Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions rust/contracts/rust-core-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -509,9 +509,12 @@ or removing a command fails until the table changes in the same commit.
| `agentLibrary.apply` | Apply one library change the user chose to one agent's configuration, backing up the configuration or instruction file it replaces first; an instruction `write` changes only Lithe's block and needs `replace` over an edited one, and `import` moves the user's own text outside the block into a new or existing set at the library revision read, leaving only the block, and answers `{changed, revision, instructions}` |
| `agentLibrary.importSkill` | Copy a skill from an agent or a directory the user chose into the library |
| `agentLibrary.removeSkill` | Remove a library skill and its links from agents |
| `agentProviders.read` | Read each agent's model, model providers, profiles and account label through its plugin, with a key reported only as `keySet` and other secrets as variable names; adds the providers Lithe saved (`listKeptBy: "lithe"`) and the agent's `backup: {savedAtMs, modifiedSince}` |
| `agentProviders.apply` | Apply one model, provider or profile change the plugin declares, through a checked staged copy of the agent's file backed up first; `addProvider`/`updateProvider` may carry a write-only `key` (or `clearKey`), handed only to the plugin's `edit` |
| `agentProviders.read` | Read each agent's model, model providers, profiles and account label through its plugin, with a key reported only as `keySet` and other secrets as variable names; adds the providers Lithe saved (`listKeptBy: "lithe"`) and the agent's `backup: {savedAtMs, modifiedSince}`; always answers `models`, the models the plugin lists (none when it lists none), each with `shown`, beside the `efforts`, `speeds`, `effort` and `speed` it reports |
| `agentProviders.apply` | Apply one model, provider or profile change the plugin declares, through a checked staged copy of the agent's file backed up first; `addProvider`/`updateProvider` may carry a write-only `key` (or `clearKey`), handed only to the plugin's `edit`; `setModel` (which may carry `effort` and `speed`), `setEffort` and `setSpeed` are refused with `unknownModel`, `unknownEffort`, `unknownSpeed` or `unsupportedCombination` when the listed models do not take them, and `setModelMenu` is Core's own |
| `agentProviders.restore` | Put every file of any configurable agent, with or without providers, back as it was before Lithe's first change since the last restore, whether `agentProviders.apply` or `agentLibrary.apply` changed it, and forget what Core last wrote to a restored instruction file and stop the agent following the library's instructions (`unfollowed`); refused when a file changed after Lithe's last write unless `discardLaterChanges` |
| `agentProviders.showModels` | Show or hide listed models of an agent in Lithe's pickers (user requests only), keeping the hidden ones in `models.json` in the library directory; when the plugin declares `setModelMenu`, also has it write the shown models into the CLI's own model menu, putting the switches back when it fails; answers `{changed}` |
| `agentProviders.readModelSettings` | Read an agent's model settings as one group, `{settings: {hidden, model?, effort?, speed?}}`, for saving as a plan |
| `agentProviders.applyModelSettings` | Write a group from `agentProviders.readModelSettings` back (user requests only): checks every model, effort and speed change first and changes nothing when one is refused, then makes them, replaces the hidden models and has the CLI's menu follow; answers `{changed}` |
| `plugins.declarative.validate` | Validate and normalize a declarative plugin manifest |
| `plugins.ui.applyResult` | Check a backend result for a plugin view and return the whole view to draw |
| `plugins.web.open` | Register a plugin page for a web tool window |
Expand Down
3 changes: 3 additions & 0 deletions rust/crates/agent-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ impl Runtime {
"agentProviders.read" => self.library.read_providers(self, payload),
"agentProviders.apply" => self.library.apply_providers(self, payload),
"agentProviders.restore" => self.library.restore_backup(self, payload),
"agentProviders.showModels" => self.library.show_models(self, payload),
"agentProviders.readModelSettings" => self.library.read_model_settings(self, payload),
"agentProviders.applyModelSettings" => self.library.apply_model_settings(self, payload),
_ => Err(CoreError::new(
ErrorCode::NotSupported,
format!("Unknown agent command {command}."),
Expand Down
9 changes: 7 additions & 2 deletions rust/crates/agent-runtime/src/library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
//! `library.json` holds the servers, hooks and instruction sets,
//! `skills/<name>/` holds one directory per skill, `state.json` records what
//! Core last wrote to each agent's instruction file, `staging/` holds the
//! copies plugins edit, and `backups/` the agents' files as they were before
//! Lithe changed them (`backups` module).
//! copies plugins edit, `backups/` the agents' files as they were before
//! Lithe changed them (`backups` module), `saved-providers.json` the
//! providers Lithe keeps for an agent whose CLI holds one endpoint, and
//! `models.json` the models the user hid from Lithe's pickers
//! (`providers` module).
//!
//! What an agent has is read from the agent's own files every time and never
//! kept. An agent plugin declares where they are (`configuration` in the
Expand Down Expand Up @@ -120,6 +123,8 @@ pub(crate) struct Library {
/// Held while a change checks and replaces a file, so two changes never
/// interleave. Never held across a backend call.
writing: Mutex<()>,
/// The models each agent's plugin last listed.
catalogs: providers::Catalogs,
}

// ---------------------------------------------------------------------------
Expand Down
Loading
Loading