@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
|
@@ -1,43 +1,49 @@
|
|
|
1
|
-
import type { Agent, AgentEvent, AgentMessage, AgentState, AgentTool, ThinkingLevel } from "@caupulican/pi-agent-core";
|
|
1
|
+
import type { Agent, AgentEvent, AgentMessage, AgentState, AgentTool, StreamIdleOptions, ThinkingLevel } from "@caupulican/pi-agent-core";
|
|
2
|
+
import { type CustomMessage } from "@caupulican/pi-agent-core";
|
|
3
|
+
import { type BranchSummaryEntry, type CompactionResult, type SessionManager } from "@caupulican/pi-agent-core/node";
|
|
2
4
|
import type { CacheRetention, ImageContent, Message, Model, StopReason, TextContent, Usage } from "@caupulican/pi-ai";
|
|
3
5
|
import type { CapabilityEnvelope, EvidenceBundle, LearningDecision, WorkerRequest, WorkerResult } from "./autonomy/contracts.ts";
|
|
4
|
-
import {
|
|
6
|
+
import type { LaneRecord } from "./autonomy/lane-tracker.ts";
|
|
5
7
|
import type { AutonomyDiagnosticSnapshot, AutonomyStatusSnapshot, GateOutcomeHistoryEntry } from "./autonomy/status.ts";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { type ContextAuditReport } from "./context/context-audit.ts";
|
|
8
|
+
import type { BashResult } from "./bash-executor.ts";
|
|
9
|
+
import type { CurationTelemetrySnapshot } from "./context/brain-curator.ts";
|
|
10
|
+
import type { ContextAuditReport } from "./context/context-audit.ts";
|
|
10
11
|
import { type ContextCompositionReport } from "./context/context-composition.ts";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
12
|
+
import type { PromptEnforcementReport } from "./context/context-prompt-enforcement.ts";
|
|
13
|
+
import type { PromptPolicyGcCorrelationReport, PromptPolicyShadowReport } from "./context/context-prompt-policy.ts";
|
|
14
|
+
import type { MemoryPromptInclusionReport } from "./context/memory-diagnostics.ts";
|
|
15
|
+
import type { MemoryRetrievalReport } from "./context/memory-retrieval.ts";
|
|
16
|
+
import type { ContextGcReport } from "./context-gc.ts";
|
|
17
|
+
import type { DailyUsageTotals } from "./cost/daily-usage.ts";
|
|
17
18
|
import { type CostGuardDecision } from "./cost-guard.ts";
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
19
|
+
import type { WorkerRunOutcome } from "./delegation/worker-runner.ts";
|
|
20
|
+
import type { ContextUsage, ExtensionCommandContextActions, ExtensionContext, ExtensionErrorListener, ExtensionRunner, ExtensionUIContext, InputSource, ReplacedSessionContext, SessionStartEvent, ShutdownHandler, ToolDefinition, ToolInfo } from "./extensions/index.ts";
|
|
20
21
|
import { type ChannelProvider, GatewayRegistry, type JobSchedulerProvider } from "./gateways/channel-provider.ts";
|
|
21
|
-
import {
|
|
22
|
+
import type { GoalContinuationPrompt, GoalContinuationPromptLimits } from "./goals/goal-continuation-prompt.ts";
|
|
22
23
|
import { type GoalRuntimeSnapshot, type GoalRuntimeSnapshotSettings } from "./goals/goal-runtime-snapshot.ts";
|
|
23
24
|
import type { GoalState } from "./goals/goal-state.ts";
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
25
|
+
import type { LearningAuditRecord } from "./learning/learning-audit.ts";
|
|
26
|
+
import type { DemandSignals, ReflectionResult } from "./learning/reflection-engine.ts";
|
|
26
27
|
import { type CurationProposals } from "./learning/skill-curator.ts";
|
|
27
28
|
import type { MemoryProvider } from "./memory/memory-provider.ts";
|
|
28
|
-
import { type CustomMessage } from "./messages.ts";
|
|
29
29
|
import { type ModelCapabilityProfile } from "./model-capability.ts";
|
|
30
30
|
import type { ModelRegistry } from "./model-registry.ts";
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
31
|
+
import type { StoredFitnessReport } from "./models/fitness-store.ts";
|
|
32
|
+
import type { LocalRuntimeDeps, OllamaRuntime } from "./models/local-runtime.ts";
|
|
33
33
|
import { type PromptTemplate } from "./prompt-templates.ts";
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
34
|
+
import type { ModelFitnessReport } from "./research/model-fitness.ts";
|
|
35
|
+
import type { ResearchRunResult } from "./research/research-runner.ts";
|
|
36
36
|
import { collectWorkspaceSources } from "./research/workspace-collector.ts";
|
|
37
37
|
import type { ResourceLoader } from "./resource-loader.ts";
|
|
38
|
-
import type {
|
|
39
|
-
import
|
|
40
|
-
|
|
38
|
+
import type { ResourceProfileFilterSettings, SettingsManager } from "./settings-manager.ts";
|
|
39
|
+
import type { BashOperations } from "./tools/bash.ts";
|
|
40
|
+
/**
|
|
41
|
+
* Test hook: override the stream-idle bounds so a stall can be provoked in-suite without a
|
|
42
|
+
* multi-minute wait. Pass `undefined` to restore the user-locked defaults (connect 120s /
|
|
43
|
+
* active 180s / quiet 600s, or the user's retry.stall settings). Applies per request — it
|
|
44
|
+
* may be set or changed at any time before the request that should observe it.
|
|
45
|
+
*/
|
|
46
|
+
export declare function setStreamIdleOptionsForTests(opts: Partial<StreamIdleOptions> | undefined): void;
|
|
41
47
|
/** Parsed skill block from a user message */
|
|
42
48
|
export interface ParsedSkillBlock {
|
|
43
49
|
name: string;
|
|
@@ -81,6 +87,12 @@ export type AgentSessionEvent = Exclude<AgentEvent, {
|
|
|
81
87
|
aborted: boolean;
|
|
82
88
|
willRetry: boolean;
|
|
83
89
|
errorMessage?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Benign no-op explanation for auto-compaction (e.g. "nothing to compact yet"). Auto
|
|
92
|
+
* bails must never be silent: without a result, either errorMessage (real failure) or
|
|
93
|
+
* skipReason (harmless skip) is set so the UI can show why nothing changed.
|
|
94
|
+
*/
|
|
95
|
+
skipReason?: string;
|
|
84
96
|
} | {
|
|
85
97
|
type: "auto_retry_start";
|
|
86
98
|
attempt: number;
|
|
@@ -155,8 +167,8 @@ export interface AgentSessionConfig {
|
|
|
155
167
|
collectWorkspaceSources?: typeof collectWorkspaceSources;
|
|
156
168
|
/**
|
|
157
169
|
* Injected fetch/spawn/exists for the local (Ollama) runtime health-check + boot used by the
|
|
158
|
-
* model router before a turn routed to a local model (see
|
|
159
|
-
* inject fakes so they never hit a real network/process; production defaults to the real ones.
|
|
170
|
+
* model router before a turn routed to a local model (see LocalRuntimeController.ensureLocalModelReady).
|
|
171
|
+
* Unit tests inject fakes so they never hit a real network/process; production defaults to the real ones.
|
|
160
172
|
*/
|
|
161
173
|
localRuntimeDeps?: LocalRuntimeDeps;
|
|
162
174
|
}
|
|
@@ -326,22 +338,6 @@ export declare class AgentSession {
|
|
|
326
338
|
private _pendingNextTurnMessages;
|
|
327
339
|
/** Serializes prompt() submissions made while streaming so queued steering/follow-ups keep user-typed FIFO order. */
|
|
328
340
|
private _streamingPromptSubmissionTail;
|
|
329
|
-
/** Pending idle timer that starts bounded goal continuation after the session becomes idle. */
|
|
330
|
-
private _goalAutoContinueTimer;
|
|
331
|
-
/** Guards bounded idle autosteer so continuation prompts do not recursively trigger themselves. */
|
|
332
|
-
private _isGoalAutoContinuing;
|
|
333
|
-
/** Pending idle timer that starts an autonomous research pass after the session becomes idle. */
|
|
334
|
-
private _researchLaneTimer;
|
|
335
|
-
/** Single-flight guard: at most one research pass runs at a time per session. */
|
|
336
|
-
private _isResearchLaneRunning;
|
|
337
|
-
/** Why the last idle research-lane evaluation skipped, for /autonomy diagnostics. */
|
|
338
|
-
private _lastResearchLaneSkipReason;
|
|
339
|
-
/** Live lane registry — the real source for AutonomyStatusSnapshot.activeLaneCount. */
|
|
340
|
-
private readonly _laneTracker;
|
|
341
|
-
/** Session-lifetime abort for in-flight research passes (same pattern as _reflectionAbort). */
|
|
342
|
-
private readonly _researchLaneAbort;
|
|
343
|
-
/** Session-lifetime abort for in-flight delegated workers. */
|
|
344
|
-
private readonly _workerDelegationAbort;
|
|
345
341
|
/**
|
|
346
342
|
* The last tool set requested via setActiveToolsByName BEFORE model-capability filtering, so
|
|
347
343
|
* switching from a small-window model back to a large one restores the full requested set.
|
|
@@ -350,45 +346,50 @@ export declare class AgentSession {
|
|
|
350
346
|
private _compactionAbortController;
|
|
351
347
|
private _autoCompactionAbortController;
|
|
352
348
|
private _overflowRecoveryAttempted;
|
|
353
|
-
private _latestContextGcReport;
|
|
354
|
-
/** Brain-curation sidecar (design: brain-context-curation-design.md). Inert unless the
|
|
355
|
-
* contextPolicy.curation setting is enabled AND the model passes the digest fitness gate. */
|
|
356
|
-
private readonly _brainCurator;
|
|
357
|
-
private _lastCurationSkipReason;
|
|
358
|
-
private _inertExtensionWarnings;
|
|
359
|
-
/** Extensions the active resource profile removed from the runtime set (surfaced in /context). */
|
|
360
|
-
private _profileDeniedExtensionCount;
|
|
361
|
-
private _lastPreDigestSkipReason;
|
|
362
349
|
private _unboundToolGrantWarnings;
|
|
363
|
-
private _toolArtifactStore;
|
|
364
|
-
private _latestContextAuditReport;
|
|
365
|
-
private _latestPromptPolicyReport;
|
|
366
|
-
private _latestPromptPolicyGcCorrelation;
|
|
367
|
-
private _latestPromptEnforcementReport;
|
|
368
|
-
private _memoryOkfProvider;
|
|
369
|
-
private _latestMemoryRetrievalReport;
|
|
370
|
-
private _latestMemoryPromptInclusionReport;
|
|
371
350
|
private _branchSummaryAbortController;
|
|
372
|
-
private
|
|
373
|
-
|
|
374
|
-
private
|
|
375
|
-
|
|
351
|
+
private _retryController;
|
|
352
|
+
/** User-facing model + thinking-level selection (see model-selection-controller.ts). */
|
|
353
|
+
private readonly _modelSelection;
|
|
354
|
+
/** Standalone bash-command execution (see bash-execution-controller.ts); owns the bash abort
|
|
355
|
+
* controller and the streaming-deferred pending-message queue. */
|
|
356
|
+
private readonly _bash;
|
|
357
|
+
/** Resource-profile tool/extension gating + reload-time profile model re-apply (see profile-filter-controller.ts). */
|
|
358
|
+
private readonly _profileFilter;
|
|
359
|
+
/** Agent tool-call gate: escalation, autonomy gating, extension hooks, untrusted boundary (see tool-gate-controller.ts). */
|
|
360
|
+
private readonly _toolGate;
|
|
376
361
|
private _extensionRunner;
|
|
377
362
|
private _turnIndex;
|
|
378
363
|
/** G7: per-turn foreground CapabilityEnvelope auto-built for visibility (observe-only; not enforced). */
|
|
379
364
|
private _currentForegroundEnvelope?;
|
|
380
365
|
private _resourceLoader;
|
|
381
366
|
private _customTools;
|
|
382
|
-
private _baseToolDefinitions;
|
|
383
367
|
private _cwd;
|
|
384
368
|
private _agentDir;
|
|
385
369
|
private _collectWorkspaceSources;
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
private
|
|
389
|
-
/**
|
|
390
|
-
*
|
|
391
|
-
private
|
|
370
|
+
/** Owns the cached per-server OllamaRuntime instances and the local-model router readiness gate
|
|
371
|
+
* (see local-runtime-controller.ts). */
|
|
372
|
+
private readonly _localRuntimeController;
|
|
373
|
+
/** Assembles the session's base system prompt from live session state (see
|
|
374
|
+
* system-prompt-builder.ts); owns the paired _baseSystemPromptOptions. */
|
|
375
|
+
private readonly _systemPromptBuilder;
|
|
376
|
+
/** G3/G8 autonomy telemetry sink + status/diagnostic snapshots (see autonomy-telemetry.ts); owns
|
|
377
|
+
* the latest gate outcome and the bounded gate-outcome history. */
|
|
378
|
+
private readonly _autonomyTelemetry;
|
|
379
|
+
/** Goal auto-continue + research lane + scout-worker delegation + model-fitness probe (see
|
|
380
|
+
* background-lane-controller.ts); owns the lane timers/guards, the last research-lane skip
|
|
381
|
+
* reason, the live LaneTracker, and the in-flight research/worker abort controllers. */
|
|
382
|
+
private readonly _backgroundLanes;
|
|
383
|
+
/** Plug-and-play memory subsystem (see memory-controller.ts); owns the OKF retrieval provider, the
|
|
384
|
+
* latest retrieval/prompt-inclusion reports, the reload-safe MemoryManager, the recall
|
|
385
|
+
* effectiveness tracker, and the extension-contributed pending providers. */
|
|
386
|
+
private readonly _memory;
|
|
387
|
+
/** Summarizer model/auth/settings resolution (see compaction-support.ts). */
|
|
388
|
+
private readonly _compactionSupport;
|
|
389
|
+
/** Per-turn context-shaping subsystem (see context-pipeline.ts); owns the latest
|
|
390
|
+
* audit/policy/correlation/enforcement/gc reports, the brain-curation sidecar + its skip reasons,
|
|
391
|
+
* and the tool-output artifact store. Invoked stage-by-stage from the context transform. */
|
|
392
|
+
private readonly _pipeline;
|
|
392
393
|
private _extensionRunnerRef?;
|
|
393
394
|
private _initialActiveToolNames?;
|
|
394
395
|
private _allowedToolNames?;
|
|
@@ -396,40 +397,36 @@ export declare class AgentSession {
|
|
|
396
397
|
private _toolProfileFilter?;
|
|
397
398
|
private readonly _isExplicitModel;
|
|
398
399
|
private readonly _isExplicitThinking;
|
|
399
|
-
/** Plug-and-play memory subsystem. Recreated on each (re)initialize so reload is safe. */
|
|
400
|
-
private _memoryManager;
|
|
401
|
-
/** R4: tracks whether injected recall is actually used, to adapt the recall gate. */
|
|
402
|
-
private readonly _effectivenessTracker;
|
|
403
400
|
/** R8: registry for deployment-supplied gateway channels + schedulers (lifecycle driven by the host runner). */
|
|
404
401
|
private readonly _gatewayRegistry;
|
|
405
402
|
/** Cache for getSpawnedUsage(), keyed by session entry count (Bug #22 — avoid O(N) per render frame). */
|
|
406
|
-
|
|
407
|
-
|
|
403
|
+
/** Usage/cost/stats accounting, /context estimate, and session export (see session-analytics.ts);
|
|
404
|
+
* owns the spawned-usage and daily-usage memo caches. */
|
|
405
|
+
private readonly _analytics;
|
|
406
|
+
/** In-file session-tree branch switching + fork-selector reads (see session-tree-navigator.ts). */
|
|
407
|
+
private readonly _treeNavigator;
|
|
408
408
|
/** Latest proactive cost-guard decision (#34), for the host UI to surface. Undefined when disabled. */
|
|
409
409
|
private _lastCostGuardDecision?;
|
|
410
410
|
/** One-shot latch so the cost guard downgrades reasoning once per over-threshold episode, not every call. */
|
|
411
411
|
private _costGuardDowngraded;
|
|
412
|
-
/**
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
private
|
|
417
|
-
private _isModelRouterRetry;
|
|
418
|
-
private _lastModelRouterDecision?;
|
|
419
|
-
private _lastAutonomyGateOutcome?;
|
|
420
|
-
/** G8: bounded (cap {@link GATE_OUTCOME_HISTORY_LIMIT}) history of gate outcomes; tail is latest. */
|
|
421
|
-
private readonly _gateOutcomeHistory;
|
|
422
|
-
private _lastModelRouterSkipReason?;
|
|
423
|
-
private _lastModelRouterIntent?;
|
|
412
|
+
/** Per-turn model-router subsystem (see model-router-controller.ts); owns the transient route/intent,
|
|
413
|
+
* the cheap-turn session buffer, the escalation/retry flags, and the sticky last-decision/skip-reason
|
|
414
|
+
* used by the status report. Its parallel routed drive path delegates every turn back to
|
|
415
|
+
* {@link _runAgentPrompt} so the drive loop stays host-side. */
|
|
416
|
+
private readonly _modelRouter;
|
|
424
417
|
/** Lazily-built skill curator (#32) over `<agentDir>/skills`. */
|
|
425
418
|
private _skillCuratorInstance?;
|
|
426
419
|
/** Set on dispose so in-flight background reflection bails instead of writing to a dead session (Bug #21). */
|
|
427
420
|
private _disposed;
|
|
428
421
|
/** Aborts in-flight background reflection completions on dispose (Bug #21). */
|
|
429
422
|
private readonly _reflectionAbort;
|
|
423
|
+
/** Native reflection engine + learning-apply/rollback path (see reflection-controller.ts); owns no
|
|
424
|
+
* session state, applies durable writes through the bundled memory tool and the session log. */
|
|
425
|
+
private readonly _reflection;
|
|
426
|
+
/** Bounded goal auto-continuation loop (see goal-loop-controller.ts); reads goal state fresh
|
|
427
|
+
* each pass and re-enters the session's own prompt path. */
|
|
428
|
+
private readonly _goalContinuation;
|
|
430
429
|
private readonly _isChildSession;
|
|
431
|
-
/** Memory providers registered by extensions via pi.registerMemoryProvider, applied on (re)init. */
|
|
432
|
-
private _pendingMemoryProviders;
|
|
433
430
|
private _baseToolsOverride?;
|
|
434
431
|
private _sessionStartEvent;
|
|
435
432
|
private _extensionUIContext?;
|
|
@@ -440,26 +437,23 @@ export declare class AgentSession {
|
|
|
440
437
|
private _extensionErrorListener?;
|
|
441
438
|
private _extensionErrorUnsubscriber?;
|
|
442
439
|
private _modelRegistry;
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
private
|
|
440
|
+
/** Tool-registry assembly + the self-modification-safe extension reload (see runtime-builder.ts);
|
|
441
|
+
* owns the base/wrapped tool definitions, the live tool registry, and the per-tool prompt
|
|
442
|
+
* snippet/guideline maps. The reload snapshot spans host/agent state reached through its deps. */
|
|
443
|
+
private readonly _runtimeBuilder;
|
|
447
444
|
private _baseSystemPrompt;
|
|
448
|
-
private _baseSystemPromptOptions;
|
|
449
445
|
constructor(config: AgentSessionConfig);
|
|
450
446
|
/** Model registry for API key resolution and model discovery */
|
|
451
447
|
get modelRegistry(): ModelRegistry;
|
|
452
|
-
private _getRequiredRequestAuth;
|
|
453
|
-
private _getCompactionRequestAuth;
|
|
454
448
|
/**
|
|
455
|
-
*
|
|
456
|
-
*
|
|
457
|
-
*
|
|
458
|
-
* - `"auto"` (default) picks the CHEAPEST authed model whose context window can hold a compaction
|
|
459
|
-
* (capability floor), and ONLY if it is strictly cheaper than the session model — so we never
|
|
460
|
-
* downgrade to an equally-priced but weaker summarizer (agy's floor: don't degrade the checkpoint);
|
|
461
|
-
* - otherwise the session model is used (safe default).
|
|
449
|
+
* True when the session's stream fn is the raw `streamSimple` provider entry (directly, or as the
|
|
450
|
+
* base wrapped by the idle watchdog at construction). Callers use this to decide whether request
|
|
451
|
+
* auth must be injected explicitly — see {@link RAW_STREAM_MARKER}.
|
|
462
452
|
*/
|
|
453
|
+
private _isRawStreamSimple;
|
|
454
|
+
private _getRequiredRequestAuth;
|
|
455
|
+
private _getCompactionRequestAuth;
|
|
456
|
+
private _resolveCompactionModelAndAuth;
|
|
463
457
|
private _resolveCompactionModel;
|
|
464
458
|
/**
|
|
465
459
|
* Install tool hooks once on the Agent instance.
|
|
@@ -501,121 +495,48 @@ export declare class AgentSession {
|
|
|
501
495
|
restorePromotedSkill(name: string): boolean;
|
|
502
496
|
private _installAgentTurnRefresh;
|
|
503
497
|
private _createAgentContextSnapshot;
|
|
504
|
-
|
|
505
|
-
private _toolArtifactsDir;
|
|
506
|
-
/**
|
|
507
|
-
* Session-scoped, filesystem-backed artifact store for first-capture-then-bound tool
|
|
508
|
-
* output (grep/find only, for now -- see tool-output-artifacts.md). Lazily created and
|
|
509
|
-
* cached so every tool construction in this session shares one store instance.
|
|
510
|
-
*
|
|
511
|
-
* `packToolOutput()` registers a reference (the packing tool call's id) at pack time
|
|
512
|
-
* and fails closed, so packed artifacts are never prematurely collected.
|
|
513
|
-
* `_releaseGcPackedArtifactReferences()` (called from `_applyContextGc()`) releases
|
|
514
|
-
* that reference once context-gc packs the result out of live context, and
|
|
515
|
-
* opportunistically reclaims now-unreferenced artifacts via `cleanup()`.
|
|
516
|
-
* Remaining carry-forward gap: cleanup() now also runs at dispose(), but only reclaims
|
|
517
|
-
* already-released (zero-reference) artifacts. A session that ends before context-gc
|
|
518
|
-
* ever evicts a result never releases that reference, so its artifact stays on disk by
|
|
519
|
-
* design (resolvable on resume). Reclaiming those requires an explicit cross-session
|
|
520
|
-
* expiry/liveness policy, not just a sweep.
|
|
521
|
-
*/
|
|
498
|
+
/** Tool-build call-site delegation to {@link ContextPipeline.getToolArtifactStore}. */
|
|
522
499
|
private _getToolArtifactStore;
|
|
523
500
|
/**
|
|
524
|
-
*
|
|
525
|
-
*
|
|
526
|
-
* memory represents durable cross-session knowledge, not a per-session capture). Not
|
|
527
|
-
* yet user-configurable -- see the memory-retrieval settings doc comment.
|
|
528
|
-
*/
|
|
529
|
-
private _memoryOkfDir;
|
|
530
|
-
/**
|
|
531
|
-
* Session-scoped, read-only local OKF memory provider. Lazily created ONLY when memory
|
|
532
|
-
* retrieval is enabled (see `_runMemoryRetrieval`) -- never force-created, so a session
|
|
533
|
-
* with the setting off never touches `_memoryOkfDir()` at all (no directory access, no
|
|
534
|
-
* creation; `createOkfMemoryProvider` itself never writes/mkdirs either way).
|
|
535
|
-
*/
|
|
536
|
-
private _getMemoryOkfProvider;
|
|
537
|
-
/**
|
|
538
|
-
* One pass over the current branch, mapping each toolResult's toolCallId to its
|
|
539
|
-
* persisted session-entry id. Rebuilt every audit pass (O(branch) per turn), so this is
|
|
540
|
-
* O(n^2) over a long session. Fine at current scale; after the artifact-read fix this is
|
|
541
|
-
* the next per-turn audit cost to optimize if it ever matters (e.g. cache/incrementally
|
|
542
|
-
* update instead of a full rebuild).
|
|
543
|
-
*/
|
|
544
|
-
private _buildSessionEntryIdLookup;
|
|
545
|
-
/**
|
|
546
|
-
* Phase 1 observe-only audit pass (see context/context-audit.ts): converts live
|
|
547
|
-
* toolResult messages into ContextItems and runs the existing retention/hard-constraint
|
|
548
|
-
* evaluators over them, storing the latest deterministic report for tests/debugging.
|
|
549
|
-
* Read-only with respect to messages, the transcript, and artifact references -- uses
|
|
550
|
-
* `_toolArtifactStore` (the field), not `_getToolArtifactStore()` (the getter), so a
|
|
551
|
-
* session that never packed anything doesn't force-create a store/dir just to audit.
|
|
552
|
-
* Never throws into a live turn: any failure degrades to an empty report.
|
|
501
|
+
* Context-transform hot-path delegation to {@link ContextPipeline.runContextAudit}. Kept as a
|
|
502
|
+
* one-line method (not inlined) so the transform stays the single owner of the pass ordering.
|
|
553
503
|
*/
|
|
554
504
|
private _runContextAudit;
|
|
555
|
-
/**
|
|
556
|
-
* Read-only inspection of the context audit. With `messages`, recomputes fresh against
|
|
557
|
-
* the given array (still no mutation of messages/transcript/artifact refs); without,
|
|
558
|
-
* returns the last report computed during a real transform pass.
|
|
559
|
-
*/
|
|
505
|
+
/** Read-only inspection of the context audit (delegates to {@link ContextPipeline.getContextAuditReport}). */
|
|
560
506
|
getContextAuditReport(messages?: AgentMessage[]): ContextAuditReport;
|
|
561
507
|
/**
|
|
562
|
-
*
|
|
563
|
-
*
|
|
564
|
-
* "keep_raw" -- this never enforces anything, it only records what the policy engine
|
|
565
|
-
* would say. Never throws into a live turn: any failure degrades to an empty report.
|
|
508
|
+
* Context-transform hot-path delegation to {@link ContextPipeline.runPromptPolicyPlanning}. Kept as
|
|
509
|
+
* a one-line method (not inlined) so the transform stays the single owner of the pass ordering.
|
|
566
510
|
*/
|
|
567
511
|
private _runPromptPolicyPlanning;
|
|
568
|
-
/**
|
|
569
|
-
* Read-only inspection of the shadow policy plan. With `messages`, recomputes fresh
|
|
570
|
-
* (audit + plan) against the given array; without, returns the last plan computed
|
|
571
|
-
* during a real transform pass. Never mutates messages/transcript/artifact refs.
|
|
572
|
-
*/
|
|
512
|
+
/** Read-only inspection of the shadow policy plan (delegates to {@link ContextPipeline.getPromptPolicyReport}). */
|
|
573
513
|
getPromptPolicyReport(messages?: AgentMessage[]): PromptPolicyShadowReport;
|
|
574
514
|
/**
|
|
575
|
-
*
|
|
576
|
-
*
|
|
577
|
-
* produced its report; never influences context-gc itself. Never throws into a live
|
|
578
|
-
* turn: any failure degrades to an empty correlation.
|
|
515
|
+
* Context-transform hot-path delegation to {@link ContextPipeline.correlatePromptPolicyWithContextGc}.
|
|
516
|
+
* Kept as a one-line method (not inlined) so the transform stays the single owner of the pass ordering.
|
|
579
517
|
*/
|
|
580
518
|
private _correlatePromptPolicyWithContextGc;
|
|
581
519
|
/** Read-only inspection of the latest shadow-plan/legacy-gc correlation, for tests/debugging. */
|
|
582
520
|
getPromptPolicyGcCorrelation(): PromptPolicyGcCorrelationReport;
|
|
583
521
|
/**
|
|
584
|
-
*
|
|
585
|
-
*
|
|
586
|
-
* provider-visible message array only. Runs on `messages` AFTER context-gc has already
|
|
587
|
-
* produced its own result, so legacy context-gc's own packing/reporting is completely
|
|
588
|
-
* unaffected by this pass -- it only ever acts on messages gc left untouched this turn.
|
|
589
|
-
* Never throws into a live turn: any failure degrades to returning `messages` unchanged.
|
|
522
|
+
* Context-transform hot-path delegation to {@link ContextPipeline.runPromptEnforcement}. Kept as a
|
|
523
|
+
* one-line method (not inlined) so the transform stays the single owner of the pass ordering.
|
|
590
524
|
*/
|
|
591
525
|
private _runPromptEnforcement;
|
|
592
526
|
/**
|
|
593
|
-
*
|
|
594
|
-
*
|
|
595
|
-
* asymmetric advisory lever inside enforcePromptPolicy. Never throws into a turn.
|
|
527
|
+
* Context-transform hot-path delegation to {@link ContextPipeline.enqueueRelevanceCuration}. Kept as
|
|
528
|
+
* a one-line method (not inlined) so the transform stays the single owner of the pass ordering.
|
|
596
529
|
*/
|
|
597
530
|
private _enqueueRelevanceCuration;
|
|
598
|
-
/**
|
|
599
|
-
* Drain gate: settings on, model configured+authed, and the model has PASSED the digest
|
|
600
|
-
* fitness probe on THIS host (design: unfit or unprobed models are refused with a visible
|
|
601
|
-
* reason, never silently degraded). Fire-and-forget; never throws into a turn.
|
|
602
|
-
*/
|
|
603
|
-
/**
|
|
604
|
-
* Resolve the curation model IFF every gate passes: setting enabled, model configured,
|
|
605
|
-
* resolvable+authed, and digest-fitness-proven on THIS host (canonical "provider/id" ref —
|
|
606
|
-
* runModelFitness stores reports under it, while settings.model may be a bare id or pattern).
|
|
607
|
-
* Sets _lastCurationSkipReason on refusal; never throws.
|
|
608
|
-
*/
|
|
531
|
+
/** Reflex/curation call-site delegation to {@link ContextPipeline.resolveCurationModelIfFit}. */
|
|
609
532
|
private _resolveCurationModelIfFit;
|
|
610
|
-
private _maybeDrainBrainCuration;
|
|
611
533
|
/**
|
|
612
|
-
*
|
|
613
|
-
*
|
|
614
|
-
* failure rate <=5% before it is trusted to pre-digest compaction input. Returns undefined
|
|
615
|
-
* (verbatim compaction, byte-for-byte today's behavior) whenever any gate refuses.
|
|
534
|
+
* Context-transform hot-path delegation to {@link ContextPipeline.maybeDrainBrainCuration}. Kept as a
|
|
535
|
+
* one-line method (not inlined) so the transform stays the single owner of the pass ordering.
|
|
616
536
|
*/
|
|
537
|
+
private _maybeDrainBrainCuration;
|
|
538
|
+
/** Compaction call-site delegation to {@link ContextPipeline.buildCompactionPreDigest}. */
|
|
617
539
|
private _buildCompactionPreDigest;
|
|
618
|
-
private _drainBrainCuration;
|
|
619
540
|
/**
|
|
620
541
|
* Context composition dashboard data: decomposes the per-request payload (system prompt, tool
|
|
621
542
|
* schemas, extension contributions, message classes incl. GC/policy stubs and recall pages)
|
|
@@ -626,6 +547,7 @@ export declare class AgentSession {
|
|
|
626
547
|
/** Bounded plain-text rendering of {@link getContextCompositionReport} for the /context command. */
|
|
627
548
|
formatContextCompositionDashboard(): string;
|
|
628
549
|
/** Curation status for diagnostics/dashboard: settings, live telemetry, last refusal reason. */
|
|
550
|
+
/** Curation status for diagnostics/dashboard (delegates to {@link ContextPipeline.getContextCurationStatus}). */
|
|
629
551
|
getContextCurationStatus(): {
|
|
630
552
|
enabled: boolean;
|
|
631
553
|
model?: string;
|
|
@@ -635,57 +557,33 @@ export declare class AgentSession {
|
|
|
635
557
|
};
|
|
636
558
|
/** Read-only inspection of the latest prompt-enforcement report, for tests/debugging. */
|
|
637
559
|
getPromptEnforcementReport(): PromptEnforcementReport;
|
|
560
|
+
/**
|
|
561
|
+
* Context-transform hot-path delegation to {@link MemoryController.runMemoryRetrieval}. Kept as a
|
|
562
|
+
* one-line method (not inlined) so the transform stays the single owner of the pass ordering.
|
|
563
|
+
*/
|
|
638
564
|
private _runMemoryRetrieval;
|
|
639
565
|
/** Read-only inspection of the latest memory-retrieval report, for tests/debugging. */
|
|
640
566
|
getMemoryRetrievalReport(): MemoryRetrievalReport;
|
|
641
567
|
/**
|
|
642
|
-
*
|
|
643
|
-
*
|
|
644
|
-
* (`enabled` AND `includeInPrompt`) plus a non-empty `report.contextItems` -- the first
|
|
645
|
-
* two are belt-and-suspenders on top of the fact that `_runMemoryRetrieval` already
|
|
646
|
-
* leaves `contextItems` empty whenever `enabled` is false, regardless of
|
|
647
|
-
* `includeInPrompt`. Reuses the `report` this pass's `_runMemoryRetrieval` call already
|
|
648
|
-
* computed -- never re-queries the provider here.
|
|
649
|
-
*
|
|
650
|
-
* Appends exactly one ephemeral `custom`/"memory_evidence" message wrapped by
|
|
651
|
-
* `wrapUntrustedText` (the same nonce-fenced boundary + always-on system-prompt rule
|
|
652
|
-
* used for other untrusted content) to the END of `messages`. This is purely additive
|
|
653
|
-
* (never mutates an existing message) and purely transient: `messages` here is the
|
|
654
|
-
* array about to be sent to the provider, not `this.agent.state.messages` or anything
|
|
655
|
-
* persisted via `sessionManager` -- so the injected message can never reach the
|
|
656
|
-
* transcript, regardless of how many times this pass runs.
|
|
657
|
-
*
|
|
658
|
-
* Also records a `MemoryPromptInclusionReport` (context/memory-diagnostics.ts) at each
|
|
659
|
-
* branch below, for context_audit's diagnostic surface only -- this is pure bookkeeping
|
|
660
|
-
* alongside the existing branches, not a new branch/condition: the messages returned
|
|
661
|
-
* are unchanged by this recording.
|
|
568
|
+
* Context-transform hot-path delegation to {@link MemoryController.maybeAppendMemoryEvidenceBlock}.
|
|
569
|
+
* Kept as a one-line method (not inlined) so the transform stays the single owner of the pass ordering.
|
|
662
570
|
*/
|
|
663
571
|
private _maybeAppendMemoryEvidenceBlock;
|
|
664
572
|
/** Read-only inspection of the latest memory-prompt-inclusion decision, for tests/debugging and context_audit. */
|
|
665
573
|
getMemoryPromptInclusionReport(): MemoryPromptInclusionReport;
|
|
666
574
|
/**
|
|
667
|
-
*
|
|
668
|
-
*
|
|
669
|
-
*
|
|
670
|
-
* based rather than a spread-then-delete of the raw report.
|
|
575
|
+
* Context-transform hot-path delegation to {@link ContextPipeline.applyContextGc}. Kept as a
|
|
576
|
+
* one-line method (not inlined) so the transform stays the single owner of the pass ordering;
|
|
577
|
+
* also serves the composition dashboard and {@link getContextGcReport} read-only paths.
|
|
671
578
|
*/
|
|
672
|
-
private _getMemoryAuditDiagnostics;
|
|
673
579
|
private _applyContextGc;
|
|
580
|
+
/** Read-only inspection of the latest context-gc report (delegates to {@link ContextPipeline.getContextGcReport}). */
|
|
581
|
+
getContextGcReport(messages?: AgentMessage[]): ContextGcReport;
|
|
674
582
|
/**
|
|
675
|
-
*
|
|
676
|
-
*
|
|
677
|
-
*
|
|
678
|
-
* classes), release the pack-time reference `packToolOutput()` registered for it, and
|
|
679
|
-
* opportunistically reclaim now-unreferenced artifacts. This is the other half of the
|
|
680
|
-
* D2b-1 gate: artifacts were being registered but never released, so they accumulated
|
|
681
|
-
* for the life of the session.
|
|
682
|
-
*
|
|
683
|
-
* `record.toolCallId` (from context-gc's packed record) is exactly the holder id
|
|
684
|
-
* `packToolOutput()` used when it called `addReference()` -- both trace back to the
|
|
685
|
-
* same tool call's id -- so no separate bookkeeping is needed to find it.
|
|
583
|
+
* Context-transform hot-path delegation to {@link ContextPipeline.estimateCurrentContextTokens}. Kept
|
|
584
|
+
* as a one-line method (not inlined) so the transform stays the single owner of the pass ordering;
|
|
585
|
+
* also feeds the per-turn cost guard.
|
|
686
586
|
*/
|
|
687
|
-
private _releaseGcPackedArtifactReferences;
|
|
688
|
-
getContextGcReport(messages?: AgentMessage[]): ContextGcReport;
|
|
689
587
|
private _estimateCurrentContextTokens;
|
|
690
588
|
private _installAgentToolHooks;
|
|
691
589
|
/** Emit an event to all listeners */
|
|
@@ -819,55 +717,27 @@ export declare class AgentSession {
|
|
|
819
717
|
get promptTemplates(): ReadonlyArray<PromptTemplate>;
|
|
820
718
|
private _normalizePromptSnippet;
|
|
821
719
|
private _normalizePromptGuidelines;
|
|
822
|
-
/**
|
|
823
|
-
* R6: the active profile's situational soul, wrapped so the model reads it as its identity for this
|
|
824
|
-
* situation. Empty when no active profile defines a soul.
|
|
825
|
-
*/
|
|
826
|
-
private _buildSituationSoulPrompt;
|
|
827
|
-
private _buildSelfModificationPrompt;
|
|
828
|
-
private _buildAutonomyPrompt;
|
|
829
|
-
private _buildSystemPromptOptionsForToolNames;
|
|
830
720
|
private _rebuildSystemPrompt;
|
|
831
721
|
/**
|
|
832
722
|
* Build a system prompt for a specific tool surface WITHOUT touching the session's base prompt
|
|
833
|
-
* state
|
|
834
|
-
* so it must also receive a system prompt whose tool guidelines/snippets match that filtered
|
|
835
|
-
* surface — but the change is per-turn, so it must not mutate `_baseSystemPromptOptions` (which
|
|
836
|
-
* later turns and extension events read).
|
|
723
|
+
* state (G4 router-swap; see {@link SystemPromptBuilder.buildSystemPromptForToolNames}).
|
|
837
724
|
*/
|
|
838
725
|
private _buildSystemPromptForToolNames;
|
|
839
726
|
private _runAgentPrompt;
|
|
840
|
-
private _isModelAvailableAndAuthed;
|
|
841
|
-
private _resolveExecutorRoute;
|
|
842
|
-
/** True if a run_toolkit_script tool result since `fromIndex` actually EXECUTED (not error/ambiguous). */
|
|
843
|
-
private _executorTurnExecutedScript;
|
|
844
|
-
private _buildExecutorRefinedPrompt;
|
|
845
727
|
/**
|
|
846
728
|
* Shared {@link OllamaRuntime} for a given server, lazily created and cached by baseUrl so every
|
|
847
|
-
* caller — the router's readiness gate
|
|
848
|
-
*
|
|
849
|
-
*
|
|
729
|
+
* caller — the router's readiness gate and any host UI's own model-lifecycle commands (e.g.
|
|
730
|
+
* `/models`) — sees and can stop the SAME pi-managed process instead of each tracking its own
|
|
731
|
+
* untracked child. Delegates to {@link LocalRuntimeController}.
|
|
850
732
|
*/
|
|
851
733
|
getLocalRuntime(baseUrl?: string): OllamaRuntime;
|
|
852
734
|
/** models.json registers a local model's baseUrl as `<server>/v1` (OpenAI-compat); the runtime's
|
|
853
|
-
* own health/boot endpoints are on the Ollama-native server root.
|
|
735
|
+
* own health/boot endpoints are on the Ollama-native server root. Delegates to
|
|
736
|
+
* {@link LocalRuntimeController}; kept here for `_warnIfManualModelChoiceIsRisky`'s own use. */
|
|
854
737
|
private _deriveOllamaServerUrl;
|
|
855
|
-
/**
|
|
856
|
-
* If the last assistant message in this session was an error from THIS exact local server, a
|
|
857
|
-
* cached "confirmed up" flag would be stale (the server may have died mid-session) — drop it so
|
|
858
|
-
* the next ensure-check is a real one instead of trusting stale state.
|
|
859
|
-
*/
|
|
860
|
-
private _invalidateLocalRuntimeIfLastCallFailed;
|
|
861
|
-
private _ensureLocalModelReady;
|
|
862
|
-
private _maybeInstallOllamaOnConsent;
|
|
863
738
|
private _ensureRouteModelReady;
|
|
864
|
-
|
|
865
|
-
private _resolveModelRouterModelForIntent;
|
|
866
|
-
private _resolveConfiguredTierModel;
|
|
867
|
-
private _resolveModelRouterTurnRouteJudged;
|
|
868
|
-
private _resolveModelRouterTurnModel;
|
|
739
|
+
/** Model-router status + config diagnostics report. Delegates to {@link ModelRouterController}. */
|
|
869
740
|
getModelRouterStatus(formatLabel?: (label: string) => string): string;
|
|
870
|
-
private _runAgentPromptWithModelRouter;
|
|
871
741
|
private _handlePostAgentRun;
|
|
872
742
|
/**
|
|
873
743
|
* Send a prompt to the agent.
|
|
@@ -879,12 +749,6 @@ export declare class AgentSession {
|
|
|
879
749
|
* @throws Error if no model selected or no API key available (when not streaming)
|
|
880
750
|
*/
|
|
881
751
|
prompt(text: string, options?: PromptOptions): Promise<void>;
|
|
882
|
-
/**
|
|
883
|
-
* Zero-I/O gate for cross-session recall (R3): skip trivial turns (short acks, slash commands) so
|
|
884
|
-
* recall only runs when it could plausibly help. The provider's similarity cutoff is the real
|
|
885
|
-
* filter — this just avoids the index query on turns that obviously don't warrant it.
|
|
886
|
-
*/
|
|
887
|
-
private _shouldAttemptRecall;
|
|
888
752
|
private _promptUnserialized;
|
|
889
753
|
/**
|
|
890
754
|
* Try to execute an extension command. Returns true if command was found and executed.
|
|
@@ -975,48 +839,16 @@ export declare class AgentSession {
|
|
|
975
839
|
* Abort current operation and wait for agent to become idle.
|
|
976
840
|
*/
|
|
977
841
|
abort(): Promise<void>;
|
|
978
|
-
private _emitModelSelect;
|
|
979
|
-
/**
|
|
980
|
-
* Set model directly.
|
|
981
|
-
* Validates that auth is configured, saves to session and settings.
|
|
982
|
-
* @throws Error if no auth is configured for the model
|
|
983
|
-
*/
|
|
984
842
|
setModel(model: Model<any>, options?: {
|
|
985
843
|
persistSettings?: boolean;
|
|
986
844
|
}): Promise<void>;
|
|
987
|
-
/**
|
|
988
|
-
* Cycle to next/previous model.
|
|
989
|
-
* Uses scoped models (from --models flag) if available, otherwise all available models.
|
|
990
|
-
* @param direction - "forward" (default) or "backward"
|
|
991
|
-
* @returns The new model info, or undefined if only one model available
|
|
992
|
-
*/
|
|
993
845
|
cycleModel(direction?: "forward" | "backward"): Promise<ModelCycleResult | undefined>;
|
|
994
|
-
private _cycleScopedModel;
|
|
995
|
-
private _cycleAvailableModel;
|
|
996
|
-
/**
|
|
997
|
-
* Set thinking level.
|
|
998
|
-
* Clamps to model capabilities based on available thinking levels.
|
|
999
|
-
* Saves to session and settings only if the level actually changes.
|
|
1000
|
-
*/
|
|
1001
846
|
setThinkingLevel(level: ThinkingLevel, options?: {
|
|
1002
847
|
persistSettings?: boolean;
|
|
1003
848
|
}): void;
|
|
1004
|
-
/**
|
|
1005
|
-
* Cycle to next thinking level.
|
|
1006
|
-
* @returns New level, or undefined if model doesn't support thinking
|
|
1007
|
-
*/
|
|
1008
849
|
cycleThinkingLevel(): ThinkingLevel | undefined;
|
|
1009
|
-
/**
|
|
1010
|
-
* Get available thinking levels for current model.
|
|
1011
|
-
* The provider will clamp to what the specific model supports internally.
|
|
1012
|
-
*/
|
|
1013
850
|
getAvailableThinkingLevels(): ThinkingLevel[];
|
|
1014
|
-
/**
|
|
1015
|
-
* Check if current model supports thinking/reasoning.
|
|
1016
|
-
*/
|
|
1017
851
|
supportsThinking(): boolean;
|
|
1018
|
-
private _getThinkingLevelForModelSwitch;
|
|
1019
|
-
private _clampThinkingLevel;
|
|
1020
852
|
/**
|
|
1021
853
|
* Set steering message mode.
|
|
1022
854
|
* Saves to settings.
|
|
@@ -1056,6 +888,7 @@ export declare class AgentSession {
|
|
|
1056
888
|
private _checkContextWindowUsageWarning;
|
|
1057
889
|
private _checkCompaction;
|
|
1058
890
|
private _runAutoCompaction;
|
|
891
|
+
private _compactWithRetry;
|
|
1059
892
|
/**
|
|
1060
893
|
* Toggle auto-compaction setting.
|
|
1061
894
|
*/
|
|
@@ -1069,32 +902,6 @@ export declare class AgentSession {
|
|
|
1069
902
|
private _applyExtensionBindings;
|
|
1070
903
|
private _refreshCurrentModelFromRegistry;
|
|
1071
904
|
private _bindExtensionCore;
|
|
1072
|
-
/**
|
|
1073
|
-
* Resolve the active resource-profile tool allow/block filter from current settings.
|
|
1074
|
-
* Mirrors the construction-time derivation (settingsManager.getResourceProfileFilter("tools"))
|
|
1075
|
-
* so reload() can re-apply it after a live settings/profile edit.
|
|
1076
|
-
*/
|
|
1077
|
-
private _deriveToolProfileFilter;
|
|
1078
|
-
private _isToolOrCommandAllowedByProfile;
|
|
1079
|
-
private _hasToolOrCommandProfileGate;
|
|
1080
|
-
private _filterExtensionsForRuntime;
|
|
1081
|
-
/**
|
|
1082
|
-
* /context observations for skills/prompts/extensions the active resource profile removed from
|
|
1083
|
-
* listings — the analog of the withheld-AGENTS.md warning. Strict UAC makes these silently absent,
|
|
1084
|
-
* so a lean profile's effect on the resource surface stays visible. Counts are profile-scoped
|
|
1085
|
-
* (skills/prompts via the profile-independent discovery universe filtered by the live profile
|
|
1086
|
-
* filter; extensions via the runtime filter's denied tally). Empty when nothing is withheld.
|
|
1087
|
-
*
|
|
1088
|
-
* Uses `isResourceDeniedByActiveProfile` (profile-only), not `isResourceAllowedByProfile` (which
|
|
1089
|
-
* also folds in the user's own legacy `disabledResources` list): a plain user-disabled resource
|
|
1090
|
-
* must never be misattributed to "the active resource profile" — that case is already surfaced by
|
|
1091
|
-
* the G14 disable-wins warning. With no active profile at all, the helper always reports nothing
|
|
1092
|
-
* denied, so this naturally stays silent (extensions keep their own runtime-filter-derived count,
|
|
1093
|
-
* which is already correctly zero absent a profile).
|
|
1094
|
-
*/
|
|
1095
|
-
private _profileDeniedResourceObservations;
|
|
1096
|
-
private _reapplyActiveProfileModelSettings;
|
|
1097
|
-
private _initializeMemory;
|
|
1098
905
|
/** Register a memory provider contributed by an extension; applied on the next memory (re)init. */
|
|
1099
906
|
registerMemoryProvider(provider: MemoryProvider): void;
|
|
1100
907
|
/** R8: the gateway/scheduler registry. A deployment runner registers providers and drives start/stop. */
|
|
@@ -1104,10 +911,6 @@ export declare class AgentSession {
|
|
|
1104
911
|
/** R8: register a deployment-supplied job scheduler (cron). */
|
|
1105
912
|
registerJobScheduler(provider: JobSchedulerProvider): void;
|
|
1106
913
|
private _refreshToolRegistry;
|
|
1107
|
-
private _createReloadRuntimeSnapshot;
|
|
1108
|
-
private _restoreReloadRuntimeSnapshot;
|
|
1109
|
-
private _doctorReloadRuntime;
|
|
1110
|
-
private _buildRuntime;
|
|
1111
914
|
reload(): Promise<void>;
|
|
1112
915
|
/**
|
|
1113
916
|
* Unload a single extension without full reload.
|
|
@@ -1129,10 +932,10 @@ export declare class AgentSession {
|
|
|
1129
932
|
* Falls back to full reload if any individual load/unload fails.
|
|
1130
933
|
*/
|
|
1131
934
|
reconcileLoadedExtensions(): Promise<void>;
|
|
1132
|
-
private _isNonRetryableProviderLimitError;
|
|
1133
935
|
/**
|
|
1134
|
-
* Check if an error is retryable (
|
|
1135
|
-
*
|
|
936
|
+
* Check if an error is retryable (transient provider/network failures). Billing/quota and auth
|
|
937
|
+
* are terminal; context overflow is handled by compaction, not retry. The verdict comes from the
|
|
938
|
+
* reliability kernel's classifier, fed the host-computed context-overflow flag.
|
|
1136
939
|
*/
|
|
1137
940
|
private _isRetryableError;
|
|
1138
941
|
private _prepareRetry;
|
|
@@ -1148,53 +951,23 @@ export declare class AgentSession {
|
|
|
1148
951
|
* Toggle auto-retry setting.
|
|
1149
952
|
*/
|
|
1150
953
|
setAutoRetryEnabled(enabled: boolean): void;
|
|
1151
|
-
/**
|
|
1152
|
-
* Execute a bash command.
|
|
1153
|
-
* Adds result to agent context and session.
|
|
1154
|
-
* @param command The bash command to execute
|
|
1155
|
-
* @param onChunk Optional streaming callback for output
|
|
1156
|
-
* @param options.excludeFromContext If true, command output won't be sent to LLM (!! prefix)
|
|
1157
|
-
* @param options.operations Custom BashOperations for remote execution
|
|
1158
|
-
*/
|
|
1159
954
|
executeBash(command: string, onChunk?: (chunk: string) => void, options?: {
|
|
1160
955
|
excludeFromContext?: boolean;
|
|
1161
956
|
operations?: BashOperations;
|
|
1162
957
|
}): Promise<BashResult>;
|
|
1163
|
-
/**
|
|
1164
|
-
* Record a bash execution result in session history.
|
|
1165
|
-
* Used by executeBash and by extensions that handle bash execution themselves.
|
|
1166
|
-
*/
|
|
1167
958
|
recordBashResult(command: string, result: BashResult, options?: {
|
|
1168
959
|
excludeFromContext?: boolean;
|
|
1169
960
|
}): void;
|
|
1170
|
-
/**
|
|
1171
|
-
* Cancel running bash command.
|
|
1172
|
-
*/
|
|
1173
961
|
abortBash(): void;
|
|
1174
962
|
/** Whether a bash command is currently running */
|
|
1175
963
|
get isBashRunning(): boolean;
|
|
1176
964
|
/** Whether there are pending bash messages waiting to be flushed */
|
|
1177
965
|
get hasPendingBashMessages(): boolean;
|
|
1178
|
-
/**
|
|
1179
|
-
* Flush pending bash messages to agent state and session.
|
|
1180
|
-
* Called after agent turn completes to maintain proper message ordering.
|
|
1181
|
-
*/
|
|
1182
966
|
private _flushPendingBashMessages;
|
|
1183
967
|
/**
|
|
1184
968
|
* Set a display name for the current session.
|
|
1185
969
|
*/
|
|
1186
970
|
setSessionName(name: string): void;
|
|
1187
|
-
/**
|
|
1188
|
-
* Navigate to a different node in the session tree.
|
|
1189
|
-
* Unlike fork() which creates a new session file, this stays in the same file.
|
|
1190
|
-
*
|
|
1191
|
-
* @param targetId The entry ID to navigate to
|
|
1192
|
-
* @param options.summarize Whether user wants to summarize abandoned branch
|
|
1193
|
-
* @param options.customInstructions Custom instructions for summarizer
|
|
1194
|
-
* @param options.replaceInstructions If true, customInstructions replaces the default prompt
|
|
1195
|
-
* @param options.label Label to attach to the branch summary entry
|
|
1196
|
-
* @returns Result with editorText (if user message) and cancelled status
|
|
1197
|
-
*/
|
|
1198
971
|
navigateTree(targetId: string, options?: {
|
|
1199
972
|
summarize?: boolean;
|
|
1200
973
|
customInstructions?: string;
|
|
@@ -1206,51 +979,17 @@ export declare class AgentSession {
|
|
|
1206
979
|
aborted?: boolean;
|
|
1207
980
|
summaryEntry?: BranchSummaryEntry;
|
|
1208
981
|
}>;
|
|
1209
|
-
/**
|
|
1210
|
-
* Get all user messages from session for fork selector.
|
|
1211
|
-
*/
|
|
1212
982
|
getUserMessagesForForking(): Array<{
|
|
1213
983
|
entryId: string;
|
|
1214
984
|
text: string;
|
|
1215
985
|
}>;
|
|
1216
|
-
private _extractUserMessageText;
|
|
1217
|
-
/**
|
|
1218
|
-
* Get session statistics.
|
|
1219
|
-
*/
|
|
1220
986
|
getSessionStats(): SessionStats;
|
|
1221
|
-
/**
|
|
1222
|
-
* Cumulative usage (full breakdown) for this session's entire spawn subtree: its own
|
|
1223
|
-
* assistant messages PLUS every `spawned_usage` report it has rolled up. Single source of
|
|
1224
|
-
* truth for "how much did this session and everything it spawned spend" — used by print-mode
|
|
1225
|
-
* to emit a child's total so a spawner can roll it up via {@link addSpawnedUsage}.
|
|
1226
|
-
*
|
|
1227
|
-
* Including the `spawned_usage` reports is what keeps the single-hop invariant intact: a child
|
|
1228
|
-
* that itself spawned grandchildren must report own + sub-usage in one number, or the parent
|
|
1229
|
-
* silently under-counts the grandchildren.
|
|
1230
|
-
*/
|
|
1231
987
|
getCumulativeUsage(): Usage;
|
|
1232
|
-
/**
|
|
1233
|
-
* Record usage spent by a spawned/subagent session so the footer can roll it into the
|
|
1234
|
-
* displayed cost. Persisted as a `CustomEntry` (`customType: "spawned_usage"`, Model A) so
|
|
1235
|
-
* it survives reload and is reconstructed exactly like main usage; a new/forked session
|
|
1236
|
-
* starts fresh because it owns a new log file.
|
|
1237
|
-
*
|
|
1238
|
-
* Idempotent on `opts.reportId`: a re-report (retry, duplicate `agent_end`) with a
|
|
1239
|
-
* previously-seen id is ignored, so cost cannot be double-counted. Honors the single-hop
|
|
1240
|
-
* invariant documented on {@link SpawnedUsageReport}.
|
|
1241
|
-
*
|
|
1242
|
-
* @returns the id of the appended entry, or `undefined` if the report was a duplicate.
|
|
1243
|
-
*/
|
|
1244
988
|
addSpawnedUsage(usage: Usage, opts?: {
|
|
1245
989
|
label?: string;
|
|
1246
990
|
sourceSessionId?: string;
|
|
1247
991
|
reportId?: string;
|
|
1248
992
|
}): string | undefined;
|
|
1249
|
-
/**
|
|
1250
|
-
* Aggregate all recorded spawned-usage reports (see {@link addSpawnedUsage}). Cached by the session
|
|
1251
|
-
* entry count so the interactive footer (which calls this every render frame) is O(1) between turns
|
|
1252
|
-
* instead of an O(N) scan on every keystroke (Bug #22). Recomputes only when entries change.
|
|
1253
|
-
*/
|
|
1254
993
|
getSpawnedUsage(): SpawnedUsageTotals;
|
|
1255
994
|
getDailyUsageTotals(now?: Date): DailyUsageTotals;
|
|
1256
995
|
getDailyUsageBreakdown(formatLabel?: (label: string) => string, now?: Date): string;
|
|
@@ -1277,21 +1016,7 @@ export declare class AgentSession {
|
|
|
1277
1016
|
getEvidenceBundleSnapshots(): EvidenceBundle[];
|
|
1278
1017
|
/** Live lane records tracked by this process (running and terminal). */
|
|
1279
1018
|
getLaneRecords(): LaneRecord[];
|
|
1280
|
-
/**
|
|
1281
|
-
* G3: bounded autonomy-telemetry sink. Passes the whole event through {@link redactTelemetryValue}
|
|
1282
|
-
* (the taxonomy's redaction contract) before storing it, so a secret that leaked into a payload
|
|
1283
|
-
* field never lands in the session log. Observe-only: a failure here can never surface into the
|
|
1284
|
-
* turn it is measuring, so the whole body is swallowed. Payloads MUST stay small (ids, codes,
|
|
1285
|
-
* numbers) — never prompt/summary text; callers own that discipline.
|
|
1286
|
-
*/
|
|
1287
1019
|
private _emitAutonomyTelemetry;
|
|
1288
|
-
/**
|
|
1289
|
-
* G8: single sink for a gate outcome. Keeps the latest-outcome getter behavior identical (the
|
|
1290
|
-
* full {@link GateOutcome} still lands in `_lastAutonomyGateOutcome`), and additionally appends a
|
|
1291
|
-
* bounded codes-only entry to {@link _gateOutcomeHistory} (oldest evicted at
|
|
1292
|
-
* {@link GATE_OUTCOME_HISTORY_LIMIT}) and emits the `gate_outcome` telemetry event. The history
|
|
1293
|
-
* tail therefore always mirrors the latest outcome. Only called with an active envelope.
|
|
1294
|
-
*/
|
|
1295
1020
|
private _recordGateOutcome;
|
|
1296
1021
|
/** G8: copies of the bounded gate-outcome history, oldest first, latest last. */
|
|
1297
1022
|
getGateOutcomeHistory(): GateOutcomeHistoryEntry[];
|
|
@@ -1300,52 +1025,14 @@ export declare class AgentSession {
|
|
|
1300
1025
|
saveLearningDecisionSnapshot(decision: LearningDecision): string;
|
|
1301
1026
|
getLearningDecisionSnapshots(): LearningDecision[];
|
|
1302
1027
|
getGoalRuntimeSnapshot(settings: GoalRuntimeSnapshotSettings): GoalRuntimeSnapshot;
|
|
1303
|
-
private _clearGoalAutoContinueTimer;
|
|
1304
|
-
private _scheduleGoalAutoContinueFromIdle;
|
|
1305
|
-
private _runScheduledGoalAutoContinue;
|
|
1306
|
-
private _clearResearchLaneTimer;
|
|
1307
|
-
/**
|
|
1308
|
-
* Derive the research demand from durable goal state: an active goal with open requirements,
|
|
1309
|
-
* deduplicated against the latest persisted bundle so the same requirement set is never
|
|
1310
|
-
* researched twice (the query is deterministic, so dedupe survives session reload).
|
|
1311
|
-
*/
|
|
1312
|
-
private _buildResearchLaneDemand;
|
|
1313
|
-
/**
|
|
1314
|
-
* Idle trigger for the autonomous research lane (mirrors {@link _scheduleGoalAutoContinueFromIdle}).
|
|
1315
|
-
* All skips are recorded in `_lastResearchLaneSkipReason` and surfaced via diagnostics — the lane
|
|
1316
|
-
* informs, it never prompts or blocks the foreground.
|
|
1317
|
-
*/
|
|
1318
|
-
private _scheduleResearchLaneFromIdle;
|
|
1319
|
-
private _runScheduledResearchLane;
|
|
1320
1028
|
/**
|
|
1321
1029
|
* Capability profile derived from the CURRENT session model's own metadata (context window),
|
|
1322
1030
|
* honoring the modelCapability.mode setting ("off" disables, a class name forces).
|
|
1323
1031
|
*/
|
|
1324
1032
|
getModelCapabilityProfile(): ModelCapabilityProfile;
|
|
1325
|
-
/** Capability profile for a specific lane model (lane budgets scale to the lane model's window). */
|
|
1326
|
-
private _laneCapabilityProfile;
|
|
1327
|
-
/**
|
|
1328
|
-
* Resolve the model for a background lane. Lanes are shipped BY this session, so they inherit
|
|
1329
|
-
* the session's own model unless a lane-specific model is explicitly configured — a single-model
|
|
1330
|
-
* setup (e.g. one local open model) runs its lanes on that same model. An explicitly configured
|
|
1331
|
-
* pattern that cannot resolve/authenticate is a visible skip, not a silent fallback.
|
|
1332
|
-
*/
|
|
1333
|
-
private _resolveLaneModel;
|
|
1334
|
-
/**
|
|
1335
|
-
* Resolve what a lane ships with. Precedence: explicit lane model setting, then the lane
|
|
1336
|
-
* profile's model (a shipped profile with a model MUST be obeyed — unresolvable is a visible
|
|
1337
|
-
* skip, never a fallback), then generic inheritance of the session model.
|
|
1338
|
-
*/
|
|
1339
|
-
private _resolveLaneShipment;
|
|
1340
|
-
/** UAC tool grants from a shipped lane profile, recorded on the lane envelope. */
|
|
1341
|
-
private _laneProfileToolGrants;
|
|
1342
|
-
/** Stripped research envelope — never the foreground/architect envelope. */
|
|
1343
|
-
private _buildResearchLaneEnvelope;
|
|
1344
1033
|
/**
|
|
1345
|
-
* Run one bounded, read-only research pass and persist its results
|
|
1346
|
-
*
|
|
1347
|
-
* lane's reportId). Explicit calls (e.g. `/autonomy research`) express user intent and bypass the
|
|
1348
|
-
* enabled/mode/dedupe gates the idle scheduler enforces; budget and capability gates always apply.
|
|
1034
|
+
* Run one bounded, read-only research pass and persist its results. Delegates to
|
|
1035
|
+
* {@link BackgroundLaneController}; see there for the full gating/budget/dedupe contract.
|
|
1349
1036
|
*/
|
|
1350
1037
|
runResearchLaneOnce(request?: {
|
|
1351
1038
|
query?: string;
|
|
@@ -1353,21 +1040,16 @@ export declare class AgentSession {
|
|
|
1353
1040
|
goalId?: string;
|
|
1354
1041
|
}): Promise<ResearchLaneRunOutcome>;
|
|
1355
1042
|
/**
|
|
1356
|
-
* Run one bounded scout-worker delegation
|
|
1357
|
-
*
|
|
1358
|
-
* {@link validateWorkerResult} before acceptance, and persist result + lane record + spawned
|
|
1359
|
-
* usage (idempotent per-lane reportId). Consumed by the `delegate` tool.
|
|
1043
|
+
* Run one bounded scout-worker delegation. Delegates to {@link BackgroundLaneController};
|
|
1044
|
+
* consumed by the `delegate` tool.
|
|
1360
1045
|
*/
|
|
1361
1046
|
runWorkerDelegationOnce(request: {
|
|
1362
1047
|
instructions: string;
|
|
1363
|
-
/** Model-provided replacement for the worker role prompt (the level-0 core always remains). */
|
|
1364
1048
|
systemPrompt?: string;
|
|
1365
1049
|
}): Promise<WorkerDelegationRunOutcome>;
|
|
1366
1050
|
/**
|
|
1367
|
-
* Probe a candidate model against the subagent contracts
|
|
1368
|
-
*
|
|
1369
|
-
* authenticate; every probe call runs as an isolated completion on that model, and probe
|
|
1370
|
-
* spend is reported through spawned-usage accounting.
|
|
1051
|
+
* Probe a candidate model against the subagent contracts. Delegates to
|
|
1052
|
+
* {@link BackgroundLaneController}; probe spend is reported through spawned-usage accounting.
|
|
1371
1053
|
*/
|
|
1372
1054
|
runModelFitness(args: {
|
|
1373
1055
|
model: string;
|
|
@@ -1385,26 +1067,13 @@ export declare class AgentSession {
|
|
|
1385
1067
|
continueGoalOnce(options: GoalContinuationOnceOptions): Promise<GoalContinuationOnceResult>;
|
|
1386
1068
|
continueGoalLoop(options: GoalContinuationLoopOptions): Promise<GoalContinuationLoopResult>;
|
|
1387
1069
|
/**
|
|
1388
|
-
* Run a one-shot LLM completion fully ISOLATED from the main session — the load-bearing
|
|
1389
|
-
*
|
|
1390
|
-
*
|
|
1391
|
-
* Isolation invariants (audited by codex): builds a fresh {@link Context} (no main history), runs
|
|
1392
|
-
* with `tools: []`, sets `cacheRetention: "none"`, and passes **no `sessionId`** — so it cannot
|
|
1393
|
-
* mutate `agent.state.messages`, cannot append session entries, cannot touch the tool registry,
|
|
1394
|
-
* and cannot churn the main session's prompt cache. Mirrors `generateSummary()`'s mechanics.
|
|
1395
|
-
*
|
|
1396
|
-
* Returns the result even on an error/aborted stop reason (callers — e.g. a background reflection
|
|
1397
|
-
* microtask — decide whether to act); it does not throw on a model-level error.
|
|
1070
|
+
* Run a one-shot LLM completion fully ISOLATED from the main session — the load-bearing primitive
|
|
1071
|
+
* for native reflection (see reflection-controller.ts for the isolation invariants).
|
|
1398
1072
|
*/
|
|
1399
1073
|
runIsolatedCompletion(opts: IsolatedCompletionOptions): Promise<IsolatedCompletionResult>;
|
|
1400
1074
|
/**
|
|
1401
|
-
* Native end-of-loop reflection pass (R2).
|
|
1402
|
-
*
|
|
1403
|
-
* resulting memory writes through the bundled `memory` tool, and accounts the reflection's token
|
|
1404
|
-
* cost via the cost-aggregation surface so it stays visible and net-negative-auditable.
|
|
1405
|
-
*
|
|
1406
|
-
* Returns `null` when the gate skips (or in a child session, which must not learn). The whole pass
|
|
1407
|
-
* is best-effort: a model/parse error yields no writes, never throws into the caller.
|
|
1075
|
+
* Native end-of-loop reflection pass (R2). Delegates to {@link ReflectionController}; returns null
|
|
1076
|
+
* when the demand gate skips or in a child session.
|
|
1408
1077
|
*/
|
|
1409
1078
|
runReflectionPass(input: {
|
|
1410
1079
|
signals: DemandSignals;
|
|
@@ -1416,41 +1085,14 @@ export declare class AgentSession {
|
|
|
1416
1085
|
reportId?: string;
|
|
1417
1086
|
}): Promise<ReflectionResult | null>;
|
|
1418
1087
|
getLearningAuditRecords(): LearningAuditRecord[];
|
|
1419
|
-
/**
|
|
1420
|
-
* Roll back one applied durable learning change by executing the inverse operation recorded in
|
|
1421
|
-
* its audit record (memory ops run through the same bundled memory-tool path as the original
|
|
1422
|
-
* apply; promoted skills are archived). Appends a linked "rollback" audit record on success so
|
|
1423
|
-
* the change history stays complete and a change cannot be rolled back twice.
|
|
1424
|
-
*/
|
|
1088
|
+
/** Roll back one applied durable learning change. Delegates to {@link ReflectionController}. */
|
|
1425
1089
|
rollbackLearningWrite(auditId: string): Promise<{
|
|
1426
1090
|
ok: boolean;
|
|
1427
1091
|
reason: string;
|
|
1428
1092
|
}>;
|
|
1429
|
-
private _applyReflectionWrite;
|
|
1430
|
-
/**
|
|
1431
|
-
* R7: write a reflection-promoted skill as `<agentDir>/skills/<name>/SKILL.md` so it loads like any
|
|
1432
|
-
* user skill. Best-effort; never clobbers an existing (hand-authored) skill of the same name.
|
|
1433
|
-
*/
|
|
1434
|
-
private _promoteReflectionSkill;
|
|
1435
1093
|
getContextUsage(): ContextUsage | undefined;
|
|
1436
|
-
/**
|
|
1437
|
-
* Export session to HTML.
|
|
1438
|
-
* @param outputPath Optional output path (defaults to session directory)
|
|
1439
|
-
* @returns Path to exported file
|
|
1440
|
-
*/
|
|
1441
1094
|
exportToHtml(outputPath?: string): Promise<string>;
|
|
1442
|
-
/**
|
|
1443
|
-
* Export the current session branch to a JSONL file.
|
|
1444
|
-
* Writes the session header followed by all entries on the current branch path.
|
|
1445
|
-
* @param outputPath Target file path. If omitted, generates a timestamped file in cwd.
|
|
1446
|
-
* @returns The resolved output file path.
|
|
1447
|
-
*/
|
|
1448
1095
|
exportToJsonl(outputPath?: string): string;
|
|
1449
|
-
/**
|
|
1450
|
-
* Get text content of last assistant message.
|
|
1451
|
-
* Useful for /copy command.
|
|
1452
|
-
* @returns Text content, or undefined if no assistant message exists
|
|
1453
|
-
*/
|
|
1454
1096
|
getLastAssistantText(): string | undefined;
|
|
1455
1097
|
getAutonomyStatusSnapshot(): AutonomyStatusSnapshot;
|
|
1456
1098
|
/**
|