@caupulican/pi-adaptative 0.81.39 → 0.81.41
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 +77 -0
- package/README.md +2 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.d.ts +2 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.d.ts.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js +3 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.ts +4 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.d.ts +9 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.d.ts.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.js +290 -107
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.js.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.ts +357 -122
- package/dist/bundled-resources/skills/tool-call-repair/references/repair-catalogue.md +2 -2
- package/dist/cli/args.d.ts +4 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +31 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/core/agent-directory-layout.d.ts +15 -0
- package/dist/core/agent-directory-layout.d.ts.map +1 -0
- package/dist/core/agent-directory-layout.js +72 -0
- package/dist/core/agent-directory-layout.js.map +1 -0
- package/dist/core/agent-paths.d.ts +25 -2
- package/dist/core/agent-paths.d.ts.map +1 -1
- package/dist/core/agent-paths.js +79 -4
- package/dist/core/agent-paths.js.map +1 -1
- package/dist/core/agent-session-contracts.d.ts +293 -0
- package/dist/core/agent-session-contracts.d.ts.map +1 -0
- package/dist/core/agent-session-contracts.js +26 -0
- package/dist/core/agent-session-contracts.js.map +1 -0
- package/dist/core/agent-session-runtime.d.ts +52 -8
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +400 -79
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +1 -0
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +1 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +74 -518
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +370 -1432
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +3 -1
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/autonomy/approval-gate.d.ts +3 -2
- package/dist/core/autonomy/approval-gate.d.ts.map +1 -1
- package/dist/core/autonomy/approval-gate.js +6 -28
- package/dist/core/autonomy/approval-gate.js.map +1 -1
- package/dist/core/autonomy/bounded-completion.d.ts +1 -1
- package/dist/core/autonomy/bounded-completion.d.ts.map +1 -1
- package/dist/core/autonomy/bounded-completion.js +1 -1
- package/dist/core/autonomy/bounded-completion.js.map +1 -1
- package/dist/core/autonomy/contracts.d.ts +20 -12
- package/dist/core/autonomy/contracts.d.ts.map +1 -1
- package/dist/core/autonomy/contracts.js.map +1 -1
- package/dist/core/autonomy/foreground-envelope.d.ts +8 -2
- package/dist/core/autonomy/foreground-envelope.d.ts.map +1 -1
- package/dist/core/autonomy/foreground-envelope.js +8 -25
- package/dist/core/autonomy/foreground-envelope.js.map +1 -1
- package/dist/core/autonomy/gates.d.ts.map +1 -1
- package/dist/core/autonomy/gates.js +8 -10
- package/dist/core/autonomy/gates.js.map +1 -1
- package/dist/core/autonomy/lane-private-paths.d.ts +2 -0
- package/dist/core/autonomy/lane-private-paths.d.ts.map +1 -0
- package/dist/core/autonomy/lane-private-paths.js +16 -0
- package/dist/core/autonomy/lane-private-paths.js.map +1 -0
- package/dist/core/autonomy/lane-tool-surface.d.ts +10 -0
- package/dist/core/autonomy/lane-tool-surface.d.ts.map +1 -1
- package/dist/core/autonomy/lane-tool-surface.js +48 -9
- package/dist/core/autonomy/lane-tool-surface.js.map +1 -1
- package/dist/core/autonomy/lane-tracker.d.ts +14 -0
- package/dist/core/autonomy/lane-tracker.d.ts.map +1 -1
- package/dist/core/autonomy/lane-tracker.js +38 -0
- package/dist/core/autonomy/lane-tracker.js.map +1 -1
- package/dist/core/autonomy/risk-assessment.d.ts +1 -2
- package/dist/core/autonomy/risk-assessment.d.ts.map +1 -1
- package/dist/core/autonomy/risk-assessment.js +1 -123
- package/dist/core/autonomy/risk-assessment.js.map +1 -1
- package/dist/core/autonomy/session-lane-record.d.ts +4 -4
- package/dist/core/autonomy/session-lane-record.d.ts.map +1 -1
- package/dist/core/autonomy/session-lane-record.js +16 -29
- package/dist/core/autonomy/session-lane-record.js.map +1 -1
- package/dist/core/autonomy/telemetry-events.d.ts +1 -1
- package/dist/core/autonomy/telemetry-events.d.ts.map +1 -1
- package/dist/core/autonomy/telemetry-events.js +1 -1
- package/dist/core/autonomy/telemetry-events.js.map +1 -1
- package/dist/core/autonomy-telemetry.d.ts +7 -7
- package/dist/core/autonomy-telemetry.d.ts.map +1 -1
- package/dist/core/autonomy-telemetry.js +9 -9
- package/dist/core/autonomy-telemetry.js.map +1 -1
- package/dist/core/background-lane-controller.d.ts +56 -236
- package/dist/core/background-lane-controller.d.ts.map +1 -1
- package/dist/core/background-lane-controller.js +141 -1273
- package/dist/core/background-lane-controller.js.map +1 -1
- package/dist/core/bedrock-sso-login.d.ts +16 -0
- package/dist/core/bedrock-sso-login.d.ts.map +1 -0
- package/dist/core/bedrock-sso-login.js +98 -0
- package/dist/core/bedrock-sso-login.js.map +1 -0
- package/dist/core/capability-contract.d.ts +4 -0
- package/dist/core/capability-contract.d.ts.map +1 -0
- package/dist/core/capability-contract.js +28 -0
- package/dist/core/capability-contract.js.map +1 -0
- package/dist/core/compaction-controller.d.ts +90 -0
- package/dist/core/compaction-controller.d.ts.map +1 -0
- package/dist/core/compaction-controller.js +452 -0
- package/dist/core/compaction-controller.js.map +1 -0
- package/dist/core/compaction-support.d.ts +13 -17
- package/dist/core/compaction-support.d.ts.map +1 -1
- package/dist/core/compaction-support.js +3 -3
- package/dist/core/compaction-support.js.map +1 -1
- package/dist/core/context/context-artifacts.d.ts +6 -2
- package/dist/core/context/context-artifacts.d.ts.map +1 -1
- package/dist/core/context/context-artifacts.js +34 -2
- package/dist/core/context/context-artifacts.js.map +1 -1
- package/dist/core/context/context-store-retention.d.ts +8 -2
- package/dist/core/context/context-store-retention.d.ts.map +1 -1
- package/dist/core/context/context-store-retention.js +158 -35
- package/dist/core/context/context-store-retention.js.map +1 -1
- package/dist/core/context/okf-memory.d.ts.map +1 -1
- package/dist/core/context/okf-memory.js +9 -11
- package/dist/core/context/okf-memory.js.map +1 -1
- package/dist/core/context/sqlite-runtime-index.d.ts.map +1 -1
- package/dist/core/context/sqlite-runtime-index.js +6 -8
- package/dist/core/context/sqlite-runtime-index.js.map +1 -1
- package/dist/core/context-gc.d.ts +3 -0
- package/dist/core/context-gc.d.ts.map +1 -1
- package/dist/core/context-gc.js +10 -5
- package/dist/core/context-gc.js.map +1 -1
- package/dist/core/context-pipeline.d.ts +1 -1
- package/dist/core/context-pipeline.d.ts.map +1 -1
- package/dist/core/context-pipeline.js +16 -37
- package/dist/core/context-pipeline.js.map +1 -1
- package/dist/core/cost/cost-summary.d.ts.map +1 -1
- package/dist/core/cost/cost-summary.js +5 -3
- package/dist/core/cost/cost-summary.js.map +1 -1
- package/dist/core/cost/daily-usage.d.ts.map +1 -1
- package/dist/core/cost/daily-usage.js +4 -5
- package/dist/core/cost/daily-usage.js.map +1 -1
- package/dist/core/default-tool-surface.d.ts.map +1 -1
- package/dist/core/default-tool-surface.js +2 -0
- package/dist/core/default-tool-surface.js.map +1 -1
- package/dist/core/delegation/managed-lane-controller.d.ts +34 -0
- package/dist/core/delegation/managed-lane-controller.d.ts.map +1 -0
- package/dist/core/delegation/managed-lane-controller.js +217 -0
- package/dist/core/delegation/managed-lane-controller.js.map +1 -0
- package/dist/core/delegation/session-worker-claim.d.ts +44 -0
- package/dist/core/delegation/session-worker-claim.d.ts.map +1 -0
- package/dist/core/delegation/session-worker-claim.js +98 -0
- package/dist/core/delegation/session-worker-claim.js.map +1 -0
- package/dist/core/delegation/worker-actions.d.ts +7 -5
- package/dist/core/delegation/worker-actions.d.ts.map +1 -1
- package/dist/core/delegation/worker-actions.js +20 -4
- package/dist/core/delegation/worker-actions.js.map +1 -1
- package/dist/core/delegation/{worker-result.d.ts → worker-claim.d.ts} +13 -13
- package/dist/core/delegation/worker-claim.d.ts.map +1 -0
- package/dist/core/delegation/{worker-result.js → worker-claim.js} +61 -51
- package/dist/core/delegation/worker-claim.js.map +1 -0
- package/dist/core/delegation/worker-delegation-controller.d.ts +110 -0
- package/dist/core/delegation/worker-delegation-controller.d.ts.map +1 -0
- package/dist/core/delegation/worker-delegation-controller.js +861 -0
- package/dist/core/delegation/worker-delegation-controller.js.map +1 -0
- package/dist/core/delegation/worker-delegation-request.d.ts +11 -0
- package/dist/core/delegation/worker-delegation-request.d.ts.map +1 -0
- package/dist/core/delegation/worker-delegation-request.js +2 -0
- package/dist/core/delegation/worker-delegation-request.js.map +1 -0
- package/dist/core/delegation/worker-dispatch-scheduler.d.ts +40 -0
- package/dist/core/delegation/worker-dispatch-scheduler.d.ts.map +1 -0
- package/dist/core/delegation/worker-dispatch-scheduler.js +93 -0
- package/dist/core/delegation/worker-dispatch-scheduler.js.map +1 -0
- package/dist/core/delegation/worker-execution-policy.d.ts +62 -0
- package/dist/core/delegation/worker-execution-policy.d.ts.map +1 -0
- package/dist/core/delegation/worker-execution-policy.js +160 -0
- package/dist/core/delegation/worker-execution-policy.js.map +1 -0
- package/dist/core/delegation/worker-lane-projection.d.ts +14 -0
- package/dist/core/delegation/worker-lane-projection.d.ts.map +1 -0
- package/dist/core/delegation/worker-lane-projection.js +100 -0
- package/dist/core/delegation/worker-lane-projection.js.map +1 -0
- package/dist/core/delegation/worker-lifecycle.d.ts +97 -0
- package/dist/core/delegation/worker-lifecycle.d.ts.map +1 -0
- package/dist/core/delegation/worker-lifecycle.js +339 -0
- package/dist/core/delegation/worker-lifecycle.js.map +1 -0
- package/dist/core/delegation/worker-notification-coordinator.d.ts +36 -0
- package/dist/core/delegation/worker-notification-coordinator.d.ts.map +1 -0
- package/dist/core/delegation/worker-notification-coordinator.js +90 -0
- package/dist/core/delegation/worker-notification-coordinator.js.map +1 -0
- package/dist/core/delegation/worker-profile-resolver.d.ts +55 -0
- package/dist/core/delegation/worker-profile-resolver.d.ts.map +1 -0
- package/dist/core/delegation/worker-profile-resolver.js +113 -0
- package/dist/core/delegation/worker-profile-resolver.js.map +1 -0
- package/dist/core/delegation/worker-runner.d.ts +25 -14
- package/dist/core/delegation/worker-runner.d.ts.map +1 -1
- package/dist/core/delegation/worker-runner.js +122 -53
- package/dist/core/delegation/worker-runner.js.map +1 -1
- package/dist/core/delegation/worker-task-label.d.ts +3 -0
- package/dist/core/delegation/worker-task-label.d.ts.map +1 -0
- package/dist/core/delegation/worker-task-label.js +11 -0
- package/dist/core/delegation/worker-task-label.js.map +1 -0
- package/dist/core/doctor.d.ts +8 -0
- package/dist/core/doctor.d.ts.map +1 -1
- package/dist/core/doctor.js +32 -1
- package/dist/core/doctor.js.map +1 -1
- package/dist/core/extension-import-authority.d.ts +6 -0
- package/dist/core/extension-import-authority.d.ts.map +1 -0
- package/dist/core/extension-import-authority.js +10 -0
- package/dist/core/extension-import-authority.js.map +1 -0
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts +5 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +52 -18
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +3 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +20 -5
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/stale-context.d.ts +2 -0
- package/dist/core/extensions/stale-context.d.ts.map +1 -0
- package/dist/core/extensions/stale-context.js +2 -0
- package/dist/core/extensions/stale-context.js.map +1 -0
- package/dist/core/extensions/storage.d.ts +8 -0
- package/dist/core/extensions/storage.d.ts.map +1 -0
- package/dist/core/extensions/storage.js +28 -0
- package/dist/core/extensions/storage.js.map +1 -0
- package/dist/core/extensions/types.d.ts +78 -21
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/failure-corpus.d.ts +1 -15
- package/dist/core/failure-corpus.d.ts.map +1 -1
- package/dist/core/failure-corpus.js +9 -37
- package/dist/core/failure-corpus.js.map +1 -1
- package/dist/core/foreground-recovery-controller.d.ts +53 -0
- package/dist/core/foreground-recovery-controller.d.ts.map +1 -0
- package/dist/core/foreground-recovery-controller.js +111 -0
- package/dist/core/foreground-recovery-controller.js.map +1 -0
- package/dist/core/gateways/channel-provider.d.ts +3 -0
- package/dist/core/gateways/channel-provider.d.ts.map +1 -1
- package/dist/core/gateways/channel-provider.js +31 -6
- package/dist/core/gateways/channel-provider.js.map +1 -1
- package/dist/core/goal-loop-controller.d.ts +14 -9
- package/dist/core/goal-loop-controller.d.ts.map +1 -1
- package/dist/core/goal-loop-controller.js +47 -75
- package/dist/core/goal-loop-controller.js.map +1 -1
- package/dist/core/goals/compact-goal-context.d.ts +11 -0
- package/dist/core/goals/compact-goal-context.d.ts.map +1 -0
- package/dist/core/goals/compact-goal-context.js +59 -0
- package/dist/core/goals/compact-goal-context.js.map +1 -0
- package/dist/core/goals/goal-acceptance.d.ts +11 -0
- package/dist/core/goals/goal-acceptance.d.ts.map +1 -0
- package/dist/core/goals/goal-acceptance.js +27 -0
- package/dist/core/goals/goal-acceptance.js.map +1 -0
- package/dist/core/goals/goal-auto-continue-controller.d.ts +28 -0
- package/dist/core/goals/goal-auto-continue-controller.d.ts.map +1 -0
- package/dist/core/goals/goal-auto-continue-controller.js +90 -0
- package/dist/core/goals/goal-auto-continue-controller.js.map +1 -0
- package/dist/core/goals/goal-continuation-controller.d.ts +2 -2
- package/dist/core/goals/goal-continuation-controller.d.ts.map +1 -1
- package/dist/core/goals/goal-continuation-controller.js +52 -11
- package/dist/core/goals/goal-continuation-controller.js.map +1 -1
- package/dist/core/goals/goal-continuation-defaults.d.ts +4 -29
- package/dist/core/goals/goal-continuation-defaults.d.ts.map +1 -1
- package/dist/core/goals/goal-continuation-defaults.js +4 -32
- package/dist/core/goals/goal-continuation-defaults.js.map +1 -1
- package/dist/core/goals/goal-continuation-prompt.d.ts +8 -18
- package/dist/core/goals/goal-continuation-prompt.d.ts.map +1 -1
- package/dist/core/goals/goal-continuation-prompt.js +9 -179
- package/dist/core/goals/goal-continuation-prompt.js.map +1 -1
- package/dist/core/goals/goal-lifecycle.d.ts +43 -0
- package/dist/core/goals/goal-lifecycle.d.ts.map +1 -0
- package/dist/core/goals/goal-lifecycle.js +102 -0
- package/dist/core/goals/goal-lifecycle.js.map +1 -0
- package/dist/core/goals/goal-record.d.ts +17 -0
- package/dist/core/goals/goal-record.d.ts.map +1 -0
- package/dist/core/goals/goal-record.js +31 -0
- package/dist/core/goals/goal-record.js.map +1 -0
- package/dist/core/goals/goal-runtime-snapshot.d.ts +11 -9
- package/dist/core/goals/goal-runtime-snapshot.d.ts.map +1 -1
- package/dist/core/goals/goal-runtime-snapshot.js +10 -8
- package/dist/core/goals/goal-runtime-snapshot.js.map +1 -1
- package/dist/core/goals/goal-session-controller.d.ts +42 -0
- package/dist/core/goals/goal-session-controller.d.ts.map +1 -0
- package/dist/core/goals/goal-session-controller.js +128 -0
- package/dist/core/goals/goal-session-controller.js.map +1 -0
- package/dist/core/goals/goal-state.d.ts +46 -25
- package/dist/core/goals/goal-state.d.ts.map +1 -1
- package/dist/core/goals/goal-state.js +91 -24
- package/dist/core/goals/goal-state.js.map +1 -1
- package/dist/core/goals/goal-tool-core.d.ts +9 -10
- package/dist/core/goals/goal-tool-core.d.ts.map +1 -1
- package/dist/core/goals/goal-tool-core.js +60 -75
- package/dist/core/goals/goal-tool-core.js.map +1 -1
- package/dist/core/goals/session-goal-state.d.ts +20 -12
- package/dist/core/goals/session-goal-state.d.ts.map +1 -1
- package/dist/core/goals/session-goal-state.js +133 -33
- package/dist/core/goals/session-goal-state.js.map +1 -1
- package/dist/core/human-input-controller.d.ts +47 -0
- package/dist/core/human-input-controller.d.ts.map +1 -0
- package/dist/core/human-input-controller.js +181 -0
- package/dist/core/human-input-controller.js.map +1 -0
- package/dist/core/human-input.d.ts +100 -0
- package/dist/core/human-input.d.ts.map +1 -0
- package/dist/core/human-input.js +362 -0
- package/dist/core/human-input.js.map +1 -0
- package/dist/core/index.d.ts +9 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +9 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/{telemetry.d.ts → install-telemetry.d.ts} +1 -1
- package/dist/core/install-telemetry.d.ts.map +1 -0
- package/dist/core/{telemetry.js → install-telemetry.js} +1 -1
- package/dist/core/install-telemetry.js.map +1 -0
- package/dist/core/keybindings.d.ts +17 -1
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +24 -6
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/learning/learning-audit.d.ts +2 -4
- package/dist/core/learning/learning-audit.d.ts.map +1 -1
- package/dist/core/learning/learning-audit.js +9 -29
- package/dist/core/learning/learning-audit.js.map +1 -1
- package/dist/core/learning/learning-gate.d.ts.map +1 -1
- package/dist/core/learning/learning-gate.js +1 -6
- package/dist/core/learning/learning-gate.js.map +1 -1
- package/dist/core/learning/session-learning-decision.d.ts +2 -4
- package/dist/core/learning/session-learning-decision.d.ts.map +1 -1
- package/dist/core/learning/session-learning-decision.js +9 -29
- package/dist/core/learning/session-learning-decision.js.map +1 -1
- package/dist/core/local-runtime-controller.d.ts +1 -1
- package/dist/core/local-runtime-controller.d.ts.map +1 -1
- package/dist/core/local-runtime-controller.js.map +1 -1
- package/dist/core/memory-controller.d.ts.map +1 -1
- package/dist/core/memory-controller.js +4 -4
- package/dist/core/memory-controller.js.map +1 -1
- package/dist/core/model-capability.d.ts +0 -19
- package/dist/core/model-capability.d.ts.map +1 -1
- package/dist/core/model-capability.js +1 -19
- package/dist/core/model-capability.js.map +1 -1
- package/dist/core/model-registry.d.ts +6 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +13 -5
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts +17 -2
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +38 -25
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-router/intent-classifier.d.ts +1 -4
- package/dist/core/model-router/intent-classifier.d.ts.map +1 -1
- package/dist/core/model-router/intent-classifier.js +1 -156
- package/dist/core/model-router/intent-classifier.js.map +1 -1
- package/dist/core/model-router-controller.d.ts +1 -1
- package/dist/core/model-router-controller.d.ts.map +1 -1
- package/dist/core/model-router-controller.js +2 -2
- package/dist/core/model-router-controller.js.map +1 -1
- package/dist/core/model-selection-controller.d.ts +5 -5
- package/dist/core/model-selection-controller.d.ts.map +1 -1
- package/dist/core/model-selection-controller.js.map +1 -1
- package/dist/core/model-tool-protocol.d.ts +23 -0
- package/dist/core/model-tool-protocol.d.ts.map +1 -0
- package/dist/core/model-tool-protocol.js +43 -0
- package/dist/core/model-tool-protocol.js.map +1 -0
- package/dist/core/models/adaptation-store.d.ts +4 -6
- package/dist/core/models/adaptation-store.d.ts.map +1 -1
- package/dist/core/models/adaptation-store.js +95 -83
- package/dist/core/models/adaptation-store.js.map +1 -1
- package/dist/core/models/fitness-store.d.ts +2 -12
- package/dist/core/models/fitness-store.d.ts.map +1 -1
- package/dist/core/models/fitness-store.js +84 -57
- package/dist/core/models/fitness-store.js.map +1 -1
- package/dist/core/models/host-state-store.d.ts +34 -0
- package/dist/core/models/host-state-store.d.ts.map +1 -0
- package/dist/core/models/host-state-store.js +86 -0
- package/dist/core/models/host-state-store.js.map +1 -0
- package/dist/core/orchestration/agent-resume.d.ts +24 -0
- package/dist/core/orchestration/agent-resume.d.ts.map +1 -0
- package/dist/core/orchestration/agent-resume.js +90 -0
- package/dist/core/orchestration/agent-resume.js.map +1 -0
- package/dist/core/orchestration/capability-gateway.d.ts +61 -0
- package/dist/core/orchestration/capability-gateway.d.ts.map +1 -0
- package/dist/core/orchestration/capability-gateway.js +152 -0
- package/dist/core/orchestration/capability-gateway.js.map +1 -0
- package/dist/core/orchestration/contracts.d.ts +343 -0
- package/dist/core/orchestration/contracts.d.ts.map +1 -0
- package/dist/core/orchestration/contracts.js +135 -0
- package/dist/core/orchestration/contracts.js.map +1 -0
- package/dist/core/orchestration/delegation-ledger.d.ts +56 -0
- package/dist/core/orchestration/delegation-ledger.d.ts.map +1 -0
- package/dist/core/orchestration/delegation-ledger.js +200 -0
- package/dist/core/orchestration/delegation-ledger.js.map +1 -0
- package/dist/core/orchestration/event-store.d.ts +83 -0
- package/dist/core/orchestration/event-store.d.ts.map +1 -0
- package/dist/core/orchestration/event-store.js +560 -0
- package/dist/core/orchestration/event-store.js.map +1 -0
- package/dist/core/orchestration/lane-tool-manifests.d.ts +9 -0
- package/dist/core/orchestration/lane-tool-manifests.d.ts.map +1 -0
- package/dist/core/orchestration/lane-tool-manifests.js +37 -0
- package/dist/core/orchestration/lane-tool-manifests.js.map +1 -0
- package/dist/core/orchestration/model-binding.d.ts +15 -0
- package/dist/core/orchestration/model-binding.d.ts.map +1 -0
- package/dist/core/orchestration/model-binding.js +29 -0
- package/dist/core/orchestration/model-binding.js.map +1 -0
- package/dist/core/orchestration/policy-compiler.d.ts +49 -0
- package/dist/core/orchestration/policy-compiler.d.ts.map +1 -0
- package/dist/core/orchestration/policy-compiler.js +191 -0
- package/dist/core/orchestration/policy-compiler.js.map +1 -0
- package/dist/core/orchestration/policy-gate.d.ts +18 -0
- package/dist/core/orchestration/policy-gate.d.ts.map +1 -0
- package/dist/core/orchestration/policy-gate.js +24 -0
- package/dist/core/orchestration/policy-gate.js.map +1 -0
- package/dist/core/orchestration/profile-registry.d.ts +51 -0
- package/dist/core/orchestration/profile-registry.d.ts.map +1 -0
- package/dist/core/orchestration/profile-registry.js +393 -0
- package/dist/core/orchestration/profile-registry.js.map +1 -0
- package/dist/core/orchestration/profile-store.d.ts +31 -0
- package/dist/core/orchestration/profile-store.d.ts.map +1 -0
- package/dist/core/orchestration/profile-store.js +136 -0
- package/dist/core/orchestration/profile-store.js.map +1 -0
- package/dist/core/orchestration/risk-budget.d.ts +9 -0
- package/dist/core/orchestration/risk-budget.d.ts.map +1 -0
- package/dist/core/orchestration/risk-budget.js +48 -0
- package/dist/core/orchestration/risk-budget.js.map +1 -0
- package/dist/core/orchestration/task-runtime.d.ts +168 -0
- package/dist/core/orchestration/task-runtime.d.ts.map +1 -0
- package/dist/core/orchestration/task-runtime.js +1600 -0
- package/dist/core/orchestration/task-runtime.js.map +1 -0
- package/dist/core/orchestration/work-state-projection.d.ts +32 -0
- package/dist/core/orchestration/work-state-projection.d.ts.map +1 -0
- package/dist/core/orchestration/work-state-projection.js +116 -0
- package/dist/core/orchestration/work-state-projection.js.map +1 -0
- package/dist/core/orchestration/worker-execution-contract.d.ts +21 -0
- package/dist/core/orchestration/worker-execution-contract.d.ts.map +1 -0
- package/dist/core/orchestration/worker-execution-contract.js +179 -0
- package/dist/core/orchestration/worker-execution-contract.js.map +1 -0
- package/dist/core/orchestration/worker-result-adapter.d.ts +21 -0
- package/dist/core/orchestration/worker-result-adapter.d.ts.map +1 -0
- package/dist/core/orchestration/worker-result-adapter.js +109 -0
- package/dist/core/orchestration/worker-result-adapter.js.map +1 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +20 -3
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/process-identity.d.ts +11 -0
- package/dist/core/process-identity.d.ts.map +1 -0
- package/dist/core/process-identity.js +26 -0
- package/dist/core/process-identity.js.map +1 -0
- package/dist/core/process-matrix/codes.d.ts +14 -3
- package/dist/core/process-matrix/codes.d.ts.map +1 -1
- package/dist/core/process-matrix/codes.js.map +1 -1
- package/dist/core/process-matrix/resume-launcher.d.ts +26 -0
- package/dist/core/process-matrix/resume-launcher.d.ts.map +1 -0
- package/dist/core/process-matrix/resume-launcher.js +62 -0
- package/dist/core/process-matrix/resume-launcher.js.map +1 -0
- package/dist/core/process-matrix/runtime.d.ts +37 -22
- package/dist/core/process-matrix/runtime.d.ts.map +1 -1
- package/dist/core/process-matrix/runtime.js +399 -76
- package/dist/core/process-matrix/runtime.js.map +1 -1
- package/dist/core/process-matrix/store.d.ts +5 -2
- package/dist/core/process-matrix/store.d.ts.map +1 -1
- package/dist/core/process-matrix/store.js +123 -14
- package/dist/core/process-matrix/store.js.map +1 -1
- package/dist/core/process-matrix/supervisor.d.ts +10 -7
- package/dist/core/process-matrix/supervisor.d.ts.map +1 -1
- package/dist/core/process-matrix/supervisor.js +45 -14
- package/dist/core/process-matrix/supervisor.js.map +1 -1
- package/dist/core/profile-filter-controller.d.ts +8 -1
- package/dist/core/profile-filter-controller.d.ts.map +1 -1
- package/dist/core/profile-filter-controller.js +23 -5
- package/dist/core/profile-filter-controller.js.map +1 -1
- package/dist/core/profile-registry.d.ts.map +1 -1
- package/dist/core/profile-registry.js +6 -8
- package/dist/core/profile-registry.js.map +1 -1
- package/dist/core/prompt-templates.d.ts +1 -0
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +18 -29
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/reflection-controller.d.ts +5 -5
- package/dist/core/reflection-controller.d.ts.map +1 -1
- package/dist/core/reflection-controller.js +5 -2
- package/dist/core/reflection-controller.js.map +1 -1
- package/dist/core/reload-blockers.d.ts.map +1 -1
- package/dist/core/reload-blockers.js +6 -8
- package/dist/core/reload-blockers.js.map +1 -1
- package/dist/core/request-auth.d.ts +7 -0
- package/dist/core/request-auth.d.ts.map +1 -0
- package/dist/core/request-auth.js +8 -0
- package/dist/core/request-auth.js.map +1 -0
- package/dist/core/research/evidence-bundle.d.ts.map +1 -1
- package/dist/core/research/evidence-bundle.js +1 -6
- package/dist/core/research/evidence-bundle.js.map +1 -1
- package/dist/core/research/lane-model-resolver.d.ts +33 -0
- package/dist/core/research/lane-model-resolver.d.ts.map +1 -0
- package/dist/core/research/lane-model-resolver.js +65 -0
- package/dist/core/research/lane-model-resolver.js.map +1 -0
- package/dist/core/research/model-fitness-controller.d.ts +38 -0
- package/dist/core/research/model-fitness-controller.d.ts.map +1 -0
- package/dist/core/research/model-fitness-controller.js +106 -0
- package/dist/core/research/model-fitness-controller.js.map +1 -0
- package/dist/core/research/model-fitness.d.ts +1 -1
- package/dist/core/research/model-fitness.d.ts.map +1 -1
- package/dist/core/research/model-fitness.js +4 -4
- package/dist/core/research/model-fitness.js.map +1 -1
- package/dist/core/research/research-gate.d.ts.map +1 -1
- package/dist/core/research/research-gate.js +7 -7
- package/dist/core/research/research-gate.js.map +1 -1
- package/dist/core/research/research-lane-controller.d.ts +62 -0
- package/dist/core/research/research-lane-controller.d.ts.map +1 -0
- package/dist/core/research/research-lane-controller.js +292 -0
- package/dist/core/research/research-lane-controller.js.map +1 -0
- package/dist/core/research/session-evidence-bundle.d.ts +2 -4
- package/dist/core/research/session-evidence-bundle.d.ts.map +1 -1
- package/dist/core/research/session-evidence-bundle.js +10 -46
- package/dist/core/research/session-evidence-bundle.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +23 -8
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/risk-classifier.d.ts +6 -0
- package/dist/core/risk-classifier.d.ts.map +1 -0
- package/dist/core/risk-classifier.js +233 -0
- package/dist/core/risk-classifier.js.map +1 -0
- package/dist/core/runtime-builder.d.ts +41 -23
- package/dist/core/runtime-builder.d.ts.map +1 -1
- package/dist/core/runtime-builder.js +365 -253
- package/dist/core/runtime-builder.js.map +1 -1
- package/dist/core/sdk.d.ts +6 -3
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +68 -25
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/secrets/credential-exposure-guard.d.ts +9 -0
- package/dist/core/secrets/credential-exposure-guard.d.ts.map +1 -0
- package/dist/core/secrets/credential-exposure-guard.js +241 -0
- package/dist/core/secrets/credential-exposure-guard.js.map +1 -0
- package/dist/core/secrets/secret-dotenv.d.ts +27 -0
- package/dist/core/secrets/secret-dotenv.d.ts.map +1 -0
- package/dist/core/secrets/secret-dotenv.js +183 -0
- package/dist/core/secrets/secret-dotenv.js.map +1 -0
- package/dist/core/secrets/secret-vault-format.d.ts +112 -0
- package/dist/core/secrets/secret-vault-format.d.ts.map +1 -0
- package/dist/core/secrets/secret-vault-format.js +397 -0
- package/dist/core/secrets/secret-vault-format.js.map +1 -0
- package/dist/core/secrets/secret-vault.d.ts +72 -0
- package/dist/core/secrets/secret-vault.d.ts.map +1 -0
- package/dist/core/secrets/secret-vault.js +671 -0
- package/dist/core/secrets/secret-vault.js.map +1 -0
- package/dist/core/session-analytics.d.ts +4 -23
- package/dist/core/session-analytics.d.ts.map +1 -1
- package/dist/core/session-analytics.js +67 -70
- package/dist/core/session-analytics.js.map +1 -1
- package/dist/core/session-image-store.d.ts +33 -0
- package/dist/core/session-image-store.d.ts.map +1 -0
- package/dist/core/session-image-store.js +283 -0
- package/dist/core/session-image-store.js.map +1 -0
- package/dist/core/session-role.d.ts +11 -4
- package/dist/core/session-role.d.ts.map +1 -1
- package/dist/core/session-role.js +24 -5
- package/dist/core/session-role.js.map +1 -1
- package/dist/core/session-snapshot.d.ts +34 -0
- package/dist/core/session-snapshot.d.ts.map +1 -0
- package/dist/core/session-snapshot.js +68 -0
- package/dist/core/session-snapshot.js.map +1 -0
- package/dist/core/session-supervision-runtime.d.ts +31 -0
- package/dist/core/session-supervision-runtime.d.ts.map +1 -0
- package/dist/core/session-supervision-runtime.js +97 -0
- package/dist/core/session-supervision-runtime.js.map +1 -0
- package/dist/core/session-tree-navigator.d.ts +4 -6
- package/dist/core/session-tree-navigator.d.ts.map +1 -1
- package/dist/core/session-tree-navigator.js +4 -1
- package/dist/core/session-tree-navigator.js.map +1 -1
- package/dist/core/settings-manager.d.ts +10 -5
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +81 -29
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +2 -2
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/tasks/session-task-state.d.ts +2 -4
- package/dist/core/tasks/session-task-state.d.ts.map +1 -1
- package/dist/core/tasks/session-task-state.js +10 -28
- package/dist/core/tasks/session-task-state.js.map +1 -1
- package/dist/core/tasks/task-projection.d.ts +20 -0
- package/dist/core/tasks/task-projection.d.ts.map +1 -0
- package/dist/core/tasks/task-projection.js +47 -0
- package/dist/core/tasks/task-projection.js.map +1 -0
- package/dist/core/tasks/task-state.d.ts +4 -0
- package/dist/core/tasks/task-state.d.ts.map +1 -1
- package/dist/core/tasks/task-state.js +28 -11
- package/dist/core/tasks/task-state.js.map +1 -1
- package/dist/core/tool-capability-policy.d.ts +13 -0
- package/dist/core/tool-capability-policy.d.ts.map +1 -0
- package/dist/core/tool-capability-policy.js +86 -0
- package/dist/core/tool-capability-policy.js.map +1 -0
- package/dist/core/tool-gate-controller.d.ts.map +1 -1
- package/dist/core/tool-gate-controller.js +8 -2
- package/dist/core/tool-gate-controller.js.map +1 -1
- package/dist/core/tool-protocol-controller.d.ts +89 -0
- package/dist/core/tool-protocol-controller.d.ts.map +1 -0
- package/dist/core/tool-protocol-controller.js +512 -0
- package/dist/core/tool-protocol-controller.js.map +1 -0
- package/dist/core/tool-recovery-log-records.d.ts +2 -3
- package/dist/core/tool-recovery-log-records.d.ts.map +1 -1
- package/dist/core/tool-recovery-log-records.js +9 -35
- package/dist/core/tool-recovery-log-records.js.map +1 -1
- package/dist/core/tool-recovery-stats.d.ts +21 -1
- package/dist/core/tool-recovery-stats.d.ts.map +1 -1
- package/dist/core/tool-recovery-stats.js.map +1 -1
- package/dist/core/tool-selection/tool-performance-store.d.ts +3 -7
- package/dist/core/tool-selection/tool-performance-store.d.ts.map +1 -1
- package/dist/core/tool-selection/tool-performance-store.js +97 -138
- package/dist/core/tool-selection/tool-performance-store.js.map +1 -1
- package/dist/core/tools/ask-question.d.ts +124 -0
- package/dist/core/tools/ask-question.d.ts.map +1 -0
- package/dist/core/tools/ask-question.js +693 -0
- package/dist/core/tools/ask-question.js.map +1 -0
- package/dist/core/tools/bash.d.ts +5 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +59 -5
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/delegate-status.d.ts +31 -3
- package/dist/core/tools/delegate-status.d.ts.map +1 -1
- package/dist/core/tools/delegate-status.js +148 -29
- package/dist/core/tools/delegate-status.js.map +1 -1
- package/dist/core/tools/delegate.d.ts +15 -13
- package/dist/core/tools/delegate.d.ts.map +1 -1
- package/dist/core/tools/delegate.js +106 -23
- package/dist/core/tools/delegate.js.map +1 -1
- package/dist/core/tools/extensionify.d.ts.map +1 -1
- package/dist/core/tools/extensionify.js +1 -0
- package/dist/core/tools/extensionify.js.map +1 -1
- package/dist/core/tools/git-filter.d.ts +1 -8
- package/dist/core/tools/git-filter.d.ts.map +1 -1
- package/dist/core/tools/git-filter.js +2 -63
- package/dist/core/tools/git-filter.js.map +1 -1
- package/dist/core/tools/goal.d.ts +10 -8
- package/dist/core/tools/goal.d.ts.map +1 -1
- package/dist/core/tools/goal.js +106 -28
- package/dist/core/tools/goal.js.map +1 -1
- package/dist/core/tools/index.d.ts +1 -0
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +1 -0
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/model-fitness.d.ts.map +1 -1
- package/dist/core/tools/model-fitness.js +2 -2
- package/dist/core/tools/model-fitness.js.map +1 -1
- package/dist/core/tools/orchestration-panel.d.ts +40 -0
- package/dist/core/tools/orchestration-panel.d.ts.map +1 -0
- package/dist/core/tools/orchestration-panel.js +124 -0
- package/dist/core/tools/orchestration-panel.js.map +1 -0
- package/dist/core/tools/output-accumulator.d.ts +11 -0
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +36 -3
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/python.d.ts +2 -0
- package/dist/core/tools/python.d.ts.map +1 -1
- package/dist/core/tools/python.js +3 -1
- package/dist/core/tools/python.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +1 -1
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/run-process.d.ts +26 -0
- package/dist/core/tools/run-process.d.ts.map +1 -0
- package/dist/core/tools/run-process.js +138 -0
- package/dist/core/tools/run-process.js.map +1 -0
- package/dist/core/tools/search-command-guard.d.ts +14 -0
- package/dist/core/tools/search-command-guard.d.ts.map +1 -0
- package/dist/core/tools/search-command-guard.js +333 -0
- package/dist/core/tools/search-command-guard.js.map +1 -0
- package/dist/core/tools/secret-store.d.ts +38 -0
- package/dist/core/tools/secret-store.d.ts.map +1 -0
- package/dist/core/tools/secret-store.js +412 -0
- package/dist/core/tools/secret-store.js.map +1 -0
- package/dist/core/tools/shell-command-parser.d.ts +16 -0
- package/dist/core/tools/shell-command-parser.d.ts.map +1 -0
- package/dist/core/tools/shell-command-parser.js +113 -0
- package/dist/core/tools/shell-command-parser.js.map +1 -0
- package/dist/core/tools/task-steps.d.ts +2 -0
- package/dist/core/tools/task-steps.d.ts.map +1 -1
- package/dist/core/tools/task-steps.js +99 -0
- package/dist/core/tools/task-steps.js.map +1 -1
- package/dist/core/tools/tmux-dispatch.d.ts +3 -5
- package/dist/core/tools/tmux-dispatch.d.ts.map +1 -1
- package/dist/core/tools/tmux-dispatch.js +4 -4
- package/dist/core/tools/tmux-dispatch.js.map +1 -1
- package/dist/core/tools/windows-shell-engine.d.ts.map +1 -1
- package/dist/core/tools/windows-shell-engine.js +4 -6
- package/dist/core/tools/windows-shell-engine.js.map +1 -1
- package/dist/core/util/atomic-file.d.ts +6 -2
- package/dist/core/util/atomic-file.d.ts.map +1 -1
- package/dist/core/util/atomic-file.js +4 -4
- package/dist/core/util/atomic-file.js.map +1 -1
- package/dist/core/util/bounded-jsonl.d.ts +10 -0
- package/dist/core/util/bounded-jsonl.d.ts.map +1 -0
- package/dist/core/util/bounded-jsonl.js +75 -0
- package/dist/core/util/bounded-jsonl.js.map +1 -0
- package/dist/core/util/value-guards.d.ts +5 -0
- package/dist/core/util/value-guards.d.ts.map +1 -0
- package/dist/core/util/value-guards.js +12 -0
- package/dist/core/util/value-guards.js.map +1 -0
- package/dist/core/worktree-sync/store.d.ts +3 -3
- package/dist/core/worktree-sync/store.d.ts.map +1 -1
- package/dist/core/worktree-sync/store.js +10 -5
- package/dist/core/worktree-sync/store.js.map +1 -1
- package/dist/index.d.ts +15 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +149 -51
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts +4 -6
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +186 -28
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/auth-dialogs-controller.d.ts +4 -0
- package/dist/modes/interactive/auth-dialogs-controller.d.ts.map +1 -1
- package/dist/modes/interactive/auth-dialogs-controller.js +60 -1
- package/dist/modes/interactive/auth-dialogs-controller.js.map +1 -1
- package/dist/modes/interactive/clipboard-input.d.ts +7 -1
- package/dist/modes/interactive/clipboard-input.d.ts.map +1 -1
- package/dist/modes/interactive/clipboard-input.js +44 -6
- package/dist/modes/interactive/clipboard-input.js.map +1 -1
- package/dist/modes/interactive/components/activity-lane.d.ts +55 -0
- package/dist/modes/interactive/components/activity-lane.d.ts.map +1 -0
- package/dist/modes/interactive/components/activity-lane.js +304 -0
- package/dist/modes/interactive/components/activity-lane.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +19 -10
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/expandable-text.d.ts +12 -0
- package/dist/modes/interactive/components/expandable-text.d.ts.map +1 -0
- package/dist/modes/interactive/components/expandable-text.js +17 -0
- package/dist/modes/interactive/components/expandable-text.js.map +1 -0
- package/dist/modes/interactive/components/extension-editor.d.ts +15 -1
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +30 -21
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-input.d.ts +1 -0
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-input.js +6 -1
- package/dist/modes/interactive/components/extension-input.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +2 -2
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +23 -14
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +6 -6
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +19 -11
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +53 -20
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tool-group.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-group.js +3 -0
- package/dist/modes/interactive/components/tool-group.js.map +1 -1
- package/dist/modes/interactive/components/usage-action-selector.d.ts +16 -0
- package/dist/modes/interactive/components/usage-action-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/usage-action-selector.js +46 -0
- package/dist/modes/interactive/components/usage-action-selector.js.map +1 -0
- package/dist/modes/interactive/config-backup.d.ts.map +1 -1
- package/dist/modes/interactive/config-backup.js +5 -4
- package/dist/modes/interactive/config-backup.js.map +1 -1
- package/dist/modes/interactive/extension-ui-host.d.ts +14 -0
- package/dist/modes/interactive/extension-ui-host.d.ts.map +1 -1
- package/dist/modes/interactive/extension-ui-host.js +77 -15
- package/dist/modes/interactive/extension-ui-host.js.map +1 -1
- package/dist/modes/interactive/external-editor.d.ts +15 -0
- package/dist/modes/interactive/external-editor.d.ts.map +1 -1
- package/dist/modes/interactive/external-editor.js +27 -19
- package/dist/modes/interactive/external-editor.js.map +1 -1
- package/dist/modes/interactive/history-reload-math.d.ts +6 -2
- package/dist/modes/interactive/history-reload-math.d.ts.map +1 -1
- package/dist/modes/interactive/history-reload-math.js +10 -5
- package/dist/modes/interactive/history-reload-math.js.map +1 -1
- package/dist/modes/interactive/interactive-event-controller.d.ts +74 -0
- package/dist/modes/interactive/interactive-event-controller.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-event-controller.js +328 -0
- package/dist/modes/interactive/interactive-event-controller.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +22 -24
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +245 -595
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/key-handlers.d.ts.map +1 -1
- package/dist/modes/interactive/key-handlers.js +1 -1
- package/dist/modes/interactive/key-handlers.js.map +1 -1
- package/dist/modes/interactive/loaded-resources-view.d.ts +20 -0
- package/dist/modes/interactive/loaded-resources-view.d.ts.map +1 -0
- package/dist/modes/interactive/loaded-resources-view.js +147 -0
- package/dist/modes/interactive/loaded-resources-view.js.map +1 -0
- package/dist/modes/interactive/profile-menu-controller.d.ts.map +1 -1
- package/dist/modes/interactive/profile-menu-controller.js +7 -7
- package/dist/modes/interactive/profile-menu-controller.js.map +1 -1
- package/dist/modes/interactive/report-commands.d.ts.map +1 -1
- package/dist/modes/interactive/report-commands.js +21 -0
- package/dist/modes/interactive/report-commands.js.map +1 -1
- package/dist/modes/interactive/resource-display.d.ts.map +1 -1
- package/dist/modes/interactive/resource-display.js +8 -2
- package/dist/modes/interactive/resource-display.js.map +1 -1
- package/dist/modes/interactive/resource-shell-commands.d.ts +1 -5
- package/dist/modes/interactive/resource-shell-commands.d.ts.map +1 -1
- package/dist/modes/interactive/resource-shell-commands.js +0 -5
- package/dist/modes/interactive/resource-shell-commands.js.map +1 -1
- package/dist/modes/interactive/session-flow-commands.d.ts +27 -8
- package/dist/modes/interactive/session-flow-commands.d.ts.map +1 -1
- package/dist/modes/interactive/session-flow-commands.js +150 -64
- package/dist/modes/interactive/session-flow-commands.js.map +1 -1
- package/dist/modes/interactive/session-io-commands.d.ts.map +1 -1
- package/dist/modes/interactive/session-io-commands.js +16 -6
- package/dist/modes/interactive/session-io-commands.js.map +1 -1
- package/dist/modes/interactive/session-replacement-errors.d.ts +7 -0
- package/dist/modes/interactive/session-replacement-errors.d.ts.map +1 -0
- package/dist/modes/interactive/session-replacement-errors.js +15 -0
- package/dist/modes/interactive/session-replacement-errors.js.map +1 -0
- package/dist/modes/interactive/startup-checks.d.ts.map +1 -1
- package/dist/modes/interactive/startup-checks.js +1 -1
- package/dist/modes/interactive/startup-checks.js.map +1 -1
- package/dist/modes/interactive/usage-commands.d.ts +34 -0
- package/dist/modes/interactive/usage-commands.d.ts.map +1 -0
- package/dist/modes/interactive/usage-commands.js +225 -0
- package/dist/modes/interactive/usage-commands.js.map +1 -0
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +82 -23
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +15 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js +138 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +2 -13
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard-native.d.ts +1 -0
- package/dist/utils/clipboard-native.d.ts.map +1 -1
- package/dist/utils/clipboard-native.js.map +1 -1
- package/dist/utils/clipboard.d.ts +1 -0
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +52 -1
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/platform.d.ts +3 -0
- package/dist/utils/platform.d.ts.map +1 -0
- package/dist/utils/platform.js +8 -0
- package/dist/utils/platform.js.map +1 -0
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +5 -3
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js +3 -1
- package/dist/utils/version-check.js.map +1 -1
- package/dist/utils/work-directory.d.ts +11 -0
- package/dist/utils/work-directory.d.ts.map +1 -1
- package/dist/utils/work-directory.js +30 -9
- package/dist/utils/work-directory.js.map +1 -1
- package/docs/UI_POLISH_ORCHESTRATION.md +38 -0
- package/docs/UI_QUALITY_ORCHESTRATION.md +28 -0
- package/docs/docs.json +4 -0
- package/docs/extensions.md +62 -2
- package/docs/harness-architecture.md +156 -0
- package/docs/keybindings.md +11 -1
- package/docs/process-matrix.md +59 -26
- package/docs/providers.md +9 -1
- package/docs/rpc.md +45 -2
- package/docs/sessions.md +15 -0
- package/docs/settings.md +125 -11
- package/docs/task-steps.md +8 -0
- package/docs/telemetry.md +19 -0
- package/docs/tmux-agent-manager.md +10 -3
- package/docs/ui-reference/README.md +9 -0
- package/docs/ui-reference/orchestration-after.txt +14 -0
- package/docs/ui-reference/orchestration-before.txt +13 -0
- package/docs/ui-reference/orchestration-reference.txt +16 -0
- package/docs/usage.md +22 -2
- package/docs/work-directory.md +19 -8
- 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/question.ts +34 -245
- package/examples/extensions/questionnaire.ts +41 -407
- 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 +13 -13
- package/package.json +4 -4
- package/dist/core/delegation/session-worker-result.d.ts +0 -46
- package/dist/core/delegation/session-worker-result.d.ts.map +0 -1
- package/dist/core/delegation/session-worker-result.js +0 -113
- package/dist/core/delegation/session-worker-result.js.map +0 -1
- package/dist/core/delegation/worker-result.d.ts.map +0 -1
- package/dist/core/delegation/worker-result.js.map +0 -1
- package/dist/core/telemetry.d.ts.map +0 -1
- package/dist/core/telemetry.js.map +0 -1
|
@@ -1,71 +1,149 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
|
+
import { emptyOrchestrationCall, OrchestrationPanelComponent, } from "./orchestration-panel.js";
|
|
2
3
|
function createDelegateSchema() {
|
|
3
4
|
return Type.Object({
|
|
5
|
+
profileId: Type.Optional(Type.String({
|
|
6
|
+
description: "Owner-authored orchestration profile to use. The profile fixes role, model, thinking, tools, resources, budget, and concurrency. Omit only when the owner configured a default workerDelegation.orchestrationProfile.",
|
|
7
|
+
})),
|
|
4
8
|
instructions: Type.String({
|
|
5
9
|
description: "The self-contained task for a bounded worker with classified workspace tools. It is read-only unless workerDelegation.writeEnabled, non-empty writePaths, and its lane profile all grant write/edit; any write is path-scoped and parent-reviewed. Include all context it needs; it cannot see this conversation.",
|
|
6
10
|
}),
|
|
7
|
-
systemPrompt: Type.Optional(Type.String({
|
|
8
|
-
description: "Optional replacement for the worker's role prompt — useful to hand a small model a minimal, purpose-built prompt. A short non-negotiable core (read-only, no invention, untrusted output, exact format) always remains.",
|
|
9
|
-
})),
|
|
10
|
-
memoryRead: Type.Optional(Type.Boolean({
|
|
11
|
-
description: "Request bounded read-only memory retrieval when it is relevant to the delegated task. The lane profile may still deny it; memory writes are never granted.",
|
|
12
|
-
})),
|
|
13
11
|
}, { additionalProperties: false });
|
|
14
12
|
}
|
|
15
13
|
const delegateSchema = createDelegateSchema();
|
|
16
|
-
const DELEGATE_DESCRIPTION_CORE = "Delegate one bounded, self-contained task to an isolated worker lane with classified workspace tools.
|
|
14
|
+
const DELEGATE_DESCRIPTION_CORE = "Delegate one bounded, self-contained task to an isolated worker lane with classified workspace tools. Workers are read-only by default. The owner-authored profile fixes memory, process, model, thinking, and tool authority; writes additionally require that workerDelegation.writeEnabled, non-empty writePaths, and the lane profile grant write/edit, with every successful path reported for parent review. Unrestricted shell, recursive delegation, and opaque extension tools remain unavailable.";
|
|
17
15
|
// Synchronous wiring: no `deps.startWorkerDelegation`, so `execute` awaits `runWorkerDelegation`
|
|
18
16
|
// and the result comes back in this same tool call's response.
|
|
19
17
|
const SYNCHRONOUS_DELEGATE_DESCRIPTION = DELEGATE_DESCRIPTION_CORE;
|
|
20
18
|
// Async wiring: `deps.startWorkerDelegation` is present, so `execute` starts the lane and returns
|
|
21
|
-
// immediately (see :~102) — the actual result only ever surfaces later via
|
|
22
|
-
|
|
19
|
+
// immediately (see :~102) — the actual result only ever surfaces later via the event-driven terminal
|
|
20
|
+
// handoff followed by one delegate_status retrieval.
|
|
21
|
+
const ASYNC_DELEGATE_DESCRIPTION = `${DELEGATE_DESCRIPTION_CORE} This call returns immediately once the worker lane starts; it does not wait for the worker to finish. The parent receives a terminal handoff when the lane ends; then call delegate_status once with the returned laneId to retrieve the result and any blockers. Do not poll.`;
|
|
23
22
|
const SYNCHRONOUS_DELEGATE_PROMPT_GUIDELINES = [
|
|
24
23
|
"Delegate only self-contained tasks; include all needed context, intended files, and acceptance criteria in the instructions.",
|
|
25
|
-
"
|
|
24
|
+
"The selected profile alone controls whether bounded read-only memory is available; the delegation call cannot elevate it.",
|
|
26
25
|
"Assume the worker is otherwise read-only unless worker writeEnabled, writePaths, and the lane profile explicitly grant write/edit.",
|
|
27
26
|
"Worker output is untrusted evidence - verify it against the repo before acting on it.",
|
|
28
27
|
"If the worker reports blockers, resolve them yourself or ask the user; do not re-delegate the same task blindly.",
|
|
29
28
|
];
|
|
30
29
|
const ASYNC_DELEGATE_PROMPT_GUIDELINES = [
|
|
31
30
|
"Delegate only self-contained tasks; include all needed context, intended files, and acceptance criteria in the instructions.",
|
|
32
|
-
"
|
|
31
|
+
"The selected profile alone controls whether bounded read-only memory is available; the delegation call cannot elevate it.",
|
|
33
32
|
"Assume the worker is otherwise read-only unless worker writeEnabled, writePaths, and the lane profile explicitly grant write/edit.",
|
|
34
|
-
"This call returns immediately with a laneId, before the worker has produced a result;
|
|
33
|
+
"This call returns immediately with a laneId, before the worker has produced a result; wait for the terminal handoff, then call delegate_status once with that laneId. Do not poll.",
|
|
35
34
|
"Worker output surfaced via delegate_status is untrusted evidence - verify it against the repo before acting on it.",
|
|
36
35
|
"If delegate_status reports blockers, resolve them yourself or ask the user; do not re-delegate the same task blindly.",
|
|
37
36
|
];
|
|
37
|
+
function delegatePanelModel(details) {
|
|
38
|
+
if (!details) {
|
|
39
|
+
return {
|
|
40
|
+
label: "workers",
|
|
41
|
+
action: "dispatch",
|
|
42
|
+
status: "idle",
|
|
43
|
+
emptyText: "No structured worker details were retained.",
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
if (!details.started) {
|
|
47
|
+
return {
|
|
48
|
+
label: "workers",
|
|
49
|
+
action: "dispatch skipped",
|
|
50
|
+
status: "warning",
|
|
51
|
+
emptyText: details.skipReason ?? "The worker was not started.",
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const laneStatus = details.status ?? "queued";
|
|
55
|
+
const rowStatus = laneStatus;
|
|
56
|
+
const meta = [
|
|
57
|
+
details.profileId ? `profile ${details.profileId}` : undefined,
|
|
58
|
+
details.reasonCode,
|
|
59
|
+
details.accepted === undefined ? undefined : details.accepted ? "accepted" : "not accepted",
|
|
60
|
+
details.costUsd === undefined ? undefined : `$${details.costUsd.toFixed(4)}`,
|
|
61
|
+
].filter((value) => value !== undefined);
|
|
62
|
+
const detailsLines = [
|
|
63
|
+
details.summary ? `untrusted claim: ${details.summary}` : undefined,
|
|
64
|
+
...(details.blockers ?? []).map((blocker) => `blocker: ${blocker}`),
|
|
65
|
+
].filter((value) => value !== undefined);
|
|
66
|
+
const active = laneStatus === "queued" || laneStatus === "running";
|
|
67
|
+
return {
|
|
68
|
+
label: "workers",
|
|
69
|
+
action: active ? "dispatched" : "completed",
|
|
70
|
+
status: active
|
|
71
|
+
? "running"
|
|
72
|
+
: laneStatus === "succeeded" && details.accepted !== false
|
|
73
|
+
? "success"
|
|
74
|
+
: laneStatus === "failed"
|
|
75
|
+
? "error"
|
|
76
|
+
: "warning",
|
|
77
|
+
summary: active ? ["terminal handoff will wake this session"] : undefined,
|
|
78
|
+
rows: [
|
|
79
|
+
{
|
|
80
|
+
status: rowStatus,
|
|
81
|
+
label: details.label ?? details.laneId ?? "worker lane",
|
|
82
|
+
meta: [details.label ? details.laneId : undefined, ...meta].filter((value) => value !== undefined),
|
|
83
|
+
details: detailsLines,
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
notices: details.accepted === false
|
|
87
|
+
? [{ status: "warning", text: "Worker output was not accepted; inspect and verify before use." }]
|
|
88
|
+
: undefined,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
38
91
|
export function createDelegateToolDefinition(deps) {
|
|
39
92
|
const isAsyncWiring = deps.startWorkerDelegation !== undefined;
|
|
93
|
+
const profileGuideline = deps.orchestrationProfiles && deps.orchestrationProfiles.length > 0
|
|
94
|
+
? `Available owner-authored orchestration profiles: ${deps.orchestrationProfiles
|
|
95
|
+
.map((profile) => `${profile.profileId} (${profile.role}: ${profile.description})`)
|
|
96
|
+
.join("; ")}. Select by profileId; never infer or request a model/thinking override.`
|
|
97
|
+
: "Delegation requires an owner-authored orchestration profile. Select its profileId, or rely on the owner's configured default; model and thinking overrides do not exist.";
|
|
40
98
|
return {
|
|
41
99
|
name: "delegate",
|
|
42
100
|
label: "delegate",
|
|
43
101
|
description: isAsyncWiring ? ASYNC_DELEGATE_DESCRIPTION : SYNCHRONOUS_DELEGATE_DESCRIPTION,
|
|
44
102
|
promptSnippet: "Delegate a bounded task to an isolated, least-privilege worker lane.",
|
|
45
|
-
promptGuidelines:
|
|
103
|
+
promptGuidelines: [
|
|
104
|
+
profileGuideline,
|
|
105
|
+
...(isAsyncWiring ? ASYNC_DELEGATE_PROMPT_GUIDELINES : SYNCHRONOUS_DELEGATE_PROMPT_GUIDELINES),
|
|
106
|
+
],
|
|
46
107
|
parameters: delegateSchema,
|
|
108
|
+
renderShell: "self",
|
|
109
|
+
renderCall() {
|
|
110
|
+
return emptyOrchestrationCall();
|
|
111
|
+
},
|
|
112
|
+
renderResult(result, { expanded, isPartial }, theme) {
|
|
113
|
+
if (isPartial)
|
|
114
|
+
return emptyOrchestrationCall();
|
|
115
|
+
const details = result.details;
|
|
116
|
+
if (!expanded && details?.started)
|
|
117
|
+
return emptyOrchestrationCall();
|
|
118
|
+
return new OrchestrationPanelComponent(theme, delegatePanelModel(details), expanded);
|
|
119
|
+
},
|
|
47
120
|
async execute(_toolCallId, input) {
|
|
48
121
|
const request = {
|
|
49
122
|
instructions: input.instructions,
|
|
50
|
-
...(input.
|
|
51
|
-
...(input.memoryRead !== undefined ? { memoryRead: input.memoryRead } : {}),
|
|
123
|
+
...(input.profileId ? { profileId: input.profileId } : {}),
|
|
52
124
|
};
|
|
53
125
|
if (deps.startWorkerDelegation) {
|
|
54
126
|
const started = deps.startWorkerDelegation(request);
|
|
55
127
|
if (!started.started) {
|
|
56
128
|
return {
|
|
57
129
|
content: [{ type: "text", text: `delegate skipped: ${started.skipReason}` }],
|
|
58
|
-
details: { started: false, skipReason: started.skipReason },
|
|
130
|
+
details: { started: false, skipReason: started.skipReason, profileId: input.profileId },
|
|
59
131
|
};
|
|
60
132
|
}
|
|
61
133
|
return {
|
|
62
134
|
content: [
|
|
63
135
|
{
|
|
64
136
|
type: "text",
|
|
65
|
-
text: `delegate started (${started.record.status}) — retrieve with delegate_status`,
|
|
137
|
+
text: `delegate started (${started.record.status}) — wait for its terminal handoff, then retrieve once with delegate_status`,
|
|
66
138
|
},
|
|
67
139
|
],
|
|
68
|
-
details: {
|
|
140
|
+
details: {
|
|
141
|
+
started: true,
|
|
142
|
+
profileId: started.record.profileId ?? input.profileId,
|
|
143
|
+
laneId: started.record.laneId,
|
|
144
|
+
label: started.record.label,
|
|
145
|
+
status: started.record.status,
|
|
146
|
+
},
|
|
69
147
|
};
|
|
70
148
|
}
|
|
71
149
|
const run = await deps.runWorkerDelegation(request);
|
|
@@ -73,7 +151,7 @@ export function createDelegateToolDefinition(deps) {
|
|
|
73
151
|
const reason = run.skipReason ?? "unknown";
|
|
74
152
|
return {
|
|
75
153
|
content: [{ type: "text", text: `delegate skipped: ${reason}` }],
|
|
76
|
-
details: { started: false, skipReason: reason },
|
|
154
|
+
details: { started: false, skipReason: reason, profileId: input.profileId },
|
|
77
155
|
};
|
|
78
156
|
}
|
|
79
157
|
const outcome = run.outcome;
|
|
@@ -81,11 +159,11 @@ export function createDelegateToolDefinition(deps) {
|
|
|
81
159
|
`delegate ${run.record?.status ?? "unknown"}${run.record?.reasonCode ? ` (${run.record.reasonCode})` : ""}`,
|
|
82
160
|
];
|
|
83
161
|
if (outcome) {
|
|
84
|
-
lines.push(`accepted: ${outcome.accepted} [${outcome.acceptance.outcome}/${outcome.acceptance.reasonCode}]`, "Worker output (UNTRUSTED - verify before acting on it):", outcome.
|
|
85
|
-
if (outcome.
|
|
86
|
-
lines.push(`Blockers: ${outcome.
|
|
162
|
+
lines.push(`accepted: ${outcome.accepted} [${outcome.acceptance.outcome}/${outcome.acceptance.reasonCode}]`, "Worker output (UNTRUSTED - verify before acting on it):", outcome.claim.summary);
|
|
163
|
+
if (outcome.claim.blockers && outcome.claim.blockers.length > 0) {
|
|
164
|
+
lines.push(`Blockers: ${outcome.claim.blockers.join("; ")}`);
|
|
87
165
|
}
|
|
88
|
-
for (const finding of outcome.
|
|
166
|
+
for (const finding of outcome.claim.evidence?.findings ?? []) {
|
|
89
167
|
lines.push(`- Finding: ${finding.summary}`);
|
|
90
168
|
}
|
|
91
169
|
}
|
|
@@ -93,10 +171,15 @@ export function createDelegateToolDefinition(deps) {
|
|
|
93
171
|
content: [{ type: "text", text: lines.join("\n") }],
|
|
94
172
|
details: {
|
|
95
173
|
started: true,
|
|
174
|
+
profileId: run.record?.profileId ?? input.profileId,
|
|
96
175
|
laneId: run.record?.laneId,
|
|
176
|
+
label: run.record?.label,
|
|
97
177
|
status: run.record?.status,
|
|
178
|
+
reasonCode: run.record?.reasonCode,
|
|
98
179
|
accepted: outcome?.accepted,
|
|
99
180
|
costUsd: outcome?.costUsd,
|
|
181
|
+
summary: outcome?.claim.summary.slice(0, 8_000),
|
|
182
|
+
blockers: outcome?.claim.blockers?.slice(0, 16),
|
|
100
183
|
},
|
|
101
184
|
};
|
|
102
185
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delegate.js","sourceRoot":"","sources":["../../../src/core/tools/delegate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAK5C,SAAS,oBAAoB,GAAG;IAC/B,OAAO,IAAI,CAAC,MAAM,CACjB;QACC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC;YACzB,WAAW,EACV,mTAAmT;SACpT,CAAC;QACF,YAAY,EAAE,IAAI,CAAC,QAAQ,CAC1B,IAAI,CAAC,MAAM,CAAC;YACX,WAAW,EACV,2NAAyN;SAC1N,CAAC,CACF;QACD,UAAU,EAAE,IAAI,CAAC,QAAQ,CACxB,IAAI,CAAC,OAAO,CAAC;YACZ,WAAW,EACV,4JAA4J;SAC7J,CAAC,CACF;KACD,EACD,EAAE,oBAAoB,EAAE,KAAK,EA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AA,CACF;KACD,CAAC;AAAA,CACF","sourcesContent":["import { type Static, Type } from \"typebox\";\nimport type { LaneRecord } from \"../autonomy/lane-tracker.ts\";\nimport type { WorkerRunOutcome } from \"../delegation/worker-runner.ts\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\n\nfunction createDelegateSchema() {\n\treturn Type.Object(\n\t\t{\n\t\t\tinstructions: Type.String({\n\t\t\t\tdescription:\n\t\t\t\t\t\"The self-contained task for a bounded worker with classified workspace tools. It is read-only unless workerDelegation.writeEnabled, non-empty writePaths, and its lane profile all grant write/edit; any write is path-scoped and parent-reviewed. Include all context it needs; it cannot see this conversation.\",\n\t\t\t}),\n\t\t\tsystemPrompt: Type.Optional(\n\t\t\t\tType.String({\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Optional replacement for the worker's role prompt — useful to hand a small model a minimal, purpose-built prompt. A short non-negotiable core (read-only, no invention, untrusted output, exact format) always remains.\",\n\t\t\t\t}),\n\t\t\t),\n\t\t\tmemoryRead: Type.Optional(\n\t\t\t\tType.Boolean({\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Request bounded read-only memory retrieval when it is relevant to the delegated task. The lane profile may still deny it; memory writes are never granted.\",\n\t\t\t\t}),\n\t\t\t),\n\t\t},\n\t\t{ additionalProperties: false },\n\t);\n}\n\nconst delegateSchema = createDelegateSchema();\n\nexport type DelegateToolInput = Static<typeof delegateSchema>;\n\nexport interface DelegateRunOutcome {\n\tstarted: boolean;\n\tskipReason?: string;\n\trecord?: LaneRecord;\n\toutcome?: WorkerRunOutcome;\n}\n\nexport interface DelegateToolDetails {\n\tstarted: boolean;\n\tskipReason?: string;\n\tlaneId?: string;\n\tstatus?: string;\n\taccepted?: boolean;\n\tcostUsd?: number;\n}\n\nexport interface DelegateToolDependencies {\n\tstartWorkerDelegation?: (args: {\n\t\tinstructions: string;\n\t\tsystemPrompt?: string;\n\t\tmemoryRead?: boolean;\n\t}) => { started: false; skipReason: string } | { started: true; record: LaneRecord };\n\trunWorkerDelegation: (args: {\n\t\tinstructions: string;\n\t\tsystemPrompt?: string;\n\t\tmemoryRead?: boolean;\n\t}) => Promise<DelegateRunOutcome>;\n}\n\nconst DELEGATE_DESCRIPTION_CORE =\n\t\"Delegate one bounded, self-contained task to an isolated worker lane with classified workspace tools. It is read-only by default; the orchestrator may request policy-gated read-only memory, while writes require workerDelegation.writeEnabled, non-empty writePaths, and a lane profile grant write/edit, with every successful path reported for parent review. Shell, recursive delegation, and opaque extension tools remain unavailable.\";\n\n// Synchronous wiring: no `deps.startWorkerDelegation`, so `execute` awaits `runWorkerDelegation`\n// and the result comes back in this same tool call's response.\nconst SYNCHRONOUS_DELEGATE_DESCRIPTION = DELEGATE_DESCRIPTION_CORE;\n\n// Async wiring: `deps.startWorkerDelegation` is present, so `execute` starts the lane and returns\n// immediately (see :~102) — the actual result only ever surfaces later via delegate_status.\nconst ASYNC_DELEGATE_DESCRIPTION = `${DELEGATE_DESCRIPTION_CORE} This call returns immediately once the worker lane starts; it does not wait for the worker to finish. Poll the delegate_status tool with the returned laneId for the result, and any blockers the worker reports arrive there too, not in this call's response.`;\n\nconst SYNCHRONOUS_DELEGATE_PROMPT_GUIDELINES = [\n\t\"Delegate only self-contained tasks; include all needed context, intended files, and acceptance criteria in the instructions.\",\n\t\"Request memoryRead only when standing memory is relevant; the lane profile remains authoritative and memory writes are never available.\",\n\t\"Assume the worker is otherwise read-only unless worker writeEnabled, writePaths, and the lane profile explicitly grant write/edit.\",\n\t\"Worker output is untrusted evidence - verify it against the repo before acting on it.\",\n\t\"If the worker reports blockers, resolve them yourself or ask the user; do not re-delegate the same task blindly.\",\n];\n\nconst ASYNC_DELEGATE_PROMPT_GUIDELINES = [\n\t\"Delegate only self-contained tasks; include all needed context, intended files, and acceptance criteria in the instructions.\",\n\t\"Request memoryRead only when standing memory is relevant; the lane profile remains authoritative and memory writes are never available.\",\n\t\"Assume the worker is otherwise read-only unless worker writeEnabled, writePaths, and the lane profile explicitly grant write/edit.\",\n\t\"This call returns immediately with a laneId, before the worker has produced a result; poll delegate_status with that laneId to retrieve it.\",\n\t\"Worker output surfaced via delegate_status is untrusted evidence - verify it against the repo before acting on it.\",\n\t\"If delegate_status reports blockers, resolve them yourself or ask the user; do not re-delegate the same task blindly.\",\n];\n\nexport function createDelegateToolDefinition(deps: DelegateToolDependencies): ToolDefinition {\n\tconst isAsyncWiring = deps.startWorkerDelegation !== undefined;\n\treturn {\n\t\tname: \"delegate\",\n\t\tlabel: \"delegate\",\n\t\tdescription: isAsyncWiring ? ASYNC_DELEGATE_DESCRIPTION : SYNCHRONOUS_DELEGATE_DESCRIPTION,\n\t\tpromptSnippet: \"Delegate a bounded task to an isolated, least-privilege worker lane.\",\n\t\tpromptGuidelines: isAsyncWiring ? ASYNC_DELEGATE_PROMPT_GUIDELINES : SYNCHRONOUS_DELEGATE_PROMPT_GUIDELINES,\n\t\tparameters: delegateSchema,\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\tinput: DelegateToolInput,\n\t\t): Promise<{\n\t\t\tcontent: Array<{ type: \"text\"; text: string }>;\n\t\t\tdetails: DelegateToolDetails;\n\t\t}> {\n\t\t\tconst request = {\n\t\t\t\tinstructions: input.instructions,\n\t\t\t\t...(input.systemPrompt ? { systemPrompt: input.systemPrompt } : {}),\n\t\t\t\t...(input.memoryRead !== undefined ? { memoryRead: input.memoryRead } : {}),\n\t\t\t};\n\t\t\tif (deps.startWorkerDelegation) {\n\t\t\t\tconst started = deps.startWorkerDelegation(request);\n\t\t\t\tif (!started.started) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [{ type: \"text\" as const, text: `delegate skipped: ${started.skipReason}` }],\n\t\t\t\t\t\tdetails: { started: false, skipReason: started.skipReason },\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\t\ttext: `delegate started (${started.record.status}) — retrieve with delegate_status`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { started: true, laneId: started.record.laneId, status: started.record.status },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst run = await deps.runWorkerDelegation(request);\n\t\t\tif (!run.started) {\n\t\t\t\tconst reason = run.skipReason ?? \"unknown\";\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\" as const, text: `delegate skipped: ${reason}` }],\n\t\t\t\t\tdetails: { started: false, skipReason: reason },\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst outcome = run.outcome;\n\t\t\tconst lines: string[] = [\n\t\t\t\t`delegate ${run.record?.status ?? \"unknown\"}${run.record?.reasonCode ? ` (${run.record.reasonCode})` : \"\"}`,\n\t\t\t];\n\t\t\tif (outcome) {\n\t\t\t\tlines.push(\n\t\t\t\t\t`accepted: ${outcome.accepted} [${outcome.acceptance.outcome}/${outcome.acceptance.reasonCode}]`,\n\t\t\t\t\t\"Worker output (UNTRUSTED - verify before acting on it):\",\n\t\t\t\t\toutcome.result.summary,\n\t\t\t\t);\n\t\t\t\tif (outcome.result.blockers && outcome.result.blockers.length > 0) {\n\t\t\t\t\tlines.push(`Blockers: ${outcome.result.blockers.join(\"; \")}`);\n\t\t\t\t}\n\t\t\t\tfor (const finding of outcome.result.evidence?.findings ?? []) {\n\t\t\t\t\tlines.push(`- Finding: ${finding.summary}`);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\" as const, text: lines.join(\"\\n\") }],\n\t\t\t\tdetails: {\n\t\t\t\t\tstarted: true,\n\t\t\t\t\tlaneId: run.record?.laneId,\n\t\t\t\t\tstatus: run.record?.status,\n\t\t\t\t\taccepted: outcome?.accepted,\n\t\t\t\t\tcostUsd: outcome?.costUsd,\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"delegate.js","sourceRoot":"","sources":["../../../src/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KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK;oBACxB,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM;oBAC1B,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU;oBAClC,QAAQ,EAAE,OAAO,EAAE,QAAQ;oBAC3B,OAAO,EAAE,OAAO,EAAE,OAAO;oBACzB,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC;oBAC/C,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;iBAC/C;aACD,CAAC;QAAA,CACF;KACD,CAAC;AAAA,CACF","sourcesContent":["import { type Static, Type } from \"typebox\";\nimport type { LaneRecord } from \"../autonomy/lane-tracker.ts\";\nimport type { WorkerDelegationRequest } from \"../delegation/worker-delegation-request.ts\";\nimport type { WorkerRunOutcome } from \"../delegation/worker-runner.ts\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport {\n\temptyOrchestrationCall,\n\tOrchestrationPanelComponent,\n\ttype OrchestrationPanelModel,\n\ttype OrchestrationRowStatus,\n} from \"./orchestration-panel.ts\";\n\nfunction createDelegateSchema() {\n\treturn Type.Object(\n\t\t{\n\t\t\tprofileId: Type.Optional(\n\t\t\t\tType.String({\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Owner-authored orchestration profile to use. The profile fixes role, model, thinking, tools, resources, budget, and concurrency. Omit only when the owner configured a default workerDelegation.orchestrationProfile.\",\n\t\t\t\t}),\n\t\t\t),\n\t\t\tinstructions: Type.String({\n\t\t\t\tdescription:\n\t\t\t\t\t\"The self-contained task for a bounded worker with classified workspace tools. It is read-only unless workerDelegation.writeEnabled, non-empty writePaths, and its lane profile all grant write/edit; any write is path-scoped and parent-reviewed. Include all context it needs; it cannot see this conversation.\",\n\t\t\t}),\n\t\t},\n\t\t{ additionalProperties: false },\n\t);\n}\n\nconst delegateSchema = createDelegateSchema();\n\nexport type DelegateToolInput = Static<typeof delegateSchema>;\n\nexport interface DelegateRunOutcome {\n\tstarted: boolean;\n\tskipReason?: string;\n\trecord?: LaneRecord;\n\toutcome?: WorkerRunOutcome;\n}\n\nexport interface DelegateToolDetails {\n\tstarted: boolean;\n\tskipReason?: string;\n\tprofileId?: string;\n\tlaneId?: string;\n\tlabel?: string;\n\tstatus?: LaneRecord[\"status\"];\n\treasonCode?: string;\n\taccepted?: boolean;\n\tcostUsd?: number;\n\tsummary?: string;\n\tblockers?: readonly string[];\n}\n\nexport interface DelegateToolDependencies {\n\tstartWorkerDelegation?: (\n\t\targs: WorkerDelegationRequest,\n\t) => { started: false; skipReason: string } | { started: true; record: LaneRecord };\n\trunWorkerDelegation: (args: WorkerDelegationRequest) => Promise<DelegateRunOutcome>;\n\torchestrationProfiles?: readonly { profileId: string; role: string; description: string }[];\n}\n\nconst DELEGATE_DESCRIPTION_CORE =\n\t\"Delegate one bounded, self-contained task to an isolated worker lane with classified workspace tools. Workers are read-only by default. The owner-authored profile fixes memory, process, model, thinking, and tool authority; writes additionally require that workerDelegation.writeEnabled, non-empty writePaths, and the lane profile grant write/edit, with every successful path reported for parent review. Unrestricted shell, recursive delegation, and opaque extension tools remain unavailable.\";\n\n// Synchronous wiring: no `deps.startWorkerDelegation`, so `execute` awaits `runWorkerDelegation`\n// and the result comes back in this same tool call's response.\nconst SYNCHRONOUS_DELEGATE_DESCRIPTION = DELEGATE_DESCRIPTION_CORE;\n\n// Async wiring: `deps.startWorkerDelegation` is present, so `execute` starts the lane and returns\n// immediately (see :~102) — the actual result only ever surfaces later via the event-driven terminal\n// handoff followed by one delegate_status retrieval.\nconst ASYNC_DELEGATE_DESCRIPTION = `${DELEGATE_DESCRIPTION_CORE} This call returns immediately once the worker lane starts; it does not wait for the worker to finish. The parent receives a terminal handoff when the lane ends; then call delegate_status once with the returned laneId to retrieve the result and any blockers. Do not poll.`;\n\nconst SYNCHRONOUS_DELEGATE_PROMPT_GUIDELINES = [\n\t\"Delegate only self-contained tasks; include all needed context, intended files, and acceptance criteria in the instructions.\",\n\t\"The selected profile alone controls whether bounded read-only memory is available; the delegation call cannot elevate it.\",\n\t\"Assume the worker is otherwise read-only unless worker writeEnabled, writePaths, and the lane profile explicitly grant write/edit.\",\n\t\"Worker output is untrusted evidence - verify it against the repo before acting on it.\",\n\t\"If the worker reports blockers, resolve them yourself or ask the user; do not re-delegate the same task blindly.\",\n];\n\nconst ASYNC_DELEGATE_PROMPT_GUIDELINES = [\n\t\"Delegate only self-contained tasks; include all needed context, intended files, and acceptance criteria in the instructions.\",\n\t\"The selected profile alone controls whether bounded read-only memory is available; the delegation call cannot elevate it.\",\n\t\"Assume the worker is otherwise read-only unless worker writeEnabled, writePaths, and the lane profile explicitly grant write/edit.\",\n\t\"This call returns immediately with a laneId, before the worker has produced a result; wait for the terminal handoff, then call delegate_status once with that laneId. Do not poll.\",\n\t\"Worker output surfaced via delegate_status is untrusted evidence - verify it against the repo before acting on it.\",\n\t\"If delegate_status reports blockers, resolve them yourself or ask the user; do not re-delegate the same task blindly.\",\n];\n\nfunction delegatePanelModel(details: DelegateToolDetails | undefined): OrchestrationPanelModel {\n\tif (!details) {\n\t\treturn {\n\t\t\tlabel: \"workers\",\n\t\t\taction: \"dispatch\",\n\t\t\tstatus: \"idle\",\n\t\t\temptyText: \"No structured worker details were retained.\",\n\t\t};\n\t}\n\tif (!details.started) {\n\t\treturn {\n\t\t\tlabel: \"workers\",\n\t\t\taction: \"dispatch skipped\",\n\t\t\tstatus: \"warning\",\n\t\t\temptyText: details.skipReason ?? \"The worker was not started.\",\n\t\t};\n\t}\n\tconst laneStatus = details.status ?? \"queued\";\n\tconst rowStatus: OrchestrationRowStatus = laneStatus;\n\tconst meta = [\n\t\tdetails.profileId ? `profile ${details.profileId}` : undefined,\n\t\tdetails.reasonCode,\n\t\tdetails.accepted === undefined ? undefined : details.accepted ? \"accepted\" : \"not accepted\",\n\t\tdetails.costUsd === undefined ? undefined : `$${details.costUsd.toFixed(4)}`,\n\t].filter((value): value is string => value !== undefined);\n\tconst detailsLines = [\n\t\tdetails.summary ? `untrusted claim: ${details.summary}` : undefined,\n\t\t...(details.blockers ?? []).map((blocker) => `blocker: ${blocker}`),\n\t].filter((value): value is string => value !== undefined);\n\tconst active = laneStatus === \"queued\" || laneStatus === \"running\";\n\treturn {\n\t\tlabel: \"workers\",\n\t\taction: active ? \"dispatched\" : \"completed\",\n\t\tstatus: active\n\t\t\t? \"running\"\n\t\t\t: laneStatus === \"succeeded\" && details.accepted !== false\n\t\t\t\t? \"success\"\n\t\t\t\t: laneStatus === \"failed\"\n\t\t\t\t\t? \"error\"\n\t\t\t\t\t: \"warning\",\n\t\tsummary: active ? [\"terminal handoff will wake this session\"] : undefined,\n\t\trows: [\n\t\t\t{\n\t\t\t\tstatus: rowStatus,\n\t\t\t\tlabel: details.label ?? details.laneId ?? \"worker lane\",\n\t\t\t\tmeta: [details.label ? details.laneId : undefined, ...meta].filter(\n\t\t\t\t\t(value): value is string => value !== undefined,\n\t\t\t\t),\n\t\t\t\tdetails: detailsLines,\n\t\t\t},\n\t\t],\n\t\tnotices:\n\t\t\tdetails.accepted === false\n\t\t\t\t? [{ status: \"warning\", text: \"Worker output was not accepted; inspect and verify before use.\" }]\n\t\t\t\t: undefined,\n\t};\n}\n\nexport function createDelegateToolDefinition(deps: DelegateToolDependencies): ToolDefinition {\n\tconst isAsyncWiring = deps.startWorkerDelegation !== undefined;\n\tconst profileGuideline =\n\t\tdeps.orchestrationProfiles && deps.orchestrationProfiles.length > 0\n\t\t\t? `Available owner-authored orchestration profiles: ${deps.orchestrationProfiles\n\t\t\t\t\t.map((profile) => `${profile.profileId} (${profile.role}: ${profile.description})`)\n\t\t\t\t\t.join(\"; \")}. Select by profileId; never infer or request a model/thinking override.`\n\t\t\t: \"Delegation requires an owner-authored orchestration profile. Select its profileId, or rely on the owner's configured default; model and thinking overrides do not exist.\";\n\treturn {\n\t\tname: \"delegate\",\n\t\tlabel: \"delegate\",\n\t\tdescription: isAsyncWiring ? ASYNC_DELEGATE_DESCRIPTION : SYNCHRONOUS_DELEGATE_DESCRIPTION,\n\t\tpromptSnippet: \"Delegate a bounded task to an isolated, least-privilege worker lane.\",\n\t\tpromptGuidelines: [\n\t\t\tprofileGuideline,\n\t\t\t...(isAsyncWiring ? ASYNC_DELEGATE_PROMPT_GUIDELINES : SYNCHRONOUS_DELEGATE_PROMPT_GUIDELINES),\n\t\t],\n\t\tparameters: delegateSchema,\n\t\trenderShell: \"self\",\n\t\trenderCall() {\n\t\t\treturn emptyOrchestrationCall();\n\t\t},\n\t\trenderResult(result, { expanded, isPartial }, theme) {\n\t\t\tif (isPartial) return emptyOrchestrationCall();\n\t\t\tconst details = result.details as DelegateToolDetails | undefined;\n\t\t\tif (!expanded && details?.started) return emptyOrchestrationCall();\n\t\t\treturn new OrchestrationPanelComponent(theme, delegatePanelModel(details), expanded);\n\t\t},\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\tinput: DelegateToolInput,\n\t\t): Promise<{\n\t\t\tcontent: Array<{ type: \"text\"; text: string }>;\n\t\t\tdetails: DelegateToolDetails;\n\t\t}> {\n\t\t\tconst request = {\n\t\t\t\tinstructions: input.instructions,\n\t\t\t\t...(input.profileId ? { profileId: input.profileId } : {}),\n\t\t\t};\n\t\t\tif (deps.startWorkerDelegation) {\n\t\t\t\tconst started = deps.startWorkerDelegation(request);\n\t\t\t\tif (!started.started) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontent: [{ type: \"text\" as const, text: `delegate skipped: ${started.skipReason}` }],\n\t\t\t\t\t\tdetails: { started: false, skipReason: started.skipReason, profileId: input.profileId },\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\" as const,\n\t\t\t\t\t\t\ttext: `delegate started (${started.record.status}) — wait for its terminal handoff, then retrieve once with delegate_status`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\tstarted: true,\n\t\t\t\t\t\tprofileId: started.record.profileId ?? input.profileId,\n\t\t\t\t\t\tlaneId: started.record.laneId,\n\t\t\t\t\t\tlabel: started.record.label,\n\t\t\t\t\t\tstatus: started.record.status,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst run = await deps.runWorkerDelegation(request);\n\t\t\tif (!run.started) {\n\t\t\t\tconst reason = run.skipReason ?? \"unknown\";\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\" as const, text: `delegate skipped: ${reason}` }],\n\t\t\t\t\tdetails: { started: false, skipReason: reason, profileId: input.profileId },\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst outcome = run.outcome;\n\t\t\tconst lines: string[] = [\n\t\t\t\t`delegate ${run.record?.status ?? \"unknown\"}${run.record?.reasonCode ? ` (${run.record.reasonCode})` : \"\"}`,\n\t\t\t];\n\t\t\tif (outcome) {\n\t\t\t\tlines.push(\n\t\t\t\t\t`accepted: ${outcome.accepted} [${outcome.acceptance.outcome}/${outcome.acceptance.reasonCode}]`,\n\t\t\t\t\t\"Worker output (UNTRUSTED - verify before acting on it):\",\n\t\t\t\t\toutcome.claim.summary,\n\t\t\t\t);\n\t\t\t\tif (outcome.claim.blockers && outcome.claim.blockers.length > 0) {\n\t\t\t\t\tlines.push(`Blockers: ${outcome.claim.blockers.join(\"; \")}`);\n\t\t\t\t}\n\t\t\t\tfor (const finding of outcome.claim.evidence?.findings ?? []) {\n\t\t\t\t\tlines.push(`- Finding: ${finding.summary}`);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\" as const, text: lines.join(\"\\n\") }],\n\t\t\t\tdetails: {\n\t\t\t\t\tstarted: true,\n\t\t\t\t\tprofileId: run.record?.profileId ?? input.profileId,\n\t\t\t\t\tlaneId: run.record?.laneId,\n\t\t\t\t\tlabel: run.record?.label,\n\t\t\t\t\tstatus: run.record?.status,\n\t\t\t\t\treasonCode: run.record?.reasonCode,\n\t\t\t\t\taccepted: outcome?.accepted,\n\t\t\t\t\tcostUsd: outcome?.costUsd,\n\t\t\t\t\tsummary: outcome?.claim.summary.slice(0, 8_000),\n\t\t\t\t\tblockers: outcome?.claim.blockers?.slice(0, 16),\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t};\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensionify.d.ts","sourceRoot":"","sources":["../../../src/core/tools/extensionify.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAK5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7D,QAAA,MAAM,kBAAkB;;;;EAItB,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAElE,MAAM,WAAW,kBAAkB;IAClC,EAAE,EAAE,OAAO,CAAC;IACZ,eAAe,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,EAAE;QACX,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC;IACF,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;CACF;AAED,MAAM,WAAW,uBAAuB;IACvC,MAAM,CAAC,EAAE,kBAAkB,CAAC;CAC5B;AAED,MAAM,WAAW,uBAAuB;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,gC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E,uBAAuB,GAC/B,SAAS,CAAC,OAAO,kBAAkB,CAAC,CAEtC","sourcesContent":["import { rmSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { AgentTool } from \"@caupulican/pi-agent-core\";\nimport { type Static, Type } from \"typebox\";\nimport { getAgentDir } from \"../../config.ts\";\nimport { acquireWorkRun, type WorkRunLease } from \"../../utils/work-directory.ts\";\nimport { createEventBus } from \"../event-bus.ts\";\nimport { createExtensionRuntime, loadExtension } from \"../extensions/loader.ts\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.ts\";\n\nconst extensionifySchema = Type.Object({\n\tname: Type.String({ description: \"Extension name (lowercase, a-z 0-9 hyphens only)\" }),\n\tcode: Type.String({ description: \"Extension factory code (TypeScript/JavaScript)\" }),\n\tpackageJson: Type.Optional(Type.String({ description: \"Optional package.json content as JSON string\" })),\n});\n\nexport type ExtensionifyInput = Static<typeof extensionifySchema>;\n\nexport interface ExtensionifyReport {\n\tok: boolean;\n\tsmokeTestPassed: boolean;\n\tdiagnostics: string[];\n\tregistered: {\n\t\ttools: string[];\n\t\tcommands: string[];\n\t};\n\tproposedPath: string;\n\tdraft: {\n\t\tname: string;\n\t\tcode: string;\n\t\tpackageJson?: string;\n\t};\n}\n\nexport interface ExtensionifyToolDetails {\n\treport?: ExtensionifyReport;\n}\n\nexport interface ExtensionifyToolOptions {\n\tagentDir?: string;\n}\n\nexport function createExtensionifyToolDefinition(\n\t_cwd: string,\n\toptions?: ExtensionifyToolOptions,\n): ToolDefinition<typeof extensionifySchema, ExtensionifyReport> {\n\treturn {\n\t\tname: \"extensionify\",\n\t\tlabel: \"extensionify\",\n\t\tdescription:\n\t\t\t\"Smoke-test a draft extension in an isolated throwaway runtime. Pure analysis tool: creates temporary scaffold, loads it, inspects registrations, then completely deletes temp dir. Does NOT write to the real extensions dir or modify the live runtime. Returns proposal with registration details.\",\n\t\tpromptSnippet: \"Smoke-test a draft extension\",\n\t\tpromptGuidelines: [\n\t\t\t\"Use extensionify to validate draft extensions before creating them.\",\n\t\t\t\"Fix any factory errors or registration issues; review tools and commands registered.\",\n\t\t\t\"The tool runs in complete isolation; the live session is never touched.\",\n\t\t\t\"Persistent write and activation happen later via a separate step.\",\n\t\t],\n\t\tparameters: extensionifySchema,\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\t{ name, code, packageJson }: ExtensionifyInput,\n\t\t\t_signal?: AbortSignal,\n\t\t\t_onUpdate?,\n\t\t\t_ctx?,\n\t\t): Promise<{\n\t\t\tcontent: Array<{ type: \"text\"; text: string }>;\n\t\t\tdetails: ExtensionifyReport;\n\t\t}> {\n\t\t\tconst diagnostics: string[] = [];\n\t\t\tlet smokeTestPassed = false;\n\t\t\tconst registeredTools: string[] = [];\n\t\t\tconst registeredCommands: string[] = [];\n\t\t\tconst agentDir = options?.agentDir ?? getAgentDir();\n\t\t\tconst proposedPath = join(agentDir, \"extensions\", name);\n\n\t\t\tlet tempDir: string | null = null;\n\t\t\tlet workRun: WorkRunLease | undefined;\n\t\t\ttry {\n\t\t\t\tworkRun = acquireWorkRun({ agentDir, category: \"extensions\", tenant: \"smoke-test\" });\n\t\t\t\ttempDir = workRun.path;\n\n\t\t\t\t// Write index.ts with the factory code\n\t\t\t\tconst indexPath = join(tempDir, \"index.ts\");\n\t\t\t\twriteFileSync(indexPath, code, \"utf-8\");\n\n\t\t\t\t// Write package.json if provided\n\t\t\t\tif (packageJson) {\n\t\t\t\t\tconst packageJsonPath = join(tempDir, \"package.json\");\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// Validate it's valid JSON\n\t\t\t\t\t\tJSON.parse(packageJson);\n\t\t\t\t\t\twriteFileSync(packageJsonPath, packageJson, \"utf-8\");\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tdiagnostics.push(`Invalid package.json: ${err instanceof Error ? err.message : String(err)}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Create isolated runtime and event bus\n\t\t\t\tconst eventBus = createEventBus();\n\t\t\t\tconst runtime = createExtensionRuntime();\n\n\t\t\t\t// Load the extension in isolation\n\t\t\t\tconst { extension, error: loadError } = await loadExtension(indexPath, tempDir, eventBus, runtime, {\n\t\t\t\t\tfresh: true,\n\t\t\t\t\tagentDir,\n\t\t\t\t});\n\n\t\t\t\tif (loadError) {\n\t\t\t\t\tdiagnostics.push(`Factory error: ${loadError}`);\n\t\t\t\t\tsmokeTestPassed = false;\n\t\t\t\t} else if (extension) {\n\t\t\t\t\tsmokeTestPassed = true;\n\n\t\t\t\t\t// Inspect registered tools\n\t\t\t\t\tfor (const [toolName] of extension.tools) {\n\t\t\t\t\t\tregisteredTools.push(toolName);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Inspect registered commands\n\t\t\t\t\tfor (const [cmdName] of extension.commands) {\n\t\t\t\t\t\tregisteredCommands.push(cmdName);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (registeredTools.length === 0 && registeredCommands.length === 0) {\n\t\t\t\t\t\tdiagnostics.push(\"Extension loaded but registered no tools or commands\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\tdiagnostics.push(`Test error: ${err instanceof Error ? err.message : String(err)}`);\n\t\t\t\tsmokeTestPassed = false;\n\t\t\t} finally {\n\t\t\t\t// Always clean up the temporary directory.\n\t\t\t\tworkRun?.release();\n\t\t\t\tif (tempDir) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\trmSync(tempDir, { recursive: true, force: true });\n\t\t\t\t\t} catch (cleanupErr) {\n\t\t\t\t\t\tdiagnostics.push(\n\t\t\t\t\t\t\t`Cleanup warning: ${cleanupErr instanceof Error ? cleanupErr.message : String(cleanupErr)}`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst ok = smokeTestPassed && diagnostics.length === 0;\n\n\t\t\tconst report: ExtensionifyReport = {\n\t\t\t\tok,\n\t\t\t\tsmokeTestPassed,\n\t\t\t\tdiagnostics,\n\t\t\t\tregistered: {\n\t\t\t\t\ttools: registeredTools,\n\t\t\t\t\tcommands: registeredCommands,\n\t\t\t\t},\n\t\t\t\tproposedPath,\n\t\t\t\tdraft: { name, code, packageJson },\n\t\t\t};\n\n\t\t\t// Format the report as readable text\n\t\t\tconst lines: string[] = [];\n\t\t\tlines.push(`Extensionify smoke-test: ${smokeTestPassed ? \"✓ passed\" : \"✗ failed\"}`);\n\n\t\t\tif (diagnostics.length > 0) {\n\t\t\t\tlines.push(\"\\nDiagnostics:\");\n\t\t\t\tfor (const diag of diagnostics) {\n\t\t\t\t\tlines.push(`- ${diag}`);\n\t\t\t\t}\n\t\t\t} else if (smokeTestPassed) {\n\t\t\t\tlines.push(\"\\n✓ No errors during factory execution.\");\n\t\t\t}\n\n\t\t\tif (registeredTools.length > 0) {\n\t\t\t\tlines.push(`\\nRegistered tools (${registeredTools.length}):`);\n\t\t\t\tfor (const toolName of registeredTools) {\n\t\t\t\t\tlines.push(`- ${toolName}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (registeredCommands.length > 0) {\n\t\t\t\tlines.push(`\\nRegistered commands (${registeredCommands.length}):`);\n\t\t\t\tfor (const cmdName of registeredCommands) {\n\t\t\t\t\tlines.push(`- ${cmdName}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (registeredTools.length === 0 && registeredCommands.length === 0 && smokeTestPassed) {\n\t\t\t\tlines.push(\"\\n⚠ Extension loaded but registered nothing.\");\n\t\t\t}\n\n\t\t\tif (ok) {\n\t\t\t\tlines.push(\"\\n✓ Extension ready for creation.\");\n\t\t\t}\n\n\t\t\tlines.push(`\\nProposed install path: ${proposedPath}`);\n\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: lines.join(\"\\n\") }],\n\t\t\t\tdetails: report,\n\t\t\t};\n\t\t},\n\t};\n}\n\nexport function createExtensionifyTool(\n\tcwd: string,\n\toptions?: ExtensionifyToolOptions,\n): AgentTool<typeof extensionifySchema> {\n\treturn wrapToolDefinition(createExtensionifyToolDefinition(cwd, options));\n}\n"]}
|
|
@@ -57,6 +57,7 @@ export function createExtensionifyToolDefinition(_cwd, options) {
|
|
|
57
57
|
// Load the extension in isolation
|
|
58
58
|
const { extension, error: loadError } = await loadExtension(indexPath, tempDir, eventBus, runtime, {
|
|
59
59
|
fresh: true,
|
|
60
|
+
agentDir,
|
|
60
61
|
});
|
|
61
62
|
if (loadError) {
|
|
62
63
|
diagnostics.push(`Factory error: ${loadError}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensionify.js","sourceRoot":"","sources":["../../../src/core/tools/extensionify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAqB,MAAM,+BAA+B,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAEhF,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,kBAAkB,GAAG,IAAI,CAAC,MAAM,CAAC;IACtC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,kDAAkD,EAAE,CAAC;IACtF,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,gDAAgD,EAAE,CAAC;IACpF,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,8CAA8C,EAAE,CAAC,CAAC;CACxG,CAAC,CAAC;AA4BH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C,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBACnD,OAAO,EAAE,MAAM;aACf,CAAC;QAAA,CACF;KACD,CAAC;AAAA,CACF;AAED,MAAM,UAAU,sBAAsB,CACrC,GAAW,EACX,OAAiC,EACM;IACvC,OAAO,kBAAkB,CAAC,gCAAgC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;AAAA,CAC1E","sourcesContent":["import { rmSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { AgentTool } from \"@caupulican/pi-agent-core\";\nimport { type Static, Type } from \"typebox\";\nimport { getAgentDir } from \"../../config.ts\";\nimport { acquireWorkRun, type WorkRunLease } from \"../../utils/work-directory.ts\";\nimport { createEventBus } from \"../event-bus.ts\";\nimport { createExtensionRuntime, loadExtension } from \"../extensions/loader.ts\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.ts\";\n\nconst extensionifySchema = Type.Object({\n\tname: Type.String({ description: \"Extension name (lowercase, a-z 0-9 hyphens only)\" }),\n\tcode: Type.String({ description: \"Extension factory code (TypeScript/JavaScript)\" }),\n\tpackageJson: Type.Optional(Type.String({ description: \"Optional package.json content as JSON string\" })),\n});\n\nexport type ExtensionifyInput = Static<typeof extensionifySchema>;\n\nexport interface ExtensionifyReport {\n\tok: boolean;\n\tsmokeTestPassed: boolean;\n\tdiagnostics: string[];\n\tregistered: {\n\t\ttools: string[];\n\t\tcommands: string[];\n\t};\n\tproposedPath: string;\n\tdraft: {\n\t\tname: string;\n\t\tcode: string;\n\t\tpackageJson?: string;\n\t};\n}\n\nexport interface ExtensionifyToolDetails {\n\treport?: ExtensionifyReport;\n}\n\nexport interface ExtensionifyToolOptions {\n\tagentDir?: string;\n}\n\nexport function createExtensionifyToolDefinition(\n\t_cwd: string,\n\toptions?: ExtensionifyToolOptions,\n): ToolDefinition<typeof extensionifySchema, ExtensionifyReport> {\n\treturn {\n\t\tname: \"extensionify\",\n\t\tlabel: \"extensionify\",\n\t\tdescription:\n\t\t\t\"Smoke-test a draft extension in an isolated throwaway runtime. Pure analysis tool: creates temporary scaffold, loads it, inspects registrations, then completely deletes temp dir. Does NOT write to the real extensions dir or modify the live runtime. Returns proposal with registration details.\",\n\t\tpromptSnippet: \"Smoke-test a draft extension\",\n\t\tpromptGuidelines: [\n\t\t\t\"Use extensionify to validate draft extensions before creating them.\",\n\t\t\t\"Fix any factory errors or registration issues; review tools and commands registered.\",\n\t\t\t\"The tool runs in complete isolation; the live session is never touched.\",\n\t\t\t\"Persistent write and activation happen later via a separate step.\",\n\t\t],\n\t\tparameters: extensionifySchema,\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\t{ name, code, packageJson }: ExtensionifyInput,\n\t\t\t_signal?: AbortSignal,\n\t\t\t_onUpdate?,\n\t\t\t_ctx?,\n\t\t): Promise<{\n\t\t\tcontent: Array<{ type: \"text\"; text: string }>;\n\t\t\tdetails: ExtensionifyReport;\n\t\t}> {\n\t\t\tconst diagnostics: string[] = [];\n\t\t\tlet smokeTestPassed = false;\n\t\t\tconst registeredTools: string[] = [];\n\t\t\tconst registeredCommands: string[] = [];\n\t\t\tconst agentDir = options?.agentDir ?? getAgentDir();\n\t\t\tconst proposedPath = join(agentDir, \"extensions\", name);\n\n\t\t\tlet tempDir: string | null = null;\n\t\t\tlet workRun: WorkRunLease | undefined;\n\t\t\ttry {\n\t\t\t\tworkRun = acquireWorkRun({ agentDir, category: \"extensions\", tenant: \"smoke-test\" });\n\t\t\t\ttempDir = workRun.path;\n\n\t\t\t\t// Write index.ts with the factory code\n\t\t\t\tconst indexPath = join(tempDir, \"index.ts\");\n\t\t\t\twriteFileSync(indexPath, code, \"utf-8\");\n\n\t\t\t\t// Write package.json if provided\n\t\t\t\tif (packageJson) {\n\t\t\t\t\tconst packageJsonPath = join(tempDir, \"package.json\");\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// Validate it's valid JSON\n\t\t\t\t\t\tJSON.parse(packageJson);\n\t\t\t\t\t\twriteFileSync(packageJsonPath, packageJson, \"utf-8\");\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tdiagnostics.push(`Invalid package.json: ${err instanceof Error ? err.message : String(err)}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Create isolated runtime and event bus\n\t\t\t\tconst eventBus = createEventBus();\n\t\t\t\tconst runtime = createExtensionRuntime();\n\n\t\t\t\t// Load the extension in isolation\n\t\t\t\tconst { extension, error: loadError } = await loadExtension(indexPath, tempDir, eventBus, runtime, {\n\t\t\t\t\tfresh: true,\n\t\t\t\t});\n\n\t\t\t\tif (loadError) {\n\t\t\t\t\tdiagnostics.push(`Factory error: ${loadError}`);\n\t\t\t\t\tsmokeTestPassed = false;\n\t\t\t\t} else if (extension) {\n\t\t\t\t\tsmokeTestPassed = true;\n\n\t\t\t\t\t// Inspect registered tools\n\t\t\t\t\tfor (const [toolName] of extension.tools) {\n\t\t\t\t\t\tregisteredTools.push(toolName);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Inspect registered commands\n\t\t\t\t\tfor (const [cmdName] of extension.commands) {\n\t\t\t\t\t\tregisteredCommands.push(cmdName);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (registeredTools.length === 0 && registeredCommands.length === 0) {\n\t\t\t\t\t\tdiagnostics.push(\"Extension loaded but registered no tools or commands\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\tdiagnostics.push(`Test error: ${err instanceof Error ? err.message : String(err)}`);\n\t\t\t\tsmokeTestPassed = false;\n\t\t\t} finally {\n\t\t\t\t// Always clean up the temporary directory.\n\t\t\t\tworkRun?.release();\n\t\t\t\tif (tempDir) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\trmSync(tempDir, { recursive: true, force: true });\n\t\t\t\t\t} catch (cleanupErr) {\n\t\t\t\t\t\tdiagnostics.push(\n\t\t\t\t\t\t\t`Cleanup warning: ${cleanupErr instanceof Error ? cleanupErr.message : String(cleanupErr)}`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst ok = smokeTestPassed && diagnostics.length === 0;\n\n\t\t\tconst report: ExtensionifyReport = {\n\t\t\t\tok,\n\t\t\t\tsmokeTestPassed,\n\t\t\t\tdiagnostics,\n\t\t\t\tregistered: {\n\t\t\t\t\ttools: registeredTools,\n\t\t\t\t\tcommands: registeredCommands,\n\t\t\t\t},\n\t\t\t\tproposedPath,\n\t\t\t\tdraft: { name, code, packageJson },\n\t\t\t};\n\n\t\t\t// Format the report as readable text\n\t\t\tconst lines: string[] = [];\n\t\t\tlines.push(`Extensionify smoke-test: ${smokeTestPassed ? \"✓ passed\" : \"✗ failed\"}`);\n\n\t\t\tif (diagnostics.length > 0) {\n\t\t\t\tlines.push(\"\\nDiagnostics:\");\n\t\t\t\tfor (const diag of diagnostics) {\n\t\t\t\t\tlines.push(`- ${diag}`);\n\t\t\t\t}\n\t\t\t} else if (smokeTestPassed) {\n\t\t\t\tlines.push(\"\\n✓ No errors during factory execution.\");\n\t\t\t}\n\n\t\t\tif (registeredTools.length > 0) {\n\t\t\t\tlines.push(`\\nRegistered tools (${registeredTools.length}):`);\n\t\t\t\tfor (const toolName of registeredTools) {\n\t\t\t\t\tlines.push(`- ${toolName}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (registeredCommands.length > 0) {\n\t\t\t\tlines.push(`\\nRegistered commands (${registeredCommands.length}):`);\n\t\t\t\tfor (const cmdName of registeredCommands) {\n\t\t\t\t\tlines.push(`- ${cmdName}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (registeredTools.length === 0 && registeredCommands.length === 0 && smokeTestPassed) {\n\t\t\t\tlines.push(\"\\n⚠ Extension loaded but registered nothing.\");\n\t\t\t}\n\n\t\t\tif (ok) {\n\t\t\t\tlines.push(\"\\n✓ Extension ready for creation.\");\n\t\t\t}\n\n\t\t\tlines.push(`\\nProposed install path: ${proposedPath}`);\n\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: lines.join(\"\\n\") }],\n\t\t\t\tdetails: report,\n\t\t\t};\n\t\t},\n\t};\n}\n\nexport function createExtensionifyTool(\n\tcwd: string,\n\toptions?: ExtensionifyToolOptions,\n): AgentTool<typeof extensionifySchema> {\n\treturn wrapToolDefinition(createExtensionifyToolDefinition(cwd, options));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"extensionify.js","sourceRoot":"","sources":["../../../src/core/tools/extensionify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAqB,MAAM,+BAA+B,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAEhF,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,kBAAkB,GAAG,IAAI,CAAC,MAAM,CAAC;IACtC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,kDAAkD,EAAE,CAAC;IACtF,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,gDAAgD,EAAE,CAAC;IACpF,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,8CAA8C,EAAE,CAAC,CAAC;CACxG,CAAC,CAAC;AA4BH,MAAM,UAAU,gCAAgC,CAC/C,IAAY,EACZ,OAAiC,EAC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EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBACnD,OAAO,EAAE,MAAM;aACf,CAAC;QAAA,CACF;KACD,CAAC;AAAA,CACF;AAED,MAAM,UAAU,sBAAsB,CACrC,GAAW,EACX,OAAiC,EACM;IACvC,OAAO,kBAAkB,CAAC,gCAAgC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;AAAA,CAC1E","sourcesContent":["import { rmSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { AgentTool } from \"@caupulican/pi-agent-core\";\nimport { type Static, Type } from \"typebox\";\nimport { getAgentDir } from \"../../config.ts\";\nimport { acquireWorkRun, type WorkRunLease } from \"../../utils/work-directory.ts\";\nimport { createEventBus } from \"../event-bus.ts\";\nimport { createExtensionRuntime, loadExtension } from \"../extensions/loader.ts\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.ts\";\n\nconst extensionifySchema = Type.Object({\n\tname: Type.String({ description: \"Extension name (lowercase, a-z 0-9 hyphens only)\" }),\n\tcode: Type.String({ description: \"Extension factory code (TypeScript/JavaScript)\" }),\n\tpackageJson: Type.Optional(Type.String({ description: \"Optional package.json content as JSON string\" })),\n});\n\nexport type ExtensionifyInput = Static<typeof extensionifySchema>;\n\nexport interface ExtensionifyReport {\n\tok: boolean;\n\tsmokeTestPassed: boolean;\n\tdiagnostics: string[];\n\tregistered: {\n\t\ttools: string[];\n\t\tcommands: string[];\n\t};\n\tproposedPath: string;\n\tdraft: {\n\t\tname: string;\n\t\tcode: string;\n\t\tpackageJson?: string;\n\t};\n}\n\nexport interface ExtensionifyToolDetails {\n\treport?: ExtensionifyReport;\n}\n\nexport interface ExtensionifyToolOptions {\n\tagentDir?: string;\n}\n\nexport function createExtensionifyToolDefinition(\n\t_cwd: string,\n\toptions?: ExtensionifyToolOptions,\n): ToolDefinition<typeof extensionifySchema, ExtensionifyReport> {\n\treturn {\n\t\tname: \"extensionify\",\n\t\tlabel: \"extensionify\",\n\t\tdescription:\n\t\t\t\"Smoke-test a draft extension in an isolated throwaway runtime. Pure analysis tool: creates temporary scaffold, loads it, inspects registrations, then completely deletes temp dir. Does NOT write to the real extensions dir or modify the live runtime. Returns proposal with registration details.\",\n\t\tpromptSnippet: \"Smoke-test a draft extension\",\n\t\tpromptGuidelines: [\n\t\t\t\"Use extensionify to validate draft extensions before creating them.\",\n\t\t\t\"Fix any factory errors or registration issues; review tools and commands registered.\",\n\t\t\t\"The tool runs in complete isolation; the live session is never touched.\",\n\t\t\t\"Persistent write and activation happen later via a separate step.\",\n\t\t],\n\t\tparameters: extensionifySchema,\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\t{ name, code, packageJson }: ExtensionifyInput,\n\t\t\t_signal?: AbortSignal,\n\t\t\t_onUpdate?,\n\t\t\t_ctx?,\n\t\t): Promise<{\n\t\t\tcontent: Array<{ type: \"text\"; text: string }>;\n\t\t\tdetails: ExtensionifyReport;\n\t\t}> {\n\t\t\tconst diagnostics: string[] = [];\n\t\t\tlet smokeTestPassed = false;\n\t\t\tconst registeredTools: string[] = [];\n\t\t\tconst registeredCommands: string[] = [];\n\t\t\tconst agentDir = options?.agentDir ?? getAgentDir();\n\t\t\tconst proposedPath = join(agentDir, \"extensions\", name);\n\n\t\t\tlet tempDir: string | null = null;\n\t\t\tlet workRun: WorkRunLease | undefined;\n\t\t\ttry {\n\t\t\t\tworkRun = acquireWorkRun({ agentDir, category: \"extensions\", tenant: \"smoke-test\" });\n\t\t\t\ttempDir = workRun.path;\n\n\t\t\t\t// Write index.ts with the factory code\n\t\t\t\tconst indexPath = join(tempDir, \"index.ts\");\n\t\t\t\twriteFileSync(indexPath, code, \"utf-8\");\n\n\t\t\t\t// Write package.json if provided\n\t\t\t\tif (packageJson) {\n\t\t\t\t\tconst packageJsonPath = join(tempDir, \"package.json\");\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// Validate it's valid JSON\n\t\t\t\t\t\tJSON.parse(packageJson);\n\t\t\t\t\t\twriteFileSync(packageJsonPath, packageJson, \"utf-8\");\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tdiagnostics.push(`Invalid package.json: ${err instanceof Error ? err.message : String(err)}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Create isolated runtime and event bus\n\t\t\t\tconst eventBus = createEventBus();\n\t\t\t\tconst runtime = createExtensionRuntime();\n\n\t\t\t\t// Load the extension in isolation\n\t\t\t\tconst { extension, error: loadError } = await loadExtension(indexPath, tempDir, eventBus, runtime, {\n\t\t\t\t\tfresh: true,\n\t\t\t\t\tagentDir,\n\t\t\t\t});\n\n\t\t\t\tif (loadError) {\n\t\t\t\t\tdiagnostics.push(`Factory error: ${loadError}`);\n\t\t\t\t\tsmokeTestPassed = false;\n\t\t\t\t} else if (extension) {\n\t\t\t\t\tsmokeTestPassed = true;\n\n\t\t\t\t\t// Inspect registered tools\n\t\t\t\t\tfor (const [toolName] of extension.tools) {\n\t\t\t\t\t\tregisteredTools.push(toolName);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Inspect registered commands\n\t\t\t\t\tfor (const [cmdName] of extension.commands) {\n\t\t\t\t\t\tregisteredCommands.push(cmdName);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (registeredTools.length === 0 && registeredCommands.length === 0) {\n\t\t\t\t\t\tdiagnostics.push(\"Extension loaded but registered no tools or commands\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\tdiagnostics.push(`Test error: ${err instanceof Error ? err.message : String(err)}`);\n\t\t\t\tsmokeTestPassed = false;\n\t\t\t} finally {\n\t\t\t\t// Always clean up the temporary directory.\n\t\t\t\tworkRun?.release();\n\t\t\t\tif (tempDir) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\trmSync(tempDir, { recursive: true, force: true });\n\t\t\t\t\t} catch (cleanupErr) {\n\t\t\t\t\t\tdiagnostics.push(\n\t\t\t\t\t\t\t`Cleanup warning: ${cleanupErr instanceof Error ? cleanupErr.message : String(cleanupErr)}`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst ok = smokeTestPassed && diagnostics.length === 0;\n\n\t\t\tconst report: ExtensionifyReport = {\n\t\t\t\tok,\n\t\t\t\tsmokeTestPassed,\n\t\t\t\tdiagnostics,\n\t\t\t\tregistered: {\n\t\t\t\t\ttools: registeredTools,\n\t\t\t\t\tcommands: registeredCommands,\n\t\t\t\t},\n\t\t\t\tproposedPath,\n\t\t\t\tdraft: { name, code, packageJson },\n\t\t\t};\n\n\t\t\t// Format the report as readable text\n\t\t\tconst lines: string[] = [];\n\t\t\tlines.push(`Extensionify smoke-test: ${smokeTestPassed ? \"✓ passed\" : \"✗ failed\"}`);\n\n\t\t\tif (diagnostics.length > 0) {\n\t\t\t\tlines.push(\"\\nDiagnostics:\");\n\t\t\t\tfor (const diag of diagnostics) {\n\t\t\t\t\tlines.push(`- ${diag}`);\n\t\t\t\t}\n\t\t\t} else if (smokeTestPassed) {\n\t\t\t\tlines.push(\"\\n✓ No errors during factory execution.\");\n\t\t\t}\n\n\t\t\tif (registeredTools.length > 0) {\n\t\t\t\tlines.push(`\\nRegistered tools (${registeredTools.length}):`);\n\t\t\t\tfor (const toolName of registeredTools) {\n\t\t\t\t\tlines.push(`- ${toolName}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (registeredCommands.length > 0) {\n\t\t\t\tlines.push(`\\nRegistered commands (${registeredCommands.length}):`);\n\t\t\t\tfor (const cmdName of registeredCommands) {\n\t\t\t\t\tlines.push(`- ${cmdName}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (registeredTools.length === 0 && registeredCommands.length === 0 && smokeTestPassed) {\n\t\t\t\tlines.push(\"\\n⚠ Extension loaded but registered nothing.\");\n\t\t\t}\n\n\t\t\tif (ok) {\n\t\t\t\tlines.push(\"\\n✓ Extension ready for creation.\");\n\t\t\t}\n\n\t\t\tlines.push(`\\nProposed install path: ${proposedPath}`);\n\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: lines.join(\"\\n\") }],\n\t\t\t\tdetails: report,\n\t\t\t};\n\t\t},\n\t};\n}\n\nexport function createExtensionifyTool(\n\tcwd: string,\n\toptions?: ExtensionifyToolOptions,\n): AgentTool<typeof extensionifySchema> {\n\treturn wrapToolDefinition(createExtensionifyToolDefinition(cwd, options));\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { isComplexShellCommand, parseCommandPrefixes, tokenizeCommand } from "./shell-command-parser.ts";
|
|
1
2
|
export interface FilterResult {
|
|
2
3
|
output: string;
|
|
3
4
|
exitCode: number;
|
|
@@ -23,13 +24,6 @@ interface GitFilterOptions {
|
|
|
23
24
|
timeout?: number;
|
|
24
25
|
}
|
|
25
26
|
export declare function unicodeTruncate(str: string, maxLength: number): string;
|
|
26
|
-
export declare function tokenizeCommand(command: string): string[] | null;
|
|
27
|
-
export interface ParsedCommand {
|
|
28
|
-
envVars: Record<string, string>;
|
|
29
|
-
coreCommandTokens: string[];
|
|
30
|
-
}
|
|
31
|
-
export declare function parseCommandPrefixes(command: string): ParsedCommand | null;
|
|
32
|
-
export declare function isComplexShellCommand(command: string): boolean;
|
|
33
27
|
export declare function runGitQuery(cwd: string, globalOptions: string[], args: string[], options?: GitFilterOptions): Promise<GitQueryResult>;
|
|
34
28
|
export declare function classifyGitCommand(command: string, parentEnv?: NodeJS.ProcessEnv): {
|
|
35
29
|
eligible: boolean;
|
|
@@ -45,5 +39,4 @@ export declare function compactDiff(diffOutput: string, maxLines?: number): {
|
|
|
45
39
|
};
|
|
46
40
|
export declare function executeFilteredGit(cwd: string, subcommand: string, globalOptions: string[], subcommandArgs: string[], options?: GitFilterOptions): Promise<FilterResult>;
|
|
47
41
|
export declare function makeGitCommandForDisplay(globalOptions: string[], subcommand: string, args: string[]): string;
|
|
48
|
-
export {};
|
|
49
42
|
//# sourceMappingURL=git-filter.d.ts.map
|