@0xmaxma/claude-gateway 1.8.13 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -1605
- package/config.template.json +7 -1
- package/dist/agent/runner.d.ts +394 -0
- package/dist/agent/runner.d.ts.map +1 -1
- package/dist/agent/runner.js +867 -38
- package/dist/agent/runner.js.map +1 -1
- package/dist/agent/skill-learning/index.d.ts +6 -4
- package/dist/agent/skill-learning/index.d.ts.map +1 -1
- package/dist/agent/skill-learning/index.js +3 -3
- package/dist/agent/skill-learning/index.js.map +1 -1
- package/dist/agent/skill-learning/notifier.d.ts +3 -4
- package/dist/agent/skill-learning/notifier.d.ts.map +1 -1
- package/dist/agent/skill-learning/notifier.js +15 -13
- package/dist/agent/skill-learning/notifier.js.map +1 -1
- package/dist/agent/skill-learning/reviewer.d.ts.map +1 -1
- package/dist/agent/skill-learning/reviewer.js +3 -1
- package/dist/agent/skill-learning/reviewer.js.map +1 -1
- package/dist/api/connectors-router.d.ts.map +1 -1
- package/dist/api/connectors-router.js +110 -4
- package/dist/api/connectors-router.js.map +1 -1
- package/dist/api/gateway-router.d.ts +1 -0
- package/dist/api/gateway-router.d.ts.map +1 -1
- package/dist/api/gateway-router.js +13 -1
- package/dist/api/gateway-router.js.map +1 -1
- package/dist/api/line-webhook-router.d.ts +2 -2
- package/dist/api/line-webhook-router.d.ts.map +1 -1
- package/dist/api/line-webhook-router.js +264 -230
- package/dist/api/line-webhook-router.js.map +1 -1
- package/dist/api/router.d.ts.map +1 -1
- package/dist/api/router.js +372 -11
- package/dist/api/router.js.map +1 -1
- package/dist/api/share-router.d.ts.map +1 -1
- package/dist/api/share-router.js +29 -10
- package/dist/api/share-router.js.map +1 -1
- package/dist/api/slack-client.d.ts +2 -0
- package/dist/api/slack-client.d.ts.map +1 -1
- package/dist/api/slack-client.js +6 -2
- package/dist/api/slack-client.js.map +1 -1
- package/dist/api/slack-webhook-router.d.ts +3 -0
- package/dist/api/slack-webhook-router.d.ts.map +1 -1
- package/dist/api/slack-webhook-router.js +226 -131
- package/dist/api/slack-webhook-router.js.map +1 -1
- package/dist/api/voice-router.d.ts +21 -0
- package/dist/api/voice-router.d.ts.map +1 -0
- package/dist/api/voice-router.js +372 -0
- package/dist/api/voice-router.js.map +1 -0
- package/dist/api/voice-settings-router.d.ts +5 -0
- package/dist/api/voice-settings-router.d.ts.map +1 -0
- package/dist/api/voice-settings-router.js +318 -0
- package/dist/api/voice-settings-router.js.map +1 -0
- package/dist/api/wechat-access.d.ts +45 -0
- package/dist/api/wechat-access.d.ts.map +1 -0
- package/dist/api/wechat-access.js +48 -0
- package/dist/api/wechat-access.js.map +1 -0
- package/dist/apps/agent-container-migration.d.ts +11 -0
- package/dist/apps/agent-container-migration.d.ts.map +1 -0
- package/dist/apps/agent-container-migration.js +85 -0
- package/dist/apps/agent-container-migration.js.map +1 -0
- package/dist/apps/installer.d.ts +1 -1
- package/dist/apps/installer.d.ts.map +1 -1
- package/dist/apps/installer.js +2 -1
- package/dist/apps/installer.js.map +1 -1
- package/dist/cli/commands/tasks.d.ts +5 -0
- package/dist/cli/commands/tasks.d.ts.map +1 -0
- package/dist/cli/commands/tasks.js +92 -0
- package/dist/cli/commands/tasks.js.map +1 -0
- package/dist/cli/http-client.d.ts +2 -0
- package/dist/cli/http-client.d.ts.map +1 -1
- package/dist/cli/http-client.js +8 -3
- package/dist/cli/http-client.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +5 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/config/config-write-lock.d.ts +2 -0
- package/dist/config/config-write-lock.d.ts.map +1 -1
- package/dist/config/config-write-lock.js +5 -0
- package/dist/config/config-write-lock.js.map +1 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +87 -2
- package/dist/config/loader.js.map +1 -1
- package/dist/config/migrator.d.ts.map +1 -1
- package/dist/config/migrator.js +12 -1
- package/dist/config/migrator.js.map +1 -1
- package/dist/config/watcher.d.ts.map +1 -1
- package/dist/config/watcher.js +6 -0
- package/dist/config/watcher.js.map +1 -1
- package/dist/connectors/resolve.d.ts.map +1 -1
- package/dist/connectors/resolve.js +3 -1
- package/dist/connectors/resolve.js.map +1 -1
- package/dist/connectors/types.d.ts +8 -0
- package/dist/connectors/types.d.ts.map +1 -1
- package/dist/cron/manager.d.ts.map +1 -1
- package/dist/cron/manager.js +21 -2
- package/dist/cron/manager.js.map +1 -1
- package/dist/discord/receiver.d.ts +2 -1
- package/dist/discord/receiver.d.ts.map +1 -1
- package/dist/discord/receiver.js +5 -1
- package/dist/discord/receiver.js.map +1 -1
- package/dist/history/db.d.ts +3 -0
- package/dist/history/db.d.ts.map +1 -1
- package/dist/history/db.js +21 -1
- package/dist/history/db.js.map +1 -1
- package/dist/history/types.d.ts +12 -1
- package/dist/history/types.d.ts.map +1 -1
- package/dist/history/types.js +10 -1
- package/dist/history/types.js.map +1 -1
- package/dist/index.js +48 -9
- package/dist/index.js.map +1 -1
- package/dist/orchestration/bounded-queue.d.ts +15 -0
- package/dist/orchestration/bounded-queue.d.ts.map +1 -0
- package/dist/orchestration/bounded-queue.js +58 -0
- package/dist/orchestration/bounded-queue.js.map +1 -0
- package/dist/orchestration/bridge.d.ts +55 -0
- package/dist/orchestration/bridge.d.ts.map +1 -0
- package/dist/orchestration/bridge.js +234 -0
- package/dist/orchestration/bridge.js.map +1 -0
- package/dist/orchestration/browser-routing.d.ts +7 -0
- package/dist/orchestration/browser-routing.d.ts.map +1 -0
- package/dist/orchestration/browser-routing.js +22 -0
- package/dist/orchestration/browser-routing.js.map +1 -0
- package/dist/orchestration/capabilities.d.ts +49 -0
- package/dist/orchestration/capabilities.d.ts.map +1 -0
- package/dist/orchestration/capabilities.js +417 -0
- package/dist/orchestration/capabilities.js.map +1 -0
- package/dist/orchestration/capacity.d.ts +14 -0
- package/dist/orchestration/capacity.d.ts.map +1 -0
- package/dist/orchestration/capacity.js +52 -0
- package/dist/orchestration/capacity.js.map +1 -0
- package/dist/orchestration/channel-activity.d.ts +21 -0
- package/dist/orchestration/channel-activity.d.ts.map +1 -0
- package/dist/orchestration/channel-activity.js +72 -0
- package/dist/orchestration/channel-activity.js.map +1 -0
- package/dist/orchestration/channel-controls.d.ts +32 -0
- package/dist/orchestration/channel-controls.d.ts.map +1 -0
- package/dist/orchestration/channel-controls.js +105 -0
- package/dist/orchestration/channel-controls.js.map +1 -0
- package/dist/orchestration/channel-input-media.d.ts +11 -0
- package/dist/orchestration/channel-input-media.d.ts.map +1 -0
- package/dist/orchestration/channel-input-media.js +54 -0
- package/dist/orchestration/channel-input-media.js.map +1 -0
- package/dist/orchestration/channel-media.d.ts +4 -0
- package/dist/orchestration/channel-media.d.ts.map +1 -0
- package/dist/orchestration/channel-media.js +70 -0
- package/dist/orchestration/channel-media.js.map +1 -0
- package/dist/orchestration/channel-speech.d.ts +7 -0
- package/dist/orchestration/channel-speech.d.ts.map +1 -0
- package/dist/orchestration/channel-speech.js +65 -0
- package/dist/orchestration/channel-speech.js.map +1 -0
- package/dist/orchestration/cli-skills.d.ts +12 -0
- package/dist/orchestration/cli-skills.d.ts.map +1 -0
- package/dist/orchestration/cli-skills.js +132 -0
- package/dist/orchestration/cli-skills.js.map +1 -0
- package/dist/orchestration/config.d.ts +256 -0
- package/dist/orchestration/config.d.ts.map +1 -0
- package/dist/orchestration/config.js +110 -0
- package/dist/orchestration/config.js.map +1 -0
- package/dist/orchestration/container.d.ts +21 -0
- package/dist/orchestration/container.d.ts.map +1 -0
- package/dist/orchestration/container.js +195 -0
- package/dist/orchestration/container.js.map +1 -0
- package/dist/orchestration/control-delivery.d.ts +5 -0
- package/dist/orchestration/control-delivery.d.ts.map +1 -0
- package/dist/orchestration/control-delivery.js +50 -0
- package/dist/orchestration/control-delivery.js.map +1 -0
- package/dist/orchestration/conversation-intake.d.ts +32 -0
- package/dist/orchestration/conversation-intake.d.ts.map +1 -0
- package/dist/orchestration/conversation-intake.js +92 -0
- package/dist/orchestration/conversation-intake.js.map +1 -0
- package/dist/orchestration/decisions.d.ts +27 -0
- package/dist/orchestration/decisions.d.ts.map +1 -0
- package/dist/orchestration/decisions.js +148 -0
- package/dist/orchestration/decisions.js.map +1 -0
- package/dist/orchestration/delivery.d.ts +30 -0
- package/dist/orchestration/delivery.d.ts.map +1 -0
- package/dist/orchestration/delivery.js +219 -0
- package/dist/orchestration/delivery.js.map +1 -0
- package/dist/orchestration/display-stream.d.ts +4 -0
- package/dist/orchestration/display-stream.d.ts.map +1 -0
- package/dist/orchestration/display-stream.js +77 -0
- package/dist/orchestration/display-stream.js.map +1 -0
- package/dist/orchestration/events.d.ts +30 -0
- package/dist/orchestration/events.d.ts.map +1 -0
- package/dist/orchestration/events.js +65 -0
- package/dist/orchestration/events.js.map +1 -0
- package/dist/orchestration/execution-observation.d.ts +38 -0
- package/dist/orchestration/execution-observation.d.ts.map +1 -0
- package/dist/orchestration/execution-observation.js +25 -0
- package/dist/orchestration/execution-observation.js.map +1 -0
- package/dist/orchestration/file-delivery.d.ts +16 -0
- package/dist/orchestration/file-delivery.d.ts.map +1 -0
- package/dist/orchestration/file-delivery.js +139 -0
- package/dist/orchestration/file-delivery.js.map +1 -0
- package/dist/orchestration/gateway-config.d.ts +17 -0
- package/dist/orchestration/gateway-config.d.ts.map +1 -0
- package/dist/orchestration/gateway-config.js +128 -0
- package/dist/orchestration/gateway-config.js.map +1 -0
- package/dist/orchestration/history.d.ts +13 -0
- package/dist/orchestration/history.d.ts.map +1 -0
- package/dist/orchestration/history.js +48 -0
- package/dist/orchestration/history.js.map +1 -0
- package/dist/orchestration/identity.d.ts +6 -0
- package/dist/orchestration/identity.d.ts.map +1 -0
- package/dist/orchestration/identity.js +13 -0
- package/dist/orchestration/identity.js.map +1 -0
- package/dist/orchestration/inference-errors.d.ts +3 -0
- package/dist/orchestration/inference-errors.d.ts.map +1 -0
- package/dist/orchestration/inference-errors.js +16 -0
- package/dist/orchestration/inference-errors.js.map +1 -0
- package/dist/orchestration/input-images.d.ts +12 -0
- package/dist/orchestration/input-images.d.ts.map +1 -0
- package/dist/orchestration/input-images.js +66 -0
- package/dist/orchestration/input-images.js.map +1 -0
- package/dist/orchestration/instance-lock.d.ts +5 -0
- package/dist/orchestration/instance-lock.d.ts.map +1 -0
- package/dist/orchestration/instance-lock.js +33 -0
- package/dist/orchestration/instance-lock.js.map +1 -0
- package/dist/orchestration/line-loading.d.ts +21 -0
- package/dist/orchestration/line-loading.d.ts.map +1 -0
- package/dist/orchestration/line-loading.js +89 -0
- package/dist/orchestration/line-loading.js.map +1 -0
- package/dist/orchestration/media.d.ts +3 -0
- package/dist/orchestration/media.d.ts.map +1 -0
- package/dist/orchestration/media.js +46 -0
- package/dist/orchestration/media.js.map +1 -0
- package/dist/orchestration/migrations/schema.d.ts +3 -0
- package/dist/orchestration/migrations/schema.d.ts.map +1 -0
- package/dist/orchestration/migrations/schema.js +80 -0
- package/dist/orchestration/migrations/schema.js.map +1 -0
- package/dist/orchestration/notification-mailbox.d.ts +5 -0
- package/dist/orchestration/notification-mailbox.d.ts.map +1 -0
- package/dist/orchestration/notification-mailbox.js +29 -0
- package/dist/orchestration/notification-mailbox.js.map +1 -0
- package/dist/orchestration/process-activity.d.ts +23 -0
- package/dist/orchestration/process-activity.d.ts.map +1 -0
- package/dist/orchestration/process-activity.js +95 -0
- package/dist/orchestration/process-activity.js.map +1 -0
- package/dist/orchestration/process-supervisor.d.ts +15 -0
- package/dist/orchestration/process-supervisor.d.ts.map +1 -0
- package/dist/orchestration/process-supervisor.js +92 -0
- package/dist/orchestration/process-supervisor.js.map +1 -0
- package/dist/orchestration/process-turn.d.ts +35 -0
- package/dist/orchestration/process-turn.d.ts.map +1 -0
- package/dist/orchestration/process-turn.js +246 -0
- package/dist/orchestration/process-turn.js.map +1 -0
- package/dist/orchestration/progress-review.d.ts +28 -0
- package/dist/orchestration/progress-review.d.ts.map +1 -0
- package/dist/orchestration/progress-review.js +48 -0
- package/dist/orchestration/progress-review.js.map +1 -0
- package/dist/orchestration/recovery.d.ts +8 -0
- package/dist/orchestration/recovery.d.ts.map +1 -0
- package/dist/orchestration/recovery.js +35 -0
- package/dist/orchestration/recovery.js.map +1 -0
- package/dist/orchestration/reply-context.d.ts +7 -0
- package/dist/orchestration/reply-context.d.ts.map +1 -0
- package/dist/orchestration/reply-context.js +54 -0
- package/dist/orchestration/reply-context.js.map +1 -0
- package/dist/orchestration/runtime.d.ts +232 -0
- package/dist/orchestration/runtime.d.ts.map +1 -0
- package/dist/orchestration/runtime.js +962 -0
- package/dist/orchestration/runtime.js.map +1 -0
- package/dist/orchestration/skills.d.ts +17 -0
- package/dist/orchestration/skills.d.ts.map +1 -0
- package/dist/orchestration/skills.js +32 -0
- package/dist/orchestration/skills.js.map +1 -0
- package/dist/orchestration/source-policy.d.ts +6 -0
- package/dist/orchestration/source-policy.d.ts.map +1 -0
- package/dist/orchestration/source-policy.js +16 -0
- package/dist/orchestration/source-policy.js.map +1 -0
- package/dist/orchestration/speech.d.ts +24 -0
- package/dist/orchestration/speech.d.ts.map +1 -0
- package/dist/orchestration/speech.js +61 -0
- package/dist/orchestration/speech.js.map +1 -0
- package/dist/orchestration/stop-controls.d.ts +30 -0
- package/dist/orchestration/stop-controls.d.ts.map +1 -0
- package/dist/orchestration/stop-controls.js +79 -0
- package/dist/orchestration/stop-controls.js.map +1 -0
- package/dist/orchestration/store.d.ts +86 -0
- package/dist/orchestration/store.d.ts.map +1 -0
- package/dist/orchestration/store.js +275 -0
- package/dist/orchestration/store.js.map +1 -0
- package/dist/orchestration/task-controls.d.ts +130 -0
- package/dist/orchestration/task-controls.d.ts.map +1 -0
- package/dist/orchestration/task-controls.js +55 -0
- package/dist/orchestration/task-controls.js.map +1 -0
- package/dist/orchestration/task-files.d.ts +29 -0
- package/dist/orchestration/task-files.d.ts.map +1 -0
- package/dist/orchestration/task-files.js +200 -0
- package/dist/orchestration/task-files.js.map +1 -0
- package/dist/orchestration/task-report.d.ts +7 -0
- package/dist/orchestration/task-report.d.ts.map +1 -0
- package/dist/orchestration/task-report.js +33 -0
- package/dist/orchestration/task-report.js.map +1 -0
- package/dist/orchestration/tasks/checkpoint-hook.d.ts +19 -0
- package/dist/orchestration/tasks/checkpoint-hook.d.ts.map +1 -0
- package/dist/orchestration/tasks/checkpoint-hook.js +49 -0
- package/dist/orchestration/tasks/checkpoint-hook.js.map +1 -0
- package/dist/orchestration/tasks/cleanup.d.ts +18 -0
- package/dist/orchestration/tasks/cleanup.d.ts.map +1 -0
- package/dist/orchestration/tasks/cleanup.js +113 -0
- package/dist/orchestration/tasks/cleanup.js.map +1 -0
- package/dist/orchestration/tasks/driver.d.ts +23 -0
- package/dist/orchestration/tasks/driver.d.ts.map +1 -0
- package/dist/orchestration/tasks/driver.js +209 -0
- package/dist/orchestration/tasks/driver.js.map +1 -0
- package/dist/orchestration/tasks/failure.d.ts +5 -0
- package/dist/orchestration/tasks/failure.d.ts.map +1 -0
- package/dist/orchestration/tasks/failure.js +17 -0
- package/dist/orchestration/tasks/failure.js.map +1 -0
- package/dist/orchestration/tasks/pool.d.ts +18 -0
- package/dist/orchestration/tasks/pool.d.ts.map +1 -0
- package/dist/orchestration/tasks/pool.js +73 -0
- package/dist/orchestration/tasks/pool.js.map +1 -0
- package/dist/orchestration/tasks/scheduler.d.ts +38 -0
- package/dist/orchestration/tasks/scheduler.d.ts.map +1 -0
- package/dist/orchestration/tasks/scheduler.js +160 -0
- package/dist/orchestration/tasks/scheduler.js.map +1 -0
- package/dist/orchestration/tasks/service.d.ts +109 -0
- package/dist/orchestration/tasks/service.d.ts.map +1 -0
- package/dist/orchestration/tasks/service.js +697 -0
- package/dist/orchestration/tasks/service.js.map +1 -0
- package/dist/orchestration/tasks/shared-workspace.d.ts +25 -0
- package/dist/orchestration/tasks/shared-workspace.d.ts.map +1 -0
- package/dist/orchestration/tasks/shared-workspace.js +162 -0
- package/dist/orchestration/tasks/shared-workspace.js.map +1 -0
- package/dist/orchestration/tasks/task-directive.d.ts +6 -0
- package/dist/orchestration/tasks/task-directive.d.ts.map +1 -0
- package/dist/orchestration/tasks/task-directive.js +41 -0
- package/dist/orchestration/tasks/task-directive.js.map +1 -0
- package/dist/orchestration/tasks/timing.d.ts +15 -0
- package/dist/orchestration/tasks/timing.d.ts.map +1 -0
- package/dist/orchestration/tasks/timing.js +48 -0
- package/dist/orchestration/tasks/timing.js.map +1 -0
- package/dist/orchestration/tasks/tool-repetition.d.ts +3 -0
- package/dist/orchestration/tasks/tool-repetition.d.ts.map +1 -0
- package/dist/orchestration/tasks/tool-repetition.js +30 -0
- package/dist/orchestration/tasks/tool-repetition.js.map +1 -0
- package/dist/orchestration/tasks/workspace.d.ts +24 -0
- package/dist/orchestration/tasks/workspace.d.ts.map +1 -0
- package/dist/orchestration/tasks/workspace.js +147 -0
- package/dist/orchestration/tasks/workspace.js.map +1 -0
- package/dist/orchestration/telegram-speech.d.ts +17 -0
- package/dist/orchestration/telegram-speech.d.ts.map +1 -0
- package/dist/orchestration/telegram-speech.js +55 -0
- package/dist/orchestration/telegram-speech.js.map +1 -0
- package/dist/orchestration/telegram-tool-status.d.ts +23 -0
- package/dist/orchestration/telegram-tool-status.d.ts.map +1 -0
- package/dist/orchestration/telegram-tool-status.js +207 -0
- package/dist/orchestration/telegram-tool-status.js.map +1 -0
- package/dist/orchestration/telegram-voices.d.ts +42 -0
- package/dist/orchestration/telegram-voices.d.ts.map +1 -0
- package/dist/orchestration/telegram-voices.js +70 -0
- package/dist/orchestration/telegram-voices.js.map +1 -0
- package/dist/orchestration/tool-activity.d.ts +10 -0
- package/dist/orchestration/tool-activity.d.ts.map +1 -0
- package/dist/orchestration/tool-activity.js +38 -0
- package/dist/orchestration/tool-activity.js.map +1 -0
- package/dist/orchestration/types.d.ts +177 -0
- package/dist/orchestration/types.d.ts.map +1 -0
- package/dist/orchestration/types.js +13 -0
- package/dist/orchestration/types.js.map +1 -0
- package/dist/orchestration/voice-reply-policy.d.ts +8 -0
- package/dist/orchestration/voice-reply-policy.d.ts.map +1 -0
- package/dist/orchestration/voice-reply-policy.js +46 -0
- package/dist/orchestration/voice-reply-policy.js.map +1 -0
- package/dist/orchestration/worker-shares.d.ts +8 -0
- package/dist/orchestration/worker-shares.d.ts.map +1 -0
- package/dist/orchestration/worker-shares.js +59 -0
- package/dist/orchestration/worker-shares.js.map +1 -0
- package/dist/orchestration/workflow.d.ts +121 -0
- package/dist/orchestration/workflow.d.ts.map +1 -0
- package/dist/orchestration/workflow.js +69 -0
- package/dist/orchestration/workflow.js.map +1 -0
- package/dist/session/input-image.d.ts +10 -0
- package/dist/session/input-image.d.ts.map +1 -0
- package/dist/session/input-image.js +3 -0
- package/dist/session/input-image.js.map +1 -0
- package/dist/session/process.d.ts +15 -3
- package/dist/session/process.d.ts.map +1 -1
- package/dist/session/process.js +144 -35
- package/dist/session/process.js.map +1 -1
- package/dist/session/runtime-profile.d.ts +36 -0
- package/dist/session/runtime-profile.d.ts.map +1 -0
- package/dist/session/runtime-profile.js +63 -0
- package/dist/session/runtime-profile.js.map +1 -0
- package/dist/session/store.d.ts.map +1 -1
- package/dist/session/store.js +23 -1
- package/dist/session/store.js.map +1 -1
- package/dist/share/share-store.d.ts +3 -1
- package/dist/share/share-store.d.ts.map +1 -1
- package/dist/share/share-store.js +13 -2
- package/dist/share/share-store.js.map +1 -1
- package/dist/shared/line-request-order.d.ts +2 -0
- package/dist/shared/line-request-order.d.ts.map +1 -0
- package/dist/shared/line-request-order.js +16 -0
- package/dist/shared/line-request-order.js.map +1 -0
- package/dist/shared/task-elapsed.d.ts +3 -0
- package/dist/shared/task-elapsed.d.ts.map +1 -0
- package/dist/shared/task-elapsed.js +12 -0
- package/dist/shared/task-elapsed.js.map +1 -0
- package/dist/shared/task-updated-time.d.ts +3 -0
- package/dist/shared/task-updated-time.d.ts.map +1 -0
- package/dist/shared/task-updated-time.js +15 -0
- package/dist/shared/task-updated-time.js.map +1 -0
- package/dist/skills/loader.d.ts +2 -0
- package/dist/skills/loader.d.ts.map +1 -1
- package/dist/skills/loader.js.map +1 -1
- package/dist/telegram/chunks.d.ts +19 -0
- package/dist/telegram/chunks.d.ts.map +1 -0
- package/dist/telegram/chunks.js +129 -0
- package/dist/telegram/chunks.js.map +1 -0
- package/dist/telegram/markdown.d.ts.map +1 -1
- package/dist/telegram/markdown.js +18 -3
- package/dist/telegram/markdown.js.map +1 -1
- package/dist/telegram/receiver.d.ts +2 -1
- package/dist/telegram/receiver.d.ts.map +1 -1
- package/dist/telegram/receiver.js +6 -1
- package/dist/telegram/receiver.js.map +1 -1
- package/dist/types.d.ts +54 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/ui/web-ui.d.ts.map +1 -1
- package/dist/ui/web-ui.js +31 -5
- package/dist/ui/web-ui.js.map +1 -1
- package/dist/voice/diagnostics.d.ts +29 -0
- package/dist/voice/diagnostics.d.ts.map +1 -0
- package/dist/voice/diagnostics.js +37 -0
- package/dist/voice/diagnostics.js.map +1 -0
- package/dist/voice/errors.d.ts +19 -0
- package/dist/voice/errors.d.ts.map +1 -0
- package/dist/voice/errors.js +133 -0
- package/dist/voice/errors.js.map +1 -0
- package/dist/voice/line-audio.d.ts +4 -0
- package/dist/voice/line-audio.d.ts.map +1 -0
- package/dist/voice/line-audio.js +27 -0
- package/dist/voice/line-audio.js.map +1 -0
- package/dist/voice/managed-quota.d.ts +5 -0
- package/dist/voice/managed-quota.d.ts.map +1 -0
- package/dist/voice/managed-quota.js +35 -0
- package/dist/voice/managed-quota.js.map +1 -0
- package/dist/voice/mp3.d.ts +3 -0
- package/dist/voice/mp3.d.ts.map +1 -0
- package/dist/voice/mp3.js +30 -0
- package/dist/voice/mp3.js.map +1 -0
- package/dist/voice/notes.d.ts +9 -0
- package/dist/voice/notes.d.ts.map +1 -0
- package/dist/voice/notes.js +68 -0
- package/dist/voice/notes.js.map +1 -0
- package/dist/voice/playback.d.ts +22 -0
- package/dist/voice/playback.d.ts.map +1 -0
- package/dist/voice/playback.js +52 -0
- package/dist/voice/playback.js.map +1 -0
- package/dist/voice/preview.d.ts +6 -0
- package/dist/voice/preview.d.ts.map +1 -0
- package/dist/voice/preview.js +44 -0
- package/dist/voice/preview.js.map +1 -0
- package/dist/voice/protocol.d.ts +10 -0
- package/dist/voice/protocol.d.ts.map +1 -0
- package/dist/voice/protocol.js +30 -0
- package/dist/voice/protocol.js.map +1 -0
- package/dist/voice/providers/cartesia-tts.d.ts +26 -0
- package/dist/voice/providers/cartesia-tts.d.ts.map +1 -0
- package/dist/voice/providers/cartesia-tts.js +95 -0
- package/dist/voice/providers/cartesia-tts.js.map +1 -0
- package/dist/voice/providers/deepgram-stt.d.ts +20 -0
- package/dist/voice/providers/deepgram-stt.d.ts.map +1 -0
- package/dist/voice/providers/deepgram-stt.js +66 -0
- package/dist/voice/providers/deepgram-stt.js.map +1 -0
- package/dist/voice/providers/elevenlabs-stt.d.ts +20 -0
- package/dist/voice/providers/elevenlabs-stt.d.ts.map +1 -0
- package/dist/voice/providers/elevenlabs-stt.js +92 -0
- package/dist/voice/providers/elevenlabs-stt.js.map +1 -0
- package/dist/voice/providers/elevenlabs-tts.d.ts +26 -0
- package/dist/voice/providers/elevenlabs-tts.d.ts.map +1 -0
- package/dist/voice/providers/elevenlabs-tts.js +82 -0
- package/dist/voice/providers/elevenlabs-tts.js.map +1 -0
- package/dist/voice/providers/encoded-audio-tts.d.ts +21 -0
- package/dist/voice/providers/encoded-audio-tts.d.ts.map +1 -0
- package/dist/voice/providers/encoded-audio-tts.js +175 -0
- package/dist/voice/providers/encoded-audio-tts.js.map +1 -0
- package/dist/voice/providers/fake.d.ts +39 -0
- package/dist/voice/providers/fake.d.ts.map +1 -0
- package/dist/voice/providers/fake.js +41 -0
- package/dist/voice/providers/fake.js.map +1 -0
- package/dist/voice/providers/gemini-live-stt.d.ts +21 -0
- package/dist/voice/providers/gemini-live-stt.d.ts.map +1 -0
- package/dist/voice/providers/gemini-live-stt.js +158 -0
- package/dist/voice/providers/gemini-live-stt.js.map +1 -0
- package/dist/voice/providers/gemini.d.ts +60 -0
- package/dist/voice/providers/gemini.d.ts.map +1 -0
- package/dist/voice/providers/gemini.js +124 -0
- package/dist/voice/providers/gemini.js.map +1 -0
- package/dist/voice/providers/model-ref.d.ts +9 -0
- package/dist/voice/providers/model-ref.d.ts.map +1 -0
- package/dist/voice/providers/model-ref.js +31 -0
- package/dist/voice/providers/model-ref.js.map +1 -0
- package/dist/voice/providers/openrouter.d.ts +39 -0
- package/dist/voice/providers/openrouter.d.ts.map +1 -0
- package/dist/voice/providers/openrouter.js +154 -0
- package/dist/voice/providers/openrouter.js.map +1 -0
- package/dist/voice/providers/paxalabs-stt.d.ts +12 -0
- package/dist/voice/providers/paxalabs-stt.d.ts.map +1 -0
- package/dist/voice/providers/paxalabs-stt.js +41 -0
- package/dist/voice/providers/paxalabs-stt.js.map +1 -0
- package/dist/voice/providers/paxalabs-tts.d.ts +23 -0
- package/dist/voice/providers/paxalabs-tts.d.ts.map +1 -0
- package/dist/voice/providers/paxalabs-tts.js +80 -0
- package/dist/voice/providers/paxalabs-tts.js.map +1 -0
- package/dist/voice/providers/recorded-stt.d.ts +34 -0
- package/dist/voice/providers/recorded-stt.d.ts.map +1 -0
- package/dist/voice/providers/recorded-stt.js +59 -0
- package/dist/voice/providers/recorded-stt.js.map +1 -0
- package/dist/voice/providers/registry.d.ts +10 -0
- package/dist/voice/providers/registry.d.ts.map +1 -0
- package/dist/voice/providers/registry.js +77 -0
- package/dist/voice/providers/registry.js.map +1 -0
- package/dist/voice/providers/socket.d.ts +10 -0
- package/dist/voice/providers/socket.d.ts.map +1 -0
- package/dist/voice/providers/socket.js +91 -0
- package/dist/voice/providers/socket.js.map +1 -0
- package/dist/voice/providers/upstream.d.ts +9 -0
- package/dist/voice/providers/upstream.d.ts.map +1 -0
- package/dist/voice/providers/upstream.js +51 -0
- package/dist/voice/providers/upstream.js.map +1 -0
- package/dist/voice/providers/voice-catalog.d.ts +17 -0
- package/dist/voice/providers/voice-catalog.d.ts.map +1 -0
- package/dist/voice/providers/voice-catalog.js +167 -0
- package/dist/voice/providers/voice-catalog.js.map +1 -0
- package/dist/voice/queue.d.ts +2 -0
- package/dist/voice/queue.d.ts.map +1 -0
- package/dist/voice/queue.js +6 -0
- package/dist/voice/queue.js.map +1 -0
- package/dist/voice/session.d.ts +86 -0
- package/dist/voice/session.d.ts.map +1 -0
- package/dist/voice/session.js +464 -0
- package/dist/voice/session.js.map +1 -0
- package/dist/voice/turn-manager.d.ts +27 -0
- package/dist/voice/turn-manager.d.ts.map +1 -0
- package/dist/voice/turn-manager.js +75 -0
- package/dist/voice/turn-manager.js.map +1 -0
- package/dist/voice/types.d.ts +78 -0
- package/dist/voice/types.d.ts.map +1 -0
- package/dist/voice/types.js +18 -0
- package/dist/voice/types.js.map +1 -0
- package/dist/voice/wav.d.ts +2 -0
- package/dist/voice/wav.d.ts.map +1 -0
- package/dist/voice/wav.js +21 -0
- package/dist/voice/wav.js.map +1 -0
- package/dist/wechat/ilink-client.d.ts +207 -0
- package/dist/wechat/ilink-client.d.ts.map +1 -0
- package/dist/wechat/ilink-client.js +660 -0
- package/dist/wechat/ilink-client.js.map +1 -0
- package/dist/wechat/manager.d.ts +93 -0
- package/dist/wechat/manager.d.ts.map +1 -0
- package/dist/wechat/manager.js +409 -0
- package/dist/wechat/manager.js.map +1 -0
- package/dist/whatsapp/manager.d.ts.map +1 -1
- package/dist/whatsapp/manager.js +51 -1
- package/dist/whatsapp/manager.js.map +1 -1
- package/mcp/capability-catalog.ts +206 -0
- package/mcp/modules.ts +56 -0
- package/mcp/server.ts +18 -35
- package/mcp/tools/browser/module.ts +1 -1
- package/mcp/tools/browser/skills/open-browser/SKILL.md +5 -3
- package/mcp/tools/discord/commands.ts +17 -1
- package/mcp/tools/discord/inbound.ts +11 -0
- package/mcp/tools/discord/module.ts +42 -2
- package/mcp/tools/discord/receiver-server.ts +10 -0
- package/mcp/tools/discord/types.ts +4 -1
- package/mcp/tools/image/module.ts +3 -1
- package/mcp/tools/receiver-spool.test.ts +28 -0
- package/mcp/tools/receiver-spool.ts +56 -0
- package/mcp/tools/share-file/module.ts +9 -1
- package/mcp/tools/shared/share-client.ts +19 -0
- package/mcp/tools/tasks/module.ts +35 -0
- package/mcp/tools/telegram/media-group.ts +21 -0
- package/mcp/tools/telegram/receiver-server.ts +232 -11
- package/mcp/tools/telegram/selection-confirmation.ts +20 -0
- package/mcp/tools/telegram/task-browser.ts +117 -0
- package/mcp/tools/telegram/task-detail.ts +36 -0
- package/mcp/tools/telegram/task-elapsed.ts +1 -0
- package/mcp/tools/telegram/typing.ts +6 -116
- package/mcp/tools/video/module.ts +1 -1
- package/mcp/tools/wechat/client.ts +49 -0
- package/mcp/tools/wechat/module.ts +88 -0
- package/mcp/types.ts +5 -0
- package/package.json +2 -1
- package/resource/claude_gateway.jpeg +0 -0
- package/scripts/orchestration/bench-store.cjs +30 -0
- package/scripts/orchestration/inspect.cjs +16 -0
- package/scripts/orchestration/probe-profile.cjs +67 -0
- package/scripts/orchestration/reconcile.cjs +21 -0
- package/scripts/orchestration/smoke-elevenlabs.cjs +90 -0
- package/scripts/orchestration/smoke-media.cjs +70 -0
- package/scripts/orchestration/smoke-text.cjs +101 -0
- package/scripts/orchestration/smoke-vision.cjs +49 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClaudeWorkerDriver = void 0;
|
|
4
|
+
const reply_context_1 = require("../reply-context");
|
|
5
|
+
const tool_repetition_1 = require("./tool-repetition");
|
|
6
|
+
const task_directive_1 = require("./task-directive");
|
|
7
|
+
const source_policy_1 = require("../source-policy");
|
|
8
|
+
const browser_routing_1 = require("../browser-routing");
|
|
9
|
+
const cli_skills_1 = require("../cli-skills");
|
|
10
|
+
const process_activity_1 = require("../process-activity");
|
|
11
|
+
const process_supervisor_1 = require("../process-supervisor");
|
|
12
|
+
const config_1 = require("../config");
|
|
13
|
+
const failure_1 = require("./failure");
|
|
14
|
+
const store_1 = require("../store");
|
|
15
|
+
const container_1 = require("../container");
|
|
16
|
+
const tool_activity_1 = require("../tool-activity");
|
|
17
|
+
const parser_1 = require("../../skills/parser");
|
|
18
|
+
const path_1 = require("path");
|
|
19
|
+
const promises_1 = require("fs/promises");
|
|
20
|
+
const store_2 = require("../../session/store");
|
|
21
|
+
const process_1 = require("../../session/process");
|
|
22
|
+
const types_1 = require("../types");
|
|
23
|
+
const process_turn_1 = require("../process-turn");
|
|
24
|
+
const crypto_1 = require("crypto");
|
|
25
|
+
const capacity_1 = require("../capacity");
|
|
26
|
+
const knowledge_1 = require("../../agent/knowledge");
|
|
27
|
+
const media_store_1 = require("../../history/media-store");
|
|
28
|
+
function boundedDiffText(text) {
|
|
29
|
+
let result = text.slice(0, 8192);
|
|
30
|
+
while (Buffer.byteLength(JSON.stringify(result)) > 16000)
|
|
31
|
+
result = result.slice(0, Math.floor(result.length / 2));
|
|
32
|
+
return result.replace(/[\uD800-\uDBFF]$/, '');
|
|
33
|
+
}
|
|
34
|
+
class ClaudeWorkerDriver {
|
|
35
|
+
constructor(agent, gateway, tasks, bridge, workspaces, privateRoot, onManagedTurn) {
|
|
36
|
+
this.agent = agent;
|
|
37
|
+
this.gateway = gateway;
|
|
38
|
+
this.tasks = tasks;
|
|
39
|
+
this.bridge = bridge;
|
|
40
|
+
this.workspaces = workspaces;
|
|
41
|
+
this.privateRoot = privateRoot;
|
|
42
|
+
this.onManagedTurn = onManagedTurn;
|
|
43
|
+
this.instanceId = (0, crypto_1.randomUUID)();
|
|
44
|
+
}
|
|
45
|
+
async cleanup(attempt) {
|
|
46
|
+
// Stopping a docker client does not prove its container execution stopped.
|
|
47
|
+
if (this.agent.type === 'app-agent')
|
|
48
|
+
return false;
|
|
49
|
+
return (0, process_supervisor_1.cleanupPersistedProcess)(attempt.processIdentity);
|
|
50
|
+
}
|
|
51
|
+
reserve(taskId) { return (0, capacity_1.gatewayCapacity)(this.gateway).acquireWorker(this.agent.id, taskId); }
|
|
52
|
+
available(taskId) { return this.workspaces.available(taskId); }
|
|
53
|
+
release(taskId) { return this.workspaces.release(taskId); }
|
|
54
|
+
async start(task, attempt, capacityReserved = false) {
|
|
55
|
+
if (!['default-worker', 'media-worker', 'skill-worker'].includes(task.targetProfile) || !task.capabilities.execute)
|
|
56
|
+
throw new types_1.OrchestrationError('EXECUTION_DENIED');
|
|
57
|
+
if (task.targetProfile === 'default-worker' && task.resourceProfile?.mode === 'shared-lock') {
|
|
58
|
+
const [project, identity] = await Promise.all([(0, promises_1.realpath)(task.resourceProfile.projectRoot), (0, promises_1.realpath)(this.agent.workspace)]);
|
|
59
|
+
if (project === identity || project.startsWith(identity + '/') || identity.startsWith(project + '/'))
|
|
60
|
+
throw new types_1.OrchestrationError('SHARED_PROJECT_MUST_DIFFER_FROM_IDENTITY_WORKSPACE');
|
|
61
|
+
}
|
|
62
|
+
if (this.agent.type === 'app-agent') {
|
|
63
|
+
if (task.resourceProfile?.mode !== 'container')
|
|
64
|
+
throw new types_1.OrchestrationError('CONTAINER_WORKSPACE_REQUIRED');
|
|
65
|
+
await (0, container_1.validateContainer)(this.agent);
|
|
66
|
+
}
|
|
67
|
+
const workspace = await this.workspaces.prepare(task.taskId);
|
|
68
|
+
const current = this.tasks.store.task(task.taskId);
|
|
69
|
+
if (current.state !== 'starting' || current.activeAttemptId !== attempt.attemptId)
|
|
70
|
+
throw new types_1.OrchestrationError('ATTEMPT_CANCELLED_BEFORE_START');
|
|
71
|
+
const directory = (0, path_1.join)(this.privateRoot, attempt.attemptId);
|
|
72
|
+
const cliSkill = task.skill?.invocation === 'cli';
|
|
73
|
+
const invokedSkill = task.skill ? (cliSkill ? task.skill.name : `orchestration-task:${task.skill.name}`) : undefined;
|
|
74
|
+
if (cliSkill) {
|
|
75
|
+
const installed = await (0, cli_skills_1.discoverCliSkills)(this.agent, workspace.path);
|
|
76
|
+
if (!installed.some(skill => skill.name === task.skill.name))
|
|
77
|
+
throw new types_1.OrchestrationError('CLI_SKILL_UNAVAILABLE', 'The selected skill is unavailable in this worker runtime; no host/container fallback was attempted.');
|
|
78
|
+
}
|
|
79
|
+
const skillPluginDir = task.skill && !cliSkill ? (0, path_1.join)(directory, 'skill-plugin') : undefined;
|
|
80
|
+
if (task.skill && !cliSkill) {
|
|
81
|
+
if (task.skill.requires?.plugins?.length)
|
|
82
|
+
throw new types_1.OrchestrationError('SKILL_PLUGIN_UNAVAILABLE');
|
|
83
|
+
const destination = (0, path_1.join)(skillPluginDir, 'skills', task.skill.name);
|
|
84
|
+
await (0, promises_1.mkdir)((0, path_1.join)(skillPluginDir, '.claude-plugin'), { recursive: true, mode: 0o700 });
|
|
85
|
+
await (0, promises_1.writeFile)((0, path_1.join)(skillPluginDir, '.claude-plugin', 'plugin.json'), JSON.stringify({ name: 'orchestration-task', description: 'Assigned task skill only', version: '1.0.0' }), { mode: 0o600 });
|
|
86
|
+
await (0, promises_1.mkdir)(destination, { recursive: true, mode: 0o700 });
|
|
87
|
+
// Keep relative references/scripts available; the invoked body is pinned at admission.
|
|
88
|
+
await (0, promises_1.cp)((0, path_1.dirname)(task.skill.filePath), destination, { recursive: true, dereference: false, filter: async (source) => !(await (0, promises_1.lstat)(source)).isSymbolicLink() });
|
|
89
|
+
await (0, promises_1.writeFile)((0, path_1.join)(destination, 'SKILL.md'), `---\nname: ${task.skill.name}\ndescription: Assigned installed skill\n---\n${(0, parser_1.extractFrontmatter)(task.skill.content)?.body ?? task.skill.content}`, { mode: 0o600 });
|
|
90
|
+
}
|
|
91
|
+
const revision = this.tasks.revision(task.taskId, attempt.revision);
|
|
92
|
+
const directive = (0, task_directive_1.taskDirective)(this.tasks.store, task.conversationId, revision);
|
|
93
|
+
// Snapshot the authorized agent context without modifying either workspace's
|
|
94
|
+
// persona files. Project CLAUDE.md continues to be discovered in the worktree.
|
|
95
|
+
const context = this.agent.type === 'app-agent'
|
|
96
|
+
? await (0, container_1.containerNode)(this.agent.container, "process.stdout.write(require('fs').readFileSync('/workspace/CLAUDE.md','utf8'))")
|
|
97
|
+
: await (0, promises_1.readFile)((0, path_1.join)(this.agent.workspace, 'CLAUDE.md'), 'utf8');
|
|
98
|
+
this.tasks.pool.bind(attempt, (0, store_1.payloadHash)({ context, workspace: workspace.path, agent: this.agent, gateway: this.gateway }));
|
|
99
|
+
const shared = (0, knowledge_1.resolveSharedConfig)(this.agent.knowledge?.shared, this.gateway.gateway.knowledge?.shared);
|
|
100
|
+
const ticket = this.bridge.issue({ role: 'worker', attemptId: attempt.attemptId, generation: attempt.generation }, directory, this.agent.workspace, shared.enabled ? (0, knowledge_1.sharedVaultDir)(shared) : '');
|
|
101
|
+
try {
|
|
102
|
+
const profile = { ...ticket.profile, hostExecution: workspace.baseCommit === 'host', containerExecution: this.agent.type === 'app-agent', originSessionId: task.agentSessionId, taskId: task.taskId, attemptId: attempt.attemptId, context, workerSession: { id: attempt.sessionId, resume: Boolean(attempt.resumeSession) }, capacityReserved, skillPluginDir };
|
|
103
|
+
const workerConfig = { ...this.agent, workspace: this.agent.type === 'app-agent' ? this.agent.workspace : workspace.path, allow_tools: true, orchestration: undefined,
|
|
104
|
+
claude: { ...this.agent.claude, model: task.model ?? this.agent.claude.model, extraFlags: [] } };
|
|
105
|
+
const process = new process_1.SessionProcess(attempt.sessionId, 'api', workerConfig, this.gateway, new store_2.SessionStore((0, path_1.join)(this.privateRoot, 'logs')), undefined, profile);
|
|
106
|
+
process.on('output', line => this.bridge.captureWorkerOutput(attempt.attemptId, attempt.generation, line));
|
|
107
|
+
process.on('output', (0, tool_activity_1.toolActivity)(event => this.tasks.store.transaction(() => this.tasks.store.appendEvent(task.conversationId, 'tool.activity', { ...event, taskId: task.taskId, role: 'worker' }, task.taskId))));
|
|
108
|
+
process.on('output', (0, tool_repetition_1.observeToolRepetition)((signature, id) => this.tasks.observeToolResult(attempt.attemptId, attempt.generation, signature, id), active => this.tasks.observeToolBoundary(attempt.attemptId, attempt.generation, active)));
|
|
109
|
+
const skillCalls = new Set();
|
|
110
|
+
process.on('output', line => {
|
|
111
|
+
if (!task.skill)
|
|
112
|
+
return;
|
|
113
|
+
try {
|
|
114
|
+
const event = JSON.parse(line);
|
|
115
|
+
for (const block of event.message?.content ?? []) {
|
|
116
|
+
if (event.type === 'assistant' && block.type === 'tool_use' && block.name === 'Skill' && block.input?.skill === invokedSkill)
|
|
117
|
+
skillCalls.add(block.id);
|
|
118
|
+
if (event.type === 'user' && block.type === 'tool_result' && skillCalls.delete(block.tool_use_id) && !block.is_error) {
|
|
119
|
+
this.tasks.store.transaction(() => this.tasks.store.appendEvent(task.conversationId, 'task.skill_invoked', { attemptId: attempt.attemptId, skill: task.skill.name }, task.taskId));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
catch { /* Observability must not change task execution. */ }
|
|
124
|
+
});
|
|
125
|
+
const input = this.tasks.store.get('SELECT * FROM conversation_inputs WHERE id=?', revision.originatingInputId);
|
|
126
|
+
const conversation = this.tasks.store.get('SELECT * FROM conversations WHERE id=?', task.conversationId);
|
|
127
|
+
const reply = (0, reply_context_1.resolveStoredReply)(this.tasks.store, { agentId: task.agentId, agentSessionId: task.agentSessionId, source: conversation.source, accountId: String(conversation.account_id), chatId: String(conversation.chat_id), threadKey: String(conversation.thread_key), principalId: String(input.principal_id) }, JSON.parse(String(input.ingress_json ?? '{}')).metadata);
|
|
128
|
+
const attachments = [...new Set([...JSON.parse(String(input.attachment_refs_json)), ...(reply?.repliedAttachmentIds ?? [])])].map(ref => media_store_1.MediaStore.resolvePath((0, path_1.join)(this.agent.workspace, '../..'), this.agent.id, ref));
|
|
129
|
+
const references = revision.contextRefs.map(ref => {
|
|
130
|
+
const inputRef = this.tasks.store.get('SELECT text,attachment_refs_json,ingress_json FROM conversation_inputs WHERE id=? AND conversation_id=?', ref.replace(/^input:/, ''), task.conversationId);
|
|
131
|
+
if (inputRef)
|
|
132
|
+
return { ref, kind: 'input', text: inputRef.text, replyContext: (0, reply_context_1.storedReplyContext)(inputRef.ingress_json), attachments: JSON.parse(String(inputRef.attachment_refs_json)).map(path => media_store_1.MediaStore.resolvePath((0, path_1.join)(this.agent.workspace, '../..'), this.agent.id, path)) };
|
|
133
|
+
const file = this.tasks.store.get('SELECT f.path FROM task_files f JOIN tasks t ON t.id=f.task_id WHERE f.id=? AND t.conversation_id=?', ref, task.conversationId);
|
|
134
|
+
if (file)
|
|
135
|
+
return { ref, kind: 'attachment', path: media_store_1.MediaStore.resolvePath((0, path_1.join)(this.agent.workspace, '../..'), this.agent.id, String(file.path)) };
|
|
136
|
+
const resource = this.tasks.store.get('SELECT r.* FROM task_resources r JOIN tasks t ON t.id=r.task_id WHERE r.id=? AND t.conversation_id=?', ref, task.conversationId);
|
|
137
|
+
if (resource)
|
|
138
|
+
return { ref, kind: 'artifact', lifecycle: resource.lifecycle_state, path: resource.lifecycle_state === 'archived' ? resource.context_snapshot_ref : resource.worktree_path };
|
|
139
|
+
return { ref, kind: 'attachment', path: media_store_1.MediaStore.resolvePath((0, path_1.join)(this.agent.workspace, '../..'), this.agent.id, ref) };
|
|
140
|
+
});
|
|
141
|
+
const contextFile = (0, path_1.join)(directory, 'context.json');
|
|
142
|
+
await (0, promises_1.writeFile)(contextFile, JSON.stringify({ references, attachments }, null, 2), { mode: 0o600 });
|
|
143
|
+
const browserContext = (0, browser_routing_1.browserRouting)(this.agent, this.gateway, workspace.baseCommit === 'host');
|
|
144
|
+
let prompt = `${browserContext}\n\nTask ${task.taskId}, attempt ${attempt.attemptId}, revision ${attempt.revision}.\n${directive}${task.skill ? `\nThe registered CLI skill name is ${invokedSkill}; invoke that exact name via Skill with arguments ${JSON.stringify(task.skill.args)}.` : ''}\n\nAuthorized read-only context and attachment paths: ${contextFile}. Read this file when the task requires its references.\nComposer options: ${JSON.parse(String(input.ingress_json ?? '{}')).metadata?.promptContext ?? ''}\n${workspace.baseCommit === 'host' ? 'Host execution: you run directly on the same machine and OS account as the original Agent, with its filesystem, shell, network, tools and credentials. Your starting directory is ' + workspace.path + '. You may change directories and operate on user-authorized paths and host services (including tmux and GitHub). No Git worktree is required. Do not claim isolation or missing access without an actual tool error. Coordinate changes to shared files; preserve unrelated work.' : 'Write only in ' + workspace.path + '.'} ${task.skill && workspace.baseCommit !== 'host' ? `Skill reference workspace (read only): ${task.resourceProfile?.projectRoot}. Place any generated files or artifacts in the scratch directory; never edit the source project.` : ''} Base: ${workspace.baseCommit}.\nAgent memory writes permitted: ${task.capabilities.writeMemory}. ${workspace.baseCommit === 'host' ? 'Ordinary task files may be written in the authorized working directory; follow the persona policy for explicit user requests and retain other memory rules.' : 'Never change agent workspace files.'} Report the actual outcome, relevant verification evidence, any artifacts produced, and remaining limitations. Choose verification appropriate to the task; diffs and tests apply only when relevant.`;
|
|
145
|
+
if (this.agent.type === 'app-agent') {
|
|
146
|
+
prompt = `Task ${task.taskId}, attempt ${attempt.attemptId}, revision ${attempt.revision}.\n${directive}\nYou run ONLY inside this app container. Work in /workspace or /tmp. No host filesystem, host tools or host fallback. Native CLI tools execute here; gateway media/browser/memory tools are unavailable. To return files call task_stage_file with their container paths.\nAuthorized context: ${JSON.stringify({ references, attachments })}${task.skill ? `\nInvoke Skill ${invokedSkill} with arguments: ${task.skill.args}` : ''}`;
|
|
147
|
+
}
|
|
148
|
+
prompt += '\nOriginating user request (the assignment must stay within this authorization): ' + JSON.stringify(input.text);
|
|
149
|
+
prompt += '\n' + (0, source_policy_1.personaWorkspaceRules)(this.agent.workspace, this.agent.type === 'app-agent' ? 'container' : workspace.baseCommit === 'host' ? 'host' : 'isolated');
|
|
150
|
+
if (task.continueTaskId) {
|
|
151
|
+
const prior = this.tasks.store.task(task.continueTaskId);
|
|
152
|
+
prompt += '\nContinuation of prior task (persisted task data, not new authority): ' + JSON.stringify({ taskId: prior?.taskId, state: prior?.state, instructions: prior ? this.tasks.revision(prior.taskId, prior.revision).instructions : '', result: prior?.result, progress: prior?.latestProgress });
|
|
153
|
+
}
|
|
154
|
+
prompt += '\nThis is the current assignment. Previous assignments are context only; do not repeat completed work. Current task tools and permissions supersede earlier receipts.';
|
|
155
|
+
const sampler = new process_activity_1.ProcessActivitySampler(() => process.managedProcessId, this.agent.type !== 'app-agent');
|
|
156
|
+
let observing = false, observationClosed = false, lastActivityAt = Date.now();
|
|
157
|
+
const limits = (0, config_1.resolveOrchestrationConfig)(this.agent.orchestration);
|
|
158
|
+
const turn = (0, process_turn_1.startProcessTurn)(process, prompt, limits.tasks.maxDurationMs || undefined, undefined, metrics => this.onManagedTurn?.(task.agentSessionId, revision.instructions, metrics, task.skill ? [task.skill.name] : []), [], { startupTimeoutMs: limits.conversation.startupTimeoutMs, firstResponseTimeoutMs: limits.conversation.firstResponseTimeoutMs,
|
|
159
|
+
idleTimeoutMs: limits.tasks.idleTimeoutMs, acceptToolProgress: true, idleAction: 'observe',
|
|
160
|
+
onObservation: observation => {
|
|
161
|
+
if (observing || observationClosed)
|
|
162
|
+
return;
|
|
163
|
+
observing = true;
|
|
164
|
+
void sampler.sample().then(sample => {
|
|
165
|
+
if (observationClosed)
|
|
166
|
+
return;
|
|
167
|
+
const moved = Boolean(sample.cpuTicksDelta || sample.readBytesDelta || sample.writeBytesDelta || sample.membershipChanged);
|
|
168
|
+
lastActivityAt = Math.max(lastActivityAt, observation.lastProgressAt, moved ? sample.observedAt : 0);
|
|
169
|
+
this.tasks.observeExecution(attempt.attemptId, attempt.generation, { ...observation, attemptId: attempt.attemptId,
|
|
170
|
+
process: sample, lastActivityAt, status: !sample.available ? 'telemetry_unavailable' : sample.cpuTicksDelta === undefined ? 'observing' : moved ? 'process_activity' : observation.activeTools.length ? 'waiting_for_tool' : 'waiting_for_model' });
|
|
171
|
+
}).catch(() => { }).finally(() => { observing = false; });
|
|
172
|
+
} });
|
|
173
|
+
let stopping = false;
|
|
174
|
+
const result = turn.result.then(async (answer) => {
|
|
175
|
+
if (answer.interrupted || stopping) {
|
|
176
|
+
await process.stop();
|
|
177
|
+
return { type: process.managedGroupStopped ? 'stopped' : 'unknown' };
|
|
178
|
+
}
|
|
179
|
+
if (Buffer.byteLength(answer.text) > 262144)
|
|
180
|
+
throw new types_1.OrchestrationError('RESPONSE_TOO_LARGE');
|
|
181
|
+
const artifact = await this.workspaces.artifact(task.taskId);
|
|
182
|
+
await (0, promises_1.writeFile)((0, path_1.join)(directory, 'diff.patch'), artifact.diff, { mode: 0o600 });
|
|
183
|
+
await (0, promises_1.writeFile)((0, path_1.join)(directory, 'result.json'), JSON.stringify({ ...artifact, summary: answer.text }, null, 2), { mode: 0o600 });
|
|
184
|
+
await process.stop();
|
|
185
|
+
if (!process.managedGroupStopped)
|
|
186
|
+
return { type: 'unknown' };
|
|
187
|
+
const diff = boundedDiffText(artifact.diff);
|
|
188
|
+
const fileIds = this.tasks.store.all('SELECT id FROM task_files WHERE attempt_id=? ORDER BY created_at,id', attempt.attemptId).map(row => String(row.id));
|
|
189
|
+
return { type: 'completed', result: { summary: answer.text || 'Worker turn ended without a text summary.', artifactIds: [artifact.resourceId, ...fileIds],
|
|
190
|
+
diff: { text: diff, truncated: diff.length < artifact.diff.length } } };
|
|
191
|
+
}).catch(async (error) => {
|
|
192
|
+
await process.stop();
|
|
193
|
+
const failure = (0, failure_1.taskFailure)(error);
|
|
194
|
+
if (error?.timeout)
|
|
195
|
+
failure.message = `Worker timeout: phase=${error.timeout.phase}, elapsed=${Math.round(error.timeout.elapsedMs / 1000)}s, idle=${Math.round(error.timeout.idleMs / 1000)}s. Inspect existing changes before continuing.`;
|
|
196
|
+
return { type: process.managedGroupStopped ? 'failed' : 'unknown', failure };
|
|
197
|
+
}).finally(async () => { observationClosed = true; ticket.revoke(); await process.stop(); });
|
|
198
|
+
return { accepted: turn.accepted, result,
|
|
199
|
+
identity: () => process.managedProcessId ? { pid: process.managedProcessId, startedAt: process.spawnedAt, instanceId: this.instanceId, ...(0, process_supervisor_1.processFingerprint)(process.managedProcessId) } : undefined,
|
|
200
|
+
stop: async () => { stopping = true; await turn.stop(); } };
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
ticket.revoke();
|
|
204
|
+
throw error;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
exports.ClaudeWorkerDriver = ClaudeWorkerDriver;
|
|
209
|
+
//# sourceMappingURL=driver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"driver.js","sourceRoot":"","sources":["../../../src/orchestration/tasks/driver.ts"],"names":[],"mappings":";;;AAAA,oDAA0E;AAC1E,uDAA0D;AAC1D,qDAAiD;AACjD,oDAAyD;AACzD,wDAAoD;AACpD,8CAAkD;AAClD,0DAA6D;AAC7D,8DAAoF;AACpF,sCAAuD;AACvD,uCAAwC;AACxC,oCAAuC;AACvC,4CAAgE;AAChE,oDAAgD;AAChD,gDAAyD;AACzD,+BAAqC;AACrC,0CAA8E;AAE9E,+CAAmD;AACnD,mDAAuD;AAIvD,oCAAyE;AAEzE,kDAAmD;AACnD,mCAAoC;AACpC,0CAA8C;AAC9C,qDAA4E;AAC5E,2DAAuD;AAEvD,SAAS,eAAe,CAAC,IAAY;IACnC,IAAI,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACjC,OAAO,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK;QAAE,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;IAClH,OAAO,MAAM,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;AAChD,CAAC;AAED,MAAa,kBAAkB;IAE7B,YAA6B,KAAkB,EAAmB,OAAsB,EAAmB,KAAkB,EAC1G,MAAkB,EAAmB,UAA0B,EAAmB,WAAmB,EAAmB,aAAmI;QADjP,UAAK,GAAL,KAAK,CAAa;QAAmB,YAAO,GAAP,OAAO,CA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
|
|
|
1
|
+
import { TaskFailure } from '../types';
|
|
2
|
+
/** Retain bounded error evidence, never a raw process transcript or credentials. */
|
|
3
|
+
export declare function taskFailure(error: unknown, fallback?: string): TaskFailure;
|
|
4
|
+
export declare function shutdownFailure(): TaskFailure;
|
|
5
|
+
//# sourceMappingURL=failure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"failure.d.ts","sourceRoot":"","sources":["../../../src/orchestration/tasks/failure.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,oFAAoF;AACpF,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,SAAkB,GAAG,WAAW,CAMnF;AACD,wBAAgB,eAAe,IAAI,WAAW,CAE7C"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.taskFailure = taskFailure;
|
|
4
|
+
exports.shutdownFailure = shutdownFailure;
|
|
5
|
+
const incident_1 = require("../../agent/incident");
|
|
6
|
+
/** Retain bounded error evidence, never a raw process transcript or credentials. */
|
|
7
|
+
function taskFailure(error, fallback = 'WORKER_FAILED') {
|
|
8
|
+
const value = error;
|
|
9
|
+
const code = typeof value?.code === 'string' && /^[A-Z0-9_]{1,80}$/.test(value.code) ? value.code : fallback;
|
|
10
|
+
const message = typeof value?.message === 'string' ? value.message : 'Worker execution did not complete.';
|
|
11
|
+
const secrets = Object.entries(process.env).filter(([key, v]) => /TOKEN|SECRET|PASSWORD|API_KEY/i.test(key) && v && v.length >= 8).map(([, v]) => v);
|
|
12
|
+
return { code, message: (0, incident_1.scrubText)(message, secrets).slice(0, 2048), observedAt: Date.now() };
|
|
13
|
+
}
|
|
14
|
+
function shutdownFailure() {
|
|
15
|
+
return { code: 'GATEWAY_SHUTDOWN', message: 'Gateway shutdown interrupted this worker. This is not a finding about the issue. Inspect existing changes before continuing; do not blindly repeat side effects.', observedAt: Date.now() };
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=failure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"failure.js","sourceRoot":"","sources":["../../../src/orchestration/tasks/failure.ts"],"names":[],"mappings":";;AAGA,kCAMC;AACD,0CAEC;AAZD,mDAAiD;AAEjD,oFAAoF;AACpF,SAAgB,WAAW,CAAC,KAAc,EAAE,QAAQ,GAAG,eAAe;IACpE,MAAM,KAAK,GAAG,KAA4C,CAAC;IAC3D,MAAM,IAAI,GAAG,OAAO,KAAK,EAAE,IAAI,KAAK,QAAQ,IAAI,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC7G,MAAM,OAAO,GAAG,OAAO,KAAK,EAAE,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,oCAAoC,CAAC;IAC1G,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,gCAAgC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAE,CAAC,CAAC;IACpJ,OAAO,EAAC,IAAI,EAAE,OAAO,EAAE,IAAA,oBAAS,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,EAAC,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,EAAC,CAAC;AAC5F,CAAC;AACD,SAAgB,eAAe;IAC7B,OAAO,EAAC,IAAI,EAAC,kBAAkB,EAAC,OAAO,EAAC,kKAAkK,EAAC,UAAU,EAAC,IAAI,CAAC,GAAG,EAAE,EAAC,CAAC;AACpO,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OrchestrationStore } from '../store';
|
|
2
|
+
import { TaskSnapshot, TaskAttempt } from '../types';
|
|
3
|
+
/** Durable logical workers. CLI processes are resumed per task so credentials,
|
|
4
|
+
* hooks and cancellation remain attempt-scoped. Idle slots hold no process. */
|
|
5
|
+
export declare class WorkerPool {
|
|
6
|
+
private readonly store;
|
|
7
|
+
constructor(store: OrchestrationStore);
|
|
8
|
+
prune(ttl: number, now?: number): void;
|
|
9
|
+
acquire(task: TaskSnapshot, max: number, ttl: number): {
|
|
10
|
+
workerId: string;
|
|
11
|
+
sessionId: string;
|
|
12
|
+
resumeSession: boolean;
|
|
13
|
+
} | undefined;
|
|
14
|
+
/** A resumed CLI must never retain a prior configuration/identity or cwd. */
|
|
15
|
+
bind(attempt: TaskAttempt, fingerprint: string): void;
|
|
16
|
+
release(taskId: string, resumable: boolean): void;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=pool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../../../src/orchestration/tasks/pool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAe,MAAM,UAAU,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAErD;+EAC+E;AAC/E,qBAAa,UAAU;IACT,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,kBAAkB;IAMtD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,SAAa,GAAG,IAAI;IAG1C,OAAO,CAAC,IAAI,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS;IA2BlI,6EAA6E;IAC7E,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;IAYrD,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,IAAI;CAGlD"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WorkerPool = void 0;
|
|
4
|
+
const crypto_1 = require("crypto");
|
|
5
|
+
const store_1 = require("../store");
|
|
6
|
+
/** Durable logical workers. CLI processes are resumed per task so credentials,
|
|
7
|
+
* hooks and cancellation remain attempt-scoped. Idle slots hold no process. */
|
|
8
|
+
class WorkerPool {
|
|
9
|
+
constructor(store) {
|
|
10
|
+
this.store = store;
|
|
11
|
+
store.run(`CREATE TABLE IF NOT EXISTS worker_pool (
|
|
12
|
+
id TEXT PRIMARY KEY, conversation_id TEXT NOT NULL, workstream_id TEXT NOT NULL,
|
|
13
|
+
binding_key TEXT NOT NULL, session_id TEXT NOT NULL, active_task_id TEXT,
|
|
14
|
+
idle_since INTEGER NOT NULL, resumable INTEGER NOT NULL DEFAULT 0, fingerprint TEXT)`);
|
|
15
|
+
}
|
|
16
|
+
prune(ttl, now = Date.now()) {
|
|
17
|
+
this.store.run('DELETE FROM worker_pool WHERE active_task_id IS NULL AND idle_since <= ?', now - ttl);
|
|
18
|
+
}
|
|
19
|
+
acquire(task, max, ttl) {
|
|
20
|
+
this.prune(ttl);
|
|
21
|
+
const stream = task.workstreamId ?? task.taskId;
|
|
22
|
+
// Serialize the entire workstream, even if the preceding task is still
|
|
23
|
+
// queued or waiting for an answer and owns no process at this instant.
|
|
24
|
+
const blocked = this.store.all("SELECT snapshot_json FROM tasks WHERE conversation_id=? AND id != ? AND state NOT IN ('completed','failed','cancelled')", task.conversationId, task.taskId)
|
|
25
|
+
.some(row => {
|
|
26
|
+
const other = JSON.parse(String(row.snapshot_json));
|
|
27
|
+
return (other.workstreamId ?? other.taskId) === stream && (other.createdAt < task.createdAt || (other.createdAt === task.createdAt && other.taskId < task.taskId));
|
|
28
|
+
});
|
|
29
|
+
if (blocked)
|
|
30
|
+
return undefined;
|
|
31
|
+
const binding = (0, store_1.payloadHash)({ conversation: task.conversationId, principal: task.ownerPrincipalId,
|
|
32
|
+
profile: task.targetProfile, resource: task.resourceProfile, skill: task.skill, model: task.model,
|
|
33
|
+
capabilities: task.capabilities,
|
|
34
|
+
// Isolated worktrees/scratch directories have task-specific working dirs.
|
|
35
|
+
isolatedTask: ['host', 'container'].includes(task.resourceProfile?.mode ?? '') ? undefined : task.taskId });
|
|
36
|
+
const related = this.store.get('SELECT * FROM worker_pool WHERE conversation_id=? AND workstream_id=? ORDER BY idle_since DESC LIMIT 1', task.conversationId, stream);
|
|
37
|
+
if (related?.active_task_id)
|
|
38
|
+
return undefined;
|
|
39
|
+
let slot = related;
|
|
40
|
+
if (!slot)
|
|
41
|
+
slot = this.store.get('SELECT * FROM worker_pool WHERE active_task_id IS NULL ORDER BY idle_since DESC LIMIT 1');
|
|
42
|
+
if (!slot && Number(this.store.get('SELECT COUNT(*) n FROM worker_pool').n) >= max)
|
|
43
|
+
return undefined;
|
|
44
|
+
const reuse = Boolean(slot && slot.conversation_id === task.conversationId && slot.workstream_id === stream && slot.binding_key === binding && slot.resumable);
|
|
45
|
+
const workerId = slot ? String(slot.id) : (0, crypto_1.randomUUID)(), sessionId = reuse ? String(slot.session_id) : (0, crypto_1.randomUUID)();
|
|
46
|
+
this.store.run(`INSERT INTO worker_pool(id,conversation_id,workstream_id,binding_key,session_id,active_task_id,idle_since,resumable,fingerprint)
|
|
47
|
+
VALUES(?,?,?,?,?,?,?,0,NULL) ON CONFLICT(id) DO UPDATE SET conversation_id=excluded.conversation_id,
|
|
48
|
+
workstream_id=excluded.workstream_id,binding_key=excluded.binding_key,session_id=excluded.session_id,
|
|
49
|
+
active_task_id=excluded.active_task_id,resumable=?,fingerprint=?`, workerId, task.conversationId, stream, binding, sessionId, task.taskId, Date.now(), reuse ? 1 : 0, reuse ? slot.fingerprint : null);
|
|
50
|
+
return { workerId, sessionId, resumeSession: reuse };
|
|
51
|
+
}
|
|
52
|
+
/** A resumed CLI must never retain a prior configuration/identity or cwd. */
|
|
53
|
+
bind(attempt, fingerprint) {
|
|
54
|
+
if (!attempt.workerId)
|
|
55
|
+
return;
|
|
56
|
+
this.store.transaction(() => {
|
|
57
|
+
const slot = this.store.get('SELECT * FROM worker_pool WHERE id=? AND active_task_id=?', attempt.workerId, attempt.taskId);
|
|
58
|
+
if (!slot)
|
|
59
|
+
throw new Error('WORKER_LEASE_LOST');
|
|
60
|
+
if (attempt.resumeSession && slot.fingerprint !== fingerprint) {
|
|
61
|
+
attempt.sessionId = (0, crypto_1.randomUUID)();
|
|
62
|
+
attempt.resumeSession = false;
|
|
63
|
+
this.store.saveAttempt(attempt);
|
|
64
|
+
}
|
|
65
|
+
this.store.run('UPDATE worker_pool SET fingerprint=?,session_id=? WHERE id=?', fingerprint, attempt.sessionId, attempt.workerId);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
release(taskId, resumable) {
|
|
69
|
+
this.store.run('UPDATE worker_pool SET active_task_id=NULL,idle_since=?,resumable=? WHERE active_task_id=?', Date.now(), resumable ? 1 : 0, taskId);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.WorkerPool = WorkerPool;
|
|
73
|
+
//# sourceMappingURL=pool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pool.js","sourceRoot":"","sources":["../../../src/orchestration/tasks/pool.ts"],"names":[],"mappings":";;;AAAA,mCAAoC;AACpC,oCAA2D;AAG3D;+EAC+E;AAC/E,MAAa,UAAU;IACrB,YAA6B,KAAyB;QAAzB,UAAK,GAAL,KAAK,CAAoB;QACpD,KAAK,CAAC,G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AE,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IACtJ,CAAC;CACF;AArDD,gCAqDC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { TaskService } from './service';
|
|
2
|
+
import { TaskAttempt, TaskSnapshot, WorkerOutcome } from '../types';
|
|
3
|
+
export interface WorkerHandle {
|
|
4
|
+
identity?(): TaskAttempt['processIdentity'];
|
|
5
|
+
/** Resolves only after turn admission is observed, never just stdin.write. */
|
|
6
|
+
accepted: Promise<void>;
|
|
7
|
+
result: Promise<WorkerOutcome>;
|
|
8
|
+
stop(): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export interface WorkerDriver {
|
|
11
|
+
cleanup?(attempt: TaskAttempt): Promise<boolean>;
|
|
12
|
+
available?(taskId: string): boolean;
|
|
13
|
+
release?(taskId: string): Promise<void>;
|
|
14
|
+
reserve?(taskId: string): (() => void) | undefined;
|
|
15
|
+
start(task: TaskSnapshot, attempt: TaskAttempt, capacityReserved?: boolean): Promise<WorkerHandle>;
|
|
16
|
+
}
|
|
17
|
+
/** Workers run outside the scheduler's claim transaction and outside agent
|
|
18
|
+
* turns. All attempts count toward admission, including uncertain processes. */
|
|
19
|
+
export declare class WorkerScheduler {
|
|
20
|
+
private readonly tasks;
|
|
21
|
+
private readonly driver;
|
|
22
|
+
private readonly reportError;
|
|
23
|
+
/** Sessions whose workers were admitted in this runtime, including recovered queued work. */
|
|
24
|
+
readonly startedSessions: Set<string>;
|
|
25
|
+
private readonly active;
|
|
26
|
+
private readonly uncertainReservations;
|
|
27
|
+
private readonly starting;
|
|
28
|
+
private ticking;
|
|
29
|
+
private closed;
|
|
30
|
+
private readonly pending;
|
|
31
|
+
private timer?;
|
|
32
|
+
constructor(tasks: TaskService, driver: WorkerDriver, reportError?: (error: unknown) => void, recoveredReservations?: Map<string, () => void>);
|
|
33
|
+
start(): void;
|
|
34
|
+
tick(): Promise<void>;
|
|
35
|
+
private run;
|
|
36
|
+
close(): Promise<void>;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=scheduler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../../../src/orchestration/tasks/scheduler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEpE,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAC5C,8EAA8E;IAC9E,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAC/B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AACD,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,SAAS,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IACpC,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IACnD,KAAK,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,gBAAgB,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CACpG;AAED;gFACgF;AAChF,qBAAa,eAAe;IAUd,OAAO,CAAC,QAAQ,CAAC,KAAK;IAAe,OAAO,CAAC,QAAQ,CAAC,MAAM;IAAgB,OAAO,CAAC,QAAQ,CAAC,WAAW;IATpH,6FAA6F;IAC7F,QAAQ,CAAC,eAAe,cAAqB;IAC7C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmC;IAC1D,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAA0B;IAChE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;IAC9C,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4B;IACpD,OAAO,CAAC,KAAK,CAAC,CAAiC;gBAClB,KAAK,EAAE,WAAW,EAAmB,MAAM,EAAE,YAAY,EAAmB,WAAW,GAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAe,EAAE,qBAAqB,qBAAyB,IAAI,CAAG;IAGhN,KAAK,IAAI,IAAI;IAMP,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;YAqDb,GAAG;IA8BX,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAO7B"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WorkerScheduler = void 0;
|
|
4
|
+
const failure_1 = require("./failure");
|
|
5
|
+
/** Workers run outside the scheduler's claim transaction and outside agent
|
|
6
|
+
* turns. All attempts count toward admission, including uncertain processes. */
|
|
7
|
+
class WorkerScheduler {
|
|
8
|
+
constructor(tasks, driver, reportError = () => { }, recoveredReservations = new Map()) {
|
|
9
|
+
this.tasks = tasks;
|
|
10
|
+
this.driver = driver;
|
|
11
|
+
this.reportError = reportError;
|
|
12
|
+
/** Sessions whose workers were admitted in this runtime, including recovered queued work. */
|
|
13
|
+
this.startedSessions = new Set();
|
|
14
|
+
this.active = new Map();
|
|
15
|
+
this.starting = new Set();
|
|
16
|
+
this.ticking = false;
|
|
17
|
+
this.closed = false;
|
|
18
|
+
this.pending = new Set();
|
|
19
|
+
this.uncertainReservations = recoveredReservations;
|
|
20
|
+
}
|
|
21
|
+
start() {
|
|
22
|
+
if (this.timer)
|
|
23
|
+
return;
|
|
24
|
+
this.timer = setInterval(() => { void this.tick().catch(this.reportError); }, 100);
|
|
25
|
+
this.timer.unref();
|
|
26
|
+
void this.tick().catch(this.reportError);
|
|
27
|
+
}
|
|
28
|
+
async tick() {
|
|
29
|
+
if (this.closed || this.ticking)
|
|
30
|
+
return;
|
|
31
|
+
this.ticking = true;
|
|
32
|
+
try {
|
|
33
|
+
this.tasks.pruneWorkers();
|
|
34
|
+
for (const [taskId, handle] of this.active) {
|
|
35
|
+
const task = this.tasks.store.task(taskId);
|
|
36
|
+
if (task && ['cancel_requested', 'interrupting'].includes(task.state))
|
|
37
|
+
void handle.stop().catch(this.reportError);
|
|
38
|
+
}
|
|
39
|
+
for (const row of this.tasks.store.all("SELECT id FROM tasks WHERE state='cancel_requested'")) {
|
|
40
|
+
const taskId = String(row.id);
|
|
41
|
+
if (this.active.has(taskId) || this.starting.has(taskId))
|
|
42
|
+
continue;
|
|
43
|
+
const task = this.tasks.store.task(taskId);
|
|
44
|
+
const attempt = task.activeAttemptId ? this.tasks.store.attempt(task.activeAttemptId) : undefined;
|
|
45
|
+
if (!attempt)
|
|
46
|
+
continue;
|
|
47
|
+
let stopped = false;
|
|
48
|
+
try {
|
|
49
|
+
stopped = await this.driver.cleanup?.(attempt) ?? false;
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
this.reportError(error);
|
|
53
|
+
}
|
|
54
|
+
const current = this.tasks.store.task(taskId);
|
|
55
|
+
if (current?.state !== 'cancel_requested' || current.activeAttemptId !== attempt.attemptId)
|
|
56
|
+
continue;
|
|
57
|
+
this.tasks.finishCleanup(attempt.attemptId, attempt.generation, stopped);
|
|
58
|
+
if (stopped) {
|
|
59
|
+
this.uncertainReservations.get(taskId)?.();
|
|
60
|
+
this.uncertainReservations.delete(taskId);
|
|
61
|
+
await this.driver.release?.(taskId).catch(this.reportError);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (this.closed)
|
|
65
|
+
return;
|
|
66
|
+
const ceiling = Number(this.tasks.store.get('SELECT COALESCE(MAX(rowid),0) n FROM tasks').n);
|
|
67
|
+
let cursor;
|
|
68
|
+
admission: while (!this.closed) {
|
|
69
|
+
const rows = this.tasks.store.all(`SELECT id,created_at FROM tasks WHERE state='queued' AND rowid<=?
|
|
70
|
+
${cursor ? 'AND (created_at>? OR (created_at=? AND id>?))' : ''}
|
|
71
|
+
ORDER BY created_at,id LIMIT 100`, ceiling, ...(cursor ? [cursor.createdAt, cursor.createdAt, cursor.id] : []));
|
|
72
|
+
if (!rows.length)
|
|
73
|
+
break;
|
|
74
|
+
for (const row of rows) {
|
|
75
|
+
cursor = { createdAt: Number(row.created_at), id: String(row.id) };
|
|
76
|
+
const taskId = String(row.id);
|
|
77
|
+
if (this.starting.has(taskId) || this.active.has(taskId))
|
|
78
|
+
continue;
|
|
79
|
+
if (this.driver.available && !this.driver.available(taskId))
|
|
80
|
+
continue;
|
|
81
|
+
const release = this.driver.reserve?.(taskId);
|
|
82
|
+
if (this.driver.reserve && !release)
|
|
83
|
+
break admission;
|
|
84
|
+
const attempt = this.tasks.claim(taskId);
|
|
85
|
+
if (!attempt) {
|
|
86
|
+
release?.();
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
this.startedSessions.add(this.tasks.store.task(taskId).agentSessionId);
|
|
90
|
+
this.starting.add(taskId);
|
|
91
|
+
// Do not await startup here: one slow spawn cannot serialize every task
|
|
92
|
+
// or control operation behind it.
|
|
93
|
+
const run = this.run(taskId, attempt, release);
|
|
94
|
+
this.pending.add(run);
|
|
95
|
+
void run.finally(() => this.pending.delete(run)).catch(this.reportError);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
finally {
|
|
100
|
+
this.ticking = false;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
async run(taskId, attempt, release) {
|
|
104
|
+
let handle;
|
|
105
|
+
try {
|
|
106
|
+
handle = await this.driver.start(this.tasks.store.task(taskId), attempt, Boolean(release));
|
|
107
|
+
this.active.set(taskId, handle);
|
|
108
|
+
if (this.closed)
|
|
109
|
+
await handle.stop();
|
|
110
|
+
// Attach rejection handlers before waiting on either branch.
|
|
111
|
+
const outcome = handle.result.catch(error => ({ type: 'unknown', failure: (0, failure_1.taskFailure)(error) }));
|
|
112
|
+
try {
|
|
113
|
+
await handle.accepted;
|
|
114
|
+
const task = this.tasks.store.task(taskId);
|
|
115
|
+
if (task.state === 'starting')
|
|
116
|
+
this.tasks.started(attempt.attemptId, attempt.generation, handle.identity?.());
|
|
117
|
+
else
|
|
118
|
+
await handle.stop();
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
await handle.stop();
|
|
122
|
+
}
|
|
123
|
+
let result = await outcome;
|
|
124
|
+
if (this.closed && result.type !== 'completed' && !['cancel_requested', 'interrupting'].includes(this.tasks.store.task(taskId)?.state ?? ''))
|
|
125
|
+
result = { ...result, failure: (0, failure_1.shutdownFailure)() };
|
|
126
|
+
this.tasks.finish(attempt.attemptId, attempt.generation, result);
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
const task = this.tasks.store.task(taskId);
|
|
130
|
+
if (!handle && error.code === 'RESOURCE_BUSY' && task?.state === 'starting')
|
|
131
|
+
this.tasks.deferUnstarted(attempt.attemptId, attempt.generation);
|
|
132
|
+
else if (task?.activeAttemptId === attempt.attemptId && task.state !== 'needs_reconciliation')
|
|
133
|
+
this.tasks.finish(attempt.attemptId, attempt.generation, { type: handle ? 'unknown' : 'failed', failure: this.closed ? (0, failure_1.shutdownFailure)() : (0, failure_1.taskFailure)(error, 'WORKER_START_FAILED') });
|
|
134
|
+
this.reportError(error);
|
|
135
|
+
}
|
|
136
|
+
finally {
|
|
137
|
+
await this.driver.release?.(taskId).catch(this.reportError);
|
|
138
|
+
if (this.tasks.store.task(taskId)?.state !== 'needs_reconciliation')
|
|
139
|
+
release?.();
|
|
140
|
+
else if (release)
|
|
141
|
+
this.uncertainReservations.set(taskId, release);
|
|
142
|
+
this.active.delete(taskId);
|
|
143
|
+
this.starting.delete(taskId);
|
|
144
|
+
if (!this.closed)
|
|
145
|
+
void this.tick().catch(this.reportError);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
async close() {
|
|
149
|
+
this.closed = true;
|
|
150
|
+
if (this.timer)
|
|
151
|
+
clearInterval(this.timer);
|
|
152
|
+
// A persisted-process cleanup may be awaiting termination outside a run handle.
|
|
153
|
+
while (this.ticking)
|
|
154
|
+
await new Promise(resolve => setTimeout(resolve, 25));
|
|
155
|
+
await Promise.allSettled([...this.active.values()].map(handle => handle.stop()));
|
|
156
|
+
await Promise.allSettled([...this.pending]);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
exports.WorkerScheduler = WorkerScheduler;
|
|
160
|
+
//# sourceMappingURL=scheduler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduler.js","sourceRoot":"","sources":["../../../src/orchestration/tasks/scheduler.ts"],"names":[],"mappings":";;;AAAA,uCAAyD;AAmBzD;gFACgF;AAChF,MAAa,eAAe;IAU1B,YAA6B,KAAkB,EAAmB,MAAoB,EAAmB,cAAwC,GAAG,EAAE,GAAE,CAAC,EAAE,wBAAwB,IAAI,GAAG,EAAsB;QAAnL,UAAK,GAAL,KAAK,CAAa;QAAmB,WAAM,GAAN,MAAM,CAAc;QAAmB,gBAAW,GAAX,WAAW,CAAqC;QATzJ,6FAA6F;QACpF,oBAAe,GAAG,IAAI,GAAG,EAAU,CAAC;QAC5B,WAAM,GAAG,IAAI,GAAG,EAAwB,CAAC;QAEzC,aAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;QACtC,YAAO,GAAG,KAAK,CAAC;QAChB,WAAM,GAAG,KAAK,CAAC;QACN,YAAO,GAAG,IAAI,GAAG,EAAiB,CAAC;QAGlD,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;IACrD,CAAC;IACD,KAAK;QACH,IAAI,IA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