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
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ node --test scripts/rust-core/*.test.mjs # CI 脚本自己的
cargo test --manifest-path rust/Cargo.toml -p lithe-platform -p lithe-platform-tests # 在 macOS 或 Windows 上运行平台测试
```

手边没有 Windows 时,至少运行一次 `LIBSQLITE3_SYS_USE_PKG_CONFIG=1 cargo clippy --manifest-path rust/Cargo.toml --workspace --all-targets --target x86_64-pc-windows-msvc -- -D warnings`,确认 Windows 代码能编译。环境变量让 SQLite 改为链接系统库、不编译自带的 C 源码:编译它需要 MSVC 工具,macOS 和 Linux 上没有;clippy 只检查不链接,不受影响。
手边没有 Windows 时,至少运行一次 `LIBSQLITE3_SYS_USE_PKG_CONFIG=1 ZSTD_SYS_USE_PKG_CONFIG=1 PKG_CONFIG_ALLOW_CROSS=1 cargo clippy --manifest-path rust/Cargo.toml --workspace --all-targets --target x86_64-pc-windows-msvc -- -D warnings`,确认 Windows 代码能编译。前两个环境变量让 SQLite 和 zstd(插件市场经 `zstd` crate 依赖它)改为链接系统库、不编译自带的 C 源码:编译它们需要 MSVC 工具和 Windows 头文件,macOS 和 Linux 上没有;第三个允许交叉目标使用 pkg-config。clippy 只检查不链接,不受影响。本机要装有 SQLite 和 zstd 的 pkg-config 文件(macOS 用 Homebrew 的 `sqlite`、`zstd`)。

---

Expand Down Expand Up @@ -132,4 +132,4 @@ node --test scripts/rust-core/*.test.mjs # the CI scripts' own
cargo test --manifest-path rust/Cargo.toml -p lithe-platform -p lithe-platform-tests # platform tests on macOS or Windows
```

Without a Windows host, at least run `LIBSQLITE3_SYS_USE_PKG_CONFIG=1 cargo clippy --manifest-path rust/Cargo.toml --workspace --all-targets --target x86_64-pc-windows-msvc -- -D warnings` to confirm the Windows code compiles. The variable makes SQLite link a system library instead of compiling its bundled C source, which needs the MSVC tools that macOS and Linux do not have; clippy only checks and never links, so this does not matter.
Without a Windows host, at least run `LIBSQLITE3_SYS_USE_PKG_CONFIG=1 ZSTD_SYS_USE_PKG_CONFIG=1 PKG_CONFIG_ALLOW_CROSS=1 cargo clippy --manifest-path rust/Cargo.toml --workspace --all-targets --target x86_64-pc-windows-msvc -- -D warnings` to confirm the Windows code compiles. The first two variables make SQLite and zstd (which the plugin marketplace reaches through the `zstd` crate) link a system library instead of compiling their bundled C sources, which need the MSVC tools and Windows headers that macOS and Linux do not have; the third lets pkg-config answer for a cross target. Clippy only checks and never links, so this does not matter. The machine needs pkg-config files for SQLite and zstd (Homebrew's `sqlite` and `zstd` on macOS).
1 change: 1 addition & 0 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions rust/contracts/rust-core-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -504,9 +504,10 @@ 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 and what each configurable agent's instructions, skills, MCP servers and hooks hold, with the agent's `backup: {savedAtMs, modifiedSince}` while Core keeps one; 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), 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.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.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.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 |
| `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 |
Expand Down
3 changes: 2 additions & 1 deletion rust/crates/agent-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ description = "Agent CLI sessions Core runs for agent plugins (plan API-45): the
publish = false

[dependencies]
base64 = "0.22"
lithe-agent-sessions = { path = "../agent-sessions" }
lithe-diagnostics = { path = "../diagnostics" }
lithe-lsp-engine = { path = "../lsp-engine" }
Expand All @@ -19,7 +20,7 @@ lithe-protocol = { path = "../protocol" }
lithe-request-context = { path = "../request-context" }
lithe-workspace = { path = "../workspace" }
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0", features = ["raw_value"] }
serde_json = { version = "1.0", features = ["preserve_order", "raw_value"] }
sha2 = "0.10"
url = "2.5"

Expand Down
1 change: 1 addition & 0 deletions rust/crates/agent-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ impl Runtime {
"agentLibrary.configure" => self.library.configure(payload),
"agentLibrary.read" => self.library.read(self, payload),
"agentLibrary.save" => self.library.save(self, payload),
"agentLibrary.parseServers" => self.library.parse_servers(payload),
"agentLibrary.apply" => self.library.apply(self, payload),
"agentLibrary.importSkill" => self.library.import_skill(self, payload),
"agentLibrary.removeSkill" => self.library.remove_skill(self, payload),
Expand Down
Loading