@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
|
@@ -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";
|
|
@@ -214,32 +218,6 @@ function removeAutoLearnArtifactPath(filePath, root) {
|
|
|
214
218
|
return false;
|
|
215
219
|
}
|
|
216
220
|
}
|
|
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
221
|
function getAutoLearnSessionIdFromFileName(fileName) {
|
|
244
222
|
return fileName.match(/_(auto-learn-[A-Za-z0-9._-]+)\.jsonl$/)?.[1];
|
|
245
223
|
}
|
|
@@ -872,6 +850,9 @@ export class InteractiveMode {
|
|
|
872
850
|
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
873
851
|
this.showError(errorMessage);
|
|
874
852
|
}
|
|
853
|
+
finally {
|
|
854
|
+
this.refreshAutonomyFooterStatus();
|
|
855
|
+
}
|
|
875
856
|
}
|
|
876
857
|
if (initialMessages) {
|
|
877
858
|
for (const message of initialMessages) {
|
|
@@ -882,6 +863,9 @@ export class InteractiveMode {
|
|
|
882
863
|
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
883
864
|
this.showError(errorMessage);
|
|
884
865
|
}
|
|
866
|
+
finally {
|
|
867
|
+
this.refreshAutonomyFooterStatus();
|
|
868
|
+
}
|
|
885
869
|
}
|
|
886
870
|
}
|
|
887
871
|
// Main interactive loop
|
|
@@ -894,8 +878,15 @@ export class InteractiveMode {
|
|
|
894
878
|
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
895
879
|
this.showError(errorMessage);
|
|
896
880
|
}
|
|
881
|
+
finally {
|
|
882
|
+
this.refreshAutonomyFooterStatus();
|
|
883
|
+
}
|
|
897
884
|
}
|
|
898
885
|
}
|
|
886
|
+
refreshAutonomyFooterStatus() {
|
|
887
|
+
this.footerDataProvider.setAutonomyStatusSnapshot(this.session.getAutonomyStatusSnapshot());
|
|
888
|
+
this.footer.invalidate();
|
|
889
|
+
}
|
|
899
890
|
async checkForPackageUpdates() {
|
|
900
891
|
if (process.env.PI_OFFLINE) {
|
|
901
892
|
return [];
|
|
@@ -2443,11 +2434,16 @@ export class InteractiveMode {
|
|
|
2443
2434
|
const images = this.takeClipboardImagesForText(text);
|
|
2444
2435
|
this.editor.addToHistory?.(text);
|
|
2445
2436
|
this.editor.setText("");
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2437
|
+
try {
|
|
2438
|
+
await this.session.prompt(text, {
|
|
2439
|
+
streamingBehavior: queueAsFollowUp ? "followUp" : "steer",
|
|
2440
|
+
images,
|
|
2441
|
+
processSlashCommands: false,
|
|
2442
|
+
});
|
|
2443
|
+
}
|
|
2444
|
+
finally {
|
|
2445
|
+
this.refreshAutonomyFooterStatus();
|
|
2446
|
+
}
|
|
2451
2447
|
this.updatePendingMessagesDisplay();
|
|
2452
2448
|
this.ui.requestRender();
|
|
2453
2449
|
return;
|
|
@@ -2520,6 +2516,11 @@ export class InteractiveMode {
|
|
|
2520
2516
|
this.editor.setText("");
|
|
2521
2517
|
return;
|
|
2522
2518
|
}
|
|
2519
|
+
if (text === "/goal-continue" || text.startsWith("/goal-continue ")) {
|
|
2520
|
+
await this.handleGoalContinueCommand(text);
|
|
2521
|
+
this.editor.setText("");
|
|
2522
|
+
return;
|
|
2523
|
+
}
|
|
2523
2524
|
if (text === "/changelog") {
|
|
2524
2525
|
this.handleChangelogCommand();
|
|
2525
2526
|
this.editor.setText("");
|
|
@@ -3610,7 +3611,12 @@ export class InteractiveMode {
|
|
|
3610
3611
|
if (this.isExtensionCommand(text)) {
|
|
3611
3612
|
this.editor.addToHistory?.(text);
|
|
3612
3613
|
this.editor.setText("");
|
|
3613
|
-
|
|
3614
|
+
try {
|
|
3615
|
+
await this.session.prompt(text);
|
|
3616
|
+
}
|
|
3617
|
+
finally {
|
|
3618
|
+
this.refreshAutonomyFooterStatus();
|
|
3619
|
+
}
|
|
3614
3620
|
}
|
|
3615
3621
|
else {
|
|
3616
3622
|
const images = this.takeClipboardImagesForText(text);
|
|
@@ -3624,7 +3630,12 @@ export class InteractiveMode {
|
|
|
3624
3630
|
const images = this.takeClipboardImagesForText(text);
|
|
3625
3631
|
this.editor.addToHistory?.(text);
|
|
3626
3632
|
this.editor.setText("");
|
|
3627
|
-
|
|
3633
|
+
try {
|
|
3634
|
+
await this.session.prompt(text, { streamingBehavior: "followUp", images });
|
|
3635
|
+
}
|
|
3636
|
+
finally {
|
|
3637
|
+
this.refreshAutonomyFooterStatus();
|
|
3638
|
+
}
|
|
3628
3639
|
this.updatePendingMessagesDisplay();
|
|
3629
3640
|
this.ui.requestRender();
|
|
3630
3641
|
}
|
|
@@ -3996,8 +4007,13 @@ export class InteractiveMode {
|
|
|
3996
4007
|
const promptOptions = this.session.isStreaming
|
|
3997
4008
|
? { images: firstPrompt.images, streamingBehavior: firstPrompt.mode }
|
|
3998
4009
|
: { images: firstPrompt.images };
|
|
3999
|
-
const promptPromise = this.session
|
|
4010
|
+
const promptPromise = this.session
|
|
4011
|
+
.prompt(firstPrompt.text, promptOptions)
|
|
4012
|
+
.catch((error) => {
|
|
4000
4013
|
restoreQueue(error);
|
|
4014
|
+
})
|
|
4015
|
+
.finally(() => {
|
|
4016
|
+
this.refreshAutonomyFooterStatus();
|
|
4001
4017
|
});
|
|
4002
4018
|
// Queue remaining messages
|
|
4003
4019
|
for (const message of rest) {
|
|
@@ -4534,9 +4550,26 @@ export class InteractiveMode {
|
|
|
4534
4550
|
return { result: undefined, next };
|
|
4535
4551
|
});
|
|
4536
4552
|
}
|
|
4537
|
-
|
|
4553
|
+
reportCompletedAutoLearnUsage(runId, sessionDir, sessionId, logPath) {
|
|
4554
|
+
try {
|
|
4555
|
+
reportCompletedAutoLearnUsageHelper({
|
|
4556
|
+
runId,
|
|
4557
|
+
sessionDir,
|
|
4558
|
+
sessionId,
|
|
4559
|
+
logPath,
|
|
4560
|
+
parentSession: this.session,
|
|
4561
|
+
appendLog: (p, msg) => this.appendAutoLearnLog(p, msg),
|
|
4562
|
+
});
|
|
4563
|
+
}
|
|
4564
|
+
catch (error) {
|
|
4565
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
4566
|
+
this.appendAutoLearnLog(logPath, `Auto Learn usage report failed: ${message}`);
|
|
4567
|
+
}
|
|
4568
|
+
}
|
|
4569
|
+
cleanupCompletedAutoLearnRun(runId, options) {
|
|
4570
|
+
this.reportCompletedAutoLearnUsage(runId, options.sessionDir, options.sessionId, options.logPath);
|
|
4538
4571
|
const dataDir = this.getAutoLearnDataDir();
|
|
4539
|
-
for (const filePath of artifactPaths)
|
|
4572
|
+
for (const filePath of options.artifactPaths)
|
|
4540
4573
|
removeAutoLearnArtifactPath(filePath, dataDir);
|
|
4541
4574
|
this.withAutoLearnStateLock((current) => {
|
|
4542
4575
|
const state = this.pruneAutoLearnState(current);
|
|
@@ -4681,8 +4714,14 @@ export class InteractiveMode {
|
|
|
4681
4714
|
}
|
|
4682
4715
|
const childPid = child.pid;
|
|
4683
4716
|
child.once("exit", (code) => {
|
|
4684
|
-
if (code === 0)
|
|
4685
|
-
this.cleanupCompletedAutoLearnRun(reservation.runId,
|
|
4717
|
+
if (code === 0) {
|
|
4718
|
+
this.cleanupCompletedAutoLearnRun(reservation.runId, {
|
|
4719
|
+
artifactPaths: [promptPath, logPath, sessionDir],
|
|
4720
|
+
sessionDir,
|
|
4721
|
+
sessionId,
|
|
4722
|
+
logPath,
|
|
4723
|
+
});
|
|
4724
|
+
}
|
|
4686
4725
|
});
|
|
4687
4726
|
child.unref();
|
|
4688
4727
|
this.markAutoLearnReservationRunning(reservation, childPid, settings);
|
|
@@ -5085,7 +5124,75 @@ export class InteractiveMode {
|
|
|
5085
5124
|
this.ui.requestRender();
|
|
5086
5125
|
return;
|
|
5087
5126
|
}
|
|
5088
|
-
|
|
5127
|
+
if (action === "diagnostics") {
|
|
5128
|
+
this.chatContainer.addChild(new Spacer(1));
|
|
5129
|
+
this.chatContainer.addChild(new Text(formatAutonomyDiagnostics(this.session.getAutonomyDiagnosticSnapshot()), 1, 0));
|
|
5130
|
+
this.ui.requestRender();
|
|
5131
|
+
return;
|
|
5132
|
+
}
|
|
5133
|
+
if (action.startsWith("rollback")) {
|
|
5134
|
+
const auditId = action.slice("rollback".length).trim();
|
|
5135
|
+
if (!auditId) {
|
|
5136
|
+
this.showStatus("Usage: /autonomy rollback <auditId> (see /autonomy diagnostics for audit ids)");
|
|
5137
|
+
return;
|
|
5138
|
+
}
|
|
5139
|
+
void this.session
|
|
5140
|
+
.rollbackLearningWrite(auditId)
|
|
5141
|
+
.then((result) => {
|
|
5142
|
+
this.showStatus(result.ok ? `Rolled back learning change ${auditId}.` : `Rollback skipped: ${result.reason}`);
|
|
5143
|
+
})
|
|
5144
|
+
.catch((error) => {
|
|
5145
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
5146
|
+
this.showStatus(`Rollback failed: ${message}`);
|
|
5147
|
+
});
|
|
5148
|
+
return;
|
|
5149
|
+
}
|
|
5150
|
+
if (action.startsWith("fitness")) {
|
|
5151
|
+
const rest = action.slice("fitness".length).trim().split(/\s+/).filter(Boolean);
|
|
5152
|
+
const modelPattern = rest[0];
|
|
5153
|
+
if (!modelPattern) {
|
|
5154
|
+
this.showStatus("Usage: /autonomy fitness <model-pattern> [trials]");
|
|
5155
|
+
return;
|
|
5156
|
+
}
|
|
5157
|
+
const trials = rest[1] ? Number(rest[1]) : undefined;
|
|
5158
|
+
this.showStatus(`Model fitness probe running on ${modelPattern}…`);
|
|
5159
|
+
void this.session
|
|
5160
|
+
.runModelFitness({ model: modelPattern, trials: Number.isFinite(trials) ? trials : undefined })
|
|
5161
|
+
.then((outcome) => {
|
|
5162
|
+
if (!outcome.started) {
|
|
5163
|
+
this.showStatus(`Model fitness skipped: ${outcome.skipReason}`);
|
|
5164
|
+
return;
|
|
5165
|
+
}
|
|
5166
|
+
this.chatContainer.addChild(new Spacer(1));
|
|
5167
|
+
this.chatContainer.addChild(new Text(formatModelFitnessReport(outcome.model, outcome.report), 1, 0));
|
|
5168
|
+
this.ui.requestRender();
|
|
5169
|
+
})
|
|
5170
|
+
.catch((error) => {
|
|
5171
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
5172
|
+
this.showStatus(`Model fitness failed: ${message}`);
|
|
5173
|
+
});
|
|
5174
|
+
return;
|
|
5175
|
+
}
|
|
5176
|
+
if (action === "research") {
|
|
5177
|
+
this.showStatus("Research lane: running…");
|
|
5178
|
+
void this.session
|
|
5179
|
+
.runResearchLaneOnce()
|
|
5180
|
+
.then((outcome) => {
|
|
5181
|
+
if (!outcome.started) {
|
|
5182
|
+
this.showStatus(`Research lane skipped: ${outcome.skipReason ?? "unknown"}`);
|
|
5183
|
+
return;
|
|
5184
|
+
}
|
|
5185
|
+
const status = outcome.record?.status ?? "unknown";
|
|
5186
|
+
const reason = outcome.record?.reasonCode ? ` (${outcome.record.reasonCode})` : "";
|
|
5187
|
+
this.showStatus(`Research lane ${status}${reason}`);
|
|
5188
|
+
})
|
|
5189
|
+
.catch((error) => {
|
|
5190
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
5191
|
+
this.showStatus(`Research lane failed: ${message}`);
|
|
5192
|
+
});
|
|
5193
|
+
return;
|
|
5194
|
+
}
|
|
5195
|
+
this.showStatus("Usage: /autonomy [status|diagnostics|research|rollback <auditId>|off|safe|balanced|full]");
|
|
5089
5196
|
}
|
|
5090
5197
|
handleAutoLearnCommand(text) {
|
|
5091
5198
|
const action = text.slice("/auto-learn".length).trim() || "status";
|
|
@@ -5153,11 +5260,19 @@ export class InteractiveMode {
|
|
|
5153
5260
|
selfModificationScope: projectSettings.selfModification ? "project" : "global",
|
|
5154
5261
|
autonomy: this.settingsManager.getAutonomySettings(),
|
|
5155
5262
|
autonomyScope: projectSettings.autonomy ? "project" : "global",
|
|
5263
|
+
researchLane: this.settingsManager.getResearchLaneSettings(),
|
|
5264
|
+
researchLaneScope: projectSettings.researchLane ? "project" : "global",
|
|
5265
|
+
workerDelegation: this.settingsManager.getWorkerDelegationSettings(),
|
|
5266
|
+
workerDelegationScope: projectSettings.workerDelegation ? "project" : "global",
|
|
5156
5267
|
modelRouter: this.settingsManager.getModelRouterSettings(),
|
|
5157
5268
|
modelRouterScope: projectSettings.modelRouter ? "project" : "global",
|
|
5158
5269
|
autoLearn: this.settingsManager.getAutoLearnSettings(),
|
|
5159
5270
|
autoLearnScope: projectSettings.autoLearn ? "project" : "global",
|
|
5160
5271
|
autoLearnModelOptions: this.getAutoLearnModelOptions(),
|
|
5272
|
+
contextPolicyEnforcement: this.settingsManager.getContextPromptEnforcementSettings(),
|
|
5273
|
+
contextPolicyEnforcementScope: projectSettings.contextPolicy?.enforcement ? "project" : "global",
|
|
5274
|
+
contextMemoryRetrieval: this.settingsManager.getMemoryRetrievalSettings(),
|
|
5275
|
+
contextMemoryRetrievalScope: projectSettings.contextPolicy?.memory ? "project" : "global",
|
|
5161
5276
|
currentModelPattern: this.session.model
|
|
5162
5277
|
? `${this.session.model.provider}/${this.session.model.id}`
|
|
5163
5278
|
: undefined,
|
|
@@ -5298,6 +5413,14 @@ export class InteractiveMode {
|
|
|
5298
5413
|
this.applyAutonomyMode(settings.mode ?? "off", scope);
|
|
5299
5414
|
this.showStatus(`Autonomy mode ${settings.mode ?? "off"} saved to ${scope}. Use /autonomy status.`);
|
|
5300
5415
|
},
|
|
5416
|
+
onResearchLaneChange: (settings, scope) => {
|
|
5417
|
+
this.settingsManager.setResearchLaneSettings(settings, scope);
|
|
5418
|
+
this.showStatus(`Research lane settings saved to ${scope}. Use /autonomy research or /autonomy diagnostics.`);
|
|
5419
|
+
},
|
|
5420
|
+
onWorkerDelegationChange: (settings, scope) => {
|
|
5421
|
+
this.settingsManager.setWorkerDelegationSettings(settings, scope);
|
|
5422
|
+
this.showStatus(`Worker delegation settings saved to ${scope}. The delegate tool uses them.`);
|
|
5423
|
+
},
|
|
5301
5424
|
onModelRouterChange: (settings, scope) => {
|
|
5302
5425
|
this.settingsManager.setModelRouterSettings(settings, scope);
|
|
5303
5426
|
for (const value of [settings.cheapModel, settings.expensiveModel, settings.learningModel]) {
|
|
@@ -5318,6 +5441,14 @@ export class InteractiveMode {
|
|
|
5318
5441
|
this.updateAutoLearnFooter();
|
|
5319
5442
|
this.showStatus(`Auto Learn settings saved to ${scope}. Use /auto-learn status or /auto-learn run.`);
|
|
5320
5443
|
},
|
|
5444
|
+
onContextPolicyEnforcementChange: (settings, scope) => {
|
|
5445
|
+
this.settingsManager.setContextPromptEnforcementSettings(settings, scope);
|
|
5446
|
+
this.showStatus(`Context/prompt-policy settings saved to ${scope}.`);
|
|
5447
|
+
},
|
|
5448
|
+
onContextMemoryRetrievalChange: (settings, scope) => {
|
|
5449
|
+
this.settingsManager.setMemoryRetrievalSettings(settings, scope);
|
|
5450
|
+
this.showStatus(`Context/memory-retrieval settings saved to ${scope}.`);
|
|
5451
|
+
},
|
|
5321
5452
|
onResourcesHubAction: (action) => {
|
|
5322
5453
|
done();
|
|
5323
5454
|
void this.handleResourcesHubAction(action);
|
|
@@ -7290,6 +7421,53 @@ export class InteractiveMode {
|
|
|
7290
7421
|
this.chatContainer.addChild(new Text(theme.fg("dim", `Session name set: ${name}`), 1, 0));
|
|
7291
7422
|
this.ui.requestRender();
|
|
7292
7423
|
}
|
|
7424
|
+
parseGoalContinueCommand(text) {
|
|
7425
|
+
const usage = "Usage: /goal-continue [maxTurns 1-20] [maxStallTurns 0-100] [maxMinutes 0-1440]";
|
|
7426
|
+
const parts = text.trim().split(/\s+/).slice(1);
|
|
7427
|
+
if (parts.length > 3) {
|
|
7428
|
+
return { ok: false, error: usage };
|
|
7429
|
+
}
|
|
7430
|
+
const parseBoundedInteger = (value, fallback, min, max) => {
|
|
7431
|
+
if (value === undefined || value.length === 0)
|
|
7432
|
+
return fallback;
|
|
7433
|
+
if (!/^\d+$/.test(value))
|
|
7434
|
+
return undefined;
|
|
7435
|
+
const parsed = Number.parseInt(value, 10);
|
|
7436
|
+
if (!Number.isSafeInteger(parsed) || parsed < min || parsed > max)
|
|
7437
|
+
return undefined;
|
|
7438
|
+
return parsed;
|
|
7439
|
+
};
|
|
7440
|
+
const maxTurns = parseBoundedInteger(parts[0], DEFAULT_GOAL_CONTINUE_MAX_TURNS, 1, MAX_GOAL_CONTINUE_MAX_TURNS);
|
|
7441
|
+
const maxStallTurns = parseBoundedInteger(parts[1], DEFAULT_GOAL_CONTINUE_MAX_STALL_TURNS, 0, MAX_GOAL_CONTINUE_MAX_STALL_TURNS);
|
|
7442
|
+
const maxWallClockMinutes = parseBoundedInteger(parts[2], DEFAULT_GOAL_CONTINUE_MAX_WALL_CLOCK_MINUTES, 0, MAX_GOAL_CONTINUE_MAX_WALL_CLOCK_MINUTES);
|
|
7443
|
+
if (maxTurns === undefined || maxStallTurns === undefined || maxWallClockMinutes === undefined) {
|
|
7444
|
+
return { ok: false, error: usage };
|
|
7445
|
+
}
|
|
7446
|
+
return { ok: true, maxTurns, maxStallTurns, maxWallClockMinutes };
|
|
7447
|
+
}
|
|
7448
|
+
async handleGoalContinueCommand(text) {
|
|
7449
|
+
const parsed = this.parseGoalContinueCommand(text);
|
|
7450
|
+
if (!parsed.ok) {
|
|
7451
|
+
this.showError(parsed.error);
|
|
7452
|
+
return;
|
|
7453
|
+
}
|
|
7454
|
+
this.showStatus(`Goal continuation started: up to ${parsed.maxTurns} turn(s), stall limit ${parsed.maxStallTurns}, wall-clock limit ${parsed.maxWallClockMinutes || "disabled"} minute(s).`);
|
|
7455
|
+
try {
|
|
7456
|
+
const result = await this.session.continueGoalLoop({
|
|
7457
|
+
maxTurns: parsed.maxTurns,
|
|
7458
|
+
maxStallTurns: parsed.maxStallTurns,
|
|
7459
|
+
maxWallClockMinutes: parsed.maxWallClockMinutes,
|
|
7460
|
+
});
|
|
7461
|
+
const continuation = result.finalSnapshot.continuation;
|
|
7462
|
+
this.showStatus(`Goal continuation stopped: ${result.stopReason}; submitted ${result.turnsSubmitted} turn(s); latest decision ${continuation.action}/${continuation.reasonCode}.`);
|
|
7463
|
+
}
|
|
7464
|
+
catch (error) {
|
|
7465
|
+
this.showError(`Goal continuation failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
7466
|
+
}
|
|
7467
|
+
finally {
|
|
7468
|
+
this.refreshAutonomyFooterStatus();
|
|
7469
|
+
}
|
|
7470
|
+
}
|
|
7293
7471
|
handleSessionCommand() {
|
|
7294
7472
|
const stats = this.session.getSessionStats();
|
|
7295
7473
|
const sessionName = this.sessionManager.getSessionName();
|