@vercel/factory 0.0.13 → 0.0.15
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 +307 -1
- package/dist/agent-routes.d.mts +69 -0
- package/dist/agent-routes.mjs +64 -0
- package/dist/agent-routes.mjs.map +1 -0
- package/dist/api-contracts.d.mts +1749 -0
- package/dist/api-contracts.mjs +118 -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 +77 -0
- package/dist/api.mjs +1087 -0
- package/dist/api.mjs.map +1 -0
- 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 +692 -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 +44 -8
- package/dist/blob/index.mjs +159 -35
- package/dist/blob/index.mjs.map +1 -1
- package/dist/budget.d.mts +108 -0
- package/dist/budget.mjs +141 -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 +6 -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 +24 -0
- package/dist/change-verification/dispatch.mjs +45 -0
- package/dist/change-verification/dispatch.mjs.map +1 -0
- package/dist/change-verification/eve-tool.d.mts +60 -0
- package/dist/change-verification/eve-tool.mjs +101 -0
- package/dist/change-verification/eve-tool.mjs.map +1 -0
- package/dist/changes/eve-record-change.d.mts +56 -0
- package/dist/changes/eve-record-change.mjs +97 -0
- package/dist/changes/eve-record-change.mjs.map +1 -0
- package/dist/changes/presentation.d.mts +14 -0
- package/dist/changes.d.mts +23 -0
- package/dist/changes.mjs +29 -0
- package/dist/changes.mjs.map +1 -0
- package/dist/client-events.d.mts +18 -0
- package/dist/client-events.mjs +41 -0
- package/dist/client-events.mjs.map +1 -0
- package/dist/client-stream.d.mts +28 -0
- package/dist/client-stream.mjs +204 -0
- package/dist/client-stream.mjs.map +1 -0
- package/dist/client-transcript.d.mts +41 -0
- package/dist/client-transcript.mjs +229 -0
- package/dist/client-transcript.mjs.map +1 -0
- package/dist/client.d.mts +234 -0
- package/dist/client.mjs +258 -0
- package/dist/client.mjs.map +1 -0
- package/dist/code-review/contracts.d.mts +26 -0
- package/dist/code-review/eve-post-review.d.mts +70 -0
- package/dist/code-review/eve-post-review.mjs +183 -0
- package/dist/code-review/eve-post-review.mjs.map +1 -0
- package/dist/code-review/eve-review-comments.d.mts +64 -0
- package/dist/code-review/eve-review-comments.mjs +159 -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 +44 -0
- package/dist/code-review/github-reporter.mjs +260 -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 +6 -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 -2
- package/dist/connectors/index.mjs +4 -26
- 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 -41
- package/dist/connectors/slack.mjs +13 -69
- package/dist/connectors/slack.mjs.map +1 -1
- package/dist/deepsec/eve-tool.d.mts +110 -0
- package/dist/deepsec/eve-tool.mjs +164 -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 +81 -0
- package/dist/dispatch.mjs +140 -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 +143 -1561
- package/dist/eve/index.mjs +244 -1063
- package/dist/eve/index.mjs.map +1 -1
- package/dist/eve/invoke.d.mts +144 -0
- package/dist/eve/invoke.mjs +241 -0
- package/dist/eve/invoke.mjs.map +1 -0
- package/dist/eve/session-client.d.mts +68 -0
- package/dist/eve/session-client.mjs +131 -0
- package/dist/eve/session-client.mjs.map +1 -0
- package/dist/eve/task-execution.mjs +18 -0
- package/dist/eve/task-execution.mjs.map +1 -0
- package/dist/eve/task-session.d.mts +87 -0
- package/dist/eve/task-session.mjs +203 -0
- package/dist/eve/task-session.mjs.map +1 -0
- package/dist/eve/transcript.d.mts +37 -0
- package/dist/eve/transcript.mjs +65 -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 +75 -0
- package/dist/execution.mjs +153 -0
- package/dist/execution.mjs.map +1 -0
- package/dist/finding-remediation/admission.d.mts +51 -0
- package/dist/finding-remediation/admission.mjs +87 -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 +6 -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 +198 -0
- package/dist/github-publication.mjs +429 -0
- package/dist/github-publication.mjs.map +1 -0
- package/dist/github-transfer.d.mts +72 -0
- package/dist/github-transfer.mjs +125 -0
- package/dist/github-transfer.mjs.map +1 -0
- package/dist/github.d.mts +406 -2
- package/dist/github.mjs +250 -37
- 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/index.d.mts +14 -314
- package/dist/index.mjs +14 -1124
- package/dist/intake-contracts.d.mts +56 -0
- package/dist/intake-contracts.mjs +33 -0
- package/dist/intake-contracts.mjs.map +1 -0
- package/dist/integrations/deepsec.d.mts +4 -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 +3 -0
- package/dist/integrations/slack.mjs +3 -0
- package/dist/integrations/vercel.d.mts +3 -0
- package/dist/integrations/vercel.mjs +3 -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 +46 -0
- package/dist/merge-resolution/eve-tools.mjs +117 -0
- package/dist/merge-resolution/eve-tools.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 +273 -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 +7 -1
- package/dist/postgres/index.mjs +7 -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 +53 -0
- package/dist/presets/software-development/dispatch.mjs +66 -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 +23 -0
- package/dist/presets/software-development/task-communication.mjs +120 -0
- package/dist/presets/software-development/task-communication.mjs.map +1 -0
- package/dist/presets/software-development.d.mts +9 -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 +53 -0
- package/dist/pull-requests/github-publisher.mjs +345 -0
- package/dist/pull-requests/github-publisher.mjs.map +1 -0
- package/dist/pull-requests.d.mts +5 -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 +9 -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 +22 -0
- package/dist/schema/agent-route.mjs +15 -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-DwCihQr4.mjs → schema/common.mjs} +7 -14
- package/dist/schema/common.mjs.map +1 -0
- package/dist/schema/communication.d.mts +52 -0
- package/dist/schema/communication.mjs +35 -0
- 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 +95 -0
- package/dist/schema/factory-config.mjs +60 -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 +26 -0
- package/dist/schema/repository.mjs +25 -0
- package/dist/schema/repository.mjs.map +1 -0
- package/dist/schema/session.d.mts +135 -0
- package/dist/schema/session.mjs +53 -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/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 +3134 -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 +272 -0
- package/dist/schema/task.mjs +199 -0
- package/dist/schema/task.mjs.map +1 -0
- package/dist/schema/transcript.d.mts +170 -0
- package/dist/schema/transcript.mjs +86 -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 +101 -0
- package/dist/schema/work.mjs +102 -0
- package/dist/schema/work.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 +19 -0
- package/dist/signals.mjs +19 -0
- package/dist/signals.mjs.map +1 -0
- package/dist/stall.d.mts +38 -0
- package/dist/stall.mjs +79 -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 +485 -0
- package/dist/store/engine.mjs +2175 -0
- package/dist/store/engine.mjs.map +1 -0
- package/dist/store/memory.d.mts +7 -0
- package/dist/store/memory.mjs +52 -0
- package/dist/store/memory.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 +65 -0
- package/dist/store/task-work.mjs +134 -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 +57 -0
- package/dist/sweep.mjs +143 -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 +264 -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 +21 -0
- package/dist/vercel-git.mjs +112 -0
- package/dist/vercel-git.mjs.map +1 -0
- package/dist/vercel.d.mts +33 -2
- package/dist/vercel.mjs +48 -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 +3 -0
- package/dist/work-triage.mjs +3 -0
- package/dist/workflows.d.mts +48 -0
- package/dist/workflows.mjs +86 -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-snapshot.d.mts +26 -0
- package/dist/workspace-snapshot.mjs +80 -0
- package/dist/workspace-snapshot.mjs.map +1 -0
- package/package.json +129 -40
- package/dist/approval-CwhTP1XB.mjs +0 -269
- package/dist/approval-CwhTP1XB.mjs.map +0 -1
- package/dist/change-CzEAoFVE.mjs +0 -620
- package/dist/change-CzEAoFVE.mjs.map +0 -1
- package/dist/dispatch-B77cuPxh.d.mts +0 -713
- package/dist/driver-BJutB0PE.d.mts +0 -34
- package/dist/driver-Bbd25rNM.mjs +0 -23
- package/dist/driver-Bbd25rNM.mjs.map +0 -1
- package/dist/factory-config-BJcjsPKl.mjs +0 -86
- package/dist/factory-config-BJcjsPKl.mjs.map +0 -1
- package/dist/factory-config-D2yU3G0c.d.mts +0 -58
- package/dist/github-DXsxboUL.d.mts +0 -271
- package/dist/id-DwCihQr4.mjs.map +0 -1
- package/dist/index-Cy4jfXh5.d.mts +0 -67
- package/dist/index.mjs.map +0 -1
- package/dist/signal-CHVEmzvI.d.mts +0 -59
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { JsonValue } from "./work.mjs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/schema/task.d.ts
|
|
4
|
+
/** Descriptive labels used by the reference workflows, not core lifecycle rules. */
|
|
5
|
+
declare const standardTaskKinds: readonly ["coordination", "code_change", "verification", "investigation", "question"];
|
|
6
|
+
/** Standard Task kinds with support for caller-defined vocabulary values. */
|
|
7
|
+
type TaskKind = (typeof standardTaskKinds)[number] | (string & Record<never, never>);
|
|
8
|
+
/** Validates the descriptive, open-vocabulary label attached to a Task. */
|
|
9
|
+
declare const taskKindSchema: z.ZodType<TaskKind>;
|
|
10
|
+
/** Validates the fixed lifecycle state of a Task. */
|
|
11
|
+
declare const taskStateSchema: z.ZodEnum<{
|
|
12
|
+
queued: "queued";
|
|
13
|
+
running: "running";
|
|
14
|
+
stalled: "stalled";
|
|
15
|
+
verifying: "verifying";
|
|
16
|
+
succeeded: "succeeded";
|
|
17
|
+
failed: "failed";
|
|
18
|
+
needs_human: "needs_human";
|
|
19
|
+
cancelled: "cancelled";
|
|
20
|
+
}>;
|
|
21
|
+
/** Validates whether a Task requires, received, or was denied human approval. */
|
|
22
|
+
declare const taskApprovalSchema: z.ZodEnum<{
|
|
23
|
+
required: "required";
|
|
24
|
+
granted: "granted";
|
|
25
|
+
denied: "denied";
|
|
26
|
+
}>;
|
|
27
|
+
/** Validates the single-repository scope required by supplied execution adapters. */
|
|
28
|
+
declare const taskExecutionRepositoryIdsSchema: z.ZodReadonly<z.ZodTuple<[z.ZodType<`repo_${string}`, string, z.core.$ZodTypeInternals<`repo_${string}`, string>>], null>>;
|
|
29
|
+
/** Validates Task provenance independently from graph parentage. */
|
|
30
|
+
declare const taskOriginSchema: z.ZodObject<{
|
|
31
|
+
signalId: z.ZodOptional<z.ZodType<`sig_${string}`, string, z.core.$ZodTypeInternals<`sig_${string}`, string>>>;
|
|
32
|
+
operator: z.ZodOptional<z.ZodString>;
|
|
33
|
+
}, z.core.$strict>;
|
|
34
|
+
/** Validates the configured coding-harness identifier retained with an execution. */
|
|
35
|
+
declare const harnessSchema: z.ZodString;
|
|
36
|
+
/**
|
|
37
|
+
* The provider's handle on the current attempt's execution. Opaque to the
|
|
38
|
+
* lifecycle: Factory records it so the execution can be inspected or
|
|
39
|
+
* cancelled, never to mirror the provider's own state machine.
|
|
40
|
+
*/
|
|
41
|
+
declare const executionReferenceSchema: z.ZodObject<{
|
|
42
|
+
provider: z.ZodString;
|
|
43
|
+
sessionId: z.ZodString;
|
|
44
|
+
environmentId: z.ZodOptional<z.ZodString>;
|
|
45
|
+
harness: z.ZodOptional<z.ZodString>;
|
|
46
|
+
traceId: z.ZodOptional<z.ZodString>;
|
|
47
|
+
}, z.core.$strict>;
|
|
48
|
+
/** Validates Task-local measured usage and per-turn step deduplication state. */
|
|
49
|
+
declare const taskUsageSchema: z.ZodObject<{
|
|
50
|
+
costUsd: z.ZodNumber;
|
|
51
|
+
inputTokens: z.ZodNumber;
|
|
52
|
+
outputTokens: z.ZodNumber;
|
|
53
|
+
cacheReadTokens: z.ZodNumber;
|
|
54
|
+
cacheWriteTokens: z.ZodNumber;
|
|
55
|
+
steps: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
56
|
+
}, z.core.$strict>;
|
|
57
|
+
/** Validates a human question, suggested replies, and any authenticated answer. */
|
|
58
|
+
declare const taskQuestionSchema: z.ZodObject<{
|
|
59
|
+
text: z.ZodString;
|
|
60
|
+
options: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
61
|
+
closingOptions: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
62
|
+
answer: z.ZodOptional<z.ZodString>;
|
|
63
|
+
answeredBy: z.ZodOptional<z.ZodString>;
|
|
64
|
+
}, z.core.$strict>;
|
|
65
|
+
/** Validates the canonical durable snapshot of one unit of workflow work. */
|
|
66
|
+
declare const taskRecordSchema: z.ZodObject<{
|
|
67
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
68
|
+
id: z.ZodType<`task_${string}`, string, z.core.$ZodTypeInternals<`task_${string}`, string>>;
|
|
69
|
+
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>>>>;
|
|
70
|
+
kind: z.ZodType<TaskKind, unknown, z.core.$ZodTypeInternals<TaskKind, unknown>>;
|
|
71
|
+
area: z.ZodOptional<z.ZodString>;
|
|
72
|
+
state: z.ZodEnum<{
|
|
73
|
+
queued: "queued";
|
|
74
|
+
running: "running";
|
|
75
|
+
stalled: "stalled";
|
|
76
|
+
verifying: "verifying";
|
|
77
|
+
succeeded: "succeeded";
|
|
78
|
+
failed: "failed";
|
|
79
|
+
needs_human: "needs_human";
|
|
80
|
+
cancelled: "cancelled";
|
|
81
|
+
}>;
|
|
82
|
+
approval: z.ZodOptional<z.ZodEnum<{
|
|
83
|
+
required: "required";
|
|
84
|
+
granted: "granted";
|
|
85
|
+
denied: "denied";
|
|
86
|
+
}>>;
|
|
87
|
+
origin: z.ZodObject<{
|
|
88
|
+
signalId: z.ZodOptional<z.ZodType<`sig_${string}`, string, z.core.$ZodTypeInternals<`sig_${string}`, string>>>;
|
|
89
|
+
operator: z.ZodOptional<z.ZodString>;
|
|
90
|
+
}, z.core.$strict>;
|
|
91
|
+
work: z.ZodObject<{
|
|
92
|
+
title: z.ZodString;
|
|
93
|
+
input: z.ZodCustom<JsonValue, JsonValue>;
|
|
94
|
+
completionCriteria: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
95
|
+
workflow: z.core.$ZodBranded<z.ZodObject<{
|
|
96
|
+
id: z.ZodString;
|
|
97
|
+
version: z.ZodNumber;
|
|
98
|
+
}, z.core.$strict>, "WorkflowBinding", "out">;
|
|
99
|
+
route: z.ZodOptional<z.core.$ZodBranded<z.ZodObject<{
|
|
100
|
+
id: z.ZodString;
|
|
101
|
+
version: z.ZodNumber;
|
|
102
|
+
}, z.core.$strict>, "AgentRouteBinding", "out">>;
|
|
103
|
+
}, z.core.$strict>;
|
|
104
|
+
workResult: z.ZodOptional<z.ZodObject<{
|
|
105
|
+
output: z.ZodCustom<JsonValue, JsonValue>;
|
|
106
|
+
completedAt: z.ZodISODateTime;
|
|
107
|
+
}, z.core.$strict>>;
|
|
108
|
+
waitingForMessages: z.ZodOptional<z.ZodBoolean>;
|
|
109
|
+
workflowPhase: z.ZodOptional<z.ZodString>;
|
|
110
|
+
rootTaskId: z.ZodType<`task_${string}`, string, z.core.$ZodTypeInternals<`task_${string}`, string>>;
|
|
111
|
+
parentTaskId: z.ZodOptional<z.ZodType<`task_${string}`, string, z.core.$ZodTypeInternals<`task_${string}`, string>>>;
|
|
112
|
+
parentTaskAttempt: z.ZodOptional<z.ZodNumber>;
|
|
113
|
+
replyTo: z.ZodObject<{
|
|
114
|
+
channel: z.ZodString;
|
|
115
|
+
address: z.ZodString;
|
|
116
|
+
}, z.core.$strict>;
|
|
117
|
+
pendingCommunicationReceiptIds: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodType<`rcpt_${string}`, string, z.core.$ZodTypeInternals<`rcpt_${string}`, string>>>>>;
|
|
118
|
+
failureReceiptId: z.ZodOptional<z.ZodType<`rcpt_${string}`, string, z.core.$ZodTypeInternals<`rcpt_${string}`, string>>>;
|
|
119
|
+
attempt: z.ZodNumber;
|
|
120
|
+
execution: z.ZodOptional<z.ZodObject<{
|
|
121
|
+
provider: z.ZodString;
|
|
122
|
+
sessionId: z.ZodString;
|
|
123
|
+
environmentId: z.ZodOptional<z.ZodString>;
|
|
124
|
+
harness: z.ZodOptional<z.ZodString>;
|
|
125
|
+
traceId: z.ZodOptional<z.ZodString>;
|
|
126
|
+
}, z.core.$strict>>;
|
|
127
|
+
lastProgressAt: z.ZodOptional<z.ZodISODateTime>;
|
|
128
|
+
stalledAt: z.ZodOptional<z.ZodISODateTime>;
|
|
129
|
+
stalledReason: z.ZodOptional<z.ZodString>;
|
|
130
|
+
needsHumanAction: z.ZodOptional<z.ZodString>;
|
|
131
|
+
needsHumanNotifiedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
132
|
+
reservedUsd: z.ZodOptional<z.ZodNumber>;
|
|
133
|
+
reservedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
134
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
135
|
+
costUsd: z.ZodNumber;
|
|
136
|
+
inputTokens: z.ZodNumber;
|
|
137
|
+
outputTokens: z.ZodNumber;
|
|
138
|
+
cacheReadTokens: z.ZodNumber;
|
|
139
|
+
cacheWriteTokens: z.ZodNumber;
|
|
140
|
+
steps: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
141
|
+
}, z.core.$strict>>;
|
|
142
|
+
settledUsd: z.ZodOptional<z.ZodNumber>;
|
|
143
|
+
question: z.ZodOptional<z.ZodObject<{
|
|
144
|
+
text: z.ZodString;
|
|
145
|
+
options: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
146
|
+
closingOptions: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
147
|
+
answer: z.ZodOptional<z.ZodString>;
|
|
148
|
+
answeredBy: z.ZodOptional<z.ZodString>;
|
|
149
|
+
}, z.core.$strict>>;
|
|
150
|
+
questionTaskId: z.ZodOptional<z.ZodType<`task_${string}`, string, z.core.$ZodTypeInternals<`task_${string}`, string>>>;
|
|
151
|
+
answerEventIds: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodType<`ans_${string}`, string, z.core.$ZodTypeInternals<`ans_${string}`, string>>>>>;
|
|
152
|
+
changeId: z.ZodOptional<z.ZodType<`chg_${string}`, string, z.core.$ZodTypeInternals<`chg_${string}`, string>>>;
|
|
153
|
+
reportRef: z.ZodOptional<z.ZodString>;
|
|
154
|
+
createdAt: z.ZodISODateTime;
|
|
155
|
+
updatedAt: z.ZodISODateTime;
|
|
156
|
+
}, z.core.$strict>;
|
|
157
|
+
type TaskRecord = z.infer<typeof taskRecordSchema>;
|
|
158
|
+
type SchemaWithOutput<Schema extends z.ZodType, Output> = Omit<Schema, keyof z.ZodType> & z.ZodType<Output, z.input<Schema>>;
|
|
159
|
+
type TaskStateField = "state" | "workResult" | "waitingForMessages" | "failureReceiptId" | "stalledAt" | "stalledReason" | "needsHumanAction" | "needsHumanNotifiedAt";
|
|
160
|
+
type TaskQuestionField = "question" | "questionTaskId" | "parentTaskAttempt" | "parentTaskId";
|
|
161
|
+
type TaskCommon = Omit<TaskRecord, TaskStateField | TaskQuestionField>;
|
|
162
|
+
type TaskIdValue = NonNullable<TaskRecord["parentTaskId"]>;
|
|
163
|
+
type TaskWorkResult = NonNullable<TaskRecord["workResult"]>;
|
|
164
|
+
type TaskWithoutQuestion = {
|
|
165
|
+
question?: never;
|
|
166
|
+
questionTaskId?: never;
|
|
167
|
+
parentTaskAttempt?: never;
|
|
168
|
+
parentTaskId?: TaskIdValue;
|
|
169
|
+
};
|
|
170
|
+
type TaskWithQuestion<Question extends TaskRecord["question"]> = {
|
|
171
|
+
question: Question;
|
|
172
|
+
questionTaskId?: never;
|
|
173
|
+
parentTaskAttempt?: never;
|
|
174
|
+
parentTaskId?: TaskIdValue;
|
|
175
|
+
} | {
|
|
176
|
+
question: Question;
|
|
177
|
+
questionTaskId?: never;
|
|
178
|
+
parentTaskAttempt: number;
|
|
179
|
+
parentTaskId: TaskIdValue;
|
|
180
|
+
};
|
|
181
|
+
type TaskWithLinkedQuestion = {
|
|
182
|
+
question?: never;
|
|
183
|
+
questionTaskId: TaskIdValue;
|
|
184
|
+
parentTaskAttempt?: never;
|
|
185
|
+
parentTaskId?: TaskIdValue;
|
|
186
|
+
};
|
|
187
|
+
type TaskQuestionContext = TaskWithoutQuestion | TaskWithQuestion<NonNullable<TaskRecord["question"]>> | TaskWithLinkedQuestion;
|
|
188
|
+
type UnansweredTaskQuestion = Omit<NonNullable<TaskRecord["question"]>, "answer" | "answeredBy"> & {
|
|
189
|
+
answer?: never;
|
|
190
|
+
answeredBy?: never;
|
|
191
|
+
};
|
|
192
|
+
type InactiveStateFields = {
|
|
193
|
+
waitingForMessages?: false;
|
|
194
|
+
needsHumanAction?: never;
|
|
195
|
+
needsHumanNotifiedAt?: never;
|
|
196
|
+
};
|
|
197
|
+
type UnstalledStateFields = {
|
|
198
|
+
stalledAt?: never;
|
|
199
|
+
stalledReason?: never;
|
|
200
|
+
};
|
|
201
|
+
type NonFailedStateFields = {
|
|
202
|
+
failureReceiptId?: never;
|
|
203
|
+
};
|
|
204
|
+
type InactiveOrdinaryTaskState<State extends "queued" | "verifying" | "cancelled"> = InactiveStateFields & UnstalledStateFields & NonFailedStateFields & {
|
|
205
|
+
state: State;
|
|
206
|
+
workResult?: TaskWorkResult;
|
|
207
|
+
};
|
|
208
|
+
type OrdinaryTaskState = InactiveOrdinaryTaskState<"queued"> | InactiveOrdinaryTaskState<"verifying"> | InactiveOrdinaryTaskState<"cancelled"> | (UnstalledStateFields & NonFailedStateFields & {
|
|
209
|
+
state: "running";
|
|
210
|
+
waitingForMessages?: boolean;
|
|
211
|
+
needsHumanAction?: never;
|
|
212
|
+
needsHumanNotifiedAt?: never;
|
|
213
|
+
workResult?: TaskWorkResult;
|
|
214
|
+
}) | (InactiveStateFields & NonFailedStateFields & {
|
|
215
|
+
state: "stalled";
|
|
216
|
+
stalledAt?: string;
|
|
217
|
+
stalledReason?: string;
|
|
218
|
+
workResult?: TaskWorkResult;
|
|
219
|
+
}) | (InactiveStateFields & UnstalledStateFields & {
|
|
220
|
+
state: "failed";
|
|
221
|
+
failureReceiptId?: NonNullable<TaskRecord["failureReceiptId"]>;
|
|
222
|
+
workResult?: TaskWorkResult;
|
|
223
|
+
}) | (InactiveStateFields & UnstalledStateFields & NonFailedStateFields & {
|
|
224
|
+
state: "succeeded";
|
|
225
|
+
workResult: TaskWorkResult;
|
|
226
|
+
});
|
|
227
|
+
type NeedsHumanTaskState = UnstalledStateFields & NonFailedStateFields & {
|
|
228
|
+
state: "needs_human";
|
|
229
|
+
waitingForMessages?: false;
|
|
230
|
+
needsHumanAction: string;
|
|
231
|
+
needsHumanNotifiedAt?: string;
|
|
232
|
+
workResult?: TaskWorkResult;
|
|
233
|
+
};
|
|
234
|
+
/** Canonical durable snapshot of one explicitly versioned unit of workflow work. */
|
|
235
|
+
type Task = TaskCommon & ((OrdinaryTaskState & TaskQuestionContext) | (NeedsHumanTaskState & (TaskWithQuestion<UnansweredTaskQuestion> | TaskWithLinkedQuestion)));
|
|
236
|
+
/** Validates the canonical durable snapshot of one unit of workflow work. */
|
|
237
|
+
declare const taskSchema: SchemaWithOutput<typeof taskRecordSchema, Task>;
|
|
238
|
+
/** Human approval status recorded on a Task when policy requires a decision. */
|
|
239
|
+
type TaskApproval = z.infer<typeof taskApprovalSchema>;
|
|
240
|
+
/** Signal or operator provenance retained independently from Task graph parentage. */
|
|
241
|
+
type TaskOrigin = z.infer<typeof taskOriginSchema>;
|
|
242
|
+
/** Human question, suggested replies, and optional authenticated answer. */
|
|
243
|
+
type TaskQuestion = z.infer<typeof taskQuestionSchema>;
|
|
244
|
+
/** Fixed lifecycle state controlled through the canonical Task transition table. */
|
|
245
|
+
type TaskState = z.infer<typeof taskStateSchema>;
|
|
246
|
+
/** Task-local measured model usage with idempotent per-step accounting. */
|
|
247
|
+
type TaskUsage = z.infer<typeof taskUsageSchema>;
|
|
248
|
+
/** Opaque provider-owned execution handle for the current Task attempt. */
|
|
249
|
+
type ExecutionReference = z.infer<typeof executionReferenceSchema>;
|
|
250
|
+
/** Succeeded Task narrowed to its required validated workflow result. */
|
|
251
|
+
type SucceededTask = Extract<Task, {
|
|
252
|
+
state: "succeeded";
|
|
253
|
+
}>;
|
|
254
|
+
/** Human-blocked Task narrowed to its required actionable description. */
|
|
255
|
+
type NeedsHumanTask = Extract<Task, {
|
|
256
|
+
state: "needs_human";
|
|
257
|
+
}>;
|
|
258
|
+
/** Running Task narrowed to its explicit message-waiting marker. */
|
|
259
|
+
type MessageWaitingTask = Extract<Task, {
|
|
260
|
+
state: "running";
|
|
261
|
+
}> & {
|
|
262
|
+
waitingForMessages: true;
|
|
263
|
+
};
|
|
264
|
+
/** Narrows a validated Task after checking its succeeded-state invariant. */
|
|
265
|
+
declare function isSucceededTask(task: Task): task is SucceededTask;
|
|
266
|
+
/** Narrows a validated Task after checking its human-action invariant. */
|
|
267
|
+
declare function isNeedsHumanTask(task: Task): task is NeedsHumanTask;
|
|
268
|
+
/** Narrows a validated Task to running work deliberately waiting for messages. */
|
|
269
|
+
declare function isMessageWaitingTask(task: Task): task is MessageWaitingTask;
|
|
270
|
+
//#endregion
|
|
271
|
+
export { ExecutionReference, MessageWaitingTask, NeedsHumanTask, SucceededTask, Task, TaskApproval, TaskKind, TaskOrigin, TaskQuestion, TaskState, TaskUsage, executionReferenceSchema, harnessSchema, isMessageWaitingTask, isNeedsHumanTask, isSucceededTask, standardTaskKinds, taskApprovalSchema, taskExecutionRepositoryIdsSchema, taskKindSchema, taskOriginSchema, taskQuestionSchema, taskSchema, taskStateSchema, taskUsageSchema };
|
|
272
|
+
//# sourceMappingURL=task.d.mts.map
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { answerIdSchema, changeIdSchema, receiptIdSchema, repositoryIdSchema, repositoryIdsSchema, signalIdSchema, taskIdSchema } from "./id.mjs";
|
|
2
|
+
import { isoDateTimeSchema, replyToSchema, schemaVersionSchema, usdSchema, vocabularySchema } from "./common.mjs";
|
|
3
|
+
import { taskWorkResultSchema, taskWorkSchema, workflowBindingSchema } from "./work.mjs";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
//#region src/schema/task.ts
|
|
6
|
+
/** Descriptive labels used by the reference workflows, not core lifecycle rules. */
|
|
7
|
+
const standardTaskKinds = [
|
|
8
|
+
"coordination",
|
|
9
|
+
"code_change",
|
|
10
|
+
"verification",
|
|
11
|
+
"investigation",
|
|
12
|
+
"question"
|
|
13
|
+
];
|
|
14
|
+
/** Validates the descriptive, open-vocabulary label attached to a Task. */
|
|
15
|
+
const taskKindSchema = vocabularySchema.describe("What kind of work this is, e.g. code_change, question, or a registered custom kind.");
|
|
16
|
+
/** Validates the fixed lifecycle state of a Task. */
|
|
17
|
+
const taskStateSchema = z.enum([
|
|
18
|
+
"queued",
|
|
19
|
+
"running",
|
|
20
|
+
"stalled",
|
|
21
|
+
"verifying",
|
|
22
|
+
"succeeded",
|
|
23
|
+
"failed",
|
|
24
|
+
"needs_human",
|
|
25
|
+
"cancelled"
|
|
26
|
+
]).describe("Lifecycle state. Transitions are fixed; see taskTransitions.");
|
|
27
|
+
/** Validates whether a Task requires, received, or was denied human approval. */
|
|
28
|
+
const taskApprovalSchema = z.enum([
|
|
29
|
+
"required",
|
|
30
|
+
"granted",
|
|
31
|
+
"denied"
|
|
32
|
+
]).describe("Human approval status. Absent means no approval is needed. Stamped required at creation by policy; granted or denied by an operator.");
|
|
33
|
+
/** Validates the single-repository scope required by supplied execution adapters. */
|
|
34
|
+
const taskExecutionRepositoryIdsSchema = z.tuple([repositoryIdSchema]).readonly().describe("The one repository used to execute a task.");
|
|
35
|
+
/** Validates Task provenance independently from graph parentage. */
|
|
36
|
+
const taskOriginSchema = z.strictObject({
|
|
37
|
+
signalId: signalIdSchema.optional().describe("Signal that led to this task."),
|
|
38
|
+
operator: z.string().min(1).optional().describe("Human operator who requested it.")
|
|
39
|
+
}).describe("Task provenance; an empty child creation origin inherits its parent's provenance.");
|
|
40
|
+
/** Validates the configured coding-harness identifier retained with an execution. */
|
|
41
|
+
const harnessSchema = z.string().min(1).describe("Coding harness running inside the execution environment, e.g. claude-code or codex.");
|
|
42
|
+
/**
|
|
43
|
+
* The provider's handle on the current attempt's execution. Opaque to the
|
|
44
|
+
* lifecycle: Factory records it so the execution can be inspected or
|
|
45
|
+
* cancelled, never to mirror the provider's own state machine.
|
|
46
|
+
*/
|
|
47
|
+
const executionReferenceSchema = z.strictObject({
|
|
48
|
+
provider: z.string().min(1).describe("Execution provider, e.g. eve."),
|
|
49
|
+
sessionId: z.string().min(1).describe("Provider-side session running this attempt."),
|
|
50
|
+
environmentId: z.string().min(1).optional().describe("Provider-side execution environment."),
|
|
51
|
+
harness: harnessSchema.optional(),
|
|
52
|
+
traceId: z.string().min(1).optional().describe("Provider-side trace for this execution.")
|
|
53
|
+
});
|
|
54
|
+
const tokenCountSchema = z.number().int().nonnegative();
|
|
55
|
+
/** Validates Task-local measured usage and per-turn step deduplication state. */
|
|
56
|
+
const taskUsageSchema = z.strictObject({
|
|
57
|
+
costUsd: usdSchema.describe("AI Gateway cost summed over recorded steps."),
|
|
58
|
+
inputTokens: tokenCountSchema,
|
|
59
|
+
outputTokens: tokenCountSchema,
|
|
60
|
+
cacheReadTokens: tokenCountSchema,
|
|
61
|
+
cacheWriteTokens: tokenCountSchema,
|
|
62
|
+
steps: z.record(z.string().min(1), tokenCountSchema).describe("Highest recorded stepIndex per turnId; steps at or below it are already counted.")
|
|
63
|
+
});
|
|
64
|
+
/** Validates a human question, suggested replies, and any authenticated answer. */
|
|
65
|
+
const taskQuestionSchema = z.strictObject({
|
|
66
|
+
text: z.string().min(1).describe("The input or action requested from a human before work can resume."),
|
|
67
|
+
options: z.array(z.string().min(1)).readonly().describe("Suggested replies; free-text is also allowed."),
|
|
68
|
+
/**
|
|
69
|
+
* Options (matched case-insensitively, trimmed) whose exact answer means
|
|
70
|
+
* "this task no longer needs a fresh attempt": the asker judged that no
|
|
71
|
+
* amount of retrying can succeed once this reply is chosen. Answering with
|
|
72
|
+
* one of these resolves the parent task instead of requeuing it. Answers
|
|
73
|
+
* outside this set keep the existing retry behavior.
|
|
74
|
+
*/
|
|
75
|
+
closingOptions: z.array(z.string().min(1)).max(20).readonly().optional().describe("Subset of options whose exact answer resolves the task instead of requeuing a fresh attempt."),
|
|
76
|
+
answer: z.string().min(1).optional(),
|
|
77
|
+
answeredBy: z.string().min(1).optional().describe("Authenticated operator who answered.")
|
|
78
|
+
});
|
|
79
|
+
/** Validates the canonical durable snapshot of one unit of workflow work. */
|
|
80
|
+
const taskSchema = z.strictObject({
|
|
81
|
+
schemaVersion: schemaVersionSchema,
|
|
82
|
+
id: taskIdSchema,
|
|
83
|
+
repositoryIds: repositoryIdsSchema.describe("Repositories the task concerns."),
|
|
84
|
+
kind: taskKindSchema,
|
|
85
|
+
area: z.string().min(1).optional().describe("Workflow-specific area, e.g. onboarding or security."),
|
|
86
|
+
state: taskStateSchema,
|
|
87
|
+
approval: taskApprovalSchema.optional(),
|
|
88
|
+
origin: taskOriginSchema,
|
|
89
|
+
work: taskWorkSchema.describe("Required versioned workflow contract for this Task."),
|
|
90
|
+
workResult: taskWorkResultSchema.optional().describe("Validated canonical workflow result."),
|
|
91
|
+
waitingForMessages: z.boolean().optional().describe("Whether work is waiting for messages; true only while running."),
|
|
92
|
+
workflowPhase: workflowBindingSchema.shape.id.optional().describe("Workflow-owned lowercase hyphenated or snake_case phase, at most 64 characters."),
|
|
93
|
+
rootTaskId: taskIdSchema.describe("Root of the task graph; equal to id for a root task."),
|
|
94
|
+
parentTaskId: taskIdSchema.optional().describe("Single owning parent task; cannot reference the task itself."),
|
|
95
|
+
parentTaskAttempt: z.number().int().positive().optional().describe("Parent execution attempt that raised this question; a new parent attempt requires a new question."),
|
|
96
|
+
replyTo: replyToSchema,
|
|
97
|
+
pendingCommunicationReceiptIds: z.array(receiptIdSchema).readonly().optional().describe("Transition receipts that still need to be projected into the communication outbox."),
|
|
98
|
+
failureReceiptId: receiptIdSchema.optional().describe("Committed failure receipt for the current failed attempt; independent of delivery bookkeeping."),
|
|
99
|
+
attempt: z.number().int().min(1).describe("Execution attempt, starting at 1; bumps on retry."),
|
|
100
|
+
execution: executionReferenceSchema.optional().describe("Execution of the current attempt, recorded at dispatch and replaced on retry."),
|
|
101
|
+
lastProgressAt: isoDateTimeSchema.optional().describe("Last time the execution demonstrably advanced: dispatch, or a completed model step."),
|
|
102
|
+
stalledAt: isoDateTimeSchema.optional().describe("When the reconciler marked the task stalled."),
|
|
103
|
+
stalledReason: z.string().min(1).optional().describe("Why the task was marked stalled."),
|
|
104
|
+
needsHumanAction: z.string().min(1).optional().describe("Actionable, human-facing description of what a human must do before this task can proceed. Required exactly while state is needs_human; every needs_human transition must carry one."),
|
|
105
|
+
needsHumanNotifiedAt: isoDateTimeSchema.optional().describe("When Slack confirmed delivery of the needs_human notification for the current needs_human episode. Absent while delivery is still retrying."),
|
|
106
|
+
reservedUsd: usdSchema.optional().describe("Budget reserved before dispatch."),
|
|
107
|
+
reservedAt: isoDateTimeSchema.optional().describe("When the reservation was stamped; attributes spend to a budget month."),
|
|
108
|
+
usage: taskUsageSchema.optional().describe("Measured model usage, accumulated per step by recordUsage and settled into settledUsd."),
|
|
109
|
+
settledUsd: usdSchema.optional().describe("Measured cost settled after execution. A task settles once and cannot be retried after settlement."),
|
|
110
|
+
question: taskQuestionSchema.optional(),
|
|
111
|
+
questionTaskId: taskIdSchema.optional().describe("Open QuestionTask blocking this executable task, stored for direct answer routing."),
|
|
112
|
+
answerEventIds: z.array(answerIdSchema).readonly().optional().describe("Immutable answer events projected onto this task for direct replay."),
|
|
113
|
+
changeId: changeIdSchema.optional().describe("Change this executable task concerns or produces."),
|
|
114
|
+
reportRef: z.string().min(1).optional().describe("Reference to the report artifact an investigation produced."),
|
|
115
|
+
createdAt: isoDateTimeSchema,
|
|
116
|
+
updatedAt: isoDateTimeSchema
|
|
117
|
+
}).superRefine((task, ctx) => {
|
|
118
|
+
if (task.failureReceiptId !== void 0 && task.state !== "failed") ctx.addIssue({
|
|
119
|
+
code: "custom",
|
|
120
|
+
path: ["failureReceiptId"],
|
|
121
|
+
message: "failureReceiptId is only valid while the task is failed"
|
|
122
|
+
});
|
|
123
|
+
if (task.state !== "stalled" && (task.stalledAt !== void 0 || task.stalledReason !== void 0)) ctx.addIssue({
|
|
124
|
+
code: "custom",
|
|
125
|
+
path: ["stalledAt"],
|
|
126
|
+
message: "stalledAt and stalledReason are only valid while the task is stalled"
|
|
127
|
+
});
|
|
128
|
+
if (task.state === "needs_human" && (task.needsHumanAction === void 0 || task.needsHumanAction.trim() === "")) ctx.addIssue({
|
|
129
|
+
code: "custom",
|
|
130
|
+
path: ["needsHumanAction"],
|
|
131
|
+
message: "needs_human requires a populated, actionable needsHumanAction for a human reader"
|
|
132
|
+
});
|
|
133
|
+
if (task.state !== "needs_human" && (task.needsHumanAction !== void 0 || task.needsHumanNotifiedAt !== void 0)) ctx.addIssue({
|
|
134
|
+
code: "custom",
|
|
135
|
+
path: ["needsHumanAction"],
|
|
136
|
+
message: "needsHumanAction and needsHumanNotifiedAt are only valid while the task is needs_human"
|
|
137
|
+
});
|
|
138
|
+
if (task.state === "needs_human" && (task.question === void 0 && task.questionTaskId === void 0 || task.question !== void 0 && (task.question.answer !== void 0 || task.question.answeredBy !== void 0))) ctx.addIssue({
|
|
139
|
+
code: "custom",
|
|
140
|
+
path: ["question"],
|
|
141
|
+
message: "needs_human requires an unanswered question or a linked open QuestionTask"
|
|
142
|
+
});
|
|
143
|
+
if (task.question !== void 0 && task.questionTaskId !== void 0) ctx.addIssue({
|
|
144
|
+
code: "custom",
|
|
145
|
+
path: ["questionTaskId"],
|
|
146
|
+
message: "A task cannot both ask a question and be blocked by another question"
|
|
147
|
+
});
|
|
148
|
+
if (task.parentTaskAttempt !== void 0 && (task.parentTaskId === void 0 || task.question === void 0)) ctx.addIssue({
|
|
149
|
+
code: "custom",
|
|
150
|
+
path: ["parentTaskAttempt"],
|
|
151
|
+
message: "parentTaskAttempt binds a child question to its parent's execution attempt"
|
|
152
|
+
});
|
|
153
|
+
if (task.parentTaskId === task.id) ctx.addIssue({
|
|
154
|
+
code: "custom",
|
|
155
|
+
path: ["parentTaskId"],
|
|
156
|
+
message: "parentTaskId cannot reference the task itself"
|
|
157
|
+
});
|
|
158
|
+
if (task.parentTaskId === void 0 && task.rootTaskId !== task.id) ctx.addIssue({
|
|
159
|
+
code: "custom",
|
|
160
|
+
path: ["rootTaskId"],
|
|
161
|
+
message: "Root tasks must use their own id as rootTaskId"
|
|
162
|
+
});
|
|
163
|
+
if (task.parentTaskId !== void 0 && task.rootTaskId === task.id) ctx.addIssue({
|
|
164
|
+
code: "custom",
|
|
165
|
+
path: ["rootTaskId"],
|
|
166
|
+
message: "Child tasks cannot use their own id as rootTaskId"
|
|
167
|
+
});
|
|
168
|
+
if (task.parentTaskId === void 0 && task.origin.signalId === void 0 && task.origin.operator === void 0) ctx.addIssue({
|
|
169
|
+
code: "custom",
|
|
170
|
+
path: ["origin"],
|
|
171
|
+
message: "Root task origin requires a signalId or operator"
|
|
172
|
+
});
|
|
173
|
+
if (task.waitingForMessages === true && task.state !== "running") ctx.addIssue({
|
|
174
|
+
code: "custom",
|
|
175
|
+
path: ["waitingForMessages"],
|
|
176
|
+
message: "waitingForMessages can only be true while work is running"
|
|
177
|
+
});
|
|
178
|
+
if (task.state === "succeeded" && task.workResult === void 0) ctx.addIssue({
|
|
179
|
+
code: "custom",
|
|
180
|
+
path: ["workResult"],
|
|
181
|
+
message: "Succeeded tasks require a validated workflow result"
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
/** Narrows a validated Task after checking its succeeded-state invariant. */
|
|
185
|
+
function isSucceededTask(task) {
|
|
186
|
+
return task.state === "succeeded" && task.workResult !== void 0;
|
|
187
|
+
}
|
|
188
|
+
/** Narrows a validated Task after checking its human-action invariant. */
|
|
189
|
+
function isNeedsHumanTask(task) {
|
|
190
|
+
return task.state === "needs_human" && task.needsHumanAction !== void 0;
|
|
191
|
+
}
|
|
192
|
+
/** Narrows a validated Task to running work deliberately waiting for messages. */
|
|
193
|
+
function isMessageWaitingTask(task) {
|
|
194
|
+
return task.state === "running" && task.waitingForMessages === true;
|
|
195
|
+
}
|
|
196
|
+
//#endregion
|
|
197
|
+
export { executionReferenceSchema, harnessSchema, isMessageWaitingTask, isNeedsHumanTask, isSucceededTask, standardTaskKinds, taskApprovalSchema, taskExecutionRepositoryIdsSchema, taskKindSchema, taskOriginSchema, taskQuestionSchema, taskSchema, taskStateSchema, taskUsageSchema };
|
|
198
|
+
|
|
199
|
+
//# sourceMappingURL=task.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.mjs","names":[],"sources":["../../src/schema/task.ts"],"sourcesContent":["import { z } from \"zod\";\nimport {\n isoDateTimeSchema,\n replyToSchema,\n schemaVersionSchema,\n usdSchema,\n vocabularySchema,\n} from \"./common\";\nimport {\n answerIdSchema,\n changeIdSchema,\n receiptIdSchema,\n repositoryIdSchema,\n repositoryIdsSchema,\n signalIdSchema,\n taskIdSchema,\n} from \"./id\";\nimport { taskWorkResultSchema, taskWorkSchema, workflowBindingSchema } from \"./work\";\n\n/** Descriptive labels used by the reference workflows, not core lifecycle rules. */\nexport const standardTaskKinds = [\n \"coordination\",\n \"code_change\",\n \"verification\",\n \"investigation\",\n \"question\",\n] as const;\n\n/** Standard Task kinds with support for caller-defined vocabulary values. */\nexport type TaskKind = (typeof standardTaskKinds)[number] | (string & Record<never, never>);\n\n/** Validates the descriptive, open-vocabulary label attached to a Task. */\nexport const taskKindSchema = vocabularySchema.describe(\n \"What kind of work this is, e.g. code_change, question, or a registered custom kind.\",\n) as z.ZodType<TaskKind>;\n\n/** Validates the fixed lifecycle state of a Task. */\nexport const taskStateSchema = z\n .enum([\n \"queued\",\n \"running\",\n \"stalled\",\n \"verifying\",\n \"succeeded\",\n \"failed\",\n \"needs_human\",\n \"cancelled\",\n ])\n .describe(\"Lifecycle state. Transitions are fixed; see taskTransitions.\");\n\n/** Validates whether a Task requires, received, or was denied human approval. */\nexport const taskApprovalSchema = z\n .enum([\"required\", \"granted\", \"denied\"])\n .describe(\n \"Human approval status. Absent means no approval is needed. Stamped required at creation by policy; granted or denied by an operator.\",\n );\n\n/** Validates the single-repository scope required by supplied execution adapters. */\nexport const taskExecutionRepositoryIdsSchema = z\n .tuple([repositoryIdSchema])\n .readonly()\n .describe(\"The one repository used to execute a task.\");\n\n/** Validates Task provenance independently from graph parentage. */\nexport const taskOriginSchema = z\n .strictObject({\n signalId: signalIdSchema.optional().describe(\"Signal that led to this task.\"),\n operator: z.string().min(1).optional().describe(\"Human operator who requested it.\"),\n })\n .describe(\"Task provenance; an empty child creation origin inherits its parent's provenance.\");\n\n/** Validates the configured coding-harness identifier retained with an execution. */\nexport const harnessSchema = z\n .string()\n .min(1)\n .describe(\"Coding harness running inside the execution environment, e.g. claude-code or codex.\");\n\n/**\n * The provider's handle on the current attempt's execution. Opaque to the\n * lifecycle: Factory records it so the execution can be inspected or\n * cancelled, never to mirror the provider's own state machine.\n */\nexport const executionReferenceSchema = z.strictObject({\n provider: z.string().min(1).describe(\"Execution provider, e.g. eve.\"),\n sessionId: z.string().min(1).describe(\"Provider-side session running this attempt.\"),\n environmentId: z.string().min(1).optional().describe(\"Provider-side execution environment.\"),\n harness: harnessSchema.optional(),\n traceId: z.string().min(1).optional().describe(\"Provider-side trace for this execution.\"),\n});\n\nconst tokenCountSchema = z.number().int().nonnegative();\n\n/** Validates Task-local measured usage and per-turn step deduplication state. */\nexport const taskUsageSchema = z.strictObject({\n costUsd: usdSchema.describe(\"AI Gateway cost summed over recorded steps.\"),\n inputTokens: tokenCountSchema,\n outputTokens: tokenCountSchema,\n cacheReadTokens: tokenCountSchema,\n cacheWriteTokens: tokenCountSchema,\n steps: z\n .record(z.string().min(1), tokenCountSchema)\n .describe(\"Highest recorded stepIndex per turnId; steps at or below it are already counted.\"),\n});\n\n/** Validates a human question, suggested replies, and any authenticated answer. */\nexport const taskQuestionSchema = z.strictObject({\n text: z\n .string()\n .min(1)\n .describe(\"The input or action requested from a human before work can resume.\"),\n options: z\n .array(z.string().min(1))\n .readonly()\n .describe(\"Suggested replies; free-text is also allowed.\"),\n /**\n * Options (matched case-insensitively, trimmed) whose exact answer means\n * \"this task no longer needs a fresh attempt\": the asker judged that no\n * amount of retrying can succeed once this reply is chosen. Answering with\n * one of these resolves the parent task instead of requeuing it. Answers\n * outside this set keep the existing retry behavior.\n */\n closingOptions: z\n .array(z.string().min(1))\n .max(20)\n .readonly()\n .optional()\n .describe(\n \"Subset of options whose exact answer resolves the task instead of requeuing a fresh attempt.\",\n ),\n answer: z.string().min(1).optional(),\n answeredBy: z.string().min(1).optional().describe(\"Authenticated operator who answered.\"),\n});\n\n/** Validates the canonical durable snapshot of one unit of workflow work. */\nconst taskRecordSchema = z\n .strictObject({\n schemaVersion: schemaVersionSchema,\n id: taskIdSchema,\n repositoryIds: repositoryIdsSchema.describe(\"Repositories the task concerns.\"),\n kind: taskKindSchema,\n area: z\n .string()\n .min(1)\n .optional()\n .describe(\"Workflow-specific area, e.g. onboarding or security.\"),\n state: taskStateSchema,\n approval: taskApprovalSchema.optional(),\n origin: taskOriginSchema,\n work: taskWorkSchema.describe(\"Required versioned workflow contract for this Task.\"),\n workResult: taskWorkResultSchema.optional().describe(\"Validated canonical workflow result.\"),\n waitingForMessages: z\n .boolean()\n .optional()\n .describe(\"Whether work is waiting for messages; true only while running.\"),\n workflowPhase: workflowBindingSchema.shape.id\n .optional()\n .describe(\"Workflow-owned lowercase hyphenated or snake_case phase, at most 64 characters.\"),\n rootTaskId: taskIdSchema.describe(\"Root of the task graph; equal to id for a root task.\"),\n parentTaskId: taskIdSchema\n .optional()\n .describe(\"Single owning parent task; cannot reference the task itself.\"),\n parentTaskAttempt: z\n .number()\n .int()\n .positive()\n .optional()\n .describe(\n \"Parent execution attempt that raised this question; a new parent attempt requires a new question.\",\n ),\n replyTo: replyToSchema,\n pendingCommunicationReceiptIds: z\n .array(receiptIdSchema)\n .readonly()\n .optional()\n .describe(\n \"Transition receipts that still need to be projected into the communication outbox.\",\n ),\n failureReceiptId: receiptIdSchema\n .optional()\n .describe(\n \"Committed failure receipt for the current failed attempt; independent of delivery bookkeeping.\",\n ),\n attempt: z.number().int().min(1).describe(\"Execution attempt, starting at 1; bumps on retry.\"),\n execution: executionReferenceSchema\n .optional()\n .describe(\"Execution of the current attempt, recorded at dispatch and replaced on retry.\"),\n lastProgressAt: isoDateTimeSchema\n .optional()\n .describe(\n \"Last time the execution demonstrably advanced: dispatch, or a completed model step.\",\n ),\n stalledAt: isoDateTimeSchema\n .optional()\n .describe(\"When the reconciler marked the task stalled.\"),\n stalledReason: z.string().min(1).optional().describe(\"Why the task was marked stalled.\"),\n needsHumanAction: z\n .string()\n .min(1)\n .optional()\n .describe(\n \"Actionable, human-facing description of what a human must do before this task can proceed. Required exactly while state is needs_human; every needs_human transition must carry one.\",\n ),\n needsHumanNotifiedAt: isoDateTimeSchema\n .optional()\n .describe(\n \"When Slack confirmed delivery of the needs_human notification for the current needs_human episode. Absent while delivery is still retrying.\",\n ),\n reservedUsd: usdSchema.optional().describe(\"Budget reserved before dispatch.\"),\n reservedAt: isoDateTimeSchema\n .optional()\n .describe(\"When the reservation was stamped; attributes spend to a budget month.\"),\n usage: taskUsageSchema\n .optional()\n .describe(\n \"Measured model usage, accumulated per step by recordUsage and settled into settledUsd.\",\n ),\n settledUsd: usdSchema\n .optional()\n .describe(\n \"Measured cost settled after execution. A task settles once and cannot be retried after settlement.\",\n ),\n question: taskQuestionSchema.optional(),\n questionTaskId: taskIdSchema\n .optional()\n .describe(\n \"Open QuestionTask blocking this executable task, stored for direct answer routing.\",\n ),\n answerEventIds: z\n .array(answerIdSchema)\n .readonly()\n .optional()\n .describe(\"Immutable answer events projected onto this task for direct replay.\"),\n changeId: changeIdSchema\n .optional()\n .describe(\"Change this executable task concerns or produces.\"),\n reportRef: z\n .string()\n .min(1)\n .optional()\n .describe(\"Reference to the report artifact an investigation produced.\"),\n createdAt: isoDateTimeSchema,\n updatedAt: isoDateTimeSchema,\n })\n .superRefine((task, ctx) => {\n if (task.failureReceiptId !== undefined && task.state !== \"failed\") {\n ctx.addIssue({\n code: \"custom\",\n path: [\"failureReceiptId\"],\n message: \"failureReceiptId is only valid while the task is failed\",\n });\n }\n if (\n task.state !== \"stalled\" &&\n (task.stalledAt !== undefined || task.stalledReason !== undefined)\n ) {\n ctx.addIssue({\n code: \"custom\",\n path: [\"stalledAt\"],\n message: \"stalledAt and stalledReason are only valid while the task is stalled\",\n });\n }\n if (\n task.state === \"needs_human\" &&\n (task.needsHumanAction === undefined || task.needsHumanAction.trim() === \"\")\n ) {\n ctx.addIssue({\n code: \"custom\",\n path: [\"needsHumanAction\"],\n message: \"needs_human requires a populated, actionable needsHumanAction for a human reader\",\n });\n }\n if (\n task.state !== \"needs_human\" &&\n (task.needsHumanAction !== undefined || task.needsHumanNotifiedAt !== undefined)\n ) {\n ctx.addIssue({\n code: \"custom\",\n path: [\"needsHumanAction\"],\n message:\n \"needsHumanAction and needsHumanNotifiedAt are only valid while the task is needs_human\",\n });\n }\n if (\n task.state === \"needs_human\" &&\n ((task.question === undefined && task.questionTaskId === undefined) ||\n (task.question !== undefined &&\n (task.question.answer !== undefined || task.question.answeredBy !== undefined)))\n ) {\n ctx.addIssue({\n code: \"custom\",\n path: [\"question\"],\n message: \"needs_human requires an unanswered question or a linked open QuestionTask\",\n });\n }\n if (task.question !== undefined && task.questionTaskId !== undefined) {\n ctx.addIssue({\n code: \"custom\",\n path: [\"questionTaskId\"],\n message: \"A task cannot both ask a question and be blocked by another question\",\n });\n }\n if (\n task.parentTaskAttempt !== undefined &&\n (task.parentTaskId === undefined || task.question === undefined)\n ) {\n ctx.addIssue({\n code: \"custom\",\n path: [\"parentTaskAttempt\"],\n message: \"parentTaskAttempt binds a child question to its parent's execution attempt\",\n });\n }\n if (task.parentTaskId === task.id) {\n ctx.addIssue({\n code: \"custom\",\n path: [\"parentTaskId\"],\n message: \"parentTaskId cannot reference the task itself\",\n });\n }\n if (task.parentTaskId === undefined && task.rootTaskId !== task.id) {\n ctx.addIssue({\n code: \"custom\",\n path: [\"rootTaskId\"],\n message: \"Root tasks must use their own id as rootTaskId\",\n });\n }\n if (task.parentTaskId !== undefined && task.rootTaskId === task.id) {\n ctx.addIssue({\n code: \"custom\",\n path: [\"rootTaskId\"],\n message: \"Child tasks cannot use their own id as rootTaskId\",\n });\n }\n if (\n task.parentTaskId === undefined &&\n task.origin.signalId === undefined &&\n task.origin.operator === undefined\n ) {\n ctx.addIssue({\n code: \"custom\",\n path: [\"origin\"],\n message: \"Root task origin requires a signalId or operator\",\n });\n }\n if (task.waitingForMessages === true && task.state !== \"running\") {\n ctx.addIssue({\n code: \"custom\",\n path: [\"waitingForMessages\"],\n message: \"waitingForMessages can only be true while work is running\",\n });\n }\n if (task.state === \"succeeded\" && task.workResult === undefined) {\n ctx.addIssue({\n code: \"custom\",\n path: [\"workResult\"],\n message: \"Succeeded tasks require a validated workflow result\",\n });\n }\n });\n\ntype TaskRecord = z.infer<typeof taskRecordSchema>;\ntype SchemaWithOutput<Schema extends z.ZodType, Output> = Omit<Schema, keyof z.ZodType> &\n z.ZodType<Output, z.input<Schema>>;\ntype TaskStateField =\n | \"state\"\n | \"workResult\"\n | \"waitingForMessages\"\n | \"failureReceiptId\"\n | \"stalledAt\"\n | \"stalledReason\"\n | \"needsHumanAction\"\n | \"needsHumanNotifiedAt\";\ntype TaskQuestionField = \"question\" | \"questionTaskId\" | \"parentTaskAttempt\" | \"parentTaskId\";\ntype TaskCommon = Omit<TaskRecord, TaskStateField | TaskQuestionField>;\ntype TaskIdValue = NonNullable<TaskRecord[\"parentTaskId\"]>;\ntype TaskWorkResult = NonNullable<TaskRecord[\"workResult\"]>;\n\ntype TaskWithoutQuestion = {\n question?: never;\n questionTaskId?: never;\n parentTaskAttempt?: never;\n parentTaskId?: TaskIdValue;\n};\n\ntype TaskWithQuestion<Question extends TaskRecord[\"question\"]> =\n | {\n question: Question;\n questionTaskId?: never;\n parentTaskAttempt?: never;\n parentTaskId?: TaskIdValue;\n }\n | {\n question: Question;\n questionTaskId?: never;\n parentTaskAttempt: number;\n parentTaskId: TaskIdValue;\n };\n\ntype TaskWithLinkedQuestion = {\n question?: never;\n questionTaskId: TaskIdValue;\n parentTaskAttempt?: never;\n parentTaskId?: TaskIdValue;\n};\n\ntype TaskQuestionContext =\n | TaskWithoutQuestion\n | TaskWithQuestion<NonNullable<TaskRecord[\"question\"]>>\n | TaskWithLinkedQuestion;\n\ntype UnansweredTaskQuestion = Omit<NonNullable<TaskRecord[\"question\"]>, \"answer\" | \"answeredBy\"> & {\n answer?: never;\n answeredBy?: never;\n};\n\ntype InactiveStateFields = {\n waitingForMessages?: false;\n needsHumanAction?: never;\n needsHumanNotifiedAt?: never;\n};\n\ntype UnstalledStateFields = {\n stalledAt?: never;\n stalledReason?: never;\n};\n\ntype NonFailedStateFields = {\n failureReceiptId?: never;\n};\n\ntype InactiveOrdinaryTaskState<State extends \"queued\" | \"verifying\" | \"cancelled\"> =\n InactiveStateFields &\n UnstalledStateFields &\n NonFailedStateFields & {\n state: State;\n workResult?: TaskWorkResult;\n };\n\ntype OrdinaryTaskState =\n | InactiveOrdinaryTaskState<\"queued\">\n | InactiveOrdinaryTaskState<\"verifying\">\n | InactiveOrdinaryTaskState<\"cancelled\">\n | (UnstalledStateFields &\n NonFailedStateFields & {\n state: \"running\";\n waitingForMessages?: boolean;\n needsHumanAction?: never;\n needsHumanNotifiedAt?: never;\n workResult?: TaskWorkResult;\n })\n | (InactiveStateFields &\n NonFailedStateFields & {\n state: \"stalled\";\n stalledAt?: string;\n stalledReason?: string;\n workResult?: TaskWorkResult;\n })\n | (InactiveStateFields &\n UnstalledStateFields & {\n state: \"failed\";\n failureReceiptId?: NonNullable<TaskRecord[\"failureReceiptId\"]>;\n workResult?: TaskWorkResult;\n })\n | (InactiveStateFields &\n UnstalledStateFields &\n NonFailedStateFields & {\n state: \"succeeded\";\n workResult: TaskWorkResult;\n });\n\ntype NeedsHumanTaskState = UnstalledStateFields &\n NonFailedStateFields & {\n state: \"needs_human\";\n waitingForMessages?: false;\n needsHumanAction: string;\n needsHumanNotifiedAt?: string;\n workResult?: TaskWorkResult;\n };\n\n/** Canonical durable snapshot of one explicitly versioned unit of workflow work. */\nexport type Task = TaskCommon &\n (\n | (OrdinaryTaskState & TaskQuestionContext)\n | (NeedsHumanTaskState & (TaskWithQuestion<UnansweredTaskQuestion> | TaskWithLinkedQuestion))\n );\n\n/** Validates the canonical durable snapshot of one unit of workflow work. */\nexport const taskSchema = taskRecordSchema as SchemaWithOutput<typeof taskRecordSchema, Task>;\n\n/** Human approval status recorded on a Task when policy requires a decision. */\nexport type TaskApproval = z.infer<typeof taskApprovalSchema>;\n/** Signal or operator provenance retained independently from Task graph parentage. */\nexport type TaskOrigin = z.infer<typeof taskOriginSchema>;\n/** Human question, suggested replies, and optional authenticated answer. */\nexport type TaskQuestion = z.infer<typeof taskQuestionSchema>;\n/** Fixed lifecycle state controlled through the canonical Task transition table. */\nexport type TaskState = z.infer<typeof taskStateSchema>;\n/** Task-local measured model usage with idempotent per-step accounting. */\nexport type TaskUsage = z.infer<typeof taskUsageSchema>;\n/** Opaque provider-owned execution handle for the current Task attempt. */\nexport type ExecutionReference = z.infer<typeof executionReferenceSchema>;\n/** Succeeded Task narrowed to its required validated workflow result. */\nexport type SucceededTask = Extract<Task, { state: \"succeeded\" }>;\n/** Human-blocked Task narrowed to its required actionable description. */\nexport type NeedsHumanTask = Extract<Task, { state: \"needs_human\" }>;\n/** Running Task narrowed to its explicit message-waiting marker. */\nexport type MessageWaitingTask = Extract<Task, { state: \"running\" }> & {\n waitingForMessages: true;\n};\n\n/** Narrows a validated Task after checking its succeeded-state invariant. */\nexport function isSucceededTask(task: Task): task is SucceededTask {\n return task.state === \"succeeded\" && task.workResult !== undefined;\n}\n\n/** Narrows a validated Task after checking its human-action invariant. */\nexport function isNeedsHumanTask(task: Task): task is NeedsHumanTask {\n return task.state === \"needs_human\" && task.needsHumanAction !== undefined;\n}\n\n/** Narrows a validated Task to running work deliberately waiting for messages. */\nexport function isMessageWaitingTask(task: Task): task is MessageWaitingTask {\n return task.state === \"running\" && task.waitingForMessages === true;\n}\n"],"mappings":";;;;;;AAoBA,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;AACF;;AAMA,MAAa,iBAAiB,iBAAiB,SAC7C,qFACF;;AAGA,MAAa,kBAAkB,EAC5B,KAAK;CACJ;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,CAAC,CACD,SAAS,8DAA8D;;AAG1E,MAAa,qBAAqB,EAC/B,KAAK;CAAC;CAAY;CAAW;AAAQ,CAAC,CAAC,CACvC,SACC,sIACF;;AAGF,MAAa,mCAAmC,EAC7C,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAC3B,SAAS,CAAC,CACV,SAAS,4CAA4C;;AAGxD,MAAa,mBAAmB,EAC7B,aAAa;CACZ,UAAU,eAAe,SAAS,CAAC,CAAC,SAAS,+BAA+B;CAC5E,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,kCAAkC;AACpF,CAAC,CAAC,CACD,SAAS,mFAAmF;;AAG/F,MAAa,gBAAgB,EAC1B,OAAO,CAAC,C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