@caupulican/pi-adaptative 0.80.86 → 0.80.89
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 +178 -0
- package/dist/core/agent-session.d.ts +412 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +2053 -41
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/autonomy/approval-gate.d.ts +4 -0
- package/dist/core/autonomy/approval-gate.d.ts.map +1 -0
- package/dist/core/autonomy/approval-gate.js +27 -0
- package/dist/core/autonomy/approval-gate.js.map +1 -0
- package/dist/core/autonomy/bounded-completion.d.ts +27 -0
- package/dist/core/autonomy/bounded-completion.d.ts.map +1 -0
- package/dist/core/autonomy/bounded-completion.js +44 -0
- package/dist/core/autonomy/bounded-completion.js.map +1 -0
- package/dist/core/autonomy/contracts.d.ts +129 -0
- package/dist/core/autonomy/contracts.d.ts.map +1 -0
- package/dist/core/autonomy/contracts.js +2 -0
- package/dist/core/autonomy/contracts.js.map +1 -0
- package/dist/core/autonomy/gates.d.ts +15 -0
- package/dist/core/autonomy/gates.d.ts.map +1 -0
- package/dist/core/autonomy/gates.js +205 -0
- package/dist/core/autonomy/gates.js.map +1 -0
- package/dist/core/autonomy/lane-tracker.d.ts +48 -0
- package/dist/core/autonomy/lane-tracker.d.ts.map +1 -0
- package/dist/core/autonomy/lane-tracker.js +125 -0
- package/dist/core/autonomy/lane-tracker.js.map +1 -0
- package/dist/core/autonomy/path-scope.d.ts +9 -0
- package/dist/core/autonomy/path-scope.d.ts.map +1 -0
- package/dist/core/autonomy/path-scope.js +122 -0
- package/dist/core/autonomy/path-scope.js.map +1 -0
- package/dist/core/autonomy/risk-assessment.d.ts +3 -0
- package/dist/core/autonomy/risk-assessment.d.ts.map +1 -0
- package/dist/core/autonomy/risk-assessment.js +122 -0
- package/dist/core/autonomy/risk-assessment.js.map +1 -0
- package/dist/core/autonomy/session-lane-record.d.ts +10 -0
- package/dist/core/autonomy/session-lane-record.d.ts.map +1 -0
- package/dist/core/autonomy/session-lane-record.js +36 -0
- package/dist/core/autonomy/session-lane-record.js.map +1 -0
- package/dist/core/autonomy/status.d.ts +40 -0
- package/dist/core/autonomy/status.d.ts.map +1 -0
- package/dist/core/autonomy/status.js +107 -0
- package/dist/core/autonomy/status.js.map +1 -0
- package/dist/core/autonomy/subagent-prompt.d.ts +21 -0
- package/dist/core/autonomy/subagent-prompt.d.ts.map +1 -0
- package/dist/core/autonomy/subagent-prompt.js +28 -0
- package/dist/core/autonomy/subagent-prompt.js.map +1 -0
- package/dist/core/autonomy/telemetry-events.d.ts +18 -0
- package/dist/core/autonomy/telemetry-events.d.ts.map +1 -0
- package/dist/core/autonomy/telemetry-events.js +60 -0
- package/dist/core/autonomy/telemetry-events.js.map +1 -0
- package/dist/core/context/artifact-retrieval.d.ts +49 -0
- package/dist/core/context/artifact-retrieval.d.ts.map +1 -0
- package/dist/core/context/artifact-retrieval.js +49 -0
- package/dist/core/context/artifact-retrieval.js.map +1 -0
- package/dist/core/context/brain-curator.d.ts +88 -0
- package/dist/core/context/brain-curator.d.ts.map +1 -0
- package/dist/core/context/brain-curator.js +192 -0
- package/dist/core/context/brain-curator.js.map +1 -0
- package/dist/core/context/context-artifacts.d.ts +94 -0
- package/dist/core/context/context-artifacts.d.ts.map +1 -0
- package/dist/core/context/context-artifacts.js +307 -0
- package/dist/core/context/context-artifacts.js.map +1 -0
- package/dist/core/context/context-audit.d.ts +66 -0
- package/dist/core/context/context-audit.d.ts.map +1 -0
- package/dist/core/context/context-audit.js +173 -0
- package/dist/core/context/context-audit.js.map +1 -0
- package/dist/core/context/context-composition.d.ts +122 -0
- package/dist/core/context/context-composition.d.ts.map +1 -0
- package/dist/core/context/context-composition.js +163 -0
- package/dist/core/context/context-composition.js.map +1 -0
- package/dist/core/context/context-item.d.ts +117 -0
- package/dist/core/context/context-item.d.ts.map +1 -0
- package/dist/core/context/context-item.js +36 -0
- package/dist/core/context/context-item.js.map +1 -0
- package/dist/core/context/context-prompt-enforcement.d.ts +86 -0
- package/dist/core/context/context-prompt-enforcement.d.ts.map +1 -0
- package/dist/core/context/context-prompt-enforcement.js +168 -0
- package/dist/core/context/context-prompt-enforcement.js.map +1 -0
- package/dist/core/context/context-prompt-policy.d.ts +90 -0
- package/dist/core/context/context-prompt-policy.d.ts.map +1 -0
- package/dist/core/context/context-prompt-policy.js +73 -0
- package/dist/core/context/context-prompt-policy.js.map +1 -0
- package/dist/core/context/context-retention.d.ts +36 -0
- package/dist/core/context/context-retention.d.ts.map +1 -0
- package/dist/core/context/context-retention.js +108 -0
- package/dist/core/context/context-retention.js.map +1 -0
- package/dist/core/context/context-store.d.ts +37 -0
- package/dist/core/context/context-store.d.ts.map +1 -0
- package/dist/core/context/context-store.js +45 -0
- package/dist/core/context/context-store.js.map +1 -0
- package/dist/core/context/memory-diagnostics.d.ts +50 -0
- package/dist/core/context/memory-diagnostics.d.ts.map +1 -0
- package/dist/core/context/memory-diagnostics.js +43 -0
- package/dist/core/context/memory-diagnostics.js.map +1 -0
- package/dist/core/context/memory-index-store.d.ts +28 -0
- package/dist/core/context/memory-index-store.d.ts.map +1 -0
- package/dist/core/context/memory-index-store.js +38 -0
- package/dist/core/context/memory-index-store.js.map +1 -0
- package/dist/core/context/memory-prompt-block.d.ts +34 -0
- package/dist/core/context/memory-prompt-block.d.ts.map +1 -0
- package/dist/core/context/memory-prompt-block.js +58 -0
- package/dist/core/context/memory-prompt-block.js.map +1 -0
- package/dist/core/context/memory-provider-contract.d.ts +114 -0
- package/dist/core/context/memory-provider-contract.d.ts.map +1 -0
- package/dist/core/context/memory-provider-contract.js +121 -0
- package/dist/core/context/memory-provider-contract.js.map +1 -0
- package/dist/core/context/memory-retrieval.d.ts +27 -0
- package/dist/core/context/memory-retrieval.d.ts.map +1 -0
- package/dist/core/context/memory-retrieval.js +91 -0
- package/dist/core/context/memory-retrieval.js.map +1 -0
- package/dist/core/context/okf-memory-provider.d.ts +26 -0
- package/dist/core/context/okf-memory-provider.d.ts.map +1 -0
- package/dist/core/context/okf-memory-provider.js +154 -0
- package/dist/core/context/okf-memory-provider.js.map +1 -0
- package/dist/core/context/okf-memory.d.ts +42 -0
- package/dist/core/context/okf-memory.d.ts.map +1 -0
- package/dist/core/context/okf-memory.js +175 -0
- package/dist/core/context/okf-memory.js.map +1 -0
- package/dist/core/context/policy-engine.d.ts +66 -0
- package/dist/core/context/policy-engine.d.ts.map +1 -0
- package/dist/core/context/policy-engine.js +171 -0
- package/dist/core/context/policy-engine.js.map +1 -0
- package/dist/core/context/policy-types.d.ts +102 -0
- package/dist/core/context/policy-types.d.ts.map +1 -0
- package/dist/core/context/policy-types.js +7 -0
- package/dist/core/context/policy-types.js.map +1 -0
- package/dist/core/context/sqlite-runtime-index.d.ts +19 -0
- package/dist/core/context/sqlite-runtime-index.d.ts.map +1 -0
- package/dist/core/context/sqlite-runtime-index.js +344 -0
- package/dist/core/context/sqlite-runtime-index.js.map +1 -0
- package/dist/core/context/storage-authority.d.ts +20 -0
- package/dist/core/context/storage-authority.d.ts.map +1 -0
- package/dist/core/context/storage-authority.js +51 -0
- package/dist/core/context/storage-authority.js.map +1 -0
- package/dist/core/context/tool-output-packer.d.ts +75 -0
- package/dist/core/context/tool-output-packer.d.ts.map +1 -0
- package/dist/core/context/tool-output-packer.js +77 -0
- package/dist/core/context/tool-output-packer.js.map +1 -0
- package/dist/core/context-gc.d.ts +13 -0
- package/dist/core/context-gc.d.ts.map +1 -1
- package/dist/core/context-gc.js +6 -0
- package/dist/core/context-gc.js.map +1 -1
- package/dist/core/cost/session-usage.d.ts +20 -0
- package/dist/core/cost/session-usage.d.ts.map +1 -0
- package/dist/core/cost/session-usage.js +164 -0
- package/dist/core/cost/session-usage.js.map +1 -0
- package/dist/core/delegation/session-worker-result.d.ts +10 -0
- package/dist/core/delegation/session-worker-result.d.ts.map +1 -0
- package/dist/core/delegation/session-worker-result.js +36 -0
- package/dist/core/delegation/session-worker-result.js.map +1 -0
- package/dist/core/delegation/worker-result.d.ts +9 -0
- package/dist/core/delegation/worker-result.d.ts.map +1 -0
- package/dist/core/delegation/worker-result.js +152 -0
- package/dist/core/delegation/worker-result.js.map +1 -0
- package/dist/core/delegation/worker-runner.d.ts +58 -0
- package/dist/core/delegation/worker-runner.d.ts.map +1 -0
- package/dist/core/delegation/worker-runner.js +188 -0
- package/dist/core/delegation/worker-runner.js.map +1 -0
- package/dist/core/extensions/builtin.d.ts +5 -1
- package/dist/core/extensions/builtin.d.ts.map +1 -1
- package/dist/core/extensions/builtin.js +23 -1
- package/dist/core/extensions/builtin.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts +5 -1
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +13 -0
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/goals/goal-continuation-controller.d.ts +22 -0
- package/dist/core/goals/goal-continuation-controller.d.ts.map +1 -0
- package/dist/core/goals/goal-continuation-controller.js +88 -0
- package/dist/core/goals/goal-continuation-controller.js.map +1 -0
- package/dist/core/goals/goal-continuation-defaults.d.ts +10 -0
- package/dist/core/goals/goal-continuation-defaults.d.ts.map +1 -0
- package/dist/core/goals/goal-continuation-defaults.js +10 -0
- package/dist/core/goals/goal-continuation-defaults.js.map +1 -0
- package/dist/core/goals/goal-continuation-prompt.d.ts +18 -0
- package/dist/core/goals/goal-continuation-prompt.d.ts.map +1 -0
- package/dist/core/goals/goal-continuation-prompt.js +141 -0
- package/dist/core/goals/goal-continuation-prompt.js.map +1 -0
- package/dist/core/goals/goal-runtime-snapshot.d.ts +19 -0
- package/dist/core/goals/goal-runtime-snapshot.d.ts.map +1 -0
- package/dist/core/goals/goal-runtime-snapshot.js +23 -0
- package/dist/core/goals/goal-runtime-snapshot.js.map +1 -0
- package/dist/core/goals/goal-state.d.ts +87 -0
- package/dist/core/goals/goal-state.d.ts.map +1 -0
- package/dist/core/goals/goal-state.js +259 -0
- package/dist/core/goals/goal-state.js.map +1 -0
- package/dist/core/goals/goal-tool-core.d.ts +66 -0
- package/dist/core/goals/goal-tool-core.d.ts.map +1 -0
- package/dist/core/goals/goal-tool-core.js +146 -0
- package/dist/core/goals/goal-tool-core.js.map +1 -0
- package/dist/core/goals/session-goal-state.d.ts +10 -0
- package/dist/core/goals/session-goal-state.d.ts.map +1 -0
- package/dist/core/goals/session-goal-state.js +35 -0
- package/dist/core/goals/session-goal-state.js.map +1 -0
- package/dist/core/learning/learning-audit.d.ts +45 -0
- package/dist/core/learning/learning-audit.d.ts.map +1 -0
- package/dist/core/learning/learning-audit.js +139 -0
- package/dist/core/learning/learning-audit.js.map +1 -0
- package/dist/core/learning/learning-gate.d.ts +29 -0
- package/dist/core/learning/learning-gate.d.ts.map +1 -0
- package/dist/core/learning/learning-gate.js +150 -0
- package/dist/core/learning/learning-gate.js.map +1 -0
- package/dist/core/learning/session-learning-decision.d.ts +10 -0
- package/dist/core/learning/session-learning-decision.d.ts.map +1 -0
- package/dist/core/learning/session-learning-decision.js +36 -0
- package/dist/core/learning/session-learning-decision.js.map +1 -0
- package/dist/core/model-capability.d.ts +41 -0
- package/dist/core/model-capability.d.ts.map +1 -0
- package/dist/core/model-capability.js +101 -0
- package/dist/core/model-capability.js.map +1 -0
- package/dist/core/model-router/config-diagnostics.d.ts.map +1 -1
- package/dist/core/model-router/config-diagnostics.js +1 -0
- package/dist/core/model-router/config-diagnostics.js.map +1 -1
- package/dist/core/model-router/intent-classifier.d.ts +2 -0
- package/dist/core/model-router/intent-classifier.d.ts.map +1 -1
- package/dist/core/model-router/intent-classifier.js +154 -9
- package/dist/core/model-router/intent-classifier.js.map +1 -1
- package/dist/core/model-router/route-judge.d.ts +54 -0
- package/dist/core/model-router/route-judge.d.ts.map +1 -0
- package/dist/core/model-router/route-judge.js +128 -0
- package/dist/core/model-router/route-judge.js.map +1 -0
- package/dist/core/model-router/status.d.ts +4 -1
- package/dist/core/model-router/status.d.ts.map +1 -1
- package/dist/core/model-router/status.js +30 -6
- package/dist/core/model-router/status.js.map +1 -1
- package/dist/core/model-router/tool-escalation.d.ts +4 -6
- package/dist/core/model-router/tool-escalation.d.ts.map +1 -1
- package/dist/core/model-router/tool-escalation.js +1 -1
- package/dist/core/model-router/tool-escalation.js.map +1 -1
- package/dist/core/models/fitness-store.d.ts +40 -0
- package/dist/core/models/fitness-store.d.ts.map +1 -0
- package/dist/core/models/fitness-store.js +61 -0
- package/dist/core/models/fitness-store.js.map +1 -0
- package/dist/core/profile-registry.d.ts.map +1 -1
- package/dist/core/profile-registry.js +1 -1
- package/dist/core/profile-registry.js.map +1 -1
- package/dist/core/prompt-templates.d.ts +2 -0
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +12 -4
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/research/automata-provider.d.ts +5 -0
- package/dist/core/research/automata-provider.d.ts.map +1 -0
- package/dist/core/research/automata-provider.js +15 -0
- package/dist/core/research/automata-provider.js.map +1 -0
- package/dist/core/research/evidence-bundle.d.ts +10 -0
- package/dist/core/research/evidence-bundle.d.ts.map +1 -0
- package/dist/core/research/evidence-bundle.js +116 -0
- package/dist/core/research/evidence-bundle.js.map +1 -0
- package/dist/core/research/model-fitness.d.ts +82 -0
- package/dist/core/research/model-fitness.d.ts.map +1 -0
- package/dist/core/research/model-fitness.js +308 -0
- package/dist/core/research/model-fitness.js.map +1 -0
- package/dist/core/research/research-gate.d.ts +11 -0
- package/dist/core/research/research-gate.d.ts.map +1 -0
- package/dist/core/research/research-gate.js +82 -0
- package/dist/core/research/research-gate.js.map +1 -0
- package/dist/core/research/research-runner.d.ts +59 -0
- package/dist/core/research/research-runner.d.ts.map +1 -0
- package/dist/core/research/research-runner.js +155 -0
- package/dist/core/research/research-runner.js.map +1 -0
- package/dist/core/research/session-evidence-bundle.d.ts +11 -0
- package/dist/core/research/session-evidence-bundle.d.ts.map +1 -0
- package/dist/core/research/session-evidence-bundle.js +55 -0
- package/dist/core/research/session-evidence-bundle.js.map +1 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +4 -0
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/settings-manager.d.ts +160 -4
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +304 -9
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts +4 -0
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +18 -6
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +10 -1
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/toolkit/script-registry.d.ts +34 -0
- package/dist/core/toolkit/script-registry.d.ts.map +1 -0
- package/dist/core/toolkit/script-registry.js +71 -0
- package/dist/core/toolkit/script-registry.js.map +1 -0
- package/dist/core/toolkit/script-runner.d.ts +28 -0
- package/dist/core/toolkit/script-runner.d.ts.map +1 -0
- package/dist/core/toolkit/script-runner.js +48 -0
- package/dist/core/toolkit/script-runner.js.map +1 -0
- package/dist/core/tools/artifact-retrieve.d.ts +23 -0
- package/dist/core/tools/artifact-retrieve.d.ts.map +1 -0
- package/dist/core/tools/artifact-retrieve.js +110 -0
- package/dist/core/tools/artifact-retrieve.js.map +1 -0
- package/dist/core/tools/delegate.d.ts +32 -0
- package/dist/core/tools/delegate.d.ts.map +1 -0
- package/dist/core/tools/delegate.js +60 -0
- package/dist/core/tools/delegate.js.map +1 -0
- package/dist/core/tools/fff-search-backend.d.ts +103 -0
- package/dist/core/tools/fff-search-backend.d.ts.map +1 -0
- package/dist/core/tools/fff-search-backend.js +151 -0
- package/dist/core/tools/fff-search-backend.js.map +1 -0
- package/dist/core/tools/find.d.ts +21 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +183 -10
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/goal.d.ts +35 -0
- package/dist/core/tools/goal.d.ts.map +1 -0
- package/dist/core/tools/goal.js +122 -0
- package/dist/core/tools/goal.js.map +1 -0
- package/dist/core/tools/grep.d.ts +21 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +272 -27
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/index.d.ts +4 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +9 -0
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/model-fitness.d.ts +30 -0
- package/dist/core/tools/model-fitness.d.ts.map +1 -0
- package/dist/core/tools/model-fitness.js +38 -0
- package/dist/core/tools/model-fitness.js.map +1 -0
- package/dist/core/tools/run-toolkit-script.d.ts +24 -0
- package/dist/core/tools/run-toolkit-script.d.ts.map +1 -0
- package/dist/core/tools/run-toolkit-script.js +103 -0
- package/dist/core/tools/run-toolkit-script.js.map +1 -0
- package/dist/core/tools/search-router.d.ts +75 -0
- package/dist/core/tools/search-router.d.ts.map +1 -0
- package/dist/core/tools/search-router.js +85 -0
- package/dist/core/tools/search-router.js.map +1 -0
- package/dist/modes/interactive/components/fitness-role-selector.d.ts +13 -0
- package/dist/modes/interactive/components/fitness-role-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/fitness-role-selector.js +65 -0
- package/dist/modes/interactive/components/fitness-role-selector.js.map +1 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +18 -16
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +16 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +555 -11
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +9 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +308 -39
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/utils/tools-manager.d.ts +2 -0
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +154 -2
- package/dist/utils/tools-manager.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/npm-shrinkwrap.json +368 -12
- package/package.json +5 -4
|
@@ -1,18 +1,37 @@
|
|
|
1
1
|
import type { Agent, AgentEvent, AgentMessage, AgentState, AgentTool, ThinkingLevel } from "@caupulican/pi-agent-core";
|
|
2
2
|
import type { CacheRetention, ImageContent, Message, Model, StopReason, TextContent, Usage } from "@caupulican/pi-ai";
|
|
3
|
+
import type { CapabilityEnvelope, EvidenceBundle, LearningDecision, WorkerResult } from "./autonomy/contracts.ts";
|
|
4
|
+
import { type LaneRecord } from "./autonomy/lane-tracker.ts";
|
|
5
|
+
import type { AutonomyDiagnosticSnapshot, AutonomyStatusSnapshot } from "./autonomy/status.ts";
|
|
3
6
|
import { type BashResult } from "./bash-executor.ts";
|
|
4
7
|
import { type CompactionResult } from "./compaction/index.ts";
|
|
8
|
+
import { type CurationTelemetrySnapshot } from "./context/brain-curator.ts";
|
|
9
|
+
import { type ContextAuditReport } from "./context/context-audit.ts";
|
|
10
|
+
import { type ContextCompositionReport } from "./context/context-composition.ts";
|
|
11
|
+
import { type PromptEnforcementReport } from "./context/context-prompt-enforcement.ts";
|
|
12
|
+
import { type PromptPolicyGcCorrelationReport, type PromptPolicyShadowReport } from "./context/context-prompt-policy.ts";
|
|
13
|
+
import { type MemoryPromptInclusionReport } from "./context/memory-diagnostics.ts";
|
|
14
|
+
import { type MemoryRetrievalReport } from "./context/memory-retrieval.ts";
|
|
5
15
|
import { type ContextGcReport } from "./context-gc.ts";
|
|
6
16
|
import { type DailyUsageTotals } from "./cost/daily-usage.ts";
|
|
7
17
|
import { type CostGuardDecision } from "./cost-guard.ts";
|
|
18
|
+
import { type WorkerRunOutcome } from "./delegation/worker-runner.ts";
|
|
8
19
|
import { type ContextUsage, type ExtensionCommandContextActions, type ExtensionContext, type ExtensionErrorListener, ExtensionRunner, type ExtensionUIContext, type InputSource, type ReplacedSessionContext, type SessionStartEvent, type ShutdownHandler, type ToolDefinition, type ToolInfo } from "./extensions/index.ts";
|
|
9
20
|
import { type ChannelProvider, GatewayRegistry, type JobSchedulerProvider } from "./gateways/channel-provider.ts";
|
|
21
|
+
import { type GoalContinuationPrompt, type GoalContinuationPromptLimits } from "./goals/goal-continuation-prompt.ts";
|
|
22
|
+
import { type GoalRuntimeSnapshot, type GoalRuntimeSnapshotSettings } from "./goals/goal-runtime-snapshot.ts";
|
|
23
|
+
import type { GoalState } from "./goals/goal-state.ts";
|
|
24
|
+
import { type LearningAuditRecord } from "./learning/learning-audit.ts";
|
|
10
25
|
import { type DemandSignals, type ReflectionResult } from "./learning/reflection-engine.ts";
|
|
11
26
|
import { type CurationProposals } from "./learning/skill-curator.ts";
|
|
12
27
|
import type { MemoryProvider } from "./memory/memory-provider.ts";
|
|
13
28
|
import { type CustomMessage } from "./messages.ts";
|
|
29
|
+
import { type ModelCapabilityProfile } from "./model-capability.ts";
|
|
14
30
|
import type { ModelRegistry } from "./model-registry.ts";
|
|
31
|
+
import { type StoredFitnessReport } from "./models/fitness-store.ts";
|
|
15
32
|
import { type PromptTemplate } from "./prompt-templates.ts";
|
|
33
|
+
import { type ModelFitnessReport } from "./research/model-fitness.ts";
|
|
34
|
+
import { type ResearchRunResult } from "./research/research-runner.ts";
|
|
16
35
|
import type { ResourceLoader } from "./resource-loader.ts";
|
|
17
36
|
import type { BranchSummaryEntry, SessionManager } from "./session-manager.ts";
|
|
18
37
|
import { type ResourceProfileFilterSettings, type SettingsManager } from "./settings-manager.ts";
|
|
@@ -92,7 +111,7 @@ export interface AgentSessionConfig {
|
|
|
92
111
|
customTools?: ToolDefinition[];
|
|
93
112
|
/** Model registry for API key resolution and model discovery */
|
|
94
113
|
modelRegistry: ModelRegistry;
|
|
95
|
-
/** Initial active built-in tool names. Default: [read, bash, edit, write, context_audit] */
|
|
114
|
+
/** Initial active built-in tool names. Default: [read, bash, edit, write, context_audit, goal] */
|
|
96
115
|
initialActiveToolNames?: string[];
|
|
97
116
|
/** Optional allowlist of tool names. When provided, only these tool names are exposed. */
|
|
98
117
|
allowedToolNames?: string[];
|
|
@@ -145,6 +164,8 @@ export interface PromptOptions {
|
|
|
145
164
|
source?: InputSource;
|
|
146
165
|
/** Internal hook used by RPC mode to observe prompt preflight acceptance or rejection. */
|
|
147
166
|
preflightResult?: (success: boolean) => void;
|
|
167
|
+
/** Whether an idle active goal should auto-inject bounded continuation prompts after this prompt settles. Default: true. */
|
|
168
|
+
autoContinueGoal?: boolean;
|
|
148
169
|
}
|
|
149
170
|
/** Result from cycleModel() */
|
|
150
171
|
export interface ModelCycleResult {
|
|
@@ -230,10 +251,49 @@ export interface IsolatedCompletionResult {
|
|
|
230
251
|
usage: Usage;
|
|
231
252
|
stopReason: StopReason;
|
|
232
253
|
}
|
|
254
|
+
export interface ResearchLaneRunOutcome {
|
|
255
|
+
/** False when the pass was skipped before starting (see skipReason). */
|
|
256
|
+
started: boolean;
|
|
257
|
+
skipReason?: string;
|
|
258
|
+
/** Terminal lane record when the pass ran. */
|
|
259
|
+
record?: LaneRecord;
|
|
260
|
+
result?: ResearchRunResult;
|
|
261
|
+
}
|
|
262
|
+
export interface WorkerDelegationRunOutcome {
|
|
263
|
+
/** False when the delegation was skipped before starting (see skipReason). */
|
|
264
|
+
started: boolean;
|
|
265
|
+
skipReason?: string;
|
|
266
|
+
/** Terminal lane record when the delegation ran. */
|
|
267
|
+
record?: LaneRecord;
|
|
268
|
+
outcome?: WorkerRunOutcome;
|
|
269
|
+
}
|
|
270
|
+
export interface GoalContinuationOnceOptions {
|
|
271
|
+
maxStallTurns: number;
|
|
272
|
+
promptLimits?: GoalContinuationPromptLimits;
|
|
273
|
+
}
|
|
274
|
+
export interface GoalContinuationOnceResult {
|
|
275
|
+
submitted: boolean;
|
|
276
|
+
snapshot: GoalRuntimeSnapshot;
|
|
277
|
+
prompt?: GoalContinuationPrompt;
|
|
278
|
+
}
|
|
279
|
+
export type GoalContinuationLoopStopReason = "continuation_not_allowed" | "max_turns_reached" | "wall_clock_budget_reached" | "goal_state_not_advanced";
|
|
280
|
+
export interface GoalContinuationLoopOptions extends GoalContinuationOnceOptions {
|
|
281
|
+
maxTurns: number;
|
|
282
|
+
/** 0 or undefined disables wall-clock budget. */
|
|
283
|
+
maxWallClockMinutes?: number;
|
|
284
|
+
/** Test seam for wall-clock budget enforcement. Defaults to Date.now. */
|
|
285
|
+
now?: () => number;
|
|
286
|
+
}
|
|
287
|
+
export interface GoalContinuationLoopResult {
|
|
288
|
+
turnsSubmitted: number;
|
|
289
|
+
stopReason: GoalContinuationLoopStopReason;
|
|
290
|
+
finalSnapshot: GoalRuntimeSnapshot;
|
|
291
|
+
}
|
|
233
292
|
export declare class AgentSession {
|
|
234
293
|
readonly agent: Agent;
|
|
235
294
|
readonly sessionManager: SessionManager;
|
|
236
295
|
readonly settingsManager: SettingsManager;
|
|
296
|
+
capabilityEnvelope?: CapabilityEnvelope;
|
|
237
297
|
private _scopedModels;
|
|
238
298
|
private _unsubscribeAgent?;
|
|
239
299
|
private _eventListeners;
|
|
@@ -248,10 +308,45 @@ export declare class AgentSession {
|
|
|
248
308
|
private _pendingNextTurnMessages;
|
|
249
309
|
/** Serializes prompt() submissions made while streaming so queued steering/follow-ups keep user-typed FIFO order. */
|
|
250
310
|
private _streamingPromptSubmissionTail;
|
|
311
|
+
/** Pending idle timer that starts bounded goal continuation after the session becomes idle. */
|
|
312
|
+
private _goalAutoContinueTimer;
|
|
313
|
+
/** Guards bounded idle autosteer so continuation prompts do not recursively trigger themselves. */
|
|
314
|
+
private _isGoalAutoContinuing;
|
|
315
|
+
/** Pending idle timer that starts an autonomous research pass after the session becomes idle. */
|
|
316
|
+
private _researchLaneTimer;
|
|
317
|
+
/** Single-flight guard: at most one research pass runs at a time per session. */
|
|
318
|
+
private _isResearchLaneRunning;
|
|
319
|
+
/** Why the last idle research-lane evaluation skipped, for /autonomy diagnostics. */
|
|
320
|
+
private _lastResearchLaneSkipReason;
|
|
321
|
+
/** Live lane registry — the real source for AutonomyStatusSnapshot.activeLaneCount. */
|
|
322
|
+
private readonly _laneTracker;
|
|
323
|
+
/** Session-lifetime abort for in-flight research passes (same pattern as _reflectionAbort). */
|
|
324
|
+
private readonly _researchLaneAbort;
|
|
325
|
+
/** Single-flight guard: at most one delegated worker runs at a time per session. */
|
|
326
|
+
private _isWorkerDelegationRunning;
|
|
327
|
+
/** Session-lifetime abort for in-flight delegated workers. */
|
|
328
|
+
private readonly _workerDelegationAbort;
|
|
329
|
+
/**
|
|
330
|
+
* The last tool set requested via setActiveToolsByName BEFORE model-capability filtering, so
|
|
331
|
+
* switching from a small-window model back to a large one restores the full requested set.
|
|
332
|
+
*/
|
|
333
|
+
private _requestedActiveToolNames;
|
|
251
334
|
private _compactionAbortController;
|
|
252
335
|
private _autoCompactionAbortController;
|
|
253
336
|
private _overflowRecoveryAttempted;
|
|
254
337
|
private _latestContextGcReport;
|
|
338
|
+
/** Brain-curation sidecar (design: brain-context-curation-design.md). Inert unless the
|
|
339
|
+
* contextPolicy.curation setting is enabled AND the model passes the digest fitness gate. */
|
|
340
|
+
private readonly _brainCurator;
|
|
341
|
+
private _lastCurationSkipReason;
|
|
342
|
+
private _toolArtifactStore;
|
|
343
|
+
private _latestContextAuditReport;
|
|
344
|
+
private _latestPromptPolicyReport;
|
|
345
|
+
private _latestPromptPolicyGcCorrelation;
|
|
346
|
+
private _latestPromptEnforcementReport;
|
|
347
|
+
private _memoryOkfProvider;
|
|
348
|
+
private _latestMemoryRetrievalReport;
|
|
349
|
+
private _latestMemoryPromptInclusionReport;
|
|
255
350
|
private _branchSummaryAbortController;
|
|
256
351
|
private _retryAbortController;
|
|
257
352
|
private _retryAttempt;
|
|
@@ -286,10 +381,12 @@ export declare class AgentSession {
|
|
|
286
381
|
private _costGuardDowngraded;
|
|
287
382
|
/** Active model-router intent for the current transient routed turn, if any. */
|
|
288
383
|
private _activeModelRouterIntent?;
|
|
384
|
+
private _activeModelRouterRoute?;
|
|
289
385
|
private _modelRouterSessionBuffer?;
|
|
290
386
|
private _modelRouterEscalationRequested;
|
|
291
387
|
private _isModelRouterRetry;
|
|
292
388
|
private _lastModelRouterDecision?;
|
|
389
|
+
private _lastAutonomyGateOutcome?;
|
|
293
390
|
private _lastModelRouterSkipReason?;
|
|
294
391
|
private _lastModelRouterIntent?;
|
|
295
392
|
/** Lazily-built skill curator (#32) over `<agentDir>/skills`. */
|
|
@@ -373,7 +470,174 @@ export declare class AgentSession {
|
|
|
373
470
|
private _installAgentTurnRefresh;
|
|
374
471
|
private _createAgentContextSnapshot;
|
|
375
472
|
private _contextGcStorageDir;
|
|
473
|
+
private _toolArtifactsDir;
|
|
474
|
+
/**
|
|
475
|
+
* Session-scoped, filesystem-backed artifact store for first-capture-then-bound tool
|
|
476
|
+
* output (grep/find only, for now -- see tool-output-artifacts.md). Lazily created and
|
|
477
|
+
* cached so every tool construction in this session shares one store instance.
|
|
478
|
+
*
|
|
479
|
+
* `packToolOutput()` registers a reference (the packing tool call's id) at pack time
|
|
480
|
+
* and fails closed, so packed artifacts are never prematurely collected.
|
|
481
|
+
* `_releaseGcPackedArtifactReferences()` (called from `_applyContextGc()`) releases
|
|
482
|
+
* that reference once context-gc packs the result out of live context, and
|
|
483
|
+
* opportunistically reclaims now-unreferenced artifacts via `cleanup()`.
|
|
484
|
+
* Remaining carry-forward gap: cleanup() now also runs at dispose(), but only reclaims
|
|
485
|
+
* already-released (zero-reference) artifacts. A session that ends before context-gc
|
|
486
|
+
* ever evicts a result never releases that reference, so its artifact stays on disk by
|
|
487
|
+
* design (resolvable on resume). Reclaiming those requires an explicit cross-session
|
|
488
|
+
* expiry/liveness policy, not just a sweep.
|
|
489
|
+
*/
|
|
490
|
+
private _getToolArtifactStore;
|
|
491
|
+
/**
|
|
492
|
+
* Fixed path for this slice's local Pi OKF memory documents, shared across sessions
|
|
493
|
+
* under this agentDir (not session-scoped, unlike tool-artifacts/context-gc, since OKF
|
|
494
|
+
* memory represents durable cross-session knowledge, not a per-session capture). Not
|
|
495
|
+
* yet user-configurable -- see the memory-retrieval settings doc comment.
|
|
496
|
+
*/
|
|
497
|
+
private _memoryOkfDir;
|
|
498
|
+
/**
|
|
499
|
+
* Session-scoped, read-only local OKF memory provider. Lazily created ONLY when memory
|
|
500
|
+
* retrieval is enabled (see `_runMemoryRetrieval`) -- never force-created, so a session
|
|
501
|
+
* with the setting off never touches `_memoryOkfDir()` at all (no directory access, no
|
|
502
|
+
* creation; `createOkfMemoryProvider` itself never writes/mkdirs either way).
|
|
503
|
+
*/
|
|
504
|
+
private _getMemoryOkfProvider;
|
|
505
|
+
/**
|
|
506
|
+
* One pass over the current branch, mapping each toolResult's toolCallId to its
|
|
507
|
+
* persisted session-entry id. Rebuilt every audit pass (O(branch) per turn), so this is
|
|
508
|
+
* O(n^2) over a long session. Fine at current scale; after the artifact-read fix this is
|
|
509
|
+
* the next per-turn audit cost to optimize if it ever matters (e.g. cache/incrementally
|
|
510
|
+
* update instead of a full rebuild).
|
|
511
|
+
*/
|
|
512
|
+
private _buildSessionEntryIdLookup;
|
|
513
|
+
/**
|
|
514
|
+
* Phase 1 observe-only audit pass (see context/context-audit.ts): converts live
|
|
515
|
+
* toolResult messages into ContextItems and runs the existing retention/hard-constraint
|
|
516
|
+
* evaluators over them, storing the latest deterministic report for tests/debugging.
|
|
517
|
+
* Read-only with respect to messages, the transcript, and artifact references -- uses
|
|
518
|
+
* `_toolArtifactStore` (the field), not `_getToolArtifactStore()` (the getter), so a
|
|
519
|
+
* session that never packed anything doesn't force-create a store/dir just to audit.
|
|
520
|
+
* Never throws into a live turn: any failure degrades to an empty report.
|
|
521
|
+
*/
|
|
522
|
+
private _runContextAudit;
|
|
523
|
+
/**
|
|
524
|
+
* Read-only inspection of the context audit. With `messages`, recomputes fresh against
|
|
525
|
+
* the given array (still no mutation of messages/transcript/artifact refs); without,
|
|
526
|
+
* returns the last report computed during a real transform pass.
|
|
527
|
+
*/
|
|
528
|
+
getContextAuditReport(messages?: AgentMessage[]): ContextAuditReport;
|
|
529
|
+
/**
|
|
530
|
+
* Observe-first shadow/planning pass (see context/context-prompt-policy.ts): re-shapes
|
|
531
|
+
* the audit report into a per-item policy plan whose `appliedAction` is always
|
|
532
|
+
* "keep_raw" -- this never enforces anything, it only records what the policy engine
|
|
533
|
+
* would say. Never throws into a live turn: any failure degrades to an empty report.
|
|
534
|
+
*/
|
|
535
|
+
private _runPromptPolicyPlanning;
|
|
536
|
+
/**
|
|
537
|
+
* Read-only inspection of the shadow policy plan. With `messages`, recomputes fresh
|
|
538
|
+
* (audit + plan) against the given array; without, returns the last plan computed
|
|
539
|
+
* during a real transform pass. Never mutates messages/transcript/artifact refs.
|
|
540
|
+
*/
|
|
541
|
+
getPromptPolicyReport(messages?: AgentMessage[]): PromptPolicyShadowReport;
|
|
542
|
+
/**
|
|
543
|
+
* Report-only correlation between the shadow plan just computed this turn and what the
|
|
544
|
+
* legacy context-gc pass actually packed. Runs after `_applyContextGc()` has already
|
|
545
|
+
* produced its report; never influences context-gc itself. Never throws into a live
|
|
546
|
+
* turn: any failure degrades to an empty correlation.
|
|
547
|
+
*/
|
|
548
|
+
private _correlatePromptPolicyWithContextGc;
|
|
549
|
+
/** Read-only inspection of the latest shadow-plan/legacy-gc correlation, for tests/debugging. */
|
|
550
|
+
getPromptPolicyGcCorrelation(): PromptPolicyGcCorrelationReport;
|
|
551
|
+
/**
|
|
552
|
+
* First enforcement pilot (see context/context-prompt-enforcement.ts): opt-in,
|
|
553
|
+
* default-disabled stub-in-place of stale artifact-backed tool_output results in the
|
|
554
|
+
* provider-visible message array only. Runs on `messages` AFTER context-gc has already
|
|
555
|
+
* produced its own result, so legacy context-gc's own packing/reporting is completely
|
|
556
|
+
* unaffected by this pass -- it only ever acts on messages gc left untouched this turn.
|
|
557
|
+
* Never throws into a live turn: any failure degrades to returning `messages` unchanged.
|
|
558
|
+
*/
|
|
559
|
+
private _runPromptEnforcement;
|
|
560
|
+
/**
|
|
561
|
+
* Enqueue relevance-scoring jobs for stale, artifact-backed tool outputs the enforcement
|
|
562
|
+
* pilot could act on. Pure queueing — the verdicts only ever take effect through the
|
|
563
|
+
* asymmetric advisory lever inside enforcePromptPolicy. Never throws into a turn.
|
|
564
|
+
*/
|
|
565
|
+
private _enqueueRelevanceCuration;
|
|
566
|
+
/**
|
|
567
|
+
* Drain gate: settings on, model configured+authed, and the model has PASSED the digest
|
|
568
|
+
* fitness probe on THIS host (design: unfit or unprobed models are refused with a visible
|
|
569
|
+
* reason, never silently degraded). Fire-and-forget; never throws into a turn.
|
|
570
|
+
*/
|
|
571
|
+
private _maybeDrainBrainCuration;
|
|
572
|
+
private _drainBrainCuration;
|
|
573
|
+
/**
|
|
574
|
+
* Context composition dashboard data: decomposes the per-request payload (system prompt, tool
|
|
575
|
+
* schemas, extension contributions, message classes incl. GC/policy stubs and recall pages)
|
|
576
|
+
* plus background spend, so users can see exactly what their integrations cost per request.
|
|
577
|
+
* Read-only: uses the GC report path (writePayloads=false), never mutates anything.
|
|
578
|
+
*/
|
|
579
|
+
getContextCompositionReport(): ContextCompositionReport;
|
|
580
|
+
/** Bounded plain-text rendering of {@link getContextCompositionReport} for the /context command. */
|
|
581
|
+
formatContextCompositionDashboard(): string;
|
|
582
|
+
/** Curation status for diagnostics/dashboard: settings, live telemetry, last refusal reason. */
|
|
583
|
+
getContextCurationStatus(): {
|
|
584
|
+
enabled: boolean;
|
|
585
|
+
model?: string;
|
|
586
|
+
telemetry: CurationTelemetrySnapshot;
|
|
587
|
+
lastSkipReason?: string;
|
|
588
|
+
};
|
|
589
|
+
/** Read-only inspection of the latest prompt-enforcement report, for tests/debugging. */
|
|
590
|
+
getPromptEnforcementReport(): PromptEnforcementReport;
|
|
591
|
+
private _runMemoryRetrieval;
|
|
592
|
+
/** Read-only inspection of the latest memory-retrieval report, for tests/debugging. */
|
|
593
|
+
getMemoryRetrievalReport(): MemoryRetrievalReport;
|
|
594
|
+
/**
|
|
595
|
+
* Bounded prompt-surfacing pilot for local memory evidence (see
|
|
596
|
+
* context/memory-prompt-block.ts): opt-in, default disabled, and gated on TWO settings
|
|
597
|
+
* (`enabled` AND `includeInPrompt`) plus a non-empty `report.contextItems` -- the first
|
|
598
|
+
* two are belt-and-suspenders on top of the fact that `_runMemoryRetrieval` already
|
|
599
|
+
* leaves `contextItems` empty whenever `enabled` is false, regardless of
|
|
600
|
+
* `includeInPrompt`. Reuses the `report` this pass's `_runMemoryRetrieval` call already
|
|
601
|
+
* computed -- never re-queries the provider here.
|
|
602
|
+
*
|
|
603
|
+
* Appends exactly one ephemeral `custom`/"memory_evidence" message wrapped by
|
|
604
|
+
* `wrapUntrustedText` (the same nonce-fenced boundary + always-on system-prompt rule
|
|
605
|
+
* used for other untrusted content) to the END of `messages`. This is purely additive
|
|
606
|
+
* (never mutates an existing message) and purely transient: `messages` here is the
|
|
607
|
+
* array about to be sent to the provider, not `this.agent.state.messages` or anything
|
|
608
|
+
* persisted via `sessionManager` -- so the injected message can never reach the
|
|
609
|
+
* transcript, regardless of how many times this pass runs.
|
|
610
|
+
*
|
|
611
|
+
* Also records a `MemoryPromptInclusionReport` (context/memory-diagnostics.ts) at each
|
|
612
|
+
* branch below, for context_audit's diagnostic surface only -- this is pure bookkeeping
|
|
613
|
+
* alongside the existing branches, not a new branch/condition: the messages returned
|
|
614
|
+
* are unchanged by this recording.
|
|
615
|
+
*/
|
|
616
|
+
private _maybeAppendMemoryEvidenceBlock;
|
|
617
|
+
/** Read-only inspection of the latest memory-prompt-inclusion decision, for tests/debugging and context_audit. */
|
|
618
|
+
getMemoryPromptInclusionReport(): MemoryPromptInclusionReport;
|
|
619
|
+
/**
|
|
620
|
+
* Combines the already-stored, no-arg latest reports (never re-queries the provider or
|
|
621
|
+
* touches the OKF directory) into the safe, allow-list-projected shape context_audit
|
|
622
|
+
* exposes. See context/memory-diagnostics.ts for why this projection is allow-list
|
|
623
|
+
* based rather than a spread-then-delete of the raw report.
|
|
624
|
+
*/
|
|
625
|
+
private _getMemoryAuditDiagnostics;
|
|
376
626
|
private _applyContextGc;
|
|
627
|
+
/**
|
|
628
|
+
* Reference-release + cleanup lifecycle: once context-gc has packed a grep/find tool
|
|
629
|
+
* result out of the live prompt (the message is no longer current/active working
|
|
630
|
+
* context -- see contracts-and-retention.md's "ephemeral"/"expired" retention
|
|
631
|
+
* classes), release the pack-time reference `packToolOutput()` registered for it, and
|
|
632
|
+
* opportunistically reclaim now-unreferenced artifacts. This is the other half of the
|
|
633
|
+
* D2b-1 gate: artifacts were being registered but never released, so they accumulated
|
|
634
|
+
* for the life of the session.
|
|
635
|
+
*
|
|
636
|
+
* `record.toolCallId` (from context-gc's packed record) is exactly the holder id
|
|
637
|
+
* `packToolOutput()` used when it called `addReference()` -- both trace back to the
|
|
638
|
+
* same tool call's id -- so no separate bookkeeping is needed to find it.
|
|
639
|
+
*/
|
|
640
|
+
private _releaseGcPackedArtifactReferences;
|
|
377
641
|
getContextGcReport(messages?: AgentMessage[]): ContextGcReport;
|
|
378
642
|
private _estimateCurrentContextTokens;
|
|
379
643
|
private _installAgentToolHooks;
|
|
@@ -449,6 +713,16 @@ export declare class AgentSession {
|
|
|
449
713
|
* Only tools in the registry can be enabled. Unknown tool names are ignored.
|
|
450
714
|
* Also rebuilds the system prompt to reflect the new tool set.
|
|
451
715
|
* Changes take effect on the next agent turn.
|
|
716
|
+
*
|
|
717
|
+
* artifact_retrieve is auto-activated as a companion whenever grep or find ends up
|
|
718
|
+
* in the resulting active set and artifact_retrieve is registered (i.e. not excluded/
|
|
719
|
+
* blocked/outside an allowlist -- the registry itself is built with that same filter,
|
|
720
|
+
* so registry presence already tracks "allowed"). This is enforced here, not just in
|
|
721
|
+
* the settings/profile refresh flow, because this method is a public, extension-
|
|
722
|
+
* exposed activation path (`setActiveTools`) on its own: without this, grep/find could
|
|
723
|
+
* end up active while still being handed an artifact store (gated on "allowed" in
|
|
724
|
+
* `_buildRuntime`) with no active tool able to resolve the resulting
|
|
725
|
+
* "Full output: artifact tool-output:<id>" handle.
|
|
452
726
|
*/
|
|
453
727
|
setActiveToolsByName(toolNames: string[]): void;
|
|
454
728
|
/** Whether compaction or branch summarization is currently running */
|
|
@@ -488,7 +762,11 @@ export declare class AgentSession {
|
|
|
488
762
|
private _buildAutonomyPrompt;
|
|
489
763
|
private _rebuildSystemPrompt;
|
|
490
764
|
private _runAgentPrompt;
|
|
765
|
+
private _isModelAvailableAndAuthed;
|
|
766
|
+
private _resolveModelRouterTurnRoute;
|
|
491
767
|
private _resolveModelRouterModelForIntent;
|
|
768
|
+
private _resolveConfiguredTierModel;
|
|
769
|
+
private _resolveModelRouterTurnRouteJudged;
|
|
492
770
|
private _resolveModelRouterTurnModel;
|
|
493
771
|
getModelRouterStatus(formatLabel?: (label: string) => string): string;
|
|
494
772
|
private _runAgentPromptWithModelRouter;
|
|
@@ -863,6 +1141,118 @@ export declare class AgentSession {
|
|
|
863
1141
|
getSpawnedUsage(): SpawnedUsageTotals;
|
|
864
1142
|
getDailyUsageTotals(now?: Date): DailyUsageTotals;
|
|
865
1143
|
getDailyUsageBreakdown(formatLabel?: (label: string) => string, now?: Date): string;
|
|
1144
|
+
/**
|
|
1145
|
+
* Save a snapshot of the goal state to the session log.
|
|
1146
|
+
*
|
|
1147
|
+
* @returns the id of the appended custom entry
|
|
1148
|
+
*/
|
|
1149
|
+
saveGoalStateSnapshot(state: GoalState): string;
|
|
1150
|
+
/**
|
|
1151
|
+
* Retrieve the latest valid goal state snapshot from the session log.
|
|
1152
|
+
*/
|
|
1153
|
+
getGoalStateSnapshot(): GoalState | undefined;
|
|
1154
|
+
/**
|
|
1155
|
+
* Save a snapshot of the evidence bundle to the session log.
|
|
1156
|
+
*
|
|
1157
|
+
* @returns the id of the appended custom entry
|
|
1158
|
+
*/
|
|
1159
|
+
saveEvidenceBundleSnapshot(bundle: EvidenceBundle): string;
|
|
1160
|
+
/**
|
|
1161
|
+
* Retrieve the latest valid evidence bundle snapshot from the session log.
|
|
1162
|
+
*/
|
|
1163
|
+
getEvidenceBundleSnapshot(): EvidenceBundle | undefined;
|
|
1164
|
+
getEvidenceBundleSnapshots(): EvidenceBundle[];
|
|
1165
|
+
/** Live lane records tracked by this process (running and terminal). */
|
|
1166
|
+
getLaneRecords(): LaneRecord[];
|
|
1167
|
+
saveWorkerResultSnapshot(result: WorkerResult): string;
|
|
1168
|
+
getWorkerResultSnapshots(): WorkerResult[];
|
|
1169
|
+
saveLearningDecisionSnapshot(decision: LearningDecision): string;
|
|
1170
|
+
getLearningDecisionSnapshots(): LearningDecision[];
|
|
1171
|
+
getGoalRuntimeSnapshot(settings: GoalRuntimeSnapshotSettings): GoalRuntimeSnapshot;
|
|
1172
|
+
private _clearGoalAutoContinueTimer;
|
|
1173
|
+
private _scheduleGoalAutoContinueFromIdle;
|
|
1174
|
+
private _runScheduledGoalAutoContinue;
|
|
1175
|
+
private _clearResearchLaneTimer;
|
|
1176
|
+
/**
|
|
1177
|
+
* Derive the research demand from durable goal state: an active goal with open requirements,
|
|
1178
|
+
* deduplicated against the latest persisted bundle so the same requirement set is never
|
|
1179
|
+
* researched twice (the query is deterministic, so dedupe survives session reload).
|
|
1180
|
+
*/
|
|
1181
|
+
private _buildResearchLaneDemand;
|
|
1182
|
+
/**
|
|
1183
|
+
* Idle trigger for the autonomous research lane (mirrors {@link _scheduleGoalAutoContinueFromIdle}).
|
|
1184
|
+
* All skips are recorded in `_lastResearchLaneSkipReason` and surfaced via diagnostics — the lane
|
|
1185
|
+
* informs, it never prompts or blocks the foreground.
|
|
1186
|
+
*/
|
|
1187
|
+
private _scheduleResearchLaneFromIdle;
|
|
1188
|
+
private _runScheduledResearchLane;
|
|
1189
|
+
/**
|
|
1190
|
+
* Capability profile derived from the CURRENT session model's own metadata (context window),
|
|
1191
|
+
* honoring the modelCapability.mode setting ("off" disables, a class name forces).
|
|
1192
|
+
*/
|
|
1193
|
+
getModelCapabilityProfile(): ModelCapabilityProfile;
|
|
1194
|
+
/** Capability profile for a specific lane model (lane budgets scale to the lane model's window). */
|
|
1195
|
+
private _laneCapabilityProfile;
|
|
1196
|
+
/**
|
|
1197
|
+
* Resolve the model for a background lane. Lanes are shipped BY this session, so they inherit
|
|
1198
|
+
* the session's own model unless a lane-specific model is explicitly configured — a single-model
|
|
1199
|
+
* setup (e.g. one local open model) runs its lanes on that same model. An explicitly configured
|
|
1200
|
+
* pattern that cannot resolve/authenticate is a visible skip, not a silent fallback.
|
|
1201
|
+
*/
|
|
1202
|
+
private _resolveLaneModel;
|
|
1203
|
+
/**
|
|
1204
|
+
* Resolve what a lane ships with. Precedence: explicit lane model setting, then the lane
|
|
1205
|
+
* profile's model (a shipped profile with a model MUST be obeyed — unresolvable is a visible
|
|
1206
|
+
* skip, never a fallback), then generic inheritance of the session model.
|
|
1207
|
+
*/
|
|
1208
|
+
private _resolveLaneShipment;
|
|
1209
|
+
/** UAC tool grants from a shipped lane profile, recorded on the lane envelope. */
|
|
1210
|
+
private _laneProfileToolGrants;
|
|
1211
|
+
/** Stripped research envelope — never the foreground/architect envelope. */
|
|
1212
|
+
private _buildResearchLaneEnvelope;
|
|
1213
|
+
/**
|
|
1214
|
+
* Run one bounded, read-only research pass and persist its results: evidence bundle snapshot,
|
|
1215
|
+
* terminal lane record, and spawned-usage cost report (single-hop invariant, idempotent on the
|
|
1216
|
+
* lane's reportId). Explicit calls (e.g. `/autonomy research`) express user intent and bypass the
|
|
1217
|
+
* enabled/mode/dedupe gates the idle scheduler enforces; budget and capability gates always apply.
|
|
1218
|
+
*/
|
|
1219
|
+
runResearchLaneOnce(request?: {
|
|
1220
|
+
query?: string;
|
|
1221
|
+
context?: string;
|
|
1222
|
+
goalId?: string;
|
|
1223
|
+
}): Promise<ResearchLaneRunOutcome>;
|
|
1224
|
+
/**
|
|
1225
|
+
* Run one bounded scout-worker delegation: build a WorkerRequest with a stripped read-only
|
|
1226
|
+
* envelope, execute it as an isolated completion on a cheap lane, validate the result via
|
|
1227
|
+
* {@link validateWorkerResult} before acceptance, and persist result + lane record + spawned
|
|
1228
|
+
* usage (idempotent per-lane reportId). Consumed by the `delegate` tool.
|
|
1229
|
+
*/
|
|
1230
|
+
runWorkerDelegationOnce(request: {
|
|
1231
|
+
instructions: string;
|
|
1232
|
+
/** Model-provided replacement for the worker role prompt (the level-0 core always remains). */
|
|
1233
|
+
systemPrompt?: string;
|
|
1234
|
+
}): Promise<WorkerDelegationRunOutcome>;
|
|
1235
|
+
/**
|
|
1236
|
+
* Probe a candidate model against the subagent contracts (research/worker/judge/search/
|
|
1237
|
+
* tool-call surfaces) via {@link runModelFitnessProbe}. The model must resolve and
|
|
1238
|
+
* authenticate; every probe call runs as an isolated completion on that model, and probe
|
|
1239
|
+
* spend is reported through spawned-usage accounting.
|
|
1240
|
+
*/
|
|
1241
|
+
runModelFitness(args: {
|
|
1242
|
+
model: string;
|
|
1243
|
+
trials?: number;
|
|
1244
|
+
}): Promise<{
|
|
1245
|
+
started: true;
|
|
1246
|
+
model: string;
|
|
1247
|
+
report: ModelFitnessReport;
|
|
1248
|
+
} | {
|
|
1249
|
+
started: false;
|
|
1250
|
+
skipReason: string;
|
|
1251
|
+
}>;
|
|
1252
|
+
/** Fitness reports persisted for THIS host (measured evidence for architect/profile decisions). */
|
|
1253
|
+
getStoredFitnessReports(): StoredFitnessReport[];
|
|
1254
|
+
continueGoalOnce(options: GoalContinuationOnceOptions): Promise<GoalContinuationOnceResult>;
|
|
1255
|
+
continueGoalLoop(options: GoalContinuationLoopOptions): Promise<GoalContinuationLoopResult>;
|
|
866
1256
|
/**
|
|
867
1257
|
* Run a one-shot LLM completion fully ISOLATED from the main session — the load-bearing
|
|
868
1258
|
* primitive for the native reflection engine (adaptive-agent design §6c/§7).
|
|
@@ -894,6 +1284,17 @@ export declare class AgentSession {
|
|
|
894
1284
|
/** Stable id so a duplicate scheduling/retry of the same pass can't double-count its cost. */
|
|
895
1285
|
reportId?: string;
|
|
896
1286
|
}): Promise<ReflectionResult | null>;
|
|
1287
|
+
getLearningAuditRecords(): LearningAuditRecord[];
|
|
1288
|
+
/**
|
|
1289
|
+
* Roll back one applied durable learning change by executing the inverse operation recorded in
|
|
1290
|
+
* its audit record (memory ops run through the same bundled memory-tool path as the original
|
|
1291
|
+
* apply; promoted skills are archived). Appends a linked "rollback" audit record on success so
|
|
1292
|
+
* the change history stays complete and a change cannot be rolled back twice.
|
|
1293
|
+
*/
|
|
1294
|
+
rollbackLearningWrite(auditId: string): Promise<{
|
|
1295
|
+
ok: boolean;
|
|
1296
|
+
reason: string;
|
|
1297
|
+
}>;
|
|
897
1298
|
private _applyReflectionWrite;
|
|
898
1299
|
/**
|
|
899
1300
|
* R7: write a reflection-promoted skill as `<agentDir>/skills/<name>/SKILL.md` so it loads like any
|
|
@@ -920,6 +1321,16 @@ export declare class AgentSession {
|
|
|
920
1321
|
* @returns Text content, or undefined if no assistant message exists
|
|
921
1322
|
*/
|
|
922
1323
|
getLastAssistantText(): string | undefined;
|
|
1324
|
+
getAutonomyStatusSnapshot(): AutonomyStatusSnapshot;
|
|
1325
|
+
/**
|
|
1326
|
+
* Aggregate an effectiveness/autonomy dashboard: what Pi has actually been doing (recent
|
|
1327
|
+
* route choices, latest gate outcome, cost, and any research/delegation/learning/goal
|
|
1328
|
+
* activity). Read-only — combines existing session-log getters, never mutates state or
|
|
1329
|
+
* recomputes a route/gate decision.
|
|
1330
|
+
*/
|
|
1331
|
+
getAutonomyDiagnosticSnapshot(options?: {
|
|
1332
|
+
maxEntriesPerFamily?: number;
|
|
1333
|
+
}): AutonomyDiagnosticSnapshot;
|
|
923
1334
|
createReplacedSessionContext(): ReplacedSessionContext;
|
|
924
1335
|
/**
|
|
925
1336
|
* Check if extensions have handlers for a specific event type.
|