@gajae-code/coding-agent 0.11.1 → 0.11.2
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 +54 -0
- package/dist/types/cli/config-cli.d.ts +11 -1
- package/dist/types/cli/notify-cli.d.ts +1 -0
- package/dist/types/cli/session-picker.d.ts +2 -1
- package/dist/types/cli/setup-cli.d.ts +1 -1
- package/dist/types/commands/mcp-serve.d.ts +33 -0
- package/dist/types/commands/mcp.d.ts +1 -1
- package/dist/types/commands/notify.d.ts +0 -2
- package/dist/types/commands/sdk.d.ts +1 -1
- package/dist/types/config/atomic-yaml-patch.d.ts +18 -0
- package/dist/types/config/file-lock.d.ts +14 -4
- package/dist/types/config/keybindings.d.ts +42 -1
- package/dist/types/config/model-auth.d.ts +3 -0
- package/dist/types/config/model-bindings-applier.d.ts +13 -0
- package/dist/types/config/model-discovery-manager.d.ts +49 -0
- package/dist/types/config/model-equivalence.d.ts +20 -0
- package/dist/types/config/model-registry.d.ts +16 -15
- package/dist/types/config/model-resolver.d.ts +28 -18
- package/dist/types/config/models-config-schema.d.ts +11 -0
- package/dist/types/config/settings-schema.d.ts +56 -1
- package/dist/types/config/settings.d.ts +14 -11
- package/dist/types/coordinator-mcp/policy.d.ts +5 -0
- package/dist/types/coordinator-mcp/question-gate-codec.d.ts +129 -0
- package/dist/types/coordinator-mcp/question-state.d.ts +356 -0
- package/dist/types/coordinator-mcp/server.d.ts +4 -0
- package/dist/types/discovery/helpers.d.ts +0 -6
- package/dist/types/edit/index.d.ts +3 -0
- package/dist/types/eval/py/env.d.ts +9 -0
- package/dist/types/extensibility/extensions/loader.d.ts +2 -1
- package/dist/types/extensibility/extensions/runner.d.ts +2 -2
- package/dist/types/extensibility/extensions/types.d.ts +34 -3
- package/dist/types/extensibility/hooks/runner.d.ts +1 -1
- package/dist/types/extensibility/shared-events.d.ts +2 -0
- package/dist/types/gjc-runtime/deep-interview-recorder.d.ts +10 -1
- package/dist/types/gjc-runtime/deep-interview-state.d.ts +44 -0
- package/dist/types/gjc-runtime/goal-mode-request.d.ts +11 -1
- package/dist/types/gjc-runtime/launch-worktree.d.ts +4 -2
- package/dist/types/gjc-runtime/linux-proc.d.ts +29 -0
- package/dist/types/gjc-runtime/session-resolution.d.ts +2 -2
- package/dist/types/gjc-runtime/state-migrations.d.ts +1 -1
- package/dist/types/gjc-runtime/state-writer.d.ts +2 -1
- package/dist/types/gjc-runtime/team-launch.d.ts +59 -0
- package/dist/types/gjc-runtime/team-notify.d.ts +45 -0
- package/dist/types/gjc-runtime/team-runtime.d.ts +29 -121
- package/dist/types/gjc-runtime/team-store.d.ts +160 -0
- package/dist/types/gjc-runtime/team-workers.d.ts +78 -0
- package/dist/types/gjc-runtime/tmux-owner-isolation.d.ts +8 -0
- package/dist/types/gjc-runtime/ultragoal-change-set.d.ts +13 -0
- package/dist/types/gjc-runtime/ultragoal-evidence.d.ts +38 -0
- package/dist/types/gjc-runtime/ultragoal-guard.d.ts +7 -0
- package/dist/types/gjc-runtime/ultragoal-pipeline.d.ts +23 -0
- package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +55 -33
- package/dist/types/gjc-runtime/workflow-cli-common.d.ts +8 -0
- package/dist/types/gjc-runtime/workflow-manifest.d.ts +3 -0
- package/dist/types/goals/continuation-timeout-guard.d.ts +22 -0
- package/dist/types/goals/runtime.d.ts +1 -0
- package/dist/types/goals/state.d.ts +8 -0
- package/dist/types/harness-control-plane/lifecycle-reconciliation.d.ts +17 -0
- package/dist/types/harness-control-plane/phase-rollup.d.ts +4 -7
- package/dist/types/harness-control-plane/receipt-ingest.d.ts +5 -0
- package/dist/types/harness-control-plane/receipt-spool.d.ts +4 -0
- package/dist/types/hindsight/state.d.ts +11 -4
- package/dist/types/lsp/lspmux.d.ts +5 -3
- package/dist/types/lsp/path-trust.d.ts +1 -0
- package/dist/types/main.d.ts +3 -2
- package/dist/types/memories/storage.d.ts +1 -0
- package/dist/types/modes/action-registry.d.ts +29 -0
- package/dist/types/modes/components/chrome.d.ts +14 -0
- package/dist/types/modes/components/command-palette.d.ts +27 -0
- package/dist/types/modes/components/custom-provider-wizard.d.ts +1 -0
- package/dist/types/modes/components/index.d.ts +2 -1
- package/dist/types/modes/components/pet-selector.d.ts +1 -1
- package/dist/types/modes/components/plan-preview-overlay.d.ts +43 -0
- package/dist/types/modes/components/queue-mode-selector.d.ts +1 -1
- package/dist/types/modes/components/queue-pane.d.ts +12 -0
- package/dist/types/modes/components/read-tool-group.d.ts +6 -0
- package/dist/types/modes/components/session-observer-overlay.d.ts +3 -4
- package/dist/types/modes/components/sessions-dashboard.d.ts +32 -0
- package/dist/types/modes/components/settings-selector.d.ts +1 -1
- package/dist/types/modes/components/show-images-selector.d.ts +1 -1
- package/dist/types/modes/components/status-line/types.d.ts +1 -1
- package/dist/types/modes/components/status-line.d.ts +1 -94
- package/dist/types/modes/components/tasks-pane.d.ts +15 -0
- package/dist/types/modes/components/theme-selector.d.ts +1 -1
- package/dist/types/modes/components/tool-execution.d.ts +15 -0
- package/dist/types/modes/components/tool-status-header.d.ts +111 -0
- package/dist/types/modes/components/transcript-viewer-overlay.d.ts +42 -0
- package/dist/types/modes/controllers/goal-mode-controller.d.ts +62 -0
- package/dist/types/modes/controllers/input-controller.d.ts +8 -1
- package/dist/types/modes/controllers/mode-gate.d.ts +8 -0
- package/dist/types/modes/controllers/plan-mode-controller.d.ts +65 -0
- package/dist/types/modes/controllers/selector-controller.d.ts +15 -3
- package/dist/types/modes/controllers/stt-controller.d.ts +26 -0
- package/dist/types/modes/interactive-mode.d.ts +19 -17
- package/dist/types/modes/jobs-observer.d.ts +2 -0
- package/dist/types/modes/shared/agent-wire/deep-interview-gate.d.ts +4 -11
- package/dist/types/modes/shared/agent-wire/workflow-gate-broker.d.ts +20 -2
- package/dist/types/modes/shared/agent-wire/workflow-gate-types.d.ts +31 -0
- package/dist/types/modes/tasks-aggregator.d.ts +39 -0
- package/dist/types/modes/transcript-item-registry.d.ts +60 -0
- package/dist/types/modes/types.d.ts +20 -13
- package/dist/types/modes/utils/ui-helpers.d.ts +2 -2
- package/dist/types/runtime-mcp/manager.d.ts +1 -1
- package/dist/types/sdk/broker/broker.d.ts +78 -12
- package/dist/types/sdk/broker/lifecycle-codec.d.ts +4 -0
- package/dist/types/sdk/broker/lifecycle-ledger.d.ts +15 -1
- package/dist/types/sdk/broker/lifecycle.d.ts +6 -2
- package/dist/types/sdk/broker/process-incarnation.d.ts +2 -0
- package/dist/types/sdk/broker/session-index.d.ts +0 -1
- package/dist/types/sdk/broker/state-version.d.ts +2 -0
- package/dist/types/sdk/bus/chat-effect-journal.d.ts +1 -0
- package/dist/types/sdk/bus/config-commands.d.ts +1 -1
- package/dist/types/sdk/bus/config.d.ts +11 -0
- package/dist/types/sdk/bus/daemon-paths.d.ts +1 -0
- package/dist/types/sdk/bus/html-format.d.ts +3 -2
- package/dist/types/sdk/bus/index.d.ts +27 -0
- package/dist/types/sdk/bus/lifecycle-control-runtime.d.ts +4 -0
- package/dist/types/sdk/bus/notification-service.d.ts +20 -0
- package/dist/types/sdk/bus/rate-limit-pool.d.ts +13 -2
- package/dist/types/sdk/bus/recent-activity.d.ts +21 -12
- package/dist/types/sdk/bus/rich-document.d.ts +7 -0
- package/dist/types/sdk/bus/rich-render.d.ts +18 -41
- package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +9 -4
- package/dist/types/sdk/bus/telegram-daemon.d.ts +46 -3
- package/dist/types/sdk/bus/threaded-inbound.d.ts +1 -1
- package/dist/types/sdk/bus/threaded-render.d.ts +13 -0
- package/dist/types/sdk/bus/topic-registry.d.ts +24 -2
- package/dist/types/sdk/host/control/operations.d.ts +1 -1
- package/dist/types/sdk/host/host.d.ts +2 -0
- package/dist/types/sdk/index.d.ts +1 -0
- package/dist/types/sdk/session-directory.d.ts +56 -0
- package/dist/types/session/agent-session.d.ts +82 -47
- package/dist/types/session/agent-storage.d.ts +7 -0
- package/dist/types/session/fallback-chain-controller.d.ts +10 -2
- package/dist/types/session/internal/managed-session-scope.d.ts +102 -0
- package/dist/types/session/internal/managed-session-storage.d.ts +38 -0
- package/dist/types/session/messages.d.ts +16 -0
- package/dist/types/session/session-manager-internal.d.ts +14 -0
- package/dist/types/session/session-manager.d.ts +82 -12
- package/dist/types/session/session-storage.d.ts +43 -3
- package/dist/types/session/volatile-context-pruning.d.ts +15 -0
- package/dist/types/skill-state/{deep-interview-mutation-guard.d.ts → workflow-mutation-guard.d.ts} +24 -8
- package/dist/types/skill-state/workflow-state-contract.d.ts +1 -3
- package/dist/types/slash-commands/builtin-registry.d.ts +4 -1
- package/dist/types/system-prompt.d.ts +2 -11
- package/dist/types/task/executor.d.ts +3 -1
- package/dist/types/thinking.d.ts +7 -0
- package/dist/types/tool-discovery/tool-index.d.ts +1 -50
- package/dist/types/tools/ask.d.ts +64 -2
- package/dist/types/tools/bash.d.ts +3 -0
- package/dist/types/tools/browser/dead-tab-recovery.d.ts +24 -0
- package/dist/types/tools/browser/tab-supervisor.d.ts +21 -0
- package/dist/types/tools/cron.d.ts +2 -0
- package/dist/types/tools/fetch.d.ts +1 -0
- package/dist/types/tools/index.d.ts +30 -15
- package/dist/types/tools/output-meta.d.ts +1 -0
- package/dist/types/tools/read.d.ts +3 -0
- package/dist/types/tools/search-tool-bm25.d.ts +3 -4
- package/dist/types/utils/event-bus.d.ts +1 -1
- package/dist/types/web/search/index.d.ts +3 -1
- package/package.json +21 -9
- package/scripts/build-sdk-package-smoke.ts +34 -1
- package/scripts/generate-hotkeys-docs.ts +74 -0
- package/scripts/generate-sdk-operation-inventory.ts +64 -20
- package/scripts/verify-gjc-sdk-canonicalization.ts +182 -2
- package/src/async/job-manager.ts +49 -6
- package/src/cli/config-cli.ts +75 -2
- package/src/cli/notify-cli.ts +92 -26
- package/src/cli/session-picker.ts +20 -3
- package/src/cli/setup-cli.ts +1 -1
- package/src/cli.ts +1 -1
- package/src/commands/config.ts +1 -1
- package/src/commands/harness.ts +34 -106
- package/src/commands/launch.ts +6 -4
- package/src/commands/mcp-serve.ts +85 -8
- package/src/commands/mcp.ts +2 -2
- package/src/commands/notify.ts +8 -4
- package/src/commands/sdk.ts +61 -40
- package/src/commands/ultragoal.ts +4 -1
- package/src/config/atomic-yaml-patch.ts +80 -13
- package/src/config/file-lock.ts +105 -43
- package/src/config/keybindings.ts +64 -20
- package/src/config/model-auth.ts +9 -0
- package/src/config/model-bindings-applier.ts +139 -0
- package/src/config/model-discovery-manager.ts +224 -0
- package/src/config/model-equivalence.ts +66 -0
- package/src/config/model-registry.ts +169 -302
- package/src/config/model-resolver.ts +361 -369
- package/src/config/models-config-schema.ts +5 -4
- package/src/config/settings-schema.ts +159 -2
- package/src/config/settings.ts +458 -482
- package/src/coordinator-mcp/policy.ts +76 -11
- package/src/coordinator-mcp/question-gate-codec.ts +274 -0
- package/src/coordinator-mcp/question-state.ts +778 -0
- package/src/coordinator-mcp/server.ts +1702 -238
- package/src/debug/index.ts +1 -1
- package/src/defaults/gjc/skills/deep-interview/SKILL.md +13 -1
- package/src/defaults/gjc/skills/team/SKILL.md +16 -0
- package/src/discovery/helpers.ts +1 -50
- package/src/edit/index.ts +64 -0
- package/src/eval/py/env.ts +26 -0
- package/src/eval/py/kernel.ts +5 -3
- package/src/extensibility/extensions/loader.ts +9 -1
- package/src/extensibility/extensions/runner.ts +12 -3
- package/src/extensibility/extensions/types.ts +39 -1
- package/src/extensibility/gjc-plugins/installer.ts +16 -16
- package/src/extensibility/hooks/runner.ts +2 -2
- package/src/extensibility/runtime-skill-discovery.ts +33 -13
- package/src/extensibility/shared-events.ts +2 -0
- package/src/gjc-runtime/deep-interview-recorder.ts +63 -3
- package/src/gjc-runtime/deep-interview-runtime.ts +76 -27
- package/src/gjc-runtime/deep-interview-state.ts +317 -5
- package/src/gjc-runtime/goal-mode-request.ts +55 -8
- package/src/gjc-runtime/launch-tmux.ts +2 -5
- package/src/gjc-runtime/launch-worktree.ts +5 -5
- package/src/gjc-runtime/linux-proc.ts +71 -0
- package/src/gjc-runtime/ralplan-runtime.ts +74 -90
- package/src/gjc-runtime/session-resolution.ts +18 -3
- package/src/gjc-runtime/session-state-sidecar.ts +6 -107
- package/src/gjc-runtime/state-migrations.ts +1 -1
- package/src/gjc-runtime/state-runtime.ts +320 -249
- package/src/gjc-runtime/state-writer.ts +36 -40
- package/src/gjc-runtime/team-launch.ts +319 -0
- package/src/gjc-runtime/team-notify.ts +326 -0
- package/src/gjc-runtime/team-runtime.ts +1099 -1482
- package/src/gjc-runtime/team-store.ts +828 -0
- package/src/gjc-runtime/team-workers.ts +962 -0
- package/src/gjc-runtime/tmux-owner-isolation-cli.ts +2 -11
- package/src/gjc-runtime/tmux-owner-isolation.ts +14 -9
- package/src/gjc-runtime/tmux-sessions.ts +4 -21
- package/src/gjc-runtime/ultragoal-change-set.ts +172 -0
- package/src/gjc-runtime/ultragoal-evidence.ts +874 -0
- package/src/gjc-runtime/ultragoal-guard.ts +29 -5
- package/src/gjc-runtime/ultragoal-pipeline.ts +306 -0
- package/src/gjc-runtime/ultragoal-runtime.ts +84 -1311
- package/src/gjc-runtime/workflow-cli-common.ts +30 -0
- package/src/gjc-runtime/workflow-manifest.generated.json +58 -0
- package/src/gjc-runtime/workflow-manifest.ts +18 -0
- package/src/goals/continuation-timeout-guard.ts +79 -0
- package/src/goals/runtime.ts +7 -5
- package/src/goals/state.ts +18 -0
- package/src/harness-control-plane/lifecycle-reconciliation.ts +64 -0
- package/src/harness-control-plane/phase-rollup.ts +4 -7
- package/src/harness-control-plane/receipt-ingest.ts +5 -0
- package/src/harness-control-plane/receipt-spool.ts +51 -7
- package/src/harness-control-plane/session-lease.ts +12 -130
- package/src/hindsight/backend.ts +26 -27
- package/src/hindsight/state.ts +101 -32
- package/src/hooks/skill-state.ts +17 -11
- package/src/internal-urls/docs-index.generated.ts +21 -18
- package/src/lsp/client.ts +1 -1
- package/src/lsp/config.ts +145 -26
- package/src/lsp/index.ts +1 -1
- package/src/lsp/lspmux.ts +39 -10
- package/src/lsp/path-trust.ts +81 -0
- package/src/main.ts +28 -8
- package/src/memories/index.ts +1 -0
- package/src/memories/storage.ts +6 -2
- package/src/modes/action-registry.ts +165 -0
- package/src/modes/components/chrome.ts +40 -0
- package/src/modes/components/command-palette.ts +168 -0
- package/src/modes/components/custom-editor.ts +1 -1
- package/src/modes/components/custom-provider-wizard.ts +51 -14
- package/src/modes/components/index.ts +2 -1
- package/src/modes/components/pet-selector.ts +11 -17
- package/src/modes/components/plan-preview-overlay.ts +295 -0
- package/src/modes/components/queue-mode-selector.ts +10 -27
- package/src/modes/components/queue-pane.ts +79 -0
- package/src/modes/components/read-tool-group.ts +13 -0
- package/src/modes/components/session-observer-overlay.ts +207 -772
- package/src/modes/components/sessions-dashboard.ts +181 -0
- package/src/modes/components/settings-selector.ts +1 -1
- package/src/modes/components/show-images-selector.ts +10 -24
- package/src/modes/components/status-line/types.ts +1 -1
- package/src/modes/components/status-line.ts +1 -969
- package/src/modes/components/tasks-pane.ts +73 -0
- package/src/modes/components/theme-selector.ts +11 -31
- package/src/modes/components/tool-execution.ts +22 -0
- package/src/modes/components/tool-status-header.ts +1056 -0
- package/src/modes/components/transcript-viewer-overlay.ts +384 -0
- package/src/modes/controllers/btw-controller.ts +1 -0
- package/src/modes/controllers/event-controller.ts +3 -2
- package/src/modes/controllers/extension-ui-controller.ts +24 -1
- package/src/modes/controllers/goal-mode-controller.ts +474 -0
- package/src/modes/controllers/input-controller.ts +764 -229
- package/src/modes/controllers/mode-gate.ts +24 -0
- package/src/modes/controllers/plan-mode-controller.ts +517 -0
- package/src/modes/controllers/selector-controller.ts +225 -10
- package/src/modes/controllers/stt-controller.ts +125 -0
- package/src/modes/interactive-mode.ts +289 -1150
- package/src/modes/jobs-observer.ts +3 -0
- package/src/modes/runtime-init.ts +8 -0
- package/src/modes/shared/agent-wire/deep-interview-gate.ts +31 -106
- package/src/modes/shared/agent-wire/workflow-gate-broker.ts +71 -16
- package/src/modes/shared/agent-wire/workflow-gate-types.ts +177 -0
- package/src/modes/tasks-aggregator.ts +199 -0
- package/src/modes/transcript-item-registry.ts +229 -0
- package/src/modes/types.ts +45 -18
- package/src/modes/utils/ui-helpers.ts +17 -9
- package/src/prompts/agent-fragments/ralplan-persistence.md +6 -0
- package/src/prompts/agent-fragments/restricted-bash.md +1 -0
- package/src/prompts/agents/architect.md +2 -8
- package/src/prompts/agents/critic.md +2 -8
- package/src/prompts/agents/executor.md +3 -0
- package/src/prompts/agents/planner.md +4 -12
- package/src/prompts/system/custom-system-prompt.md +1 -23
- package/src/prompts/system/plan-mode-approved.md +8 -0
- package/src/prompts/system/system-prompt.md +17 -96
- package/src/prompts/tools/bash.md +4 -4
- package/src/prompts/tools/browser.md +15 -52
- package/src/prompts/tools/find.md +2 -2
- package/src/prompts/tools/hashline.md +13 -55
- package/src/prompts/tools/read.md +3 -6
- package/src/prompts/tools/search-tool-bm25.md +0 -2
- package/src/prompts/tools/search.md +2 -4
- package/src/prompts/tools/skill-discovery.md +1 -2
- package/src/prompts/tools/task.md +1 -1
- package/src/runtime-mcp/manager.ts +1 -1
- package/src/sdk/broker/broker.ts +206 -78
- package/src/sdk/broker/discovery.ts +1 -1
- package/src/sdk/broker/ensure.ts +3 -1
- package/src/sdk/broker/lifecycle-codec.ts +11 -0
- package/src/sdk/broker/lifecycle-ledger.ts +371 -74
- package/src/sdk/broker/lifecycle.ts +1399 -142
- package/src/sdk/broker/process-incarnation.ts +5 -13
- package/src/sdk/broker/session-index.ts +145 -56
- package/src/sdk/broker/state-version.ts +21 -0
- package/src/sdk/broker/transport.ts +1 -1
- package/src/sdk/bus/chat-daemon-cli.ts +2 -0
- package/src/sdk/bus/chat-daemon-control.ts +8 -28
- package/src/sdk/bus/chat-effect-journal.ts +10 -2
- package/src/sdk/bus/config-commands.ts +5 -4
- package/src/sdk/bus/config.ts +98 -0
- package/src/sdk/bus/conversation-store.ts +5 -29
- package/src/sdk/bus/daemon-paths.ts +2 -0
- package/src/sdk/bus/html-format.ts +20 -3
- package/src/sdk/bus/index.ts +778 -93
- package/src/sdk/bus/lifecycle-control-runtime.ts +91 -33
- package/src/sdk/bus/natives-augment.d.ts +26 -1
- package/src/sdk/bus/notification-service.ts +168 -20
- package/src/sdk/bus/rate-limit-pool.ts +58 -14
- package/src/sdk/bus/recent-activity.ts +188 -74
- package/src/sdk/bus/rich-document.ts +258 -0
- package/src/sdk/bus/rich-render.ts +62 -70
- package/src/sdk/bus/telegram-daemon-cli.ts +15 -59
- package/src/sdk/bus/telegram-daemon-contract.ts +9 -4
- package/src/sdk/bus/telegram-daemon.ts +1389 -237
- package/src/sdk/bus/threaded-inbound.ts +8 -3
- package/src/sdk/bus/threaded-render.ts +57 -1
- package/src/sdk/bus/topic-registry.ts +120 -13
- package/src/sdk/host/control/dispatch.ts +14 -2
- package/src/sdk/host/control/operations.ts +6 -1
- package/src/sdk/host/host.ts +31 -1
- package/src/sdk/host/query/handlers.ts +20 -22
- package/src/sdk/host/query/revision-store.ts +80 -57
- package/src/sdk/index.ts +1 -0
- package/src/sdk/protocol/operation-inventory.generated.json +943 -1907
- package/src/sdk/session-directory.ts +141 -0
- package/src/sdk/session.ts +458 -479
- package/src/session/agent-session.ts +1700 -583
- package/src/session/agent-storage.ts +18 -0
- package/src/session/cache-economics.ts +25 -8
- package/src/session/fallback-chain-controller.ts +53 -3
- package/src/session/internal/managed-session-scope.ts +2226 -0
- package/src/session/internal/managed-session-storage.ts +453 -0
- package/src/session/messages.ts +91 -2
- package/src/session/session-manager-internal.ts +33 -0
- package/src/session/session-manager.ts +1112 -333
- package/src/session/session-storage.ts +444 -39
- package/src/session/volatile-context-pruning.ts +78 -0
- package/src/setup/credential-auto-import.ts +2 -1
- package/src/setup/hermes/templates/operator-instructions.v1.md +1 -1
- package/src/setup/provider-onboarding.ts +36 -61
- package/src/setup/provider-presets.json +5 -0
- package/src/skill-state/active-state.ts +3 -13
- package/src/skill-state/{deep-interview-mutation-guard.ts → workflow-mutation-guard.ts} +47 -29
- package/src/skill-state/workflow-state-contract.ts +6 -41
- package/src/slash-commands/builtin-registry.ts +46 -11
- package/src/system-prompt.ts +37 -44
- package/src/task/agents.ts +19 -1
- package/src/task/executor.ts +90 -6
- package/src/task/index.ts +36 -21
- package/src/thinking.ts +21 -6
- package/src/tool-discovery/tool-index.ts +2 -134
- package/src/tools/ask.ts +157 -21
- package/src/tools/ast-edit.ts +1 -1
- package/src/tools/bash.ts +38 -0
- package/src/tools/browser/dead-tab-recovery.ts +78 -0
- package/src/tools/browser/tab-supervisor.ts +282 -36
- package/src/tools/computer.ts +10 -3
- package/src/tools/cron.ts +30 -16
- package/src/tools/eval.ts +1 -2
- package/src/tools/fetch.ts +11 -4
- package/src/tools/index.ts +76 -24
- package/src/tools/output-meta.ts +13 -5
- package/src/tools/read.ts +37 -1
- package/src/tools/resource-gc.ts +2 -2
- package/src/tools/search-tool-bm25.ts +11 -74
- package/src/utils/event-bus.ts +9 -4
- package/src/web/search/index.ts +3 -3
- package/dist/types/discovery/plugin-dir-roots.d.ts +0 -15
- package/dist/types/runtime-mcp/discoverable-tool-metadata.d.ts +0 -7
- package/src/discovery/plugin-dir-roots.ts +0 -28
- package/src/runtime-mcp/discoverable-tool-metadata.ts +0 -25
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { Container, Input, type KeyId, type MouseEvent, matchesKey, truncateToWidth } from "@gajae-code/tui";
|
|
3
|
+
|
|
4
|
+
import { theme } from "../theme/theme";
|
|
5
|
+
import { DynamicBorder } from "./dynamic-border";
|
|
6
|
+
|
|
7
|
+
export const PLAN_REVIEW_ACTIONS = [
|
|
8
|
+
"Approve and execute",
|
|
9
|
+
"Approve and compact context",
|
|
10
|
+
"Approve and keep context",
|
|
11
|
+
"Refine plan",
|
|
12
|
+
] as const;
|
|
13
|
+
export type PlanReviewAction = (typeof PLAN_REVIEW_ACTIONS)[number];
|
|
14
|
+
export type PlanPreviewFocus = "preview" | "sourceSelect" | "commentInput" | "actionBar";
|
|
15
|
+
export interface PlanPreviewOptions {
|
|
16
|
+
externalEditorKey?: string;
|
|
17
|
+
externalEditorKeys?: readonly KeyId[];
|
|
18
|
+
onExternalEditor?: () => Promise<string | null>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface PlanComment {
|
|
22
|
+
id: string;
|
|
23
|
+
startLine: number;
|
|
24
|
+
endLine: number;
|
|
25
|
+
text: string;
|
|
26
|
+
snapshotHash: string;
|
|
27
|
+
createdAt: number;
|
|
28
|
+
}
|
|
29
|
+
export interface PlanPreviewResult {
|
|
30
|
+
action?: PlanReviewAction;
|
|
31
|
+
comments: PlanComment[];
|
|
32
|
+
notes: string;
|
|
33
|
+
snapshotHash: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function planSnapshotHash(content: string): string {
|
|
37
|
+
return createHash("sha256").update(content).digest("hex");
|
|
38
|
+
}
|
|
39
|
+
export function serializePlanReviewComments(
|
|
40
|
+
content: string,
|
|
41
|
+
hash: string,
|
|
42
|
+
comments: readonly PlanComment[],
|
|
43
|
+
notes = "",
|
|
44
|
+
): string {
|
|
45
|
+
const lines = content.split("\n").map(line => line.replace(/\r$/, ""));
|
|
46
|
+
const valid = comments.filter(
|
|
47
|
+
comment =>
|
|
48
|
+
comment.snapshotHash === hash &&
|
|
49
|
+
comment.text.trim() &&
|
|
50
|
+
Number.isInteger(comment.startLine) &&
|
|
51
|
+
Number.isInteger(comment.endLine) &&
|
|
52
|
+
comment.startLine >= 1 &&
|
|
53
|
+
comment.endLine >= comment.startLine &&
|
|
54
|
+
comment.startLine <= lines.length,
|
|
55
|
+
);
|
|
56
|
+
if (!valid.length && !notes.trim()) return "";
|
|
57
|
+
const block = [`Plan review comments (snapshot ${hash.slice(0, 8)}):`];
|
|
58
|
+
for (const comment of valid) {
|
|
59
|
+
const end = Math.min(lines.length, Math.max(comment.startLine, comment.endLine));
|
|
60
|
+
block.push(`- L${comment.startLine}${end === comment.startLine ? "" : `-L${end}`}: ${comment.text.trim()}`);
|
|
61
|
+
for (let line = comment.startLine; line <= Math.min(end, comment.startLine + 5); line++)
|
|
62
|
+
block.push(`> ${lines[line - 1]}`);
|
|
63
|
+
}
|
|
64
|
+
if (notes.trim()) block.push(notes.trim());
|
|
65
|
+
return block.join("\n");
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Modal pre-decision review. Its result is consumed by InteractiveMode, which owns audit and dispatch semantics. */
|
|
69
|
+
export class PlanPreviewOverlay extends Container {
|
|
70
|
+
#focus: PlanPreviewFocus = "preview";
|
|
71
|
+
#scroll = 0;
|
|
72
|
+
#sourceLine = 1;
|
|
73
|
+
#actionIndex = 0;
|
|
74
|
+
#comments: PlanComment[] = [];
|
|
75
|
+
#notes = "";
|
|
76
|
+
#input = new Input();
|
|
77
|
+
#inputKind: "comment" | "notes" = "comment";
|
|
78
|
+
#renderedSourceLines: number[] = [];
|
|
79
|
+
#renderedBody: string[] = [];
|
|
80
|
+
#renderedBodyWidth = 0;
|
|
81
|
+
content: string | null;
|
|
82
|
+
|
|
83
|
+
snapshotHash: string;
|
|
84
|
+
lines: string[];
|
|
85
|
+
constructor(
|
|
86
|
+
content: string | null,
|
|
87
|
+
private readonly done: (result: PlanPreviewResult) => void,
|
|
88
|
+
private readonly requestRender: () => void,
|
|
89
|
+
private readonly options: PlanPreviewOptions = {},
|
|
90
|
+
) {
|
|
91
|
+
super();
|
|
92
|
+
this.content = content;
|
|
93
|
+
this.snapshotHash = planSnapshotHash(content ?? "");
|
|
94
|
+
this.lines = (content ?? "").split("\n");
|
|
95
|
+
this.#input.onSubmit = text => this.#saveInput(text);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
get focusState(): PlanPreviewFocus {
|
|
99
|
+
return this.#focus;
|
|
100
|
+
}
|
|
101
|
+
get comments(): readonly PlanComment[] {
|
|
102
|
+
return this.#comments;
|
|
103
|
+
}
|
|
104
|
+
get pageOffset(): number {
|
|
105
|
+
return this.#scroll;
|
|
106
|
+
}
|
|
107
|
+
get sourceLine(): number {
|
|
108
|
+
return this.#sourceLine;
|
|
109
|
+
}
|
|
110
|
+
override render(width: number): string[] {
|
|
111
|
+
const height = Math.max(5, (process.stdout.rows || 40) - 8);
|
|
112
|
+
const bodyWidth = Math.max(1, width - 2);
|
|
113
|
+
const body = this.#renderSourceRows(bodyWidth);
|
|
114
|
+
this.#scroll = Math.max(0, Math.min(this.#scroll, Math.max(0, body.length - height)));
|
|
115
|
+
const visible = body.slice(this.#scroll, this.#scroll + height);
|
|
116
|
+
const actions = PLAN_REVIEW_ACTIONS.map(
|
|
117
|
+
(action, index) => `${this.#focus === "actionBar" && index === this.#actionIndex ? "▶ " : " "}${action}`,
|
|
118
|
+
);
|
|
119
|
+
const actionBar = width < 40 ? actions : [actions.join(" ")];
|
|
120
|
+
const footer =
|
|
121
|
+
this.#focus === "commentInput"
|
|
122
|
+
? `${this.#inputKind === "notes" ? "Notes" : `Comment for source line ${this.#sourceLine}`} (Enter save, Esc cancel): ${this.#input.getValue()}`
|
|
123
|
+
: this.#focus === "sourceSelect"
|
|
124
|
+
? `Source line ${this.#sourceLine}/${this.lines.length || 1} j/k:select c:comment Esc:done`
|
|
125
|
+
: `${this.#scroll + 1}-${Math.min(this.#scroll + height, body.length)}/${body.length || 1} s:source line n:notes ${this.options.externalEditorKey ? `${this.options.externalEditorKey.toLowerCase()}:edit ` : ""}Tab:actions PgUp/PgDn:page`;
|
|
126
|
+
|
|
127
|
+
const rendered = [
|
|
128
|
+
new DynamicBorder().render(width)[0] ?? "",
|
|
129
|
+
` ${theme.bold(theme.fg("accent", "Plan review"))}`,
|
|
130
|
+
...visible.map(line => ` ${line}`),
|
|
131
|
+
"",
|
|
132
|
+
...actionBar.map(action => ` ${action}`),
|
|
133
|
+
` ${footer}`,
|
|
134
|
+
new DynamicBorder().render(width)[0] ?? "",
|
|
135
|
+
];
|
|
136
|
+
return rendered.map(line =>
|
|
137
|
+
!this.content && width < 40 && PLAN_REVIEW_ACTIONS.some(action => line.includes(action))
|
|
138
|
+
? line
|
|
139
|
+
: truncateToWidth(line, width),
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
handleMouse(event: MouseEvent): void {
|
|
143
|
+
if (event.kind !== "click" || this.#focus === "commentInput") return;
|
|
144
|
+
const renderedRow = this.#scroll + (event.localY ?? event.y) - 2;
|
|
145
|
+
const sourceLine = this.#renderedSourceLines[renderedRow];
|
|
146
|
+
if (sourceLine === undefined) return;
|
|
147
|
+
this.#sourceLine = sourceLine;
|
|
148
|
+
this.#focus = "sourceSelect";
|
|
149
|
+
this.requestRender();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
handleInput(key: string): void {
|
|
153
|
+
if (this.#focus === "commentInput") {
|
|
154
|
+
if (matchesKey(key, "escape")) {
|
|
155
|
+
this.#focus = "preview";
|
|
156
|
+
this.#input.setValue("");
|
|
157
|
+
this.requestRender();
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
this.#input.handleInput(key);
|
|
161
|
+
this.requestRender();
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
if (matchesKey(key, "escape")) {
|
|
165
|
+
this.done({ comments: this.#comments, notes: this.#notes, snapshotHash: this.snapshotHash });
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (this.#matchesExternalEditor(key)) {
|
|
169
|
+
void this.#openExternalEditor();
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (matchesKey(key, "tab")) {
|
|
174
|
+
this.#focus = this.#focus === "actionBar" ? "preview" : "actionBar";
|
|
175
|
+
this.requestRender();
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
if (this.#focus === "actionBar") {
|
|
179
|
+
if (matchesKey(key, "left") || matchesKey(key, "up")) this.#actionIndex = Math.max(0, this.#actionIndex - 1);
|
|
180
|
+
else if (matchesKey(key, "right") || matchesKey(key, "down"))
|
|
181
|
+
this.#actionIndex = Math.min(PLAN_REVIEW_ACTIONS.length - 1, this.#actionIndex + 1);
|
|
182
|
+
else if (matchesKey(key, "enter") || key === "\r")
|
|
183
|
+
this.done({
|
|
184
|
+
action: PLAN_REVIEW_ACTIONS[this.#actionIndex],
|
|
185
|
+
comments: this.#comments,
|
|
186
|
+
|
|
187
|
+
notes: this.#notes,
|
|
188
|
+
snapshotHash: this.snapshotHash,
|
|
189
|
+
});
|
|
190
|
+
this.requestRender();
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (this.#focus === "sourceSelect") {
|
|
194
|
+
if (key === "j" || matchesKey(key, "down"))
|
|
195
|
+
this.#sourceLine = Math.min(this.lines.length || 1, this.#sourceLine + 1);
|
|
196
|
+
else if (key === "k" || matchesKey(key, "up")) this.#sourceLine = Math.max(1, this.#sourceLine - 1);
|
|
197
|
+
else if (key === "c") {
|
|
198
|
+
this.#inputKind = "comment";
|
|
199
|
+
this.#focus = "commentInput";
|
|
200
|
+
} else if (matchesKey(key, "enter")) this.#focus = "preview";
|
|
201
|
+
this.requestRender();
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
if (key === "s") {
|
|
205
|
+
this.#focus = "sourceSelect";
|
|
206
|
+
this.requestRender();
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
if (key === "c") {
|
|
210
|
+
this.#inputKind = "comment";
|
|
211
|
+
this.#focus = "commentInput";
|
|
212
|
+
this.requestRender();
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
if (key === "n") {
|
|
216
|
+
this.#inputKind = "notes";
|
|
217
|
+
this.#focus = "commentInput";
|
|
218
|
+
this.requestRender();
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
if (matchesKey(key, "pageDown")) this.#scroll += 15;
|
|
222
|
+
if (matchesKey(key, "pageUp")) this.#scroll -= 15;
|
|
223
|
+
this.requestRender();
|
|
224
|
+
}
|
|
225
|
+
#saveInput(text: string): void {
|
|
226
|
+
if (text.trim()) {
|
|
227
|
+
if (this.#inputKind === "notes") this.#notes = text;
|
|
228
|
+
else
|
|
229
|
+
this.#comments.push({
|
|
230
|
+
id: crypto.randomUUID(),
|
|
231
|
+
startLine: this.#sourceLine,
|
|
232
|
+
endLine: this.#sourceLine,
|
|
233
|
+
text,
|
|
234
|
+
snapshotHash: this.snapshotHash,
|
|
235
|
+
createdAt: Date.now(),
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
this.#input.setValue("");
|
|
239
|
+
this.#focus = "preview";
|
|
240
|
+
this.requestRender();
|
|
241
|
+
}
|
|
242
|
+
// Render numbered source rather than Markdown so every displayed row has an exact source-line owner.
|
|
243
|
+
#renderSourceRows(width: number): string[] {
|
|
244
|
+
if (!this.content) {
|
|
245
|
+
this.#renderedSourceLines = [];
|
|
246
|
+
this.#renderedBody = [theme.fg("warning", "Plan file is empty or missing.")];
|
|
247
|
+
this.#renderedBodyWidth = width;
|
|
248
|
+
return this.#renderedBody;
|
|
249
|
+
}
|
|
250
|
+
if (this.#renderedBodyWidth === width) return this.#renderedBody;
|
|
251
|
+
|
|
252
|
+
const lineNumberWidth = String(this.lines.length).length;
|
|
253
|
+
const prefixWidth = lineNumberWidth + 3;
|
|
254
|
+
const sourceWidth = Math.max(1, width - prefixWidth);
|
|
255
|
+
const body: string[] = [];
|
|
256
|
+
const sourceLines: number[] = [];
|
|
257
|
+
for (let index = 0; index < this.lines.length; index++) {
|
|
258
|
+
const prefix = `${String(index + 1).padStart(lineNumberWidth)} │ `;
|
|
259
|
+
const wrapped = Bun.wrapAnsi(this.lines[index]!.replace(/\r$/, ""), sourceWidth, {
|
|
260
|
+
hard: true,
|
|
261
|
+
trim: false,
|
|
262
|
+
});
|
|
263
|
+
const rows = wrapped ? wrapped.split("\n") : [""];
|
|
264
|
+
for (const row of rows) {
|
|
265
|
+
body.push(`${prefix}${row}`);
|
|
266
|
+
sourceLines.push(index + 1);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
this.#renderedSourceLines = sourceLines;
|
|
270
|
+
this.#renderedBody = body;
|
|
271
|
+
this.#renderedBodyWidth = width;
|
|
272
|
+
return body;
|
|
273
|
+
}
|
|
274
|
+
#matchesExternalEditor(key: string): boolean {
|
|
275
|
+
return Boolean(
|
|
276
|
+
this.options.onExternalEditor && this.options.externalEditorKeys?.some(binding => matchesKey(key, binding)),
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
async #openExternalEditor(): Promise<void> {
|
|
280
|
+
const updatedContent = await this.options.onExternalEditor?.();
|
|
281
|
+
if (updatedContent === null || updatedContent === undefined || updatedContent === this.content) return;
|
|
282
|
+
this.content = updatedContent;
|
|
283
|
+
this.snapshotHash = planSnapshotHash(updatedContent);
|
|
284
|
+
this.lines = updatedContent.split("\n");
|
|
285
|
+
this.#renderedSourceLines = [];
|
|
286
|
+
this.#renderedBody = [];
|
|
287
|
+
this.#renderedBodyWidth = 0;
|
|
288
|
+
this.#comments = [];
|
|
289
|
+
this.#notes = "";
|
|
290
|
+
this.#scroll = 0;
|
|
291
|
+
this.#sourceLine = 1;
|
|
292
|
+
this.#focus = "preview";
|
|
293
|
+
this.requestRender();
|
|
294
|
+
}
|
|
295
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Container, type SelectItem, SelectList } from "@gajae-code/tui";
|
|
2
|
-
import {
|
|
3
|
-
import { DynamicBorder } from "./dynamic-border";
|
|
1
|
+
import { Container, type SelectItem, type SelectList } from "@gajae-code/tui";
|
|
2
|
+
import { FramedSelect } from "./chrome";
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* Component that renders a queue mode selector with borders
|
|
@@ -24,30 +23,14 @@ export class QueueModeSelectorComponent extends Container {
|
|
|
24
23
|
{ value: "all", label: "all", description: "Process all queued messages at once" },
|
|
25
24
|
];
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (currentIndex !== -1) {
|
|
36
|
-
this.#selectList.setSelectedIndex(currentIndex);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
this.#selectList.onSelect = item => {
|
|
40
|
-
onSelect(item.value as "all" | "one-at-a-time");
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
this.#selectList.onCancel = () => {
|
|
44
|
-
onCancel();
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
this.addChild(this.#selectList);
|
|
48
|
-
|
|
49
|
-
// Add bottom border
|
|
50
|
-
this.addChild(new DynamicBorder());
|
|
26
|
+
const framed = FramedSelect(undefined, queueModes, {
|
|
27
|
+
maxVisible: 2,
|
|
28
|
+
selectedValue: currentMode,
|
|
29
|
+
onSelect: item => onSelect(item.value as "all" | "one-at-a-time"),
|
|
30
|
+
onCancel,
|
|
31
|
+
});
|
|
32
|
+
this.#selectList = framed.selectList;
|
|
33
|
+
this.addChild(framed.container);
|
|
51
34
|
}
|
|
52
35
|
|
|
53
36
|
getSelectList(): SelectList {
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Container, matchesKey, type SelectItem, SelectList, Spacer, Text } from "@gajae-code/tui";
|
|
2
|
+
import type { QueuedMessageEditEntry } from "../../session/agent-session";
|
|
3
|
+
import { getSelectListTheme, theme } from "../theme/theme";
|
|
4
|
+
import { DynamicBorder } from "./dynamic-border";
|
|
5
|
+
|
|
6
|
+
const MAX_VISIBLE_QUEUE_MESSAGES = 8;
|
|
7
|
+
const RAW_UP = "\x1b[A";
|
|
8
|
+
const RAW_DOWN = "\x1b[B";
|
|
9
|
+
|
|
10
|
+
export class QueuePaneComponent extends Container {
|
|
11
|
+
#selectList: SelectList;
|
|
12
|
+
#selectedEntry: QueuedMessageEditEntry | undefined;
|
|
13
|
+
#selectedIndex: number;
|
|
14
|
+
#onDelete: (entry: QueuedMessageEditEntry, index: number) => void;
|
|
15
|
+
#onMove: (entry: QueuedMessageEditEntry, index: number, direction: "up" | "down") => void;
|
|
16
|
+
|
|
17
|
+
constructor(
|
|
18
|
+
entries: QueuedMessageEditEntry[],
|
|
19
|
+
options: {
|
|
20
|
+
selectedIndex?: number;
|
|
21
|
+
onDelete: (entry: QueuedMessageEditEntry, index: number) => void;
|
|
22
|
+
onMove: (entry: QueuedMessageEditEntry, index: number, direction: "up" | "down") => void;
|
|
23
|
+
onClose: () => void;
|
|
24
|
+
},
|
|
25
|
+
) {
|
|
26
|
+
super();
|
|
27
|
+
this.#onDelete = options.onDelete;
|
|
28
|
+
this.#onMove = options.onMove;
|
|
29
|
+
this.#selectedIndex = Math.max(0, Math.min(options.selectedIndex ?? 0, entries.length - 1));
|
|
30
|
+
this.#selectedEntry = entries[this.#selectedIndex];
|
|
31
|
+
const byId = new Map(entries.map(entry => [entry.id, entry]));
|
|
32
|
+
const items: SelectItem[] = entries.map((entry, index) => ({
|
|
33
|
+
value: entry.id,
|
|
34
|
+
label: `${entry.label} ${index + 1}`,
|
|
35
|
+
description: entry.text,
|
|
36
|
+
hint: "Del remove · Ctrl+↑/↓ move",
|
|
37
|
+
}));
|
|
38
|
+
|
|
39
|
+
this.addChild(new Spacer(1));
|
|
40
|
+
this.addChild(new Text(theme.bold("Message queue"), 1, 0));
|
|
41
|
+
this.addChild(new Text(theme.fg("muted", "Del remove · Ctrl+↑/↓ move · Esc close"), 1, 0));
|
|
42
|
+
this.addChild(new Spacer(1));
|
|
43
|
+
this.addChild(new DynamicBorder());
|
|
44
|
+
this.#selectList = new SelectList(items, MAX_VISIBLE_QUEUE_MESSAGES, getSelectListTheme());
|
|
45
|
+
this.#selectList.onSelectionChange = item => {
|
|
46
|
+
const index = entries.findIndex(entry => entry.id === item.value);
|
|
47
|
+
this.#selectedIndex = index === -1 ? this.#selectedIndex : index;
|
|
48
|
+
this.#selectedEntry = byId.get(item.value);
|
|
49
|
+
};
|
|
50
|
+
this.#selectList.setSelectedIndex(this.#selectedIndex);
|
|
51
|
+
this.#selectList.onCancel = options.onClose;
|
|
52
|
+
this.addChild(this.#selectList);
|
|
53
|
+
this.addChild(new DynamicBorder());
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
handleInput(keyData: string): void {
|
|
57
|
+
if (matchesKey(keyData, "alt+up")) {
|
|
58
|
+
this.#selectList.handleInput(RAW_UP);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (matchesKey(keyData, "alt+down")) {
|
|
62
|
+
this.#selectList.handleInput(RAW_DOWN);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (matchesKey(keyData, "ctrl+up") || matchesKey(keyData, "ctrl+shift+up")) {
|
|
66
|
+
if (this.#selectedEntry) this.#onMove(this.#selectedEntry, this.#selectedIndex, "up");
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (matchesKey(keyData, "ctrl+down") || matchesKey(keyData, "ctrl+shift+down")) {
|
|
70
|
+
if (this.#selectedEntry) this.#onMove(this.#selectedEntry, this.#selectedIndex, "down");
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (matchesKey(keyData, "delete")) {
|
|
74
|
+
if (this.#selectedEntry) this.#onDelete(this.#selectedEntry, this.#selectedIndex);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
this.#selectList.handleInput(keyData);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -80,6 +80,7 @@ export class ReadToolGroupComponent extends Container implements ToolExecutionHa
|
|
|
80
80
|
#entries = new Map<string, ReadEntry>();
|
|
81
81
|
#text: Text;
|
|
82
82
|
#expanded = false;
|
|
83
|
+
#manuallyExpanded: boolean | undefined;
|
|
83
84
|
#showContentPreview: boolean;
|
|
84
85
|
|
|
85
86
|
constructor(options: ReadToolGroupOptions = {}) {
|
|
@@ -137,7 +138,19 @@ export class ReadToolGroupComponent extends Container implements ToolExecutionHa
|
|
|
137
138
|
this.#updateDisplay();
|
|
138
139
|
}
|
|
139
140
|
|
|
141
|
+
/** Applies automatic expansion unless this renderer instance has an explicit fold choice. */
|
|
140
142
|
setExpanded(expanded: boolean): void {
|
|
143
|
+
if (this.#manuallyExpanded !== undefined) return;
|
|
144
|
+
this.#expanded = expanded;
|
|
145
|
+
this.#updateDisplay();
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Applies and pins an explicit fold choice for this renderer instance only.
|
|
150
|
+
* Transcript rebuilds recreate components from global state and drop this pin.
|
|
151
|
+
*/
|
|
152
|
+
setManuallyExpanded(expanded: boolean): void {
|
|
153
|
+
this.#manuallyExpanded = expanded;
|
|
141
154
|
this.#expanded = expanded;
|
|
142
155
|
this.#updateDisplay();
|
|
143
156
|
}
|