feat: add check_subsession and an exploratory read_subsession transcript reader

Split subsession inspection into two tools: check_subsession gives a quick
glance (status + latest assistant output), while read_subsession reads through
a child's transcript with role/content filters, full-content substring search
(including tool-call args), optional per-value maxChars truncation that flags
clipped parts, includeToolArgs, and pagination.

Filtering and search run on full untruncated content; truncation is an explicit,
caller-owned final projection (no default) so a narrow read never silently hides
a match. Empty page-windows are distinguished from zero-match results.
This commit is contained in:
Federico Jaramillo Martinez
2026-06-19 23:48:12 +02:00
parent 62c2234b85
commit 997b821717
9 changed files with 749 additions and 35 deletions
+3 -2
View File
@@ -960,12 +960,13 @@ describe("PiSessionService", () => {
await service.dispose();
});
it("read_subsession refuses sessions that are not the caller's children", async () => {
it("check_subsession and read_subsession refuse sessions that are not the caller's children", async () => {
const { service } = subsessionService({ allowed: true, cwd: "/workspace-feature" });
await service.start("/workspace");
await service.spawnSubsession({ spawningCwd: "/workspace", parentSessionId: "parent-1", parentSessionFile: "/tmp/parent-1.jsonl", prompt: "go", cwd: "/workspace-feature" });
await expect(service.readSubsession("someone-else", "child-1")).rejects.toThrow("not one of your subsessions");
await expect(service.checkSubsession("someone-else", "child-1")).rejects.toThrow("not one of your subsessions");
await expect(service.readSubsession("someone-else", "child-1", {})).rejects.toThrow("not one of your subsessions");
await service.dispose();
});