<feed xmlns='http://www.w3.org/2005/Atom'>
<title>pantograph.git/docs/libpanto-cleanup.md, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<id>https://code.tjp.lol/pantograph.git/atom?h=main</id>
<link rel='self' href='https://code.tjp.lol/pantograph.git/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://code.tjp.lol/pantograph.git/'/>
<updated>2026-06-08T18:25:55Z</updated>
<entry>
<title>tui plan</title>
<updated>2026-06-08T18:25:55Z</updated>
<author>
<name>t</name>
<email>t@tjp.lol</email>
</author>
<published>2026-06-08T04:36:06Z</published>
<link rel='alternate' type='text/html' href='https://code.tjp.lol/pantograph.git/commit/?id=a5881243f9bb4642f90fa94179f7a5bff23e4657'/>
<id>urn:sha1:a5881243f9bb4642f90fa94179f7a5bff23e4657</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Sync Agent/Stream internals to public names; alias Stream</title>
<updated>2026-06-07T21:19:57Z</updated>
<author>
<name>t</name>
<email>t@tjp.lol</email>
</author>
<published>2026-06-07T21:19:57Z</published>
<link rel='alternate' type='text/html' href='https://code.tjp.lol/pantograph.git/commit/?id=eb4179f9958deeae408a0a06b1f8ae6437e089db'/>
<id>urn:sha1:eb4179f9958deeae408a0a06b1f8ae6437e089db</id>
<content type='text'>
Push the API-shaping we'd done in the public facade down into the internal
types, collapsing the wrappers:

- Stream: rename phase-&gt;state, Phase-&gt;State; underscore-prefix the internal
  fields (_agent/_queue/_response/_start/_persisted/_pending_error). state
  is the one intended-public field. public.zig now aliases Stream; run
  returns *Stream.
- Agent compaction: pure transform compact()-&gt;private _compactInPlace;
  compactAndPersist()-&gt;compact() (the public name, persists).
- Agent system prompt: addSystemMessage(text,mode) split into
  addSystemMessage(text) + setSystemPrompt(text) over a private
  _persistSystemMessage.
- UserMessage moved off Agent to module scope.
- Underscore-prefix pure-internal Agent fields: _open_stream_fn,
  _auto_compacted, _retry_prng.

The Agent facade is now pure 1:1 forwarders; it stays a wrapper only because
init heap-pins the inner (copyable, move-safe handle) and conversation()/
sessionId() are accessors. Conversation and Stream are plain aliases.
</content>
</entry>
<entry>
<title>Alias Conversation instead of facading it; merge addAssistantMessage</title>
<updated>2026-06-07T20:57:58Z</updated>
<author>
<name>t</name>
<email>t@tjp.lol</email>
</author>
<published>2026-06-07T20:57:58Z</published>
<link rel='alternate' type='text/html' href='https://code.tjp.lol/pantograph.git/commit/?id=17a985cb41727b8a1bca4d95f334106c09386040'/>
<id>urn:sha1:17a985cb41727b8a1bca4d95f334106c09386040</id>
<content type='text'>
A facade that forwards every method 1:1 is worse than paring the real type
down to the intended surface and aliasing it. conversation.Conversation's
interface is already the public surface we want (init/deinit, the
add*/replace* builders, and messages/allocator as plain data fields), so
public.zig now aliases it straight through and Agent.conversation() returns
a borrowed *Conversation for in-place surgery. Drops the ConversationData
alias and the pointer-wrapper.

Merged addAssistantMessageWithUsage into addAssistantMessage(blocks, ?usage)
on the real type (separate method deleted), so the alias has the intended
one-method shape; all call sites updated.

Only Agent and Stream remain true facades -- they have genuinely-internal
fields plus API-shaping renames (Stream.phase-&gt;state, Phase-&gt;State) an alias
can't express.
</content>
</entry>
<entry>
<title>Plug the deep-embedder holes; remove public.zig escape hatch</title>
<updated>2026-06-07T20:49:20Z</updated>
<author>
<name>t</name>
<email>t@tjp.lol</email>
</author>
<published>2026-06-07T20:49:20Z</published>
<link rel='alternate' type='text/html' href='https://code.tjp.lol/pantograph.git/commit/?id=1eddee33902757f7e06993825a3ad1011e7ec346'/>
<id>urn:sha1:1eddee33902757f7e06993825a3ad1011e7ec346</id>
<content type='text'>
Close the gap that forced the CLI to import internal libpanto namespaces,
then delete the transitional re-exports. The CLI now uses only the curated
public surface.

Additions to the public Agent facade:
- init/deinit (heap-pin the inner; the handle is a copyable value).
- addSystemMessage (.append) and setSystemPrompt (.replace).
- compact(override_system_prompt, extra) falling back to the config prompt.
- sessionId() accessor.

