@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
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/schema/transcript.d.ts
|
|
3
|
+
/** Validates a structured input request projected from a provider transcript. */
|
|
4
|
+
declare const inputRequestSchema: z.ZodReadonly<z.ZodObject<{
|
|
5
|
+
requestId: z.ZodString;
|
|
6
|
+
prompt: z.ZodString;
|
|
7
|
+
kind: z.ZodString;
|
|
8
|
+
allowFreeform: z.ZodOptional<z.ZodBoolean>;
|
|
9
|
+
options: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
10
|
+
id: z.ZodString;
|
|
11
|
+
label: z.ZodString;
|
|
12
|
+
description: z.ZodOptional<z.ZodString>;
|
|
13
|
+
}, z.core.$strip>>>>>;
|
|
14
|
+
}, z.core.$strip>>;
|
|
15
|
+
/** Validates the streamed state and payloads of one projected tool call. */
|
|
16
|
+
declare const toolCallSchema: z.ZodReadonly<z.ZodObject<{
|
|
17
|
+
callId: z.ZodString;
|
|
18
|
+
name: z.ZodString;
|
|
19
|
+
input: z.ZodOptional<z.ZodUnknown>;
|
|
20
|
+
inputText: z.ZodString;
|
|
21
|
+
output: z.ZodOptional<z.ZodUnknown>;
|
|
22
|
+
error: z.ZodOptional<z.ZodUnknown>;
|
|
23
|
+
state: z.ZodEnum<{
|
|
24
|
+
running: "running";
|
|
25
|
+
failed: "failed";
|
|
26
|
+
cancelled: "cancelled";
|
|
27
|
+
rejected: "rejected";
|
|
28
|
+
"input-streaming": "input-streaming";
|
|
29
|
+
completed: "completed";
|
|
30
|
+
}>;
|
|
31
|
+
}, z.core.$strip>>;
|
|
32
|
+
/** Validates a rendered transcript block with payloads correlated to its kind. */
|
|
33
|
+
declare const transcriptBlockSchema: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
|
|
34
|
+
kind: z.ZodLiteral<"user">;
|
|
35
|
+
tool: z.ZodOptional<z.ZodNever>;
|
|
36
|
+
attachments: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
37
|
+
id: z.ZodType<`img_${string}`, string, z.core.$ZodTypeInternals<`img_${string}`, string>>;
|
|
38
|
+
filename: z.ZodString;
|
|
39
|
+
mediaType: z.ZodEnum<{
|
|
40
|
+
"image/png": "image/png";
|
|
41
|
+
"image/jpeg": "image/jpeg";
|
|
42
|
+
"image/webp": "image/webp";
|
|
43
|
+
}>;
|
|
44
|
+
size: z.ZodNumber;
|
|
45
|
+
}, z.core.$strict>>>>;
|
|
46
|
+
id: z.ZodString;
|
|
47
|
+
title: z.ZodString;
|
|
48
|
+
text: z.ZodString;
|
|
49
|
+
createdAt: z.ZodOptional<z.ZodISODateTime>;
|
|
50
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
51
|
+
kind: z.ZodEnum<{
|
|
52
|
+
error: "error";
|
|
53
|
+
assistant: "assistant";
|
|
54
|
+
reasoning: "reasoning";
|
|
55
|
+
status: "status";
|
|
56
|
+
}>;
|
|
57
|
+
tool: z.ZodOptional<z.ZodNever>;
|
|
58
|
+
attachments: z.ZodOptional<z.ZodNever>;
|
|
59
|
+
id: z.ZodString;
|
|
60
|
+
title: z.ZodString;
|
|
61
|
+
text: z.ZodString;
|
|
62
|
+
createdAt: z.ZodOptional<z.ZodISODateTime>;
|
|
63
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
64
|
+
kind: z.ZodLiteral<"tool">;
|
|
65
|
+
tool: z.ZodReadonly<z.ZodObject<{
|
|
66
|
+
callId: z.ZodString;
|
|
67
|
+
name: z.ZodString;
|
|
68
|
+
input: z.ZodOptional<z.ZodUnknown>;
|
|
69
|
+
inputText: z.ZodString;
|
|
70
|
+
output: z.ZodOptional<z.ZodUnknown>;
|
|
71
|
+
error: z.ZodOptional<z.ZodUnknown>;
|
|
72
|
+
state: z.ZodEnum<{
|
|
73
|
+
running: "running";
|
|
74
|
+
failed: "failed";
|
|
75
|
+
cancelled: "cancelled";
|
|
76
|
+
rejected: "rejected";
|
|
77
|
+
"input-streaming": "input-streaming";
|
|
78
|
+
completed: "completed";
|
|
79
|
+
}>;
|
|
80
|
+
}, z.core.$strip>>;
|
|
81
|
+
attachments: z.ZodOptional<z.ZodNever>;
|
|
82
|
+
id: z.ZodString;
|
|
83
|
+
title: z.ZodString;
|
|
84
|
+
text: z.ZodString;
|
|
85
|
+
createdAt: z.ZodOptional<z.ZodISODateTime>;
|
|
86
|
+
}, z.core.$strict>>], "kind">;
|
|
87
|
+
/** Validates a cursor-addressed transcript projection and its current execution state. */
|
|
88
|
+
declare const transcriptSnapshotSchema: z.ZodReadonly<z.ZodObject<{
|
|
89
|
+
blocks: z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
|
|
90
|
+
kind: z.ZodLiteral<"user">;
|
|
91
|
+
tool: z.ZodOptional<z.ZodNever>;
|
|
92
|
+
attachments: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
93
|
+
id: z.ZodType<`img_${string}`, string, z.core.$ZodTypeInternals<`img_${string}`, string>>;
|
|
94
|
+
filename: z.ZodString;
|
|
95
|
+
mediaType: z.ZodEnum<{
|
|
96
|
+
"image/png": "image/png";
|
|
97
|
+
"image/jpeg": "image/jpeg";
|
|
98
|
+
"image/webp": "image/webp";
|
|
99
|
+
}>;
|
|
100
|
+
size: z.ZodNumber;
|
|
101
|
+
}, z.core.$strict>>>>;
|
|
102
|
+
id: z.ZodString;
|
|
103
|
+
title: z.ZodString;
|
|
104
|
+
text: z.ZodString;
|
|
105
|
+
createdAt: z.ZodOptional<z.ZodISODateTime>;
|
|
106
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
107
|
+
kind: z.ZodEnum<{
|
|
108
|
+
error: "error";
|
|
109
|
+
assistant: "assistant";
|
|
110
|
+
reasoning: "reasoning";
|
|
111
|
+
status: "status";
|
|
112
|
+
}>;
|
|
113
|
+
tool: z.ZodOptional<z.ZodNever>;
|
|
114
|
+
attachments: z.ZodOptional<z.ZodNever>;
|
|
115
|
+
id: z.ZodString;
|
|
116
|
+
title: z.ZodString;
|
|
117
|
+
text: z.ZodString;
|
|
118
|
+
createdAt: z.ZodOptional<z.ZodISODateTime>;
|
|
119
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
120
|
+
kind: z.ZodLiteral<"tool">;
|
|
121
|
+
tool: z.ZodReadonly<z.ZodObject<{
|
|
122
|
+
callId: z.ZodString;
|
|
123
|
+
name: z.ZodString;
|
|
124
|
+
input: z.ZodOptional<z.ZodUnknown>;
|
|
125
|
+
inputText: z.ZodString;
|
|
126
|
+
output: z.ZodOptional<z.ZodUnknown>;
|
|
127
|
+
error: z.ZodOptional<z.ZodUnknown>;
|
|
128
|
+
state: z.ZodEnum<{
|
|
129
|
+
running: "running";
|
|
130
|
+
failed: "failed";
|
|
131
|
+
cancelled: "cancelled";
|
|
132
|
+
rejected: "rejected";
|
|
133
|
+
"input-streaming": "input-streaming";
|
|
134
|
+
completed: "completed";
|
|
135
|
+
}>;
|
|
136
|
+
}, z.core.$strip>>;
|
|
137
|
+
attachments: z.ZodOptional<z.ZodNever>;
|
|
138
|
+
id: z.ZodString;
|
|
139
|
+
title: z.ZodString;
|
|
140
|
+
text: z.ZodString;
|
|
141
|
+
createdAt: z.ZodOptional<z.ZodISODateTime>;
|
|
142
|
+
}, z.core.$strict>>], "kind">>>;
|
|
143
|
+
inputs: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
144
|
+
requestId: z.ZodString;
|
|
145
|
+
prompt: z.ZodString;
|
|
146
|
+
kind: z.ZodString;
|
|
147
|
+
allowFreeform: z.ZodOptional<z.ZodBoolean>;
|
|
148
|
+
options: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
149
|
+
id: z.ZodString;
|
|
150
|
+
label: z.ZodString;
|
|
151
|
+
description: z.ZodOptional<z.ZodString>;
|
|
152
|
+
}, z.core.$strip>>>>>;
|
|
153
|
+
}, z.core.$strip>>>>;
|
|
154
|
+
cursor: z.ZodNumber;
|
|
155
|
+
state: z.ZodEnum<{
|
|
156
|
+
running: "running";
|
|
157
|
+
failed: "failed";
|
|
158
|
+
completed: "completed";
|
|
159
|
+
connecting: "connecting";
|
|
160
|
+
"needs input": "needs input";
|
|
161
|
+
waiting: "waiting";
|
|
162
|
+
}>;
|
|
163
|
+
turnId: z.ZodOptional<z.ZodString>;
|
|
164
|
+
tokens: z.ZodNumber;
|
|
165
|
+
}, z.core.$strip>>;
|
|
166
|
+
/** Structured pending input request projected from a provider transcript. */
|
|
167
|
+
type InputRequest = z.infer<typeof inputRequestSchema>;
|
|
168
|
+
/** Projected tool invocation with streamed input, result, error, and lifecycle state. */
|
|
169
|
+
type ToolCall = z.infer<typeof toolCallSchema>;
|
|
170
|
+
/** Renderable unit in a structured Factory transcript. */
|
|
171
|
+
type TranscriptBlock = z.infer<typeof transcriptBlockSchema>;
|
|
172
|
+
/** Cursor-addressed read model of a provider execution transcript. */
|
|
173
|
+
type TranscriptSnapshot = z.infer<typeof transcriptSnapshotSchema>;
|
|
174
|
+
//#endregion
|
|
175
|
+
export { InputRequest, ToolCall, TranscriptBlock, TranscriptSnapshot, inputRequestSchema, toolCallSchema, transcriptBlockSchema, transcriptSnapshotSchema };
|
|
176
|
+
//# sourceMappingURL=transcript.d.mts.map
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { imageAttachmentsSchema } from "../image-input.mjs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/schema/transcript.ts
|
|
4
|
+
/** Validates a structured input request projected from a provider transcript. */
|
|
5
|
+
const inputRequestSchema = z.object({
|
|
6
|
+
requestId: z.string().describe("Stable provider input request ID."),
|
|
7
|
+
prompt: z.string().describe("Question or instruction presented to the operator."),
|
|
8
|
+
kind: z.string().describe("Provider-defined input request kind."),
|
|
9
|
+
allowFreeform: z.boolean().optional().describe("Whether the operator may enter text instead of selecting an option."),
|
|
10
|
+
options: z.array(z.object({
|
|
11
|
+
id: z.string().describe("Stable option ID returned in the response."),
|
|
12
|
+
label: z.string().describe("Operator-facing option label."),
|
|
13
|
+
description: z.string().optional().describe("Additional option context.")
|
|
14
|
+
}).readonly()).readonly().optional().describe("Selectable answers offered by the provider.")
|
|
15
|
+
}).readonly();
|
|
16
|
+
/** Validates the streamed state and payloads of one projected tool call. */
|
|
17
|
+
const toolCallSchema = z.object({
|
|
18
|
+
callId: z.string().describe("Provider tool-call ID used to correlate streamed updates."),
|
|
19
|
+
name: z.string().describe("Tool name shown in the transcript."),
|
|
20
|
+
input: z.unknown().optional().describe("Parsed tool input when complete JSON is available."),
|
|
21
|
+
inputText: z.string().describe("Accumulated tool input text, including partial JSON."),
|
|
22
|
+
output: z.unknown().optional().describe("Latest partial or final tool output."),
|
|
23
|
+
error: z.unknown().optional().describe("Provider error associated with this tool call."),
|
|
24
|
+
state: z.enum([
|
|
25
|
+
"input-streaming",
|
|
26
|
+
"running",
|
|
27
|
+
"completed",
|
|
28
|
+
"failed",
|
|
29
|
+
"cancelled",
|
|
30
|
+
"rejected"
|
|
31
|
+
]).describe("Current streamed tool-call lifecycle state.")
|
|
32
|
+
}).readonly();
|
|
33
|
+
const transcriptBlockBase = {
|
|
34
|
+
id: z.string().describe("Stable block ID used to replace streamed updates in place."),
|
|
35
|
+
title: z.string().describe("Short operator-facing block title."),
|
|
36
|
+
text: z.string().describe("Rendered Markdown or plain-text block content."),
|
|
37
|
+
createdAt: z.iso.datetime().optional().describe("Source event timestamp retained in older saved transcripts.")
|
|
38
|
+
};
|
|
39
|
+
const userTranscriptBlockSchema = z.strictObject({
|
|
40
|
+
...transcriptBlockBase,
|
|
41
|
+
kind: z.literal("user").describe("Human-authored message block."),
|
|
42
|
+
tool: z.never().optional().describe("Tool payloads are forbidden on user messages."),
|
|
43
|
+
attachments: imageAttachmentsSchema.optional().describe("Images attached to this human message.")
|
|
44
|
+
}).readonly();
|
|
45
|
+
const textTranscriptBlockSchema = z.strictObject({
|
|
46
|
+
...transcriptBlockBase,
|
|
47
|
+
kind: z.enum([
|
|
48
|
+
"assistant",
|
|
49
|
+
"reasoning",
|
|
50
|
+
"status",
|
|
51
|
+
"error"
|
|
52
|
+
]).describe("Non-tool transcript block kind."),
|
|
53
|
+
tool: z.never().optional().describe("Tool payloads are forbidden on text blocks."),
|
|
54
|
+
attachments: z.never().optional().describe("Attachments are reserved for user messages.")
|
|
55
|
+
}).readonly();
|
|
56
|
+
const toolTranscriptBlockSchema = z.strictObject({
|
|
57
|
+
...transcriptBlockBase,
|
|
58
|
+
kind: z.literal("tool").describe("Correlated tool-call block."),
|
|
59
|
+
tool: toolCallSchema.describe("Tool invocation represented by this block."),
|
|
60
|
+
attachments: z.never().optional().describe("Attachments are reserved for user messages.")
|
|
61
|
+
}).readonly();
|
|
62
|
+
/** Validates a rendered transcript block with payloads correlated to its kind. */
|
|
63
|
+
const transcriptBlockSchema = z.discriminatedUnion("kind", [
|
|
64
|
+
userTranscriptBlockSchema,
|
|
65
|
+
textTranscriptBlockSchema,
|
|
66
|
+
toolTranscriptBlockSchema
|
|
67
|
+
]);
|
|
68
|
+
/** Validates a cursor-addressed transcript projection and its current execution state. */
|
|
69
|
+
const transcriptSnapshotSchema = z.object({
|
|
70
|
+
blocks: z.array(transcriptBlockSchema).readonly().describe("Ordered rendered transcript blocks."),
|
|
71
|
+
inputs: z.array(inputRequestSchema).readonly().describe("Unresolved provider input requests."),
|
|
72
|
+
cursor: z.number().int().nonnegative().describe("Next provider event index to request."),
|
|
73
|
+
state: z.enum([
|
|
74
|
+
"connecting",
|
|
75
|
+
"running",
|
|
76
|
+
"needs input",
|
|
77
|
+
"waiting",
|
|
78
|
+
"completed",
|
|
79
|
+
"failed"
|
|
80
|
+
]).describe("Current execution state shown to the operator."),
|
|
81
|
+
turnId: z.string().optional().describe("Active provider turn ID, when one is running."),
|
|
82
|
+
tokens: z.number().nonnegative().describe("Accumulated input and output tokens.")
|
|
83
|
+
}).readonly();
|
|
84
|
+
//#endregion
|
|
85
|
+
export { inputRequestSchema, toolCallSchema, transcriptBlockSchema, transcriptSnapshotSchema };
|
|
86
|
+
|
|
87
|
+
//# sourceMappingURL=transcript.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transcript.mjs","names":[],"sources":["../../src/schema/transcript.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { imageAttachmentsSchema } from \"../image-input\";\n\n/** Validates a structured input request projected from a provider transcript. */\nexport const inputRequestSchema = z\n .object({\n requestId: z.string().describe(\"Stable provider input request ID.\"),\n prompt: z.string().describe(\"Question or instruction presented to the operator.\"),\n kind: z.string().describe(\"Provider-defined input request kind.\"),\n allowFreeform: z\n .boolean()\n .optional()\n .describe(\"Whether the operator may enter text instead of selecting an option.\"),\n options: z\n .array(\n z\n .object({\n id: z.string().describe(\"Stable option ID returned in the response.\"),\n label: z.string().describe(\"Operator-facing option label.\"),\n description: z.string().optional().describe(\"Additional option context.\"),\n })\n .readonly(),\n )\n .readonly()\n .optional()\n .describe(\"Selectable answers offered by the provider.\"),\n })\n .readonly();\n\n/** Validates the streamed state and payloads of one projected tool call. */\nexport const toolCallSchema = z\n .object({\n callId: z.string().describe(\"Provider tool-call ID used to correlate streamed updates.\"),\n name: z.string().describe(\"Tool name shown in the transcript.\"),\n input: z.unknown().optional().describe(\"Parsed tool input when complete JSON is available.\"),\n inputText: z.string().describe(\"Accumulated tool input text, including partial JSON.\"),\n output: z.unknown().optional().describe(\"Latest partial or final tool output.\"),\n error: z.unknown().optional().describe(\"Provider error associated with this tool call.\"),\n state: z\n .enum([\"input-streaming\", \"running\", \"completed\", \"failed\", \"cancelled\", \"rejected\"])\n .describe(\"Current streamed tool-call lifecycle state.\"),\n })\n .readonly();\n\nconst transcriptBlockBase = {\n id: z.string().describe(\"Stable block ID used to replace streamed updates in place.\"),\n title: z.string().describe(\"Short operator-facing block title.\"),\n text: z.string().describe(\"Rendered Markdown or plain-text block content.\"),\n createdAt: z.iso\n .datetime()\n .optional()\n .describe(\"Source event timestamp retained in older saved transcripts.\"),\n};\n\nconst userTranscriptBlockSchema = z\n .strictObject({\n ...transcriptBlockBase,\n kind: z.literal(\"user\").describe(\"Human-authored message block.\"),\n tool: z.never().optional().describe(\"Tool payloads are forbidden on user messages.\"),\n attachments: imageAttachmentsSchema\n .optional()\n .describe(\"Images attached to this human message.\"),\n })\n .readonly();\n\nconst textTranscriptBlockSchema = z\n .strictObject({\n ...transcriptBlockBase,\n kind: z\n .enum([\"assistant\", \"reasoning\", \"status\", \"error\"])\n .describe(\"Non-tool transcript block kind.\"),\n tool: z.never().optional().describe(\"Tool payloads are forbidden on text blocks.\"),\n attachments: z.never().optional().describe(\"Attachments are reserved for user messages.\"),\n })\n .readonly();\n\nconst toolTranscriptBlockSchema = z\n .strictObject({\n ...transcriptBlockBase,\n kind: z.literal(\"tool\").describe(\"Correlated tool-call block.\"),\n tool: toolCallSchema.describe(\"Tool invocation represented by this block.\"),\n attachments: z.never().optional().describe(\"Attachments are reserved for user messages.\"),\n })\n .readonly();\n\n/** Validates a rendered transcript block with payloads correlated to its kind. */\nexport const transcriptBlockSchema = z.discriminatedUnion(\"kind\", [\n userTranscriptBlockSchema,\n textTranscriptBlockSchema,\n toolTranscriptBlockSchema,\n]);\n\n/** Validates a cursor-addressed transcript projection and its current execution state. */\nexport const transcriptSnapshotSchema = z\n .object({\n blocks: z\n .array(transcriptBlockSchema)\n .readonly()\n .describe(\"Ordered rendered transcript blocks.\"),\n inputs: z.array(inputRequestSchema).readonly().describe(\"Unresolved provider input requests.\"),\n cursor: z.number().int().nonnegative().describe(\"Next provider event index to request.\"),\n state: z\n .enum([\"connecting\", \"running\", \"needs input\", \"waiting\", \"completed\", \"failed\"])\n .describe(\"Current execution state shown to the operator.\"),\n turnId: z.string().optional().describe(\"Active provider turn ID, when one is running.\"),\n tokens: z.number().nonnegative().describe(\"Accumulated input and output tokens.\"),\n })\n .readonly();\n\n/** Structured pending input request projected from a provider transcript. */\nexport type InputRequest = z.infer<typeof inputRequestSchema>;\n/** Projected tool invocation with streamed input, result, error, and lifecycle state. */\nexport type ToolCall = z.infer<typeof toolCallSchema>;\n/** Renderable unit in a structured Factory transcript. */\nexport type TranscriptBlock = z.infer<typeof transcriptBlockSchema>;\n/** Cursor-addressed read model of a provider execution transcript. */\nexport type Tran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AC7F,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,uCAAuC;CACvF,OAAO,EACJ,KAAK;EAAC;EAAc;EAAW;EAAe;EAAW;EAAa;CAAQ,CAAC,CAAC,CAChF,SAAS,gDAAgD;CAC5D,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,+CAA+C;CACtF,QAAQ,EAAE,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,sCAAsC;AAClF,CAAC,CAAC,CACD,SAAS"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { SignalOutcome, SignalTriage } from "./signal.mjs";
|
|
2
|
+
import { TaskState } from "./task.mjs";
|
|
3
|
+
import { ChangeState } from "./change.mjs";
|
|
4
|
+
//#region src/schema/transitions.d.ts
|
|
5
|
+
/** Authority category responsible for advancing a state-machine edge. */
|
|
6
|
+
type TransitionActor = "system" | "reconciler" | "foreman" | "operator" | "webhook" | "human";
|
|
7
|
+
/** Inspectable legal edge in a Factory state machine. */
|
|
8
|
+
interface Transition<State extends string> {
|
|
9
|
+
readonly from: State;
|
|
10
|
+
readonly to: State;
|
|
11
|
+
readonly trigger: string;
|
|
12
|
+
readonly actor: TransitionActor;
|
|
13
|
+
}
|
|
14
|
+
/** Named source and destination states for a transition check. */
|
|
15
|
+
interface TransitionInput<State extends string> {
|
|
16
|
+
readonly from: NoInfer<State>;
|
|
17
|
+
readonly to: NoInfer<State>;
|
|
18
|
+
}
|
|
19
|
+
/** Required lifecycle state assigned when a Task is admitted. */
|
|
20
|
+
declare const taskInitialState = "queued";
|
|
21
|
+
/** Canonical legal Task lifecycle edges and their responsible authorities. */
|
|
22
|
+
declare const taskTransitions: readonly Transition<TaskState>[];
|
|
23
|
+
/** Required lifecycle state assigned when a Change is first recorded. */
|
|
24
|
+
declare const changeInitialState = "verifying";
|
|
25
|
+
/** Canonical legal Change lifecycle edges and their responsible authorities. */
|
|
26
|
+
declare const changeTransitions: readonly Transition<ChangeState>[];
|
|
27
|
+
/** Required outcome assigned when an inbound Signal is admitted. */
|
|
28
|
+
declare const signalInitialOutcome = "pending";
|
|
29
|
+
/** Canonical one-time Signal triage edges. */
|
|
30
|
+
declare const signalOutcomeTransitions: readonly Transition<SignalOutcome>[];
|
|
31
|
+
/** Reports whether a state-machine table contains the requested directed edge. */
|
|
32
|
+
declare function isTransitionAllowed<State extends string>(transitions: readonly Transition<State>[], input: TransitionInput<State>): boolean;
|
|
33
|
+
/** Returns the distinct states directly reachable from a given state. */
|
|
34
|
+
declare function legalNextStates<State extends string>(transitions: readonly Transition<State>[], from: NoInfer<State>): readonly State[];
|
|
35
|
+
/** Error describing a refused state transition and every legal next state. */
|
|
36
|
+
declare class InvalidTransitionError<State extends string> extends Error {
|
|
37
|
+
readonly from: State;
|
|
38
|
+
readonly to: State;
|
|
39
|
+
readonly legalNextStates: readonly State[];
|
|
40
|
+
constructor(from: State, to: State, legal: readonly State[]);
|
|
41
|
+
}
|
|
42
|
+
/** Throws an {@link InvalidTransitionError} unless the requested edge is legal. */
|
|
43
|
+
declare function assertTransition<State extends string>(transitions: readonly Transition<State>[], input: TransitionInput<State>): void;
|
|
44
|
+
/** Derives states with no outgoing edges from a transition table. */
|
|
45
|
+
declare function terminalStates<State extends string>(transitions: readonly Transition<State>[]): readonly State[];
|
|
46
|
+
/** Canonical triage observation and explicit retry edges. */
|
|
47
|
+
declare const signalTriageTransitions: readonly Transition<SignalTriage["state"]>[];
|
|
48
|
+
//#endregion
|
|
49
|
+
export { InvalidTransitionError, Transition, TransitionActor, TransitionInput, assertTransition, changeInitialState, changeTransitions, isTransitionAllowed, legalNextStates, signalInitialOutcome, signalOutcomeTransitions, signalTriageTransitions, taskInitialState, taskTransitions, terminalStates };
|
|
50
|
+
//# sourceMappingURL=transitions.d.mts.map
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
//#region src/schema/transitions.ts
|
|
2
|
+
/** Required lifecycle state assigned when a Task is admitted. */
|
|
3
|
+
const taskInitialState = "queued";
|
|
4
|
+
/** Canonical legal Task lifecycle edges and their responsible authorities. */
|
|
5
|
+
const taskTransitions = [
|
|
6
|
+
{
|
|
7
|
+
from: "queued",
|
|
8
|
+
to: "running",
|
|
9
|
+
trigger: "graph prerequisites succeeded, dependencies sealed, workflow admission approved",
|
|
10
|
+
actor: "reconciler"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
from: "queued",
|
|
14
|
+
to: "failed",
|
|
15
|
+
trigger: "reservation refused",
|
|
16
|
+
actor: "reconciler"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
from: "queued",
|
|
20
|
+
to: "needs_human",
|
|
21
|
+
trigger: "workflow presents a human question",
|
|
22
|
+
actor: "system"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
from: "queued",
|
|
26
|
+
to: "cancelled",
|
|
27
|
+
trigger: "cancel or kill",
|
|
28
|
+
actor: "operator"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
from: "running",
|
|
32
|
+
to: "verifying",
|
|
33
|
+
trigger: "workflow requests verification of its result",
|
|
34
|
+
actor: "reconciler"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
from: "running",
|
|
38
|
+
to: "queued",
|
|
39
|
+
trigger: "launch or execution failed below attempt limit",
|
|
40
|
+
actor: "reconciler"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
from: "running",
|
|
44
|
+
to: "failed",
|
|
45
|
+
trigger: "execution or launch failed at attempt limit",
|
|
46
|
+
actor: "reconciler"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
from: "running",
|
|
50
|
+
to: "needs_human",
|
|
51
|
+
trigger: "an open QuestionTask requests human input or action",
|
|
52
|
+
actor: "reconciler"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
from: "running",
|
|
56
|
+
to: "cancelled",
|
|
57
|
+
trigger: "cancel or kill",
|
|
58
|
+
actor: "operator"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
from: "running",
|
|
62
|
+
to: "stalled",
|
|
63
|
+
trigger: "no progress within the stall window",
|
|
64
|
+
actor: "reconciler"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
from: "running",
|
|
68
|
+
to: "succeeded",
|
|
69
|
+
trigger: "workflow completes with validated output",
|
|
70
|
+
actor: "reconciler"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
from: "stalled",
|
|
74
|
+
to: "queued",
|
|
75
|
+
trigger: "replacement attempt below attempt limit, or operator retry",
|
|
76
|
+
actor: "reconciler"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
from: "stalled",
|
|
80
|
+
to: "failed",
|
|
81
|
+
trigger: "attempt limit exhausted",
|
|
82
|
+
actor: "reconciler"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
from: "stalled",
|
|
86
|
+
to: "cancelled",
|
|
87
|
+
trigger: "cancel or kill",
|
|
88
|
+
actor: "operator"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
from: "verifying",
|
|
92
|
+
to: "succeeded",
|
|
93
|
+
trigger: "workflow verification completes with validated output",
|
|
94
|
+
actor: "reconciler"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
from: "verifying",
|
|
98
|
+
to: "running",
|
|
99
|
+
trigger: "verification failed below attempt limit",
|
|
100
|
+
actor: "reconciler"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
from: "verifying",
|
|
104
|
+
to: "failed",
|
|
105
|
+
trigger: "verification failed at attempt limit",
|
|
106
|
+
actor: "reconciler"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
from: "verifying",
|
|
110
|
+
to: "cancelled",
|
|
111
|
+
trigger: "cancel or kill",
|
|
112
|
+
actor: "operator"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
from: "needs_human",
|
|
116
|
+
to: "succeeded",
|
|
117
|
+
trigger: "question answered",
|
|
118
|
+
actor: "operator"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
from: "needs_human",
|
|
122
|
+
to: "queued",
|
|
123
|
+
trigger: "operator retry",
|
|
124
|
+
actor: "operator"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
from: "needs_human",
|
|
128
|
+
to: "cancelled",
|
|
129
|
+
trigger: "cancel or kill",
|
|
130
|
+
actor: "operator"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
from: "failed",
|
|
134
|
+
to: "queued",
|
|
135
|
+
trigger: "operator retry",
|
|
136
|
+
actor: "operator"
|
|
137
|
+
}
|
|
138
|
+
];
|
|
139
|
+
/** Required lifecycle state assigned when a Change is first recorded. */
|
|
140
|
+
const changeInitialState = "verifying";
|
|
141
|
+
/** Canonical legal Change lifecycle edges and their responsible authorities. */
|
|
142
|
+
const changeTransitions = [
|
|
143
|
+
{
|
|
144
|
+
from: "ready",
|
|
145
|
+
to: "verifying",
|
|
146
|
+
trigger: "a code_change task updated the existing pull request head",
|
|
147
|
+
actor: "reconciler"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
from: "verifying",
|
|
151
|
+
to: "ready",
|
|
152
|
+
trigger: "configured verification policy completed, risk and confidence written",
|
|
153
|
+
actor: "reconciler"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
from: "verifying",
|
|
157
|
+
to: "closed",
|
|
158
|
+
trigger: "verification failed at attempt limit or pr closed upstream",
|
|
159
|
+
actor: "reconciler"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
from: "ready",
|
|
163
|
+
to: "merged",
|
|
164
|
+
trigger: "pr merged on github",
|
|
165
|
+
actor: "webhook"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
from: "ready",
|
|
169
|
+
to: "closed",
|
|
170
|
+
trigger: "pr closed without merge",
|
|
171
|
+
actor: "webhook"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
from: "merged",
|
|
175
|
+
to: "deployed",
|
|
176
|
+
trigger: "production deployment ready containing the merge sha",
|
|
177
|
+
actor: "webhook"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
from: "deployed",
|
|
181
|
+
to: "rolled_out",
|
|
182
|
+
trigger: "no flag, or flag ramped to full and held",
|
|
183
|
+
actor: "foreman"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
from: "deployed",
|
|
187
|
+
to: "rolled_back",
|
|
188
|
+
trigger: "rollback rule crossed",
|
|
189
|
+
actor: "foreman"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
from: "rolled_out",
|
|
193
|
+
to: "rolled_back",
|
|
194
|
+
trigger: "rollback rule crossed or flag flipped off",
|
|
195
|
+
actor: "foreman"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
from: "rolled_back",
|
|
199
|
+
to: "deployed",
|
|
200
|
+
trigger: "human retried the ramp",
|
|
201
|
+
actor: "human"
|
|
202
|
+
}
|
|
203
|
+
];
|
|
204
|
+
/** Required outcome assigned when an inbound Signal is admitted. */
|
|
205
|
+
const signalInitialOutcome = "pending";
|
|
206
|
+
/** Canonical one-time Signal triage edges. */
|
|
207
|
+
const signalOutcomeTransitions = [
|
|
208
|
+
{
|
|
209
|
+
from: "pending",
|
|
210
|
+
to: "accepted",
|
|
211
|
+
trigger: "classified as actionable",
|
|
212
|
+
actor: "reconciler"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
from: "pending",
|
|
216
|
+
to: "duplicate",
|
|
217
|
+
trigger: "classified as duplicate",
|
|
218
|
+
actor: "reconciler"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
from: "pending",
|
|
222
|
+
to: "unactionable",
|
|
223
|
+
trigger: "classified as unactionable",
|
|
224
|
+
actor: "reconciler"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
from: "pending",
|
|
228
|
+
to: "low_confidence",
|
|
229
|
+
trigger: "classified below confidence threshold",
|
|
230
|
+
actor: "reconciler"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
from: "pending",
|
|
234
|
+
to: "ignored",
|
|
235
|
+
trigger: "classified as ignorable",
|
|
236
|
+
actor: "reconciler"
|
|
237
|
+
}
|
|
238
|
+
];
|
|
239
|
+
/** Reports whether a state-machine table contains the requested directed edge. */
|
|
240
|
+
function isTransitionAllowed(transitions, input) {
|
|
241
|
+
return transitions.some((transition) => transition.from === input.from && transition.to === input.to);
|
|
242
|
+
}
|
|
243
|
+
/** Returns the distinct states directly reachable from a given state. */
|
|
244
|
+
function legalNextStates(transitions, from) {
|
|
245
|
+
return [...new Set(transitions.filter((transition) => transition.from === from).map((t) => t.to))];
|
|
246
|
+
}
|
|
247
|
+
/** Error describing a refused state transition and every legal next state. */
|
|
248
|
+
var InvalidTransitionError = class extends Error {
|
|
249
|
+
from;
|
|
250
|
+
to;
|
|
251
|
+
legalNextStates;
|
|
252
|
+
constructor(from, to, legal) {
|
|
253
|
+
super(legal.length > 0 ? `invalid transition from "${from}" to "${to}"; legal next states: ${legal.map((state) => `"${state}"`).join(", ")}` : `invalid transition from "${from}" to "${to}"; "${from}" is terminal`);
|
|
254
|
+
this.name = "InvalidTransitionError";
|
|
255
|
+
this.from = from;
|
|
256
|
+
this.to = to;
|
|
257
|
+
this.legalNextStates = legal;
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
/** Throws an {@link InvalidTransitionError} unless the requested edge is legal. */
|
|
261
|
+
function assertTransition(transitions, input) {
|
|
262
|
+
if (!isTransitionAllowed(transitions, input)) throw new InvalidTransitionError(input.from, input.to, legalNextStates(transitions, input.from));
|
|
263
|
+
}
|
|
264
|
+
/** Derives states with no outgoing edges from a transition table. */
|
|
265
|
+
function terminalStates(transitions) {
|
|
266
|
+
const states = /* @__PURE__ */ new Set();
|
|
267
|
+
for (const transition of transitions) {
|
|
268
|
+
states.add(transition.from);
|
|
269
|
+
states.add(transition.to);
|
|
270
|
+
}
|
|
271
|
+
return [...states].filter((state) => !transitions.some((transition) => transition.from === state));
|
|
272
|
+
}
|
|
273
|
+
/** Canonical triage observation and explicit retry edges. */
|
|
274
|
+
const signalTriageTransitions = [
|
|
275
|
+
{
|
|
276
|
+
from: "running",
|
|
277
|
+
to: "blocked",
|
|
278
|
+
trigger: "provider stopped without deciding",
|
|
279
|
+
actor: "system"
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
from: "running",
|
|
283
|
+
to: "uncertain",
|
|
284
|
+
trigger: "launch response unavailable",
|
|
285
|
+
actor: "system"
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
from: "uncertain",
|
|
289
|
+
to: "blocked",
|
|
290
|
+
trigger: "provider confirmed stopped",
|
|
291
|
+
actor: "system"
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
from: "blocked",
|
|
295
|
+
to: "running",
|
|
296
|
+
trigger: "explicit operator retry",
|
|
297
|
+
actor: "operator"
|
|
298
|
+
}
|
|
299
|
+
];
|
|
300
|
+
//#endregion
|
|
301
|
+
export { InvalidTransitionError, assertTransition, changeInitialState, changeTransitions, isTransitionAllowed, legalNextStates, signalInitialOutcome, signalOutcomeTransitions, signalTriageTransitions, taskInitialState, taskTransitions, terminalStates };
|
|
302
|
+
|
|
303
|
+
//# sourceMappingURL=transitions.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transitions.mjs","names":[],"sources":["../../src/schema/transitions.ts"],"sourcesContent":["import type { ChangeState } from \"./change\";\nimport type { SignalOutcome, SignalTriage } from \"./signal\";\nimport type { TaskState } from \"./task\";\n\n/** Authority category responsible for advancing a state-machine edge. */\nexport type TransitionActor =\n | \"system\"\n | \"reconciler\"\n | \"foreman\"\n | \"operator\"\n | \"webhook\"\n | \"human\";\n\n/** Inspectable legal edge in a Factory state machine. */\nexport interface Transition<State extends string> {\n readonly from: State;\n readonly to: State;\n readonly trigger: string;\n readonly actor: TransitionActor;\n}\n\n/** Named source and destination states for a transition check. */\nexport interface TransitionInput<State extends string> {\n readonly from: NoInfer<State>;\n readonly to: NoInfer<State>;\n}\n\n/** Required lifecycle state assigned when a Task is admitted. */\nexport const taskInitialState = \"queued\" satisfies TaskState;\n\n/** Canonical legal Task lifecycle edges and their responsible authorities. */\nexport const taskTransitions: readonly Transition<TaskState>[] = [\n {\n from: \"queued\",\n to: \"running\",\n trigger: \"graph prerequisites succeeded, dependencies sealed, workflow admission approved\",\n actor: \"reconciler\",\n },\n { from: \"queued\", to: \"failed\", trigger: \"reservation refused\", actor: \"reconciler\" },\n {\n from: \"queued\",\n to: \"needs_human\",\n trigger: \"workflow presents a human question\",\n actor: \"system\",\n },\n { from: \"queued\", to: \"cancelled\", trigger: \"cancel or kill\", actor: \"operator\" },\n {\n from: \"running\",\n to: \"verifying\",\n trigger: \"workflow requests verification of its result\",\n actor: \"reconciler\",\n },\n {\n from: \"running\",\n to: \"queued\",\n trigger: \"launch or execution failed below attempt limit\",\n actor: \"reconciler\",\n },\n {\n from: \"running\",\n to: \"failed\",\n trigger: \"execution or launch failed at attempt limit\",\n actor: \"reconciler\",\n },\n {\n from: \"running\",\n to: \"needs_human\",\n trigger: \"an open QuestionTask requests human input or action\",\n actor: \"reconciler\",\n },\n { from: \"running\", to: \"cancelled\", trigger: \"cancel or kill\", actor: \"operator\" },\n {\n from: \"running\",\n to: \"stalled\",\n trigger: \"no progress within the stall window\",\n actor: \"reconciler\",\n },\n {\n from: \"running\",\n to: \"succeeded\",\n trigger: \"workflow completes with validated output\",\n actor: \"reconciler\",\n },\n {\n from: \"stalled\",\n to: \"queued\",\n trigger: \"replacement attempt below attempt limit, or operator retry\",\n actor: \"reconciler\",\n },\n { from: \"stalled\", to: \"failed\", trigger: \"attempt limit exhausted\", actor: \"reconciler\" },\n { from: \"stalled\", to: \"cancelled\", trigger: \"cancel or kill\", actor: \"operator\" },\n {\n from: \"verifying\",\n to: \"succeeded\",\n trigger: \"workflow verification completes with validated output\",\n actor: \"reconciler\",\n },\n {\n from: \"verifying\",\n to: \"running\",\n trigger: \"verification failed below attempt limit\",\n actor: \"reconciler\",\n },\n {\n from: \"verifying\",\n to: \"failed\",\n trigger: \"verification failed at attempt limit\",\n actor: \"reconciler\",\n },\n { from: \"verifying\", to: \"cancelled\", trigger: \"cancel or kill\", actor: \"operator\" },\n { from: \"needs_human\", to: \"succeeded\", trigger: \"question answered\", actor: \"operator\" },\n { from: \"needs_human\", to: \"queued\", trigger: \"operator retry\", actor: \"operator\" },\n { from: \"needs_human\", to: \"cancelled\", trigger: \"cancel or kill\", actor: \"operator\" },\n { from: \"failed\", to: \"queued\", trigger: \"operator retry\", actor: \"operator\" },\n];\n\n/** Required lifecycle state assigned when a Change is first recorded. */\nexport const changeInitialState = \"verifying\" satisfies ChangeState;\n\n/** Canonical legal Change lifecycle edges and their responsible authorities. */\nexport const changeTransitions: readonly Transition<ChangeState>[] = [\n {\n from: \"ready\",\n to: \"verifying\",\n trigger: \"a code_change task updated the existing pull request head\",\n actor: \"reconciler\",\n },\n {\n from: \"verifying\",\n to: \"ready\",\n trigger: \"configured verification policy completed, risk and confidence written\",\n actor: \"reconciler\",\n },\n {\n from: \"verifying\",\n to: \"closed\",\n trigger: \"verification failed at attempt limit or pr closed upstream\",\n actor: \"reconciler\",\n },\n { from: \"ready\", to: \"merged\", trigger: \"pr merged on github\", actor: \"webhook\" },\n { from: \"ready\", to: \"closed\", trigger: \"pr closed without merge\", actor: \"webhook\" },\n {\n from: \"merged\",\n to: \"deployed\",\n trigger: \"production deployment ready containing the merge sha\",\n actor: \"webhook\",\n },\n {\n from: \"deployed\",\n to: \"rolled_out\",\n trigger: \"no flag, or flag ramped to full and held\",\n actor: \"foreman\",\n },\n { from: \"deployed\", to: \"rolled_back\", trigger: \"rollback rule crossed\", actor: \"foreman\" },\n {\n from: \"rolled_out\",\n to: \"rolled_back\",\n trigger: \"rollback rule crossed or flag flipped off\",\n actor: \"foreman\",\n },\n { from: \"rolled_back\", to: \"deployed\", trigger: \"human retried the ramp\", actor: \"human\" },\n];\n\n/** Required outcome assigned when an inbound Signal is admitted. */\nexport const signalInitialOutcome = \"pending\" satisfies SignalOutcome;\n\n/** Canonical one-time Signal triage edges. */\nexport const signalOutcomeTransitions: readonly Transition<SignalOutcome>[] = [\n { from: \"pending\", to: \"accepted\", trigger: \"classified as actionable\", actor: \"reconciler\" },\n { from: \"pending\", to: \"duplicate\", trigger: \"classified as duplicate\", actor: \"reconciler\" },\n {\n from: \"pending\",\n to: \"unactionable\",\n trigger: \"classified as unactionable\",\n actor: \"reconciler\",\n },\n {\n from: \"pending\",\n to: \"low_confidence\",\n trigger: \"classified below confidence threshold\",\n actor: \"reconciler\",\n },\n { from: \"pending\", to: \"ignored\", trigger: \"classified as ignorable\", actor: \"reconciler\" },\n];\n\n/** Reports whether a state-machine table contains the requested directed edge. */\nexport function isTransitionAllowed<State extends string>(\n transitions: readonly Transition<State>[],\n input: TransitionInput<State>,\n): boolean {\n return transitions.some(\n (transition) => transition.from === input.from && transition.to === input.to,\n );\n}\n\n/** Returns the distinct states directly reachable from a given state. */\nexport function legalNextStates<State extends string>(\n transitions: readonly Transition<State>[],\n from: NoInfer<State>,\n): readonly State[] {\n return [\n ...new Set(transitions.filter((transition) => transition.from === from).map((t) => t.to)),\n ];\n}\n\n/** Error describing a refused state transition and every legal next state. */\nexport class InvalidTransitionError<State extends string> extends Error {\n readonly from: State;\n readonly to: State;\n readonly legalNextStates: readonly State[];\n\n constructor(from: State, to: State, legal: readonly State[]) {\n super(\n legal.length > 0\n ? `invalid transition from \"${from}\" to \"${to}\"; legal next states: ${legal\n .map((state) => `\"${state}\"`)\n .join(\", \")}`\n : `invalid transition from \"${from}\" to \"${to}\"; \"${from}\" is terminal`,\n );\n this.name = \"InvalidTransitionError\";\n this.from = from;\n this.to = to;\n this.legalNextStates = legal;\n }\n}\n\n/** Throws an {@link InvalidTransitionError} unless the requested edge is legal. */\nexport function assertTransition<State extends string>(\n transitions: readonly Transition<State>[],\n input: TransitionInput<State>,\n): void {\n if (!isTransitionAllowed(transitions, input)) {\n throw new InvalidTransitionError(\n input.from,\n input.to,\n legalNextStates(transitions, input.from),\n );\n }\n}\n\n/** Derives states with no outgoing edges from a transition table. */\nexport function terminalStates<State extends string>(\n transitions: readonly Transition<State>[],\n): readonly State[] {\n const states = new Set<State>();\n for (const transition of transitions) {\n states.add(transition.from);\n states.add(transition.to);\n }\n return [...states].filter(\n (state) => !transitions.some((transition) => transition.from === state),\n );\n}\n\n/** Canonical triage observation and explicit retry edges. */\nexport const signalTriageTransitions: readonly Transition<SignalTriage[\"state\"]>[] = [\n { from: \"running\", to: \"blocked\", trigger: \"provider stopped without deciding\", actor: \"system\" },\n { from: \"running\", to: \"uncertain\", trigger: \"launch response unavailable\", actor: \"system\" },\n { from: \"uncertain\", to: \"blocked\", trigger: \"provider confirmed stopped\", actor: \"system\" },\n { from: \"blocked\", to: \"running\", trigger: \"explicit operator retry\", actor: \"operator\" },\n];\n"],"mappings":";;AA4BA,MAAa,mBAAmB;;AAGhC,MAAa,kBAAoD;CAC/D;EACE,MAAM;EACN,IAAI;EACJ,SAAS;EACT,OAAO;CACT;CACA;EAAE,MAAM;EAAU,IAAI;EAAU,SAAS;EAAuB,OAAO;CAAa;CACpF;EACE,MAAM;EACN,IAAI;EACJ,SAAS;EACT,OAAO;CACT;CACA;EAAE,MAAM;EAAU,IAAI;EAAa,SAAS;EAAkB,OAAO;CAAW;CAChF;EACE,MAAM;EACN,IAAI;EACJ,SAAS;EACT,OAAO;CACT;CACA;EACE,MAAM;EACN,IAAI;EACJ,SAAS;EACT,OAAO;CACT;CACA;EACE,MAAM;EACN,IAAI;EACJ,SAAS;EACT,OAAO;CACT;CACA;EACE,MAAM;EACN,IAAI;EACJ,SAAS;EACT,OAAO;CACT;CACA;EAAE,MAAM;EAAW,IAAI;EAAa,SAAS;EAAkB,OAAO;CAAW;CACjF;EACE,MAAM;EACN,IAAI;EACJ,SAAS;EAC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