repositories / smith

smith

There are many coding harnesses - but this one is fast

owned by bugabinga

Pin the two open spec boundary decisions

61f6577c79e6e3c217e65d73e37398874efe9459

Oliver Jan Krylow <oliver@bugabinga.net> ·

SSH signature · not checked

Browse filesCompare with HEAD

Two owner questions were blocking implementation: signed thinking metadata had no StreamFn path, and public API exceptions had no enforceable representation.

The spec now puts signed-thinking metadata on ThinkingDelta and records implementation-module public API exceptions in a single table that xtask arch can enforce.

Surface touched: SPEC §2.2 and §5.2-§5.4.

Changed files (1)

+30 / −2 text lines

Diff layout

docs/SPEC.md

Modified

+30 / −2 text lines

134134- `mod.rs` containing anything except module declarations and re-exports.
135135- Public API leaking from implementation modules unless explicitly listed here.
137Implementation-module public API exceptions are declared only in this table. An
138exception names the crate, the implementation-module path, the exact public
139symbols allowed there, and the reason the symbol cannot live at the crate root or
140in a dedicated public API module. An empty table means no exceptions.
142| Crate | Implementation module | Allowed public symbols | Reason |
143|---|---|---|---|
144| _none_ | _none_ | _none_ | _none_ |
146Crate roots and dedicated public API modules may declare public API normally.
147Every other public item under an implementation module must either be private to
148its crate or appear in the exception table above.
137150Architecture gates:
139152- `cargo run -p xtask -- arch` checks stable Cargo metadata and source
140 invariants not covered by pup.
153 invariants not covered by pup, including the implementation-module exception
154 table above: any public item in an implementation module that is absent from
155 the table fails the gate with crate, module path, and symbol name.
141156- `cargo run -p xtask -- pup` runs `cargo +nightly-2026-01-22 pup`.
142157- `cargo run -p xtask -- print-modules` prints crate roots from Cargo metadata
143158 plus cargo-pup submodule output.
465480- `ThinkingLevel`: `Off`, `Minimal`, `Low`, `Medium`, `High`, `XHigh`.
466481- `ProviderEvent`:
467482 - `TextDelta { text }`,
468 - `ThinkingDelta { text }`,
483 - `ThinkingDelta { text, provider_metadata? }` — `provider_metadata` is
484 opaque, optional, and attached by the provider adapter to the delta whose
485 thinking text it authenticates,
469486 - `ToolCall { id, name, arguments }` — assembled and complete; partial
470487 argument chunks are joined at the provider boundary (§7.2),
471488 - `Done { usage, stop_reason }`,
484501- `AgentTool` is async and `Send + Sync`.
485502- `ToolExecutionMode`: sequential or parallel according to tool metadata.
486503- `AgentToolResult` returns content blocks, error flag, and optional updates.
504- Tool updates are v1 completion metadata: `AgentToolUpdate` values are surfaced
505 in the final `AgentToolResult`, not streamed live while the tool runs.
487506- Tool arguments are JSON and validated with `jsonschema`.
489508### 5.4 StreamFn
497516This permits `smith-core` and `smith-ai` to build independently.
518The agent loop assembles consecutive `ThinkingDelta` events into a
519`ContentBlock::Thinking`. It concatenates `text` in arrival order and carries
520forward every non-empty `provider_metadata` value into the assembled block. If a
521provider emits more than one metadata value for one assembled thinking block,
522the block stores them in arrival order inside the opaque metadata payload;
523Smith still never interprets them. This is the only route by which signed
524thinking metadata crosses the `StreamFn` boundary and becomes available for
525provider replay (§7.2).
499527### 5.5 Lua Runtime
501529`LuaRuntime` wraps mlua + LuaJIT + `mlua-pkg` custom require.