docs: update toolsrv architecture references

This commit is contained in:
Ollie Agent 2026-08-16 15:02:35 +02:00
parent 1d2d5053ab
commit 11f2137ce4
1 changed files with 6 additions and 6 deletions

View File

@ -25,9 +25,9 @@ ollie/ ← you are here
│ ├── toolsrv/ Sandboxed tool execution server
│ │ └── internal/
│ │ ├── exec/ Tool execution
│ │ ├── fs/ toolsrv 9P namespace
│ │ ├── registry/ Per-agent tool registry
│ │ └── sandbox/ Landlock configuration and enforcement
│ │ ├── sandbox/ Landlock configuration and enforcement
│ │ └── server/ Namespace specification and process state
│ └── ollie-9p/ 9P client CLI
├── tools/ Compiled tool implementations
│ ├── codeintel/ Tree-sitter code-intelligence tools
@ -75,7 +75,7 @@ just install-el # Emacs frontend
just test # core and lib9p tests
just test-core # cmd/olliesrv, cmd/toolsrv, shared packages, and toolsrv tests
just test-9p # lib9p tests
just test-remote # build-check toolsrv remote package
just test-remote # build-check toolsrv (`go build ./cmd/toolsrv/...`)
just clean # remove build artifacts
```
Requires [just](https://github.com/casey/just): `cargo install just`.
@ -104,17 +104,17 @@ For direct Go testing, use the packages covered by `just test-core` and `just te
3. **Agent loop** (`cmd/olliesrv/internal/agent/loop.go` and `turn.go`): Stream an LLM response, parse native or text tool calls, execute tools, update history, and repeat until a final response, cancellation, or a configured limit. It includes transient retries, context-overflow compaction, error/stall/replan controls, and tool-result caching.
4. **Dynamic tools**: Tools are external executables described by `.meta` files. `toolsrv` owns discovery and per-agent registries. `olliesrv` refreshes the registry, injects common dispatch flags (`bypass`, `timeout`, `sandbox`, `background`), and calls tools through `toolsrv.Conn`.
5. **Parallel and background dispatch**: Non-conflicting tool calls in one turn run concurrently. Metadata scopes schedule `read`, `write`, and global operations; shell-like global operations serialize. Any tool may run in the background, producing a process ID whose output is injected when the process changes or exits.
6. **Sandbox** (`cmd/toolsrv/internal/sandbox/`): Landlock/landrun policies control filesystem and network access. The installed `sandbox.yaml` is sourced from `cmd/toolsrv/internal/sandbox/sandbox.yaml`. The bypass broker provides policy-controlled escape requests, approval, persistence, and rate limiting.
6. **Sandbox** (`cmd/toolsrv/internal/sandbox/`): Landlock/landrun policies control filesystem and network access. The installed `sandbox.yaml` is sourced from `cmd/toolsrv/internal/sandbox/sandbox.yaml`. The toolsrv namespace and process state live under `cmd/toolsrv/p9.go` and `cmd/toolsrv/internal/server/`. The bypass broker provides policy-controlled escape requests, approval, persistence, and rate limiting.
7. **Backends** (`cmd/olliesrv/internal/backend/`): Supported names are `ollama`, `openai`, `openrouter`, `anthropic`, `copilot`, `kiro`, and `gemini`. Configuration is read from `~/.config/ollie/backends.conf`; environment variables are fallback inputs.
8. **Prompt assembly**: `cmd/olliesrv/internal/prompts/system_prompt.md` is embedded as the default system prompt. An agent's `systemPrompt` can override it with a filesystem path. `prompt` and `userPrompts` entries resolve files, expand environment variables, and support legacy `!command` entries. The runtime combines system, environment, agent, and tool sections.
9. **Context management**: History tracks messages, usage, costs, cache statistics, and structured task state. Cold/warm/hot result tiers and automatic compaction preserve recent context while summarizing older material.
10. **Sub-agents**: `subagent_spawn` creates a transient child session with an independent runtime and context. The child receives a one-time parent-history snapshot and returns only its final reply. Parent/child IDs are retained for tracing; concurrent children are supported.
11. **9P namespace declaration**: `cmd/olliesrv/internal/fs/spec.go` and `cmd/toolsrv/internal/fs/spec.go` declare the namespaces with the `virtfs` EDSL. `virtfs.BuildTree()` validates and constructs the trees; handlers are defined inline in the specs.
11. **9P namespace declaration**: `cmd/olliesrv/internal/fs/spec.go` declares the olliesrv namespace. The toolsrv namespace is declared by `cmd/toolsrv/p9.go` using `cmd/toolsrv/internal/server.Spec`; process state and handlers are in `cmd/toolsrv/internal/server/`. Both use the `virtfs` EDSL and `virtfs.BuildTree()`.
## Key Files
| What | Where |
|------|-------|
| 9P namespace (olliesrv) | `cmd/olliesrv/internal/fs/spec.go` |
| 9P namespace (toolsrv) | `cmd/toolsrv/internal/fs/spec.go` |
| 9P namespace (toolsrv) | `cmd/toolsrv/p9.go`, `cmd/toolsrv/internal/server/server.go` |
| virtfs EDSL | `virtfs/decl.go`, `virtfs/builder.go` |
| Agent loop and dispatch | `cmd/olliesrv/internal/agent/loop.go`, `turn.go` |
| Runtime and prompt assembly | `cmd/olliesrv/internal/agent/runtime.go`, `prompt_resolver.go` |