visionclaw 0.1.219-beta.0 → 0.1.219-dev.codex-issue-2805-worker-runtime.2
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/dist/agent/api-proxy.d.ts +0 -16
- package/dist/agent/api-proxy.d.ts.map +1 -1
- package/dist/agent/api-proxy.js +9 -8
- package/dist/agent/api-proxy.js.map +1 -1
- package/dist/agent/browser-launcher.d.ts +3 -0
- package/dist/agent/browser-launcher.d.ts.map +1 -1
- package/dist/agent/browser-launcher.js +101 -43
- package/dist/agent/browser-launcher.js.map +1 -1
- package/dist/agent/coding-conventions.d.ts +8 -0
- package/dist/agent/coding-conventions.d.ts.map +1 -0
- package/dist/agent/coding-conventions.js +19 -0
- package/dist/agent/coding-conventions.js.map +1 -0
- package/dist/agent/command-handlers.d.ts.map +1 -1
- package/dist/agent/command-handlers.js +4 -16
- package/dist/agent/command-handlers.js.map +1 -1
- package/dist/agent/context-action-restart-fallback.d.ts.map +1 -1
- package/dist/agent/context-action-restart-fallback.js +9 -3
- package/dist/agent/context-action-restart-fallback.js.map +1 -1
- package/dist/agent/context-refresh.d.ts.map +1 -1
- package/dist/agent/context-refresh.js +0 -7
- package/dist/agent/context-refresh.js.map +1 -1
- package/dist/agent/context.d.ts +2 -4
- package/dist/agent/context.d.ts.map +1 -1
- package/dist/agent/context.js +12 -21
- package/dist/agent/context.js.map +1 -1
- package/dist/agent/engine-fallback.d.ts +0 -35
- package/dist/agent/engine-fallback.d.ts.map +1 -1
- package/dist/agent/engine-fallback.js +4 -3
- package/dist/agent/engine-fallback.js.map +1 -1
- package/dist/agent/engine-switch.d.ts +19 -38
- package/dist/agent/engine-switch.d.ts.map +1 -1
- package/dist/agent/engine-switch.js +46 -111
- package/dist/agent/engine-switch.js.map +1 -1
- package/dist/agent/engines/browser-tool-policy.d.ts +12 -1
- package/dist/agent/engines/browser-tool-policy.d.ts.map +1 -1
- package/dist/agent/engines/browser-tool-policy.js +17 -2
- package/dist/agent/engines/browser-tool-policy.js.map +1 -1
- package/dist/agent/engines/claude/executor-shell-groups.d.ts +11 -0
- package/dist/agent/engines/claude/executor-shell-groups.d.ts.map +1 -0
- package/dist/agent/engines/claude/executor-shell-groups.js +22 -0
- package/dist/agent/engines/claude/executor-shell-groups.js.map +1 -0
- package/dist/agent/engines/claude/session.d.ts +13 -4
- package/dist/agent/engines/claude/session.d.ts.map +1 -1
- package/dist/agent/engines/claude/session.js +165 -84
- package/dist/agent/engines/claude/session.js.map +1 -1
- package/dist/agent/engines/pi/shared/usage.d.ts +6 -8
- package/dist/agent/engines/pi/shared/usage.d.ts.map +1 -1
- package/dist/agent/engines/pi/shared/usage.js +24 -7
- package/dist/agent/engines/pi/shared/usage.js.map +1 -1
- package/dist/agent/engines/pi/tools.d.ts +3 -10
- package/dist/agent/engines/pi/tools.d.ts.map +1 -1
- package/dist/agent/engines/pi/tools.js +6 -20
- package/dist/agent/engines/pi/tools.js.map +1 -1
- package/dist/agent/engines/pi-coding/executor-shell.d.ts +4 -0
- package/dist/agent/engines/pi-coding/executor-shell.d.ts.map +1 -0
- package/dist/agent/engines/pi-coding/executor-shell.js +175 -0
- package/dist/agent/engines/pi-coding/executor-shell.js.map +1 -0
- package/dist/agent/engines/pi-coding/session.d.ts +4 -4
- package/dist/agent/engines/pi-coding/session.d.ts.map +1 -1
- package/dist/agent/engines/pi-coding/session.js +118 -66
- package/dist/agent/engines/pi-coding/session.js.map +1 -1
- package/dist/agent/engines/pi-coding/tools.d.ts +2 -5
- package/dist/agent/engines/pi-coding/tools.d.ts.map +1 -1
- package/dist/agent/engines/pi-coding/tools.js +7 -5
- package/dist/agent/engines/pi-coding/tools.js.map +1 -1
- package/dist/agent/engines/session-types.d.ts +8 -8
- package/dist/agent/engines/session-types.d.ts.map +1 -1
- package/dist/agent/external-context/interrupt.d.ts +0 -2
- package/dist/agent/external-context/interrupt.d.ts.map +1 -1
- package/dist/agent/external-context/interrupt.js +0 -1
- package/dist/agent/external-context/interrupt.js.map +1 -1
- package/dist/agent/external-context/registry.d.ts +0 -2
- package/dist/agent/external-context/registry.d.ts.map +1 -1
- package/dist/agent/external-context/registry.js +2 -4
- package/dist/agent/external-context/registry.js.map +1 -1
- package/dist/agent/external-context/runtime.d.ts.map +1 -1
- package/dist/agent/external-context/runtime.js +15 -14
- package/dist/agent/external-context/runtime.js.map +1 -1
- package/dist/agent/external-context/types.d.ts +0 -2
- package/dist/agent/external-context/types.d.ts.map +1 -1
- package/dist/agent/fast-responder.d.ts +4 -20
- package/dist/agent/fast-responder.d.ts.map +1 -1
- package/dist/agent/fast-responder.js +28 -42
- package/dist/agent/fast-responder.js.map +1 -1
- package/dist/agent/interrupt-handler.d.ts +4 -18
- package/dist/agent/interrupt-handler.d.ts.map +1 -1
- package/dist/agent/interrupt-handler.js +52 -283
- package/dist/agent/interrupt-handler.js.map +1 -1
- package/dist/agent/lab-run-system-prompt.d.ts.map +1 -1
- package/dist/agent/lab-run-system-prompt.js +4 -1
- package/dist/agent/lab-run-system-prompt.js.map +1 -1
- package/dist/agent/lifecycle-trace.d.ts.map +1 -1
- package/dist/agent/lifecycle-trace.js +6 -5
- package/dist/agent/lifecycle-trace.js.map +1 -1
- package/dist/agent/loop.d.ts +9 -3
- package/dist/agent/loop.d.ts.map +1 -1
- package/dist/agent/loop.js +288 -157
- package/dist/agent/loop.js.map +1 -1
- package/dist/agent/memory-protocol.d.ts +2 -2
- package/dist/agent/memory-protocol.d.ts.map +1 -1
- package/dist/agent/memory-protocol.js +3 -15
- package/dist/agent/memory-protocol.js.map +1 -1
- package/dist/agent/memory-store.d.ts +58 -0
- package/dist/agent/memory-store.d.ts.map +1 -0
- package/dist/agent/memory-store.js +152 -0
- package/dist/agent/memory-store.js.map +1 -0
- package/dist/agent/model-provider.d.ts +18 -5
- package/dist/agent/model-provider.d.ts.map +1 -1
- package/dist/agent/model-provider.js +58 -18
- package/dist/agent/model-provider.js.map +1 -1
- package/dist/agent/nightly-maintenance/dreaming-batch.d.ts +184 -0
- package/dist/agent/nightly-maintenance/dreaming-batch.d.ts.map +1 -0
- package/dist/agent/nightly-maintenance/dreaming-batch.js +192 -0
- package/dist/agent/nightly-maintenance/dreaming-batch.js.map +1 -0
- package/dist/agent/nightly-maintenance/dreaming-files.d.ts +48 -0
- package/dist/agent/nightly-maintenance/dreaming-files.d.ts.map +1 -0
- package/dist/agent/nightly-maintenance/dreaming-files.js +109 -0
- package/dist/agent/nightly-maintenance/dreaming-files.js.map +1 -0
- package/dist/agent/nightly-maintenance/dreaming-ledger.d.ts +62 -0
- package/dist/agent/nightly-maintenance/dreaming-ledger.d.ts.map +1 -0
- package/dist/agent/nightly-maintenance/dreaming-ledger.js +146 -0
- package/dist/agent/nightly-maintenance/dreaming-ledger.js.map +1 -0
- package/dist/agent/nightly-maintenance/dreaming-planner.d.ts +86 -0
- package/dist/agent/nightly-maintenance/dreaming-planner.d.ts.map +1 -0
- package/dist/agent/nightly-maintenance/dreaming-planner.js +304 -0
- package/dist/agent/nightly-maintenance/dreaming-planner.js.map +1 -0
- package/dist/agent/nightly-maintenance/dreaming-runner.d.ts +93 -0
- package/dist/agent/nightly-maintenance/dreaming-runner.d.ts.map +1 -0
- package/dist/agent/nightly-maintenance/dreaming-runner.js +156 -0
- package/dist/agent/nightly-maintenance/dreaming-runner.js.map +1 -0
- package/dist/agent/nightly-maintenance/dreaming-sources.d.ts +115 -0
- package/dist/agent/nightly-maintenance/dreaming-sources.d.ts.map +1 -0
- package/dist/agent/nightly-maintenance/dreaming-sources.js +270 -0
- package/dist/agent/nightly-maintenance/dreaming-sources.js.map +1 -0
- package/dist/agent/nightly-maintenance/index.d.ts +28 -8
- package/dist/agent/nightly-maintenance/index.d.ts.map +1 -1
- package/dist/agent/nightly-maintenance/index.js +42 -15
- package/dist/agent/nightly-maintenance/index.js.map +1 -1
- package/dist/agent/nightly-maintenance/skill-learning-gate.js +1 -1
- package/dist/agent/nightly-maintenance/skill-learning-gate.js.map +1 -1
- package/dist/agent/nightly-maintenance/vocabulary-processor.d.ts +1 -1
- package/dist/agent/nightly-maintenance/vocabulary-processor.d.ts.map +1 -1
- package/dist/agent/product-identity.d.ts +5 -4
- package/dist/agent/product-identity.d.ts.map +1 -1
- package/dist/agent/product-identity.js +7 -6
- package/dist/agent/product-identity.js.map +1 -1
- package/dist/agent/public-activity.js +1 -1
- package/dist/agent/public-activity.js.map +1 -1
- package/dist/agent/reply-watchdog.d.ts +5 -3
- package/dist/agent/reply-watchdog.d.ts.map +1 -1
- package/dist/agent/reply-watchdog.js +6 -4
- package/dist/agent/reply-watchdog.js.map +1 -1
- package/dist/agent/runtime-context.d.ts +27 -0
- package/dist/agent/runtime-context.d.ts.map +1 -0
- package/dist/agent/runtime-context.js +60 -0
- package/dist/agent/runtime-context.js.map +1 -0
- package/dist/agent/runtime-disclosure-policy.d.ts +6 -0
- package/dist/agent/runtime-disclosure-policy.d.ts.map +1 -0
- package/dist/agent/runtime-disclosure-policy.js +16 -0
- package/dist/agent/runtime-disclosure-policy.js.map +1 -0
- package/dist/agent/runtime-surface.d.ts +15 -4
- package/dist/agent/runtime-surface.d.ts.map +1 -1
- package/dist/agent/runtime-surface.js +0 -1
- package/dist/agent/runtime-surface.js.map +1 -1
- package/dist/agent/session-manager.d.ts +30 -126
- package/dist/agent/session-manager.d.ts.map +1 -1
- package/dist/agent/session-manager.js +60 -484
- package/dist/agent/session-manager.js.map +1 -1
- package/dist/agent/state.d.ts +42 -2
- package/dist/agent/state.d.ts.map +1 -1
- package/dist/agent/state.js +21 -11
- package/dist/agent/state.js.map +1 -1
- package/dist/agent/stream-handler.d.ts +6 -13
- package/dist/agent/stream-handler.d.ts.map +1 -1
- package/dist/agent/stream-handler.js +8 -62
- package/dist/agent/stream-handler.js.map +1 -1
- package/dist/agent/system-prompt.d.ts +2 -0
- package/dist/agent/system-prompt.d.ts.map +1 -1
- package/dist/agent/system-prompt.js +21 -20
- package/dist/agent/system-prompt.js.map +1 -1
- package/dist/agent/tool-usage.d.ts.map +1 -1
- package/dist/agent/tool-usage.js +0 -1
- package/dist/agent/tool-usage.js.map +1 -1
- package/dist/agent/transcript/transcript-backfill.js +3 -3
- package/dist/agent/transcript/transcript-backfill.js.map +1 -1
- package/dist/agent/transcript/transcript-indexer.d.ts +3 -31
- package/dist/agent/transcript/transcript-indexer.d.ts.map +1 -1
- package/dist/agent/transcript/transcript-indexer.js +58 -57
- package/dist/agent/transcript/transcript-indexer.js.map +1 -1
- package/dist/agent/transcript-parsers/trivial-tools.d.ts.map +1 -1
- package/dist/agent/transcript-parsers/trivial-tools.js +0 -2
- package/dist/agent/transcript-parsers/trivial-tools.js.map +1 -1
- package/dist/agent/transcript-parsers/types.d.ts +1 -1
- package/dist/agent/transcript-summarizer.d.ts +14 -0
- package/dist/agent/transcript-summarizer.d.ts.map +1 -1
- package/dist/agent/transcript-summarizer.js +69 -45
- package/dist/agent/transcript-summarizer.js.map +1 -1
- package/dist/agent/usage/usage-report-queue.d.ts.map +1 -1
- package/dist/agent/usage/usage-report-queue.js +53 -52
- package/dist/agent/usage/usage-report-queue.js.map +1 -1
- package/dist/agent/usage/usage-report-types.d.ts +1 -1
- package/dist/agent/usage/usage-report-types.d.ts.map +1 -1
- package/dist/agent/vocabulary-glossary.d.ts +3 -3
- package/dist/agent/wake-cycle-runner.d.ts +14 -17
- package/dist/agent/wake-cycle-runner.d.ts.map +1 -1
- package/dist/agent/wake-cycle-runner.js +121 -290
- package/dist/agent/wake-cycle-runner.js.map +1 -1
- package/dist/builtin-skills/owner-manual/SKILL.md +2 -2
- package/dist/calendar/occurrence-ownership.d.ts.map +1 -1
- package/dist/calendar/occurrence-ownership.js +6 -5
- package/dist/calendar/occurrence-ownership.js.map +1 -1
- package/dist/calendar/scheduler.d.ts.map +1 -1
- package/dist/calendar/scheduler.js +4 -3
- package/dist/calendar/scheduler.js.map +1 -1
- package/dist/channels/interface.d.ts +8 -2
- package/dist/channels/interface.d.ts.map +1 -1
- package/dist/channels/interface.js +8 -1
- package/dist/channels/interface.js.map +1 -1
- package/dist/channels/manager.d.ts.map +1 -1
- package/dist/channels/manager.js +5 -1
- package/dist/channels/manager.js.map +1 -1
- package/dist/channels/queue.d.ts.map +1 -1
- package/dist/channels/queue.js +8 -0
- package/dist/channels/queue.js.map +1 -1
- package/dist/channels/tui.d.ts +14 -1
- package/dist/channels/tui.d.ts.map +1 -1
- package/dist/channels/tui.js +64 -2
- package/dist/channels/tui.js.map +1 -1
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +22 -53
- package/dist/cli/index.js.map +1 -1
- package/dist/config/index.d.ts +13 -7
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +51 -64
- package/dist/config/index.js.map +1 -1
- package/dist/config/types.d.ts +28 -7
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js +22 -20
- package/dist/config/types.js.map +1 -1
- package/dist/conversations/lazy-runtime.d.ts +5 -0
- package/dist/conversations/lazy-runtime.d.ts.map +1 -0
- package/dist/conversations/lazy-runtime.js +12 -0
- package/dist/conversations/lazy-runtime.js.map +1 -0
- package/dist/conversations/runtime.d.ts +17 -0
- package/dist/conversations/runtime.d.ts.map +1 -0
- package/dist/conversations/runtime.js +92 -0
- package/dist/conversations/runtime.js.map +1 -0
- package/dist/conversations/scheduler.d.ts +57 -0
- package/dist/conversations/scheduler.d.ts.map +1 -0
- package/dist/conversations/scheduler.js +175 -0
- package/dist/conversations/scheduler.js.map +1 -0
- package/dist/data-processing/pipeline.d.ts +0 -2
- package/dist/data-processing/pipeline.d.ts.map +1 -1
- package/dist/data-processing/pipeline.js +19 -24
- package/dist/data-processing/pipeline.js.map +1 -1
- package/dist/data-processing/restructure.d.ts +0 -2
- package/dist/data-processing/restructure.d.ts.map +1 -1
- package/dist/data-processing/restructure.js +6 -9
- package/dist/data-processing/restructure.js.map +1 -1
- package/dist/data-processing/types.d.ts +2 -9
- package/dist/data-processing/types.d.ts.map +1 -1
- package/dist/data-processing/types.js +2 -13
- package/dist/data-processing/types.js.map +1 -1
- package/dist/email/email-route-store.d.ts.map +1 -1
- package/dist/email/email-route-store.js +6 -5
- package/dist/email/email-route-store.js.map +1 -1
- package/dist/i18n/messages.d.ts +26 -2
- package/dist/i18n/messages.d.ts.map +1 -1
- package/dist/i18n/messages.js +30 -5
- package/dist/i18n/messages.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +11 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +49 -1
- package/dist/logger.js.map +1 -1
- package/dist/obs/mini-app/status.d.ts.map +1 -1
- package/dist/obs/mini-app/status.js +0 -1
- package/dist/obs/mini-app/status.js.map +1 -1
- package/dist/onboarding/onboarding-service-client.d.ts +1 -0
- package/dist/onboarding/onboarding-service-client.d.ts.map +1 -1
- package/dist/onboarding/onboarding-service-client.js.map +1 -1
- package/dist/onboarding/remote-set-owner.d.ts.map +1 -1
- package/dist/onboarding/remote-set-owner.js +0 -1
- package/dist/onboarding/remote-set-owner.js.map +1 -1
- package/dist/onboarding/set-owner.d.ts +1 -1
- package/dist/onboarding/set-owner.d.ts.map +1 -1
- package/dist/onboarding/set-owner.js +3 -6
- package/dist/onboarding/set-owner.js.map +1 -1
- package/dist/reconfigure.d.ts.map +1 -1
- package/dist/reconfigure.js +1 -32
- package/dist/reconfigure.js.map +1 -1
- package/dist/reset.d.ts.map +1 -1
- package/dist/reset.js +3 -1
- package/dist/reset.js.map +1 -1
- package/dist/threads/active-threads-store.d.ts.map +1 -1
- package/dist/threads/active-threads-store.js +8 -27
- package/dist/threads/active-threads-store.js.map +1 -1
- package/dist/threads/dreaming-execution.d.ts +10 -0
- package/dist/threads/dreaming-execution.d.ts.map +1 -0
- package/dist/threads/dreaming-execution.js +78 -0
- package/dist/threads/dreaming-execution.js.map +1 -0
- package/dist/threads/execution-authority.d.ts +43 -0
- package/dist/threads/execution-authority.d.ts.map +1 -0
- package/dist/threads/execution-authority.js +75 -0
- package/dist/threads/execution-authority.js.map +1 -0
- package/dist/threads/execution-budget.d.ts +107 -0
- package/dist/threads/execution-budget.d.ts.map +1 -0
- package/dist/threads/execution-budget.js +257 -0
- package/dist/threads/execution-budget.js.map +1 -0
- package/dist/threads/execution-host.d.ts +17 -0
- package/dist/threads/execution-host.d.ts.map +1 -0
- package/dist/threads/execution-host.js +66 -0
- package/dist/threads/execution-host.js.map +1 -0
- package/dist/threads/execution-scheduler.d.ts +162 -0
- package/dist/threads/execution-scheduler.d.ts.map +1 -0
- package/dist/threads/execution-scheduler.js +413 -0
- package/dist/threads/execution-scheduler.js.map +1 -0
- package/dist/threads/execution-snapshot.d.ts +91 -0
- package/dist/threads/execution-snapshot.d.ts.map +1 -0
- package/dist/threads/execution-snapshot.js +146 -0
- package/dist/threads/execution-snapshot.js.map +1 -0
- package/dist/threads/execution-store.d.ts +374 -0
- package/dist/threads/execution-store.d.ts.map +1 -0
- package/dist/threads/execution-store.js +910 -0
- package/dist/threads/execution-store.js.map +1 -0
- package/dist/threads/execution-thread-error.d.ts +9 -0
- package/dist/threads/execution-thread-error.d.ts.map +1 -0
- package/dist/threads/execution-thread-error.js +12 -0
- package/dist/threads/execution-thread-error.js.map +1 -0
- package/dist/threads/executor-exit.d.ts +18 -0
- package/dist/threads/executor-exit.d.ts.map +1 -0
- package/dist/threads/executor-exit.js +21 -0
- package/dist/threads/executor-exit.js.map +1 -0
- package/dist/threads/foreground-task.d.ts +91 -0
- package/dist/threads/foreground-task.d.ts.map +1 -0
- package/dist/threads/foreground-task.js +191 -0
- package/dist/threads/foreground-task.js.map +1 -0
- package/dist/threads/foreman-business.d.ts +9 -0
- package/dist/threads/foreman-business.d.ts.map +1 -0
- package/dist/threads/foreman-business.js +117 -0
- package/dist/threads/foreman-business.js.map +1 -0
- package/dist/threads/foreman-client.d.ts +18 -0
- package/dist/threads/foreman-client.d.ts.map +1 -0
- package/dist/threads/foreman-client.js +51 -0
- package/dist/threads/foreman-client.js.map +1 -0
- package/dist/threads/foreman-delivery.d.ts +5 -0
- package/dist/threads/foreman-delivery.d.ts.map +1 -0
- package/dist/threads/foreman-delivery.js +21 -0
- package/dist/threads/foreman-delivery.js.map +1 -0
- package/dist/threads/foreman-execution.d.ts +32 -0
- package/dist/threads/foreman-execution.d.ts.map +1 -0
- package/dist/threads/foreman-execution.js +90 -0
- package/dist/threads/foreman-execution.js.map +1 -0
- package/dist/threads/foreman-host.d.ts +77 -0
- package/dist/threads/foreman-host.d.ts.map +1 -0
- package/dist/threads/foreman-host.js +891 -0
- package/dist/threads/foreman-host.js.map +1 -0
- package/dist/threads/foreman-protocol.d.ts +242 -0
- package/dist/threads/foreman-protocol.d.ts.map +1 -0
- package/dist/threads/foreman-protocol.js +116 -0
- package/dist/threads/foreman-protocol.js.map +1 -0
- package/dist/threads/foreman-store.d.ts +151 -0
- package/dist/threads/foreman-store.d.ts.map +1 -0
- package/dist/threads/foreman-store.js +299 -0
- package/dist/threads/foreman-store.js.map +1 -0
- package/dist/threads/generic-execution.d.ts +25 -0
- package/dist/threads/generic-execution.d.ts.map +1 -0
- package/dist/threads/generic-execution.js +86 -0
- package/dist/threads/generic-execution.js.map +1 -0
- package/dist/threads/init-thread-dir.d.ts +2 -2
- package/dist/threads/init-thread-dir.d.ts.map +1 -1
- package/dist/threads/init-thread-dir.js +6 -6
- package/dist/threads/init-thread-dir.js.map +1 -1
- package/dist/threads/ipc.d.ts +108 -2
- package/dist/threads/ipc.d.ts.map +1 -1
- package/dist/threads/ipc.js +14 -2
- package/dist/threads/ipc.js.map +1 -1
- package/dist/threads/lab-run-thread.d.ts +3 -5
- package/dist/threads/lab-run-thread.d.ts.map +1 -1
- package/dist/threads/lab-run-thread.js +3 -5
- package/dist/threads/lab-run-thread.js.map +1 -1
- package/dist/threads/lab-runtime-policy.d.ts +26 -21
- package/dist/threads/lab-runtime-policy.d.ts.map +1 -1
- package/dist/threads/lab-runtime-policy.js +31 -126
- package/dist/threads/lab-runtime-policy.js.map +1 -1
- package/dist/threads/process-group.d.ts +41 -0
- package/dist/threads/process-group.d.ts.map +1 -0
- package/dist/threads/process-group.js +161 -0
- package/dist/threads/process-group.js.map +1 -0
- package/dist/threads/relay-adapter.d.ts +8 -0
- package/dist/threads/relay-adapter.d.ts.map +1 -1
- package/dist/threads/relay-adapter.js +26 -1
- package/dist/threads/relay-adapter.js.map +1 -1
- package/dist/threads/supervisor.d.ts +191 -57
- package/dist/threads/supervisor.d.ts.map +1 -1
- package/dist/threads/supervisor.js +766 -427
- package/dist/threads/supervisor.js.map +1 -1
- package/dist/threads/task-workspace.d.ts +8 -0
- package/dist/threads/task-workspace.d.ts.map +1 -0
- package/dist/threads/task-workspace.js +52 -0
- package/dist/threads/task-workspace.js.map +1 -0
- package/dist/threads/worker-entry.d.ts.map +1 -1
- package/dist/threads/worker-entry.js +314 -34
- package/dist/threads/worker-entry.js.map +1 -1
- package/dist/threads/worker-execution-runtime.d.ts +75 -0
- package/dist/threads/worker-execution-runtime.d.ts.map +1 -0
- package/dist/threads/worker-execution-runtime.js +142 -0
- package/dist/threads/worker-execution-runtime.js.map +1 -0
- package/dist/threads/worker-execution.d.ts +35 -0
- package/dist/threads/worker-execution.d.ts.map +1 -0
- package/dist/threads/worker-execution.js +2 -0
- package/dist/threads/worker-execution.js.map +1 -0
- package/dist/threads/worker-runtime-policy.d.ts +42 -0
- package/dist/threads/worker-runtime-policy.d.ts.map +1 -0
- package/dist/threads/worker-runtime-policy.js +98 -0
- package/dist/threads/worker-runtime-policy.js.map +1 -0
- package/dist/tools/adapter-tool.d.ts +12 -0
- package/dist/tools/adapter-tool.d.ts.map +1 -0
- package/dist/tools/adapter-tool.js +2 -0
- package/dist/tools/adapter-tool.js.map +1 -0
- package/dist/tools/data-service.d.ts +2 -2
- package/dist/tools/delegation.d.ts +121 -0
- package/dist/tools/delegation.d.ts.map +1 -0
- package/dist/tools/delegation.js +106 -0
- package/dist/tools/delegation.js.map +1 -0
- package/dist/tools/dream-memory.d.ts +122 -0
- package/dist/tools/dream-memory.d.ts.map +1 -0
- package/dist/tools/dream-memory.js +513 -0
- package/dist/tools/dream-memory.js.map +1 -0
- package/dist/tools/email.d.ts +1 -1
- package/dist/tools/execution-control.d.ts +31 -0
- package/dist/tools/execution-control.d.ts.map +1 -0
- package/dist/tools/execution-control.js +71 -0
- package/dist/tools/execution-control.js.map +1 -0
- package/dist/tools/index.d.ts +5 -7
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +7 -13
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/mcp-manager.d.ts +1 -1
- package/dist/tools/memory.d.ts +1 -1
- package/dist/tools/memory.d.ts.map +1 -1
- package/dist/tools/memory.js +69 -45
- package/dist/tools/memory.js.map +1 -1
- package/dist/tools/notify.d.ts +5 -0
- package/dist/tools/notify.d.ts.map +1 -1
- package/dist/tools/notify.js +45 -10
- package/dist/tools/notify.js.map +1 -1
- package/dist/tools/skill.d.ts +1 -1
- package/dist/tools/totp.d.ts +1 -1
- package/dist/tui/client.d.ts +1 -16
- package/dist/tui/client.d.ts.map +1 -1
- package/dist/tui/client.js +0 -4
- package/dist/tui/client.js.map +1 -1
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +0 -41
- package/dist/tui/index.js.map +1 -1
- package/dist/tui/protocol.d.ts +2 -1
- package/dist/tui/protocol.d.ts.map +1 -1
- package/dist/tui/protocol.js +2 -1
- package/dist/tui/protocol.js.map +1 -1
- package/dist/tui/renderer.d.ts.map +1 -1
- package/dist/tui/renderer.js +0 -5
- package/dist/tui/renderer.js.map +1 -1
- package/dist/tui/request-store.d.ts +1 -1
- package/dist/tui/request-store.d.ts.map +1 -1
- package/dist/tui/request-store.js +2 -2
- package/dist/tui/request-store.js.map +1 -1
- package/dist/tui/server.d.ts.map +1 -1
- package/dist/tui/server.js +137 -25
- package/dist/tui/server.js.map +1 -1
- package/dist/utils/claude-transcripts.d.ts +6 -0
- package/dist/utils/claude-transcripts.d.ts.map +1 -1
- package/dist/utils/claude-transcripts.js +8 -2
- package/dist/utils/claude-transcripts.js.map +1 -1
- package/dist/utils/restart.d.ts.map +1 -1
- package/dist/utils/restart.js +6 -0
- package/dist/utils/restart.js.map +1 -1
- package/dist-agent/bundle.cjs +2 -2
- package/package.json +1 -1
- package/dist/agent/mailbox.d.ts +0 -50
- package/dist/agent/mailbox.d.ts.map +0 -1
- package/dist/agent/mailbox.js +0 -124
- package/dist/agent/mailbox.js.map +0 -1
- package/dist/agent/nightly-maintenance/memory-dreaming-sweep.d.ts +0 -77
- package/dist/agent/nightly-maintenance/memory-dreaming-sweep.d.ts.map +0 -1
- package/dist/agent/nightly-maintenance/memory-dreaming-sweep.js +0 -158
- package/dist/agent/nightly-maintenance/memory-dreaming-sweep.js.map +0 -1
- package/dist/agent/nightly-maintenance/memory-dreaming.d.ts +0 -116
- package/dist/agent/nightly-maintenance/memory-dreaming.d.ts.map +0 -1
- package/dist/agent/nightly-maintenance/memory-dreaming.js +0 -458
- package/dist/agent/nightly-maintenance/memory-dreaming.js.map +0 -1
- package/dist/threads/task-contracts.d.ts +0 -194
- package/dist/threads/task-contracts.d.ts.map +0 -1
- package/dist/threads/task-contracts.js +0 -82
- package/dist/threads/task-contracts.js.map +0 -1
- package/dist/threads/task-sidecar.d.ts +0 -145
- package/dist/threads/task-sidecar.d.ts.map +0 -1
- package/dist/threads/task-sidecar.js +0 -311
- package/dist/threads/task-sidecar.js.map +0 -1
- package/dist/threads/task-store.d.ts +0 -172
- package/dist/threads/task-store.d.ts.map +0 -1
- package/dist/threads/task-store.js +0 -599
- package/dist/threads/task-store.js.map +0 -1
- package/dist/threads/thread-task-context.d.ts +0 -40
- package/dist/threads/thread-task-context.d.ts.map +0 -1
- package/dist/threads/thread-task-context.js +0 -160
- package/dist/threads/thread-task-context.js.map +0 -1
- package/dist/threads/thread-task-controller.d.ts +0 -122
- package/dist/threads/thread-task-controller.d.ts.map +0 -1
- package/dist/threads/thread-task-controller.js +0 -276
- package/dist/threads/thread-task-controller.js.map +0 -1
- package/dist/threads/thread-task-runtime.d.ts +0 -354
- package/dist/threads/thread-task-runtime.d.ts.map +0 -1
- package/dist/threads/thread-task-runtime.js +0 -917
- package/dist/threads/thread-task-runtime.js.map +0 -1
- package/dist/tools/switch-session.d.ts +0 -15
- package/dist/tools/switch-session.d.ts.map +0 -1
- package/dist/tools/switch-session.js +0 -88
- package/dist/tools/switch-session.js.map +0 -1
- package/dist/tools/thread-tasks.d.ts +0 -23
- package/dist/tools/thread-tasks.d.ts.map +0 -1
- package/dist/tools/thread-tasks.js +0 -122
- package/dist/tools/thread-tasks.js.map +0 -1
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { logger } from "../logger.js";
|
|
2
|
+
import { EXECUTOR_INTERRUPTED_EXIT_CODE } from "./executor-exit.js";
|
|
3
|
+
/** Message meta key carrying the input sequence an injected message delivers. */
|
|
4
|
+
export const EXECUTION_INPUT_SEQ_META_KEY = "executionInputSeq";
|
|
5
|
+
/**
|
|
6
|
+
* Worker side of an internal execution (#2805 1c).
|
|
7
|
+
*
|
|
8
|
+
* The worker never writes the execution store. It reports its result,
|
|
9
|
+
* progress, questions, applied inputs, usage and tool-call boundaries over
|
|
10
|
+
* IPC, and the host validates each report against the executor generation it
|
|
11
|
+
* started. One runtime exists per worker process; tools reach it through
|
|
12
|
+
* {@link getWorkerExecutionRuntime}.
|
|
13
|
+
*
|
|
14
|
+
* An input counts as applied only once it was handed to the model, not when
|
|
15
|
+
* it arrived over IPC: a result reported before the model saw an input must
|
|
16
|
+
* not claim to have processed it.
|
|
17
|
+
*/
|
|
18
|
+
export class WorkerExecutionRuntime {
|
|
19
|
+
executionId;
|
|
20
|
+
send;
|
|
21
|
+
requiresUserMessage;
|
|
22
|
+
processedInputSeq;
|
|
23
|
+
receivedInputSeq;
|
|
24
|
+
terminalReported = false;
|
|
25
|
+
lastError = null;
|
|
26
|
+
pending = [];
|
|
27
|
+
constructor(executionId, initialInputSeq, send, requiresUserMessage = false) {
|
|
28
|
+
this.executionId = executionId;
|
|
29
|
+
this.send = send;
|
|
30
|
+
this.requiresUserMessage = requiresUserMessage;
|
|
31
|
+
this.processedInputSeq = initialInputSeq;
|
|
32
|
+
this.receivedInputSeq = initialInputSeq;
|
|
33
|
+
}
|
|
34
|
+
get hasReportedResult() {
|
|
35
|
+
return this.terminalReported;
|
|
36
|
+
}
|
|
37
|
+
get inputSeq() {
|
|
38
|
+
return this.processedInputSeq;
|
|
39
|
+
}
|
|
40
|
+
/** The last model/session error seen by this worker, for a failure report. */
|
|
41
|
+
get lastErrorMessage() {
|
|
42
|
+
return this.lastError;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Note an input delivered by the host; ignore duplicates and stale ones.
|
|
46
|
+
* The host accepts input only before it commits a result, so a result this
|
|
47
|
+
* worker reported earlier was refused for it: a new report is allowed.
|
|
48
|
+
*/
|
|
49
|
+
receiveInput(input) {
|
|
50
|
+
if (input.executionId !== this.executionId || input.inputSeq <= this.receivedInputSeq)
|
|
51
|
+
return false;
|
|
52
|
+
this.terminalReported = false;
|
|
53
|
+
this.receivedInputSeq = input.inputSeq;
|
|
54
|
+
this.pending.push(input);
|
|
55
|
+
this.pending.sort((a, b) => a.inputSeq - b.inputSeq);
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
/** Take buffered inputs for injection; each becomes `input_applied` once the model receives it. */
|
|
59
|
+
takePendingInputs() {
|
|
60
|
+
const taken = this.pending.splice(0);
|
|
61
|
+
return taken;
|
|
62
|
+
}
|
|
63
|
+
markInputApplied(inputSeq) {
|
|
64
|
+
if (inputSeq <= this.processedInputSeq)
|
|
65
|
+
return;
|
|
66
|
+
this.processedInputSeq = inputSeq;
|
|
67
|
+
this.send({ type: "execution-input-applied", executionId: this.executionId, inputSeq });
|
|
68
|
+
}
|
|
69
|
+
reportProgress(summary) {
|
|
70
|
+
this.send({ type: "execution-progress", executionId: this.executionId, summary: summary.slice(0, 4_000) });
|
|
71
|
+
}
|
|
72
|
+
askQuestion(text, choices, delivery = "review") {
|
|
73
|
+
this.send({
|
|
74
|
+
type: "execution-question", executionId: this.executionId, text: text.slice(0, 4_000),
|
|
75
|
+
...(choices ? { choices: choices.slice(0, 10) } : {}),
|
|
76
|
+
...(delivery === "direct" ? { delivery } : {}),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
toolBoundary(callId, toolName, phase) {
|
|
80
|
+
this.send({ type: "execution-tool", executionId: this.executionId, callId, toolName, phase });
|
|
81
|
+
}
|
|
82
|
+
/** The host keeps the authoritative usage; every local change is reported. */
|
|
83
|
+
reportUsage(usage) {
|
|
84
|
+
this.send({ type: "execution-usage", executionId: this.executionId, usage });
|
|
85
|
+
}
|
|
86
|
+
noteError(message) {
|
|
87
|
+
this.lastError = message.slice(0, 500);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Report the terminal result once. A success is refused locally while an
|
|
91
|
+
* input that arrived has not reached the model yet: the model must see it
|
|
92
|
+
* first. A failure may be reported regardless.
|
|
93
|
+
*/
|
|
94
|
+
reportResult(result) {
|
|
95
|
+
if (this.terminalReported)
|
|
96
|
+
return { accepted: false, reason: "already_reported" };
|
|
97
|
+
if (result.status === "succeeded" && this.receivedInputSeq > this.processedInputSeq) {
|
|
98
|
+
return { accepted: false, reason: "pending_input" };
|
|
99
|
+
}
|
|
100
|
+
this.terminalReported = true;
|
|
101
|
+
this.send({
|
|
102
|
+
type: "execution-result",
|
|
103
|
+
executionId: this.executionId,
|
|
104
|
+
processedInputSeq: this.processedInputSeq,
|
|
105
|
+
...result,
|
|
106
|
+
});
|
|
107
|
+
logger.system(`[execution] Reported ${result.status} for execution=${this.executionId}`);
|
|
108
|
+
return { accepted: true };
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
let current = null;
|
|
112
|
+
export function installWorkerExecutionRuntime(runtime) {
|
|
113
|
+
current = runtime;
|
|
114
|
+
}
|
|
115
|
+
export function getWorkerExecutionRuntime() {
|
|
116
|
+
return current;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* The exit code this process should end with: an execution stopped before it
|
|
120
|
+
* reported a result (shutdown request, signal, lost host) is an interruption
|
|
121
|
+
* the host may resume, not a finished task.
|
|
122
|
+
*/
|
|
123
|
+
export function executorExitCode() {
|
|
124
|
+
return current && !current.hasReportedResult ? EXECUTOR_INTERRUPTED_EXIT_CODE : 0;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* These messages were just handed to the model (a new turn, or injected into
|
|
128
|
+
* the running one). Execution inputs among them now count as applied.
|
|
129
|
+
*/
|
|
130
|
+
export function noteMessagesHandedToModel(messages) {
|
|
131
|
+
if (!current)
|
|
132
|
+
return;
|
|
133
|
+
let highest = 0;
|
|
134
|
+
for (const message of messages) {
|
|
135
|
+
const seq = message.meta?.[EXECUTION_INPUT_SEQ_META_KEY];
|
|
136
|
+
if (typeof seq === "number" && seq > highest)
|
|
137
|
+
highest = seq;
|
|
138
|
+
}
|
|
139
|
+
if (highest > 0)
|
|
140
|
+
current.markInputApplied(highest);
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=worker-execution-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-execution-runtime.js","sourceRoot":"","sources":["../../src/threads/worker-execution-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC,OAAO,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAEpE,iFAAiF;AACjF,MAAM,CAAC,MAAM,4BAA4B,GAAG,mBAAmB,CAAC;AAMhE;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,sBAAsB;IAQtB;IAEQ;IACR;IAVH,iBAAiB,CAAS;IAC1B,gBAAgB,CAAS;IACzB,gBAAgB,GAAG,KAAK,CAAC;IACzB,SAAS,GAAkB,IAAI,CAAC;IACvB,OAAO,GAAwB,EAAE,CAAC;IAEnD,YACW,WAAmB,EAC5B,eAAuB,EACN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C;IAC3E,IAAI,CAAC,OAAO;QAAE,OAAO;IACrB,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,4BAA4B,CAAC,CAAC;QACzD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,GAAG,OAAO;YAAE,OAAO,GAAG,GAAG,CAAC;IAC9D,CAAC;IACD,IAAI,OAAO,GAAG,CAAC;QAAE,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { AdapterTool } from "../tools/adapter-tool.js";
|
|
2
|
+
import type { VisionClawConfig } from "../config/types.js";
|
|
3
|
+
import type { ActiveWorkerRuntimePolicy } from "./worker-runtime-policy.js";
|
|
4
|
+
import type { ExecutionSnapshot } from "./execution-snapshot.js";
|
|
5
|
+
import type { ExecutionBudgetMeter } from "./execution-budget.js";
|
|
6
|
+
/**
|
|
7
|
+
* A bounded execution installed by the trusted worker host, after admission.
|
|
8
|
+
*
|
|
9
|
+
* Unlike a conversational worker, it receives only dispatched task context,
|
|
10
|
+
* drains its queue, then returns control to its host. Business adapters own
|
|
11
|
+
* the prompt and any additional host-backed capabilities. This object never
|
|
12
|
+
* comes from message metadata or model output.
|
|
13
|
+
*/
|
|
14
|
+
export interface WorkerExecution {
|
|
15
|
+
id: string;
|
|
16
|
+
policy: ActiveWorkerRuntimePolicy;
|
|
17
|
+
/** Effective snapshot frozen by the admitting host and verified at startup. */
|
|
18
|
+
snapshot: ExecutionSnapshot;
|
|
19
|
+
/** Task budget restored from this execution's own durable record. */
|
|
20
|
+
budget: ExecutionBudgetMeter;
|
|
21
|
+
/** Rebuild against the current config after a model switch or refresh. */
|
|
22
|
+
buildSystemPrompt: (config: VisionClawConfig) => string;
|
|
23
|
+
/**
|
|
24
|
+
* The adapter's own tool registrations (e.g. Lab's lab_run_control). The
|
|
25
|
+
* host exposes them only through the policy allowlist; an adapter cannot
|
|
26
|
+
* change any other part of the restricted surface.
|
|
27
|
+
*/
|
|
28
|
+
adapterTools?: readonly AdapterTool[];
|
|
29
|
+
/**
|
|
30
|
+
* The conversation is private data (Dreaming reads and edits memory): its
|
|
31
|
+
* transcripts are not shipped as runtime telemetry and logs carry no content.
|
|
32
|
+
*/
|
|
33
|
+
privateContent?: boolean;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=worker-execution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-execution.d.ts","sourceRoot":"","sources":["../../src/threads/worker-execution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,yBAAyB,CAAC;IAClC,+EAA+E;IAC/E,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,qEAAqE;IACrE,MAAM,EAAE,oBAAoB,CAAC;IAC7B,0EAA0E;IAC1E,iBAAiB,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,MAAM,CAAC;IACxD;;;;OAIG;IACH,YAAY,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;IACtC;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-execution.js","sourceRoot":"","sources":["../../src/threads/worker-execution.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { VisionClawConfig } from "../config/types.js";
|
|
3
|
+
import type { RuntimeSurface } from "../agent/runtime-surface.js";
|
|
4
|
+
import type { AdapterTool } from "../tools/adapter-tool.js";
|
|
5
|
+
/** Capabilities selected by a trusted caller, independent of its business identity. */
|
|
6
|
+
export declare const WorkerRuntimePolicySchema: z.ZodObject<{
|
|
7
|
+
prompt: z.ZodObject<{
|
|
8
|
+
trustedOverlay: z.ZodDefault<z.ZodString>;
|
|
9
|
+
}, z.core.$strict>;
|
|
10
|
+
skills: z.ZodObject<{
|
|
11
|
+
allowed: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
12
|
+
}, z.core.$strict>;
|
|
13
|
+
mcp: z.ZodObject<{
|
|
14
|
+
staticServers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{}, z.core.$strict>>>;
|
|
15
|
+
}, z.core.$strict>;
|
|
16
|
+
tools: z.ZodObject<{
|
|
17
|
+
allowed: z.ZodArray<z.ZodString>;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
channels: z.ZodObject<{
|
|
20
|
+
outbound: z.ZodTuple<[], null>;
|
|
21
|
+
}, z.core.$strict>;
|
|
22
|
+
}, z.core.$strict>;
|
|
23
|
+
export type WorkerRuntimePolicy = z.infer<typeof WorkerRuntimePolicySchema>;
|
|
24
|
+
export interface ActiveWorkerRuntimePolicy {
|
|
25
|
+
policy: WorkerRuntimePolicy;
|
|
26
|
+
/** Digest of the caller's authorized execution snapshot. */
|
|
27
|
+
digest: string;
|
|
28
|
+
}
|
|
29
|
+
/** Claude may emit incremental Task tools instead of the legacy TodoWrite. */
|
|
30
|
+
export declare const CLAUDE_TODO_TRACKING_TOOLS: readonly ["TodoWrite", "TaskCreate", "TaskUpdate", "TaskGet", "TaskList"];
|
|
31
|
+
export declare function resolvePiWorkerToolNames(toolNames: readonly string[]): string[];
|
|
32
|
+
export declare function resolveClaudeWorkerNativeToolNames(toolNames: readonly string[]): string[];
|
|
33
|
+
/** Remove owner channels and integrations from the config an internal worker runs with. */
|
|
34
|
+
export declare function isolateWorkerConfig(config: VisionClawConfig): VisionClawConfig;
|
|
35
|
+
/**
|
|
36
|
+
* The restricted surface of an internal execution. Applied by the host after
|
|
37
|
+
* everything else, so no adapter can restore credentials or MCP servers,
|
|
38
|
+
* replace the policy, or attach its own budget. `adapterTools` is the only
|
|
39
|
+
* adapter-supplied input, and the policy allowlist still filters it.
|
|
40
|
+
*/
|
|
41
|
+
export declare function applyWorkerRuntimePolicyToSurface(surface: RuntimeSurface, active: ActiveWorkerRuntimePolicy, adapterTools?: readonly AdapterTool[]): RuntimeSurface;
|
|
42
|
+
//# sourceMappingURL=worker-runtime-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-runtime-policy.d.ts","sourceRoot":"","sources":["../../src/threads/worker-runtime-policy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAI5D,uFAAuF;AACvF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;kBAgB3B,CAAC;AAEZ,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC;CAChB;AAcD,8EAA8E;AAC9E,eAAO,MAAM,0BAA0B,2EAE7B,CAAC;AAiBX,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAE/E;AAED,wBAAgB,kCAAkC,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAKzF;AAED,2FAA2F;AAC3F,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CAa9E;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,yBAAyB,EACjC,YAAY,GAAE,SAAS,WAAW,EAAO,GACxC,cAAc,CAmBhB"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const slugSchema = z.string().regex(/^[a-z0-9][a-z0-9._-]{0,63}$/);
|
|
3
|
+
/** Capabilities selected by a trusted caller, independent of its business identity. */
|
|
4
|
+
export const WorkerRuntimePolicySchema = z.object({
|
|
5
|
+
prompt: z.object({
|
|
6
|
+
trustedOverlay: z.string().max(20_000).default(""),
|
|
7
|
+
}).strict(),
|
|
8
|
+
skills: z.object({
|
|
9
|
+
allowed: z.array(slugSchema).max(64).default([]),
|
|
10
|
+
}).strict(),
|
|
11
|
+
mcp: z.object({
|
|
12
|
+
staticServers: z.record(slugSchema, z.object({}).strict()).default({}),
|
|
13
|
+
}).strict(),
|
|
14
|
+
tools: z.object({
|
|
15
|
+
allowed: z.array(slugSchema).min(1).max(64),
|
|
16
|
+
}).strict(),
|
|
17
|
+
channels: z.object({
|
|
18
|
+
outbound: z.tuple([]),
|
|
19
|
+
}).strict(),
|
|
20
|
+
}).strict();
|
|
21
|
+
const PI_WORKER_TOOL_NAMES = {
|
|
22
|
+
read: "visionclaw_read",
|
|
23
|
+
write: "visionclaw_write",
|
|
24
|
+
edit: "visionclaw_edit",
|
|
25
|
+
grep: "visionclaw_grep",
|
|
26
|
+
find: "visionclaw_find",
|
|
27
|
+
ls: "visionclaw_ls",
|
|
28
|
+
bash: "visionclaw_bash",
|
|
29
|
+
todo_write: "TodoWrite",
|
|
30
|
+
web_fetch: "WebFetch",
|
|
31
|
+
};
|
|
32
|
+
/** Claude may emit incremental Task tools instead of the legacy TodoWrite. */
|
|
33
|
+
export const CLAUDE_TODO_TRACKING_TOOLS = [
|
|
34
|
+
"TodoWrite", "TaskCreate", "TaskUpdate", "TaskGet", "TaskList",
|
|
35
|
+
];
|
|
36
|
+
const CLAUDE_WORKER_TOOL_NAMES = {
|
|
37
|
+
read: "Read",
|
|
38
|
+
write: "Write",
|
|
39
|
+
edit: "Edit",
|
|
40
|
+
grep: "Grep",
|
|
41
|
+
find: "Glob",
|
|
42
|
+
ls: "Glob",
|
|
43
|
+
bash: "Bash",
|
|
44
|
+
todo_write: CLAUDE_TODO_TRACKING_TOOLS,
|
|
45
|
+
// Subagents run with the parent's restricted tools; their calls are metered.
|
|
46
|
+
agent: ["Agent", "Task"],
|
|
47
|
+
web_fetch: "WebFetch",
|
|
48
|
+
web_search: "WebSearch",
|
|
49
|
+
};
|
|
50
|
+
export function resolvePiWorkerToolNames(toolNames) {
|
|
51
|
+
return [...new Set(toolNames.map((name) => PI_WORKER_TOOL_NAMES[name] ?? name))];
|
|
52
|
+
}
|
|
53
|
+
export function resolveClaudeWorkerNativeToolNames(toolNames) {
|
|
54
|
+
return [...new Set(toolNames.flatMap((name) => {
|
|
55
|
+
const mapped = CLAUDE_WORKER_TOOL_NAMES[name];
|
|
56
|
+
return mapped ? (typeof mapped === "string" ? [mapped] : [...mapped]) : [];
|
|
57
|
+
}))];
|
|
58
|
+
}
|
|
59
|
+
/** Remove owner channels and integrations from the config an internal worker runs with. */
|
|
60
|
+
export function isolateWorkerConfig(config) {
|
|
61
|
+
const isolated = structuredClone(config);
|
|
62
|
+
isolated.gmail = "";
|
|
63
|
+
isolated.channels = {};
|
|
64
|
+
isolated.capabilities = {
|
|
65
|
+
schemaVersion: 1,
|
|
66
|
+
...isolated.capabilities,
|
|
67
|
+
managedWorkspace: false,
|
|
68
|
+
proactiveWake: false,
|
|
69
|
+
tunnel: false,
|
|
70
|
+
gemini: false,
|
|
71
|
+
};
|
|
72
|
+
return isolated;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The restricted surface of an internal execution. Applied by the host after
|
|
76
|
+
* everything else, so no adapter can restore credentials or MCP servers,
|
|
77
|
+
* replace the policy, or attach its own budget. `adapterTools` is the only
|
|
78
|
+
* adapter-supplied input, and the policy allowlist still filters it.
|
|
79
|
+
*/
|
|
80
|
+
export function applyWorkerRuntimePolicyToSurface(surface, active, adapterTools = []) {
|
|
81
|
+
return {
|
|
82
|
+
...surface,
|
|
83
|
+
credentialBacked: {
|
|
84
|
+
eventTrigger: false,
|
|
85
|
+
financialTool: false,
|
|
86
|
+
finApp: false,
|
|
87
|
+
serpApi: false,
|
|
88
|
+
},
|
|
89
|
+
externalMcpServers: Object.fromEntries(Object.entries(surface.externalMcpServers)
|
|
90
|
+
.filter(([name]) => Object.hasOwn(active.policy.mcp.staticServers, name))),
|
|
91
|
+
workerRuntimePolicy: active,
|
|
92
|
+
// Every execution requires fresh adapter authorization and its own budget,
|
|
93
|
+
// even when reusing a surface.
|
|
94
|
+
adapterTools,
|
|
95
|
+
executionBudget: undefined,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=worker-runtime-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-runtime-policy.js","sourceRoot":"","sources":["../../src/threads/worker-runtime-policy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;AAEnE,uFAAuF;AACvF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,cAAc,EAAE,CAAC,CAAC,MAAM,EAA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AC;QAChB,GAAG,QAAQ,CAAC,YAAY;QACxB,gBAAgB,EAAE,KAAK;QACvB,aAAa,EAAE,KAAK;QACpB,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,KAAK;KACd,CAAC;IACF,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iCAAiC,CAC/C,OAAuB,EACvB,MAAiC,EACjC,eAAuC,EAAE;IAEzC,OAAO;QACL,GAAG,OAAO;QACV,gBAAgB,EAAE;YAChB,YAAY,EAAE,KAAK;YACnB,aAAa,EAAE,KAAK;YACpB,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,KAAK;SACf;QACD,kBAAkB,EAAE,MAAM,CAAC,WAAW,CACpC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC;aACvC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC,CAC5E;QACD,mBAAmB,EAAE,MAAM;QAC3B,2EAA2E;QAC3E,+BAA+B;QAC/B,YAAY;QACZ,eAAe,EAAE,SAAS;KAC3B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SdkMcpToolDefinition } from "@anthropic-ai/claude-agent-sdk";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
/**
|
|
4
|
+
* A VisionClaw tool registered by a trusted execution adapter, such as the Lab
|
|
5
|
+
* adapter's `lab_run_control`. Both engines expose these through the same
|
|
6
|
+
* allowlist filter as built-in tools. The handler's argument type is erased so
|
|
7
|
+
* differently-typed definitions can share one list.
|
|
8
|
+
*/
|
|
9
|
+
export type AdapterTool = Omit<SdkMcpToolDefinition, "handler"> & {
|
|
10
|
+
handler: (args: never, extra: unknown) => Promise<CallToolResult>;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=adapter-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter-tool.d.ts","sourceRoot":"","sources":["../../src/tools/adapter-tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEzE;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC,GAAG;IAChE,OAAO,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;CACnE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter-tool.js","sourceRoot":"","sources":["../../src/tools/adapter-tool.ts"],"names":[],"mappings":""}
|
|
@@ -161,9 +161,9 @@ export declare class DataServiceProvider {
|
|
|
161
161
|
}
|
|
162
162
|
export declare const queryMarketDataTool: import("@anthropic-ai/claude-agent-sdk").SdkMcpToolDefinition<{
|
|
163
163
|
operation: z.ZodOptional<z.ZodEnum<{
|
|
164
|
-
query: "query";
|
|
165
164
|
catalog: "catalog";
|
|
166
165
|
plan: "plan";
|
|
166
|
+
query: "query";
|
|
167
167
|
}>>;
|
|
168
168
|
mode: z.ZodOptional<z.ZodEnum<{
|
|
169
169
|
product: "product";
|
|
@@ -187,9 +187,9 @@ export declare const queryMarketDataTool: import("@anthropic-ai/claude-agent-sdk
|
|
|
187
187
|
export declare function gruReferenceDataRoot(workspaceCwd?: string): string;
|
|
188
188
|
export declare const queryReferenceDataTool: import("@anthropic-ai/claude-agent-sdk").SdkMcpToolDefinition<{
|
|
189
189
|
operation: z.ZodOptional<z.ZodEnum<{
|
|
190
|
-
query: "query";
|
|
191
190
|
catalog: "catalog";
|
|
192
191
|
plan: "plan";
|
|
192
|
+
query: "query";
|
|
193
193
|
}>>;
|
|
194
194
|
mode: z.ZodOptional<z.ZodEnum<{
|
|
195
195
|
product: "product";
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
export declare const delegateTaskTool: import("@anthropic-ai/claude-agent-sdk").SdkMcpToolDefinition<{
|
|
2
|
+
source_message_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
3
|
+
key: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
4
|
+
title: import("zod").ZodString;
|
|
5
|
+
goal: import("zod").ZodString;
|
|
6
|
+
requirements: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
7
|
+
expected_output: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
8
|
+
context: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
9
|
+
done: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
10
|
+
remaining: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
11
|
+
artifacts: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
12
|
+
uncertain_operations: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
13
|
+
project_dir: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
14
|
+
workspace_mode: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodEnum<{
|
|
15
|
+
read_only: "read_only";
|
|
16
|
+
shared: "shared";
|
|
17
|
+
}>>>;
|
|
18
|
+
context_task_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
19
|
+
retry_task_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
20
|
+
}>;
|
|
21
|
+
export declare const delegateTasksTool: import("@anthropic-ai/claude-agent-sdk").SdkMcpToolDefinition<{
|
|
22
|
+
source_message_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
23
|
+
title: import("zod").ZodString;
|
|
24
|
+
result_mode: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
25
|
+
separate: "separate";
|
|
26
|
+
combined: "combined";
|
|
27
|
+
}>>;
|
|
28
|
+
tasks: import("zod").ZodArray<import("zod").ZodObject<{
|
|
29
|
+
key: import("zod").ZodString;
|
|
30
|
+
title: import("zod").ZodString;
|
|
31
|
+
done: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
32
|
+
remaining: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
33
|
+
goal: import("zod").ZodString;
|
|
34
|
+
requirements: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
35
|
+
artifacts: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
36
|
+
workspace_mode: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
37
|
+
read_only: "read_only";
|
|
38
|
+
shared: "shared";
|
|
39
|
+
isolated: "isolated";
|
|
40
|
+
}>>;
|
|
41
|
+
source_message_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
42
|
+
expected_output: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
43
|
+
context: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
44
|
+
uncertain_operations: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
45
|
+
project_dir: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
46
|
+
context_task_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
47
|
+
}, import("zod/v4/core").$strip>>;
|
|
48
|
+
}>;
|
|
49
|
+
export declare const backgroundTaskStatusTool: import("@anthropic-ai/claude-agent-sdk").SdkMcpToolDefinition<{
|
|
50
|
+
task_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
51
|
+
}>;
|
|
52
|
+
export declare const backgroundTaskInputTool: import("@anthropic-ai/claude-agent-sdk").SdkMcpToolDefinition<{
|
|
53
|
+
task_id: import("zod").ZodString;
|
|
54
|
+
text: import("zod").ZodString;
|
|
55
|
+
question_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
56
|
+
}>;
|
|
57
|
+
export declare const backgroundTaskCancelTool: import("@anthropic-ai/claude-agent-sdk").SdkMcpToolDefinition<{
|
|
58
|
+
task_id: import("zod").ZodString;
|
|
59
|
+
requested_by_user: import("zod").ZodBoolean;
|
|
60
|
+
reason: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
61
|
+
}>;
|
|
62
|
+
export declare const DELEGATION_TOOLS: readonly [import("@anthropic-ai/claude-agent-sdk").SdkMcpToolDefinition<{
|
|
63
|
+
source_message_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
64
|
+
key: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
65
|
+
title: import("zod").ZodString;
|
|
66
|
+
goal: import("zod").ZodString;
|
|
67
|
+
requirements: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
68
|
+
expected_output: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
69
|
+
context: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
70
|
+
done: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
71
|
+
remaining: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
72
|
+
artifacts: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
73
|
+
uncertain_operations: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
74
|
+
project_dir: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
75
|
+
workspace_mode: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodEnum<{
|
|
76
|
+
read_only: "read_only";
|
|
77
|
+
shared: "shared";
|
|
78
|
+
}>>>;
|
|
79
|
+
context_task_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
80
|
+
retry_task_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
81
|
+
}>, import("@anthropic-ai/claude-agent-sdk").SdkMcpToolDefinition<{
|
|
82
|
+
source_message_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
83
|
+
title: import("zod").ZodString;
|
|
84
|
+
result_mode: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
85
|
+
separate: "separate";
|
|
86
|
+
combined: "combined";
|
|
87
|
+
}>>;
|
|
88
|
+
tasks: import("zod").ZodArray<import("zod").ZodObject<{
|
|
89
|
+
key: import("zod").ZodString;
|
|
90
|
+
title: import("zod").ZodString;
|
|
91
|
+
done: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
92
|
+
remaining: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
93
|
+
goal: import("zod").ZodString;
|
|
94
|
+
requirements: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
95
|
+
artifacts: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
96
|
+
workspace_mode: import("zod").ZodDefault<import("zod").ZodEnum<{
|
|
97
|
+
read_only: "read_only";
|
|
98
|
+
shared: "shared";
|
|
99
|
+
isolated: "isolated";
|
|
100
|
+
}>>;
|
|
101
|
+
source_message_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
102
|
+
expected_output: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
103
|
+
context: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
104
|
+
uncertain_operations: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
105
|
+
project_dir: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
106
|
+
context_task_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
107
|
+
}, import("zod/v4/core").$strip>>;
|
|
108
|
+
}>, import("@anthropic-ai/claude-agent-sdk").SdkMcpToolDefinition<{
|
|
109
|
+
task_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
110
|
+
}>, import("@anthropic-ai/claude-agent-sdk").SdkMcpToolDefinition<{
|
|
111
|
+
task_id: import("zod").ZodString;
|
|
112
|
+
text: import("zod").ZodString;
|
|
113
|
+
question_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
114
|
+
}>, import("@anthropic-ai/claude-agent-sdk").SdkMcpToolDefinition<{
|
|
115
|
+
task_id: import("zod").ZodString;
|
|
116
|
+
requested_by_user: import("zod").ZodBoolean;
|
|
117
|
+
reason: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
118
|
+
}>];
|
|
119
|
+
/** A disabled delegation feature still exposes control of already admitted Tasks. */
|
|
120
|
+
export declare function availableTaskTools(): typeof DELEGATION_TOOLS[number][];
|
|
121
|
+
//# sourceMappingURL=delegation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegation.d.ts","sourceRoot":"","sources":["../../src/tools/delegation.ts"],"names":[],"mappings":"AAoFA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;EAK5B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;EAK7B,CAAC;AAEF,eAAO,MAAM,wBAAwB;;EAKpC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;EAKnC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;EAKpC,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAMnB,CAAC;AAEX,qFAAqF;AACrF,wBAAgB,kBAAkB,IAAI,OAAO,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAMtE"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { tool } from "@anthropic-ai/claude-agent-sdk";
|
|
3
|
+
import { getAgentState } from "../agent/state.js";
|
|
4
|
+
import { buildTaskReplyTarget } from "../agent/reply-target.js";
|
|
5
|
+
import { getMessageDedupKey } from "../channels/message-dedup.js";
|
|
6
|
+
import { getForegroundTaskTracker } from "../threads/foreground-task.js";
|
|
7
|
+
import { BACKGROUND_TASK_CANCEL_ARGS, BACKGROUND_TASK_INPUT_ARGS, BACKGROUND_TASK_STATUS_ARGS, DELEGATE_TASK_ARGS, DELEGATE_TASKS_ARGS, getForemanClient, } from "../threads/foreman-protocol.js";
|
|
8
|
+
/**
|
|
9
|
+
* General's background-task tools (#2805 stage 3, Foreman). They only
|
|
10
|
+
* coordinate: the work itself runs in a background worker, and none of these
|
|
11
|
+
* calls count against the foreground tool-call limit.
|
|
12
|
+
*
|
|
13
|
+
* Identity and routing never come from the model: the host binds every task
|
|
14
|
+
* to the conversation that sends the command, and the dispatch records the
|
|
15
|
+
* reply target of the inbound message this wake is serving.
|
|
16
|
+
*/
|
|
17
|
+
function reply(text, isError = false) {
|
|
18
|
+
return { ...(isError ? { isError: true } : {}), content: [{ type: "text", text }] };
|
|
19
|
+
}
|
|
20
|
+
const UNAVAILABLE = "Error: background tasks are not available in this conversation.";
|
|
21
|
+
/** Resolve routing from an actual queue claim, never from model-supplied addresses. */
|
|
22
|
+
function dispatchSource(sourceMessageId) {
|
|
23
|
+
let state;
|
|
24
|
+
try {
|
|
25
|
+
state = getAgentState();
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return {};
|
|
29
|
+
}
|
|
30
|
+
let claims = [];
|
|
31
|
+
try {
|
|
32
|
+
claims = state.messageQueue.currentCycleClaims();
|
|
33
|
+
}
|
|
34
|
+
catch { /* legacy callers may have no queue */ }
|
|
35
|
+
const matches = sourceMessageId ? claims.filter((message) => message.id === sourceMessageId || getMessageDedupKey(message) === sourceMessageId) : [];
|
|
36
|
+
if (matches.length > 1)
|
|
37
|
+
throw new Error("Use the unambiguous source_message_id shown beside the message");
|
|
38
|
+
const selected = matches.at(0);
|
|
39
|
+
if (sourceMessageId && !selected)
|
|
40
|
+
throw new Error("source_message_id must name a message in this conversation's active turn");
|
|
41
|
+
const addressed = claims.filter((message) => message.deliveryTarget !== undefined || message.channel !== "system");
|
|
42
|
+
const targets = new Set(addressed.map((message) => JSON.stringify(buildTaskReplyTarget(message).delivery)));
|
|
43
|
+
if (!selected && targets.size > 1)
|
|
44
|
+
throw new Error(`Choose source_message_id for this Task: ${addressed.map((message) => getMessageDedupKey(message)).join(", ")}`);
|
|
45
|
+
const message = selected ?? addressed.at(0);
|
|
46
|
+
return {
|
|
47
|
+
target: message ? buildTaskReplyTarget(message) : state.currentTaskReplyTarget,
|
|
48
|
+
dispatchKey: message ? getMessageDedupKey(message) : state.currentDispatchId,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
async function delegate(type, args) {
|
|
52
|
+
const client = getForemanClient();
|
|
53
|
+
if (!client)
|
|
54
|
+
return reply(UNAVAILABLE, true);
|
|
55
|
+
const tracker = getForegroundTaskTracker();
|
|
56
|
+
const foreground = tracker?.taskForHandoff() ?? { taskId: `task-${randomUUID()}`, toolCallsUsed: 0 };
|
|
57
|
+
try {
|
|
58
|
+
const source = dispatchSource(args.source_message_id);
|
|
59
|
+
const result = await client.request({
|
|
60
|
+
type, args,
|
|
61
|
+
foreground: { taskId: foreground.taskId, toolCallsUsed: tracker?.unassignedToolCalls ?? 0 },
|
|
62
|
+
dispatchKey: source.dispatchKey ?? foreground.taskId,
|
|
63
|
+
...(source.target ? { replyTarget: source.target.delivery, sender: source.target.sender } : {}),
|
|
64
|
+
});
|
|
65
|
+
if (result.ok)
|
|
66
|
+
tracker?.markHandedOff(foreground.taskId);
|
|
67
|
+
return reply(result.text, !result.ok);
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
return reply(`Error: ${error instanceof Error ? error.message : String(error)}`, true);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async function send(command) {
|
|
74
|
+
const client = getForemanClient();
|
|
75
|
+
if (!client)
|
|
76
|
+
return reply(UNAVAILABLE, true);
|
|
77
|
+
try {
|
|
78
|
+
const result = await client.request(command);
|
|
79
|
+
return reply(result.text, !result.ok);
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
return reply(`Error: ${error instanceof Error ? error.message : String(error)}`, true);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
export const delegateTaskTool = tool("delegate_task", "Delegate one Task to the shared worker pool. Reply directly when you already have the answer. Use delegate_tasks for independent work that should run in parallel. Pass the goal, completed work, remaining work and artifacts. Use context_task_id to continue a completed Task's workspace and results as new work. Omit retry_task_id for new work; use it only to retry a finished Task without resetting its cumulative budget. Verified owner-DM Tasks can read email, calendar and Drive through the host; sends and remote changes remain with you. After acceptance, do not continue that Task's work in the foreground: call notify_user on the originating channel with a concise handoff summary (what is done and what remains), then call finish. You may continue coordination or delegate independent Tasks. Do not claim handoff before acceptance and do not duplicate a delegated Task's work in the foreground.", DELEGATE_TASK_ARGS, (args) => delegate("delegate", args));
|
|
86
|
+
export const delegateTasksTool = tool("delegate_tasks", "Admit independent Tasks together, each with its own cumulative budget. Default result_mode=separate creates no parent; choose combined only when the user needs one jointly reviewed result. Use stable unique task keys. project_dir keeps its current files by default: shared access is exclusive, read_only allows concurrent readers without mutation tools, and isolated explicitly creates Git worktrees for parallel modifications. Repeating the same dispatch is idempotent. After acceptance, notify_user with a concise handoff summary and finish this chat turn before doing more work on those Tasks; continue only with coordination or independent Tasks.", DELEGATE_TASKS_ARGS, (args) => delegate("delegate_batch", args));
|
|
87
|
+
export const backgroundTaskStatusTool = tool("background_task_status", "Read the real state of this conversation's background tasks: queued, running, waiting for an answer, stopping, or finished, with the latest progress, open question, result and whether the user was told. Use it to answer progress questions instead of guessing.", BACKGROUND_TASK_STATUS_ARGS, (args) => send({ type: "status", args }));
|
|
88
|
+
export const backgroundTaskInputTool = tool("background_task_input", "Send a running background task the answer to its question, or a new requirement from the user. The input is stored and the worker reads it at its next step; storing it does not mean the worker has applied it. Use this instead of doing the task's work here. To change a finished task's result, use delegate_task with retry_task_id.", BACKGROUND_TASK_INPUT_ARGS, (args) => send({ type: "input", args }));
|
|
89
|
+
export const backgroundTaskCancelTool = tool("background_task_cancel", "Ask a background task to stop. A running task is only reported cancelled after its worker has really stopped, so do not tell the user it has stopped until then; there is no pause.", BACKGROUND_TASK_CANCEL_ARGS, (args) => send({ type: "cancel", args }));
|
|
90
|
+
export const DELEGATION_TOOLS = [
|
|
91
|
+
delegateTaskTool,
|
|
92
|
+
delegateTasksTool,
|
|
93
|
+
backgroundTaskStatusTool,
|
|
94
|
+
backgroundTaskInputTool,
|
|
95
|
+
backgroundTaskCancelTool,
|
|
96
|
+
];
|
|
97
|
+
/** A disabled delegation feature still exposes control of already admitted Tasks. */
|
|
98
|
+
export function availableTaskTools() {
|
|
99
|
+
const client = getForemanClient();
|
|
100
|
+
if (!client)
|
|
101
|
+
return [];
|
|
102
|
+
return client.delegationEnabled === false
|
|
103
|
+
? [backgroundTaskStatusTool, backgroundTaskInputTool, backgroundTaskCancelTool]
|
|
104
|
+
: [...DELEGATION_TOOLS];
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=delegation.js.map
|