@bastani/atomic 0.9.73-alpha.1 → 0.9.74-alpha.1
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/CHANGELOG.md +36 -0
- package/dist/builtin/intercom/CHANGELOG.md +10 -0
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +16 -0
- package/dist/builtin/workflows/README.md +2 -2
- package/dist/builtin/workflows/builtin/adversarial-verification.js +2 -2
- package/dist/builtin/workflows/builtin/{chunk-2377r57g.js → chunk-8kdrnrpa.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-t8y25z1j.js → chunk-8ycbc76t.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-vbrmytm5.js → chunk-a4fdm2cw.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-9pjdp2td.js → chunk-d5cxskkp.js} +3 -3
- package/dist/builtin/workflows/builtin/{chunk-tpsw128z.js → chunk-d9pz64yp.js} +3 -3
- package/dist/builtin/workflows/builtin/{chunk-z0d03ktm.js → chunk-gp0s6m45.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-4kygv34g.js → chunk-m8eg152f.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-mswg7kc7.js → chunk-r39ypw6b.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-q7dry6km.js → chunk-va2h64a6.js} +3 -3
- package/dist/builtin/workflows/builtin/generate-and-filter.js +2 -2
- package/dist/builtin/workflows/builtin/goal.js +4 -4
- package/dist/builtin/workflows/builtin/index.js +9 -9
- package/dist/builtin/workflows/builtin/loop-until-done.js +2 -2
- package/dist/builtin/workflows/builtin/ralph.js +4 -4
- package/dist/builtin/workflows/builtin/tournament.js +2 -2
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/authoring.d.ts +2 -0
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +403 -76
- package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +387 -60
- package/dist/builtin/workflows/src/index.js +393 -62
- package/dist/builtin/workflows/src/local-worker-entry.mjs +387 -60
- package/dist/builtin/workflows/src/shared/serializable-error-families.d.ts +1 -0
- package/dist/builtin/workflows/src/shared/structured-output-errors.d.ts +50 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +4 -0
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-background-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-background-compaction.js +2 -1
- package/dist/core/agent-session-background-compaction.js.map +1 -1
- package/dist/core/agent-session-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-compaction.js +98 -4
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-detached-tools.d.ts +20 -5
- package/dist/core/agent-session-detached-tools.d.ts.map +1 -1
- package/dist/core/agent-session-detached-tools.js +97 -21
- package/dist/core/agent-session-detached-tools.js.map +1 -1
- package/dist/core/agent-session-message-queue.d.ts.map +1 -1
- package/dist/core/agent-session-message-queue.js +2 -1
- package/dist/core/agent-session-message-queue.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +3 -1
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-persistent-custom-messages.d.ts.map +1 -1
- package/dist/core/agent-session-persistent-custom-messages.js +12 -4
- package/dist/core/agent-session-persistent-custom-messages.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +33 -0
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/compaction/background-compaction.d.ts +11 -5
- package/dist/core/compaction/background-compaction.d.ts.map +1 -1
- package/dist/core/compaction/background-compaction.js +19 -10
- package/dist/core/compaction/background-compaction.js.map +1 -1
- package/dist/core/compaction/compaction-boundary.d.ts +10 -0
- package/dist/core/compaction/compaction-boundary.d.ts.map +1 -1
- package/dist/core/compaction/compaction-boundary.js +30 -2
- package/dist/core/compaction/compaction-boundary.js.map +1 -1
- package/dist/core/compaction/compaction-runner.d.ts +7 -0
- package/dist/core/compaction/compaction-runner.d.ts.map +1 -1
- package/dist/core/compaction/compaction-runner.js +13 -5
- package/dist/core/compaction/compaction-runner.js.map +1 -1
- package/dist/core/compaction/compaction-types.d.ts +1 -1
- package/dist/core/compaction/compaction-types.js +1 -1
- package/dist/core/compaction/compaction-types.js.map +1 -1
- package/dist/core/compaction/deleted-ranges.d.ts +17 -2
- package/dist/core/compaction/deleted-ranges.d.ts.map +1 -1
- package/dist/core/compaction/deleted-ranges.js +44 -5
- package/dist/core/compaction/deleted-ranges.js.map +1 -1
- package/dist/core/compaction/history-recall.d.ts +32 -0
- package/dist/core/compaction/history-recall.d.ts.map +1 -0
- package/dist/core/compaction/history-recall.js +275 -0
- package/dist/core/compaction/history-recall.js.map +1 -0
- package/dist/core/compaction/index.d.ts +2 -0
- package/dist/core/compaction/index.d.ts.map +1 -1
- package/dist/core/compaction/index.js +2 -0
- package/dist/core/compaction/index.js.map +1 -1
- package/dist/core/compaction/pi-summary-fallback.d.ts.map +1 -1
- package/dist/core/compaction/pi-summary-fallback.js +1 -0
- package/dist/core/compaction/pi-summary-fallback.js.map +1 -1
- package/dist/core/compaction/planner-outcome.d.ts +14 -0
- package/dist/core/compaction/planner-outcome.d.ts.map +1 -1
- package/dist/core/compaction/planner-outcome.js +8 -0
- package/dist/core/compaction/planner-outcome.js.map +1 -1
- package/dist/core/compaction/range-planner-diagnostics.d.ts +35 -10
- package/dist/core/compaction/range-planner-diagnostics.d.ts.map +1 -1
- package/dist/core/compaction/range-planner-diagnostics.js +67 -24
- package/dist/core/compaction/range-planner-diagnostics.js.map +1 -1
- package/dist/core/compaction/range-planner.d.ts +7 -4
- package/dist/core/compaction/range-planner.d.ts.map +1 -1
- package/dist/core/compaction/range-planner.js +43 -19
- package/dist/core/compaction/range-planner.js.map +1 -1
- package/dist/core/compaction/refusal-recovery.d.ts +27 -0
- package/dist/core/compaction/refusal-recovery.d.ts.map +1 -0
- package/dist/core/compaction/refusal-recovery.js +65 -0
- package/dist/core/compaction/refusal-recovery.js.map +1 -0
- package/dist/core/compaction/region-trimming.d.ts +23 -0
- package/dist/core/compaction/region-trimming.d.ts.map +1 -1
- package/dist/core/compaction/region-trimming.js +59 -15
- package/dist/core/compaction/region-trimming.js.map +1 -1
- package/dist/core/compaction/structured-compaction-input.d.ts +19 -1
- package/dist/core/compaction/structured-compaction-input.d.ts.map +1 -1
- package/dist/core/compaction/structured-compaction-input.js +30 -17
- package/dist/core/compaction/structured-compaction-input.js.map +1 -1
- package/dist/core/compaction/transcript-serialization.d.ts +9 -3
- package/dist/core/compaction/transcript-serialization.d.ts.map +1 -1
- package/dist/core/compaction/transcript-serialization.js +18 -10
- package/dist/core/compaction/transcript-serialization.js.map +1 -1
- package/dist/core/messages.d.ts +5 -1
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +21 -3
- package/dist/core/messages.js.map +1 -1
- package/dist/core/session-manager-core.js +1 -1
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-manager-history.d.ts +1 -1
- package/dist/core/session-manager-history.d.ts.map +1 -1
- package/dist/core/session-manager-history.js +2 -5
- package/dist/core/session-manager-history.js.map +1 -1
- package/dist/core/settings-defaults.d.ts +2 -0
- package/dist/core/settings-defaults.d.ts.map +1 -1
- package/dist/core/settings-defaults.js +2 -0
- package/dist/core/settings-defaults.js.map +1 -1
- package/dist/core/settings-manager-basic-accessors.d.ts +2 -0
- package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-basic-accessors.js +3 -0
- package/dist/core/settings-manager-basic-accessors.js.map +1 -1
- package/dist/core/settings-schema.d.ts +2 -0
- package/dist/core/settings-schema.d.ts.map +1 -1
- package/dist/core/settings-schema.js +4 -0
- package/dist/core/settings-schema.js.map +1 -1
- package/dist/core/storage/session/conformance.d.ts.map +1 -1
- package/dist/core/storage/session/conformance.js +12 -0
- package/dist/core/storage/session/conformance.js.map +1 -1
- package/dist/core/storage/session/jsonl-session-store.d.ts.map +1 -1
- package/dist/core/storage/session/jsonl-session-store.js +3 -0
- package/dist/core/storage/session/jsonl-session-store.js.map +1 -1
- package/dist/core/storage/session/legacy-session-store.d.ts.map +1 -1
- package/dist/core/storage/session/legacy-session-store.js +3 -0
- package/dist/core/storage/session/legacy-session-store.js.map +1 -1
- package/dist/core/storage/session/memory-session-store.d.ts.map +1 -1
- package/dist/core/storage/session/memory-session-store.js +3 -0
- package/dist/core/storage/session/memory-session-store.js.map +1 -1
- package/dist/core/storage/session/sql-session-store.d.ts.map +1 -1
- package/dist/core/storage/session/sql-session-store.js +12 -3
- package/dist/core/storage/session/sql-session-store.js.map +1 -1
- package/dist/core/storage/session/types.d.ts +3 -0
- package/dist/core/storage/session/types.d.ts.map +1 -1
- package/dist/core/storage/session/types.js +3 -0
- package/dist/core/storage/session/types.js.map +1 -1
- package/dist/core/tools/history-protocol.d.ts +3 -0
- package/dist/core/tools/history-protocol.d.ts.map +1 -1
- package/dist/core/tools/history-protocol.js +7 -87
- package/dist/core/tools/history-protocol.js.map +1 -1
- package/dist/core/tools/history-transcript.d.ts +24 -0
- package/dist/core/tools/history-transcript.d.ts.map +1 -0
- package/dist/core/tools/history-transcript.js +110 -0
- package/dist/core/tools/history-transcript.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main-session.d.ts.map +1 -1
- package/dist/main-session.js +21 -5
- package/dist/main-session.js.map +1 -1
- package/dist/modes/interactive/components/compaction-boundary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-boundary-message.js +7 -3
- package/dist/modes/interactive/components/compaction-boundary-message.js.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.js +2 -2
- package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
- package/dist/session-id-target.d.ts +1 -0
- package/dist/session-id-target.d.ts.map +1 -1
- package/dist/session-id-target.js +3 -0
- package/dist/session-id-target.js.map +1 -1
- package/docs/compaction/reference.md +3 -2
- package/docs/compaction.md +35 -7
- package/docs/development.md +1 -1
- package/docs/sdk/reference.md +6 -5
- package/docs/sessions.md +3 -3
- package/docs/settings.md +3 -0
- package/docs/storage.md +2 -0
- package/docs/workflows/api-reference.md +15 -3
- package/docs/workflows/authoring.md +2 -2
- package/docs/workflows/operations.md +1 -0
- package/docs/workflows/reliable-design.md +1 -1
- package/npm-shrinkwrap.json +32 -32
- package/package.json +3 -3
- package/schemas/settings.schema.json +5 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compaction-boundary-message.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/compaction-boundary-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAMnF,OAAO,
|
|
1
|
+
{"version":3,"file":"compaction-boundary-message.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/compaction-boundary-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAMnF,OAAO,EAEN,yBAAyB,EACzB,6BAA6B,GAC7B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAY7D,gFAAgF;AAChF,MAAM,OAAO,kCAAmC,SAAQ,GAAG;IAClD,QAAQ,GAAG,KAAK,CAAC;IACR,IAAI,CAAe;IAEpC,YAAY,MAA+C,EAAE,SAAS,GAAG,CAAC;QACzE,KAAK,CAAC,SAAS,EAAE,CAAC,EA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,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;aAC1B,IAAI,CAAC,IAAI,CAAC;QACb,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACnB,MAAM,IAAI,GACT,OAAO,CAAC,OAAO,KAAK,SAAS;QAC5B,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,yBAAyB,CAAC;YAC9C,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,yBAAyB,CAAC,MAAM,CAAC;YACjD,CAAC,CAAC,OAAO;QACV,CAAC,CAAC,6BAA6B,CAAC,OAAO,CAAC,CAAC;IAC3C,MAAM,SAAS,GAAG,IAAI,kCAAkC,CACvD;QACC,IAAI;QACJ,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,KAAK,CAAC,YAAY;QAChE,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,KAAK,EAAE,OAAO,CAAC,KAAK;KACpB,EACD,SAAS,CACT,CAAC;IACF,SAAS,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IAChC,OAAO,SAAS,CAAC;AAClB,CAAC","sourcesContent":["import { Box, Container, MouseRegion, Spacer, Text } from \"@earendil-works/pi-tui\";\nimport type {\n\tVerbatimCompactionDetails,\n\tVerbatimCompactionResult,\n\tVerbatimCompactionStats,\n} from \"../../../core/compaction/index.ts\";\nimport {\n\ttype CustomMessage,\n\tSUMMARY_COMPACTION_PREFIX,\n\tstripVerbatimCompactionPrefix,\n} from \"../../../core/messages.ts\";\nimport { theme } from \"../theme/theme.js\";\nimport { parenthesizedKeyHint } from \"./keybinding-hints.js\";\n\ninterface BoundaryView {\n\ttext: string;\n\tstats: VerbatimCompactionStats;\n\trung: VerbatimCompactionDetails[\"rung\"];\n\tbackend?: VerbatimCompactionDetails[\"backend\"];\n\tmodel?: string;\n\t/** Authoritative whole-context count, preferred for \"Compacted from N tokens\". */\n\ttokensBefore?: number;\n}\n\n/** Renders the durable verbatim compaction boundary without markdown reflow. */\nexport class CompactionBoundaryMessageComponent extends Box {\n\tprivate expanded = false;\n\tprivate readonly view: BoundaryView;\n\n\tconstructor(result: VerbatimCompactionResult | BoundaryView, outputPad = 1) {\n\t\tsuper(outputPad, 1, (text) => theme.bg(\"customMessageBg\", text));\n\t\tif (\"compactedText\" in result) {\n\t\t\tthis.view = {\n\t\t\t\ttext: result.compactedText,\n\t\t\t\tstats: result.stats,\n\t\t\t\trung: result.rung,\n\t\t\t\ttokensBefore: result.tokensBefore,\n\t\t\t\tbackend: result.backend,\n\t\t\t\tmodel: result.model,\n\t\t\t};\n\t\t} else {\n\t\t\tthis.view = result;\n\t\t}\n\t\tthis.updateDisplay();\n\t}\n\n\tsetExpanded(expanded: boolean): void {\n\t\tthis.expanded = expanded;\n\t\tthis.updateDisplay();\n\t}\n\tsetOutputPad(outputPad: number): void {\n\t\tthis.setPaddingX(outputPad);\n\t}\n\n\toverride invalidate(): void {\n\t\tsuper.invalidate();\n\t\tthis.updateDisplay();\n\t}\n\n\tprivate updateDisplay(): void {\n\t\tthis.clear();\n\t\tconst content = new Container();\n\t\tconst tokenStr = (this.view.tokensBefore ?? this.view.stats.tokensBefore).toLocaleString();\n\t\t// The fresh rung destroyed the compactable conversation; say so plainly.\n\t\tconst label = theme.fg(\n\t\t\t\"customMessageLabel\",\n\t\t\ttheme.bold(\n\t\t\t\tthis.view.rung === \"fresh\"\n\t\t\t\t\t? \"✻ Context cleared (compaction degraded)\"\n\t\t\t\t\t: this.view.backend === \"summary\"\n\t\t\t\t\t\t? \"✻ Context compacted · summary (pi fallback)\"\n\t\t\t\t\t\t: \"✻ Context compacted\",\n\t\t\t),\n\t\t);\n\t\tcontent.addChild(new Text(label, 0, 0));\n\t\tif (this.view.backend && this.view.model) {\n\t\t\tcontent.addChild(\n\t\t\t\tnew Text(\n\t\t\t\t\ttheme.fg(\n\t\t\t\t\t\t\"dim\",\n\t\t\t\t\t\t`${this.view.backend === \"summary\" ? \"summary (pi fallback)\" : this.view.backend} · ${this.view.model}`,\n\t\t\t\t\t),\n\t\t\t\t\t0,\n\t\t\t\t\t0,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\tcontent.addChild(new Spacer(1));\n\t\tif (this.expanded) {\n\t\t\tcontent.addChild(\n\t\t\t\tnew Text(theme.bold(theme.fg(\"customMessageText\", `Compacted from ${tokenStr} tokens`)), 0, 0),\n\t\t\t);\n\t\t\tcontent.addChild(new Spacer(1));\n\t\t\tconst rendered = this.view.text\n\t\t\t\t.split(\"\\n\")\n\t\t\t\t.map((line) =>\n\t\t\t\t\t/^\\(filtered \\d+ lines\\)$/.test(line) ? theme.fg(\"dim\", line) : theme.fg(\"customMessageText\", line),\n\t\t\t\t)\n\t\t\t\t.join(\"\\n\");\n\t\t\tcontent.addChild(new Text(rendered, 0, 0));\n\t\t} else {\n\t\t\tconst hint = parenthesizedKeyHint(\"app.tools.expand\", \"to expand\");\n\t\t\tcontent.addChild(\n\t\t\t\tnew Text(\n\t\t\t\t\ttheme.fg(\"customMessageText\", `Compacted from ${tokenStr} tokens`) + (hint ? ` ${hint}` : \"\"),\n\t\t\t\t\t0,\n\t\t\t\t\t0,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\tthis.addChild(\n\t\t\tnew MouseRegion(content, (event) => {\n\t\t\t\tif (event.type !== \"click\" || event.button !== \"left\") return undefined;\n\t\t\t\tthis.setExpanded(!this.expanded);\n\t\t\t\treturn { handled: true };\n\t\t\t}),\n\t\t);\n\t}\n}\n\nexport function compactionBoundaryFromMessage(\n\tmessage: CustomMessage,\n\texpanded: boolean,\n\toutputPad = 1,\n): CompactionBoundaryMessageComponent {\n\tconst details = message.details as VerbatimCompactionDetails;\n\tconst content = Array.isArray(message.content)\n\t\t? message.content\n\t\t\t\t.filter((block) => block.type === \"text\")\n\t\t\t\t.map((block) => block.text)\n\t\t\t\t.join(\"\\n\")\n\t\t: message.content;\n\tconst text =\n\t\tdetails.backend === \"summary\"\n\t\t\t? content.startsWith(SUMMARY_COMPACTION_PREFIX)\n\t\t\t\t? content.slice(SUMMARY_COMPACTION_PREFIX.length)\n\t\t\t\t: content\n\t\t\t: stripVerbatimCompactionPrefix(content);\n\tconst component = new CompactionBoundaryMessageComponent(\n\t\t{\n\t\t\ttext,\n\t\t\tstats: details.stats,\n\t\t\trung: details.rung,\n\t\t\ttokensBefore: details.tokensBefore ?? details.stats.tokensBefore,\n\t\t\tbackend: details.backend,\n\t\t\tmodel: details.model,\n\t\t},\n\t\toutputPad,\n\t);\n\tcomponent.setExpanded(expanded);\n\treturn component;\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CONFIG_DIR_NAME } from "../../config.js";
|
|
2
2
|
import { collectCacheMisses, createCacheMissModelSource, describeCacheMissCause } from "../../core/cache-stats.js";
|
|
3
3
|
import { markLifecycleTiming } from "../../core/lifecycle-timings.js";
|
|
4
|
-
import {
|
|
4
|
+
import { stripVerbatimCompactionPrefix } from "../../core/messages.js";
|
|
5
5
|
import { serviceTierWarnings } from "../../core/service-tier-warnings.js";
|
|
6
6
|
import { buildContextEntries, sessionEntryToContextMessages } from "../../core/session-manager.js";
|
|
7
7
|
import { yieldToEventLoop } from "../../utils/event-loop.js";
|
|
@@ -526,6 +526,6 @@ function isSynthesizedCompactionBoundary(message, result) {
|
|
|
526
526
|
.map((block) => block.text)
|
|
527
527
|
.join("\n")
|
|
528
528
|
: message.content;
|
|
529
|
-
return content ===
|
|
529
|
+
return stripVerbatimCompactionPrefix(content) === result.compactedText;
|
|
530
530
|
}
|
|
531
531
|
//# sourceMappingURL=interactive-render-chat.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-render-chat.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-render-chat.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,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AO,EAAE,IAAI,KAAK,QAAQ,IAAI,OAAO,CAAC,UAAU,KAAK,YAAY,IAAI,CAAC,OAAO,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IACxG,MAAM,OAAO,GAAG,OAAO,CAAC,OAA4C,CAAC;IACrE,IAAI,OAAO,EAAE,QAAQ,KAAK,gBAAgB;QAAE,OAAO,KAAK,CAAC;IACzD,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;QAC7C,CAAC,CAAC,OAAO,CAAC,OAAO;aACd,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC;aACxC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;aAC1B,IAAI,CAAC,IAAI,CAAC;QACb,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACnB,OAAO,OAAO,KAAK,0BAA0B,GAAG,MAAM,CAAC,aAAa,CAAC;AACtE,CAAC","sourcesContent":["import type { AssistantMessage, Usage } from \"@bastani/pi-ai/compat\";\nimport { CONFIG_DIR_NAME } from \"../../config.js\";\nimport { collectCacheMisses, createCacheMissModelSource, describeCacheMissCause } from \"../../core/cache-stats.ts\";\nimport { markLifecycleTiming } from \"../../core/lifecycle-timings.ts\";\nimport { VERBATIM_COMPACTION_PREFIX } from \"../../core/messages.ts\";\nimport { serviceTierWarnings } from \"../../core/service-tier-warnings.ts\";\nimport type { CustomEntry } from \"../../core/session-manager.ts\";\nimport { buildContextEntries, type SessionEntry, sessionEntryToContextMessages } from \"../../core/session-manager.ts\";\nimport { yieldToEventLoop } from \"../../utils/event-loop.ts\";\nimport { IsolatedInteractiveRuntime } from \"../interactive-engine/isolated-runtime.js\";\nimport { RemoteCustomMessageComponent, RemoteToolExecutionComponent } from \"../interactive-engine/remote-renderer.ts\";\nimport { appendBoundedStderr } from \"../rpc/rpc-client-process.js\";\nimport { CustomEntryComponent } from \"./components/custom-entry.ts\";\nimport { createMarkdownTransform } from \"./components/markdown-transform.ts\";\nimport { createMermaidMarkdownTransformer } from \"./components/mermaid.ts\";\nimport { ThemedText } from \"./components/themed-text.js\";\nimport { appendNewChildrenBeforeAttachedChild } from \"./interactive-child-ordering.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport {\n\ttype AgentMessage,\n\tAPP_NAME,\n\tAssistantMessageComponent,\n\taddChatTranscriptEntry,\n\tBashExecutionComponent,\n\tBranchSummaryMessageComponent,\n\ttype ChatMessageEntry,\n\ttype ChatMessageRenderOptions,\n\tCompactionBoundaryMessageComponent,\n\ttype Component,\n\tCustomMessageComponent,\n\tchatEntriesFromAgentMessages,\n\thasTrustRequiringProjectResources,\n\tMarkdown,\n\ttype Message,\n\ttype PersistedMessageMeta,\n\tparseSkillBlock,\n\trecordTimeSinceReset,\n\trenderChatMessageEntry,\n\ttype SessionContext,\n\tSkillInvocationMessageComponent,\n\tSpacer,\n\tText,\n\tToolExecutionComponent,\n\ttype TruncationResult,\n\ttheme,\n\tUserMessageComponent,\n\ttype VerbatimCompactionResult,\n} from \"./interactive-mode-deps.ts\";\nimport type { InteractiveSubmission } from \"./interactive-submission.ts\";\nimport { refreshInteractiveTasks } from \"./interactive-task-projection.js\";\n\nfunction countDroppedThinkingBlocks(message: AssistantMessage): number {\n\treturn (message.diagnostics ?? []).reduce((count, diagnostic) => {\n\t\tif (diagnostic.type !== \"anthropic_input_transformations\") return count;\n\t\tconst dropped = diagnostic.details?.droppedBlockCount;\n\t\treturn count + (typeof dropped === \"number\" && dropped > 0 ? dropped : 0);\n\t}, 0);\n}\n\nfunction addServiceTierWarnings(mode: InteractiveModeBase, message: AssistantMessage): void {\n\tfor (const warning of serviceTierWarnings(message)) {\n\t\tmode.chatContainer.addChild(new Spacer(1));\n\t\tmode.chatContainer.addChild(new Text(theme.fg(\"warning\", `Warning: ${warning}`), 1, 0));\n\t}\n}\n\nInteractiveModeBase.prototype.maybeShowAssistantDiagnostics = function (\n\tthis: InteractiveModeBase,\n\tmessage: AssistantMessage,\n): void {\n\taddServiceTierWarnings(this, message);\n\tif (!this.settingsManager.getShowCacheMissNotices()) return;\n\n\tconst count = countDroppedThinkingBlocks(message);\n\tif (count === 0) return;\n\tlet previousCount = 0;\n\t// The live message_end notification precedes persistence of this response.\n\tconst branch = this.sessionManager.getBranch();\n\tfor (let i = branch.length - 1; i >= 0; i--) {\n\t\tconst entry = branch[i];\n\t\tif (entry.type === \"message\" && entry.message.role === \"assistant\") {\n\t\t\tpreviousCount = countDroppedThinkingBlocks(entry.message);\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (count <= previousCount) return;\n\tconst noun = count === 1 ? \"thinking block\" : \"thinking blocks\";\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(\n\t\tnew Text(theme.fg(\"warning\", `Anthropic dropped ${count} ${noun} (details in session)`), 1, 0),\n\t);\n};\n\n// Weak keys leave cleared/rebuilt transcripts collectible without separate lifecycle state.\n// Only persistent diagnostic statuses participate; ordinary chat/status is never evicted.\nconst diagnosticStatuses = new WeakMap<Component, { spacer: Spacer; bytes: number }>();\nconst MAX_DIAGNOSTIC_STATUSES = 64;\nconst MAX_DIAGNOSTIC_HISTORY_BYTES = 256 * 1024;\n\nInteractiveModeBase.prototype.showStatus = function (\n\tthis: InteractiveModeBase,\n\tmessage: string,\n\tpersist = false,\n): void {\n\tconst children = this.chatContainer.children;\n\tconst last = children.length > 0 ? children[children.length - 1] : undefined;\n\tconst secondLast = children.length > 1 ? children[children.length - 2] : undefined;\n\n\tif (!persist && last && secondLast && last === this.lastStatusText && secondLast === this.lastStatusSpacer) {\n\t\tthis.lastStatusText.setText(theme.fg(\"dim\", message));\n\t\tthis.ui.requestRender();\n\t\treturn;\n\t}\n\n\tif (persist) message = appendBoundedStderr(\"\", message);\n\tconst spacer = new Spacer(1);\n\tconst text = new Text(theme.fg(\"dim\", message), 1, 0);\n\tthis.chatContainer.addChild(spacer);\n\tthis.chatContainer.addChild(text);\n\tthis.lastStatusSpacer = persist ? undefined : spacer;\n\tthis.lastStatusText = persist ? undefined : text;\n\tif (persist) {\n\t\tdiagnosticStatuses.set(text, { spacer, bytes: Buffer.byteLength(message) });\n\t\tlet count = 0;\n\t\tlet bytes = 0;\n\t\tfor (const child of [...children].reverse()) {\n\t\t\tconst diagnostic = diagnosticStatuses.get(child);\n\t\t\tif (!diagnostic) continue;\n\t\t\tcount++;\n\t\t\tbytes += diagnostic.bytes;\n\t\t\tif (count > MAX_DIAGNOSTIC_STATUSES || bytes > MAX_DIAGNOSTIC_HISTORY_BYTES) {\n\t\t\t\tthis.chatContainer.removeChild(child);\n\t\t\t\tthis.chatContainer.removeChild(diagnostic.spacer);\n\t\t\t}\n\t\t}\n\t}\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.renderDeferredUserInput = function (this: InteractiveModeBase, text: string): void {\n\tthis.deferredRenderedUserInputs.push(text);\n\tconst startIndex = this.chatContainer.children.length;\n\tthis.addMessageToChat({ role: \"user\", content: text } as AgentMessage);\n\tconst renderedComponents = this.chatContainer.children.slice(startIndex);\n\tconst trackedComponents = this.deferredRenderedUserInputComponents.get(text) ?? [];\n\ttrackedComponents.push(renderedComponents);\n\tthis.deferredRenderedUserInputComponents.set(text, trackedComponents);\n\tthis.updatePendingMessagesDisplay();\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.consumeDeferredRenderedUserInput = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n): boolean {\n\tconst index = this.deferredRenderedUserInputs.indexOf(text);\n\tif (index === -1) return false;\n\tthis.deferredRenderedUserInputs.splice(index, 1);\n\tif (this.startedDeferredUserInput === text) this.startedDeferredUserInput = undefined;\n\tconst trackedComponents = this.deferredRenderedUserInputComponents.get(text);\n\ttrackedComponents?.shift();\n\tif (trackedComponents && trackedComponents.length === 0) {\n\t\tthis.deferredRenderedUserInputComponents.delete(text);\n\t}\n\treturn true;\n};\n\nInteractiveModeBase.prototype.discardDeferredRenderedUserInput = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n): void {\n\tconst index = this.deferredRenderedUserInputs.indexOf(text);\n\tif (index !== -1) {\n\t\tthis.deferredRenderedUserInputs.splice(index, 1);\n\t\tif (this.startedDeferredUserInput === text) this.startedDeferredUserInput = undefined;\n\t}\n\tconst trackedComponents = this.deferredRenderedUserInputComponents.get(text);\n\tconst componentsToRemove = trackedComponents?.shift();\n\tif (trackedComponents && trackedComponents.length === 0) {\n\t\tthis.deferredRenderedUserInputComponents.delete(text);\n\t}\n\tif (!componentsToRemove) return;\n\tfor (const component of componentsToRemove) {\n\t\tthis.chatContainer.removeChild(component);\n\t}\n\tthis.updatePendingMessagesDisplay();\n\tthis.ui.requestRender();\n};\n\n/**\n * The session started a run for a submission this host echoed as `text`. The run begins with the submission's message,\n * as sent: an `input` hook may have rewritten it, so its `message_start` need not match the echo (#4277). An engine's\n * answer can reach the host after that `message_start`, which the session then showed itself (#4272): if it showed any\n * message of its own since `shownBefore`, the echo goes. Otherwise the session's next message that matches no echo\n * takes the echo's place. A run starts only after the one before it showed its message, so an earlier run still\n * waiting here never got to show it, and its echo stays as it is.\n */\nInteractiveModeBase.prototype.expectStartedUserInput = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n\tshownBefore: number,\n): void {\n\tif (!this.deferredRenderedUserInputs.includes(text)) return;\n\tif (this.userMessagesShownBySession !== shownBefore) this.discardDeferredRenderedUserInput(text);\n\telse this.startedDeferredUserInput = text;\n};\n\n/** Show a user message from the session: in place of its echo, or of the echo of the run it started, or as new. */\nInteractiveModeBase.prototype.showSessionUserMessage = function (this: InteractiveModeBase, message: Message): void {\n\tif (this.consumeDeferredRenderedUserInput(this.getUserMessageText(message))) return;\n\tconst started = this.startedDeferredUserInput;\n\tif (started !== undefined) {\n\t\tconst echo = this.deferredRenderedUserInputComponents.get(started)?.[0];\n\t\tappendNewChildrenBeforeAttachedChild(this.chatContainer, echo?.[0], () => this.addMessageToChat(message));\n\t\tthis.discardDeferredRenderedUserInput(started);\n\t\treturn;\n\t}\n\tthis.userMessagesShownBySession += 1;\n\tthis.addMessageToChat(message);\n};\n\nInteractiveModeBase.prototype.getMarkdownTransformers = function (this: InteractiveModeBase) {\n\tconst mode = this.settingsManager.getMermaidRenderingMode();\n\tif (this.mermaidMarkdownTransformerMode !== mode) {\n\t\tthis.mermaidMarkdownTransformerMode = mode;\n\t\tthis.mermaidMarkdownTransformer = createMermaidMarkdownTransformer({\n\t\t\tgetMode: () => this.settingsManager.getMermaidRenderingMode(),\n\t\t\ttheme,\n\t\t});\n\t}\n\tconst extensionTransformers =\n\t\tthis.runtimeHost instanceof IsolatedInteractiveRuntime\n\t\t\t? []\n\t\t\t: this.session.extensionRunner.getMarkdownTransformers();\n\treturn [this.mermaidMarkdownTransformer, ...extensionTransformers];\n};\n\n/**\n * Markdown of a changelog that runs the Markdown transformers registered for the `changelog` type. Transformers are\n * looked up on each render, so a notice shown before deferred extensions load uses them once it is invalidated.\n */\nInteractiveModeBase.prototype.createChangelogMarkdown = function (\n\tthis: InteractiveModeBase,\n\tmarkdown: string,\n\tpaddingX: number,\n\tpaddingY: number,\n): Markdown {\n\treturn new Markdown(markdown, paddingX, paddingY, this.getMarkdownThemeWithSettings(), undefined, {\n\t\ttransform: (text, width) =>\n\t\t\tcreateMarkdownTransform(\"changelog\", () => false, this.getMarkdownTransformers())(text, width),\n\t});\n};\n\nInteractiveModeBase.prototype.chatMessageRenderOptions = function (\n\tthis: InteractiveModeBase,\n): ChatMessageRenderOptions {\n\tconst isolated = this.runtimeHost instanceof IsolatedInteractiveRuntime;\n\treturn {\n\t\tui: this.ui,\n\t\tcwd: this.sessionManager.getCwd(),\n\t\tmarkdownTheme: this.getMarkdownThemeWithSettings(),\n\t\thideThinkingBlock: this.hideThinkingBlock,\n\t\thiddenThinkingLabel: this.hiddenThinkingLabel,\n\t\ttoolOutputExpanded: this.toolOutputExpanded,\n\t\tshowImages: this.settingsManager.getShowImages(),\n\t\timageWidthCells: this.settingsManager.getImageWidthCells(),\n\t\toutputPad: this.outputPad,\n\t\trenderLatex: this.settingsManager.getLatexRenderingEnabled(),\n\t\tmarkdownTransformers: this.getMarkdownTransformers(),\n\t\tgetToolDefinition: isolated ? undefined : (toolName) => this.getRegisteredToolDefinition(toolName),\n\t\tgetCustomMessageRenderer: isolated\n\t\t\t? undefined\n\t\t\t: (customType) => this.session.extensionRunner.getMessageRenderer(customType),\n\t\tcreateToolComponent: isolated\n\t\t\t? (entry) => {\n\t\t\t\t\tconst component = new RemoteToolExecutionComponent(\n\t\t\t\t\t\tentry.toolName,\n\t\t\t\t\t\tentry.toolCallId,\n\t\t\t\t\t\tentry.args,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tshowImages: this.settingsManager.getShowImages(),\n\t\t\t\t\t\t\timageWidthCells: this.settingsManager.getImageWidthCells(),\n\t\t\t\t\t\t\toutputPad: this.outputPad,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tthis.runtimeHost as IsolatedInteractiveRuntime,\n\t\t\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t\t);\n\t\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\t\tif (entry.result) component.updateResult(entry.result, entry.isPartial ?? false);\n\t\t\t\t\treturn component;\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tcreateCustomMessageComponent: isolated\n\t\t\t? (message) => {\n\t\t\t\t\tconst component = new RemoteCustomMessageComponent(\n\t\t\t\t\t\tmessage,\n\t\t\t\t\t\tthis.runtimeHost as IsolatedInteractiveRuntime,\n\t\t\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t);\n\t\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\t\treturn component;\n\t\t\t\t}\n\t\t\t: undefined,\n\t};\n};\n\nInteractiveModeBase.prototype.addRenderedChatEntry = function (\n\tthis: InteractiveModeBase,\n\tentry: ChatMessageEntry,\n): Component {\n\tconst component = renderChatMessageEntry(entry, this.chatMessageRenderOptions());\n\taddChatTranscriptEntry(this.chatContainer, component, entry.role);\n\treturn component;\n};\n\nInteractiveModeBase.prototype.addCompactionBoundaryToChat = function (\n\tthis: InteractiveModeBase,\n\tresult: VerbatimCompactionResult,\n): void {\n\tthis.chatContainer.addChild(new Spacer(1));\n\tconst component = new CompactionBoundaryMessageComponent(result, this.outputPad);\n\tcomponent.setExpanded(this.toolOutputExpanded);\n\tthis.chatContainer.addChild(component);\n};\n\nInteractiveModeBase.prototype.addCompactionCostNotice = function (\n\tthis: InteractiveModeBase,\n\tkind: \"compaction\" | \"branch_summary\",\n\tusage: Usage,\n): void {\n\tif (!this.settingsManager.getShowCacheMissNotices()) return;\n\tconst tokens = usage.input + usage.output + usage.cacheRead + usage.cacheWrite;\n\tconst cost = usage.cost.total >= 0.01 ? ` (~$${usage.cost.total.toFixed(2)})` : \"\";\n\tconst label = kind === \"compaction\" ? \"Compaction\" : \"Branch summary\";\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(\n\t\tnew Text(theme.fg(\"warning\", `${label}: ${tokens.toLocaleString()} tokens billed${cost}`), 1, 0),\n\t);\n};\n\nInteractiveModeBase.prototype.addCustomEntryToChat = function (this: InteractiveModeBase, entry: CustomEntry): void {\n\tconst renderer = this.session.extensionRunner.getEntryRenderer(entry.customType);\n\tif (!renderer) return;\n\tconst runner = this.session.extensionRunner;\n\tconst component = new CustomEntryComponent(\n\t\tentry,\n\t\t(...args) => runner.renderEntry(entry.customType, ...args),\n\t\tthis.outputPad,\n\t);\n\tcomponent.setExpanded(this.toolOutputExpanded);\n\tif (!component.hasContent()) return;\n\tconst streamingIndex = this.streamingComponent ? this.chatContainer.children.indexOf(this.streamingComponent) : -1;\n\tif (streamingIndex >= 0) this.chatContainer.children.splice(streamingIndex, 0, component);\n\telse this.chatContainer.addChild(component);\n};\n\nInteractiveModeBase.prototype.addMessageToChat = function (\n\tthis: InteractiveModeBase,\n\tmessage: AgentMessage,\n\toptions?: { populateHistory?: boolean },\n): void {\n\tconst markdownTransformers = this.getMarkdownTransformers();\n\tswitch (message.role) {\n\t\tcase \"bashExecution\": {\n\t\t\tconst component = new BashExecutionComponent(\n\t\t\t\tmessage.command,\n\t\t\t\tthis.ui,\n\t\t\t\tmessage.excludeFromContext,\n\t\t\t\tthis.outputPad,\n\t\t\t);\n\t\t\tif (message.output) {\n\t\t\t\tcomponent.appendOutput(message.output);\n\t\t\t}\n\t\t\tcomponent.setComplete(\n\t\t\t\tmessage.exitCode,\n\t\t\t\tmessage.cancelled,\n\t\t\t\tmessage.truncated ? ({ truncated: true } as TruncationResult) : undefined,\n\t\t\t\tmessage.fullOutputPath,\n\t\t\t);\n\t\t\tthis.chatContainer.addChild(component);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"custom\": {\n\t\t\tif (message.display) {\n\t\t\t\tconst component =\n\t\t\t\t\tthis.runtimeHost instanceof IsolatedInteractiveRuntime\n\t\t\t\t\t\t? new RemoteCustomMessageComponent(\n\t\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\t\tthis.runtimeHost,\n\t\t\t\t\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: new CustomMessageComponent(\n\t\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\t\tthis.session.extensionRunner.getMessageRenderer(message.customType),\n\t\t\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t\t\t);\n\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\tthis.chatContainer.addChild(component);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"branchSummary\": {\n\t\t\tthis.chatContainer.addChild(new Spacer(1));\n\t\t\tconst component = new BranchSummaryMessageComponent(\n\t\t\t\tmessage,\n\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\tthis.outputPad,\n\t\t\t\tmarkdownTransformers,\n\t\t\t);\n\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\tthis.chatContainer.addChild(component);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"user\": {\n\t\t\tconst textContent = this.getUserMessageText(message);\n\t\t\tif (textContent) {\n\t\t\t\tif (this.chatContainer.children.length > 0) {\n\t\t\t\t\tthis.chatContainer.addChild(new Spacer(1));\n\t\t\t\t}\n\t\t\t\tconst skillBlock = parseSkillBlock(textContent);\n\t\t\t\tif (skillBlock) {\n\t\t\t\t\t// Render skill block (collapsible)\n\t\t\t\t\tconst component = new SkillInvocationMessageComponent(\n\t\t\t\t\t\tskillBlock,\n\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t);\n\t\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\t\tthis.chatContainer.addChild(component);\n\t\t\t\t\t// Render user message separately if present\n\t\t\t\t\tif (skillBlock.userMessage) {\n\t\t\t\t\t\tconst userComponent = new UserMessageComponent(\n\t\t\t\t\t\t\tskillBlock.userMessage,\n\t\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.chatContainer.addChild(userComponent);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst userComponent = new UserMessageComponent(\n\t\t\t\t\t\ttextContent,\n\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t);\n\t\t\t\t\tthis.chatContainer.addChild(userComponent);\n\t\t\t\t}\n\t\t\t\tif (options?.populateHistory) {\n\t\t\t\t\tthis.editor.addToHistory?.(textContent);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"assistant\": {\n\t\t\tconst assistantComponent = new AssistantMessageComponent(\n\t\t\t\tmessage,\n\t\t\t\tthis.hideThinkingBlock,\n\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\tthis.hiddenThinkingLabel,\n\t\t\t\tthis.outputPad,\n\t\t\t\tmarkdownTransformers,\n\t\t\t\tfalse,\n\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t);\n\t\t\tthis.chatContainer.addChild(assistantComponent);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"toolResult\": {\n\t\t\t// Tool results are rendered inline with tool calls, handled separately\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tbreak;\n\t}\n};\n\nInteractiveModeBase.prototype.renderSessionContext = function (\n\tthis: InteractiveModeBase,\n\tsessionContext: SessionContext,\n\toptions: { updateFooter?: boolean; populateHistory?: boolean } = {},\n): void {\n\tthis.pendingTools.clear();\n\tconst pendingDeferredInputs = [...this.deferredRenderedUserInputs];\n\tthis.deferredRenderedUserInputs = [];\n\tthis.deferredRenderedUserInputComponents.clear();\n\n\tif (options.updateFooter) {\n\t\tthis.footer.invalidate();\n\t\tthis.updateEditorBorderColor();\n\t}\n\n\tconst entries = chatEntriesFromAgentMessages(sessionContext.messages);\n\tfor (const entry of entries) {\n\t\tconst component = this.addRenderedChatEntry(entry);\n\t\tif (entry.kind === \"tool\" && entry.isPartial !== false && component instanceof ToolExecutionComponent) {\n\t\t\tthis.pendingTools.set(entry.toolCallId, component);\n\t\t}\n\t\tif (options.populateHistory && entry.kind === \"user\") {\n\t\t\tthis.editor.addToHistory?.(entry.text);\n\t\t}\n\t}\n\n\tfor (const input of pendingDeferredInputs) {\n\t\tthis.renderDeferredUserInput(input);\n\t}\n\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.renderSessionEntries = function (\n\tthis: InteractiveModeBase,\n\tsessionEntries: SessionEntry[],\n\toptions: {\n\t\tupdateFooter?: boolean;\n\t\tpopulateHistory?: boolean;\n\t\tsuppressCompactionBoundary?: VerbatimCompactionResult;\n\t} = {},\n): void {\n\tthis.resetTranscriptSelection();\n\tthis.pendingTools.clear();\n\tconst deferredInputs = [...this.deferredRenderedUserInputs];\n\tthis.deferredRenderedUserInputs = [];\n\tthis.deferredRenderedUserInputComponents.clear();\n\tif (options.updateFooter) {\n\t\tthis.footer.invalidate();\n\t\tthis.updateEditorBorderColor();\n\t}\n\tlet messageBuffer: AgentMessage[] = [];\n\tconst messageMeta = new Map<AgentMessage, PersistedMessageMeta>();\n\tlet firstMessage = true;\n\tconst flushMessages = (): void => {\n\t\tif (\n\t\t\toptions.suppressCompactionBoundary &&\n\t\t\tfirstMessage &&\n\t\t\tisSynthesizedCompactionBoundary(messageBuffer[0], options.suppressCompactionBoundary)\n\t\t) {\n\t\t\tmessageBuffer = messageBuffer.slice(1);\n\t\t}\n\t\tfirstMessage = false;\n\t\tfor (const entry of chatEntriesFromAgentMessages(messageBuffer, messageMeta)) {\n\t\t\tconst component = this.addRenderedChatEntry(entry);\n\t\t\tif (entry.kind === \"assistant\") addServiceTierWarnings(this, entry.message);\n\t\t\tif (entry.kind === \"tool\" && entry.isPartial !== false && component instanceof ToolExecutionComponent) {\n\t\t\t\tthis.pendingTools.set(entry.toolCallId, component);\n\t\t\t}\n\t\t\tif (options.populateHistory && entry.kind === \"user\") this.editor.addToHistory?.(entry.text);\n\t\t}\n\t\tmessageBuffer = [];\n\t};\n\tfor (const entry of sessionEntries) {\n\t\tif (entry.type === \"custom\") {\n\t\t\t// An unrendered record between a tool call and its result must not split them into two cards.\n\t\t\tif (!this.session.extensionRunner.getEntryRenderer(entry.customType)) continue;\n\t\t\tflushMessages();\n\t\t\tthis.addCustomEntryToChat(entry);\n\t\t} else {\n\t\t\tconst messages = sessionEntryToContextMessages(entry);\n\t\t\tfor (const message of messages) messageMeta.set(message, { id: entry.id, timestamp: entry.timestamp });\n\t\t\tmessageBuffer.push(...messages);\n\t\t\tif ((entry.type === \"compaction\" || entry.type === \"branch_summary\") && entry.usage) {\n\t\t\t\tflushMessages();\n\t\t\t\tconst suppressedLiveBoundary =\n\t\t\t\t\tentry.type === \"compaction\" &&\n\t\t\t\t\toptions.suppressCompactionBoundary !== undefined &&\n\t\t\t\t\tentry.summary === options.suppressCompactionBoundary.compactedText &&\n\t\t\t\t\tentry.tokensBefore === options.suppressCompactionBoundary.tokensBefore;\n\t\t\t\tif (!suppressedLiveBoundary) this.addCompactionCostNotice(entry.type, entry.usage);\n\t\t\t}\n\t\t}\n\t}\n\tflushMessages();\n\tif (this.settingsManager.getShowCacheMissNotices()) {\n\t\tfor (const miss of collectCacheMisses(\n\t\t\tsessionEntries,\n\t\t\tcreateCacheMissModelSource(this.session.modelRuntime),\n\t\t).values()) {\n\t\t\tconst cause = describeCacheMissCause(miss);\n\t\t\tthis.chatContainer.addChild(\n\t\t\t\tnew Text(\n\t\t\t\t\ttheme.fg(\n\t\t\t\t\t\t\"warning\",\n\t\t\t\t\t\t`Prompt cache miss${cause}: ${miss.missedTokens.toLocaleString()} tokens re-billed ($${miss.missedCost.toFixed(3)})`,\n\t\t\t\t\t),\n\t\t\t\t\t1,\n\t\t\t\t\t0,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\tfor (const input of deferredInputs) this.renderDeferredUserInput(input);\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.attachStartupNoticesContainer = function (\n\tthis: InteractiveModeBase,\n\toptions: { resetDetached?: boolean } = {},\n): void {\n\tconst disclosureIndex = this.chatContainer.children.indexOf(this.resourceDisclosureContainer);\n\tconst noticesIndex = this.chatContainer.children.indexOf(this.startupNoticesContainer);\n\tif (disclosureIndex >= 0 && noticesIndex >= 0) return;\n\tif (disclosureIndex < 0) {\n\t\tif (options.resetDetached) this.resourceDisclosureContainer.clear();\n\t\tif (noticesIndex >= 0) this.chatContainer.children.splice(noticesIndex, 0, this.resourceDisclosureContainer);\n\t\telse this.chatContainer.addChild(this.resourceDisclosureContainer);\n\t}\n\tif (noticesIndex < 0) {\n\t\tif (options.resetDetached) this.startupNoticesContainer.clear();\n\t\tthis.chatContainer.addChild(this.startupNoticesContainer);\n\t}\n};\n\nInteractiveModeBase.prototype.renderInitialMessages = function (this: InteractiveModeBase): void {\n\tthis.attachStartupNoticesContainer({ resetDetached: true });\n\tconst entries = buildContextEntries(this.sessionManager.getEntries(), this.sessionManager.getLeafId());\n\tthis.renderSessionEntries(entries, { updateFooter: true, populateHistory: true });\n\trenderProjectTrustWarningIfNeeded(this);\n\trefreshInteractiveTasks(this);\n};\n\nfunction renderProjectTrustWarningIfNeeded(mode: InteractiveModeBase): void {\n\tif (mode.settingsManager.isProjectTrusted() || !hasTrustRequiringProjectResources(mode.sessionManager.getCwd())) {\n\t\treturn;\n\t}\n\tif (mode.chatContainer.children.length > 0) {\n\t\tmode.chatContainer.addChild(new Spacer(1));\n\t}\n\tmode.chatContainer.addChild(\n\t\tnew ThemedText(\n\t\t\t() =>\n\t\t\t\ttheme.fg(\n\t\t\t\t\t\"warning\",\n\t\t\t\t\t`This project is not trusted. Project ${CONFIG_DIR_NAME} resources and packages are ignored. Use /trust to save a trust decision, then restart ${APP_NAME}.`,\n\t\t\t\t),\n\t\t\t1,\n\t\t\t0,\n\t\t),\n\t);\n}\n\nInteractiveModeBase.prototype.getUserInput = async function (\n\tthis: InteractiveModeBase,\n): Promise<InteractiveSubmission> {\n\twhile (true) {\n\t\tconst queuedInput = this.pendingUserInputs.shift();\n\t\tif (queuedInput !== undefined) {\n\t\t\treturn queuedInput;\n\t\t}\n\n\t\tif (this.startupReplayActiveInput) {\n\t\t\tawait this.drainStartupReplayCommands();\n\t\t\tcontinue;\n\t\t}\n\n\t\treturn new Promise((resolve) => {\n\t\t\tthis.onInputCallback = (submission: InteractiveSubmission) => {\n\t\t\t\tthis.onInputCallback = undefined;\n\t\t\t\tresolve(submission);\n\t\t\t};\n\t\t\tif (!this.inputHandlerReadyRecorded) {\n\t\t\t\tthis.inputHandlerReadyRecorded = true;\n\t\t\t\trecordTimeSinceReset(\"interactive-input-handler-ready\");\n\t\t\t\tmarkLifecycleTiming(\"interactive-input-handler-ready\");\n\t\t\t\tvoid (async () => {\n\t\t\t\t\tawait yieldToEventLoop();\n\t\t\t\t\t// pi parity: the changelog/first-run notices need nothing from\n\t\t\t\t\t// extensions — render them right after the input handler is ready\n\t\t\t\t\t// instead of gating them behind the deferred extension reload (or,\n\t\t\t\t\t// when the user types immediately, behind the whole agent turn).\n\t\t\t\t\tthis.showStartupNoticesIfNeeded(this.startupNoticesContainer);\n\t\t\t\t\tthis.footerDataProvider.startGitWatcher();\n\t\t\t\t\tif (this.deferredStartupPending) {\n\t\t\t\t\t\tawait this.ensureDeferredStartupComplete();\n\t\t\t\t\t}\n\t\t\t\t})().catch((error) => {\n\t\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\t\tconsole.error(`Deferred input-readiness startup task failed: ${message}`);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n};\n\nInteractiveModeBase.prototype.rebuildChatFromMessages = function (\n\tthis: InteractiveModeBase,\n\toptions: {\n\t\tsuppressCompactionBoundary?: VerbatimCompactionResult;\n\t\tresetStartupDisclosure?: boolean;\n\t} = {},\n): void {\n\t// Generic rebuilds keep the same session: pending fd/rg callbacks still own\n\t// this transcript. Full session replacements invalidate their generation in\n\t// renderCurrentSessionState() before rebuilding the replacement transcript.\n\tthis.managedToolStatusStarted = false;\n\tthis.lastStatusSpacer = undefined;\n\tthis.lastStatusText = undefined;\n\tthis.chatContainer.clear();\n\tif (options.resetStartupDisclosure) this.resourceDisclosureContainer.clear();\n\tthis.attachStartupNoticesContainer();\n\tconst entries = buildContextEntries(this.sessionManager.getEntries(), this.sessionManager.getLeafId());\n\tthis.renderSessionEntries(entries, { suppressCompactionBoundary: options.suppressCompactionBoundary });\n};\n\nfunction isSynthesizedCompactionBoundary(message: AgentMessage | undefined, result: VerbatimCompactionResult): boolean {\n\tif (message?.role !== \"custom\" || message.customType !== \"compaction\" || !message.display) return false;\n\tconst details = message.details as { strategy?: string } | undefined;\n\tif (details?.strategy !== \"verbatim-lines\") return false;\n\tconst content = Array.isArray(message.content)\n\t\t? message.content\n\t\t\t\t.filter((block) => block.type === \"text\")\n\t\t\t\t.map((block) => block.text)\n\t\t\t\t.join(\"\\n\")\n\t\t: message.content;\n\treturn content === VERBATIM_COMPACTION_PREFIX + result.compactedText;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interactive-render-chat.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-render-chat.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE1E,OAAO,EAAE,mBAAmB,EAAqB,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AACtH,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AACvF,OAAO,EAAE,4BAA4B,EAAE,4BAA4B,EAAE,MAAM,0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,KAAK,CAAC,IAAI,CAAC;aAC1B,IAAI,CAAC,IAAI,CAAC;QACb,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACnB,OAAO,6BAA6B,CAAC,OAAO,CAAC,KAAK,MAAM,CAAC,aAAa,CAAC;AACxE,CAAC","sourcesContent":["import type { AssistantMessage, Usage } from \"@bastani/pi-ai/compat\";\nimport { CONFIG_DIR_NAME } from \"../../config.js\";\nimport { collectCacheMisses, createCacheMissModelSource, describeCacheMissCause } from \"../../core/cache-stats.ts\";\nimport { markLifecycleTiming } from \"../../core/lifecycle-timings.ts\";\nimport { stripVerbatimCompactionPrefix } from \"../../core/messages.ts\";\nimport { serviceTierWarnings } from \"../../core/service-tier-warnings.ts\";\nimport type { CustomEntry } from \"../../core/session-manager.ts\";\nimport { buildContextEntries, type SessionEntry, sessionEntryToContextMessages } from \"../../core/session-manager.ts\";\nimport { yieldToEventLoop } from \"../../utils/event-loop.ts\";\nimport { IsolatedInteractiveRuntime } from \"../interactive-engine/isolated-runtime.js\";\nimport { RemoteCustomMessageComponent, RemoteToolExecutionComponent } from \"../interactive-engine/remote-renderer.ts\";\nimport { appendBoundedStderr } from \"../rpc/rpc-client-process.js\";\nimport { CustomEntryComponent } from \"./components/custom-entry.ts\";\nimport { createMarkdownTransform } from \"./components/markdown-transform.ts\";\nimport { createMermaidMarkdownTransformer } from \"./components/mermaid.ts\";\nimport { ThemedText } from \"./components/themed-text.js\";\nimport { appendNewChildrenBeforeAttachedChild } from \"./interactive-child-ordering.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport {\n\ttype AgentMessage,\n\tAPP_NAME,\n\tAssistantMessageComponent,\n\taddChatTranscriptEntry,\n\tBashExecutionComponent,\n\tBranchSummaryMessageComponent,\n\ttype ChatMessageEntry,\n\ttype ChatMessageRenderOptions,\n\tCompactionBoundaryMessageComponent,\n\ttype Component,\n\tCustomMessageComponent,\n\tchatEntriesFromAgentMessages,\n\thasTrustRequiringProjectResources,\n\tMarkdown,\n\ttype Message,\n\ttype PersistedMessageMeta,\n\tparseSkillBlock,\n\trecordTimeSinceReset,\n\trenderChatMessageEntry,\n\ttype SessionContext,\n\tSkillInvocationMessageComponent,\n\tSpacer,\n\tText,\n\tToolExecutionComponent,\n\ttype TruncationResult,\n\ttheme,\n\tUserMessageComponent,\n\ttype VerbatimCompactionResult,\n} from \"./interactive-mode-deps.ts\";\nimport type { InteractiveSubmission } from \"./interactive-submission.ts\";\nimport { refreshInteractiveTasks } from \"./interactive-task-projection.js\";\n\nfunction countDroppedThinkingBlocks(message: AssistantMessage): number {\n\treturn (message.diagnostics ?? []).reduce((count, diagnostic) => {\n\t\tif (diagnostic.type !== \"anthropic_input_transformations\") return count;\n\t\tconst dropped = diagnostic.details?.droppedBlockCount;\n\t\treturn count + (typeof dropped === \"number\" && dropped > 0 ? dropped : 0);\n\t}, 0);\n}\n\nfunction addServiceTierWarnings(mode: InteractiveModeBase, message: AssistantMessage): void {\n\tfor (const warning of serviceTierWarnings(message)) {\n\t\tmode.chatContainer.addChild(new Spacer(1));\n\t\tmode.chatContainer.addChild(new Text(theme.fg(\"warning\", `Warning: ${warning}`), 1, 0));\n\t}\n}\n\nInteractiveModeBase.prototype.maybeShowAssistantDiagnostics = function (\n\tthis: InteractiveModeBase,\n\tmessage: AssistantMessage,\n): void {\n\taddServiceTierWarnings(this, message);\n\tif (!this.settingsManager.getShowCacheMissNotices()) return;\n\n\tconst count = countDroppedThinkingBlocks(message);\n\tif (count === 0) return;\n\tlet previousCount = 0;\n\t// The live message_end notification precedes persistence of this response.\n\tconst branch = this.sessionManager.getBranch();\n\tfor (let i = branch.length - 1; i >= 0; i--) {\n\t\tconst entry = branch[i];\n\t\tif (entry.type === \"message\" && entry.message.role === \"assistant\") {\n\t\t\tpreviousCount = countDroppedThinkingBlocks(entry.message);\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (count <= previousCount) return;\n\tconst noun = count === 1 ? \"thinking block\" : \"thinking blocks\";\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(\n\t\tnew Text(theme.fg(\"warning\", `Anthropic dropped ${count} ${noun} (details in session)`), 1, 0),\n\t);\n};\n\n// Weak keys leave cleared/rebuilt transcripts collectible without separate lifecycle state.\n// Only persistent diagnostic statuses participate; ordinary chat/status is never evicted.\nconst diagnosticStatuses = new WeakMap<Component, { spacer: Spacer; bytes: number }>();\nconst MAX_DIAGNOSTIC_STATUSES = 64;\nconst MAX_DIAGNOSTIC_HISTORY_BYTES = 256 * 1024;\n\nInteractiveModeBase.prototype.showStatus = function (\n\tthis: InteractiveModeBase,\n\tmessage: string,\n\tpersist = false,\n): void {\n\tconst children = this.chatContainer.children;\n\tconst last = children.length > 0 ? children[children.length - 1] : undefined;\n\tconst secondLast = children.length > 1 ? children[children.length - 2] : undefined;\n\n\tif (!persist && last && secondLast && last === this.lastStatusText && secondLast === this.lastStatusSpacer) {\n\t\tthis.lastStatusText.setText(theme.fg(\"dim\", message));\n\t\tthis.ui.requestRender();\n\t\treturn;\n\t}\n\n\tif (persist) message = appendBoundedStderr(\"\", message);\n\tconst spacer = new Spacer(1);\n\tconst text = new Text(theme.fg(\"dim\", message), 1, 0);\n\tthis.chatContainer.addChild(spacer);\n\tthis.chatContainer.addChild(text);\n\tthis.lastStatusSpacer = persist ? undefined : spacer;\n\tthis.lastStatusText = persist ? undefined : text;\n\tif (persist) {\n\t\tdiagnosticStatuses.set(text, { spacer, bytes: Buffer.byteLength(message) });\n\t\tlet count = 0;\n\t\tlet bytes = 0;\n\t\tfor (const child of [...children].reverse()) {\n\t\t\tconst diagnostic = diagnosticStatuses.get(child);\n\t\t\tif (!diagnostic) continue;\n\t\t\tcount++;\n\t\t\tbytes += diagnostic.bytes;\n\t\t\tif (count > MAX_DIAGNOSTIC_STATUSES || bytes > MAX_DIAGNOSTIC_HISTORY_BYTES) {\n\t\t\t\tthis.chatContainer.removeChild(child);\n\t\t\t\tthis.chatContainer.removeChild(diagnostic.spacer);\n\t\t\t}\n\t\t}\n\t}\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.renderDeferredUserInput = function (this: InteractiveModeBase, text: string): void {\n\tthis.deferredRenderedUserInputs.push(text);\n\tconst startIndex = this.chatContainer.children.length;\n\tthis.addMessageToChat({ role: \"user\", content: text } as AgentMessage);\n\tconst renderedComponents = this.chatContainer.children.slice(startIndex);\n\tconst trackedComponents = this.deferredRenderedUserInputComponents.get(text) ?? [];\n\ttrackedComponents.push(renderedComponents);\n\tthis.deferredRenderedUserInputComponents.set(text, trackedComponents);\n\tthis.updatePendingMessagesDisplay();\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.consumeDeferredRenderedUserInput = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n): boolean {\n\tconst index = this.deferredRenderedUserInputs.indexOf(text);\n\tif (index === -1) return false;\n\tthis.deferredRenderedUserInputs.splice(index, 1);\n\tif (this.startedDeferredUserInput === text) this.startedDeferredUserInput = undefined;\n\tconst trackedComponents = this.deferredRenderedUserInputComponents.get(text);\n\ttrackedComponents?.shift();\n\tif (trackedComponents && trackedComponents.length === 0) {\n\t\tthis.deferredRenderedUserInputComponents.delete(text);\n\t}\n\treturn true;\n};\n\nInteractiveModeBase.prototype.discardDeferredRenderedUserInput = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n): void {\n\tconst index = this.deferredRenderedUserInputs.indexOf(text);\n\tif (index !== -1) {\n\t\tthis.deferredRenderedUserInputs.splice(index, 1);\n\t\tif (this.startedDeferredUserInput === text) this.startedDeferredUserInput = undefined;\n\t}\n\tconst trackedComponents = this.deferredRenderedUserInputComponents.get(text);\n\tconst componentsToRemove = trackedComponents?.shift();\n\tif (trackedComponents && trackedComponents.length === 0) {\n\t\tthis.deferredRenderedUserInputComponents.delete(text);\n\t}\n\tif (!componentsToRemove) return;\n\tfor (const component of componentsToRemove) {\n\t\tthis.chatContainer.removeChild(component);\n\t}\n\tthis.updatePendingMessagesDisplay();\n\tthis.ui.requestRender();\n};\n\n/**\n * The session started a run for a submission this host echoed as `text`. The run begins with the submission's message,\n * as sent: an `input` hook may have rewritten it, so its `message_start` need not match the echo (#4277). An engine's\n * answer can reach the host after that `message_start`, which the session then showed itself (#4272): if it showed any\n * message of its own since `shownBefore`, the echo goes. Otherwise the session's next message that matches no echo\n * takes the echo's place. A run starts only after the one before it showed its message, so an earlier run still\n * waiting here never got to show it, and its echo stays as it is.\n */\nInteractiveModeBase.prototype.expectStartedUserInput = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n\tshownBefore: number,\n): void {\n\tif (!this.deferredRenderedUserInputs.includes(text)) return;\n\tif (this.userMessagesShownBySession !== shownBefore) this.discardDeferredRenderedUserInput(text);\n\telse this.startedDeferredUserInput = text;\n};\n\n/** Show a user message from the session: in place of its echo, or of the echo of the run it started, or as new. */\nInteractiveModeBase.prototype.showSessionUserMessage = function (this: InteractiveModeBase, message: Message): void {\n\tif (this.consumeDeferredRenderedUserInput(this.getUserMessageText(message))) return;\n\tconst started = this.startedDeferredUserInput;\n\tif (started !== undefined) {\n\t\tconst echo = this.deferredRenderedUserInputComponents.get(started)?.[0];\n\t\tappendNewChildrenBeforeAttachedChild(this.chatContainer, echo?.[0], () => this.addMessageToChat(message));\n\t\tthis.discardDeferredRenderedUserInput(started);\n\t\treturn;\n\t}\n\tthis.userMessagesShownBySession += 1;\n\tthis.addMessageToChat(message);\n};\n\nInteractiveModeBase.prototype.getMarkdownTransformers = function (this: InteractiveModeBase) {\n\tconst mode = this.settingsManager.getMermaidRenderingMode();\n\tif (this.mermaidMarkdownTransformerMode !== mode) {\n\t\tthis.mermaidMarkdownTransformerMode = mode;\n\t\tthis.mermaidMarkdownTransformer = createMermaidMarkdownTransformer({\n\t\t\tgetMode: () => this.settingsManager.getMermaidRenderingMode(),\n\t\t\ttheme,\n\t\t});\n\t}\n\tconst extensionTransformers =\n\t\tthis.runtimeHost instanceof IsolatedInteractiveRuntime\n\t\t\t? []\n\t\t\t: this.session.extensionRunner.getMarkdownTransformers();\n\treturn [this.mermaidMarkdownTransformer, ...extensionTransformers];\n};\n\n/**\n * Markdown of a changelog that runs the Markdown transformers registered for the `changelog` type. Transformers are\n * looked up on each render, so a notice shown before deferred extensions load uses them once it is invalidated.\n */\nInteractiveModeBase.prototype.createChangelogMarkdown = function (\n\tthis: InteractiveModeBase,\n\tmarkdown: string,\n\tpaddingX: number,\n\tpaddingY: number,\n): Markdown {\n\treturn new Markdown(markdown, paddingX, paddingY, this.getMarkdownThemeWithSettings(), undefined, {\n\t\ttransform: (text, width) =>\n\t\t\tcreateMarkdownTransform(\"changelog\", () => false, this.getMarkdownTransformers())(text, width),\n\t});\n};\n\nInteractiveModeBase.prototype.chatMessageRenderOptions = function (\n\tthis: InteractiveModeBase,\n): ChatMessageRenderOptions {\n\tconst isolated = this.runtimeHost instanceof IsolatedInteractiveRuntime;\n\treturn {\n\t\tui: this.ui,\n\t\tcwd: this.sessionManager.getCwd(),\n\t\tmarkdownTheme: this.getMarkdownThemeWithSettings(),\n\t\thideThinkingBlock: this.hideThinkingBlock,\n\t\thiddenThinkingLabel: this.hiddenThinkingLabel,\n\t\ttoolOutputExpanded: this.toolOutputExpanded,\n\t\tshowImages: this.settingsManager.getShowImages(),\n\t\timageWidthCells: this.settingsManager.getImageWidthCells(),\n\t\toutputPad: this.outputPad,\n\t\trenderLatex: this.settingsManager.getLatexRenderingEnabled(),\n\t\tmarkdownTransformers: this.getMarkdownTransformers(),\n\t\tgetToolDefinition: isolated ? undefined : (toolName) => this.getRegisteredToolDefinition(toolName),\n\t\tgetCustomMessageRenderer: isolated\n\t\t\t? undefined\n\t\t\t: (customType) => this.session.extensionRunner.getMessageRenderer(customType),\n\t\tcreateToolComponent: isolated\n\t\t\t? (entry) => {\n\t\t\t\t\tconst component = new RemoteToolExecutionComponent(\n\t\t\t\t\t\tentry.toolName,\n\t\t\t\t\t\tentry.toolCallId,\n\t\t\t\t\t\tentry.args,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tshowImages: this.settingsManager.getShowImages(),\n\t\t\t\t\t\t\timageWidthCells: this.settingsManager.getImageWidthCells(),\n\t\t\t\t\t\t\toutputPad: this.outputPad,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tthis.runtimeHost as IsolatedInteractiveRuntime,\n\t\t\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t\t);\n\t\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\t\tif (entry.result) component.updateResult(entry.result, entry.isPartial ?? false);\n\t\t\t\t\treturn component;\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tcreateCustomMessageComponent: isolated\n\t\t\t? (message) => {\n\t\t\t\t\tconst component = new RemoteCustomMessageComponent(\n\t\t\t\t\t\tmessage,\n\t\t\t\t\t\tthis.runtimeHost as IsolatedInteractiveRuntime,\n\t\t\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t);\n\t\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\t\treturn component;\n\t\t\t\t}\n\t\t\t: undefined,\n\t};\n};\n\nInteractiveModeBase.prototype.addRenderedChatEntry = function (\n\tthis: InteractiveModeBase,\n\tentry: ChatMessageEntry,\n): Component {\n\tconst component = renderChatMessageEntry(entry, this.chatMessageRenderOptions());\n\taddChatTranscriptEntry(this.chatContainer, component, entry.role);\n\treturn component;\n};\n\nInteractiveModeBase.prototype.addCompactionBoundaryToChat = function (\n\tthis: InteractiveModeBase,\n\tresult: VerbatimCompactionResult,\n): void {\n\tthis.chatContainer.addChild(new Spacer(1));\n\tconst component = new CompactionBoundaryMessageComponent(result, this.outputPad);\n\tcomponent.setExpanded(this.toolOutputExpanded);\n\tthis.chatContainer.addChild(component);\n};\n\nInteractiveModeBase.prototype.addCompactionCostNotice = function (\n\tthis: InteractiveModeBase,\n\tkind: \"compaction\" | \"branch_summary\",\n\tusage: Usage,\n): void {\n\tif (!this.settingsManager.getShowCacheMissNotices()) return;\n\tconst tokens = usage.input + usage.output + usage.cacheRead + usage.cacheWrite;\n\tconst cost = usage.cost.total >= 0.01 ? ` (~$${usage.cost.total.toFixed(2)})` : \"\";\n\tconst label = kind === \"compaction\" ? \"Compaction\" : \"Branch summary\";\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(\n\t\tnew Text(theme.fg(\"warning\", `${label}: ${tokens.toLocaleString()} tokens billed${cost}`), 1, 0),\n\t);\n};\n\nInteractiveModeBase.prototype.addCustomEntryToChat = function (this: InteractiveModeBase, entry: CustomEntry): void {\n\tconst renderer = this.session.extensionRunner.getEntryRenderer(entry.customType);\n\tif (!renderer) return;\n\tconst runner = this.session.extensionRunner;\n\tconst component = new CustomEntryComponent(\n\t\tentry,\n\t\t(...args) => runner.renderEntry(entry.customType, ...args),\n\t\tthis.outputPad,\n\t);\n\tcomponent.setExpanded(this.toolOutputExpanded);\n\tif (!component.hasContent()) return;\n\tconst streamingIndex = this.streamingComponent ? this.chatContainer.children.indexOf(this.streamingComponent) : -1;\n\tif (streamingIndex >= 0) this.chatContainer.children.splice(streamingIndex, 0, component);\n\telse this.chatContainer.addChild(component);\n};\n\nInteractiveModeBase.prototype.addMessageToChat = function (\n\tthis: InteractiveModeBase,\n\tmessage: AgentMessage,\n\toptions?: { populateHistory?: boolean },\n): void {\n\tconst markdownTransformers = this.getMarkdownTransformers();\n\tswitch (message.role) {\n\t\tcase \"bashExecution\": {\n\t\t\tconst component = new BashExecutionComponent(\n\t\t\t\tmessage.command,\n\t\t\t\tthis.ui,\n\t\t\t\tmessage.excludeFromContext,\n\t\t\t\tthis.outputPad,\n\t\t\t);\n\t\t\tif (message.output) {\n\t\t\t\tcomponent.appendOutput(message.output);\n\t\t\t}\n\t\t\tcomponent.setComplete(\n\t\t\t\tmessage.exitCode,\n\t\t\t\tmessage.cancelled,\n\t\t\t\tmessage.truncated ? ({ truncated: true } as TruncationResult) : undefined,\n\t\t\t\tmessage.fullOutputPath,\n\t\t\t);\n\t\t\tthis.chatContainer.addChild(component);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"custom\": {\n\t\t\tif (message.display) {\n\t\t\t\tconst component =\n\t\t\t\t\tthis.runtimeHost instanceof IsolatedInteractiveRuntime\n\t\t\t\t\t\t? new RemoteCustomMessageComponent(\n\t\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\t\tthis.runtimeHost,\n\t\t\t\t\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: new CustomMessageComponent(\n\t\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\t\tthis.session.extensionRunner.getMessageRenderer(message.customType),\n\t\t\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t\t\t);\n\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\tthis.chatContainer.addChild(component);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"branchSummary\": {\n\t\t\tthis.chatContainer.addChild(new Spacer(1));\n\t\t\tconst component = new BranchSummaryMessageComponent(\n\t\t\t\tmessage,\n\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\tthis.outputPad,\n\t\t\t\tmarkdownTransformers,\n\t\t\t);\n\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\tthis.chatContainer.addChild(component);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"user\": {\n\t\t\tconst textContent = this.getUserMessageText(message);\n\t\t\tif (textContent) {\n\t\t\t\tif (this.chatContainer.children.length > 0) {\n\t\t\t\t\tthis.chatContainer.addChild(new Spacer(1));\n\t\t\t\t}\n\t\t\t\tconst skillBlock = parseSkillBlock(textContent);\n\t\t\t\tif (skillBlock) {\n\t\t\t\t\t// Render skill block (collapsible)\n\t\t\t\t\tconst component = new SkillInvocationMessageComponent(\n\t\t\t\t\t\tskillBlock,\n\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t);\n\t\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\t\tthis.chatContainer.addChild(component);\n\t\t\t\t\t// Render user message separately if present\n\t\t\t\t\tif (skillBlock.userMessage) {\n\t\t\t\t\t\tconst userComponent = new UserMessageComponent(\n\t\t\t\t\t\t\tskillBlock.userMessage,\n\t\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.chatContainer.addChild(userComponent);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst userComponent = new UserMessageComponent(\n\t\t\t\t\t\ttextContent,\n\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t);\n\t\t\t\t\tthis.chatContainer.addChild(userComponent);\n\t\t\t\t}\n\t\t\t\tif (options?.populateHistory) {\n\t\t\t\t\tthis.editor.addToHistory?.(textContent);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"assistant\": {\n\t\t\tconst assistantComponent = new AssistantMessageComponent(\n\t\t\t\tmessage,\n\t\t\t\tthis.hideThinkingBlock,\n\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\tthis.hiddenThinkingLabel,\n\t\t\t\tthis.outputPad,\n\t\t\t\tmarkdownTransformers,\n\t\t\t\tfalse,\n\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t);\n\t\t\tthis.chatContainer.addChild(assistantComponent);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"toolResult\": {\n\t\t\t// Tool results are rendered inline with tool calls, handled separately\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tbreak;\n\t}\n};\n\nInteractiveModeBase.prototype.renderSessionContext = function (\n\tthis: InteractiveModeBase,\n\tsessionContext: SessionContext,\n\toptions: { updateFooter?: boolean; populateHistory?: boolean } = {},\n): void {\n\tthis.pendingTools.clear();\n\tconst pendingDeferredInputs = [...this.deferredRenderedUserInputs];\n\tthis.deferredRenderedUserInputs = [];\n\tthis.deferredRenderedUserInputComponents.clear();\n\n\tif (options.updateFooter) {\n\t\tthis.footer.invalidate();\n\t\tthis.updateEditorBorderColor();\n\t}\n\n\tconst entries = chatEntriesFromAgentMessages(sessionContext.messages);\n\tfor (const entry of entries) {\n\t\tconst component = this.addRenderedChatEntry(entry);\n\t\tif (entry.kind === \"tool\" && entry.isPartial !== false && component instanceof ToolExecutionComponent) {\n\t\t\tthis.pendingTools.set(entry.toolCallId, component);\n\t\t}\n\t\tif (options.populateHistory && entry.kind === \"user\") {\n\t\t\tthis.editor.addToHistory?.(entry.text);\n\t\t}\n\t}\n\n\tfor (const input of pendingDeferredInputs) {\n\t\tthis.renderDeferredUserInput(input);\n\t}\n\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.renderSessionEntries = function (\n\tthis: InteractiveModeBase,\n\tsessionEntries: SessionEntry[],\n\toptions: {\n\t\tupdateFooter?: boolean;\n\t\tpopulateHistory?: boolean;\n\t\tsuppressCompactionBoundary?: VerbatimCompactionResult;\n\t} = {},\n): void {\n\tthis.resetTranscriptSelection();\n\tthis.pendingTools.clear();\n\tconst deferredInputs = [...this.deferredRenderedUserInputs];\n\tthis.deferredRenderedUserInputs = [];\n\tthis.deferredRenderedUserInputComponents.clear();\n\tif (options.updateFooter) {\n\t\tthis.footer.invalidate();\n\t\tthis.updateEditorBorderColor();\n\t}\n\tlet messageBuffer: AgentMessage[] = [];\n\tconst messageMeta = new Map<AgentMessage, PersistedMessageMeta>();\n\tlet firstMessage = true;\n\tconst flushMessages = (): void => {\n\t\tif (\n\t\t\toptions.suppressCompactionBoundary &&\n\t\t\tfirstMessage &&\n\t\t\tisSynthesizedCompactionBoundary(messageBuffer[0], options.suppressCompactionBoundary)\n\t\t) {\n\t\t\tmessageBuffer = messageBuffer.slice(1);\n\t\t}\n\t\tfirstMessage = false;\n\t\tfor (const entry of chatEntriesFromAgentMessages(messageBuffer, messageMeta)) {\n\t\t\tconst component = this.addRenderedChatEntry(entry);\n\t\t\tif (entry.kind === \"assistant\") addServiceTierWarnings(this, entry.message);\n\t\t\tif (entry.kind === \"tool\" && entry.isPartial !== false && component instanceof ToolExecutionComponent) {\n\t\t\t\tthis.pendingTools.set(entry.toolCallId, component);\n\t\t\t}\n\t\t\tif (options.populateHistory && entry.kind === \"user\") this.editor.addToHistory?.(entry.text);\n\t\t}\n\t\tmessageBuffer = [];\n\t};\n\tfor (const entry of sessionEntries) {\n\t\tif (entry.type === \"custom\") {\n\t\t\t// An unrendered record between a tool call and its result must not split them into two cards.\n\t\t\tif (!this.session.extensionRunner.getEntryRenderer(entry.customType)) continue;\n\t\t\tflushMessages();\n\t\t\tthis.addCustomEntryToChat(entry);\n\t\t} else {\n\t\t\tconst messages = sessionEntryToContextMessages(entry);\n\t\t\tfor (const message of messages) messageMeta.set(message, { id: entry.id, timestamp: entry.timestamp });\n\t\t\tmessageBuffer.push(...messages);\n\t\t\tif ((entry.type === \"compaction\" || entry.type === \"branch_summary\") && entry.usage) {\n\t\t\t\tflushMessages();\n\t\t\t\tconst suppressedLiveBoundary =\n\t\t\t\t\tentry.type === \"compaction\" &&\n\t\t\t\t\toptions.suppressCompactionBoundary !== undefined &&\n\t\t\t\t\tentry.summary === options.suppressCompactionBoundary.compactedText &&\n\t\t\t\t\tentry.tokensBefore === options.suppressCompactionBoundary.tokensBefore;\n\t\t\t\tif (!suppressedLiveBoundary) this.addCompactionCostNotice(entry.type, entry.usage);\n\t\t\t}\n\t\t}\n\t}\n\tflushMessages();\n\tif (this.settingsManager.getShowCacheMissNotices()) {\n\t\tfor (const miss of collectCacheMisses(\n\t\t\tsessionEntries,\n\t\t\tcreateCacheMissModelSource(this.session.modelRuntime),\n\t\t).values()) {\n\t\t\tconst cause = describeCacheMissCause(miss);\n\t\t\tthis.chatContainer.addChild(\n\t\t\t\tnew Text(\n\t\t\t\t\ttheme.fg(\n\t\t\t\t\t\t\"warning\",\n\t\t\t\t\t\t`Prompt cache miss${cause}: ${miss.missedTokens.toLocaleString()} tokens re-billed ($${miss.missedCost.toFixed(3)})`,\n\t\t\t\t\t),\n\t\t\t\t\t1,\n\t\t\t\t\t0,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\tfor (const input of deferredInputs) this.renderDeferredUserInput(input);\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.attachStartupNoticesContainer = function (\n\tthis: InteractiveModeBase,\n\toptions: { resetDetached?: boolean } = {},\n): void {\n\tconst disclosureIndex = this.chatContainer.children.indexOf(this.resourceDisclosureContainer);\n\tconst noticesIndex = this.chatContainer.children.indexOf(this.startupNoticesContainer);\n\tif (disclosureIndex >= 0 && noticesIndex >= 0) return;\n\tif (disclosureIndex < 0) {\n\t\tif (options.resetDetached) this.resourceDisclosureContainer.clear();\n\t\tif (noticesIndex >= 0) this.chatContainer.children.splice(noticesIndex, 0, this.resourceDisclosureContainer);\n\t\telse this.chatContainer.addChild(this.resourceDisclosureContainer);\n\t}\n\tif (noticesIndex < 0) {\n\t\tif (options.resetDetached) this.startupNoticesContainer.clear();\n\t\tthis.chatContainer.addChild(this.startupNoticesContainer);\n\t}\n};\n\nInteractiveModeBase.prototype.renderInitialMessages = function (this: InteractiveModeBase): void {\n\tthis.attachStartupNoticesContainer({ resetDetached: true });\n\tconst entries = buildContextEntries(this.sessionManager.getEntries(), this.sessionManager.getLeafId());\n\tthis.renderSessionEntries(entries, { updateFooter: true, populateHistory: true });\n\trenderProjectTrustWarningIfNeeded(this);\n\trefreshInteractiveTasks(this);\n};\n\nfunction renderProjectTrustWarningIfNeeded(mode: InteractiveModeBase): void {\n\tif (mode.settingsManager.isProjectTrusted() || !hasTrustRequiringProjectResources(mode.sessionManager.getCwd())) {\n\t\treturn;\n\t}\n\tif (mode.chatContainer.children.length > 0) {\n\t\tmode.chatContainer.addChild(new Spacer(1));\n\t}\n\tmode.chatContainer.addChild(\n\t\tnew ThemedText(\n\t\t\t() =>\n\t\t\t\ttheme.fg(\n\t\t\t\t\t\"warning\",\n\t\t\t\t\t`This project is not trusted. Project ${CONFIG_DIR_NAME} resources and packages are ignored. Use /trust to save a trust decision, then restart ${APP_NAME}.`,\n\t\t\t\t),\n\t\t\t1,\n\t\t\t0,\n\t\t),\n\t);\n}\n\nInteractiveModeBase.prototype.getUserInput = async function (\n\tthis: InteractiveModeBase,\n): Promise<InteractiveSubmission> {\n\twhile (true) {\n\t\tconst queuedInput = this.pendingUserInputs.shift();\n\t\tif (queuedInput !== undefined) {\n\t\t\treturn queuedInput;\n\t\t}\n\n\t\tif (this.startupReplayActiveInput) {\n\t\t\tawait this.drainStartupReplayCommands();\n\t\t\tcontinue;\n\t\t}\n\n\t\treturn new Promise((resolve) => {\n\t\t\tthis.onInputCallback = (submission: InteractiveSubmission) => {\n\t\t\t\tthis.onInputCallback = undefined;\n\t\t\t\tresolve(submission);\n\t\t\t};\n\t\t\tif (!this.inputHandlerReadyRecorded) {\n\t\t\t\tthis.inputHandlerReadyRecorded = true;\n\t\t\t\trecordTimeSinceReset(\"interactive-input-handler-ready\");\n\t\t\t\tmarkLifecycleTiming(\"interactive-input-handler-ready\");\n\t\t\t\tvoid (async () => {\n\t\t\t\t\tawait yieldToEventLoop();\n\t\t\t\t\t// pi parity: the changelog/first-run notices need nothing from\n\t\t\t\t\t// extensions — render them right after the input handler is ready\n\t\t\t\t\t// instead of gating them behind the deferred extension reload (or,\n\t\t\t\t\t// when the user types immediately, behind the whole agent turn).\n\t\t\t\t\tthis.showStartupNoticesIfNeeded(this.startupNoticesContainer);\n\t\t\t\t\tthis.footerDataProvider.startGitWatcher();\n\t\t\t\t\tif (this.deferredStartupPending) {\n\t\t\t\t\t\tawait this.ensureDeferredStartupComplete();\n\t\t\t\t\t}\n\t\t\t\t})().catch((error) => {\n\t\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\t\tconsole.error(`Deferred input-readiness startup task failed: ${message}`);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n};\n\nInteractiveModeBase.prototype.rebuildChatFromMessages = function (\n\tthis: InteractiveModeBase,\n\toptions: {\n\t\tsuppressCompactionBoundary?: VerbatimCompactionResult;\n\t\tresetStartupDisclosure?: boolean;\n\t} = {},\n): void {\n\t// Generic rebuilds keep the same session: pending fd/rg callbacks still own\n\t// this transcript. Full session replacements invalidate their generation in\n\t// renderCurrentSessionState() before rebuilding the replacement transcript.\n\tthis.managedToolStatusStarted = false;\n\tthis.lastStatusSpacer = undefined;\n\tthis.lastStatusText = undefined;\n\tthis.chatContainer.clear();\n\tif (options.resetStartupDisclosure) this.resourceDisclosureContainer.clear();\n\tthis.attachStartupNoticesContainer();\n\tconst entries = buildContextEntries(this.sessionManager.getEntries(), this.sessionManager.getLeafId());\n\tthis.renderSessionEntries(entries, { suppressCompactionBoundary: options.suppressCompactionBoundary });\n};\n\nfunction isSynthesizedCompactionBoundary(message: AgentMessage | undefined, result: VerbatimCompactionResult): boolean {\n\tif (message?.role !== \"custom\" || message.customType !== \"compaction\" || !message.display) return false;\n\tconst details = message.details as { strategy?: string } | undefined;\n\tif (details?.strategy !== \"verbatim-lines\") return false;\n\tconst content = Array.isArray(message.content)\n\t\t? message.content\n\t\t\t\t.filter((block) => block.type === \"text\")\n\t\t\t\t.map((block) => block.text)\n\t\t\t\t.join(\"\\n\")\n\t\t: message.content;\n\treturn stripVerbatimCompactionPrefix(content) === result.compactedText;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-id-target.d.ts","sourceRoot":"","sources":["../src/session-id-target.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,yBAAyB,CAAC,CAAC,SAAS,kBAAkB,IAC/D;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAA;CAAE,GAC/C;IAAE,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAA;CAAE,GACvD;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACxF;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACxD;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC;AAElC,MAAM,MAAM,+BAA+B,CAAC,CAAC,SAAS,kBAAkB,IACrE;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAA;CAAE,GACrG,OAAO,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE;IAAE,IAAI,EAAE,WAAW,GAAG,WAAW,GAAG,WAAW,CAAA;CAAE,CAAC,CAAC;AAE5F,uF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AS,kBAAkB,IACrE;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAA;CAAE,GACrG,OAAO,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE;IAAE,IAAI,EAAE,WAAW,GAAG,WAAW,GAAG,WAAW,CAAA;CAAE,CAAC,CAAC;AAE5F,uFAAuF;AACvF,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,kBAAkB,EAClE,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,SAAS,CAAC,EAAE,GACpB,yBAAyB,CAAC,CAAC,CAAC,CAmC9B;AAED,kFAAkF;AAClF,wBAAsB,kCAAkC,CAAC,CAAC,SAAS,kBAAkB,EACpF,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,SAAS,CAAC,EAAE,EAC3B,kBAAkB,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,GAC7C,OAAO,CAAC,+BAA+B,CAAC,CAAC,CAAC,CAAC,CAY7C"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
2
2
|
const UUID_PREFIX_PATTERN = /^[0-9a-f]{8}$/i;
|
|
3
3
|
const UUID_FRAGMENT_PATTERN = /^[0-9a-f-]+$/i;
|
|
4
|
+
export function isSessionIdPrefix(target) {
|
|
5
|
+
return UUID_PREFIX_PATTERN.test(target);
|
|
6
|
+
}
|
|
4
7
|
/** Resolve exact custom/UUID IDs, or a unique 8-hex prefix of UUID-backed sessions. */
|
|
5
8
|
export function resolveSessionIdTarget(target, sessions) {
|
|
6
9
|
const exact = sessions.find((session) => session.id === target);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-id-target.js","sourceRoot":"","sources":["../src/session-id-target.ts"],"names":[],"mappings":"AAAA,MAAM,YAAY,GAAG,iEAAiE,CAAC;AACvF,MAAM,mBAAmB,GAAG,gBAAgB,CAAC;AAC7C,MAAM,qBAAqB,GAAG,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"session-id-target.js","sourceRoot":"","sources":["../src/session-id-target.ts"],"names":[],"mappings":"AAAA,MAAM,YAAY,GAAG,iEAAiE,CAAC;AACvF,MAAM,mBAAmB,GAAG,gBAAgB,CAAC;AAC7C,MAAM,qBAAqB,GAAG,eAAe,CAAC;AAE9C,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC/C,OAAO,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACzC,CAAC;AAiBD,uFAAuF;AACvF,MAAM,UAAU,sBAAsB,CACrC,MAAc,EACd,QAAsB;IAEtB,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC;IAChE,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAElE,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;IAC5D,IAAI,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;QACxC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;QAC/B,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE;YAC3C,MAAM,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;YACpC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CA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,EAAE,OAAO,EAAE,CAAC;IACrC,CAAC;IACD,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW;QAAE,OAAO,KAAK,CAAC;IAE7C,MAAM,MAAM,GAAG,sBAAsB,CAAC,MAAM,EAAE,MAAM,kBAAkB,EAAE,CAAC,CAAC;IAC1E,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,IAAI,MAAM,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;QAChE,OAAO,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;IACvC,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC","sourcesContent":["const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\nconst UUID_PREFIX_PATTERN = /^[0-9a-f]{8}$/i;\nconst UUID_FRAGMENT_PATTERN = /^[0-9a-f-]+$/i;\n\nexport function isSessionIdPrefix(target: string): boolean {\n\treturn UUID_PREFIX_PATTERN.test(target);\n}\n\nexport interface SessionIdCandidate {\n\treadonly id: string;\n}\n\nexport type SessionIdTargetResolution<T extends SessionIdCandidate> =\n\t| { readonly kind: \"exact\"; readonly session: T }\n\t| { readonly kind: \"unique_prefix\"; readonly session: T }\n\t| { readonly kind: \"ambiguous\"; readonly matches: readonly T[]; readonly message: string }\n\t| { readonly kind: \"malformed\"; readonly message: string }\n\t| { readonly kind: \"not_found\" };\n\nexport type ScopedSessionIdTargetResolution<T extends SessionIdCandidate> =\n\t| { readonly kind: \"exact\" | \"unique_prefix\"; readonly scope: \"local\" | \"global\"; readonly session: T }\n\t| Extract<SessionIdTargetResolution<T>, { kind: \"ambiguous\" | \"malformed\" | \"not_found\" }>;\n\n/** Resolve exact custom/UUID IDs, or a unique 8-hex prefix of UUID-backed sessions. */\nexport function resolveSessionIdTarget<T extends SessionIdCandidate>(\n\ttarget: string,\n\tsessions: readonly T[],\n): SessionIdTargetResolution<T> {\n\tconst exact = sessions.find((session) => session.id === target);\n\tif (exact !== undefined) return { kind: \"exact\", session: exact };\n\n\tif (UUID_PATTERN.test(target)) return { kind: \"not_found\" };\n\tif (UUID_PREFIX_PATTERN.test(target)) {\n\t\tconst normalized = target.toLowerCase();\n\t\tconst seen = new Set<string>();\n\t\tconst matches = sessions.filter((session) => {\n\t\t\tconst id = session.id.toLowerCase();\n\t\t\tif (!UUID_PATTERN.test(session.id) || !id.startsWith(normalized) || seen.has(id)) return false;\n\t\t\tseen.add(id);\n\t\t\treturn true;\n\t\t});\n\t\tif (matches.length === 0) return { kind: \"not_found\" };\n\t\tif (matches.length === 1) return { kind: \"unique_prefix\", session: matches[0]! };\n\t\treturn {\n\t\t\tkind: \"ambiguous\",\n\t\t\tmatches,\n\t\t\tmessage: `Session ID prefix \"${target}\" is ambiguous; matches: ${matches\n\t\t\t\t.map((session) => session.id)\n\t\t\t\t.join(\", \")}. Use the full UUID.`,\n\t\t};\n\t}\n\n\t// #2603: reject UUID-like truncations instead of selecting the first startsWith match.\n\tif (UUID_FRAGMENT_PATTERN.test(target)) {\n\t\treturn {\n\t\t\tkind: \"malformed\",\n\t\t\tmessage:\n\t\t\t\t`Session selector must be an exact custom session ID, a full 36-character UUID, ` +\n\t\t\t\t`or a unique 8-character hexadecimal UUID prefix; got \"${target}\" (${target.length} chars).`,\n\t\t};\n\t}\n\treturn { kind: \"not_found\" };\n}\n\n/** Resolve lazily across the existing project-local, then global search order. */\nexport async function resolveSessionIdTargetAcrossScopes<T extends SessionIdCandidate>(\n\ttarget: string,\n\tlocalSessions: readonly T[],\n\tloadGlobalSessions: () => Promise<readonly T[]>,\n): Promise<ScopedSessionIdTargetResolution<T>> {\n\tconst local = resolveSessionIdTarget(target, localSessions);\n\tif (local.kind === \"exact\" || local.kind === \"unique_prefix\") {\n\t\treturn { ...local, scope: \"local\" };\n\t}\n\tif (local.kind === \"ambiguous\") return local;\n\n\tconst global = resolveSessionIdTarget(target, await loadGlobalSessions());\n\tif (global.kind === \"exact\" || global.kind === \"unique_prefix\") {\n\t\treturn { ...global, scope: \"global\" };\n\t}\n\treturn global;\n}\n"]}
|
|
@@ -12,7 +12,7 @@ The effective parameters appear in extension events and successful results:
|
|
|
12
12
|
|
|
13
13
|
| Parameter | Default | Meaning |
|
|
14
14
|
|---|---:|---|
|
|
15
|
-
| `compression_ratio` | `0.5` | Fraction of compactable **lines to keep**, not a token ratio |
|
|
15
|
+
| `compression_ratio` | `0.5` | Fraction of compactable **lines to keep**, not a token ratio. Planner deletions beyond this target plus a small tolerance are ignored |
|
|
16
16
|
| `preserve_recent` | `2` | Exact number of newest context-visible messages protected client-side |
|
|
17
17
|
| `query` | Last visible user message | Relevance focus for deciding which older lines to retain |
|
|
18
18
|
|
|
@@ -291,12 +291,13 @@ Configure compaction in `~/.atomic/agent/settings.json` or `<project-dir>/.atomi
|
|
|
291
291
|
| `reserveTokens` | `16384` | Tokens to reserve for the next LLM response; threshold auto-compaction starts when completed-response usage or a prospective post-tool context exceeds the model's effective input budget minus this reserve. It is an **input-side** reserve only and never caps planner output. |
|
|
292
292
|
| `background` | `true` | Compact older context in the background once usage passes `backgroundThresholdPercent`, and apply the result at the next turn boundary. `false` restores blocking compaction at the `reserveTokens` threshold. Requires `enabled`. |
|
|
293
293
|
| `backgroundThresholdPercent` | `75` | Percentage of the context window at which background compaction starts. Must be above 0 and below 100; another value is a `BackgroundCompactionConfigError`. It only takes effect while it is below the `reserveTokens` threshold (context window minus `reserveTokens`); with the default reserve that means windows above 65,536 tokens, and smaller windows compact in the foreground only. |
|
|
294
|
+
| `historyRecall` | `true` | Add a `Recalled context` section of matching lines from this session's earlier history, other sessions and workflow runs to each planned compaction boundary, within 10% of the kept context and 1,500 tokens and a 3-second search; any failure, timeout, cancellation or lack of matches leaves the boundary unchanged. `false` turns it off. See [Recalled context](/compaction#recalled-context). |
|
|
294
295
|
|
|
295
296
|
An invalid `background` or `backgroundThresholdPercent` in a settings file is reported as a settings warning when settings load or reload; the session still starts. Until it is fixed, background compaction stays off: `session.compaction` and RPC `get_state` report `failed` with the `invalid-setting` error, and `session.backgroundCompactionEnabled` and `session.backgroundCompactionThresholdPercent` read `false` and `75`. Writing a valid value through `/settings` or the SDK setters clears the failure.
|
|
296
297
|
|
|
297
298
|
The top-level `compactionModel` setting defaults to `"auto"`, using the session model. An exact registered chat-model, classifier, or compactor ID selects a separate compactor. See [Compaction model](/compaction#compaction-model).
|
|
298
299
|
|
|
299
|
-
Fallback borrowing reuses `settings.fallbackModels`, the same ordered `provider/model[:thinkingLevel]` list used for chat fallback. It skips entries equal to the selected compaction model. A policy refusal from any chat compaction model, including `auto`, explicit chat-model IDs, and borrowed fallback entries, first tries pi's summary compaction on the same model. Classifier and Morph refusals skip summary fallback and advance directly to the next configured model. Other failures and failed summaries also advance to the next configured model. Only load-bearing recovery may clear older context after all attempts fail.
|
|
300
|
+
Fallback borrowing reuses `settings.fallbackModels`, the same ordered `provider/model[:thinkingLevel]` list used for chat fallback. It skips entries equal to the selected compaction model. A policy refusal from any chat compaction model, including `auto`, explicit chat-model IDs, and borrowed fallback entries, first tries pi's summary compaction on the same model, unless it arrived after the model had generated output tokens: that refusal is retried once and then planned in parts split at message boundaries (halves, then quarters), and the summary runs only if that fails. Classifier and Morph refusals skip summary fallback and advance directly to the next configured model. Other failures and failed summaries also advance to the next configured model. Only load-bearing recovery may clear older context after all attempts fail.
|
|
300
301
|
|
|
301
302
|
Disable auto-compaction with `"enabled": false`. You can still compact manually with `/compact`.
|
|
302
303
|
|
package/docs/compaction.md
CHANGED
|
@@ -7,7 +7,7 @@ description: "Verbatim line compaction, when it runs, planning rungs, and branch
|
|
|
7
7
|
|
|
8
8
|
LLMs have finite context windows. Atomic reduces older transcript context with **verbatim line compaction** while preserving a configured count of recent context-visible messages. Branch summarization is a separate, lossy feature used when navigating away from a branch.
|
|
9
9
|
|
|
10
|
-
Compaction normally uses the model selected by `compactionModel`. If it fails, Atomic borrows the next model from your configured `fallbackModels` for that request. A chat model's policy refusal first triggers pi's summary compaction on the same model, whether selected by `auto`, an explicit chat-model ID, or a `fallbackModels` entry. If that also fails, Atomic continues through the fallback models. Classifier and Morph failures go straight to the fallback models.
|
|
10
|
+
Compaction normally uses the model selected by `compactionModel`. If it fails, Atomic borrows the next model from your configured `fallbackModels` for that request. A chat model's policy refusal that arrives before it generated anything first triggers pi's summary compaction on the same model, whether selected by `auto`, an explicit chat-model ID, or a `fallbackModels` entry. A refusal that arrives partway through the model's output is retried once and then planned in parts, keeping the result verbatim, before any summary. If that also fails, Atomic continues through the fallback models. Classifier and Morph failures go straight to the fallback models.
|
|
11
11
|
|
|
12
12
|
**The selected compaction model and configured fallback models may receive the compaction transcript**, using their own credentials. Borrowing never changes the session's model or thinking level. Line planners select deletions, and Atomic reconstructs surviving lines without rewriting them. The policy-refusal summary fallback is lossy and appears as `summary (pi fallback)`.
|
|
13
13
|
|
|
@@ -22,7 +22,8 @@ This page covers the concepts and normal use of compaction and branch summarizat
|
|
|
22
22
|
| Verbatim compaction | `/compact`, RPC `compact`, or automatic threshold/overflow recovery | Per-message `id:start,end` deletion records | Retained transcript text reconstructed from the originals |
|
|
23
23
|
| Background compaction | Context passes `compaction.backgroundThresholdPercent` (75% by default) | The same verbatim compaction, run while the agent keeps working | The same boundary, committed at the next turn boundary |
|
|
24
24
|
| Planner fallback borrowing | A failed selected compaction model | Same deletion records, from a configured `fallbackModels` entry | Retained text with the borrowed model recorded |
|
|
25
|
-
|
|
|
25
|
+
| Split planning | A chat provider refuses a compaction request partway through its output, twice | The same deletion records, planned for each part of the transcript split at message boundaries | Retained text reconstructed from the originals |
|
|
26
|
+
| Policy-refusal summary fallback | A chat provider refuses compaction under its policy before generating anything, or split planning failed | Pi's summary compaction on the same model | A summary boundary labeled `summary (pi fallback)` |
|
|
26
27
|
| Fresh context window | Load-bearing compaction after every configured model failed | *(none — no model call)* | A `CompactionEntry` with `details.rung: "fresh"` |
|
|
27
28
|
| Branch summarization | Optional `/tree` navigation | Generated summary prose | A `BranchSummaryEntry` |
|
|
28
29
|
|
|
@@ -64,11 +65,27 @@ Each deleted span is replaced on its own line with exactly:
|
|
|
64
65
|
|
|
65
66
|
Counts remain cumulative across repeated compactions. The spelling is always plural, including `(filtered 1 lines)`.
|
|
66
67
|
|
|
68
|
+
Removed lines are not lost. They stay in the session's history, and the compacted context tells the agent so, naming this session's `history://sessions/<sessionId>` URL: the agent uses `search` on that URL to find removed text, including text removed by earlier compactions of the same session, and `read` with `:N-M` to open it. The same note points the agent at `search history://sessions` for the project's other sessions, `search history://workflows` for workflow runs and `search history://` for both. It tells the agent to use them before redoing an investigation, or when a removed decision, error message, file path or result matters, and that a search over several records covers the newest ones by default and pages on with `?offset=`. The planner is told that removed lines stay retrievable, so it removes bulky output that can be read again, such as tool results, file dumps and logs, before your requests, decisions, root causes and conclusions. See [Recalling earlier work](/sessions#recalling-earlier-work).
|
|
69
|
+
|
|
70
|
+
### Recalled context
|
|
71
|
+
|
|
72
|
+
Once the planner has chosen what to keep, Atomic looks through history for lines that bear on the current task and adds the best few to the compacted context, in a short `Recalled context` section after the kept lines. The search uses your latest request and the compaction `query`. It covers this session's own history, which includes lines earlier compactions removed, then the project's other sessions and workflow runs, with the same `history://` search the agent has. No model call is involved.
|
|
73
|
+
|
|
74
|
+
Each snippet is quoted with `> ` and starts with a source line such as `history://sessions/<id>:12-14`, which `read` opens in full. A line the compacted context already shows, including the kept recent messages, is never repeated, and each line appears once.
|
|
75
|
+
|
|
76
|
+
The section stays small: at most 10% of the kept context, never more than 1,500 tokens, and the whole search has 3 seconds. If the search fails, runs out of time, finds nothing relevant, or the compaction is cancelled, the compacted context stays as the planner left it and compaction carries on. A boundary written by a `session_before_compact` extension, a fresh context window or the policy-refusal summary fallback gets no recalled context. A recalled line is data, not structure: quoting means it can never act as a `<keepContext>` span, a role header or a `(filtered N lines)` marker when the boundary is compacted again.
|
|
77
|
+
|
|
78
|
+
Recall is on by default. Set `compaction.historyRecall` to `false` in settings to leave the compacted context exactly as the planner kept it.
|
|
79
|
+
|
|
80
|
+
### Keep target
|
|
81
|
+
|
|
82
|
+
The planner lists its deletions in priority order, lowest continuation value first. Atomic applies them in that order and stops once the lines deleted reach the keep target (`compression_ratio`) plus a small tolerance of 5% of the compactable lines, trimming the deletion that crosses the limit. Deletions the planner lists after that point are ignored, so a plan that deletes far more than the ratio asks for no longer shrinks the transcript below it. A plan that deletes less than the target is applied as written. Protected lines are never deleted and do not count against the limit.
|
|
83
|
+
|
|
67
84
|
### Protected structure
|
|
68
85
|
|
|
69
86
|
Role-header lines such as `[User]:` and `[Assistant]:` are ordinary ranked lines and may be deleted. Explicit protected spans, including blank lines, are never deleted. The configured number of newest context-visible messages remains outside the classifier request entirely; all preceding active transcript content is included.
|
|
70
87
|
|
|
71
|
-
Images in the compactable region become the literal line `[image]`; images in the protected recent tail remain normal image content. Tool-result text
|
|
88
|
+
Images in the compactable region become the literal line `[image]`; images in the protected recent tail remain normal image content. Tool-result text is capped at 2,000 characters before the planner sees it and before it becomes durable compaction text. The truncation marker gives the exact location of the full output, for example `[... 41230 more characters truncated; full output: read history://sessions/<sessionId>:1234-1890]`, and `read` on that path returns the whole output. When the location cannot be determined, such as in a session that is not saved, the marker only says the full output is in this session's history, which the agent can search as described above.
|
|
72
89
|
|
|
73
90
|
The recent tail is appended to the boundary in the same grammar, without thinking. Its tool results keep their full text.
|
|
74
91
|
|
|
@@ -118,7 +135,12 @@ The compaction card shows the backend and model that produced the result, such a
|
|
|
118
135
|
|
|
119
136
|
### Troubleshooting policy refusals
|
|
120
137
|
|
|
121
|
-
If you see "This request was blocked as it seems to violate Anthropic's Terms of Service", or a refusal about reverse engineering or duplicating model outputs, the provider refused that compaction request. Atomic does not retry policy refusals as transient errors
|
|
138
|
+
If you see "This request was blocked as it seems to violate Anthropic's Terms of Service", or a refusal about reverse engineering or duplicating model outputs, the provider refused that compaction request. Atomic does not retry policy refusals as transient errors, and it handles two kinds differently.
|
|
139
|
+
|
|
140
|
+
- **Refused before the model generated anything.** The provider rejected the request at once. For any chat compaction model, including `auto`, Atomic tries pi's summary compaction on the same model. That summary retries recoverable rate-limit, server, overload, and transport errors according to `settings.retry`, just like the planner. If the summary also fails or is refused, Atomic continues through `fallbackModels`.
|
|
141
|
+
- **Refused partway through the model's output.** The refusal came after the model had billed output or reasoning tokens, which on a very large transcript can take minutes. Atomic retries the planner once. If the retry fails for another reason, Atomic goes to the summary as it does for an immediate refusal. If the retry is refused again, Atomic splits the compactable transcript at message boundaries and plans each half, then each quarter of a half that is refused, and merges the deletions into one verbatim result. A quarter that is still refused ends this step. Only then does Atomic fall back to the same-model summary and the `fallbackModels` as above.
|
|
142
|
+
|
|
143
|
+
Splitting costs extra planner requests, at most eight per planner model, each billed by your provider. Automatic compaction shares the [planning time limit](#planning-time-limit) across all of them, so a run that is still refusing after five minutes ends as timed out; raise `compaction.planningTimeoutMs` or run `/compact`, which has no limit, to give it longer.
|
|
122
144
|
|
|
123
145
|
Classifier and Morph refusals skip the summary fallback and go directly to the next configured model. Anthropic remains a supported compactor. To keep verbatim compaction when a model refuses deletion planning, choose another `compactionModel`, such as a chat model, classifier, or Morph. Adding a `fallbackModels` entry gives Atomic another verbatim planner if the same-model summary fails.
|
|
124
146
|
|
|
@@ -190,7 +212,7 @@ When every configured model is exhausted, what happens depends on how much the c
|
|
|
190
212
|
|
|
191
213
|
Recoverable failure writes no boundary, schedules no continuation, and reports the cause through `compaction_end`. Manual calls cannot request destructive recovery. Overflow recovery and post-tool preflight can fall back to the fresh context window below.
|
|
192
214
|
|
|
193
|
-
A successful compaction may delete less than requested. The retry can still report a context overflow.
|
|
215
|
+
A successful compaction may delete less than requested, because the planner can list fewer deletions than the keep target allows, but it does not delete more than the keep target plus a small tolerance. The retry can still report a context overflow.
|
|
194
216
|
|
|
195
217
|
### Planning time limit
|
|
196
218
|
|
|
@@ -208,15 +230,21 @@ Clearing context does not fix provider rate limits or guarantee the next turn su
|
|
|
208
230
|
|
|
209
231
|
Atomic may recover usable deletion records when the provider truncates a planner response. Successful recovery appears as ordinary `✻ Context compacted`; unusable output advances to the next configured model.
|
|
210
232
|
|
|
233
|
+
### Planner output with stray lines
|
|
234
|
+
|
|
235
|
+
A planner answer is a list of `id:start,end` records. Atomic skips lines around the records that are not records, such as a sentence of prose, a header, blank lines or a Markdown fence, and trims whitespace around each record. The remaining records keep the order the planner listed them.
|
|
236
|
+
|
|
237
|
+
An answer is treated as malformed output, and the next configured model is tried, when it contains no valid record or when more than half of its non-blank lines are not records. A derailed or conversational answer is therefore not mistaken for a sparse plan. A recovered answer that tolerated stray lines records how many were skipped as `skippedLineCount` in its recovery diagnostic.
|
|
238
|
+
|
|
211
239
|
### Planner failure diagnostics
|
|
212
240
|
|
|
213
|
-
For a persisted session, each failed planner attempt writes its own JSON sidecar
|
|
241
|
+
For a persisted session, each failed planner attempt writes its own JSON sidecar and carries the path on the typed outcome. A session kept in a JSONL file gets the sidecar beside the session file. A session kept in SQLite or another store has no session file, so its sidecars go to `compaction-diagnostics/` in the agent directory (`~/.atomic/agent/compaction-diagnostics/`, or under `ATOMIC_CODING_AGENT_DIR` when that is set) and are named `<session id>-compaction-diagnostic-<time>-<id>.json`. When a recoverable compaction exhausts every configured model, the resulting `RangePlanError` includes that path, for example:
|
|
214
242
|
|
|
215
243
|
```text
|
|
216
244
|
Compaction range planning returned malformed output (diagnostic: /path/session-compaction-diagnostic-1785222000000-019fa7….json)
|
|
217
245
|
```
|
|
218
246
|
|
|
219
|
-
Treat diagnostic sidecars like session files: a raw model response may echo sensitive input. They use `0600` permissions where supported and omit API keys, request headers, and the planner request. In-memory sessions do not create them.
|
|
247
|
+
Treat diagnostic sidecars like session files: a raw model response may echo sensitive input. They use `0600` permissions where supported and omit API keys, request headers, and the planner request. The `rawResponse` field holds the model's answer with credential-shaped text replaced by `[redacted]`, cut to 65,536 characters; when it was cut, `rawResponseChars` gives its full length. Writing a sidecar is best effort: if the directory cannot be written, compaction reports its own failure without a path, and turning on debug mode records the unwritable path in the debug log. Atomic does not delete sidecars, so remove old files from the directory when you no longer need them. In-memory sessions do not create them.
|
|
220
248
|
|
|
221
249
|
Interactive main chat and attached workflow stage chat treat `compaction_end` as the authority for cancellation and failure UI. A failed or cancelled `/compact` stops its spinner, shows the event-provided status or diagnostic path without a duplicate stack trace, writes no boundary, and leaves the session usable for another `/compact` attempt or a normal follow-up turn.
|
|
222
250
|
|
package/docs/development.md
CHANGED
|
@@ -20,7 +20,7 @@ In debug mode, every area below appends one JSON line per event to `~/.atomic/ag
|
|
|
20
20
|
|
|
21
21
|
| Area | Own variable | What it shows | Own variable writes to |
|
|
22
22
|
|------|--------------|---------------|------------------------|
|
|
23
|
-
| `workflow` | `ATOMIC_WORKFLOW_DEBUG=1` | Failed background workflow discovery, failed workflow lifecycle, HiL-answer and heartbeat notices,
|
|
23
|
+
| `workflow` | `ATOMIC_WORKFLOW_DEBUG=1` | Failed background workflow discovery, failed workflow lifecycle, HiL-answer and heartbeat notices, heartbeat intervals too large to schedule, and, in debug mode only (`ATOMIC_WORKFLOW_DEBUG=1` alone does not write them), a detached tool call dropped because its conversation moved past it (`stale-detached-call`) and a stage prompt or retry not sent because its session waits on a detached call's result (`stage-input-held-for-detached-results`) | stderr |
|
|
24
24
|
| `model-routing` | `ATOMIC_MODEL_ROUTING_DEBUG=1` | `model: "auto"` routing decisions and fallbacks, including a workflow stage that falls back to the current chat model | stderr, or a workflow warning for a stage |
|
|
25
25
|
| `pooled-watch` | `ATOMIC_DEBUG_POOLED_WATCH=1`, or a file path | Each step of watching a pooled stage: watches opening and ending, reconnects, rebinds, delivered messages and their outcomes, admissions and refusals | `pooled-watch-trace.jsonl` next to the pool journal, or the named file |
|
|
26
26
|
| `pool` | None | Worker pool coordination counters: requests and journal writes per second, by kind. Debug mode also shows them as the `pool:` line in workflow status | — |
|
package/docs/sdk/reference.md
CHANGED
|
@@ -459,8 +459,9 @@ Without a detachment policy a detachable call runs inline like any other. A host
|
|
|
459
459
|
|
|
460
460
|
- A call that finishes within `afterMs` runs inline.
|
|
461
461
|
- A call still running after `afterMs` detaches: the turn's other results are saved, the call has no result yet, and `prompt()` resolves. The call's work goes on outside the session, so the host can dispose of the session meanwhile.
|
|
462
|
-
- `session.takeDetachedToolCalls()` returns each detached call once
|
|
463
|
-
- `session.resumeDetachedTurn(results)` on a session reopened from the store records each result as its call's result, right after the call, and continues the same turn, without a new user message, once every detachable call of the turn has its result. Results may be handed back together or across several calls: until the last one arrives, the call records what it gets and resolves without continuing, and `hasPendingDetachedTurn()` stays `true`. A result for a call that already has one,
|
|
462
|
+
- `session.takeDetachedToolCalls()` returns each detached call once, except a call whose turn the transcript has moved past: nothing waits for its result, so the session cancels its work (through its abort signal) and drops it, and records it in the debug log as `stale-detached-call`. Every `DetachedToolCall` has `toolCallId`, `toolName`, a `result` promise that never rejects (a thrown error becomes an `isError` result), and `abort(reason)`. When the thrown error has a string `code`, the result's `details.error` carries it as data, so a host can branch on `code` instead of the text: the error's own `toJSON()` form when it has one, otherwise its `name`, `code`, `message`, and its `hint`, `retryable`, JSON-safe `fields` and cause chain when it has them. If its `toJSON()` throws, `details.error` is built from its properties and carries `serialization: "fallback"`.
|
|
463
|
+
- `session.resumeDetachedTurn(results)` on a session reopened from the store records each result as its call's result, right after the call, and continues the same turn, without a new user message, once every detachable call of the turn has its result. Results may be handed back together or across several calls: until the last one arrives, the call records what it gets and resolves without continuing, and `hasPendingDetachedTurn()` stays `true`. A result for a call that already has one, repeated in `results`, or issued by a turn the transcript has moved past is ignored, the last one with a `stale-detached-call` record in the debug log; a result for a call that no message of the transcript issued throws `unknown-tool-call`. With no new result, a transcript that ends on a detachable call's turn whose every call already has its result continues that turn (the process that recorded the results stopped before the model answered), and a turn still waiting on a call is left as it is.
|
|
464
|
+
- `session.isWaitingOnDetachedResults()` tells whether the transcript still waits on the result of a detachable call, with or without other calls of its turn answered. While it does, and a detachment policy is set, nothing starts a turn on the idle session: custom messages that would start one (such as a finished subagent's notification), interrupting messages, follow-ups and steering, and a continuation after a compaction wait, and the turn that `resumeDetachedTurn()` continues takes them up after the results. A custom message held this way gets a durable card, so it survives the session being released or disposed before the results arrive: the session reopened from the store delivers it after the result (`startPendingRecovery()` replays it). `prompt()` stays the host's call: do not prompt a session that waits on a result.
|
|
464
465
|
- `session.hasPendingDetachedTurn()` tells whether a reopened transcript ends on such a turn, with or without some or all of its results. When it does, continue the turn with `redispatchDetachedToolCalls()` and `resumeDetachedTurn()` instead of prompting again.
|
|
465
466
|
- `session.redispatchDetachedToolCalls()` starts again the detachable calls that a reopened transcript ends on without a result, with their original ids and arguments. Calls that already have a result are not started again. Session listeners receive a `tool_execution_start` event for each call before the method returns, and extensions receive it in order with the session's other events.
|
|
466
467
|
|
|
@@ -475,15 +476,15 @@ A call started again by `redispatchDetachedToolCalls()` reports no progress from
|
|
|
475
476
|
|
|
476
477
|
`ask_user_question` is detachable only in a workflow stage's own session, where the question waits in the stage's UI rather than the session's: the stage releases its session while the model waits on the user's answer. In other sessions it always runs inline, because its question ends with the session that asked it. A shell `wait` whose task is gone after a restart returns an error result whose `details.error` is the serialized `TaskToolError` (see [Owner-bound task supervisor](#owner-bound-task-supervisor-s1)).
|
|
477
478
|
|
|
478
|
-
While a transcript waits on a detached call's result, a background task's completion notice is saved but not added to the conversation, so nothing comes between the call and its result. It is delivered once `resumeDetachedTurn()` has continued the turn.
|
|
479
|
+
While a transcript waits on a detached call's result, a background task's completion notice is saved but not added to the conversation, so nothing comes between the call and its result. It is delivered once `resumeDetachedTurn()` has continued the turn. A compaction of such a transcript covers only what precedes the call's turn, even when notifications or other messages were added after it, so the call stays a tool call that its result can answer.
|
|
479
480
|
|
|
480
481
|
`ToolDetachmentError` reports a refused detachment operation; nothing changed when it is thrown. Check it with `isToolDetachmentError(error)`, or find it in a cause chain with `findToolDetachmentError(error)`, and branch on `code`:
|
|
481
482
|
|
|
482
483
|
| Class | `code` | When | Fields | What to do |
|
|
483
484
|
|---|---|---|---|---|
|
|
484
485
|
| `ToolDetachmentError` | `invalid-policy` | `setToolDetachment()` got an `afterMs` that is not a finite number from 0 to `MAX_TOOL_DETACHMENT_AFTER_MS` | `sessionId`, `field`, `value` | Pass an `afterMs` in that range, or `undefined`. To keep calls inline, set no policy |
|
|
485
|
-
| `ToolDetachmentError` | `unknown-tool-call` | `resumeDetachedTurn()` got a new result for a call
|
|
486
|
-
| `ToolDetachmentError` | `session-busy` | `resumeDetachedTurn()` was called while the session was still running, or still recording the results an earlier call handed back (`retryable: true`) | `sessionId` | Wait for that call or run to settle, then call it again |
|
|
486
|
+
| `ToolDetachmentError` | `unknown-tool-call` | `resumeDetachedTurn()` got a new result for a call that no message of the transcript issued | `sessionId`, `toolCallId` | Hand back only results of the calls `takeDetachedToolCalls()` or `redispatchDetachedToolCalls()` returned for this session's transcript |
|
|
487
|
+
| `ToolDetachmentError` | `session-busy` | `resumeDetachedTurn()` was called while the session was still running, or still recording the results an earlier call handed back (`retryable: true`). A workflow stage waits for the run to settle and hands the results back again | `sessionId` | Wait for that call or run to settle, then call it again |
|
|
487
488
|
| `ToolDetachmentError` | `session-closed` | `resumeDetachedTurn()` was called on a session that is disposed or closing. Nothing is recorded | `sessionId` | Reopen the session from its store and hand the results to the new session |
|
|
488
489
|
| `ToolDetachmentError` | `context-detached` | A detached call's work used its `ctx` for anything but `cwd` | `sessionId`, `toolCallId` | Read what the work needs from `ctx` before the call detaches, or pass it in the tool's arguments |
|
|
489
490
|
| `ToolDetachmentError` | `stage-parked` | A workflow stage released while it waits on tool results was asked to start a task, an agent task or a shell command (`retryable: true`) | `sessionId` (the stage's session) | Wait for the stage to reopen its session, then start the task again |
|