diff options
| author | t <t@tjp.lol> | 2026-06-07 11:42:41 -0600 |
|---|---|---|
| committer | t <t@tjp.lol> | 2026-06-07 11:42:41 -0600 |
| commit | 11818552dad254649af012df3b4277633943d2b6 (patch) | |
| tree | 88c60f54b0a71d92adb4b09c7ff984080b5d86ac /src/system_prompt.zig | |
| parent | 457ee6a0d56c5a0470e77fca79d3e85f65f51fec (diff) | |
Migrate panto CLI onto the public.zig surface
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.
Diffstat (limited to 'src/system_prompt.zig')
| -rw-r--r-- | src/system_prompt.zig | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/system_prompt.zig b/src/system_prompt.zig index d8c06bb..500b135 100644 --- a/src/system_prompt.zig +++ b/src/system_prompt.zig @@ -249,7 +249,7 @@ pub fn resolveCompactionLayers( /// seed sequence). Returned slices borrow from `messages`. fn effectiveConfigWindow( arena: Allocator, - messages: []const panto.conversation.Message, + messages: []const panto.Message, ) ![]const []const u8 { // Find the index of the last message carrying a `replace`-mode block. var anchor: ?usize = null; @@ -462,9 +462,9 @@ const TmpLayers = struct { } }; -fn openTmpStore(arena: Allocator, root: []const u8) !panto.session_manager.FileSystemJSONLStore { +fn openTmpStore(arena: Allocator, root: []const u8) !panto.FileSystemJSONLStore { const sessions = try std.fs.path.join(arena, &.{ root, "sessions" }); - return panto.session_manager.FileSystemJSONLStore.init(testing.allocator, testing.io, sessions, "/cwd"); + return panto.FileSystemJSONLStore.init(testing.allocator, testing.io, sessions, "/cwd"); } /// Minimal agent harness for system-prompt tests: a throwaway provider @@ -472,12 +472,12 @@ fn openTmpStore(arena: Allocator, root: []const u8) !panto.session_manager.FileS /// store). Post-R1 the agent owns its own (empty) tool registry, so the /// harness only holds the config to keep the agent's borrowed pointer valid. const SPAgentHarness = struct { - config: panto.config.Config, + config: panto.Config, agent: panto.agent.Agent, fn init( self: *SPAgentHarness, - session: panto.session_store.Session, + session: panto.Session, adopted: ?panto.conversation.Conversation, ) void { self.config = .{ @@ -499,8 +499,8 @@ fn forceFlush(agent: *panto.agent.Agent) !void { var conv = panto.conversation.Conversation.init(testing.allocator); defer conv.deinit(); try conv.addAssistantMessage(&.{}); - const id: panto.session_store.WireIdentity = .{ .api_style = .openai_chat, .base_url = "u", .model = "m" }; - var batch = [_]panto.session_store.PersistentMessage{ + const id: panto.WireIdentity = .{ .api_style = .openai_chat, .base_url = "u", .model = "m" }; + var batch = [_]panto.PersistentMessage{ .{ .message = conv.messages.items[0], .identity = id }, }; try agent.session.append(&batch); @@ -537,7 +537,7 @@ test "seedFresh then no-config-change resume is a no-op" { // The persisted conversation reflects the seeded system prompt. var conv_disk = (try store.load(session_id)).?; - const eff_disk = try panto.conversation.effectiveSystemBlocks(arena, conv_disk.messages.items); + const eff_disk = try panto.effectiveSystemBlocks(arena, conv_disk.messages.items); const seeded_count = eff_disk.items.len; conv_disk.deinit(); try testing.expect(seeded_count > 0); @@ -550,7 +550,7 @@ test "seedFresh then no-config-change resume is a no-op" { h2.init(sess2, conv2); defer h2.deinit(); try reconcileResumeLayers(arena, testing.io, null, null, project_dir, &h2.agent); - const eff_after = try panto.conversation.effectiveSystemBlocks(arena, h2.agent.conversation.messages.items); + const eff_after = try panto.effectiveSystemBlocks(arena, h2.agent.conversation.messages.items); try testing.expectEqual(seeded_count, eff_after.items.len); } @@ -593,7 +593,7 @@ test "resume after config change appends replace + append sequence" { try reconcileResumeLayers(arena, testing.io, null, null, project_dir, &h2.agent); // The effective prompt now reflects only the new config blocks. - const eff = try panto.conversation.effectiveSystemBlocks(arena, h2.agent.conversation.messages.items); + const eff = try panto.effectiveSystemBlocks(arena, h2.agent.conversation.messages.items); try testing.expectEqual(@as(usize, 2), eff.items.len); try testing.expectEqualStrings("new seed", eff.items[0]); try testing.expectEqualStrings("new append", eff.items[1]); @@ -601,7 +601,7 @@ test "resume after config change appends replace + append sequence" { // A second no-op resume must not change the effective prompt (anchors // to the new `replace` window, not the stale original seed). try reconcileResumeLayers(arena, testing.io, null, null, project_dir, &h2.agent); - const eff2 = try panto.conversation.effectiveSystemBlocks(arena, h2.agent.conversation.messages.items); + const eff2 = try panto.effectiveSystemBlocks(arena, h2.agent.conversation.messages.items); try testing.expectEqual(@as(usize, 2), eff2.items.len); } |