CompactionConfig gains compaction_prompt, which owns the compaction system
prompt for both auto-compaction and the explicit compact() default; the
Agent.compaction_system_prompt field is deleted. ConversationData is the
public name for the owned conversation value type (Session.load returns it,
Agent.init adopts it), distinct from the borrowed Conversation handle.

Agent.addSystemMessage/setSystemPrompt are kept on Agent (they persist with
the SystemMode) rather than dropped as the plan first proposed.
</content>
</entry>
<entry>
<title>Migrate panto CLI onto the public.zig surface</title>
<updated>2026-06-07T17:42:41Z</updated>
<author>
<name>t</name>
<email>t@tjp.lol</email>
</author>
<published>2026-06-07T17:42:41Z</published>
<link rel='alternate' type='text/html' href='https://code.tjp.lol/pantograph.git/commit/?id=11818552dad254649af012df3b4277633943d2b6'/>
<id>urn:sha1:11818552dad254649af012df3b4277633943d2b6</id>
<content type='text'>
Move the CLI off the internal libpanto module namespaces onto the curated
public API: data-type aliases (Config family, Message/MessageRole/
effectiveSystemBlocks, Event, Pricing/PricingRegistry, the session seam,
FileSystemJSONLStore, ContentBlockType), process lifecycle (panto.init/
deinit), and ResultParts.fromText/fromTextOwned/deinit in place of the
freestanding textResult/ownedTextResult/freeResultParts.

The CLI remains on two flagged internal namespaces, panto.agent and
panto.conversation: it is a deep embedder that drives the loop below the
curated Agent/Conversation facades (system-prompt seeding through the
agent, compaction_system_prompt, the open_stream_fn test seam, standalone
Conversation values, compactAndPersist). These stay re-exported from
public.zig as a documented deep-embedder escape hatch; trimming the
transitional block removed every other internal re-export.
</content>
</entry>
<entry>
<title>Add public.zig as the libpanto root; delete root.zig</title>
<updated>2026-06-07T17:39:14Z</updated>
<author>
<name>t</name>
<email>t@tjp.lol</email>
</author>
<published>2026-06-07T17:39:14Z</published>
<link rel='alternate' type='text/html' href='https://code.tjp.lol/pantograph.git/commit/?id=457ee6a0d56c5a0470e77fca79d3e85f65f51fec'/>
<id>urn:sha1:457ee6a0d56c5a0470e77fca79d3e85f65f51fec</id>
<content type='text'>
public.zig is now the sole exported root (build.zig points the panto module
at it). It defines the curated public API allowlist: behavioral facades
(Agent/Stream/Conversation wrapping a pointer to the heap-pinned internal),
the ResultParts struct, Pricing, the session seam, and data-type aliases
for the Config/Conversation/Event families.

A clearly-marked transitional block re-exports the internal module
namespaces and the freestanding result-part helpers the panto CLI still
imports directly; Phase 4 trims these as the CLI migrates onto the curated
surface. Stream.Phase is now pub so State can alias it. The refAllDecls
test contract moved from root.zig into public.zig.
</content>
</entry>
<entry>
<title>R2: redesign session store with wire-format identity</title>
<updated>2026-06-07T17:35:49Z</updated>
<author>
<name>t</name>
<email>t@tjp.lol</email>
</author>
<published>2026-06-07T17:35:49Z</published>
<link rel='alternate' type='text/html' href='https://code.tjp.lol/pantograph.git/commit/?id=b14859b9726185ab873356390068e887b7f486d3'/>
<id>urn:sha1:b14859b9726185ab873356390068e887b7f486d3</id>
<content type='text'>
Replace the single-session SessionManager seam with a directory-backed
catalog. session_manager.zig -&gt; file_system_jsonl_store.zig; the old
machinery becomes internal SessionFile, and a new FileSystemJSONLStore
implements the redesigned SessionStore vtable (create/list/resolve/latest/
load/appendMessages) minting Session/SessionInfo handles.

Session logs now record wire-format provider identity
({api_style, base_url, model, reasoning}) instead of a single provider
string or CLI aliases; no api_key material is ever stored. Disk* content
types renamed Stored*; the rich audit-oriented write record is
PersistentMessage (in-memory Message + WireIdentity + provenance).

Agent.init now takes a Session; persist_provider/persist_model display
strings deleted (banner stays alias-based, resume picks default model).
Message.metadata round-trips. Dangling-prompt recovery dropped. CLI
migrated to the catalog store for run/resume/list. Clean break, no version
bump (old logs wiped).
</content>
</entry>
<entry>
<title>lib cleanup doc</title>
<updated>2026-06-07T16:51:16Z</updated>
<author>
<name>t</name>
<email>t@tjp.lol</email>
</author>
<published>2026-06-06T18:24:37Z</published>
<link rel='alternate' type='text/html' href='https://code.tjp.lol/pantograph.git/commit/?id=032d27b18597ee3f10222963b53625208c84f571'/>
<id>urn:sha1:032d27b18597ee3f10222963b53625208c84f571</id>
<content type='text'>
</content>
</entry>
</feed>
