@bastani/atomic 0.9.89 → 0.9.90-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 +113 -0
- package/dist/builtin/intercom/CHANGELOG.md +13 -0
- package/dist/builtin/intercom/README.md +3 -1
- package/dist/builtin/intercom/broker/broker.ts +35 -10
- package/dist/builtin/intercom/broker/client.ts +42 -1
- package/dist/builtin/intercom/index.bundle.mjs +400 -67
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/intercom/skills/intercom/SKILL.md +24 -5
- package/dist/builtin/intercom/types.ts +5 -0
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +27 -0
- package/dist/builtin/subagents/README.md +18 -20
- package/dist/builtin/subagents/agents/worker.md +1 -1
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/skills/feedback/SKILL.md +2 -2
- package/dist/builtin/subagents/skills/qlty/SKILL.md +2 -2
- package/dist/builtin/subagents/skills/qlty/references/commands.md +45 -12
- package/dist/builtin/subagents/skills/qlty/references/quickstart.md +102 -21
- package/dist/builtin/subagents/skills/subagent/SKILL.md +18 -17
- package/dist/builtin/subagents/skills/tdd/LICENSE.txt +50 -0
- package/dist/builtin/subagents/skills/tdd/SKILL.md +10 -0
- package/dist/builtin/subagents/skills/tdd/tests.md +16 -0
- package/dist/builtin/subagents/skills/tmux/LICENSE.txt +24 -0
- package/dist/builtin/subagents/skills/tmux/SKILL.md +20 -1
- package/dist/builtin/subagents/skills/tmux/scripts/find-sessions.sh +19 -10
- package/dist/builtin/subagents/skills/tmux/scripts/wait-for-text.sh +231 -19
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +1911 -845
- package/dist/builtin/web-access/CHANGELOG.md +6 -0
- package/dist/builtin/web-access/index.bundle.mjs +158 -34
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +36 -0
- package/dist/builtin/workflows/builtin/{chunk-tjk7jp9a.js → chunk-akmcsx14.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-913nwrzq.js → chunk-erpybg3c.js} +109 -30
- package/dist/builtin/workflows/builtin/{chunk-e07n7en6.js → chunk-wpgpr31s.js} +1 -1
- package/dist/builtin/workflows/builtin/goal.js +2 -2
- package/dist/builtin/workflows/builtin/index.js +3 -3
- package/dist/builtin/workflows/builtin/ralph.js +2 -2
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/skills/bro/SKILL.md +1 -1
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_fable_5_2.md +19 -19
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_haiku_5_5.md +2 -2
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_opus_5_5.md +3 -3
- package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_6.md +2 -2
- package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_6_1_sol.md +2 -2
- package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_6_1_terra.md +3 -3
- package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_6_2.md +3 -2
- package/dist/builtin/workflows/skills/show-me/SKILL.md +2 -2
- package/dist/builtin/workflows/skills/skill-creator/scripts/run_eval.py +29 -24
- package/dist/builtin/workflows/skills/teach/SKILL.md +8 -8
- package/dist/builtin/workflows/skills/unslop/SKILL.md +29 -51
- package/dist/builtin/workflows/src/durable/journal/internal.d.ts +10 -5
- package/dist/builtin/workflows/src/durable/journal/sharded-run-journal.d.ts +6 -3
- package/dist/builtin/workflows/src/durable/journal/sql-run-journal.d.ts +25 -3
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +4444 -1356
- package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +2544 -568
- package/dist/builtin/workflows/src/index.js +2467 -549
- package/dist/builtin/workflows/src/local-worker-entry.mjs +2544 -568
- package/dist/cli/storage-command.d.ts +6 -0
- package/dist/cli/storage-command.d.ts.map +1 -1
- package/dist/cli/storage-command.js +11 -0
- package/dist/cli/storage-command.js.map +1 -1
- package/dist/cli/storage-search-database.d.ts +18 -0
- package/dist/cli/storage-search-database.d.ts.map +1 -0
- package/dist/cli/storage-search-database.js +90 -0
- package/dist/cli/storage-search-database.js.map +1 -0
- package/dist/cli/storage-search-session.d.ts +5 -0
- package/dist/cli/storage-search-session.d.ts.map +1 -0
- package/dist/cli/storage-search-session.js +133 -0
- package/dist/cli/storage-search-session.js.map +1 -0
- package/dist/core/agent-session-accessors.d.ts.map +1 -1
- package/dist/core/agent-session-accessors.js +107 -1
- package/dist/core/agent-session-accessors.js.map +1 -1
- package/dist/core/agent-session-bash.d.ts.map +1 -1
- package/dist/core/agent-session-bash.js +2 -0
- package/dist/core/agent-session-bash.js.map +1 -1
- package/dist/core/agent-session-boundaries.d.ts +2 -0
- package/dist/core/agent-session-boundaries.d.ts.map +1 -1
- package/dist/core/agent-session-boundaries.js +9 -4
- package/dist/core/agent-session-boundaries.js.map +1 -1
- package/dist/core/agent-session-custom-message-commit.d.ts.map +1 -1
- package/dist/core/agent-session-custom-message-commit.js +2 -1
- package/dist/core/agent-session-custom-message-commit.js.map +1 -1
- package/dist/core/agent-session-detached-tools.d.ts +3 -2
- package/dist/core/agent-session-detached-tools.d.ts.map +1 -1
- package/dist/core/agent-session-detached-tools.js +156 -41
- package/dist/core/agent-session-detached-tools.js.map +1 -1
- package/dist/core/agent-session-events.d.ts +2 -1
- package/dist/core/agent-session-events.d.ts.map +1 -1
- package/dist/core/agent-session-events.js +59 -23
- package/dist/core/agent-session-events.js.map +1 -1
- package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
- package/dist/core/agent-session-extension-bindings.js +53 -4
- package/dist/core/agent-session-extension-bindings.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 +23 -3
- 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-models.d.ts.map +1 -1
- package/dist/core/agent-session-models.js +2 -0
- package/dist/core/agent-session-models.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts +1 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +14 -3
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-queue-pause.d.ts +2 -1
- package/dist/core/agent-session-queue-pause.d.ts.map +1 -1
- package/dist/core/agent-session-queue-pause.js +8 -4
- package/dist/core/agent-session-queue-pause.js.map +1 -1
- package/dist/core/agent-session-retry.d.ts +7 -3
- package/dist/core/agent-session-retry.d.ts.map +1 -1
- package/dist/core/agent-session-retry.js +113 -112
- package/dist/core/agent-session-retry.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +15 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +26 -0
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +5 -2
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +6 -6
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session-tasks.js.map +1 -1
- package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
- package/dist/core/agent-session-tool-registry.js +4 -2
- package/dist/core/agent-session-tool-registry.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +19 -1
- package/dist/core/agent-session-types.d.ts.map +1 -1
- package/dist/core/agent-session-types.js.map +1 -1
- package/dist/core/agent-session.d.ts +11 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +8 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/anthropic-thinking-guard.d.ts +16 -1
- package/dist/core/anthropic-thinking-guard.d.ts.map +1 -1
- package/dist/core/anthropic-thinking-guard.js +124 -7
- package/dist/core/anthropic-thinking-guard.js.map +1 -1
- package/dist/core/auth-storage.d.ts +3 -0
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +10 -0
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/detached-tool-output.d.ts +4 -0
- package/dist/core/detached-tool-output.d.ts.map +1 -0
- package/dist/core/detached-tool-output.js +48 -0
- package/dist/core/detached-tool-output.js.map +1 -0
- package/dist/core/event-loop-monitor.d.ts +4 -1
- package/dist/core/event-loop-monitor.d.ts.map +1 -1
- package/dist/core/event-loop-monitor.js +84 -159
- package/dist/core/event-loop-monitor.js.map +1 -1
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js +26 -4
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/export-html/saved-agent-cards.d.ts +15 -0
- package/dist/core/export-html/saved-agent-cards.d.ts.map +1 -0
- package/dist/core/export-html/saved-agent-cards.js +255 -0
- package/dist/core/export-html/saved-agent-cards.js.map +1 -0
- package/dist/core/export-html/saved-agent-viewer.js +101 -0
- package/dist/core/extensions/builtin-subagent-record-writer.d.ts +11 -0
- package/dist/core/extensions/builtin-subagent-record-writer.d.ts.map +1 -0
- package/dist/core/extensions/builtin-subagent-record-writer.js +33 -0
- package/dist/core/extensions/builtin-subagent-record-writer.js.map +1 -0
- package/dist/core/extensions/loader-api.d.ts +1 -1
- package/dist/core/extensions/loader-api.d.ts.map +1 -1
- package/dist/core/extensions/loader-api.js +9 -2
- package/dist/core/extensions/loader-api.js.map +1 -1
- package/dist/core/extensions/loader-bindings.d.ts +7 -0
- package/dist/core/extensions/loader-bindings.d.ts.map +1 -1
- package/dist/core/extensions/loader-bindings.js +42 -1
- package/dist/core/extensions/loader-bindings.js.map +1 -1
- package/dist/core/extensions/loader-core.d.ts.map +1 -1
- package/dist/core/extensions/loader-core.js +33 -12
- package/dist/core/extensions/loader-core.js.map +1 -1
- package/dist/core/extensions/runner-events.d.ts +2 -0
- package/dist/core/extensions/runner-events.d.ts.map +1 -1
- package/dist/core/extensions/runner-events.js +17 -7
- package/dist/core/extensions/runner-events.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +6 -2
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +5 -2
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/ui-types.d.ts +4 -0
- package/dist/core/extensions/ui-types.d.ts.map +1 -1
- package/dist/core/extensions/ui-types.js.map +1 -1
- package/dist/core/extensions/workflow-run-control-hub.d.ts +2 -2
- package/dist/core/extensions/workflow-run-control-hub.d.ts.map +1 -1
- package/dist/core/extensions/workflow-run-control-hub.js +2 -2
- package/dist/core/extensions/workflow-run-control-hub.js.map +1 -1
- package/dist/core/extensions/workflow-run-control.d.ts +10 -3
- package/dist/core/extensions/workflow-run-control.d.ts.map +1 -1
- package/dist/core/extensions/workflow-run-control.js.map +1 -1
- package/dist/core/first-prompt-model.d.ts +22 -0
- package/dist/core/first-prompt-model.d.ts.map +1 -0
- package/dist/core/first-prompt-model.js +84 -0
- package/dist/core/first-prompt-model.js.map +1 -0
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +11 -7
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/fork-replay-pair.d.ts +22 -0
- package/dist/core/fork-replay-pair.d.ts.map +1 -0
- package/dist/core/fork-replay-pair.js +174 -0
- package/dist/core/fork-replay-pair.js.map +1 -0
- package/dist/core/fork-replay-wire.d.ts +11 -0
- package/dist/core/fork-replay-wire.d.ts.map +1 -0
- package/dist/core/fork-replay-wire.js +116 -0
- package/dist/core/fork-replay-wire.js.map +1 -0
- package/dist/core/messages.d.ts +2 -0
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +8 -4
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-runtime.d.ts +10 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +76 -11
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/package-manager-auto-resources.d.ts.map +1 -1
- package/dist/core/package-manager-auto-resources.js +3 -2
- package/dist/core/package-manager-auto-resources.js.map +1 -1
- package/dist/core/package-manager-resource-files.js +7 -8
- package/dist/core/package-manager-resource-files.js.map +1 -1
- package/dist/core/project-trust-state.d.ts +90 -0
- package/dist/core/project-trust-state.d.ts.map +1 -0
- package/dist/core/project-trust-state.js +65 -0
- package/dist/core/project-trust-state.js.map +1 -0
- package/dist/core/provider-rate-limits.d.ts +6 -0
- package/dist/core/provider-rate-limits.d.ts.map +1 -1
- package/dist/core/provider-rate-limits.js +43 -0
- package/dist/core/provider-rate-limits.js.map +1 -1
- package/dist/core/provider-request-admission.d.ts.map +1 -1
- package/dist/core/provider-request-admission.js +10 -1
- package/dist/core/provider-request-admission.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts +6 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +22 -1
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js +5 -2
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/resource-loader-core.d.ts.map +1 -1
- package/dist/core/resource-loader-core.js +3 -0
- package/dist/core/resource-loader-core.js.map +1 -1
- package/dist/core/resource-loader-extensions.d.ts +2 -2
- package/dist/core/resource-loader-extensions.d.ts.map +1 -1
- package/dist/core/resource-loader-extensions.js +6 -4
- package/dist/core/resource-loader-extensions.js.map +1 -1
- package/dist/core/resource-loader-package-resources.d.ts +1 -0
- package/dist/core/resource-loader-package-resources.d.ts.map +1 -1
- package/dist/core/resource-loader-package-resources.js +2 -1
- package/dist/core/resource-loader-package-resources.js.map +1 -1
- package/dist/core/resource-loader-reload.d.ts +1 -1
- package/dist/core/resource-loader-reload.d.ts.map +1 -1
- package/dist/core/resource-loader-reload.js +3 -2
- package/dist/core/resource-loader-reload.js.map +1 -1
- package/dist/core/resource-loader-types.d.ts +2 -0
- package/dist/core/resource-loader-types.d.ts.map +1 -1
- package/dist/core/resource-loader-types.js.map +1 -1
- package/dist/core/resume/blueprint/actions.d.ts.map +1 -1
- package/dist/core/resume/blueprint/actions.js +15 -15
- package/dist/core/resume/blueprint/actions.js.map +1 -1
- package/dist/core/resume/blueprint/process.d.ts +6 -1
- package/dist/core/resume/blueprint/process.d.ts.map +1 -1
- package/dist/core/resume/blueprint/process.js +132 -21
- package/dist/core/resume/blueprint/process.js.map +1 -1
- package/dist/core/runtime-credentials.d.ts +5 -0
- package/dist/core/runtime-credentials.d.ts.map +1 -1
- package/dist/core/runtime-credentials.js +34 -0
- package/dist/core/runtime-credentials.js.map +1 -1
- package/dist/core/sdk-types.d.ts +2 -0
- package/dist/core/sdk-types.d.ts.map +1 -1
- package/dist/core/sdk-types.js.map +1 -1
- package/dist/core/sdk.d.ts +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +187 -32
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-account-model.d.ts +15 -0
- package/dist/core/session-account-model.d.ts.map +1 -0
- package/dist/core/session-account-model.js +105 -0
- package/dist/core/session-account-model.js.map +1 -0
- package/dist/core/session-lifecycle-scope.d.ts +5 -0
- package/dist/core/session-lifecycle-scope.d.ts.map +1 -1
- package/dist/core/session-lifecycle-scope.js.map +1 -1
- package/dist/core/session-manager-core.d.ts +21 -2
- package/dist/core/session-manager-core.d.ts.map +1 -1
- package/dist/core/session-manager-core.js +64 -8
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-manager-history.d.ts +3 -1
- package/dist/core/session-manager-history.d.ts.map +1 -1
- package/dist/core/session-manager-history.js +19 -5
- package/dist/core/session-manager-history.js.map +1 -1
- package/dist/core/session-manager-types.d.ts +2 -0
- package/dist/core/session-manager-types.d.ts.map +1 -1
- package/dist/core/session-manager-types.js.map +1 -1
- package/dist/core/session-retry-status.d.ts +22 -0
- package/dist/core/session-retry-status.d.ts.map +1 -0
- package/dist/core/session-retry-status.js +25 -0
- package/dist/core/session-retry-status.js.map +1 -0
- package/dist/core/session-worktree-snapshots.d.ts +4 -2
- package/dist/core/session-worktree-snapshots.d.ts.map +1 -1
- package/dist/core/session-worktree-snapshots.js +8 -4
- package/dist/core/session-worktree-snapshots.js.map +1 -1
- package/dist/core/settings-manager-core.d.ts +4 -0
- package/dist/core/settings-manager-core.d.ts.map +1 -1
- package/dist/core/settings-manager-core.js +73 -1
- package/dist/core/settings-manager-core.js.map +1 -1
- package/dist/core/settings-schema.js +1 -1
- package/dist/core/settings-schema.js.map +1 -1
- package/dist/core/slash-commands.d.ts +2 -2
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +15 -4
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/storage/database.d.ts +14 -2
- package/dist/core/storage/database.d.ts.map +1 -1
- package/dist/core/storage/database.js.map +1 -1
- package/dist/core/storage/dialect.d.ts +13 -0
- package/dist/core/storage/dialect.d.ts.map +1 -1
- package/dist/core/storage/dialect.js +9 -1
- package/dist/core/storage/dialect.js.map +1 -1
- package/dist/core/storage/errors.d.ts +23 -1
- package/dist/core/storage/errors.d.ts.map +1 -1
- package/dist/core/storage/errors.js +28 -5
- package/dist/core/storage/errors.js.map +1 -1
- package/dist/core/storage/journal-transfer.d.ts.map +1 -1
- package/dist/core/storage/journal-transfer.js +90 -5
- package/dist/core/storage/journal-transfer.js.map +1 -1
- package/dist/core/storage/node-sqlite.d.ts.map +1 -1
- package/dist/core/storage/node-sqlite.js +61 -1
- package/dist/core/storage/node-sqlite.js.map +1 -1
- package/dist/core/storage/session/chunked-resume-projection.d.ts +4 -0
- package/dist/core/storage/session/chunked-resume-projection.d.ts.map +1 -0
- package/dist/core/storage/session/chunked-resume-projection.js +369 -0
- package/dist/core/storage/session/chunked-resume-projection.js.map +1 -0
- package/dist/core/storage/session/legacy-session-store.d.ts +5 -0
- package/dist/core/storage/session/legacy-session-store.d.ts.map +1 -1
- package/dist/core/storage/session/legacy-session-store.js +10 -2
- 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 +6 -1
- package/dist/core/storage/session/memory-session-store.js.map +1 -1
- package/dist/core/storage/session/snapshot-generation.d.ts +8 -0
- package/dist/core/storage/session/snapshot-generation.d.ts.map +1 -0
- package/dist/core/storage/session/snapshot-generation.js +17 -0
- package/dist/core/storage/session/snapshot-generation.js.map +1 -0
- package/dist/core/storage/session/sql-session-store.d.ts +12 -0
- package/dist/core/storage/session/sql-session-store.d.ts.map +1 -1
- package/dist/core/storage/session/sql-session-store.js +243 -46
- package/dist/core/storage/session/sql-session-store.js.map +1 -1
- package/dist/core/storage/sqlite-facade.d.ts +17 -2
- package/dist/core/storage/sqlite-facade.d.ts.map +1 -1
- package/dist/core/storage/sqlite-facade.js +17 -1
- package/dist/core/storage/sqlite-facade.js.map +1 -1
- package/dist/core/tasks/agent-adapter.d.ts +13 -2
- package/dist/core/tasks/agent-adapter.d.ts.map +1 -1
- package/dist/core/tasks/agent-adapter.js +25 -8
- package/dist/core/tasks/agent-adapter.js.map +1 -1
- package/dist/core/tasks/agent-panel-rules.d.ts +77 -0
- package/dist/core/tasks/agent-panel-rules.d.ts.map +1 -0
- package/dist/core/tasks/agent-panel-rules.js +88 -0
- package/dist/core/tasks/agent-panel-rules.js.map +1 -0
- package/dist/core/tasks/agent-panel-source.d.ts +19 -0
- package/dist/core/tasks/agent-panel-source.d.ts.map +1 -1
- package/dist/core/tasks/agent-panel-source.js +50 -9
- package/dist/core/tasks/agent-panel-source.js.map +1 -1
- package/dist/core/tasks/command-output.d.ts +17 -2
- package/dist/core/tasks/command-output.d.ts.map +1 -1
- package/dist/core/tasks/command-output.js +59 -3
- package/dist/core/tasks/command-output.js.map +1 -1
- package/dist/core/tasks/completion-message.d.ts +8 -3
- package/dist/core/tasks/completion-message.d.ts.map +1 -1
- package/dist/core/tasks/completion-message.js +14 -10
- package/dist/core/tasks/completion-message.js.map +1 -1
- package/dist/core/tasks/completion.d.ts +14 -4
- package/dist/core/tasks/completion.d.ts.map +1 -1
- package/dist/core/tasks/completion.js +58 -17
- package/dist/core/tasks/completion.js.map +1 -1
- package/dist/core/tasks/contracts.d.ts +10 -1
- package/dist/core/tasks/contracts.d.ts.map +1 -1
- package/dist/core/tasks/contracts.js +3 -1
- package/dist/core/tasks/contracts.js.map +1 -1
- package/dist/core/tasks/heartbeat.js +2 -1
- package/dist/core/tasks/heartbeat.js.map +1 -1
- package/dist/core/tasks/live-elapsed.d.ts +16 -1
- package/dist/core/tasks/live-elapsed.d.ts.map +1 -1
- package/dist/core/tasks/live-elapsed.js +43 -4
- package/dist/core/tasks/live-elapsed.js.map +1 -1
- package/dist/core/tasks/owner-store.d.ts +8 -0
- package/dist/core/tasks/owner-store.d.ts.map +1 -1
- package/dist/core/tasks/owner-store.js +34 -4
- package/dist/core/tasks/owner-store.js.map +1 -1
- package/dist/core/tasks/session-scope.d.ts +7 -0
- package/dist/core/tasks/session-scope.d.ts.map +1 -1
- package/dist/core/tasks/session-scope.js +15 -9
- package/dist/core/tasks/session-scope.js.map +1 -1
- package/dist/core/tasks/supervisor.d.ts +7 -3
- package/dist/core/tasks/supervisor.d.ts.map +1 -1
- package/dist/core/tasks/supervisor.js +92 -17
- package/dist/core/tasks/supervisor.js.map +1 -1
- package/dist/core/tasks/task-archive-snapshot.d.ts +7 -0
- package/dist/core/tasks/task-archive-snapshot.d.ts.map +1 -0
- package/dist/core/tasks/task-archive-snapshot.js +33 -0
- package/dist/core/tasks/task-archive-snapshot.js.map +1 -0
- package/dist/core/tasks/task-resumer.d.ts +5 -3
- package/dist/core/tasks/task-resumer.d.ts.map +1 -1
- package/dist/core/tasks/task-resumer.js +37 -13
- package/dist/core/tasks/task-resumer.js.map +1 -1
- package/dist/core/tasks/task-view-source.d.ts +25 -3
- package/dist/core/tasks/task-view-source.d.ts.map +1 -1
- package/dist/core/tasks/task-view-source.js +144 -44
- package/dist/core/tasks/task-view-source.js.map +1 -1
- package/dist/core/tasks/transcript.d.ts +3 -1
- package/dist/core/tasks/transcript.d.ts.map +1 -1
- package/dist/core/tasks/transcript.js +27 -0
- package/dist/core/tasks/transcript.js.map +1 -1
- package/dist/core/tools/ask-user-question/view/dialog-builder.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/view/dialog-builder.js +2 -1
- package/dist/core/tools/ask-user-question/view/dialog-builder.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +2 -1
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/history-protocol.d.ts.map +1 -1
- package/dist/core/tools/history-protocol.js +130 -29
- package/dist/core/tools/history-protocol.js.map +1 -1
- package/dist/core/tools/history-search-position.d.ts +30 -0
- package/dist/core/tools/history-search-position.d.ts.map +1 -0
- package/dist/core/tools/history-search-position.js +161 -0
- package/dist/core/tools/history-search-position.js.map +1 -0
- package/dist/core/tools/history-search-wire.d.ts +25 -0
- package/dist/core/tools/history-search-wire.d.ts.map +1 -0
- package/dist/core/tools/history-search-wire.js +210 -0
- package/dist/core/tools/history-search-wire.js.map +1 -0
- package/dist/core/tools/resource-selectors.d.ts +7 -1
- package/dist/core/tools/resource-selectors.d.ts.map +1 -1
- package/dist/core/tools/resource-selectors.js +18 -11
- package/dist/core/tools/resource-selectors.js.map +1 -1
- package/dist/core/tools/search.d.ts.map +1 -1
- package/dist/core/tools/search.js +24 -3
- package/dist/core/tools/search.js.map +1 -1
- package/dist/core/tools/sqlite-selector-connection.d.ts +3 -0
- package/dist/core/tools/sqlite-selector-connection.d.ts.map +1 -1
- package/dist/core/tools/sqlite-selector-connection.js +4 -0
- package/dist/core/tools/sqlite-selector-connection.js.map +1 -1
- package/dist/core/tools/tool-abort-grace.d.ts +13 -0
- package/dist/core/tools/tool-abort-grace.d.ts.map +1 -0
- package/dist/core/tools/tool-abort-grace.js +72 -0
- package/dist/core/tools/tool-abort-grace.js.map +1 -0
- package/dist/core/tools/tool-concurrency.d.ts +5 -1
- package/dist/core/tools/tool-concurrency.d.ts.map +1 -1
- package/dist/core/tools/tool-concurrency.js +36 -6
- package/dist/core/tools/tool-concurrency.js.map +1 -1
- package/dist/core/workflow-resume.d.ts +1 -1
- package/dist/core/workflow-resume.d.ts.map +1 -1
- package/dist/core/workflow-resume.js +13 -3
- package/dist/core/workflow-resume.js.map +1 -1
- package/dist/core/workflow-summary-lifecycle.d.ts.map +1 -1
- package/dist/core/workflow-summary-lifecycle.js +8 -2
- package/dist/core/workflow-summary-lifecycle.js.map +1 -1
- package/dist/core/workspace/errors.d.ts +5 -2
- package/dist/core/workspace/errors.d.ts.map +1 -1
- package/dist/core/workspace/errors.js +59 -5
- package/dist/core/workspace/errors.js.map +1 -1
- package/dist/core/worktree-snapshot/blob-store.d.ts +138 -17
- package/dist/core/worktree-snapshot/blob-store.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/blob-store.js +788 -82
- package/dist/core/worktree-snapshot/blob-store.js.map +1 -1
- package/dist/core/worktree-snapshot/garbage.d.ts +17 -2
- package/dist/core/worktree-snapshot/garbage.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/garbage.js +20 -4
- package/dist/core/worktree-snapshot/garbage.js.map +1 -1
- package/dist/core/worktree-snapshot/index.d.ts +1 -1
- package/dist/core/worktree-snapshot/index.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/index.js +1 -1
- package/dist/core/worktree-snapshot/index.js.map +1 -1
- package/dist/core/worktree-snapshot/pool.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/pool.js +38 -6
- package/dist/core/worktree-snapshot/pool.js.map +1 -1
- package/dist/core/worktree-snapshot/shared-clock.d.ts +3 -1
- package/dist/core/worktree-snapshot/shared-clock.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/shared-clock.js +116 -26
- package/dist/core/worktree-snapshot/shared-clock.js.map +1 -1
- package/dist/core/worktree-snapshot/types.d.ts +4 -1
- package/dist/core/worktree-snapshot/types.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/types.js.map +1 -1
- package/dist/extensions/llama/huggingface-ui.d.ts.map +1 -1
- package/dist/extensions/llama/huggingface-ui.js +2 -2
- package/dist/extensions/llama/huggingface-ui.js.map +1 -1
- package/dist/extensions/llama/index.d.ts +2 -0
- package/dist/extensions/llama/index.d.ts.map +1 -1
- package/dist/extensions/llama/index.js +19 -2
- package/dist/extensions/llama/index.js.map +1 -1
- package/dist/index.d.ts +9 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +74 -15
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/agent-panel.d.ts +22 -6
- package/dist/modes/interactive/components/agent-panel.d.ts.map +1 -1
- package/dist/modes/interactive/components/agent-panel.js +80 -23
- package/dist/modes/interactive/components/agent-panel.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +2 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +11 -0
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/atomic-working-status.d.ts.map +1 -1
- package/dist/modes/interactive/components/atomic-working-status.js +10 -3
- package/dist/modes/interactive/components/atomic-working-status.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts +3 -2
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +7 -7
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts +6 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +12 -7
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.d.ts +2 -0
- package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.js +24 -3
- package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-actions.d.ts +1 -1
- package/dist/modes/interactive/components/chat-session-host-actions.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-actions.js +16 -10
- package/dist/modes/interactive/components/chat-session-host-actions.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.d.ts +10 -0
- package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.js +76 -31
- package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.d.ts +17 -5
- package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.js +79 -24
- package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-runtime.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-runtime.js +5 -4
- package/dist/modes/interactive/components/chat-session-host-runtime.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.d.ts +16 -1
- package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.js +22 -0
- package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-types.d.ts +8 -2
- package/dist/modes/interactive/components/chat-session-host-types.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-types.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-utils.d.ts +1 -0
- package/dist/modes/interactive/components/chat-session-host-utils.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-utils.js +2 -1
- package/dist/modes/interactive/components/chat-session-host-utils.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts +35 -9
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +129 -35
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/components/chat-transcript.d.ts +13 -2
- package/dist/modes/interactive/components/chat-transcript.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-transcript.js +24 -4
- package/dist/modes/interactive/components/chat-transcript.js.map +1 -1
- package/dist/modes/interactive/components/compaction-boundary-message.d.ts +6 -0
- package/dist/modes/interactive/components/compaction-boundary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-boundary-message.js +12 -7
- package/dist/modes/interactive/components/compaction-boundary-message.js.map +1 -1
- package/dist/modes/interactive/components/composer-rule.d.ts +0 -2
- package/dist/modes/interactive/components/composer-rule.d.ts.map +1 -1
- package/dist/modes/interactive/components/composer-rule.js +4 -6
- package/dist/modes/interactive/components/composer-rule.js.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.d.ts +5 -9
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.js +32 -23
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +4 -3
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/custom-entry.d.ts +6 -0
- package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-entry.js +15 -0
- package/dist/modes/interactive/components/custom-entry.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts +7 -3
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +17 -15
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +10 -3
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +37 -45
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/heartbeat-block.d.ts.map +1 -1
- package/dist/modes/interactive/components/heartbeat-block.js +3 -1
- package/dist/modes/interactive/components/heartbeat-block.js.map +1 -1
- package/dist/modes/interactive/components/host-input-form.d.ts.map +1 -1
- package/dist/modes/interactive/components/host-input-form.js +3 -3
- package/dist/modes/interactive/components/host-input-form.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +1 -1
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/input-label.d.ts.map +1 -1
- package/dist/modes/interactive/components/input-label.js +4 -5
- package/dist/modes/interactive/components/input-label.js.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts +7 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js +27 -6
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
- package/dist/modes/interactive/components/main-composer-keys.d.ts +17 -2
- package/dist/modes/interactive/components/main-composer-keys.d.ts.map +1 -1
- package/dist/modes/interactive/components/main-composer-keys.js +44 -27
- package/dist/modes/interactive/components/main-composer-keys.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +6 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +13 -7
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/nav-keys.d.ts +7 -2
- package/dist/modes/interactive/components/nav-keys.d.ts.map +1 -1
- package/dist/modes/interactive/components/nav-keys.js +51 -17
- package/dist/modes/interactive/components/nav-keys.js.map +1 -1
- package/dist/modes/interactive/components/notice-line.d.ts +8 -0
- package/dist/modes/interactive/components/notice-line.d.ts.map +1 -1
- package/dist/modes/interactive/components/notice-line.js +6 -1
- package/dist/modes/interactive/components/notice-line.js.map +1 -1
- package/dist/modes/interactive/components/selector.d.ts +3 -0
- package/dist/modes/interactive/components/selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/selector.js +30 -7
- package/dist/modes/interactive/components/selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-list.js +11 -11
- package/dist/modes/interactive/components/session-selector-list.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +2 -2
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-picker.d.ts +5 -0
- package/dist/modes/interactive/components/settings-picker.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-picker.js +36 -2
- package/dist/modes/interactive/components/settings-picker.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-submenus.d.ts +10 -0
- package/dist/modes/interactive/components/settings-selector-submenus.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-submenus.js +89 -19
- package/dist/modes/interactive/components/settings-selector-submenus.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-types.d.ts +6 -0
- package/dist/modes/interactive/components/settings-selector-types.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +7 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +12 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +6 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +12 -7
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/task-board.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-board.js +9 -2
- package/dist/modes/interactive/components/task-board.js.map +1 -1
- package/dist/modes/interactive/components/task-completion-message.d.ts +10 -3
- package/dist/modes/interactive/components/task-completion-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-completion-message.js +173 -19
- package/dist/modes/interactive/components/task-completion-message.js.map +1 -1
- package/dist/modes/interactive/components/task-inspector.d.ts +1 -1
- package/dist/modes/interactive/components/task-inspector.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-inspector.js +28 -19
- package/dist/modes/interactive/components/task-inspector.js.map +1 -1
- package/dist/modes/interactive/components/task-list.d.ts +7 -3
- package/dist/modes/interactive/components/task-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-list.js +60 -33
- package/dist/modes/interactive/components/task-list.js.map +1 -1
- package/dist/modes/interactive/components/task-row.d.ts +7 -0
- package/dist/modes/interactive/components/task-row.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-row.js +25 -11
- package/dist/modes/interactive/components/task-row.js.map +1 -1
- package/dist/modes/interactive/components/task-transcript-notices.d.ts +16 -0
- package/dist/modes/interactive/components/task-transcript-notices.d.ts.map +1 -0
- package/dist/modes/interactive/components/task-transcript-notices.js +74 -0
- package/dist/modes/interactive/components/task-transcript-notices.js.map +1 -0
- package/dist/modes/interactive/components/task-transcript-page.d.ts +11 -6
- package/dist/modes/interactive/components/task-transcript-page.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-transcript-page.js +48 -21
- package/dist/modes/interactive/components/task-transcript-page.js.map +1 -1
- package/dist/modes/interactive/components/tool-block-families.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-block-families.js +2 -1
- package/dist/modes/interactive/components/tool-block-families.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +3 -2
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +23 -9
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/transcript-block-clicks.d.ts +54 -14
- package/dist/modes/interactive/components/transcript-block-clicks.d.ts.map +1 -1
- package/dist/modes/interactive/components/transcript-block-clicks.js +151 -16
- package/dist/modes/interactive/components/transcript-block-clicks.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector-help.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector-help.js +25 -30
- package/dist/modes/interactive/components/tree-selector-help.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector-list.d.ts +4 -0
- package/dist/modes/interactive/components/tree-selector-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector-list.js +21 -21
- package/dist/modes/interactive/components/tree-selector-list.js.map +1 -1
- package/dist/modes/interactive/components/working-run-meter.d.ts +31 -2
- package/dist/modes/interactive/components/working-run-meter.d.ts.map +1 -1
- package/dist/modes/interactive/components/working-run-meter.js +81 -10
- package/dist/modes/interactive/components/working-run-meter.js.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.js +67 -14
- package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
- package/dist/modes/interactive/interactive-autocomplete.js +2 -2
- package/dist/modes/interactive/interactive-autocomplete.js.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.js +10 -4
- package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-editor-actions.js +4 -1
- package/dist/modes/interactive/interactive-editor-actions.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-custom-ui.js +13 -3
- package/dist/modes/interactive/interactive-extension-custom-ui.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.js +4 -2
- package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-widgets.js +6 -8
- package/dist/modes/interactive/interactive-extension-widgets.js.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.js +43 -3
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts +7 -0
- package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.js +9 -2
- package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.d.ts +1 -1
- package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.js +1 -1
- package/dist/modes/interactive/interactive-mode-deps.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-helpers.d.ts +5 -0
- package/dist/modes/interactive/interactive-mode-helpers.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-helpers.js +9 -0
- package/dist/modes/interactive/interactive-mode-helpers.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +10 -2
- package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
- package/dist/modes/interactive/interactive-model-routing.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-model-routing.js +63 -21
- package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-prompt-turn.js +1 -1
- package/dist/modes/interactive/interactive-prompt-turn.js.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.js +71 -10
- package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
- package/dist/modes/interactive/interactive-resource-rendering.js +9 -18
- package/dist/modes/interactive/interactive-resource-rendering.js.map +1 -1
- package/dist/modes/interactive/interactive-selectors.js +106 -57
- package/dist/modes/interactive/interactive-selectors.js.map +1 -1
- package/dist/modes/interactive/interactive-session-routing.js +10 -5
- package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-session-runtime.d.ts +3 -0
- package/dist/modes/interactive/interactive-session-runtime.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-session-runtime.js +11 -0
- package/dist/modes/interactive/interactive-session-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.js +3 -0
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
- package/dist/modes/interactive/interactive-startup-chat-container.d.ts +5 -1
- package/dist/modes/interactive/interactive-startup-chat-container.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup-chat-container.js +8 -3
- package/dist/modes/interactive/interactive-startup-chat-container.js.map +1 -1
- package/dist/modes/interactive/interactive-startup-trust.d.ts +2 -0
- package/dist/modes/interactive/interactive-startup-trust.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup-trust.js +21 -0
- package/dist/modes/interactive/interactive-startup-trust.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +39 -17
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-task-projection.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-task-projection.js +11 -1
- package/dist/modes/interactive/interactive-task-projection.js.map +1 -1
- package/dist/modes/interactive/resume-catalog.d.ts.map +1 -1
- package/dist/modes/interactive/resume-catalog.js +1 -0
- package/dist/modes/interactive/resume-catalog.js.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts +6 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.js +19 -1
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
- package/dist/modes/interactive-engine/engine-child-liveness.d.ts +2 -0
- package/dist/modes/interactive-engine/engine-child-liveness.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-child-liveness.js +2 -0
- package/dist/modes/interactive-engine/engine-child-liveness.js.map +1 -1
- package/dist/modes/interactive-engine/engine-custom-ui.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-custom-ui.js +54 -4
- package/dist/modes/interactive-engine/engine-custom-ui.js.map +1 -1
- package/dist/modes/interactive-engine/engine-render-service.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-render-service.js +21 -2
- package/dist/modes/interactive-engine/engine-render-service.js.map +1 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.d.ts +4 -2
- package/dist/modes/interactive-engine/extension-ui-bridge.d.ts.map +1 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.js +4 -0
- package/dist/modes/interactive-engine/extension-ui-bridge.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.d.ts +39 -3
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.js +219 -29
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
- package/dist/modes/interactive-engine/protocol.d.ts +33 -1
- package/dist/modes/interactive-engine/protocol.d.ts.map +1 -1
- package/dist/modes/interactive-engine/protocol.js +40 -2
- package/dist/modes/interactive-engine/protocol.js.map +1 -1
- package/dist/modes/interactive-engine/remote-command-catalog.d.ts +2 -2
- package/dist/modes/interactive-engine/remote-command-catalog.d.ts.map +1 -1
- package/dist/modes/interactive-engine/remote-command-catalog.js +7 -3
- package/dist/modes/interactive-engine/remote-command-catalog.js.map +1 -1
- package/dist/modes/interactive-engine/remote-component.d.ts.map +1 -1
- package/dist/modes/interactive-engine/remote-component.js +31 -5
- package/dist/modes/interactive-engine/remote-component.js.map +1 -1
- package/dist/modes/interactive-engine/remote-renderer.d.ts +20 -12
- package/dist/modes/interactive-engine/remote-renderer.d.ts.map +1 -1
- package/dist/modes/interactive-engine/remote-renderer.js +100 -34
- package/dist/modes/interactive-engine/remote-renderer.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +4 -1
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/agent-panel-bridge.d.ts +7 -0
- package/dist/modes/rpc/agent-panel-bridge.d.ts.map +1 -1
- package/dist/modes/rpc/agent-panel-bridge.js +119 -114
- package/dist/modes/rpc/agent-panel-bridge.js.map +1 -1
- package/dist/modes/rpc/rpc-client-process.d.ts +2 -1
- package/dist/modes/rpc/rpc-client-process.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client-process.js +2 -1
- package/dist/modes/rpc/rpc-client-process.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +8 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +5 -1
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.js +19 -2
- package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +4 -2
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-session-binding.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-session-binding.js +7 -0
- package/dist/modes/rpc/rpc-session-binding.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +13 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/utils/interactive-engine-bootstrap.d.ts +3 -0
- package/dist/utils/interactive-engine-bootstrap.d.ts.map +1 -1
- package/dist/utils/interactive-engine-bootstrap.js +25 -0
- package/dist/utils/interactive-engine-bootstrap.js.map +1 -1
- package/dist/utils/interactive-engine-env.d.ts +3 -0
- package/dist/utils/interactive-engine-env.d.ts.map +1 -1
- package/dist/utils/interactive-engine-env.js +1 -0
- package/dist/utils/interactive-engine-env.js.map +1 -1
- package/dist/utils/shell.d.ts +2 -0
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +3 -3
- package/dist/utils/shell.js.map +1 -1
- package/docs/background-tasks.md +32 -37
- package/docs/compaction.md +2 -2
- package/docs/computer-use.md +2 -0
- package/docs/development.md +11 -1
- package/docs/environment-variables.md +2 -0
- package/docs/extensions/api-reference.md +7 -3
- package/docs/extensions/authoring.md +3 -1
- package/docs/extensions/events.md +3 -1
- package/docs/extensions/ui.md +2 -0
- package/docs/guides/resume-on-any-machine.md +3 -1
- package/docs/intercom/reference.md +1 -1
- package/docs/intercom.md +3 -3
- package/docs/keybindings.md +6 -2
- package/docs/libraries/tui.md +4 -0
- package/docs/providers.md +1 -1
- package/docs/rpc/protocol.md +6 -4
- package/docs/sdk/reference.md +10 -4
- package/docs/sdk.md +5 -2
- package/docs/security.md +5 -1
- package/docs/session-format.md +1 -1
- package/docs/sessions.md +16 -0
- package/docs/settings.md +2 -2
- package/docs/skills.md +3 -3
- package/docs/storage.md +25 -4
- package/docs/subagents.md +42 -45
- package/docs/tui.md +1 -1
- package/docs/usage.md +3 -1
- package/docs/workflows/api-reference.md +3 -1
- package/docs/workflows/authoring.md +1 -1
- package/docs/workflows/operations.md +21 -14
- package/docs/workflows.md +1 -1
- package/docs/worktree-snapshots.md +10 -8
- package/npm-shrinkwrap.json +71 -49
- package/package.json +9 -8
- package/schemas/settings.schema.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-transcript.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/chat-transcript.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,SAAS,EACd,KAAK,SAAS,EAId,KAAK,mBAAmB,EAKxB,KAAK,gBAAgB,EACrB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"chat-transcript.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/chat-transcript.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,SAAS,EACd,KAAK,SAAS,EAId,KAAK,mBAAmB,EAKxB,KAAK,gBAAgB,EACrB,MAAM,qBAAqB,CAAC;AAI7B,OAAO,EAAE,KAAK,oBAAoB,EAAqC,MAAM,8BAA8B,CAAC;AAG5G;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAC3B,WAAW,GACX,UAAU,GACV,MAAM,GACN,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,SAAS,CAAC;AAEb,MAAM,WAAW,uBAAuB;IACvC,QAAQ,CAAC,IAAI,EAAE,kBAA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gBAAgB;IAKxB,mGAAmG;IACnG,OAAO,CAAC,cAAc;IA6BtB,OAAO,CAAC,eAAe;IAiBvB,OAAO,CAAC,iBAAiB;IAkCzB,+GAA+G;IAC/G,OAAO,CAAC,cAAc;CAUtB;AAgHD,qBAAa,iCAAiC,CAAC,MAAM,SAAS,uBAAuB,CAAE,YAAW,SAAS;IAC1G,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqC;IAC9D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkC;IAE7D,YAAY,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,WAAW,EAAE,sBAAsB,CAAC,MAAM,CAAC,EAGlF;IAED,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEjC;IAED,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEjC;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAE9B;IAED,UAAU,IAAI,IAAI,CAEjB;IAED,mBAAmB,IAAI,MAAM,CAE5B;IAED,YAAY,IAAI,MAAM,CAErB;IAED,cAAc,IAAI,IAAI,CAErB;CACD;AAED,yGAAyG;AACzG,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAYtE"}
|
|
@@ -2,7 +2,7 @@ import { getKeybindings, matchesKey, Spacer, stripTerminalSequences, truncateToW
|
|
|
2
2
|
import { colorEnvironment } from "../theme/color-utils.js";
|
|
3
3
|
import { isUserPromptRow } from "./jump-to-latest.js";
|
|
4
4
|
import { disposeRenderer as disposeComponent } from "./renderer-disposal.js";
|
|
5
|
-
import {
|
|
5
|
+
import { clickUnit, isClickExpandableBlock } from "./transcript-block-clicks.js";
|
|
6
6
|
import { WheelScrollAccelerator } from "./wheel-scroll-accelerator.js";
|
|
7
7
|
/** `ensureBlockCache` found every block current. */
|
|
8
8
|
const UNCHANGED = Number.POSITIVE_INFINITY;
|
|
@@ -141,7 +141,7 @@ export class ChatTranscriptComponent {
|
|
|
141
141
|
}
|
|
142
142
|
/**
|
|
143
143
|
* The entries whose blocks a single click on row `row` of the transcript, as last laid out at `width`, expands or
|
|
144
|
-
* collapses, and
|
|
144
|
+
* collapses, and those blocks as drawn. Undefined unless the row is one a block draws; only a windowed transcript,
|
|
145
145
|
* one built with a cache key, can tell.
|
|
146
146
|
*/
|
|
147
147
|
clickedEntries(width, row) {
|
|
@@ -157,8 +157,24 @@ export class ChatTranscriptComponent {
|
|
|
157
157
|
const bodyRow = row - (painted.starts[index] ?? 0) - (block.spaced ? 1 : 0);
|
|
158
158
|
if (bodyRow < 0 || bodyRow >= block.body.length)
|
|
159
159
|
return undefined;
|
|
160
|
+
if (!isClickExpandableBlock(block.component))
|
|
161
|
+
return undefined;
|
|
162
|
+
const area = block.component.clickArea(width);
|
|
163
|
+
if (!area || bodyRow < area.start || bodyRow >= area.end)
|
|
164
|
+
return undefined;
|
|
165
|
+
return this.clickGroupAt(blocks, index);
|
|
166
|
+
}
|
|
167
|
+
/** The target's current group and data, at the width of the body that will expand. */
|
|
168
|
+
currentClickGroup(width, entry) {
|
|
169
|
+
this.measureRows(width);
|
|
170
|
+
return this.clickGroupAt(this.blockCache, this.entries.indexOf(entry));
|
|
171
|
+
}
|
|
172
|
+
clickGroupAt(blocks, index) {
|
|
173
|
+
const target = blocks[index]?.entry;
|
|
174
|
+
if (target === undefined)
|
|
175
|
+
return undefined;
|
|
160
176
|
const components = blocks.map((candidate) => candidate?.component ?? EMPTY_COMPONENT);
|
|
161
|
-
const unit =
|
|
177
|
+
const unit = clickUnit(components, index);
|
|
162
178
|
if (unit === undefined)
|
|
163
179
|
return undefined;
|
|
164
180
|
const entryOf = new Map();
|
|
@@ -169,7 +185,7 @@ export class ChatTranscriptComponent {
|
|
|
169
185
|
const entry = entryOf.get(component);
|
|
170
186
|
return entry === undefined ? [] : [entry];
|
|
171
187
|
});
|
|
172
|
-
return { entries,
|
|
188
|
+
return { target, entries, blocks: unit };
|
|
173
189
|
}
|
|
174
190
|
requestEntryRender(entry) {
|
|
175
191
|
this.dirtyEntries.add(entry);
|
|
@@ -642,6 +658,10 @@ export class ScrollableComponentViewport {
|
|
|
642
658
|
}
|
|
643
659
|
return undefined;
|
|
644
660
|
}
|
|
661
|
+
/** The content width the last frame gave its transcript, after reserving any scrollbar. */
|
|
662
|
+
get paintedContentWidth() {
|
|
663
|
+
return this.lastWidth;
|
|
664
|
+
}
|
|
645
665
|
/** The first stack row the last frame drew, for holding the view where it is. */
|
|
646
666
|
firstVisibleRow() {
|
|
647
667
|
return this.lastPaint?.start;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-transcript.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/chat-transcript.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,cAAc,EAEd,UAAU,EAEV,MAAM,EACN,sBAAsB,EACtB,eAAe,EACf,YAAY,GAEZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,eAAe,IAAI,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAiEvE,oDAAoD;AACpD,MAAM,SAAS,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAE3C,sGAAsG;AACtG,MAAM,eAAe,GAAc,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,CAAC;AA0D9E,MAAM,UAAU,sBAAsB,CAAC,SAAoB,EAAE,SAAoB,EAAE,IAAwB;IAC1G,IAAI,kBAAkB,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,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AAC,IAAY;IACpC,OAAO,0BAA0B,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;AAC3E,CAAC","sourcesContent":["import {\n\ttype Component,\n\ttype Container,\n\tgetKeybindings,\n\ttype KeybindingsManager,\n\tmatchesKey,\n\ttype ScrollViewScrollbar,\n\tSpacer,\n\tstripTerminalSequences,\n\ttruncateToWidth,\n\tvisibleWidth,\n\ttype WheelScrollLines,\n} from \"@bastani/atomic-tui\";\nimport { colorEnvironment } from \"../theme/color-utils.ts\";\nimport { isUserPromptRow } from \"./jump-to-latest.ts\";\nimport { disposeRenderer as disposeComponent } from \"./renderer-disposal.js\";\nimport { clickedBlocks } from \"./transcript-block-clicks.ts\";\nimport { WheelScrollAccelerator } from \"./wheel-scroll-accelerator.ts\";\n\n/**\n * Roles that participate in pi's chat spacing contract.\n *\n * Assistant turns own their leading whitespace internally, and tool rows attach\n * directly under the assistant/tool-call row they belong to. User-like rows get\n * one blank line when they are not the first row in the transcript.\n */\nexport type ChatTranscriptRole =\n\t| \"assistant\"\n\t| \"thinking\"\n\t| \"tool\"\n\t| \"user\"\n\t| \"custom\"\n\t| \"notice\"\n\t| \"system\"\n\t| \"summary\";\n\nexport interface ChatTranscriptEntryLike {\n\treadonly role: ChatTranscriptRole;\n}\n\nexport type ChatTranscriptRenderer<TEntry extends ChatTranscriptEntryLike> = (entry: TEntry) => Component;\n\n/**\n * What an entry's rendered rows depend on beyond the entry object itself. A string is compared whole; parts are\n * compared one by one with `Object.is`, so a host can name the objects and fields an entry renders from without\n * serializing them on every frame.\n */\nexport type ChatTranscriptCacheKeyValue = string | readonly unknown[];\n\nexport type ChatTranscriptCacheKey<TEntry extends ChatTranscriptEntryLike> = (\n\tentry: TEntry,\n\tindex: number,\n) => ChatTranscriptCacheKeyValue;\n\ninterface CachedChatTranscriptBlock<TEntry extends ChatTranscriptEntryLike> {\n\treadonly entry: TEntry;\n\treadonly key: ChatTranscriptCacheKeyValue;\n\treadonly width: number;\n\treadonly component: Component;\n\t/** The component's own rows, without the leading spacer its position adds. */\n\treadonly body: readonly string[];\n\treadonly bodyPromptRows: readonly number[];\n\treadonly spaced: boolean;\n\treadonly lines: readonly string[];\n\treadonly promptRows: readonly number[];\n}\n\n/** The blocks a transcript drew and their first rows, at the width it drew them. */\ninterface CachedTranscriptPaint<TEntry extends ChatTranscriptEntryLike> {\n\treadonly width: number;\n\treadonly blocks: readonly (CachedChatTranscriptBlock<TEntry> | undefined)[];\n\treadonly starts: readonly number[];\n}\n\n/** Row offsets of every cached block, kept current from the first block that changed onward. */\ninterface TranscriptRowLayout {\n\treadonly starts: number[];\n\treadonly prompts: number[];\n\tsegments: readonly RowWindowSegment[];\n\trowCount: number;\n}\n\n/** `ensureBlockCache` found every block current. */\nconst UNCHANGED = Number.POSITIVE_INFINITY;\n\n/** Stands in for an entry with no block, so blocks keep their positions in a click's sibling list. */\nconst EMPTY_COMPONENT: Component = { render: () => [], invalidate: () => {} };\n\n/**\n * A run of rows inside a windowed component, tagged with the identity of the\n * thing that produced them.\n *\n * `id` is compared with `===` only, and is never rendered. Entry *objects* are\n * the natural id for a transcript: cache keys carry the entry's index and so\n * change for every survivor of a splice, while the entry objects themselves are\n * moved, not rebuilt.\n */\nexport interface RowWindowSegment {\n\treadonly id: unknown;\n\treadonly rows: number;\n}\n\ninterface MeasuredRowWindow {\n\treadonly rowCount: number;\n\treadonly segments?: readonly RowWindowSegment[];\n\trenderRows(start: number, end: number): string[];\n\tfindUserPromptRow?(start: number): number | undefined;\n}\n\ninterface RowWindowComponent extends Component {\n\treadonly supportsRowWindow: true;\n\trowCount(width: number): number;\n\trenderRows(width: number, startRow: number, endRow: number): string[];\n\tmeasureRows?(width: number): MeasuredRowWindow;\n\t/**\n\t * Optional row map, letting the viewport keep a scroll anchor that sits\n\t * *inside* this component when its interior changes height.\n\t */\n\trowSegments?(width: number): readonly RowWindowSegment[];\n}\n\ninterface WindowedComponentRows {\n\treadonly kind: \"windowed\";\n\treadonly renderRows: MeasuredRowWindow[\"renderRows\"];\n\treadonly findUserPromptRow: MeasuredRowWindow[\"findUserPromptRow\"];\n\treadonly rowCount: number;\n\treadonly segments: readonly RowWindowSegment[] | undefined;\n}\n\ninterface StaticComponentRows {\n\treadonly kind: \"static\";\n\treadonly lines: readonly string[];\n\treadonly rowCount: number;\n\t/**\n\t * Present when a static component can still identify its own rows. A\n\t * transcript built without a cache key renders every row each frame rather\n\t * than windowing, but it knows just as well which entry produced which rows,\n\t * and the anchor needs that whenever it is the component spanning the anchor.\n\t */\n\treadonly segments?: readonly RowWindowSegment[] | undefined;\n}\n\ntype ComponentRows = WindowedComponentRows | StaticComponentRows;\n\nexport function addChatTranscriptEntry(container: Container, component: Component, role: ChatTranscriptRole): void {\n\tif (needsLeadingSpacer(role) && container.children.length > 0 && !ownsLeadingSpacer(component)) {\n\t\tcontainer.addChild(new Spacer(1));\n\t}\n\tcontainer.addChild(component);\n}\n\nfunction ownsLeadingSpacer(component: Component): boolean {\n\treturn \"ownsLeadingSpacer\" in component && component.ownsLeadingSpacer === true;\n}\n\nfunction needsLeadingSpacer(role: ChatTranscriptRole): boolean {\n\treturn role === \"user\" || role === \"custom\" || role === \"notice\" || role === \"system\" || role === \"summary\";\n}\n\n/**\n * Reusable pi chat transcript scaffold for extension surfaces.\n *\n * This intentionally mirrors InteractiveMode.addMessageToChat spacing without\n * coupling consumers to a full AgentSession. Extension UIs can bring their own\n * message model while still rendering inside the same Container/Spacer rhythm\n * as the main chat.\n */\nexport class ChatTranscriptComponent<TEntry extends ChatTranscriptEntryLike> implements Component {\n\tprivate readonly entries: readonly TEntry[];\n\tprivate readonly renderEntry: ChatTranscriptRenderer<TEntry>;\n\treadonly supportsRowWindow: boolean;\n\n\tprivate readonly cacheKey: ChatTranscriptCacheKey<TEntry> | undefined;\n\tprivate blockCache: Array<CachedChatTranscriptBlock<TEntry> | undefined> = [];\n\tprivate measuredRows: MeasuredRowWindow | undefined;\n\t/** The blocks and their first rows as last drawn, which a click is resolved against. */\n\tprivate paintedLayout: CachedTranscriptPaint<TEntry> | undefined;\n\tprivate readonly layout: TranscriptRowLayout = { starts: [], prompts: [], segments: [], rowCount: 0 };\n\tprivate dirtyEntries = new WeakSet<TEntry>();\n\tprivate staticComponents: readonly Component[] = [];\n\t/** Per-entry heights recorded by the most recent `renderAllRows`. */\n\tprivate staticSegments: readonly RowWindowSegment[] = [];\n\t/** Width those heights were measured at; they mean nothing at another width. */\n\tprivate staticSegmentsWidth: number | undefined;\n\n\tconstructor(\n\t\tentries: readonly TEntry[],\n\t\trenderEntry: ChatTranscriptRenderer<TEntry>,\n\t\tcacheKey?: ChatTranscriptCacheKey<TEntry>,\n\t) {\n\t\tthis.entries = entries;\n\t\tthis.renderEntry = renderEntry;\n\t\tthis.cacheKey = cacheKey;\n\t\tthis.supportsRowWindow = cacheKey !== undefined;\n\t}\n\n\trender(width: number): string[] {\n\t\tif (!this.supportsRowWindow) return this.renderAllRows(width);\n\t\tconst measured = this.measureRows(width);\n\t\treturn measured.renderRows(0, measured.rowCount);\n\t}\n\n\trowCount(width: number): number {\n\t\tif (!this.supportsRowWindow) return this.renderAllRows(width).length;\n\t\treturn this.measureRows(width).rowCount;\n\t}\n\n\t/**\n\t * One segment per cached entry block, identified by the entry object itself.\n\t */\n\trowSegments(width: number): readonly RowWindowSegment[] {\n\t\tif (!this.supportsRowWindow) {\n\t\t\t// Recorded by the last renderAllRows. The viewport measures a static\n\t\t\t// component by rendering it and only then reads its segments, so this\n\t\t\t// is populated for the frame being measured. A width mismatch means the\n\t\t\t// heights describe a different layout, and reporting them would move the\n\t\t\t// anchor by a stale delta; the caller falls back to whole-component\n\t\t\t// accounting instead.\n\t\t\treturn this.staticSegmentsWidth === width ? this.staticSegments : [];\n\t\t}\n\t\treturn this.measureRows(width).segments ?? [];\n\t}\n\n\trenderRows(width: number, startRow: number, endRow: number): string[] {\n\t\tconst start = Math.max(0, Math.floor(startRow));\n\t\tconst end = Math.max(start, Math.floor(endRow));\n\t\tif (end <= start) return [];\n\t\tif (!this.supportsRowWindow) return this.renderAllRows(width).slice(start, end);\n\t\treturn this.measureRows(width).renderRows(start, end);\n\t}\n\n\t/**\n\t * The row layout of every entry at `width`.\n\t *\n\t * Work per call is proportional to what changed: an entry is rendered again only when it is new, its cache key\n\t * changed, or the width changed, and row offsets are recomputed from the first changed entry onward. Entries that\n\t * only moved (a prepend, a splice) keep their rendered rows.\n\t */\n\tmeasureRows(width: number): MeasuredRowWindow {\n\t\tconst firstChanged = this.ensureBlockCache(width);\n\t\tif (this.measuredRows !== undefined && firstChanged === UNCHANGED) return this.measuredRows;\n\t\tthis.refreshLayout(Math.min(firstChanged, this.blockCache.length));\n\t\tconst { starts, prompts, segments, rowCount } = this.layout;\n\t\tconst blocks = this.blockCache;\n\t\tlet painted: CachedTranscriptPaint<TEntry> | undefined;\n\t\tthis.measuredRows = {\n\t\t\trowCount,\n\t\t\tsegments,\n\t\t\tfindUserPromptRow: (start) => prompts[indexAtOrBefore(prompts, start)],\n\t\t\trenderRows: (start, end) => {\n\t\t\t\t// Drawing these rows is what the reader sees; a click resolves against this layout until the next draw,\n\t\t\t\t// though a search or prompt jump may measure the transcript again before then.\n\t\t\t\tpainted ??= { width, blocks: [...blocks], starts: [...starts] };\n\t\t\t\tthis.paintedLayout = painted;\n\t\t\t\tconst lines: string[] = [];\n\t\t\t\tfor (let index = Math.max(0, indexAtOrBefore(starts, start)); index < blocks.length; index++) {\n\t\t\t\t\tconst block = blocks[index];\n\t\t\t\t\tconst blockStart = starts[index] ?? 0;\n\t\t\t\t\tif (blockStart >= end) break;\n\t\t\t\t\tif (block === undefined) continue;\n\t\t\t\t\tconst localEnd = Math.min(block.lines.length, end - blockStart);\n\t\t\t\t\tfor (let row = Math.max(0, start - blockStart); row < localEnd; row++) {\n\t\t\t\t\t\tlines.push(block.lines[row] ?? \"\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn lines;\n\t\t\t},\n\t\t};\n\t\treturn this.measuredRows;\n\t}\n\n\t/** The entry whose block the last draw at `width` put on row `row`, and the row within that block. */\n\tpaintedEntryAt(width: number, row: number): { readonly entry: TEntry; readonly row: number } | undefined {\n\t\tconst painted = this.paintedLayout;\n\t\tif (!this.supportsRowWindow || row < 0 || painted === undefined || painted.width !== width) return undefined;\n\t\tconst index = indexAtOrBefore(painted.starts, row);\n\t\tconst block = painted.blocks[index];\n\t\tconst start = painted.starts[index] ?? 0;\n\t\tif (block === undefined || row - start >= block.lines.length) return undefined;\n\t\treturn { entry: block.entry, row: row - start };\n\t}\n\n\t/**\n\t * The entries whose blocks a single click on row `row` of the transcript, as last laid out at `width`, expands or\n\t * collapses, and whether it expands them. Undefined unless the row is a block's header; only a windowed transcript,\n\t * one built with a cache key, can tell.\n\t */\n\tclickedEntries(\n\t\twidth: number,\n\t\trow: number,\n\t): { readonly entries: readonly TEntry[]; readonly expand: boolean } | undefined {\n\t\tconst painted = this.paintedLayout;\n\t\tif (!this.supportsRowWindow || row < 0 || painted === undefined || painted.width !== width) return undefined;\n\t\t// The rows as last drawn, which is what the reader saw: entries that arrived since are not drawn yet.\n\t\tconst blocks = painted.blocks;\n\t\tconst index = indexAtOrBefore(painted.starts, row);\n\t\tconst block = blocks[index];\n\t\tif (block === undefined) return undefined;\n\t\tconst bodyRow = row - (painted.starts[index] ?? 0) - (block.spaced ? 1 : 0);\n\t\tif (bodyRow < 0 || bodyRow >= block.body.length) return undefined;\n\t\tconst components = blocks.map((candidate) => candidate?.component ?? EMPTY_COMPONENT);\n\t\tconst unit = clickedBlocks(components, index, width, bodyRow);\n\t\tif (unit === undefined) return undefined;\n\t\tconst entryOf = new Map<Component, TEntry>();\n\t\tfor (const candidate of blocks) if (candidate !== undefined) entryOf.set(candidate.component, candidate.entry);\n\t\tconst entries = unit.flatMap((component) => {\n\t\t\tconst entry = entryOf.get(component);\n\t\t\treturn entry === undefined ? [] : [entry];\n\t\t});\n\t\treturn { entries, expand: !unit[0]!.isExpanded() };\n\t}\n\n\trequestEntryRender(entry: TEntry): void {\n\t\tthis.dirtyEntries.add(entry);\n\t\tthis.measuredRows = undefined;\n\t}\n\n\tinvalidate(): void {\n\t\tfor (const block of this.blockCache) disposeComponent(block?.component);\n\t\tfor (const component of new Set(this.staticComponents)) disposeComponent(component);\n\t\tthis.blockCache = [];\n\t\tthis.staticComponents = [];\n\t\tthis.dirtyEntries = new WeakSet<TEntry>();\n\t\tthis.measuredRows = undefined;\n\t\tthis.paintedLayout = undefined;\n\t}\n\n\t/**\n\t * Brings every block up to date. Returns the index of the first block whose rows or position may have changed,\n\t * or `UNCHANGED`.\n\t */\n\tprivate ensureBlockCache(width: number): number {\n\t\tconst entries = this.entries;\n\t\tconst previous = this.blockCache;\n\t\tif (sameEntries(previous, entries)) {\n\t\t\tlet firstChanged = UNCHANGED;\n\t\t\tfor (let index = 0; index < entries.length; index++) {\n\t\t\t\tconst cached = previous[index];\n\t\t\t\tconst block = this.currentBlock(entries[index], index, width, cached);\n\t\t\t\tif (block === cached) continue;\n\t\t\t\tif (cached !== undefined && cached.component !== block?.component) disposeComponent(cached.component);\n\t\t\t\tprevious[index] = block;\n\t\t\t\tfirstChanged = Math.min(firstChanged, index);\n\t\t\t}\n\t\t\treturn firstChanged;\n\t\t}\n\t\t// Entries were added, removed or moved: find each one's block by identity, so a moved entry keeps its rows.\n\t\tconst byEntry = new Map<TEntry, CachedChatTranscriptBlock<TEntry>>();\n\t\tfor (const block of previous) if (block !== undefined) byEntry.set(block.entry, block);\n\t\tconst kept = new Set<Component>();\n\t\tconst next: Array<CachedChatTranscriptBlock<TEntry> | undefined> = [];\n\t\tlet firstChanged = Math.min(previous.length, entries.length);\n\t\tfor (let index = 0; index < entries.length; index++) {\n\t\t\tconst entry = entries[index];\n\t\t\tconst block = this.currentBlock(entry, index, width, entry === undefined ? undefined : byEntry.get(entry));\n\t\t\tif (block !== undefined) kept.add(block.component);\n\t\t\tnext.push(block);\n\t\t\tif (block !== previous[index]) firstChanged = Math.min(firstChanged, index);\n\t\t}\n\t\tfor (const block of previous) {\n\t\t\tif (block !== undefined && !kept.has(block.component)) disposeComponent(block.component);\n\t\t}\n\t\tthis.blockCache = next;\n\t\treturn firstChanged;\n\t}\n\n\t/**\n\t * `cached` while it still shows `entry` at `index`; otherwise the entry's block, rendered again only when its key or\n\t * the width changed. A block whose position alone changed keeps its rendered rows and only gains or loses its\n\t * leading spacer. The caller disposes a replaced component.\n\t */\n\tprivate currentBlock(\n\t\tentry: TEntry | undefined,\n\t\tindex: number,\n\t\twidth: number,\n\t\tcached: CachedChatTranscriptBlock<TEntry> | undefined,\n\t): CachedChatTranscriptBlock<TEntry> | undefined {\n\t\tif (entry === undefined) return undefined;\n\t\tconst key = this.cacheKey?.(entry, index) ?? `${index}:${entry.role}`;\n\t\tconst spaced = index > 0 && needsLeadingSpacer(entry.role);\n\t\tconst reusable = cached !== undefined && cached.width === width && sameCacheKey(cached.key, key);\n\t\tif (reusable && !this.dirtyEntries.has(entry)) {\n\t\t\tconst cachedSpaced = spaced && leadsWithSpacer(cached.component, cached.body);\n\t\t\treturn cached.spaced === cachedSpaced ? cached : withSpacing(cached, cachedSpaced);\n\t\t}\n\t\tthis.dirtyEntries.delete(entry);\n\t\tconst component = reusable ? cached.component : this.renderEntry(entry);\n\t\tconst body = component.render(width);\n\t\tconst bodyPromptRows: number[] = [];\n\t\tfor (let row = 0; row < body.length; row++) {\n\t\t\tif (isUserPromptRow(body[row] ?? \"\")) bodyPromptRows.push(row);\n\t\t}\n\t\tconst blockSpaced = spaced && leadsWithSpacer(component, body);\n\t\treturn withSpacing(\n\t\t\t{ entry, key, width, component, body, bodyPromptRows, spaced: blockSpaced, lines: [], promptRows: [] },\n\t\t\tblockSpaced,\n\t\t);\n\t}\n\n\t/** Recomputes row offsets, prompt rows and segments from block `from` onward; earlier blocks did not move. */\n\tprivate refreshLayout(from: number): void {\n\t\tconst layout = this.layout;\n\t\tconst blocks = this.blockCache;\n\t\tlet row = from === 0 ? 0 : (layout.starts[from - 1] ?? 0) + (blocks[from - 1]?.lines.length ?? 0);\n\t\tlayout.starts.length = blocks.length;\n\t\tlayout.prompts.length = indexAtOrBefore(layout.prompts, row - 1) + 1;\n\t\tconst segments = layout.segments.slice(0, from);\n\t\tfor (let index = from; index < blocks.length; index++) {\n\t\t\tconst block = blocks[index];\n\t\t\tlayout.starts[index] = row;\n\t\t\tconst rows = block?.lines.length ?? 0;\n\t\t\tif (block !== undefined) {\n\t\t\t\tsegments.push({ id: block.entry, rows });\n\t\t\t\tfor (const promptRow of block.promptRows) layout.prompts.push(row + promptRow);\n\t\t\t}\n\t\t\trow += rows;\n\t\t}\n\t\tlayout.segments = segments;\n\t\tlayout.rowCount = row;\n\t}\n\n\t/**\n\t * Render every entry, recording each one's height as it goes.\n\t *\n\t * The heights are what `rowSegments` reports on this path. They are a\n\t * by-product of work this method already does, so identifying rows costs\n\t * nothing extra and, unlike a cache key, cannot miss an entry mutated in\n\t * place -- which is the behaviour a transcript without a cache key exists to\n\t * provide.\n\t */\n\tprivate renderAllRows(width: number): string[] {\n\t\tconst lines: string[] = [];\n\t\tconst segments: RowWindowSegment[] = [];\n\t\tconst nextComponents: Component[] = [];\n\t\ttry {\n\t\t\tfor (let index = 0; index < this.entries.length; index += 1) {\n\t\t\t\tconst entry = this.entries[index];\n\t\t\t\tif (entry === undefined) continue;\n\t\t\t\tconst component = this.renderEntry(entry);\n\t\t\t\tnextComponents.push(component);\n\t\t\t\tconst block = this.renderEntryBlock(component, entry, index, width);\n\t\t\t\tsegments.push({ id: entry, rows: block.length });\n\t\t\t\tfor (const line of block) lines.push(line);\n\t\t\t}\n\t\t} finally {\n\t\t\tconst retained = new Set(nextComponents);\n\t\t\tfor (const component of new Set(this.staticComponents)) {\n\t\t\t\tif (!retained.has(component)) disposeComponent(component);\n\t\t\t}\n\t\t\tthis.staticComponents = nextComponents;\n\t\t}\n\t\tthis.staticSegments = segments;\n\t\tthis.staticSegmentsWidth = width;\n\t\treturn lines;\n\t}\n\n\tprivate renderEntryBlock(component: Component, entry: TEntry, index: number, width: number): string[] {\n\t\tconst rendered = component.render(width);\n\t\tif (rendered.length === 0) return [];\n\t\tconst lines: string[] = [];\n\t\tif (index > 0 && needsLeadingSpacer(entry.role) && !ownsLeadingSpacer(component)) lines.push(\"\");\n\t\tfor (const line of rendered) lines.push(line);\n\t\treturn lines;\n\t}\n}\n\nfunction indexAtOrBefore(sorted: readonly number[], target: number): number {\n\tlet low = 0;\n\tlet high = sorted.length;\n\twhile (low < high) {\n\t\tconst middle = Math.floor((low + high) / 2);\n\t\tif ((sorted[middle] ?? 0) <= target) low = middle + 1;\n\t\telse high = middle;\n\t}\n\treturn low - 1;\n}\n\nfunction sameEntries<TEntry extends ChatTranscriptEntryLike>(\n\tblocks: ReadonlyArray<CachedChatTranscriptBlock<TEntry> | undefined>,\n\tentries: readonly TEntry[],\n): boolean {\n\tif (blocks.length !== entries.length) return false;\n\tfor (let index = 0; index < entries.length; index++) if (blocks[index]?.entry !== entries[index]) return false;\n\treturn true;\n}\n\nfunction sameCacheKey(left: ChatTranscriptCacheKeyValue, right: ChatTranscriptCacheKeyValue): boolean {\n\tif (left === right) return true;\n\tif (typeof left === \"string\" || typeof right === \"string\" || left.length !== right.length) return false;\n\tfor (let index = 0; index < left.length; index++) if (!Object.is(left[index], right[index])) return false;\n\treturn true;\n}\n\n/** The block's rows at its position: one blank row ahead of a user-like entry that is not the first. */\nfunction withSpacing<TEntry extends ChatTranscriptEntryLike>(\n\tblock: CachedChatTranscriptBlock<TEntry>,\n\tspaced: boolean,\n): CachedChatTranscriptBlock<TEntry> {\n\treturn {\n\t\t...block,\n\t\tspaced,\n\t\tlines: spaced ? [\"\", ...block.body] : block.body,\n\t\tpromptRows: spaced ? block.bodyPromptRows.map((row) => row + 1) : block.bodyPromptRows,\n\t};\n}\n\nfunction leadsWithSpacer(component: Component, body: readonly string[]): boolean {\n\treturn body.length > 0 && !ownsLeadingSpacer(component);\n}\n\n/** Alt+wheel moves this many wheel steps at once, as the main transcript does. */\nexport const ALT_WHEEL_SCROLL_MULTIPLIER = 5;\n/** How long an `\"auto\"` scrollbar stays visible after the last scroll. */\nexport const SCROLLBAR_HIDE_DELAY_MS = 1000;\nconst OSC133_PROMPT_START = /^\\x1b\\]133;A(?:;[^\\x07\\x1b]*)?(?:\\x07|\\x1b\\\\)/;\nconst SCROLLBAR_THUMB = \"┃\";\nconst SCROLLBAR_TRACK = \"│\";\nconst SCROLLBAR_CELL_RESET = \"\\x1b[0m\\x1b]8;;\\x07\";\nconst PINNED_PROMPT_SCAN_ROWS = 64;\nconst MAX_PINNED_PROMPT_SCAN_ROWS = 16_384;\n\n/** Settings and hooks of a {@link ScrollableComponentViewport}; every member is optional. */\nexport interface ScrollableComponentViewportOptions {\n\t/** Rows per wheel event, or `\"auto\"` to follow wheel velocity (`fullscreenWheelScrollLines`). Default `\"auto\"`. */\n\treadonly wheelScrollLines?: () => WheelScrollLines | undefined;\n\t/** Scrollbar display (`fullscreenScrollbar`). Default `\"hidden\"`. */\n\treadonly scrollbar?: () => ScrollViewScrollbar | undefined;\n\t/** Painted in the last row while the viewport is scrolled away from its live end. */\n\treadonly followIndicator?: Pick<Component, \"render\">;\n\treadonly pinnedPrompt?: (promptRow: string) => string;\n\treadonly observeFollowing?: (following: boolean) => void;\n\t/** Asked to repaint when an `\"auto\"` scrollbar hides. */\n\treadonly requestRender?: () => void;\n\t/** Called after a render whose first row lies within one viewport of the top. */\n\treadonly onNearTop?: () => void;\n\t/** Milliseconds, for wheel velocity and the `\"auto\"` scrollbar. Default `performance.now()`. */\n\treadonly now?: () => number;\n\t/** Whether `\"auto\"` wheel scrolling accelerates; by default only where the terminal does not already. */\n\treadonly accelerateWheel?: boolean;\n\treadonly scrollbarThumbStyle?: (text: string) => string;\n\treadonly scrollbarTrackStyle?: (text: string) => string;\n}\n\nexport interface WheelReport {\n\treadonly direction: -1 | 1;\n\treadonly alt: boolean;\n}\n\n/**\n * Sticky-bottom, scrollable viewport for chat-like component stacks.\n *\n * Pi's main interactive chat gets terminal scrollback for free. Extension\n * overlays render into a fixed rectangle, so they need an explicit viewport\n * with the same sticky-bottom default plus keyboard and mouse history controls.\n */\nexport class ScrollableComponentViewport implements Component {\n\tprivate components: readonly Component[] = [];\n\tprivate visibleRows = 1;\n\tprivate scrollFromBottom = 0;\n\tprivate lastLineCount = 0;\n\tprivate lastComponentSegments: readonly (readonly RowWindowSegment[] | undefined)[] = [];\n\tprivate lastComponentRowCounts: readonly number[] = [];\n\tprivate lastWidth = 0;\n\t/** Where the last frame drew content: its first stack row, and the frame rows the pinned prompt took above it. */\n\tprivate lastPaint: { readonly start: number; readonly pinRows: number; readonly contentRows: number } | undefined;\n\tprivate maxScroll = 0;\n\t/**\n\t * Absolute row `scrollTo` asked for, still waiting for the render that can\n\t * honour it. See `scrollTo` for why the request has to outlive the call.\n\t */\n\tprivate pendingScrollRow: number | undefined;\n\t/** Ctrl+Home holds the first row of content taller than the view, also while earlier history loads, until another scroll. */\n\tprivate pinnedToTop = false;\n\tprivate readonly keybindings: Pick<KeybindingsManager, \"matches\"> | undefined;\n\tprivate readonly options: ScrollableComponentViewportOptions;\n\tprivate readonly wheel: WheelScrollAccelerator;\n\tprivate wheelLines: WheelScrollLines = \"auto\";\n\tprivate lastScrollAt = Number.NEGATIVE_INFINITY;\n\tprivate scrollbarHideTimer: ReturnType<typeof setTimeout> | undefined;\n\n\tconstructor(keybindings?: unknown, options: ScrollableComponentViewportOptions = {}) {\n\t\tconst candidate = keybindings as Partial<Pick<KeybindingsManager, \"matches\">> | undefined;\n\t\tthis.keybindings =\n\t\t\ttypeof candidate?.matches === \"function\" ? (candidate as Pick<KeybindingsManager, \"matches\">) : undefined;\n\t\tthis.options = options;\n\t\tthis.wheel = new WheelScrollAccelerator(this.wheelLines, options.accelerateWheel);\n\t}\n\n\tsetComponents(components: readonly Component[]): void {\n\t\tthis.components = components;\n\t}\n\n\tsetVisibleRows(rows: number): void {\n\t\tthis.visibleRows = Math.max(1, Math.floor(rows));\n\t\tthis.clampScroll();\n\t}\n\n\tgetScrollFromBottom(): number {\n\t\treturn this.scrollFromBottom;\n\t}\n\n\tgetMaxScroll(): number {\n\t\treturn this.maxScroll;\n\t}\n\n\tscrollToBottom(): void {\n\t\tconst previous = this.scrollFromBottom;\n\t\tthis.pinnedToTop = false;\n\t\tthis.pendingScrollRow = undefined;\n\t\tthis.scrollFromBottom = 0;\n\t\tthis.noteScroll(previous);\n\t}\n\n\t/** The first row, also of rows a render has not measured yet, such as earlier history that loads later. */\n\tscrollToTop(): void {\n\t\tthis.scrollTo(0);\n\t\tthis.pinnedToTop = true;\n\t}\n\n\tscrollBy(deltaRows: number): void {\n\t\t// Positive deltas move toward newer content; negative deltas move up\n\t\t// into older history. Store the offset from the sticky bottom so new\n\t\t// streaming output can keep following when the offset is zero.\n\t\tconst previous = this.scrollFromBottom;\n\t\tthis.pinnedToTop = false;\n\t\tthis.pendingScrollRow = undefined;\n\t\tthis.scrollFromBottom -= deltaRows;\n\t\tthis.clampScroll();\n\t\tthis.noteScroll(previous);\n\t}\n\n\t/**\n\t * Park the viewport with `row` as its first visible row.\n\t *\n\t * The absolute counterpart of `scrollBy`, for a caller that already knows\n\t * which row it wants on screen.\n\t *\n\t * The request is *also* recorded for the next render, and that is the half\n\t * that matters. `scrollFromBottom` is a distance from the bottom, so the\n\t * row it names moves whenever the stack grows; and the render that follows\n\t * re-derives the offset from the previous frame's layout to hold a\n\t * scrolled-up reader's content still, which would drag this request back\n\t * with it. A caller who has just measured rows the last render never saw\n\t * would otherwise be answered with the old layout's clamp and the old\n\t * frame's anchor. The next render resolves the row against the layout it\n\t * actually paints; any other scroll before then withdraws the request.\n\t */\n\tscrollTo(row: number): void {\n\t\tconst previous = this.scrollFromBottom;\n\t\tconst requestedRow = Number.isNaN(row) ? 0 : Math.max(0, Math.floor(row));\n\t\tthis.pinnedToTop = false;\n\t\tthis.pendingScrollRow = requestedRow;\n\t\tconst target = Math.min(this.maxScroll, requestedRow);\n\t\tthis.scrollFromBottom = this.maxScroll - target;\n\t\tthis.clampScroll();\n\t\tthis.noteScroll(previous);\n\t}\n\n\t/**\n\t * Total rows the component stack occupies at `width`, on and off screen.\n\t *\n\t * This measures rather than paints: it is what lets a search read the whole\n\t * transcript instead of the window the reader happens to be parked on.\n\t */\n\trowCount(width: number): number {\n\t\treturn this.measureComponentRows(this.contentWidth(width)).reduce((sum, rows) => sum + rows.rowCount, 0);\n\t}\n\n\t/**\n\t * Rows `startRow` (inclusive) through `endRow` (exclusive) of the whole\n\t * stack, independent of the current scroll offset. Deliberately not paired\n\t * with `supportsRowWindow`: a viewport is a scroll container rather than a\n\t * windowed component, and an enclosing viewport must keep measuring it by\n\t * its visible height.\n\t */\n\trenderRows(width: number, startRow: number, endRow: number): string[] {\n\t\tconst contentWidth = this.contentWidth(width);\n\t\treturn this.renderVisibleRows(this.measureComponentRows(contentWidth), startRow, endRow);\n\t}\n\n\thandleInput(data: string): boolean {\n\t\tconst wheel = parseWheelReport(data);\n\t\tif (wheel !== undefined) {\n\t\t\tconst lines = this.wheelStep(wheel.direction);\n\t\t\tthis.scrollBy(wheel.direction * (wheel.alt ? lines * ALT_WHEEL_SCROLL_MULTIPLIER : lines));\n\t\t\treturn true;\n\t\t}\n\t\tif (isMouseSequence(data)) return true;\n\t\tif (matchesKey(data, \"pageUp\")) {\n\t\t\tthis.scrollBy(-this.pageSize());\n\t\t\treturn true;\n\t\t}\n\t\tif (matchesKey(data, \"pageDown\")) {\n\t\t\tthis.scrollBy(this.pageSize());\n\t\t\treturn true;\n\t\t}\n\t\tconst keybindings = this.keybindings ?? getKeybindings();\n\t\tif (keybindings.matches(data, \"tui.altScreen.halfPageUp\")) {\n\t\t\tthis.scrollBy(-this.halfPageSize());\n\t\t\treturn true;\n\t\t}\n\t\tif (keybindings.matches(data, \"tui.altScreen.halfPageDown\")) {\n\t\t\tthis.scrollBy(this.halfPageSize());\n\t\t\treturn true;\n\t\t}\n\t\tif (keybindings.matches(data, \"tui.altScreen.previousPrompt\")) {\n\t\t\tthis.scrollToPrompt(-1);\n\t\t\treturn true;\n\t\t}\n\t\tif (keybindings.matches(data, \"tui.altScreen.nextPrompt\")) {\n\t\t\tthis.scrollToPrompt(1);\n\t\t\treturn true;\n\t\t}\n\t\tif (keybindings.matches(data, \"tui.altScreen.top\")) {\n\t\t\tthis.scrollToTop();\n\t\t\treturn true;\n\t\t}\n\t\tif (keybindings.matches(data, \"tui.altScreen.bottom\")) {\n\t\t\tthis.scrollToBottom();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\trender(width: number): string[] {\n\t\tconst scrollbar = this.scrollbarMode();\n\t\tconst contentWidth = this.contentWidth(width, scrollbar);\n\t\tconst componentRows = this.measureComponentRows(contentWidth);\n\t\tconst rowCounts = componentRows.map((rows) => rows.rowCount);\n\t\tconst lineCount = rowCounts.reduce((sum, count) => sum + count, 0);\n\t\tconst maxScroll = Math.max(0, lineCount - this.visibleRows);\n\t\t// The offset is a distance from the bottom, so the first visible row is\n\t\t// `maxScroll - scrollFromBottom`. Rows appearing or disappearing move the\n\t\t// content a scrolled-up viewer is reading unless the offset moves with\n\t\t// them -- a live subagent widget does exactly that every time it gains or\n\t\t// drops its current-tool row.\n\t\t//\n\t\t// Which way the offset must move depends on where the rows changed, so a\n\t\t// plain `scrollFromBottom += lineCount - lastLineCount` is wrong half the\n\t\t// time. Rows changing *below* the anchor need the offset adjusted by that\n\t\t// delta; rows changing *above* it need the offset left alone, because the\n\t\t// bottom-relative distance to the anchored content did not change. Anchor\n\t\t// on the row the viewer is actually reading and re-derive the offset from\n\t\t// it. A viewer already at the bottom keeps scrollFromBottom === 0 and is\n\t\t// skipped entirely, so sticky-bottom following is untouched.\n\t\t//\n\t\t// Per-component row counts alone cannot place a change that happens\n\t\t// inside the component holding the anchor -- and in the chat host the\n\t\t// whole transcript is one component, so that is the normal case. A\n\t\t// component that can hand over a row map turns the \"where\" question into\n\t\t// \"where did the anchored segment go\". Both kinds may supply one: a\n\t\t// transcript built without a cache key is not windowed, but it is still\n\t\t// one component spanning the anchor and still knows its own rows.\n\t\tconst segments = componentRows.map((rows) => rows.segments);\n\t\t// Content that fits on one screen has no top to hold: Ctrl+Home there keeps following, as the main transcript does.\n\t\tif (maxScroll === 0) this.pinnedToTop = false;\n\t\tconst pendingScrollRow = this.pinnedToTop ? 0 : this.pendingScrollRow;\n\t\tthis.pendingScrollRow = undefined;\n\t\tif (pendingScrollRow !== undefined) {\n\t\t\t// An absolute request outranks the anchor: the caller measured this\n\t\t\t// frame's rows and named one of them. Re-deriving the anchor here\n\t\t\t// would answer with the previous frame's layout instead.\n\t\t\tthis.scrollFromBottom = maxScroll - Math.min(maxScroll, pendingScrollRow);\n\t\t} else if (this.scrollFromBottom > 0 && this.lastWidth === contentWidth) {\n\t\t\t// The row the reader had at the top in the last frame, so a change of height keeps it there.\n\t\t\tconst anchorRow = Math.max(0, this.maxScroll - this.scrollFromBottom);\n\t\t\tconst shift = rowsShiftedAboveAnchor(\n\t\t\t\t{ rowCounts: this.lastComponentRowCounts, segments: this.lastComponentSegments },\n\t\t\t\t{ rowCounts, segments },\n\t\t\t\tanchorRow,\n\t\t\t);\n\t\t\tconst nextAnchorRow = Math.max(0, Math.min(maxScroll, anchorRow + shift));\n\t\t\tthis.scrollFromBottom = maxScroll - nextAnchorRow;\n\t\t}\n\t\tthis.lastLineCount = lineCount;\n\t\tthis.lastComponentRowCounts = rowCounts;\n\t\tthis.lastComponentSegments = segments;\n\t\tthis.lastWidth = contentWidth;\n\t\tthis.maxScroll = maxScroll;\n\t\tthis.clampScroll();\n\n\t\tthis.options.observeFollowing?.(this.scrollFromBottom === 0);\n\t\tconst start = Math.max(0, maxScroll - this.scrollFromBottom);\n\t\tconst indicator =\n\t\t\tthis.scrollFromBottom > 0 && this.visibleRows > 1\n\t\t\t\t? (this.options.followIndicator?.render(width).slice(0, 1) ?? [])\n\t\t\t\t: [];\n\t\tconst pinned =\n\t\t\tthis.scrollFromBottom > 0 && start > 0 && this.visibleRows - indicator.length > 2\n\t\t\t\t? this.pinnedPromptRow(componentRows, start)\n\t\t\t\t: undefined;\n\t\tconst pin = pinned === undefined ? [] : [truncateToWidth(pinned, contentWidth, \"\")];\n\t\tconst contentRows = this.visibleRows - indicator.length - pin.length;\n\t\tthis.lastPaint = { start, pinRows: pin.length, contentRows };\n\t\tconst visible = [\n\t\t\t...pin,\n\t\t\t...this.renderVisibleRows(componentRows, start, start + contentRows).map(withoutTerminalControl),\n\t\t];\n\t\twhile (visible.length < contentRows + pin.length) visible.push(\" \".repeat(contentWidth));\n\t\tconst painted = this.paintScrollbar(visible, width, scrollbar, { lineCount, start, maxScroll });\n\t\tif (start < this.visibleRows) this.options.onNearTop?.();\n\t\treturn [...painted, ...indicator];\n\t}\n\n\t/**\n\t * The component the last frame drew on frame row `row`, the row inside that component, and the width it was laid\n\t * out at. Undefined for the pinned prompt row, the jump-to-latest row and rows past the content.\n\t */\n\tcomponentAtRow(\n\t\trow: number,\n\t): { readonly component: Component; readonly row: number; readonly width: number } | undefined {\n\t\tconst paint = this.lastPaint;\n\t\tif (paint === undefined) return undefined;\n\t\tconst contentRow = row - paint.pinRows;\n\t\tif (contentRow < 0 || contentRow >= paint.contentRows) return undefined;\n\t\tlet stackRow = paint.start + contentRow;\n\t\tfor (let index = 0; index < this.lastComponentRowCounts.length; index++) {\n\t\t\tconst rows = this.lastComponentRowCounts[index] ?? 0;\n\t\t\tconst component = this.components[index];\n\t\t\tif (stackRow < rows)\n\t\t\t\treturn component === undefined ? undefined : { component, row: stackRow, width: this.lastWidth };\n\t\t\tstackRow -= rows;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t/** The first stack row the last frame drew, for holding the view where it is. */\n\tfirstVisibleRow(): number | undefined {\n\t\treturn this.lastPaint?.start;\n\t}\n\n\t/** Stops the timer that hides an `\"auto\"` scrollbar. */\n\tdispose(): void {\n\t\tclearTimeout(this.scrollbarHideTimer);\n\t\tthis.scrollbarHideTimer = undefined;\n\t}\n\n\tinvalidate(): void {\n\t\tfor (const component of this.components) component.invalidate();\n\t}\n\n\tprivate measureComponentRows(width: number): ComponentRows[] {\n\t\treturn this.components.map((component) => {\n\t\t\tif (isRowWindowComponent(component)) {\n\t\t\t\tconst measured = component.measureRows?.(width);\n\t\t\t\treturn {\n\t\t\t\t\tkind: \"windowed\",\n\t\t\t\t\trenderRows: measured?.renderRows ?? ((start, end) => component.renderRows(width, start, end)),\n\t\t\t\t\tfindUserPromptRow: measured?.findUserPromptRow,\n\t\t\t\t\trowCount: measured?.rowCount ?? component.rowCount(width),\n\t\t\t\t\tsegments: measured?.segments ?? component.rowSegments?.(width),\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst lines = component.render(width);\n\t\t\t// Read segments only after rendering: a static transcript records its\n\t\t\t// per-entry heights as a by-product of that render, so asking first\n\t\t\t// would return the previous frame's layout.\n\t\t\tconst segments = segmentReporter(component)?.rowSegments(width);\n\t\t\treturn {\n\t\t\t\tkind: \"static\",\n\t\t\t\tlines,\n\t\t\t\trowCount: lines.length,\n\t\t\t\tsegments: segments !== undefined && segments.length > 0 ? segments : undefined,\n\t\t\t};\n\t\t});\n\t}\n\n\tprivate renderVisibleRows(componentRows: readonly ComponentRows[], startRow: number, endRow: number): string[] {\n\t\tconst lines: string[] = [];\n\t\tlet cursor = 0;\n\t\tfor (const rows of componentRows) {\n\t\t\tconst componentStart = cursor;\n\t\t\tconst componentEnd = componentStart + rows.rowCount;\n\t\t\tif (componentEnd > startRow && componentStart < endRow) {\n\t\t\t\tconst localStart = Math.max(0, startRow - componentStart);\n\t\t\t\tconst localEnd = Math.min(rows.rowCount, endRow - componentStart);\n\t\t\t\tconst selected =\n\t\t\t\t\trows.kind === \"windowed\"\n\t\t\t\t\t\t? rows.renderRows(localStart, localEnd)\n\t\t\t\t\t\t: rows.lines.slice(localStart, localEnd);\n\t\t\t\tfor (const line of selected) lines.push(line);\n\t\t\t}\n\t\t\tcursor = componentEnd;\n\t\t\tif (cursor >= endRow) break;\n\t\t}\n\t\treturn lines;\n\t}\n\n\tprivate pageSize(): number {\n\t\treturn Math.max(4, this.visibleRows - 2);\n\t}\n\n\tprivate halfPageSize(): number {\n\t\treturn Math.max(1, Math.floor(this.visibleRows / 2));\n\t}\n\n\tprivate clampScroll(): void {\n\t\tthis.scrollFromBottom = Math.max(0, Math.min(this.maxScroll, this.scrollFromBottom));\n\t}\n\n\tprivate now(): number {\n\t\treturn this.options.now?.() ?? performance.now();\n\t}\n\n\tprivate wheelStep(direction: -1 | 1): number {\n\t\tconst lines = this.options.wheelScrollLines?.() ?? \"auto\";\n\t\tif (lines !== this.wheelLines) {\n\t\t\tthis.wheelLines = lines;\n\t\t\tthis.wheel.setLines(lines);\n\t\t}\n\t\treturn this.wheel.next(direction, this.now());\n\t}\n\n\tprivate scrollbarMode(): ScrollViewScrollbar {\n\t\treturn this.options.scrollbar?.() ?? \"hidden\";\n\t}\n\n\t/** `\"always\"` keeps the rightmost column for the scrollbar; the other modes paint over content. */\n\tprivate contentWidth(width: number, scrollbar = this.scrollbarMode()): number {\n\t\treturn scrollbar === \"always\" && width > 1 ? width - 1 : width;\n\t}\n\n\t/** Shows an `\"auto\"` scrollbar for {@link SCROLLBAR_HIDE_DELAY_MS} after the position actually changed. */\n\tprivate noteScroll(previousScrollFromBottom: number): void {\n\t\tif (this.scrollFromBottom === previousScrollFromBottom && this.pendingScrollRow === undefined) return;\n\t\tthis.lastScrollAt = this.now();\n\t\tif (this.scrollbarMode() !== \"auto\" || this.options.requestRender === undefined) return;\n\t\tclearTimeout(this.scrollbarHideTimer);\n\t\tthis.scrollbarHideTimer = setTimeout(() => {\n\t\t\tthis.scrollbarHideTimer = undefined;\n\t\t\tthis.options.requestRender?.();\n\t\t}, SCROLLBAR_HIDE_DELAY_MS);\n\t\tthis.scrollbarHideTimer.unref?.();\n\t}\n\n\tprivate scrollbarVisible(scrollbar: ScrollViewScrollbar, lineCount: number, trackRows: number): boolean {\n\t\tif (scrollbar === \"always\") return trackRows > 0;\n\t\treturn scrollbar === \"auto\" && lineCount > trackRows && this.now() - this.lastScrollAt < SCROLLBAR_HIDE_DELAY_MS;\n\t}\n\n\t/** The thumb geometry follows the main transcript's scrollbar: proportional, at least two rows. */\n\tprivate paintScrollbar(\n\t\trows: readonly string[],\n\t\twidth: number,\n\t\tscrollbar: ScrollViewScrollbar,\n\t\tposition: { readonly lineCount: number; readonly start: number; readonly maxScroll: number },\n\t): string[] {\n\t\tconst track = rows.length;\n\t\tif (width < 2 || !this.scrollbarVisible(scrollbar, position.lineCount, track)) return [...rows];\n\t\tconst thumbHeight = Math.max(\n\t\t\tMath.min(2, track),\n\t\t\tMath.min(track, Math.round((track * track) / Math.max(1, position.lineCount))),\n\t\t);\n\t\tconst thumbTop =\n\t\t\tposition.maxScroll === 0 ? 0 : Math.round((position.start / position.maxScroll) * (track - thumbHeight));\n\t\t// The default colors are off with NO_COLOR or FORCE_COLOR=0; the viewport may paint before any theme loads.\n\t\tconst plain = colorEnvironment().off;\n\t\tconst thumbStyle =\n\t\t\tthis.options.scrollbarThumbStyle ?? ((text: string) => (plain ? text : `\\x1b[37m${text}\\x1b[39m`));\n\t\tconst trackStyle =\n\t\t\tthis.options.scrollbarTrackStyle ?? ((text: string) => (plain ? text : `\\x1b[90m${text}\\x1b[39m`));\n\t\tconst cellWidth = width - 1;\n\t\treturn rows.map((row, index) => {\n\t\t\tconst cell = truncateToWidth(row, cellWidth, \"\");\n\t\t\tconst padding = \" \".repeat(Math.max(0, cellWidth - visibleWidth(cell)));\n\t\t\tconst thumb = index >= thumbTop && index < thumbTop + thumbHeight;\n\t\t\treturn `${cell}${padding}${SCROLLBAR_CELL_RESET}${thumb ? thumbStyle(SCROLLBAR_THUMB) : trackStyle(SCROLLBAR_TRACK)}`;\n\t\t});\n\t}\n\n\tprivate pinnedPromptRow(componentRows: ComponentRows[], start: number): string | undefined {\n\t\tconst style = this.options.pinnedPrompt;\n\t\tif (!style) return undefined;\n\t\tconst prompt = this.findUserPromptRow(componentRows, start);\n\t\tif (prompt === undefined) return undefined;\n\t\tlet cursor = prompt;\n\t\tlet windowRows = 1;\n\t\twhile (cursor < start) {\n\t\t\tconst end = Math.min(start, cursor + windowRows);\n\t\t\tconst text = firstPromptTextRow(this.renderVisibleRows(componentRows, cursor, end));\n\t\t\tif (text !== undefined) return style(text);\n\t\t\tcursor = end;\n\t\t\twindowRows = PINNED_PROMPT_SCAN_ROWS;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate findUserPromptRow(componentRows: readonly ComponentRows[], start: number): number | undefined {\n\t\tlet componentEnd = componentRows.reduce((total, rows) => total + rows.rowCount, 0);\n\t\tfor (let index = componentRows.length - 1; index >= 0; index--) {\n\t\t\tconst rows = componentRows[index];\n\t\t\tif (rows === undefined) continue;\n\t\t\tconst componentStart = componentEnd - rows.rowCount;\n\t\t\tcomponentEnd = componentStart;\n\t\t\tif (componentStart > start || rows.rowCount === 0) continue;\n\t\t\tconst last = Math.min(rows.rowCount - 1, start - componentStart);\n\t\t\tif (rows.kind === \"windowed\" && rows.findUserPromptRow !== undefined) {\n\t\t\t\tconst prompt = rows.findUserPromptRow(last);\n\t\t\t\tif (prompt !== undefined) return componentStart + prompt;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (rows.kind === \"static\") {\n\t\t\t\tfor (let row = last; row >= 0; row--) {\n\t\t\t\t\tif (isUserPromptRow(rows.lines[row] ?? \"\")) return componentStart + row;\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tlet windowRows = PINNED_PROMPT_SCAN_ROWS;\n\t\t\tfor (let end = last + 1; end > 0; ) {\n\t\t\t\tconst begin = Math.max(0, end - windowRows);\n\t\t\t\tconst lines = rows.renderRows(begin, end);\n\t\t\t\tfor (let row = lines.length - 1; row >= 0; row--) {\n\t\t\t\t\tif (isUserPromptRow(lines[row] ?? \"\")) return componentStart + begin + row;\n\t\t\t\t}\n\t\t\t\tend = begin;\n\t\t\t\twindowRows = Math.min(MAX_PINNED_PROMPT_SCAN_ROWS, windowRows * 2);\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t/** Parks the nearest semantic prompt (an OSC 133 `A` mark) above or below the first visible row at the top. */\n\tprivate scrollToPrompt(direction: -1 | 1): void {\n\t\tif (this.lastWidth <= 0) return;\n\t\tconst rows = this.renderVisibleRows(this.measureComponentRows(this.lastWidth), 0, this.lastLineCount);\n\t\tconst top = Math.max(0, this.maxScroll - this.scrollFromBottom);\n\t\tfor (let row = top + direction; row >= 0 && row < rows.length; row += direction) {\n\t\t\tif (!OSC133_PROMPT_START.test(rows[row] ?? \"\")) continue;\n\t\t\tthis.scrollTo(row);\n\t\t\treturn;\n\t\t}\n\t}\n}\n\n/** One rendered frame's row layout, as the viewport measured it. */\ninterface ComponentRowLayout {\n\treadonly rowCounts: readonly number[];\n\treadonly segments: readonly (readonly RowWindowSegment[] | undefined)[];\n}\n\n/**\n * Rows gained or lost above `anchorRow`, measured in the previous frame's rows.\n *\n * The anchored row moves down by exactly this many rows, so adding it to the\n * anchor keeps the same content under the viewer.\n *\n * Components entirely above the anchor contribute their whole height delta.\n * The component that *spans* the anchor contributes only what changed above the\n * anchored row, which needs its row map (`rowSegments`); without one it\n * contributes nothing, which is the old behaviour and is right for the\n * append-and-mutate-at-the-tail widgets that have no interior.\n *\n * Row counts are compared positionally over the shared prefix, which is what the\n * chat stacks this viewport drives actually do — they append and mutate at the\n * tail. A component inserted or removed *ahead* of the anchor would be\n * misattributed; the anchor then lands one component off rather than drifting on\n * every frame, and the next user scroll re-establishes it.\n */\nfunction rowsShiftedAboveAnchor(previous: ComponentRowLayout, next: ComponentRowLayout, anchorRow: number): number {\n\tlet cursor = 0;\n\tlet shift = 0;\n\tconst shared = Math.min(previous.rowCounts.length, next.rowCounts.length);\n\tfor (let index = 0; index < shared; index += 1) {\n\t\tconst previousRows = previous.rowCounts[index] ?? 0;\n\t\tconst componentEnd = cursor + previousRows;\n\t\tif (componentEnd > anchorRow) {\n\t\t\treturn shift + rowsShiftedInsideComponent(previous.segments[index], next.segments[index], anchorRow - cursor);\n\t\t}\n\t\tshift += (next.rowCounts[index] ?? 0) - previousRows;\n\t\tcursor = componentEnd;\n\t}\n\treturn shift;\n}\n\n/**\n * Rows gained or lost above `anchorRow` *within* one windowed component.\n *\n * Rather than diffing heights, this finds the segment the viewer is parked on\n * and reports how far that same segment moved. Segments are matched by `===` on\n * their id, so a transcript splice that renumbers every cache key still lines\n * up: the entry objects survive it. If the anchored segment itself is gone\n * (the viewer was reading rows that were compacted away) the nearest surviving\n * neighbour above it — then below it — stands in, so the viewer lands on the\n * closest content that still exists instead of drifting by the whole delta.\n */\nfunction rowsShiftedInsideComponent(\n\tpreviousSegments: readonly RowWindowSegment[] | undefined,\n\tnextSegments: readonly RowWindowSegment[] | undefined,\n\tanchorRow: number,\n): number {\n\tif (previousSegments === undefined || nextSegments === undefined) return 0;\n\tconst nextStarts = new Map<unknown, number>();\n\tlet cursor = 0;\n\tfor (const segment of nextSegments) {\n\t\tif (!nextStarts.has(segment.id)) nextStarts.set(segment.id, cursor);\n\t\tcursor += segment.rows;\n\t}\n\tconst previousStarts: number[] = [];\n\tlet anchorIndex = -1;\n\tcursor = 0;\n\tfor (let index = 0; index < previousSegments.length; index += 1) {\n\t\tpreviousStarts.push(cursor);\n\t\tcursor += previousSegments[index]?.rows ?? 0;\n\t\tif (anchorIndex < 0 && cursor > anchorRow) anchorIndex = index;\n\t}\n\tif (anchorIndex < 0) return 0;\n\tfor (let index = anchorIndex; index >= 0; index -= 1) {\n\t\tconst nextStart = nextStarts.get(previousSegments[index]?.id);\n\t\tif (nextStart !== undefined) return nextStart - (previousStarts[index] ?? 0);\n\t}\n\tfor (let index = anchorIndex + 1; index < previousSegments.length; index += 1) {\n\t\tconst nextStart = nextStarts.get(previousSegments[index]?.id);\n\t\tif (nextStart !== undefined) return nextStart - (previousStarts[index] ?? 0);\n\t}\n\treturn 0;\n}\n\nfunction isRowWindowComponent(component: Component): component is RowWindowComponent {\n\tconst candidate = component as Partial<RowWindowComponent>;\n\treturn (\n\t\tcandidate.supportsRowWindow === true &&\n\t\ttypeof candidate.rowCount === \"function\" &&\n\t\ttypeof candidate.renderRows === \"function\"\n\t);\n}\n\n/**\n * A component that can identify its own rows without being windowed.\n *\n * `ScrollableChatTranscriptComponent` builds its transcript without a cache key\n * — deliberately, because that is what lets it reflect entries mutated in place\n * — so it is not a `RowWindowComponent` and renders every row each frame. It\n * still knows which entry produced which rows, and it is still the component\n * spanning the anchor, so the anchor needs to ask.\n */\nfunction segmentReporter(\n\tcomponent: Component,\n): { rowSegments(width: number): readonly RowWindowSegment[] } | undefined {\n\tconst candidate = component as Partial<RowWindowComponent>;\n\treturn typeof candidate.rowSegments === \"function\"\n\t\t? (candidate as { rowSegments(width: number): readonly RowWindowSegment[] })\n\t\t: undefined;\n}\n\nexport class ScrollableChatTranscriptComponent<TEntry extends ChatTranscriptEntryLike> implements Component {\n\tprivate readonly viewport = new ScrollableComponentViewport();\n\tprivate readonly transcript: ChatTranscriptComponent<TEntry>;\n\n\tconstructor(entries: readonly TEntry[], renderEntry: ChatTranscriptRenderer<TEntry>) {\n\t\tthis.transcript = new ChatTranscriptComponent(entries, renderEntry);\n\t\tthis.viewport.setComponents([this.transcript]);\n\t}\n\n\tsetVisibleRows(rows: number): void {\n\t\tthis.viewport.setVisibleRows(rows);\n\t}\n\n\thandleInput(data: string): boolean {\n\t\treturn this.viewport.handleInput(data);\n\t}\n\n\trender(width: number): string[] {\n\t\treturn this.viewport.render(width);\n\t}\n\n\tinvalidate(): void {\n\t\tthis.viewport.invalidate();\n\t}\n\n\tgetScrollFromBottom(): number {\n\t\treturn this.viewport.getScrollFromBottom();\n\t}\n\n\tgetMaxScroll(): number {\n\t\treturn this.viewport.getMaxScroll();\n\t}\n\n\tscrollToBottom(): void {\n\t\tthis.viewport.scrollToBottom();\n\t}\n}\n\n/** A vertical wheel report (SGR or legacy X10 encoding), with its direction and whether Alt was held. */\nexport function parseWheelReport(data: string): WheelReport | undefined {\n\tconst sgr = /^\\x1b\\[<(\\d+);\\d+;\\d+M$/.exec(data);\n\tconst code =\n\t\tsgr !== null\n\t\t\t? Number.parseInt(sgr[1] ?? \"\", 10)\n\t\t\t: data.startsWith(\"\\x1b[M\") && data.length >= 6\n\t\t\t\t? data.charCodeAt(3) - 32\n\t\t\t\t: undefined;\n\tif (code === undefined || (code & 64) === 0) return undefined;\n\tconst button = code & 3;\n\tif (button > 1) return undefined;\n\treturn { direction: button === 0 ? -1 : 1, alt: (code & 8) !== 0 };\n}\n\nconst CONTROL_SEQUENCE = /\\x1b\\[[0-?]*[ -/]*[@-~]/g;\nconst CONTROL_CHARACTER = /[\\x00-\\x06\\x08-\\x1a\\x1c-\\x1f\\x7f]/g;\n\n/**\n * A transcript row without the cursor movement, erasing and other control a message may carry: SGR styling,\n * OSC links and prompt marks, and APC images stay. Rows a viewport paints sit inside a fixed rectangle, which\n * anything else would break out of.\n */\nfunction withoutTerminalControl(row: string): string {\n\treturn row\n\t\t.replace(CONTROL_SEQUENCE, (sequence) => (sequence.endsWith(\"m\") ? sequence : \"\"))\n\t\t.replace(CONTROL_CHARACTER, \" \");\n}\n\nfunction firstPromptTextRow(rows: readonly string[]): string | undefined {\n\tfor (const row of rows) {\n\t\tconst text = stripTerminalSequences(row);\n\t\tif (text.trim()) return text;\n\t}\n\treturn undefined;\n}\n\nfunction isMouseSequence(data: string): boolean {\n\treturn /^\\x1b\\[<\\d+;\\d+;\\d+[mM]$/.test(data) || data.startsWith(\"\\x1b[M\");\n}\n"]}
|
|
1
|
+
{"version":3,"file":"chat-transcript.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/chat-transcript.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,cAAc,EAEd,UAAU,EAEV,MAAM,EACN,sBAAsB,EACtB,eAAe,EACf,YAAY,GAEZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EA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xB,MAAM,IAAI,GAAG,sBAAsB,CAAC,GAAG,CAAC,CAAC;QACzC,IAAI,IAAI,CAAC,IAAI,EAAE;YAAE,OAAO,IAAI,CAAC;IAC9B,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,SAAS,eAAe,CAAC,IAAY;IACpC,OAAO,0BAA0B,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;AAC3E,CAAC","sourcesContent":["import {\n\ttype Component,\n\ttype Container,\n\tgetKeybindings,\n\ttype KeybindingsManager,\n\tmatchesKey,\n\ttype ScrollViewScrollbar,\n\tSpacer,\n\tstripTerminalSequences,\n\ttruncateToWidth,\n\tvisibleWidth,\n\ttype WheelScrollLines,\n} from \"@bastani/atomic-tui\";\nimport { colorEnvironment } from \"../theme/color-utils.ts\";\nimport { isUserPromptRow } from \"./jump-to-latest.ts\";\nimport { disposeRenderer as disposeComponent } from \"./renderer-disposal.js\";\nimport { type ClickExpandableBlock, clickUnit, isClickExpandableBlock } from \"./transcript-block-clicks.ts\";\nimport { WheelScrollAccelerator } from \"./wheel-scroll-accelerator.ts\";\n\n/**\n * Roles that participate in pi's chat spacing contract.\n *\n * Assistant turns own their leading whitespace internally, and tool rows attach\n * directly under the assistant/tool-call row they belong to. User-like rows get\n * one blank line when they are not the first row in the transcript.\n */\nexport type ChatTranscriptRole =\n\t| \"assistant\"\n\t| \"thinking\"\n\t| \"tool\"\n\t| \"user\"\n\t| \"custom\"\n\t| \"notice\"\n\t| \"system\"\n\t| \"summary\";\n\nexport interface ChatTranscriptEntryLike {\n\treadonly role: ChatTranscriptRole;\n}\n\nexport type ChatTranscriptRenderer<TEntry extends ChatTranscriptEntryLike> = (entry: TEntry) => Component;\n\n/**\n * What an entry's rendered rows depend on beyond the entry object itself. A string is compared whole; parts are\n * compared one by one with `Object.is`, so a host can name the objects and fields an entry renders from without\n * serializing them on every frame.\n */\nexport type ChatTranscriptCacheKeyValue = string | readonly unknown[];\n\nexport type ChatTranscriptCacheKey<TEntry extends ChatTranscriptEntryLike> = (\n\tentry: TEntry,\n\tindex: number,\n) => ChatTranscriptCacheKeyValue;\n\ninterface CachedChatTranscriptBlock<TEntry extends ChatTranscriptEntryLike> {\n\treadonly entry: TEntry;\n\treadonly key: ChatTranscriptCacheKeyValue;\n\treadonly width: number;\n\treadonly component: Component;\n\t/** The component's own rows, without the leading spacer its position adds. */\n\treadonly body: readonly string[];\n\treadonly bodyPromptRows: readonly number[];\n\treadonly spaced: boolean;\n\treadonly lines: readonly string[];\n\treadonly promptRows: readonly number[];\n}\n\n/** The blocks a transcript drew and their first rows, at the width it drew them. */\ninterface CachedTranscriptPaint<TEntry extends ChatTranscriptEntryLike> {\n\treadonly width: number;\n\treadonly blocks: readonly (CachedChatTranscriptBlock<TEntry> | undefined)[];\n\treadonly starts: readonly number[];\n}\n\n/** Row offsets of every cached block, kept current from the first block that changed onward. */\ninterface TranscriptRowLayout {\n\treadonly starts: number[];\n\treadonly prompts: number[];\n\tsegments: readonly RowWindowSegment[];\n\trowCount: number;\n}\n\n/** `ensureBlockCache` found every block current. */\nconst UNCHANGED = Number.POSITIVE_INFINITY;\n\n/** Stands in for an entry with no block, so blocks keep their positions in a click's sibling list. */\nconst EMPTY_COMPONENT: Component = { render: () => [], invalidate: () => {} };\n\n/**\n * A run of rows inside a windowed component, tagged with the identity of the\n * thing that produced them.\n *\n * `id` is compared with `===` only, and is never rendered. Entry *objects* are\n * the natural id for a transcript: cache keys carry the entry's index and so\n * change for every survivor of a splice, while the entry objects themselves are\n * moved, not rebuilt.\n */\nexport interface RowWindowSegment {\n\treadonly id: unknown;\n\treadonly rows: number;\n}\n\ninterface MeasuredRowWindow {\n\treadonly rowCount: number;\n\treadonly segments?: readonly RowWindowSegment[];\n\trenderRows(start: number, end: number): string[];\n\tfindUserPromptRow?(start: number): number | undefined;\n}\n\ninterface RowWindowComponent extends Component {\n\treadonly supportsRowWindow: true;\n\trowCount(width: number): number;\n\trenderRows(width: number, startRow: number, endRow: number): string[];\n\tmeasureRows?(width: number): MeasuredRowWindow;\n\t/**\n\t * Optional row map, letting the viewport keep a scroll anchor that sits\n\t * *inside* this component when its interior changes height.\n\t */\n\trowSegments?(width: number): readonly RowWindowSegment[];\n}\n\ninterface WindowedComponentRows {\n\treadonly kind: \"windowed\";\n\treadonly renderRows: MeasuredRowWindow[\"renderRows\"];\n\treadonly findUserPromptRow: MeasuredRowWindow[\"findUserPromptRow\"];\n\treadonly rowCount: number;\n\treadonly segments: readonly RowWindowSegment[] | undefined;\n}\n\ninterface StaticComponentRows {\n\treadonly kind: \"static\";\n\treadonly lines: readonly string[];\n\treadonly rowCount: number;\n\t/**\n\t * Present when a static component can still identify its own rows. A\n\t * transcript built without a cache key renders every row each frame rather\n\t * than windowing, but it knows just as well which entry produced which rows,\n\t * and the anchor needs that whenever it is the component spanning the anchor.\n\t */\n\treadonly segments?: readonly RowWindowSegment[] | undefined;\n}\n\ntype ComponentRows = WindowedComponentRows | StaticComponentRows;\n\nexport function addChatTranscriptEntry(container: Container, component: Component, role: ChatTranscriptRole): void {\n\tif (needsLeadingSpacer(role) && container.children.length > 0 && !ownsLeadingSpacer(component)) {\n\t\tcontainer.addChild(new Spacer(1));\n\t}\n\tcontainer.addChild(component);\n}\n\nfunction ownsLeadingSpacer(component: Component): boolean {\n\treturn \"ownsLeadingSpacer\" in component && component.ownsLeadingSpacer === true;\n}\n\nfunction needsLeadingSpacer(role: ChatTranscriptRole): boolean {\n\treturn role === \"user\" || role === \"custom\" || role === \"notice\" || role === \"system\" || role === \"summary\";\n}\n\n/**\n * Reusable pi chat transcript scaffold for extension surfaces.\n *\n * This intentionally mirrors InteractiveMode.addMessageToChat spacing without\n * coupling consumers to a full AgentSession. Extension UIs can bring their own\n * message model while still rendering inside the same Container/Spacer rhythm\n * as the main chat.\n */\nexport class ChatTranscriptComponent<TEntry extends ChatTranscriptEntryLike> implements Component {\n\tprivate readonly entries: readonly TEntry[];\n\tprivate readonly renderEntry: ChatTranscriptRenderer<TEntry>;\n\treadonly supportsRowWindow: boolean;\n\n\tprivate readonly cacheKey: ChatTranscriptCacheKey<TEntry> | undefined;\n\tprivate blockCache: Array<CachedChatTranscriptBlock<TEntry> | undefined> = [];\n\tprivate measuredRows: MeasuredRowWindow | undefined;\n\t/** The blocks and their first rows as last drawn, which a click is resolved against. */\n\tprivate paintedLayout: CachedTranscriptPaint<TEntry> | undefined;\n\tprivate readonly layout: TranscriptRowLayout = { starts: [], prompts: [], segments: [], rowCount: 0 };\n\tprivate dirtyEntries = new WeakSet<TEntry>();\n\tprivate staticComponents: readonly Component[] = [];\n\t/** Per-entry heights recorded by the most recent `renderAllRows`. */\n\tprivate staticSegments: readonly RowWindowSegment[] = [];\n\t/** Width those heights were measured at; they mean nothing at another width. */\n\tprivate staticSegmentsWidth: number | undefined;\n\n\tconstructor(\n\t\tentries: readonly TEntry[],\n\t\trenderEntry: ChatTranscriptRenderer<TEntry>,\n\t\tcacheKey?: ChatTranscriptCacheKey<TEntry>,\n\t) {\n\t\tthis.entries = entries;\n\t\tthis.renderEntry = renderEntry;\n\t\tthis.cacheKey = cacheKey;\n\t\tthis.supportsRowWindow = cacheKey !== undefined;\n\t}\n\n\trender(width: number): string[] {\n\t\tif (!this.supportsRowWindow) return this.renderAllRows(width);\n\t\tconst measured = this.measureRows(width);\n\t\treturn measured.renderRows(0, measured.rowCount);\n\t}\n\n\trowCount(width: number): number {\n\t\tif (!this.supportsRowWindow) return this.renderAllRows(width).length;\n\t\treturn this.measureRows(width).rowCount;\n\t}\n\n\t/**\n\t * One segment per cached entry block, identified by the entry object itself.\n\t */\n\trowSegments(width: number): readonly RowWindowSegment[] {\n\t\tif (!this.supportsRowWindow) {\n\t\t\t// Recorded by the last renderAllRows. The viewport measures a static\n\t\t\t// component by rendering it and only then reads its segments, so this\n\t\t\t// is populated for the frame being measured. A width mismatch means the\n\t\t\t// heights describe a different layout, and reporting them would move the\n\t\t\t// anchor by a stale delta; the caller falls back to whole-component\n\t\t\t// accounting instead.\n\t\t\treturn this.staticSegmentsWidth === width ? this.staticSegments : [];\n\t\t}\n\t\treturn this.measureRows(width).segments ?? [];\n\t}\n\n\trenderRows(width: number, startRow: number, endRow: number): string[] {\n\t\tconst start = Math.max(0, Math.floor(startRow));\n\t\tconst end = Math.max(start, Math.floor(endRow));\n\t\tif (end <= start) return [];\n\t\tif (!this.supportsRowWindow) return this.renderAllRows(width).slice(start, end);\n\t\treturn this.measureRows(width).renderRows(start, end);\n\t}\n\n\t/**\n\t * The row layout of every entry at `width`.\n\t *\n\t * Work per call is proportional to what changed: an entry is rendered again only when it is new, its cache key\n\t * changed, or the width changed, and row offsets are recomputed from the first changed entry onward. Entries that\n\t * only moved (a prepend, a splice) keep their rendered rows.\n\t */\n\tmeasureRows(width: number): MeasuredRowWindow {\n\t\tconst firstChanged = this.ensureBlockCache(width);\n\t\tif (this.measuredRows !== undefined && firstChanged === UNCHANGED) return this.measuredRows;\n\t\tthis.refreshLayout(Math.min(firstChanged, this.blockCache.length));\n\t\tconst { starts, prompts, segments, rowCount } = this.layout;\n\t\tconst blocks = this.blockCache;\n\t\tlet painted: CachedTranscriptPaint<TEntry> | undefined;\n\t\tthis.measuredRows = {\n\t\t\trowCount,\n\t\t\tsegments,\n\t\t\tfindUserPromptRow: (start) => prompts[indexAtOrBefore(prompts, start)],\n\t\t\trenderRows: (start, end) => {\n\t\t\t\t// Drawing these rows is what the reader sees; a click resolves against this layout until the next draw,\n\t\t\t\t// though a search or prompt jump may measure the transcript again before then.\n\t\t\t\tpainted ??= { width, blocks: [...blocks], starts: [...starts] };\n\t\t\t\tthis.paintedLayout = painted;\n\t\t\t\tconst lines: string[] = [];\n\t\t\t\tfor (let index = Math.max(0, indexAtOrBefore(starts, start)); index < blocks.length; index++) {\n\t\t\t\t\tconst block = blocks[index];\n\t\t\t\t\tconst blockStart = starts[index] ?? 0;\n\t\t\t\t\tif (blockStart >= end) break;\n\t\t\t\t\tif (block === undefined) continue;\n\t\t\t\t\tconst localEnd = Math.min(block.lines.length, end - blockStart);\n\t\t\t\t\tfor (let row = Math.max(0, start - blockStart); row < localEnd; row++) {\n\t\t\t\t\t\tlines.push(block.lines[row] ?? \"\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn lines;\n\t\t\t},\n\t\t};\n\t\treturn this.measuredRows;\n\t}\n\n\t/** The entry whose block the last draw at `width` put on row `row`, and the row within that block. */\n\tpaintedEntryAt(width: number, row: number): { readonly entry: TEntry; readonly row: number } | undefined {\n\t\tconst painted = this.paintedLayout;\n\t\tif (!this.supportsRowWindow || row < 0 || painted === undefined || painted.width !== width) return undefined;\n\t\tconst index = indexAtOrBefore(painted.starts, row);\n\t\tconst block = painted.blocks[index];\n\t\tconst start = painted.starts[index] ?? 0;\n\t\tif (block === undefined || row - start >= block.lines.length) return undefined;\n\t\treturn { entry: block.entry, row: row - start };\n\t}\n\n\t/**\n\t * The entries whose blocks a single click on row `row` of the transcript, as last laid out at `width`, expands or\n\t * collapses, and those blocks as drawn. Undefined unless the row is one a block draws; only a windowed transcript,\n\t * one built with a cache key, can tell.\n\t */\n\tclickedEntries(\n\t\twidth: number,\n\t\trow: number,\n\t):\n\t\t| {\n\t\t\t\treadonly target: TEntry;\n\t\t\t\treadonly entries: readonly TEntry[];\n\t\t\t\treadonly blocks: readonly ClickExpandableBlock[];\n\t\t }\n\t\t| undefined {\n\t\tconst painted = this.paintedLayout;\n\t\tif (!this.supportsRowWindow || row < 0 || painted === undefined || painted.width !== width) return undefined;\n\t\t// The rows as last drawn, which is what the reader saw: entries that arrived since are not drawn yet.\n\t\tconst blocks = painted.blocks;\n\t\tconst index = indexAtOrBefore(painted.starts, row);\n\t\tconst block = blocks[index];\n\t\tif (block === undefined) return undefined;\n\t\tconst bodyRow = row - (painted.starts[index] ?? 0) - (block.spaced ? 1 : 0);\n\t\tif (bodyRow < 0 || bodyRow >= block.body.length) return undefined;\n\t\tif (!isClickExpandableBlock(block.component)) return undefined;\n\t\tconst area = block.component.clickArea(width);\n\t\tif (!area || bodyRow < area.start || bodyRow >= area.end) return undefined;\n\t\treturn this.clickGroupAt(blocks, index);\n\t}\n\n\t/** The target's current group and data, at the width of the body that will expand. */\n\tcurrentClickGroup(width: number, entry: TEntry) {\n\t\tthis.measureRows(width);\n\t\treturn this.clickGroupAt(this.blockCache, this.entries.indexOf(entry));\n\t}\n\n\tprivate clickGroupAt(blocks: readonly (CachedChatTranscriptBlock<TEntry> | undefined)[], index: number) {\n\t\tconst target = blocks[index]?.entry;\n\t\tif (target === undefined) return undefined;\n\t\tconst components = blocks.map((candidate) => candidate?.component ?? EMPTY_COMPONENT);\n\t\tconst unit = clickUnit(components, index);\n\t\tif (unit === undefined) return undefined;\n\t\tconst entryOf = new Map<Component, TEntry>();\n\t\tfor (const candidate of blocks) if (candidate !== undefined) entryOf.set(candidate.component, candidate.entry);\n\t\tconst entries = unit.flatMap((component) => {\n\t\t\tconst entry = entryOf.get(component);\n\t\t\treturn entry === undefined ? [] : [entry];\n\t\t});\n\t\treturn { target, entries, blocks: unit };\n\t}\n\n\trequestEntryRender(entry: TEntry): void {\n\t\tthis.dirtyEntries.add(entry);\n\t\tthis.measuredRows = undefined;\n\t}\n\n\tinvalidate(): void {\n\t\tfor (const block of this.blockCache) disposeComponent(block?.component);\n\t\tfor (const component of new Set(this.staticComponents)) disposeComponent(component);\n\t\tthis.blockCache = [];\n\t\tthis.staticComponents = [];\n\t\tthis.dirtyEntries = new WeakSet<TEntry>();\n\t\tthis.measuredRows = undefined;\n\t\tthis.paintedLayout = undefined;\n\t}\n\n\t/**\n\t * Brings every block up to date. Returns the index of the first block whose rows or position may have changed,\n\t * or `UNCHANGED`.\n\t */\n\tprivate ensureBlockCache(width: number): number {\n\t\tconst entries = this.entries;\n\t\tconst previous = this.blockCache;\n\t\tif (sameEntries(previous, entries)) {\n\t\t\tlet firstChanged = UNCHANGED;\n\t\t\tfor (let index = 0; index < entries.length; index++) {\n\t\t\t\tconst cached = previous[index];\n\t\t\t\tconst block = this.currentBlock(entries[index], index, width, cached);\n\t\t\t\tif (block === cached) continue;\n\t\t\t\tif (cached !== undefined && cached.component !== block?.component) disposeComponent(cached.component);\n\t\t\t\tprevious[index] = block;\n\t\t\t\tfirstChanged = Math.min(firstChanged, index);\n\t\t\t}\n\t\t\treturn firstChanged;\n\t\t}\n\t\t// Entries were added, removed or moved: find each one's block by identity, so a moved entry keeps its rows.\n\t\tconst byEntry = new Map<TEntry, CachedChatTranscriptBlock<TEntry>>();\n\t\tfor (const block of previous) if (block !== undefined) byEntry.set(block.entry, block);\n\t\tconst kept = new Set<Component>();\n\t\tconst next: Array<CachedChatTranscriptBlock<TEntry> | undefined> = [];\n\t\tlet firstChanged = Math.min(previous.length, entries.length);\n\t\tfor (let index = 0; index < entries.length; index++) {\n\t\t\tconst entry = entries[index];\n\t\t\tconst block = this.currentBlock(entry, index, width, entry === undefined ? undefined : byEntry.get(entry));\n\t\t\tif (block !== undefined) kept.add(block.component);\n\t\t\tnext.push(block);\n\t\t\tif (block !== previous[index]) firstChanged = Math.min(firstChanged, index);\n\t\t}\n\t\tfor (const block of previous) {\n\t\t\tif (block !== undefined && !kept.has(block.component)) disposeComponent(block.component);\n\t\t}\n\t\tthis.blockCache = next;\n\t\treturn firstChanged;\n\t}\n\n\t/**\n\t * `cached` while it still shows `entry` at `index`; otherwise the entry's block, rendered again only when its key or\n\t * the width changed. A block whose position alone changed keeps its rendered rows and only gains or loses its\n\t * leading spacer. The caller disposes a replaced component.\n\t */\n\tprivate currentBlock(\n\t\tentry: TEntry | undefined,\n\t\tindex: number,\n\t\twidth: number,\n\t\tcached: CachedChatTranscriptBlock<TEntry> | undefined,\n\t): CachedChatTranscriptBlock<TEntry> | undefined {\n\t\tif (entry === undefined) return undefined;\n\t\tconst key = this.cacheKey?.(entry, index) ?? `${index}:${entry.role}`;\n\t\tconst spaced = index > 0 && needsLeadingSpacer(entry.role);\n\t\tconst reusable = cached !== undefined && cached.width === width && sameCacheKey(cached.key, key);\n\t\tif (reusable && !this.dirtyEntries.has(entry)) {\n\t\t\tconst cachedSpaced = spaced && leadsWithSpacer(cached.component, cached.body);\n\t\t\treturn cached.spaced === cachedSpaced ? cached : withSpacing(cached, cachedSpaced);\n\t\t}\n\t\tthis.dirtyEntries.delete(entry);\n\t\tconst component = reusable ? cached.component : this.renderEntry(entry);\n\t\tconst body = component.render(width);\n\t\tconst bodyPromptRows: number[] = [];\n\t\tfor (let row = 0; row < body.length; row++) {\n\t\t\tif (isUserPromptRow(body[row] ?? \"\")) bodyPromptRows.push(row);\n\t\t}\n\t\tconst blockSpaced = spaced && leadsWithSpacer(component, body);\n\t\treturn withSpacing(\n\t\t\t{ entry, key, width, component, body, bodyPromptRows, spaced: blockSpaced, lines: [], promptRows: [] },\n\t\t\tblockSpaced,\n\t\t);\n\t}\n\n\t/** Recomputes row offsets, prompt rows and segments from block `from` onward; earlier blocks did not move. */\n\tprivate refreshLayout(from: number): void {\n\t\tconst layout = this.layout;\n\t\tconst blocks = this.blockCache;\n\t\tlet row = from === 0 ? 0 : (layout.starts[from - 1] ?? 0) + (blocks[from - 1]?.lines.length ?? 0);\n\t\tlayout.starts.length = blocks.length;\n\t\tlayout.prompts.length = indexAtOrBefore(layout.prompts, row - 1) + 1;\n\t\tconst segments = layout.segments.slice(0, from);\n\t\tfor (let index = from; index < blocks.length; index++) {\n\t\t\tconst block = blocks[index];\n\t\t\tlayout.starts[index] = row;\n\t\t\tconst rows = block?.lines.length ?? 0;\n\t\t\tif (block !== undefined) {\n\t\t\t\tsegments.push({ id: block.entry, rows });\n\t\t\t\tfor (const promptRow of block.promptRows) layout.prompts.push(row + promptRow);\n\t\t\t}\n\t\t\trow += rows;\n\t\t}\n\t\tlayout.segments = segments;\n\t\tlayout.rowCount = row;\n\t}\n\n\t/**\n\t * Render every entry, recording each one's height as it goes.\n\t *\n\t * The heights are what `rowSegments` reports on this path. They are a\n\t * by-product of work this method already does, so identifying rows costs\n\t * nothing extra and, unlike a cache key, cannot miss an entry mutated in\n\t * place -- which is the behaviour a transcript without a cache key exists to\n\t * provide.\n\t */\n\tprivate renderAllRows(width: number): string[] {\n\t\tconst lines: string[] = [];\n\t\tconst segments: RowWindowSegment[] = [];\n\t\tconst nextComponents: Component[] = [];\n\t\ttry {\n\t\t\tfor (let index = 0; index < this.entries.length; index += 1) {\n\t\t\t\tconst entry = this.entries[index];\n\t\t\t\tif (entry === undefined) continue;\n\t\t\t\tconst component = this.renderEntry(entry);\n\t\t\t\tnextComponents.push(component);\n\t\t\t\tconst block = this.renderEntryBlock(component, entry, index, width);\n\t\t\t\tsegments.push({ id: entry, rows: block.length });\n\t\t\t\tfor (const line of block) lines.push(line);\n\t\t\t}\n\t\t} finally {\n\t\t\tconst retained = new Set(nextComponents);\n\t\t\tfor (const component of new Set(this.staticComponents)) {\n\t\t\t\tif (!retained.has(component)) disposeComponent(component);\n\t\t\t}\n\t\t\tthis.staticComponents = nextComponents;\n\t\t}\n\t\tthis.staticSegments = segments;\n\t\tthis.staticSegmentsWidth = width;\n\t\treturn lines;\n\t}\n\n\tprivate renderEntryBlock(component: Component, entry: TEntry, index: number, width: number): string[] {\n\t\tconst rendered = component.render(width);\n\t\tif (rendered.length === 0) return [];\n\t\tconst lines: string[] = [];\n\t\tif (index > 0 && needsLeadingSpacer(entry.role) && !ownsLeadingSpacer(component)) lines.push(\"\");\n\t\tfor (const line of rendered) lines.push(line);\n\t\treturn lines;\n\t}\n}\n\nfunction indexAtOrBefore(sorted: readonly number[], target: number): number {\n\tlet low = 0;\n\tlet high = sorted.length;\n\twhile (low < high) {\n\t\tconst middle = Math.floor((low + high) / 2);\n\t\tif ((sorted[middle] ?? 0) <= target) low = middle + 1;\n\t\telse high = middle;\n\t}\n\treturn low - 1;\n}\n\nfunction sameEntries<TEntry extends ChatTranscriptEntryLike>(\n\tblocks: ReadonlyArray<CachedChatTranscriptBlock<TEntry> | undefined>,\n\tentries: readonly TEntry[],\n): boolean {\n\tif (blocks.length !== entries.length) return false;\n\tfor (let index = 0; index < entries.length; index++) if (blocks[index]?.entry !== entries[index]) return false;\n\treturn true;\n}\n\nfunction sameCacheKey(left: ChatTranscriptCacheKeyValue, right: ChatTranscriptCacheKeyValue): boolean {\n\tif (left === right) return true;\n\tif (typeof left === \"string\" || typeof right === \"string\" || left.length !== right.length) return false;\n\tfor (let index = 0; index < left.length; index++) if (!Object.is(left[index], right[index])) return false;\n\treturn true;\n}\n\n/** The block's rows at its position: one blank row ahead of a user-like entry that is not the first. */\nfunction withSpacing<TEntry extends ChatTranscriptEntryLike>(\n\tblock: CachedChatTranscriptBlock<TEntry>,\n\tspaced: boolean,\n): CachedChatTranscriptBlock<TEntry> {\n\treturn {\n\t\t...block,\n\t\tspaced,\n\t\tlines: spaced ? [\"\", ...block.body] : block.body,\n\t\tpromptRows: spaced ? block.bodyPromptRows.map((row) => row + 1) : block.bodyPromptRows,\n\t};\n}\n\nfunction leadsWithSpacer(component: Component, body: readonly string[]): boolean {\n\treturn body.length > 0 && !ownsLeadingSpacer(component);\n}\n\n/** Alt+wheel moves this many wheel steps at once, as the main transcript does. */\nexport const ALT_WHEEL_SCROLL_MULTIPLIER = 5;\n/** How long an `\"auto\"` scrollbar stays visible after the last scroll. */\nexport const SCROLLBAR_HIDE_DELAY_MS = 1000;\nconst OSC133_PROMPT_START = /^\\x1b\\]133;A(?:;[^\\x07\\x1b]*)?(?:\\x07|\\x1b\\\\)/;\nconst SCROLLBAR_THUMB = \"┃\";\nconst SCROLLBAR_TRACK = \"│\";\nconst SCROLLBAR_CELL_RESET = \"\\x1b[0m\\x1b]8;;\\x07\";\nconst PINNED_PROMPT_SCAN_ROWS = 64;\nconst MAX_PINNED_PROMPT_SCAN_ROWS = 16_384;\n\n/** Settings and hooks of a {@link ScrollableComponentViewport}; every member is optional. */\nexport interface ScrollableComponentViewportOptions {\n\t/** Rows per wheel event, or `\"auto\"` to follow wheel velocity (`fullscreenWheelScrollLines`). Default `\"auto\"`. */\n\treadonly wheelScrollLines?: () => WheelScrollLines | undefined;\n\t/** Scrollbar display (`fullscreenScrollbar`). Default `\"hidden\"`. */\n\treadonly scrollbar?: () => ScrollViewScrollbar | undefined;\n\t/** Painted in the last row while the viewport is scrolled away from its live end. */\n\treadonly followIndicator?: Pick<Component, \"render\">;\n\treadonly pinnedPrompt?: (promptRow: string) => string;\n\treadonly observeFollowing?: (following: boolean) => void;\n\t/** Asked to repaint when an `\"auto\"` scrollbar hides. */\n\treadonly requestRender?: () => void;\n\t/** Called after a render whose first row lies within one viewport of the top. */\n\treadonly onNearTop?: () => void;\n\t/** Milliseconds, for wheel velocity and the `\"auto\"` scrollbar. Default `performance.now()`. */\n\treadonly now?: () => number;\n\t/** Whether `\"auto\"` wheel scrolling accelerates; by default only where the terminal does not already. */\n\treadonly accelerateWheel?: boolean;\n\treadonly scrollbarThumbStyle?: (text: string) => string;\n\treadonly scrollbarTrackStyle?: (text: string) => string;\n}\n\nexport interface WheelReport {\n\treadonly direction: -1 | 1;\n\treadonly alt: boolean;\n}\n\n/**\n * Sticky-bottom, scrollable viewport for chat-like component stacks.\n *\n * Pi's main interactive chat gets terminal scrollback for free. Extension\n * overlays render into a fixed rectangle, so they need an explicit viewport\n * with the same sticky-bottom default plus keyboard and mouse history controls.\n */\nexport class ScrollableComponentViewport implements Component {\n\tprivate components: readonly Component[] = [];\n\tprivate visibleRows = 1;\n\tprivate scrollFromBottom = 0;\n\tprivate lastLineCount = 0;\n\tprivate lastComponentSegments: readonly (readonly RowWindowSegment[] | undefined)[] = [];\n\tprivate lastComponentRowCounts: readonly number[] = [];\n\tprivate lastWidth = 0;\n\t/** Where the last frame drew content: its first stack row, and the frame rows the pinned prompt took above it. */\n\tprivate lastPaint: { readonly start: number; readonly pinRows: number; readonly contentRows: number } | undefined;\n\tprivate maxScroll = 0;\n\t/**\n\t * Absolute row `scrollTo` asked for, still waiting for the render that can\n\t * honour it. See `scrollTo` for why the request has to outlive the call.\n\t */\n\tprivate pendingScrollRow: number | undefined;\n\t/** Ctrl+Home holds the first row of content taller than the view, also while earlier history loads, until another scroll. */\n\tprivate pinnedToTop = false;\n\tprivate readonly keybindings: Pick<KeybindingsManager, \"matches\"> | undefined;\n\tprivate readonly options: ScrollableComponentViewportOptions;\n\tprivate readonly wheel: WheelScrollAccelerator;\n\tprivate wheelLines: WheelScrollLines = \"auto\";\n\tprivate lastScrollAt = Number.NEGATIVE_INFINITY;\n\tprivate scrollbarHideTimer: ReturnType<typeof setTimeout> | undefined;\n\n\tconstructor(keybindings?: unknown, options: ScrollableComponentViewportOptions = {}) {\n\t\tconst candidate = keybindings as Partial<Pick<KeybindingsManager, \"matches\">> | undefined;\n\t\tthis.keybindings =\n\t\t\ttypeof candidate?.matches === \"function\" ? (candidate as Pick<KeybindingsManager, \"matches\">) : undefined;\n\t\tthis.options = options;\n\t\tthis.wheel = new WheelScrollAccelerator(this.wheelLines, options.accelerateWheel);\n\t}\n\n\tsetComponents(components: readonly Component[]): void {\n\t\tthis.components = components;\n\t}\n\n\tsetVisibleRows(rows: number): void {\n\t\tthis.visibleRows = Math.max(1, Math.floor(rows));\n\t\tthis.clampScroll();\n\t}\n\n\tgetScrollFromBottom(): number {\n\t\treturn this.scrollFromBottom;\n\t}\n\n\tgetMaxScroll(): number {\n\t\treturn this.maxScroll;\n\t}\n\n\tscrollToBottom(): void {\n\t\tconst previous = this.scrollFromBottom;\n\t\tthis.pinnedToTop = false;\n\t\tthis.pendingScrollRow = undefined;\n\t\tthis.scrollFromBottom = 0;\n\t\tthis.noteScroll(previous);\n\t}\n\n\t/** The first row, also of rows a render has not measured yet, such as earlier history that loads later. */\n\tscrollToTop(): void {\n\t\tthis.scrollTo(0);\n\t\tthis.pinnedToTop = true;\n\t}\n\n\tscrollBy(deltaRows: number): void {\n\t\t// Positive deltas move toward newer content; negative deltas move up\n\t\t// into older history. Store the offset from the sticky bottom so new\n\t\t// streaming output can keep following when the offset is zero.\n\t\tconst previous = this.scrollFromBottom;\n\t\tthis.pinnedToTop = false;\n\t\tthis.pendingScrollRow = undefined;\n\t\tthis.scrollFromBottom -= deltaRows;\n\t\tthis.clampScroll();\n\t\tthis.noteScroll(previous);\n\t}\n\n\t/**\n\t * Park the viewport with `row` as its first visible row.\n\t *\n\t * The absolute counterpart of `scrollBy`, for a caller that already knows\n\t * which row it wants on screen.\n\t *\n\t * The request is *also* recorded for the next render, and that is the half\n\t * that matters. `scrollFromBottom` is a distance from the bottom, so the\n\t * row it names moves whenever the stack grows; and the render that follows\n\t * re-derives the offset from the previous frame's layout to hold a\n\t * scrolled-up reader's content still, which would drag this request back\n\t * with it. A caller who has just measured rows the last render never saw\n\t * would otherwise be answered with the old layout's clamp and the old\n\t * frame's anchor. The next render resolves the row against the layout it\n\t * actually paints; any other scroll before then withdraws the request.\n\t */\n\tscrollTo(row: number): void {\n\t\tconst previous = this.scrollFromBottom;\n\t\tconst requestedRow = Number.isNaN(row) ? 0 : Math.max(0, Math.floor(row));\n\t\tthis.pinnedToTop = false;\n\t\tthis.pendingScrollRow = requestedRow;\n\t\tconst target = Math.min(this.maxScroll, requestedRow);\n\t\tthis.scrollFromBottom = this.maxScroll - target;\n\t\tthis.clampScroll();\n\t\tthis.noteScroll(previous);\n\t}\n\n\t/**\n\t * Total rows the component stack occupies at `width`, on and off screen.\n\t *\n\t * This measures rather than paints: it is what lets a search read the whole\n\t * transcript instead of the window the reader happens to be parked on.\n\t */\n\trowCount(width: number): number {\n\t\treturn this.measureComponentRows(this.contentWidth(width)).reduce((sum, rows) => sum + rows.rowCount, 0);\n\t}\n\n\t/**\n\t * Rows `startRow` (inclusive) through `endRow` (exclusive) of the whole\n\t * stack, independent of the current scroll offset. Deliberately not paired\n\t * with `supportsRowWindow`: a viewport is a scroll container rather than a\n\t * windowed component, and an enclosing viewport must keep measuring it by\n\t * its visible height.\n\t */\n\trenderRows(width: number, startRow: number, endRow: number): string[] {\n\t\tconst contentWidth = this.contentWidth(width);\n\t\treturn this.renderVisibleRows(this.measureComponentRows(contentWidth), startRow, endRow);\n\t}\n\n\thandleInput(data: string): boolean {\n\t\tconst wheel = parseWheelReport(data);\n\t\tif (wheel !== undefined) {\n\t\t\tconst lines = this.wheelStep(wheel.direction);\n\t\t\tthis.scrollBy(wheel.direction * (wheel.alt ? lines * ALT_WHEEL_SCROLL_MULTIPLIER : lines));\n\t\t\treturn true;\n\t\t}\n\t\tif (isMouseSequence(data)) return true;\n\t\tif (matchesKey(data, \"pageUp\")) {\n\t\t\tthis.scrollBy(-this.pageSize());\n\t\t\treturn true;\n\t\t}\n\t\tif (matchesKey(data, \"pageDown\")) {\n\t\t\tthis.scrollBy(this.pageSize());\n\t\t\treturn true;\n\t\t}\n\t\tconst keybindings = this.keybindings ?? getKeybindings();\n\t\tif (keybindings.matches(data, \"tui.altScreen.halfPageUp\")) {\n\t\t\tthis.scrollBy(-this.halfPageSize());\n\t\t\treturn true;\n\t\t}\n\t\tif (keybindings.matches(data, \"tui.altScreen.halfPageDown\")) {\n\t\t\tthis.scrollBy(this.halfPageSize());\n\t\t\treturn true;\n\t\t}\n\t\tif (keybindings.matches(data, \"tui.altScreen.previousPrompt\")) {\n\t\t\tthis.scrollToPrompt(-1);\n\t\t\treturn true;\n\t\t}\n\t\tif (keybindings.matches(data, \"tui.altScreen.nextPrompt\")) {\n\t\t\tthis.scrollToPrompt(1);\n\t\t\treturn true;\n\t\t}\n\t\tif (keybindings.matches(data, \"tui.altScreen.top\")) {\n\t\t\tthis.scrollToTop();\n\t\t\treturn true;\n\t\t}\n\t\tif (keybindings.matches(data, \"tui.altScreen.bottom\")) {\n\t\t\tthis.scrollToBottom();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\trender(width: number): string[] {\n\t\tconst scrollbar = this.scrollbarMode();\n\t\tconst contentWidth = this.contentWidth(width, scrollbar);\n\t\tconst componentRows = this.measureComponentRows(contentWidth);\n\t\tconst rowCounts = componentRows.map((rows) => rows.rowCount);\n\t\tconst lineCount = rowCounts.reduce((sum, count) => sum + count, 0);\n\t\tconst maxScroll = Math.max(0, lineCount - this.visibleRows);\n\t\t// The offset is a distance from the bottom, so the first visible row is\n\t\t// `maxScroll - scrollFromBottom`. Rows appearing or disappearing move the\n\t\t// content a scrolled-up viewer is reading unless the offset moves with\n\t\t// them -- a live subagent widget does exactly that every time it gains or\n\t\t// drops its current-tool row.\n\t\t//\n\t\t// Which way the offset must move depends on where the rows changed, so a\n\t\t// plain `scrollFromBottom += lineCount - lastLineCount` is wrong half the\n\t\t// time. Rows changing *below* the anchor need the offset adjusted by that\n\t\t// delta; rows changing *above* it need the offset left alone, because the\n\t\t// bottom-relative distance to the anchored content did not change. Anchor\n\t\t// on the row the viewer is actually reading and re-derive the offset from\n\t\t// it. A viewer already at the bottom keeps scrollFromBottom === 0 and is\n\t\t// skipped entirely, so sticky-bottom following is untouched.\n\t\t//\n\t\t// Per-component row counts alone cannot place a change that happens\n\t\t// inside the component holding the anchor -- and in the chat host the\n\t\t// whole transcript is one component, so that is the normal case. A\n\t\t// component that can hand over a row map turns the \"where\" question into\n\t\t// \"where did the anchored segment go\". Both kinds may supply one: a\n\t\t// transcript built without a cache key is not windowed, but it is still\n\t\t// one component spanning the anchor and still knows its own rows.\n\t\tconst segments = componentRows.map((rows) => rows.segments);\n\t\t// Content that fits on one screen has no top to hold: Ctrl+Home there keeps following, as the main transcript does.\n\t\tif (maxScroll === 0) this.pinnedToTop = false;\n\t\tconst pendingScrollRow = this.pinnedToTop ? 0 : this.pendingScrollRow;\n\t\tthis.pendingScrollRow = undefined;\n\t\tif (pendingScrollRow !== undefined) {\n\t\t\t// An absolute request outranks the anchor: the caller measured this\n\t\t\t// frame's rows and named one of them. Re-deriving the anchor here\n\t\t\t// would answer with the previous frame's layout instead.\n\t\t\tthis.scrollFromBottom = maxScroll - Math.min(maxScroll, pendingScrollRow);\n\t\t} else if (this.scrollFromBottom > 0 && this.lastWidth === contentWidth) {\n\t\t\t// The row the reader had at the top in the last frame, so a change of height keeps it there.\n\t\t\tconst anchorRow = Math.max(0, this.maxScroll - this.scrollFromBottom);\n\t\t\tconst shift = rowsShiftedAboveAnchor(\n\t\t\t\t{ rowCounts: this.lastComponentRowCounts, segments: this.lastComponentSegments },\n\t\t\t\t{ rowCounts, segments },\n\t\t\t\tanchorRow,\n\t\t\t);\n\t\t\tconst nextAnchorRow = Math.max(0, Math.min(maxScroll, anchorRow + shift));\n\t\t\tthis.scrollFromBottom = maxScroll - nextAnchorRow;\n\t\t}\n\t\tthis.lastLineCount = lineCount;\n\t\tthis.lastComponentRowCounts = rowCounts;\n\t\tthis.lastComponentSegments = segments;\n\t\tthis.lastWidth = contentWidth;\n\t\tthis.maxScroll = maxScroll;\n\t\tthis.clampScroll();\n\n\t\tthis.options.observeFollowing?.(this.scrollFromBottom === 0);\n\t\tconst start = Math.max(0, maxScroll - this.scrollFromBottom);\n\t\tconst indicator =\n\t\t\tthis.scrollFromBottom > 0 && this.visibleRows > 1\n\t\t\t\t? (this.options.followIndicator?.render(width).slice(0, 1) ?? [])\n\t\t\t\t: [];\n\t\tconst pinned =\n\t\t\tthis.scrollFromBottom > 0 && start > 0 && this.visibleRows - indicator.length > 2\n\t\t\t\t? this.pinnedPromptRow(componentRows, start)\n\t\t\t\t: undefined;\n\t\tconst pin = pinned === undefined ? [] : [truncateToWidth(pinned, contentWidth, \"\")];\n\t\tconst contentRows = this.visibleRows - indicator.length - pin.length;\n\t\tthis.lastPaint = { start, pinRows: pin.length, contentRows };\n\t\tconst visible = [\n\t\t\t...pin,\n\t\t\t...this.renderVisibleRows(componentRows, start, start + contentRows).map(withoutTerminalControl),\n\t\t];\n\t\twhile (visible.length < contentRows + pin.length) visible.push(\" \".repeat(contentWidth));\n\t\tconst painted = this.paintScrollbar(visible, width, scrollbar, { lineCount, start, maxScroll });\n\t\tif (start < this.visibleRows) this.options.onNearTop?.();\n\t\treturn [...painted, ...indicator];\n\t}\n\n\t/**\n\t * The component the last frame drew on frame row `row`, the row inside that component, and the width it was laid\n\t * out at. Undefined for the pinned prompt row, the jump-to-latest row and rows past the content.\n\t */\n\tcomponentAtRow(\n\t\trow: number,\n\t): { readonly component: Component; readonly row: number; readonly width: number } | undefined {\n\t\tconst paint = this.lastPaint;\n\t\tif (paint === undefined) return undefined;\n\t\tconst contentRow = row - paint.pinRows;\n\t\tif (contentRow < 0 || contentRow >= paint.contentRows) return undefined;\n\t\tlet stackRow = paint.start + contentRow;\n\t\tfor (let index = 0; index < this.lastComponentRowCounts.length; index++) {\n\t\t\tconst rows = this.lastComponentRowCounts[index] ?? 0;\n\t\t\tconst component = this.components[index];\n\t\t\tif (stackRow < rows)\n\t\t\t\treturn component === undefined ? undefined : { component, row: stackRow, width: this.lastWidth };\n\t\t\tstackRow -= rows;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t/** The content width the last frame gave its transcript, after reserving any scrollbar. */\n\tget paintedContentWidth(): number {\n\t\treturn this.lastWidth;\n\t}\n\n\t/** The first stack row the last frame drew, for holding the view where it is. */\n\tfirstVisibleRow(): number | undefined {\n\t\treturn this.lastPaint?.start;\n\t}\n\n\t/** Stops the timer that hides an `\"auto\"` scrollbar. */\n\tdispose(): void {\n\t\tclearTimeout(this.scrollbarHideTimer);\n\t\tthis.scrollbarHideTimer = undefined;\n\t}\n\n\tinvalidate(): void {\n\t\tfor (const component of this.components) component.invalidate();\n\t}\n\n\tprivate measureComponentRows(width: number): ComponentRows[] {\n\t\treturn this.components.map((component) => {\n\t\t\tif (isRowWindowComponent(component)) {\n\t\t\t\tconst measured = component.measureRows?.(width);\n\t\t\t\treturn {\n\t\t\t\t\tkind: \"windowed\",\n\t\t\t\t\trenderRows: measured?.renderRows ?? ((start, end) => component.renderRows(width, start, end)),\n\t\t\t\t\tfindUserPromptRow: measured?.findUserPromptRow,\n\t\t\t\t\trowCount: measured?.rowCount ?? component.rowCount(width),\n\t\t\t\t\tsegments: measured?.segments ?? component.rowSegments?.(width),\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst lines = component.render(width);\n\t\t\t// Read segments only after rendering: a static transcript records its\n\t\t\t// per-entry heights as a by-product of that render, so asking first\n\t\t\t// would return the previous frame's layout.\n\t\t\tconst segments = segmentReporter(component)?.rowSegments(width);\n\t\t\treturn {\n\t\t\t\tkind: \"static\",\n\t\t\t\tlines,\n\t\t\t\trowCount: lines.length,\n\t\t\t\tsegments: segments !== undefined && segments.length > 0 ? segments : undefined,\n\t\t\t};\n\t\t});\n\t}\n\n\tprivate renderVisibleRows(componentRows: readonly ComponentRows[], startRow: number, endRow: number): string[] {\n\t\tconst lines: string[] = [];\n\t\tlet cursor = 0;\n\t\tfor (const rows of componentRows) {\n\t\t\tconst componentStart = cursor;\n\t\t\tconst componentEnd = componentStart + rows.rowCount;\n\t\t\tif (componentEnd > startRow && componentStart < endRow) {\n\t\t\t\tconst localStart = Math.max(0, startRow - componentStart);\n\t\t\t\tconst localEnd = Math.min(rows.rowCount, endRow - componentStart);\n\t\t\t\tconst selected =\n\t\t\t\t\trows.kind === \"windowed\"\n\t\t\t\t\t\t? rows.renderRows(localStart, localEnd)\n\t\t\t\t\t\t: rows.lines.slice(localStart, localEnd);\n\t\t\t\tfor (const line of selected) lines.push(line);\n\t\t\t}\n\t\t\tcursor = componentEnd;\n\t\t\tif (cursor >= endRow) break;\n\t\t}\n\t\treturn lines;\n\t}\n\n\tprivate pageSize(): number {\n\t\treturn Math.max(4, this.visibleRows - 2);\n\t}\n\n\tprivate halfPageSize(): number {\n\t\treturn Math.max(1, Math.floor(this.visibleRows / 2));\n\t}\n\n\tprivate clampScroll(): void {\n\t\tthis.scrollFromBottom = Math.max(0, Math.min(this.maxScroll, this.scrollFromBottom));\n\t}\n\n\tprivate now(): number {\n\t\treturn this.options.now?.() ?? performance.now();\n\t}\n\n\tprivate wheelStep(direction: -1 | 1): number {\n\t\tconst lines = this.options.wheelScrollLines?.() ?? \"auto\";\n\t\tif (lines !== this.wheelLines) {\n\t\t\tthis.wheelLines = lines;\n\t\t\tthis.wheel.setLines(lines);\n\t\t}\n\t\treturn this.wheel.next(direction, this.now());\n\t}\n\n\tprivate scrollbarMode(): ScrollViewScrollbar {\n\t\treturn this.options.scrollbar?.() ?? \"hidden\";\n\t}\n\n\t/** `\"always\"` keeps the rightmost column for the scrollbar; the other modes paint over content. */\n\tprivate contentWidth(width: number, scrollbar = this.scrollbarMode()): number {\n\t\treturn scrollbar === \"always\" && width > 1 ? width - 1 : width;\n\t}\n\n\t/** Shows an `\"auto\"` scrollbar for {@link SCROLLBAR_HIDE_DELAY_MS} after the position actually changed. */\n\tprivate noteScroll(previousScrollFromBottom: number): void {\n\t\tif (this.scrollFromBottom === previousScrollFromBottom && this.pendingScrollRow === undefined) return;\n\t\tthis.lastScrollAt = this.now();\n\t\tif (this.scrollbarMode() !== \"auto\" || this.options.requestRender === undefined) return;\n\t\tclearTimeout(this.scrollbarHideTimer);\n\t\tthis.scrollbarHideTimer = setTimeout(() => {\n\t\t\tthis.scrollbarHideTimer = undefined;\n\t\t\tthis.options.requestRender?.();\n\t\t}, SCROLLBAR_HIDE_DELAY_MS);\n\t\tthis.scrollbarHideTimer.unref?.();\n\t}\n\n\tprivate scrollbarVisible(scrollbar: ScrollViewScrollbar, lineCount: number, trackRows: number): boolean {\n\t\tif (scrollbar === \"always\") return trackRows > 0;\n\t\treturn scrollbar === \"auto\" && lineCount > trackRows && this.now() - this.lastScrollAt < SCROLLBAR_HIDE_DELAY_MS;\n\t}\n\n\t/** The thumb geometry follows the main transcript's scrollbar: proportional, at least two rows. */\n\tprivate paintScrollbar(\n\t\trows: readonly string[],\n\t\twidth: number,\n\t\tscrollbar: ScrollViewScrollbar,\n\t\tposition: { readonly lineCount: number; readonly start: number; readonly maxScroll: number },\n\t): string[] {\n\t\tconst track = rows.length;\n\t\tif (width < 2 || !this.scrollbarVisible(scrollbar, position.lineCount, track)) return [...rows];\n\t\tconst thumbHeight = Math.max(\n\t\t\tMath.min(2, track),\n\t\t\tMath.min(track, Math.round((track * track) / Math.max(1, position.lineCount))),\n\t\t);\n\t\tconst thumbTop =\n\t\t\tposition.maxScroll === 0 ? 0 : Math.round((position.start / position.maxScroll) * (track - thumbHeight));\n\t\t// The default colors are off with NO_COLOR or FORCE_COLOR=0; the viewport may paint before any theme loads.\n\t\tconst plain = colorEnvironment().off;\n\t\tconst thumbStyle =\n\t\t\tthis.options.scrollbarThumbStyle ?? ((text: string) => (plain ? text : `\\x1b[37m${text}\\x1b[39m`));\n\t\tconst trackStyle =\n\t\t\tthis.options.scrollbarTrackStyle ?? ((text: string) => (plain ? text : `\\x1b[90m${text}\\x1b[39m`));\n\t\tconst cellWidth = width - 1;\n\t\treturn rows.map((row, index) => {\n\t\t\tconst cell = truncateToWidth(row, cellWidth, \"\");\n\t\t\tconst padding = \" \".repeat(Math.max(0, cellWidth - visibleWidth(cell)));\n\t\t\tconst thumb = index >= thumbTop && index < thumbTop + thumbHeight;\n\t\t\treturn `${cell}${padding}${SCROLLBAR_CELL_RESET}${thumb ? thumbStyle(SCROLLBAR_THUMB) : trackStyle(SCROLLBAR_TRACK)}`;\n\t\t});\n\t}\n\n\tprivate pinnedPromptRow(componentRows: ComponentRows[], start: number): string | undefined {\n\t\tconst style = this.options.pinnedPrompt;\n\t\tif (!style) return undefined;\n\t\tconst prompt = this.findUserPromptRow(componentRows, start);\n\t\tif (prompt === undefined) return undefined;\n\t\tlet cursor = prompt;\n\t\tlet windowRows = 1;\n\t\twhile (cursor < start) {\n\t\t\tconst end = Math.min(start, cursor + windowRows);\n\t\t\tconst text = firstPromptTextRow(this.renderVisibleRows(componentRows, cursor, end));\n\t\t\tif (text !== undefined) return style(text);\n\t\t\tcursor = end;\n\t\t\twindowRows = PINNED_PROMPT_SCAN_ROWS;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate findUserPromptRow(componentRows: readonly ComponentRows[], start: number): number | undefined {\n\t\tlet componentEnd = componentRows.reduce((total, rows) => total + rows.rowCount, 0);\n\t\tfor (let index = componentRows.length - 1; index >= 0; index--) {\n\t\t\tconst rows = componentRows[index];\n\t\t\tif (rows === undefined) continue;\n\t\t\tconst componentStart = componentEnd - rows.rowCount;\n\t\t\tcomponentEnd = componentStart;\n\t\t\tif (componentStart > start || rows.rowCount === 0) continue;\n\t\t\tconst last = Math.min(rows.rowCount - 1, start - componentStart);\n\t\t\tif (rows.kind === \"windowed\" && rows.findUserPromptRow !== undefined) {\n\t\t\t\tconst prompt = rows.findUserPromptRow(last);\n\t\t\t\tif (prompt !== undefined) return componentStart + prompt;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (rows.kind === \"static\") {\n\t\t\t\tfor (let row = last; row >= 0; row--) {\n\t\t\t\t\tif (isUserPromptRow(rows.lines[row] ?? \"\")) return componentStart + row;\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tlet windowRows = PINNED_PROMPT_SCAN_ROWS;\n\t\t\tfor (let end = last + 1; end > 0; ) {\n\t\t\t\tconst begin = Math.max(0, end - windowRows);\n\t\t\t\tconst lines = rows.renderRows(begin, end);\n\t\t\t\tfor (let row = lines.length - 1; row >= 0; row--) {\n\t\t\t\t\tif (isUserPromptRow(lines[row] ?? \"\")) return componentStart + begin + row;\n\t\t\t\t}\n\t\t\t\tend = begin;\n\t\t\t\twindowRows = Math.min(MAX_PINNED_PROMPT_SCAN_ROWS, windowRows * 2);\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t/** Parks the nearest semantic prompt (an OSC 133 `A` mark) above or below the first visible row at the top. */\n\tprivate scrollToPrompt(direction: -1 | 1): void {\n\t\tif (this.lastWidth <= 0) return;\n\t\tconst rows = this.renderVisibleRows(this.measureComponentRows(this.lastWidth), 0, this.lastLineCount);\n\t\tconst top = Math.max(0, this.maxScroll - this.scrollFromBottom);\n\t\tfor (let row = top + direction; row >= 0 && row < rows.length; row += direction) {\n\t\t\tif (!OSC133_PROMPT_START.test(rows[row] ?? \"\")) continue;\n\t\t\tthis.scrollTo(row);\n\t\t\treturn;\n\t\t}\n\t}\n}\n\n/** One rendered frame's row layout, as the viewport measured it. */\ninterface ComponentRowLayout {\n\treadonly rowCounts: readonly number[];\n\treadonly segments: readonly (readonly RowWindowSegment[] | undefined)[];\n}\n\n/**\n * Rows gained or lost above `anchorRow`, measured in the previous frame's rows.\n *\n * The anchored row moves down by exactly this many rows, so adding it to the\n * anchor keeps the same content under the viewer.\n *\n * Components entirely above the anchor contribute their whole height delta.\n * The component that *spans* the anchor contributes only what changed above the\n * anchored row, which needs its row map (`rowSegments`); without one it\n * contributes nothing, which is the old behaviour and is right for the\n * append-and-mutate-at-the-tail widgets that have no interior.\n *\n * Row counts are compared positionally over the shared prefix, which is what the\n * chat stacks this viewport drives actually do — they append and mutate at the\n * tail. A component inserted or removed *ahead* of the anchor would be\n * misattributed; the anchor then lands one component off rather than drifting on\n * every frame, and the next user scroll re-establishes it.\n */\nfunction rowsShiftedAboveAnchor(previous: ComponentRowLayout, next: ComponentRowLayout, anchorRow: number): number {\n\tlet cursor = 0;\n\tlet shift = 0;\n\tconst shared = Math.min(previous.rowCounts.length, next.rowCounts.length);\n\tfor (let index = 0; index < shared; index += 1) {\n\t\tconst previousRows = previous.rowCounts[index] ?? 0;\n\t\tconst componentEnd = cursor + previousRows;\n\t\tif (componentEnd > anchorRow) {\n\t\t\treturn shift + rowsShiftedInsideComponent(previous.segments[index], next.segments[index], anchorRow - cursor);\n\t\t}\n\t\tshift += (next.rowCounts[index] ?? 0) - previousRows;\n\t\tcursor = componentEnd;\n\t}\n\treturn shift;\n}\n\n/**\n * Rows gained or lost above `anchorRow` *within* one windowed component.\n *\n * Rather than diffing heights, this finds the segment the viewer is parked on\n * and reports how far that same segment moved. Segments are matched by `===` on\n * their id, so a transcript splice that renumbers every cache key still lines\n * up: the entry objects survive it. If the anchored segment itself is gone\n * (the viewer was reading rows that were compacted away) the nearest surviving\n * neighbour above it — then below it — stands in, so the viewer lands on the\n * closest content that still exists instead of drifting by the whole delta.\n */\nfunction rowsShiftedInsideComponent(\n\tpreviousSegments: readonly RowWindowSegment[] | undefined,\n\tnextSegments: readonly RowWindowSegment[] | undefined,\n\tanchorRow: number,\n): number {\n\tif (previousSegments === undefined || nextSegments === undefined) return 0;\n\tconst nextStarts = new Map<unknown, number>();\n\tlet cursor = 0;\n\tfor (const segment of nextSegments) {\n\t\tif (!nextStarts.has(segment.id)) nextStarts.set(segment.id, cursor);\n\t\tcursor += segment.rows;\n\t}\n\tconst previousStarts: number[] = [];\n\tlet anchorIndex = -1;\n\tcursor = 0;\n\tfor (let index = 0; index < previousSegments.length; index += 1) {\n\t\tpreviousStarts.push(cursor);\n\t\tcursor += previousSegments[index]?.rows ?? 0;\n\t\tif (anchorIndex < 0 && cursor > anchorRow) anchorIndex = index;\n\t}\n\tif (anchorIndex < 0) return 0;\n\tfor (let index = anchorIndex; index >= 0; index -= 1) {\n\t\tconst nextStart = nextStarts.get(previousSegments[index]?.id);\n\t\tif (nextStart !== undefined) return nextStart - (previousStarts[index] ?? 0);\n\t}\n\tfor (let index = anchorIndex + 1; index < previousSegments.length; index += 1) {\n\t\tconst nextStart = nextStarts.get(previousSegments[index]?.id);\n\t\tif (nextStart !== undefined) return nextStart - (previousStarts[index] ?? 0);\n\t}\n\treturn 0;\n}\n\nfunction isRowWindowComponent(component: Component): component is RowWindowComponent {\n\tconst candidate = component as Partial<RowWindowComponent>;\n\treturn (\n\t\tcandidate.supportsRowWindow === true &&\n\t\ttypeof candidate.rowCount === \"function\" &&\n\t\ttypeof candidate.renderRows === \"function\"\n\t);\n}\n\n/**\n * A component that can identify its own rows without being windowed.\n *\n * `ScrollableChatTranscriptComponent` builds its transcript without a cache key\n * — deliberately, because that is what lets it reflect entries mutated in place\n * — so it is not a `RowWindowComponent` and renders every row each frame. It\n * still knows which entry produced which rows, and it is still the component\n * spanning the anchor, so the anchor needs to ask.\n */\nfunction segmentReporter(\n\tcomponent: Component,\n): { rowSegments(width: number): readonly RowWindowSegment[] } | undefined {\n\tconst candidate = component as Partial<RowWindowComponent>;\n\treturn typeof candidate.rowSegments === \"function\"\n\t\t? (candidate as { rowSegments(width: number): readonly RowWindowSegment[] })\n\t\t: undefined;\n}\n\nexport class ScrollableChatTranscriptComponent<TEntry extends ChatTranscriptEntryLike> implements Component {\n\tprivate readonly viewport = new ScrollableComponentViewport();\n\tprivate readonly transcript: ChatTranscriptComponent<TEntry>;\n\n\tconstructor(entries: readonly TEntry[], renderEntry: ChatTranscriptRenderer<TEntry>) {\n\t\tthis.transcript = new ChatTranscriptComponent(entries, renderEntry);\n\t\tthis.viewport.setComponents([this.transcript]);\n\t}\n\n\tsetVisibleRows(rows: number): void {\n\t\tthis.viewport.setVisibleRows(rows);\n\t}\n\n\thandleInput(data: string): boolean {\n\t\treturn this.viewport.handleInput(data);\n\t}\n\n\trender(width: number): string[] {\n\t\treturn this.viewport.render(width);\n\t}\n\n\tinvalidate(): void {\n\t\tthis.viewport.invalidate();\n\t}\n\n\tgetScrollFromBottom(): number {\n\t\treturn this.viewport.getScrollFromBottom();\n\t}\n\n\tgetMaxScroll(): number {\n\t\treturn this.viewport.getMaxScroll();\n\t}\n\n\tscrollToBottom(): void {\n\t\tthis.viewport.scrollToBottom();\n\t}\n}\n\n/** A vertical wheel report (SGR or legacy X10 encoding), with its direction and whether Alt was held. */\nexport function parseWheelReport(data: string): WheelReport | undefined {\n\tconst sgr = /^\\x1b\\[<(\\d+);\\d+;\\d+M$/.exec(data);\n\tconst code =\n\t\tsgr !== null\n\t\t\t? Number.parseInt(sgr[1] ?? \"\", 10)\n\t\t\t: data.startsWith(\"\\x1b[M\") && data.length >= 6\n\t\t\t\t? data.charCodeAt(3) - 32\n\t\t\t\t: undefined;\n\tif (code === undefined || (code & 64) === 0) return undefined;\n\tconst button = code & 3;\n\tif (button > 1) return undefined;\n\treturn { direction: button === 0 ? -1 : 1, alt: (code & 8) !== 0 };\n}\n\nconst CONTROL_SEQUENCE = /\\x1b\\[[0-?]*[ -/]*[@-~]/g;\nconst CONTROL_CHARACTER = /[\\x00-\\x06\\x08-\\x1a\\x1c-\\x1f\\x7f]/g;\n\n/**\n * A transcript row without the cursor movement, erasing and other control a message may carry: SGR styling,\n * OSC links and prompt marks, and APC images stay. Rows a viewport paints sit inside a fixed rectangle, which\n * anything else would break out of.\n */\nfunction withoutTerminalControl(row: string): string {\n\treturn row\n\t\t.replace(CONTROL_SEQUENCE, (sequence) => (sequence.endsWith(\"m\") ? sequence : \"\"))\n\t\t.replace(CONTROL_CHARACTER, \" \");\n}\n\nfunction firstPromptTextRow(rows: readonly string[]): string | undefined {\n\tfor (const row of rows) {\n\t\tconst text = stripTerminalSequences(row);\n\t\tif (text.trim()) return text;\n\t}\n\treturn undefined;\n}\n\nfunction isMouseSequence(data: string): boolean {\n\treturn /^\\x1b\\[<\\d+;\\d+;\\d+[mM]$/.test(data) || data.startsWith(\"\\x1b[M\");\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Box } from "@bastani/atomic-tui";
|
|
2
2
|
import type { CompactionForm, VerbatimCompactionResult, VerbatimCompactionStats } from "../../../core/compaction/index.ts";
|
|
3
3
|
import { type CustomMessage } from "../../../core/messages.ts";
|
|
4
|
+
import { type RowRange } from "./transcript-block-clicks.ts";
|
|
4
5
|
/** The mark every compaction boundary line starts with. */
|
|
5
6
|
export declare const COMPACTION_BOUNDARY_MARK = "\u269B";
|
|
6
7
|
interface BoundaryView {
|
|
@@ -22,6 +23,11 @@ export declare class CompactionBoundaryMessageComponent extends Box {
|
|
|
22
23
|
private expanded;
|
|
23
24
|
private readonly view;
|
|
24
25
|
constructor(result: VerbatimCompactionResult | BoundaryView, outputPad?: number);
|
|
26
|
+
/** A click anywhere on the compaction boundary expands or collapses it, as Ctrl+O does. */
|
|
27
|
+
readonly expandsOnClick = true;
|
|
28
|
+
isExpanded(): boolean;
|
|
29
|
+
/** Every row of the compaction boundary, its padding included. */
|
|
30
|
+
clickArea(width: number): RowRange | undefined;
|
|
25
31
|
setExpanded(expanded: boolean): void;
|
|
26
32
|
setOutputPad(outputPad: number): void;
|
|
27
33
|
invalidate(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compaction-boundary-message.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/compaction-boundary-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"compaction-boundary-message.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/compaction-boundary-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAA2B,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EACX,cAAc,EAEd,wBAAwB,EACxB,uBAAuB,EACvB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACN,KAAK,aAAa,EAGlB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,KAAK,QAAQ,EAAY,MAAM,8BAA8B,CAAC;AAGvE,2DAA2D;AAC3D,eAAO,MAAM,wBAAwB,WAAM,CAAC;AAE5C,UAAU,YAAY;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,cAAc,CAAC;IACrB,KAAK,EAAE,uBAAuB,CAAC;IAC/B,qGAAqG;IACrG,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uFAAuF;IACvF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,8GAA8G;AAC9G,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED,8GAA8G;AAC9G,wBAAgB,uBAAuB,CACtC,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,cAAc,CAAC,GACpE,MAAM,CAUR;AAaD,2GAA2G;AAC3G,qBAAa,kCAAmC,SAAQ,GAAG;IAC1D,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAe;IAEpC,YAAY,MAAM,EAAE,wBAAwB,GAAG,YAAY,EAAE,SAAS,SAAI,EAezE;IAED,2FAA2F;IAC3F,QAAQ,CAAC,cAAc,QAAQ;IAE/B,UAAU,IAAI,OAAO,CAEpB;IAED,kEAAkE;IAClE,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAE7C;IAED,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAGnC;IACD,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAEpC;IAEQ,UAAU,IAAI,IAAI,CAG1B;IAED,OAAO,CAAC,aAAa;CAmCrB;AAED,wBAAgB,6BAA6B,CAC5C,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,OAAO,EACjB,SAAS,SAAI,GACX,kCAAkC,CA4BpC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Box, Container,
|
|
1
|
+
import { Box, Container, Spacer, Text } from "@bastani/atomic-tui";
|
|
2
2
|
import { SUMMARY_COMPACTION_PREFIX, stripVerbatimCompactionPrefix, } from "../../../core/messages.js";
|
|
3
3
|
import { theme } from "../theme/theme.js";
|
|
4
4
|
import { keyHintIfBound } from "./keybinding-hints.js";
|
|
5
|
+
import { rowsFrom } from "./transcript-block-clicks.js";
|
|
5
6
|
import { formatWorkingTokens } from "./working-run-meter.js";
|
|
6
7
|
/** The mark every compaction boundary line starts with. */
|
|
7
8
|
export const COMPACTION_BOUNDARY_MARK = "⚛";
|
|
@@ -53,6 +54,15 @@ export class CompactionBoundaryMessageComponent extends Box {
|
|
|
53
54
|
}
|
|
54
55
|
this.updateDisplay();
|
|
55
56
|
}
|
|
57
|
+
/** A click anywhere on the compaction boundary expands or collapses it, as Ctrl+O does. */
|
|
58
|
+
expandsOnClick = true;
|
|
59
|
+
isExpanded() {
|
|
60
|
+
return this.expanded;
|
|
61
|
+
}
|
|
62
|
+
/** Every row of the compaction boundary, its padding included. */
|
|
63
|
+
clickArea(width) {
|
|
64
|
+
return rowsFrom(0, this.render(width).length);
|
|
65
|
+
}
|
|
56
66
|
setExpanded(expanded) {
|
|
57
67
|
this.expanded = expanded;
|
|
58
68
|
this.updateDisplay();
|
|
@@ -89,12 +99,7 @@ export class CompactionBoundaryMessageComponent extends Box {
|
|
|
89
99
|
.join("\n");
|
|
90
100
|
content.addChild(new Text(rendered, 0, 0));
|
|
91
101
|
}
|
|
92
|
-
this.addChild(
|
|
93
|
-
if (event.type !== "click" || event.button !== "left")
|
|
94
|
-
return undefined;
|
|
95
|
-
this.setExpanded(!this.expanded);
|
|
96
|
-
return { handled: true };
|
|
97
|
-
}));
|
|
102
|
+
this.addChild(content);
|
|
98
103
|
}
|
|
99
104
|
}
|
|
100
105
|
export function compactionBoundaryFromMessage(message, expanded, outputPad = 1) {
|