@caupulican/pi-adaptative 0.80.86 → 0.80.88
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 +149 -0
- package/dist/core/agent-session.d.ts +377 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +1791 -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/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-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 +73 -0
- package/dist/core/context/context-prompt-enforcement.d.ts.map +1 -0
- package/dist/core/context/context-prompt-enforcement.js +153 -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/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 +79 -0
- package/dist/core/research/model-fitness.d.ts.map +1 -0
- package/dist/core/research/model-fitness.js +257 -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 +147 -4
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +285 -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 +4 -0
- 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/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 +13 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +471 -11
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +4 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +217 -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
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,128 @@
|
|
|
1
|
+
## [0.80.88] - 2026-07-02
|
|
2
|
+
|
|
3
|
+
## [0.80.87] - 2026-07-02
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Added an opt-in Context / Prompt Policy setting that stubs stale, artifact-backed grep/find tool output
|
|
8
|
+
in the model-visible prompt only (never the transcript) once configured retention-window and character
|
|
9
|
+
thresholds are exceeded. Configurable via the Context / Prompt Policy settings submenu; default disabled.
|
|
10
|
+
- Added an opt-in Context / Memory Retrieval setting that searches local Pi OKF memory documents each turn
|
|
11
|
+
and can optionally surface a bounded, source-labeled evidence block in the model prompt (never the
|
|
12
|
+
transcript). Configurable via the Context / Memory Retrieval settings submenu, including a separate
|
|
13
|
+
"Include in prompt" toggle; both default disabled, and retrieval only ever queries the local provider.
|
|
14
|
+
- Extended `context_audit` with a compact Memory retrieval / Prompt inclusion diagnostic section reporting
|
|
15
|
+
status and counts for the two settings above, without exposing any memory content, query text, or file
|
|
16
|
+
paths.
|
|
17
|
+
- Added a `goal` tool that records the durable goal ledger (goal, requirements, evidence, and
|
|
18
|
+
progress/stall events) as session-persisted snapshots. This is the producer that drives the bounded
|
|
19
|
+
goal continuation loop and `/goal-continue`; without it the continuation runtime always read empty
|
|
20
|
+
state and could not continue. The tool is active by default and maps to the `memory_write` capability.
|
|
21
|
+
- Added `/autonomy diagnostics`, an effectiveness dashboard summarizing recent model-router decisions,
|
|
22
|
+
current/spawned/daily cost totals, and, when present, the latest research, worker-delegation,
|
|
23
|
+
learning, and goal activity. It is additive to `/autonomy [status|off|safe|balanced|full]`.
|
|
24
|
+
- Added the autonomous research lane runtime: an opt-in, read-only background research pass that runs
|
|
25
|
+
when the session goes idle with an active goal that has open requirements, executes one bounded
|
|
26
|
+
isolated completion through the (unwired-until-now) research capability/budget gate, and persists a
|
|
27
|
+
provenance-tagged evidence bundle plus a terminal lane record. Budgets cover cost per pass,
|
|
28
|
+
wall-clock time, findings/sources caps, and idle runs per session; failures/skips are recorded with
|
|
29
|
+
reason codes and never block or prompt the foreground. Research spend reports through spawned-usage
|
|
30
|
+
accounting with an idempotent per-lane report id. Configurable via the new Research Lane settings
|
|
31
|
+
submenu (default disabled; also requires autonomy mode on); `/autonomy research` triggers an
|
|
32
|
+
explicit pass. Live lanes now feed the previously-unset `activeLaneCount` in `/autonomy status`
|
|
33
|
+
snapshots, and `/autonomy diagnostics` shows research lane records, all evidence bundles, and the
|
|
34
|
+
last skip reason.
|
|
35
|
+
- Added the bounded worker-delegation runtime piloting read-only scout workers: a new `delegate`
|
|
36
|
+
tool (active by default, mapped to the `delegate` capability, refusing with a reason until the
|
|
37
|
+
Worker Delegation setting is enabled) lets the foreground model hand one self-contained analysis
|
|
38
|
+
task to a worker running as a bounded isolated completion on a cheap model lane under a stripped
|
|
39
|
+
read-only envelope. Every result is validated through the existing `validateWorkerResult` parent
|
|
40
|
+
gate before acceptance, persisted as a worker-result snapshot plus a terminal lane record, marked
|
|
41
|
+
untrusted in the tool output, and cost-reported through spawned-usage accounting with an
|
|
42
|
+
idempotent per-lane report id. Budgets cover cost per worker and wall-clock time; delegation
|
|
43
|
+
lanes appear in `/autonomy diagnostics` and count toward the live `activeLaneCount`.
|
|
44
|
+
- Added the learning apply/audit/rollback policy runtime: reflection-sourced durable writes now
|
|
45
|
+
route through the (previously unwired) learning gate, persist a `LearningDecision` snapshot per
|
|
46
|
+
write, and leave an audit record with a concrete rollback plan for every applied or proposed
|
|
47
|
+
change. With the new Learning Policy settings disabled (default) the legacy direct-apply
|
|
48
|
+
behavior is preserved — now fully audited; when enabled, single-session reflection cues become
|
|
49
|
+
proposals unless the configured confidence/observation thresholds and allowed layers
|
|
50
|
+
(memory-only by default) permit auto-apply. `/autonomy rollback <auditId>` (and
|
|
51
|
+
`AgentSession.rollbackLearningWrite`) executes the inverse memory operation or archives a
|
|
52
|
+
promoted skill, exactly once per change, and records a linked rollback audit. Audit records
|
|
53
|
+
appear in the `/autonomy diagnostics` learning family.
|
|
54
|
+
- Added model-capability auto-detection so small open models (including sub-1B local models) stay
|
|
55
|
+
usable for chat: the harness derives a capability class from the model's own `contextWindow`
|
|
56
|
+
metadata — full (≥32k, unchanged), lean (≥16k, background-autonomy tools like `delegate` and
|
|
57
|
+
`context_audit` blocked), minimal (≥8k, tools reduced to read/bash/edit/write, background lanes
|
|
58
|
+
disabled), and chat (<8k, no tools at all). Filtering happens in `setActiveToolsByName`, so the
|
|
59
|
+
system prompt sheds the blocked tools' schemas and guidelines too; the unfiltered request is
|
|
60
|
+
remembered and restored when switching back to a larger model, with a visible notice on
|
|
61
|
+
downgrade. Idle goal auto-continuation and the research lane are gated off below 16k
|
|
62
|
+
(`model_context_too_small` in diagnostics), and lane output-token budgets scale to the lane
|
|
63
|
+
model's window. Metadata-first with defaults only when info is missing (unknown window keeps
|
|
64
|
+
full behavior); configurable via `modelCapability.mode` (`auto` default, `off`, or a forced
|
|
65
|
+
class).
|
|
66
|
+
- Changed background-lane model resolution to inherit the session model the lane was shipped
|
|
67
|
+
from unless a lane-specific model is explicitly configured (the router's `cheapModel` no longer
|
|
68
|
+
implicitly redirects lanes) — single-model setups, e.g. one local open model, now run research
|
|
69
|
+
and scout workers on that same model.
|
|
70
|
+
- Changed active resource profiles to strict least-privilege grants: when one or more profiles are
|
|
71
|
+
active, any authority-bearing resource kind (extensions, skills, prompts, tools, agents) that no
|
|
72
|
+
active profile explicitly mentions is denied outright — a defaults profile no longer loads the
|
|
73
|
+
full extension/tool surface. Grant-all must be explicit via `allow: ["*"]`; explicitly written
|
|
74
|
+
block-framed filters keep meaning "all except the listed"; themes are exempt; behavior without
|
|
75
|
+
an active profile is unchanged.
|
|
76
|
+
- Changed profile denial to gate the disk reads themselves: skill files and prompt templates a
|
|
77
|
+
profile denies are never read from disk (extensions were already path-filtered before loading).
|
|
78
|
+
While a restrictive profile is active, denied skills/prompts consequently no longer appear in
|
|
79
|
+
resource listings; edit profiles with no restrictive profile active to see everything.
|
|
80
|
+
- Added profile-shipped subagents: research and worker lanes accept a `profile` setting whose
|
|
81
|
+
model MUST be obeyed when set (unresolvable is a visible `no_lane_profile_model` skip, never a
|
|
82
|
+
fallback), whose soul and thinking level ship with the lane, and whose tool grants are recorded
|
|
83
|
+
on the lane's capability envelope. Generic lanes keep inheriting the session model.
|
|
84
|
+
- Added a level-0 subagent system-prompt core (<300 tokens of non-negotiable rules) that survives
|
|
85
|
+
ANY prompt customization: lane settings (`systemPrompt`) and the delegate tool's new
|
|
86
|
+
`systemPrompt` input can erase and replace everything above it — so a big session model can
|
|
87
|
+
hand a small open model a minimal purpose-built prompt without shedding the safety floor.
|
|
88
|
+
- Added `run_toolkit_script` (active by default, mapped to the `run_shell` capability): the
|
|
89
|
+
user's blessed daily-ops script registry (`settings.toolkit.scripts` — name, description,
|
|
90
|
+
aliases, uv/powershell/bash runner, danger flag) executed with a structural reliability
|
|
91
|
+
contract. Finding is a conservative registry lookup that NEVER guesses between near-neighbors
|
|
92
|
+
("prepare db" vs "update-db" returns a shortlist instead of executing); the harness owns
|
|
93
|
+
invocation (fixed argv, no shell strings) and always returns exit code, stdout, and stderr —
|
|
94
|
+
a failed script is an error result by construction and can never look like success; scripts
|
|
95
|
+
flagged `danger` never run without an explicit `confirm: true`.
|
|
96
|
+
- Added the `model_fitness` probe (tool + `/autonomy fitness <model> [trials]`): runs the real
|
|
97
|
+
research-lane, scout-worker, and routing-judge runners plus two heavy-lifter surfaces
|
|
98
|
+
(search-plan formulation, tool-call emission) against any registered model — local Ollama
|
|
99
|
+
models included — reporting parse/success rates, judge discrimination, mean latency,
|
|
100
|
+
tokens-per-second, and probe cost. Probe spend is cost-accounted; the tool is registered but
|
|
101
|
+
not default-active. An opt-in size-class bench (`PI_LOCAL_MODEL_BENCH=1`) asserts per-class
|
|
102
|
+
minimum bars for locally installed models.
|
|
103
|
+
- Added a host-keyed fitness store (`<agentDir>/state/model-fitness.json`): every probe persists
|
|
104
|
+
its report under a hardware fingerprint (CPU/cores/RAM), because fitness is a property of a
|
|
105
|
+
model ON a host — role assignments stay per-machine and synced settings cannot carry one
|
|
106
|
+
machine's speed numbers onto another. `AgentSession.getStoredFitnessReports()` exposes the
|
|
107
|
+
current host's measured evidence for profile/role decisions.
|
|
108
|
+
- Added the routing judge: with the model router enabled, a bounded routing-only completion on the
|
|
109
|
+
judge lane (`modelRouter.judgeModel`, else `mediumModel`; ≤128 output tokens, 10s wall clock,
|
|
110
|
+
static cached prompt) decides the final cheap/medium/expensive tier over the regex baseline —
|
|
111
|
+
never the learning tier. Core rule: planning/design prompts are never cheap unless the judge
|
|
112
|
+
explicitly deems them trivial; the regex classifier now also floors prospective planning prompts
|
|
113
|
+
at medium (`planning_min_medium`) while plain lookups like "show me the architecture" stay
|
|
114
|
+
cheap. Judge failures fall back to the baseline with visible reasons, judge spend reports
|
|
115
|
+
through spawned-usage accounting, and `modelRouter.judgeEnabled: false` restores byte-identical
|
|
116
|
+
router behavior.
|
|
117
|
+
|
|
118
|
+
### Changed
|
|
119
|
+
|
|
120
|
+
- Changed bounded goal continuation to default to 20 turns and auto-inject continuation prompts after a
|
|
121
|
+
prompt settles idle while an active goal remains open, with internal recursion suppression for
|
|
122
|
+
continuation prompts. It now also respects new settings for wall-clock budget, idle delay, and turn limits,
|
|
123
|
+
which can be configured via the Autonomy submenu in the settings TUI.
|
|
124
|
+
- Added a third positional argument `[maxMinutes]` to the `/goal-continue` command to support bounded wall-clock loop termination.
|
|
125
|
+
|
|
1
126
|
## [0.80.86] - 2026-06-29
|
|
2
127
|
|
|
3
128
|
### Added
|
|
@@ -8,6 +133,30 @@
|
|
|
8
133
|
|
|
9
134
|
- Fixed adaptive scaling of compaction parameters (`reserveTokens` and `keepRecentTokens`) for models with small context windows to avoid immediate auto-compaction loops.
|
|
10
135
|
- Fixed a scope redeclaration issue with `activeProfileNames` in the resource loader.
|
|
136
|
+
- Fixed the semantic-memory context GC never packing the recall pages the bundled default memory
|
|
137
|
+
provider emits: active providers' page markers are now merged into the GC marker list at runtime
|
|
138
|
+
(and the generic `<memory_context` marker joined the settings default), so stale cross-session
|
|
139
|
+
recall pages no longer accumulate raw — and re-bill — for the life of the session.
|
|
140
|
+
- Fixed internal tool-registry refreshes (extension `refreshTools`, memory init, `/reload`,
|
|
141
|
+
live extension load/unload) permanently shrinking the restorable tool set: they re-derived from
|
|
142
|
+
the capability/profile-filtered ACTIVE tools instead of the pre-filter request, so switching back
|
|
143
|
+
to a larger model restored only the reduced set.
|
|
144
|
+
- Fixed the model router judge being consulted on internally generated continuation turns (one
|
|
145
|
+
judge call per loop iteration) and enforced the planning floor in code: a cheap downgrade of a
|
|
146
|
+
non-cheap baseline now requires the judge's explicit `trivial` verdict.
|
|
147
|
+
- Fixed `model_fitness` probes: per-surface calls are now wall-clock bounded (a hung local model
|
|
148
|
+
can no longer hang the probe), tokens/sec is measured in the shipped session path, and an empty
|
|
149
|
+
judge prompt set no longer yields NaN latency.
|
|
150
|
+
- Fixed reflection learning-audit ids colliding after no-op decisions (the rollback key now counts
|
|
151
|
+
only stored snapshots), which could block or misdirect `learning rollback`.
|
|
152
|
+
- Fixed the lane tracker growing without bound in long sessions (terminal lanes beyond 100 are
|
|
153
|
+
evicted from memory; the session log keeps full history) and lane ids being reused after resume.
|
|
154
|
+
- Fixed toolkit script execution discarding spawn-failure diagnostics: a missing runner
|
|
155
|
+
(ENOENT/EACCES) now surfaces the real cause in stderr instead of an empty `exited null`, and an
|
|
156
|
+
output-overflow kill is no longer mislabeled as a timeout. Repeated words in a request no longer
|
|
157
|
+
multiply the Level-0 matcher score into a false confident match.
|
|
158
|
+
- Fixed NaN/invalid model `contextWindow` metadata leaking into capability profiles and lane
|
|
159
|
+
budgets in `off`/forced modes.
|
|
11
160
|
|
|
12
161
|
|
|
13
162
|
## [0.80.85] - 2026-06-29
|
|
@@ -1,18 +1,35 @@
|
|
|
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 ContextAuditReport } from "./context/context-audit.ts";
|
|
9
|
+
import { type PromptEnforcementReport } from "./context/context-prompt-enforcement.ts";
|
|
10
|
+
import { type PromptPolicyGcCorrelationReport, type PromptPolicyShadowReport } from "./context/context-prompt-policy.ts";
|
|
11
|
+
import { type MemoryPromptInclusionReport } from "./context/memory-diagnostics.ts";
|
|
12
|
+
import { type MemoryRetrievalReport } from "./context/memory-retrieval.ts";
|
|
5
13
|
import { type ContextGcReport } from "./context-gc.ts";
|
|
6
14
|
import { type DailyUsageTotals } from "./cost/daily-usage.ts";
|
|
7
15
|
import { type CostGuardDecision } from "./cost-guard.ts";
|
|
16
|
+
import { type WorkerRunOutcome } from "./delegation/worker-runner.ts";
|
|
8
17
|
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
18
|
import { type ChannelProvider, GatewayRegistry, type JobSchedulerProvider } from "./gateways/channel-provider.ts";
|
|
19
|
+
import { type GoalContinuationPrompt, type GoalContinuationPromptLimits } from "./goals/goal-continuation-prompt.ts";
|
|
20
|
+
import { type GoalRuntimeSnapshot, type GoalRuntimeSnapshotSettings } from "./goals/goal-runtime-snapshot.ts";
|
|
21
|
+
import type { GoalState } from "./goals/goal-state.ts";
|
|
22
|
+
import { type LearningAuditRecord } from "./learning/learning-audit.ts";
|
|
10
23
|
import { type DemandSignals, type ReflectionResult } from "./learning/reflection-engine.ts";
|
|
11
24
|
import { type CurationProposals } from "./learning/skill-curator.ts";
|
|
12
25
|
import type { MemoryProvider } from "./memory/memory-provider.ts";
|
|
13
26
|
import { type CustomMessage } from "./messages.ts";
|
|
27
|
+
import { type ModelCapabilityProfile } from "./model-capability.ts";
|
|
14
28
|
import type { ModelRegistry } from "./model-registry.ts";
|
|
29
|
+
import { type StoredFitnessReport } from "./models/fitness-store.ts";
|
|
15
30
|
import { type PromptTemplate } from "./prompt-templates.ts";
|
|
31
|
+
import { type ModelFitnessReport } from "./research/model-fitness.ts";
|
|
32
|
+
import { type ResearchRunResult } from "./research/research-runner.ts";
|
|
16
33
|
import type { ResourceLoader } from "./resource-loader.ts";
|
|
17
34
|
import type { BranchSummaryEntry, SessionManager } from "./session-manager.ts";
|
|
18
35
|
import { type ResourceProfileFilterSettings, type SettingsManager } from "./settings-manager.ts";
|
|
@@ -92,7 +109,7 @@ export interface AgentSessionConfig {
|
|
|
92
109
|
customTools?: ToolDefinition[];
|
|
93
110
|
/** Model registry for API key resolution and model discovery */
|
|
94
111
|
modelRegistry: ModelRegistry;
|
|
95
|
-
/** Initial active built-in tool names. Default: [read, bash, edit, write, context_audit] */
|
|
112
|
+
/** Initial active built-in tool names. Default: [read, bash, edit, write, context_audit, goal] */
|
|
96
113
|
initialActiveToolNames?: string[];
|
|
97
114
|
/** Optional allowlist of tool names. When provided, only these tool names are exposed. */
|
|
98
115
|
allowedToolNames?: string[];
|
|
@@ -145,6 +162,8 @@ export interface PromptOptions {
|
|
|
145
162
|
source?: InputSource;
|
|
146
163
|
/** Internal hook used by RPC mode to observe prompt preflight acceptance or rejection. */
|
|
147
164
|
preflightResult?: (success: boolean) => void;
|
|
165
|
+
/** Whether an idle active goal should auto-inject bounded continuation prompts after this prompt settles. Default: true. */
|
|
166
|
+
autoContinueGoal?: boolean;
|
|
148
167
|
}
|
|
149
168
|
/** Result from cycleModel() */
|
|
150
169
|
export interface ModelCycleResult {
|
|
@@ -230,10 +249,49 @@ export interface IsolatedCompletionResult {
|
|
|
230
249
|
usage: Usage;
|
|
231
250
|
stopReason: StopReason;
|
|
232
251
|
}
|
|
252
|
+
export interface ResearchLaneRunOutcome {
|
|
253
|
+
/** False when the pass was skipped before starting (see skipReason). */
|
|
254
|
+
started: boolean;
|
|
255
|
+
skipReason?: string;
|
|
256
|
+
/** Terminal lane record when the pass ran. */
|
|
257
|
+
record?: LaneRecord;
|
|
258
|
+
result?: ResearchRunResult;
|
|
259
|
+
}
|
|
260
|
+
export interface WorkerDelegationRunOutcome {
|
|
261
|
+
/** False when the delegation was skipped before starting (see skipReason). */
|
|
262
|
+
started: boolean;
|
|
263
|
+
skipReason?: string;
|
|
264
|
+
/** Terminal lane record when the delegation ran. */
|
|
265
|
+
record?: LaneRecord;
|
|
266
|
+
outcome?: WorkerRunOutcome;
|
|
267
|
+
}
|
|
268
|
+
export interface GoalContinuationOnceOptions {
|
|
269
|
+
maxStallTurns: number;
|
|
270
|
+
promptLimits?: GoalContinuationPromptLimits;
|
|
271
|
+
}
|
|
272
|
+
export interface GoalContinuationOnceResult {
|
|
273
|
+
submitted: boolean;
|
|
274
|
+
snapshot: GoalRuntimeSnapshot;
|
|
275
|
+
prompt?: GoalContinuationPrompt;
|
|
276
|
+
}
|
|
277
|
+
export type GoalContinuationLoopStopReason = "continuation_not_allowed" | "max_turns_reached" | "wall_clock_budget_reached" | "goal_state_not_advanced";
|
|
278
|
+
export interface GoalContinuationLoopOptions extends GoalContinuationOnceOptions {
|
|
279
|
+
maxTurns: number;
|
|
280
|
+
/** 0 or undefined disables wall-clock budget. */
|
|
281
|
+
maxWallClockMinutes?: number;
|
|
282
|
+
/** Test seam for wall-clock budget enforcement. Defaults to Date.now. */
|
|
283
|
+
now?: () => number;
|
|
284
|
+
}
|
|
285
|
+
export interface GoalContinuationLoopResult {
|
|
286
|
+
turnsSubmitted: number;
|
|
287
|
+
stopReason: GoalContinuationLoopStopReason;
|
|
288
|
+
finalSnapshot: GoalRuntimeSnapshot;
|
|
289
|
+
}
|
|
233
290
|
export declare class AgentSession {
|
|
234
291
|
readonly agent: Agent;
|
|
235
292
|
readonly sessionManager: SessionManager;
|
|
236
293
|
readonly settingsManager: SettingsManager;
|
|
294
|
+
capabilityEnvelope?: CapabilityEnvelope;
|
|
237
295
|
private _scopedModels;
|
|
238
296
|
private _unsubscribeAgent?;
|
|
239
297
|
private _eventListeners;
|
|
@@ -248,10 +306,41 @@ export declare class AgentSession {
|
|
|
248
306
|
private _pendingNextTurnMessages;
|
|
249
307
|
/** Serializes prompt() submissions made while streaming so queued steering/follow-ups keep user-typed FIFO order. */
|
|
250
308
|
private _streamingPromptSubmissionTail;
|
|
309
|
+
/** Pending idle timer that starts bounded goal continuation after the session becomes idle. */
|
|
310
|
+
private _goalAutoContinueTimer;
|
|
311
|
+
/** Guards bounded idle autosteer so continuation prompts do not recursively trigger themselves. */
|
|
312
|
+
private _isGoalAutoContinuing;
|
|
313
|
+
/** Pending idle timer that starts an autonomous research pass after the session becomes idle. */
|
|
314
|
+
private _researchLaneTimer;
|
|
315
|
+
/** Single-flight guard: at most one research pass runs at a time per session. */
|
|
316
|
+
private _isResearchLaneRunning;
|
|
317
|
+
/** Why the last idle research-lane evaluation skipped, for /autonomy diagnostics. */
|
|
318
|
+
private _lastResearchLaneSkipReason;
|
|
319
|
+
/** Live lane registry — the real source for AutonomyStatusSnapshot.activeLaneCount. */
|
|
320
|
+
private readonly _laneTracker;
|
|
321
|
+
/** Session-lifetime abort for in-flight research passes (same pattern as _reflectionAbort). */
|
|
322
|
+
private readonly _researchLaneAbort;
|
|
323
|
+
/** Single-flight guard: at most one delegated worker runs at a time per session. */
|
|
324
|
+
private _isWorkerDelegationRunning;
|
|
325
|
+
/** Session-lifetime abort for in-flight delegated workers. */
|
|
326
|
+
private readonly _workerDelegationAbort;
|
|
327
|
+
/**
|
|
328
|
+
* The last tool set requested via setActiveToolsByName BEFORE model-capability filtering, so
|
|
329
|
+
* switching from a small-window model back to a large one restores the full requested set.
|
|
330
|
+
*/
|
|
331
|
+
private _requestedActiveToolNames;
|
|
251
332
|
private _compactionAbortController;
|
|
252
333
|
private _autoCompactionAbortController;
|
|
253
334
|
private _overflowRecoveryAttempted;
|
|
254
335
|
private _latestContextGcReport;
|
|
336
|
+
private _toolArtifactStore;
|
|
337
|
+
private _latestContextAuditReport;
|
|
338
|
+
private _latestPromptPolicyReport;
|
|
339
|
+
private _latestPromptPolicyGcCorrelation;
|
|
340
|
+
private _latestPromptEnforcementReport;
|
|
341
|
+
private _memoryOkfProvider;
|
|
342
|
+
private _latestMemoryRetrievalReport;
|
|
343
|
+
private _latestMemoryPromptInclusionReport;
|
|
255
344
|
private _branchSummaryAbortController;
|
|
256
345
|
private _retryAbortController;
|
|
257
346
|
private _retryAttempt;
|
|
@@ -286,10 +375,12 @@ export declare class AgentSession {
|
|
|
286
375
|
private _costGuardDowngraded;
|
|
287
376
|
/** Active model-router intent for the current transient routed turn, if any. */
|
|
288
377
|
private _activeModelRouterIntent?;
|
|
378
|
+
private _activeModelRouterRoute?;
|
|
289
379
|
private _modelRouterSessionBuffer?;
|
|
290
380
|
private _modelRouterEscalationRequested;
|
|
291
381
|
private _isModelRouterRetry;
|
|
292
382
|
private _lastModelRouterDecision?;
|
|
383
|
+
private _lastAutonomyGateOutcome?;
|
|
293
384
|
private _lastModelRouterSkipReason?;
|
|
294
385
|
private _lastModelRouterIntent?;
|
|
295
386
|
/** Lazily-built skill curator (#32) over `<agentDir>/skills`. */
|
|
@@ -373,7 +464,145 @@ export declare class AgentSession {
|
|
|
373
464
|
private _installAgentTurnRefresh;
|
|
374
465
|
private _createAgentContextSnapshot;
|
|
375
466
|
private _contextGcStorageDir;
|
|
467
|
+
private _toolArtifactsDir;
|
|
468
|
+
/**
|
|
469
|
+
* Session-scoped, filesystem-backed artifact store for first-capture-then-bound tool
|
|
470
|
+
* output (grep/find only, for now -- see tool-output-artifacts.md). Lazily created and
|
|
471
|
+
* cached so every tool construction in this session shares one store instance.
|
|
472
|
+
*
|
|
473
|
+
* `packToolOutput()` registers a reference (the packing tool call's id) at pack time
|
|
474
|
+
* and fails closed, so packed artifacts are never prematurely collected.
|
|
475
|
+
* `_releaseGcPackedArtifactReferences()` (called from `_applyContextGc()`) releases
|
|
476
|
+
* that reference once context-gc packs the result out of live context, and
|
|
477
|
+
* opportunistically reclaims now-unreferenced artifacts via `cleanup()`.
|
|
478
|
+
* Remaining carry-forward gap: cleanup() now also runs at dispose(), but only reclaims
|
|
479
|
+
* already-released (zero-reference) artifacts. A session that ends before context-gc
|
|
480
|
+
* ever evicts a result never releases that reference, so its artifact stays on disk by
|
|
481
|
+
* design (resolvable on resume). Reclaiming those requires an explicit cross-session
|
|
482
|
+
* expiry/liveness policy, not just a sweep.
|
|
483
|
+
*/
|
|
484
|
+
private _getToolArtifactStore;
|
|
485
|
+
/**
|
|
486
|
+
* Fixed path for this slice's local Pi OKF memory documents, shared across sessions
|
|
487
|
+
* under this agentDir (not session-scoped, unlike tool-artifacts/context-gc, since OKF
|
|
488
|
+
* memory represents durable cross-session knowledge, not a per-session capture). Not
|
|
489
|
+
* yet user-configurable -- see the memory-retrieval settings doc comment.
|
|
490
|
+
*/
|
|
491
|
+
private _memoryOkfDir;
|
|
492
|
+
/**
|
|
493
|
+
* Session-scoped, read-only local OKF memory provider. Lazily created ONLY when memory
|
|
494
|
+
* retrieval is enabled (see `_runMemoryRetrieval`) -- never force-created, so a session
|
|
495
|
+
* with the setting off never touches `_memoryOkfDir()` at all (no directory access, no
|
|
496
|
+
* creation; `createOkfMemoryProvider` itself never writes/mkdirs either way).
|
|
497
|
+
*/
|
|
498
|
+
private _getMemoryOkfProvider;
|
|
499
|
+
/**
|
|
500
|
+
* One pass over the current branch, mapping each toolResult's toolCallId to its
|
|
501
|
+
* persisted session-entry id. Rebuilt every audit pass (O(branch) per turn), so this is
|
|
502
|
+
* O(n^2) over a long session. Fine at current scale; after the artifact-read fix this is
|
|
503
|
+
* the next per-turn audit cost to optimize if it ever matters (e.g. cache/incrementally
|
|
504
|
+
* update instead of a full rebuild).
|
|
505
|
+
*/
|
|
506
|
+
private _buildSessionEntryIdLookup;
|
|
507
|
+
/**
|
|
508
|
+
* Phase 1 observe-only audit pass (see context/context-audit.ts): converts live
|
|
509
|
+
* toolResult messages into ContextItems and runs the existing retention/hard-constraint
|
|
510
|
+
* evaluators over them, storing the latest deterministic report for tests/debugging.
|
|
511
|
+
* Read-only with respect to messages, the transcript, and artifact references -- uses
|
|
512
|
+
* `_toolArtifactStore` (the field), not `_getToolArtifactStore()` (the getter), so a
|
|
513
|
+
* session that never packed anything doesn't force-create a store/dir just to audit.
|
|
514
|
+
* Never throws into a live turn: any failure degrades to an empty report.
|
|
515
|
+
*/
|
|
516
|
+
private _runContextAudit;
|
|
517
|
+
/**
|
|
518
|
+
* Read-only inspection of the context audit. With `messages`, recomputes fresh against
|
|
519
|
+
* the given array (still no mutation of messages/transcript/artifact refs); without,
|
|
520
|
+
* returns the last report computed during a real transform pass.
|
|
521
|
+
*/
|
|
522
|
+
getContextAuditReport(messages?: AgentMessage[]): ContextAuditReport;
|
|
523
|
+
/**
|
|
524
|
+
* Observe-first shadow/planning pass (see context/context-prompt-policy.ts): re-shapes
|
|
525
|
+
* the audit report into a per-item policy plan whose `appliedAction` is always
|
|
526
|
+
* "keep_raw" -- this never enforces anything, it only records what the policy engine
|
|
527
|
+
* would say. Never throws into a live turn: any failure degrades to an empty report.
|
|
528
|
+
*/
|
|
529
|
+
private _runPromptPolicyPlanning;
|
|
530
|
+
/**
|
|
531
|
+
* Read-only inspection of the shadow policy plan. With `messages`, recomputes fresh
|
|
532
|
+
* (audit + plan) against the given array; without, returns the last plan computed
|
|
533
|
+
* during a real transform pass. Never mutates messages/transcript/artifact refs.
|
|
534
|
+
*/
|
|
535
|
+
getPromptPolicyReport(messages?: AgentMessage[]): PromptPolicyShadowReport;
|
|
536
|
+
/**
|
|
537
|
+
* Report-only correlation between the shadow plan just computed this turn and what the
|
|
538
|
+
* legacy context-gc pass actually packed. Runs after `_applyContextGc()` has already
|
|
539
|
+
* produced its report; never influences context-gc itself. Never throws into a live
|
|
540
|
+
* turn: any failure degrades to an empty correlation.
|
|
541
|
+
*/
|
|
542
|
+
private _correlatePromptPolicyWithContextGc;
|
|
543
|
+
/** Read-only inspection of the latest shadow-plan/legacy-gc correlation, for tests/debugging. */
|
|
544
|
+
getPromptPolicyGcCorrelation(): PromptPolicyGcCorrelationReport;
|
|
545
|
+
/**
|
|
546
|
+
* First enforcement pilot (see context/context-prompt-enforcement.ts): opt-in,
|
|
547
|
+
* default-disabled stub-in-place of stale artifact-backed tool_output results in the
|
|
548
|
+
* provider-visible message array only. Runs on `messages` AFTER context-gc has already
|
|
549
|
+
* produced its own result, so legacy context-gc's own packing/reporting is completely
|
|
550
|
+
* unaffected by this pass -- it only ever acts on messages gc left untouched this turn.
|
|
551
|
+
* Never throws into a live turn: any failure degrades to returning `messages` unchanged.
|
|
552
|
+
*/
|
|
553
|
+
private _runPromptEnforcement;
|
|
554
|
+
/** Read-only inspection of the latest prompt-enforcement report, for tests/debugging. */
|
|
555
|
+
getPromptEnforcementReport(): PromptEnforcementReport;
|
|
556
|
+
private _runMemoryRetrieval;
|
|
557
|
+
/** Read-only inspection of the latest memory-retrieval report, for tests/debugging. */
|
|
558
|
+
getMemoryRetrievalReport(): MemoryRetrievalReport;
|
|
559
|
+
/**
|
|
560
|
+
* Bounded prompt-surfacing pilot for local memory evidence (see
|
|
561
|
+
* context/memory-prompt-block.ts): opt-in, default disabled, and gated on TWO settings
|
|
562
|
+
* (`enabled` AND `includeInPrompt`) plus a non-empty `report.contextItems` -- the first
|
|
563
|
+
* two are belt-and-suspenders on top of the fact that `_runMemoryRetrieval` already
|
|
564
|
+
* leaves `contextItems` empty whenever `enabled` is false, regardless of
|
|
565
|
+
* `includeInPrompt`. Reuses the `report` this pass's `_runMemoryRetrieval` call already
|
|
566
|
+
* computed -- never re-queries the provider here.
|
|
567
|
+
*
|
|
568
|
+
* Appends exactly one ephemeral `custom`/"memory_evidence" message wrapped by
|
|
569
|
+
* `wrapUntrustedText` (the same nonce-fenced boundary + always-on system-prompt rule
|
|
570
|
+
* used for other untrusted content) to the END of `messages`. This is purely additive
|
|
571
|
+
* (never mutates an existing message) and purely transient: `messages` here is the
|
|
572
|
+
* array about to be sent to the provider, not `this.agent.state.messages` or anything
|
|
573
|
+
* persisted via `sessionManager` -- so the injected message can never reach the
|
|
574
|
+
* transcript, regardless of how many times this pass runs.
|
|
575
|
+
*
|
|
576
|
+
* Also records a `MemoryPromptInclusionReport` (context/memory-diagnostics.ts) at each
|
|
577
|
+
* branch below, for context_audit's diagnostic surface only -- this is pure bookkeeping
|
|
578
|
+
* alongside the existing branches, not a new branch/condition: the messages returned
|
|
579
|
+
* are unchanged by this recording.
|
|
580
|
+
*/
|
|
581
|
+
private _maybeAppendMemoryEvidenceBlock;
|
|
582
|
+
/** Read-only inspection of the latest memory-prompt-inclusion decision, for tests/debugging and context_audit. */
|
|
583
|
+
getMemoryPromptInclusionReport(): MemoryPromptInclusionReport;
|
|
584
|
+
/**
|
|
585
|
+
* Combines the already-stored, no-arg latest reports (never re-queries the provider or
|
|
586
|
+
* touches the OKF directory) into the safe, allow-list-projected shape context_audit
|
|
587
|
+
* exposes. See context/memory-diagnostics.ts for why this projection is allow-list
|
|
588
|
+
* based rather than a spread-then-delete of the raw report.
|
|
589
|
+
*/
|
|
590
|
+
private _getMemoryAuditDiagnostics;
|
|
376
591
|
private _applyContextGc;
|
|
592
|
+
/**
|
|
593
|
+
* Reference-release + cleanup lifecycle: once context-gc has packed a grep/find tool
|
|
594
|
+
* result out of the live prompt (the message is no longer current/active working
|
|
595
|
+
* context -- see contracts-and-retention.md's "ephemeral"/"expired" retention
|
|
596
|
+
* classes), release the pack-time reference `packToolOutput()` registered for it, and
|
|
597
|
+
* opportunistically reclaim now-unreferenced artifacts. This is the other half of the
|
|
598
|
+
* D2b-1 gate: artifacts were being registered but never released, so they accumulated
|
|
599
|
+
* for the life of the session.
|
|
600
|
+
*
|
|
601
|
+
* `record.toolCallId` (from context-gc's packed record) is exactly the holder id
|
|
602
|
+
* `packToolOutput()` used when it called `addReference()` -- both trace back to the
|
|
603
|
+
* same tool call's id -- so no separate bookkeeping is needed to find it.
|
|
604
|
+
*/
|
|
605
|
+
private _releaseGcPackedArtifactReferences;
|
|
377
606
|
getContextGcReport(messages?: AgentMessage[]): ContextGcReport;
|
|
378
607
|
private _estimateCurrentContextTokens;
|
|
379
608
|
private _installAgentToolHooks;
|
|
@@ -449,6 +678,16 @@ export declare class AgentSession {
|
|
|
449
678
|
* Only tools in the registry can be enabled. Unknown tool names are ignored.
|
|
450
679
|
* Also rebuilds the system prompt to reflect the new tool set.
|
|
451
680
|
* Changes take effect on the next agent turn.
|
|
681
|
+
*
|
|
682
|
+
* artifact_retrieve is auto-activated as a companion whenever grep or find ends up
|
|
683
|
+
* in the resulting active set and artifact_retrieve is registered (i.e. not excluded/
|
|
684
|
+
* blocked/outside an allowlist -- the registry itself is built with that same filter,
|
|
685
|
+
* so registry presence already tracks "allowed"). This is enforced here, not just in
|
|
686
|
+
* the settings/profile refresh flow, because this method is a public, extension-
|
|
687
|
+
* exposed activation path (`setActiveTools`) on its own: without this, grep/find could
|
|
688
|
+
* end up active while still being handed an artifact store (gated on "allowed" in
|
|
689
|
+
* `_buildRuntime`) with no active tool able to resolve the resulting
|
|
690
|
+
* "Full output: artifact tool-output:<id>" handle.
|
|
452
691
|
*/
|
|
453
692
|
setActiveToolsByName(toolNames: string[]): void;
|
|
454
693
|
/** Whether compaction or branch summarization is currently running */
|
|
@@ -488,7 +727,11 @@ export declare class AgentSession {
|
|
|
488
727
|
private _buildAutonomyPrompt;
|
|
489
728
|
private _rebuildSystemPrompt;
|
|
490
729
|
private _runAgentPrompt;
|
|
730
|
+
private _isModelAvailableAndAuthed;
|
|
731
|
+
private _resolveModelRouterTurnRoute;
|
|
491
732
|
private _resolveModelRouterModelForIntent;
|
|
733
|
+
private _resolveConfiguredTierModel;
|
|
734
|
+
private _resolveModelRouterTurnRouteJudged;
|
|
492
735
|
private _resolveModelRouterTurnModel;
|
|
493
736
|
getModelRouterStatus(formatLabel?: (label: string) => string): string;
|
|
494
737
|
private _runAgentPromptWithModelRouter;
|
|
@@ -863,6 +1106,118 @@ export declare class AgentSession {
|
|
|
863
1106
|
getSpawnedUsage(): SpawnedUsageTotals;
|
|
864
1107
|
getDailyUsageTotals(now?: Date): DailyUsageTotals;
|
|
865
1108
|
getDailyUsageBreakdown(formatLabel?: (label: string) => string, now?: Date): string;
|
|
1109
|
+
/**
|
|
1110
|
+
* Save a snapshot of the goal state to the session log.
|
|
1111
|
+
*
|
|
1112
|
+
* @returns the id of the appended custom entry
|
|
1113
|
+
*/
|
|
1114
|
+
saveGoalStateSnapshot(state: GoalState): string;
|
|
1115
|
+
/**
|
|
1116
|
+
* Retrieve the latest valid goal state snapshot from the session log.
|
|
1117
|
+
*/
|
|
1118
|
+
getGoalStateSnapshot(): GoalState | undefined;
|
|
1119
|
+
/**
|
|
1120
|
+
* Save a snapshot of the evidence bundle to the session log.
|
|
1121
|
+
*
|
|
1122
|
+
* @returns the id of the appended custom entry
|
|
1123
|
+
*/
|
|
1124
|
+
saveEvidenceBundleSnapshot(bundle: EvidenceBundle): string;
|
|
1125
|
+
/**
|
|
1126
|
+
* Retrieve the latest valid evidence bundle snapshot from the session log.
|
|
1127
|
+
*/
|
|
1128
|
+
getEvidenceBundleSnapshot(): EvidenceBundle | undefined;
|
|
1129
|
+
getEvidenceBundleSnapshots(): EvidenceBundle[];
|
|
1130
|
+
/** Live lane records tracked by this process (running and terminal). */
|
|
1131
|
+
getLaneRecords(): LaneRecord[];
|
|
1132
|
+
saveWorkerResultSnapshot(result: WorkerResult): string;
|
|
1133
|
+
getWorkerResultSnapshots(): WorkerResult[];
|
|
1134
|
+
saveLearningDecisionSnapshot(decision: LearningDecision): string;
|
|
1135
|
+
getLearningDecisionSnapshots(): LearningDecision[];
|
|
1136
|
+
getGoalRuntimeSnapshot(settings: GoalRuntimeSnapshotSettings): GoalRuntimeSnapshot;
|
|
1137
|
+
private _clearGoalAutoContinueTimer;
|
|
1138
|
+
private _scheduleGoalAutoContinueFromIdle;
|
|
1139
|
+
private _runScheduledGoalAutoContinue;
|
|
1140
|
+
private _clearResearchLaneTimer;
|
|
1141
|
+
/**
|
|
1142
|
+
* Derive the research demand from durable goal state: an active goal with open requirements,
|
|
1143
|
+
* deduplicated against the latest persisted bundle so the same requirement set is never
|
|
1144
|
+
* researched twice (the query is deterministic, so dedupe survives session reload).
|
|
1145
|
+
*/
|
|
1146
|
+
private _buildResearchLaneDemand;
|
|
1147
|
+
/**
|
|
1148
|
+
* Idle trigger for the autonomous research lane (mirrors {@link _scheduleGoalAutoContinueFromIdle}).
|
|
1149
|
+
* All skips are recorded in `_lastResearchLaneSkipReason` and surfaced via diagnostics — the lane
|
|
1150
|
+
* informs, it never prompts or blocks the foreground.
|
|
1151
|
+
*/
|
|
1152
|
+
private _scheduleResearchLaneFromIdle;
|
|
1153
|
+
private _runScheduledResearchLane;
|
|
1154
|
+
/**
|
|
1155
|
+
* Capability profile derived from the CURRENT session model's own metadata (context window),
|
|
1156
|
+
* honoring the modelCapability.mode setting ("off" disables, a class name forces).
|
|
1157
|
+
*/
|
|
1158
|
+
getModelCapabilityProfile(): ModelCapabilityProfile;
|
|
1159
|
+
/** Capability profile for a specific lane model (lane budgets scale to the lane model's window). */
|
|
1160
|
+
private _laneCapabilityProfile;
|
|
1161
|
+
/**
|
|
1162
|
+
* Resolve the model for a background lane. Lanes are shipped BY this session, so they inherit
|
|
1163
|
+
* the session's own model unless a lane-specific model is explicitly configured — a single-model
|
|
1164
|
+
* setup (e.g. one local open model) runs its lanes on that same model. An explicitly configured
|
|
1165
|
+
* pattern that cannot resolve/authenticate is a visible skip, not a silent fallback.
|
|
1166
|
+
*/
|
|
1167
|
+
private _resolveLaneModel;
|
|
1168
|
+
/**
|
|
1169
|
+
* Resolve what a lane ships with. Precedence: explicit lane model setting, then the lane
|
|
1170
|
+
* profile's model (a shipped profile with a model MUST be obeyed — unresolvable is a visible
|
|
1171
|
+
* skip, never a fallback), then generic inheritance of the session model.
|
|
1172
|
+
*/
|
|
1173
|
+
private _resolveLaneShipment;
|
|
1174
|
+
/** UAC tool grants from a shipped lane profile, recorded on the lane envelope. */
|
|
1175
|
+
private _laneProfileToolGrants;
|
|
1176
|
+
/** Stripped research envelope — never the foreground/architect envelope. */
|
|
1177
|
+
private _buildResearchLaneEnvelope;
|
|
1178
|
+
/**
|
|
1179
|
+
* Run one bounded, read-only research pass and persist its results: evidence bundle snapshot,
|
|
1180
|
+
* terminal lane record, and spawned-usage cost report (single-hop invariant, idempotent on the
|
|
1181
|
+
* lane's reportId). Explicit calls (e.g. `/autonomy research`) express user intent and bypass the
|
|
1182
|
+
* enabled/mode/dedupe gates the idle scheduler enforces; budget and capability gates always apply.
|
|
1183
|
+
*/
|
|
1184
|
+
runResearchLaneOnce(request?: {
|
|
1185
|
+
query?: string;
|
|
1186
|
+
context?: string;
|
|
1187
|
+
goalId?: string;
|
|
1188
|
+
}): Promise<ResearchLaneRunOutcome>;
|
|
1189
|
+
/**
|
|
1190
|
+
* Run one bounded scout-worker delegation: build a WorkerRequest with a stripped read-only
|
|
1191
|
+
* envelope, execute it as an isolated completion on a cheap lane, validate the result via
|
|
1192
|
+
* {@link validateWorkerResult} before acceptance, and persist result + lane record + spawned
|
|
1193
|
+
* usage (idempotent per-lane reportId). Consumed by the `delegate` tool.
|
|
1194
|
+
*/
|
|
1195
|
+
runWorkerDelegationOnce(request: {
|
|
1196
|
+
instructions: string;
|
|
1197
|
+
/** Model-provided replacement for the worker role prompt (the level-0 core always remains). */
|
|
1198
|
+
systemPrompt?: string;
|
|
1199
|
+
}): Promise<WorkerDelegationRunOutcome>;
|
|
1200
|
+
/**
|
|
1201
|
+
* Probe a candidate model against the subagent contracts (research/worker/judge/search/
|
|
1202
|
+
* tool-call surfaces) via {@link runModelFitnessProbe}. The model must resolve and
|
|
1203
|
+
* authenticate; every probe call runs as an isolated completion on that model, and probe
|
|
1204
|
+
* spend is reported through spawned-usage accounting.
|
|
1205
|
+
*/
|
|
1206
|
+
runModelFitness(args: {
|
|
1207
|
+
model: string;
|
|
1208
|
+
trials?: number;
|
|
1209
|
+
}): Promise<{
|
|
1210
|
+
started: true;
|
|
1211
|
+
model: string;
|
|
1212
|
+
report: ModelFitnessReport;
|
|
1213
|
+
} | {
|
|
1214
|
+
started: false;
|
|
1215
|
+
skipReason: string;
|
|
1216
|
+
}>;
|
|
1217
|
+
/** Fitness reports persisted for THIS host (measured evidence for architect/profile decisions). */
|
|
1218
|
+
getStoredFitnessReports(): StoredFitnessReport[];
|
|
1219
|
+
continueGoalOnce(options: GoalContinuationOnceOptions): Promise<GoalContinuationOnceResult>;
|
|
1220
|
+
continueGoalLoop(options: GoalContinuationLoopOptions): Promise<GoalContinuationLoopResult>;
|
|
866
1221
|
/**
|
|
867
1222
|
* Run a one-shot LLM completion fully ISOLATED from the main session — the load-bearing
|
|
868
1223
|
* primitive for the native reflection engine (adaptive-agent design §6c/§7).
|
|
@@ -894,6 +1249,17 @@ export declare class AgentSession {
|
|
|
894
1249
|
/** Stable id so a duplicate scheduling/retry of the same pass can't double-count its cost. */
|
|
895
1250
|
reportId?: string;
|
|
896
1251
|
}): Promise<ReflectionResult | null>;
|
|
1252
|
+
getLearningAuditRecords(): LearningAuditRecord[];
|
|
1253
|
+
/**
|
|
1254
|
+
* Roll back one applied durable learning change by executing the inverse operation recorded in
|
|
1255
|
+
* its audit record (memory ops run through the same bundled memory-tool path as the original
|
|
1256
|
+
* apply; promoted skills are archived). Appends a linked "rollback" audit record on success so
|
|
1257
|
+
* the change history stays complete and a change cannot be rolled back twice.
|
|
1258
|
+
*/
|
|
1259
|
+
rollbackLearningWrite(auditId: string): Promise<{
|
|
1260
|
+
ok: boolean;
|
|
1261
|
+
reason: string;
|
|
1262
|
+
}>;
|
|
897
1263
|
private _applyReflectionWrite;
|
|
898
1264
|
/**
|
|
899
1265
|
* R7: write a reflection-promoted skill as `<agentDir>/skills/<name>/SKILL.md` so it loads like any
|
|
@@ -920,6 +1286,16 @@ export declare class AgentSession {
|
|
|
920
1286
|
* @returns Text content, or undefined if no assistant message exists
|
|
921
1287
|
*/
|
|
922
1288
|
getLastAssistantText(): string | undefined;
|
|
1289
|
+
getAutonomyStatusSnapshot(): AutonomyStatusSnapshot;
|
|
1290
|
+
/**
|
|
1291
|
+
* Aggregate an effectiveness/autonomy dashboard: what Pi has actually been doing (recent
|
|
1292
|
+
* route choices, latest gate outcome, cost, and any research/delegation/learning/goal
|
|
1293
|
+
* activity). Read-only — combines existing session-log getters, never mutates state or
|
|
1294
|
+
* recomputes a route/gate decision.
|
|
1295
|
+
*/
|
|
1296
|
+
getAutonomyDiagnosticSnapshot(options?: {
|
|
1297
|
+
maxEntriesPerFamily?: number;
|
|
1298
|
+
}): AutonomyDiagnosticSnapshot;
|
|
923
1299
|
createReplacedSessionContext(): ReplacedSessionContext;
|
|
924
1300
|
/**
|
|
925
1301
|
* Check if extensions have handlers for a specific event type.
|