@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,150 @@
|
|
|
1
|
+
import { AgentRouteBinding } from "./agent-route.mjs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/schema/work.d.ts
|
|
4
|
+
/** Finite JSON data accepted at persisted workflow boundaries. */
|
|
5
|
+
type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
|
|
6
|
+
readonly [key: string]: JsonValue;
|
|
7
|
+
};
|
|
8
|
+
declare const workflowInputType: unique symbol;
|
|
9
|
+
declare const workflowOutputType: unique symbol;
|
|
10
|
+
/** Exact workflow identity carrying its input and output types for safe construction. */
|
|
11
|
+
type WorkflowBinding<Input extends JsonValue = JsonValue, Output extends JsonValue = JsonValue, Id extends string = string, Version extends number = number> = z.infer<typeof workflowBindingSchema> & {
|
|
12
|
+
readonly id: Id;
|
|
13
|
+
readonly version: Version;
|
|
14
|
+
readonly [workflowInputType]?: Input;
|
|
15
|
+
readonly [workflowOutputType]?: Output;
|
|
16
|
+
};
|
|
17
|
+
/** Definition-like value exposing an exact typed workflow binding. */
|
|
18
|
+
interface WorkflowReference<InputSchema extends z.ZodType = z.ZodType, Binding extends WorkflowBinding = WorkflowBinding> {
|
|
19
|
+
readonly binding: Binding;
|
|
20
|
+
readonly input: InputSchema;
|
|
21
|
+
}
|
|
22
|
+
/** Input type carried by a definition-like workflow reference. */
|
|
23
|
+
type WorkflowReferenceInput<Reference extends WorkflowReference> = z.input<Reference["input"]> & JsonValue;
|
|
24
|
+
/** Maximum serialized UTF-8 size of workflow input, output, or message JSON. */
|
|
25
|
+
declare const MAX_WORK_JSON_BYTES: number;
|
|
26
|
+
/** Maximum nesting depth below the root of persisted workflow JSON. */
|
|
27
|
+
declare const MAX_WORK_JSON_DEPTH = 32;
|
|
28
|
+
/** Validates bounded canonical JSON without cycles, accessors, or sparse arrays. */
|
|
29
|
+
declare const jsonValueSchema: z.ZodCustom<JsonValue, JsonValue>;
|
|
30
|
+
/** Validates an exact workflow identifier and positive integer version. */
|
|
31
|
+
declare const workflowBindingSchema: z.core.$ZodBranded<z.ZodObject<{
|
|
32
|
+
id: z.ZodString;
|
|
33
|
+
version: z.ZodNumber;
|
|
34
|
+
}, z.core.$strict>, "WorkflowBinding", "out">;
|
|
35
|
+
/** Plain identifier and version accepted when constructing a workflow binding. */
|
|
36
|
+
interface WorkflowBindingInput<Id extends string = string, Version extends number = number> {
|
|
37
|
+
readonly id: Id;
|
|
38
|
+
readonly version: Version;
|
|
39
|
+
}
|
|
40
|
+
/** Validates and brands an exact workflow binding while preserving literal identity. */
|
|
41
|
+
declare function parseWorkflowBinding<const Input extends WorkflowBindingInput>(input: Input): WorkflowBinding<JsonValue, JsonValue, Input["id"], Input["version"]>;
|
|
42
|
+
/** Validates the required versioned input and completion contract for a Task. */
|
|
43
|
+
declare const taskWorkSchema: z.ZodObject<{
|
|
44
|
+
title: z.ZodString;
|
|
45
|
+
input: z.ZodCustom<JsonValue, JsonValue>;
|
|
46
|
+
completionCriteria: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
47
|
+
workflow: z.core.$ZodBranded<z.ZodObject<{
|
|
48
|
+
id: z.ZodString;
|
|
49
|
+
version: z.ZodNumber;
|
|
50
|
+
}, z.core.$strict>, "WorkflowBinding", "out">;
|
|
51
|
+
route: z.ZodOptional<z.core.$ZodBranded<z.ZodObject<{
|
|
52
|
+
id: z.ZodString;
|
|
53
|
+
version: z.ZodNumber;
|
|
54
|
+
}, z.core.$strict>, "AgentRouteBinding", "out">>;
|
|
55
|
+
}, z.core.$strict>;
|
|
56
|
+
/** Validates canonical output recorded when workflow work completes. */
|
|
57
|
+
declare const taskWorkResultSchema: z.ZodObject<{
|
|
58
|
+
output: z.ZodCustom<JsonValue, JsonValue>;
|
|
59
|
+
completedAt: z.ZodISODateTime;
|
|
60
|
+
}, z.core.$strict>;
|
|
61
|
+
/** Required title, typed input, criteria, workflow, and optional route contract of a Task. */
|
|
62
|
+
interface TaskWork<Input extends JsonValue = JsonValue, Workflow extends WorkflowBinding = WorkflowBinding> {
|
|
63
|
+
/** Short operator-facing description of the requested work. */
|
|
64
|
+
readonly title: string;
|
|
65
|
+
/** Canonical bounded JSON validated by the exact registered workflow before persistence. */
|
|
66
|
+
readonly input: Input;
|
|
67
|
+
/** Explicit acceptance statements interpreted by workflow or agent policy. */
|
|
68
|
+
readonly completionCriteria: readonly string[];
|
|
69
|
+
/** Exact workflow ID and version that validate this Task's input and output. */
|
|
70
|
+
readonly workflow: Workflow;
|
|
71
|
+
/** Exact agent route to dispatch, or absent when workflow code owns execution. */
|
|
72
|
+
readonly route?: AgentRouteBinding;
|
|
73
|
+
}
|
|
74
|
+
/** Validated canonical output and completion timestamp of succeeded workflow work. */
|
|
75
|
+
type TaskWorkResult = z.infer<typeof taskWorkResultSchema>;
|
|
76
|
+
/** Named fields for constructing generic `task@1` work. */
|
|
77
|
+
interface TaskWorkOptions<Input extends JsonValue = JsonValue> {
|
|
78
|
+
/** Short operator-facing description, trimmed and limited to 256 characters. */
|
|
79
|
+
readonly title: string;
|
|
80
|
+
/** Bounded JSON input. Defaults to an empty object. */
|
|
81
|
+
readonly input?: Input;
|
|
82
|
+
/** Generic work always selects `task@1`; use `WorkflowTaskWorkOptions` for custom workflows. */
|
|
83
|
+
readonly workflow?: never;
|
|
84
|
+
/** Add an exact agent route after construction or use `routeTaskWork`. */
|
|
85
|
+
readonly route?: never;
|
|
86
|
+
/** Generic work starts with no explicit criteria. */
|
|
87
|
+
readonly completionCriteria?: never;
|
|
88
|
+
}
|
|
89
|
+
/** Named fields for constructing work owned by an exact workflow contract. */
|
|
90
|
+
interface WorkflowTaskWorkOptions<Input extends JsonValue = JsonValue, Workflow extends WorkflowBinding | WorkflowReference = WorkflowBinding | WorkflowReference> {
|
|
91
|
+
/** Short operator-facing description, trimmed and limited to 256 characters. */
|
|
92
|
+
readonly title: string;
|
|
93
|
+
/** Input statically checked against the referenced workflow and validated again by the engine. */
|
|
94
|
+
readonly input: Input;
|
|
95
|
+
/** Exact typed workflow definition or binding; no implicit latest version is selected. */
|
|
96
|
+
readonly workflow: Workflow;
|
|
97
|
+
/** Add an exact agent route after construction or use `routeTaskWork`. */
|
|
98
|
+
readonly route?: never;
|
|
99
|
+
/** Workflow policy owns acceptance criteria; this helper starts with an empty list. */
|
|
100
|
+
readonly completionCriteria?: never;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Constructs generic `task@1` work with an empty completion-criteria list.
|
|
104
|
+
*
|
|
105
|
+
* @remarks
|
|
106
|
+
* This helper constructs the persisted work envelope; it does not create or dispatch a Task.
|
|
107
|
+
* Supplying a workflow definition or typed binding preserves its input/output relationship for
|
|
108
|
+
* later `stores.work.completeWorkflow` calls. The store engine performs authoritative runtime
|
|
109
|
+
* validation against its registered exact workflow version.
|
|
110
|
+
*
|
|
111
|
+
* @param options - Named title and optional bounded JSON input for generic `task@1` work.
|
|
112
|
+
* @returns A new work envelope selecting the generic `task@1` workflow.
|
|
113
|
+
* @throws A Zod validation error when the title, input, or workflow binding is invalid.
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```ts
|
|
117
|
+
* import { taskWork } from "@vercel/factory/workflows";
|
|
118
|
+
*
|
|
119
|
+
* const work = taskWork({
|
|
120
|
+
* title: "Summarize the incident",
|
|
121
|
+
* input: { incidentId: "inc_123" },
|
|
122
|
+
* });
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
declare function taskWork<const Input extends JsonValue = JsonValue>(options: TaskWorkOptions<Input>): TaskWork<Input>;
|
|
126
|
+
/**
|
|
127
|
+
* Constructs work from a workflow definition while preserving its exact typed binding.
|
|
128
|
+
*
|
|
129
|
+
* @param options - Named title, workflow definition, and input accepted by that definition.
|
|
130
|
+
* @returns A new work envelope carrying the definition's exact workflow binding.
|
|
131
|
+
* @throws A Zod validation error when the title, input envelope, or workflow binding is invalid.
|
|
132
|
+
*/
|
|
133
|
+
declare function taskWork<InputSchema extends z.ZodType, Binding extends WorkflowBinding>(options: WorkflowTaskWorkOptions<NoInfer<z.input<InputSchema>> & JsonValue, {
|
|
134
|
+
readonly input: InputSchema;
|
|
135
|
+
readonly binding: Binding;
|
|
136
|
+
}>): TaskWork<z.input<InputSchema> & JsonValue, Binding>;
|
|
137
|
+
/**
|
|
138
|
+
* Constructs work from an exact typed workflow binding.
|
|
139
|
+
*
|
|
140
|
+
* @param options - Named title, exact binding, and input carried by that binding.
|
|
141
|
+
* @returns A new work envelope carrying the supplied exact workflow binding.
|
|
142
|
+
* @throws A Zod validation error when the title, input envelope, or workflow binding is invalid.
|
|
143
|
+
*/
|
|
144
|
+
declare function taskWork<Input extends JsonValue, Output extends JsonValue, const Id extends string, const Version extends number>(options: WorkflowTaskWorkOptions<NoInfer<Input>, WorkflowBinding<Input, Output, Id, Version> & {
|
|
145
|
+
readonly binding?: never;
|
|
146
|
+
readonly input?: never;
|
|
147
|
+
}>): TaskWork<Input, WorkflowBinding<Input, Output, Id, Version>>;
|
|
148
|
+
//#endregion
|
|
149
|
+
export { JsonValue, MAX_WORK_JSON_BYTES, MAX_WORK_JSON_DEPTH, TaskWork, TaskWorkOptions, TaskWorkResult, WorkflowBinding, WorkflowBindingInput, WorkflowReference, WorkflowReferenceInput, WorkflowTaskWorkOptions, jsonValueSchema, parseWorkflowBinding, taskWork, taskWorkResultSchema, taskWorkSchema, workflowBindingSchema };
|
|
150
|
+
//# sourceMappingURL=work.d.mts.map
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { isoDateTimeSchema } from "./common.mjs";
|
|
2
|
+
import { agentRouteBindingSchema } from "./agent-route.mjs";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
//#region src/schema/work.ts
|
|
5
|
+
/** Maximum serialized UTF-8 size of workflow input, output, or message JSON. */
|
|
6
|
+
const MAX_WORK_JSON_BYTES = 65536;
|
|
7
|
+
/** Maximum nesting depth below the root of persisted workflow JSON. */
|
|
8
|
+
const MAX_WORK_JSON_DEPTH = 32;
|
|
9
|
+
const encoder = new TextEncoder();
|
|
10
|
+
function isBoundedJson(value) {
|
|
11
|
+
let bytes = 0;
|
|
12
|
+
const ancestors = /* @__PURE__ */ new Set();
|
|
13
|
+
const addBytes = (count) => {
|
|
14
|
+
bytes += count;
|
|
15
|
+
return bytes <= MAX_WORK_JSON_BYTES;
|
|
16
|
+
};
|
|
17
|
+
const stringFits = (text) => text.length <= 65536 && addBytes(encoder.encode(JSON.stringify(text)).byteLength);
|
|
18
|
+
const visit = (entry, depth) => {
|
|
19
|
+
if (depth > 32) return false;
|
|
20
|
+
if (entry === null) return addBytes(4);
|
|
21
|
+
if (typeof entry === "boolean") return addBytes(entry ? 4 : 5);
|
|
22
|
+
if (typeof entry === "string") return stringFits(entry);
|
|
23
|
+
if (typeof entry === "number") return Number.isFinite(entry) && addBytes(JSON.stringify(entry).length);
|
|
24
|
+
if (typeof entry !== "object" || ancestors.has(entry)) return false;
|
|
25
|
+
const array = Array.isArray(entry);
|
|
26
|
+
const prototype = Object.getPrototypeOf(entry);
|
|
27
|
+
if (array ? prototype !== Array.prototype : prototype !== Object.prototype && prototype !== null) return false;
|
|
28
|
+
if (!addBytes(2)) return false;
|
|
29
|
+
ancestors.add(entry);
|
|
30
|
+
const keys = Reflect.ownKeys(entry);
|
|
31
|
+
if (array) {
|
|
32
|
+
if (entry.length > 65536 || keys.length !== entry.length + 1) return false;
|
|
33
|
+
for (let index = 0; index < entry.length; index++) {
|
|
34
|
+
const descriptor = Object.getOwnPropertyDescriptor(entry, String(index));
|
|
35
|
+
if (!descriptor || !descriptor.enumerable || !("value" in descriptor)) return false;
|
|
36
|
+
if (index > 0 && !addBytes(1)) return false;
|
|
37
|
+
if (!visit(descriptor.value, depth + 1)) return false;
|
|
38
|
+
}
|
|
39
|
+
} else for (const [index, key] of keys.entries()) {
|
|
40
|
+
if (typeof key !== "string") return false;
|
|
41
|
+
const descriptor = Object.getOwnPropertyDescriptor(entry, key);
|
|
42
|
+
if (!descriptor || !descriptor.enumerable || !("value" in descriptor)) return false;
|
|
43
|
+
if (index > 0 && !addBytes(1)) return false;
|
|
44
|
+
if (!stringFits(key) || !addBytes(1) || !visit(descriptor.value, depth + 1)) return false;
|
|
45
|
+
}
|
|
46
|
+
ancestors.delete(entry);
|
|
47
|
+
return true;
|
|
48
|
+
};
|
|
49
|
+
try {
|
|
50
|
+
return visit(value, 0);
|
|
51
|
+
} catch {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** Validates bounded canonical JSON without cycles, accessors, or sparse arrays. */
|
|
56
|
+
const jsonValueSchema = z.custom(isBoundedJson, { message: `Expected finite JSON with at most ${MAX_WORK_JSON_BYTES} UTF-8 bytes and depth 32; cycles, accessors, sparse arrays, and non-JSON properties are not allowed` }).describe("Finite JSON value, at most 64 KiB serialized UTF-8 and 32 levels below the root.");
|
|
57
|
+
/** Validates an exact workflow identifier and positive integer version. */
|
|
58
|
+
const workflowBindingSchema = z.strictObject({
|
|
59
|
+
id: z.string().max(64).regex(/^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$/, "Expected a lowercase hyphenated or snake_case workflow name").describe("Registered workflow name, starting with a lowercase letter; at most 64 characters."),
|
|
60
|
+
version: z.number().int().positive().describe("Exact positive integer version of the registered workflow.")
|
|
61
|
+
}).describe("Explicit workflow identity and version; never resolved to an implicit latest version.").brand();
|
|
62
|
+
/** Validates and brands an exact workflow binding while preserving literal identity. */
|
|
63
|
+
function parseWorkflowBinding(input) {
|
|
64
|
+
return workflowBindingSchema.parse(input);
|
|
65
|
+
}
|
|
66
|
+
/** Validates the required versioned input and completion contract for a Task. */
|
|
67
|
+
const taskWorkSchema = z.strictObject({
|
|
68
|
+
title: z.string().trim().min(1).max(256).describe("Short work title, from 1 to 256 characters."),
|
|
69
|
+
input: jsonValueSchema.describe("Bounded JSON input to validate against the registered workflow input schema."),
|
|
70
|
+
completionCriteria: z.array(z.string().trim().min(1).max(2048).describe("One completion criterion, from 1 to 2048 characters.")).max(32).readonly().describe("Up to 32 explicit completion criteria; workflow code determines completion."),
|
|
71
|
+
workflow: workflowBindingSchema.describe("Exact registered workflow contract that owns this work."),
|
|
72
|
+
route: agentRouteBindingSchema.optional().describe("Exact agent execution route selected by the workflow; absent for work not dispatched to an agent.")
|
|
73
|
+
}).describe("Required versioned work contract; registered workflow validation is owned by the engine.");
|
|
74
|
+
/** Validates canonical output recorded when workflow work completes. */
|
|
75
|
+
const taskWorkResultSchema = z.strictObject({
|
|
76
|
+
output: jsonValueSchema.describe("Canonical bounded JSON output, validated by the engine against the stored workflow output schema."),
|
|
77
|
+
completedAt: isoDateTimeSchema.describe("Engine timestamp when the workflow result was completed.")
|
|
78
|
+
}).describe("Completed result of workflow work; registered output validation is owned by the engine.");
|
|
79
|
+
function taskWork(options) {
|
|
80
|
+
const { title, input = {} } = options;
|
|
81
|
+
const workflow = options.workflow ?? parseWorkflowBinding({
|
|
82
|
+
id: "task",
|
|
83
|
+
version: 1
|
|
84
|
+
});
|
|
85
|
+
const binding = "binding" in workflow ? workflow.binding : workflow;
|
|
86
|
+
const parsed = taskWorkSchema.parse({
|
|
87
|
+
title,
|
|
88
|
+
input,
|
|
89
|
+
workflow: binding,
|
|
90
|
+
completionCriteria: []
|
|
91
|
+
});
|
|
92
|
+
return structuredClone({
|
|
93
|
+
title: parsed.title,
|
|
94
|
+
input,
|
|
95
|
+
workflow: binding,
|
|
96
|
+
completionCriteria: []
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
100
|
+
export { MAX_WORK_JSON_BYTES, MAX_WORK_JSON_DEPTH, jsonValueSchema, parseWorkflowBinding, taskWork, taskWorkResultSchema, taskWorkSchema, workflowBindingSchema };
|
|
101
|
+
|
|
102
|
+
//# sourceMappingURL=work.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"work.mjs","names":[],"sources":["../../src/schema/work.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { agentRouteBindingSchema, type AgentRouteBinding } from \"./agent-route\";\nimport { isoDateTimeSchema } from \"./common\";\n\n/** Finite JSON data accepted at persisted workflow boundaries. */\nexport type JsonValue =\n | null\n | boolean\n | number\n | string\n | readonly JsonValue[]\n | { readonly [key: string]: JsonValue };\n\ndeclare const workflowInputType: unique symbol;\ndeclare const workflowOutputType: unique symbol;\n\n/** Exact workflow identity carrying its input and output types for safe construction. */\nexport type WorkflowBinding<\n Input extends JsonValue = JsonValue,\n Output extends JsonValue = JsonValue,\n Id extends string = string,\n Version extends number = number,\n> = z.infer<typeof workflowBindingSchema> & {\n readonly id: Id;\n readonly version: Version;\n readonly [workflowInputType]?: Input;\n readonly [workflowOutputType]?: Output;\n};\n\n/** Definition-like value exposing an exact typed workflow binding. */\nexport interface WorkflowReference<\n InputSchema extends z.ZodType = z.ZodType,\n Binding extends WorkflowBinding = WorkflowBinding,\n> {\n readonly binding: Binding;\n readonly input: InputSchema;\n}\n\n/** Input type carried by a definition-like workflow reference. */\nexport type WorkflowReferenceInput<Reference extends WorkflowReference> = z.input<\n Reference[\"input\"]\n> &\n JsonValue;\n\n/** Maximum serialized UTF-8 size of workflow input, output, or message JSON. */\nexport const MAX_WORK_JSON_BYTES = 64 * 1024;\n/** Maximum nesting depth below the root of persisted workflow JSON. */\nexport const MAX_WORK_JSON_DEPTH = 32;\n\nconst encoder = new TextEncoder();\n\nfunction isBoundedJson(value: unknown): boolean {\n let bytes = 0;\n const ancestors = new Set<object>();\n const addBytes = (count: number): boolean => {\n bytes += count;\n return bytes <= MAX_WORK_JSON_BYTES;\n };\n const stringFits = (text: string): boolean =>\n text.length <= MAX_WORK_JSON_BYTES && addBytes(encoder.encode(JSON.stringify(text)).byteLength);\n\n const visit = (entry: unknown, depth: number): boolean => {\n if (depth > MAX_WORK_JSON_DEPTH) return false;\n if (entry === null) return addBytes(4);\n if (typeof entry === \"boolean\") return addBytes(entry ? 4 : 5);\n if (typeof entry === \"string\") return stringFits(entry);\n if (typeof entry === \"number\") {\n return Number.isFinite(entry) && addBytes(JSON.stringify(entry).length);\n }\n if (typeof entry !== \"object\" || ancestors.has(entry)) return false;\n\n const array = Array.isArray(entry);\n const prototype: unknown = Object.getPrototypeOf(entry);\n if (\n array ? prototype !== Array.prototype : prototype !== Object.prototype && prototype !== null\n ) {\n return false;\n }\n if (!addBytes(2)) return false;\n ancestors.add(entry);\n const keys = Reflect.ownKeys(entry);\n if (array) {\n if (entry.length > MAX_WORK_JSON_BYTES || keys.length !== entry.length + 1) return false;\n for (let index = 0; index < entry.length; index++) {\n const descriptor = Object.getOwnPropertyDescriptor(entry, String(index));\n if (!descriptor || !descriptor.enumerable || !(\"value\" in descriptor)) return false;\n if (index > 0 && !addBytes(1)) return false;\n if (!visit(descriptor.value, depth + 1)) return false;\n }\n } else {\n for (const [index, key] of keys.entries()) {\n if (typeof key !== \"string\") return false;\n const descriptor = Object.getOwnPropertyDescriptor(entry, key);\n if (!descriptor || !descriptor.enumerable || !(\"value\" in descriptor)) return false;\n if (index > 0 && !addBytes(1)) return false;\n if (!stringFits(key) || !addBytes(1) || !visit(descriptor.value, depth + 1)) return false;\n }\n }\n ancestors.delete(entry);\n return true;\n };\n\n try {\n return visit(value, 0);\n } catch {\n return false;\n }\n}\n\n/** Validates bounded canonical JSON without cycles, accessors, or sparse arrays. */\nexport const jsonValueSchema = z\n .custom<JsonValue>(isBoundedJson, {\n message: `Expected finite JSON with at most ${MAX_WORK_JSON_BYTES} UTF-8 bytes and depth ${MAX_WORK_JSON_DEPTH}; cycles, accessors, sparse arrays, and non-JSON properties are not allowed`,\n })\n .describe(\"Finite JSON value, at most 64 KiB serialized UTF-8 and 32 levels below the root.\");\n\n/** Validates an exact workflow identifier and positive integer version. */\nexport const workflowBindingSchema = z\n .strictObject({\n id: z\n .string()\n .max(64)\n .regex(\n /^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$/,\n \"Expected a lowercase hyphenated or snake_case workflow name\",\n )\n .describe(\n \"Registered workflow name, starting with a lowercase letter; at most 64 characters.\",\n ),\n version: z\n .number()\n .int()\n .positive()\n .describe(\"Exact positive integer version of the registered workflow.\"),\n })\n .describe(\"Explicit workflow identity and version; never resolved to an implicit latest version.\")\n .brand<\"WorkflowBinding\">();\n\n/** Plain identifier and version accepted when constructing a workflow binding. */\nexport interface WorkflowBindingInput<Id extends string = string, Version extends number = number> {\n readonly id: Id;\n readonly version: Version;\n}\n\n/** Validates and brands an exact workflow binding while preserving literal identity. */\nexport function parseWorkflowBinding<const Input extends WorkflowBindingInput>(\n input: Input,\n): WorkflowBinding<JsonValue, JsonValue, Input[\"id\"], Input[\"version\"]> {\n return workflowBindingSchema.parse(input) as WorkflowBinding<\n JsonValue,\n JsonValue,\n Input[\"id\"],\n Input[\"version\"]\n >;\n}\n\n/** Validates the required versioned input and completion contract for a Task. */\nexport const taskWorkSchema = z\n .strictObject({\n title: z\n .string()\n .trim()\n .min(1)\n .max(256)\n .describe(\"Short work title, from 1 to 256 characters.\"),\n input: jsonValueSchema.describe(\n \"Bounded JSON input to validate against the registered workflow input schema.\",\n ),\n completionCriteria: z\n .array(\n z\n .string()\n .trim()\n .min(1)\n .max(2048)\n .describe(\"One completion criterion, from 1 to 2048 characters.\"),\n )\n .max(32)\n .readonly()\n .describe(\"Up to 32 explicit completion criteria; workflow code determines completion.\"),\n workflow: workflowBindingSchema.describe(\n \"Exact registered workflow contract that owns this work.\",\n ),\n route: agentRouteBindingSchema\n .optional()\n .describe(\n \"Exact agent execution route selected by the workflow; absent for work not dispatched to an agent.\",\n ),\n })\n .describe(\n \"Required versioned work contract; registered workflow validation is owned by the engine.\",\n );\n\n/** Validates canonical output recorded when workflow work completes. */\nexport const taskWorkResultSchema = z\n .strictObject({\n output: jsonValueSchema.describe(\n \"Canonical bounded JSON output, validated by the engine against the stored workflow output schema.\",\n ),\n completedAt: isoDateTimeSchema.describe(\n \"Engine timestamp when the workflow result was completed.\",\n ),\n })\n .describe(\n \"Completed result of workflow work; registered output validation is owned by the engine.\",\n );\n\n/** Required title, typed input, criteria, workflow, and optional route contract of a Task. */\nexport interface TaskWork<\n Input extends JsonValue = JsonValue,\n Workflow extends WorkflowBinding = WorkflowBinding,\n> {\n /** Short operator-facing description of the requested work. */\n readonly title: string;\n /** Canonical bounded JSON validated by the exact registered workflow before persistence. */\n readonly input: Input;\n /** Explicit acceptance statements interpreted by workflow or agent policy. */\n readonly completionCriteria: readonly string[];\n /** Exact workflow ID and version that validate this Task's input and output. */\n readonly workflow: Workflow;\n /** Exact agent route to dispatch, or absent when workflow code owns execution. */\n readonly route?: AgentRouteBinding;\n}\n/** Validated canonical output and completion timestamp of succeeded workflow work. */\nexport type TaskWorkResult = z.infer<typeof taskWorkResultSchema>;\n\n/** Named fields for constructing generic `task@1` work. */\nexport interface TaskWorkOptions<Input extends JsonValue = JsonValue> {\n /** Short operator-facing description, trimmed and limited to 256 characters. */\n readonly title: string;\n /** Bounded JSON input. Defaults to an empty object. */\n readonly input?: Input;\n /** Generic work always selects `task@1`; use `WorkflowTaskWorkOptions` for custom workflows. */\n readonly workflow?: never;\n /** Add an exact agent route after construction or use `routeTaskWork`. */\n readonly route?: never;\n /** Generic work starts with no explicit criteria. */\n readonly completionCriteria?: never;\n}\n\n/** Named fields for constructing work owned by an exact workflow contract. */\nexport interface WorkflowTaskWorkOptions<\n Input extends JsonValue = JsonValue,\n Workflow extends WorkflowBinding | WorkflowReference = WorkflowBinding | WorkflowReference,\n> {\n /** Short operator-facing description, trimmed and limited to 256 characters. */\n readonly title: string;\n /** Input statically checked against the referenced workflow and validated again by the engine. */\n readonly input: Input;\n /** Exact typed workflow definition or binding; no implicit latest version is selected. */\n readonly workflow: Workflow;\n /** Add an exact agent route after construction or use `routeTaskWork`. */\n readonly route?: never;\n /** Workflow policy owns acceptance criteria; this helper starts with an empty list. */\n readonly completionCriteria?: never;\n}\n\n/**\n * Constructs generic `task@1` work with an empty completion-criteria list.\n *\n * @remarks\n * This helper constructs the persisted work envelope; it does not create or dispatch a Task.\n * Supplying a workflow definition or typed binding preserves its input/output relationship for\n * later `stores.work.completeWorkflow` calls. The store engine performs authoritative runtime\n * validation against its registered exact workflow version.\n *\n * @param options - Named title and optional bounded JSON input for generic `task@1` work.\n * @returns A new work envelope selecting the generic `task@1` workflow.\n * @throws A Zod validation error when the title, input, or workflow binding is invalid.\n *\n * @example\n * ```ts\n * import { taskWork } from \"@vercel/factory/workflows\";\n *\n * const work = taskWork({\n * title: \"Summarize the incident\",\n * input: { incidentId: \"inc_123\" },\n * });\n * ```\n */\nexport function taskWork<const Input extends JsonValue = JsonValue>(\n options: TaskWorkOptions<Input>,\n): TaskWork<Input>;\n/**\n * Constructs work from a workflow definition while preserving its exact typed binding.\n *\n * @param options - Named title, workflow definition, and input accepted by that definition.\n * @returns A new work envelope carrying the definition's exact workflow binding.\n * @throws A Zod validation error when the title, input envelope, or workflow binding is invalid.\n */\nexport function taskWork<InputSchema extends z.ZodType, Binding extends WorkflowBinding>(\n options: WorkflowTaskWorkOptions<\n NoInfer<z.input<InputSchema>> & JsonValue,\n { readonly input: InputSchema; readonly binding: Binding }\n >,\n): TaskWork<z.input<InputSchema> & JsonValue, Binding>;\n/**\n * Constructs work from an exact typed workflow binding.\n *\n * @param options - Named title, exact binding, and input carried by that binding.\n * @returns A new work envelope carrying the supplied exact workflow binding.\n * @throws A Zod validation error when the title, input envelope, or workflow binding is invalid.\n */\nexport function taskWork<\n Input extends JsonValue,\n Output extends JsonValue,\n const Id extends string,\n const Version extends number,\n>(\n options: WorkflowTaskWorkOptions<\n NoInfer<Input>,\n WorkflowBinding<Input, Output, Id, Version> & {\n readonly binding?: never;\n readonly input?: never;\n }\n >,\n): TaskWork<Input, WorkflowBinding<Input, Output, Id, Version>>;\nexport function taskWork(options: TaskWorkOptions | WorkflowTaskWorkOptions): TaskWork {\n const { title, input = {} } = options;\n const workflow =\n options.workflow ??\n parseWorkflowBinding({\n id: \"task\",\n version: 1,\n });\n const binding = \"binding\" in workflow ? workflow.binding : workflow;\n const parsed = taskWorkSchema.parse({ title, input, workflow: binding, completionCriteria: [] });\n return structuredClone({\n title: parsed.title,\n input,\n workflow: binding,\n completionCriteria: [],\n });\n}\n"],"mappings":";;;;;AA6CA,MAAa,sBAAsB;;AAEnC,MAAa,sBAAsB;AAEnC,MAAM,UAAU,IAAI,YAAY;AAEhC,SAAS,cAAc,OAAyB;CAC9C,IAAI,QAAQ;CACZ,MAAM,4BAAY,IAAI,IAAY;CAClC,MAAM,YAAY,UAA2B;EAC3C,SAAS;EACT,OAAO,SAAS;CAClB;CACA,MAAM,cAAc,SAClB,KAAK,UAAA,SAAiC,SAAS,QAAQ,OAAO,KAAK,UAAU,IAAI,CAAC,CAAC,CAAC,UAAU;CAEhG,MAAM,SAAS,OAAgB,UAA2B;EACxD,IAAI,QAAA,IAA6B,OAAO;EACxC,IAAI,UAAU,MAAM,OAAO,SAAS,CAAC;EACrC,IAAI,OAAO,UAAU,WAAW,OAAO,SAAS,QAAQ,IAAI,CAAC;EAC7D,IAAI,OAAO,UAAU,UAAU,OAAO,WAAW,KAAK;EACtD,IAAI,OAAO,UAAU,UACnB,OAAO,OAAO,SAAS,KAAK,KAAK,SAAS,KAAK,UAAU,KAAK,CAAC,CAAC,MAAM;EAExE,IAAI,OAAO,UAAU,YAAY,UAAU,IAAI,KAAK,GAAG,OAAO;EAE9D,MAAM,QAAQ,MAAM,QAAQ,KAAK;EACjC,MAAM,YAAqB,OAAO,eAAe,KAAK;EACtD,IACE,QAAQ,cAAc,MAAM,YAAY,cAAc,OAAO,aAAa,cAAc,MAExF,OAAO;EAET,IAAI,CAAC,SAAS,CAAC,GAAG,OAAO;EACzB,UAAU,IAAI,KAAK;EACnB,MAAM,OAAO,QAAQ,QAAQ,KAAK;EAClC,IAAI,OAAO;GACT,IAAI,MAAM,SAAA,SAAgC,KAAK,WAAW,MAAM,SAAS,GAAG,OAAO;GACnF,KAAK,IAAI,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS;IACjD,MAAM,aAAa,OAAO,yBAAyB,OAAO,OAAO,KAAK,CAAC;IACvE,IAAI,CAAC,cAAc,CAAC,WAAW,cAAc,EAAE,WAAW,aAAa,OAAO;IAC9E,IAAI,QAAQ,KAAK,CAAC,SAAS,CAAC,GAAG,OAAO;IACtC,IAAI,CAAC,MAAM,WAAW,OAAO,QAAQ,CAAC,GAAG,OAAO;GAClD;EACF,OACE,KAAK,MAAM,CAAC,OAAO,QAAQ,KAAK,QAAQ,GAAG;GACzC,IAAI,OAAO,QAAQ,UAAU,OAAO;GACpC,MAAM,aAAa,OAAO,yBAAyB,OAAO,GAAG;GAC7D,IAAI,CAAC,cAAc,CAAC,WAAW,cAAc,EAAE,WAAW,aAAa,OAAO;GAC9E,IAAI,QAAQ,KAAK,CAAC,SAAS,CAAC,GAAG,OAAO;GACtC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,WAAW,OAAO,QAAQ,CAAC,GAAG,OAAO;EACtF;EAEF,UAAU,OAAO,KAAK;EACtB,OAAO;CACT;CAEA,IAAI;EACF,OAAO,MAAM,OAAO,CAAC;CACvB,QAAQ;EACN,OAAO;CACT;AACF;;AAGA,MAAa,kBAAkB,EAC5B,OAAkB,eAAe,EAChC,SAAS,qCAAqC,oBAAoB,sGACpE,CAAC,CAAC,CACD,SAAS,kFAAkF;;AAG9F,MAAa,wBAAwB,EAClC,aAAa;CACZ,IAAI,EACD,OAAO,CAAC,CACR,IAAI,EAAE,CAAC,CACP,MACC,sCACA,6DACF,CAAC,CACA,SACC,oFACF;CACF,SAAS,EACN,OAAO,CAAC,CACR,IAAI,CAAC,CACL,SAAS,CAAC,CACV,SAAS,4DAA4D;AAC1E,CAAC,CAAC,CACD,SAAS,uFAAuF,CAAC,CACjG,MAAyB;;AAS5B,SAAgB,qBACd,OACsE;CACtE,OAAO,sBAAsB,MAAM,KAAK;AAM1C;;AAGA,MAAa,iBAAiB,EAC3B,aAAa;CACZ,OAAO,EACJ,OAAO,CAAC,CACR,KAAK,CAAC,CACN,IAAI,CAAC,CAAC,CACN,IAAI,GAAG,CAAC,CACR,SAAS,6CAA6C;CACzD,OAAO,gBAAgB,SACrB,8EACF;CACA,oBAAoB,EACjB,MACC,EACG,OAAO,CAAC,CACR,KAAK,CAAC,CACN,IAAI,CAAC,CAAC,CACN,IAAI,IAAI,CAAC,CACT,SAAS,sDAAsD,CACpE,CAAC,CACA,IAAI,EAAE,CAAC,CACP,SAAS,CAAC,CACV,SAAS,6EAA6E;CACzF,UAAU,sBAAsB,SAC9B,yDACF;CACA,OAAO,wBACJ,SAAS,CAAC,CACV,SACC,mGACF;AACJ,CAAC,CAAC,CACD,SACC,0FACF;;AAGF,MAAa,uBAAuB,EACjC,aAAa;CACZ,QAAQ,gBAAgB,SACtB,mGACF;CACA,aAAa,kBAAkB,SAC7B,0DACF;AACF,CAAC,CAAC,CACD,SACC,yFACF;AAgHF,SAAgB,SAAS,SAA8D;CACrF,MAAM,EAAE,OAAO,QAAQ,CAAC,MAAM;CAC9B,MAAM,WACJ,QAAQ,YACR,qBAAqB;EACnB,IAAI;EACJ,SAAS;CACX,CAAC;CACH,MAAM,UAAU,aAAa,WAAW,SAAS,UAAU;CAC3D,MAAM,SAAS,eAAe,MAAM;EAAE;EAAO;EAAO,UAAU;EAAS,oBAAoB,CAAC;CAAE,CAAC;CAC/F,OAAO,gBAAgB;EACrB,OAAO,OAAO;EACd;EACA,UAAU;EACV,oBAAoB,CAAC;CACvB,CAAC;AACH"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/session-previews.d.ts
|
|
3
|
+
/** Validates an application-supplied preview page with explicit availability and expiry. */
|
|
4
|
+
declare const sessionPreviewSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
5
|
+
status: z.ZodEnum<{
|
|
6
|
+
unknown: "unknown";
|
|
7
|
+
ready: "ready";
|
|
8
|
+
}>;
|
|
9
|
+
url: z.ZodString;
|
|
10
|
+
id: z.ZodString;
|
|
11
|
+
title: z.ZodString;
|
|
12
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
13
|
+
source: z.ZodString;
|
|
14
|
+
revision: z.ZodNullable<z.ZodString>;
|
|
15
|
+
expiresAt: z.ZodOptional<z.ZodISODateTime>;
|
|
16
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
17
|
+
status: z.ZodEnum<{
|
|
18
|
+
unavailable: "unavailable";
|
|
19
|
+
starting: "starting";
|
|
20
|
+
expired: "expired";
|
|
21
|
+
}>;
|
|
22
|
+
reason: z.ZodString;
|
|
23
|
+
id: z.ZodString;
|
|
24
|
+
title: z.ZodString;
|
|
25
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
26
|
+
source: z.ZodString;
|
|
27
|
+
revision: z.ZodNullable<z.ZodString>;
|
|
28
|
+
expiresAt: z.ZodOptional<z.ZodISODateTime>;
|
|
29
|
+
}, z.core.$strict>], "status">;
|
|
30
|
+
/** Validates the optional live-preview projection, including instructions for non-web work. */
|
|
31
|
+
declare const sessionPreviewsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
32
|
+
state: z.ZodLiteral<"ready">;
|
|
33
|
+
previews: z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
34
|
+
status: z.ZodEnum<{
|
|
35
|
+
unknown: "unknown";
|
|
36
|
+
ready: "ready";
|
|
37
|
+
}>;
|
|
38
|
+
url: z.ZodString;
|
|
39
|
+
id: z.ZodString;
|
|
40
|
+
title: z.ZodString;
|
|
41
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
42
|
+
source: z.ZodString;
|
|
43
|
+
revision: z.ZodNullable<z.ZodString>;
|
|
44
|
+
expiresAt: z.ZodOptional<z.ZodISODateTime>;
|
|
45
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
46
|
+
status: z.ZodEnum<{
|
|
47
|
+
unavailable: "unavailable";
|
|
48
|
+
starting: "starting";
|
|
49
|
+
expired: "expired";
|
|
50
|
+
}>;
|
|
51
|
+
reason: z.ZodString;
|
|
52
|
+
id: z.ZodString;
|
|
53
|
+
title: z.ZodString;
|
|
54
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
55
|
+
source: z.ZodString;
|
|
56
|
+
revision: z.ZodNullable<z.ZodString>;
|
|
57
|
+
expiresAt: z.ZodOptional<z.ZodISODateTime>;
|
|
58
|
+
}, z.core.$strict>], "status">>>;
|
|
59
|
+
instructions: z.ZodNullable<z.ZodString>;
|
|
60
|
+
limitations: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
61
|
+
truncated: z.ZodBoolean;
|
|
62
|
+
executionId: z.ZodNullable<z.ZodString>;
|
|
63
|
+
capturedAt: z.ZodISODateTime;
|
|
64
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
65
|
+
state: z.ZodLiteral<"unavailable">;
|
|
66
|
+
reason: z.ZodString;
|
|
67
|
+
executionId: z.ZodNullable<z.ZodString>;
|
|
68
|
+
capturedAt: z.ZodISODateTime;
|
|
69
|
+
}, z.core.$strict>], "state">;
|
|
70
|
+
/** One application-owned preview page and its recorded availability. */
|
|
71
|
+
type SessionPreview = z.infer<typeof sessionPreviewSchema>;
|
|
72
|
+
/** Provider-neutral preview pages and practical testing instructions for a session. */
|
|
73
|
+
type SessionPreviews = z.infer<typeof sessionPreviewsSchema>;
|
|
74
|
+
//#endregion
|
|
75
|
+
export { SessionPreview, SessionPreviews, sessionPreviewSchema, sessionPreviewsSchema };
|
|
76
|
+
//# sourceMappingURL=session-previews.d.mts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/session-previews.ts
|
|
3
|
+
const text = z.string().trim().min(1);
|
|
4
|
+
const previewUrl = z.string().refine((value) => {
|
|
5
|
+
if (!/^https?:\/\//iu.test(value) || /[\s\\]/u.test(value) || [...value].some((character) => character.charCodeAt(0) < 32 || character.charCodeAt(0) === 127)) return false;
|
|
6
|
+
try {
|
|
7
|
+
const url = new URL(value);
|
|
8
|
+
return ["https:", "http:"].includes(url.protocol) && !url.username && !url.password;
|
|
9
|
+
} catch {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
}, "Use an absolute HTTP(S) preview URL without credentials");
|
|
13
|
+
const page = {
|
|
14
|
+
id: text.describe("Stable preview identity within this session."),
|
|
15
|
+
title: text.describe("Page or application to try."),
|
|
16
|
+
instructions: text.optional().describe("Actions to try and expected results, as Markdown."),
|
|
17
|
+
source: text.describe("Application-owned origin of the preview."),
|
|
18
|
+
revision: text.nullable().describe("Exact opaque code revision, or null when not recorded."),
|
|
19
|
+
expiresAt: z.iso.datetime().optional().describe("Known expiry; absent means not recorded.")
|
|
20
|
+
};
|
|
21
|
+
/** Validates an application-supplied preview page with explicit availability and expiry. */
|
|
22
|
+
const sessionPreviewSchema = z.discriminatedUnion("status", [z.strictObject({
|
|
23
|
+
...page,
|
|
24
|
+
status: z.enum(["ready", "unknown"]).describe("Ready as reported by the reader, or unchecked."),
|
|
25
|
+
url: previewUrl.describe("Browser destination; the application owns access and lifetime.")
|
|
26
|
+
}), z.strictObject({
|
|
27
|
+
...page,
|
|
28
|
+
status: z.enum([
|
|
29
|
+
"starting",
|
|
30
|
+
"unavailable",
|
|
31
|
+
"expired"
|
|
32
|
+
]).describe("Why this preview cannot be opened."),
|
|
33
|
+
reason: text.describe("Explanation and next steps for the operator.")
|
|
34
|
+
})]);
|
|
35
|
+
const common = {
|
|
36
|
+
executionId: text.nullable().describe("Observed session execution, or null before execution."),
|
|
37
|
+
capturedAt: z.iso.datetime().describe("When the preview projection was read.")
|
|
38
|
+
};
|
|
39
|
+
/** Validates the optional live-preview projection, including instructions for non-web work. */
|
|
40
|
+
const sessionPreviewsSchema = z.discriminatedUnion("state", [z.strictObject({
|
|
41
|
+
...common,
|
|
42
|
+
state: z.literal("ready").describe("The reader completed; individual pages have their own status."),
|
|
43
|
+
previews: z.array(sessionPreviewSchema).readonly().describe("Recorded preview pages or applications."),
|
|
44
|
+
instructions: text.nullable().describe("How to test the work, including local steps when no live site exists."),
|
|
45
|
+
limitations: z.array(text).readonly().describe("Missing evidence or review limitations."),
|
|
46
|
+
truncated: z.boolean().describe("Whether the reader omitted entries due to its configured limits.")
|
|
47
|
+
}), z.strictObject({
|
|
48
|
+
...common,
|
|
49
|
+
state: z.literal("unavailable").describe("Preview information could not be read."),
|
|
50
|
+
reason: text.describe("Why preview information is unavailable.")
|
|
51
|
+
})]);
|
|
52
|
+
//#endregion
|
|
53
|
+
export { sessionPreviewSchema, sessionPreviewsSchema };
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=session-previews.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-previews.mjs","names":[],"sources":["../src/session-previews.ts"],"sourcesContent":["import { z } from \"zod\";\n\nconst text = z.string().trim().min(1);\nconst previewUrl = z.string().refine((value) => {\n if (\n !/^https?:\\/\\//iu.test(value) ||\n /[\\s\\\\]/u.test(value) ||\n [...value].some((character) => character.charCodeAt(0) < 32 || character.charCodeAt(0) === 127)\n )\n return false;\n try {\n const url = new URL(value);\n return [\"https:\", \"http:\"].includes(url.protocol) && !url.username && !url.password;\n } catch {\n return false;\n }\n}, \"Use an absolute HTTP(S) preview URL without credentials\");\nconst page = {\n id: text.describe(\"Stable preview identity within this session.\"),\n title: text.describe(\"Page or application to try.\"),\n instructions: text.optional().describe(\"Actions to try and expected results, as Markdown.\"),\n source: text.describe(\"Application-owned origin of the preview.\"),\n revision: text.nullable().describe(\"Exact opaque code revision, or null when not recorded.\"),\n expiresAt: z.iso.datetime().optional().describe(\"Known expiry; absent means not recorded.\"),\n};\n\n/** Validates an application-supplied preview page with explicit availability and expiry. */\nexport const sessionPreviewSchema = z.discriminatedUnion(\"status\", [\n z.strictObject({\n ...page,\n status: z.enum([\"ready\", \"unknown\"]).describe(\"Ready as reported by the reader, or unchecked.\"),\n url: previewUrl.describe(\"Browser destination; the application owns access and lifetime.\"),\n }),\n z.strictObject({\n ...page,\n status: z\n .enum([\"starting\", \"unavailable\", \"expired\"])\n .describe(\"Why this preview cannot be opened.\"),\n reason: text.describe(\"Explanation and next steps for the operator.\"),\n }),\n]);\n\nconst common = {\n executionId: text.nullable().describe(\"Observed session execution, or null before execution.\"),\n capturedAt: z.iso.datetime().describe(\"When the preview projection was read.\"),\n};\n\n/** Validates the optional live-preview projection, including instructions for non-web work. */\nexport const sessionPreviewsSchema = z.discriminatedUnion(\"state\", [\n z.strictObject({\n ...common,\n state: z\n .literal(\"ready\")\n .describe(\"The reader completed; individual pages have their own status.\"),\n previews: z\n .array(sessionPreviewSchema)\n .readonly()\n .describe(\"Recorded preview pages or applications.\"),\n instructions: text\n .nullable()\n .describe(\"How to test the work, including local steps when no live site exists.\"),\n limitations: z.array(text).readonly().describe(\"Missing evidence or review limitations.\"),\n truncated: z\n .boolean()\n .describe(\"Whether the reader omitted entries due to its configured limits.\"),\n }),\n z.strictObject({\n ...common,\n state: z.literal(\"unavailable\").describe(\"Preview information could not be read.\"),\n reason: text.describe(\"Why preview information is unavailable.\"),\n }),\n]);\n\n/** One application-owned preview page and its recorded availability. */\nexport type SessionPreview = z.infer<typeof sessionPreviewSchema>;\n/** Provider-neutral preview pages and practical testing instructions for a session. */\nexport type SessionPreviews = z.infer<typeof sessionPreviewsSchema>;\n"],"mappings":";;AAEA,MAAM,OAAO,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;AACpC,MAAM,aAAa,EAAE,OAAO,CAAC,CAAC,QAAQ,UAAU;CAC9C,IACE,CAAC,iBAAiB,KAAK,KAAK,KAC5B,UAAU,KAAK,KAAK,KACpB,CAAC,GAAG,KAAK,CAAC,CAAC,MAAM,cAAc,UAAU,WAAW,CAAC,IAAI,MAAM,UAAU,WAAW,CAAC,MAAM,GAAG,GAE9F,OAAO;CACT,IAAI;EACF,MAAM,MAAM,IAAI,IAAI,KAAK;EACzB,OAAO,CAAC,UAAU,OAAO,CAAC,CAAC,SAAS,IAAI,QAAQ,KAAK,CAAC,IAAI,YAAY,CAAC,IAAI;CAC7E,QAAQ;EACN,OAAO;CACT;AACF,GAAG,yDAAyD;AAC5D,MAAM,OAAO;CACX,IAAI,KAAK,SAAS,8CAA8C;CAChE,OAAO,KAAK,SAAS,6BAA6B;CAClD,cAAc,KAAK,SAAS,CAAC,CAAC,SAAS,mDAAmD;CAC1F,QAAQ,KAAK,SAAS,0CAA0C;CAChE,UAAU,KAAK,SAAS,CAAC,CAAC,SAAS,wDAAwD;CAC3F,WAAW,EAAE,IAAI,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,0CAA0C;AAC5F;;AAGA,MAAa,uBAAuB,EAAE,mBAAmB,UAAU,CACjE,EAAE,aAAa;CACb,GAAG;CACH,QAAQ,EAAE,KAAK,CAAC,SAAS,SAAS,CAAC,CAAC,CAAC,SAAS,gDAAgD;CAC9F,KAAK,WAAW,SAAS,gEAAgE;AAC3F,CAAC,GACD,EAAE,aAAa;CACb,GAAG;CACH,QAAQ,EACL,KAAK;EAAC;EAAY;EAAe;CAAS,CAAC,CAAC,CAC5C,SAAS,oCAAoC;CAChD,QAAQ,KAAK,SAAS,8CAA8C;AACtE,CAAC,CACH,CAAC;AAED,MAAM,SAAS;CACb,aAAa,KAAK,SAAS,CAAC,CAAC,SAAS,uDAAuD;CAC7F,YAAY,EAAE,IAAI,SAAS,CAAC,CAAC,SAAS,uCAAuC;AAC/E;;AAGA,MAAa,wBAAwB,EAAE,mBAAmB,SAAS,CACjE,EAAE,aAAa;CACb,GAAG;CACH,OAAO,EACJ,QAAQ,OAAO,CAAC,CAChB,SAAS,+DAA+D;CAC3E,UAAU,EACP,MAAM,oBAAoB,CAAC,CAC3B,SAAS,CAAC,CACV,SAAS,yCAAyC;CACrD,cAAc,KACX,SAAS,CAAC,CACV,SAAS,uEAAuE;CACnF,aAAa,EAAE,MAAM,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,yCAAyC;CACxF,WAAW,EACR,QAAQ,CAAC,CACT,SAAS,kEAAkE;AAChF,CAAC,GACD,EAAE,aAAa;CACb,GAAG;CACH,OAAO,EAAE,QAAQ,aAAa,CAAC,CAAC,SAAS,wCAAwC;CACjF,QAAQ,KAAK,SAAS,yCAAyC;AACjE,CAAC,CACH,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/session-review.d.ts
|
|
3
|
+
/** Validates one recorded check without inferring success from a completed Task. */
|
|
4
|
+
declare const sessionReviewCheckSchema: z.ZodObject<{
|
|
5
|
+
source: z.ZodString;
|
|
6
|
+
revision: z.ZodNullable<z.ZodString>;
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
title: z.ZodString;
|
|
9
|
+
status: z.ZodEnum<{
|
|
10
|
+
unknown: "unknown";
|
|
11
|
+
running: "running";
|
|
12
|
+
failed: "failed";
|
|
13
|
+
passed: "passed";
|
|
14
|
+
skipped: "skipped";
|
|
15
|
+
}>;
|
|
16
|
+
command: z.ZodOptional<z.ZodString>;
|
|
17
|
+
details: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
/** Validates a screenshot supplied by the application's authorized review reader. */
|
|
20
|
+
declare const sessionReviewScreenshotSchema: z.ZodObject<{
|
|
21
|
+
source: z.ZodString;
|
|
22
|
+
revision: z.ZodNullable<z.ZodString>;
|
|
23
|
+
id: z.ZodString;
|
|
24
|
+
url: z.ZodString;
|
|
25
|
+
caption: z.ZodString;
|
|
26
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
27
|
+
before: "before";
|
|
28
|
+
after: "after";
|
|
29
|
+
}>>;
|
|
30
|
+
comparisonId: z.ZodOptional<z.ZodString>;
|
|
31
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
}, z.core.$strict>;
|
|
34
|
+
/** Validates a reported issue and the evidence or uncertainty behind it. */
|
|
35
|
+
declare const sessionReviewIssueSchema: z.ZodObject<{
|
|
36
|
+
source: z.ZodString;
|
|
37
|
+
revision: z.ZodNullable<z.ZodString>;
|
|
38
|
+
id: z.ZodString;
|
|
39
|
+
title: z.ZodString;
|
|
40
|
+
body: z.ZodString;
|
|
41
|
+
status: z.ZodEnum<{
|
|
42
|
+
open: "open";
|
|
43
|
+
resolved: "resolved";
|
|
44
|
+
}>;
|
|
45
|
+
path: z.ZodOptional<z.ZodString>;
|
|
46
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
47
|
+
priority: z.ZodOptional<z.ZodString>;
|
|
48
|
+
evidence: z.ZodOptional<z.ZodString>;
|
|
49
|
+
limitations: z.ZodOptional<z.ZodString>;
|
|
50
|
+
}, z.core.$strict>;
|
|
51
|
+
/** Validates a review projection with explicit distinctions between missing and empty evidence. */
|
|
52
|
+
declare const sessionReviewSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
53
|
+
state: z.ZodLiteral<"ready">;
|
|
54
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
55
|
+
checks: z.ZodNullable<z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
56
|
+
source: z.ZodString;
|
|
57
|
+
revision: z.ZodNullable<z.ZodString>;
|
|
58
|
+
id: z.ZodString;
|
|
59
|
+
title: z.ZodString;
|
|
60
|
+
status: z.ZodEnum<{
|
|
61
|
+
unknown: "unknown";
|
|
62
|
+
running: "running";
|
|
63
|
+
failed: "failed";
|
|
64
|
+
passed: "passed";
|
|
65
|
+
skipped: "skipped";
|
|
66
|
+
}>;
|
|
67
|
+
command: z.ZodOptional<z.ZodString>;
|
|
68
|
+
details: z.ZodOptional<z.ZodString>;
|
|
69
|
+
}, z.core.$strict>>>>;
|
|
70
|
+
screenshots: z.ZodNullable<z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
71
|
+
source: z.ZodString;
|
|
72
|
+
revision: z.ZodNullable<z.ZodString>;
|
|
73
|
+
id: z.ZodString;
|
|
74
|
+
url: z.ZodString;
|
|
75
|
+
caption: z.ZodString;
|
|
76
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
77
|
+
before: "before";
|
|
78
|
+
after: "after";
|
|
79
|
+
}>>;
|
|
80
|
+
comparisonId: z.ZodOptional<z.ZodString>;
|
|
81
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
82
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
83
|
+
}, z.core.$strict>>>>;
|
|
84
|
+
issues: z.ZodNullable<z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
85
|
+
source: z.ZodString;
|
|
86
|
+
revision: z.ZodNullable<z.ZodString>;
|
|
87
|
+
id: z.ZodString;
|
|
88
|
+
title: z.ZodString;
|
|
89
|
+
body: z.ZodString;
|
|
90
|
+
status: z.ZodEnum<{
|
|
91
|
+
open: "open";
|
|
92
|
+
resolved: "resolved";
|
|
93
|
+
}>;
|
|
94
|
+
path: z.ZodOptional<z.ZodString>;
|
|
95
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
96
|
+
priority: z.ZodOptional<z.ZodString>;
|
|
97
|
+
evidence: z.ZodOptional<z.ZodString>;
|
|
98
|
+
limitations: z.ZodOptional<z.ZodString>;
|
|
99
|
+
}, z.core.$strict>>>>;
|
|
100
|
+
limitations: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
101
|
+
truncated: z.ZodBoolean;
|
|
102
|
+
executionId: z.ZodNullable<z.ZodString>;
|
|
103
|
+
capturedAt: z.ZodISODateTime;
|
|
104
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
105
|
+
state: z.ZodLiteral<"unavailable">;
|
|
106
|
+
reason: z.ZodString;
|
|
107
|
+
executionId: z.ZodNullable<z.ZodString>;
|
|
108
|
+
capturedAt: z.ZodISODateTime;
|
|
109
|
+
}, z.core.$strict>], "state">;
|
|
110
|
+
/** Recorded check displayed in the operator review screen. */
|
|
111
|
+
type SessionReviewCheck = z.infer<typeof sessionReviewCheckSchema>;
|
|
112
|
+
/** Screenshot and optional before/after grouping supplied by an application. */
|
|
113
|
+
type SessionReviewScreenshot = z.infer<typeof sessionReviewScreenshotSchema>;
|
|
114
|
+
/** Reported issue with its recorded resolution state and supporting evidence. */
|
|
115
|
+
type SessionReviewIssue = z.infer<typeof sessionReviewIssueSchema>;
|
|
116
|
+
/** Provider-neutral evidence for reviewing an operator session. */
|
|
117
|
+
type SessionReview = z.infer<typeof sessionReviewSchema>;
|
|
118
|
+
//#endregion
|
|
119
|
+
export { SessionReview, SessionReviewCheck, SessionReviewIssue, SessionReviewScreenshot, sessionReviewCheckSchema, sessionReviewIssueSchema, sessionReviewSchema, sessionReviewScreenshotSchema };
|
|
120
|
+
//# sourceMappingURL=session-review.d.mts.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/session-review.ts
|
|
3
|
+
const text = z.string().min(1);
|
|
4
|
+
const source = {
|
|
5
|
+
source: text.describe("Human-readable origin of the evidence, including attempt when known."),
|
|
6
|
+
revision: text.nullable().describe("Exact provider-owned revision, or null when not recorded.")
|
|
7
|
+
};
|
|
8
|
+
/** Validates one recorded check without inferring success from a completed Task. */
|
|
9
|
+
const sessionReviewCheckSchema = z.strictObject({
|
|
10
|
+
id: text.describe("Stable check identity within this review."),
|
|
11
|
+
title: text.describe("Check name."),
|
|
12
|
+
status: z.enum([
|
|
13
|
+
"passed",
|
|
14
|
+
"failed",
|
|
15
|
+
"skipped",
|
|
16
|
+
"running",
|
|
17
|
+
"unknown"
|
|
18
|
+
]).describe("Recorded outcome."),
|
|
19
|
+
command: text.optional().describe("Exact command, when recorded."),
|
|
20
|
+
details: text.optional().describe("Recorded output or explanation, rendered as Markdown."),
|
|
21
|
+
...source
|
|
22
|
+
});
|
|
23
|
+
const imageUrl = z.string().refine((value) => {
|
|
24
|
+
if (/[\s\\]/u.test(value)) return false;
|
|
25
|
+
if (value.startsWith("/") && !value.startsWith("//")) return true;
|
|
26
|
+
try {
|
|
27
|
+
const url = new URL(value);
|
|
28
|
+
return ["https:", "http:"].includes(url.protocol) && !url.username && !url.password;
|
|
29
|
+
} catch {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
}, "Use an HTTP(S) image URL or an absolute same-origin path");
|
|
33
|
+
/** Validates a screenshot supplied by the application's authorized review reader. */
|
|
34
|
+
const sessionReviewScreenshotSchema = z.strictObject({
|
|
35
|
+
id: text.describe("Stable image identity within this review."),
|
|
36
|
+
url: imageUrl.describe("Browser-readable image URL; the application owns access and expiry."),
|
|
37
|
+
caption: text.describe("Description of what the screenshot demonstrates."),
|
|
38
|
+
state: z.enum(["before", "after"]).optional().describe("Side of a before/after comparison."),
|
|
39
|
+
comparisonId: text.optional().describe("Groups before and after images of the same scenario."),
|
|
40
|
+
width: z.number().int().positive().optional().describe("Captured pixel width."),
|
|
41
|
+
height: z.number().int().positive().optional().describe("Captured pixel height."),
|
|
42
|
+
...source
|
|
43
|
+
});
|
|
44
|
+
/** Validates a reported issue and the evidence or uncertainty behind it. */
|
|
45
|
+
const sessionReviewIssueSchema = z.strictObject({
|
|
46
|
+
id: text.describe("Stable issue identity within this review."),
|
|
47
|
+
title: text.describe("Short problem description."),
|
|
48
|
+
body: text.describe("Impact and explanation, rendered as Markdown."),
|
|
49
|
+
status: z.enum(["open", "resolved"]).describe("Recorded resolution state, not inferred from Task success."),
|
|
50
|
+
path: text.optional().describe("Repository-relative affected file."),
|
|
51
|
+
line: z.number().int().positive().optional().describe("Affected line in the recorded revision."),
|
|
52
|
+
priority: text.optional().describe("Application-defined urgency label."),
|
|
53
|
+
evidence: text.optional().describe("What was checked and what it showed."),
|
|
54
|
+
limitations: text.optional().describe("What remains uncertain or unchecked."),
|
|
55
|
+
...source
|
|
56
|
+
});
|
|
57
|
+
const common = {
|
|
58
|
+
executionId: text.nullable().describe("Observed session execution, or null before execution."),
|
|
59
|
+
capturedAt: z.iso.datetime().describe("When this evidence projection was read.")
|
|
60
|
+
};
|
|
61
|
+
/** Validates a review projection with explicit distinctions between missing and empty evidence. */
|
|
62
|
+
const sessionReviewSchema = z.discriminatedUnion("state", [z.strictObject({
|
|
63
|
+
...common,
|
|
64
|
+
state: z.literal("ready").describe("The configured review reader completed."),
|
|
65
|
+
summary: text.optional().describe("Application-provided summary of the work."),
|
|
66
|
+
checks: z.array(sessionReviewCheckSchema).readonly().nullable().describe("Recorded checks; null means not recorded, not passing."),
|
|
67
|
+
screenshots: z.array(sessionReviewScreenshotSchema).readonly().nullable().describe("Recorded screenshots; null means no capture report is available."),
|
|
68
|
+
issues: z.array(sessionReviewIssueSchema).readonly().nullable().describe("Reported issues; null means no issue report is available."),
|
|
69
|
+
limitations: z.array(text).readonly().describe("Missing evidence, unsupported sources, or other review limitations."),
|
|
70
|
+
truncated: z.boolean().describe("The reader omitted evidence because of its configured limits.")
|
|
71
|
+
}), z.strictObject({
|
|
72
|
+
...common,
|
|
73
|
+
state: z.literal("unavailable").describe("Review evidence could not be read."),
|
|
74
|
+
reason: text.describe("Why review evidence is unavailable.")
|
|
75
|
+
})]);
|
|
76
|
+
//#endregion
|
|
77
|
+
export { sessionReviewCheckSchema, sessionReviewIssueSchema, sessionReviewSchema, sessionReviewScreenshotSchema };
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=session-review.mjs.map
|