repositories / smith

smith

There are many coding harnesses - but this one is fast

owned by bugabinga

fix(specs): pi + catwalk → pi.dev + catwalk; remove unreachable HookResult::Block

ad22efacd83cd3ddbedd114f3dc29749b5a3d72b

HallucyGenie Agent <agent@hallucygenie.local> ·

SSH signature · not checked

Browse filesCompare with HEAD

Changed files (3)

+13 / −19 text lines

Diff layout

docs/AI-CRATE-DESIGN.md

Modified

+5 / −5 text lines

1313### Location
1414- Bundled at compile time: `smith-ai/src/providers.json`
15- Generated by `xtask fetch-providers` from pi + catwalk repos
15- Generated by `xtask fetch-providers` from pi.dev + catwalk
1717### Structure
231231// xtask/src/fetch_providers.rs
233233pub fn fetch_providers() -> Result<()> {
234 // 1. Fetch from pi repo
234 // 1. Fetch from pi.dev
235235 let pi_models = fetch_pi_models()?;
237237 // 2. Fetch from catwalk repo
287287### Initial Providers
289All providers from pi + catwalk:
290- **pi providers**: anthropic, openai, google, mistral, amazon-bedrock, google-vertex, google-gemini-cli, azure-openai, openai-codex, github-copilot, xai, groq, cerebras, openrouter, vercel-ai-gateway, zai, minimax, huggingface, opencode, kimi-coding
289All providers from pi.dev + catwalk:
290- **pi.dev providers**: anthropic, openai, google, mistral, amazon-bedrock, google-vertex, google-gemini-cli, azure-openai, openai-codex, github-copilot, xai, groq, cerebras, openrouter, vercel-ai-gateway, zai, minimax, huggingface, opencode, kimi-coding
291291- **catwalk providers**: openrouter, huggingface, and OpenAI-compatible APIs
293293## TODO
299299- [ ] ~~Implement xtask fetch command~~ — tracked in SM-007 Steps
300300- [ ] ~~Implement model registry~~ — tracked in SM-007 Steps
301301- [ ] ~~Implement auth resolvers~~ — tracked in SM-007 Steps
302- [ ] ~~Implement all providers from pi + catwalk~~ — tracked in SM-007 Steps
302- [ ] ~~Implement all providers from pi.dev + catwalk~~ — tracked in SM-007 Steps

docs/spec-sm-006-core.md

Modified

+4 / −10 text lines

88The agent loop takes a `StreamFn` (from smith/) — it never imports provider types.
99This enables parallel builds: smith-core and smith-ai build simultaneously.
11**Architecture:** Follows pi's `pi-agent-core` pattern, but uses dependency inversion
11**Architecture:** Follows pi's agent pattern, but uses dependency inversion
1212via `StreamFn` instead of importing provider types directly.
1414## Key Design Decision
130130 pub convert_to_llm: Box<dyn Fn(Vec<Message>) -> Vec<Message> + Send + Sync>,
131131 pub transform_context: Option<Box<dyn Fn(Vec<Message>) -> Vec<Message> + Send + Sync>>,
132132 pub get_api_key: Option<Box<dyn Fn(&str) -> Option<String> + Send + Sync>>,
133 pub before_tool_call: Option<Box<dyn Fn(&str, &serde_json::Value) -> Option<HookResult> + Send + Sync>>,
134133 pub after_tool_call: Option<Box<dyn Fn(&str, &AgentToolResult) -> Option<AgentToolResult> + Send + Sync>>,
178177 - ThinkingDelta → emit AgentEvent::ThinkingDelta
179178 - Done → finalize assistant message, execute queued tools
1801796. For each tool call:
181 a. before_tool_call hook (can block)
182 b. Execute tool (AgentTool::execute)
183 c. after_tool_call hook (can modify result)
184 d. Add tool result to messages
180 a. Execute tool (AgentTool::execute)
181 b. after_tool_call hook (can modify result)
182 c. Add tool result to messages
1851837. If stop_reason == ToolUse, goto 1 (next turn)
1861848. If stop_reason == EndTurn, emit AgentEnd
187185```
356354pub enum HookResult {
357355 Pass,
358 Block { reason: String },
359356 Modify { data: serde_json::Value },
361358```
504501 - Mock StreamFn returns ToolCall + Done
505502 - Agent executes tool, adds result, loops again
506503 - Second loop returns EndTurn
507- **Agent loop with blocked tool**
508 - before_tool_call returns Block
509 - Tool not executed, error result added
510504- **Session creation and entry addition**
511505- **Session fork creates correct tree**
512506- **SecretProxy hides and restores secrets**

docs/spec-sm-011-workspace.md

Modified

+4 / −4 text lines

@@ -10,7 +10,7 @@ Key Design Decisions
1010## Key Design Decisions
1212xTasks must include:
13- `fetch-providers` — fetch from pi + catwalk, generate providers.json
13- `fetch-providers` — fetch from pi.dev + catwalk, generate providers.json
1414- `doc-test` — extract @usage + guide code blocks, run in Lua VM
1515- `verify-docs` — completeness checks (every API has docs)
1616- `doc-gen` — generate man pages + docs bundle from annotations
@@ -70,7 +70,7 @@ 2. xtask Structure
7070├── Cargo.toml
7171└── src/
7272 ├── main.rs
73 ├── fetch_providers.rs — fetch from pi + catwalk
73 ├── fetch_providers.rs — fetch from pi.dev + catwalk
7474 ├── doc_test.rs — extract + run code blocks
7575 ├── verify_docs.rs — completeness checks
7676 └── doc_gen.rs — generate man pages + docs bundle
@@ -90,11 +90,11 @@ 4. `fetch_providers.rs`
9090### 4. `fetch_providers.rs`
9292```rust
93/// Fetch provider data from pi repo and catwalk repo
93/// Fetch provider data from pi.dev and catwalk
9494/// Merge/deduplicate
9595/// Generate smith-ai/src/providers.json
9696pub fn fetch_providers() -> Result<()> {
97 // 1. Fetch pi's models.generated.js → parse models
97 // 1. Fetch pi.dev's models.generated.js → parse models
9898 let pi_models = fetch_pi_models()?;
100100 // 2. Fetch catwalk provider configs → parse models