@vercel/factory 0.0.14 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +356 -0
- package/README.md +96 -2
- package/dist/agent-routes.d.mts +113 -0
- package/dist/agent-routes.mjs +91 -0
- package/dist/agent-routes.mjs.map +1 -0
- package/dist/api-contracts.d.mts +1768 -0
- package/dist/api-contracts.mjs +119 -0
- package/dist/api-contracts.mjs.map +1 -0
- package/dist/api-images.d.mts +30 -0
- package/dist/api-images.mjs +28 -0
- package/dist/api-images.mjs.map +1 -0
- package/dist/api-task-graph.mjs +57 -0
- package/dist/api-task-graph.mjs.map +1 -0
- package/dist/api.d.mts +111 -216
- package/dist/api.mjs +1063 -99
- package/dist/api.mjs.map +1 -1
- package/dist/approval-access.d.mts +39 -0
- package/dist/approval-access.mjs +62 -0
- package/dist/approval-access.mjs.map +1 -0
- package/dist/approval-contracts.d.mts +698 -0
- package/dist/approval-contracts.mjs +27 -0
- package/dist/approval-contracts.mjs.map +1 -0
- package/dist/approval.d.mts +49 -0
- package/dist/approval.mjs +39 -0
- package/dist/approval.mjs.map +1 -0
- package/dist/blob/artifacts.d.mts +37 -0
- package/dist/blob/artifacts.mjs +45 -0
- package/dist/blob/artifacts.mjs.map +1 -0
- package/dist/blob/index.d.mts +84 -12
- package/dist/blob/index.mjs +179 -45
- package/dist/blob/index.mjs.map +1 -1
- package/dist/budget.d.mts +115 -0
- package/dist/budget.mjs +147 -0
- package/dist/budget.mjs.map +1 -0
- package/dist/budgets.d.mts +4 -0
- package/dist/budgets.mjs +4 -0
- package/dist/build-factory.d.mts +7 -4
- package/dist/build-factory.mjs +2 -1
- package/dist/build-factory.mjs.map +1 -1
- package/dist/change-verification/brief.d.mts +9 -0
- package/dist/change-verification/brief.mjs +13 -0
- package/dist/change-verification/brief.mjs.map +1 -0
- package/dist/change-verification/dispatch.d.mts +37 -0
- package/dist/change-verification/dispatch.mjs +83 -0
- package/dist/change-verification/dispatch.mjs.map +1 -0
- package/dist/change-verification/eve-tool.d.mts +61 -0
- package/dist/change-verification/eve-tool.mjs +89 -0
- package/dist/change-verification/eve-tool.mjs.map +1 -0
- package/dist/change-verification/result.mjs +130 -0
- package/dist/change-verification/result.mjs.map +1 -0
- package/dist/changes/eve-record-change.d.mts +56 -0
- package/dist/changes/eve-record-change.mjs +131 -0
- package/dist/changes/eve-record-change.mjs.map +1 -0
- package/dist/changes/presentation.d.mts +14 -0
- package/dist/changes.d.mts +24 -0
- package/dist/changes.mjs +29 -0
- package/dist/changes.mjs.map +1 -0
- package/dist/client-events.d.mts +25 -0
- package/dist/client-events.mjs +45 -0
- package/dist/client-events.mjs.map +1 -0
- package/dist/client-stream.d.mts +28 -0
- package/dist/client-stream.mjs +210 -0
- package/dist/client-stream.mjs.map +1 -0
- package/dist/client-transcript.d.mts +41 -0
- package/dist/client-transcript.mjs +233 -0
- package/dist/client-transcript.mjs.map +1 -0
- package/dist/client.d.mts +343 -0
- package/dist/client.mjs +366 -0
- package/dist/client.mjs.map +1 -0
- package/dist/code-review/contracts.d.mts +27 -0
- package/dist/code-review/eve-post-review.d.mts +70 -0
- package/dist/code-review/eve-post-review.mjs +195 -0
- package/dist/code-review/eve-post-review.mjs.map +1 -0
- package/dist/code-review/eve-review-comments.d.mts +75 -0
- package/dist/code-review/eve-review-comments.mjs +193 -0
- package/dist/code-review/eve-review-comments.mjs.map +1 -0
- package/dist/code-review/github-contracts.d.mts +10 -0
- package/dist/code-review/github-reporter.d.mts +46 -0
- package/dist/code-review/github-reporter.mjs +262 -0
- package/dist/code-review/github-reporter.mjs.map +1 -0
- package/dist/code-review/preparation.d.mts +34 -0
- package/dist/code-review/preparation.mjs +23 -0
- package/dist/code-review/preparation.mjs.map +1 -0
- package/dist/code-review/stall.d.mts +17 -0
- package/dist/code-review/stall.mjs +30 -0
- package/dist/code-review/stall.mjs.map +1 -0
- package/dist/code-review.d.mts +7 -0
- package/dist/code-review.mjs +5 -0
- package/dist/communication.d.mts +9 -0
- package/dist/communication.mjs +9 -0
- package/dist/connectors/github.d.mts +26 -0
- package/dist/connectors/github.mjs +55 -0
- package/dist/connectors/github.mjs.map +1 -0
- package/dist/connectors/index.d.mts +35 -3
- package/dist/connectors/index.mjs +3 -52
- package/dist/connectors/index.mjs.map +1 -1
- package/dist/connectors/outbox.d.mts +34 -0
- package/dist/connectors/outbox.mjs +50 -0
- package/dist/connectors/outbox.mjs.map +1 -0
- package/dist/connectors/slack-approval-blocks.mjs +136 -0
- package/dist/connectors/slack-approval-blocks.mjs.map +1 -0
- package/dist/connectors/slack-approvals.d.mts +29 -0
- package/dist/connectors/slack-approvals.mjs +346 -0
- package/dist/connectors/slack-approvals.mjs.map +1 -0
- package/dist/connectors/slack.d.mts +35 -52
- package/dist/connectors/slack.mjs +13 -85
- package/dist/connectors/slack.mjs.map +1 -1
- package/dist/deepsec/eve-tool.d.mts +110 -0
- package/dist/deepsec/eve-tool.mjs +166 -0
- package/dist/deepsec/eve-tool.mjs.map +1 -0
- package/dist/deepsec/finding.d.mts +84 -0
- package/dist/deepsec/finding.mjs +56 -0
- package/dist/deepsec/finding.mjs.map +1 -0
- package/dist/deepsec.d.mts +3 -0
- package/dist/delivery-metrics/metrics.d.mts +93 -0
- package/dist/delivery-metrics/metrics.mjs +200 -0
- package/dist/delivery-metrics/metrics.mjs.map +1 -0
- package/dist/delivery-metrics.d.mts +2 -0
- package/dist/delivery-metrics.mjs +2 -0
- package/dist/dispatch.d.mts +152 -0
- package/dist/dispatch.mjs +199 -0
- package/dist/dispatch.mjs.map +1 -0
- package/dist/errors.d.mts +15 -0
- package/dist/errors.mjs +38 -0
- package/dist/errors.mjs.map +1 -0
- package/dist/eve/index.d.mts +209 -1277
- package/dist/eve/index.mjs +312 -1073
- package/dist/eve/index.mjs.map +1 -1
- package/dist/eve/invoke.d.mts +144 -0
- package/dist/eve/invoke.mjs +254 -0
- package/dist/eve/invoke.mjs.map +1 -0
- package/dist/eve/session-client.d.mts +186 -0
- package/dist/eve/session-client.mjs +245 -0
- package/dist/eve/session-client.mjs.map +1 -0
- package/dist/eve/task-execution.d.mts +380 -0
- package/dist/eve/task-execution.mjs +73 -0
- package/dist/eve/task-execution.mjs.map +1 -0
- package/dist/eve/task-session.d.mts +129 -0
- package/dist/eve/task-session.mjs +245 -0
- package/dist/eve/task-session.mjs.map +1 -0
- package/dist/eve/transcript.d.mts +37 -0
- package/dist/eve/transcript.mjs +69 -0
- package/dist/eve/transcript.mjs.map +1 -0
- package/dist/execution-public.d.mts +8 -0
- package/dist/execution-public.mjs +7 -0
- package/dist/execution.d.mts +183 -0
- package/dist/execution.mjs +223 -0
- package/dist/execution.mjs.map +1 -0
- package/dist/finding-remediation/admission.d.mts +53 -0
- package/dist/finding-remediation/admission.mjs +90 -0
- package/dist/finding-remediation/admission.mjs.map +1 -0
- package/dist/finding-remediation/brief.d.mts +14 -0
- package/dist/finding-remediation/brief.mjs +25 -0
- package/dist/finding-remediation/brief.mjs.map +1 -0
- package/dist/finding-remediation/eve-tool.d.mts +29 -0
- package/dist/finding-remediation/eve-tool.mjs +34 -0
- package/dist/finding-remediation/eve-tool.mjs.map +1 -0
- package/dist/findings/fingerprint.d.mts +14 -0
- package/dist/findings/fingerprint.mjs +28 -0
- package/dist/findings/fingerprint.mjs.map +1 -0
- package/dist/findings.d.mts +7 -0
- package/dist/findings.mjs +6 -0
- package/dist/github-app.d.mts +54 -0
- package/dist/github-app.mjs +121 -0
- package/dist/github-app.mjs.map +1 -0
- package/dist/github-publication.d.mts +199 -0
- package/dist/github-publication.mjs +442 -0
- package/dist/github-publication.mjs.map +1 -0
- package/dist/github-transfer.d.mts +81 -0
- package/dist/github-transfer.mjs +273 -0
- package/dist/github-transfer.mjs.map +1 -0
- package/dist/github.d.mts +446 -2
- package/dist/github.mjs +357 -56
- package/dist/github.mjs.map +1 -1
- package/dist/image-input.d.mts +51 -0
- package/dist/image-input.mjs +63 -0
- package/dist/image-input.mjs.map +1 -0
- package/dist/inbox-activity.d.mts +53 -0
- package/dist/inbox-activity.mjs +41 -0
- package/dist/inbox-activity.mjs.map +1 -0
- package/dist/index.d.mts +16 -484
- package/dist/index.mjs +15 -522
- package/dist/intake-contracts.d.mts +55 -0
- package/dist/intake-contracts.mjs +33 -0
- package/dist/intake-contracts.mjs.map +1 -0
- package/dist/integrations/deepsec.d.mts +5 -0
- package/dist/integrations/deepsec.mjs +3 -0
- package/dist/integrations/github.d.mts +11 -0
- package/dist/integrations/github.mjs +9 -0
- package/dist/integrations/slack.d.mts +5 -0
- package/dist/integrations/slack.mjs +5 -0
- package/dist/integrations/vercel.d.mts +5 -0
- package/dist/integrations/vercel.mjs +4 -0
- package/dist/merge-resolution/contracts.d.mts +17 -0
- package/dist/merge-resolution/contracts.mjs +19 -0
- package/dist/merge-resolution/contracts.mjs.map +1 -0
- package/dist/merge-resolution/eve-tools.d.mts +47 -0
- package/dist/merge-resolution/eve-tools.mjs +122 -0
- package/dist/merge-resolution/eve-tools.mjs.map +1 -0
- package/dist/model-settings.d.mts +41 -0
- package/dist/model-settings.mjs +35 -0
- package/dist/model-settings.mjs.map +1 -0
- package/dist/multi-repository-changes/coordination.d.mts +49 -0
- package/dist/multi-repository-changes/coordination.mjs +115 -0
- package/dist/multi-repository-changes/coordination.mjs.map +1 -0
- package/dist/planning/cancellation.mjs +82 -0
- package/dist/planning/cancellation.mjs.map +1 -0
- package/dist/planning/configuration.d.mts +23 -0
- package/dist/planning/configuration.mjs +56 -0
- package/dist/planning/configuration.mjs.map +1 -0
- package/dist/planning/contracts.d.mts +136 -0
- package/dist/planning/contracts.mjs +42 -0
- package/dist/planning/contracts.mjs.map +1 -0
- package/dist/planning/dependencies.mjs +44 -0
- package/dist/planning/dependencies.mjs.map +1 -0
- package/dist/planning/effects.mjs +122 -0
- package/dist/planning/effects.mjs.map +1 -0
- package/dist/planning/reconcile.mjs +279 -0
- package/dist/planning/reconcile.mjs.map +1 -0
- package/dist/planning/runtime.d.mts +27 -0
- package/dist/planning/runtime.mjs +25 -0
- package/dist/planning/runtime.mjs.map +1 -0
- package/dist/planning/state.mjs +92 -0
- package/dist/planning/state.mjs.map +1 -0
- package/dist/planning/turns.mjs +262 -0
- package/dist/planning/turns.mjs.map +1 -0
- package/dist/planning/validation.mjs +106 -0
- package/dist/planning/validation.mjs.map +1 -0
- package/dist/postgres/index.d.mts +48 -1
- package/dist/postgres/index.mjs +45 -3
- package/dist/postgres/index.mjs.map +1 -1
- package/dist/presets/software-development/approval.d.mts +14 -0
- package/dist/presets/software-development/approval.mjs +21 -0
- package/dist/presets/software-development/approval.mjs.map +1 -0
- package/dist/presets/software-development/deepsec-brief.d.mts +8 -0
- package/dist/presets/software-development/deepsec-brief.mjs +14 -0
- package/dist/presets/software-development/deepsec-brief.mjs.map +1 -0
- package/dist/presets/software-development/dispatch.d.mts +56 -0
- package/dist/presets/software-development/dispatch.mjs +67 -0
- package/dist/presets/software-development/dispatch.mjs.map +1 -0
- package/dist/presets/software-development/eve-delegation-policy.d.mts +7 -0
- package/dist/presets/software-development/eve-delegation-policy.mjs +34 -0
- package/dist/presets/software-development/eve-delegation-policy.mjs.map +1 -0
- package/dist/presets/software-development/eve.d.mts +18 -0
- package/dist/presets/software-development/eve.mjs +19 -0
- package/dist/presets/software-development/eve.mjs.map +1 -0
- package/dist/presets/software-development/finish-task-policy.d.mts +7 -0
- package/dist/presets/software-development/finish-task-policy.mjs +9 -0
- package/dist/presets/software-development/finish-task-policy.mjs.map +1 -0
- package/dist/presets/software-development/recovery.d.mts +32 -0
- package/dist/presets/software-development/recovery.mjs +120 -0
- package/dist/presets/software-development/recovery.mjs.map +1 -0
- package/dist/presets/software-development/task-communication.d.mts +24 -0
- package/dist/presets/software-development/task-communication.mjs +157 -0
- package/dist/presets/software-development/task-communication.mjs.map +1 -0
- package/dist/presets/software-development.d.mts +10 -0
- package/dist/presets/software-development.mjs +9 -0
- package/dist/pull-requests/contracts.d.mts +72 -0
- package/dist/pull-requests/eve-fetch.d.mts +57 -0
- package/dist/pull-requests/eve-fetch.mjs +151 -0
- package/dist/pull-requests/eve-fetch.mjs.map +1 -0
- package/dist/pull-requests/github-label-manager.d.mts +27 -0
- package/dist/pull-requests/github-label-manager.mjs +40 -0
- package/dist/pull-requests/github-label-manager.mjs.map +1 -0
- package/dist/pull-requests/github-publisher.d.mts +67 -0
- package/dist/pull-requests/github-publisher.mjs +405 -0
- package/dist/pull-requests/github-publisher.mjs.map +1 -0
- package/dist/pull-requests.d.mts +6 -0
- package/dist/pull-requests.mjs +4 -0
- package/dist/receipts.d.mts +4 -0
- package/dist/receipts.mjs +3 -0
- package/dist/repositories.d.mts +18 -0
- package/dist/repositories.mjs +33 -0
- package/dist/repositories.mjs.map +1 -0
- package/dist/sandbox/command.d.mts +18 -0
- package/dist/sandbox/execution-abort.d.mts +16 -0
- package/dist/sandbox/execution-abort.mjs +49 -0
- package/dist/sandbox/execution-abort.mjs.map +1 -0
- package/dist/sandbox/execution-environment.d.mts +25 -0
- package/dist/sandbox/execution-run-ledger.d.mts +115 -0
- package/dist/sandbox/execution-run-ledger.mjs +209 -0
- package/dist/sandbox/execution-run-ledger.mjs.map +1 -0
- package/dist/sandbox/execution.d.mts +54 -0
- package/dist/sandbox/execution.mjs +228 -0
- package/dist/sandbox/execution.mjs.map +1 -0
- package/dist/sandbox/harness-runner.d.mts +79 -0
- package/dist/sandbox/harness-runner.mjs +162 -0
- package/dist/sandbox/harness-runner.mjs.map +1 -0
- package/dist/sandbox/index.d.mts +10 -0
- package/dist/sandbox/index.mjs +7 -0
- package/dist/sandbox/task-environment.d.mts +50 -0
- package/dist/sandbox/task-environment.mjs +140 -0
- package/dist/sandbox/task-environment.mjs.map +1 -0
- package/dist/sandbox/workspace.d.mts +29 -0
- package/dist/sandbox/workspace.mjs +28 -0
- package/dist/sandbox/workspace.mjs.map +1 -0
- package/dist/schema/agent-route.d.mts +40 -0
- package/dist/schema/agent-route.mjs +33 -0
- package/dist/schema/agent-route.mjs.map +1 -0
- package/dist/schema/answer.d.mts +23 -0
- package/dist/schema/answer.mjs +21 -0
- package/dist/schema/answer.mjs.map +1 -0
- package/dist/schema/budget.d.mts +38 -0
- package/dist/schema/budget.mjs +30 -0
- package/dist/schema/budget.mjs.map +1 -0
- package/dist/schema/catalog.mjs +72 -0
- package/dist/schema/catalog.mjs.map +1 -0
- package/dist/schema/change.d.mts +117 -0
- package/dist/schema/change.mjs +68 -0
- package/dist/schema/change.mjs.map +1 -0
- package/dist/schema/common.d.mts +33 -0
- package/dist/{id-BLIkCVue.mjs → schema/common.mjs} +7 -16
- package/dist/schema/common.mjs.map +1 -0
- package/dist/schema/communication.d.mts +52 -0
- package/dist/{communication-Kd9nU5RP.mjs → schema/communication.mjs} +8 -3
- package/dist/schema/communication.mjs.map +1 -0
- package/dist/schema/execution.d.mts +101 -0
- package/dist/schema/execution.mjs +86 -0
- package/dist/schema/execution.mjs.map +1 -0
- package/dist/schema/factory-config.d.mts +122 -0
- package/dist/schema/factory-config.mjs +90 -0
- package/dist/schema/factory-config.mjs.map +1 -0
- package/dist/schema/finding.d.mts +125 -0
- package/dist/schema/finding.mjs +67 -0
- package/dist/schema/finding.mjs.map +1 -0
- package/dist/schema/id.d.mts +43 -0
- package/dist/schema/id.mjs +32 -0
- package/dist/schema/id.mjs.map +1 -0
- package/dist/schema/outbox.d.mts +240 -0
- package/dist/schema/outbox.mjs +53 -0
- package/dist/schema/outbox.mjs.map +1 -0
- package/dist/schema/question-route.mjs +16 -0
- package/dist/schema/question-route.mjs.map +1 -0
- package/dist/schema/receipt.d.mts +81 -0
- package/dist/schema/receipt.mjs +94 -0
- package/dist/schema/receipt.mjs.map +1 -0
- package/dist/schema/repository.d.mts +30 -0
- package/dist/schema/repository.mjs +29 -0
- package/dist/schema/repository.mjs.map +1 -0
- package/dist/schema/session.d.mts +136 -0
- package/dist/schema/session.mjs +54 -0
- package/dist/schema/session.mjs.map +1 -0
- package/dist/schema/signal.d.mts +105 -0
- package/dist/schema/signal.mjs +81 -0
- package/dist/schema/signal.mjs.map +1 -0
- package/dist/schema/slack-pr-notifications.d.mts +12 -0
- package/dist/schema/slack-pr-notifications.mjs +11 -0
- package/dist/schema/slack-pr-notifications.mjs.map +1 -0
- package/dist/schema/stored-session.mjs +10 -0
- package/dist/schema/stored-session.mjs.map +1 -0
- package/dist/schema/stored-task.mjs +20 -0
- package/dist/schema/stored-task.mjs.map +1 -0
- package/dist/schema/task-effect.d.mts +39 -0
- package/dist/schema/task-effect.mjs +29 -0
- package/dist/schema/task-effect.mjs.map +1 -0
- package/dist/schema/task-graph.d.mts +3173 -0
- package/dist/schema/task-graph.mjs +97 -0
- package/dist/schema/task-graph.mjs.map +1 -0
- package/dist/schema/task-message.d.mts +254 -0
- package/dist/schema/task-message.mjs +189 -0
- package/dist/schema/task-message.mjs.map +1 -0
- package/dist/schema/task.d.mts +273 -0
- package/dist/schema/task.mjs +200 -0
- package/dist/schema/task.mjs.map +1 -0
- package/dist/schema/transcript.d.mts +176 -0
- package/dist/schema/transcript.mjs +87 -0
- package/dist/schema/transcript.mjs.map +1 -0
- package/dist/schema/transitions.d.mts +50 -0
- package/dist/schema/transitions.mjs +303 -0
- package/dist/schema/transitions.mjs.map +1 -0
- package/dist/schema/work.d.mts +150 -0
- package/dist/schema/work.mjs +102 -0
- package/dist/schema/work.mjs.map +1 -0
- package/dist/session-previews.d.mts +76 -0
- package/dist/session-previews.mjs +55 -0
- package/dist/session-previews.mjs.map +1 -0
- package/dist/session-review.d.mts +120 -0
- package/dist/session-review.mjs +79 -0
- package/dist/session-review.mjs.map +1 -0
- package/dist/signal-triage.d.mts +20 -0
- package/dist/signal-triage.mjs +85 -0
- package/dist/signal-triage.mjs.map +1 -0
- package/dist/signals.d.mts +20 -0
- package/dist/signals.mjs +19 -0
- package/dist/signals.mjs.map +1 -0
- package/dist/stall.d.mts +41 -0
- package/dist/stall.mjs +83 -0
- package/dist/stall.mjs.map +1 -0
- package/dist/storage.d.mts +4 -0
- package/dist/storage.mjs +4 -0
- package/dist/store/driver.d.mts +65 -0
- package/dist/store/driver.mjs +42 -0
- package/dist/store/driver.mjs.map +1 -0
- package/dist/store/engine.d.mts +683 -0
- package/dist/store/engine.mjs +2309 -0
- package/dist/store/engine.mjs.map +1 -0
- package/dist/store/memory.d.mts +24 -0
- package/dist/store/memory.mjs +69 -0
- package/dist/store/memory.mjs.map +1 -0
- package/dist/store/slack-pr-notifications.d.mts +44 -0
- package/dist/store/slack-pr-notifications.mjs +121 -0
- package/dist/store/slack-pr-notifications.mjs.map +1 -0
- package/dist/store/task-effects.d.mts +38 -0
- package/dist/store/task-effects.mjs +118 -0
- package/dist/store/task-effects.mjs.map +1 -0
- package/dist/store/task-graphs.d.mts +60 -0
- package/dist/store/task-graphs.mjs +212 -0
- package/dist/store/task-graphs.mjs.map +1 -0
- package/dist/store/task-messages.d.mts +136 -0
- package/dist/store/task-messages.mjs +475 -0
- package/dist/store/task-messages.mjs.map +1 -0
- package/dist/store/task-work.d.mts +180 -0
- package/dist/store/task-work.mjs +137 -0
- package/dist/store/task-work.mjs.map +1 -0
- package/dist/store/work-notifications.d.mts +19 -0
- package/dist/store/work-notifications.mjs +48 -0
- package/dist/store/work-notifications.mjs.map +1 -0
- package/dist/sweep.d.mts +79 -0
- package/dist/sweep.mjs +171 -0
- package/dist/sweep.mjs.map +1 -0
- package/dist/task-communication.d.mts +35 -0
- package/dist/task-communication.mjs +47 -0
- package/dist/task-communication.mjs.map +1 -0
- package/dist/task-graph-view.d.mts +267 -0
- package/dist/task-graph-view.mjs +17 -0
- package/dist/task-graph-view.mjs.map +1 -0
- package/dist/task-message-processing.d.mts +60 -0
- package/dist/task-message-processing.mjs +200 -0
- package/dist/task-message-processing.mjs.map +1 -0
- package/dist/task-protocols.d.mts +80 -0
- package/dist/task-protocols.mjs +47 -0
- package/dist/task-protocols.mjs.map +1 -0
- package/dist/tasks.d.mts +17 -0
- package/dist/tasks.mjs +17 -0
- package/dist/vercel-git.d.mts +53 -0
- package/dist/vercel-git.mjs +344 -0
- package/dist/vercel-git.mjs.map +1 -0
- package/dist/vercel-github-api.d.mts +103 -0
- package/dist/vercel-github-api.mjs +363 -0
- package/dist/vercel-github-api.mjs.map +1 -0
- package/dist/vercel.d.mts +34 -2
- package/dist/vercel.mjs +49 -3
- package/dist/vercel.mjs.map +1 -1
- package/dist/work-triage/eve-tool.d.mts +29 -0
- package/dist/work-triage/eve-tool.mjs +32 -0
- package/dist/work-triage/eve-tool.mjs.map +1 -0
- package/dist/work-triage/find-existing-work.d.mts +32 -0
- package/dist/work-triage/find-existing-work.mjs +31 -0
- package/dist/work-triage/find-existing-work.mjs.map +1 -0
- package/dist/work-triage/github.d.mts +15 -0
- package/dist/work-triage/github.mjs +14 -0
- package/dist/work-triage/github.mjs.map +1 -0
- package/dist/work-triage.d.mts +4 -0
- package/dist/work-triage.mjs +3 -0
- package/dist/workflows.d.mts +146 -0
- package/dist/workflows.mjs +139 -0
- package/dist/workflows.mjs.map +1 -0
- package/dist/workspace-diff-assembly.d.mts +33 -0
- package/dist/workspace-diff-assembly.mjs +95 -0
- package/dist/workspace-diff-assembly.mjs.map +1 -0
- package/dist/workspace-diff.d.mts +90 -0
- package/dist/workspace-diff.mjs +61 -0
- package/dist/workspace-diff.mjs.map +1 -0
- package/dist/workspace-files-git.d.mts +15 -0
- package/dist/workspace-files-git.mjs +61 -0
- package/dist/workspace-files-git.mjs.map +1 -0
- package/dist/workspace-files.d.mts +107 -0
- package/dist/workspace-files.mjs +74 -0
- package/dist/workspace-files.mjs.map +1 -0
- package/dist/workspace-snapshot.d.mts +26 -0
- package/dist/workspace-snapshot.mjs +80 -0
- package/dist/workspace-snapshot.mjs.map +1 -0
- package/docs/getting-started.md +104 -0
- package/docs/index.md +100 -0
- package/docs/recipes/cancellation.md +215 -0
- package/docs/recipes/custom-workflow.md +153 -0
- package/docs/recipes/dependent-tasks.md +207 -0
- package/docs/recipes/eve-agent.md +277 -0
- package/docs/recipes/human-input.md +204 -0
- package/docs/recipes/persistence-recovery.md +268 -0
- package/docs/recipes/retry-recovery.md +241 -0
- package/docs/recipes/task-messaging.md +215 -0
- package/docs/recipes/typed-eve-result.md +161 -0
- package/docs/runtime-integration.md +137 -0
- package/package.json +142 -46
- package/dist/approval-JX2Px9IC.mjs +0 -132
- package/dist/approval-JX2Px9IC.mjs.map +0 -1
- package/dist/budget-DzSiIA4t.mjs +0 -42
- package/dist/budget-DzSiIA4t.mjs.map +0 -1
- package/dist/change-D2U6v7Ek.mjs +0 -554
- package/dist/change-D2U6v7Ek.mjs.map +0 -1
- package/dist/communication-Kd9nU5RP.mjs.map +0 -1
- package/dist/coordination-Cq08hb1l.mjs +0 -76
- package/dist/coordination-Cq08hb1l.mjs.map +0 -1
- package/dist/dispatch-BaZS3PT8.d.mts +0 -76
- package/dist/driver-BC0Mt5KG.d.mts +0 -34
- package/dist/driver-Bbd25rNM.mjs +0 -23
- package/dist/driver-Bbd25rNM.mjs.map +0 -1
- package/dist/engine-DFHU2Pe-.d.mts +0 -781
- package/dist/engine-WaUM2cGA.mjs +0 -1068
- package/dist/engine-WaUM2cGA.mjs.map +0 -1
- package/dist/factory-config-BoRXOw43.mjs +0 -50
- package/dist/factory-config-BoRXOw43.mjs.map +0 -1
- package/dist/factory-config-D2yU3G0c.d.mts +0 -58
- package/dist/github-C5HNBN6p.d.mts +0 -279
- package/dist/id-BLIkCVue.mjs.map +0 -1
- package/dist/index-Bw6hggoH.d.mts +0 -40
- package/dist/index.mjs.map +0 -1
- package/dist/task-CcOyOJ3k.mjs +0 -154
- package/dist/task-CcOyOJ3k.mjs.map +0 -1
package/dist/sweep.mjs
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { InvalidTransitionError } from "./schema/transitions.mjs";
|
|
2
|
+
import { routeKey } from "./agent-routes.mjs";
|
|
3
|
+
import { VersionConflictError } from "./store/driver.mjs";
|
|
4
|
+
import { DispatchRefusedError, dispatchTask } from "./dispatch.mjs";
|
|
5
|
+
import { TaskAttemptConflictError } from "./store/engine.mjs";
|
|
6
|
+
//#region src/sweep.ts
|
|
7
|
+
async function failUnrouteable(stores, task, reasonCode, reason, result) {
|
|
8
|
+
try {
|
|
9
|
+
await stores.tasks.transition(task.id, "failed", {
|
|
10
|
+
reason,
|
|
11
|
+
expectFrom: "queued"
|
|
12
|
+
});
|
|
13
|
+
result.failed.push({
|
|
14
|
+
taskId: task.id,
|
|
15
|
+
reasonCode,
|
|
16
|
+
reason
|
|
17
|
+
});
|
|
18
|
+
} catch (error) {
|
|
19
|
+
if (error instanceof InvalidTransitionError || error instanceof VersionConflictError) {
|
|
20
|
+
result.skipped.push({
|
|
21
|
+
taskId: task.id,
|
|
22
|
+
reasonCode: "task_changed",
|
|
23
|
+
reason: "task changed during routing"
|
|
24
|
+
});
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
throw error;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Runs one bounded pass over queued Tasks and dispatches each eligible exact route.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* Candidates are ordered by newest attempt first and then creation time. Route-less work remains
|
|
35
|
+
* queued for its workflow owner; unmet dependencies, approvals, and pass limits appear in
|
|
36
|
+
* `skipped`. Invalid repository scope, missing repositories or launchers, and launch failures
|
|
37
|
+
* appear in `failed`, with unrouteable Tasks transitioned to `failed` when this sweep wins the
|
|
38
|
+
* race. A result entry describes this pass rather than guaranteeing the Task's lifecycle state:
|
|
39
|
+
* an ambiguously accepted launch is reported as `launch_failed` while its Task intentionally stays
|
|
40
|
+
* running for recovery. Callers should surface every failure, reread those Tasks before deciding
|
|
41
|
+
* remediation, and schedule another pass for skipped work.
|
|
42
|
+
*
|
|
43
|
+
* Overlapping passes are safe: {@link dispatchTask} atomically admits one winner before invoking a
|
|
44
|
+
* launcher. A supplied `tasks` snapshot bounds reads and candidate selection for this pass; it can
|
|
45
|
+
* become stale, and corresponding races are returned as `task_changed` rather than hidden.
|
|
46
|
+
* `maxDispatches` counts provider launches started during the pass, including launches that later
|
|
47
|
+
* fail, so `dispatched.length` may be smaller than the limit.
|
|
48
|
+
*
|
|
49
|
+
* @param stores - Graph, receipt, repository, and Task stores used during the pass.
|
|
50
|
+
* @param options - Exact-route launchers plus optional budget, Task snapshot, and dispatch limit.
|
|
51
|
+
* @returns IDs dispatched and structured skipped/failed outcomes for every considered candidate.
|
|
52
|
+
* @throws When `maxDispatches` is not a positive integer or an unexpected persistence error occurs.
|
|
53
|
+
* @see The shipped `docs/recipes/retry-recovery.md` recipe for scheduled recovery.
|
|
54
|
+
*/
|
|
55
|
+
async function sweepQueued(stores, options) {
|
|
56
|
+
const result = {
|
|
57
|
+
dispatched: [],
|
|
58
|
+
skipped: [],
|
|
59
|
+
failed: []
|
|
60
|
+
};
|
|
61
|
+
const maxDispatches = options.maxDispatches ?? Number.POSITIVE_INFINITY;
|
|
62
|
+
if (!(Number.isInteger(maxDispatches) || maxDispatches === Number.POSITIVE_INFINITY) || maxDispatches < 1) throw new Error("maxDispatches must be a positive integer");
|
|
63
|
+
let attempted = 0;
|
|
64
|
+
const taskSnapshot = options.tasks ?? await stores.tasks.list();
|
|
65
|
+
const budgetSnapshot = options.budget?.tasks ?? (options.budget && options.tasks ? await stores.tasks.list() : taskSnapshot);
|
|
66
|
+
const budgetTasks = new Map(budgetSnapshot.map((task) => [task.id, task]));
|
|
67
|
+
const queued = taskSnapshot.filter((task) => task.state === "queued").sort((a, b) => b.attempt - a.attempt || a.createdAt.localeCompare(b.createdAt));
|
|
68
|
+
for (const task of queued) {
|
|
69
|
+
const route = task.work.route;
|
|
70
|
+
if (route === void 0) {
|
|
71
|
+
result.skipped.push({
|
|
72
|
+
taskId: task.id,
|
|
73
|
+
reasonCode: "workflow_owned",
|
|
74
|
+
reason: "no agent route; workflow owns execution"
|
|
75
|
+
});
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
const [repositoryId] = task.repositoryIds;
|
|
79
|
+
if (task.repositoryIds.length !== 1 || repositoryId === void 0) {
|
|
80
|
+
await failUnrouteable(stores, task, "invalid_repository_scope", "sweep launcher adapter requires exactly one repository", result);
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (task.approval === "required") {
|
|
84
|
+
result.skipped.push({
|
|
85
|
+
taskId: task.id,
|
|
86
|
+
reasonCode: "awaiting_approval",
|
|
87
|
+
reason: "awaiting human approval"
|
|
88
|
+
});
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
const key = routeKey(route);
|
|
92
|
+
const launcher = Object.hasOwn(options.launchers, key) ? options.launchers[key] : void 0;
|
|
93
|
+
if (launcher === void 0) {
|
|
94
|
+
await failUnrouteable(stores, task, "launcher_not_registered", `no registered launcher handles agent route ${key}`, result);
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
if (!await stores.graphs.dependenciesSatisfied({
|
|
98
|
+
rootTaskId: task.rootTaskId,
|
|
99
|
+
taskId: task.id
|
|
100
|
+
})) {
|
|
101
|
+
result.skipped.push({
|
|
102
|
+
taskId: task.id,
|
|
103
|
+
reasonCode: "dependencies_unsatisfied",
|
|
104
|
+
reason: "graph dependencies must all be succeeded before dispatch"
|
|
105
|
+
});
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
if (attempted >= maxDispatches) {
|
|
109
|
+
result.skipped.push({
|
|
110
|
+
taskId: task.id,
|
|
111
|
+
reasonCode: "dispatch_limit",
|
|
112
|
+
reason: "per-sweep dispatch limit reached"
|
|
113
|
+
});
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
const repository = await stores.repositories.get(repositoryId);
|
|
117
|
+
if (repository === null) {
|
|
118
|
+
await failUnrouteable(stores, task, "repository_not_found", "task has no repository", result);
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
let launchStarted = false;
|
|
122
|
+
try {
|
|
123
|
+
const dispatched = await dispatchTask(stores, {
|
|
124
|
+
taskId: task.id,
|
|
125
|
+
route,
|
|
126
|
+
launch: (dispatched) => {
|
|
127
|
+
attempted += 1;
|
|
128
|
+
launchStarted = true;
|
|
129
|
+
return launcher(dispatched, repository);
|
|
130
|
+
},
|
|
131
|
+
budget: options.budget === void 0 ? void 0 : {
|
|
132
|
+
...options.budget,
|
|
133
|
+
tasks: [...budgetTasks.values()]
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
budgetTasks.set(dispatched.id, dispatched);
|
|
137
|
+
result.dispatched.push(task.id);
|
|
138
|
+
} catch (error) {
|
|
139
|
+
if (options.budget !== void 0) {
|
|
140
|
+
const current = await stores.tasks.get(task.id).catch(() => null);
|
|
141
|
+
if (current !== null) budgetTasks.set(current.id, current);
|
|
142
|
+
}
|
|
143
|
+
if (error instanceof DispatchRefusedError) {
|
|
144
|
+
result.skipped.push({
|
|
145
|
+
taskId: task.id,
|
|
146
|
+
reasonCode: error.code,
|
|
147
|
+
reason: error.reason
|
|
148
|
+
});
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
if (!launchStarted && (error instanceof InvalidTransitionError || error instanceof TaskAttemptConflictError || error instanceof VersionConflictError)) {
|
|
152
|
+
result.skipped.push({
|
|
153
|
+
taskId: task.id,
|
|
154
|
+
reasonCode: "task_changed",
|
|
155
|
+
reason: "task changed before dispatch"
|
|
156
|
+
});
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
result.failed.push({
|
|
160
|
+
taskId: task.id,
|
|
161
|
+
reasonCode: "launch_failed",
|
|
162
|
+
reason: error instanceof Error ? error.message : String(error)
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return result;
|
|
167
|
+
}
|
|
168
|
+
//#endregion
|
|
169
|
+
export { sweepQueued };
|
|
170
|
+
|
|
171
|
+
//# sourceMappingURL=sweep.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sweep.mjs","names":[],"sources":["../src/sweep.ts"],"sourcesContent":["import { routeKey, type AgentRouteKey } from \"./agent-routes\";\nimport { dispatchTask, DispatchRefusedError, type DispatchBudget } from \"./dispatch\";\nimport type { DispatchRefusalCode } from \"./dispatch\";\nimport type { TaskId } from \"./schema/id\";\nimport type { Repository } from \"./schema/repository\";\nimport type { ExecutionReference, Task } from \"./schema/task\";\nimport { InvalidTransitionError } from \"./schema/transitions\";\nimport { VersionConflictError } from \"./store/driver\";\nimport { TaskAttemptConflictError, type FactoryStores } from \"./store/engine\";\n\n/** Graph, receipt, repository, and Task capabilities required by queued-work dispatch. */\nexport type SweepQueuedStores = Pick<\n FactoryStores,\n \"graphs\" | \"receipts\" | \"repositories\" | \"tasks\"\n>;\n\n/**\n * Single-repository adapter for an exact agent route. Supplied by the app, which knows its\n * agents' addresses. Returns the provider's execution reference when it has one.\n *\n * @param task - Running Task already admitted by the dispatch gate.\n * @param repository - Exact enabled repository selected from the Task scope.\n * @returns Provider execution reference that dispatch can persist for recovery.\n */\nexport type TaskLauncher = (task: Task, repository: Repository) => Promise<ExecutionReference>;\n\n/** Exact-route launchers, budget gate, and pass bounds for queued Task dispatch. */\nexport interface SweepQueuedOptions {\n /** Single-repository agent adapters keyed by routeKey(binding), e.g. code-change@1. */\n launchers: Readonly<Partial<Record<AgentRouteKey, TaskLauncher>>>;\n /** Reserve-before-execution limits, passed through to every dispatch. */\n budget?: DispatchBudget;\n /** Maximum task launches attempted in one pass; omitted means no limit. */\n maxDispatches?: number;\n /** A dispatcher-wide snapshot avoids another complete task read. */\n tasks?: readonly Task[];\n}\n\n/** Tasks dispatched, deferred by a gate, or failed by one queued-work pass. */\nexport interface SweepQueuedResult {\n /** Task IDs whose provider execution reference was durably recorded. */\n readonly dispatched: readonly TaskId[];\n /** Tasks left in the queue because a declared gate may become eligible later. */\n readonly skipped: readonly {\n readonly taskId: TaskId;\n readonly reasonCode: SweepSkipReasonCode;\n readonly reason: string;\n }[];\n /** Tasks whose routing is invalid or whose launch threw. */\n readonly failed: readonly {\n readonly taskId: TaskId;\n readonly reasonCode: SweepFailureReasonCode;\n readonly reason: string;\n }[];\n}\n\n/** Stable reason a queued Task remained eligible for a later dispatch pass. */\nexport type SweepSkipReasonCode =\n | DispatchRefusalCode\n | \"workflow_owned\"\n | \"awaiting_approval\"\n | \"dispatch_limit\"\n | \"task_changed\";\n\n/** Stable reason a queued Task could not be routed or launched. */\nexport type SweepFailureReasonCode =\n | \"invalid_repository_scope\"\n | \"repository_not_found\"\n | \"launcher_not_registered\"\n | \"launch_failed\";\n\ntype MutableSweepQueuedResult = {\n dispatched: TaskId[];\n skipped: { taskId: TaskId; reasonCode: SweepSkipReasonCode; reason: string }[];\n failed: { taskId: TaskId; reasonCode: SweepFailureReasonCode; reason: string }[];\n};\n\nasync function failUnrouteable(\n stores: SweepQueuedStores,\n task: Task,\n reasonCode: SweepFailureReasonCode,\n reason: string,\n result: MutableSweepQueuedResult,\n): Promise<void> {\n try {\n await stores.tasks.transition(task.id, \"failed\", { reason, expectFrom: \"queued\" });\n result.failed.push({ taskId: task.id, reasonCode, reason });\n } catch (error) {\n if (error instanceof InvalidTransitionError || error instanceof VersionConflictError) {\n result.skipped.push({\n taskId: task.id,\n reasonCode: \"task_changed\",\n reason: \"task changed during routing\",\n });\n return;\n }\n throw error;\n }\n}\n\n/**\n * Runs one bounded pass over queued Tasks and dispatches each eligible exact route.\n *\n * @remarks\n * Candidates are ordered by newest attempt first and then creation time. Route-less work remains\n * queued for its workflow owner; unmet dependencies, approvals, and pass limits appear in\n * `skipped`. Invalid repository scope, missing repositories or launchers, and launch failures\n * appear in `failed`, with unrouteable Tasks transitioned to `failed` when this sweep wins the\n * race. A result entry describes this pass rather than guaranteeing the Task's lifecycle state:\n * an ambiguously accepted launch is reported as `launch_failed` while its Task intentionally stays\n * running for recovery. Callers should surface every failure, reread those Tasks before deciding\n * remediation, and schedule another pass for skipped work.\n *\n * Overlapping passes are safe: {@link dispatchTask} atomically admits one winner before invoking a\n * launcher. A supplied `tasks` snapshot bounds reads and candidate selection for this pass; it can\n * become stale, and corresponding races are returned as `task_changed` rather than hidden.\n * `maxDispatches` counts provider launches started during the pass, including launches that later\n * fail, so `dispatched.length` may be smaller than the limit.\n *\n * @param stores - Graph, receipt, repository, and Task stores used during the pass.\n * @param options - Exact-route launchers plus optional budget, Task snapshot, and dispatch limit.\n * @returns IDs dispatched and structured skipped/failed outcomes for every considered candidate.\n * @throws When `maxDispatches` is not a positive integer or an unexpected persistence error occurs.\n * @see The shipped `docs/recipes/retry-recovery.md` recipe for scheduled recovery.\n */\nexport async function sweepQueued(\n stores: SweepQueuedStores,\n options: SweepQueuedOptions,\n): Promise<SweepQueuedResult> {\n const result: MutableSweepQueuedResult = { dispatched: [], skipped: [], failed: [] };\n const maxDispatches = options.maxDispatches ?? Number.POSITIVE_INFINITY;\n if (\n !(Number.isInteger(maxDispatches) || maxDispatches === Number.POSITIVE_INFINITY) ||\n maxDispatches < 1\n ) {\n throw new Error(\"maxDispatches must be a positive integer\");\n }\n let attempted = 0;\n const taskSnapshot = options.tasks ?? (await stores.tasks.list());\n const budgetSnapshot =\n options.budget?.tasks ??\n (options.budget && options.tasks ? await stores.tasks.list() : taskSnapshot);\n const budgetTasks = new Map(budgetSnapshot.map((task) => [task.id, task]));\n const queued = taskSnapshot\n .filter((task) => task.state === \"queued\")\n .sort((a, b) => b.attempt - a.attempt || a.createdAt.localeCompare(b.createdAt));\n\n for (const task of queued) {\n const route = task.work.route;\n if (route === undefined) {\n result.skipped.push({\n taskId: task.id,\n reasonCode: \"workflow_owned\",\n reason: \"no agent route; workflow owns execution\",\n });\n continue;\n }\n const [repositoryId] = task.repositoryIds;\n if (task.repositoryIds.length !== 1 || repositoryId === undefined) {\n await failUnrouteable(\n stores,\n task,\n \"invalid_repository_scope\",\n \"sweep launcher adapter requires exactly one repository\",\n result,\n );\n continue;\n }\n if (task.approval === \"required\") {\n result.skipped.push({\n taskId: task.id,\n reasonCode: \"awaiting_approval\",\n reason: \"awaiting human approval\",\n });\n continue;\n }\n const key = routeKey(route);\n const launcher = Object.hasOwn(options.launchers, key) ? options.launchers[key] : undefined;\n if (launcher === undefined) {\n await failUnrouteable(\n stores,\n task,\n \"launcher_not_registered\",\n `no registered launcher handles agent route ${key}`,\n result,\n );\n continue;\n }\n if (\n !(await stores.graphs.dependenciesSatisfied({\n rootTaskId: task.rootTaskId,\n taskId: task.id,\n }))\n ) {\n result.skipped.push({\n taskId: task.id,\n reasonCode: \"dependencies_unsatisfied\",\n reason: \"graph dependencies must all be succeeded before dispatch\",\n });\n continue;\n }\n if (attempted >= maxDispatches) {\n result.skipped.push({\n taskId: task.id,\n reasonCode: \"dispatch_limit\",\n reason: \"per-sweep dispatch limit reached\",\n });\n continue;\n }\n const repository = await stores.repositories.get(repositoryId);\n if (repository === null) {\n await failUnrouteable(stores, task, \"repository_not_found\", \"task has no repository\", result);\n continue;\n }\n let launchStarted = false;\n try {\n const dispatched = await dispatchTask(stores, {\n taskId: task.id,\n route,\n launch: (dispatched) => {\n attempted += 1;\n launchStarted = true;\n return launcher(dispatched, repository);\n },\n budget:\n options.budget === undefined\n ? undefined\n : { ...options.budget, tasks: [...budgetTasks.values()] },\n });\n budgetTasks.set(dispatched.id, dispatched);\n result.dispatched.push(task.id);\n } catch (error) {\n if (options.budget !== undefined) {\n const current = await stores.tasks.get(task.id).catch(() => null);\n if (current !== null) budgetTasks.set(current.id, current);\n }\n if (error instanceof DispatchRefusedError) {\n // Dependencies not ready, or another sweep won the race. Leave it.\n result.skipped.push({ taskId: task.id, reasonCode: error.code, reason: error.reason });\n continue;\n }\n if (\n !launchStarted &&\n (error instanceof InvalidTransitionError ||\n error instanceof TaskAttemptConflictError ||\n error instanceof VersionConflictError)\n ) {\n result.skipped.push({\n taskId: task.id,\n reasonCode: \"task_changed\",\n reason: \"task changed before dispatch\",\n });\n continue;\n }\n result.failed.push({\n taskId: task.id,\n reasonCode: \"launch_failed\",\n reason: error instanceof Error ? error.message : String(error),\n });\n }\n }\n return result;\n}\n"],"mappings":";;;;;;AA6EA,eAAe,gBACb,QACA,MACA,YACA,QACA,QACe;CACf,IAAI;EACF,MAAM,OAAO,MAAM,WAAW,KAAK,IAAI,UAAU;GAAE;GAAQ,YAAY;EAAS,CAAC;EACjF,OAAO,OAAO,KAAK;GAAE,QAAQ,KAAK;GAAI;GAAY;EAAO,CAAC;CAC5D,SAAS,OAAO;EACd,IAAI,iBAAiB,0BAA0B,iBAAiB,sBAAsB;GACpF,OAAO,QAAQ,KAAK;IAClB,QAAQ,KAAK;IACb,YAAY;IACZ,QAAQ;GACV,CAAC;GACD;EACF;EACA,MAAM;CACR;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,eAAsB,YACpB,QACA,SAC4B;CAC5B,MAAM,SAAmC;EAAE,YAAY,CAAC;EAAG,SAAS,CAAC;EAAG,QAAQ,CAAC;CAAE;CACnF,MAAM,gBAAgB,QAAQ,iBAAiB,OAAO;CACtD,IACE,EAAE,OAAO,UAAU,aAAa,KAAK,kBAAkB,OAAO,sBAC9D,gBAAgB,GAEhB,MAAM,IAAI,MAAM,0CAA0C;CAE5D,IAAI,YAAY;CAChB,MAAM,eAAe,QAAQ,SAAU,MAAM,OAAO,MAAM,KAAK;CAC/D,MAAM,iBACJ,QAAQ,QAAQ,UACf,QAAQ,UAAU,QAAQ,QAAQ,MAAM,OAAO,MAAM,KAAK,IAAI;CACjE,MAAM,cAAc,IAAI,IAAI,eAAe,KAAK,SAAS,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC;CACzE,MAAM,SAAS,aACZ,QAAQ,SAAS,KAAK,UAAU,QAAQ,CAAC,CACzC,MAAM,GAAG,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,cAAc,EAAE,SAAS,CAAC;CAEjF,KAAK,MAAM,QAAQ,QAAQ;EACzB,MAAM,QAAQ,KAAK,KAAK;EACxB,IAAI,UAAU,KAAA,GAAW;GACvB,OAAO,QAAQ,KAAK;IAClB,QAAQ,KAAK;IACb,YAAY;IACZ,QAAQ;GACV,CAAC;GACD;EACF;EACA,MAAM,CAAC,gBAAgB,KAAK;EAC5B,IAAI,KAAK,cAAc,WAAW,KAAK,iBAAiB,KAAA,GAAW;GACjE,MAAM,gBACJ,QACA,MACA,4BACA,0DACA,MACF;GACA;EACF;EACA,IAAI,KAAK,aAAa,YAAY;GAChC,OAAO,QAAQ,KAAK;IAClB,QAAQ,KAAK;IACb,YAAY;IACZ,QAAQ;GACV,CAAC;GACD;EACF;EACA,MAAM,MAAM,SAAS,KAAK;EAC1B,MAAM,WAAW,OAAO,OAAO,QAAQ,WAAW,GAAG,IAAI,QAAQ,UAAU,OAAO,KAAA;EAClF,IAAI,aAAa,KAAA,GAAW;GAC1B,MAAM,gBACJ,QACA,MACA,2BACA,8CAA8C,OAC9C,MACF;GACA;EACF;EACA,IACE,CAAE,MAAM,OAAO,OAAO,sBAAsB;GAC1C,YAAY,KAAK;GACjB,QAAQ,KAAK;EACf,CAAC,GACD;GACA,OAAO,QAAQ,KAAK;IAClB,QAAQ,KAAK;IACb,YAAY;IACZ,QAAQ;GACV,CAAC;GACD;EACF;EACA,IAAI,aAAa,eAAe;GAC9B,OAAO,QAAQ,KAAK;IAClB,QAAQ,KAAK;IACb,YAAY;IACZ,QAAQ;GACV,CAAC;GACD;EACF;EACA,MAAM,aAAa,MAAM,OAAO,aAAa,IAAI,YAAY;EAC7D,IAAI,eAAe,MAAM;GACvB,MAAM,gBAAgB,QAAQ,MAAM,wBAAwB,0BAA0B,MAAM;GAC5F;EACF;EACA,IAAI,gBAAgB;EACpB,IAAI;GACF,MAAM,aAAa,MAAM,aAAa,QAAQ;IAC5C,QAAQ,KAAK;IACb;IACA,SAAS,eAAe;KACtB,aAAa;KACb,gBAAgB;KAChB,OAAO,SAAS,YAAY,UAAU;IACxC;IACA,QACE,QAAQ,WAAW,KAAA,IACf,KAAA,IACA;KAAE,GAAG,QAAQ;KAAQ,OAAO,CAAC,GAAG,YAAY,OAAO,CAAC;IAAE;GAC9D,CAAC;GACD,YAAY,IAAI,WAAW,IAAI,UAAU;GACzC,OAAO,WAAW,KAAK,KAAK,EAAE;EAChC,SAAS,OAAO;GACd,IAAI,QAAQ,WAAW,KAAA,GAAW;IAChC,MAAM,UAAU,MAAM,OAAO,MAAM,IAAI,KAAK,EAAE,CAAC,CAAC,YAAY,IAAI;IAChE,IAAI,YAAY,MAAM,YAAY,IAAI,QAAQ,IAAI,OAAO;GAC3D;GACA,IAAI,iBAAiB,sBAAsB;IAEzC,OAAO,QAAQ,KAAK;KAAE,QAAQ,KAAK;KAAI,YAAY,MAAM;KAAM,QAAQ,MAAM;IAAO,CAAC;IACrF;GACF;GACA,IACE,CAAC,kBACA,iBAAiB,0BAChB,iBAAiB,4BACjB,iBAAiB,uBACnB;IACA,OAAO,QAAQ,KAAK;KAClB,QAAQ,KAAK;KACb,YAAY;KACZ,QAAQ;IACV,CAAC;IACD;GACF;GACA,OAAO,OAAO,KAAK;IACjB,QAAQ,KAAK;IACb,YAAY;IACZ,QAAQ,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GAC/D,CAAC;EACH;CACF;CACA,OAAO;AACT"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Task } from "./schema/task.mjs";
|
|
2
|
+
import { MaybePromise } from "./schema/common.mjs";
|
|
3
|
+
import { CommunicationEvent } from "./schema/communication.mjs";
|
|
4
|
+
import { Receipt } from "./schema/receipt.mjs";
|
|
5
|
+
import { FactoryStores } from "./store/engine.mjs";
|
|
6
|
+
//#region src/task-communication.d.ts
|
|
7
|
+
/** Outbox, receipt, and Task capabilities required by communication reconciliation. */
|
|
8
|
+
type TaskCommunicationStores = Pick<FactoryStores, "outbox" | "receipts" | "tasks">;
|
|
9
|
+
/** Number of connector-neutral events newly enqueued during reconciliation. */
|
|
10
|
+
interface TaskCommunicationResult {
|
|
11
|
+
enqueued: number;
|
|
12
|
+
}
|
|
13
|
+
/** Repairs pending Task communication projections against the durable outbox. */
|
|
14
|
+
type TaskCommunicationReconciler<Stores extends TaskCommunicationStores = TaskCommunicationStores> = (stores: Stores, snapshot?: readonly Task[]) => Promise<TaskCommunicationResult>;
|
|
15
|
+
/** Durable Task and receipt context supplied to a lifecycle event projection. */
|
|
16
|
+
interface TaskLifecycleProjectionInput<Stores extends TaskCommunicationStores = TaskCommunicationStores> {
|
|
17
|
+
stores: Stores;
|
|
18
|
+
tasks: readonly Task[];
|
|
19
|
+
task: Task;
|
|
20
|
+
receipt: Receipt;
|
|
21
|
+
}
|
|
22
|
+
/** Application policy for projecting durable task state into connector-neutral events. */
|
|
23
|
+
interface TaskCommunicationProjection<Stores extends TaskCommunicationStores = TaskCommunicationStores> {
|
|
24
|
+
question(task: Task): MaybePromise<readonly CommunicationEvent[]>;
|
|
25
|
+
lifecycle(input: TaskLifecycleProjectionInput<Stores>): MaybePromise<readonly CommunicationEvent[]>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Build the generic durable receipt reconciler around an application's event
|
|
29
|
+
* projection. Events are acknowledged only after every projected event has
|
|
30
|
+
* reached the outbox.
|
|
31
|
+
*/
|
|
32
|
+
declare function createTaskCommunicationReconciler<Stores extends TaskCommunicationStores>(projection: TaskCommunicationProjection<Stores>): TaskCommunicationReconciler<Stores>;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { TaskCommunicationProjection, TaskCommunicationReconciler, TaskCommunicationResult, TaskCommunicationStores, TaskLifecycleProjectionInput, createTaskCommunicationReconciler };
|
|
35
|
+
//# sourceMappingURL=task-communication.d.mts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//#region src/task-communication.ts
|
|
2
|
+
/**
|
|
3
|
+
* Build the generic durable receipt reconciler around an application's event
|
|
4
|
+
* projection. Events are acknowledged only after every projected event has
|
|
5
|
+
* reached the outbox.
|
|
6
|
+
*/
|
|
7
|
+
function createTaskCommunicationReconciler(projection) {
|
|
8
|
+
return async function reconcileTaskCommunications(stores, snapshot) {
|
|
9
|
+
const tasks = snapshot ?? await stores.tasks.list();
|
|
10
|
+
let enqueued = 0;
|
|
11
|
+
for (const task of tasks) {
|
|
12
|
+
const presentsQuestion = task.question !== void 0;
|
|
13
|
+
if (presentsQuestion && task.state === "needs_human" && task.needsHumanNotifiedAt !== void 0) await stores.tasks.recordNeedsHumanDelivery(task.id, { attempt: task.attempt });
|
|
14
|
+
if (presentsQuestion && task.state === "needs_human" && task.needsHumanNotifiedAt === void 0 && !task.pendingCommunicationReceiptIds?.length) for (const event of await projection.question(task)) {
|
|
15
|
+
await stores.outbox.enqueue(event);
|
|
16
|
+
enqueued += 1;
|
|
17
|
+
}
|
|
18
|
+
for (const receiptId of task.pendingCommunicationReceiptIds ?? []) {
|
|
19
|
+
const receipt = await stores.receipts.get(receiptId);
|
|
20
|
+
if (receipt === null || receipt.taskId !== task.id) throw new Error(`Task ${task.id} references missing lifecycle receipt ${receiptId}.`);
|
|
21
|
+
if (receipt.state === "needs_human" && presentsQuestion) {
|
|
22
|
+
if (task.state === "needs_human" && task.attempt === receipt.attempt) for (const event of await projection.question(task)) {
|
|
23
|
+
await stores.outbox.enqueue(event);
|
|
24
|
+
enqueued += 1;
|
|
25
|
+
}
|
|
26
|
+
await stores.tasks.acknowledgeCommunication(task.id, receiptId);
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
for (const event of await projection.lifecycle({
|
|
30
|
+
stores,
|
|
31
|
+
tasks,
|
|
32
|
+
task,
|
|
33
|
+
receipt
|
|
34
|
+
})) {
|
|
35
|
+
await stores.outbox.enqueue(event);
|
|
36
|
+
enqueued += 1;
|
|
37
|
+
}
|
|
38
|
+
await stores.tasks.acknowledgeCommunication(task.id, receiptId);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return { enqueued };
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { createTaskCommunicationReconciler };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=task-communication.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-communication.mjs","names":[],"sources":["../src/task-communication.ts"],"sourcesContent":["import type { CommunicationEvent } from \"./schema/communication\";\nimport type { MaybePromise } from \"./schema/common\";\nimport type { Receipt } from \"./schema/receipt\";\nimport type { Task } from \"./schema/task\";\nimport type { FactoryStores } from \"./store/engine\";\n\n/** Outbox, receipt, and Task capabilities required by communication reconciliation. */\nexport type TaskCommunicationStores = Pick<FactoryStores, \"outbox\" | \"receipts\" | \"tasks\">;\n\n/** Number of connector-neutral events newly enqueued during reconciliation. */\nexport interface TaskCommunicationResult {\n enqueued: number;\n}\n\n/** Repairs pending Task communication projections against the durable outbox. */\nexport type TaskCommunicationReconciler<\n Stores extends TaskCommunicationStores = TaskCommunicationStores,\n> = (stores: Stores, snapshot?: readonly Task[]) => Promise<TaskCommunicationResult>;\n\n/** Durable Task and receipt context supplied to a lifecycle event projection. */\nexport interface TaskLifecycleProjectionInput<\n Stores extends TaskCommunicationStores = TaskCommunicationStores,\n> {\n stores: Stores;\n tasks: readonly Task[];\n task: Task;\n receipt: Receipt;\n}\n\n/** Application policy for projecting durable task state into connector-neutral events. */\nexport interface TaskCommunicationProjection<\n Stores extends TaskCommunicationStores = TaskCommunicationStores,\n> {\n question(task: Task): MaybePromise<readonly CommunicationEvent[]>;\n lifecycle(\n input: TaskLifecycleProjectionInput<Stores>,\n ): MaybePromise<readonly CommunicationEvent[]>;\n}\n\n/**\n * Build the generic durable receipt reconciler around an application's event\n * projection. Events are acknowledged only after every projected event has\n * reached the outbox.\n */\nexport function createTaskCommunicationReconciler<Stores extends TaskCommunicationStores>(\n projection: TaskCommunicationProjection<Stores>,\n): TaskCommunicationReconciler<Stores> {\n return async function reconcileTaskCommunications(\n stores: Stores,\n snapshot?: readonly Task[],\n ): Promise<TaskCommunicationResult> {\n const tasks = snapshot ?? (await stores.tasks.list());\n let enqueued = 0;\n for (const task of tasks) {\n const presentsQuestion = task.question !== undefined;\n // A connector may confirm before the parent starts waiting, or before\n // its delivery stamp is persisted.\n if (\n presentsQuestion &&\n task.state === \"needs_human\" &&\n task.needsHumanNotifiedAt !== undefined\n ) {\n await stores.tasks.recordNeedsHumanDelivery(task.id, { attempt: task.attempt });\n }\n if (\n presentsQuestion &&\n task.state === \"needs_human\" &&\n task.needsHumanNotifiedAt === undefined &&\n !task.pendingCommunicationReceiptIds?.length\n ) {\n for (const event of await projection.question(task)) {\n await stores.outbox.enqueue(event);\n enqueued += 1;\n }\n }\n for (const receiptId of task.pendingCommunicationReceiptIds ?? []) {\n const receipt = await stores.receipts.get(receiptId);\n if (receipt === null || receipt.taskId !== task.id) {\n throw new Error(`Task ${task.id} references missing lifecycle receipt ${receiptId}.`);\n }\n if (receipt.state === \"needs_human\" && presentsQuestion) {\n if (task.state === \"needs_human\" && task.attempt === receipt.attempt) {\n for (const event of await projection.question(task)) {\n await stores.outbox.enqueue(event);\n enqueued += 1;\n }\n }\n await stores.tasks.acknowledgeCommunication(task.id, receiptId);\n continue;\n }\n for (const event of await projection.lifecycle({ stores, tasks, task, receipt })) {\n await stores.outbox.enqueue(event);\n enqueued += 1;\n }\n await stores.tasks.acknowledgeCommunication(task.id, receiptId);\n }\n }\n return { enqueued };\n };\n}\n"],"mappings":";;;;;;AA4CA,SAAgB,kCACd,YACqC;CACrC,OAAO,eAAe,4BACpB,QACA,UACkC;EAClC,MAAM,QAAQ,YAAa,MAAM,OAAO,MAAM,KAAK;EACnD,IAAI,WAAW;EACf,KAAK,MAAM,QAAQ,OAAO;GACxB,MAAM,mBAAmB,KAAK,aAAa,KAAA;GAG3C,IACE,oBACA,KAAK,UAAU,iBACf,KAAK,yBAAyB,KAAA,GAE9B,MAAM,OAAO,MAAM,yBAAyB,KAAK,IAAI,EAAE,SAAS,KAAK,QAAQ,CAAC;GAEhF,IACE,oBACA,KAAK,UAAU,iBACf,KAAK,yBAAyB,KAAA,KAC9B,CAAC,KAAK,gCAAgC,QAEtC,KAAK,MAAM,SAAS,MAAM,WAAW,SAAS,IAAI,GAAG;IACnD,MAAM,OAAO,OAAO,QAAQ,KAAK;IACjC,YAAY;GACd;GAEF,KAAK,MAAM,aAAa,KAAK,kCAAkC,CAAC,GAAG;IACjE,MAAM,UAAU,MAAM,OAAO,SAAS,IAAI,SAAS;IACnD,IAAI,YAAY,QAAQ,QAAQ,WAAW,KAAK,IAC9C,MAAM,IAAI,MAAM,QAAQ,KAAK,GAAG,wCAAwC,UAAU,EAAE;IAEtF,IAAI,QAAQ,UAAU,iBAAiB,kBAAkB;KACvD,IAAI,KAAK,UAAU,iBAAiB,KAAK,YAAY,QAAQ,SAC3D,KAAK,MAAM,SAAS,MAAM,WAAW,SAAS,IAAI,GAAG;MACnD,MAAM,OAAO,OAAO,QAAQ,KAAK;MACjC,YAAY;KACd;KAEF,MAAM,OAAO,MAAM,yBAAyB,KAAK,IAAI,SAAS;KAC9D;IACF;IACA,KAAK,MAAM,SAAS,MAAM,WAAW,UAAU;KAAE;KAAQ;KAAO;KAAM;IAAQ,CAAC,GAAG;KAChF,MAAM,OAAO,OAAO,QAAQ,KAAK;KACjC,YAAY;IACd;IACA,MAAM,OAAO,MAAM,yBAAyB,KAAK,IAAI,SAAS;GAChE;EACF;EACA,OAAO,EAAE,SAAS;CACpB;AACF"}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { JsonValue } from "./schema/work.mjs";
|
|
2
|
+
import { Task, TaskKind } from "./schema/task.mjs";
|
|
3
|
+
import "./workflows.mjs";
|
|
4
|
+
import "./tasks.mjs";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
//#region src/task-graph-view.d.ts
|
|
7
|
+
declare const taskGraphViewSchema: z.ZodObject<{
|
|
8
|
+
rootTaskId: z.ZodNullable<z.ZodType<`task_${string}`, string, z.core.$ZodTypeInternals<`task_${string}`, string>>>;
|
|
9
|
+
currentTaskId: z.ZodOptional<z.ZodNullable<z.ZodType<`task_${string}`, string, z.core.$ZodTypeInternals<`task_${string}`, string>>>>;
|
|
10
|
+
nodes: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
11
|
+
task: Omit<z.ZodObject<{
|
|
12
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
13
|
+
id: z.ZodType<`task_${string}`, string, z.core.$ZodTypeInternals<`task_${string}`, string>>;
|
|
14
|
+
repositoryIds: z.ZodReadonly<z.ZodTuple<[z.ZodType<`repo_${string}`, string, z.core.$ZodTypeInternals<`repo_${string}`, string>>], z.ZodType<`repo_${string}`, string, z.core.$ZodTypeInternals<`repo_${string}`, string>>>>;
|
|
15
|
+
kind: z.ZodType<TaskKind, unknown, z.core.$ZodTypeInternals<TaskKind, unknown>>;
|
|
16
|
+
model: z.ZodOptional<z.ZodString>;
|
|
17
|
+
area: z.ZodOptional<z.ZodString>;
|
|
18
|
+
state: z.ZodEnum<{
|
|
19
|
+
queued: "queued";
|
|
20
|
+
running: "running";
|
|
21
|
+
stalled: "stalled";
|
|
22
|
+
verifying: "verifying";
|
|
23
|
+
succeeded: "succeeded";
|
|
24
|
+
failed: "failed";
|
|
25
|
+
needs_human: "needs_human";
|
|
26
|
+
cancelled: "cancelled";
|
|
27
|
+
}>;
|
|
28
|
+
approval: z.ZodOptional<z.ZodEnum<{
|
|
29
|
+
required: "required";
|
|
30
|
+
granted: "granted";
|
|
31
|
+
denied: "denied";
|
|
32
|
+
}>>;
|
|
33
|
+
origin: z.ZodObject<{
|
|
34
|
+
signalId: z.ZodOptional<z.ZodType<`sig_${string}`, string, z.core.$ZodTypeInternals<`sig_${string}`, string>>>;
|
|
35
|
+
operator: z.ZodOptional<z.ZodString>;
|
|
36
|
+
}, z.core.$strict>;
|
|
37
|
+
work: z.ZodObject<{
|
|
38
|
+
title: z.ZodString;
|
|
39
|
+
input: z.ZodCustom<JsonValue, JsonValue>;
|
|
40
|
+
completionCriteria: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
41
|
+
workflow: z.core.$ZodBranded<z.ZodObject<{
|
|
42
|
+
id: z.ZodString;
|
|
43
|
+
version: z.ZodNumber;
|
|
44
|
+
}, z.core.$strict>, "WorkflowBinding", "out">;
|
|
45
|
+
route: z.ZodOptional<z.core.$ZodBranded<z.ZodObject<{
|
|
46
|
+
id: z.ZodString;
|
|
47
|
+
version: z.ZodNumber;
|
|
48
|
+
}, z.core.$strict>, "AgentRouteBinding", "out">>;
|
|
49
|
+
}, z.core.$strict>;
|
|
50
|
+
workResult: z.ZodOptional<z.ZodObject<{
|
|
51
|
+
output: z.ZodCustom<JsonValue, JsonValue>;
|
|
52
|
+
completedAt: z.ZodISODateTime;
|
|
53
|
+
}, z.core.$strict>>;
|
|
54
|
+
waitingForMessages: z.ZodOptional<z.ZodBoolean>;
|
|
55
|
+
workflowPhase: z.ZodOptional<z.ZodString>;
|
|
56
|
+
rootTaskId: z.ZodType<`task_${string}`, string, z.core.$ZodTypeInternals<`task_${string}`, string>>;
|
|
57
|
+
parentTaskId: z.ZodOptional<z.ZodType<`task_${string}`, string, z.core.$ZodTypeInternals<`task_${string}`, string>>>;
|
|
58
|
+
parentTaskAttempt: z.ZodOptional<z.ZodNumber>;
|
|
59
|
+
replyTo: z.ZodObject<{
|
|
60
|
+
channel: z.ZodString;
|
|
61
|
+
address: z.ZodString;
|
|
62
|
+
}, z.core.$strict>;
|
|
63
|
+
pendingCommunicationReceiptIds: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodType<`rcpt_${string}`, string, z.core.$ZodTypeInternals<`rcpt_${string}`, string>>>>>;
|
|
64
|
+
failureReceiptId: z.ZodOptional<z.ZodType<`rcpt_${string}`, string, z.core.$ZodTypeInternals<`rcpt_${string}`, string>>>;
|
|
65
|
+
attempt: z.ZodNumber;
|
|
66
|
+
execution: z.ZodOptional<z.ZodObject<{
|
|
67
|
+
provider: z.ZodString;
|
|
68
|
+
sessionId: z.ZodString;
|
|
69
|
+
environmentId: z.ZodOptional<z.ZodString>;
|
|
70
|
+
harness: z.ZodOptional<z.ZodString>;
|
|
71
|
+
traceId: z.ZodOptional<z.ZodString>;
|
|
72
|
+
}, z.core.$strict>>;
|
|
73
|
+
lastProgressAt: z.ZodOptional<z.ZodISODateTime>;
|
|
74
|
+
stalledAt: z.ZodOptional<z.ZodISODateTime>;
|
|
75
|
+
stalledReason: z.ZodOptional<z.ZodString>;
|
|
76
|
+
needsHumanAction: z.ZodOptional<z.ZodString>;
|
|
77
|
+
needsHumanNotifiedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
78
|
+
reservedUsd: z.ZodOptional<z.ZodNumber>;
|
|
79
|
+
reservedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
80
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
81
|
+
costUsd: z.ZodNumber;
|
|
82
|
+
inputTokens: z.ZodNumber;
|
|
83
|
+
outputTokens: z.ZodNumber;
|
|
84
|
+
cacheReadTokens: z.ZodNumber;
|
|
85
|
+
cacheWriteTokens: z.ZodNumber;
|
|
86
|
+
steps: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
87
|
+
}, z.core.$strict>>;
|
|
88
|
+
settledUsd: z.ZodOptional<z.ZodNumber>;
|
|
89
|
+
question: z.ZodOptional<z.ZodObject<{
|
|
90
|
+
text: z.ZodString;
|
|
91
|
+
options: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
92
|
+
closingOptions: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
93
|
+
answer: z.ZodOptional<z.ZodString>;
|
|
94
|
+
answeredBy: z.ZodOptional<z.ZodString>;
|
|
95
|
+
}, z.core.$strict>>;
|
|
96
|
+
questionTaskId: z.ZodOptional<z.ZodType<`task_${string}`, string, z.core.$ZodTypeInternals<`task_${string}`, string>>>;
|
|
97
|
+
answerEventIds: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodType<`ans_${string}`, string, z.core.$ZodTypeInternals<`ans_${string}`, string>>>>>;
|
|
98
|
+
changeId: z.ZodOptional<z.ZodType<`chg_${string}`, string, z.core.$ZodTypeInternals<`chg_${string}`, string>>>;
|
|
99
|
+
reportRef: z.ZodOptional<z.ZodString>;
|
|
100
|
+
createdAt: z.ZodISODateTime;
|
|
101
|
+
updatedAt: z.ZodISODateTime;
|
|
102
|
+
}, z.core.$strict>, keyof z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>> & z.ZodType<Task, {
|
|
103
|
+
schemaVersion: 1;
|
|
104
|
+
id: string;
|
|
105
|
+
repositoryIds: readonly [string, ...string[]];
|
|
106
|
+
kind: unknown;
|
|
107
|
+
state: "queued" | "running" | "stalled" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
|
|
108
|
+
origin: {
|
|
109
|
+
signalId?: string | undefined;
|
|
110
|
+
operator?: string | undefined;
|
|
111
|
+
};
|
|
112
|
+
work: {
|
|
113
|
+
title: string;
|
|
114
|
+
input: JsonValue;
|
|
115
|
+
completionCriteria: readonly string[];
|
|
116
|
+
workflow: {
|
|
117
|
+
id: string;
|
|
118
|
+
version: number;
|
|
119
|
+
};
|
|
120
|
+
route?: {
|
|
121
|
+
id: string;
|
|
122
|
+
version: number;
|
|
123
|
+
} | undefined;
|
|
124
|
+
};
|
|
125
|
+
rootTaskId: string;
|
|
126
|
+
replyTo: {
|
|
127
|
+
channel: string;
|
|
128
|
+
address: string;
|
|
129
|
+
};
|
|
130
|
+
attempt: number;
|
|
131
|
+
createdAt: string;
|
|
132
|
+
updatedAt: string;
|
|
133
|
+
model?: string | undefined;
|
|
134
|
+
area?: string | undefined;
|
|
135
|
+
approval?: "required" | "granted" | "denied" | undefined;
|
|
136
|
+
workResult?: {
|
|
137
|
+
output: JsonValue;
|
|
138
|
+
completedAt: string;
|
|
139
|
+
} | undefined;
|
|
140
|
+
waitingForMessages?: boolean | undefined;
|
|
141
|
+
workflowPhase?: string | undefined;
|
|
142
|
+
parentTaskId?: string | undefined;
|
|
143
|
+
parentTaskAttempt?: number | undefined;
|
|
144
|
+
pendingCommunicationReceiptIds?: readonly string[] | undefined;
|
|
145
|
+
failureReceiptId?: string | undefined;
|
|
146
|
+
execution?: {
|
|
147
|
+
provider: string;
|
|
148
|
+
sessionId: string;
|
|
149
|
+
environmentId?: string | undefined;
|
|
150
|
+
harness?: string | undefined;
|
|
151
|
+
traceId?: string | undefined;
|
|
152
|
+
} | undefined;
|
|
153
|
+
lastProgressAt?: string | undefined;
|
|
154
|
+
stalledAt?: string | undefined;
|
|
155
|
+
stalledReason?: string | undefined;
|
|
156
|
+
needsHumanAction?: string | undefined;
|
|
157
|
+
needsHumanNotifiedAt?: string | undefined;
|
|
158
|
+
reservedUsd?: number | undefined;
|
|
159
|
+
reservedAt?: string | undefined;
|
|
160
|
+
usage?: {
|
|
161
|
+
costUsd: number;
|
|
162
|
+
inputTokens: number;
|
|
163
|
+
outputTokens: number;
|
|
164
|
+
cacheReadTokens: number;
|
|
165
|
+
cacheWriteTokens: number;
|
|
166
|
+
steps: Record<string, number>;
|
|
167
|
+
} | undefined;
|
|
168
|
+
settledUsd?: number | undefined;
|
|
169
|
+
question?: {
|
|
170
|
+
text: string;
|
|
171
|
+
options: readonly string[];
|
|
172
|
+
closingOptions?: readonly string[] | undefined;
|
|
173
|
+
answer?: string | undefined;
|
|
174
|
+
answeredBy?: string | undefined;
|
|
175
|
+
} | undefined;
|
|
176
|
+
questionTaskId?: string | undefined;
|
|
177
|
+
answerEventIds?: readonly string[] | undefined;
|
|
178
|
+
changeId?: string | undefined;
|
|
179
|
+
reportRef?: string | undefined;
|
|
180
|
+
}, z.core.$ZodTypeInternals<Task, {
|
|
181
|
+
schemaVersion: 1;
|
|
182
|
+
id: string;
|
|
183
|
+
repositoryIds: readonly [string, ...string[]];
|
|
184
|
+
kind: unknown;
|
|
185
|
+
state: "queued" | "running" | "stalled" | "verifying" | "succeeded" | "failed" | "needs_human" | "cancelled";
|
|
186
|
+
origin: {
|
|
187
|
+
signalId?: string | undefined;
|
|
188
|
+
operator?: string | undefined;
|
|
189
|
+
};
|
|
190
|
+
work: {
|
|
191
|
+
title: string;
|
|
192
|
+
input: JsonValue;
|
|
193
|
+
completionCriteria: readonly string[];
|
|
194
|
+
workflow: {
|
|
195
|
+
id: string;
|
|
196
|
+
version: number;
|
|
197
|
+
};
|
|
198
|
+
route?: {
|
|
199
|
+
id: string;
|
|
200
|
+
version: number;
|
|
201
|
+
} | undefined;
|
|
202
|
+
};
|
|
203
|
+
rootTaskId: string;
|
|
204
|
+
replyTo: {
|
|
205
|
+
channel: string;
|
|
206
|
+
address: string;
|
|
207
|
+
};
|
|
208
|
+
attempt: number;
|
|
209
|
+
createdAt: string;
|
|
210
|
+
updatedAt: string;
|
|
211
|
+
model?: string | undefined;
|
|
212
|
+
area?: string | undefined;
|
|
213
|
+
approval?: "required" | "granted" | "denied" | undefined;
|
|
214
|
+
workResult?: {
|
|
215
|
+
output: JsonValue;
|
|
216
|
+
completedAt: string;
|
|
217
|
+
} | undefined;
|
|
218
|
+
waitingForMessages?: boolean | undefined;
|
|
219
|
+
workflowPhase?: string | undefined;
|
|
220
|
+
parentTaskId?: string | undefined;
|
|
221
|
+
parentTaskAttempt?: number | undefined;
|
|
222
|
+
pendingCommunicationReceiptIds?: readonly string[] | undefined;
|
|
223
|
+
failureReceiptId?: string | undefined;
|
|
224
|
+
execution?: {
|
|
225
|
+
provider: string;
|
|
226
|
+
sessionId: string;
|
|
227
|
+
environmentId?: string | undefined;
|
|
228
|
+
harness?: string | undefined;
|
|
229
|
+
traceId?: string | undefined;
|
|
230
|
+
} | undefined;
|
|
231
|
+
lastProgressAt?: string | undefined;
|
|
232
|
+
stalledAt?: string | undefined;
|
|
233
|
+
stalledReason?: string | undefined;
|
|
234
|
+
needsHumanAction?: string | undefined;
|
|
235
|
+
needsHumanNotifiedAt?: string | undefined;
|
|
236
|
+
reservedUsd?: number | undefined;
|
|
237
|
+
reservedAt?: string | undefined;
|
|
238
|
+
usage?: {
|
|
239
|
+
costUsd: number;
|
|
240
|
+
inputTokens: number;
|
|
241
|
+
outputTokens: number;
|
|
242
|
+
cacheReadTokens: number;
|
|
243
|
+
cacheWriteTokens: number;
|
|
244
|
+
steps: Record<string, number>;
|
|
245
|
+
} | undefined;
|
|
246
|
+
settledUsd?: number | undefined;
|
|
247
|
+
question?: {
|
|
248
|
+
text: string;
|
|
249
|
+
options: readonly string[];
|
|
250
|
+
closingOptions?: readonly string[] | undefined;
|
|
251
|
+
answer?: string | undefined;
|
|
252
|
+
answeredBy?: string | undefined;
|
|
253
|
+
} | undefined;
|
|
254
|
+
questionTaskId?: string | undefined;
|
|
255
|
+
answerEventIds?: readonly string[] | undefined;
|
|
256
|
+
changeId?: string | undefined;
|
|
257
|
+
reportRef?: string | undefined;
|
|
258
|
+
}>>;
|
|
259
|
+
dependencyTaskIds: z.ZodReadonly<z.ZodArray<z.ZodType<`task_${string}`, string, z.core.$ZodTypeInternals<`task_${string}`, string>>>>;
|
|
260
|
+
agent: z.ZodNullable<z.ZodString>;
|
|
261
|
+
}, z.core.$strict>>>;
|
|
262
|
+
}, z.core.$strict>;
|
|
263
|
+
/** An authorized, read-only operator projection of one canonical Task graph. */
|
|
264
|
+
type TaskGraphView = z.infer<typeof taskGraphViewSchema>;
|
|
265
|
+
//#endregion
|
|
266
|
+
export { TaskGraphView, taskGraphViewSchema };
|
|
267
|
+
//# sourceMappingURL=task-graph-view.d.mts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { taskIdSchema } from "./schema/id.mjs";
|
|
2
|
+
import { taskSchema } from "./schema/task.mjs";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
//#region src/task-graph-view.ts
|
|
5
|
+
const taskGraphViewSchema = z.strictObject({
|
|
6
|
+
rootTaskId: taskIdSchema.nullable().describe("Canonical root, or null for a taskless conversation."),
|
|
7
|
+
currentTaskId: taskIdSchema.nullable().optional().describe("Task currently shown by the entrypoint conversation, or null when it is not in this graph."),
|
|
8
|
+
nodes: z.array(z.strictObject({
|
|
9
|
+
task: taskSchema.describe("Current persisted Task snapshot."),
|
|
10
|
+
dependencyTaskIds: z.array(taskIdSchema).max(255).readonly().describe("Canonical prerequisites, distinct from parent ownership."),
|
|
11
|
+
agent: z.string().nullable().describe("Exact exposed route agent, or null for workflow-owned or unavailable execution.")
|
|
12
|
+
})).max(256).readonly().describe("Authorized canonical graph membership, independent of session pagination.")
|
|
13
|
+
}).describe("Read-only operator view of one root Task graph.");
|
|
14
|
+
//#endregion
|
|
15
|
+
export { taskGraphViewSchema };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=task-graph-view.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-graph-view.mjs","names":[],"sources":["../src/task-graph-view.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { taskIdSchema } from \"./schema/id\";\nimport { taskSchema } from \"./schema/task\";\n\nexport const taskGraphViewSchema = z\n .strictObject({\n rootTaskId: taskIdSchema\n .nullable()\n .describe(\"Canonical root, or null for a taskless conversation.\"),\n currentTaskId: taskIdSchema\n .nullable()\n .optional()\n .describe(\n \"Task currently shown by the entrypoint conversation, or null when it is not in this graph.\",\n ),\n nodes: z\n .array(\n z.strictObject({\n task: taskSchema.describe(\"Current persisted Task snapshot.\"),\n dependencyTaskIds: z\n .array(taskIdSchema)\n .max(255)\n .readonly()\n .describe(\"Canonical prerequisites, distinct from parent ownership.\"),\n agent: z\n .string()\n .nullable()\n .describe(\n \"Exact exposed route agent, or null for workflow-owned or unavailable execution.\",\n ),\n }),\n )\n .max(256)\n .readonly()\n .describe(\"Authorized canonical graph membership, independent of session pagination.\"),\n })\n .describe(\"Read-only operator view of one root Task graph.\");\n/** An authorized, read-only operator projection of one canonical Task graph. */\nexport type TaskGraphView = z.infer<typeof taskGraphViewSchema>;\n"],"mappings":";;;;AAIA,MAAa,sBAAsB,EAChC,aAAa;CACZ,YAAY,aACT,SAAS,CAAC,CACV,SAAS,sDAAsD;CAClE,eAAe,aACZ,SAAS,CAAC,CACV,SAAS,CAAC,CACV,SACC,4FACF;CACF,OAAO,EACJ,MACC,EAAE,aAAa;EACb,MAAM,WAAW,SAAS,kCAAkC;EAC5D,mBAAmB,EAChB,MAAM,YAAY,CAAC,CACnB,IAAI,GAAG,CAAC,CACR,SAAS,CAAC,CACV,SAAS,0DAA0D;EACtE,OAAO,EACJ,OAAO,CAAC,CACR,SAAS,CAAC,CACV,SACC,iFACF;CACJ,CAAC,CACH,CAAC,CACA,IAAI,GAAG,CAAC,CACR,SAAS,CAAC,CACV,SAAS,2EAA2E;AACzF,CAAC,CAAC,CACD,SAAS,iDAAiD"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { WorkflowBinding } from "./schema/work.mjs";
|
|
2
|
+
import { Task } from "./schema/task.mjs";
|
|
3
|
+
import { TaskMessageForProtocol, TaskMessageId, TaskMessagePrincipal, TaskMessageProtocol } from "./schema/task-message.mjs";
|
|
4
|
+
import { IsoDateTimeClock } from "./schema/common.mjs";
|
|
5
|
+
import { TaskAttemptRef } from "./schema/execution.mjs";
|
|
6
|
+
import { FactoryStores } from "./store/engine.mjs";
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
//#region src/task-message-processing.d.ts
|
|
9
|
+
/** Minimal persistence capabilities required to decide and apply one Task message. */
|
|
10
|
+
type TaskMessageProcessingStores = Pick<FactoryStores, "messages" | "tasks" | "workflowRecords">;
|
|
11
|
+
/** Trusted dependencies and pure/effectful callbacks for processing one Task inbox head. */
|
|
12
|
+
interface ProcessTaskMessageOptions<Schema extends z.ZodType, Protocol extends TaskMessageProtocol = TaskMessageProtocol> {
|
|
13
|
+
readonly stores: TaskMessageProcessingStores;
|
|
14
|
+
/** Authenticated externally; the message store enforces its configured claim policy. */
|
|
15
|
+
readonly principal: TaskMessagePrincipal;
|
|
16
|
+
/** Exact recipient Task attempt authorized to process the inbox head. */
|
|
17
|
+
readonly task: TaskAttemptRef;
|
|
18
|
+
/** Refuse a different inbox head before deciding or replaying effects. */
|
|
19
|
+
readonly expectMessageId?: TaskMessageId;
|
|
20
|
+
readonly leaseMs: number;
|
|
21
|
+
readonly workflow: WorkflowBinding;
|
|
22
|
+
/** Exact protocol required for the claimed message and exposed to typed callbacks. */
|
|
23
|
+
readonly protocol: Protocol;
|
|
24
|
+
/** Trusted UTC clock for decision timestamps; defaults to the system clock. */
|
|
25
|
+
readonly now?: IsoDateTimeClock;
|
|
26
|
+
/** Must accept its canonical JSON output unchanged. Exclude secrets from the decision contract. */
|
|
27
|
+
readonly decisionSchema: Schema;
|
|
28
|
+
/** Pure computation: may run concurrently or repeat until a decision is durably inserted. */
|
|
29
|
+
decide(context: Readonly<{
|
|
30
|
+
task: Task;
|
|
31
|
+
message: TaskMessageForProtocol<Protocol>;
|
|
32
|
+
}>): Promise<z.input<Schema>>;
|
|
33
|
+
/**
|
|
34
|
+
* Honor effectKey for every external write (derive stable subkeys for multiple effects).
|
|
35
|
+
* Lease checks cannot fence external systems: apply may repeat, overlap, or outlive its claim.
|
|
36
|
+
* Resolve only after all effects commit; never mutate the decision to select different effects.
|
|
37
|
+
*/
|
|
38
|
+
apply(context: Readonly<{
|
|
39
|
+
task: Task;
|
|
40
|
+
message: TaskMessageForProtocol<Protocol>;
|
|
41
|
+
decision: z.output<Schema>;
|
|
42
|
+
effectKey: string;
|
|
43
|
+
}>): Promise<void>;
|
|
44
|
+
}
|
|
45
|
+
/** Result of finding no claimable work or durably processing one Task message. */
|
|
46
|
+
type ProcessTaskMessageResult<Decision> = {
|
|
47
|
+
status: "idle";
|
|
48
|
+
} | {
|
|
49
|
+
status: "processed";
|
|
50
|
+
messageId: TaskMessageId;
|
|
51
|
+
decision: Decision;
|
|
52
|
+
effectKey: string;
|
|
53
|
+
};
|
|
54
|
+
/** Authorized typed inspection; null means no committed decision, not permission to decide for a terminal Task. */
|
|
55
|
+
declare function readTaskMessageDecision<Schema extends z.ZodType>(options: Pick<ProcessTaskMessageOptions<Schema>, "stores" | "principal" | "task" | "workflow" | "decisionSchema">, messageId: TaskMessageId): Promise<z.output<Schema> | null>;
|
|
56
|
+
/** Process one authorized inbox head. Idle means empty or already leased, not necessarily drained. */
|
|
57
|
+
declare function processTaskMessage<Schema extends z.ZodType, Protocol extends TaskMessageProtocol = TaskMessageProtocol>(options: ProcessTaskMessageOptions<Schema, Protocol>): Promise<ProcessTaskMessageResult<z.output<Schema>>>;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { ProcessTaskMessageOptions, ProcessTaskMessageResult, TaskMessageProcessingStores, processTaskMessage, readTaskMessageDecision };
|
|
60
|
+
//# sourceMappingURL=task-message-processing.d.mts.map
|