@caupulican/pi-adaptative 0.94.1 → 0.96.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +58 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/README.md +32 -13
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.d.ts +7 -4
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.d.ts.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.js +201 -293
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.js.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.ts +272 -392
- package/dist/bundled-resources/extensions/tmux-agent-manager/launch-profile.d.ts +52 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/launch-profile.d.ts.map +1 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/launch-profile.js +118 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/launch-profile.js.map +1 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/launch-profile.ts +169 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/templates/builder-validator.json +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/templates/provider-prompt-smoke.json +1 -1
- package/dist/bundled-resources/extensions/tps/index.d.ts +3 -0
- package/dist/bundled-resources/extensions/tps/index.d.ts.map +1 -0
- package/dist/bundled-resources/extensions/tps/index.js +44 -0
- package/dist/bundled-resources/extensions/tps/index.js.map +1 -0
- package/dist/bundled-resources/extensions/tps/index.ts +48 -0
- package/dist/bundled-resources/skills/pi-harness-learning/SKILL.md +13 -7
- package/dist/bundled-resources/skills/worker-profile-writer/SKILL.md +11 -11
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +12 -3
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +11 -41
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +93 -160
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/autonomy/envelope-enforcement.d.ts +6 -1
- package/dist/core/autonomy/envelope-enforcement.d.ts.map +1 -1
- package/dist/core/autonomy/envelope-enforcement.js +26 -25
- package/dist/core/autonomy/envelope-enforcement.js.map +1 -1
- package/dist/core/autonomy/lane-private-paths.d.ts.map +1 -1
- package/dist/core/autonomy/lane-private-paths.js +2 -1
- package/dist/core/autonomy/lane-private-paths.js.map +1 -1
- package/dist/core/autonomy/lane-tool-surface.d.ts +8 -8
- package/dist/core/autonomy/lane-tool-surface.d.ts.map +1 -1
- package/dist/core/autonomy/lane-tool-surface.js +45 -30
- package/dist/core/autonomy/lane-tool-surface.js.map +1 -1
- package/dist/core/autonomy/worker-session-private-scope.d.ts +12 -0
- package/dist/core/autonomy/worker-session-private-scope.d.ts.map +1 -0
- package/dist/core/autonomy/worker-session-private-scope.js +42 -0
- package/dist/core/autonomy/worker-session-private-scope.js.map +1 -0
- package/dist/core/autonomy/worker-tool-adapter-registry.d.ts +65 -0
- package/dist/core/autonomy/worker-tool-adapter-registry.d.ts.map +1 -0
- package/dist/core/autonomy/worker-tool-adapter-registry.js +145 -0
- package/dist/core/autonomy/worker-tool-adapter-registry.js.map +1 -0
- package/dist/core/background-lane-controller.d.ts +1 -1
- package/dist/core/background-lane-controller.d.ts.map +1 -1
- package/dist/core/background-lane-controller.js +1 -1
- package/dist/core/background-lane-controller.js.map +1 -1
- package/dist/core/background-tool-task-controller.d.ts +8 -2
- package/dist/core/background-tool-task-controller.d.ts.map +1 -1
- package/dist/core/background-tool-task-controller.js +10 -2
- package/dist/core/background-tool-task-controller.js.map +1 -1
- package/dist/core/compaction-controller.d.ts +3 -0
- package/dist/core/compaction-controller.d.ts.map +1 -1
- package/dist/core/compaction-controller.js +12 -1
- package/dist/core/compaction-controller.js.map +1 -1
- package/dist/core/cost-guard-controller.d.ts +37 -0
- package/dist/core/cost-guard-controller.d.ts.map +1 -0
- package/dist/core/cost-guard-controller.js +71 -0
- package/dist/core/cost-guard-controller.js.map +1 -0
- package/dist/core/cost-guard.d.ts +9 -4
- package/dist/core/cost-guard.d.ts.map +1 -1
- package/dist/core/cost-guard.js +7 -3
- package/dist/core/cost-guard.js.map +1 -1
- package/dist/core/delegation/worker-attempt-executor.d.ts +1 -1
- package/dist/core/delegation/worker-attempt-executor.d.ts.map +1 -1
- package/dist/core/delegation/worker-attempt-executor.js +0 -1
- package/dist/core/delegation/worker-attempt-executor.js.map +1 -1
- package/dist/core/delegation/worker-authority-resolver.d.ts +16 -3
- package/dist/core/delegation/worker-authority-resolver.d.ts.map +1 -1
- package/dist/core/delegation/worker-authority-resolver.js +114 -55
- package/dist/core/delegation/worker-authority-resolver.js.map +1 -1
- package/dist/core/delegation/worker-claim.d.ts +1 -2
- package/dist/core/delegation/worker-claim.d.ts.map +1 -1
- package/dist/core/delegation/worker-claim.js.map +1 -1
- package/dist/core/delegation/worker-delegation-controller.d.ts +19 -6
- package/dist/core/delegation/worker-delegation-controller.d.ts.map +1 -1
- package/dist/core/delegation/worker-delegation-controller.js +125 -40
- package/dist/core/delegation/worker-delegation-controller.js.map +1 -1
- package/dist/core/delegation/worker-delegation-request.d.ts +3 -3
- package/dist/core/delegation/worker-delegation-request.d.ts.map +1 -1
- package/dist/core/delegation/worker-delegation-request.js +13 -19
- package/dist/core/delegation/worker-delegation-request.js.map +1 -1
- package/dist/core/delegation/worker-execution-policy.d.ts +3 -2
- package/dist/core/delegation/worker-execution-policy.d.ts.map +1 -1
- package/dist/core/delegation/worker-execution-policy.js +54 -39
- package/dist/core/delegation/worker-execution-policy.js.map +1 -1
- package/dist/core/delegation/worker-fleet-limits.d.ts +3 -3
- package/dist/core/delegation/worker-fleet-limits.d.ts.map +1 -1
- package/dist/core/delegation/worker-fleet-limits.js +7 -7
- package/dist/core/delegation/worker-fleet-limits.js.map +1 -1
- package/dist/core/delegation/worker-machine-scope.d.ts +12 -0
- package/dist/core/delegation/worker-machine-scope.d.ts.map +1 -0
- package/dist/core/delegation/worker-machine-scope.js +38 -0
- package/dist/core/delegation/worker-machine-scope.js.map +1 -0
- package/dist/core/delegation/worker-recovery-coordinator.d.ts.map +1 -1
- package/dist/core/delegation/worker-recovery-coordinator.js +6 -1
- package/dist/core/delegation/worker-recovery-coordinator.js.map +1 -1
- package/dist/core/delegation/worker-runner.d.ts +5 -7
- package/dist/core/delegation/worker-runner.d.ts.map +1 -1
- package/dist/core/delegation/worker-runner.js +1 -4
- package/dist/core/delegation/worker-runner.js.map +1 -1
- package/dist/core/delegation/worker-write-reservation-coordinator.d.ts +3 -2
- package/dist/core/delegation/worker-write-reservation-coordinator.d.ts.map +1 -1
- package/dist/core/delegation/worker-write-reservation-coordinator.js +50 -25
- package/dist/core/delegation/worker-write-reservation-coordinator.js.map +1 -1
- package/dist/core/durable-custom-message-turn-controller.d.ts +6 -0
- package/dist/core/durable-custom-message-turn-controller.d.ts.map +1 -1
- package/dist/core/durable-custom-message-turn-controller.js +38 -15
- package/dist/core/durable-custom-message-turn-controller.js.map +1 -1
- package/dist/core/extension-binding-controller.d.ts +5 -1
- package/dist/core/extension-binding-controller.d.ts.map +1 -1
- package/dist/core/extension-binding-controller.js +15 -0
- package/dist/core/extension-binding-controller.js.map +1 -1
- package/dist/core/extension-import-authority.d.ts +3 -1
- package/dist/core/extension-import-authority.d.ts.map +1 -1
- package/dist/core/extension-import-authority.js +15 -0
- package/dist/core/extension-import-authority.js.map +1 -1
- package/dist/core/extensions/factory-runtime.d.ts.map +1 -1
- package/dist/core/extensions/factory-runtime.js +5 -0
- package/dist/core/extensions/factory-runtime.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +1 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +8 -4
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/foreground-terminal-handoff-controller.d.ts +14 -0
- package/dist/core/foreground-terminal-handoff-controller.d.ts.map +1 -1
- package/dist/core/foreground-terminal-handoff-controller.js +188 -72
- package/dist/core/foreground-terminal-handoff-controller.js.map +1 -1
- package/dist/core/goals/goal-session-controller.d.ts +2 -0
- package/dist/core/goals/goal-session-controller.d.ts.map +1 -1
- package/dist/core/goals/goal-session-controller.js +8 -0
- package/dist/core/goals/goal-session-controller.js.map +1 -1
- package/dist/core/goals/goal-tool-core.d.ts +5 -4
- package/dist/core/goals/goal-tool-core.d.ts.map +1 -1
- package/dist/core/goals/goal-tool-core.js +23 -19
- package/dist/core/goals/goal-tool-core.js.map +1 -1
- package/dist/core/keybindings.d.ts +2 -2
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +2 -2
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/learning/auto-learn-settings.d.ts +84 -0
- package/dist/core/learning/auto-learn-settings.d.ts.map +1 -0
- package/dist/core/learning/auto-learn-settings.js +66 -0
- package/dist/core/learning/auto-learn-settings.js.map +1 -0
- package/dist/core/learning/reflection-engine.d.ts +4 -0
- package/dist/core/learning/reflection-engine.d.ts.map +1 -1
- package/dist/core/learning/reflection-engine.js +48 -10
- package/dist/core/learning/reflection-engine.js.map +1 -1
- package/dist/core/local-prefix-warm-controller.d.ts +24 -0
- package/dist/core/local-prefix-warm-controller.d.ts.map +1 -0
- package/dist/core/local-prefix-warm-controller.js +79 -0
- package/dist/core/local-prefix-warm-controller.js.map +1 -0
- package/dist/core/memory/providers/file-store.d.ts +2 -0
- package/dist/core/memory/providers/file-store.d.ts.map +1 -1
- package/dist/core/memory/providers/file-store.js +71 -15
- package/dist/core/memory/providers/file-store.js.map +1 -1
- package/dist/core/memory/worker-memory-tools.d.ts +5 -0
- package/dist/core/memory/worker-memory-tools.d.ts.map +1 -0
- package/dist/core/memory/worker-memory-tools.js +5 -0
- package/dist/core/memory/worker-memory-tools.js.map +1 -0
- package/dist/core/model-capability.d.ts +7 -0
- package/dist/core/model-capability.d.ts.map +1 -1
- package/dist/core/model-capability.js +12 -0
- package/dist/core/model-capability.js.map +1 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +2 -10
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-router-controller.d.ts +3 -2
- package/dist/core/model-router-controller.d.ts.map +1 -1
- package/dist/core/model-router-controller.js +3 -2
- package/dist/core/model-router-controller.js.map +1 -1
- package/dist/core/orchestration/contracts.d.ts +16 -12
- package/dist/core/orchestration/contracts.d.ts.map +1 -1
- package/dist/core/orchestration/contracts.js +2 -2
- package/dist/core/orchestration/contracts.js.map +1 -1
- package/dist/core/orchestration/lane-tool-manifests.d.ts +2 -2
- package/dist/core/orchestration/lane-tool-manifests.d.ts.map +1 -1
- package/dist/core/orchestration/lane-tool-manifests.js +6 -1
- package/dist/core/orchestration/lane-tool-manifests.js.map +1 -1
- package/dist/core/orchestration/profile-registry.d.ts.map +1 -1
- package/dist/core/orchestration/profile-registry.js +14 -0
- package/dist/core/orchestration/profile-registry.js.map +1 -1
- package/dist/core/orchestration/task-profile-writer.d.ts +7 -4
- package/dist/core/orchestration/task-profile-writer.d.ts.map +1 -1
- package/dist/core/orchestration/task-profile-writer.js +71 -59
- package/dist/core/orchestration/task-profile-writer.js.map +1 -1
- package/dist/core/orchestration/thinking-level-schema.d.ts +7 -0
- package/dist/core/orchestration/thinking-level-schema.d.ts.map +1 -0
- package/dist/core/orchestration/thinking-level-schema.js +19 -0
- package/dist/core/orchestration/thinking-level-schema.js.map +1 -0
- package/dist/core/orchestration/worker-execution-contract.d.ts.map +1 -1
- package/dist/core/orchestration/worker-execution-contract.js +12 -5
- package/dist/core/orchestration/worker-execution-contract.js.map +1 -1
- package/dist/core/profile-filter-controller.d.ts.map +1 -1
- package/dist/core/profile-filter-controller.js +5 -2
- package/dist/core/profile-filter-controller.js.map +1 -1
- package/dist/core/provider-prompt-contracts.d.ts +6 -5
- package/dist/core/provider-prompt-contracts.d.ts.map +1 -1
- package/dist/core/provider-prompt-contracts.js +9 -11
- package/dist/core/provider-prompt-contracts.js.map +1 -1
- package/dist/core/provider-request-context-controller.d.ts +2 -0
- package/dist/core/provider-request-context-controller.d.ts.map +1 -1
- package/dist/core/provider-request-context-controller.js +10 -3
- package/dist/core/provider-request-context-controller.js.map +1 -1
- package/dist/core/reflection-controller.d.ts +56 -27
- package/dist/core/reflection-controller.d.ts.map +1 -1
- package/dist/core/reflection-controller.js +206 -117
- package/dist/core/reflection-controller.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +6 -2
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/risk-classifier.d.ts.map +1 -1
- package/dist/core/risk-classifier.js +22 -2
- package/dist/core/risk-classifier.js.map +1 -1
- package/dist/core/runtime-builder.d.ts +1 -0
- package/dist/core/runtime-builder.d.ts.map +1 -1
- package/dist/core/runtime-builder.js +25 -14
- package/dist/core/runtime-builder.js.map +1 -1
- package/dist/core/secrets/credential-exposure-guard.d.ts.map +1 -1
- package/dist/core/secrets/credential-exposure-guard.js +55 -10
- package/dist/core/secrets/credential-exposure-guard.js.map +1 -1
- package/dist/core/session-role.d.ts +6 -8
- package/dist/core/session-role.d.ts.map +1 -1
- package/dist/core/session-role.js +8 -18
- package/dist/core/session-role.js.map +1 -1
- package/dist/core/settings-manager.d.ts +20 -16
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +75 -50
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skill-vault.d.ts +15 -0
- package/dist/core/skill-vault.d.ts.map +1 -1
- package/dist/core/skill-vault.js +79 -45
- package/dist/core/skill-vault.js.map +1 -1
- package/dist/core/skills.d.ts +3 -0
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +6 -6
- package/dist/core/skills.js.map +1 -1
- package/dist/core/system-prompt-builder.d.ts +3 -0
- package/dist/core/system-prompt-builder.d.ts.map +1 -1
- package/dist/core/system-prompt-builder.js +73 -13
- package/dist/core/system-prompt-builder.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +6 -2
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tool-capability-policy.d.ts +3 -0
- package/dist/core/tool-capability-policy.d.ts.map +1 -1
- package/dist/core/tool-capability-policy.js +13 -2
- package/dist/core/tool-capability-policy.js.map +1 -1
- package/dist/core/toolkit/script-runner.d.ts +2 -1
- package/dist/core/toolkit/script-runner.d.ts.map +1 -1
- package/dist/core/toolkit/script-runner.js +10 -2
- package/dist/core/toolkit/script-runner.js.map +1 -1
- package/dist/core/tools/delegate-status.d.ts +1 -1
- package/dist/core/tools/delegate-status.d.ts.map +1 -1
- package/dist/core/tools/delegate-status.js +1 -1
- package/dist/core/tools/delegate-status.js.map +1 -1
- package/dist/core/tools/delegate.d.ts +4 -15
- package/dist/core/tools/delegate.d.ts.map +1 -1
- package/dist/core/tools/delegate.js +111 -73
- package/dist/core/tools/delegate.js.map +1 -1
- package/dist/core/tools/goal.d.ts +3 -4
- package/dist/core/tools/goal.d.ts.map +1 -1
- package/dist/core/tools/goal.js +30 -23
- package/dist/core/tools/goal.js.map +1 -1
- package/dist/core/tools/orchestration-panel.d.ts +7 -0
- package/dist/core/tools/orchestration-panel.d.ts.map +1 -1
- package/dist/core/tools/orchestration-panel.js +58 -9
- package/dist/core/tools/orchestration-panel.js.map +1 -1
- package/dist/core/tools/profile-writer.d.ts +2 -8
- package/dist/core/tools/profile-writer.d.ts.map +1 -1
- package/dist/core/tools/profile-writer.js +6 -18
- package/dist/core/tools/profile-writer.js.map +1 -1
- package/dist/core/tools/run-toolkit-script.d.ts +1 -1
- package/dist/core/tools/run-toolkit-script.d.ts.map +1 -1
- package/dist/core/tools/run-toolkit-script.js +2 -2
- package/dist/core/tools/run-toolkit-script.js.map +1 -1
- package/dist/core/tools/skill-audit.d.ts +28 -1
- package/dist/core/tools/skill-audit.d.ts.map +1 -1
- package/dist/core/tools/skill-audit.js +56 -12
- package/dist/core/tools/skill-audit.js.map +1 -1
- package/dist/core/tools/skill.d.ts +12 -1
- package/dist/core/tools/skill.d.ts.map +1 -1
- package/dist/core/tools/skill.js +52 -0
- package/dist/core/tools/skill.js.map +1 -1
- package/dist/core/tools/skillify.d.ts.map +1 -1
- package/dist/core/tools/skillify.js +16 -7
- package/dist/core/tools/skillify.js.map +1 -1
- package/dist/core/tools/task-steps.d.ts.map +1 -1
- package/dist/core/tools/task-steps.js +2 -1
- package/dist/core/tools/task-steps.js.map +1 -1
- package/dist/core/tools/tmux-dispatch.d.ts +4 -16
- package/dist/core/tools/tmux-dispatch.d.ts.map +1 -1
- package/dist/core/tools/tmux-dispatch.js +5 -20
- package/dist/core/tools/tmux-dispatch.js.map +1 -1
- package/dist/core/worktree-sync/codes.d.ts +1 -2
- package/dist/core/worktree-sync/codes.d.ts.map +1 -1
- package/dist/core/worktree-sync/codes.js +1 -2
- package/dist/core/worktree-sync/codes.js.map +1 -1
- package/dist/core/worktree-sync/lane-gate.d.ts +4 -8
- package/dist/core/worktree-sync/lane-gate.d.ts.map +1 -1
- package/dist/core/worktree-sync/lane-gate.js +5 -51
- package/dist/core/worktree-sync/lane-gate.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/auto-learn-controller.d.ts +6 -7
- package/dist/modes/interactive/auto-learn-controller.d.ts.map +1 -1
- package/dist/modes/interactive/auto-learn-controller.js +30 -207
- package/dist/modes/interactive/auto-learn-controller.js.map +1 -1
- package/dist/modes/interactive/autonomy-commands.js +2 -2
- package/dist/modes/interactive/autonomy-commands.js.map +1 -1
- package/dist/modes/interactive/components/agents-overlay.d.ts +16 -4
- package/dist/modes/interactive/components/agents-overlay.d.ts.map +1 -1
- package/dist/modes/interactive/components/agents-overlay.js +108 -29
- package/dist/modes/interactive/components/agents-overlay.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +17 -0
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/fitness-role-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/fitness-role-selector.js +2 -2
- package/dist/modes/interactive/components/fitness-role-selector.js.map +1 -1
- package/dist/modes/interactive/components/footer.js +1 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +4 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +150 -73
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +5 -4
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/report-commands.d.ts.map +1 -1
- package/dist/modes/interactive/report-commands.js +8 -4
- package/dist/modes/interactive/report-commands.js.map +1 -1
- package/dist/modes/interactive/settings-selector-flow.d.ts.map +1 -1
- package/dist/modes/interactive/settings-selector-flow.js +10 -0
- package/dist/modes/interactive/settings-selector-flow.js.map +1 -1
- package/docs/extensions.md +10 -0
- package/docs/harness-architecture.md +28 -32
- package/docs/index.md +2 -1
- package/docs/keybindings.md +2 -0
- package/docs/process-matrix.md +8 -6
- package/docs/resources.md +1 -1
- package/docs/settings.md +61 -51
- package/docs/task-steps.md +2 -0
- package/docs/tmux-agent-manager.md +48 -41
- package/docs/usage.md +1 -1
- package/docs/work-lifecycle.md +137 -0
- package/docs/worker-profiles.md +8 -6
- package/docs/worktree-sync.md +26 -20
- 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 +12 -12
- package/package.json +4 -4
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.d.ts +0 -133
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.d.ts.map +0 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js +0 -199
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js.map +0 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.ts +0 -312
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Root-session reflection cue + explicit learning-write controller.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* the skills dir; the whole pass is best-effort and never throws into the turn loop. Reads live
|
|
9
|
-
* session state (model/agent/registry/memory/settings) through narrow deps accessors rather than the
|
|
10
|
-
* whole AgentSession.
|
|
4
|
+
* Automatic reflection is a hidden cue in the root orchestrator's ordinary provider turn. This
|
|
5
|
+
* controller never schedules an automatic provider request. The isolated completion and structured
|
|
6
|
+
* reflection pass remain explicit compatibility/application seams for owner-invoked callers. Every
|
|
7
|
+
* durable effect goes through the bundled memory tool, the session log (via deps), or the skills dir.
|
|
11
8
|
*/
|
|
12
|
-
import {
|
|
9
|
+
import { randomUUID } from "node:crypto";
|
|
13
10
|
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
14
11
|
import { join } from "node:path";
|
|
15
12
|
import { runAgentLoop, startAgentProviderRequest } from "@caupulican/pi-agent-core/agent-loop";
|
|
@@ -17,23 +14,63 @@ import { resolveModelThinkingLevel } from "@caupulican/pi-ai/models";
|
|
|
17
14
|
import { computeLaneAffinityKey, DEFAULT_ISOLATED_LANE_KIND, } from "./agent-session-contracts.js";
|
|
18
15
|
import { AUTONOMY_TELEMETRY_EVENT_TYPES } from "./autonomy/telemetry-events.js";
|
|
19
16
|
import { PI_OKF_TYPES } from "./context/okf-memory.js";
|
|
17
|
+
import { isCurrentSessionReflectionEnabled, resolveAutoLearnSettings } from "./learning/auto-learn-settings.js";
|
|
20
18
|
import { APPLY_WRITE_REFUSED_REASON_CODE, appendLearningAuditSnapshot, contradictionsForReflectionWrite, getLearningAuditSnapshots, proposalFromReflectionWrite, rollbackPlanForReflectionWrite, } from "./learning/learning-audit.js";
|
|
21
19
|
import { evaluateLearningDecision } from "./learning/learning-gate.js";
|
|
22
20
|
import { ObservationStore, observationKey } from "./learning/observation-store.js";
|
|
23
21
|
import { decideDemand, ReflectionEngine, } from "./learning/reflection-engine.js";
|
|
24
|
-
import { analyzeReflectionTurn
|
|
25
|
-
import { resolveCliModel } from "./model-resolver.js";
|
|
22
|
+
import { analyzeReflectionTurn } from "./learning/reflection-turn-analysis.js";
|
|
26
23
|
import { registerInFlightWork } from "./reload-blockers.js";
|
|
27
|
-
import { runSkillAudit } from "./tools/skill-audit.js";
|
|
24
|
+
import { DEFAULT_BOUNDED_SKILL_AUDIT_LIMITS, runSkillAudit } from "./tools/skill-audit.js";
|
|
28
25
|
// reasonCode when an automatic skill promotion is blocked by an overlap with an existing skill
|
|
29
26
|
// (skill_audit's similarity threshold) and routed to a consolidation proposal instead of a blind write.
|
|
30
27
|
export const SKILL_OVERLAP_CONSOLIDATION_REASON_CODE = "skill_overlap_consolidation_proposed";
|
|
31
28
|
// reasonCode when the overlap audit itself fails — the promotion is held (not written unaudited)
|
|
32
29
|
// rather than silently skipping the check.
|
|
33
30
|
export const SKILL_AUDIT_UNAVAILABLE_REASON_CODE = "skill_audit_unavailable";
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
31
|
+
export const CURRENT_TURN_REFLECTION_CUSTOM_TYPE = "reflection_cue";
|
|
32
|
+
export const CURRENT_TURN_REFLECTION_STATE_CUSTOM_TYPE = "reflection_cue_state";
|
|
33
|
+
const CURRENT_TURN_REFLECTION_CUE = [
|
|
34
|
+
"Root reflection contract for this current turn:",
|
|
35
|
+
"- Decide during this same turn whether the request or resulting evidence warrants durable learning.",
|
|
36
|
+
"- When warranted, confront existing memory first, then use this root session's memory or skill tools now.",
|
|
37
|
+
"- Do not defer reflection, request another model turn, call an isolated completion, or launch a background learner or worker for reflection.",
|
|
38
|
+
"- When nothing durable is warranted, continue normally and do not mention this cue.",
|
|
39
|
+
].join("\n");
|
|
40
|
+
const CURRENT_TURN_REFLECTION_TRIGGERS = new Set([
|
|
41
|
+
"root-turn",
|
|
42
|
+
"complex",
|
|
43
|
+
"corrective",
|
|
44
|
+
"durable",
|
|
45
|
+
"session-end",
|
|
46
|
+
]);
|
|
47
|
+
function parseCurrentTurnReflectionCueState(value) {
|
|
48
|
+
if (!value || typeof value !== "object")
|
|
49
|
+
return undefined;
|
|
50
|
+
const candidate = value;
|
|
51
|
+
if (candidate.version !== 1 ||
|
|
52
|
+
typeof candidate.revision !== "number" ||
|
|
53
|
+
!Number.isSafeInteger(candidate.revision) ||
|
|
54
|
+
candidate.revision < 1 ||
|
|
55
|
+
typeof candidate.cueId !== "string" ||
|
|
56
|
+
(candidate.status !== "pending" && candidate.status !== "consumed" && candidate.status !== "dismissed") ||
|
|
57
|
+
!Array.isArray(candidate.triggers) ||
|
|
58
|
+
candidate.triggers.length === 0 ||
|
|
59
|
+
candidate.triggers.some((trigger) => !CURRENT_TURN_REFLECTION_TRIGGERS.has(trigger)) ||
|
|
60
|
+
typeof candidate.createdAt !== "string" ||
|
|
61
|
+
typeof candidate.updatedAt !== "string") {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
version: 1,
|
|
66
|
+
revision: candidate.revision,
|
|
67
|
+
cueId: candidate.cueId,
|
|
68
|
+
status: candidate.status,
|
|
69
|
+
triggers: [...new Set(candidate.triggers)],
|
|
70
|
+
createdAt: candidate.createdAt,
|
|
71
|
+
updatedAt: candidate.updatedAt,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
37
74
|
function parseOkfRollbackTarget(target) {
|
|
38
75
|
if (!target)
|
|
39
76
|
return undefined;
|
|
@@ -47,114 +84,160 @@ function parseOkfRollbackTarget(target) {
|
|
|
47
84
|
}
|
|
48
85
|
export class ReflectionController {
|
|
49
86
|
constructor(deps) {
|
|
50
|
-
this.
|
|
51
|
-
this.scheduledDigests = new Set();
|
|
52
|
-
this.lastScheduledPassAt = 0;
|
|
87
|
+
this.cueStateCacheInitialized = false;
|
|
53
88
|
this.deps = deps;
|
|
89
|
+
this.unsubscribeSettingsChanges = deps.getSettingsManager().subscribeChanges(() => {
|
|
90
|
+
this.synchronizeCurrentTurnCueWithSettings();
|
|
91
|
+
});
|
|
92
|
+
this.synchronizeCurrentTurnCueWithSettings();
|
|
54
93
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (
|
|
66
|
-
return
|
|
67
|
-
this.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
94
|
+
dispose() {
|
|
95
|
+
this.unsubscribeSettingsChanges();
|
|
96
|
+
}
|
|
97
|
+
isAutomaticReflectionEnabled() {
|
|
98
|
+
const settingsManager = this.deps.getSettingsManager();
|
|
99
|
+
const settings = resolveAutoLearnSettings(settingsManager.getAutonomySettings().mode, settingsManager.getAutoLearnSettings());
|
|
100
|
+
return isCurrentSessionReflectionEnabled(settings) && !this.deps.isChildSession() && !this.deps.isDisposed();
|
|
101
|
+
}
|
|
102
|
+
/** Latest durable cue snapshot on the active session branch; custom state never enters model context. */
|
|
103
|
+
getCurrentTurnCueState() {
|
|
104
|
+
if (this.cueStateCacheInitialized)
|
|
105
|
+
return this.cueStateCache;
|
|
106
|
+
const sessionManager = this.deps.getSessionManager();
|
|
107
|
+
let fromId;
|
|
108
|
+
while (true) {
|
|
109
|
+
const entry = sessionManager.getLatestCustomEntryOnBranch(CURRENT_TURN_REFLECTION_STATE_CUSTOM_TYPE, fromId);
|
|
110
|
+
if (!entry)
|
|
71
111
|
break;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
112
|
+
const state = parseCurrentTurnReflectionCueState(entry.data);
|
|
113
|
+
if (state) {
|
|
114
|
+
this.cueStateCache = state;
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
if (!entry.parentId)
|
|
118
|
+
break;
|
|
119
|
+
fromId = entry.parentId;
|
|
78
120
|
}
|
|
79
|
-
this.
|
|
80
|
-
return
|
|
121
|
+
this.cueStateCacheInitialized = true;
|
|
122
|
+
return this.cueStateCache;
|
|
123
|
+
}
|
|
124
|
+
/** Branch/session navigation invalidates the lazy latest-state index; ordinary appends do not. */
|
|
125
|
+
invalidateCurrentTurnCueStateCache() {
|
|
126
|
+
this.cueStateCacheInitialized = false;
|
|
127
|
+
this.cueStateCache = undefined;
|
|
81
128
|
}
|
|
82
|
-
|
|
83
|
-
|
|
129
|
+
persistCurrentTurnCueState(state) {
|
|
130
|
+
this.deps.getSessionManager().appendCustomEntry(CURRENT_TURN_REFLECTION_STATE_CUSTOM_TYPE, state);
|
|
131
|
+
this.cueStateCache = state;
|
|
132
|
+
this.cueStateCacheInitialized = true;
|
|
133
|
+
}
|
|
134
|
+
synchronizeCurrentTurnCueWithSettings() {
|
|
135
|
+
if (this.isAutomaticReflectionEnabled())
|
|
84
136
|
return;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
if (delay > 0) {
|
|
88
|
-
this.scheduledTimer = setTimeout(() => {
|
|
89
|
-
this.scheduledTimer = undefined;
|
|
90
|
-
this.startPendingPass();
|
|
91
|
-
}, delay);
|
|
92
|
-
this.scheduledTimer.unref?.();
|
|
137
|
+
const current = this.getCurrentTurnCueState();
|
|
138
|
+
if (current?.status !== "pending")
|
|
93
139
|
return;
|
|
94
|
-
|
|
95
|
-
|
|
140
|
+
this.persistCurrentTurnCueState({
|
|
141
|
+
...current,
|
|
142
|
+
revision: current.revision + 1,
|
|
143
|
+
status: "dismissed",
|
|
144
|
+
updatedAt: new Date().toISOString(),
|
|
145
|
+
});
|
|
96
146
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const reportDigest = createHash("sha256")
|
|
106
|
-
.update(turns.map((turn) => turn.analysis.digest).join("\0"))
|
|
107
|
-
.digest("hex")
|
|
108
|
-
.slice(0, 24);
|
|
109
|
-
const settings = this.deps.getSettingsManager().getAutoLearnSettings();
|
|
110
|
-
let model;
|
|
111
|
-
if (settings.model && settings.model !== "active") {
|
|
112
|
-
const resolved = resolveCliModel({ cliModel: settings.model, modelRegistry: this.deps.getModelRegistry() });
|
|
113
|
-
if (resolved.model && this.deps.getModelRegistry().hasConfiguredAuth(resolved.model))
|
|
114
|
-
model = resolved.model;
|
|
147
|
+
/**
|
|
148
|
+
* Persist one logical pending cue. Repeated triggers merge into the existing pending snapshot;
|
|
149
|
+
* they never append competing pending cues or retain raw transcript text.
|
|
150
|
+
*/
|
|
151
|
+
queueCurrentTurnCue(trigger) {
|
|
152
|
+
if (!this.isAutomaticReflectionEnabled()) {
|
|
153
|
+
this.synchronizeCurrentTurnCueWithSettings();
|
|
154
|
+
return false;
|
|
115
155
|
}
|
|
116
|
-
const
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
this.schedulePendingPass();
|
|
142
|
-
}
|
|
143
|
-
})();
|
|
156
|
+
const current = this.getCurrentTurnCueState();
|
|
157
|
+
const updatedAt = new Date().toISOString();
|
|
158
|
+
if (current?.status === "pending") {
|
|
159
|
+
if (current.triggers.includes(trigger))
|
|
160
|
+
return false;
|
|
161
|
+
const next = {
|
|
162
|
+
...current,
|
|
163
|
+
revision: current.revision + 1,
|
|
164
|
+
triggers: [...current.triggers, trigger],
|
|
165
|
+
updatedAt,
|
|
166
|
+
};
|
|
167
|
+
this.persistCurrentTurnCueState(next);
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
const next = {
|
|
171
|
+
version: 1,
|
|
172
|
+
revision: 1,
|
|
173
|
+
cueId: randomUUID(),
|
|
174
|
+
status: "pending",
|
|
175
|
+
triggers: [trigger],
|
|
176
|
+
createdAt: updatedAt,
|
|
177
|
+
updatedAt,
|
|
178
|
+
};
|
|
179
|
+
this.persistCurrentTurnCueState(next);
|
|
180
|
+
return true;
|
|
144
181
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
182
|
+
/**
|
|
183
|
+
* Preview one transient provider-only cue. Discarded/replanned previews do nothing; the accepted
|
|
184
|
+
* provider-plan commit closes exactly the captured cue id + revision.
|
|
185
|
+
*/
|
|
186
|
+
previewCurrentTurnCue() {
|
|
187
|
+
const current = this.getCurrentTurnCueState();
|
|
188
|
+
if (current?.status !== "pending" || !this.isAutomaticReflectionEnabled())
|
|
189
|
+
return undefined;
|
|
190
|
+
const cueId = current.cueId;
|
|
191
|
+
const revision = current.revision;
|
|
192
|
+
const message = {
|
|
193
|
+
role: "custom",
|
|
194
|
+
customType: CURRENT_TURN_REFLECTION_CUSTOM_TYPE,
|
|
195
|
+
content: `${CURRENT_TURN_REFLECTION_CUE}\n- Pending evidence classes: ${current.triggers.join(", ")}.`,
|
|
196
|
+
display: false,
|
|
197
|
+
details: {
|
|
198
|
+
version: 1,
|
|
199
|
+
scope: "root-current-turn",
|
|
200
|
+
automaticProviderRequests: 0,
|
|
201
|
+
cueId: current.cueId,
|
|
202
|
+
triggers: current.triggers,
|
|
203
|
+
},
|
|
204
|
+
timestamp: Date.now(),
|
|
205
|
+
};
|
|
206
|
+
const isCurrent = () => {
|
|
207
|
+
const latest = this.getCurrentTurnCueState();
|
|
208
|
+
return (this.isAutomaticReflectionEnabled() &&
|
|
209
|
+
latest?.status === "pending" &&
|
|
210
|
+
latest.cueId === cueId &&
|
|
211
|
+
latest.revision === revision);
|
|
212
|
+
};
|
|
213
|
+
return {
|
|
214
|
+
message,
|
|
215
|
+
isCurrent,
|
|
216
|
+
commit: () => {
|
|
217
|
+
if (!isCurrent())
|
|
218
|
+
throw new Error("Reflection cue changed before provider-plan commit");
|
|
219
|
+
const latest = this.getCurrentTurnCueState();
|
|
220
|
+
if (!latest)
|
|
221
|
+
throw new Error("Reflection cue disappeared before provider-plan commit");
|
|
222
|
+
const next = {
|
|
223
|
+
...latest,
|
|
224
|
+
revision: latest.revision + 1,
|
|
225
|
+
status: "consumed",
|
|
226
|
+
updatedAt: new Date().toISOString(),
|
|
227
|
+
};
|
|
228
|
+
this.persistCurrentTurnCueState(next);
|
|
229
|
+
},
|
|
230
|
+
};
|
|
150
231
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
232
|
+
/** Pure completed-turn projection used only by deterministic memory synchronization. */
|
|
233
|
+
analyzeCompletedTurn(messages) {
|
|
234
|
+
const settingsManager = this.deps.getSettingsManager();
|
|
235
|
+
const settings = resolveAutoLearnSettings(settingsManager.getAutonomySettings().mode, settingsManager.getAutoLearnSettings());
|
|
236
|
+
return analyzeReflectionTurn(messages, settings.complexTaskToolCalls);
|
|
154
237
|
}
|
|
155
238
|
/**
|
|
156
|
-
* Run an LLM completion fully ISOLATED from the main session
|
|
157
|
-
*
|
|
239
|
+
* Run an explicit LLM completion fully ISOLATED from the main session for bounded host-owned
|
|
240
|
+
* consumers. Automatic reflection never reaches this primitive.
|
|
158
241
|
*
|
|
159
242
|
* Isolation invariants (audited by codex): builds fresh context (no main history), defaults to no
|
|
160
243
|
* tools, and passes **no real `sessionId`** — only a deterministic SYNTHETIC cache-affinity key
|
|
@@ -163,8 +246,8 @@ export class ReflectionController {
|
|
|
163
246
|
* and applies a turn bound only when its owner explicitly supplies one. It cannot mutate `agent.state.messages`, append session entries, or touch the
|
|
164
247
|
* foreground tool registry. Mirrors `generateSummary()`'s one-shot mechanics otherwise.
|
|
165
248
|
*
|
|
166
|
-
* Returns the result even on an error/aborted stop reason
|
|
167
|
-
*
|
|
249
|
+
* Returns the result even on an error/aborted stop reason; the explicit caller decides whether to
|
|
250
|
+
* act, and a model-level error is returned rather than thrown.
|
|
168
251
|
*/
|
|
169
252
|
async runIsolatedCompletion(opts) {
|
|
170
253
|
if (opts.maxTurns !== undefined && (!Number.isSafeInteger(opts.maxTurns) || opts.maxTurns <= 0)) {
|
|
@@ -370,10 +453,10 @@ export class ReflectionController {
|
|
|
370
453
|
}
|
|
371
454
|
}
|
|
372
455
|
/**
|
|
373
|
-
*
|
|
374
|
-
*
|
|
375
|
-
* resulting
|
|
376
|
-
*
|
|
456
|
+
* Explicit compatibility/application seam for an owner-invoked structured reflection pass. This
|
|
457
|
+
* method can make an isolated provider request, so automatic current-turn reflection never calls
|
|
458
|
+
* it. Demand-gates (zero-I/O), applies resulting writes through the bundled `memory` tool, and
|
|
459
|
+
* accounts the explicitly requested pass through the spawned-usage surface.
|
|
377
460
|
*
|
|
378
461
|
* Returns `null` when the gate skips (or in a child session, which must not learn). The whole pass
|
|
379
462
|
* is best-effort: a model/parse error yields no writes, never throws into the caller.
|
|
@@ -795,7 +878,13 @@ export class ReflectionController {
|
|
|
795
878
|
_checkSkillPromotionOverlap(write) {
|
|
796
879
|
try {
|
|
797
880
|
const cwd = this.deps.getCwd?.() ?? process.cwd();
|
|
798
|
-
const audit = runSkillAudit(cwd, write);
|
|
881
|
+
const audit = runSkillAudit(cwd, write, this.deps.getSkillsForAudit?.(), undefined, DEFAULT_BOUNDED_SKILL_AUDIT_LIMITS);
|
|
882
|
+
if (audit.truncated) {
|
|
883
|
+
return {
|
|
884
|
+
reasonCode: SKILL_AUDIT_UNAVAILABLE_REASON_CODE,
|
|
885
|
+
note: "skill overlap audit exceeded its bounded universe; promotion held rather than written unaudited",
|
|
886
|
+
};
|
|
887
|
+
}
|
|
799
888
|
const overlap = audit.nearDuplicates.find((d) => d.a === "[draft]" || d.b === "[draft]");
|
|
800
889
|
if (!overlap)
|
|
801
890
|
return undefined;
|