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
|
@@ -1,131 +1,24 @@
|
|
|
1
|
-
import { isThreadTasksEnabled, isWorkspaceEnabled } from "../config/types.js";
|
|
2
1
|
import { ClaudeAgentSession } from "./engines/claude/session.js";
|
|
3
2
|
import { PiCodingAgentSession } from "./engines/pi-coding/session.js";
|
|
4
3
|
import { getAgentEngine } from "./engines/engine-factory.js";
|
|
5
|
-
import {
|
|
6
|
-
import { describeEffectiveBrowserSelection } from "./browser-selection.js";
|
|
7
|
-
import { loadMailbox, setActiveSession, addMemo, consumeMemosFor, ackMemos, updateCodingSessionInfo, } from "./mailbox.js";
|
|
4
|
+
import { rotateSessionId } from "../config/index.js";
|
|
8
5
|
import { logger } from "../logger.js";
|
|
9
|
-
import { getAgentState } from "./state.js";
|
|
10
|
-
import { buildMemoryProtocolSection } from "./memory-protocol.js";
|
|
11
|
-
import { resolveWorkspaceCwd, sameWorkspaceCwd } from "./workspace-cwd.js";
|
|
12
|
-
export function buildGeneralSessionAddendum(config) {
|
|
13
|
-
const workspaceTasks = isWorkspaceEnabled(config)
|
|
14
|
-
? "- Status checks, scheduling, calendar tasks, and email\n"
|
|
15
|
-
: "- Status checks and tasks using independently connected integrations when available\n";
|
|
16
|
-
const codingWorkspaceHint = getAgentEngine(config) === "pi-coding"
|
|
17
|
-
? "When switching to the coding session for a task that involves a specific project or repository, pass the project's absolute path as the `cwd` parameter (e.g. `switch_session(target=\"coding\", cwd=\"/Users/jessica/myproject\", memo=\"...\")`). This sets the Pi SDK coding session's working directory so Bash commands default to the project root."
|
|
18
|
-
: "The optional `cwd` parameter is ignored by Claude coding sessions and when switching back to general.";
|
|
19
|
-
return `
|
|
20
|
-
## Session-Specific Instructions (General Session)
|
|
21
|
-
|
|
22
|
-
You are currently in the **general session**. This session handles:
|
|
23
|
-
- Conversations and quick questions from the owner
|
|
24
|
-
${workspaceTasks}- Simple one-off tasks (look something up, summarize information, etc.)
|
|
25
|
-
- Monitoring and proactive behavior during heartbeats
|
|
26
|
-
|
|
27
|
-
If the owner asks for a complex, multi-step coding task (refactoring, debugging, multi-file feature work), use \`switch_session(target="coding", memo="<task and known constraints>")\` to hand it off. Do NOT attempt sustained coding work in this session — it will pollute your context.
|
|
28
|
-
|
|
29
|
-
${codingWorkspaceHint}
|
|
30
|
-
|
|
31
|
-
When the coding session is active or paused, you can tell the owner its status. If they send a message related to that task (e.g. "actually use a different approach"), forward it via \`switch_session(target="coding", memo="<the new instruction>")\` and do not continue the coding work yourself.
|
|
32
|
-
|
|
33
|
-
When you receive a memo marked \`[Coding task complete — owner notification required]\`, \`notify_user\` with \`purpose="completion"\` and a concise human-language summary, then \`finish\`. The memo is internal working text — never paste it into chat. If you do not notify, the runtime still sends a short generic ping so the completion is not silently dropped.`;
|
|
34
|
-
}
|
|
35
|
-
export function buildCodingSessionAddendum(config, runtimeSurface) {
|
|
36
|
-
const ownerConfig = loadOwnerConfig();
|
|
37
|
-
const agentLabel = config.displayName ?? config.agentName;
|
|
38
|
-
const workspaceIdentity = isWorkspaceEnabled(config)
|
|
39
|
-
? `- **Your email**: ${config.gmail}`
|
|
40
|
-
: `- **Managed Workspace**: unavailable; independently connected MCP${runtimeSurface.browser.available ? "/browser" : ""} accounts may still be used, but they do not enable built-in Workspace tools or channels.`;
|
|
41
|
-
// Claude coding uses the claude_code preset, so this addendum is the only
|
|
42
|
-
// VisionClaw Memory Protocol that session sees. Pi already concatenates the
|
|
43
|
-
// full owner prompt — do not duplicate the section there.
|
|
44
|
-
const includeMemoryProtocol = getAgentEngine(config) === "claude";
|
|
45
|
-
const extraTools = [
|
|
46
|
-
runtimeSurface.browser.available ? "browser (Playwright MCP)" : null,
|
|
47
|
-
runtimeSurface.desktop.available ? "desktop (computer_use_* tools)" : null,
|
|
48
|
-
].filter((part) => part !== null);
|
|
49
|
-
const extraToolsClause = extraTools.length > 0
|
|
50
|
-
? ` ${extraTools[0][0].toUpperCase()}${extraTools.join(" and ").slice(1)} ${extraTools.length === 1 ? "is" : "are"} available if the task needs them — do not drift into unrelated desktop or browser work.`
|
|
51
|
-
: "";
|
|
52
|
-
const browserEngineLine = `- Browser engine: ${describeEffectiveBrowserSelection(runtimeSurface.browserSelection)}`;
|
|
53
|
-
const memorySection = includeMemoryProtocol
|
|
54
|
-
? `\n\n${buildMemoryProtocolSection(isThreadTasksEnabled(config)).trimEnd()}`
|
|
55
|
-
: "";
|
|
56
|
-
return `
|
|
57
|
-
## VisionClaw Context
|
|
58
|
-
|
|
59
|
-
You are **${agentLabel}**, the **coding session** of a dual-session VisionClaw agent on ${runtimeSurface.hostCapabilities.platformLabel}.
|
|
60
|
-
|
|
61
|
-
${workspaceIdentity}
|
|
62
|
-
- **Owner**: ${ownerConfig.ownerName}${ownerConfig.ownerEmail ? ` <${ownerConfig.ownerEmail}>` : ""}
|
|
63
|
-
${browserEngineLine}
|
|
64
|
-
|
|
65
|
-
Prefer terminal and filesystem tools for this session.${extraToolsClause} Custom VisionClaw tools include \`notify_user\`, \`memory\`, \`manage_skills\`, and \`switch_session\`.
|
|
66
|
-
|
|
67
|
-
## Communicating with the Owner (CRITICAL)
|
|
68
|
-
|
|
69
|
-
Plain assistant text is process narration. Telegram and Fin-App put it on the progress card and do not post it as a chat bubble. TUI still shows it. It is not a substitute for \`notify_user\`.
|
|
70
|
-
|
|
71
|
-
Use \`notify_user\` for:
|
|
72
|
-
- Questions or blockers that need the owner (omit \`purpose\`)
|
|
73
|
-
- Attachments / screenshots
|
|
74
|
-
- The final result of this coding task: \`notify_user\` with \`purpose="completion"\`, then \`switch_session(target="general", reason="complete", memo="Task completed: <summary>")\`. The completion purpose prevents the general session from sending the same result again.
|
|
75
|
-
|
|
76
|
-
## Session-Specific Instructions (Coding Session)
|
|
77
|
-
|
|
78
|
-
This session is reserved for focused, multi-step coding. Stay on the current task. If an unrelated message arrives (chat, question, non-coding request), \`switch_session(target="general", reason="handoff")\` with enough memo for general to reply. Use provider-specific coding or delegation tools when they help; keep orchestration here.
|
|
79
|
-
|
|
80
|
-
## Repository State (check before your first edit)
|
|
81
|
-
|
|
82
|
-
This session resumes in whatever worktree and branch the previous task left behind. Before editing a git repository, run \`git status --short --branch\` (and \`git worktree list\` when there is more than one checkout).
|
|
83
|
-
|
|
84
|
-
Decide which case you are in. Do not \`notify_user\` with git status unless you need the owner to decide:
|
|
85
|
-
- **Continuing work that already has a branch** — stay on that branch.
|
|
86
|
-
- **Starting a new task** — do not build on top of the previous task's branch. Begin from a freshly fetched main: \`git fetch origin\`, then \`git switch -c <branch> refs/remotes/origin/main\`. Skipping the fetch branches you off a stale main, which is the usual reason a diff fills up with changes that are not yours.
|
|
87
|
-
- **Uncommitted changes you did not make** — ask the owner before committing, stashing, or discarding them.
|
|
88
|
-
|
|
89
|
-
If your diff ends up carrying files or commits unrelated to the task, the base is wrong. Fix the base rather than explaining the noise in the PR.${memorySection}`;
|
|
90
|
-
}
|
|
91
6
|
/**
|
|
92
|
-
*
|
|
7
|
+
* Owns the agent's single conversation session.
|
|
93
8
|
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
9
|
+
* Builds the engine-specific session object, exposes the runtime surface
|
|
10
|
+
* resolved at startup, and handles stop, reset, summary injection and MCP
|
|
11
|
+
* teardown for it.
|
|
97
12
|
*/
|
|
98
13
|
export class SessionManager {
|
|
99
14
|
config;
|
|
100
15
|
buildBaseSystemPrompt;
|
|
101
16
|
/** Resolved runtime tool and external MCP surface for this model/provider pair. */
|
|
102
17
|
runtimeSurface;
|
|
103
|
-
|
|
104
|
-
generalSession;
|
|
105
|
-
codingSession = null;
|
|
106
|
-
_activeMode = "general";
|
|
18
|
+
session;
|
|
107
19
|
_managerStopRequested = false;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
/** Propagated to all sessions for auto-screenshot after Playwright tools. */
|
|
111
|
-
_screenshotInjector = null;
|
|
112
|
-
buildCodingSystemPrompt() {
|
|
113
|
-
if (getAgentEngine(this.config) !== "claude") {
|
|
114
|
-
return this.buildBaseSystemPrompt() + buildCodingSessionAddendum(this.config, this.runtimeSurface);
|
|
115
|
-
}
|
|
116
|
-
return {
|
|
117
|
-
type: "preset",
|
|
118
|
-
preset: "claude_code",
|
|
119
|
-
append: buildCodingSessionAddendum(this.config, this.runtimeSurface),
|
|
120
|
-
// The addendum is rebuilt for each wake so runtime/config changes are
|
|
121
|
-
// visible when the SDK resumes an existing transcript.
|
|
122
|
-
snapshot: false,
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
buildGeneralSystemPrompt() {
|
|
126
|
-
const prompt = this.dualSessionEnabled
|
|
127
|
-
? this.buildBaseSystemPrompt() + buildGeneralSessionAddendum(this.config)
|
|
128
|
-
: this.buildBaseSystemPrompt();
|
|
20
|
+
buildSystemPrompt() {
|
|
21
|
+
const prompt = this.buildBaseSystemPrompt();
|
|
129
22
|
return getAgentEngine(this.config) === "claude"
|
|
130
23
|
? {
|
|
131
24
|
type: "custom",
|
|
@@ -135,77 +28,32 @@ export class SessionManager {
|
|
|
135
28
|
}
|
|
136
29
|
: prompt;
|
|
137
30
|
}
|
|
138
|
-
|
|
139
|
-
return {
|
|
140
|
-
mode,
|
|
141
|
-
getDualSessionEnabled: () => this.dualSessionEnabled,
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
createSession(buildPrompt, mode, workspaceCwd) {
|
|
145
|
-
const engine = getAgentEngine(this.config);
|
|
146
|
-
const effectiveWorkspaceCwd = workspaceCwd && (this.runtimeSurface.labRuntimePolicy || (mode === "coding" && engine === "pi-coding")) ? workspaceCwd : undefined;
|
|
31
|
+
createSession(workspaceCwd) {
|
|
147
32
|
const args = {
|
|
148
33
|
config: this.config,
|
|
149
|
-
buildSystemPrompt:
|
|
34
|
+
buildSystemPrompt: () => this.buildSystemPrompt(),
|
|
150
35
|
runtimeSurface: this.runtimeSurface,
|
|
151
|
-
|
|
152
|
-
...(effectiveWorkspaceCwd ? { workspaceCwd: effectiveWorkspaceCwd } : {}),
|
|
36
|
+
...(workspaceCwd ? { workspaceCwd } : {}),
|
|
153
37
|
};
|
|
154
|
-
return
|
|
38
|
+
return getAgentEngine(this.config) === "pi-coding"
|
|
155
39
|
? new PiCodingAgentSession(args)
|
|
156
40
|
: new ClaudeAgentSession(args);
|
|
157
41
|
}
|
|
158
|
-
|
|
159
|
-
const cwd = loadMailbox().codingSession.cwd;
|
|
160
|
-
if (!cwd)
|
|
161
|
-
return undefined;
|
|
162
|
-
try {
|
|
163
|
-
return resolveWorkspaceCwd(cwd);
|
|
164
|
-
}
|
|
165
|
-
catch (error) {
|
|
166
|
-
const detail = error instanceof Error ? error.message : String(error);
|
|
167
|
-
logger.system(`Persisted coding workspace is unavailable; pausing coding and returning to general: ${detail}`);
|
|
168
|
-
rotateSessionId("coding");
|
|
169
|
-
updateCodingSessionInfo({ status: "paused", cwd: undefined });
|
|
170
|
-
setActiveSession("general");
|
|
171
|
-
return undefined;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
constructor(config, buildSystemPrompt, runtimeSurface, options) {
|
|
42
|
+
constructor(config, buildSystemPrompt, runtimeSurface, options = {}) {
|
|
175
43
|
this.config = config;
|
|
176
44
|
this.buildBaseSystemPrompt = buildSystemPrompt;
|
|
177
|
-
this._requestedDualSessionEnabled = options.dualSessionEnabled;
|
|
178
45
|
this.runtimeSurface = runtimeSurface;
|
|
179
46
|
const engine = getAgentEngine(config);
|
|
180
|
-
if (runtimeSurface.
|
|
181
|
-
throw new Error("Pi policy-isolated
|
|
47
|
+
if (runtimeSurface.workerRuntimePolicy && engine === "pi-coding" && !options.workspaceCwd) {
|
|
48
|
+
throw new Error("Pi policy-isolated worker sessions require a workspace cwd");
|
|
182
49
|
}
|
|
183
|
-
if (runtimeSurface.
|
|
184
|
-
throw new Error("Workspace cwd overrides are supported only for Pi
|
|
50
|
+
if (runtimeSurface.workerRuntimePolicy && engine !== "pi-coding" && options.workspaceCwd) {
|
|
51
|
+
throw new Error("Workspace cwd overrides are supported only for Pi worker sessions");
|
|
185
52
|
}
|
|
186
|
-
if (!runtimeSurface.
|
|
187
|
-
throw new Error("Startup workspace cwd overrides are supported only for Pi
|
|
53
|
+
if (!runtimeSurface.workerRuntimePolicy && options.workspaceCwd) {
|
|
54
|
+
throw new Error("Startup workspace cwd overrides are supported only for Pi workers");
|
|
188
55
|
}
|
|
189
|
-
this.
|
|
190
|
-
if (this.dualSessionEnabled) {
|
|
191
|
-
let mailbox = loadMailbox();
|
|
192
|
-
if (mailbox.codingSession.status === "in_progress" || mailbox.codingSession.status === "paused") {
|
|
193
|
-
const workspaceCwd = runtimeSurface.labRuntimePolicy
|
|
194
|
-
? options.workspaceCwd
|
|
195
|
-
: engine === "pi-coding"
|
|
196
|
-
? this.codingWorkspaceCwd()
|
|
197
|
-
: undefined;
|
|
198
|
-
// Reload because stale-cwd recovery updates the durable mailbox.
|
|
199
|
-
mailbox = loadMailbox();
|
|
200
|
-
this.codingSession = this.createSession(() => this.buildCodingSystemPrompt(), "coding", workspaceCwd);
|
|
201
|
-
}
|
|
202
|
-
this._activeMode = mailbox.activeSession;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
get dualSessionEnabled() {
|
|
206
|
-
return !this.runtimeSurface.labRuntimePolicy
|
|
207
|
-
&& this._requestedDualSessionEnabled
|
|
208
|
-
&& this.runtimeSurface.visionClawToolTransport.supportsSwitchSessionTool;
|
|
56
|
+
this.session = this.createSession(options.workspaceCwd);
|
|
209
57
|
}
|
|
210
58
|
/** Browser backend resolved at startup (see {@link RuntimeSurface}). */
|
|
211
59
|
get resolvedBrowserBackend() {
|
|
@@ -226,355 +74,83 @@ export class SessionManager {
|
|
|
226
74
|
get hostCapabilities() {
|
|
227
75
|
return this.runtimeSurface.hostCapabilities;
|
|
228
76
|
}
|
|
229
|
-
/**
|
|
230
|
-
* Toggle dual-session mode at runtime. Takes effect on the next wake cycle
|
|
231
|
-
* because each query() call rebuilds its tool surface.
|
|
232
|
-
*/
|
|
233
|
-
setDualSessionEnabled(enabled) {
|
|
234
|
-
this._requestedDualSessionEnabled = enabled;
|
|
235
|
-
if (!this.dualSessionEnabled && this._activeMode === "coding") {
|
|
236
|
-
this._activeMode = "general";
|
|
237
|
-
setActiveSession("general");
|
|
238
|
-
logger.system("Dual session disabled — forced switch to general");
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
77
|
/**
|
|
242
78
|
* Set the screenshot injector that auto-injects screenshots after
|
|
243
|
-
* Playwright tool calls.
|
|
79
|
+
* Playwright tool calls.
|
|
244
80
|
*/
|
|
245
81
|
setScreenshotInjector(injector) {
|
|
246
|
-
this.
|
|
247
|
-
this.generalSession.screenshotInjector = injector;
|
|
248
|
-
if (this.codingSession) {
|
|
249
|
-
this.codingSession.screenshotInjector = injector;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
get activeMode() {
|
|
253
|
-
return this._activeMode;
|
|
82
|
+
this.session.screenshotInjector = injector;
|
|
254
83
|
}
|
|
255
84
|
get activeSession() {
|
|
256
|
-
|
|
257
|
-
return this.codingSession;
|
|
258
|
-
}
|
|
259
|
-
return this.generalSession;
|
|
260
|
-
}
|
|
261
|
-
get pendingSwitch() {
|
|
262
|
-
return this._pendingSwitch;
|
|
263
|
-
}
|
|
264
|
-
getActiveCodingTaskStartedAt() {
|
|
265
|
-
return loadMailbox().codingSession.startedAt;
|
|
266
|
-
}
|
|
267
|
-
hasCompletionReceiptForActiveTask() {
|
|
268
|
-
try {
|
|
269
|
-
const taskStartedAt = this.getActiveCodingTaskStartedAt();
|
|
270
|
-
return Boolean(taskStartedAt && getAgentState().codingCompletionTaskStartedAt === taskStartedAt);
|
|
271
|
-
}
|
|
272
|
-
catch {
|
|
273
|
-
// Agent state is absent in isolated session-manager tests.
|
|
274
|
-
return false;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* Record a switch request detected from the stream.
|
|
279
|
-
* The main loop should check this after each stream ends and act on it.
|
|
280
|
-
*/
|
|
281
|
-
setSwitchRequest(req) {
|
|
282
|
-
const { cwd: requestedCwd, ...requestWithoutCwd } = req;
|
|
283
|
-
let cwd;
|
|
284
|
-
if (req.target === "coding" && requestedCwd && getAgentEngine(this.config) === "pi-coding") {
|
|
285
|
-
try {
|
|
286
|
-
cwd = resolveWorkspaceCwd(requestedCwd);
|
|
287
|
-
}
|
|
288
|
-
catch (error) {
|
|
289
|
-
logger.warn(`Ignoring unavailable coding workspace cwd and continuing with fallback: ${error instanceof Error ? error.message : String(error)}`);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
this._pendingSwitch = cwd
|
|
293
|
-
? { ...requestWithoutCwd, cwd }
|
|
294
|
-
: requestWithoutCwd;
|
|
295
|
-
}
|
|
296
|
-
/**
|
|
297
|
-
* Execute a pending session switch.
|
|
298
|
-
* - Writes the memo to the mailbox
|
|
299
|
-
* - Creates the coding session if it doesn't exist
|
|
300
|
-
* - Updates the active mode
|
|
301
|
-
* Returns the forwarded message content to send to the new session.
|
|
302
|
-
*/
|
|
303
|
-
executePendingSwitch() {
|
|
304
|
-
if (!this.dualSessionEnabled)
|
|
305
|
-
return null;
|
|
306
|
-
const req = this._pendingSwitch;
|
|
307
|
-
if (!req)
|
|
308
|
-
return null;
|
|
309
|
-
this._pendingSwitch = null;
|
|
310
|
-
const currentMode = this._activeMode;
|
|
311
|
-
let workspaceNotice;
|
|
312
|
-
const isCodingCompletion = currentMode === "coding" && req.target === "general" && req.reason === "complete";
|
|
313
|
-
// The stream handler captures completionDelivered when it sees the
|
|
314
|
-
// switch_session tool_use. If notify_user ran in the same assistant
|
|
315
|
-
// message, its send resolves after that capture, so re-check the receipt
|
|
316
|
-
// here (after the stream ended) before asking general to notify again.
|
|
317
|
-
const completionDelivered = isCodingCompletion
|
|
318
|
-
&& (req.completionDelivered === true || this.hasCompletionReceiptForActiveTask());
|
|
319
|
-
// A delivered coding completion needs no cross-session memo. Required
|
|
320
|
-
// completions remain durable so general / runtime last-resort can still ping.
|
|
321
|
-
if (req.memo && !completionDelivered) {
|
|
322
|
-
const memo = isCodingCompletion
|
|
323
|
-
? [
|
|
324
|
-
"[Coding task complete — owner notification required]",
|
|
325
|
-
req.memo,
|
|
326
|
-
"",
|
|
327
|
-
"`notify_user` with purpose=`completion` and a concise, human-language summary (outcome, files changed, validation, caveats). Never paste this memo into chat. If you do not notify, the runtime still sends a short generic ping so the completion is not silently dropped.",
|
|
328
|
-
].join("\n")
|
|
329
|
-
: req.memo;
|
|
330
|
-
addMemo(currentMode, req.target, memo);
|
|
331
|
-
}
|
|
332
|
-
if (req.target === "coding") {
|
|
333
|
-
const supportsWorkspaceCwd = getAgentEngine(this.config) === "pi-coding";
|
|
334
|
-
const currentCwd = supportsWorkspaceCwd ? loadMailbox().codingSession.cwd : undefined;
|
|
335
|
-
const requestedCwd = supportsWorkspaceCwd ? req.cwd ?? currentCwd : undefined;
|
|
336
|
-
let workspaceCwd;
|
|
337
|
-
let workspaceFallback = false;
|
|
338
|
-
if (requestedCwd) {
|
|
339
|
-
try {
|
|
340
|
-
workspaceCwd = resolveWorkspaceCwd(requestedCwd);
|
|
341
|
-
}
|
|
342
|
-
catch (error) {
|
|
343
|
-
workspaceFallback = true;
|
|
344
|
-
workspaceNotice = "The persisted coding workspace is unavailable; continuing in the profile workspace fallback. The original project directory may need to be restored before making project changes.";
|
|
345
|
-
logger.system(`Coding workspace is unavailable; falling back to the profile workspace: ${error instanceof Error ? error.message : String(error)}`);
|
|
346
|
-
updateCodingSessionInfo({ cwd: undefined });
|
|
347
|
-
this.codingSession?.requestStop();
|
|
348
|
-
this.discardCodingSession();
|
|
349
|
-
rotateSessionId("coding");
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
if (!workspaceFallback && supportsWorkspaceCwd && req.cwd && (!currentCwd || !sameWorkspaceCwd(currentCwd, workspaceCwd ?? ""))) {
|
|
353
|
-
this.codingSession?.requestStop();
|
|
354
|
-
this.discardCodingSession();
|
|
355
|
-
rotateSessionId("coding");
|
|
356
|
-
logger.system(`Coding workspace changed: ${currentCwd ?? "(default)"} → ${workspaceCwd}; starting a fresh session`);
|
|
357
|
-
}
|
|
358
|
-
this.codingSession ??= this.createSession(() => this.buildCodingSystemPrompt(), "coding", workspaceCwd);
|
|
359
|
-
if (this._screenshotInjector) {
|
|
360
|
-
this.codingSession.screenshotInjector = this._screenshotInjector;
|
|
361
|
-
}
|
|
362
|
-
updateCodingSessionInfo({
|
|
363
|
-
status: "in_progress",
|
|
364
|
-
taskSummary: req.memo || "Coding task in progress",
|
|
365
|
-
startedAt: new Date().toISOString(),
|
|
366
|
-
...(supportsWorkspaceCwd && workspaceCwd ? { cwd: workspaceCwd } : {}),
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
else if (currentMode === "coding") {
|
|
370
|
-
if (req.reason === "complete") {
|
|
371
|
-
updateCodingSessionInfo({ status: "completed" });
|
|
372
|
-
}
|
|
373
|
-
else {
|
|
374
|
-
updateCodingSessionInfo({ status: "paused" });
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
this._activeMode = req.target;
|
|
378
|
-
setActiveSession(req.target);
|
|
379
|
-
logger.system(`Session switch: ${currentMode} → ${req.target}`);
|
|
380
|
-
return {
|
|
381
|
-
target: req.target,
|
|
382
|
-
reason: req.reason,
|
|
383
|
-
forwardMessage: req.forwardMessage,
|
|
384
|
-
...(workspaceNotice ? { workspaceNotice } : {}),
|
|
385
|
-
...(isCodingCompletion
|
|
386
|
-
? {
|
|
387
|
-
completionMemo: req.memo,
|
|
388
|
-
ownerNotificationRequired: !completionDelivered,
|
|
389
|
-
}
|
|
390
|
-
: {}),
|
|
391
|
-
};
|
|
392
|
-
}
|
|
393
|
-
/**
|
|
394
|
-
* Get any unread memos for the currently active session.
|
|
395
|
-
* Call this before sending a message to the active session so
|
|
396
|
-
* the memos can be prepended to the context.
|
|
397
|
-
*/
|
|
398
|
-
consumeMemosForActive() {
|
|
399
|
-
if (!this.dualSessionEnabled)
|
|
400
|
-
return null;
|
|
401
|
-
const memos = consumeMemosFor(this._activeMode);
|
|
402
|
-
if (memos.length === 0)
|
|
403
|
-
return null;
|
|
404
|
-
const lines = ["## Messages from the other session"];
|
|
405
|
-
for (const m of memos) {
|
|
406
|
-
lines.push(`[${m.from} session at ${m.timestamp}]: ${m.content}`);
|
|
407
|
-
}
|
|
408
|
-
return lines.join("\n");
|
|
409
|
-
}
|
|
410
|
-
/**
|
|
411
|
-
* Acknowledge that consumed memos for the active session have been
|
|
412
|
-
* successfully injected. Removes them from the mailbox on disk.
|
|
413
|
-
*/
|
|
414
|
-
ackMemosForActive() {
|
|
415
|
-
if (!this.dualSessionEnabled)
|
|
416
|
-
return;
|
|
417
|
-
ackMemos(this._activeMode);
|
|
418
|
-
}
|
|
419
|
-
/**
|
|
420
|
-
* End the coding session (task complete or abandoned).
|
|
421
|
-
* Switches back to general mode.
|
|
422
|
-
*/
|
|
423
|
-
endCodingSession(summary) {
|
|
424
|
-
updateCodingSessionInfo({ status: "completed", taskSummary: summary });
|
|
425
|
-
if (this._activeMode === "coding") {
|
|
426
|
-
addMemo("coding", "general", `Coding task completed: ${summary}`);
|
|
427
|
-
this._activeMode = "general";
|
|
428
|
-
setActiveSession("general");
|
|
429
|
-
logger.system("Coding session ended, switched to general");
|
|
430
|
-
}
|
|
85
|
+
return this.session;
|
|
431
86
|
}
|
|
432
87
|
/**
|
|
433
|
-
*
|
|
434
|
-
*
|
|
435
|
-
*
|
|
436
|
-
*
|
|
437
|
-
*
|
|
438
|
-
* progress notification followed by `finish` still leaves the task active.
|
|
439
|
-
*/
|
|
440
|
-
finalizeCodingCompletionAfterFinish() {
|
|
441
|
-
if (!this.dualSessionEnabled || this._activeMode !== "coding")
|
|
442
|
-
return false;
|
|
443
|
-
const codingSession = loadMailbox().codingSession;
|
|
444
|
-
if (codingSession.status !== "in_progress" && codingSession.status !== "paused") {
|
|
445
|
-
return false;
|
|
446
|
-
}
|
|
447
|
-
updateCodingSessionInfo({ status: "completed" });
|
|
448
|
-
this._activeMode = "general";
|
|
449
|
-
setActiveSession("general");
|
|
450
|
-
logger.system("Coding completion delivered before finish — finalized task and switched to general");
|
|
451
|
-
return true;
|
|
452
|
-
}
|
|
453
|
-
/**
|
|
454
|
-
* Discard pre-warmed subprocesses on every session so the next turn
|
|
455
|
-
* rebuilds them from the current `config`. Use after mutating provider-
|
|
456
|
-
* bound state (e.g. client-side provider fallback) — without this, the
|
|
457
|
-
* Claude warm subprocess can silently keep using the previous provider
|
|
458
|
-
* for one more turn.
|
|
88
|
+
* Discard the pre-warmed subprocess so the next turn rebuilds it from the
|
|
89
|
+
* current `config`. Use after mutating provider-bound state (e.g.
|
|
90
|
+
* client-side provider fallback) — without this, the Claude warm
|
|
91
|
+
* subprocess can silently keep using the previous provider for one more
|
|
92
|
+
* turn.
|
|
459
93
|
*/
|
|
460
94
|
discardAllWarmQueries() {
|
|
461
|
-
this.
|
|
462
|
-
this.codingSession?.discardWarmQuery();
|
|
95
|
+
this.session.discardWarmQuery();
|
|
463
96
|
}
|
|
464
|
-
/**
|
|
465
|
-
pendingReleases = new Set();
|
|
466
|
-
/**
|
|
467
|
-
* Close MCP stdio children for every session: the live general and coding
|
|
468
|
-
* sessions plus any discarded coding session whose teardown is still in
|
|
469
|
-
* flight. Sessions are independent, so release them in parallel and never
|
|
470
|
-
* let one failure skip another.
|
|
471
|
-
*/
|
|
97
|
+
/** Close the session's MCP stdio children. A failure is logged, never thrown. */
|
|
472
98
|
async releaseMcpResources() {
|
|
473
|
-
|
|
474
|
-
this.
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
for (const result of results) {
|
|
479
|
-
if (result.status !== "rejected")
|
|
480
|
-
continue;
|
|
481
|
-
const reason = result.reason;
|
|
482
|
-
logger.warn(`Failed to release session MCP resources: ${reason instanceof Error ? reason.message : String(reason)}`);
|
|
99
|
+
try {
|
|
100
|
+
await this.session.releaseMcpResources();
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
logger.warn(`Failed to release session MCP resources: ${err instanceof Error ? err.message : String(err)}`);
|
|
483
104
|
}
|
|
484
|
-
}
|
|
485
|
-
discardCodingSession() {
|
|
486
|
-
const previous = this.codingSession;
|
|
487
|
-
this.codingSession = null;
|
|
488
|
-
if (!previous)
|
|
489
|
-
return;
|
|
490
|
-
// releaseMcpResources() subsumes discardWarmQuery() on every engine.
|
|
491
|
-
const release = previous.releaseMcpResources().catch((err) => {
|
|
492
|
-
logger.warn(`Failed to release coding session MCP resources: ${err instanceof Error ? err.message : String(err)}`);
|
|
493
|
-
});
|
|
494
|
-
this.pendingReleases.add(release);
|
|
495
|
-
void release.then(() => this.pendingReleases.delete(release));
|
|
496
105
|
}
|
|
497
106
|
requestStop() {
|
|
498
107
|
this._managerStopRequested = true;
|
|
499
|
-
this.
|
|
108
|
+
this.session.requestStop();
|
|
500
109
|
}
|
|
501
110
|
clearStop() {
|
|
502
111
|
this._managerStopRequested = false;
|
|
503
|
-
this.
|
|
112
|
+
this.session.clearStop();
|
|
504
113
|
}
|
|
505
114
|
isStopRequested() {
|
|
506
|
-
return this._managerStopRequested || this.
|
|
115
|
+
return this._managerStopRequested || this.session.isStopRequested();
|
|
507
116
|
}
|
|
508
|
-
/**
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
getCodingSessionStatus() {
|
|
515
|
-
if (!this.dualSessionEnabled)
|
|
516
|
-
return null;
|
|
517
|
-
const mailbox = loadMailbox();
|
|
518
|
-
const cs = mailbox.codingSession;
|
|
519
|
-
if (!cs.taskSummary)
|
|
520
|
-
return null;
|
|
521
|
-
if (cs.status === "in_progress")
|
|
522
|
-
return `Coding session is active: ${cs.taskSummary}`;
|
|
523
|
-
if (cs.status === "paused")
|
|
524
|
-
return `Coding session is paused: ${cs.taskSummary}`;
|
|
525
|
-
return null;
|
|
117
|
+
/**
|
|
118
|
+
* True only when the active engine has confirmed it will not continue.
|
|
119
|
+
* An engine that cannot prove this leaves the host entry unconfirmed.
|
|
120
|
+
*/
|
|
121
|
+
executionBarrierConfirmed() {
|
|
122
|
+
return this.session.executionBarrierConfirmed?.() ?? false;
|
|
526
123
|
}
|
|
527
124
|
/**
|
|
528
|
-
* Reset the
|
|
125
|
+
* Reset the session: rotates the current session ID to
|
|
529
126
|
* `previousSessionIds`, clears the active session ID, and passes the
|
|
530
127
|
* summary to the session object for injection into the next turn.
|
|
531
128
|
*
|
|
532
129
|
* The next `sendAndStream` will create a brand-new SDK session.
|
|
533
130
|
*/
|
|
534
131
|
resetActiveSession(summary) {
|
|
535
|
-
|
|
536
|
-
// state is temporarily inconsistent (for example coding is marked active
|
|
537
|
-
// before its lazy session has been constructed).
|
|
538
|
-
const effectiveMode = this._activeMode === "coding" && this.codingSession ? "coding" : "general";
|
|
539
|
-
this.resetSession(effectiveMode, summary);
|
|
132
|
+
this.resetSession(summary);
|
|
540
133
|
}
|
|
541
134
|
/**
|
|
542
|
-
*
|
|
543
|
-
*
|
|
544
|
-
*
|
|
545
|
-
* the next turn as priority context.
|
|
546
|
-
*
|
|
547
|
-
* Used by `/refresh` (via {@link resetActiveSession}, which targets the
|
|
548
|
-
* currently-active mode).
|
|
549
|
-
*
|
|
550
|
-
* No-op when the target session has not been constructed (the coding
|
|
551
|
-
* session is lazy-created when the mailbox marks it active).
|
|
135
|
+
* Rotate the persisted session id into `previousSessionIds`, then hand
|
|
136
|
+
* `summary` to the session object so it is prepended to the next turn as
|
|
137
|
+
* priority context. Used by `/refresh` (via {@link resetActiveSession}).
|
|
552
138
|
*/
|
|
553
|
-
resetSession(
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
rotateSessionId(mode);
|
|
558
|
-
target.resetForNewSession(summary);
|
|
559
|
-
logger.system(`Session reset (mode=${mode}), summary ${summary.length} chars`);
|
|
139
|
+
resetSession(summary) {
|
|
140
|
+
rotateSessionId();
|
|
141
|
+
this.session.resetForNewSession(summary);
|
|
142
|
+
logger.system(`Session reset, summary ${summary.length} chars`);
|
|
560
143
|
}
|
|
561
144
|
/**
|
|
562
|
-
* Inject a summary into
|
|
563
|
-
*
|
|
564
|
-
* Used by the startup engine-switch boundary: rotation and mailbox
|
|
565
|
-
* clearing happen *before* `SessionManager` is constructed (so the
|
|
566
|
-
* manager sees the post-collapse world), and then this method just
|
|
567
|
-
* threads the combined summary into the freshly created session's
|
|
568
|
-
* first turn.
|
|
145
|
+
* Inject a summary into the session WITHOUT rotating its session id.
|
|
569
146
|
*
|
|
570
|
-
*
|
|
147
|
+
* Used by the startup engine-switch boundary: rotation happens *before*
|
|
148
|
+
* `SessionManager` is constructed, and then this method just threads the
|
|
149
|
+
* combined summary into the freshly created session's first turn.
|
|
571
150
|
*/
|
|
572
|
-
injectSummary(
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
return;
|
|
576
|
-
target.injectSummary(summary);
|
|
577
|
-
logger.system(`[session-manager] Injected summary into ${mode} session (${summary.length} chars)`);
|
|
151
|
+
injectSummary(summary) {
|
|
152
|
+
this.session.injectSummary(summary);
|
|
153
|
+
logger.system(`[session-manager] Injected summary into session (${summary.length} chars)`);
|
|
578
154
|
}
|
|
579
155
|
}
|
|
580
156
|
//# sourceMappingURL=session-manager.js.map
|