Skip to content
Draft
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
11 changes: 8 additions & 3 deletions rust/contracts/rust-core-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -504,12 +504,17 @@ or removing a command fails until the table changes in the same commit.
| `agentSessions.export` | Export a recorded session as Markdown of at most `maxBytes`: messages, replies, one line per tool call and their times, keeping the start or the end, in words the host passes in `labels` |
| `agentSessions.subagents` | List a recorded session's subagents, as the plugin's scan reports them, with their calls and each one's usage; empty when the plugin reports none |
| `agentLibrary.configure` | Open the agent library in the platform's application data |
| `agentLibrary.read` | Read the library `directory`, the library and what each configurable agent's instructions, skills, MCP servers and hooks hold, with the agent's `backup: {savedAtMs, modifiedSince}` while Core keeps one and its `mcpServerSupport` (the transports and server fields its plugin declares); MCP server variables and headers are `{name, valueSet}`, never a value; each server's state per agent compares what a put writes, and `stateDetails` gives the reason an item cannot be put and the server fields the agent does not keep; `found` groups the servers, hooks and skills agents hold outside the library, marking distinct copies, differences from the library and whether and from which agent each group can be imported; an agent's `instructions` is `{path, state, ownLines?}`, `state` comparing Lithe's block in the file with the library (`absent`, `noBlock`, `current`, `stale`, `edited`, `tooLarge`, `unreadable`) and `ownLines` counting the user's own lines outside it; a library saved with `active` reads as that set `on`; optional `query`, `agent` with `presence`, and `sort` add the keys of the matching items as `matches` |
| `agentLibrary.read` | Read the library `directory`, the library, its skills with the `source` of each one copied in from a folder (`{path, installedAtMs}`), and what each configurable agent's instructions, skills, MCP servers and hooks hold, with the agent's `backup: {savedAtMs, modifiedSince}` while Core keeps one and its `mcpServerSupport` (the transports and server fields its plugin declares); MCP server variables and headers are `{name, valueSet}`, never a value; each server's state per agent compares what a put writes, and `stateDetails` gives the reason an item cannot be put and the server fields the agent does not keep; `found` groups the servers, hooks and skills agents hold outside the library, marking distinct copies, differences from the library and whether and from which agent each group can be imported; an agent's `instructions` is `{path, state, ownLines?}`, `state` comparing Lithe's block in the file with the library (`absent`, `noBlock`, `current`, `stale`, `edited`, `tooLarge`, `unreadable`) and `ownLines` counting the user's own lines outside it; a library saved with `active` reads as that set `on`; optional `query`, `agent` with `presence`, and `sort` add the keys of the matching items as `matches` |
| `agentLibrary.save` | Replace the library the user edited if it is still at the revision read (instruction sets each with `on` and `agents`; `active` is refused; a server variable without a value keeps the value the library has, a renamed server naming its old name in `renamedFrom`), writing `library.json` owner-only, then write Lithe's block in the instruction file of every agent that follows the library, never over a block edited outside Lithe, and answer each agent's `written`, `unchanged`, `skipped` or `failed` with its reason in `instructions` |
| `agentLibrary.parseServers` | Read the MCP servers a pasted JSON text describes (common client shapes, comments and trailing commas allowed) into the shape `save` takes, values included, without saving; answer `{servers, problems}`, a syntax error with its line and character column and each unreadable entry with its JSON pointer and reason |
| `agentLibrary.apply` | Apply one library change the user chose to one agent's configuration, backing up the configuration or instruction file it replaces first; a server `put` writes only the fields the agent's plugin declares, values included, and is refused for a transport, variables or a switched-off server the agent cannot keep; a server `import` takes the agent's server with its values into the library at the revision read without changing the agent, answering `{changed, revision}`; 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 |
| `agentLibrary.createSkill` | Make a library skill whose `SKILL.md` holds front matter with the `name` and one-line `description` given, then `body` or a heading of the name; refuses, ignoring case, a name a library skill holds (`skillExists`) or another entry of the skills folder holds (`skillNameTaken`), and a full library; answers `{name, revision}` |
| `agentLibrary.readSkill` | Read a library skill's `SKILL.md` whole (at most 64 KiB, UTF-8) with its `revision`, the SHA-256 of the file, and list the skill's other regular files by `path` and `size` without reading them |
| `agentLibrary.writeSkill` | Replace a library skill's `SKILL.md` with the whole text the user edited if the file is still at the `revision` read, after checking its front matter (`name` the skill's, nonblank `description` of at most 1024 characters), backing the file up first; answers `{changed, revision}` |
| `agentLibrary.importSkill` | Copy a skill from an agent or a folder the user chose into the library without following any link, leaving `.git` and `.DS_Store` behind and refusing special files, under the names `createSkill` takes; a folder is recorded as the skill's source with the time and the digest of what was copied |
| `agentLibrary.checkSkillSources` | For each library skill copied in from a folder, or those `names` lists, compare the folder with what was copied (`unchanged`, `changed`, or `unavailable` with the refusal a reinstall would give) and say whether the library's copy was `edited` since; reads every file of each folder, never the network |
| `agentLibrary.reinstallSkill` | Copy a library skill again from the folder it was installed from, keeping the version it replaces with the skill's backups and putting it back when the new one cannot take its place; a copy edited in the library since needs `discardEdits` |
| `agentLibrary.removeSkill` | Remove a library skill and its links from agents, with its source record and backups |
| `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` |
Expand Down
5 changes: 5 additions & 0 deletions rust/crates/agent-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,12 @@ impl Runtime {
"agentLibrary.save" => self.library.save(self, payload),
"agentLibrary.parseServers" => self.library.parse_servers(payload),
"agentLibrary.apply" => self.library.apply(self, payload),
"agentLibrary.createSkill" => self.library.create_skill(payload),
"agentLibrary.readSkill" => self.library.read_skill(payload),
"agentLibrary.writeSkill" => self.library.write_skill(payload),
"agentLibrary.importSkill" => self.library.import_skill(self, payload),
"agentLibrary.checkSkillSources" => self.library.check_skill_sources(payload),
"agentLibrary.reinstallSkill" => self.library.reinstall_skill(payload),
"agentLibrary.removeSkill" => self.library.remove_skill(self, payload),
"agentProviders.read" => self.library.read_providers(self, payload),
"agentProviders.apply" => self.library.apply_providers(self, payload),
Expand Down
Loading