@smthrs/harness 1.0.0-rc.3 → 1.0.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ExternalTranscript.d.ts.map +1 -1
- package/dist/cjs/ExternalTranscript.js.map +2 -2
- package/dist/cjs/Transcript.d.ts +1 -1
- package/dist/cjs/Transcript.d.ts.map +1 -1
- package/dist/cjs/Transcript.js.map +1 -1
- package/dist/esm/ExternalTranscript.d.ts.map +1 -1
- package/dist/esm/ExternalTranscript.js +2 -4
- package/dist/esm/ExternalTranscript.js.map +1 -1
- package/dist/esm/Transcript.d.ts +1 -1
- package/dist/esm/Transcript.d.ts.map +1 -1
- package/dist/esm/Transcript.js.map +1 -1
- package/package.json +10 -10
- package/src/ExternalTranscript.ts +3 -4
- package/src/Transcript.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExternalTranscript.d.ts","sourceRoot":"","sources":["../../src/ExternalTranscript.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEvC;;;;;GAKG;AACH,eAAO,MAAM,SAAS,oDAA4C,CAAA;AAElE;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,IAAI,CAAA;AAE7C;;;;;GAKG;AACH,eAAO,MAAM,UAAU;;;;;EAKrB,CAAA;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;IAUb,uFAAuF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAsBzF,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,IAAI,CAAA;AAEnC;;;;;GAKG;AACH,eAAO,MAAM,KAAK;;;;;IAKhB;;;OAGG;;;;IAIH,qDAAqD;;;IAGrD,2EAA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AAC,OAAO,EAAE,MAAM,CAAA;IACxB,kCAAkC;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,8BAA8B;IAC9B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,uDAAuD;IACvD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACrC,kFAAkF;IAClF,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAClC,iEAAiE;IACjE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAA;CACrD;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAAE,WAAyD,CAAA;AAuNnF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,GACvB,OAAO,WAAW,EAClB,OAAO,MAAM,KACZ,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,uBAAuB,CA+J7D,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/ExternalTranscript.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * The conversations of agents a person runs beside Smithers, decoded from the agent's own transcript file\n * into ordered, read-only entries (mvp.md M-38, ui-components.md T-UI-07 S2).\n *\n * Every entry carries its origin, agent kind, format version, session, source record identity and\n * `read_only: true`; who the owner and the agent participant are is the caller's to say, never the\n * transcript's. Decoding is pure: the caller supplies bytes in any chunking and keeps the returned state,\n * so a growing file is tailed by decoding only what was appended. An incomplete last line waits for more\n * bytes. A complete line that is not a record, a transcript without a version, a version this module does\n * not support, and a record, event, item or content block this module does not name are tagged errors,\n * never a guess: every skipped kind is listed below by name.\n *\n * Codex: `rollout-*.jsonl` files under `$CODEX_HOME/sessions`, profile `codex-rollout/<major.minor>` from\n * the CLI release in `session_meta`. Items come from `event_msg` `item_completed` rows. `response_item` rows\n * repeat them for the model and are skipped, except three the items leave out: a message between agents\n * (`agent_message`), whose encrypted body is one placeholder; a code-mode script that failed\n * (`custom_tool_call_output`), with the request that started it; and nothing else.\n *\n * Claude Code: `<session>.jsonl` files under `~/.claude/projects/<project>`, profile `claude-code/<major.minor>`\n * from the `version` every conversation record carries. A tool call becomes one entry when its result arrives;\n * the named bookkeeping rows outside the conversation chain (no `uuid`) are skipped.\n *\n * @since 1.0.0-rc.1\n */\n\nimport * as Fault from \"@smthrs/flow/Fault\"\nimport { Result, Schema } from \"effect\"\n\n/**\n * The agents whose transcripts decode here.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport const AgentKind = Schema.Literals([\"codex\", \"claude-code\"])\n\n/**\n * The value decoded by {@link AgentKind}.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport type AgentKind = typeof AgentKind.Type\n\n/**\n * One edited file as the agent reported it: its path, the kind of change and the unified diff.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport const EditedFile = Schema.Struct({\n path: Schema.String,\n change: Schema.Literals([\"added\", \"modified\", \"deleted\", \"renamed\"]),\n renamed_to: Schema.optional(Schema.String),\n diff: Schema.String\n})\n\n/**\n * What one entry says. Tool parts keep the agent's correlation id; edits keep the path and the reported\n * outcome; a body the agent encrypted is a placeholder in its place, never dropped.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport const Part = Schema.Union([\n Schema.Struct({ type: Schema.Literal(\"prompt\"), text: Schema.String }),\n Schema.Struct({ type: Schema.Literal(\"goal\"), objective: Schema.String, status: Schema.String }),\n Schema.Struct({ type: Schema.Literal(\"text\"), text: Schema.String, final: Schema.Boolean }),\n Schema.Struct({ type: Schema.Literal(\"reasoning\"), text: Schema.String }),\n Schema.Struct({ type: Schema.Literal(\"encrypted\") }),\n Schema.Struct({\n type: Schema.Literal(\"tool\"),\n call_id: Schema.String,\n command: Schema.String,\n /** Set when every part of the command only reads, searches or lists: \"Read mvp.md\". */\n reads: Schema.Array(Schema.String),\n status: Schema.Literals([\"ok\", \"error\", \"running\"]),\n exit_code: Schema.optional(Schema.Number),\n output: Schema.String,\n duration_ms: Schema.Number\n }),\n Schema.Struct({\n type: Schema.Literal(\"edit\"),\n call_id: Schema.String,\n files: Schema.Array(EditedFile),\n outcome: Schema.Literals([\"applied\", \"failed\"])\n }),\n Schema.Struct({ type: Schema.Literal(\"search\"), call_id: Schema.String, query: Schema.String }),\n Schema.Struct({\n type: Schema.Literal(\"helper\"),\n call_id: Schema.String,\n agent: Schema.String,\n activity: Schema.String\n }),\n Schema.Struct({ type: Schema.Literal(\"compaction\") }),\n Schema.Struct({ type: Schema.Literal(\"error\"), message: Schema.String })\n])\n\n/**\n * The value decoded by {@link Part}.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport type Part = typeof Part.Type\n\n/**\n * One read-only entry of an external conversation, in source order.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport const Entry = Schema.Struct({\n origin: Schema.Literal(\"external\"),\n agent_kind: AgentKind,\n format_version: Schema.String,\n session_id: Schema.String,\n /**\n * The record this entry came from: `<session>:<line>`. A record that yields several entries numbers the later\n * ones `<session>:<line>#<n>`.\n */\n source_id: Schema.String,\n read_only: Schema.Literal(true),\n seq: Schema.Number,\n /** Milliseconds since the epoch, from the record. */\n at: Schema.Number,\n turn_id: Schema.optional(Schema.String),\n /** `user` entries are the owner's; `assistant` entries are the agent's. */\n role: Schema.Literals([\"user\", \"assistant\"]),\n part: Part\n})\n\n/**\n * The value decoded by {@link Entry}.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport type Entry = typeof Entry.Type\n\n/**\n * Why a transcript did not decode.\n *\n * @category errors\n * @since 1.0.0-rc.1\n */\nexport const ExternalTranscriptErrorCode = Schema.Literals([\n \"missing_version\",\n \"unsupported_version\",\n \"unsupported_record\",\n \"malformed_record\"\n])\n\n/**\n * The value decoded by {@link ExternalTranscriptErrorCode}.\n *\n * @category errors\n * @since 1.0.0-rc.1\n */\nexport type ExternalTranscriptErrorCode = typeof ExternalTranscriptErrorCode.Type\n\n/**\n * A transcript this module refuses to read, with the line it stopped at.\n *\n * @category errors\n * @since 1.0.0-rc.1\n */\nexport class ExternalTranscriptError\n extends Schema.TaggedError<ExternalTranscriptError>()(\"harness/ExternalTranscriptError\", {\n code: ExternalTranscriptErrorCode,\n message: Schema.String,\n line: Schema.Number\n })\n{}\nFault.register(\n \"harness/ExternalTranscriptError\",\n {\n // The agent wrote a transcript this release cannot read: a format change outside Smithers.\n missing_version: \"dependency\",\n unsupported_version: \"dependency\",\n unsupported_record: \"dependency\",\n malformed_record: \"dependency\"\n } satisfies Fault.Rows<ExternalTranscriptErrorCode>\n)\n\n/**\n * The Codex CLI releases whose rollout shape this module reads, by `major.minor`.\n *\n * @category constants\n * @since 1.0.0-rc.1\n */\nexport const codexReleases: ReadonlyArray<string> = [\"0.159\", \"0.160\"]\n\n/**\n * What a Codex decode remembers between chunks.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport interface CodexState {\n /** Bytes after the last newline: a line the agent is still writing. */\n readonly pending: string\n /** Complete lines read so far. */\n readonly line: number\n /** Entries emitted so far. */\n readonly seq: number\n readonly session?: { readonly id: string; readonly format_version: string; readonly cwd: string } | undefined\n readonly goal?: string | undefined\n /** Code-mode scripts whose output has not arrived, by `call_id`: text the decoder keeps and never runs. */\n readonly calls?: Readonly<Record<string, CodexCall>> | undefined\n}\n\n/**\n * A Codex code-mode request waiting for its output: the tool's name and the script it was given.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport interface CodexCall {\n readonly name: string\n readonly input: string\n}\n\n/**\n * The state before the first byte.\n *\n * @category constructors\n * @since 1.0.0-rc.1\n */\nexport const codexStart: CodexState = { pending: \"\", line: 0, seq: 0 }\n\n/**\n * A decoded chunk: the entries it completed and the state to pass with the next chunk.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport interface Decoded<State = CodexState> {\n readonly state: State\n readonly entries: ReadonlyArray<Entry>\n}\n\ntype Json = Record<string, unknown>\nconst record = (value: unknown): Json =>\n typeof value === \"object\" && value !== null && !Array.isArray(value) ? value as Json : {}\nconst text = (value: unknown): string => typeof value === \"string\" ? value : \"\"\nconst list = (value: unknown): ReadonlyArray<unknown> => Array.isArray(value) ? value : []\nconst basename = (path: string): string => path.split(\"/\").filter(Boolean).at(-1) ?? path\n/** One complete line as a JSON record, or `undefined` when it is not one. */\nconst parseRow = (raw: string): Json | undefined => {\n try {\n const parsed: unknown = JSON.parse(raw)\n return typeof parsed === \"object\" && parsed !== null && !Array.isArray(parsed) ? parsed as Json : undefined\n } catch {\n return undefined\n }\n}\nconst helperName = (path: unknown): string => basename(text(path)) || \"helper\"\n\nconst reads = (parsed: unknown): ReadonlyArray<string> => {\n const parts = list(parsed).map(record)\n if (parts.length === 0 || parts.some((part) => ![\"read\", \"search\", \"list_files\"].includes(text(part[\"type\"])))) {\n return []\n }\n return parts.map((part) =>\n part[\"type\"] === \"read\"\n ? `Read ${text(part[\"name\"]) || basename(text(part[\"path\"]))}`\n : part[\"type\"] === \"search\"\n ? `Searched ${JSON.stringify(text(part[\"query\"]))}${part[\"path\"] ? ` in ${basename(text(part[\"path\"]))}` : \"\"}`\n : `Listed ${basename(text(part[\"path\"])) || \"files\"}`\n )\n}\n\n/** Lines of an edit string, without the newline that ends the last one. */\nconst linesOf = (value: string): ReadonlyArray<string> => value === \"\" ? [] : value.replace(/\\n$/, \"\").split(\"\\n\")\n\n/** An added or deleted file reports its content, not a diff: one hunk of the whole file, all `+` or all `-`. */\nconst wholeFile = (content: string, op: \"+\" | \"-\"): string => {\n const lines = linesOf(content)\n if (lines.length === 0) return \"\"\n return `@@ ${op === \"+\" ? `-0,0 +1,${lines.length}` : `-1,${lines.length} +0,0`} @@\\n${\n lines.map((line) => `${op}${line}`).join(\"\\n\")\n }\\n`\n}\n\nconst changeOf = (change: Json): Schema.Schema.Type<typeof EditedFile>[\"change\"] =>\n typeof change[\"move_path\"] === \"string\"\n ? \"renamed\"\n : change[\"type\"] === \"add\"\n ? \"added\"\n : change[\"type\"] === \"delete\"\n ? \"deleted\"\n : \"modified\"\n\n/**\n * The Codex record, event and item kinds this module names. Each list is closed: a kind outside it is a tagged\n * `unsupported_record`, so a new kind stops the import where a person can see it instead of vanishing.\n */\nconst codexSkippedRows = [\n \"turn_context\",\n \"world_state\",\n \"token_usage_record\",\n \"compacted\",\n \"inter_agent_communication_metadata\"\n]\nconst codexResponseItems = [\n \"message\",\n \"reasoning\",\n \"custom_tool_call\",\n \"custom_tool_call_output\",\n \"function_call\",\n \"function_call_output\",\n \"agent_message\"\n]\nconst codexSkippedEvents = [\"task_started\", \"token_count\", \"thread_settings_applied\"]\nconst codexItems = [\n \"UserMessage\",\n \"AgentMessage\",\n \"Reasoning\",\n \"CommandExecution\",\n \"FileChange\",\n \"ContextCompaction\",\n \"SubAgentActivity\",\n \"CollabAgentToolCall\",\n \"Extension\",\n \"McpToolCall\",\n \"FunctionCallOutput\",\n \"ImageView\"\n]\n\n/** The text of a list of `{type, text}` parts, as Codex and MCP servers write tool output. */\nconst partsText = (value: unknown): string =>\n typeof value === \"string\" ? value : list(value).map((each) => text(record(each)[\"text\"])).filter(Boolean).join(\"\\n\")\n\n/**\n * One completed Codex item as the part it reports, or `undefined` for items with nothing to show. `took` is the\n * wall time Codex recorded around the item (`completed_at_ms - started_at_ms`). The caller has checked the item's\n * type against `codexItems`.\n */\nconst itemPart = (item: Json, took: number): { readonly role: Entry[\"role\"]; readonly part: Part } | undefined => {\n switch (item[\"type\"]) {\n case \"UserMessage\":\n return {\n role: \"user\",\n part: { type: \"prompt\", text: list(item[\"content\"]).map((each) => text(record(each)[\"text\"])).join(\"\\n\") }\n }\n case \"AgentMessage\": {\n const content = list(item[\"content\"]).map(record)\n const said = content.map((each) => text(each[\"text\"])).filter(Boolean).join(\"\\n\")\n if (content.some((each) => each[\"type\"] === \"encrypted_content\")) {\n return { role: \"assistant\", part: { type: \"encrypted\" } }\n }\n return { role: \"assistant\", part: { type: \"text\", text: said, final: item[\"phase\"] === \"final_answer\" } }\n }\n case \"Reasoning\": {\n // Codex keeps reasoning encrypted; only a summary it chose to write is readable.\n const summary = list(item[\"summary_text\"]).map(text).filter(Boolean).join(\"\\n\")\n return summary === \"\"\n ? (item[\"encrypted_content\"] ? { role: \"assistant\", part: { type: \"encrypted\" } } : undefined)\n : { role: \"assistant\", part: { type: \"reasoning\", text: summary } }\n }\n case \"CommandExecution\": {\n const exit = typeof item[\"exit_code\"] === \"number\" ? item[\"exit_code\"] : undefined\n // Codex reports in_progress, completed, failed and declined; only a clean completion is ok.\n const status = item[\"status\"] === \"in_progress\"\n ? \"running\"\n : item[\"status\"] === \"completed\" && (exit ?? 0) === 0\n ? \"ok\"\n : \"error\"\n return {\n role: \"assistant\",\n part: {\n type: \"tool\",\n call_id: text(item[\"id\"]),\n command: list(item[\"command\"]).map(text).at(-1) ?? \"\",\n reads: reads(item[\"parsed_cmd\"]),\n status,\n ...(exit === undefined ? {} : { exit_code: exit }),\n output: text(item[\"aggregated_output\"]) || text(item[\"formatted_output\"]),\n duration_ms: took\n }\n }\n }\n case \"FileChange\":\n return {\n role: \"assistant\",\n part: {\n type: \"edit\",\n call_id: text(item[\"id\"]),\n outcome: item[\"status\"] === \"completed\" ? \"applied\" : \"failed\",\n files: Object.entries(record(item[\"changes\"])).map(([path, value]) => {\n const change = record(value)\n return {\n path,\n change: changeOf(change),\n ...(typeof change[\"move_path\"] === \"string\" ? { renamed_to: change[\"move_path\"] } : {}),\n diff: text(change[\"unified_diff\"]) ||\n wholeFile(text(change[\"content\"]), change[\"type\"] === \"delete\" ? \"-\" : \"+\")\n }\n })\n }\n }\n case \"ContextCompaction\":\n return { role: \"assistant\", part: { type: \"compaction\" } }\n case \"SubAgentActivity\":\n return {\n role: \"assistant\",\n part: {\n type: \"helper\",\n call_id: text(item[\"id\"]),\n agent: helperName(item[\"agent_path\"]),\n activity: text(item[\"kind\"])\n }\n }\n case \"CollabAgentToolCall\": {\n const agents = list(item[\"receiver_agents\"]).map((each) => helperName(record(each)[\"agent_path\"] ?? each))\n return {\n role: \"assistant\",\n part: {\n type: \"helper\",\n call_id: text(item[\"id\"]),\n agent: agents.join(\", \") || \"helpers\",\n activity: text(item[\"tool\"])\n }\n }\n }\n case \"Extension\": {\n const action = record(item[\"action\"])\n const query = text(item[\"query\"]) || text(action[\"query\"]) || text(action[\"pattern\"]) || text(action[\"url\"])\n return { role: \"assistant\", part: { type: \"search\", call_id: text(item[\"id\"]), query } }\n }\n case \"McpToolCall\": {\n // A tool another server ran for the agent: its request and the result the server reported.\n const result = record(item[\"result\"])\n const args = record(item[\"arguments\"])\n const name = [text(item[\"server\"]), text(item[\"tool\"])].filter(Boolean).join(\".\")\n const failed = item[\"status\"] !== \"completed\" || result[\"isError\"] === true\n return {\n role: \"assistant\",\n part: {\n type: \"tool\",\n call_id: text(item[\"id\"]),\n command: Object.keys(args).length === 0 ? name : `${name} ${JSON.stringify(args)}`,\n reads: [],\n status: item[\"status\"] === \"in_progress\" ? \"running\" : failed ? \"error\" : \"ok\",\n output: partsText(result[\"content\"]) || text(record(item[\"error\"])[\"message\"]),\n duration_ms: took\n }\n }\n }\n case \"FunctionCallOutput\":\n return {\n role: \"assistant\",\n part: {\n type: \"tool\",\n call_id: text(item[\"id\"]),\n command: [text(item[\"namespace\"]), text(item[\"name\"])].filter(Boolean).join(\".\"),\n reads: [],\n status: \"ok\",\n output: partsText(item[\"output\"]),\n duration_ms: took\n }\n }\n default:\n // ImageView, the one kind of `codexItems` left: an image the agent looked at.\n return {\n role: \"assistant\",\n part: {\n type: \"tool\",\n call_id: text(item[\"id\"]),\n command: `view_image ${text(item[\"path\"])}`,\n reads: [`Read ${basename(text(item[\"path\"]))}`],\n status: \"ok\",\n output: \"\",\n duration_ms: took\n }\n }\n }\n}\n\n/**\n * The first line of a code-mode output says how the script ended. A script that finished, or one still running in\n * a cell, repeats what completed items already report; any other ending is a failure only this row records.\n */\nconst scriptFailed = (output: string): boolean => !/^Script (?:completed|running)\\b/.test(output)\n\n/** The file a failed `apply_patch` names, when the report is that failure. */\nconst failedPatchPath = (output: string): string | undefined =>\n /apply_patch verification failed: Failed to find expected lines in ([^\\n]+):\\n/.exec(output)?.[1]\n\n/** The adapter profile `<profile>/<major.minor>` for a supported release, or `undefined`. */\nconst profileOf = (profile: string, releases: ReadonlyArray<string>, release: string): string | undefined => {\n const minor = /^(\\d+\\.\\d+)\\./.exec(release)?.[1]\n return minor !== undefined && releases.includes(minor) ? `${profile}/${minor}` : undefined\n}\n\n/**\n * Decode the next chunk of a Codex rollout. Pass `codexStart` with the first chunk and the returned state\n * with each following one; any partition of the same bytes yields the same entries.\n *\n * @category decoding\n * @since 1.0.0-rc.1\n */\nexport const decodeCodex = (state: CodexState, chunk: string): Result.Result<Decoded, ExternalTranscriptError> => {\n const lines = (state.pending + chunk).split(\"\\n\")\n const pending = lines.pop()!\n let { line, seq, session, goal } = state\n const calls = new Map(Object.entries(state.calls ?? {}))\n const entries: Array<Entry> = []\n const fail = (code: ExternalTranscriptErrorCode, message: string) =>\n Result.fail(new ExternalTranscriptError({ code, message, line }))\n /** A kind outside the named lists; a kind that is not even a string is a record of another shape. */\n const unread = (what: string, type: unknown) =>\n typeof type === \"string\" && type !== \"\"\n ? fail(\"unsupported_record\", `Codex wrote ${what} this release does not read: ${type}`)\n : fail(\"malformed_record\", `Codex rollout line ${line} names no ${what.replace(/^an? /, \"\")} type.`)\n for (const raw of lines) {\n line++\n if (raw.trim() === \"\") continue\n const row = parseRow(raw)\n if (row === undefined) return fail(\"malformed_record\", `Codex rollout line ${line} is not a JSON record.`)\n const payload = record(row[\"payload\"])\n if (row[\"type\"] === \"session_meta\") {\n const release = text(payload[\"cli_version\"])\n const format_version = profileOf(\"codex-rollout\", codexReleases, release)\n if (format_version === undefined) {\n return fail(\n \"unsupported_version\",\n `Codex ${release || \"(no release)\"} wrote this rollout; supported: ${codexReleases.join(\", \")}.`\n )\n }\n session = { id: text(payload[\"id\"]) || text(payload[\"session_id\"]), format_version, cwd: text(payload[\"cwd\"]) }\n continue\n }\n if (session === undefined) {\n return fail(\"missing_version\", `Codex rollout line ${line} comes before its session record.`)\n }\n const found: Array<{ readonly role: Entry[\"role\"]; readonly part: Part; readonly turn?: string }> = []\n if (row[\"type\"] === \"response_item\") {\n if (!codexResponseItems.includes(text(payload[\"type\"]))) return unread(\"a response item\", payload[\"type\"])\n switch (payload[\"type\"]) {\n case \"custom_tool_call\": {\n const id = payload[\"call_id\"], name = payload[\"name\"], input = payload[\"input\"]\n if (typeof id !== \"string\" || id === \"\" || typeof name !== \"string\" || typeof input !== \"string\") {\n return fail(\"malformed_record\", `Codex tool request on line ${line} names no call, tool or input.`)\n }\n calls.set(id, { name, input })\n break\n }\n case \"custom_tool_call_output\": {\n const id = text(payload[\"call_id\"])\n const call = calls.get(id)\n calls.delete(id)\n const output = partsText(payload[\"output\"])\n // A script that finished repeats its completed items. One that failed has no item: keep its report with\n // the request that started it, so a failed edit is never silently missing.\n if (!scriptFailed(output)) break\n found.push({\n role: \"assistant\",\n part: {\n type: \"tool\",\n call_id: id,\n command: call?.input ?? \"\",\n reads: [],\n status: \"error\",\n output,\n duration_ms: 0\n }\n })\n const path = failedPatchPath(output)\n if (path !== undefined) {\n // The report names the file and no change: the diff is empty because nothing was observed to change.\n found.push({\n role: \"assistant\",\n part: { type: \"edit\", call_id: id, files: [{ path, change: \"modified\", diff: \"\" }], outcome: \"failed\" }\n })\n }\n break\n }\n case \"agent_message\": {\n // A message between this agent and one it works with. Codex encrypts the body; the header beside it\n // names agents, and a name in a transcript confers nothing.\n const content = payload[\"content\"]\n if (!Array.isArray(content)) {\n return fail(\"malformed_record\", `Codex agent message on line ${line} has no content list.`)\n }\n let encrypted = false\n const said: Array<string> = []\n for (const each of content) {\n const block = record(each)\n if (block[\"type\"] === \"encrypted_content\") {\n if (typeof block[\"encrypted_content\"] !== \"string\" || block[\"encrypted_content\"] === \"\") {\n return fail(\"malformed_record\", `Codex encrypted body on line ${line} is empty.`)\n }\n encrypted = true\n } else if (block[\"type\"] === \"input_text\" || block[\"type\"] === \"output_text\") {\n if (typeof block[\"text\"] !== \"string\") {\n return fail(\"malformed_record\", `Codex agent message on line ${line} has a text part without text.`)\n }\n said.push(block[\"text\"])\n } else {\n return unread(\"a message part\", block[\"type\"])\n }\n }\n const turn = text(record(payload[\"internal_chat_message_metadata_passthrough\"])[\"turn_id\"])\n // One placeholder stands for the whole body, header included: nothing readable is shown beside it.\n if (encrypted) found.push({ role: \"assistant\", part: { type: \"encrypted\" }, turn })\n else if (said.join(\"\\n\") !== \"\") {\n found.push({ role: \"assistant\", part: { type: \"text\", text: said.join(\"\\n\"), final: false }, turn })\n }\n break\n }\n // message, reasoning, function_call, function_call_output: the model-facing copy of completed items.\n }\n } else if (row[\"type\"] === \"event_msg\") {\n switch (payload[\"type\"]) {\n case \"item_completed\": {\n const started = payload[\"started_at_ms\"], completed = payload[\"completed_at_ms\"]\n const took = typeof started === \"number\" && typeof completed === \"number\" ? completed - started : 0\n const item = record(payload[\"item\"])\n if (!codexItems.includes(text(item[\"type\"]))) return unread(\"an item\", item[\"type\"])\n if (item[\"type\"] === \"UserMessage\" || item[\"type\"] === \"AgentMessage\") {\n const content = item[\"content\"]\n if (!Array.isArray(content)) {\n return fail(\"malformed_record\", `Codex message on line ${line} has no content list.`)\n }\n // Ciphertext stands for the whole body, so the parts beside it are not read.\n if (!content.some((each) => record(each)[\"type\"] === \"encrypted_content\")) {\n for (const each of content) {\n const block = record(each)\n if (block[\"type\"] !== (item[\"type\"] === \"UserMessage\" ? \"text\" : \"Text\")) {\n return unread(\"a message part\", block[\"type\"])\n }\n if (typeof block[\"text\"] !== \"string\") {\n return fail(\"malformed_record\", `Codex message on line ${line} has a text part without text.`)\n }\n }\n }\n }\n const part = itemPart(item, Number.isFinite(took) && took > 0 ? took : 0)\n if (part !== undefined) found.push({ ...part, turn: text(payload[\"turn_id\"]) })\n break\n }\n case \"thread_goal_updated\": {\n const update = record(payload[\"goal\"])\n const key = `${text(update[\"status\"])}:${text(update[\"objective\"])}`\n // Codex repeats a goal on every usage update; only a new objective or status is news.\n if (key !== goal) {\n found.push({\n role: \"user\",\n part: { type: \"goal\", objective: text(update[\"objective\"]), status: text(update[\"status\"]) }\n })\n }\n goal = key\n break\n }\n case \"task_complete\": {\n // A turn's end repeats its last message, and carries the failure when the turn ended in one: a usage\n // limit, a model at capacity, a refused request.\n if (payload[\"error\"] === undefined || payload[\"error\"] === null) break\n const message = text(record(payload[\"error\"])[\"message\"])\n if (message === \"\") return fail(\"malformed_record\", `Codex failure on line ${line} gives no message.`)\n found.push({ role: \"assistant\", part: { type: \"error\", message }, turn: text(payload[\"turn_id\"]) })\n break\n }\n case \"error\":\n case \"turn_aborted\": {\n // What Codex said went wrong, or why the turn stopped (\"interrupted\").\n const message = text(payload[\"message\"]) || text(payload[\"reason\"])\n if (message === \"\") {\n return fail(\"malformed_record\", `Codex failure on line ${line} gives no message or reason.`)\n }\n found.push({ role: \"assistant\", part: { type: \"error\", message }, turn: text(payload[\"turn_id\"]) })\n break\n }\n default:\n if (!codexSkippedEvents.includes(text(payload[\"type\"]))) return unread(\"an event\", payload[\"type\"])\n }\n } else if (!codexSkippedRows.includes(text(row[\"type\"]))) {\n return unread(\"a record\", row[\"type\"])\n }\n const at = Date.parse(text(row[\"timestamp\"])) || 0\n const sessionId = session.id, format_version = session.format_version\n found.forEach(({ part, role, turn }, index) => {\n entries.push({\n origin: \"external\",\n agent_kind: \"codex\",\n format_version,\n session_id: sessionId,\n source_id: index === 0 ? `${sessionId}:${line}` : `${sessionId}:${line}#${index}`,\n read_only: true,\n seq: seq++,\n at,\n ...(turn ? { turn_id: turn } : {}),\n role,\n part\n })\n })\n }\n return Result.succeed({\n state: { pending, line, seq, session, goal, ...(calls.size === 0 ? {} : { calls: Object.fromEntries(calls) }) },\n entries\n })\n}\n\n/**\n * The Claude Code release lines whose transcript shape this module reads, by `major.minor`.\n *\n * @category constants\n * @since 1.0.0-rc.1\n */\nexport const claudeReleases: ReadonlyArray<string> = [\"2.1\"]\n\n/**\n * A Claude Code tool call waiting for its result: the tool's name, its input and when the agent asked.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport interface ClaudeCall {\n readonly name: string\n readonly input: unknown\n /** Milliseconds since the epoch, from the `tool_use` record. */\n readonly at: number\n}\n\n/**\n * What a Claude Code decode remembers between chunks.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport interface ClaudeState {\n /** Bytes after the last newline: a line the agent is still writing. */\n readonly pending: string\n /** Complete lines read so far. */\n readonly line: number\n /** Entries emitted so far. */\n readonly seq: number\n /** The session the first conversation record named. */\n readonly session?: string | undefined\n /** The `promptId` of the latest user record: the turn later entries belong to. */\n readonly turn?: string | undefined\n /** Tool calls whose result has not arrived, by `tool_use` id. */\n readonly calls: Readonly<Record<string, ClaudeCall>>\n}\n\n/**\n * The state before the first byte.\n *\n * @category constructors\n * @since 1.0.0-rc.1\n */\nexport const claudeStart: ClaudeState = { pending: \"\", line: 0, seq: 0, calls: {} }\n\n/** Content as blocks: Claude Code writes a plain prompt as a string and everything else as a block list. */\nconst blocksOf = (content: unknown): ReadonlyArray<Json> =>\n typeof content === \"string\" ? [{ type: \"text\", text: content }] : list(content).map(record)\n\nconst textOf = (blocks: ReadonlyArray<Json>): string =>\n blocks.filter((block) => block[\"type\"] === \"text\").map((block) => text(block[\"text\"])).join(\"\\n\")\n\n/** A user turn is the owner's when Claude Code classified it human or did not classify it. */\nconst byOwner = (origin: unknown): boolean =>\n origin === undefined || origin === null || record(origin)[\"kind\"] === \"human\"\n\n/**\n * A requested replacement as one hunk. Claude Code reports no position for a replacement it did not apply, so the\n * hunk starts at line 1.\n */\nconst replacement = (before: string, after: string): string => {\n const removed = linesOf(before), added = linesOf(after)\n if (removed.length + added.length === 0) return \"\"\n return `@@ -1,${removed.length} +1,${added.length} @@\\n${\n [...removed.map((line) => `-${line}`), ...added.map((line) => `+${line}`)].join(\"\\n\")\n }\\n`\n}\n\nconst count = (value: unknown): number => typeof value === \"number\" ? value : 0\n\n/** The hunks Claude Code reported for an applied edit (`toolUseResult.structuredPatch`). */\nconst reportedPatch = (patch: unknown): string =>\n list(patch).map(record).map((hunk) =>\n `@@ -${count(hunk[\"oldStart\"])},${count(hunk[\"oldLines\"])} +${count(hunk[\"newStart\"])},${\n count(hunk[\"newLines\"])\n } @@\\n${list(hunk[\"lines\"]).map(text).join(\"\\n\")}\\n`\n ).join(\"\")\n\n/** The edit the agent asked for, from the tool input, when Claude Code reported no hunks. */\nconst requestedPatch = (name: string, input: Json): string => {\n switch (name) {\n case \"Write\":\n return wholeFile(text(input[\"content\"]), \"+\")\n case \"NotebookEdit\":\n return wholeFile(text(input[\"new_source\"]), \"+\")\n case \"MultiEdit\":\n return list(input[\"edits\"]).map(record).map((edit) =>\n replacement(text(edit[\"old_string\"]), text(edit[\"new_string\"]))\n ).join(\"\")\n default:\n return replacement(text(input[\"old_string\"]), text(input[\"new_string\"]))\n }\n}\n\n/** The reads label of a tool that only reads, searches or lists, or none. */\nconst claudeReads = (name: string, input: Json): ReadonlyArray<string> => {\n const path = text(input[\"path\"])\n switch (name) {\n case \"Read\":\n return [`Read ${basename(text(input[\"file_path\"]))}`]\n case \"Grep\":\n case \"Glob\":\n return [`Searched ${JSON.stringify(text(input[\"pattern\"]))}${path ? ` in ${basename(path)}` : \"\"}`]\n case \"LS\":\n return [`Listed ${basename(path) || \"files\"}`]\n default:\n return []\n }\n}\n\n/** One finished tool call: its `tool_use` (when this transcript holds it) and the `tool_result` that ended it. */\nconst claudeToolPart = (\n id: string,\n call: ClaudeCall | undefined,\n result: { readonly failed: boolean; readonly output: string; readonly report: Json; readonly took: number }\n): Part => {\n const name = call?.name ?? \"\"\n const input = record(call?.input)\n switch (name) {\n case \"Edit\":\n case \"Write\":\n case \"MultiEdit\":\n case \"NotebookEdit\":\n return {\n type: \"edit\",\n call_id: id,\n files: [{\n path: text(input[\"file_path\"]) || text(input[\"notebook_path\"]),\n change: name === \"Write\" && result.report[\"type\"] === \"create\" ? \"added\" : \"modified\",\n diff: reportedPatch(result.report[\"structuredPatch\"]) || requestedPatch(name, input)\n }],\n outcome: result.failed ? \"failed\" : \"applied\"\n }\n case \"WebSearch\":\n return { type: \"search\", call_id: id, query: text(input[\"query\"]) }\n case \"WebFetch\":\n return { type: \"search\", call_id: id, query: text(input[\"url\"]) }\n case \"Task\":\n case \"Agent\":\n return {\n type: \"helper\",\n call_id: id,\n agent: text(input[\"subagent_type\"]) || \"general-purpose\",\n activity: text(input[\"description\"])\n }\n }\n const exit = result.failed ? /^Exit code (\\d+)/.exec(result.output)?.[1] : undefined\n return {\n type: \"tool\",\n call_id: id,\n command: name === \"Bash\"\n ? text(input[\"command\"])\n : Object.keys(input).length === 0\n ? name\n : `${name} ${JSON.stringify(input)}`,\n reads: claudeReads(name, input),\n status: result.failed ? \"error\" : \"ok\",\n ...(exit === undefined ? {} : { exit_code: Number(exit) }),\n output: result.output,\n duration_ms: result.took\n }\n}\n\n/**\n * The Claude Code record, status, attachment and block kinds this module names. Each list is closed: a kind\n * outside it is a tagged `unsupported_record`, so a new kind stops the import where a person can see it.\n */\n/** Rows outside the conversation chain: session bookkeeping that names no speaker and says nothing. */\nconst claudeSkippedRows = [\n \"mode\",\n \"permission-mode\",\n \"atis-latch\",\n \"last-prompt\",\n \"ai-title\",\n \"custom-title\",\n \"agent-name\",\n \"queue-operation\",\n \"file-history-snapshot\",\n \"file-history-delta\",\n \"cost-state\",\n \"pr-link\",\n \"bridge-session\"\n]\n/** Status lines: turn timing, hook summaries, retries, model fallback and scheduled-task notices. */\nconst claudeSkippedStatus = [\n \"turn_duration\",\n \"informational\",\n \"stop_hook_summary\",\n \"away_summary\",\n \"api_error\",\n \"local_command\",\n \"scheduled_task_fire\",\n \"agents_killed\",\n \"model_refusal_fallback\"\n]\n/** Context Claude Code attaches for the model; `queued_command` alone can carry the owner's words. */\nconst claudeSkippedAttachments = [\n \"agent_listing_delta\",\n \"auto_mode\",\n \"bash_output_audience_note\",\n \"batching_reminder_sent\",\n \"budget_usd\",\n \"command_permissions\",\n \"compact_file_reference\",\n \"credential_org\",\n \"date\",\n \"deferred_tools_delta\",\n \"deferred_tools_record\",\n \"diagnostics\",\n \"directory\",\n \"edited_text_file\",\n \"environment\",\n \"file\",\n \"goal_status\",\n \"hook_additional_context\",\n \"hook_cancelled\",\n \"hook_non_blocking_error\",\n \"hook_system_message\",\n \"instructions\",\n \"invoked_skills\",\n \"max_turns_reached\",\n \"mcp_instructions_delta\",\n \"model\",\n \"nested_memory\",\n \"plan_mode\",\n \"prompt_snapshot\",\n \"read_truncation_notice\",\n \"remote_session_change\",\n \"sandbox_instructions\",\n \"session_context\",\n \"silent_turn_reminder\",\n \"skill_listing\",\n \"skill_mention\",\n \"task_reminder\",\n \"task_status\",\n \"thinking_drop\",\n \"thinking_stripped\",\n \"total_tokens_reminder\",\n \"ultra_effort_enter\",\n \"ultra_effort_exit\",\n \"workflow_keyword_request\"\n]\n\n/** The owner's words in a user record, or `undefined` for Claude Code's own output of a local command. */\nconst ownerText = (said: string): Part | undefined => {\n if (/^\\[Request interrupted by user[^\\]]*\\]$/.test(said)) return { type: \"error\", message: said }\n if (/^<(?:local-command-std(?:out|err)|bash-std(?:out|err))>/.test(said)) return undefined\n // Claude Code writes a slash command as tags that open the record; a prompt that mentions them stays as typed.\n const command = /^<command-(?:name|message)>/.test(said)\n ? /<command-name>([^<]*)<\\/command-name>/.exec(said)?.[1]\n : undefined\n if (command !== undefined) {\n const args = /<command-args>([\\s\\S]*?)<\\/command-args>/.exec(said)?.[1]?.trim()\n return { type: \"prompt\", text: args ? `${command} ${args}` : command }\n }\n const shell = /^<bash-input>([\\s\\S]*)<\\/bash-input>$/.exec(said)?.[1]\n return { type: \"prompt\", text: shell === undefined ? said : `!${shell.trim()}` }\n}\n\n/**\n * Decode the next chunk of a Claude Code session transcript. Pass `claudeStart` with the first chunk and the\n * returned state with each following one; any partition of the same bytes yields the same entries.\n *\n * Entries follow the order of the records that complete them. A tool call is held in `state.calls` from its\n * `tool_use` record until the `tool_result` with the same id arrives, and becomes one entry at the result's line;\n * a call whose result never arrives emits nothing.\n *\n * @category decoding\n * @since 1.0.0-rc.1\n */\nexport const decodeClaude = (\n state: ClaudeState,\n chunk: string\n): Result.Result<Decoded<ClaudeState>, ExternalTranscriptError> => {\n const lines = (state.pending + chunk).split(\"\\n\")\n const pending = lines.pop()!\n let { line, seq, session, turn } = state\n const calls = new Map(Object.entries(state.calls))\n const entries: Array<Entry> = []\n const fail = (code: ExternalTranscriptErrorCode, message: string) =>\n Result.fail(new ExternalTranscriptError({ code, message, line }))\n /** A kind outside the named lists; a kind that is not even a string is a record of another shape. */\n const unread = (what: string, type: unknown) =>\n typeof type === \"string\" && type !== \"\"\n ? fail(\"unsupported_record\", `Claude Code wrote ${what} this release does not read: ${type}`)\n : fail(\"malformed_record\", `Claude Code transcript line ${line} names no ${what.replace(/^an? /, \"\")} type.`)\n for (const raw of lines) {\n line++\n if (raw.trim() === \"\") continue\n const row = parseRow(raw)\n if (row === undefined) return fail(\"malformed_record\", `Claude Code transcript line ${line} is not a JSON record.`)\n // Bookkeeping rows say nothing in the conversation, whether or not a release gives them a uuid.\n if (claudeSkippedRows.includes(text(row[\"type\"]))) continue\n if (![\"user\", \"assistant\", \"system\", \"attachment\"].includes(text(row[\"type\"]))) {\n return unread(\"a record\", row[\"type\"])\n }\n // Conversation records chain by uuid: one without it is not the shape this profile reads.\n if (typeof row[\"uuid\"] !== \"string\") {\n return fail(\"malformed_record\", `Claude Code transcript line ${line} is a conversation record without a uuid.`)\n }\n const release = text(row[\"version\"])\n if (release === \"\") return fail(\"missing_version\", `Claude Code transcript line ${line} names no release.`)\n const format_version = profileOf(\"claude-code\", claudeReleases, release)\n if (format_version === undefined) {\n return fail(\n \"unsupported_version\",\n `Claude Code ${release} wrote this transcript; supported: ${claudeReleases.join(\", \")}.`\n )\n }\n session ??= text(row[\"sessionId\"]) || undefined\n if (session === undefined) {\n return fail(\"malformed_record\", `Claude Code transcript line ${line} names no session.`)\n }\n const sessionId = session\n // A subagent's records belong to its own transcript; the main one shows the call as a helper.\n if (row[\"isSidechain\"] === true) continue\n const at = Date.parse(text(row[\"timestamp\"])) || 0\n if (row[\"type\"] === \"user\" && typeof row[\"promptId\"] === \"string\" && row[\"promptId\"] !== \"\") {\n turn = row[\"promptId\"]\n }\n const found: Array<{ readonly role: Entry[\"role\"]; readonly part: Part }> = []\n const said = (part: Part) => found.push({ role: \"assistant\", part })\n const message = record(row[\"message\"])\n if (\n (row[\"type\"] === \"user\" || row[\"type\"] === \"assistant\") && typeof message[\"content\"] !== \"string\" &&\n !Array.isArray(message[\"content\"])\n ) {\n return fail(\"malformed_record\", `Claude Code transcript line ${line} has no message content.`)\n }\n switch (row[\"type\"]) {\n case \"user\": {\n const blocks = blocksOf(message[\"content\"])\n for (const block of blocks) {\n if (block[\"type\"] === \"tool_result\") {\n const callId = text(block[\"tool_use_id\"])\n const call = calls.get(callId)\n calls.delete(callId)\n const content = block[\"content\"]\n said(claudeToolPart(callId, call, {\n failed: block[\"is_error\"] === true,\n output: typeof content === \"string\" ? content : textOf(list(content).map(record)),\n report: record(row[\"toolUseResult\"]),\n took: call !== undefined && call.at > 0 && at > call.at ? at - call.at : 0\n }))\n } else if (block[\"type\"] !== \"text\" && block[\"type\"] !== \"image\") {\n return unread(\"a content block\", block[\"type\"])\n }\n }\n const words = textOf(blocks)\n // Skill bodies, caveats and summaries Claude Code injects are not the owner's; nor are task notifications\n // or messages from other sessions.\n if (words === \"\" || row[\"isMeta\"] === true || row[\"isCompactSummary\"] === true || !byOwner(row[\"origin\"])) break\n const part = ownerText(words)\n if (part !== undefined) found.push({ role: part.type === \"prompt\" ? \"user\" : \"assistant\", part })\n break\n }\n case \"assistant\": {\n const blocks = blocksOf(message[\"content\"])\n if (row[\"isApiErrorMessage\"] === true) {\n said({ type: \"error\", message: textOf(blocks) || text(row[\"error\"]) })\n break\n }\n for (const block of blocks) {\n switch (block[\"type\"]) {\n case \"text\":\n if (text(block[\"text\"]) !== \"\") {\n said({ type: \"text\", text: text(block[\"text\"]), final: message[\"stop_reason\"] === \"end_turn\" })\n }\n break\n case \"thinking\":\n // Claude Code keeps only the signature of most thinking; an empty body has nothing to show.\n if (text(block[\"thinking\"]) !== \"\") said({ type: \"reasoning\", text: text(block[\"thinking\"]) })\n break\n case \"redacted_thinking\":\n break\n case \"fallback\":\n // A notice that Claude Code answered with another model: a status line, not something it said.\n break\n case \"tool_use\":\n if (typeof block[\"id\"] !== \"string\" || block[\"id\"] === \"\") {\n return fail(\"malformed_record\", `Claude Code tool request on line ${line} names no call.`)\n }\n calls.set(block[\"id\"], { name: text(block[\"name\"]), input: block[\"input\"] ?? {}, at })\n break\n default:\n return unread(\"a content block\", block[\"type\"])\n }\n }\n break\n }\n case \"system\":\n if (row[\"subtype\"] === \"compact_boundary\") said({ type: \"compaction\" })\n else if (!claudeSkippedStatus.includes(text(row[\"subtype\"]))) return unread(\"a status record\", row[\"subtype\"])\n break\n case \"attachment\": {\n // Context Claude Code attaches for the model, except a prompt the owner queued while the agent worked.\n const attachment = record(row[\"attachment\"])\n if (attachment[\"type\"] !== \"queued_command\") {\n if (!claudeSkippedAttachments.includes(text(attachment[\"type\"]))) {\n return unread(\"an attachment\", attachment[\"type\"])\n }\n break\n }\n if (\n attachment[\"commandMode\"] === \"prompt\" && attachment[\"isMeta\"] !== true && byOwner(attachment[\"origin\"])\n ) {\n const words = textOf(blocksOf(attachment[\"prompt\"]))\n if (words !== \"\") found.push({ role: \"user\", part: { type: \"prompt\", text: words } })\n }\n break\n }\n }\n found.forEach(({ part, role }, index) => {\n entries.push({\n origin: \"external\",\n agent_kind: \"claude-code\",\n format_version,\n session_id: sessionId,\n source_id: index === 0 ? `${sessionId}:${line}` : `${sessionId}:${line}#${index}`,\n read_only: true,\n seq: seq++,\n at,\n ...(turn === undefined ? {} : { turn_id: turn }),\n role,\n part\n })\n })\n }\n return Result.succeed({\n state: {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,IAAI,IAAI,KAAK;AAAA,QAC/E,WAAW;AAAA,QACX,KAAK;AAAA,QACL;AAAA,QACA,GAAI,SAAS,SAAY,CAAC,IAAI,EAAE,SAAS,KAAK;AAAA,QAC9C;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AACA,SAAO,qBAAO,QAAQ;AAAA,IACpB,OAAO,EAAE,SAAS,MAAM,KAAK,SAAS,MAAM,OAAO,OAAO,YAAY,KAAK,EAAE;AAAA,IAC7E;AAAA,EACF,CAAC;AACH;",
|
|
4
|
+
"sourcesContent": ["/**\n * The conversations of agents a person runs beside Smithers, decoded from the agent's own transcript file\n * into ordered, read-only entries (mvp.md M-38, ui-components.md T-UI-07 S2).\n *\n * Every entry carries its origin, agent kind, format version, session, source record identity and\n * `read_only: true`; who the owner and the agent participant are is the caller's to say, never the\n * transcript's. Decoding is pure: the caller supplies bytes in any chunking and keeps the returned state,\n * so a growing file is tailed by decoding only what was appended. An incomplete last line waits for more\n * bytes. A complete line that is not a record, a transcript without a version, a version this module does\n * not support, and a record, event, item or content block this module does not name are tagged errors,\n * never a guess: every skipped kind is listed below by name.\n *\n * Codex: `rollout-*.jsonl` files under `$CODEX_HOME/sessions`, profile `codex-rollout/<major.minor>` from\n * the CLI release in `session_meta`. Items come from `event_msg` `item_completed` rows. `response_item` rows\n * repeat them for the model and are skipped, except three the items leave out: a message between agents\n * (`agent_message`), whose encrypted body is one placeholder; a code-mode script that failed\n * (`custom_tool_call_output`), with the request that started it; and nothing else.\n *\n * Claude Code: `<session>.jsonl` files under `~/.claude/projects/<project>`, profile `claude-code/<major.minor>`\n * from the `version` every conversation record carries. A tool call becomes one entry when its result arrives;\n * the named bookkeeping rows outside the conversation chain (no `uuid`) are skipped.\n *\n * @since 1.0.0-rc.1\n */\n\nimport * as Fault from \"@smthrs/flow/Fault\"\nimport { Result, Schema } from \"effect\"\n\n/**\n * The agents whose transcripts decode here.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport const AgentKind = Schema.Literals([\"codex\", \"claude-code\"])\n\n/**\n * The value decoded by {@link AgentKind}.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport type AgentKind = typeof AgentKind.Type\n\n/**\n * One edited file as the agent reported it: its path, the kind of change and the unified diff.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport const EditedFile = Schema.Struct({\n path: Schema.String,\n change: Schema.Literals([\"added\", \"modified\", \"deleted\", \"renamed\"]),\n renamed_to: Schema.optional(Schema.String),\n diff: Schema.String\n})\n\n/**\n * What one entry says. Tool parts keep the agent's correlation id; edits keep the path and the reported\n * outcome; a body the agent encrypted is a placeholder in its place, never dropped.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport const Part = Schema.Union([\n Schema.Struct({ type: Schema.Literal(\"prompt\"), text: Schema.String }),\n Schema.Struct({ type: Schema.Literal(\"goal\"), objective: Schema.String, status: Schema.String }),\n Schema.Struct({ type: Schema.Literal(\"text\"), text: Schema.String, final: Schema.Boolean }),\n Schema.Struct({ type: Schema.Literal(\"reasoning\"), text: Schema.String }),\n Schema.Struct({ type: Schema.Literal(\"encrypted\") }),\n Schema.Struct({\n type: Schema.Literal(\"tool\"),\n call_id: Schema.String,\n command: Schema.String,\n /** Set when every part of the command only reads, searches or lists: \"Read mvp.md\". */\n reads: Schema.Array(Schema.String),\n status: Schema.Literals([\"ok\", \"error\", \"running\"]),\n exit_code: Schema.optional(Schema.Number),\n output: Schema.String,\n duration_ms: Schema.Number\n }),\n Schema.Struct({\n type: Schema.Literal(\"edit\"),\n call_id: Schema.String,\n files: Schema.Array(EditedFile),\n outcome: Schema.Literals([\"applied\", \"failed\"])\n }),\n Schema.Struct({ type: Schema.Literal(\"search\"), call_id: Schema.String, query: Schema.String }),\n Schema.Struct({\n type: Schema.Literal(\"helper\"),\n call_id: Schema.String,\n agent: Schema.String,\n activity: Schema.String\n }),\n Schema.Struct({ type: Schema.Literal(\"compaction\") }),\n Schema.Struct({ type: Schema.Literal(\"error\"), message: Schema.String })\n])\n\n/**\n * The value decoded by {@link Part}.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport type Part = typeof Part.Type\n\n/**\n * One read-only entry of an external conversation, in source order.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport const Entry = Schema.Struct({\n origin: Schema.Literal(\"external\"),\n agent_kind: AgentKind,\n format_version: Schema.String,\n session_id: Schema.String,\n /**\n * The record this entry came from: `<session>:<line>`. A record that yields several entries numbers the later\n * ones `<session>:<line>#<n>`.\n */\n source_id: Schema.String,\n read_only: Schema.Literal(true),\n seq: Schema.Number,\n /** Milliseconds since the epoch, from the record. */\n at: Schema.Number,\n turn_id: Schema.optional(Schema.String),\n /** `user` entries are the owner's; `assistant` entries are the agent's. */\n role: Schema.Literals([\"user\", \"assistant\"]),\n part: Part\n})\n\n/**\n * The value decoded by {@link Entry}.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport type Entry = typeof Entry.Type\n\n/**\n * Why a transcript did not decode.\n *\n * @category errors\n * @since 1.0.0-rc.1\n */\nexport const ExternalTranscriptErrorCode = Schema.Literals([\n \"missing_version\",\n \"unsupported_version\",\n \"unsupported_record\",\n \"malformed_record\"\n])\n\n/**\n * The value decoded by {@link ExternalTranscriptErrorCode}.\n *\n * @category errors\n * @since 1.0.0-rc.1\n */\nexport type ExternalTranscriptErrorCode = typeof ExternalTranscriptErrorCode.Type\n\n/**\n * A transcript this module refuses to read, with the line it stopped at.\n *\n * @category errors\n * @since 1.0.0-rc.1\n */\nexport class ExternalTranscriptError\n extends Schema.TaggedError<ExternalTranscriptError>()(\"harness/ExternalTranscriptError\", {\n code: ExternalTranscriptErrorCode,\n message: Schema.String,\n line: Schema.Number\n })\n{}\nFault.register(\n \"harness/ExternalTranscriptError\",\n {\n // The agent wrote a transcript this release cannot read: a format change outside Smithers.\n missing_version: \"dependency\",\n unsupported_version: \"dependency\",\n unsupported_record: \"dependency\",\n malformed_record: \"dependency\"\n } satisfies Fault.Rows<ExternalTranscriptErrorCode>\n)\n\n/**\n * The Codex CLI releases whose rollout shape this module reads, by `major.minor`.\n *\n * @category constants\n * @since 1.0.0-rc.1\n */\nexport const codexReleases: ReadonlyArray<string> = [\"0.159\", \"0.160\"]\n\n/**\n * What a Codex decode remembers between chunks.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport interface CodexState {\n /** Bytes after the last newline: a line the agent is still writing. */\n readonly pending: string\n /** Complete lines read so far. */\n readonly line: number\n /** Entries emitted so far. */\n readonly seq: number\n readonly session?: { readonly id: string; readonly format_version: string; readonly cwd: string } | undefined\n readonly goal?: string | undefined\n /** Code-mode scripts whose output has not arrived, by `call_id`: text the decoder keeps and never runs. */\n readonly calls?: Readonly<Record<string, CodexCall>> | undefined\n}\n\n/**\n * A Codex code-mode request waiting for its output: the tool's name and the script it was given.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport interface CodexCall {\n readonly name: string\n readonly input: string\n}\n\n/**\n * The state before the first byte.\n *\n * @category constructors\n * @since 1.0.0-rc.1\n */\nexport const codexStart: CodexState = { pending: \"\", line: 0, seq: 0 }\n\n/**\n * A decoded chunk: the entries it completed and the state to pass with the next chunk.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport interface Decoded<State = CodexState> {\n readonly state: State\n readonly entries: ReadonlyArray<Entry>\n}\n\ntype Json = Record<string, unknown>\nconst record = (value: unknown): Json =>\n typeof value === \"object\" && value !== null && !Array.isArray(value) ? value as Json : {}\nconst text = (value: unknown): string => typeof value === \"string\" ? value : \"\"\nconst list = (value: unknown): ReadonlyArray<unknown> => Array.isArray(value) ? value : []\nconst basename = (path: string): string => path.split(\"/\").filter(Boolean).at(-1) ?? path\n/** One complete line as a JSON record, or `undefined` when it is not one. */\nconst parseRow = (raw: string): Json | undefined => {\n try {\n const parsed: unknown = JSON.parse(raw)\n return typeof parsed === \"object\" && parsed !== null && !Array.isArray(parsed) ? parsed as Json : undefined\n } catch {\n return undefined\n }\n}\nconst helperName = (path: unknown): string => basename(text(path)) || \"helper\"\n\nconst reads = (parsed: unknown): ReadonlyArray<string> => {\n const parts = list(parsed).map(record)\n if (parts.length === 0 || parts.some((part) => ![\"read\", \"search\", \"list_files\"].includes(text(part[\"type\"])))) {\n return []\n }\n return parts.map((part) =>\n part[\"type\"] === \"read\"\n ? `Read ${text(part[\"name\"]) || basename(text(part[\"path\"]))}`\n : part[\"type\"] === \"search\"\n ? `Searched ${JSON.stringify(text(part[\"query\"]))}${part[\"path\"] ? ` in ${basename(text(part[\"path\"]))}` : \"\"}`\n : `Listed ${basename(text(part[\"path\"])) || \"files\"}`\n )\n}\n\n/** Lines of an edit string, without the newline that ends the last one. */\nconst linesOf = (value: string): ReadonlyArray<string> => value === \"\" ? [] : value.replace(/\\n$/, \"\").split(\"\\n\")\n\n/** An added or deleted file reports its content, not a diff: one hunk of the whole file, all `+` or all `-`. */\nconst wholeFile = (content: string, op: \"+\" | \"-\"): string => {\n const lines = linesOf(content)\n if (lines.length === 0) return \"\"\n return `@@ ${op === \"+\" ? `-0,0 +1,${lines.length}` : `-1,${lines.length} +0,0`} @@\\n${\n lines.map((line) => `${op}${line}`).join(\"\\n\")\n }\\n`\n}\n\nconst changeOf = (change: Json): Schema.Schema.Type<typeof EditedFile>[\"change\"] =>\n typeof change[\"move_path\"] === \"string\"\n ? \"renamed\"\n : change[\"type\"] === \"add\"\n ? \"added\"\n : change[\"type\"] === \"delete\"\n ? \"deleted\"\n : \"modified\"\n\n/**\n * The Codex record, event and item kinds this module names. Each list is closed: a kind outside it is a tagged\n * `unsupported_record`, so a new kind stops the import where a person can see it instead of vanishing.\n */\nconst codexSkippedRows = [\n \"turn_context\",\n \"world_state\",\n \"token_usage_record\",\n \"compacted\",\n \"inter_agent_communication_metadata\"\n]\nconst codexResponseItems = [\n \"message\",\n \"reasoning\",\n \"custom_tool_call\",\n \"custom_tool_call_output\",\n \"function_call\",\n \"function_call_output\",\n \"agent_message\"\n]\nconst codexSkippedEvents = [\"task_started\", \"token_count\", \"thread_settings_applied\"]\nconst codexItems = [\n \"UserMessage\",\n \"AgentMessage\",\n \"Reasoning\",\n \"CommandExecution\",\n \"FileChange\",\n \"ContextCompaction\",\n \"SubAgentActivity\",\n \"CollabAgentToolCall\",\n \"Extension\",\n \"McpToolCall\",\n \"FunctionCallOutput\",\n \"ImageView\"\n]\n\n/** The text of a list of `{type, text}` parts, as Codex and MCP servers write tool output. */\nconst partsText = (value: unknown): string =>\n typeof value === \"string\" ? value : list(value).map((each) => text(record(each)[\"text\"])).filter(Boolean).join(\"\\n\")\n\n/**\n * One completed Codex item as the part it reports, or `undefined` for items with nothing to show. `took` is the\n * wall time Codex recorded around the item (`completed_at_ms - started_at_ms`). The caller has checked the item's\n * type against `codexItems`.\n */\nconst itemPart = (item: Json, took: number): { readonly role: Entry[\"role\"]; readonly part: Part } | undefined => {\n switch (item[\"type\"]) {\n case \"UserMessage\":\n return {\n role: \"user\",\n part: { type: \"prompt\", text: list(item[\"content\"]).map((each) => text(record(each)[\"text\"])).join(\"\\n\") }\n }\n case \"AgentMessage\": {\n const content = list(item[\"content\"]).map(record)\n const said = content.map((each) => text(each[\"text\"])).filter(Boolean).join(\"\\n\")\n if (content.some((each) => each[\"type\"] === \"encrypted_content\")) {\n return { role: \"assistant\", part: { type: \"encrypted\" } }\n }\n return { role: \"assistant\", part: { type: \"text\", text: said, final: item[\"phase\"] === \"final_answer\" } }\n }\n case \"Reasoning\": {\n // Codex keeps reasoning encrypted; only a summary it chose to write is readable.\n const summary = list(item[\"summary_text\"]).map(text).filter(Boolean).join(\"\\n\")\n return summary === \"\"\n ? (item[\"encrypted_content\"] ? { role: \"assistant\", part: { type: \"encrypted\" } } : undefined)\n : { role: \"assistant\", part: { type: \"reasoning\", text: summary } }\n }\n case \"CommandExecution\": {\n const exit = typeof item[\"exit_code\"] === \"number\" ? item[\"exit_code\"] : undefined\n // Codex reports in_progress, completed, failed and declined; only a clean completion is ok.\n const status = item[\"status\"] === \"in_progress\"\n ? \"running\"\n : item[\"status\"] === \"completed\" && (exit ?? 0) === 0\n ? \"ok\"\n : \"error\"\n return {\n role: \"assistant\",\n part: {\n type: \"tool\",\n call_id: text(item[\"id\"]),\n command: list(item[\"command\"]).map(text).at(-1) ?? \"\",\n reads: reads(item[\"parsed_cmd\"]),\n status,\n ...(exit === undefined ? {} : { exit_code: exit }),\n output: text(item[\"aggregated_output\"]) || text(item[\"formatted_output\"]),\n duration_ms: took\n }\n }\n }\n case \"FileChange\":\n return {\n role: \"assistant\",\n part: {\n type: \"edit\",\n call_id: text(item[\"id\"]),\n outcome: item[\"status\"] === \"completed\" ? \"applied\" : \"failed\",\n files: Object.entries(record(item[\"changes\"])).map(([path, value]) => {\n const change = record(value)\n return {\n path,\n change: changeOf(change),\n ...(typeof change[\"move_path\"] === \"string\" ? { renamed_to: change[\"move_path\"] } : {}),\n diff: text(change[\"unified_diff\"]) ||\n wholeFile(text(change[\"content\"]), change[\"type\"] === \"delete\" ? \"-\" : \"+\")\n }\n })\n }\n }\n case \"ContextCompaction\":\n return { role: \"assistant\", part: { type: \"compaction\" } }\n case \"SubAgentActivity\":\n return {\n role: \"assistant\",\n part: {\n type: \"helper\",\n call_id: text(item[\"id\"]),\n agent: helperName(item[\"agent_path\"]),\n activity: text(item[\"kind\"])\n }\n }\n case \"CollabAgentToolCall\": {\n const agents = list(item[\"receiver_agents\"]).map((each) => helperName(record(each)[\"agent_path\"] ?? each))\n return {\n role: \"assistant\",\n part: {\n type: \"helper\",\n call_id: text(item[\"id\"]),\n agent: agents.join(\", \") || \"helpers\",\n activity: text(item[\"tool\"])\n }\n }\n }\n case \"Extension\": {\n const action = record(item[\"action\"])\n const query = text(item[\"query\"]) || text(action[\"query\"]) || text(action[\"pattern\"]) || text(action[\"url\"])\n return { role: \"assistant\", part: { type: \"search\", call_id: text(item[\"id\"]), query } }\n }\n case \"McpToolCall\": {\n // A tool another server ran for the agent: its request and the result the server reported.\n const result = record(item[\"result\"])\n const args = record(item[\"arguments\"])\n const name = [text(item[\"server\"]), text(item[\"tool\"])].filter(Boolean).join(\".\")\n const failed = item[\"status\"] !== \"completed\" || result[\"isError\"] === true\n return {\n role: \"assistant\",\n part: {\n type: \"tool\",\n call_id: text(item[\"id\"]),\n command: Object.keys(args).length === 0 ? name : `${name} ${JSON.stringify(args)}`,\n reads: [],\n status: item[\"status\"] === \"in_progress\" ? \"running\" : failed ? \"error\" : \"ok\",\n output: partsText(result[\"content\"]) || text(record(item[\"error\"])[\"message\"]),\n duration_ms: took\n }\n }\n }\n case \"FunctionCallOutput\":\n return {\n role: \"assistant\",\n part: {\n type: \"tool\",\n call_id: text(item[\"id\"]),\n command: [text(item[\"namespace\"]), text(item[\"name\"])].filter(Boolean).join(\".\"),\n reads: [],\n status: \"ok\",\n output: partsText(item[\"output\"]),\n duration_ms: took\n }\n }\n default:\n // ImageView, the one kind of `codexItems` left: an image the agent looked at.\n return {\n role: \"assistant\",\n part: {\n type: \"tool\",\n call_id: text(item[\"id\"]),\n command: `view_image ${text(item[\"path\"])}`,\n reads: [`Read ${basename(text(item[\"path\"]))}`],\n status: \"ok\",\n output: \"\",\n duration_ms: took\n }\n }\n }\n}\n\n/**\n * The first line of a code-mode output says how the script ended. A script that finished, or one still running in\n * a cell, repeats what completed items already report; any other ending is a failure only this row records.\n */\nconst scriptFailed = (output: string): boolean => !/^Script (?:completed|running)\\b/.test(output)\n\n/** The file a failed `apply_patch` names, when the report is that failure. */\nconst failedPatchPath = (output: string): string | undefined =>\n /apply_patch verification failed: Failed to find expected lines in ([^\\n]+):\\n/.exec(output)?.[1]\n\n/** The adapter profile `<profile>/<major.minor>` for a supported release, or `undefined`. */\nconst profileOf = (profile: string, releases: ReadonlyArray<string>, release: string): string | undefined => {\n const minor = /^(\\d+\\.\\d+)\\./.exec(release)?.[1]\n return minor !== undefined && releases.includes(minor) ? `${profile}/${minor}` : undefined\n}\n\n/**\n * Decode the next chunk of a Codex rollout. Pass `codexStart` with the first chunk and the returned state\n * with each following one; any partition of the same bytes yields the same entries.\n *\n * @category decoding\n * @since 1.0.0-rc.1\n */\nexport const decodeCodex = (state: CodexState, chunk: string): Result.Result<Decoded, ExternalTranscriptError> => {\n const lines = (state.pending + chunk).split(\"\\n\")\n const pending = lines.pop()!\n let { line, seq, session, goal } = state\n const calls = new Map(Object.entries(state.calls ?? {}))\n const entries: Array<Entry> = []\n const fail = (code: ExternalTranscriptErrorCode, message: string) =>\n Result.fail(new ExternalTranscriptError({ code, message, line }))\n /** A kind outside the named lists; a kind that is not even a string is a record of another shape. */\n const unread = (what: string, type: unknown) =>\n typeof type === \"string\" && type !== \"\"\n ? fail(\"unsupported_record\", `Codex wrote ${what} this release does not read: ${type}`)\n : fail(\"malformed_record\", `Codex rollout line ${line} names no ${what.replace(/^an? /, \"\")} type.`)\n for (const raw of lines) {\n line++\n if (raw.trim() === \"\") continue\n const row = parseRow(raw)\n if (row === undefined) return fail(\"malformed_record\", `Codex rollout line ${line} is not a JSON record.`)\n const payload = record(row[\"payload\"])\n if (row[\"type\"] === \"session_meta\") {\n const release = text(payload[\"cli_version\"])\n const format_version = profileOf(\"codex-rollout\", codexReleases, release)\n if (format_version === undefined) {\n return fail(\n \"unsupported_version\",\n `Codex ${release || \"(no release)\"} wrote this rollout; supported: ${codexReleases.join(\", \")}.`\n )\n }\n session = { id: text(payload[\"id\"]) || text(payload[\"session_id\"]), format_version, cwd: text(payload[\"cwd\"]) }\n continue\n }\n if (session === undefined) {\n return fail(\"missing_version\", `Codex rollout line ${line} comes before its session record.`)\n }\n const found: Array<{ readonly role: Entry[\"role\"]; readonly part: Part; readonly turn?: string }> = []\n if (row[\"type\"] === \"response_item\") {\n if (!codexResponseItems.includes(text(payload[\"type\"]))) return unread(\"a response item\", payload[\"type\"])\n switch (payload[\"type\"]) {\n case \"custom_tool_call\": {\n const id = payload[\"call_id\"], name = payload[\"name\"], input = payload[\"input\"]\n if (typeof id !== \"string\" || id === \"\" || typeof name !== \"string\" || typeof input !== \"string\") {\n return fail(\"malformed_record\", `Codex tool request on line ${line} names no call, tool or input.`)\n }\n calls.set(id, { name, input })\n break\n }\n case \"custom_tool_call_output\": {\n const id = text(payload[\"call_id\"])\n const call = calls.get(id)\n calls.delete(id)\n const output = partsText(payload[\"output\"])\n // A script that finished repeats its completed items. One that failed has no item: keep its report with\n // the request that started it, so a failed edit is never silently missing.\n if (!scriptFailed(output)) break\n found.push({\n role: \"assistant\",\n part: {\n type: \"tool\",\n call_id: id,\n command: call?.input ?? \"\",\n reads: [],\n status: \"error\",\n output,\n duration_ms: 0\n }\n })\n const path = failedPatchPath(output)\n if (path !== undefined) {\n // The report names the file and no change: the diff is empty because nothing was observed to change.\n found.push({\n role: \"assistant\",\n part: { type: \"edit\", call_id: id, files: [{ path, change: \"modified\", diff: \"\" }], outcome: \"failed\" }\n })\n }\n break\n }\n case \"agent_message\": {\n // A message between this agent and one it works with. Codex encrypts the body; the header beside it\n // names agents, and a name in a transcript confers nothing.\n const content = payload[\"content\"]\n if (!Array.isArray(content)) {\n return fail(\"malformed_record\", `Codex agent message on line ${line} has no content list.`)\n }\n let encrypted = false\n const said: Array<string> = []\n for (const each of content) {\n const block = record(each)\n if (block[\"type\"] === \"encrypted_content\") {\n if (typeof block[\"encrypted_content\"] !== \"string\" || block[\"encrypted_content\"] === \"\") {\n return fail(\"malformed_record\", `Codex encrypted body on line ${line} is empty.`)\n }\n encrypted = true\n } else if (block[\"type\"] === \"input_text\" || block[\"type\"] === \"output_text\") {\n if (typeof block[\"text\"] !== \"string\") {\n return fail(\"malformed_record\", `Codex agent message on line ${line} has a text part without text.`)\n }\n said.push(block[\"text\"])\n } else {\n return unread(\"a message part\", block[\"type\"])\n }\n }\n const turn = text(record(payload[\"internal_chat_message_metadata_passthrough\"])[\"turn_id\"])\n // One placeholder stands for the whole body, header included: nothing readable is shown beside it.\n if (encrypted) found.push({ role: \"assistant\", part: { type: \"encrypted\" }, turn })\n else if (said.join(\"\\n\") !== \"\") {\n found.push({ role: \"assistant\", part: { type: \"text\", text: said.join(\"\\n\"), final: false }, turn })\n }\n break\n }\n // message, reasoning, function_call, function_call_output: the model-facing copy of completed items.\n }\n } else if (row[\"type\"] === \"event_msg\") {\n switch (payload[\"type\"]) {\n case \"item_completed\": {\n const started = payload[\"started_at_ms\"], completed = payload[\"completed_at_ms\"]\n const took = typeof started === \"number\" && typeof completed === \"number\" ? completed - started : 0\n const item = record(payload[\"item\"])\n if (!codexItems.includes(text(item[\"type\"]))) return unread(\"an item\", item[\"type\"])\n if (item[\"type\"] === \"UserMessage\" || item[\"type\"] === \"AgentMessage\") {\n const content = item[\"content\"]\n if (!Array.isArray(content)) {\n return fail(\"malformed_record\", `Codex message on line ${line} has no content list.`)\n }\n // Ciphertext stands for the whole body, so the parts beside it are not read.\n if (!content.some((each) => record(each)[\"type\"] === \"encrypted_content\")) {\n for (const each of content) {\n const block = record(each)\n if (block[\"type\"] !== (item[\"type\"] === \"UserMessage\" ? \"text\" : \"Text\")) {\n return unread(\"a message part\", block[\"type\"])\n }\n if (typeof block[\"text\"] !== \"string\") {\n return fail(\"malformed_record\", `Codex message on line ${line} has a text part without text.`)\n }\n }\n }\n }\n const part = itemPart(item, Number.isFinite(took) && took > 0 ? took : 0)\n if (part !== undefined) found.push({ ...part, turn: text(payload[\"turn_id\"]) })\n break\n }\n case \"thread_goal_updated\": {\n const update = record(payload[\"goal\"])\n const key = `${text(update[\"status\"])}:${text(update[\"objective\"])}`\n // Codex repeats a goal on every usage update; only a new objective or status is news.\n if (key !== goal) {\n found.push({\n role: \"user\",\n part: { type: \"goal\", objective: text(update[\"objective\"]), status: text(update[\"status\"]) }\n })\n }\n goal = key\n break\n }\n case \"task_complete\": {\n // A turn's end repeats its last message, and carries the failure when the turn ended in one: a usage\n // limit, a model at capacity, a refused request.\n if (payload[\"error\"] === undefined || payload[\"error\"] === null) break\n const message = text(record(payload[\"error\"])[\"message\"])\n if (message === \"\") return fail(\"malformed_record\", `Codex failure on line ${line} gives no message.`)\n found.push({ role: \"assistant\", part: { type: \"error\", message }, turn: text(payload[\"turn_id\"]) })\n break\n }\n case \"error\":\n case \"turn_aborted\": {\n // What Codex said went wrong, or why the turn stopped (\"interrupted\").\n const message = text(payload[\"message\"]) || text(payload[\"reason\"])\n if (message === \"\") {\n return fail(\"malformed_record\", `Codex failure on line ${line} gives no message or reason.`)\n }\n found.push({ role: \"assistant\", part: { type: \"error\", message }, turn: text(payload[\"turn_id\"]) })\n break\n }\n default:\n if (!codexSkippedEvents.includes(text(payload[\"type\"]))) return unread(\"an event\", payload[\"type\"])\n }\n } else if (!codexSkippedRows.includes(text(row[\"type\"]))) {\n return unread(\"a record\", row[\"type\"])\n }\n const at = Date.parse(text(row[\"timestamp\"])) || 0\n const sessionId = session.id, format_version = session.format_version\n found.forEach(({ part, role, turn }, index) => {\n entries.push({\n origin: \"external\",\n agent_kind: \"codex\",\n format_version,\n session_id: sessionId,\n source_id: index === 0 ? `${sessionId}:${line}` : `${sessionId}:${line}#${index}`,\n read_only: true,\n seq: seq++,\n at,\n ...(turn ? { turn_id: turn } : {}),\n role,\n part\n })\n })\n }\n return Result.succeed({\n state: { pending, line, seq, session, goal, ...(calls.size === 0 ? {} : { calls: Object.fromEntries(calls) }) },\n entries\n })\n}\n\n/**\n * The Claude Code release lines whose transcript shape this module reads, by `major.minor`.\n *\n * @category constants\n * @since 1.0.0-rc.1\n */\nexport const claudeReleases: ReadonlyArray<string> = [\"2.1\"]\n\n/**\n * A Claude Code tool call waiting for its result: the tool's name, its input and when the agent asked.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport interface ClaudeCall {\n readonly name: string\n readonly input: unknown\n /** Milliseconds since the epoch, from the `tool_use` record. */\n readonly at: number\n}\n\n/**\n * What a Claude Code decode remembers between chunks.\n *\n * @category models\n * @since 1.0.0-rc.1\n */\nexport interface ClaudeState {\n /** Bytes after the last newline: a line the agent is still writing. */\n readonly pending: string\n /** Complete lines read so far. */\n readonly line: number\n /** Entries emitted so far. */\n readonly seq: number\n /** The session the first conversation record named. */\n readonly session?: string | undefined\n /** The `promptId` of the latest user record: the turn later entries belong to. */\n readonly turn?: string | undefined\n /** Tool calls whose result has not arrived, by `tool_use` id. */\n readonly calls: Readonly<Record<string, ClaudeCall>>\n}\n\n/**\n * The state before the first byte.\n *\n * @category constructors\n * @since 1.0.0-rc.1\n */\nexport const claudeStart: ClaudeState = { pending: \"\", line: 0, seq: 0, calls: {} }\n\n/** Content as blocks: Claude Code writes a plain prompt as a string and everything else as a block list. */\nconst blocksOf = (content: unknown): ReadonlyArray<Json> =>\n typeof content === \"string\" ? [{ type: \"text\", text: content }] : list(content).map(record)\n\nconst textOf = (blocks: ReadonlyArray<Json>): string =>\n blocks.filter((block) => block[\"type\"] === \"text\").map((block) => text(block[\"text\"])).join(\"\\n\")\n\n/** A user turn is the owner's when Claude Code classified it human or did not classify it. */\nconst byOwner = (origin: unknown): boolean =>\n origin === undefined || origin === null || record(origin)[\"kind\"] === \"human\"\n\n/**\n * A requested replacement as one hunk. Claude Code reports no position for a replacement it did not apply, so the\n * hunk starts at line 1.\n */\nconst replacement = (before: string, after: string): string => {\n const removed = linesOf(before), added = linesOf(after)\n if (removed.length + added.length === 0) return \"\"\n return `@@ -1,${removed.length} +1,${added.length} @@\\n${\n [...removed.map((line) => `-${line}`), ...added.map((line) => `+${line}`)].join(\"\\n\")\n }\\n`\n}\n\nconst count = (value: unknown): number => typeof value === \"number\" ? value : 0\n\n/** The hunks Claude Code reported for an applied edit (`toolUseResult.structuredPatch`). */\nconst reportedPatch = (patch: unknown): string =>\n list(patch).map(record).map((hunk) =>\n `@@ -${count(hunk[\"oldStart\"])},${count(hunk[\"oldLines\"])} +${count(hunk[\"newStart\"])},${\n count(hunk[\"newLines\"])\n } @@\\n${list(hunk[\"lines\"]).map(text).join(\"\\n\")}\\n`\n ).join(\"\")\n\n/** The edit the agent asked for, from the tool input, when Claude Code reported no hunks. */\nconst requestedPatch = (name: string, input: Json): string => {\n switch (name) {\n case \"Write\":\n return wholeFile(text(input[\"content\"]), \"+\")\n case \"NotebookEdit\":\n return wholeFile(text(input[\"new_source\"]), \"+\")\n case \"MultiEdit\":\n return list(input[\"edits\"]).map(record).map((edit) =>\n replacement(text(edit[\"old_string\"]), text(edit[\"new_string\"]))\n ).join(\"\")\n default:\n return replacement(text(input[\"old_string\"]), text(input[\"new_string\"]))\n }\n}\n\n/** The reads label of a tool that only reads, searches or lists, or none. */\nconst claudeReads = (name: string, input: Json): ReadonlyArray<string> => {\n const path = text(input[\"path\"])\n switch (name) {\n case \"Read\":\n return [`Read ${basename(text(input[\"file_path\"]))}`]\n case \"Grep\":\n case \"Glob\":\n return [`Searched ${JSON.stringify(text(input[\"pattern\"]))}${path ? ` in ${basename(path)}` : \"\"}`]\n case \"LS\":\n return [`Listed ${basename(path) || \"files\"}`]\n default:\n return []\n }\n}\n\n/** One finished tool call: its `tool_use` (when this transcript holds it) and the `tool_result` that ended it. */\nconst claudeToolPart = (\n id: string,\n call: ClaudeCall | undefined,\n result: { readonly failed: boolean; readonly output: string; readonly report: Json; readonly took: number }\n): Part => {\n const name = call?.name ?? \"\"\n const input = record(call?.input)\n switch (name) {\n case \"Edit\":\n case \"Write\":\n case \"MultiEdit\":\n case \"NotebookEdit\":\n return {\n type: \"edit\",\n call_id: id,\n files: [{\n path: text(input[\"file_path\"]) || text(input[\"notebook_path\"]),\n change: name === \"Write\" && result.report[\"type\"] === \"create\" ? \"added\" : \"modified\",\n diff: reportedPatch(result.report[\"structuredPatch\"]) || requestedPatch(name, input)\n }],\n outcome: result.failed ? \"failed\" : \"applied\"\n }\n case \"WebSearch\":\n return { type: \"search\", call_id: id, query: text(input[\"query\"]) }\n case \"WebFetch\":\n return { type: \"search\", call_id: id, query: text(input[\"url\"]) }\n case \"Task\":\n case \"Agent\":\n return {\n type: \"helper\",\n call_id: id,\n agent: text(input[\"subagent_type\"]) || \"general-purpose\",\n activity: text(input[\"description\"])\n }\n }\n const exit = result.failed ? /^Exit code (\\d+)/.exec(result.output)?.[1] : undefined\n return {\n type: \"tool\",\n call_id: id,\n command: name === \"Bash\"\n ? text(input[\"command\"])\n : Object.keys(input).length === 0\n ? name\n : `${name} ${JSON.stringify(input)}`,\n reads: claudeReads(name, input),\n status: result.failed ? \"error\" : \"ok\",\n ...(exit === undefined ? {} : { exit_code: Number(exit) }),\n output: result.output,\n duration_ms: result.took\n }\n}\n\n// The Claude Code record, status, attachment and block kinds this module names. Each list is closed: a kind\n// outside it is a tagged `unsupported_record`, so a new kind stops the import where a person can see it.\n\n/** Rows outside the conversation chain: session bookkeeping that names no speaker and says nothing. */\nconst claudeSkippedRows = [\n \"mode\",\n \"permission-mode\",\n \"atis-latch\",\n \"last-prompt\",\n \"ai-title\",\n \"custom-title\",\n \"agent-name\",\n \"queue-operation\",\n \"file-history-snapshot\",\n \"file-history-delta\",\n \"cost-state\",\n \"pr-link\",\n \"bridge-session\"\n]\n/** Status lines: turn timing, hook summaries, retries, model fallback and scheduled-task notices. */\nconst claudeSkippedStatus = [\n \"turn_duration\",\n \"informational\",\n \"stop_hook_summary\",\n \"away_summary\",\n \"api_error\",\n \"local_command\",\n \"scheduled_task_fire\",\n \"agents_killed\",\n \"model_refusal_fallback\"\n]\n/** Context Claude Code attaches for the model; `queued_command` alone can carry the owner's words. */\nconst claudeSkippedAttachments = [\n \"agent_listing_delta\",\n \"auto_mode\",\n \"bash_output_audience_note\",\n \"batching_reminder_sent\",\n \"budget_usd\",\n \"command_permissions\",\n \"compact_file_reference\",\n \"credential_org\",\n \"date\",\n \"deferred_tools_delta\",\n \"deferred_tools_record\",\n \"diagnostics\",\n \"directory\",\n \"edited_text_file\",\n \"environment\",\n \"file\",\n \"goal_status\",\n \"hook_additional_context\",\n \"hook_cancelled\",\n \"hook_non_blocking_error\",\n \"hook_system_message\",\n \"instructions\",\n \"invoked_skills\",\n \"max_turns_reached\",\n \"mcp_instructions_delta\",\n \"model\",\n \"nested_memory\",\n \"plan_mode\",\n \"prompt_snapshot\",\n \"read_truncation_notice\",\n \"remote_session_change\",\n \"sandbox_instructions\",\n \"session_context\",\n \"silent_turn_reminder\",\n \"skill_listing\",\n \"skill_mention\",\n \"task_reminder\",\n \"task_status\",\n \"thinking_drop\",\n \"thinking_stripped\",\n \"total_tokens_reminder\",\n \"ultra_effort_enter\",\n \"ultra_effort_exit\",\n \"workflow_keyword_request\"\n]\n\n/** The owner's words in a user record, or `undefined` for Claude Code's own output of a local command. */\nconst ownerText = (said: string): Part | undefined => {\n if (/^\\[Request interrupted by user[^\\]]*\\]$/.test(said)) return { type: \"error\", message: said }\n if (/^<(?:local-command-std(?:out|err)|bash-std(?:out|err))>/.test(said)) return undefined\n // Claude Code writes a slash command as tags that open the record; a prompt that mentions them stays as typed.\n const command = /^<command-(?:name|message)>/.test(said)\n ? /<command-name>([^<]*)<\\/command-name>/.exec(said)?.[1]\n : undefined\n if (command !== undefined) {\n const args = /<command-args>([\\s\\S]*?)<\\/command-args>/.exec(said)?.[1]?.trim()\n return { type: \"prompt\", text: args ? `${command} ${args}` : command }\n }\n const shell = /^<bash-input>([\\s\\S]*)<\\/bash-input>$/.exec(said)?.[1]\n return { type: \"prompt\", text: shell === undefined ? said : `!${shell.trim()}` }\n}\n\n/**\n * Decode the next chunk of a Claude Code session transcript. Pass `claudeStart` with the first chunk and the\n * returned state with each following one; any partition of the same bytes yields the same entries.\n *\n * Entries follow the order of the records that complete them. A tool call is held in `state.calls` from its\n * `tool_use` record until the `tool_result` with the same id arrives, and becomes one entry at the result's line;\n * a call whose result never arrives emits nothing.\n *\n * @category decoding\n * @since 1.0.0-rc.1\n */\nexport const decodeClaude = (\n state: ClaudeState,\n chunk: string\n): Result.Result<Decoded<ClaudeState>, ExternalTranscriptError> => {\n const lines = (state.pending + chunk).split(\"\\n\")\n const pending = lines.pop()!\n let { line, seq, session, turn } = state\n const calls = new Map(Object.entries(state.calls))\n const entries: Array<Entry> = []\n const fail = (code: ExternalTranscriptErrorCode, message: string) =>\n Result.fail(new ExternalTranscriptError({ code, message, line }))\n /** A kind outside the named lists; a kind that is not even a string is a record of another shape. */\n const unread = (what: string, type: unknown) =>\n typeof type === \"string\" && type !== \"\"\n ? fail(\"unsupported_record\", `Claude Code wrote ${what} this release does not read: ${type}`)\n : fail(\"malformed_record\", `Claude Code transcript line ${line} names no ${what.replace(/^an? /, \"\")} type.`)\n for (const raw of lines) {\n line++\n if (raw.trim() === \"\") continue\n const row = parseRow(raw)\n if (row === undefined) return fail(\"malformed_record\", `Claude Code transcript line ${line} is not a JSON record.`)\n // Bookkeeping rows say nothing in the conversation, whether or not a release gives them a uuid.\n if (claudeSkippedRows.includes(text(row[\"type\"]))) continue\n if (![\"user\", \"assistant\", \"system\", \"attachment\"].includes(text(row[\"type\"]))) {\n return unread(\"a record\", row[\"type\"])\n }\n // Conversation records chain by uuid: one without it is not the shape this profile reads.\n if (typeof row[\"uuid\"] !== \"string\") {\n return fail(\"malformed_record\", `Claude Code transcript line ${line} is a conversation record without a uuid.`)\n }\n const release = text(row[\"version\"])\n if (release === \"\") return fail(\"missing_version\", `Claude Code transcript line ${line} names no release.`)\n const format_version = profileOf(\"claude-code\", claudeReleases, release)\n if (format_version === undefined) {\n return fail(\n \"unsupported_version\",\n `Claude Code ${release} wrote this transcript; supported: ${claudeReleases.join(\", \")}.`\n )\n }\n session ??= text(row[\"sessionId\"]) || undefined\n if (session === undefined) {\n return fail(\"malformed_record\", `Claude Code transcript line ${line} names no session.`)\n }\n const sessionId = session\n // A subagent's records belong to its own transcript; the main one shows the call as a helper.\n if (row[\"isSidechain\"] === true) continue\n const at = Date.parse(text(row[\"timestamp\"])) || 0\n if (row[\"type\"] === \"user\" && typeof row[\"promptId\"] === \"string\" && row[\"promptId\"] !== \"\") {\n turn = row[\"promptId\"]\n }\n const found: Array<{ readonly role: Entry[\"role\"]; readonly part: Part }> = []\n const said = (part: Part) => found.push({ role: \"assistant\", part })\n const message = record(row[\"message\"])\n if (\n (row[\"type\"] === \"user\" || row[\"type\"] === \"assistant\") && typeof message[\"content\"] !== \"string\" &&\n !Array.isArray(message[\"content\"])\n ) {\n return fail(\"malformed_record\", `Claude Code transcript line ${line} has no message content.`)\n }\n switch (row[\"type\"]) {\n case \"user\": {\n const blocks = blocksOf(message[\"content\"])\n for (const block of blocks) {\n if (block[\"type\"] === \"tool_result\") {\n const callId = text(block[\"tool_use_id\"])\n const call = calls.get(callId)\n calls.delete(callId)\n const content = block[\"content\"]\n said(claudeToolPart(callId, call, {\n failed: block[\"is_error\"] === true,\n output: typeof content === \"string\" ? content : textOf(list(content).map(record)),\n report: record(row[\"toolUseResult\"]),\n took: call !== undefined && call.at > 0 && at > call.at ? at - call.at : 0\n }))\n } else if (block[\"type\"] !== \"text\" && block[\"type\"] !== \"image\") {\n return unread(\"a content block\", block[\"type\"])\n }\n }\n const words = textOf(blocks)\n // Skill bodies, caveats and summaries Claude Code injects are not the owner's; nor are task notifications\n // or messages from other sessions.\n if (words === \"\" || row[\"isMeta\"] === true || row[\"isCompactSummary\"] === true || !byOwner(row[\"origin\"])) break\n const part = ownerText(words)\n if (part !== undefined) found.push({ role: part.type === \"prompt\" ? \"user\" : \"assistant\", part })\n break\n }\n case \"assistant\": {\n const blocks = blocksOf(message[\"content\"])\n if (row[\"isApiErrorMessage\"] === true) {\n said({ type: \"error\", message: textOf(blocks) || text(row[\"error\"]) })\n break\n }\n for (const block of blocks) {\n switch (block[\"type\"]) {\n case \"text\":\n if (text(block[\"text\"]) !== \"\") {\n said({ type: \"text\", text: text(block[\"text\"]), final: message[\"stop_reason\"] === \"end_turn\" })\n }\n break\n case \"thinking\":\n // Claude Code keeps only the signature of most thinking; an empty body has nothing to show.\n if (text(block[\"thinking\"]) !== \"\") said({ type: \"reasoning\", text: text(block[\"thinking\"]) })\n break\n case \"redacted_thinking\":\n break\n case \"fallback\":\n // A notice that Claude Code answered with another model: a status line, not something it said.\n break\n case \"tool_use\":\n if (typeof block[\"id\"] !== \"string\" || block[\"id\"] === \"\") {\n return fail(\"malformed_record\", `Claude Code tool request on line ${line} names no call.`)\n }\n calls.set(block[\"id\"], { name: text(block[\"name\"]), input: block[\"input\"] ?? {}, at })\n break\n default:\n return unread(\"a content block\", block[\"type\"])\n }\n }\n break\n }\n case \"system\":\n if (row[\"subtype\"] === \"compact_boundary\") said({ type: \"compaction\" })\n else if (!claudeSkippedStatus.includes(text(row[\"subtype\"]))) return unread(\"a status record\", row[\"subtype\"])\n break\n case \"attachment\": {\n // Context Claude Code attaches for the model, except a prompt the owner queued while the agent worked.\n const attachment = record(row[\"attachment\"])\n if (attachment[\"type\"] !== \"queued_command\") {\n if (!claudeSkippedAttachments.includes(text(attachment[\"type\"]))) {\n return unread(\"an attachment\", attachment[\"type\"])\n }\n break\n }\n if (\n attachment[\"commandMode\"] === \"prompt\" && attachment[\"isMeta\"] !== true && byOwner(attachment[\"origin\"])\n ) {\n const words = textOf(blocksOf(attachment[\"prompt\"]))\n if (words !== \"\") found.push({ role: \"user\", part: { type: \"prompt\", text: words } })\n }\n break\n }\n }\n found.forEach(({ part, role }, index) => {\n entries.push({\n origin: \"external\",\n agent_kind: \"claude-code\",\n format_version,\n session_id: sessionId,\n source_id: index === 0 ? `${sessionId}:${line}` : `${sessionId}:${line}#${index}`,\n read_only: true,\n seq: seq++,\n at,\n ...(turn === undefined ? {} : { turn_id: turn }),\n role,\n part\n })\n })\n }\n return Result.succeed({\n state: { pending, line, seq, session, turn, calls: Object.fromEntries(calls) },\n entries\n })\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyBA,YAAuB;AACvB,oBAA+B;AAQxB,MAAM,YAAY,qBAAO,SAAS,CAAC,SAAS,aAAa,CAAC;AAgB1D,MAAM,aAAa,qBAAO,OAAO;AAAA,EACtC,MAAM,qBAAO;AAAA,EACb,QAAQ,qBAAO,SAAS,CAAC,SAAS,YAAY,WAAW,SAA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CHANGED
|
@@ -167,5 +167,5 @@ export declare const projectResult: (entries: ReadonlyArray<JournalEvent.Entry>)
|
|
|
167
167
|
* @since 1.0.0-rc.1
|
|
168
168
|
*/
|
|
169
169
|
export { decodeClaude, decodeCodex } from "./ExternalTranscript.ts";
|
|
170
|
-
export type {
|
|
170
|
+
export type { Decoded as ExternalDecoded, Entry as ExternalEntry } from "./ExternalTranscript.ts";
|
|
171
171
|
//# sourceMappingURL=Transcript.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transcript.d.ts","sourceRoot":"","sources":["../../src/Transcript.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAA;AACtC,OAAO,KAAK,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAKhD;;;;;GAKG;AACH,eAAO,MAAM,cAAc,IAAI,CAAA;AAE/B;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,mBAAmB,CAAA;AAElD;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,GAAG,OAAO,kBAAkB,GAAG,MAAM,EAAE,CAAA;AAEtE;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAC1B,SAAS,aAAa,CAAC,YAAY,CAAC,KAAK,CAAC,KACzC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAclC,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,iDAAyC,CAAA;AAEzE;;;;;;GAMG;AACH,MAAM,MA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;;;;;;;;GAoBG;AACH,eAAO,MAAM,kBAAkB,GAC7B,SAAS,aAAa,CAAC,YAAY,CAAC,KAAK,CAAC,KACzC,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,eAAe,CAwP/C,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GACxB,SAAS,aAAa,CAAC,YAAY,CAAC,KAAK,CAAC,KACzC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,eAAe,CAC2B,CAAA;AAEhG;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACnE,YAAY,EAAE,OAAO,IAAI,eAAe,EAAE,KAAK,IAAI,aAAa,EAAE,MAAM,yBAAyB,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Transcript.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Transcript projection from durable journal entries.\n *\n * The transcript grows: what the model saw is what it said plus what the\n * harness answered, in journal order. A `continue` used to be able to replace\n * the whole projection with a list of messages the cell had written for its\n * successor, and that branch is gone with the surface that produced it \u2014 a\n * journal from those waves still decodes, and its `context` entries are simply\n * not read.\n *\n * @since 0.1.0\n */\n\nimport * as Fault from \"@smthrs/flow/Fault\"\nimport type { JournalEvent } from \"@smthrs/journal\"\nimport { ModelRequest } from \"@smthrs/model\"\nimport { Result, Schema } from \"effect\"\nimport * as AgentEvent from \"./AgentEvent.ts\"\nimport type * as Cell from \"./Cell.ts\"\nimport type * as EngineLike from \"./EngineLike.ts\"\nimport * as FailedCall from \"./FailedCall.ts\"\nimport { HarnessError } from \"./HarnessError.ts\"\nimport * as DemandText from \"./internal/demandText.ts\"\nimport { printsObservation } from \"./internal/printsObservation.ts\"\nimport * as UnobservedCall from \"./internal/unobservedCall.ts\"\n\n/**\n * Journal and model-key format after summaries became user context.\n *\n * @category constants\n * @since 1.0.0-rc.0\n */\nexport const journalVersion = 2\n\n/**\n * The event-type namespace a session journals its controller events under.\n *\n * Resume validation reads only the entries under this prefix, and the writer\n * that produces them lives in another package, so the prefix is exported here\n * rather than spelled twice: a writer types its event types as\n * {@link ControlEventType} and a rename fails to compile instead of silently\n * emptying the set {@link validateJournal} inspects.\n *\n * @category constants\n * @since 1.0.0-rc.0\n */\nexport const controlEventPrefix = \"control.agent.\"\n\n/**\n * An event type {@link validateJournal} validates.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport type ControlEventType = `${typeof controlEventPrefix}${string}`\n\n/**\n * Refuses history whose replay could address different sealed model steps.\n * Historical display projection is separate from permission to resume.\n *\n * @category validation\n * @since 1.0.0-rc.0\n */\nexport const validateJournal = (\n entries: ReadonlyArray<JournalEvent.Entry>\n): Result.Result<void, HarnessError> => {\n for (const entry of entries) {\n if (!entry.eventType.startsWith(controlEventPrefix)) continue\n const payload = entry.payload as Record<string, unknown> | null\n if (payload === null || typeof payload !== \"object\" || payload[\"journalVersion\"] !== journalVersion) {\n return Result.fail(\n new HarnessError({\n code: \"incompatible_journal\",\n message: `Journal sequence ${entry.seq} predates harness journal format ${journalVersion}; start a new run.`\n })\n )\n }\n }\n return Result.succeed(undefined)\n}\n\n/**\n * Stable failures produced while projecting a durable transcript.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport const TranscriptErrorCode = Schema.Literals([\"projection_failed\"])\n\n/**\n * Stable failures produced while projecting a durable transcript.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport type TranscriptErrorCode = typeof TranscriptErrorCode.Type\n\n/**\n * Stable failures produced while projecting a durable transcript.\n *\n * @category errors\n * @since 0.1.0\n * @slop\n */\nexport class TranscriptError extends Schema.TaggedError<TranscriptError>()(\"flows/harness/TranscriptError\", {\n code: TranscriptErrorCode,\n message: Schema.String,\n cause: Schema.optional(Schema.Defect())\n}) {}\nFault.register(\"flows/harness/TranscriptError\", { projection_failed: \"bug\" } satisfies Fault.Rows<TranscriptErrorCode>)\n\n/**\n * The kind and message of one projected transcript item.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport interface ProjectedMessage {\n readonly kind: \"transcript\" | \"summary\" | \"steering\"\n readonly message: ModelRequest.Message\n}\n\n/**\n * A projection with the compaction replacement identity, when one was recorded.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport interface ProjectedState {\n readonly messages: ReadonlyArray<ProjectedMessage>\n readonly replaced?: string | undefined\n readonly cell: CellEvidence\n}\n\n/**\n * Schema-decoded cell evidence consumed while rebuilding a journal.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport interface CellEvidence {\n readonly produced: ReadonlyArray<Cell.Source>\n /**\n * What each frame printed, in journal order.\n *\n * The print buffer is the whole of the context channel: it is what the NEXT\n * model turn reads, and `AgentEvent.CellPrinted` is journaled rather than\n * derived precisely so a projection can rebuild that window without\n * re-running anything. It was missing from this decoder, so a transcript\n * projected from a harness-native journal could not reconstruct what the\n * model saw.\n */\n readonly printed: ReadonlyArray<AgentEvent.CellPrinted>\n readonly callsStarted: ReadonlyArray<Cell.Call>\n readonly callsSettled: ReadonlyArray<AgentEvent.CellCallSettled>\n readonly settled: ReadonlyArray<AgentEvent.CellSettled>\n readonly transitions: ReadonlyArray<Cell.Transition>\n readonly suspensions: ReadonlyArray<EngineLike.SuspendReason>\n readonly aborts: ReadonlyArray<string>\n}\n\n/** The one journal-event-type table; see `AgentEvent.eventType`. */\nconst eventType = AgentEvent.eventType\n\nconst projectionFailed = (entry: JournalEvent.Entry, cause: unknown): TranscriptError =>\n new TranscriptError({\n code: \"projection_failed\",\n message: `Invalid ${entry.eventType} payload at journal sequence ${entry.seq}`,\n cause\n })\n\nconst decode = <A>(\n decodePayload: (payload: unknown) => Result.Result<A, unknown>,\n entry: JournalEvent.Entry\n): Result.Result<A, TranscriptError> =>\n Result.mapError(decodePayload(entry.payload), (cause) => projectionFailed(entry, cause))\n\nconst ordered = (entries: ReadonlyArray<JournalEvent.Entry>): ReadonlyArray<JournalEvent.Entry> =>\n [...entries].sort((left, right) => left.seq - right.seq)\n\nconst decodeModelSettled = Schema.decodeUnknownResult(AgentEvent.ModelSettled)\nconst decodeSteeringDrained = Schema.decodeUnknownResult(AgentEvent.SteeringDrained)\nconst decodeCompactionSettled = Schema.decodeUnknownResult(AgentEvent.CompactionSettled)\nconst decodeCellPrinted = Schema.decodeUnknownResult(AgentEvent.CellPrinted)\nconst decodeCellProduced = Schema.decodeUnknownResult(AgentEvent.CellProduced)\nconst decodeCellCallStarted = Schema.decodeUnknownResult(AgentEvent.CellCallStarted)\nconst decodeCellCallSettled = Schema.decodeUnknownResult(AgentEvent.CellCallSettled)\nconst decodeCellSettled = Schema.decodeUnknownResult(AgentEvent.CellSettled)\nconst decodeTransitionApplied = Schema.decodeUnknownResult(AgentEvent.TransitionApplied)\nconst decodeSuspended = Schema.decodeUnknownResult(AgentEvent.Suspended)\nconst decodeAborted = Schema.decodeUnknownResult(AgentEvent.Aborted)\nconst decodeReadOnlyDemandIssued = Schema.decodeUnknownResult(AgentEvent.ReadOnlyDemandIssued)\nconst decodeRepeatDemanded = Schema.decodeUnknownResult(AgentEvent.RepeatDemanded)\nconst decodeNarrowedDemanded = Schema.decodeUnknownResult(AgentEvent.NarrowedDemanded)\nconst decodeNarrowOnlyDemanded = Schema.decodeUnknownResult(AgentEvent.NarrowOnlyDemanded)\nconst decodeUnmovedDemanded = Schema.decodeUnknownResult(AgentEvent.UnmovedDemanded)\nconst decodeUnresolvedDemanded = Schema.decodeUnknownResult(AgentEvent.UnresolvedDemanded)\nconst decodeFailedCallDemanded = Schema.decodeUnknownResult(AgentEvent.FailedCallDemanded)\nconst decodeUnobservedDemanded = Schema.decodeUnknownResult(AgentEvent.UnobservedDemanded)\nconst decodeOutputDemanded = Schema.decodeUnknownResult(AgentEvent.OutputDemanded)\nconst decodeClaimDemanded = Schema.decodeUnknownResult(AgentEvent.ClaimDemanded)\n\nconst transcriptMessage = (\n message: ModelRequest.AssistantMessage\n): ModelRequest.AssistantMessage =>\n message.stopReason === \"error\" || message.stopReason === \"aborted\"\n ? new ModelRequest.AssistantMessage({\n role: \"assistant\",\n content: message.content.map((part) =>\n part.type === \"thinking\"\n ? ModelRequest.ThinkingPart.make({ text: part.text })\n : part\n ),\n stopReason: message.stopReason\n })\n : message\n\n/**\n * Projects journal events into their model-visible transcript state as typed\n * data, preserving malformed payload failures instead of throwing.\n *\n * This rebuilds turn structure, the settlement's own message, and every\n * journaled controller demand. The controller also folds frame-local\n * settled-call salvage and the memory-probe alert into failure notes. A raised\n * cell's `bindingPathMiss` hint is live-only, so the projection rebuilds a\n * shorter note exactly where that hint would name a missed binding.\n *\n * A terminal frame has the opposite skew: `observe` appends no observation\n * once the frame budget is spent, while this projection rebuilds its journaled\n * print and settlement. On a run whose last frame was terminal, it therefore\n * over-reports by one trailing user turn. `AgentEvent.TurnClosed.outcome` is the\n * journaled signal a future projection would key on to drop it: `\"resolved\"`\n * on the terminal frame and `\"continue\"` otherwise.\n *\n * @category projections\n * @since 0.1.0\n * @slop\n */\nexport const projectStateResult = (\n entries: ReadonlyArray<JournalEvent.Entry>\n): Result.Result<ProjectedState, TranscriptError> => {\n const events = ordered(entries)\n const produced: Array<Cell.Source> = []\n const printed: Array<AgentEvent.CellPrinted> = []\n const prints = new Map<number, AgentEvent.CellPrinted>()\n const callsStarted: Array<Cell.Call> = []\n const callsSettled: Array<AgentEvent.CellCallSettled> = []\n const settledCells: Array<AgentEvent.CellSettled> = []\n const transitions: Array<Cell.Transition> = []\n const suspensions: Array<EngineLike.SuspendReason> = []\n const aborts: Array<string> = []\n const compactions = new Map<number, AgentEvent.CompactionSettled>()\n let replaced: string | undefined\n // Legacy events replaced everything before themselves. Preserve that\n // behavior, including skipping obsolete model payloads, for old journals.\n let legacyBoundary = Number.NEGATIVE_INFINITY\n\n for (const entry of events) {\n switch (entry.eventType) {\n case eventType.cellProduced: {\n const decoded = decode(decodeCellProduced, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n produced.push(decoded.success.cell)\n break\n }\n case eventType.cellPrinted: {\n const decoded = decode(decodeCellPrinted, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n printed.push(decoded.success)\n // Decoded once, here, and read back by sequence below. The payload is\n // retained so a failed settlement can prove the immediately preceding\n // print belongs to the same cell before merging the two observations.\n prints.set(entry.seq, decoded.success)\n break\n }\n case eventType.cellCallStarted: {\n const decoded = decode(decodeCellCallStarted, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n callsStarted.push(decoded.success.call)\n break\n }\n case eventType.cellCallSettled: {\n const decoded = decode(decodeCellCallSettled, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n callsSettled.push(decoded.success)\n break\n }\n case eventType.cellSettled: {\n const decoded = decode(decodeCellSettled, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n settledCells.push(decoded.success)\n break\n }\n case eventType.transitionApplied: {\n const decoded = decode(decodeTransitionApplied, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n transitions.push(decoded.success.transition)\n break\n }\n case eventType.suspended: {\n const decoded = decode(decodeSuspended, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n suspensions.push(decoded.success.reason)\n break\n }\n case eventType.aborted: {\n const decoded = decode(decodeAborted, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n aborts.push(decoded.success.reason)\n break\n }\n case eventType.compactionSettled: {\n const decoded = decode(decodeCompactionSettled, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n compactions.set(entry.seq, decoded.success)\n replaced = decoded.success.replacedPrefixDigest\n if (decoded.success.retainedMessageCount === undefined) legacyBoundary = entry.seq\n break\n }\n }\n }\n\n const messages: Array<ProjectedMessage> = []\n // Set only after emitting a print and cleared whenever another message is\n // emitted, so presence means the last projected turn is exactly this print.\n let precedingPrint: AgentEvent.CellPrinted | undefined\n const appendDemand = (text: string): void => {\n messages.push({ kind: \"transcript\", message: ModelRequest.Message.user(text) })\n precedingPrint = undefined\n }\n\n for (const entry of events) {\n if (entry.seq < legacyBoundary) continue\n const compaction = compactions.get(entry.seq)\n if (compaction !== undefined) {\n // Apply each boundary to the already-projected messages so repeated\n // compactions replace prior summaries without dropping the recent tail.\n // A marked compaction carries the replaced messages it kept verbatim\n // after its summary, and may carry no summary when nothing was squashed.\n const summary = compaction.summary\n messages.splice(\n 0,\n Math.max(0, messages.length - (compaction.retainedMessageCount ?? 0)),\n ...(summary === undefined ? [] : [{\n kind: \"summary\" as const,\n message: summary.role === \"user\"\n ? summary\n : ModelRequest.Message.user(\n summary.content.filter((part): part is ModelRequest.TextPart => part.type === \"text\")\n )\n }]),\n ...(compaction.kept ?? []).map((message) => ({ kind: \"transcript\" as const, message }))\n )\n precedingPrint = undefined\n continue\n }\n // The print buffer is the context channel: what a cell printed is what the\n // next model turn read, in the place the journal put it.\n const print = prints.get(entry.seq)\n if (print !== undefined) {\n messages.push({\n kind: \"transcript\",\n message: ModelRequest.Message.user(printsObservation(print.text))\n })\n precedingPrint = print\n continue\n }\n switch (entry.eventType) {\n case eventType.modelSettled: {\n const decoded = decode(decodeModelSettled, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n if (decoded.success.message.content.length === 0) break\n messages.push({ kind: \"transcript\", message: transcriptMessage(decoded.success.message) })\n precedingPrint = undefined\n break\n }\n case eventType.steeringDrained: {\n const decoded = decode(decodeSteeringDrained, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n for (const message of decoded.success.messages) {\n messages.push({ kind: \"steering\", message })\n precedingPrint = undefined\n }\n break\n }\n case eventType.readOnlyDemandIssued: {\n const decoded = decode(decodeReadOnlyDemandIssued, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(DemandText.readOnly(decoded.success.cap, decoded.success.streak))\n break\n }\n case eventType.repeatDemanded: {\n const decoded = decode(decodeRepeatDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(DemandText.repeat(decoded.success.frames, decoded.success.cap))\n break\n }\n case eventType.narrowedDemanded: {\n const decoded = decode(decodeNarrowedDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(DemandText.narrowed(decoded.success.flow, decoded.success.broader, decoded.success.narrower))\n break\n }\n case eventType.narrowOnlyDemanded: {\n const decoded = decode(decodeNarrowOnlyDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(DemandText.narrowOnly(decoded.success.flow, decoded.success.check, decoded.success.targets))\n break\n }\n case eventType.unmovedDemanded: {\n const decoded = decode(decodeUnmovedDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(DemandText.unmoved(decoded.success.openedDigest, decoded.success.currentDigest))\n break\n }\n case eventType.unresolvedDemanded: {\n const decoded = decode(decodeUnresolvedDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(DemandText.unresolved(decoded.success.flow, decoded.success.failed, decoded.success.instead))\n break\n }\n case eventType.failedCallDemanded: {\n const decoded = decode(decodeFailedCallDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(FailedCall.demand(decoded.success.failures))\n break\n }\n case eventType.unobservedDemanded: {\n const decoded = decode(decodeUnobservedDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(UnobservedCall.demand(decoded.success.calls))\n break\n }\n case eventType.outputDemanded: {\n const decoded = decode(decodeOutputDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(decoded.success.note)\n break\n }\n case eventType.claimDemanded: {\n const decoded = decode(decodeClaimDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n // The reading that let a completion through was journaled too, and it\n // put nothing in front of the model, so only a firing is replayed.\n if (decoded.success.demanded) {\n appendDemand(DemandText.claim())\n }\n break\n }\n case eventType.cellSettled: {\n const decoded = decode(decodeCellSettled, entry)\n /* v8 ignore next -- the first pass ran `decodeCellSettled` over every `cellSettled` entry of this same `events` array and returned on failure, and `decode` is a pure function of `entry.payload`, so re-decoding an entry that survived that pass cannot fail; the branch exists because `Result` has no way to carry that proof */\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n const outcome = decoded.success.outcome\n if (outcome._tag !== \"rejected\" && outcome._tag !== \"raised\") break\n const note = outcome._tag === \"rejected\"\n ? outcome.message\n : `The cell threw ${outcome.name}: ${outcome.message}. Emit a corrected cell.`\n if (precedingPrint !== undefined && precedingPrint.cell === decoded.success.cell) {\n messages[messages.length - 1] = {\n kind: \"transcript\",\n message: ModelRequest.Message.user(`${printsObservation(precedingPrint.text)}\\n\\n${note}`)\n }\n } else {\n messages.push({\n kind: \"transcript\",\n message: ModelRequest.Message.user(note)\n })\n }\n precedingPrint = undefined\n break\n }\n }\n }\n return Result.succeed({\n messages,\n replaced,\n cell: {\n produced,\n printed,\n callsStarted,\n callsSettled,\n settled: settledCells,\n transitions,\n suspensions,\n aborts\n }\n })\n}\n\n/**\n * Projects model-visible messages in canonical journal sequence order.\n *\n * @category projections\n * @since 0.1.0\n * @slop\n */\nexport const projectResult = (\n entries: ReadonlyArray<JournalEvent.Entry>\n): Result.Result<ReadonlyArray<ModelRequest.Message>, TranscriptError> =>\n Result.map(projectStateResult(entries), (state) => state.messages.map((item) => item.message))\n\n/**\n * Pure external-source decoders; never create executable journal identities.\n * @since 1.0.0-rc.1\n */\nexport { decodeClaude, decodeCodex } from \"./ExternalTranscript.ts\"\nexport type { Entry as ExternalEntry, Decoded as ExternalDecoded } from \"./ExternalTranscript.ts\"\n"],
|
|
4
|
+
"sourcesContent": ["/**\n * Transcript projection from durable journal entries.\n *\n * The transcript grows: what the model saw is what it said plus what the\n * harness answered, in journal order. A `continue` used to be able to replace\n * the whole projection with a list of messages the cell had written for its\n * successor, and that branch is gone with the surface that produced it \u2014 a\n * journal from those waves still decodes, and its `context` entries are simply\n * not read.\n *\n * @since 0.1.0\n */\n\nimport * as Fault from \"@smthrs/flow/Fault\"\nimport type { JournalEvent } from \"@smthrs/journal\"\nimport { ModelRequest } from \"@smthrs/model\"\nimport { Result, Schema } from \"effect\"\nimport * as AgentEvent from \"./AgentEvent.ts\"\nimport type * as Cell from \"./Cell.ts\"\nimport type * as EngineLike from \"./EngineLike.ts\"\nimport * as FailedCall from \"./FailedCall.ts\"\nimport { HarnessError } from \"./HarnessError.ts\"\nimport * as DemandText from \"./internal/demandText.ts\"\nimport { printsObservation } from \"./internal/printsObservation.ts\"\nimport * as UnobservedCall from \"./internal/unobservedCall.ts\"\n\n/**\n * Journal and model-key format after summaries became user context.\n *\n * @category constants\n * @since 1.0.0-rc.0\n */\nexport const journalVersion = 2\n\n/**\n * The event-type namespace a session journals its controller events under.\n *\n * Resume validation reads only the entries under this prefix, and the writer\n * that produces them lives in another package, so the prefix is exported here\n * rather than spelled twice: a writer types its event types as\n * {@link ControlEventType} and a rename fails to compile instead of silently\n * emptying the set {@link validateJournal} inspects.\n *\n * @category constants\n * @since 1.0.0-rc.0\n */\nexport const controlEventPrefix = \"control.agent.\"\n\n/**\n * An event type {@link validateJournal} validates.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport type ControlEventType = `${typeof controlEventPrefix}${string}`\n\n/**\n * Refuses history whose replay could address different sealed model steps.\n * Historical display projection is separate from permission to resume.\n *\n * @category validation\n * @since 1.0.0-rc.0\n */\nexport const validateJournal = (\n entries: ReadonlyArray<JournalEvent.Entry>\n): Result.Result<void, HarnessError> => {\n for (const entry of entries) {\n if (!entry.eventType.startsWith(controlEventPrefix)) continue\n const payload = entry.payload as Record<string, unknown> | null\n if (payload === null || typeof payload !== \"object\" || payload[\"journalVersion\"] !== journalVersion) {\n return Result.fail(\n new HarnessError({\n code: \"incompatible_journal\",\n message: `Journal sequence ${entry.seq} predates harness journal format ${journalVersion}; start a new run.`\n })\n )\n }\n }\n return Result.succeed(undefined)\n}\n\n/**\n * Stable failures produced while projecting a durable transcript.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport const TranscriptErrorCode = Schema.Literals([\"projection_failed\"])\n\n/**\n * Stable failures produced while projecting a durable transcript.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport type TranscriptErrorCode = typeof TranscriptErrorCode.Type\n\n/**\n * Stable failures produced while projecting a durable transcript.\n *\n * @category errors\n * @since 0.1.0\n * @slop\n */\nexport class TranscriptError extends Schema.TaggedError<TranscriptError>()(\"flows/harness/TranscriptError\", {\n code: TranscriptErrorCode,\n message: Schema.String,\n cause: Schema.optional(Schema.Defect())\n}) {}\nFault.register(\"flows/harness/TranscriptError\", { projection_failed: \"bug\" } satisfies Fault.Rows<TranscriptErrorCode>)\n\n/**\n * The kind and message of one projected transcript item.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport interface ProjectedMessage {\n readonly kind: \"transcript\" | \"summary\" | \"steering\"\n readonly message: ModelRequest.Message\n}\n\n/**\n * A projection with the compaction replacement identity, when one was recorded.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport interface ProjectedState {\n readonly messages: ReadonlyArray<ProjectedMessage>\n readonly replaced?: string | undefined\n readonly cell: CellEvidence\n}\n\n/**\n * Schema-decoded cell evidence consumed while rebuilding a journal.\n *\n * @category models\n * @since 0.1.0\n * @slop\n */\nexport interface CellEvidence {\n readonly produced: ReadonlyArray<Cell.Source>\n /**\n * What each frame printed, in journal order.\n *\n * The print buffer is the whole of the context channel: it is what the NEXT\n * model turn reads, and `AgentEvent.CellPrinted` is journaled rather than\n * derived precisely so a projection can rebuild that window without\n * re-running anything. It was missing from this decoder, so a transcript\n * projected from a harness-native journal could not reconstruct what the\n * model saw.\n */\n readonly printed: ReadonlyArray<AgentEvent.CellPrinted>\n readonly callsStarted: ReadonlyArray<Cell.Call>\n readonly callsSettled: ReadonlyArray<AgentEvent.CellCallSettled>\n readonly settled: ReadonlyArray<AgentEvent.CellSettled>\n readonly transitions: ReadonlyArray<Cell.Transition>\n readonly suspensions: ReadonlyArray<EngineLike.SuspendReason>\n readonly aborts: ReadonlyArray<string>\n}\n\n/** The one journal-event-type table; see `AgentEvent.eventType`. */\nconst eventType = AgentEvent.eventType\n\nconst projectionFailed = (entry: JournalEvent.Entry, cause: unknown): TranscriptError =>\n new TranscriptError({\n code: \"projection_failed\",\n message: `Invalid ${entry.eventType} payload at journal sequence ${entry.seq}`,\n cause\n })\n\nconst decode = <A>(\n decodePayload: (payload: unknown) => Result.Result<A, unknown>,\n entry: JournalEvent.Entry\n): Result.Result<A, TranscriptError> =>\n Result.mapError(decodePayload(entry.payload), (cause) => projectionFailed(entry, cause))\n\nconst ordered = (entries: ReadonlyArray<JournalEvent.Entry>): ReadonlyArray<JournalEvent.Entry> =>\n [...entries].sort((left, right) => left.seq - right.seq)\n\nconst decodeModelSettled = Schema.decodeUnknownResult(AgentEvent.ModelSettled)\nconst decodeSteeringDrained = Schema.decodeUnknownResult(AgentEvent.SteeringDrained)\nconst decodeCompactionSettled = Schema.decodeUnknownResult(AgentEvent.CompactionSettled)\nconst decodeCellPrinted = Schema.decodeUnknownResult(AgentEvent.CellPrinted)\nconst decodeCellProduced = Schema.decodeUnknownResult(AgentEvent.CellProduced)\nconst decodeCellCallStarted = Schema.decodeUnknownResult(AgentEvent.CellCallStarted)\nconst decodeCellCallSettled = Schema.decodeUnknownResult(AgentEvent.CellCallSettled)\nconst decodeCellSettled = Schema.decodeUnknownResult(AgentEvent.CellSettled)\nconst decodeTransitionApplied = Schema.decodeUnknownResult(AgentEvent.TransitionApplied)\nconst decodeSuspended = Schema.decodeUnknownResult(AgentEvent.Suspended)\nconst decodeAborted = Schema.decodeUnknownResult(AgentEvent.Aborted)\nconst decodeReadOnlyDemandIssued = Schema.decodeUnknownResult(AgentEvent.ReadOnlyDemandIssued)\nconst decodeRepeatDemanded = Schema.decodeUnknownResult(AgentEvent.RepeatDemanded)\nconst decodeNarrowedDemanded = Schema.decodeUnknownResult(AgentEvent.NarrowedDemanded)\nconst decodeNarrowOnlyDemanded = Schema.decodeUnknownResult(AgentEvent.NarrowOnlyDemanded)\nconst decodeUnmovedDemanded = Schema.decodeUnknownResult(AgentEvent.UnmovedDemanded)\nconst decodeUnresolvedDemanded = Schema.decodeUnknownResult(AgentEvent.UnresolvedDemanded)\nconst decodeFailedCallDemanded = Schema.decodeUnknownResult(AgentEvent.FailedCallDemanded)\nconst decodeUnobservedDemanded = Schema.decodeUnknownResult(AgentEvent.UnobservedDemanded)\nconst decodeOutputDemanded = Schema.decodeUnknownResult(AgentEvent.OutputDemanded)\nconst decodeClaimDemanded = Schema.decodeUnknownResult(AgentEvent.ClaimDemanded)\n\nconst transcriptMessage = (\n message: ModelRequest.AssistantMessage\n): ModelRequest.AssistantMessage =>\n message.stopReason === \"error\" || message.stopReason === \"aborted\"\n ? new ModelRequest.AssistantMessage({\n role: \"assistant\",\n content: message.content.map((part) =>\n part.type === \"thinking\"\n ? ModelRequest.ThinkingPart.make({ text: part.text })\n : part\n ),\n stopReason: message.stopReason\n })\n : message\n\n/**\n * Projects journal events into their model-visible transcript state as typed\n * data, preserving malformed payload failures instead of throwing.\n *\n * This rebuilds turn structure, the settlement's own message, and every\n * journaled controller demand. The controller also folds frame-local\n * settled-call salvage and the memory-probe alert into failure notes. A raised\n * cell's `bindingPathMiss` hint is live-only, so the projection rebuilds a\n * shorter note exactly where that hint would name a missed binding.\n *\n * A terminal frame has the opposite skew: `observe` appends no observation\n * once the frame budget is spent, while this projection rebuilds its journaled\n * print and settlement. On a run whose last frame was terminal, it therefore\n * over-reports by one trailing user turn. `AgentEvent.TurnClosed.outcome` is the\n * journaled signal a future projection would key on to drop it: `\"resolved\"`\n * on the terminal frame and `\"continue\"` otherwise.\n *\n * @category projections\n * @since 0.1.0\n * @slop\n */\nexport const projectStateResult = (\n entries: ReadonlyArray<JournalEvent.Entry>\n): Result.Result<ProjectedState, TranscriptError> => {\n const events = ordered(entries)\n const produced: Array<Cell.Source> = []\n const printed: Array<AgentEvent.CellPrinted> = []\n const prints = new Map<number, AgentEvent.CellPrinted>()\n const callsStarted: Array<Cell.Call> = []\n const callsSettled: Array<AgentEvent.CellCallSettled> = []\n const settledCells: Array<AgentEvent.CellSettled> = []\n const transitions: Array<Cell.Transition> = []\n const suspensions: Array<EngineLike.SuspendReason> = []\n const aborts: Array<string> = []\n const compactions = new Map<number, AgentEvent.CompactionSettled>()\n let replaced: string | undefined\n // Legacy events replaced everything before themselves. Preserve that\n // behavior, including skipping obsolete model payloads, for old journals.\n let legacyBoundary = Number.NEGATIVE_INFINITY\n\n for (const entry of events) {\n switch (entry.eventType) {\n case eventType.cellProduced: {\n const decoded = decode(decodeCellProduced, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n produced.push(decoded.success.cell)\n break\n }\n case eventType.cellPrinted: {\n const decoded = decode(decodeCellPrinted, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n printed.push(decoded.success)\n // Decoded once, here, and read back by sequence below. The payload is\n // retained so a failed settlement can prove the immediately preceding\n // print belongs to the same cell before merging the two observations.\n prints.set(entry.seq, decoded.success)\n break\n }\n case eventType.cellCallStarted: {\n const decoded = decode(decodeCellCallStarted, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n callsStarted.push(decoded.success.call)\n break\n }\n case eventType.cellCallSettled: {\n const decoded = decode(decodeCellCallSettled, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n callsSettled.push(decoded.success)\n break\n }\n case eventType.cellSettled: {\n const decoded = decode(decodeCellSettled, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n settledCells.push(decoded.success)\n break\n }\n case eventType.transitionApplied: {\n const decoded = decode(decodeTransitionApplied, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n transitions.push(decoded.success.transition)\n break\n }\n case eventType.suspended: {\n const decoded = decode(decodeSuspended, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n suspensions.push(decoded.success.reason)\n break\n }\n case eventType.aborted: {\n const decoded = decode(decodeAborted, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n aborts.push(decoded.success.reason)\n break\n }\n case eventType.compactionSettled: {\n const decoded = decode(decodeCompactionSettled, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n compactions.set(entry.seq, decoded.success)\n replaced = decoded.success.replacedPrefixDigest\n if (decoded.success.retainedMessageCount === undefined) legacyBoundary = entry.seq\n break\n }\n }\n }\n\n const messages: Array<ProjectedMessage> = []\n // Set only after emitting a print and cleared whenever another message is\n // emitted, so presence means the last projected turn is exactly this print.\n let precedingPrint: AgentEvent.CellPrinted | undefined\n const appendDemand = (text: string): void => {\n messages.push({ kind: \"transcript\", message: ModelRequest.Message.user(text) })\n precedingPrint = undefined\n }\n\n for (const entry of events) {\n if (entry.seq < legacyBoundary) continue\n const compaction = compactions.get(entry.seq)\n if (compaction !== undefined) {\n // Apply each boundary to the already-projected messages so repeated\n // compactions replace prior summaries without dropping the recent tail.\n // A marked compaction carries the replaced messages it kept verbatim\n // after its summary, and may carry no summary when nothing was squashed.\n const summary = compaction.summary\n messages.splice(\n 0,\n Math.max(0, messages.length - (compaction.retainedMessageCount ?? 0)),\n ...(summary === undefined ? [] : [{\n kind: \"summary\" as const,\n message: summary.role === \"user\"\n ? summary\n : ModelRequest.Message.user(\n summary.content.filter((part): part is ModelRequest.TextPart => part.type === \"text\")\n )\n }]),\n ...(compaction.kept ?? []).map((message) => ({ kind: \"transcript\" as const, message }))\n )\n precedingPrint = undefined\n continue\n }\n // The print buffer is the context channel: what a cell printed is what the\n // next model turn read, in the place the journal put it.\n const print = prints.get(entry.seq)\n if (print !== undefined) {\n messages.push({\n kind: \"transcript\",\n message: ModelRequest.Message.user(printsObservation(print.text))\n })\n precedingPrint = print\n continue\n }\n switch (entry.eventType) {\n case eventType.modelSettled: {\n const decoded = decode(decodeModelSettled, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n if (decoded.success.message.content.length === 0) break\n messages.push({ kind: \"transcript\", message: transcriptMessage(decoded.success.message) })\n precedingPrint = undefined\n break\n }\n case eventType.steeringDrained: {\n const decoded = decode(decodeSteeringDrained, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n for (const message of decoded.success.messages) {\n messages.push({ kind: \"steering\", message })\n precedingPrint = undefined\n }\n break\n }\n case eventType.readOnlyDemandIssued: {\n const decoded = decode(decodeReadOnlyDemandIssued, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(DemandText.readOnly(decoded.success.cap, decoded.success.streak))\n break\n }\n case eventType.repeatDemanded: {\n const decoded = decode(decodeRepeatDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(DemandText.repeat(decoded.success.frames, decoded.success.cap))\n break\n }\n case eventType.narrowedDemanded: {\n const decoded = decode(decodeNarrowedDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(DemandText.narrowed(decoded.success.flow, decoded.success.broader, decoded.success.narrower))\n break\n }\n case eventType.narrowOnlyDemanded: {\n const decoded = decode(decodeNarrowOnlyDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(DemandText.narrowOnly(decoded.success.flow, decoded.success.check, decoded.success.targets))\n break\n }\n case eventType.unmovedDemanded: {\n const decoded = decode(decodeUnmovedDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(DemandText.unmoved(decoded.success.openedDigest, decoded.success.currentDigest))\n break\n }\n case eventType.unresolvedDemanded: {\n const decoded = decode(decodeUnresolvedDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(DemandText.unresolved(decoded.success.flow, decoded.success.failed, decoded.success.instead))\n break\n }\n case eventType.failedCallDemanded: {\n const decoded = decode(decodeFailedCallDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(FailedCall.demand(decoded.success.failures))\n break\n }\n case eventType.unobservedDemanded: {\n const decoded = decode(decodeUnobservedDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(UnobservedCall.demand(decoded.success.calls))\n break\n }\n case eventType.outputDemanded: {\n const decoded = decode(decodeOutputDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n appendDemand(decoded.success.note)\n break\n }\n case eventType.claimDemanded: {\n const decoded = decode(decodeClaimDemanded, entry)\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n // The reading that let a completion through was journaled too, and it\n // put nothing in front of the model, so only a firing is replayed.\n if (decoded.success.demanded) {\n appendDemand(DemandText.claim())\n }\n break\n }\n case eventType.cellSettled: {\n const decoded = decode(decodeCellSettled, entry)\n /* v8 ignore next -- the first pass ran `decodeCellSettled` over every `cellSettled` entry of this same `events` array and returned on failure, and `decode` is a pure function of `entry.payload`, so re-decoding an entry that survived that pass cannot fail; the branch exists because `Result` has no way to carry that proof */\n if (Result.isFailure(decoded)) return Result.fail(decoded.failure)\n const outcome = decoded.success.outcome\n if (outcome._tag !== \"rejected\" && outcome._tag !== \"raised\") break\n const note = outcome._tag === \"rejected\"\n ? outcome.message\n : `The cell threw ${outcome.name}: ${outcome.message}. Emit a corrected cell.`\n if (precedingPrint !== undefined && precedingPrint.cell === decoded.success.cell) {\n messages[messages.length - 1] = {\n kind: \"transcript\",\n message: ModelRequest.Message.user(`${printsObservation(precedingPrint.text)}\\n\\n${note}`)\n }\n } else {\n messages.push({\n kind: \"transcript\",\n message: ModelRequest.Message.user(note)\n })\n }\n precedingPrint = undefined\n break\n }\n }\n }\n return Result.succeed({\n messages,\n replaced,\n cell: {\n produced,\n printed,\n callsStarted,\n callsSettled,\n settled: settledCells,\n transitions,\n suspensions,\n aborts\n }\n })\n}\n\n/**\n * Projects model-visible messages in canonical journal sequence order.\n *\n * @category projections\n * @since 0.1.0\n * @slop\n */\nexport const projectResult = (\n entries: ReadonlyArray<JournalEvent.Entry>\n): Result.Result<ReadonlyArray<ModelRequest.Message>, TranscriptError> =>\n Result.map(projectStateResult(entries), (state) => state.messages.map((item) => item.message))\n\n/**\n * Pure external-source decoders; never create executable journal identities.\n * @since 1.0.0-rc.1\n */\nexport { decodeClaude, decodeCodex } from \"./ExternalTranscript.ts\"\nexport type { Decoded as ExternalDecoded, Entry as ExternalEntry } from \"./ExternalTranscript.ts\"\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaA,YAAuB;AAEvB,mBAA6B;AAC7B,oBAA+B;AAC/B,iBAA4B;AAG5B,iBAA4B;AAC5B,0BAA6B;AAC7B,iBAA4B;AAC5B,+BAAkC;AAClC,qBAAgC;AAuehC,gCAA0C;AA/dnC,MAAM,iBAAiB;AAcvB,MAAM,qBAAqB;AAiB3B,MAAM,kBAAkB,CAC7B,YACsC;AACtC,aAAW,SAAS,SAAS;AAC3B,QAAI,CAAC,MAAM,UAAU,WAAW,kBAAkB,EAAG;AACrD,UAAM,UAAU,MAAM;AACtB,QAAI,YAAY,QAAQ,OAAO,YAAY,YAAY,QAAQ,gBAAgB,MAAM,gBAAgB;AACnG,aAAO,qBAAO;AAAA,QACZ,IAAI,iCAAa;AAAA,UACf,MAAM;AAAA,UACN,SAAS,oBAAoB,MAAM,GAAG,oCAAoC,cAAc;AAAA,QAC1F,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACA,SAAO,qBAAO,QAAQ,MAAS;AACjC;AASO,MAAM,sBAAsB,qBAAO,SAAS,CAAC,mBAAmB,CAAC;AAkBjE,MAAM,wBAAwB,qBAAO,YAA6B,EAAE,iCAAiC;AAAA,EAC1G,MAAM;AAAA,EACN,SAAS,qBAAO;AAAA,EAChB,OAAO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,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,8BAA8B;IAC9B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,uDAAuD;IACvD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACrC,kFAAkF;IAClF,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAClC,iEAAiE;IACjE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAA;CACrD;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAAE,WAAyD,CAAA;AAuNnF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,GACvB,OAAO,WAAW,EAClB,OAAO,MAAM,KACZ,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,uBAAuB,CA+J7D,CAAA"}
|
|
@@ -714,10 +714,8 @@ const claudeToolPart = (id, call, result) => {
|
|
|
714
714
|
duration_ms: result.took
|
|
715
715
|
};
|
|
716
716
|
};
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
* outside it is a tagged `unsupported_record`, so a new kind stops the import where a person can see it.
|
|
720
|
-
*/
|
|
717
|
+
// The Claude Code record, status, attachment and block kinds this module names. Each list is closed: a kind
|
|
718
|
+
// outside it is a tagged `unsupported_record`, so a new kind stops the import where a person can see it.
|
|
721
719
|
/** Rows outside the conversation chain: session bookkeeping that names no speaker and says nothing. */
|
|
722
720
|
const claudeSkippedRows = [
|
|
723
721
|
"mode",
|