@caupulican/pi-adaptative 0.80.103 → 0.81.0
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 +120 -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 +152 -512
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +635 -4590
- 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/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/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,48 @@
|
|
|
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
|
+
* 30s wait. Pass `undefined` to restore the user-locked default (30s idle / 120s connect).
|
|
43
|
+
* Must be set BEFORE the session is constructed — the wiring reads it in the constructor.
|
|
44
|
+
*/
|
|
45
|
+
export declare function setStreamIdleOptionsForTests(opts: Partial<StreamIdleOptions> | undefined): void;
|
|
41
46
|
/** Parsed skill block from a user message */
|
|
42
47
|
export interface ParsedSkillBlock {
|
|
43
48
|
name: string;
|
|
@@ -81,6 +86,12 @@ export type AgentSessionEvent = Exclude<AgentEvent, {
|
|
|
81
86
|
aborted: boolean;
|
|
82
87
|
willRetry: boolean;
|
|
83
88
|
errorMessage?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Benign no-op explanation for auto-compaction (e.g. "nothing to compact yet"). Auto
|
|
91
|
+
* bails must never be silent: without a result, either errorMessage (real failure) or
|
|
92
|
+
* skipReason (harmless skip) is set so the UI can show why nothing changed.
|
|
93
|
+
*/
|
|
94
|
+
skipReason?: string;
|
|
84
95
|
} | {
|
|
85
96
|
type: "auto_retry_start";
|
|
86
97
|
attempt: number;
|
|
@@ -155,8 +166,8 @@ export interface AgentSessionConfig {
|
|
|
155
166
|
collectWorkspaceSources?: typeof collectWorkspaceSources;
|
|
156
167
|
/**
|
|
157
168
|
* 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.
|
|
169
|
+
* model router before a turn routed to a local model (see LocalRuntimeController.ensureLocalModelReady).
|
|
170
|
+
* Unit tests inject fakes so they never hit a real network/process; production defaults to the real ones.
|
|
160
171
|
*/
|
|
161
172
|
localRuntimeDeps?: LocalRuntimeDeps;
|
|
162
173
|
}
|
|
@@ -326,22 +337,6 @@ export declare class AgentSession {
|
|
|
326
337
|
private _pendingNextTurnMessages;
|
|
327
338
|
/** Serializes prompt() submissions made while streaming so queued steering/follow-ups keep user-typed FIFO order. */
|
|
328
339
|
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
340
|
/**
|
|
346
341
|
* The last tool set requested via setActiveToolsByName BEFORE model-capability filtering, so
|
|
347
342
|
* switching from a small-window model back to a large one restores the full requested set.
|
|
@@ -350,45 +345,50 @@ export declare class AgentSession {
|
|
|
350
345
|
private _compactionAbortController;
|
|
351
346
|
private _autoCompactionAbortController;
|
|
352
347
|
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
348
|
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
349
|
private _branchSummaryAbortController;
|
|
372
|
-
private
|
|
373
|
-
|
|
374
|
-
private
|
|
375
|
-
|
|
350
|
+
private _retryController;
|
|
351
|
+
/** User-facing model + thinking-level selection (see model-selection-controller.ts). */
|
|
352
|
+
private readonly _modelSelection;
|
|
353
|
+
/** Standalone bash-command execution (see bash-execution-controller.ts); owns the bash abort
|
|
354
|
+
* controller and the streaming-deferred pending-message queue. */
|
|
355
|
+
private readonly _bash;
|
|
356
|
+
/** Resource-profile tool/extension gating + reload-time profile model re-apply (see profile-filter-controller.ts). */
|
|
357
|
+
private readonly _profileFilter;
|
|
358
|
+
/** Agent tool-call gate: escalation, autonomy gating, extension hooks, untrusted boundary (see tool-gate-controller.ts). */
|
|
359
|
+
private readonly _toolGate;
|
|
376
360
|
private _extensionRunner;
|
|
377
361
|
private _turnIndex;
|
|
378
362
|
/** G7: per-turn foreground CapabilityEnvelope auto-built for visibility (observe-only; not enforced). */
|
|
379
363
|
private _currentForegroundEnvelope?;
|
|
380
364
|
private _resourceLoader;
|
|
381
365
|
private _customTools;
|
|
382
|
-
private _baseToolDefinitions;
|
|
383
366
|
private _cwd;
|
|
384
367
|
private _agentDir;
|
|
385
368
|
private _collectWorkspaceSources;
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
private
|
|
389
|
-
/**
|
|
390
|
-
*
|
|
391
|
-
private
|
|
369
|
+
/** Owns the cached per-server OllamaRuntime instances and the local-model router readiness gate
|
|
370
|
+
* (see local-runtime-controller.ts). */
|
|
371
|
+
private readonly _localRuntimeController;
|
|
372
|
+
/** Assembles the session's base system prompt from live session state (see
|
|
373
|
+
* system-prompt-builder.ts); owns the paired _baseSystemPromptOptions. */
|
|
374
|
+
private readonly _systemPromptBuilder;
|
|
375
|
+
/** G3/G8 autonomy telemetry sink + status/diagnostic snapshots (see autonomy-telemetry.ts); owns
|
|
376
|
+
* the latest gate outcome and the bounded gate-outcome history. */
|
|
377
|
+
private readonly _autonomyTelemetry;
|
|
378
|
+
/** Goal auto-continue + research lane + scout-worker delegation + model-fitness probe (see
|
|
379
|
+
* background-lane-controller.ts); owns the lane timers/guards, the last research-lane skip
|
|
380
|
+
* reason, the live LaneTracker, and the in-flight research/worker abort controllers. */
|
|
381
|
+
private readonly _backgroundLanes;
|
|
382
|
+
/** Plug-and-play memory subsystem (see memory-controller.ts); owns the OKF retrieval provider, the
|
|
383
|
+
* latest retrieval/prompt-inclusion reports, the reload-safe MemoryManager, the recall
|
|
384
|
+
* effectiveness tracker, and the extension-contributed pending providers. */
|
|
385
|
+
private readonly _memory;
|
|
386
|
+
/** Summarizer model/auth/settings resolution (see compaction-support.ts). */
|
|
387
|
+
private readonly _compactionSupport;
|
|
388
|
+
/** Per-turn context-shaping subsystem (see context-pipeline.ts); owns the latest
|
|
389
|
+
* audit/policy/correlation/enforcement/gc reports, the brain-curation sidecar + its skip reasons,
|
|
390
|
+
* and the tool-output artifact store. Invoked stage-by-stage from the context transform. */
|
|
391
|
+
private readonly _pipeline;
|
|
392
392
|
private _extensionRunnerRef?;
|
|
393
393
|
private _initialActiveToolNames?;
|
|
394
394
|
private _allowedToolNames?;
|
|
@@ -396,40 +396,36 @@ export declare class AgentSession {
|
|
|
396
396
|
private _toolProfileFilter?;
|
|
397
397
|
private readonly _isExplicitModel;
|
|
398
398
|
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
399
|
/** R8: registry for deployment-supplied gateway channels + schedulers (lifecycle driven by the host runner). */
|
|
404
400
|
private readonly _gatewayRegistry;
|
|
405
401
|
/** Cache for getSpawnedUsage(), keyed by session entry count (Bug #22 — avoid O(N) per render frame). */
|
|
406
|
-
|
|
407
|
-
|
|
402
|
+
/** Usage/cost/stats accounting, /context estimate, and session export (see session-analytics.ts);
|
|
403
|
+
* owns the spawned-usage and daily-usage memo caches. */
|
|
404
|
+
private readonly _analytics;
|
|
405
|
+
/** In-file session-tree branch switching + fork-selector reads (see session-tree-navigator.ts). */
|
|
406
|
+
private readonly _treeNavigator;
|
|
408
407
|
/** Latest proactive cost-guard decision (#34), for the host UI to surface. Undefined when disabled. */
|
|
409
408
|
private _lastCostGuardDecision?;
|
|
410
409
|
/** One-shot latch so the cost guard downgrades reasoning once per over-threshold episode, not every call. */
|
|
411
410
|
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?;
|
|
411
|
+
/** Per-turn model-router subsystem (see model-router-controller.ts); owns the transient route/intent,
|
|
412
|
+
* the cheap-turn session buffer, the escalation/retry flags, and the sticky last-decision/skip-reason
|
|
413
|
+
* used by the status report. Its parallel routed drive path delegates every turn back to
|
|
414
|
+
* {@link _runAgentPrompt} so the drive loop stays host-side. */
|
|
415
|
+
private readonly _modelRouter;
|
|
424
416
|
/** Lazily-built skill curator (#32) over `<agentDir>/skills`. */
|
|
425
417
|
private _skillCuratorInstance?;
|
|
426
418
|
/** Set on dispose so in-flight background reflection bails instead of writing to a dead session (Bug #21). */
|
|
427
419
|
private _disposed;
|
|
428
420
|
/** Aborts in-flight background reflection completions on dispose (Bug #21). */
|
|
429
421
|
private readonly _reflectionAbort;
|
|
422
|
+
/** Native reflection engine + learning-apply/rollback path (see reflection-controller.ts); owns no
|
|
423
|
+
* session state, applies durable writes through the bundled memory tool and the session log. */
|
|
424
|
+
private readonly _reflection;
|
|
425
|
+
/** Bounded goal auto-continuation loop (see goal-loop-controller.ts); reads goal state fresh
|
|
426
|
+
* each pass and re-enters the session's own prompt path. */
|
|
427
|
+
private readonly _goalContinuation;
|
|
430
428
|
private readonly _isChildSession;
|
|
431
|
-
/** Memory providers registered by extensions via pi.registerMemoryProvider, applied on (re)init. */
|
|
432
|
-
private _pendingMemoryProviders;
|
|
433
429
|
private _baseToolsOverride?;
|
|
434
430
|
private _sessionStartEvent;
|
|
435
431
|
private _extensionUIContext?;
|
|
@@ -440,26 +436,23 @@ export declare class AgentSession {
|
|
|
440
436
|
private _extensionErrorListener?;
|
|
441
437
|
private _extensionErrorUnsubscriber?;
|
|
442
438
|
private _modelRegistry;
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
private
|
|
439
|
+
/** Tool-registry assembly + the self-modification-safe extension reload (see runtime-builder.ts);
|
|
440
|
+
* owns the base/wrapped tool definitions, the live tool registry, and the per-tool prompt
|
|
441
|
+
* snippet/guideline maps. The reload snapshot spans host/agent state reached through its deps. */
|
|
442
|
+
private readonly _runtimeBuilder;
|
|
447
443
|
private _baseSystemPrompt;
|
|
448
|
-
private _baseSystemPromptOptions;
|
|
449
444
|
constructor(config: AgentSessionConfig);
|
|
450
445
|
/** Model registry for API key resolution and model discovery */
|
|
451
446
|
get modelRegistry(): ModelRegistry;
|
|
452
|
-
private _getRequiredRequestAuth;
|
|
453
|
-
private _getCompactionRequestAuth;
|
|
454
447
|
/**
|
|
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).
|
|
448
|
+
* True when the session's stream fn is the raw `streamSimple` provider entry (directly, or as the
|
|
449
|
+
* base wrapped by the idle watchdog at construction). Callers use this to decide whether request
|
|
450
|
+
* auth must be injected explicitly — see {@link RAW_STREAM_MARKER}.
|
|
462
451
|
*/
|
|
452
|
+
private _isRawStreamSimple;
|
|
453
|
+
private _getRequiredRequestAuth;
|
|
454
|
+
private _getCompactionRequestAuth;
|
|
455
|
+
private _resolveCompactionModelAndAuth;
|
|
463
456
|
private _resolveCompactionModel;
|
|
464
457
|
/**
|
|
465
458
|
* Install tool hooks once on the Agent instance.
|
|
@@ -501,121 +494,48 @@ export declare class AgentSession {
|
|
|
501
494
|
restorePromotedSkill(name: string): boolean;
|
|
502
495
|
private _installAgentTurnRefresh;
|
|
503
496
|
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
|
-
*/
|
|
497
|
+
/** Tool-build call-site delegation to {@link ContextPipeline.getToolArtifactStore}. */
|
|
522
498
|
private _getToolArtifactStore;
|
|
523
499
|
/**
|
|
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.
|
|
500
|
+
* Context-transform hot-path delegation to {@link ContextPipeline.runContextAudit}. Kept as a
|
|
501
|
+
* one-line method (not inlined) so the transform stays the single owner of the pass ordering.
|
|
553
502
|
*/
|
|
554
503
|
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
|
-
*/
|
|
504
|
+
/** Read-only inspection of the context audit (delegates to {@link ContextPipeline.getContextAuditReport}). */
|
|
560
505
|
getContextAuditReport(messages?: AgentMessage[]): ContextAuditReport;
|
|
561
506
|
/**
|
|
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.
|
|
507
|
+
* Context-transform hot-path delegation to {@link ContextPipeline.runPromptPolicyPlanning}. Kept as
|
|
508
|
+
* a one-line method (not inlined) so the transform stays the single owner of the pass ordering.
|
|
566
509
|
*/
|
|
567
510
|
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
|
-
*/
|
|
511
|
+
/** Read-only inspection of the shadow policy plan (delegates to {@link ContextPipeline.getPromptPolicyReport}). */
|
|
573
512
|
getPromptPolicyReport(messages?: AgentMessage[]): PromptPolicyShadowReport;
|
|
574
513
|
/**
|
|
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.
|
|
514
|
+
* Context-transform hot-path delegation to {@link ContextPipeline.correlatePromptPolicyWithContextGc}.
|
|
515
|
+
* Kept as a one-line method (not inlined) so the transform stays the single owner of the pass ordering.
|
|
579
516
|
*/
|
|
580
517
|
private _correlatePromptPolicyWithContextGc;
|
|
581
518
|
/** Read-only inspection of the latest shadow-plan/legacy-gc correlation, for tests/debugging. */
|
|
582
519
|
getPromptPolicyGcCorrelation(): PromptPolicyGcCorrelationReport;
|
|
583
520
|
/**
|
|
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.
|
|
521
|
+
* Context-transform hot-path delegation to {@link ContextPipeline.runPromptEnforcement}. Kept as a
|
|
522
|
+
* one-line method (not inlined) so the transform stays the single owner of the pass ordering.
|
|
590
523
|
*/
|
|
591
524
|
private _runPromptEnforcement;
|
|
592
525
|
/**
|
|
593
|
-
*
|
|
594
|
-
*
|
|
595
|
-
* asymmetric advisory lever inside enforcePromptPolicy. Never throws into a turn.
|
|
526
|
+
* Context-transform hot-path delegation to {@link ContextPipeline.enqueueRelevanceCuration}. Kept as
|
|
527
|
+
* a one-line method (not inlined) so the transform stays the single owner of the pass ordering.
|
|
596
528
|
*/
|
|
597
529
|
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
|
-
*/
|
|
530
|
+
/** Reflex/curation call-site delegation to {@link ContextPipeline.resolveCurationModelIfFit}. */
|
|
609
531
|
private _resolveCurationModelIfFit;
|
|
610
|
-
private _maybeDrainBrainCuration;
|
|
611
532
|
/**
|
|
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.
|
|
533
|
+
* Context-transform hot-path delegation to {@link ContextPipeline.maybeDrainBrainCuration}. Kept as a
|
|
534
|
+
* one-line method (not inlined) so the transform stays the single owner of the pass ordering.
|
|
616
535
|
*/
|
|
536
|
+
private _maybeDrainBrainCuration;
|
|
537
|
+
/** Compaction call-site delegation to {@link ContextPipeline.buildCompactionPreDigest}. */
|
|
617
538
|
private _buildCompactionPreDigest;
|
|
618
|
-
private _drainBrainCuration;
|
|
619
539
|
/**
|
|
620
540
|
* Context composition dashboard data: decomposes the per-request payload (system prompt, tool
|
|
621
541
|
* schemas, extension contributions, message classes incl. GC/policy stubs and recall pages)
|
|
@@ -626,6 +546,7 @@ export declare class AgentSession {
|
|
|
626
546
|
/** Bounded plain-text rendering of {@link getContextCompositionReport} for the /context command. */
|
|
627
547
|
formatContextCompositionDashboard(): string;
|
|
628
548
|
/** Curation status for diagnostics/dashboard: settings, live telemetry, last refusal reason. */
|
|
549
|
+
/** Curation status for diagnostics/dashboard (delegates to {@link ContextPipeline.getContextCurationStatus}). */
|
|
629
550
|
getContextCurationStatus(): {
|
|
630
551
|
enabled: boolean;
|
|
631
552
|
model?: string;
|
|
@@ -635,57 +556,33 @@ export declare class AgentSession {
|
|
|
635
556
|
};
|
|
636
557
|
/** Read-only inspection of the latest prompt-enforcement report, for tests/debugging. */
|
|
637
558
|
getPromptEnforcementReport(): PromptEnforcementReport;
|
|
559
|
+
/**
|
|
560
|
+
* Context-transform hot-path delegation to {@link MemoryController.runMemoryRetrieval}. Kept as a
|
|
561
|
+
* one-line method (not inlined) so the transform stays the single owner of the pass ordering.
|
|
562
|
+
*/
|
|
638
563
|
private _runMemoryRetrieval;
|
|
639
564
|
/** Read-only inspection of the latest memory-retrieval report, for tests/debugging. */
|
|
640
565
|
getMemoryRetrievalReport(): MemoryRetrievalReport;
|
|
641
566
|
/**
|
|
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.
|
|
567
|
+
* Context-transform hot-path delegation to {@link MemoryController.maybeAppendMemoryEvidenceBlock}.
|
|
568
|
+
* Kept as a one-line method (not inlined) so the transform stays the single owner of the pass ordering.
|
|
662
569
|
*/
|
|
663
570
|
private _maybeAppendMemoryEvidenceBlock;
|
|
664
571
|
/** Read-only inspection of the latest memory-prompt-inclusion decision, for tests/debugging and context_audit. */
|
|
665
572
|
getMemoryPromptInclusionReport(): MemoryPromptInclusionReport;
|
|
666
573
|
/**
|
|
667
|
-
*
|
|
668
|
-
*
|
|
669
|
-
*
|
|
670
|
-
* based rather than a spread-then-delete of the raw report.
|
|
574
|
+
* Context-transform hot-path delegation to {@link ContextPipeline.applyContextGc}. Kept as a
|
|
575
|
+
* one-line method (not inlined) so the transform stays the single owner of the pass ordering;
|
|
576
|
+
* also serves the composition dashboard and {@link getContextGcReport} read-only paths.
|
|
671
577
|
*/
|
|
672
|
-
private _getMemoryAuditDiagnostics;
|
|
673
578
|
private _applyContextGc;
|
|
579
|
+
/** Read-only inspection of the latest context-gc report (delegates to {@link ContextPipeline.getContextGcReport}). */
|
|
580
|
+
getContextGcReport(messages?: AgentMessage[]): ContextGcReport;
|
|
674
581
|
/**
|
|
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.
|
|
582
|
+
* Context-transform hot-path delegation to {@link ContextPipeline.estimateCurrentContextTokens}. Kept
|
|
583
|
+
* as a one-line method (not inlined) so the transform stays the single owner of the pass ordering;
|
|
584
|
+
* also feeds the per-turn cost guard.
|
|
686
585
|
*/
|
|
687
|
-
private _releaseGcPackedArtifactReferences;
|
|
688
|
-
getContextGcReport(messages?: AgentMessage[]): ContextGcReport;
|
|
689
586
|
private _estimateCurrentContextTokens;
|
|
690
587
|
private _installAgentToolHooks;
|
|
691
588
|
/** Emit an event to all listeners */
|
|
@@ -819,55 +716,27 @@ export declare class AgentSession {
|
|
|
819
716
|
get promptTemplates(): ReadonlyArray<PromptTemplate>;
|
|
820
717
|
private _normalizePromptSnippet;
|
|
821
718
|
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
719
|
private _rebuildSystemPrompt;
|
|
831
720
|
/**
|
|
832
721
|
* 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).
|
|
722
|
+
* state (G4 router-swap; see {@link SystemPromptBuilder.buildSystemPromptForToolNames}).
|
|
837
723
|
*/
|
|
838
724
|
private _buildSystemPromptForToolNames;
|
|
839
725
|
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
726
|
/**
|
|
846
727
|
* Shared {@link OllamaRuntime} for a given server, lazily created and cached by baseUrl so every
|
|
847
|
-
* caller — the router's readiness gate
|
|
848
|
-
*
|
|
849
|
-
*
|
|
728
|
+
* caller — the router's readiness gate and any host UI's own model-lifecycle commands (e.g.
|
|
729
|
+
* `/models`) — sees and can stop the SAME pi-managed process instead of each tracking its own
|
|
730
|
+
* untracked child. Delegates to {@link LocalRuntimeController}.
|
|
850
731
|
*/
|
|
851
732
|
getLocalRuntime(baseUrl?: string): OllamaRuntime;
|
|
852
733
|
/** 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.
|
|
734
|
+
* own health/boot endpoints are on the Ollama-native server root. Delegates to
|
|
735
|
+
* {@link LocalRuntimeController}; kept here for `_warnIfManualModelChoiceIsRisky`'s own use. */
|
|
854
736
|
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
737
|
private _ensureRouteModelReady;
|
|
864
|
-
|
|
865
|
-
private _resolveModelRouterModelForIntent;
|
|
866
|
-
private _resolveConfiguredTierModel;
|
|
867
|
-
private _resolveModelRouterTurnRouteJudged;
|
|
868
|
-
private _resolveModelRouterTurnModel;
|
|
738
|
+
/** Model-router status + config diagnostics report. Delegates to {@link ModelRouterController}. */
|
|
869
739
|
getModelRouterStatus(formatLabel?: (label: string) => string): string;
|
|
870
|
-
private _runAgentPromptWithModelRouter;
|
|
871
740
|
private _handlePostAgentRun;
|
|
872
741
|
/**
|
|
873
742
|
* Send a prompt to the agent.
|
|
@@ -879,12 +748,6 @@ export declare class AgentSession {
|
|
|
879
748
|
* @throws Error if no model selected or no API key available (when not streaming)
|
|
880
749
|
*/
|
|
881
750
|
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
751
|
private _promptUnserialized;
|
|
889
752
|
/**
|
|
890
753
|
* Try to execute an extension command. Returns true if command was found and executed.
|
|
@@ -975,48 +838,16 @@ export declare class AgentSession {
|
|
|
975
838
|
* Abort current operation and wait for agent to become idle.
|
|
976
839
|
*/
|
|
977
840
|
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
841
|
setModel(model: Model<any>, options?: {
|
|
985
842
|
persistSettings?: boolean;
|
|
986
843
|
}): 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
844
|
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
845
|
setThinkingLevel(level: ThinkingLevel, options?: {
|
|
1002
846
|
persistSettings?: boolean;
|
|
1003
847
|
}): void;
|
|
1004
|
-
/**
|
|
1005
|
-
* Cycle to next thinking level.
|
|
1006
|
-
* @returns New level, or undefined if model doesn't support thinking
|
|
1007
|
-
*/
|
|
1008
848
|
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
849
|
getAvailableThinkingLevels(): ThinkingLevel[];
|
|
1014
|
-
/**
|
|
1015
|
-
* Check if current model supports thinking/reasoning.
|
|
1016
|
-
*/
|
|
1017
850
|
supportsThinking(): boolean;
|
|
1018
|
-
private _getThinkingLevelForModelSwitch;
|
|
1019
|
-
private _clampThinkingLevel;
|
|
1020
851
|
/**
|
|
1021
852
|
* Set steering message mode.
|
|
1022
853
|
* Saves to settings.
|
|
@@ -1069,32 +900,6 @@ export declare class AgentSession {
|
|
|
1069
900
|
private _applyExtensionBindings;
|
|
1070
901
|
private _refreshCurrentModelFromRegistry;
|
|
1071
902
|
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
903
|
/** Register a memory provider contributed by an extension; applied on the next memory (re)init. */
|
|
1099
904
|
registerMemoryProvider(provider: MemoryProvider): void;
|
|
1100
905
|
/** R8: the gateway/scheduler registry. A deployment runner registers providers and drives start/stop. */
|
|
@@ -1104,10 +909,6 @@ export declare class AgentSession {
|
|
|
1104
909
|
/** R8: register a deployment-supplied job scheduler (cron). */
|
|
1105
910
|
registerJobScheduler(provider: JobSchedulerProvider): void;
|
|
1106
911
|
private _refreshToolRegistry;
|
|
1107
|
-
private _createReloadRuntimeSnapshot;
|
|
1108
|
-
private _restoreReloadRuntimeSnapshot;
|
|
1109
|
-
private _doctorReloadRuntime;
|
|
1110
|
-
private _buildRuntime;
|
|
1111
912
|
reload(): Promise<void>;
|
|
1112
913
|
/**
|
|
1113
914
|
* Unload a single extension without full reload.
|
|
@@ -1129,10 +930,10 @@ export declare class AgentSession {
|
|
|
1129
930
|
* Falls back to full reload if any individual load/unload fails.
|
|
1130
931
|
*/
|
|
1131
932
|
reconcileLoadedExtensions(): Promise<void>;
|
|
1132
|
-
private _isNonRetryableProviderLimitError;
|
|
1133
933
|
/**
|
|
1134
|
-
* Check if an error is retryable (
|
|
1135
|
-
*
|
|
934
|
+
* Check if an error is retryable (transient provider/network failures). Billing/quota and auth
|
|
935
|
+
* are terminal; context overflow is handled by compaction, not retry. The verdict comes from the
|
|
936
|
+
* reliability kernel's classifier, fed the host-computed context-overflow flag.
|
|
1136
937
|
*/
|
|
1137
938
|
private _isRetryableError;
|
|
1138
939
|
private _prepareRetry;
|
|
@@ -1148,53 +949,23 @@ export declare class AgentSession {
|
|
|
1148
949
|
* Toggle auto-retry setting.
|
|
1149
950
|
*/
|
|
1150
951
|
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
952
|
executeBash(command: string, onChunk?: (chunk: string) => void, options?: {
|
|
1160
953
|
excludeFromContext?: boolean;
|
|
1161
954
|
operations?: BashOperations;
|
|
1162
955
|
}): 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
956
|
recordBashResult(command: string, result: BashResult, options?: {
|
|
1168
957
|
excludeFromContext?: boolean;
|
|
1169
958
|
}): void;
|
|
1170
|
-
/**
|
|
1171
|
-
* Cancel running bash command.
|
|
1172
|
-
*/
|
|
1173
959
|
abortBash(): void;
|
|
1174
960
|
/** Whether a bash command is currently running */
|
|
1175
961
|
get isBashRunning(): boolean;
|
|
1176
962
|
/** Whether there are pending bash messages waiting to be flushed */
|
|
1177
963
|
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
964
|
private _flushPendingBashMessages;
|
|
1183
965
|
/**
|
|
1184
966
|
* Set a display name for the current session.
|
|
1185
967
|
*/
|
|
1186
968
|
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
969
|
navigateTree(targetId: string, options?: {
|
|
1199
970
|
summarize?: boolean;
|
|
1200
971
|
customInstructions?: string;
|
|
@@ -1206,51 +977,17 @@ export declare class AgentSession {
|
|
|
1206
977
|
aborted?: boolean;
|
|
1207
978
|
summaryEntry?: BranchSummaryEntry;
|
|
1208
979
|
}>;
|
|
1209
|
-
/**
|
|
1210
|
-
* Get all user messages from session for fork selector.
|
|
1211
|
-
*/
|
|
1212
980
|
getUserMessagesForForking(): Array<{
|
|
1213
981
|
entryId: string;
|
|
1214
982
|
text: string;
|
|
1215
983
|
}>;
|
|
1216
|
-
private _extractUserMessageText;
|
|
1217
|
-
/**
|
|
1218
|
-
* Get session statistics.
|
|
1219
|
-
*/
|
|
1220
984
|
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
985
|
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
986
|
addSpawnedUsage(usage: Usage, opts?: {
|
|
1245
987
|
label?: string;
|
|
1246
988
|
sourceSessionId?: string;
|
|
1247
989
|
reportId?: string;
|
|
1248
990
|
}): 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
991
|
getSpawnedUsage(): SpawnedUsageTotals;
|
|
1255
992
|
getDailyUsageTotals(now?: Date): DailyUsageTotals;
|
|
1256
993
|
getDailyUsageBreakdown(formatLabel?: (label: string) => string, now?: Date): string;
|
|
@@ -1277,21 +1014,7 @@ export declare class AgentSession {
|
|
|
1277
1014
|
getEvidenceBundleSnapshots(): EvidenceBundle[];
|
|
1278
1015
|
/** Live lane records tracked by this process (running and terminal). */
|
|
1279
1016
|
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
1017
|
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
1018
|
private _recordGateOutcome;
|
|
1296
1019
|
/** G8: copies of the bounded gate-outcome history, oldest first, latest last. */
|
|
1297
1020
|
getGateOutcomeHistory(): GateOutcomeHistoryEntry[];
|
|
@@ -1300,52 +1023,14 @@ export declare class AgentSession {
|
|
|
1300
1023
|
saveLearningDecisionSnapshot(decision: LearningDecision): string;
|
|
1301
1024
|
getLearningDecisionSnapshots(): LearningDecision[];
|
|
1302
1025
|
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
1026
|
/**
|
|
1321
1027
|
* Capability profile derived from the CURRENT session model's own metadata (context window),
|
|
1322
1028
|
* honoring the modelCapability.mode setting ("off" disables, a class name forces).
|
|
1323
1029
|
*/
|
|
1324
1030
|
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
1031
|
/**
|
|
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.
|
|
1032
|
+
* Run one bounded, read-only research pass and persist its results. Delegates to
|
|
1033
|
+
* {@link BackgroundLaneController}; see there for the full gating/budget/dedupe contract.
|
|
1349
1034
|
*/
|
|
1350
1035
|
runResearchLaneOnce(request?: {
|
|
1351
1036
|
query?: string;
|
|
@@ -1353,21 +1038,16 @@ export declare class AgentSession {
|
|
|
1353
1038
|
goalId?: string;
|
|
1354
1039
|
}): Promise<ResearchLaneRunOutcome>;
|
|
1355
1040
|
/**
|
|
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.
|
|
1041
|
+
* Run one bounded scout-worker delegation. Delegates to {@link BackgroundLaneController};
|
|
1042
|
+
* consumed by the `delegate` tool.
|
|
1360
1043
|
*/
|
|
1361
1044
|
runWorkerDelegationOnce(request: {
|
|
1362
1045
|
instructions: string;
|
|
1363
|
-
/** Model-provided replacement for the worker role prompt (the level-0 core always remains). */
|
|
1364
1046
|
systemPrompt?: string;
|
|
1365
1047
|
}): Promise<WorkerDelegationRunOutcome>;
|
|
1366
1048
|
/**
|
|
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.
|
|
1049
|
+
* Probe a candidate model against the subagent contracts. Delegates to
|
|
1050
|
+
* {@link BackgroundLaneController}; probe spend is reported through spawned-usage accounting.
|
|
1371
1051
|
*/
|
|
1372
1052
|
runModelFitness(args: {
|
|
1373
1053
|
model: string;
|
|
@@ -1385,26 +1065,13 @@ export declare class AgentSession {
|
|
|
1385
1065
|
continueGoalOnce(options: GoalContinuationOnceOptions): Promise<GoalContinuationOnceResult>;
|
|
1386
1066
|
continueGoalLoop(options: GoalContinuationLoopOptions): Promise<GoalContinuationLoopResult>;
|
|
1387
1067
|
/**
|
|
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.
|
|
1068
|
+
* Run a one-shot LLM completion fully ISOLATED from the main session — the load-bearing primitive
|
|
1069
|
+
* for native reflection (see reflection-controller.ts for the isolation invariants).
|
|
1398
1070
|
*/
|
|
1399
1071
|
runIsolatedCompletion(opts: IsolatedCompletionOptions): Promise<IsolatedCompletionResult>;
|
|
1400
1072
|
/**
|
|
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.
|
|
1073
|
+
* Native end-of-loop reflection pass (R2). Delegates to {@link ReflectionController}; returns null
|
|
1074
|
+
* when the demand gate skips or in a child session.
|
|
1408
1075
|
*/
|
|
1409
1076
|
runReflectionPass(input: {
|
|
1410
1077
|
signals: DemandSignals;
|
|
@@ -1416,41 +1083,14 @@ export declare class AgentSession {
|
|
|
1416
1083
|
reportId?: string;
|
|
1417
1084
|
}): Promise<ReflectionResult | null>;
|
|
1418
1085
|
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
|
-
*/
|
|
1086
|
+
/** Roll back one applied durable learning change. Delegates to {@link ReflectionController}. */
|
|
1425
1087
|
rollbackLearningWrite(auditId: string): Promise<{
|
|
1426
1088
|
ok: boolean;
|
|
1427
1089
|
reason: string;
|
|
1428
1090
|
}>;
|
|
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
1091
|
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
1092
|
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
1093
|
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
1094
|
getLastAssistantText(): string | undefined;
|
|
1455
1095
|
getAutonomyStatusSnapshot(): AutonomyStatusSnapshot;
|
|
1456
1096
|
/**
|