@caupulican/pi-adaptative 0.80.103 → 0.81.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 +128 -0
- package/dist/cli/session-picker.d.ts +1 -1
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +7 -1
- package/dist/cli.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +6 -6
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +154 -512
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +675 -4589
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/autonomy/session-lane-record.d.ts +1 -1
- package/dist/core/autonomy/session-lane-record.d.ts.map +1 -1
- package/dist/core/autonomy/session-lane-record.js.map +1 -1
- package/dist/core/autonomy/status.d.ts +1 -0
- package/dist/core/autonomy/status.d.ts.map +1 -1
- package/dist/core/autonomy/status.js +1 -0
- package/dist/core/autonomy/status.js.map +1 -1
- package/dist/core/autonomy-telemetry.d.ts +80 -0
- package/dist/core/autonomy-telemetry.d.ts.map +1 -0
- package/dist/core/autonomy-telemetry.js +266 -0
- package/dist/core/autonomy-telemetry.js.map +1 -0
- package/dist/core/background-lane-controller.d.ts +186 -0
- package/dist/core/background-lane-controller.d.ts.map +1 -0
- package/dist/core/background-lane-controller.js +691 -0
- package/dist/core/background-lane-controller.js.map +1 -0
- package/dist/core/bash-execution-controller.d.ts +51 -0
- package/dist/core/bash-execution-controller.d.ts.map +1 -0
- package/dist/core/bash-execution-controller.js +96 -0
- package/dist/core/bash-execution-controller.js.map +1 -0
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +9 -2
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/compaction-support.d.ts +56 -0
- package/dist/core/compaction-support.d.ts.map +1 -0
- package/dist/core/compaction-support.js +99 -0
- package/dist/core/compaction-support.js.map +1 -0
- package/dist/core/context/artifact-retrieval.d.ts +1 -1
- package/dist/core/context/artifact-retrieval.d.ts.map +1 -1
- package/dist/core/context/artifact-retrieval.js +1 -1
- package/dist/core/context/artifact-retrieval.js.map +1 -1
- package/dist/core/context/context-composition.d.ts.map +1 -1
- package/dist/core/context/context-composition.js +1 -1
- package/dist/core/context/context-composition.js.map +1 -1
- package/dist/core/context/tool-output-packer.d.ts +1 -1
- package/dist/core/context/tool-output-packer.d.ts.map +1 -1
- package/dist/core/context/tool-output-packer.js +1 -1
- package/dist/core/context/tool-output-packer.js.map +1 -1
- package/dist/core/context-gc.d.ts.map +1 -1
- package/dist/core/context-gc.js +1 -1
- package/dist/core/context-gc.js.map +1 -1
- package/dist/core/context-pipeline.d.ts +223 -0
- package/dist/core/context-pipeline.d.ts.map +1 -0
- package/dist/core/context-pipeline.js +594 -0
- package/dist/core/context-pipeline.js.map +1 -0
- package/dist/core/cost/daily-usage.d.ts +1 -1
- package/dist/core/cost/daily-usage.d.ts.map +1 -1
- package/dist/core/cost/daily-usage.js +1 -1
- package/dist/core/cost/daily-usage.js.map +1 -1
- package/dist/core/cost/session-usage.d.ts +1 -1
- package/dist/core/cost/session-usage.d.ts.map +1 -1
- package/dist/core/cost/session-usage.js +1 -1
- package/dist/core/cost/session-usage.js.map +1 -1
- package/dist/core/delegation/session-worker-result.d.ts +1 -1
- package/dist/core/delegation/session-worker-result.d.ts.map +1 -1
- package/dist/core/delegation/session-worker-result.js.map +1 -1
- package/dist/core/exec.d.ts +2 -0
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js +15 -9
- package/dist/core/exec.js.map +1 -1
- package/dist/core/export-html/index.d.ts +1 -1
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js +2 -2
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/extensions/builtin.d.ts.map +1 -1
- package/dist/core/extensions/builtin.js +2 -2
- package/dist/core/extensions/builtin.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +2 -4
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/goal-loop-controller.d.ts +24 -0
- package/dist/core/goal-loop-controller.d.ts.map +1 -0
- package/dist/core/goal-loop-controller.js +83 -0
- package/dist/core/goal-loop-controller.js.map +1 -0
- package/dist/core/goals/goal-runtime-snapshot.d.ts +1 -1
- package/dist/core/goals/goal-runtime-snapshot.d.ts.map +1 -1
- package/dist/core/goals/goal-runtime-snapshot.js.map +1 -1
- package/dist/core/goals/session-goal-state.d.ts +1 -1
- package/dist/core/goals/session-goal-state.d.ts.map +1 -1
- package/dist/core/goals/session-goal-state.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts +4 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +6 -1
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/learning/learning-audit.d.ts +1 -1
- package/dist/core/learning/learning-audit.d.ts.map +1 -1
- package/dist/core/learning/learning-audit.js.map +1 -1
- package/dist/core/learning/session-learning-decision.d.ts +1 -1
- package/dist/core/learning/session-learning-decision.d.ts.map +1 -1
- package/dist/core/learning/session-learning-decision.js.map +1 -1
- package/dist/core/local-runtime-controller.d.ts +99 -0
- package/dist/core/local-runtime-controller.d.ts.map +1 -0
- package/dist/core/local-runtime-controller.js +214 -0
- package/dist/core/local-runtime-controller.js.map +1 -0
- package/dist/core/memory/providers/transcript-recall.d.ts.map +1 -1
- package/dist/core/memory/providers/transcript-recall.js +1 -1
- package/dist/core/memory/providers/transcript-recall.js.map +1 -1
- package/dist/core/memory-controller.d.ts +139 -0
- package/dist/core/memory-controller.d.ts.map +1 -0
- package/dist/core/memory-controller.js +323 -0
- package/dist/core/memory-controller.js.map +1 -0
- package/dist/core/model-router/status.d.ts +1 -1
- package/dist/core/model-router/status.d.ts.map +1 -1
- package/dist/core/model-router/status.js.map +1 -1
- package/dist/core/model-router-controller.d.ts +140 -0
- package/dist/core/model-router-controller.d.ts.map +1 -0
- package/dist/core/model-router-controller.js +623 -0
- package/dist/core/model-router-controller.js.map +1 -0
- package/dist/core/model-selection-controller.d.ts +95 -0
- package/dist/core/model-selection-controller.d.ts.map +1 -0
- package/dist/core/model-selection-controller.js +252 -0
- package/dist/core/model-selection-controller.js.map +1 -0
- package/dist/core/models/model-ref.d.ts +13 -0
- package/dist/core/models/model-ref.d.ts.map +1 -1
- package/dist/core/models/model-ref.js +22 -0
- package/dist/core/models/model-ref.js.map +1 -1
- package/dist/core/profile-filter-controller.d.ts +77 -0
- package/dist/core/profile-filter-controller.d.ts.map +1 -0
- package/dist/core/profile-filter-controller.js +159 -0
- package/dist/core/profile-filter-controller.js.map +1 -0
- package/dist/core/reflection-controller.d.ts +111 -0
- package/dist/core/reflection-controller.d.ts.map +1 -0
- package/dist/core/reflection-controller.js +412 -0
- package/dist/core/reflection-controller.js.map +1 -0
- package/dist/core/research/model-fitness.d.ts +12 -0
- package/dist/core/research/model-fitness.d.ts.map +1 -1
- package/dist/core/research/model-fitness.js +21 -0
- package/dist/core/research/model-fitness.js.map +1 -1
- package/dist/core/research/session-evidence-bundle.d.ts +1 -1
- package/dist/core/research/session-evidence-bundle.d.ts.map +1 -1
- package/dist/core/research/session-evidence-bundle.js.map +1 -1
- package/dist/core/runtime-builder.d.ts +222 -0
- package/dist/core/runtime-builder.d.ts.map +1 -0
- package/dist/core/runtime-builder.js +640 -0
- package/dist/core/runtime-builder.js.map +1 -0
- package/dist/core/sdk.d.ts +2 -2
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +3 -4
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-analytics.d.ts +96 -0
- package/dist/core/session-analytics.d.ts.map +1 -0
- package/dist/core/session-analytics.js +331 -0
- package/dist/core/session-analytics.js.map +1 -0
- package/dist/core/session-manager-factory.d.ts +18 -0
- package/dist/core/session-manager-factory.d.ts.map +1 -0
- package/dist/core/session-manager-factory.js +32 -0
- package/dist/core/session-manager-factory.js.map +1 -0
- package/dist/core/session-tree-navigator.d.ts +68 -0
- package/dist/core/session-tree-navigator.d.ts.map +1 -0
- package/dist/core/session-tree-navigator.js +217 -0
- package/dist/core/session-tree-navigator.js.map +1 -0
- package/dist/core/settings-manager.d.ts +16 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +22 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/system-prompt-builder.d.ts +63 -0
- package/dist/core/system-prompt-builder.d.ts.map +1 -0
- package/dist/core/system-prompt-builder.js +181 -0
- package/dist/core/system-prompt-builder.js.map +1 -0
- package/dist/core/tool-gate-controller.d.ts +36 -0
- package/dist/core/tool-gate-controller.d.ts.map +1 -0
- package/dist/core/tool-gate-controller.js +94 -0
- package/dist/core/tool-gate-controller.js.map +1 -0
- package/dist/core/tools/artifact-retrieve.d.ts.map +1 -1
- package/dist/core/tools/artifact-retrieve.js +1 -1
- package/dist/core/tools/artifact-retrieve.js.map +1 -1
- package/dist/core/tools/bash.d.ts +4 -2
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +49 -7
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/file-mutation-queue.d.ts +6 -0
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
- package/dist/core/tools/file-mutation-queue.js +61 -1
- package/dist/core/tools/file-mutation-queue.js.map +1 -1
- package/dist/core/tools/find.d.ts +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +1 -1
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +1 -1
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/index.d.ts +1 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +1 -1
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/ls.d.ts +1 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +1 -1
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts +1 -1
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +1 -1
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/read.d.ts +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +1 -1
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +1 -1
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -4
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +13 -12
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/auth-dialogs-controller.d.ts +59 -0
- package/dist/modes/interactive/auth-dialogs-controller.d.ts.map +1 -0
- package/dist/modes/interactive/auth-dialogs-controller.js +398 -0
- package/dist/modes/interactive/auth-dialogs-controller.js.map +1 -0
- package/dist/modes/interactive/auto-learn-controller.d.ts +168 -0
- package/dist/modes/interactive/auto-learn-controller.d.ts.map +1 -0
- package/dist/modes/interactive/auto-learn-controller.js +1239 -0
- package/dist/modes/interactive/auto-learn-controller.js.map +1 -0
- package/dist/modes/interactive/autocomplete-provider.d.ts +26 -0
- package/dist/modes/interactive/autocomplete-provider.d.ts.map +1 -0
- package/dist/modes/interactive/autocomplete-provider.js +103 -0
- package/dist/modes/interactive/autocomplete-provider.js.map +1 -0
- package/dist/modes/interactive/autonomy-commands.d.ts +38 -0
- package/dist/modes/interactive/autonomy-commands.d.ts.map +1 -0
- package/dist/modes/interactive/autonomy-commands.js +142 -0
- package/dist/modes/interactive/autonomy-commands.js.map +1 -0
- package/dist/modes/interactive/clipboard-input.d.ts +37 -0
- package/dist/modes/interactive/clipboard-input.d.ts.map +1 -0
- package/dist/modes/interactive/clipboard-input.js +59 -0
- package/dist/modes/interactive/clipboard-input.js.map +1 -0
- package/dist/modes/interactive/compaction-queue.d.ts +30 -0
- package/dist/modes/interactive/compaction-queue.d.ts.map +1 -0
- package/dist/modes/interactive/compaction-queue.js +91 -0
- package/dist/modes/interactive/compaction-queue.js.map +1 -0
- package/dist/modes/interactive/components/bash-execution.d.ts +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +1 -1
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.d.ts +1 -1
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +2 -2
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/config-backup.d.ts +27 -0
- package/dist/modes/interactive/config-backup.d.ts.map +1 -0
- package/dist/modes/interactive/config-backup.js +146 -0
- package/dist/modes/interactive/config-backup.js.map +1 -0
- package/dist/modes/interactive/editor-overlay-host.d.ts +48 -0
- package/dist/modes/interactive/editor-overlay-host.d.ts.map +1 -0
- package/dist/modes/interactive/editor-overlay-host.js +43 -0
- package/dist/modes/interactive/editor-overlay-host.js.map +1 -0
- package/dist/modes/interactive/extension-ui-host.d.ts +165 -0
- package/dist/modes/interactive/extension-ui-host.d.ts.map +1 -0
- package/dist/modes/interactive/extension-ui-host.js +610 -0
- package/dist/modes/interactive/extension-ui-host.js.map +1 -0
- package/dist/modes/interactive/external-editor.d.ts +18 -0
- package/dist/modes/interactive/external-editor.d.ts.map +1 -0
- package/dist/modes/interactive/external-editor.js +107 -0
- package/dist/modes/interactive/external-editor.js.map +1 -0
- package/dist/modes/interactive/history-reload-math.d.ts +24 -0
- package/dist/modes/interactive/history-reload-math.d.ts.map +1 -0
- package/dist/modes/interactive/history-reload-math.js +129 -0
- package/dist/modes/interactive/history-reload-math.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +22 -238
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +714 -5910
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/key-handlers.d.ts +46 -0
- package/dist/modes/interactive/key-handlers.d.ts.map +1 -0
- package/dist/modes/interactive/key-handlers.js +80 -0
- package/dist/modes/interactive/key-handlers.js.map +1 -0
- package/dist/modes/interactive/local-model-commands.d.ts +68 -0
- package/dist/modes/interactive/local-model-commands.d.ts.map +1 -0
- package/dist/modes/interactive/local-model-commands.js +288 -0
- package/dist/modes/interactive/local-model-commands.js.map +1 -0
- package/dist/modes/interactive/profile-menu-controller.d.ts +77 -0
- package/dist/modes/interactive/profile-menu-controller.d.ts.map +1 -0
- package/dist/modes/interactive/profile-menu-controller.js +917 -0
- package/dist/modes/interactive/profile-menu-controller.js.map +1 -0
- package/dist/modes/interactive/report-commands.d.ts +46 -0
- package/dist/modes/interactive/report-commands.d.ts.map +1 -0
- package/dist/modes/interactive/report-commands.js +255 -0
- package/dist/modes/interactive/report-commands.js.map +1 -0
- package/dist/modes/interactive/resource-display.d.ts +73 -0
- package/dist/modes/interactive/resource-display.d.ts.map +1 -0
- package/dist/modes/interactive/resource-display.js +278 -0
- package/dist/modes/interactive/resource-display.js.map +1 -0
- package/dist/modes/interactive/resource-shell-commands.d.ts +64 -0
- package/dist/modes/interactive/resource-shell-commands.d.ts.map +1 -0
- package/dist/modes/interactive/resource-shell-commands.js +202 -0
- package/dist/modes/interactive/resource-shell-commands.js.map +1 -0
- package/dist/modes/interactive/session-flow-commands.d.ts +139 -0
- package/dist/modes/interactive/session-flow-commands.d.ts.map +1 -0
- package/dist/modes/interactive/session-flow-commands.js +458 -0
- package/dist/modes/interactive/session-flow-commands.js.map +1 -0
- package/dist/modes/interactive/session-io-commands.d.ts +73 -0
- package/dist/modes/interactive/session-io-commands.d.ts.map +1 -0
- package/dist/modes/interactive/session-io-commands.js +202 -0
- package/dist/modes/interactive/session-io-commands.js.map +1 -0
- package/dist/modes/interactive/settings-selector-flow.d.ts +42 -0
- package/dist/modes/interactive/settings-selector-flow.d.ts.map +1 -0
- package/dist/modes/interactive/settings-selector-flow.js +287 -0
- package/dist/modes/interactive/settings-selector-flow.js.map +1 -0
- package/dist/modes/interactive/signal-lifecycle.d.ts +55 -0
- package/dist/modes/interactive/signal-lifecycle.d.ts.map +1 -0
- package/dist/modes/interactive/signal-lifecycle.js +177 -0
- package/dist/modes/interactive/signal-lifecycle.js.map +1 -0
- package/dist/modes/interactive/startup-checks.d.ts +38 -0
- package/dist/modes/interactive/startup-checks.d.ts.map +1 -0
- package/dist/modes/interactive/startup-checks.js +189 -0
- package/dist/modes/interactive/startup-checks.js.map +1 -0
- package/dist/modes/rpc/rpc-client.d.ts +1 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +1 -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/paths.d.ts +2 -14
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +5 -30
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/process-memory.d.ts +8 -0
- package/dist/utils/process-memory.d.ts.map +1 -0
- package/dist/utils/process-memory.js +11 -0
- package/dist/utils/process-memory.js.map +1 -0
- package/dist/utils/shell.d.ts +0 -9
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +0 -37
- package/dist/utils/shell.js.map +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/sdk/11-sessions.ts +8 -8
- package/examples/sdk/13-session-runtime.ts +1 -1
- package/npm-shrinkwrap.json +12 -12
- package/package.json +4 -4
- package/dist/core/compaction/branch-summarization.d.ts +0 -88
- package/dist/core/compaction/branch-summarization.d.ts.map +0 -1
- package/dist/core/compaction/branch-summarization.js +0 -243
- package/dist/core/compaction/branch-summarization.js.map +0 -1
- package/dist/core/compaction/compaction.d.ts +0 -143
- package/dist/core/compaction/compaction.d.ts.map +0 -1
- package/dist/core/compaction/compaction.js +0 -659
- package/dist/core/compaction/compaction.js.map +0 -1
- package/dist/core/compaction/index.d.ts +0 -7
- package/dist/core/compaction/index.d.ts.map +0 -1
- package/dist/core/compaction/index.js +0 -7
- package/dist/core/compaction/index.js.map +0 -1
- package/dist/core/compaction/utils.d.ts +0 -38
- package/dist/core/compaction/utils.d.ts.map +0 -1
- package/dist/core/compaction/utils.js +0 -153
- package/dist/core/compaction/utils.js.map +0 -1
- package/dist/core/message-retention.d.ts +0 -26
- package/dist/core/message-retention.d.ts.map +0 -1
- package/dist/core/message-retention.js +0 -95
- package/dist/core/message-retention.js.map +0 -1
- package/dist/core/messages.d.ts +0 -77
- package/dist/core/messages.d.ts.map +0 -1
- package/dist/core/messages.js +0 -123
- package/dist/core/messages.js.map +0 -1
- package/dist/core/session-manager.d.ts +0 -337
- package/dist/core/session-manager.d.ts.map +0 -1
- package/dist/core/session-manager.js +0 -1328
- package/dist/core/session-manager.js.map +0 -1
- package/dist/core/tools/truncate.d.ts +0 -70
- package/dist/core/tools/truncate.d.ts.map +0 -1
- package/dist/core/tools/truncate.js +0 -215
- package/dist/core/tools/truncate.js.map +0 -1
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `/autonomy` and `/auto-learn` command bodies extracted from interactive-mode.
|
|
3
|
+
*
|
|
4
|
+
* These render the autonomy/auto-learn status blocks and dispatch the autonomy
|
|
5
|
+
* sub-actions (mode presets, diagnostics, rollback, one-off fitness/research
|
|
6
|
+
* lanes) through a narrow `AutonomyHost` seam. `applyAutonomyMode`,
|
|
7
|
+
* `launchAutoLearn`, and the auto-learn getters stay host-side (shared with the
|
|
8
|
+
* settings selector and AutoLearnController); interactive-mode keeps thin
|
|
9
|
+
* delegating wrappers.
|
|
10
|
+
*/
|
|
11
|
+
import { Spacer, Text } from "@caupulican/pi-tui";
|
|
12
|
+
import { formatAutonomyDiagnostics } from "../../core/autonomy/status.js";
|
|
13
|
+
import { formatModelFitnessReport } from "../../core/research/model-fitness.js";
|
|
14
|
+
import { AUTONOMY_MODES } from "./auto-learn-controller.js";
|
|
15
|
+
export function formatAutonomyStatus(host) {
|
|
16
|
+
const autonomy = host.settingsManager.getAutonomySettings();
|
|
17
|
+
const settings = host.getEffectiveAutoLearnSettings();
|
|
18
|
+
const autoLearnState = host.getPrunedAutoLearnState();
|
|
19
|
+
const tenant = host.getAutoLearnTenantKey();
|
|
20
|
+
const running = Object.entries(autoLearnState.runs ?? {}).filter(([, run]) => run.tenant === tenant);
|
|
21
|
+
const otherTenantRunning = Object.values(autoLearnState.runs ?? {}).filter((run) => run.tenant !== tenant).length;
|
|
22
|
+
const safety = autonomy.mode === "full"
|
|
23
|
+
? "standing grant for memory, skills, user/project extensions, autonomy/autoLearn tuning, and authorized selfModification.sourcePath edits; hard stops still require explicit foreground approval"
|
|
24
|
+
: "proposal-gated outside configured high-confidence memory policy";
|
|
25
|
+
const reflectionLine = autonomy.mode === "full"
|
|
26
|
+
? `Reflection review: ${settings.reflectionReview ? "enabled" : "disabled"}; post-turn when concurrency allows; cooldown=${settings.reflectionCooldownMinutes}m`
|
|
27
|
+
: `Reflection review: ${settings.reflectionReview ? "enabled" : "disabled"}; tool trigger=${settings.reflectionMinToolCalls}; cooldown=${settings.reflectionCooldownMinutes}m`;
|
|
28
|
+
return [
|
|
29
|
+
"Autonomy status",
|
|
30
|
+
`Mode: ${autonomy.mode}${autonomy.mode === "full" ? " (standing autonomy)" : ""}`,
|
|
31
|
+
`Goal loop rounds: ${autonomy.maxStallTurns}`,
|
|
32
|
+
`Auto Learn: ${settings.enabled ? "enabled" : "disabled"}; model=${settings.model}; applyHighConfidence=${settings.applyHighConfidence}`,
|
|
33
|
+
`Long-session trigger: ${settings.longSessionMessages} messages or ${settings.longSessionContextPercent}% context; cooldown=${settings.cooldownMinutes}m`,
|
|
34
|
+
reflectionLine,
|
|
35
|
+
`Running tenant learners: ${running.length}/${settings.maxConcurrentLearners}`,
|
|
36
|
+
`Other tenant learners: ${otherTenantRunning}`,
|
|
37
|
+
"History retention: 7 days for internal Auto Learn prompts/logs/sessions",
|
|
38
|
+
`Standing authority: ${safety}`,
|
|
39
|
+
`Audit/log dir: ${host.getAutoLearnDataDir()}`,
|
|
40
|
+
`Tenant artifact dir: ${host.getAutoLearnTenantDataDir()}`,
|
|
41
|
+
"Use /autonomy off|safe|balanced|full to switch presets. Advanced overrides remain in /settings → Auto Learn Advanced.",
|
|
42
|
+
].join("\n");
|
|
43
|
+
}
|
|
44
|
+
export function handleAutonomyCommand(host, text) {
|
|
45
|
+
const action = text.slice("/autonomy".length).trim() || "status";
|
|
46
|
+
if (AUTONOMY_MODES.includes(action)) {
|
|
47
|
+
const mode = action;
|
|
48
|
+
host.applyAutonomyMode(mode);
|
|
49
|
+
host.showStatus(`Autonomy mode set to ${mode}${mode === "full" ? " (standing autonomy)" : ""}.`);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (action === "status") {
|
|
53
|
+
host.chatContainer.addChild(new Spacer(1));
|
|
54
|
+
host.chatContainer.addChild(new Text(formatAutonomyStatus(host), 1, 0));
|
|
55
|
+
host.ui.requestRender();
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (action === "diagnostics") {
|
|
59
|
+
host.chatContainer.addChild(new Spacer(1));
|
|
60
|
+
host.chatContainer.addChild(new Text(formatAutonomyDiagnostics(host.session.getAutonomyDiagnosticSnapshot()), 1, 0));
|
|
61
|
+
host.ui.requestRender();
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (action.startsWith("rollback")) {
|
|
65
|
+
const auditId = action.slice("rollback".length).trim();
|
|
66
|
+
if (!auditId) {
|
|
67
|
+
host.showStatus("Usage: /autonomy rollback <auditId> (see /autonomy diagnostics for audit ids)");
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
void host.session
|
|
71
|
+
.rollbackLearningWrite(auditId)
|
|
72
|
+
.then((result) => {
|
|
73
|
+
host.showStatus(result.ok ? `Rolled back learning change ${auditId}.` : `Rollback skipped: ${result.reason}`);
|
|
74
|
+
})
|
|
75
|
+
.catch((error) => {
|
|
76
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
77
|
+
host.showStatus(`Rollback failed: ${message}`);
|
|
78
|
+
});
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (action.startsWith("fitness")) {
|
|
82
|
+
const rest = action.slice("fitness".length).trim().split(/\s+/).filter(Boolean);
|
|
83
|
+
const modelPattern = rest[0];
|
|
84
|
+
if (!modelPattern) {
|
|
85
|
+
host.showStatus("Usage: /autonomy fitness <model-pattern> [trials]");
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const trials = rest[1] ? Number(rest[1]) : undefined;
|
|
89
|
+
host.showStatus(`Model fitness probe running on ${modelPattern}…`);
|
|
90
|
+
void host.session
|
|
91
|
+
.runModelFitness({ model: modelPattern, trials: Number.isFinite(trials) ? trials : undefined })
|
|
92
|
+
.then((outcome) => {
|
|
93
|
+
if (!outcome.started) {
|
|
94
|
+
host.showStatus(`Model fitness skipped: ${outcome.skipReason}`);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
host.chatContainer.addChild(new Spacer(1));
|
|
98
|
+
host.chatContainer.addChild(new Text(formatModelFitnessReport(outcome.model, outcome.report), 1, 0));
|
|
99
|
+
host.ui.requestRender();
|
|
100
|
+
})
|
|
101
|
+
.catch((error) => {
|
|
102
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
103
|
+
host.showStatus(`Model fitness failed: ${message}`);
|
|
104
|
+
});
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (action === "research") {
|
|
108
|
+
host.showStatus("Research lane: running…");
|
|
109
|
+
void host.session
|
|
110
|
+
.runResearchLaneOnce()
|
|
111
|
+
.then((outcome) => {
|
|
112
|
+
if (!outcome.started) {
|
|
113
|
+
host.showStatus(`Research lane skipped: ${outcome.skipReason ?? "unknown"}`);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const status = outcome.record?.status ?? "unknown";
|
|
117
|
+
const reason = outcome.record?.reasonCode ? ` (${outcome.record.reasonCode})` : "";
|
|
118
|
+
host.showStatus(`Research lane ${status}${reason}`);
|
|
119
|
+
})
|
|
120
|
+
.catch((error) => {
|
|
121
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
122
|
+
host.showStatus(`Research lane failed: ${message}`);
|
|
123
|
+
});
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
host.showStatus("Usage: /autonomy [status|diagnostics|research|rollback <auditId>|off|safe|balanced|full]");
|
|
127
|
+
}
|
|
128
|
+
export function handleAutoLearnCommand(host, text) {
|
|
129
|
+
const action = text.slice("/auto-learn".length).trim() || "status";
|
|
130
|
+
if (action === "run" || action === "now" || action === "run-now") {
|
|
131
|
+
host.showStatus(host.launchAutoLearn("manual", true));
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
if (action === "status") {
|
|
135
|
+
host.chatContainer.addChild(new Spacer(1));
|
|
136
|
+
host.chatContainer.addChild(new Text(host.formatAutoLearnStatus(), 1, 0));
|
|
137
|
+
host.ui.requestRender();
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
host.showStatus("Usage: /auto-learn [status|run]");
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=autonomy-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autonomy-commands.js","sourceRoot":"","sources":["../../../src/modes/interactive/autonomy-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,wBA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E,CAAC,CAAC;QAAA,CACpD,CAAC;aACD,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE,CAAC;YAC1B,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,IAAI,CAAC,UAAU,CAAC,yBAAyB,OAAO,EAAE,CAAC,CAAC;QAAA,CACpD,CAAC,CAAC;QACJ,OAAO;IACR,CAAC;IACD,IAAI,CAAC,UAAU,CAAC,0FAA0F,CAAC,CAAC;AAAA,CAC5G;AAED,MAAM,UAAU,sBAAsB,CAAC,IAAkB,EAAE,IAAY,EAAQ;IAC9E,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,QAAQ,CAAC;IACnE,IAAI,MAAM,KAAK,KAAK,IAAI,MAAM,KAAK,KAAK,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAClE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;QACtD,OAAO;IACR,CAAC;IACD,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;QACzB,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3C,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC1E,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;QACxB,OAAO;IACR,CAAC;IACD,IAAI,CAAC,UAAU,CAAC,iCAAiC,CAAC,CAAC;AAAA,CACnD","sourcesContent":["/**\n * `/autonomy` and `/auto-learn` command bodies extracted from interactive-mode.\n *\n * These render the autonomy/auto-learn status blocks and dispatch the autonomy\n * sub-actions (mode presets, diagnostics, rollback, one-off fitness/research\n * lanes) through a narrow `AutonomyHost` seam. `applyAutonomyMode`,\n * `launchAutoLearn`, and the auto-learn getters stay host-side (shared with the\n * settings selector and AutoLearnController); interactive-mode keeps thin\n * delegating wrappers.\n */\n\nimport type { Container, TUI } from \"@caupulican/pi-tui\";\nimport { Spacer, Text } from \"@caupulican/pi-tui\";\nimport type { AgentSession } from \"../../core/agent-session.ts\";\nimport { formatAutonomyDiagnostics } from \"../../core/autonomy/status.ts\";\nimport { formatModelFitnessReport } from \"../../core/research/model-fitness.ts\";\nimport type { AutoLearnSettings, AutonomyMode, SettingsManager, SettingsScope } from \"../../core/settings-manager.ts\";\nimport { AUTONOMY_MODES, type AutoLearnState } from \"./auto-learn-controller.ts\";\n\nexport interface AutonomyHost {\n\treadonly session: AgentSession;\n\treadonly settingsManager: SettingsManager;\n\treadonly chatContainer: Container;\n\treadonly ui: TUI;\n\tshowStatus(message: string): void;\n\tapplyAutonomyMode(mode: AutonomyMode, scope?: SettingsScope): void;\n\tlaunchAutoLearn(\n\t\treason: string,\n\t\tforce?: boolean,\n\t\toptions?: {\n\t\t\tcooldownKind?: \"auto\" | \"reflection\";\n\t\t\tpromptKind?: \"auto\" | \"reflection\";\n\t\t\tturnDigest?: string;\n\t\t\tbypassReflectionCooldown?: boolean;\n\t\t},\n\t): string;\n\tformatAutoLearnStatus(): string;\n\tgetEffectiveAutoLearnSettings(): Required<AutoLearnSettings>;\n\tgetPrunedAutoLearnState(): AutoLearnState;\n\tgetAutoLearnTenantKey(): string;\n\tgetAutoLearnDataDir(): string;\n\tgetAutoLearnTenantDataDir(): string;\n}\n\nexport function formatAutonomyStatus(host: AutonomyHost): string {\n\tconst autonomy = host.settingsManager.getAutonomySettings();\n\tconst settings = host.getEffectiveAutoLearnSettings();\n\tconst autoLearnState = host.getPrunedAutoLearnState();\n\tconst tenant = host.getAutoLearnTenantKey();\n\tconst running = Object.entries(autoLearnState.runs ?? {}).filter(([, run]) => run.tenant === tenant);\n\tconst otherTenantRunning = Object.values(autoLearnState.runs ?? {}).filter((run) => run.tenant !== tenant).length;\n\tconst safety =\n\t\tautonomy.mode === \"full\"\n\t\t\t? \"standing grant for memory, skills, user/project extensions, autonomy/autoLearn tuning, and authorized selfModification.sourcePath edits; hard stops still require explicit foreground approval\"\n\t\t\t: \"proposal-gated outside configured high-confidence memory policy\";\n\tconst reflectionLine =\n\t\tautonomy.mode === \"full\"\n\t\t\t? `Reflection review: ${settings.reflectionReview ? \"enabled\" : \"disabled\"}; post-turn when concurrency allows; cooldown=${settings.reflectionCooldownMinutes}m`\n\t\t\t: `Reflection review: ${settings.reflectionReview ? \"enabled\" : \"disabled\"}; tool trigger=${settings.reflectionMinToolCalls}; cooldown=${settings.reflectionCooldownMinutes}m`;\n\treturn [\n\t\t\"Autonomy status\",\n\t\t`Mode: ${autonomy.mode}${autonomy.mode === \"full\" ? \" (standing autonomy)\" : \"\"}`,\n\t\t`Goal loop rounds: ${autonomy.maxStallTurns}`,\n\t\t`Auto Learn: ${settings.enabled ? \"enabled\" : \"disabled\"}; model=${settings.model}; applyHighConfidence=${settings.applyHighConfidence}`,\n\t\t`Long-session trigger: ${settings.longSessionMessages} messages or ${settings.longSessionContextPercent}% context; cooldown=${settings.cooldownMinutes}m`,\n\t\treflectionLine,\n\t\t`Running tenant learners: ${running.length}/${settings.maxConcurrentLearners}`,\n\t\t`Other tenant learners: ${otherTenantRunning}`,\n\t\t\"History retention: 7 days for internal Auto Learn prompts/logs/sessions\",\n\t\t`Standing authority: ${safety}`,\n\t\t`Audit/log dir: ${host.getAutoLearnDataDir()}`,\n\t\t`Tenant artifact dir: ${host.getAutoLearnTenantDataDir()}`,\n\t\t\"Use /autonomy off|safe|balanced|full to switch presets. Advanced overrides remain in /settings → Auto Learn Advanced.\",\n\t].join(\"\\n\");\n}\n\nexport function handleAutonomyCommand(host: AutonomyHost, text: string): void {\n\tconst action = text.slice(\"/autonomy\".length).trim() || \"status\";\n\tif (AUTONOMY_MODES.includes(action as AutonomyMode)) {\n\t\tconst mode = action as AutonomyMode;\n\t\thost.applyAutonomyMode(mode);\n\t\thost.showStatus(`Autonomy mode set to ${mode}${mode === \"full\" ? \" (standing autonomy)\" : \"\"}.`);\n\t\treturn;\n\t}\n\tif (action === \"status\") {\n\t\thost.chatContainer.addChild(new Spacer(1));\n\t\thost.chatContainer.addChild(new Text(formatAutonomyStatus(host), 1, 0));\n\t\thost.ui.requestRender();\n\t\treturn;\n\t}\n\tif (action === \"diagnostics\") {\n\t\thost.chatContainer.addChild(new Spacer(1));\n\t\thost.chatContainer.addChild(\n\t\t\tnew Text(formatAutonomyDiagnostics(host.session.getAutonomyDiagnosticSnapshot()), 1, 0),\n\t\t);\n\t\thost.ui.requestRender();\n\t\treturn;\n\t}\n\tif (action.startsWith(\"rollback\")) {\n\t\tconst auditId = action.slice(\"rollback\".length).trim();\n\t\tif (!auditId) {\n\t\t\thost.showStatus(\"Usage: /autonomy rollback <auditId> (see /autonomy diagnostics for audit ids)\");\n\t\t\treturn;\n\t\t}\n\t\tvoid host.session\n\t\t\t.rollbackLearningWrite(auditId)\n\t\t\t.then((result) => {\n\t\t\t\thost.showStatus(\n\t\t\t\t\tresult.ok ? `Rolled back learning change ${auditId}.` : `Rollback skipped: ${result.reason}`,\n\t\t\t\t);\n\t\t\t})\n\t\t\t.catch((error: unknown) => {\n\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\thost.showStatus(`Rollback failed: ${message}`);\n\t\t\t});\n\t\treturn;\n\t}\n\tif (action.startsWith(\"fitness\")) {\n\t\tconst rest = action.slice(\"fitness\".length).trim().split(/\\s+/).filter(Boolean);\n\t\tconst modelPattern = rest[0];\n\t\tif (!modelPattern) {\n\t\t\thost.showStatus(\"Usage: /autonomy fitness <model-pattern> [trials]\");\n\t\t\treturn;\n\t\t}\n\t\tconst trials = rest[1] ? Number(rest[1]) : undefined;\n\t\thost.showStatus(`Model fitness probe running on ${modelPattern}…`);\n\t\tvoid host.session\n\t\t\t.runModelFitness({ model: modelPattern, trials: Number.isFinite(trials) ? trials : undefined })\n\t\t\t.then((outcome) => {\n\t\t\t\tif (!outcome.started) {\n\t\t\t\t\thost.showStatus(`Model fitness skipped: ${outcome.skipReason}`);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\thost.chatContainer.addChild(new Spacer(1));\n\t\t\t\thost.chatContainer.addChild(new Text(formatModelFitnessReport(outcome.model, outcome.report), 1, 0));\n\t\t\t\thost.ui.requestRender();\n\t\t\t})\n\t\t\t.catch((error: unknown) => {\n\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\thost.showStatus(`Model fitness failed: ${message}`);\n\t\t\t});\n\t\treturn;\n\t}\n\tif (action === \"research\") {\n\t\thost.showStatus(\"Research lane: running…\");\n\t\tvoid host.session\n\t\t\t.runResearchLaneOnce()\n\t\t\t.then((outcome) => {\n\t\t\t\tif (!outcome.started) {\n\t\t\t\t\thost.showStatus(`Research lane skipped: ${outcome.skipReason ?? \"unknown\"}`);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst status = outcome.record?.status ?? \"unknown\";\n\t\t\t\tconst reason = outcome.record?.reasonCode ? ` (${outcome.record.reasonCode})` : \"\";\n\t\t\t\thost.showStatus(`Research lane ${status}${reason}`);\n\t\t\t})\n\t\t\t.catch((error: unknown) => {\n\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\thost.showStatus(`Research lane failed: ${message}`);\n\t\t\t});\n\t\treturn;\n\t}\n\thost.showStatus(\"Usage: /autonomy [status|diagnostics|research|rollback <auditId>|off|safe|balanced|full]\");\n}\n\nexport function handleAutoLearnCommand(host: AutonomyHost, text: string): void {\n\tconst action = text.slice(\"/auto-learn\".length).trim() || \"status\";\n\tif (action === \"run\" || action === \"now\" || action === \"run-now\") {\n\t\thost.showStatus(host.launchAutoLearn(\"manual\", true));\n\t\treturn;\n\t}\n\tif (action === \"status\") {\n\t\thost.chatContainer.addChild(new Spacer(1));\n\t\thost.chatContainer.addChild(new Text(host.formatAutoLearnStatus(), 1, 0));\n\t\thost.ui.requestRender();\n\t\treturn;\n\t}\n\thost.showStatus(\"Usage: /auto-learn [status|run]\");\n}\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clipboard-image paste and user-input assembly extracted from interactive-mode.
|
|
3
|
+
*
|
|
4
|
+
* `handleClipboardImagePaste` reads an image off the clipboard, labels it, and
|
|
5
|
+
* queues it for the next submission; `takeClipboardImagesForText` drains the
|
|
6
|
+
* queued images whose labels survive in the submitted text; and
|
|
7
|
+
* `buildUserInputSubmission` pairs the text with those images. They mutate the
|
|
8
|
+
* pending-image queue/counter through a `ClipboardInputHost` seam;
|
|
9
|
+
* interactive-mode keeps thin wrappers.
|
|
10
|
+
*/
|
|
11
|
+
import type { ImageContent } from "@caupulican/pi-ai";
|
|
12
|
+
import type { EditorComponent, TUI } from "@caupulican/pi-tui";
|
|
13
|
+
export type UserInputSubmission = {
|
|
14
|
+
text: string;
|
|
15
|
+
images?: ImageContent[];
|
|
16
|
+
};
|
|
17
|
+
export type PendingClipboardImage = {
|
|
18
|
+
label: string;
|
|
19
|
+
content: ImageContent;
|
|
20
|
+
};
|
|
21
|
+
export interface ClipboardQueueHost {
|
|
22
|
+
pendingClipboardImages: PendingClipboardImage[];
|
|
23
|
+
clipboardImageCounter: number;
|
|
24
|
+
}
|
|
25
|
+
export interface ClipboardInputHost extends ClipboardQueueHost {
|
|
26
|
+
readonly editor: Pick<EditorComponent, "insertTextAtCursor">;
|
|
27
|
+
readonly ui: Pick<TUI, "requestRender">;
|
|
28
|
+
showStatus(message: string): void;
|
|
29
|
+
showWarning(message: string): void;
|
|
30
|
+
}
|
|
31
|
+
export interface BuildSubmissionHost {
|
|
32
|
+
takeClipboardImagesForText(text: string): ImageContent[] | undefined;
|
|
33
|
+
}
|
|
34
|
+
export declare function handleClipboardImagePaste(host: ClipboardInputHost): Promise<void>;
|
|
35
|
+
export declare function takeClipboardImagesForText(host: ClipboardQueueHost, text: string): ImageContent[] | undefined;
|
|
36
|
+
export declare function buildUserInputSubmission(host: BuildSubmissionHost, text: string): UserInputSubmission;
|
|
37
|
+
//# sourceMappingURL=clipboard-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipboard-input.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/clipboard-input.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAG/D,MAAM,MAAM,mBAAmB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,YAAY,CAAC;CACtB,CAAC;AAEF,MAAM,WAAW,kBAAkB;IAClC,sBAAsB,EAAE,qBAAqB,EAAE,CAAC;IAChD,qBAAqB,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,kBAAmB,SAAQ,kBAAkB;IAC7D,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,oBAAoB,CAAC,CAAC;IAC7D,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;IACxC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAED,MAAM,WAAW,mBAAmB;IACnC,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,EAAE,GAAG,SAAS,CAAC;CACrE;AAED,wBAAsB,yBAAyB,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBvF;AAUD,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,EAAE,GAAG,SAAS,CAW7G;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,GAAG,mBAAmB,CAGrG","sourcesContent":["/**\n * Clipboard-image paste and user-input assembly extracted from interactive-mode.\n *\n * `handleClipboardImagePaste` reads an image off the clipboard, labels it, and\n * queues it for the next submission; `takeClipboardImagesForText` drains the\n * queued images whose labels survive in the submitted text; and\n * `buildUserInputSubmission` pairs the text with those images. They mutate the\n * pending-image queue/counter through a `ClipboardInputHost` seam;\n * interactive-mode keeps thin wrappers.\n */\n\nimport type { ImageContent } from \"@caupulican/pi-ai\";\nimport type { EditorComponent, TUI } from \"@caupulican/pi-tui\";\nimport { readClipboardImage } from \"../../utils/clipboard-image.ts\";\n\nexport type UserInputSubmission = {\n\ttext: string;\n\timages?: ImageContent[];\n};\n\nexport type PendingClipboardImage = {\n\tlabel: string;\n\tcontent: ImageContent;\n};\n\nexport interface ClipboardQueueHost {\n\tpendingClipboardImages: PendingClipboardImage[];\n\tclipboardImageCounter: number;\n}\n\nexport interface ClipboardInputHost extends ClipboardQueueHost {\n\treadonly editor: Pick<EditorComponent, \"insertTextAtCursor\">;\n\treadonly ui: Pick<TUI, \"requestRender\">;\n\tshowStatus(message: string): void;\n\tshowWarning(message: string): void;\n}\n\nexport interface BuildSubmissionHost {\n\ttakeClipboardImagesForText(text: string): ImageContent[] | undefined;\n}\n\nexport async function handleClipboardImagePaste(host: ClipboardInputHost): Promise<void> {\n\ttry {\n\t\tconst image = await readClipboardImage();\n\t\tif (!image) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst label = nextClipboardImageLabel(host);\n\t\tconst mimeType = image.mimeType.split(\";\")[0]?.trim().toLowerCase() || image.mimeType;\n\t\thost.pendingClipboardImages.push({\n\t\t\tlabel,\n\t\t\tcontent: {\n\t\t\t\ttype: \"image\",\n\t\t\t\tdata: Buffer.from(image.bytes).toString(\"base64\"),\n\t\t\t\tmimeType,\n\t\t\t},\n\t\t});\n\n\t\thost.editor.insertTextAtCursor?.(`${label} `);\n\t\thost.showStatus(`Attached clipboard image ${label} (${mimeType})`);\n\t\thost.ui.requestRender();\n\t} catch (error: unknown) {\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\thost.showWarning(`Failed to paste image: ${message}`);\n\t}\n}\n\nfunction nextClipboardImageLabel(host: ClipboardQueueHost): string {\n\tif (host.pendingClipboardImages.length === 0) {\n\t\thost.clipboardImageCounter = 0;\n\t}\n\thost.clipboardImageCounter += 1;\n\treturn `[Image #${host.clipboardImageCounter}]`;\n}\n\nexport function takeClipboardImagesForText(host: ClipboardQueueHost, text: string): ImageContent[] | undefined {\n\tif (host.pendingClipboardImages.length === 0) {\n\t\treturn undefined;\n\t}\n\n\tconst images = host.pendingClipboardImages\n\t\t.filter((image) => text.includes(image.label))\n\t\t.map((image) => image.content);\n\thost.pendingClipboardImages = [];\n\thost.clipboardImageCounter = 0;\n\treturn images.length > 0 ? images : undefined;\n}\n\nexport function buildUserInputSubmission(host: BuildSubmissionHost, text: string): UserInputSubmission {\n\tconst images = host.takeClipboardImagesForText(text);\n\treturn images ? { text, images } : { text };\n}\n"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clipboard-image paste and user-input assembly extracted from interactive-mode.
|
|
3
|
+
*
|
|
4
|
+
* `handleClipboardImagePaste` reads an image off the clipboard, labels it, and
|
|
5
|
+
* queues it for the next submission; `takeClipboardImagesForText` drains the
|
|
6
|
+
* queued images whose labels survive in the submitted text; and
|
|
7
|
+
* `buildUserInputSubmission` pairs the text with those images. They mutate the
|
|
8
|
+
* pending-image queue/counter through a `ClipboardInputHost` seam;
|
|
9
|
+
* interactive-mode keeps thin wrappers.
|
|
10
|
+
*/
|
|
11
|
+
import { readClipboardImage } from "../../utils/clipboard-image.js";
|
|
12
|
+
export async function handleClipboardImagePaste(host) {
|
|
13
|
+
try {
|
|
14
|
+
const image = await readClipboardImage();
|
|
15
|
+
if (!image) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const label = nextClipboardImageLabel(host);
|
|
19
|
+
const mimeType = image.mimeType.split(";")[0]?.trim().toLowerCase() || image.mimeType;
|
|
20
|
+
host.pendingClipboardImages.push({
|
|
21
|
+
label,
|
|
22
|
+
content: {
|
|
23
|
+
type: "image",
|
|
24
|
+
data: Buffer.from(image.bytes).toString("base64"),
|
|
25
|
+
mimeType,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
host.editor.insertTextAtCursor?.(`${label} `);
|
|
29
|
+
host.showStatus(`Attached clipboard image ${label} (${mimeType})`);
|
|
30
|
+
host.ui.requestRender();
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
34
|
+
host.showWarning(`Failed to paste image: ${message}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function nextClipboardImageLabel(host) {
|
|
38
|
+
if (host.pendingClipboardImages.length === 0) {
|
|
39
|
+
host.clipboardImageCounter = 0;
|
|
40
|
+
}
|
|
41
|
+
host.clipboardImageCounter += 1;
|
|
42
|
+
return `[Image #${host.clipboardImageCounter}]`;
|
|
43
|
+
}
|
|
44
|
+
export function takeClipboardImagesForText(host, text) {
|
|
45
|
+
if (host.pendingClipboardImages.length === 0) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
const images = host.pendingClipboardImages
|
|
49
|
+
.filter((image) => text.includes(image.label))
|
|
50
|
+
.map((image) => image.content);
|
|
51
|
+
host.pendingClipboardImages = [];
|
|
52
|
+
host.clipboardImageCounter = 0;
|
|
53
|
+
return images.length > 0 ? images : undefined;
|
|
54
|
+
}
|
|
55
|
+
export function buildUserInputSubmission(host, text) {
|
|
56
|
+
const images = host.takeClipboardImagesForText(text);
|
|
57
|
+
return images ? { text, images } : { text };
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=clipboard-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipboard-input.js","sourceRoot":"","sources":["../../../src/modes/interactive/clipboard-input.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AA4BpE,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,IAAwB,EAAiB;IACxF,IAAI,CAAC;QACJ,MAAM,KAAK,GAAG,MAAM,kBAAkB,EAAE,CAAC;QACzC,IAAI,CAAC,KAAK,EAAE,CAAC;YACZ,OAAO;QACR,CAAC;QAED,MAAM,KAAK,GAAG,uBAAuB,CAAC,IAAI,CAAC,CAAC;QAC5C,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,IAAI,KAAK,CAAC,QAAQ,CAAC;QACtF,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC;YAChC,KAAK;YACL,OAAO,EAAE;gBACR,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBACjD,QAAQ;aACR;SACD,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;QAC9C,IAAI,CAAC,UAAU,CAAC,4BAA4B,KAAK,KAAK,QAAQ,GAAG,CAAC,CAAC;QACnE,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;IACzB,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC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AAC,EAAE,IAAI,EAAE,CAAC;AAAA,CAC5C","sourcesContent":["/**\n * Clipboard-image paste and user-input assembly extracted from interactive-mode.\n *\n * `handleClipboardImagePaste` reads an image off the clipboard, labels it, and\n * queues it for the next submission; `takeClipboardImagesForText` drains the\n * queued images whose labels survive in the submitted text; and\n * `buildUserInputSubmission` pairs the text with those images. They mutate the\n * pending-image queue/counter through a `ClipboardInputHost` seam;\n * interactive-mode keeps thin wrappers.\n */\n\nimport type { ImageContent } from \"@caupulican/pi-ai\";\nimport type { EditorComponent, TUI } from \"@caupulican/pi-tui\";\nimport { readClipboardImage } from \"../../utils/clipboard-image.ts\";\n\nexport type UserInputSubmission = {\n\ttext: string;\n\timages?: ImageContent[];\n};\n\nexport type PendingClipboardImage = {\n\tlabel: string;\n\tcontent: ImageContent;\n};\n\nexport interface ClipboardQueueHost {\n\tpendingClipboardImages: PendingClipboardImage[];\n\tclipboardImageCounter: number;\n}\n\nexport interface ClipboardInputHost extends ClipboardQueueHost {\n\treadonly editor: Pick<EditorComponent, \"insertTextAtCursor\">;\n\treadonly ui: Pick<TUI, \"requestRender\">;\n\tshowStatus(message: string): void;\n\tshowWarning(message: string): void;\n}\n\nexport interface BuildSubmissionHost {\n\ttakeClipboardImagesForText(text: string): ImageContent[] | undefined;\n}\n\nexport async function handleClipboardImagePaste(host: ClipboardInputHost): Promise<void> {\n\ttry {\n\t\tconst image = await readClipboardImage();\n\t\tif (!image) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst label = nextClipboardImageLabel(host);\n\t\tconst mimeType = image.mimeType.split(\";\")[0]?.trim().toLowerCase() || image.mimeType;\n\t\thost.pendingClipboardImages.push({\n\t\t\tlabel,\n\t\t\tcontent: {\n\t\t\t\ttype: \"image\",\n\t\t\t\tdata: Buffer.from(image.bytes).toString(\"base64\"),\n\t\t\t\tmimeType,\n\t\t\t},\n\t\t});\n\n\t\thost.editor.insertTextAtCursor?.(`${label} `);\n\t\thost.showStatus(`Attached clipboard image ${label} (${mimeType})`);\n\t\thost.ui.requestRender();\n\t} catch (error: unknown) {\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\thost.showWarning(`Failed to paste image: ${message}`);\n\t}\n}\n\nfunction nextClipboardImageLabel(host: ClipboardQueueHost): string {\n\tif (host.pendingClipboardImages.length === 0) {\n\t\thost.clipboardImageCounter = 0;\n\t}\n\thost.clipboardImageCounter += 1;\n\treturn `[Image #${host.clipboardImageCounter}]`;\n}\n\nexport function takeClipboardImagesForText(host: ClipboardQueueHost, text: string): ImageContent[] | undefined {\n\tif (host.pendingClipboardImages.length === 0) {\n\t\treturn undefined;\n\t}\n\n\tconst images = host.pendingClipboardImages\n\t\t.filter((image) => text.includes(image.label))\n\t\t.map((image) => image.content);\n\thost.pendingClipboardImages = [];\n\thost.clipboardImageCounter = 0;\n\treturn images.length > 0 ? images : undefined;\n}\n\nexport function buildUserInputSubmission(host: BuildSubmissionHost, text: string): UserInputSubmission {\n\tconst images = host.takeClipboardImagesForText(text);\n\treturn images ? { text, images } : { text };\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compaction-queue flushing extracted from interactive-mode.
|
|
3
|
+
*
|
|
4
|
+
* When auto-compaction runs while the user has queued follow-up/steer messages,
|
|
5
|
+
* `flushCompactionQueue` drains that queue after compaction settles — sending the
|
|
6
|
+
* first non-command message as the resuming prompt, replaying steer/follow-up
|
|
7
|
+
* modes for the rest, executing extension commands inline, and restoring the
|
|
8
|
+
* queue on failure. It mutates the queue through a `CompactionQueueHost` seam
|
|
9
|
+
* (`compactionQueuedMessages` via get/set); interactive-mode keeps a thin wrapper
|
|
10
|
+
* (retained on the prototype for the compaction_end event handler).
|
|
11
|
+
*/
|
|
12
|
+
import type { ImageContent } from "@caupulican/pi-ai";
|
|
13
|
+
import type { AgentSession } from "../../core/agent-session.ts";
|
|
14
|
+
export type CompactionQueuedMessage = {
|
|
15
|
+
text: string;
|
|
16
|
+
mode: "steer" | "followUp";
|
|
17
|
+
images?: ImageContent[];
|
|
18
|
+
};
|
|
19
|
+
export interface CompactionQueueHost {
|
|
20
|
+
compactionQueuedMessages: CompactionQueuedMessage[];
|
|
21
|
+
readonly session: Pick<AgentSession, "isStreaming" | "prompt" | "followUp" | "steer" | "clearQueue">;
|
|
22
|
+
updatePendingMessagesDisplay(): void;
|
|
23
|
+
showError(message: string): void;
|
|
24
|
+
isExtensionCommand(text: string): boolean;
|
|
25
|
+
refreshAutonomyFooterStatus(): void;
|
|
26
|
+
}
|
|
27
|
+
export declare function flushCompactionQueue(host: CompactionQueueHost, options?: {
|
|
28
|
+
willRetry?: boolean;
|
|
29
|
+
}): Promise<void>;
|
|
30
|
+
//# sourceMappingURL=compaction-queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compaction-queue.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/compaction-queue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,MAAM,MAAM,uBAAuB,GAAG;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,GAAG,UAAU,CAAC;IAC3B,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,WAAW,mBAAmB;IACnC,wBAAwB,EAAE,uBAAuB,EAAE,CAAC;IACpD,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,aAAa,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,YAAY,CAAC,CAAC;IACrG,4BAA4B,IAAI,IAAI,CAAC;IACrC,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1C,2BAA2B,IAAI,IAAI,CAAC;CACpC;AAED,wBAAsB,oBAAoB,CACzC,IAAI,EAAE,mBAAmB,EACzB,OAAO,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GAC/B,OAAO,CAAC,IAAI,CAAC,CAqFf","sourcesContent":["/**\n * Compaction-queue flushing extracted from interactive-mode.\n *\n * When auto-compaction runs while the user has queued follow-up/steer messages,\n * `flushCompactionQueue` drains that queue after compaction settles — sending the\n * first non-command message as the resuming prompt, replaying steer/follow-up\n * modes for the rest, executing extension commands inline, and restoring the\n * queue on failure. It mutates the queue through a `CompactionQueueHost` seam\n * (`compactionQueuedMessages` via get/set); interactive-mode keeps a thin wrapper\n * (retained on the prototype for the compaction_end event handler).\n */\n\nimport type { ImageContent } from \"@caupulican/pi-ai\";\nimport type { AgentSession } from \"../../core/agent-session.ts\";\n\nexport type CompactionQueuedMessage = {\n\ttext: string;\n\tmode: \"steer\" | \"followUp\";\n\timages?: ImageContent[];\n};\n\nexport interface CompactionQueueHost {\n\tcompactionQueuedMessages: CompactionQueuedMessage[];\n\treadonly session: Pick<AgentSession, \"isStreaming\" | \"prompt\" | \"followUp\" | \"steer\" | \"clearQueue\">;\n\tupdatePendingMessagesDisplay(): void;\n\tshowError(message: string): void;\n\tisExtensionCommand(text: string): boolean;\n\trefreshAutonomyFooterStatus(): void;\n}\n\nexport async function flushCompactionQueue(\n\thost: CompactionQueueHost,\n\toptions?: { willRetry?: boolean },\n): Promise<void> {\n\tif (host.compactionQueuedMessages.length === 0) {\n\t\treturn;\n\t}\n\n\tconst queuedMessages = [...host.compactionQueuedMessages];\n\thost.compactionQueuedMessages = [];\n\thost.updatePendingMessagesDisplay();\n\n\tconst restoreQueue = (error: unknown) => {\n\t\thost.session.clearQueue();\n\t\thost.compactionQueuedMessages = queuedMessages;\n\t\thost.updatePendingMessagesDisplay();\n\t\thost.showError(\n\t\t\t`Failed to send queued message${queuedMessages.length > 1 ? \"s\" : \"\"}: ${\n\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\t}`,\n\t\t);\n\t};\n\n\ttry {\n\t\tif (options?.willRetry) {\n\t\t\t// When retry is pending, queue messages for the retry turn\n\t\t\tfor (const message of queuedMessages) {\n\t\t\t\tif (host.isExtensionCommand(message.text)) {\n\t\t\t\t\tawait host.session.prompt(message.text);\n\t\t\t\t} else if (message.mode === \"followUp\") {\n\t\t\t\t\tawait host.session.followUp(message.text, message.images);\n\t\t\t\t} else {\n\t\t\t\t\tawait host.session.steer(message.text, message.images);\n\t\t\t\t}\n\t\t\t}\n\t\t\thost.updatePendingMessagesDisplay();\n\t\t\treturn;\n\t\t}\n\n\t\t// Find first non-extension-command message to use as prompt\n\t\tconst firstPromptIndex = queuedMessages.findIndex((message) => !host.isExtensionCommand(message.text));\n\t\tif (firstPromptIndex === -1) {\n\t\t\t// All extension commands - execute them all\n\t\t\tfor (const message of queuedMessages) {\n\t\t\t\tawait host.session.prompt(message.text);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Execute any extension commands before the first prompt\n\t\tconst preCommands = queuedMessages.slice(0, firstPromptIndex);\n\t\tconst firstPrompt = queuedMessages[firstPromptIndex];\n\t\tconst rest = queuedMessages.slice(firstPromptIndex + 1);\n\n\t\tfor (const message of preCommands) {\n\t\t\tawait host.session.prompt(message.text);\n\t\t}\n\n\t\t// Send first prompt (starts streaming). Auto-compaction can finish while the\n\t\t// agent is still processing; in that case, queue the message with the same\n\t\t// steering/follow-up mode instead of surfacing an internal streamingBehavior error.\n\t\tconst promptOptions = host.session.isStreaming\n\t\t\t? { images: firstPrompt.images, streamingBehavior: firstPrompt.mode }\n\t\t\t: { images: firstPrompt.images };\n\t\tconst promptPromise = host.session\n\t\t\t.prompt(firstPrompt.text, promptOptions)\n\t\t\t.catch((error) => {\n\t\t\t\trestoreQueue(error);\n\t\t\t})\n\t\t\t.finally(() => {\n\t\t\t\thost.refreshAutonomyFooterStatus();\n\t\t\t});\n\n\t\t// Queue remaining messages\n\t\tfor (const message of rest) {\n\t\t\tif (host.isExtensionCommand(message.text)) {\n\t\t\t\tawait host.session.prompt(message.text);\n\t\t\t} else if (message.mode === \"followUp\") {\n\t\t\t\tawait host.session.followUp(message.text, message.images);\n\t\t\t} else {\n\t\t\t\tawait host.session.steer(message.text, message.images);\n\t\t\t}\n\t\t}\n\t\thost.updatePendingMessagesDisplay();\n\t\tvoid promptPromise;\n\t} catch (error) {\n\t\trestoreQueue(error);\n\t}\n}\n"]}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compaction-queue flushing extracted from interactive-mode.
|
|
3
|
+
*
|
|
4
|
+
* When auto-compaction runs while the user has queued follow-up/steer messages,
|
|
5
|
+
* `flushCompactionQueue` drains that queue after compaction settles — sending the
|
|
6
|
+
* first non-command message as the resuming prompt, replaying steer/follow-up
|
|
7
|
+
* modes for the rest, executing extension commands inline, and restoring the
|
|
8
|
+
* queue on failure. It mutates the queue through a `CompactionQueueHost` seam
|
|
9
|
+
* (`compactionQueuedMessages` via get/set); interactive-mode keeps a thin wrapper
|
|
10
|
+
* (retained on the prototype for the compaction_end event handler).
|
|
11
|
+
*/
|
|
12
|
+
export async function flushCompactionQueue(host, options) {
|
|
13
|
+
if (host.compactionQueuedMessages.length === 0) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const queuedMessages = [...host.compactionQueuedMessages];
|
|
17
|
+
host.compactionQueuedMessages = [];
|
|
18
|
+
host.updatePendingMessagesDisplay();
|
|
19
|
+
const restoreQueue = (error) => {
|
|
20
|
+
host.session.clearQueue();
|
|
21
|
+
host.compactionQueuedMessages = queuedMessages;
|
|
22
|
+
host.updatePendingMessagesDisplay();
|
|
23
|
+
host.showError(`Failed to send queued message${queuedMessages.length > 1 ? "s" : ""}: ${error instanceof Error ? error.message : String(error)}`);
|
|
24
|
+
};
|
|
25
|
+
try {
|
|
26
|
+
if (options?.willRetry) {
|
|
27
|
+
// When retry is pending, queue messages for the retry turn
|
|
28
|
+
for (const message of queuedMessages) {
|
|
29
|
+
if (host.isExtensionCommand(message.text)) {
|
|
30
|
+
await host.session.prompt(message.text);
|
|
31
|
+
}
|
|
32
|
+
else if (message.mode === "followUp") {
|
|
33
|
+
await host.session.followUp(message.text, message.images);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
await host.session.steer(message.text, message.images);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
host.updatePendingMessagesDisplay();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
// Find first non-extension-command message to use as prompt
|
|
43
|
+
const firstPromptIndex = queuedMessages.findIndex((message) => !host.isExtensionCommand(message.text));
|
|
44
|
+
if (firstPromptIndex === -1) {
|
|
45
|
+
// All extension commands - execute them all
|
|
46
|
+
for (const message of queuedMessages) {
|
|
47
|
+
await host.session.prompt(message.text);
|
|
48
|
+
}
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
// Execute any extension commands before the first prompt
|
|
52
|
+
const preCommands = queuedMessages.slice(0, firstPromptIndex);
|
|
53
|
+
const firstPrompt = queuedMessages[firstPromptIndex];
|
|
54
|
+
const rest = queuedMessages.slice(firstPromptIndex + 1);
|
|
55
|
+
for (const message of preCommands) {
|
|
56
|
+
await host.session.prompt(message.text);
|
|
57
|
+
}
|
|
58
|
+
// Send first prompt (starts streaming). Auto-compaction can finish while the
|
|
59
|
+
// agent is still processing; in that case, queue the message with the same
|
|
60
|
+
// steering/follow-up mode instead of surfacing an internal streamingBehavior error.
|
|
61
|
+
const promptOptions = host.session.isStreaming
|
|
62
|
+
? { images: firstPrompt.images, streamingBehavior: firstPrompt.mode }
|
|
63
|
+
: { images: firstPrompt.images };
|
|
64
|
+
const promptPromise = host.session
|
|
65
|
+
.prompt(firstPrompt.text, promptOptions)
|
|
66
|
+
.catch((error) => {
|
|
67
|
+
restoreQueue(error);
|
|
68
|
+
})
|
|
69
|
+
.finally(() => {
|
|
70
|
+
host.refreshAutonomyFooterStatus();
|
|
71
|
+
});
|
|
72
|
+
// Queue remaining messages
|
|
73
|
+
for (const message of rest) {
|
|
74
|
+
if (host.isExtensionCommand(message.text)) {
|
|
75
|
+
await host.session.prompt(message.text);
|
|
76
|
+
}
|
|
77
|
+
else if (message.mode === "followUp") {
|
|
78
|
+
await host.session.followUp(message.text, message.images);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
await host.session.steer(message.text, message.images);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
host.updatePendingMessagesDisplay();
|
|
85
|
+
void promptPromise;
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
restoreQueue(error);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=compaction-queue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compaction-queue.js","sourceRoot":"","sources":["../../../src/modes/interactive/compaction-queue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAoBH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACzC,IAAyB,EACzB,OAAiC,EACjB;IAChB,IAAI,IAAI,CAAC,wBAAwB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChD,OAAO;IACR,CAAC;IAED,MAAM,cAAc,GAAG,CAAC,GAAG,IAAI,CAAC,wBAAwB,CAAC,CAAC;IAC1D,IAAI,CAAC,wBAAwB,GAAG,EAAE,CAAC;IACnC,IAAI,CAAC,4BAA4B,EAAE,CAAC;IAEpC,MAAM,YAAY,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC;QACxC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QAC1B,IAAI,CAAC,wBAAwB,GAAG,cAAc,CAAC;QAC/C,IAAI,CAAC,4BAA4B,EAAE,CAAC;QACpC,IAAI,CAAC,SAAS,CACb,gCAAgC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,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,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;YAC3D,CAAC;iBAAM,CAAC;gBACP,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;YACxD,CAAC;QACF,CAAC;QACD,IAAI,CAAC,4BAA4B,EAAE,CAAC;QACpC,KAAK,aAAa,CAAC;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,YAAY,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;AAAA,CACD","sourcesContent":["/**\n * Compaction-queue flushing extracted from interactive-mode.\n *\n * When auto-compaction runs while the user has queued follow-up/steer messages,\n * `flushCompactionQueue` drains that queue after compaction settles — sending the\n * first non-command message as the resuming prompt, replaying steer/follow-up\n * modes for the rest, executing extension commands inline, and restoring the\n * queue on failure. It mutates the queue through a `CompactionQueueHost` seam\n * (`compactionQueuedMessages` via get/set); interactive-mode keeps a thin wrapper\n * (retained on the prototype for the compaction_end event handler).\n */\n\nimport type { ImageContent } from \"@caupulican/pi-ai\";\nimport type { AgentSession } from \"../../core/agent-session.ts\";\n\nexport type CompactionQueuedMessage = {\n\ttext: string;\n\tmode: \"steer\" | \"followUp\";\n\timages?: ImageContent[];\n};\n\nexport interface CompactionQueueHost {\n\tcompactionQueuedMessages: CompactionQueuedMessage[];\n\treadonly session: Pick<AgentSession, \"isStreaming\" | \"prompt\" | \"followUp\" | \"steer\" | \"clearQueue\">;\n\tupdatePendingMessagesDisplay(): void;\n\tshowError(message: string): void;\n\tisExtensionCommand(text: string): boolean;\n\trefreshAutonomyFooterStatus(): void;\n}\n\nexport async function flushCompactionQueue(\n\thost: CompactionQueueHost,\n\toptions?: { willRetry?: boolean },\n): Promise<void> {\n\tif (host.compactionQueuedMessages.length === 0) {\n\t\treturn;\n\t}\n\n\tconst queuedMessages = [...host.compactionQueuedMessages];\n\thost.compactionQueuedMessages = [];\n\thost.updatePendingMessagesDisplay();\n\n\tconst restoreQueue = (error: unknown) => {\n\t\thost.session.clearQueue();\n\t\thost.compactionQueuedMessages = queuedMessages;\n\t\thost.updatePendingMessagesDisplay();\n\t\thost.showError(\n\t\t\t`Failed to send queued message${queuedMessages.length > 1 ? \"s\" : \"\"}: ${\n\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\t}`,\n\t\t);\n\t};\n\n\ttry {\n\t\tif (options?.willRetry) {\n\t\t\t// When retry is pending, queue messages for the retry turn\n\t\t\tfor (const message of queuedMessages) {\n\t\t\t\tif (host.isExtensionCommand(message.text)) {\n\t\t\t\t\tawait host.session.prompt(message.text);\n\t\t\t\t} else if (message.mode === \"followUp\") {\n\t\t\t\t\tawait host.session.followUp(message.text, message.images);\n\t\t\t\t} else {\n\t\t\t\t\tawait host.session.steer(message.text, message.images);\n\t\t\t\t}\n\t\t\t}\n\t\t\thost.updatePendingMessagesDisplay();\n\t\t\treturn;\n\t\t}\n\n\t\t// Find first non-extension-command message to use as prompt\n\t\tconst firstPromptIndex = queuedMessages.findIndex((message) => !host.isExtensionCommand(message.text));\n\t\tif (firstPromptIndex === -1) {\n\t\t\t// All extension commands - execute them all\n\t\t\tfor (const message of queuedMessages) {\n\t\t\t\tawait host.session.prompt(message.text);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Execute any extension commands before the first prompt\n\t\tconst preCommands = queuedMessages.slice(0, firstPromptIndex);\n\t\tconst firstPrompt = queuedMessages[firstPromptIndex];\n\t\tconst rest = queuedMessages.slice(firstPromptIndex + 1);\n\n\t\tfor (const message of preCommands) {\n\t\t\tawait host.session.prompt(message.text);\n\t\t}\n\n\t\t// Send first prompt (starts streaming). Auto-compaction can finish while the\n\t\t// agent is still processing; in that case, queue the message with the same\n\t\t// steering/follow-up mode instead of surfacing an internal streamingBehavior error.\n\t\tconst promptOptions = host.session.isStreaming\n\t\t\t? { images: firstPrompt.images, streamingBehavior: firstPrompt.mode }\n\t\t\t: { images: firstPrompt.images };\n\t\tconst promptPromise = host.session\n\t\t\t.prompt(firstPrompt.text, promptOptions)\n\t\t\t.catch((error) => {\n\t\t\t\trestoreQueue(error);\n\t\t\t})\n\t\t\t.finally(() => {\n\t\t\t\thost.refreshAutonomyFooterStatus();\n\t\t\t});\n\n\t\t// Queue remaining messages\n\t\tfor (const message of rest) {\n\t\t\tif (host.isExtensionCommand(message.text)) {\n\t\t\t\tawait host.session.prompt(message.text);\n\t\t\t} else if (message.mode === \"followUp\") {\n\t\t\t\tawait host.session.followUp(message.text, message.images);\n\t\t\t} else {\n\t\t\t\tawait host.session.steer(message.text, message.images);\n\t\t\t}\n\t\t}\n\t\thost.updatePendingMessagesDisplay();\n\t\tvoid promptPromise;\n\t} catch (error) {\n\t\trestoreQueue(error);\n\t}\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Component for displaying bash command execution with streaming output.
|
|
3
3
|
*/
|
|
4
|
+
import { type TruncationResult } from "@caupulican/pi-agent-core/node";
|
|
4
5
|
import { Container, type TUI } from "@caupulican/pi-tui";
|
|
5
|
-
import { type TruncationResult } from "../../../core/tools/truncate.ts";
|
|
6
6
|
export declare class BashExecutionComponent extends Container {
|
|
7
7
|
private command;
|
|
8
8
|
private outputLines;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bash-execution.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/bash-execution.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"bash-execution.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/bash-execution.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAGN,KAAK,gBAAgB,EAErB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,SAAS,EAAwB,KAAK,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAU/E,qBAAa,sBAAuB,SAAQ,SAAS;IACpD,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,MAAM,CAA6D;IAC3E,OAAO,CAAC,QAAQ,CAAiC;IACjD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,gBAAgB,CAAC,CAAmB;IAC5C,OAAO,CAAC,cAAc,CAAC,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,gBAAgB,CAAY;IAEpC,YAAY,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,kBAAkB,UAAQ,EAiC/D;IAED;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAGnC;IAEQ,UAAU,IAAI,IAAI,CAG1B;IAED,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAgBhC;IAED,WAAW,CACV,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,SAAS,EAAE,OAAO,EAClB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,cAAc,CAAC,EAAE,MAAM,GACrB,IAAI,CAcN;IAED,OAAO,CAAC,aAAa;IAsFrB;;OAEG;IACH,SAAS,IAAI,MAAM,CAElB;IAED;;OAEG;IACH,UAAU,IAAI,MAAM,CAEnB;CACD","sourcesContent":["/**\n * Component for displaying bash command execution with streaming output.\n */\n\nimport {\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype TruncationResult,\n\ttruncateTail,\n} from \"@caupulican/pi-agent-core/node\";\nimport { Container, Loader, Spacer, Text, type TUI } from \"@caupulican/pi-tui\";\nimport { stripAnsi } from \"../../../utils/ansi.ts\";\nimport { theme } from \"../theme/theme.ts\";\nimport { DynamicBorder } from \"./dynamic-border.ts\";\nimport { keyHint, keyText } from \"./keybinding-hints.ts\";\nimport { truncateToVisualLines } from \"./visual-truncate.ts\";\n\n// Preview line limit when not expanded (matches tool execution behavior)\nconst PREVIEW_LINES = 20;\n\nexport class BashExecutionComponent extends Container {\n\tprivate command: string;\n\tprivate outputLines: string[] = [];\n\tprivate status: \"running\" | \"complete\" | \"cancelled\" | \"error\" = \"running\";\n\tprivate exitCode: number | undefined = undefined;\n\tprivate loader: Loader;\n\tprivate truncationResult?: TruncationResult;\n\tprivate fullOutputPath?: string;\n\tprivate expanded = false;\n\tprivate contentContainer: Container;\n\n\tconstructor(command: string, ui: TUI, excludeFromContext = false) {\n\t\tsuper();\n\t\tthis.command = command;\n\n\t\t// Use dim border for excluded-from-context commands (!! prefix)\n\t\tconst colorKey = excludeFromContext ? \"dim\" : \"bashMode\";\n\t\tconst borderColor = (str: string) => theme.fg(colorKey, str);\n\n\t\t// Add spacer\n\t\tthis.addChild(new Spacer(1));\n\n\t\t// Top border\n\t\tthis.addChild(new DynamicBorder(borderColor));\n\n\t\t// Content container (holds dynamic content between borders)\n\t\tthis.contentContainer = new Container();\n\t\tthis.addChild(this.contentContainer);\n\n\t\t// Command header\n\t\tconst header = new Text(theme.fg(colorKey, theme.bold(`$ ${command}`)), 1, 0);\n\t\tthis.contentContainer.addChild(header);\n\n\t\t// Loader\n\t\tthis.loader = new Loader(\n\t\t\tui,\n\t\t\t(spinner) => theme.fg(colorKey, spinner),\n\t\t\t(text) => theme.fg(\"muted\", text),\n\t\t\t`Running... (${keyText(\"tui.select.cancel\")} to cancel)`, // Plain text for loader\n\t\t);\n\t\tthis.contentContainer.addChild(this.loader);\n\n\t\t// Bottom border\n\t\tthis.addChild(new DynamicBorder(borderColor));\n\t}\n\n\t/**\n\t * Set whether the output is expanded (shows full output) or collapsed (preview only).\n\t */\n\tsetExpanded(expanded: boolean): void {\n\t\tthis.expanded = expanded;\n\t\tthis.updateDisplay();\n\t}\n\n\toverride invalidate(): void {\n\t\tsuper.invalidate();\n\t\tthis.updateDisplay();\n\t}\n\n\tappendOutput(chunk: string): void {\n\t\t// Strip ANSI codes and normalize line endings\n\t\t// Note: binary data is already sanitized in tui-renderer.ts executeBashCommand\n\t\tconst clean = stripAnsi(chunk).replace(/\\r\\n/g, \"\\n\").replace(/\\r/g, \"\\n\");\n\n\t\t// Append to output lines\n\t\tconst newLines = clean.split(\"\\n\");\n\t\tif (this.outputLines.length > 0 && newLines.length > 0) {\n\t\t\t// Append first chunk to last line (incomplete line continuation)\n\t\t\tthis.outputLines[this.outputLines.length - 1] += newLines[0];\n\t\t\tthis.outputLines.push(...newLines.slice(1));\n\t\t} else {\n\t\t\tthis.outputLines.push(...newLines);\n\t\t}\n\n\t\tthis.updateDisplay();\n\t}\n\n\tsetComplete(\n\t\texitCode: number | undefined,\n\t\tcancelled: boolean,\n\t\ttruncationResult?: TruncationResult,\n\t\tfullOutputPath?: string,\n\t): void {\n\t\tthis.exitCode = exitCode;\n\t\tthis.status = cancelled\n\t\t\t? \"cancelled\"\n\t\t\t: exitCode !== 0 && exitCode !== undefined && exitCode !== null\n\t\t\t\t? \"error\"\n\t\t\t\t: \"complete\";\n\t\tthis.truncationResult = truncationResult;\n\t\tthis.fullOutputPath = fullOutputPath;\n\n\t\t// Stop loader\n\t\tthis.loader.stop();\n\n\t\tthis.updateDisplay();\n\t}\n\n\tprivate updateDisplay(): void {\n\t\t// Apply truncation for LLM context limits (same limits as bash tool)\n\t\tconst fullOutput = this.outputLines.join(\"\\n\");\n\t\tconst contextTruncation = truncateTail(fullOutput, {\n\t\t\tmaxLines: DEFAULT_MAX_LINES,\n\t\t\tmaxBytes: DEFAULT_MAX_BYTES,\n\t\t});\n\n\t\t// Get the lines to potentially display (after context truncation)\n\t\tconst availableLines = contextTruncation.content ? contextTruncation.content.split(\"\\n\") : [];\n\n\t\t// Apply preview truncation based on expanded state\n\t\tconst previewLogicalLines = availableLines.slice(-PREVIEW_LINES);\n\t\tconst hiddenLineCount = availableLines.length - previewLogicalLines.length;\n\n\t\t// Rebuild content container\n\t\tthis.contentContainer.clear();\n\n\t\t// Command header\n\t\tconst header = new Text(theme.fg(\"bashMode\", theme.bold(`$ ${this.command}`)), 1, 0);\n\t\tthis.contentContainer.addChild(header);\n\n\t\t// Output\n\t\tif (availableLines.length > 0) {\n\t\t\tif (this.expanded) {\n\t\t\t\t// Show all lines\n\t\t\t\tconst displayText = availableLines.map((line) => theme.fg(\"muted\", line)).join(\"\\n\");\n\t\t\t\tthis.contentContainer.addChild(new Text(`\\n${displayText}`, 1, 0));\n\t\t\t} else {\n\t\t\t\t// Use shared visual truncation utility with width-aware caching\n\t\t\t\tconst styledOutput = previewLogicalLines.map((line) => theme.fg(\"muted\", line)).join(\"\\n\");\n\t\t\t\tconst styledInput = `\\n${styledOutput}`;\n\t\t\t\tlet cachedWidth: number | undefined;\n\t\t\t\tlet cachedLines: string[] | undefined;\n\t\t\t\tthis.contentContainer.addChild({\n\t\t\t\t\trender: (width: number) => {\n\t\t\t\t\t\tif (cachedLines === undefined || cachedWidth !== width) {\n\t\t\t\t\t\t\tconst result = truncateToVisualLines(styledInput, PREVIEW_LINES, width, 1);\n\t\t\t\t\t\t\tcachedLines = result.visualLines;\n\t\t\t\t\t\t\tcachedWidth = width;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn cachedLines ?? [];\n\t\t\t\t\t},\n\t\t\t\t\tinvalidate: () => {\n\t\t\t\t\t\tcachedWidth = undefined;\n\t\t\t\t\t\tcachedLines = undefined;\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t// Loader or status\n\t\tif (this.status === \"running\") {\n\t\t\tthis.contentContainer.addChild(this.loader);\n\t\t} else {\n\t\t\tconst statusParts: string[] = [];\n\n\t\t\t// Show how many lines are hidden (collapsed preview)\n\t\t\tif (hiddenLineCount > 0) {\n\t\t\t\tif (this.expanded) {\n\t\t\t\t\tstatusParts.push(`(${keyHint(\"app.tools.expand\", \"to collapse\")})`);\n\t\t\t\t} else {\n\t\t\t\t\tstatusParts.push(\n\t\t\t\t\t\t`${theme.fg(\"muted\", `... ${hiddenLineCount} more lines`)} (${keyHint(\"app.tools.expand\", \"to expand\")})`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.status === \"cancelled\") {\n\t\t\t\tstatusParts.push(theme.fg(\"warning\", \"(cancelled)\"));\n\t\t\t} else if (this.status === \"error\") {\n\t\t\t\tstatusParts.push(theme.fg(\"error\", `(exit ${this.exitCode})`));\n\t\t\t}\n\n\t\t\t// Add truncation warning (context truncation, not preview truncation)\n\t\t\tconst wasTruncated = this.truncationResult?.truncated || contextTruncation.truncated;\n\t\t\tif (wasTruncated && this.fullOutputPath) {\n\t\t\t\tstatusParts.push(theme.fg(\"warning\", `Output truncated. Full output: ${this.fullOutputPath}`));\n\t\t\t}\n\n\t\t\tif (statusParts.length > 0) {\n\t\t\t\tthis.contentContainer.addChild(new Text(`\\n${statusParts.join(\"\\n\")}`, 1, 0));\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Get the raw output for creating BashExecutionMessage.\n\t */\n\tgetOutput(): string {\n\t\treturn this.outputLines.join(\"\\n\");\n\t}\n\n\t/**\n\t * Get the command that was executed.\n\t */\n\tgetCommand(): string {\n\t\treturn this.command;\n\t}\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Component for displaying bash command execution with streaming output.
|
|
3
3
|
*/
|
|
4
|
+
import { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, truncateTail, } from "@caupulican/pi-agent-core/node";
|
|
4
5
|
import { Container, Loader, Spacer, Text } from "@caupulican/pi-tui";
|
|
5
|
-
import { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, truncateTail, } from "../../../core/tools/truncate.js";
|
|
6
6
|
import { stripAnsi } from "../../../utils/ansi.js";
|
|
7
7
|
import { theme } from "../theme/theme.js";
|
|
8
8
|
import { DynamicBorder } from "./dynamic-border.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bash-execution.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/bash-execution.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,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;IAED;;OAEG;IACH,UAAU,GAAW;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC;IAAA,CACpB;CACD","sourcesContent":["/**\n * Component for displaying bash command execution with streaming output.\n */\n\nimport { Container, Loader, Spacer, Text, type TUI } from \"@caupulican/pi-tui\";\nimport {\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype TruncationResult,\n\ttruncateTail,\n} from \"../../../core/tools/truncate.ts\";\nimport { stripAnsi } from \"../../../utils/ansi.ts\";\nimport { theme } from \"../theme/theme.ts\";\nimport { DynamicBorder } from \"./dynamic-border.ts\";\nimport { keyHint, keyText } from \"./keybinding-hints.ts\";\nimport { truncateToVisualLines } from \"./visual-truncate.ts\";\n\n// Preview line limit when not expanded (matches tool execution behavior)\nconst PREVIEW_LINES = 20;\n\nexport class BashExecutionComponent extends Container {\n\tprivate command: string;\n\tprivate outputLines: string[] = [];\n\tprivate status: \"running\" | \"complete\" | \"cancelled\" | \"error\" = \"running\";\n\tprivate exitCode: number | undefined = undefined;\n\tprivate loader: Loader;\n\tprivate truncationResult?: TruncationResult;\n\tprivate fullOutputPath?: string;\n\tprivate expanded = false;\n\tprivate contentContainer: Container;\n\n\tconstructor(command: string, ui: TUI, excludeFromContext = false) {\n\t\tsuper();\n\t\tthis.command = command;\n\n\t\t// Use dim border for excluded-from-context commands (!! prefix)\n\t\tconst colorKey = excludeFromContext ? \"dim\" : \"bashMode\";\n\t\tconst borderColor = (str: string) => theme.fg(colorKey, str);\n\n\t\t// Add spacer\n\t\tthis.addChild(new Spacer(1));\n\n\t\t// Top border\n\t\tthis.addChild(new DynamicBorder(borderColor));\n\n\t\t// Content container (holds dynamic content between borders)\n\t\tthis.contentContainer = new Container();\n\t\tthis.addChild(this.contentContainer);\n\n\t\t// Command header\n\t\tconst header = new Text(theme.fg(colorKey, theme.bold(`$ ${command}`)), 1, 0);\n\t\tthis.contentContainer.addChild(header);\n\n\t\t// Loader\n\t\tthis.loader = new Loader(\n\t\t\tui,\n\t\t\t(spinner) => theme.fg(colorKey, spinner),\n\t\t\t(text) => theme.fg(\"muted\", text),\n\t\t\t`Running... (${keyText(\"tui.select.cancel\")} to cancel)`, // Plain text for loader\n\t\t);\n\t\tthis.contentContainer.addChild(this.loader);\n\n\t\t// Bottom border\n\t\tthis.addChild(new DynamicBorder(borderColor));\n\t}\n\n\t/**\n\t * Set whether the output is expanded (shows full output) or collapsed (preview only).\n\t */\n\tsetExpanded(expanded: boolean): void {\n\t\tthis.expanded = expanded;\n\t\tthis.updateDisplay();\n\t}\n\n\toverride invalidate(): void {\n\t\tsuper.invalidate();\n\t\tthis.updateDisplay();\n\t}\n\n\tappendOutput(chunk: string): void {\n\t\t// Strip ANSI codes and normalize line endings\n\t\t// Note: binary data is already sanitized in tui-renderer.ts executeBashCommand\n\t\tconst clean = stripAnsi(chunk).replace(/\\r\\n/g, \"\\n\").replace(/\\r/g, \"\\n\");\n\n\t\t// Append to output lines\n\t\tconst newLines = clean.split(\"\\n\");\n\t\tif (this.outputLines.length > 0 && newLines.length > 0) {\n\t\t\t// Append first chunk to last line (incomplete line continuation)\n\t\t\tthis.outputLines[this.outputLines.length - 1] += newLines[0];\n\t\t\tthis.outputLines.push(...newLines.slice(1));\n\t\t} else {\n\t\t\tthis.outputLines.push(...newLines);\n\t\t}\n\n\t\tthis.updateDisplay();\n\t}\n\n\tsetComplete(\n\t\texitCode: number | undefined,\n\t\tcancelled: boolean,\n\t\ttruncationResult?: TruncationResult,\n\t\tfullOutputPath?: string,\n\t): void {\n\t\tthis.exitCode = exitCode;\n\t\tthis.status = cancelled\n\t\t\t? \"cancelled\"\n\t\t\t: exitCode !== 0 && exitCode !== undefined && exitCode !== null\n\t\t\t\t? \"error\"\n\t\t\t\t: \"complete\";\n\t\tthis.truncationResult = truncationResult;\n\t\tthis.fullOutputPath = fullOutputPath;\n\n\t\t// Stop loader\n\t\tthis.loader.stop();\n\n\t\tthis.updateDisplay();\n\t}\n\n\tprivate updateDisplay(): void {\n\t\t// Apply truncation for LLM context limits (same limits as bash tool)\n\t\tconst fullOutput = this.outputLines.join(\"\\n\");\n\t\tconst contextTruncation = truncateTail(fullOutput, {\n\t\t\tmaxLines: DEFAULT_MAX_LINES,\n\t\t\tmaxBytes: DEFAULT_MAX_BYTES,\n\t\t});\n\n\t\t// Get the lines to potentially display (after context truncation)\n\t\tconst availableLines = contextTruncation.content ? contextTruncation.content.split(\"\\n\") : [];\n\n\t\t// Apply preview truncation based on expanded state\n\t\tconst previewLogicalLines = availableLines.slice(-PREVIEW_LINES);\n\t\tconst hiddenLineCount = availableLines.length - previewLogicalLines.length;\n\n\t\t// Rebuild content container\n\t\tthis.contentContainer.clear();\n\n\t\t// Command header\n\t\tconst header = new Text(theme.fg(\"bashMode\", theme.bold(`$ ${this.command}`)), 1, 0);\n\t\tthis.contentContainer.addChild(header);\n\n\t\t// Output\n\t\tif (availableLines.length > 0) {\n\t\t\tif (this.expanded) {\n\t\t\t\t// Show all lines\n\t\t\t\tconst displayText = availableLines.map((line) => theme.fg(\"muted\", line)).join(\"\\n\");\n\t\t\t\tthis.contentContainer.addChild(new Text(`\\n${displayText}`, 1, 0));\n\t\t\t} else {\n\t\t\t\t// Use shared visual truncation utility with width-aware caching\n\t\t\t\tconst styledOutput = previewLogicalLines.map((line) => theme.fg(\"muted\", line)).join(\"\\n\");\n\t\t\t\tconst styledInput = `\\n${styledOutput}`;\n\t\t\t\tlet cachedWidth: number | undefined;\n\t\t\t\tlet cachedLines: string[] | undefined;\n\t\t\t\tthis.contentContainer.addChild({\n\t\t\t\t\trender: (width: number) => {\n\t\t\t\t\t\tif (cachedLines === undefined || cachedWidth !== width) {\n\t\t\t\t\t\t\tconst result = truncateToVisualLines(styledInput, PREVIEW_LINES, width, 1);\n\t\t\t\t\t\t\tcachedLines = result.visualLines;\n\t\t\t\t\t\t\tcachedWidth = width;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn cachedLines ?? [];\n\t\t\t\t\t},\n\t\t\t\t\tinvalidate: () => {\n\t\t\t\t\t\tcachedWidth = undefined;\n\t\t\t\t\t\tcachedLines = undefined;\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t// Loader or status\n\t\tif (this.status === \"running\") {\n\t\t\tthis.contentContainer.addChild(this.loader);\n\t\t} else {\n\t\t\tconst statusParts: string[] = [];\n\n\t\t\t// Show how many lines are hidden (collapsed preview)\n\t\t\tif (hiddenLineCount > 0) {\n\t\t\t\tif (this.expanded) {\n\t\t\t\t\tstatusParts.push(`(${keyHint(\"app.tools.expand\", \"to collapse\")})`);\n\t\t\t\t} else {\n\t\t\t\t\tstatusParts.push(\n\t\t\t\t\t\t`${theme.fg(\"muted\", `... ${hiddenLineCount} more lines`)} (${keyHint(\"app.tools.expand\", \"to expand\")})`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.status === \"cancelled\") {\n\t\t\t\tstatusParts.push(theme.fg(\"warning\", \"(cancelled)\"));\n\t\t\t} else if (this.status === \"error\") {\n\t\t\t\tstatusParts.push(theme.fg(\"error\", `(exit ${this.exitCode})`));\n\t\t\t}\n\n\t\t\t// Add truncation warning (context truncation, not preview truncation)\n\t\t\tconst wasTruncated = this.truncationResult?.truncated || contextTruncation.truncated;\n\t\t\tif (wasTruncated && this.fullOutputPath) {\n\t\t\t\tstatusParts.push(theme.fg(\"warning\", `Output truncated. Full output: ${this.fullOutputPath}`));\n\t\t\t}\n\n\t\t\tif (statusParts.length > 0) {\n\t\t\t\tthis.contentContainer.addChild(new Text(`\\n${statusParts.join(\"\\n\")}`, 1, 0));\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Get the raw output for creating BashExecutionMessage.\n\t */\n\tgetOutput(): string {\n\t\treturn this.outputLines.join(\"\\n\");\n\t}\n\n\t/**\n\t * Get the command that was executed.\n\t */\n\tgetCommand(): string {\n\t\treturn this.command;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"bash-execution.js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W;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAAA,CACnC;IAED;;OAEG;IACH,UAAU,GAAW;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC;IAAA,CACpB;CACD","sourcesContent":["/**\n * Component for displaying bash command execution with streaming output.\n */\n\nimport {\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype TruncationResult,\n\ttruncateTail,\n} from \"@caupulican/pi-agent-core/node\";\nimport { Container, Loader, Spacer, Text, type TUI } from \"@caupulican/pi-tui\";\nimport { stripAnsi } from \"../../../utils/ansi.ts\";\nimport { theme } from \"../theme/theme.ts\";\nimport { DynamicBorder } from \"./dynamic-border.ts\";\nimport { keyHint, keyText } from \"./keybinding-hints.ts\";\nimport { truncateToVisualLines } from \"./visual-truncate.ts\";\n\n// Preview line limit when not expanded (matches tool execution behavior)\nconst PREVIEW_LINES = 20;\n\nexport class BashExecutionComponent extends Container {\n\tprivate command: string;\n\tprivate outputLines: string[] = [];\n\tprivate status: \"running\" | \"complete\" | \"cancelled\" | \"error\" = \"running\";\n\tprivate exitCode: number | undefined = undefined;\n\tprivate loader: Loader;\n\tprivate truncationResult?: TruncationResult;\n\tprivate fullOutputPath?: string;\n\tprivate expanded = false;\n\tprivate contentContainer: Container;\n\n\tconstructor(command: string, ui: TUI, excludeFromContext = false) {\n\t\tsuper();\n\t\tthis.command = command;\n\n\t\t// Use dim border for excluded-from-context commands (!! prefix)\n\t\tconst colorKey = excludeFromContext ? \"dim\" : \"bashMode\";\n\t\tconst borderColor = (str: string) => theme.fg(colorKey, str);\n\n\t\t// Add spacer\n\t\tthis.addChild(new Spacer(1));\n\n\t\t// Top border\n\t\tthis.addChild(new DynamicBorder(borderColor));\n\n\t\t// Content container (holds dynamic content between borders)\n\t\tthis.contentContainer = new Container();\n\t\tthis.addChild(this.contentContainer);\n\n\t\t// Command header\n\t\tconst header = new Text(theme.fg(colorKey, theme.bold(`$ ${command}`)), 1, 0);\n\t\tthis.contentContainer.addChild(header);\n\n\t\t// Loader\n\t\tthis.loader = new Loader(\n\t\t\tui,\n\t\t\t(spinner) => theme.fg(colorKey, spinner),\n\t\t\t(text) => theme.fg(\"muted\", text),\n\t\t\t`Running... (${keyText(\"tui.select.cancel\")} to cancel)`, // Plain text for loader\n\t\t);\n\t\tthis.contentContainer.addChild(this.loader);\n\n\t\t// Bottom border\n\t\tthis.addChild(new DynamicBorder(borderColor));\n\t}\n\n\t/**\n\t * Set whether the output is expanded (shows full output) or collapsed (preview only).\n\t */\n\tsetExpanded(expanded: boolean): void {\n\t\tthis.expanded = expanded;\n\t\tthis.updateDisplay();\n\t}\n\n\toverride invalidate(): void {\n\t\tsuper.invalidate();\n\t\tthis.updateDisplay();\n\t}\n\n\tappendOutput(chunk: string): void {\n\t\t// Strip ANSI codes and normalize line endings\n\t\t// Note: binary data is already sanitized in tui-renderer.ts executeBashCommand\n\t\tconst clean = stripAnsi(chunk).replace(/\\r\\n/g, \"\\n\").replace(/\\r/g, \"\\n\");\n\n\t\t// Append to output lines\n\t\tconst newLines = clean.split(\"\\n\");\n\t\tif (this.outputLines.length > 0 && newLines.length > 0) {\n\t\t\t// Append first chunk to last line (incomplete line continuation)\n\t\t\tthis.outputLines[this.outputLines.length - 1] += newLines[0];\n\t\t\tthis.outputLines.push(...newLines.slice(1));\n\t\t} else {\n\t\t\tthis.outputLines.push(...newLines);\n\t\t}\n\n\t\tthis.updateDisplay();\n\t}\n\n\tsetComplete(\n\t\texitCode: number | undefined,\n\t\tcancelled: boolean,\n\t\ttruncationResult?: TruncationResult,\n\t\tfullOutputPath?: string,\n\t): void {\n\t\tthis.exitCode = exitCode;\n\t\tthis.status = cancelled\n\t\t\t? \"cancelled\"\n\t\t\t: exitCode !== 0 && exitCode !== undefined && exitCode !== null\n\t\t\t\t? \"error\"\n\t\t\t\t: \"complete\";\n\t\tthis.truncationResult = truncationResult;\n\t\tthis.fullOutputPath = fullOutputPath;\n\n\t\t// Stop loader\n\t\tthis.loader.stop();\n\n\t\tthis.updateDisplay();\n\t}\n\n\tprivate updateDisplay(): void {\n\t\t// Apply truncation for LLM context limits (same limits as bash tool)\n\t\tconst fullOutput = this.outputLines.join(\"\\n\");\n\t\tconst contextTruncation = truncateTail(fullOutput, {\n\t\t\tmaxLines: DEFAULT_MAX_LINES,\n\t\t\tmaxBytes: DEFAULT_MAX_BYTES,\n\t\t});\n\n\t\t// Get the lines to potentially display (after context truncation)\n\t\tconst availableLines = contextTruncation.content ? contextTruncation.content.split(\"\\n\") : [];\n\n\t\t// Apply preview truncation based on expanded state\n\t\tconst previewLogicalLines = availableLines.slice(-PREVIEW_LINES);\n\t\tconst hiddenLineCount = availableLines.length - previewLogicalLines.length;\n\n\t\t// Rebuild content container\n\t\tthis.contentContainer.clear();\n\n\t\t// Command header\n\t\tconst header = new Text(theme.fg(\"bashMode\", theme.bold(`$ ${this.command}`)), 1, 0);\n\t\tthis.contentContainer.addChild(header);\n\n\t\t// Output\n\t\tif (availableLines.length > 0) {\n\t\t\tif (this.expanded) {\n\t\t\t\t// Show all lines\n\t\t\t\tconst displayText = availableLines.map((line) => theme.fg(\"muted\", line)).join(\"\\n\");\n\t\t\t\tthis.contentContainer.addChild(new Text(`\\n${displayText}`, 1, 0));\n\t\t\t} else {\n\t\t\t\t// Use shared visual truncation utility with width-aware caching\n\t\t\t\tconst styledOutput = previewLogicalLines.map((line) => theme.fg(\"muted\", line)).join(\"\\n\");\n\t\t\t\tconst styledInput = `\\n${styledOutput}`;\n\t\t\t\tlet cachedWidth: number | undefined;\n\t\t\t\tlet cachedLines: string[] | undefined;\n\t\t\t\tthis.contentContainer.addChild({\n\t\t\t\t\trender: (width: number) => {\n\t\t\t\t\t\tif (cachedLines === undefined || cachedWidth !== width) {\n\t\t\t\t\t\t\tconst result = truncateToVisualLines(styledInput, PREVIEW_LINES, width, 1);\n\t\t\t\t\t\t\tcachedLines = result.visualLines;\n\t\t\t\t\t\t\tcachedWidth = width;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn cachedLines ?? [];\n\t\t\t\t\t},\n\t\t\t\t\tinvalidate: () => {\n\t\t\t\t\t\tcachedWidth = undefined;\n\t\t\t\t\t\tcachedLines = undefined;\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t// Loader or status\n\t\tif (this.status === \"running\") {\n\t\t\tthis.contentContainer.addChild(this.loader);\n\t\t} else {\n\t\t\tconst statusParts: string[] = [];\n\n\t\t\t// Show how many lines are hidden (collapsed preview)\n\t\t\tif (hiddenLineCount > 0) {\n\t\t\t\tif (this.expanded) {\n\t\t\t\t\tstatusParts.push(`(${keyHint(\"app.tools.expand\", \"to collapse\")})`);\n\t\t\t\t} else {\n\t\t\t\t\tstatusParts.push(\n\t\t\t\t\t\t`${theme.fg(\"muted\", `... ${hiddenLineCount} more lines`)} (${keyHint(\"app.tools.expand\", \"to expand\")})`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.status === \"cancelled\") {\n\t\t\t\tstatusParts.push(theme.fg(\"warning\", \"(cancelled)\"));\n\t\t\t} else if (this.status === \"error\") {\n\t\t\t\tstatusParts.push(theme.fg(\"error\", `(exit ${this.exitCode})`));\n\t\t\t}\n\n\t\t\t// Add truncation warning (context truncation, not preview truncation)\n\t\t\tconst wasTruncated = this.truncationResult?.truncated || contextTruncation.truncated;\n\t\t\tif (wasTruncated && this.fullOutputPath) {\n\t\t\t\tstatusParts.push(theme.fg(\"warning\", `Output truncated. Full output: ${this.fullOutputPath}`));\n\t\t\t}\n\n\t\t\tif (statusParts.length > 0) {\n\t\t\t\tthis.contentContainer.addChild(new Text(`\\n${statusParts.join(\"\\n\")}`, 1, 0));\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Get the raw output for creating BashExecutionMessage.\n\t */\n\tgetOutput(): string {\n\t\treturn this.outputLines.join(\"\\n\");\n\t}\n\n\t/**\n\t * Get the command that was executed.\n\t */\n\tgetCommand(): string {\n\t\treturn this.command;\n\t}\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { BranchSummaryMessage } from "@caupulican/pi-agent-core";
|
|
1
2
|
import { Box, type MarkdownTheme } from "@caupulican/pi-tui";
|
|
2
|
-
import type { BranchSummaryMessage } from "../../../core/messages.ts";
|
|
3
3
|
/**
|
|
4
4
|
* Component that renders a branch summary message with collapsed/expanded state.
|
|
5
5
|
* Uses same background color as custom messages for visual consistency.
|