@0xmaxma/claude-gateway 1.8.14 → 2.0.1
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 -1613
- package/config.template.json +7 -1
- package/dist/agent/runner.d.ts +419 -0
- package/dist/agent/runner.d.ts.map +1 -1
- package/dist/agent/runner.js +736 -24
- 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 +162 -10
- 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/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 +2 -0
- package/dist/history/types.d.ts.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 +260 -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 +151 -0
- package/dist/orchestration/decisions.js.map +1 -0
- package/dist/orchestration/delivery.d.ts +34 -0
- package/dist/orchestration/delivery.d.ts.map +1 -0
- package/dist/orchestration/delivery.js +235 -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 +237 -0
- package/dist/orchestration/runtime.d.ts.map +1 -0
- package/dist/orchestration/runtime.js +1031 -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 +92 -0
- package/dist/orchestration/store.d.ts.map +1 -0
- package/dist/orchestration/store.js +326 -0
- package/dist/orchestration/store.js.map +1 -0
- package/dist/orchestration/task-controls.d.ts +172 -0
- package/dist/orchestration/task-controls.d.ts.map +1 -0
- package/dist/orchestration/task-controls.js +59 -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-questions.d.ts +26 -0
- package/dist/orchestration/task-questions.d.ts.map +1 -0
- package/dist/orchestration/task-questions.js +160 -0
- package/dist/orchestration/task-questions.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 +114 -0
- package/dist/orchestration/tasks/service.d.ts.map +1 -0
- package/dist/orchestration/tasks/service.js +760 -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 +143 -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 +14 -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 +13 -0
- package/dist/wechat/ilink-client.d.ts.map +1 -1
- package/dist/wechat/ilink-client.js +19 -0
- package/dist/wechat/ilink-client.js.map +1 -1
- 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 -37
- 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 +246 -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/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,326 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OrchestrationStore = void 0;
|
|
4
|
+
exports.payloadHash = payloadHash;
|
|
5
|
+
exports.boundedText = boundedText;
|
|
6
|
+
exports.channelVoiceKey = channelVoiceKey;
|
|
7
|
+
const timing_1 = require("./tasks/timing");
|
|
8
|
+
const voice_reply_policy_1 = require("./voice-reply-policy");
|
|
9
|
+
const node_sqlite_1 = require("node:sqlite");
|
|
10
|
+
const fs_1 = require("fs");
|
|
11
|
+
const path_1 = require("path");
|
|
12
|
+
const crypto_1 = require("crypto");
|
|
13
|
+
const schema_1 = require("./migrations/schema");
|
|
14
|
+
const types_1 = require("./types");
|
|
15
|
+
function canonical(value) {
|
|
16
|
+
if (Array.isArray(value))
|
|
17
|
+
return value.map(canonical);
|
|
18
|
+
if (value && typeof value === 'object')
|
|
19
|
+
return Object.fromEntries(Object.entries(value).filter(([, v]) => v !== undefined).sort(([a], [b]) => a.localeCompare(b)).map(([k, v]) => [k, canonical(v)]));
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
function payloadHash(value) {
|
|
23
|
+
return (0, crypto_1.createHash)('sha256').update(JSON.stringify(canonical(value))).digest('hex');
|
|
24
|
+
}
|
|
25
|
+
function boundedText(text, max = 65536) {
|
|
26
|
+
if (typeof text !== 'string' || !text.trim() || Buffer.byteLength(text) > max)
|
|
27
|
+
throw new types_1.OrchestrationError('INVALID_INPUT', 'Expected bounded nonempty text');
|
|
28
|
+
return text;
|
|
29
|
+
}
|
|
30
|
+
class OrchestrationStore {
|
|
31
|
+
constructor(filename, agentId) {
|
|
32
|
+
this.filename = filename;
|
|
33
|
+
this.agentId = agentId;
|
|
34
|
+
this.inTransaction = false;
|
|
35
|
+
this.composing = false;
|
|
36
|
+
this.savepointSequence = 0;
|
|
37
|
+
if (filename !== ':memory:')
|
|
38
|
+
(0, fs_1.mkdirSync)((0, path_1.dirname)(filename), { recursive: true, mode: 0o700 });
|
|
39
|
+
this.db = new node_sqlite_1.DatabaseSync(filename);
|
|
40
|
+
try {
|
|
41
|
+
if (filename !== ':memory:')
|
|
42
|
+
(0, fs_1.chmodSync)(filename, 0o600);
|
|
43
|
+
this.db.exec('PRAGMA foreign_keys=ON; PRAGMA busy_timeout=1000; PRAGMA journal_mode=WAL; PRAGMA synchronous=FULL;');
|
|
44
|
+
this.transaction(() => {
|
|
45
|
+
this.db.exec('CREATE TABLE IF NOT EXISTS orchestration_schema_migrations(version INTEGER PRIMARY KEY, applied_at INTEGER NOT NULL)');
|
|
46
|
+
const version = this.get('SELECT MAX(version) AS version FROM orchestration_schema_migrations')?.version ?? 0;
|
|
47
|
+
if (Number(version) > 1)
|
|
48
|
+
throw new types_1.OrchestrationError('UNSUPPORTED_SCHEMA');
|
|
49
|
+
if (!version) {
|
|
50
|
+
this.db.exec(schema_1.ORCHESTRATION_SCHEMA_V1);
|
|
51
|
+
this.run('INSERT INTO orchestration_schema_migrations VALUES(1,?)', Date.now());
|
|
52
|
+
}
|
|
53
|
+
this.db.exec(`CREATE TABLE IF NOT EXISTS task_questions(
|
|
54
|
+
question_id TEXT PRIMARY KEY, task_id TEXT NOT NULL REFERENCES tasks(id), revision INTEGER NOT NULL, state_version INTEGER NOT NULL,
|
|
55
|
+
binding_id TEXT NOT NULL REFERENCES conversation_bindings(id), next_reminder_at INTEGER NOT NULL,
|
|
56
|
+
reminder_count INTEGER NOT NULL DEFAULT 0, muted INTEGER NOT NULL DEFAULT 0, closed INTEGER NOT NULL DEFAULT 0);
|
|
57
|
+
CREATE INDEX IF NOT EXISTS task_questions_task ON task_questions(task_id,closed);
|
|
58
|
+
CREATE TABLE IF NOT EXISTS task_question_messages(
|
|
59
|
+
response_id TEXT PRIMARY KEY REFERENCES assistant_responses(id), question_id TEXT NOT NULL REFERENCES task_questions(question_id));
|
|
60
|
+
CREATE INDEX IF NOT EXISTS task_question_messages_question ON task_question_messages(question_id);
|
|
61
|
+
CREATE INDEX IF NOT EXISTS deliveries_provider_message ON deliveries(provider_message_id,binding_id);`);
|
|
62
|
+
this.db.exec('CREATE TABLE IF NOT EXISTS response_audio(response_id TEXT PRIMARY KEY REFERENCES assistant_responses(id),audio BLOB NOT NULL,created_at INTEGER NOT NULL)');
|
|
63
|
+
this.db.exec('CREATE TABLE IF NOT EXISTS telegram_tts_voices(chat_id TEXT PRIMARY KEY, provider TEXT NOT NULL, voice_id TEXT NOT NULL)');
|
|
64
|
+
this.db.exec('CREATE TABLE IF NOT EXISTS telegram_voice_preferences(chat_id TEXT PRIMARY KEY, enabled INTEGER NOT NULL CHECK(enabled IN (0,1)))');
|
|
65
|
+
this.db.exec("CREATE TABLE IF NOT EXISTS voice_reply_modes(chat_id TEXT PRIMARY KEY, mode TEXT NOT NULL CHECK(mode IN ('off','auto','on')))");
|
|
66
|
+
});
|
|
67
|
+
const foreign = this.get('SELECT id FROM conversations WHERE agent_id != ? LIMIT 1', agentId);
|
|
68
|
+
if (foreign)
|
|
69
|
+
throw new types_1.OrchestrationError('AGENT_STORE_MISMATCH');
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
this.db.close();
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
saveResponseAudio(responseId, audio) {
|
|
77
|
+
if (!audio.length || audio.length > 16 * 1024 * 1024)
|
|
78
|
+
return;
|
|
79
|
+
this.transaction(() => {
|
|
80
|
+
this.run('DELETE FROM response_audio WHERE created_at<?', Date.now() - 30 * 86400000);
|
|
81
|
+
this.run('INSERT OR IGNORE INTO response_audio VALUES(?,?,?)', responseId, audio, Date.now());
|
|
82
|
+
while (Number(this.get('SELECT COALESCE(SUM(length(audio)),0) AS n FROM response_audio').n) > 64 * 1024 * 1024)
|
|
83
|
+
this.run('DELETE FROM response_audio WHERE response_id=(SELECT response_id FROM response_audio ORDER BY created_at,response_id LIMIT 1)');
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
responseAudio(sessionId, responseId) {
|
|
87
|
+
const sql = ' FROM response_audio a JOIN assistant_responses r ON r.id=a.response_id JOIN conversations c ON c.id=r.conversation_id WHERE c.agent_session_id=? AND a.created_at>?';
|
|
88
|
+
const cutoff = Date.now() - 30 * 86400000;
|
|
89
|
+
if (!responseId)
|
|
90
|
+
return this.all('SELECT a.response_id' + sql, sessionId, cutoff).map(r => String(r.response_id));
|
|
91
|
+
const row = this.db.prepare('SELECT a.audio' + sql + ' AND a.response_id=?').get(sessionId, cutoff, responseId);
|
|
92
|
+
return row ? Buffer.from(row.audio) : undefined;
|
|
93
|
+
}
|
|
94
|
+
channelVoice(channel, chatId, thread = '') { return this.telegramVoice(channelVoiceKey(channel, chatId, thread)); }
|
|
95
|
+
setChannelVoice(channel, chatId, thread, enabled) { this.setTelegramVoice(channelVoiceKey(channel, chatId, thread), enabled); }
|
|
96
|
+
channelVoiceMode(channel, chatId, thread = '') { return this.telegramVoiceMode(channelVoiceKey(channel, chatId, thread)); }
|
|
97
|
+
setChannelVoiceMode(channel, chatId, thread, mode) { this.setTelegramVoiceMode(channelVoiceKey(channel, chatId, thread), mode); }
|
|
98
|
+
telegramVoiceMode(chatId) {
|
|
99
|
+
return this.get('SELECT mode FROM voice_reply_modes WHERE chat_id=?', chatId)?.mode
|
|
100
|
+
?? (this.get('SELECT enabled FROM telegram_voice_preferences WHERE chat_id=?', chatId)?.enabled === 1 ? 'on' : 'off');
|
|
101
|
+
}
|
|
102
|
+
telegramVoice(chatId) { return this.telegramVoiceMode(chatId) !== 'off'; }
|
|
103
|
+
setTelegramVoice(chatId, enabled) { this.setTelegramVoiceMode(chatId, enabled ? 'on' : 'off'); }
|
|
104
|
+
setTelegramVoiceMode(chatId, mode) {
|
|
105
|
+
if (!voice_reply_policy_1.VOICE_REPLY_MODES.includes(mode))
|
|
106
|
+
throw new types_1.OrchestrationError('INVALID_VOICE_MODE');
|
|
107
|
+
const write = () => {
|
|
108
|
+
this.run('INSERT INTO voice_reply_modes VALUES(?,?) ON CONFLICT(chat_id) DO UPDATE SET mode=excluded.mode', chatId, mode);
|
|
109
|
+
// Older binaries degrade auto to off, never to always-on audio.
|
|
110
|
+
this.run('INSERT INTO telegram_voice_preferences VALUES(?,?) ON CONFLICT(chat_id) DO UPDATE SET enabled=excluded.enabled', chatId, mode === 'on' ? 1 : 0);
|
|
111
|
+
};
|
|
112
|
+
if (this.inTransaction)
|
|
113
|
+
write();
|
|
114
|
+
else
|
|
115
|
+
this.transaction(write);
|
|
116
|
+
}
|
|
117
|
+
close() { this.db.close(); }
|
|
118
|
+
get(sql, ...values) { return this.db.prepare(sql).get(...values); }
|
|
119
|
+
all(sql, ...values) { return this.db.prepare(sql).all(...values); }
|
|
120
|
+
run(sql, ...values) { return this.db.prepare(sql).run(...values); }
|
|
121
|
+
/** Synchronous only: network, process startup and canonical history writes stay outside. */
|
|
122
|
+
transaction(operation) {
|
|
123
|
+
if (this.inTransaction) {
|
|
124
|
+
if (!this.composing)
|
|
125
|
+
throw new types_1.OrchestrationError('NESTED_TRANSACTION');
|
|
126
|
+
const name = `composed_${++this.savepointSequence}`;
|
|
127
|
+
this.db.exec(`SAVEPOINT ${name}`);
|
|
128
|
+
try {
|
|
129
|
+
const result = operation();
|
|
130
|
+
if (result && typeof result.then === 'function')
|
|
131
|
+
throw new types_1.OrchestrationError('ASYNC_TRANSACTION');
|
|
132
|
+
this.db.exec(`RELEASE SAVEPOINT ${name}`);
|
|
133
|
+
return result;
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
this.db.exec(`ROLLBACK TO SAVEPOINT ${name}; RELEASE SAVEPOINT ${name}`);
|
|
137
|
+
throw error;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
this.db.exec('BEGIN IMMEDIATE');
|
|
141
|
+
this.inTransaction = true;
|
|
142
|
+
try {
|
|
143
|
+
const result = operation();
|
|
144
|
+
if (result && typeof result.then === 'function')
|
|
145
|
+
throw new types_1.OrchestrationError('ASYNC_TRANSACTION');
|
|
146
|
+
this.db.exec('COMMIT');
|
|
147
|
+
return result;
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
this.db.exec('ROLLBACK');
|
|
151
|
+
throw error;
|
|
152
|
+
}
|
|
153
|
+
finally {
|
|
154
|
+
this.inTransaction = false;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/** Explicit atomic composition of existing synchronous commands. Each nested
|
|
158
|
+
* command rolls back to its own savepoint even if the caller handles its error. */
|
|
159
|
+
compose(operation) {
|
|
160
|
+
const previous = this.composing;
|
|
161
|
+
this.composing = true;
|
|
162
|
+
try {
|
|
163
|
+
return this.transaction(operation);
|
|
164
|
+
}
|
|
165
|
+
finally {
|
|
166
|
+
this.composing = previous;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
assertMember(conversationId, principalId) {
|
|
170
|
+
const row = this.get(`SELECT c.* FROM conversations c JOIN conversation_members m ON c.id=m.conversation_id
|
|
171
|
+
WHERE c.id=? AND c.agent_id=? AND m.principal_id=?`, conversationId, this.agentId, principalId);
|
|
172
|
+
if (!row)
|
|
173
|
+
throw new types_1.OrchestrationError('ACCESS_DENIED');
|
|
174
|
+
return row;
|
|
175
|
+
}
|
|
176
|
+
acceptInput(input, maxPending = 100) {
|
|
177
|
+
const { scope } = input;
|
|
178
|
+
if (scope.agentId !== this.agentId)
|
|
179
|
+
throw new types_1.OrchestrationError('ACCESS_DENIED');
|
|
180
|
+
if (Buffer.byteLength(JSON.stringify(input)) > 262144)
|
|
181
|
+
throw new types_1.OrchestrationError('PAYLOAD_TOO_LARGE');
|
|
182
|
+
if (input.acceptedInputId) {
|
|
183
|
+
const row = this.get('SELECT * FROM conversation_inputs WHERE id=?', input.acceptedInputId);
|
|
184
|
+
if (!row || row.principal_id !== scope.principalId)
|
|
185
|
+
throw new types_1.OrchestrationError('ACCESS_DENIED');
|
|
186
|
+
const agentSession = this.assertMember(String(row.conversation_id), scope.principalId);
|
|
187
|
+
if (agentSession.agent_session_id !== scope.agentSessionId)
|
|
188
|
+
throw new types_1.OrchestrationError('ACCESS_DENIED');
|
|
189
|
+
return { inputId: String(row.id), conversationId: String(row.conversation_id), bindingId: String(row.binding_id) };
|
|
190
|
+
}
|
|
191
|
+
for (const key of ['agentId', 'agentSessionId', 'principalId', 'chatId'])
|
|
192
|
+
boundedText(scope[key], 1024);
|
|
193
|
+
boundedText(input.text);
|
|
194
|
+
if (input.attachmentIds && (input.attachmentIds.length > 64 || input.attachmentIds.some(id => typeof id !== 'string' || id.length > 1024)))
|
|
195
|
+
throw new types_1.OrchestrationError('INVALID_INPUT');
|
|
196
|
+
if (!Number.isSafeInteger(maxPending) || maxPending <= 0)
|
|
197
|
+
throw new types_1.OrchestrationError('INVALID_CONFIG');
|
|
198
|
+
// Agent session intentionally excluded: a provider retry after a session
|
|
199
|
+
// switch must retain the original agent binding. Ingress authorizes route.
|
|
200
|
+
const hash = payloadHash({ text: input.text, attachments: input.attachmentIds ?? [], modality: input.modality ?? 'text',
|
|
201
|
+
principal: scope.principalId, source: scope.source, account: scope.accountId, chat: scope.chatId, thread: scope.threadKey,
|
|
202
|
+
storeUserMessage: input.storeUserMessage !== false, metadata: input.metadata, model: input.model });
|
|
203
|
+
const ingressKey = input.ingressKey ? payloadHash([this.agentId, scope.source, scope.accountId, scope.chatId, scope.threadKey, scope.principalId, boundedText(input.ingressKey, 2048)]) : undefined;
|
|
204
|
+
return this.transaction(() => {
|
|
205
|
+
if (ingressKey) {
|
|
206
|
+
const prior = this.get(`SELECT r.*,i.binding_id FROM ingress_receipts r JOIN conversation_inputs i ON i.id=r.input_id WHERE ingress_key=?`, ingressKey);
|
|
207
|
+
if (prior) {
|
|
208
|
+
if (prior.payload_hash !== hash)
|
|
209
|
+
throw new types_1.OrchestrationError('IDEMPOTENCY_CONFLICT');
|
|
210
|
+
this.assertMember(String(prior.conversation_id), scope.principalId);
|
|
211
|
+
return { inputId: String(prior.input_id), conversationId: String(prior.conversation_id), bindingId: String(prior.binding_id) };
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
let conversation = this.get(`SELECT * FROM conversations WHERE agent_id=? AND agent_session_id=? AND source=? AND account_id=? AND chat_id=? AND thread_key=?`, this.agentId, scope.agentSessionId, scope.source, scope.accountId, scope.chatId, scope.threadKey);
|
|
215
|
+
const canonicalSessions = this.all('SELECT * FROM conversations WHERE agent_id=? AND agent_session_id=?', this.agentId, scope.agentSessionId);
|
|
216
|
+
for (const canonicalSession of canonicalSessions) {
|
|
217
|
+
if (input.trustedChannelMember && scope.source !== 'api' && canonicalSession.source === scope.source && canonicalSession.account_id === scope.accountId && canonicalSession.chat_id === scope.chatId) {
|
|
218
|
+
this.run('INSERT INTO conversation_members VALUES(?,?,?) ON CONFLICT DO NOTHING', canonicalSession.id, scope.principalId, 'member');
|
|
219
|
+
}
|
|
220
|
+
this.assertMember(String(canonicalSession.id), scope.principalId);
|
|
221
|
+
}
|
|
222
|
+
const now = Date.now();
|
|
223
|
+
if (!conversation) {
|
|
224
|
+
const id = (0, crypto_1.randomUUID)();
|
|
225
|
+
this.run(`INSERT INTO conversations(id,agent_id,agent_session_id,source,account_id,chat_id,thread_key,owner_principal_id,stream_id,created_at,updated_at) VALUES(?,?,?,?,?,?,?,?,?,?,?)`, id, this.agentId, scope.agentSessionId, scope.source, scope.accountId, scope.chatId, scope.threadKey, scope.principalId, (0, crypto_1.randomUUID)(), now, now);
|
|
226
|
+
this.run('INSERT INTO conversation_members VALUES(?,?,?)', id, scope.principalId, 'owner');
|
|
227
|
+
this.run(`INSERT INTO conversation_bindings VALUES(?,?,?,?,?,?,?,?)`, (0, crypto_1.randomUUID)(), id, scope.source, scope.accountId, scope.chatId, scope.threadKey, 'next_user_turn', '{}');
|
|
228
|
+
conversation = this.get('SELECT * FROM conversations WHERE id=?', id);
|
|
229
|
+
}
|
|
230
|
+
const id = String(conversation.id);
|
|
231
|
+
this.assertMember(id, scope.principalId);
|
|
232
|
+
// Snapshot the conversation's last selected model for voice and task reports.
|
|
233
|
+
// Do this after authorization, inside the same admission transaction. The
|
|
234
|
+
// retry hash above still describes the submitted payload, not later defaults.
|
|
235
|
+
const previousModel = input.model ? undefined : this.get(`SELECT json_extract(ingress_json,'$.model') AS model
|
|
236
|
+
FROM conversation_inputs WHERE conversation_id=? AND json_type(ingress_json,'$.model')='text'
|
|
237
|
+
AND json_extract(ingress_json,'$.model')<>'' ORDER BY input_seq DESC LIMIT 1`, id)?.model;
|
|
238
|
+
const admittedInput = previousModel ? { ...input, model: String(previousModel) } : input;
|
|
239
|
+
const pending = Number(this.get("SELECT COUNT(*) AS n FROM conversation_inputs WHERE conversation_id=? AND status IN ('accepted','assigned')", id).n);
|
|
240
|
+
if (pending >= maxPending)
|
|
241
|
+
throw new types_1.OrchestrationError('QUEUE_FULL');
|
|
242
|
+
const bindingId = String(this.get('SELECT id FROM conversation_bindings WHERE conversation_id=?', id).id);
|
|
243
|
+
const inputId = (0, crypto_1.randomUUID)(), seq = Number(conversation.last_input_seq) + 1;
|
|
244
|
+
this.run('UPDATE conversations SET last_input_seq=?,updated_at=? WHERE id=?', seq, now, id);
|
|
245
|
+
this.run(`INSERT INTO conversation_inputs(id,conversation_id,input_seq,principal_id,binding_id,modality,text,attachment_refs_json,request_id,store_user_message,created_at) VALUES(?,?,?,?,?,?,?,?,?,?,?)`, inputId, id, seq, scope.principalId, bindingId, input.modality ?? 'text', input.text, JSON.stringify(input.attachmentIds ?? []), input.requestId ?? null, input.storeUserMessage === false ? 0 : 1, now);
|
|
246
|
+
this.run('UPDATE conversation_inputs SET ingress_json=? WHERE id=?', JSON.stringify(admittedInput), inputId);
|
|
247
|
+
if (ingressKey)
|
|
248
|
+
this.run('INSERT INTO ingress_receipts VALUES(?,?,?,?,?)', ingressKey, hash, inputId, id, now);
|
|
249
|
+
this.appendEvent(id, 'input.accepted', { inputId });
|
|
250
|
+
this.enqueue('input', `input:${inputId}`, { conversationId: id, inputId });
|
|
251
|
+
// Live voice arrives as finalized text. Uploaded voice notes still need STT
|
|
252
|
+
// before their canonical history operation can be written.
|
|
253
|
+
if (input.modality === 'live_voice') {
|
|
254
|
+
this.run('INSERT INTO history_operations VALUES(?,?,?,?,?,?,?,?)', `input:${inputId}`, id, inputId, null, 'append', null, 'pending', now);
|
|
255
|
+
this.enqueue('history', `input:${inputId}`, { operationId: `input:${inputId}` });
|
|
256
|
+
}
|
|
257
|
+
return { inputId, conversationId: id, bindingId };
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
appendEvent(conversationId, type, payload, taskId) {
|
|
261
|
+
if (!this.inTransaction)
|
|
262
|
+
throw new types_1.OrchestrationError('TRANSACTION_REQUIRED');
|
|
263
|
+
const serialized = JSON.stringify(payload);
|
|
264
|
+
if (Buffer.byteLength(serialized) > 65536)
|
|
265
|
+
throw new types_1.OrchestrationError('PAYLOAD_TOO_LARGE');
|
|
266
|
+
const row = this.get('UPDATE conversations SET last_event_seq=last_event_seq+1 WHERE id=? RETURNING stream_id,last_event_seq', conversationId);
|
|
267
|
+
if (!row)
|
|
268
|
+
throw new types_1.OrchestrationError('CONVERSATION_NOT_FOUND');
|
|
269
|
+
const event = { schema_version: 1, event_id: (0, crypto_1.randomUUID)(), conversation_id: conversationId,
|
|
270
|
+
stream_id: String(row.stream_id), seq: Number(row.last_event_seq), type, occurred_at: Date.now(), ...(taskId ? { task_id: taskId } : {}), payload };
|
|
271
|
+
this.run('INSERT INTO conversation_events VALUES(?,?,?,?,?,?)', conversationId, event.seq, event.event_id, type, JSON.stringify(event), event.occurred_at);
|
|
272
|
+
return event;
|
|
273
|
+
}
|
|
274
|
+
enqueue(kind, dedupKey, payload) {
|
|
275
|
+
if (!this.inTransaction)
|
|
276
|
+
throw new types_1.OrchestrationError('TRANSACTION_REQUIRED');
|
|
277
|
+
const now = Date.now();
|
|
278
|
+
this.run('INSERT INTO outbox(id,kind,dedup_key,payload_json,available_at,created_at) VALUES(?,?,?,?,?,?) ON CONFLICT(dedup_key) DO NOTHING', (0, crypto_1.randomUUID)(), kind, dedupKey, JSON.stringify(payload), now, now);
|
|
279
|
+
}
|
|
280
|
+
task(id) {
|
|
281
|
+
const row = this.get('SELECT snapshot_json FROM tasks WHERE id=?', id);
|
|
282
|
+
return row ? JSON.parse(String(row.snapshot_json)) : undefined;
|
|
283
|
+
}
|
|
284
|
+
attempt(id) {
|
|
285
|
+
const row = this.get('SELECT payload_json FROM task_attempts WHERE id=?', id);
|
|
286
|
+
return row ? JSON.parse(String(row.payload_json)) : undefined;
|
|
287
|
+
}
|
|
288
|
+
cancelQuestionDeliveries(questionId) {
|
|
289
|
+
if (!this.inTransaction)
|
|
290
|
+
throw new types_1.OrchestrationError('TRANSACTION_REQUIRED');
|
|
291
|
+
this.run(`UPDATE outbox SET state='completed' WHERE kind='delivery' AND state='pending'
|
|
292
|
+
AND json_extract(payload_json,'$.deliveryId') IN (SELECT d.id FROM deliveries d JOIN task_question_messages m ON m.response_id=d.response_id WHERE m.question_id=?)`, questionId);
|
|
293
|
+
this.run(`UPDATE deliveries SET state='failed' WHERE state='pending' AND response_id IN
|
|
294
|
+
(SELECT response_id FROM task_question_messages WHERE question_id=?)`, questionId);
|
|
295
|
+
}
|
|
296
|
+
saveTask(task, expectedVersion) {
|
|
297
|
+
if (!this.inTransaction)
|
|
298
|
+
throw new types_1.OrchestrationError('TRANSACTION_REQUIRED');
|
|
299
|
+
(0, timing_1.advanceTiming)(task);
|
|
300
|
+
task.stateVersion = expectedVersion + 1;
|
|
301
|
+
task.updatedAt = Date.now();
|
|
302
|
+
const changed = this.run(`UPDATE tasks SET state=?,state_version=?,revision=?,active_attempt_id=?,snapshot_json=?,updated_at=? WHERE id=? AND state_version=?`, task.state, task.stateVersion, task.revision, task.activeAttemptId ?? null, JSON.stringify(task), task.updatedAt, task.taskId, expectedVersion);
|
|
303
|
+
if (Number(changed.changes) !== 1)
|
|
304
|
+
throw new types_1.OrchestrationError('STATE_CONFLICT');
|
|
305
|
+
for (const question of this.all(`UPDATE task_questions SET closed=1 WHERE task_id=? AND closed=0
|
|
306
|
+
AND question_id!=? RETURNING question_id,state_version`, task.taskId, task.state === 'waiting_input' ? task.pendingQuestion?.questionId ?? '' : '')) {
|
|
307
|
+
this.cancelQuestionDeliveries(String(question.question_id));
|
|
308
|
+
this.run("UPDATE notifications SET status='handled' WHERE task_id=? AND task_state_version<=? AND status='pending'", task.taskId, question.state_version);
|
|
309
|
+
}
|
|
310
|
+
// State events are notifications, not the result store. Large results remain
|
|
311
|
+
// complete in the snapshot/attempt and are retrieved through task_status.
|
|
312
|
+
const eventTask = task.result && Buffer.byteLength(JSON.stringify(task)) > 65536
|
|
313
|
+
? { ...task, result: undefined, resultAvailable: true, resultRef: { tool: 'task_status', task_id: task.taskId } }
|
|
314
|
+
: task;
|
|
315
|
+
this.appendEvent(task.conversationId, 'task.state_changed', eventTask, task.taskId);
|
|
316
|
+
}
|
|
317
|
+
saveAttempt(attempt) {
|
|
318
|
+
if (!this.inTransaction)
|
|
319
|
+
throw new types_1.OrchestrationError('TRANSACTION_REQUIRED');
|
|
320
|
+
this.run('UPDATE task_attempts SET state=?,payload_json=? WHERE id=? AND generation=?', attempt.state, JSON.stringify(attempt), attempt.attemptId, attempt.generation);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
exports.OrchestrationStore = OrchestrationStore;
|
|
324
|
+
/** Preserve existing Telegram preferences while namespacing all other channels. */
|
|
325
|
+
function channelVoiceKey(channel, chatId, thread = '') { return channel === 'telegram' ? chatId : JSON.stringify([channel, chatId]); }
|
|
326
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/orchestration/store.ts"],"names":[],"mappings":";;;AAsCA,kCAEC;AACD,kCAGC;AAqPD,0CAA8J;AAjS9J,2CAA+C;AAC/C,6DAAyE;AACzE,6CAA0D;AAC1D,2BAA0C;AAC1C,+BAA+B;AAC/B,mCAAgD;AAChD,gDAA8D;AAC9D,mCAA8H;AA0B9H,SAAS,SAAS,CAAC,KAAc;IAC/B,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACtD,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtM,OAAO,KAA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,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE;YACjH,CAAC,CAAC,IAAI,CAAC;QACT,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,cAAc,EAAE,oBAAoB,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACtF,CAAC;IACD,WAAW,CAAC,OAAoB;QAC9B,IAAI,CAAC,IAAI,CAAC,aAAa;YAAE,MAAM,IAAI,0BAAkB,CAAC,sBAAsB,CAAC,CAAC;QAC9E,IAAI,CAAC,GAAG,CAAC,6EAA6E,EAAE,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IACzK,CAAC;CACF;AAhPD,gDAgPC;AAED,mFAAmF;AACnF,SAAgB,eAAe,CAAC,OAAe,EAAE,MAAc,EAAE,MAAM,GAAG,EAAE,IAAY,OAAO,OAAO,KAAG,UAAU,CAAA,CAAC,CAAA,MAAM,CAAA,CAAC,CAAA,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { OrchestrationStore } from './store';
|
|
2
|
+
import { TaskService } from './tasks/service';
|
|
3
|
+
/** Read-only browsing never interrupts the Agent or creates an inference turn. */
|
|
4
|
+
export declare class TaskControls {
|
|
5
|
+
private store;
|
|
6
|
+
private tasks;
|
|
7
|
+
constructor(store: OrchestrationStore, tasks: TaskService);
|
|
8
|
+
private view;
|
|
9
|
+
list(sessionId: string, principalId: string, page?: number, pageSize?: number, includeFinished?: boolean): {
|
|
10
|
+
page: number;
|
|
11
|
+
pages: number;
|
|
12
|
+
total: number;
|
|
13
|
+
tasks: {
|
|
14
|
+
timing: Partial<Record<import("./tasks/timing").TimingPhase, number>> | undefined;
|
|
15
|
+
timingMeasuredFrom: number | undefined;
|
|
16
|
+
supervision: {
|
|
17
|
+
id: string;
|
|
18
|
+
reason: "stale_progress" | "repeated_tools";
|
|
19
|
+
observedAt: number;
|
|
20
|
+
message: string;
|
|
21
|
+
deliveredAt?: number;
|
|
22
|
+
} | undefined;
|
|
23
|
+
progressText: string;
|
|
24
|
+
activityDetails: {
|
|
25
|
+
observationStatus: string;
|
|
26
|
+
process: import("./process-activity").ProcessSample;
|
|
27
|
+
lastTool: import("./execution-observation").ToolOutcome | undefined;
|
|
28
|
+
quiet: boolean;
|
|
29
|
+
status: string;
|
|
30
|
+
counters: string;
|
|
31
|
+
age: number;
|
|
32
|
+
activeTools: string[];
|
|
33
|
+
} | undefined;
|
|
34
|
+
startedAt: number | undefined;
|
|
35
|
+
finishedAt: number | undefined;
|
|
36
|
+
taskId: string;
|
|
37
|
+
title: string;
|
|
38
|
+
state: import("./types").TaskState;
|
|
39
|
+
replacedByTaskId: string | undefined;
|
|
40
|
+
cancellation: {
|
|
41
|
+
requestedBy: "user" | "agent";
|
|
42
|
+
requestedAt: number;
|
|
43
|
+
} | undefined;
|
|
44
|
+
failure: import("./types").TaskFailure | undefined;
|
|
45
|
+
execution: import("./execution-observation").ExecutionObservation | undefined;
|
|
46
|
+
progress: string | undefined;
|
|
47
|
+
question: string | undefined;
|
|
48
|
+
questionId: string | undefined;
|
|
49
|
+
updatedAt: number;
|
|
50
|
+
canStop: boolean;
|
|
51
|
+
}[];
|
|
52
|
+
};
|
|
53
|
+
private owned;
|
|
54
|
+
detail(sessionId: string, principalId: string, taskId: string): {
|
|
55
|
+
timing: Partial<Record<import("./tasks/timing").TimingPhase, number>> | undefined;
|
|
56
|
+
timingMeasuredFrom: number | undefined;
|
|
57
|
+
supervision: {
|
|
58
|
+
id: string;
|
|
59
|
+
reason: "stale_progress" | "repeated_tools";
|
|
60
|
+
observedAt: number;
|
|
61
|
+
message: string;
|
|
62
|
+
deliveredAt?: number;
|
|
63
|
+
} | undefined;
|
|
64
|
+
progressText: string;
|
|
65
|
+
activityDetails: {
|
|
66
|
+
observationStatus: string;
|
|
67
|
+
process: import("./process-activity").ProcessSample;
|
|
68
|
+
lastTool: import("./execution-observation").ToolOutcome | undefined;
|
|
69
|
+
quiet: boolean;
|
|
70
|
+
status: string;
|
|
71
|
+
counters: string;
|
|
72
|
+
age: number;
|
|
73
|
+
activeTools: string[];
|
|
74
|
+
} | undefined;
|
|
75
|
+
startedAt: number | undefined;
|
|
76
|
+
finishedAt: number | undefined;
|
|
77
|
+
taskId: string;
|
|
78
|
+
title: string;
|
|
79
|
+
state: import("./types").TaskState;
|
|
80
|
+
replacedByTaskId: string | undefined;
|
|
81
|
+
cancellation: {
|
|
82
|
+
requestedBy: "user" | "agent";
|
|
83
|
+
requestedAt: number;
|
|
84
|
+
} | undefined;
|
|
85
|
+
failure: import("./types").TaskFailure | undefined;
|
|
86
|
+
execution: import("./execution-observation").ExecutionObservation | undefined;
|
|
87
|
+
progress: string | undefined;
|
|
88
|
+
question: string | undefined;
|
|
89
|
+
questionId: string | undefined;
|
|
90
|
+
updatedAt: number;
|
|
91
|
+
canStop: boolean;
|
|
92
|
+
};
|
|
93
|
+
answer(sessionId: string, principalId: string, taskId: string, questionId: string, answer: string, acceptedInputId?: string): {
|
|
94
|
+
timing: Partial<Record<import("./tasks/timing").TimingPhase, number>> | undefined;
|
|
95
|
+
timingMeasuredFrom: number | undefined;
|
|
96
|
+
supervision: {
|
|
97
|
+
id: string;
|
|
98
|
+
reason: "stale_progress" | "repeated_tools";
|
|
99
|
+
observedAt: number;
|
|
100
|
+
message: string;
|
|
101
|
+
deliveredAt?: number;
|
|
102
|
+
} | undefined;
|
|
103
|
+
progressText: string;
|
|
104
|
+
activityDetails: {
|
|
105
|
+
observationStatus: string;
|
|
106
|
+
process: import("./process-activity").ProcessSample;
|
|
107
|
+
lastTool: import("./execution-observation").ToolOutcome | undefined;
|
|
108
|
+
quiet: boolean;
|
|
109
|
+
status: string;
|
|
110
|
+
counters: string;
|
|
111
|
+
age: number;
|
|
112
|
+
activeTools: string[];
|
|
113
|
+
} | undefined;
|
|
114
|
+
startedAt: number | undefined;
|
|
115
|
+
finishedAt: number | undefined;
|
|
116
|
+
taskId: string;
|
|
117
|
+
title: string;
|
|
118
|
+
state: import("./types").TaskState;
|
|
119
|
+
replacedByTaskId: string | undefined;
|
|
120
|
+
cancellation: {
|
|
121
|
+
requestedBy: "user" | "agent";
|
|
122
|
+
requestedAt: number;
|
|
123
|
+
} | undefined;
|
|
124
|
+
failure: import("./types").TaskFailure | undefined;
|
|
125
|
+
execution: import("./execution-observation").ExecutionObservation | undefined;
|
|
126
|
+
progress: string | undefined;
|
|
127
|
+
question: string | undefined;
|
|
128
|
+
questionId: string | undefined;
|
|
129
|
+
updatedAt: number;
|
|
130
|
+
canStop: boolean;
|
|
131
|
+
};
|
|
132
|
+
cancel(sessionId: string, principalId: string, taskId: string): {
|
|
133
|
+
timing: Partial<Record<import("./tasks/timing").TimingPhase, number>> | undefined;
|
|
134
|
+
timingMeasuredFrom: number | undefined;
|
|
135
|
+
supervision: {
|
|
136
|
+
id: string;
|
|
137
|
+
reason: "stale_progress" | "repeated_tools";
|
|
138
|
+
observedAt: number;
|
|
139
|
+
message: string;
|
|
140
|
+
deliveredAt?: number;
|
|
141
|
+
} | undefined;
|
|
142
|
+
progressText: string;
|
|
143
|
+
activityDetails: {
|
|
144
|
+
observationStatus: string;
|
|
145
|
+
process: import("./process-activity").ProcessSample;
|
|
146
|
+
lastTool: import("./execution-observation").ToolOutcome | undefined;
|
|
147
|
+
quiet: boolean;
|
|
148
|
+
status: string;
|
|
149
|
+
counters: string;
|
|
150
|
+
age: number;
|
|
151
|
+
activeTools: string[];
|
|
152
|
+
} | undefined;
|
|
153
|
+
startedAt: number | undefined;
|
|
154
|
+
finishedAt: number | undefined;
|
|
155
|
+
taskId: string;
|
|
156
|
+
title: string;
|
|
157
|
+
state: import("./types").TaskState;
|
|
158
|
+
replacedByTaskId: string | undefined;
|
|
159
|
+
cancellation: {
|
|
160
|
+
requestedBy: "user" | "agent";
|
|
161
|
+
requestedAt: number;
|
|
162
|
+
} | undefined;
|
|
163
|
+
failure: import("./types").TaskFailure | undefined;
|
|
164
|
+
execution: import("./execution-observation").ExecutionObservation | undefined;
|
|
165
|
+
progress: string | undefined;
|
|
166
|
+
question: string | undefined;
|
|
167
|
+
questionId: string | undefined;
|
|
168
|
+
updatedAt: number;
|
|
169
|
+
canStop: boolean;
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=task-controls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-controls.d.ts","sourceRoot":"","sources":["../../src/orchestration/task-controls.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9C,kFAAkF;AAClF,qBAAa,YAAY;IACX,OAAO,CAAC,KAAK;IAAsB,OAAO,CAAC,KAAK;gBAAxC,KAAK,EAAE,kBAAkB,EAAU,KAAK,EAAE,WAAW;IACzE,OAAO,CAAC,IAAI;IAgBZ,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,SAAI,EAAE,QAAQ,SAAK,EAAE,eAAe,UAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAU7F,OAAO,CAAC,KAAK;IAMb,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAC7D,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAI3H,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAI9D"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TaskControls = void 0;
|
|
4
|
+
const timing_1 = require("./tasks/timing");
|
|
5
|
+
const execution_observation_1 = require("./execution-observation");
|
|
6
|
+
const types_1 = require("./types");
|
|
7
|
+
/** Read-only browsing never interrupts the Agent or creates an inference turn. */
|
|
8
|
+
class TaskControls {
|
|
9
|
+
constructor(store, tasks) {
|
|
10
|
+
this.store = store;
|
|
11
|
+
this.tasks = tasks;
|
|
12
|
+
}
|
|
13
|
+
view(task) {
|
|
14
|
+
const activity = this.store.get("SELECT occurred_at FROM conversation_events WHERE conversation_id=? AND type='tool.activity' AND json_extract(payload_json,'$.task_id')=? ORDER BY seq DESC LIMIT 1", task.conversationId, task.taskId);
|
|
15
|
+
const timing = this.store.get(`SELECT
|
|
16
|
+
MIN(CASE WHEN json_extract(payload_json,'$.payload.state') IN ('starting','running') THEN occurred_at END) AS started_at,
|
|
17
|
+
MIN(CASE WHEN json_extract(payload_json,'$.payload.state') IN ('completed','failed','cancelled') THEN occurred_at END) AS finished_at
|
|
18
|
+
FROM conversation_events WHERE conversation_id=? AND type='task.state_changed' AND json_extract(payload_json,'$.task_id')=?`, task.conversationId, task.taskId);
|
|
19
|
+
const startedAt = timing?.started_at == null ? undefined : Number(timing.started_at);
|
|
20
|
+
const finishedAt = ['completed', 'failed', 'cancelled'].includes(task.state) ? Number(timing?.finished_at ?? task.updatedAt) : undefined;
|
|
21
|
+
const latestProgress = task.latestProgress?.source === 'runtime' && task.latestProgress.text.startsWith('Queued after task ') && task.state !== 'queued' ? undefined : task.latestProgress;
|
|
22
|
+
const progressText = [task.failure ? `${task.failure.code}: ${task.failure.message}` : latestProgress?.text.slice(0, 1500), task.replacedByTaskId ? `Replaced by task ${task.replacedByTaskId}` : undefined].filter(Boolean).join('\n');
|
|
23
|
+
const activityDetails = task.execution && ['running', 'starting'].includes(task.state) ? (0, execution_observation_1.executionDetails)(task.execution) : undefined;
|
|
24
|
+
return { timing: (0, timing_1.timingTotals)(task), timingMeasuredFrom: task.timing?.measuredFrom, supervision: task.supervision, progressText, activityDetails, startedAt, finishedAt, taskId: task.taskId, title: task.title.slice(0, 200), state: task.state, replacedByTaskId: task.replacedByTaskId,
|
|
25
|
+
cancellation: task.cancellation, failure: task.failure, execution: task.execution, progress: [task.failure ? `${task.failure.code}: ${task.failure.message}` : latestProgress?.text.slice(0, 1500), task.execution && ['running', 'starting'].includes(task.state) ? (0, execution_observation_1.executionDescription)(task.execution) : undefined, task.replacedByTaskId ? `Replaced by task ${task.replacedByTaskId}` : undefined].filter(Boolean).join('\n') || undefined, question: task.pendingQuestion?.text.slice(0, 1000), questionId: task.pendingQuestion?.questionId,
|
|
26
|
+
updatedAt: Math.max(task.updatedAt, Number(activity?.occurred_at ?? 0), task.execution?.lastActivityAt ?? 0), canStop: ['queued', 'starting', 'running', 'waiting_input', 'interrupting', 'recovering', 'needs_reconciliation'].includes(task.state) };
|
|
27
|
+
}
|
|
28
|
+
list(sessionId, principalId, page = 0, pageSize = 10, includeFinished = false) {
|
|
29
|
+
if (!Number.isSafeInteger(page) || page < 0 || !Number.isSafeInteger(pageSize) || pageSize < 1 || pageSize > 100)
|
|
30
|
+
throw new types_1.OrchestrationError('INVALID_TASK_PAGE');
|
|
31
|
+
for (const row of this.store.all('SELECT id FROM conversations WHERE agent_session_id=?', sessionId))
|
|
32
|
+
this.store.assertMember(String(row.id), principalId);
|
|
33
|
+
const scope = "FROM tasks t JOIN conversations c ON c.id=t.conversation_id WHERE c.agent_session_id=?" + (includeFinished ? "" : " AND t.state NOT IN ('completed','failed','cancelled')");
|
|
34
|
+
const total = Number(this.store.get(`SELECT COUNT(*) AS total ${scope}`, sessionId).total);
|
|
35
|
+
const pages = Math.max(1, Math.ceil(total / pageSize));
|
|
36
|
+
page = Math.min(page, pages - 1);
|
|
37
|
+
const tasks = this.store.all(`SELECT t.snapshot_json ${scope} ORDER BY t.created_at,t.id LIMIT ? OFFSET ?`, sessionId, pageSize, page * pageSize)
|
|
38
|
+
.map(row => this.view(JSON.parse(String(row.snapshot_json))));
|
|
39
|
+
return { page, pages, total, tasks };
|
|
40
|
+
}
|
|
41
|
+
owned(sessionId, principalId, taskId) {
|
|
42
|
+
const task = this.store.task(taskId);
|
|
43
|
+
if (!task || task.agentSessionId !== sessionId)
|
|
44
|
+
throw new types_1.OrchestrationError('ACCESS_DENIED');
|
|
45
|
+
this.store.assertMember(task.conversationId, principalId);
|
|
46
|
+
return task;
|
|
47
|
+
}
|
|
48
|
+
detail(sessionId, principalId, taskId) { return this.view(this.owned(sessionId, principalId, taskId)); }
|
|
49
|
+
answer(sessionId, principalId, taskId, questionId, answer, acceptedInputId) {
|
|
50
|
+
const task = this.owned(sessionId, principalId, taskId);
|
|
51
|
+
return this.view(this.tasks.answerByUser(task.conversationId, principalId, taskId, questionId, answer, acceptedInputId));
|
|
52
|
+
}
|
|
53
|
+
cancel(sessionId, principalId, taskId) {
|
|
54
|
+
const task = this.owned(sessionId, principalId, taskId);
|
|
55
|
+
return this.view(this.tasks.cancelByUser(task.conversationId, principalId, taskId));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.TaskControls = TaskControls;
|
|
59
|
+
//# sourceMappingURL=task-controls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-controls.js","sourceRoot":"","sources":["../../src/orchestration/task-controls.ts"],"names":[],"mappings":";;;AAAA,2CAA8C;AAC9C,mEAAiF;AAGjF,mCAA2D;AAE3D,kFAAkF;AAClF,MAAa,YAAY;IACvB,YAAoB,KAAyB,EAAU,KAAkB;QAArD,UAAK,GAAL,KAAK,C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AI,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAC,WAAW,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9H,MAAM,CAAC,SAAiB,EAAE,WAAmB,EAAE,MAAc,EAAE,UAAkB,EAAE,MAAc,EAAE,eAAwB;QACzH,MAAM,IAAI,GAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAC,WAAW,EAAC,MAAM,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,cAAc,EAAC,WAAW,EAAC,MAAM,EAAC,UAAU,EAAC,MAAM,EAAC,eAAe,CAAC,CAAC,CAAC;IACtH,CAAC;IACD,MAAM,CAAC,SAAiB,EAAE,WAAmB,EAAE,MAAc;QAC3D,MAAM,IAAI,GAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAC,WAAW,EAAC,MAAM,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,cAAc,EAAC,WAAW,EAAC,MAAM,CAAC,CAAC,CAAC;IACpF,CAAC;CACF;AA3CD,oCA2CC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { OrchestrationStore } from './store';
|
|
2
|
+
export declare class TaskFiles {
|
|
3
|
+
readonly store: OrchestrationStore;
|
|
4
|
+
readonly agentsRoot: string;
|
|
5
|
+
private readonly containerSpool?;
|
|
6
|
+
private readonly workspace;
|
|
7
|
+
constructor(store: OrchestrationStore, agentsRoot: string, containerSpool?: string | undefined, workspace?: string);
|
|
8
|
+
private readonly capturedImages;
|
|
9
|
+
private readonly pendingImageTools;
|
|
10
|
+
/** Capture actual MCP image bytes, never model-authored paths or assistant text. */
|
|
11
|
+
captureOutput(attemptId: string, generation: number, line: string): void;
|
|
12
|
+
releaseCaptured(attemptId: string): void;
|
|
13
|
+
scope(attemptId: string, generation: number): {
|
|
14
|
+
task: import("./types").TaskSnapshot;
|
|
15
|
+
conversation: import("./store").Row;
|
|
16
|
+
mediaDir: string;
|
|
17
|
+
};
|
|
18
|
+
allowedPath(attemptId: string, generation: number, candidate: unknown): string;
|
|
19
|
+
stage(attemptId: string, generation: number, actionId: string, args: Record<string, unknown>): {
|
|
20
|
+
artifactId: string;
|
|
21
|
+
path: string;
|
|
22
|
+
staged: boolean;
|
|
23
|
+
};
|
|
24
|
+
remember(attemptId: string, generation: number, actionId: string, args: Record<string, unknown>): {
|
|
25
|
+
updated: boolean;
|
|
26
|
+
path: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=task-files.d.ts.map
|