@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
|
@@ -14,7 +14,10 @@ import lockfile from "proper-lockfile";
|
|
|
14
14
|
import { APP_NAME, APP_TITLE, getAgentDir, getAuthPath, getDebugLogPath, getDocsPath, getShareViewerUrl, VERSION, } from "../../config.js";
|
|
15
15
|
import { parseSkillBlock } from "../../core/agent-session.js";
|
|
16
16
|
import { SessionImportFileNotFoundError } from "../../core/agent-session-runtime.js";
|
|
17
|
+
import { formatAutonomyDiagnostics } from "../../core/autonomy/status.js";
|
|
18
|
+
import { readAutoLearnSessionIdFromFile, reportCompletedAutoLearnUsageHelper } from "../../core/cost/session-usage.js";
|
|
17
19
|
import { FooterDataProvider } from "../../core/footer-data-provider.js";
|
|
20
|
+
import { DEFAULT_GOAL_CONTINUE_MAX_STALL_TURNS, DEFAULT_GOAL_CONTINUE_MAX_TURNS, DEFAULT_GOAL_CONTINUE_MAX_WALL_CLOCK_MINUTES, MAX_GOAL_CONTINUE_MAX_STALL_TURNS, MAX_GOAL_CONTINUE_MAX_TURNS, MAX_GOAL_CONTINUE_MAX_WALL_CLOCK_MINUTES, } from "../../core/goals/goal-continuation-defaults.js";
|
|
18
21
|
import { configureHttpDispatcher, formatHttpIdleTimeoutMs } from "../../core/http-dispatcher.js";
|
|
19
22
|
import { KeybindingsManager } from "../../core/keybindings.js";
|
|
20
23
|
import { createCompactionSummaryMessage } from "../../core/messages.js";
|
|
@@ -22,6 +25,7 @@ import { cliProviderAliases, defaultModelPerProvider, findExactModelReferenceMat
|
|
|
22
25
|
import { DefaultPackageManager } from "../../core/package-manager.js";
|
|
23
26
|
import { BUILT_IN_PROVIDER_DISPLAY_NAMES } from "../../core/provider-display-names.js";
|
|
24
27
|
import { getPendingReloadBlockers } from "../../core/reload-blockers.js";
|
|
28
|
+
import { formatModelFitnessReport } from "../../core/research/model-fitness.js";
|
|
25
29
|
import { resourceProfileSettingsChangedKinds } from "../../core/resource-profile-equality.js";
|
|
26
30
|
import { formatMissingSessionCwdPrompt, MissingSessionCwdError } from "../../core/session-cwd.js";
|
|
27
31
|
import { isAutoLearnSessionId, SessionManager } from "../../core/session-manager.js";
|
|
@@ -55,6 +59,7 @@ import { EarendilAnnouncementComponent } from "./components/earendil-announcemen
|
|
|
55
59
|
import { ExtensionEditorComponent } from "./components/extension-editor.js";
|
|
56
60
|
import { ExtensionInputComponent } from "./components/extension-input.js";
|
|
57
61
|
import { ExtensionSelectorComponent } from "./components/extension-selector.js";
|
|
62
|
+
import { FitnessRoleSelectorComponent } from "./components/fitness-role-selector.js";
|
|
58
63
|
import { FooterComponent } from "./components/footer.js";
|
|
59
64
|
import { formatKeyText, keyDisplayText, keyHint, keyText, rawKeyHint } from "./components/keybinding-hints.js";
|
|
60
65
|
import { LoginDialogComponent } from "./components/login-dialog.js";
|
|
@@ -214,32 +219,6 @@ function removeAutoLearnArtifactPath(filePath, root) {
|
|
|
214
219
|
return false;
|
|
215
220
|
}
|
|
216
221
|
}
|
|
217
|
-
function readAutoLearnSessionIdFromFile(filePath) {
|
|
218
|
-
let fd;
|
|
219
|
-
try {
|
|
220
|
-
fd = fs.openSync(filePath, "r");
|
|
221
|
-
const buffer = Buffer.alloc(64 * 1024);
|
|
222
|
-
const bytesRead = fs.readSync(fd, buffer, 0, buffer.length, 0);
|
|
223
|
-
const firstLine = buffer.toString("utf8", 0, bytesRead).split("\n", 1)[0]?.trim();
|
|
224
|
-
if (!firstLine)
|
|
225
|
-
return undefined;
|
|
226
|
-
const header = JSON.parse(firstLine);
|
|
227
|
-
return header.type === "session" && typeof header.id === "string" ? header.id : undefined;
|
|
228
|
-
}
|
|
229
|
-
catch {
|
|
230
|
-
return undefined;
|
|
231
|
-
}
|
|
232
|
-
finally {
|
|
233
|
-
if (fd !== undefined) {
|
|
234
|
-
try {
|
|
235
|
-
fs.closeSync(fd);
|
|
236
|
-
}
|
|
237
|
-
catch {
|
|
238
|
-
// Ignore close errors while pruning best-effort history artifacts.
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
222
|
function getAutoLearnSessionIdFromFileName(fileName) {
|
|
244
223
|
return fileName.match(/_(auto-learn-[A-Za-z0-9._-]+)\.jsonl$/)?.[1];
|
|
245
224
|
}
|
|
@@ -872,6 +851,9 @@ export class InteractiveMode {
|
|
|
872
851
|
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
873
852
|
this.showError(errorMessage);
|
|
874
853
|
}
|
|
854
|
+
finally {
|
|
855
|
+
this.refreshAutonomyFooterStatus();
|
|
856
|
+
}
|
|
875
857
|
}
|
|
876
858
|
if (initialMessages) {
|
|
877
859
|
for (const message of initialMessages) {
|
|
@@ -882,6 +864,9 @@ export class InteractiveMode {
|
|
|
882
864
|
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
883
865
|
this.showError(errorMessage);
|
|
884
866
|
}
|
|
867
|
+
finally {
|
|
868
|
+
this.refreshAutonomyFooterStatus();
|
|
869
|
+
}
|
|
885
870
|
}
|
|
886
871
|
}
|
|
887
872
|
// Main interactive loop
|
|
@@ -894,8 +879,15 @@ export class InteractiveMode {
|
|
|
894
879
|
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
895
880
|
this.showError(errorMessage);
|
|
896
881
|
}
|
|
882
|
+
finally {
|
|
883
|
+
this.refreshAutonomyFooterStatus();
|
|
884
|
+
}
|
|
897
885
|
}
|
|
898
886
|
}
|
|
887
|
+
refreshAutonomyFooterStatus() {
|
|
888
|
+
this.footerDataProvider.setAutonomyStatusSnapshot(this.session.getAutonomyStatusSnapshot());
|
|
889
|
+
this.footer.invalidate();
|
|
890
|
+
}
|
|
899
891
|
async checkForPackageUpdates() {
|
|
900
892
|
if (process.env.PI_OFFLINE) {
|
|
901
893
|
return [];
|
|
@@ -2443,11 +2435,16 @@ export class InteractiveMode {
|
|
|
2443
2435
|
const images = this.takeClipboardImagesForText(text);
|
|
2444
2436
|
this.editor.addToHistory?.(text);
|
|
2445
2437
|
this.editor.setText("");
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2438
|
+
try {
|
|
2439
|
+
await this.session.prompt(text, {
|
|
2440
|
+
streamingBehavior: queueAsFollowUp ? "followUp" : "steer",
|
|
2441
|
+
images,
|
|
2442
|
+
processSlashCommands: false,
|
|
2443
|
+
});
|
|
2444
|
+
}
|
|
2445
|
+
finally {
|
|
2446
|
+
this.refreshAutonomyFooterStatus();
|
|
2447
|
+
}
|
|
2451
2448
|
this.updatePendingMessagesDisplay();
|
|
2452
2449
|
this.ui.requestRender();
|
|
2453
2450
|
return;
|
|
@@ -2468,6 +2465,24 @@ export class InteractiveMode {
|
|
|
2468
2465
|
this.editor.setText("");
|
|
2469
2466
|
return;
|
|
2470
2467
|
}
|
|
2468
|
+
if (text === "/fitness" || text.startsWith("/fitness ")) {
|
|
2469
|
+
const fitnessArgs = text.slice("/fitness".length).trim();
|
|
2470
|
+
this.editor.setText("");
|
|
2471
|
+
if (fitnessArgs.length === 0) {
|
|
2472
|
+
// No args: open the model picker, probe the selection, then offer role assignment.
|
|
2473
|
+
this.showFitnessModelSelector();
|
|
2474
|
+
}
|
|
2475
|
+
else {
|
|
2476
|
+
// Explicit ref: same handler as /autonomy fitness.
|
|
2477
|
+
this.handleAutonomyCommand(`/autonomy fitness ${fitnessArgs}`);
|
|
2478
|
+
}
|
|
2479
|
+
return;
|
|
2480
|
+
}
|
|
2481
|
+
if (text === "/context") {
|
|
2482
|
+
this.showStatus(this.session.formatContextCompositionDashboard());
|
|
2483
|
+
this.editor.setText("");
|
|
2484
|
+
return;
|
|
2485
|
+
}
|
|
2471
2486
|
if (text === "/scoped-models") {
|
|
2472
2487
|
this.editor.setText("");
|
|
2473
2488
|
await this.showModelsSelector();
|
|
@@ -2520,6 +2535,11 @@ export class InteractiveMode {
|
|
|
2520
2535
|
this.editor.setText("");
|
|
2521
2536
|
return;
|
|
2522
2537
|
}
|
|
2538
|
+
if (text === "/goal-continue" || text.startsWith("/goal-continue ")) {
|
|
2539
|
+
await this.handleGoalContinueCommand(text);
|
|
2540
|
+
this.editor.setText("");
|
|
2541
|
+
return;
|
|
2542
|
+
}
|
|
2523
2543
|
if (text === "/changelog") {
|
|
2524
2544
|
this.handleChangelogCommand();
|
|
2525
2545
|
this.editor.setText("");
|
|
@@ -3610,7 +3630,12 @@ export class InteractiveMode {
|
|
|
3610
3630
|
if (this.isExtensionCommand(text)) {
|
|
3611
3631
|
this.editor.addToHistory?.(text);
|
|
3612
3632
|
this.editor.setText("");
|
|
3613
|
-
|
|
3633
|
+
try {
|
|
3634
|
+
await this.session.prompt(text);
|
|
3635
|
+
}
|
|
3636
|
+
finally {
|
|
3637
|
+
this.refreshAutonomyFooterStatus();
|
|
3638
|
+
}
|
|
3614
3639
|
}
|
|
3615
3640
|
else {
|
|
3616
3641
|
const images = this.takeClipboardImagesForText(text);
|
|
@@ -3624,7 +3649,12 @@ export class InteractiveMode {
|
|
|
3624
3649
|
const images = this.takeClipboardImagesForText(text);
|
|
3625
3650
|
this.editor.addToHistory?.(text);
|
|
3626
3651
|
this.editor.setText("");
|
|
3627
|
-
|
|
3652
|
+
try {
|
|
3653
|
+
await this.session.prompt(text, { streamingBehavior: "followUp", images });
|
|
3654
|
+
}
|
|
3655
|
+
finally {
|
|
3656
|
+
this.refreshAutonomyFooterStatus();
|
|
3657
|
+
}
|
|
3628
3658
|
this.updatePendingMessagesDisplay();
|
|
3629
3659
|
this.ui.requestRender();
|
|
3630
3660
|
}
|
|
@@ -3996,8 +4026,13 @@ export class InteractiveMode {
|
|
|
3996
4026
|
const promptOptions = this.session.isStreaming
|
|
3997
4027
|
? { images: firstPrompt.images, streamingBehavior: firstPrompt.mode }
|
|
3998
4028
|
: { images: firstPrompt.images };
|
|
3999
|
-
const promptPromise = this.session
|
|
4029
|
+
const promptPromise = this.session
|
|
4030
|
+
.prompt(firstPrompt.text, promptOptions)
|
|
4031
|
+
.catch((error) => {
|
|
4000
4032
|
restoreQueue(error);
|
|
4033
|
+
})
|
|
4034
|
+
.finally(() => {
|
|
4035
|
+
this.refreshAutonomyFooterStatus();
|
|
4001
4036
|
});
|
|
4002
4037
|
// Queue remaining messages
|
|
4003
4038
|
for (const message of rest) {
|
|
@@ -4534,9 +4569,26 @@ export class InteractiveMode {
|
|
|
4534
4569
|
return { result: undefined, next };
|
|
4535
4570
|
});
|
|
4536
4571
|
}
|
|
4537
|
-
|
|
4572
|
+
reportCompletedAutoLearnUsage(runId, sessionDir, sessionId, logPath) {
|
|
4573
|
+
try {
|
|
4574
|
+
reportCompletedAutoLearnUsageHelper({
|
|
4575
|
+
runId,
|
|
4576
|
+
sessionDir,
|
|
4577
|
+
sessionId,
|
|
4578
|
+
logPath,
|
|
4579
|
+
parentSession: this.session,
|
|
4580
|
+
appendLog: (p, msg) => this.appendAutoLearnLog(p, msg),
|
|
4581
|
+
});
|
|
4582
|
+
}
|
|
4583
|
+
catch (error) {
|
|
4584
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
4585
|
+
this.appendAutoLearnLog(logPath, `Auto Learn usage report failed: ${message}`);
|
|
4586
|
+
}
|
|
4587
|
+
}
|
|
4588
|
+
cleanupCompletedAutoLearnRun(runId, options) {
|
|
4589
|
+
this.reportCompletedAutoLearnUsage(runId, options.sessionDir, options.sessionId, options.logPath);
|
|
4538
4590
|
const dataDir = this.getAutoLearnDataDir();
|
|
4539
|
-
for (const filePath of artifactPaths)
|
|
4591
|
+
for (const filePath of options.artifactPaths)
|
|
4540
4592
|
removeAutoLearnArtifactPath(filePath, dataDir);
|
|
4541
4593
|
this.withAutoLearnStateLock((current) => {
|
|
4542
4594
|
const state = this.pruneAutoLearnState(current);
|
|
@@ -4681,8 +4733,14 @@ export class InteractiveMode {
|
|
|
4681
4733
|
}
|
|
4682
4734
|
const childPid = child.pid;
|
|
4683
4735
|
child.once("exit", (code) => {
|
|
4684
|
-
if (code === 0)
|
|
4685
|
-
this.cleanupCompletedAutoLearnRun(reservation.runId,
|
|
4736
|
+
if (code === 0) {
|
|
4737
|
+
this.cleanupCompletedAutoLearnRun(reservation.runId, {
|
|
4738
|
+
artifactPaths: [promptPath, logPath, sessionDir],
|
|
4739
|
+
sessionDir,
|
|
4740
|
+
sessionId,
|
|
4741
|
+
logPath,
|
|
4742
|
+
});
|
|
4743
|
+
}
|
|
4686
4744
|
});
|
|
4687
4745
|
child.unref();
|
|
4688
4746
|
this.markAutoLearnReservationRunning(reservation, childPid, settings);
|
|
@@ -5071,6 +5129,72 @@ export class InteractiveMode {
|
|
|
5071
5129
|
this.settingsManager.setAutoLearnSettings(preset, scope);
|
|
5072
5130
|
this.updateAutoLearnFooter();
|
|
5073
5131
|
}
|
|
5132
|
+
/** /fitness with no args: pick a model from the configured registry, probe it, assign a role. */
|
|
5133
|
+
showFitnessModelSelector() {
|
|
5134
|
+
this.showSelector((done) => {
|
|
5135
|
+
const selector = new ModelSelectorComponent(this.ui, this.session.model, this.settingsManager, this.session.modelRegistry, this.session.scopedModels, async (model) => {
|
|
5136
|
+
done();
|
|
5137
|
+
await this.runFitnessAndAssign(`${model.provider}/${model.id}`);
|
|
5138
|
+
}, () => {
|
|
5139
|
+
done();
|
|
5140
|
+
this.ui.requestRender();
|
|
5141
|
+
});
|
|
5142
|
+
return { component: selector, focus: selector };
|
|
5143
|
+
});
|
|
5144
|
+
}
|
|
5145
|
+
/** Probe a model's fitness, show the report, then offer one-step role assignment. */
|
|
5146
|
+
async runFitnessAndAssign(modelRef) {
|
|
5147
|
+
this.showStatus(`Model fitness probe running on ${modelRef}… (6 surfaces; local models may take a few minutes)`);
|
|
5148
|
+
try {
|
|
5149
|
+
const outcome = await this.session.runModelFitness({ model: modelRef });
|
|
5150
|
+
if (!outcome.started) {
|
|
5151
|
+
this.showStatus(`Model fitness skipped: ${outcome.skipReason}`);
|
|
5152
|
+
return;
|
|
5153
|
+
}
|
|
5154
|
+
this.chatContainer.addChild(new Spacer(1));
|
|
5155
|
+
this.chatContainer.addChild(new Text(formatModelFitnessReport(outcome.model, outcome.report), 1, 0));
|
|
5156
|
+
this.ui.requestRender();
|
|
5157
|
+
this.showSelector((done) => {
|
|
5158
|
+
const selector = new FitnessRoleSelectorComponent(outcome.model, (role) => {
|
|
5159
|
+
done();
|
|
5160
|
+
this.assignFitnessRole(outcome.model, role);
|
|
5161
|
+
}, () => {
|
|
5162
|
+
done();
|
|
5163
|
+
this.ui.requestRender();
|
|
5164
|
+
});
|
|
5165
|
+
return { component: selector, focus: selector };
|
|
5166
|
+
});
|
|
5167
|
+
}
|
|
5168
|
+
catch (error) {
|
|
5169
|
+
this.showError(error instanceof Error ? error.message : String(error));
|
|
5170
|
+
}
|
|
5171
|
+
}
|
|
5172
|
+
/** Persist a role assignment from the post-probe selector into the matching settings. */
|
|
5173
|
+
assignFitnessRole(modelRef, role) {
|
|
5174
|
+
if (role === "none") {
|
|
5175
|
+
this.showStatus(`Fitness result for ${modelRef} saved. Assign a role later from /settings.`);
|
|
5176
|
+
return;
|
|
5177
|
+
}
|
|
5178
|
+
if (role === "curator") {
|
|
5179
|
+
const current = this.settingsManager.getContextCurationSettings();
|
|
5180
|
+
this.settingsManager.setContextCurationSettings({ ...current, enabled: true, model: modelRef });
|
|
5181
|
+
this.showStatus(`Context curation enabled with ${modelRef} as the curator.`);
|
|
5182
|
+
return;
|
|
5183
|
+
}
|
|
5184
|
+
const router = this.settingsManager.getModelRouterSettings();
|
|
5185
|
+
const field = role === "router-cheap"
|
|
5186
|
+
? "cheapModel"
|
|
5187
|
+
: role === "router-medium"
|
|
5188
|
+
? "mediumModel"
|
|
5189
|
+
: role === "router-expensive"
|
|
5190
|
+
? "expensiveModel"
|
|
5191
|
+
: role === "judge"
|
|
5192
|
+
? "judgeModel"
|
|
5193
|
+
: "learningModel";
|
|
5194
|
+
this.settingsManager.setModelRouterSettings({ ...router, [field]: modelRef });
|
|
5195
|
+
const hint = router.enabled ? "" : " Model router is currently disabled — enable it in /settings → Model Router.";
|
|
5196
|
+
this.showStatus(`${modelRef} set as ${role.replace("router-", "router ")} model.${hint}`);
|
|
5197
|
+
}
|
|
5074
5198
|
handleAutonomyCommand(text) {
|
|
5075
5199
|
const action = text.slice("/autonomy".length).trim() || "status";
|
|
5076
5200
|
if (AUTONOMY_MODES.includes(action)) {
|
|
@@ -5085,7 +5209,75 @@ export class InteractiveMode {
|
|
|
5085
5209
|
this.ui.requestRender();
|
|
5086
5210
|
return;
|
|
5087
5211
|
}
|
|
5088
|
-
|
|
5212
|
+
if (action === "diagnostics") {
|
|
5213
|
+
this.chatContainer.addChild(new Spacer(1));
|
|
5214
|
+
this.chatContainer.addChild(new Text(formatAutonomyDiagnostics(this.session.getAutonomyDiagnosticSnapshot()), 1, 0));
|
|
5215
|
+
this.ui.requestRender();
|
|
5216
|
+
return;
|
|
5217
|
+
}
|
|
5218
|
+
if (action.startsWith("rollback")) {
|
|
5219
|
+
const auditId = action.slice("rollback".length).trim();
|
|
5220
|
+
if (!auditId) {
|
|
5221
|
+
this.showStatus("Usage: /autonomy rollback <auditId> (see /autonomy diagnostics for audit ids)");
|
|
5222
|
+
return;
|
|
5223
|
+
}
|
|
5224
|
+
void this.session
|
|
5225
|
+
.rollbackLearningWrite(auditId)
|
|
5226
|
+
.then((result) => {
|
|
5227
|
+
this.showStatus(result.ok ? `Rolled back learning change ${auditId}.` : `Rollback skipped: ${result.reason}`);
|
|
5228
|
+
})
|
|
5229
|
+
.catch((error) => {
|
|
5230
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
5231
|
+
this.showStatus(`Rollback failed: ${message}`);
|
|
5232
|
+
});
|
|
5233
|
+
return;
|
|
5234
|
+
}
|
|
5235
|
+
if (action.startsWith("fitness")) {
|
|
5236
|
+
const rest = action.slice("fitness".length).trim().split(/\s+/).filter(Boolean);
|
|
5237
|
+
const modelPattern = rest[0];
|
|
5238
|
+
if (!modelPattern) {
|
|
5239
|
+
this.showStatus("Usage: /autonomy fitness <model-pattern> [trials]");
|
|
5240
|
+
return;
|
|
5241
|
+
}
|
|
5242
|
+
const trials = rest[1] ? Number(rest[1]) : undefined;
|
|
5243
|
+
this.showStatus(`Model fitness probe running on ${modelPattern}…`);
|
|
5244
|
+
void this.session
|
|
5245
|
+
.runModelFitness({ model: modelPattern, trials: Number.isFinite(trials) ? trials : undefined })
|
|
5246
|
+
.then((outcome) => {
|
|
5247
|
+
if (!outcome.started) {
|
|
5248
|
+
this.showStatus(`Model fitness skipped: ${outcome.skipReason}`);
|
|
5249
|
+
return;
|
|
5250
|
+
}
|
|
5251
|
+
this.chatContainer.addChild(new Spacer(1));
|
|
5252
|
+
this.chatContainer.addChild(new Text(formatModelFitnessReport(outcome.model, outcome.report), 1, 0));
|
|
5253
|
+
this.ui.requestRender();
|
|
5254
|
+
})
|
|
5255
|
+
.catch((error) => {
|
|
5256
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
5257
|
+
this.showStatus(`Model fitness failed: ${message}`);
|
|
5258
|
+
});
|
|
5259
|
+
return;
|
|
5260
|
+
}
|
|
5261
|
+
if (action === "research") {
|
|
5262
|
+
this.showStatus("Research lane: running…");
|
|
5263
|
+
void this.session
|
|
5264
|
+
.runResearchLaneOnce()
|
|
5265
|
+
.then((outcome) => {
|
|
5266
|
+
if (!outcome.started) {
|
|
5267
|
+
this.showStatus(`Research lane skipped: ${outcome.skipReason ?? "unknown"}`);
|
|
5268
|
+
return;
|
|
5269
|
+
}
|
|
5270
|
+
const status = outcome.record?.status ?? "unknown";
|
|
5271
|
+
const reason = outcome.record?.reasonCode ? ` (${outcome.record.reasonCode})` : "";
|
|
5272
|
+
this.showStatus(`Research lane ${status}${reason}`);
|
|
5273
|
+
})
|
|
5274
|
+
.catch((error) => {
|
|
5275
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
5276
|
+
this.showStatus(`Research lane failed: ${message}`);
|
|
5277
|
+
});
|
|
5278
|
+
return;
|
|
5279
|
+
}
|
|
5280
|
+
this.showStatus("Usage: /autonomy [status|diagnostics|research|rollback <auditId>|off|safe|balanced|full]");
|
|
5089
5281
|
}
|
|
5090
5282
|
handleAutoLearnCommand(text) {
|
|
5091
5283
|
const action = text.slice("/auto-learn".length).trim() || "status";
|
|
@@ -5153,11 +5345,21 @@ export class InteractiveMode {
|
|
|
5153
5345
|
selfModificationScope: projectSettings.selfModification ? "project" : "global",
|
|
5154
5346
|
autonomy: this.settingsManager.getAutonomySettings(),
|
|
5155
5347
|
autonomyScope: projectSettings.autonomy ? "project" : "global",
|
|
5348
|
+
researchLane: this.settingsManager.getResearchLaneSettings(),
|
|
5349
|
+
researchLaneScope: projectSettings.researchLane ? "project" : "global",
|
|
5350
|
+
workerDelegation: this.settingsManager.getWorkerDelegationSettings(),
|
|
5351
|
+
workerDelegationScope: projectSettings.workerDelegation ? "project" : "global",
|
|
5352
|
+
contextCuration: this.settingsManager.getContextCurationSettings(),
|
|
5353
|
+
contextCurationScope: projectSettings.contextPolicy?.curation ? "project" : "global",
|
|
5156
5354
|
modelRouter: this.settingsManager.getModelRouterSettings(),
|
|
5157
5355
|
modelRouterScope: projectSettings.modelRouter ? "project" : "global",
|
|
5158
5356
|
autoLearn: this.settingsManager.getAutoLearnSettings(),
|
|
5159
5357
|
autoLearnScope: projectSettings.autoLearn ? "project" : "global",
|
|
5160
5358
|
autoLearnModelOptions: this.getAutoLearnModelOptions(),
|
|
5359
|
+
contextPolicyEnforcement: this.settingsManager.getContextPromptEnforcementSettings(),
|
|
5360
|
+
contextPolicyEnforcementScope: projectSettings.contextPolicy?.enforcement ? "project" : "global",
|
|
5361
|
+
contextMemoryRetrieval: this.settingsManager.getMemoryRetrievalSettings(),
|
|
5362
|
+
contextMemoryRetrievalScope: projectSettings.contextPolicy?.memory ? "project" : "global",
|
|
5161
5363
|
currentModelPattern: this.session.model
|
|
5162
5364
|
? `${this.session.model.provider}/${this.session.model.id}`
|
|
5163
5365
|
: undefined,
|
|
@@ -5298,6 +5500,18 @@ export class InteractiveMode {
|
|
|
5298
5500
|
this.applyAutonomyMode(settings.mode ?? "off", scope);
|
|
5299
5501
|
this.showStatus(`Autonomy mode ${settings.mode ?? "off"} saved to ${scope}. Use /autonomy status.`);
|
|
5300
5502
|
},
|
|
5503
|
+
onResearchLaneChange: (settings, scope) => {
|
|
5504
|
+
this.settingsManager.setResearchLaneSettings(settings, scope);
|
|
5505
|
+
this.showStatus(`Research lane settings saved to ${scope}. Use /autonomy research or /autonomy diagnostics.`);
|
|
5506
|
+
},
|
|
5507
|
+
onWorkerDelegationChange: (settings, scope) => {
|
|
5508
|
+
this.settingsManager.setWorkerDelegationSettings(settings, scope);
|
|
5509
|
+
this.showStatus(`Worker delegation settings saved to ${scope}. The delegate tool uses them.`);
|
|
5510
|
+
},
|
|
5511
|
+
onContextCurationChange: (settings, scope) => {
|
|
5512
|
+
this.settingsManager.setContextCurationSettings(settings, scope);
|
|
5513
|
+
this.showStatus(`Context curation settings saved to ${scope}. Run /fitness <model> first if the model is unprobed.`);
|
|
5514
|
+
},
|
|
5301
5515
|
onModelRouterChange: (settings, scope) => {
|
|
5302
5516
|
this.settingsManager.setModelRouterSettings(settings, scope);
|
|
5303
5517
|
for (const value of [settings.cheapModel, settings.expensiveModel, settings.learningModel]) {
|
|
@@ -5318,6 +5532,14 @@ export class InteractiveMode {
|
|
|
5318
5532
|
this.updateAutoLearnFooter();
|
|
5319
5533
|
this.showStatus(`Auto Learn settings saved to ${scope}. Use /auto-learn status or /auto-learn run.`);
|
|
5320
5534
|
},
|
|
5535
|
+
onContextPolicyEnforcementChange: (settings, scope) => {
|
|
5536
|
+
this.settingsManager.setContextPromptEnforcementSettings(settings, scope);
|
|
5537
|
+
this.showStatus(`Context/prompt-policy settings saved to ${scope}.`);
|
|
5538
|
+
},
|
|
5539
|
+
onContextMemoryRetrievalChange: (settings, scope) => {
|
|
5540
|
+
this.settingsManager.setMemoryRetrievalSettings(settings, scope);
|
|
5541
|
+
this.showStatus(`Context/memory-retrieval settings saved to ${scope}.`);
|
|
5542
|
+
},
|
|
5321
5543
|
onResourcesHubAction: (action) => {
|
|
5322
5544
|
done();
|
|
5323
5545
|
void this.handleResourcesHubAction(action);
|
|
@@ -7290,6 +7512,53 @@ export class InteractiveMode {
|
|
|
7290
7512
|
this.chatContainer.addChild(new Text(theme.fg("dim", `Session name set: ${name}`), 1, 0));
|
|
7291
7513
|
this.ui.requestRender();
|
|
7292
7514
|
}
|
|
7515
|
+
parseGoalContinueCommand(text) {
|
|
7516
|
+
const usage = "Usage: /goal-continue [maxTurns 1-20] [maxStallTurns 0-100] [maxMinutes 0-1440]";
|
|
7517
|
+
const parts = text.trim().split(/\s+/).slice(1);
|
|
7518
|
+
if (parts.length > 3) {
|
|
7519
|
+
return { ok: false, error: usage };
|
|
7520
|
+
}
|
|
7521
|
+
const parseBoundedInteger = (value, fallback, min, max) => {
|
|
7522
|
+
if (value === undefined || value.length === 0)
|
|
7523
|
+
return fallback;
|
|
7524
|
+
if (!/^\d+$/.test(value))
|
|
7525
|
+
return undefined;
|
|
7526
|
+
const parsed = Number.parseInt(value, 10);
|
|
7527
|
+
if (!Number.isSafeInteger(parsed) || parsed < min || parsed > max)
|
|
7528
|
+
return undefined;
|
|
7529
|
+
return parsed;
|
|
7530
|
+
};
|
|
7531
|
+
const maxTurns = parseBoundedInteger(parts[0], DEFAULT_GOAL_CONTINUE_MAX_TURNS, 1, MAX_GOAL_CONTINUE_MAX_TURNS);
|
|
7532
|
+
const maxStallTurns = parseBoundedInteger(parts[1], DEFAULT_GOAL_CONTINUE_MAX_STALL_TURNS, 0, MAX_GOAL_CONTINUE_MAX_STALL_TURNS);
|
|
7533
|
+
const maxWallClockMinutes = parseBoundedInteger(parts[2], DEFAULT_GOAL_CONTINUE_MAX_WALL_CLOCK_MINUTES, 0, MAX_GOAL_CONTINUE_MAX_WALL_CLOCK_MINUTES);
|
|
7534
|
+
if (maxTurns === undefined || maxStallTurns === undefined || maxWallClockMinutes === undefined) {
|
|
7535
|
+
return { ok: false, error: usage };
|
|
7536
|
+
}
|
|
7537
|
+
return { ok: true, maxTurns, maxStallTurns, maxWallClockMinutes };
|
|
7538
|
+
}
|
|
7539
|
+
async handleGoalContinueCommand(text) {
|
|
7540
|
+
const parsed = this.parseGoalContinueCommand(text);
|
|
7541
|
+
if (!parsed.ok) {
|
|
7542
|
+
this.showError(parsed.error);
|
|
7543
|
+
return;
|
|
7544
|
+
}
|
|
7545
|
+
this.showStatus(`Goal continuation started: up to ${parsed.maxTurns} turn(s), stall limit ${parsed.maxStallTurns}, wall-clock limit ${parsed.maxWallClockMinutes || "disabled"} minute(s).`);
|
|
7546
|
+
try {
|
|
7547
|
+
const result = await this.session.continueGoalLoop({
|
|
7548
|
+
maxTurns: parsed.maxTurns,
|
|
7549
|
+
maxStallTurns: parsed.maxStallTurns,
|
|
7550
|
+
maxWallClockMinutes: parsed.maxWallClockMinutes,
|
|
7551
|
+
});
|
|
7552
|
+
const continuation = result.finalSnapshot.continuation;
|
|
7553
|
+
this.showStatus(`Goal continuation stopped: ${result.stopReason}; submitted ${result.turnsSubmitted} turn(s); latest decision ${continuation.action}/${continuation.reasonCode}.`);
|
|
7554
|
+
}
|
|
7555
|
+
catch (error) {
|
|
7556
|
+
this.showError(`Goal continuation failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
7557
|
+
}
|
|
7558
|
+
finally {
|
|
7559
|
+
this.refreshAutonomyFooterStatus();
|
|
7560
|
+
}
|
|
7561
|
+
}
|
|
7293
7562
|
handleSessionCommand() {
|
|
7294
7563
|
const stats = this.session.getSessionStats();
|
|
7295
7564
|
const sessionName = this.sessionManager.getSessionName();
|