diff options
| author | T <t@tjp.lol> | 2026-04-26 11:09:37 -0600 |
|---|---|---|
| committer | T <t@tjp.lol> | 2026-05-25 11:48:47 -0700 |
| commit | 52b2ca78aed7950af27d4865aee65da781514a99 (patch) | |
| tree | 24f512e67afd677b6c0d8a8064819e8f5332d28d /docs/phase-1.md | |
| parent | d3d5a6295a67bdc99e35e5bfd77359d98a850c3f (diff) | |
Initial work, and name change to pantograph
Diffstat (limited to 'docs/phase-1.md')
| -rw-r--r-- | docs/phase-1.md | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/docs/phase-1.md b/docs/phase-1.md index d9a8450..8acaf42 100644 --- a/docs/phase-1.md +++ b/docs/phase-1.md @@ -1,4 +1,4 @@ -# Phase 1: libawl — Minimal Chat Library +# Phase 1: libpanto — Minimal Chat Library ## Goal @@ -6,9 +6,9 @@ A Zig library that can hold a streaming conversation with an LLM via an OpenAI-c ## Deliverable -A `libawl` Zig module importable by other Zig code, plus a `awl` binary that wires it into a basic read/print loop. At the end of this phase, you can: +A `libpanto` Zig module importable by other Zig code, plus a `panto` binary that wires it into a basic read/print loop. At the end of this phase, you can: -- Start `awl`, type a message, and receive a streamed response from an OpenAI-compatible LLM. +- Start `panto`, type a message, and receive a streamed response from an OpenAI-compatible LLM. - Send follow-up messages that include full conversation history. - See thinking tokens and text tokens stream in as they arrive. - Have the complete conversation available in memory for the duration of the session. @@ -17,7 +17,7 @@ A `libawl` Zig module importable by other Zig code, plus a `awl` binary that wir | Capability | How to exercise it | |---|---| -| Open a conversation | `awl.conversation.Conversation.init(allocator)` | +| Open a conversation | `libpanto.conversation.Conversation.init(allocator)` | | Add a user message | `conversation.addUserMessage("hello")` | | Run an agent step (streaming) | `agent.runStep(conversation, &receiver)` | | See streamed output | CLI prints thinking/text chunks as they arrive | @@ -91,7 +91,7 @@ The `input` field of `ToolUse` is stored as raw JSON bytes (`[]const u8`) rather `ToolUse` blocks also stream incrementally — both providers send tool input as JSON fragments across multiple deltas. Therefore `ToolUse.input` also uses `TextualBlock` for assembly. `id` and `name` arrive at block-start time and are stored as owned `[]const u8` copies. -`ToolResult` blocks are constructed by `awl` itself (not streamed from a provider), so `content` could be a simple `[]const u8`. However, for consistency and to allow progressive construction of results, it also uses `TextualBlock`. +`ToolResult` blocks are constructed by `pantograph` itself (not streamed from a provider), so `content` could be a simple `[]const u8`. However, for consistency and to allow progressive construction of results, it also uses `TextualBlock`. Updated types: ``` @@ -216,7 +216,7 @@ BlockMeta = struct { - Callbacks are always invoked in this order for every block, regardless of which provider is active. - `onMessageStart` is called when the stream begins delivering a new message. - `onBlockStart` is called when a new content block begins. `meta` carries block-type-specific metadata (tool id/name for ToolUse, null for Text/Thinking). -- `onContentDelta` is called zero or more times per block with raw byte fragments. For Text/Thinking these are word fragments; for ToolUse these are JSON fragments. The receiver does not need to interpret them. `delta` is a `[]const u8` — libawl does not parse tool input content, it passes bytes through. +- `onContentDelta` is called zero or more times per block with raw byte fragments. For Text/Thinking these are word fragments; for ToolUse these are JSON fragments. The receiver does not need to interpret them. `delta` is a `[]const u8` — libpanto does not parse tool input content, it passes bytes through. - `onBlockComplete` is called when a block is finished. The `block` parameter contains the fully assembled ContentBlock. The receiver that only needs complete content can ignore deltas and use this. - `onMessageComplete` is called when the stream ends. The `message` parameter contains the fully assembled Message with all blocks. - Providers guarantee that `onBlockComplete`'s `block` and `onMessageComplete`'s `message` are always fully assembled and valid. @@ -334,7 +334,7 @@ Config = struct { }; ``` -Populated from environment variables (`AWL_API_KEY`, `AWL_BASE_URL`, `AWL_MODEL`) with defaults for base_url and model. +Populated from environment variables (`PANTO_API_KEY`, `PANTO_BASE_URL`, `PANTO_MODEL`) with defaults for base_url and model. ### `root.zig` @@ -403,19 +403,19 @@ The `finish_reason: "stop"` signals stream end → emit onBlockComplete for any ## Minimal CLI ``` -awl/ +panto/ src/ main.zig // CLI entry point ``` Behavior: -1. Read `AWL_API_KEY`, `AWL_BASE_URL`, `AWL_MODEL` from environment +1. Read `PANTO_API_KEY`, `PANTO_BASE_URL`, `PANTO_MODEL` from environment 2. Create a Conversation, add a system message (default: "You are a helpful assistant.") 3. Print a prompt (`> `), read a line from stdin 4. Add user message, call `agent.runStep()`, print streamed deltas to stdout 5. Repeat step 3 until EOF (Ctrl+D) -There is no line editing, no scrolling, no syntax highlighting. Just `readline` → `print`. The sole purpose is exercising libawl against a real API. +There is no line editing, no scrolling, no syntax highlighting. Just `readline` → `print`. The sole purpose is exercising libpanto against a real API. --- @@ -432,7 +432,7 @@ There is no line editing, no scrolling, no syntax highlighting. Just `readline` ### Integration test (manual) -- Run `awl` binary with a real API key +- Run `panto` binary with a real API key - Hold a multi-turn conversation - Verify responses stream to stdout - Verify follow-up messages include prior context (ask the model "what did I just say?") |
