@vercel/factory 0.0.14 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +306 -0
- package/dist/agent-routes.d.mts +69 -0
- package/dist/agent-routes.mjs +64 -0
- package/dist/agent-routes.mjs.map +1 -0
- package/dist/api-contracts.d.mts +1749 -0
- package/dist/api-contracts.mjs +118 -0
- package/dist/api-contracts.mjs.map +1 -0
- package/dist/api-images.d.mts +30 -0
- package/dist/api-images.mjs +28 -0
- package/dist/api-images.mjs.map +1 -0
- package/dist/api-task-graph.mjs +57 -0
- package/dist/api-task-graph.mjs.map +1 -0
- package/dist/api.d.mts +68 -216
- package/dist/api.mjs +872 -97
- 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 +692 -0
- package/dist/approval-contracts.mjs +27 -0
- package/dist/approval-contracts.mjs.map +1 -0
- package/dist/approval.d.mts +49 -0
- package/dist/approval.mjs +39 -0
- package/dist/approval.mjs.map +1 -0
- package/dist/blob/artifacts.d.mts +37 -0
- package/dist/blob/artifacts.mjs +45 -0
- package/dist/blob/artifacts.mjs.map +1 -0
- package/dist/blob/index.d.mts +41 -6
- package/dist/blob/index.mjs +158 -40
- package/dist/blob/index.mjs.map +1 -1
- package/dist/budget.d.mts +108 -0
- package/dist/budget.mjs +141 -0
- package/dist/budget.mjs.map +1 -0
- package/dist/budgets.d.mts +4 -0
- package/dist/budgets.mjs +4 -0
- package/dist/build-factory.d.mts +6 -4
- package/dist/build-factory.mjs +2 -1
- package/dist/build-factory.mjs.map +1 -1
- package/dist/change-verification/brief.d.mts +9 -0
- package/dist/change-verification/brief.mjs +13 -0
- package/dist/change-verification/brief.mjs.map +1 -0
- package/dist/change-verification/dispatch.d.mts +24 -0
- package/dist/change-verification/dispatch.mjs +45 -0
- package/dist/change-verification/dispatch.mjs.map +1 -0
- package/dist/change-verification/eve-tool.d.mts +60 -0
- package/dist/change-verification/eve-tool.mjs +101 -0
- package/dist/change-verification/eve-tool.mjs.map +1 -0
- package/dist/changes/eve-record-change.d.mts +56 -0
- package/dist/changes/eve-record-change.mjs +97 -0
- package/dist/changes/eve-record-change.mjs.map +1 -0
- package/dist/changes/presentation.d.mts +14 -0
- package/dist/changes.d.mts +23 -0
- package/dist/changes.mjs +29 -0
- package/dist/changes.mjs.map +1 -0
- package/dist/client-events.d.mts +18 -0
- package/dist/client-events.mjs +41 -0
- package/dist/client-events.mjs.map +1 -0
- package/dist/client-stream.d.mts +28 -0
- package/dist/client-stream.mjs +204 -0
- package/dist/client-stream.mjs.map +1 -0
- package/dist/client-transcript.d.mts +41 -0
- package/dist/client-transcript.mjs +229 -0
- package/dist/client-transcript.mjs.map +1 -0
- package/dist/client.d.mts +234 -0
- package/dist/client.mjs +258 -0
- package/dist/client.mjs.map +1 -0
- package/dist/code-review/contracts.d.mts +26 -0
- package/dist/code-review/eve-post-review.d.mts +70 -0
- package/dist/code-review/eve-post-review.mjs +183 -0
- package/dist/code-review/eve-post-review.mjs.map +1 -0
- package/dist/code-review/eve-review-comments.d.mts +64 -0
- package/dist/code-review/eve-review-comments.mjs +159 -0
- package/dist/code-review/eve-review-comments.mjs.map +1 -0
- package/dist/code-review/github-contracts.d.mts +10 -0
- package/dist/code-review/github-reporter.d.mts +44 -0
- package/dist/code-review/github-reporter.mjs +260 -0
- package/dist/code-review/github-reporter.mjs.map +1 -0
- package/dist/code-review/preparation.d.mts +34 -0
- package/dist/code-review/preparation.mjs +23 -0
- package/dist/code-review/preparation.mjs.map +1 -0
- package/dist/code-review/stall.d.mts +17 -0
- package/dist/code-review/stall.mjs +30 -0
- package/dist/code-review/stall.mjs.map +1 -0
- package/dist/code-review.d.mts +6 -0
- package/dist/code-review.mjs +5 -0
- package/dist/communication.d.mts +9 -0
- package/dist/communication.mjs +9 -0
- package/dist/connectors/github.d.mts +26 -0
- package/dist/connectors/github.mjs +55 -0
- package/dist/connectors/github.mjs.map +1 -0
- package/dist/connectors/index.d.mts +35 -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 +164 -0
- package/dist/deepsec/eve-tool.mjs.map +1 -0
- package/dist/deepsec/finding.d.mts +84 -0
- package/dist/deepsec/finding.mjs +56 -0
- package/dist/deepsec/finding.mjs.map +1 -0
- package/dist/deepsec.d.mts +3 -0
- package/dist/delivery-metrics/metrics.d.mts +93 -0
- package/dist/delivery-metrics/metrics.mjs +200 -0
- package/dist/delivery-metrics/metrics.mjs.map +1 -0
- package/dist/delivery-metrics.d.mts +2 -0
- package/dist/delivery-metrics.mjs +2 -0
- package/dist/dispatch.d.mts +81 -0
- package/dist/dispatch.mjs +140 -0
- package/dist/dispatch.mjs.map +1 -0
- package/dist/errors.d.mts +15 -0
- package/dist/errors.mjs +38 -0
- package/dist/errors.mjs.map +1 -0
- package/dist/eve/index.d.mts +143 -1271
- package/dist/eve/index.mjs +233 -1065
- package/dist/eve/index.mjs.map +1 -1
- package/dist/eve/invoke.d.mts +144 -0
- package/dist/eve/invoke.mjs +241 -0
- package/dist/eve/invoke.mjs.map +1 -0
- package/dist/eve/session-client.d.mts +68 -0
- package/dist/eve/session-client.mjs +131 -0
- package/dist/eve/session-client.mjs.map +1 -0
- package/dist/eve/task-execution.mjs +18 -0
- package/dist/eve/task-execution.mjs.map +1 -0
- package/dist/eve/task-session.d.mts +87 -0
- package/dist/eve/task-session.mjs +203 -0
- package/dist/eve/task-session.mjs.map +1 -0
- package/dist/eve/transcript.d.mts +37 -0
- package/dist/eve/transcript.mjs +65 -0
- package/dist/eve/transcript.mjs.map +1 -0
- package/dist/execution-public.d.mts +8 -0
- package/dist/execution-public.mjs +7 -0
- package/dist/execution.d.mts +75 -0
- package/dist/execution.mjs +153 -0
- package/dist/execution.mjs.map +1 -0
- package/dist/finding-remediation/admission.d.mts +51 -0
- package/dist/finding-remediation/admission.mjs +87 -0
- package/dist/finding-remediation/admission.mjs.map +1 -0
- package/dist/finding-remediation/brief.d.mts +14 -0
- package/dist/finding-remediation/brief.mjs +25 -0
- package/dist/finding-remediation/brief.mjs.map +1 -0
- package/dist/finding-remediation/eve-tool.d.mts +29 -0
- package/dist/finding-remediation/eve-tool.mjs +34 -0
- package/dist/finding-remediation/eve-tool.mjs.map +1 -0
- package/dist/findings/fingerprint.d.mts +14 -0
- package/dist/findings/fingerprint.mjs +28 -0
- package/dist/findings/fingerprint.mjs.map +1 -0
- package/dist/findings.d.mts +6 -0
- package/dist/findings.mjs +6 -0
- package/dist/github-app.d.mts +54 -0
- package/dist/github-app.mjs +121 -0
- package/dist/github-app.mjs.map +1 -0
- package/dist/github-publication.d.mts +198 -0
- package/dist/github-publication.mjs +429 -0
- package/dist/github-publication.mjs.map +1 -0
- package/dist/github-transfer.d.mts +72 -0
- package/dist/github-transfer.mjs +125 -0
- package/dist/github-transfer.mjs.map +1 -0
- package/dist/github.d.mts +406 -2
- package/dist/github.mjs +239 -40
- package/dist/github.mjs.map +1 -1
- package/dist/image-input.d.mts +51 -0
- package/dist/image-input.mjs +63 -0
- package/dist/image-input.mjs.map +1 -0
- package/dist/index.d.mts +14 -484
- package/dist/index.mjs +14 -522
- package/dist/intake-contracts.d.mts +56 -0
- package/dist/intake-contracts.mjs +33 -0
- package/dist/intake-contracts.mjs.map +1 -0
- package/dist/integrations/deepsec.d.mts +4 -0
- package/dist/integrations/deepsec.mjs +3 -0
- package/dist/integrations/github.d.mts +11 -0
- package/dist/integrations/github.mjs +9 -0
- package/dist/integrations/slack.d.mts +3 -0
- package/dist/integrations/slack.mjs +3 -0
- package/dist/integrations/vercel.d.mts +3 -0
- package/dist/integrations/vercel.mjs +3 -0
- package/dist/merge-resolution/contracts.d.mts +17 -0
- package/dist/merge-resolution/contracts.mjs +19 -0
- package/dist/merge-resolution/contracts.mjs.map +1 -0
- package/dist/merge-resolution/eve-tools.d.mts +46 -0
- package/dist/merge-resolution/eve-tools.mjs +117 -0
- package/dist/merge-resolution/eve-tools.mjs.map +1 -0
- package/dist/multi-repository-changes/coordination.d.mts +49 -0
- package/dist/multi-repository-changes/coordination.mjs +115 -0
- package/dist/multi-repository-changes/coordination.mjs.map +1 -0
- package/dist/planning/cancellation.mjs +82 -0
- package/dist/planning/cancellation.mjs.map +1 -0
- package/dist/planning/configuration.d.mts +23 -0
- package/dist/planning/configuration.mjs +56 -0
- package/dist/planning/configuration.mjs.map +1 -0
- package/dist/planning/contracts.d.mts +136 -0
- package/dist/planning/contracts.mjs +42 -0
- package/dist/planning/contracts.mjs.map +1 -0
- package/dist/planning/dependencies.mjs +44 -0
- package/dist/planning/dependencies.mjs.map +1 -0
- package/dist/planning/effects.mjs +122 -0
- package/dist/planning/effects.mjs.map +1 -0
- package/dist/planning/reconcile.mjs +273 -0
- package/dist/planning/reconcile.mjs.map +1 -0
- package/dist/planning/runtime.d.mts +27 -0
- package/dist/planning/runtime.mjs +25 -0
- package/dist/planning/runtime.mjs.map +1 -0
- package/dist/planning/state.mjs +92 -0
- package/dist/planning/state.mjs.map +1 -0
- package/dist/planning/turns.mjs +262 -0
- package/dist/planning/turns.mjs.map +1 -0
- package/dist/planning/validation.mjs +106 -0
- package/dist/planning/validation.mjs.map +1 -0
- package/dist/postgres/index.d.mts +7 -1
- package/dist/postgres/index.mjs +7 -3
- package/dist/postgres/index.mjs.map +1 -1
- package/dist/presets/software-development/approval.d.mts +14 -0
- package/dist/presets/software-development/approval.mjs +21 -0
- package/dist/presets/software-development/approval.mjs.map +1 -0
- package/dist/presets/software-development/deepsec-brief.d.mts +8 -0
- package/dist/presets/software-development/deepsec-brief.mjs +14 -0
- package/dist/presets/software-development/deepsec-brief.mjs.map +1 -0
- package/dist/presets/software-development/dispatch.d.mts +53 -0
- package/dist/presets/software-development/dispatch.mjs +66 -0
- package/dist/presets/software-development/dispatch.mjs.map +1 -0
- package/dist/presets/software-development/eve-delegation-policy.d.mts +7 -0
- package/dist/presets/software-development/eve-delegation-policy.mjs +34 -0
- package/dist/presets/software-development/eve-delegation-policy.mjs.map +1 -0
- package/dist/presets/software-development/eve.d.mts +18 -0
- package/dist/presets/software-development/eve.mjs +19 -0
- package/dist/presets/software-development/eve.mjs.map +1 -0
- package/dist/presets/software-development/finish-task-policy.d.mts +7 -0
- package/dist/presets/software-development/finish-task-policy.mjs +9 -0
- package/dist/presets/software-development/finish-task-policy.mjs.map +1 -0
- package/dist/presets/software-development/recovery.d.mts +32 -0
- package/dist/presets/software-development/recovery.mjs +120 -0
- package/dist/presets/software-development/recovery.mjs.map +1 -0
- package/dist/presets/software-development/task-communication.d.mts +23 -0
- package/dist/presets/software-development/task-communication.mjs +120 -0
- package/dist/presets/software-development/task-communication.mjs.map +1 -0
- package/dist/presets/software-development.d.mts +9 -0
- package/dist/presets/software-development.mjs +9 -0
- package/dist/pull-requests/contracts.d.mts +72 -0
- package/dist/pull-requests/eve-fetch.d.mts +57 -0
- package/dist/pull-requests/eve-fetch.mjs +151 -0
- package/dist/pull-requests/eve-fetch.mjs.map +1 -0
- package/dist/pull-requests/github-label-manager.d.mts +27 -0
- package/dist/pull-requests/github-label-manager.mjs +40 -0
- package/dist/pull-requests/github-label-manager.mjs.map +1 -0
- package/dist/pull-requests/github-publisher.d.mts +53 -0
- package/dist/pull-requests/github-publisher.mjs +345 -0
- package/dist/pull-requests/github-publisher.mjs.map +1 -0
- package/dist/pull-requests.d.mts +5 -0
- package/dist/pull-requests.mjs +4 -0
- package/dist/receipts.d.mts +4 -0
- package/dist/receipts.mjs +3 -0
- package/dist/repositories.d.mts +18 -0
- package/dist/repositories.mjs +33 -0
- package/dist/repositories.mjs.map +1 -0
- package/dist/sandbox/command.d.mts +18 -0
- package/dist/sandbox/execution-abort.d.mts +16 -0
- package/dist/sandbox/execution-abort.mjs +49 -0
- package/dist/sandbox/execution-abort.mjs.map +1 -0
- package/dist/sandbox/execution-environment.d.mts +25 -0
- package/dist/sandbox/execution-run-ledger.d.mts +115 -0
- package/dist/sandbox/execution-run-ledger.mjs +209 -0
- package/dist/sandbox/execution-run-ledger.mjs.map +1 -0
- package/dist/sandbox/execution.d.mts +54 -0
- package/dist/sandbox/execution.mjs +228 -0
- package/dist/sandbox/execution.mjs.map +1 -0
- package/dist/sandbox/harness-runner.d.mts +79 -0
- package/dist/sandbox/harness-runner.mjs +162 -0
- package/dist/sandbox/harness-runner.mjs.map +1 -0
- package/dist/sandbox/index.d.mts +9 -0
- package/dist/sandbox/index.mjs +7 -0
- package/dist/sandbox/task-environment.d.mts +50 -0
- package/dist/sandbox/task-environment.mjs +140 -0
- package/dist/sandbox/task-environment.mjs.map +1 -0
- package/dist/sandbox/workspace.d.mts +29 -0
- package/dist/sandbox/workspace.mjs +28 -0
- package/dist/sandbox/workspace.mjs.map +1 -0
- package/dist/schema/agent-route.d.mts +22 -0
- package/dist/schema/agent-route.mjs +15 -0
- package/dist/schema/agent-route.mjs.map +1 -0
- package/dist/schema/answer.d.mts +23 -0
- package/dist/schema/answer.mjs +21 -0
- package/dist/schema/answer.mjs.map +1 -0
- package/dist/schema/budget.d.mts +38 -0
- package/dist/schema/budget.mjs +30 -0
- package/dist/schema/budget.mjs.map +1 -0
- package/dist/schema/catalog.mjs +72 -0
- package/dist/schema/catalog.mjs.map +1 -0
- package/dist/schema/change.d.mts +117 -0
- package/dist/schema/change.mjs +68 -0
- package/dist/schema/change.mjs.map +1 -0
- package/dist/schema/common.d.mts +33 -0
- package/dist/{id-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 +95 -0
- package/dist/schema/factory-config.mjs +60 -0
- package/dist/schema/factory-config.mjs.map +1 -0
- package/dist/schema/finding.d.mts +125 -0
- package/dist/schema/finding.mjs +67 -0
- package/dist/schema/finding.mjs.map +1 -0
- package/dist/schema/id.d.mts +43 -0
- package/dist/schema/id.mjs +32 -0
- package/dist/schema/id.mjs.map +1 -0
- package/dist/schema/outbox.d.mts +240 -0
- package/dist/schema/outbox.mjs +53 -0
- package/dist/schema/outbox.mjs.map +1 -0
- package/dist/schema/question-route.mjs +16 -0
- package/dist/schema/question-route.mjs.map +1 -0
- package/dist/schema/receipt.d.mts +81 -0
- package/dist/schema/receipt.mjs +94 -0
- package/dist/schema/receipt.mjs.map +1 -0
- package/dist/schema/repository.d.mts +26 -0
- package/dist/schema/repository.mjs +25 -0
- package/dist/schema/repository.mjs.map +1 -0
- package/dist/schema/session.d.mts +135 -0
- package/dist/schema/session.mjs +53 -0
- package/dist/schema/session.mjs.map +1 -0
- package/dist/schema/signal.d.mts +105 -0
- package/dist/schema/signal.mjs +81 -0
- package/dist/schema/signal.mjs.map +1 -0
- package/dist/schema/stored-session.mjs +10 -0
- package/dist/schema/stored-session.mjs.map +1 -0
- package/dist/schema/stored-task.mjs +20 -0
- package/dist/schema/stored-task.mjs.map +1 -0
- package/dist/schema/task-effect.d.mts +39 -0
- package/dist/schema/task-effect.mjs +29 -0
- package/dist/schema/task-effect.mjs.map +1 -0
- package/dist/schema/task-graph.d.mts +3134 -0
- package/dist/schema/task-graph.mjs +97 -0
- package/dist/schema/task-graph.mjs.map +1 -0
- package/dist/schema/task-message.d.mts +254 -0
- package/dist/schema/task-message.mjs +189 -0
- package/dist/schema/task-message.mjs.map +1 -0
- package/dist/schema/task.d.mts +272 -0
- package/dist/schema/task.mjs +199 -0
- package/dist/schema/task.mjs.map +1 -0
- package/dist/schema/transcript.d.mts +170 -0
- package/dist/schema/transcript.mjs +86 -0
- package/dist/schema/transcript.mjs.map +1 -0
- package/dist/schema/transitions.d.mts +50 -0
- package/dist/schema/transitions.mjs +303 -0
- package/dist/schema/transitions.mjs.map +1 -0
- package/dist/schema/work.d.mts +101 -0
- package/dist/schema/work.mjs +102 -0
- package/dist/schema/work.mjs.map +1 -0
- package/dist/signal-triage.d.mts +20 -0
- package/dist/signal-triage.mjs +85 -0
- package/dist/signal-triage.mjs.map +1 -0
- package/dist/signals.d.mts +19 -0
- package/dist/signals.mjs +19 -0
- package/dist/signals.mjs.map +1 -0
- package/dist/stall.d.mts +38 -0
- package/dist/stall.mjs +79 -0
- package/dist/stall.mjs.map +1 -0
- package/dist/storage.d.mts +4 -0
- package/dist/storage.mjs +4 -0
- package/dist/store/driver.d.mts +65 -0
- package/dist/store/driver.mjs +42 -0
- package/dist/store/driver.mjs.map +1 -0
- package/dist/store/engine.d.mts +485 -0
- package/dist/store/engine.mjs +2175 -0
- package/dist/store/engine.mjs.map +1 -0
- package/dist/store/memory.d.mts +7 -0
- package/dist/store/memory.mjs +52 -0
- package/dist/store/memory.mjs.map +1 -0
- package/dist/store/task-effects.d.mts +38 -0
- package/dist/store/task-effects.mjs +118 -0
- package/dist/store/task-effects.mjs.map +1 -0
- package/dist/store/task-graphs.d.mts +60 -0
- package/dist/store/task-graphs.mjs +212 -0
- package/dist/store/task-graphs.mjs.map +1 -0
- package/dist/store/task-messages.d.mts +136 -0
- package/dist/store/task-messages.mjs +475 -0
- package/dist/store/task-messages.mjs.map +1 -0
- package/dist/store/task-work.d.mts +65 -0
- package/dist/store/task-work.mjs +134 -0
- package/dist/store/task-work.mjs.map +1 -0
- package/dist/store/work-notifications.d.mts +19 -0
- package/dist/store/work-notifications.mjs +48 -0
- package/dist/store/work-notifications.mjs.map +1 -0
- package/dist/sweep.d.mts +57 -0
- package/dist/sweep.mjs +143 -0
- package/dist/sweep.mjs.map +1 -0
- package/dist/task-communication.d.mts +35 -0
- package/dist/task-communication.mjs +47 -0
- package/dist/task-communication.mjs.map +1 -0
- package/dist/task-graph-view.d.mts +264 -0
- package/dist/task-graph-view.mjs +17 -0
- package/dist/task-graph-view.mjs.map +1 -0
- package/dist/task-message-processing.d.mts +60 -0
- package/dist/task-message-processing.mjs +200 -0
- package/dist/task-message-processing.mjs.map +1 -0
- package/dist/task-protocols.d.mts +80 -0
- package/dist/task-protocols.mjs +47 -0
- package/dist/task-protocols.mjs.map +1 -0
- package/dist/tasks.d.mts +17 -0
- package/dist/tasks.mjs +17 -0
- package/dist/vercel-git.d.mts +21 -0
- package/dist/vercel-git.mjs +112 -0
- package/dist/vercel-git.mjs.map +1 -0
- package/dist/vercel.d.mts +33 -2
- package/dist/vercel.mjs +48 -3
- package/dist/vercel.mjs.map +1 -1
- package/dist/work-triage/eve-tool.d.mts +29 -0
- package/dist/work-triage/eve-tool.mjs +32 -0
- package/dist/work-triage/eve-tool.mjs.map +1 -0
- package/dist/work-triage/find-existing-work.d.mts +32 -0
- package/dist/work-triage/find-existing-work.mjs +31 -0
- package/dist/work-triage/find-existing-work.mjs.map +1 -0
- package/dist/work-triage/github.d.mts +15 -0
- package/dist/work-triage/github.mjs +14 -0
- package/dist/work-triage/github.mjs.map +1 -0
- package/dist/work-triage.d.mts +3 -0
- package/dist/work-triage.mjs +3 -0
- package/dist/workflows.d.mts +48 -0
- package/dist/workflows.mjs +86 -0
- package/dist/workflows.mjs.map +1 -0
- package/dist/workspace-diff-assembly.d.mts +33 -0
- package/dist/workspace-diff-assembly.mjs +95 -0
- package/dist/workspace-diff-assembly.mjs.map +1 -0
- package/dist/workspace-diff.d.mts +90 -0
- package/dist/workspace-diff.mjs +61 -0
- package/dist/workspace-diff.mjs.map +1 -0
- package/dist/workspace-snapshot.d.mts +26 -0
- package/dist/workspace-snapshot.mjs +80 -0
- package/dist/workspace-snapshot.mjs.map +1 -0
- package/package.json +129 -44
- package/dist/approval-JX2Px9IC.mjs +0 -132
- package/dist/approval-JX2Px9IC.mjs.map +0 -1
- package/dist/budget-DzSiIA4t.mjs +0 -42
- package/dist/budget-DzSiIA4t.mjs.map +0 -1
- package/dist/change-D2U6v7Ek.mjs +0 -554
- package/dist/change-D2U6v7Ek.mjs.map +0 -1
- package/dist/communication-Kd9nU5RP.mjs.map +0 -1
- package/dist/coordination-Cq08hb1l.mjs +0 -76
- package/dist/coordination-Cq08hb1l.mjs.map +0 -1
- package/dist/dispatch-BaZS3PT8.d.mts +0 -76
- package/dist/driver-BC0Mt5KG.d.mts +0 -34
- package/dist/driver-Bbd25rNM.mjs +0 -23
- package/dist/driver-Bbd25rNM.mjs.map +0 -1
- package/dist/engine-DFHU2Pe-.d.mts +0 -781
- package/dist/engine-WaUM2cGA.mjs +0 -1068
- package/dist/engine-WaUM2cGA.mjs.map +0 -1
- package/dist/factory-config-BoRXOw43.mjs +0 -50
- package/dist/factory-config-BoRXOw43.mjs.map +0 -1
- package/dist/factory-config-D2yU3G0c.d.mts +0 -58
- package/dist/github-C5HNBN6p.d.mts +0 -279
- package/dist/id-BLIkCVue.mjs.map +0 -1
- package/dist/index-Bw6hggoH.d.mts +0 -40
- package/dist/index.mjs.map +0 -1
- package/dist/task-CcOyOJ3k.mjs +0 -154
- package/dist/task-CcOyOJ3k.mjs.map +0 -1
package/dist/github.mjs
CHANGED
|
@@ -1,25 +1,129 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { repositorySlugSchema } from "./schema/repository.mjs";
|
|
2
|
+
import { mintGitHubAppInstallationToken } from "./github-app.mjs";
|
|
3
|
+
import { GitHubCheckoutConflictError, GitHubPublicationApiError, checkoutGitHubRepository, createGitHubPublicationClient, factorySessionBranch, factoryTaskBranch, isSafeGitRef, readCommittedGitChange, runSandboxGit } from "./github-publication.mjs";
|
|
2
4
|
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
5
|
+
import { z } from "zod";
|
|
3
6
|
//#region src/github.ts
|
|
4
7
|
const gitHubApiUrl = "https://api.github.com";
|
|
5
|
-
const
|
|
8
|
+
const gitHubRepositorySlugSchema = z.string().min(1).transform((value) => value.toLowerCase()).pipe(repositorySlugSchema);
|
|
9
|
+
const factoryReviewCommentEventSchema = z.looseObject({
|
|
10
|
+
action: z.literal("created"),
|
|
11
|
+
comment: z.looseObject({
|
|
12
|
+
id: z.number().int().positive(),
|
|
13
|
+
body: z.string(),
|
|
14
|
+
html_url: z.url()
|
|
15
|
+
}),
|
|
16
|
+
pull_request: z.looseObject({
|
|
17
|
+
number: z.number().int().positive(),
|
|
18
|
+
html_url: z.url(),
|
|
19
|
+
user: z.looseObject({ login: z.string().min(1) })
|
|
20
|
+
}),
|
|
21
|
+
repository: z.looseObject({ full_name: gitHubRepositorySlugSchema })
|
|
22
|
+
});
|
|
23
|
+
const factoryQuestionReplyEventSchema = z.looseObject({
|
|
24
|
+
action: z.literal("created"),
|
|
25
|
+
comment: z.looseObject({
|
|
26
|
+
body: z.string(),
|
|
27
|
+
html_url: z.url(),
|
|
28
|
+
id: z.number().int().positive()
|
|
29
|
+
}),
|
|
30
|
+
issue: z.looseObject({
|
|
31
|
+
number: z.number().int().positive(),
|
|
32
|
+
pull_request: z.unknown().optional()
|
|
33
|
+
}),
|
|
34
|
+
repository: z.looseObject({ full_name: gitHubRepositorySlugSchema }),
|
|
35
|
+
sender: z.looseObject({
|
|
36
|
+
login: z.string().min(1),
|
|
37
|
+
type: z.string().min(1)
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
const defaultReviewMentions = ["factory"];
|
|
41
|
+
const defaultQuestionMentions = [
|
|
42
|
+
"agent-factory",
|
|
43
|
+
"agent-factory[bot]",
|
|
44
|
+
"factory"
|
|
45
|
+
];
|
|
46
|
+
function stripMention(body, mentions) {
|
|
47
|
+
const trimmed = body.trimStart();
|
|
48
|
+
for (const mention of mentions) {
|
|
49
|
+
const prefix = `@${mention.trim()}`;
|
|
50
|
+
if (prefix === "@" || trimmed.slice(0, prefix.length).toLowerCase() !== prefix.toLowerCase()) continue;
|
|
51
|
+
const remainder = trimmed.slice(prefix.length);
|
|
52
|
+
if (!/^[\s,:-]/u.test(remainder)) continue;
|
|
53
|
+
return remainder.replace(/^[\s,:-]*/u, "").trim();
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
/** Select the one configured repository consistently identified by a provider delivery. */
|
|
58
|
+
function configuredEventRepositorySlug(input) {
|
|
59
|
+
const { configuredSlugs, eventSlugs } = input;
|
|
60
|
+
const distinctEventSlugs = [...new Set(eventSlugs.filter((slug) => slug !== null))];
|
|
61
|
+
const eventSlug = distinctEventSlugs[0];
|
|
62
|
+
return distinctEventSlugs.length === 1 && eventSlug !== void 0 && configuredSlugs.includes(eventSlug) ? eventSlug : null;
|
|
63
|
+
}
|
|
64
|
+
/** Normalize an explicitly addressed inline review comment into trusted routing fields. */
|
|
65
|
+
function normalizeFactoryReviewComment(input) {
|
|
66
|
+
if (input.event !== "pull_request_review_comment") return null;
|
|
67
|
+
const parsed = factoryReviewCommentEventSchema.safeParse(input.payload);
|
|
68
|
+
if (!parsed.success || stripMention(parsed.data.comment.body, input.mentions ?? defaultReviewMentions) === null) return null;
|
|
69
|
+
return {
|
|
70
|
+
repositorySlug: parsed.data.repository.full_name,
|
|
71
|
+
pullRequestNumber: parsed.data.pull_request.number,
|
|
72
|
+
pullRequestUrl: parsed.data.pull_request.html_url,
|
|
73
|
+
pullRequestAuthor: parsed.data.pull_request.user.login,
|
|
74
|
+
commentId: parsed.data.comment.id,
|
|
75
|
+
commentUrl: parsed.data.comment.html_url
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Strip the Factory mention from an issue comment body, returning null when the
|
|
80
|
+
* comment does not address Factory. Exported so a caller reconciling a delivery
|
|
81
|
+
* against GitHub's own copy of the comment applies the same rule the normalizer
|
|
82
|
+
* applied to the payload.
|
|
83
|
+
*/
|
|
84
|
+
function stripFactoryQuestionMention(body, options = {}) {
|
|
85
|
+
return stripMention(body, options.mentions ?? defaultQuestionMentions);
|
|
86
|
+
}
|
|
87
|
+
/** Normalize a mentioned issue comment that can answer a persisted Factory QuestionTask. */
|
|
88
|
+
function normalizeFactoryQuestionReply(input) {
|
|
89
|
+
if (input.event !== "issue_comment") return null;
|
|
90
|
+
const parsed = factoryQuestionReplyEventSchema.safeParse(input.payload);
|
|
91
|
+
if (!parsed.success || parsed.data.sender.type.toLowerCase() === "bot") return null;
|
|
92
|
+
const answer = stripMention(parsed.data.comment.body, input.mentions ?? defaultQuestionMentions);
|
|
93
|
+
if (answer === null || answer === "") return null;
|
|
94
|
+
if (parsed.data.issue.pull_request !== void 0) return null;
|
|
95
|
+
const repositorySlug = parsed.data.repository.full_name;
|
|
96
|
+
return {
|
|
97
|
+
repositorySlug,
|
|
98
|
+
replyAddress: `${repositorySlug}#${parsed.data.issue.number}`,
|
|
99
|
+
author: parsed.data.sender.login,
|
|
100
|
+
answer,
|
|
101
|
+
commentId: parsed.data.comment.id,
|
|
102
|
+
issueNumber: parsed.data.issue.number,
|
|
103
|
+
commentUrl: parsed.data.comment.html_url
|
|
104
|
+
};
|
|
105
|
+
}
|
|
6
106
|
const pullRequestSchema = z.object({
|
|
7
107
|
number: z.number().int().positive(),
|
|
8
108
|
html_url: z.url()
|
|
9
109
|
});
|
|
10
110
|
const readablePullRequestSchema = pullRequestSchema.extend({
|
|
11
111
|
state: z.enum(["open", "closed"]),
|
|
12
|
-
user: z.object({
|
|
112
|
+
user: z.object({
|
|
113
|
+
login: z.string().min(1),
|
|
114
|
+
type: z.string().optional()
|
|
115
|
+
})
|
|
13
116
|
});
|
|
14
117
|
const pullRequestHeadSchema = z.object({ head: z.object({
|
|
15
118
|
ref: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._/-]*$/).refine((value) => !value.includes("..")),
|
|
16
119
|
sha: z.string().regex(/^[0-9a-f]{40}$/),
|
|
17
|
-
repo: z.object({ full_name:
|
|
120
|
+
repo: z.object({ full_name: gitHubRepositorySlugSchema })
|
|
18
121
|
}) });
|
|
19
122
|
const reviewCommentSchema = z.object({
|
|
20
123
|
id: z.number().int().positive(),
|
|
21
124
|
body: z.string(),
|
|
22
125
|
html_url: z.url(),
|
|
126
|
+
pull_request_url: z.url(),
|
|
23
127
|
user: z.object({ login: z.string().min(1) }),
|
|
24
128
|
in_reply_to_id: z.number().int().positive().nullish()
|
|
25
129
|
});
|
|
@@ -77,7 +181,7 @@ const pullRequestCandidateSchema = z.object({
|
|
|
77
181
|
user: z.object({ type: z.string().min(1) }),
|
|
78
182
|
head: z.object({
|
|
79
183
|
ref: z.string().min(1),
|
|
80
|
-
repo: z.object({ full_name:
|
|
184
|
+
repo: z.object({ full_name: gitHubRepositorySlugSchema })
|
|
81
185
|
})
|
|
82
186
|
});
|
|
83
187
|
const openPullRequestsSchema = z.array(pullRequestCandidateSchema);
|
|
@@ -91,6 +195,14 @@ const pullRequestDetailSchema = pullRequestCandidateSchema.extend({
|
|
|
91
195
|
sha: z.string().min(1)
|
|
92
196
|
})
|
|
93
197
|
});
|
|
198
|
+
const openPullRequestSummarySchema = z.object({
|
|
199
|
+
number: z.number().int().positive(),
|
|
200
|
+
html_url: z.url(),
|
|
201
|
+
title: z.string().min(1),
|
|
202
|
+
user: z.object({ login: z.string().min(1) }),
|
|
203
|
+
head: z.object({ ref: z.string().min(1) }),
|
|
204
|
+
draft: z.boolean()
|
|
205
|
+
});
|
|
94
206
|
const collaboratorPermissionSchema = z.object({ permission: z.enum([
|
|
95
207
|
"admin",
|
|
96
208
|
"maintain",
|
|
@@ -104,6 +216,7 @@ const writePermissions = /* @__PURE__ */ new Set([
|
|
|
104
216
|
"maintain",
|
|
105
217
|
"write"
|
|
106
218
|
]);
|
|
219
|
+
/** Refusal raised when an inline review-comment author lacks repository write access. */
|
|
107
220
|
var GitHubReviewCommentAuthorError = class extends Error {
|
|
108
221
|
author;
|
|
109
222
|
constructor(author) {
|
|
@@ -112,6 +225,28 @@ var GitHubReviewCommentAuthorError = class extends Error {
|
|
|
112
225
|
this.author = author;
|
|
113
226
|
}
|
|
114
227
|
};
|
|
228
|
+
/**
|
|
229
|
+
* The pull request advanced past the commit a review or fix was prepared
|
|
230
|
+
* against. Callers that reviewed a task keyed to a specific commit (for
|
|
231
|
+
* example `record_post_review`) can use `expectedSha`/`actualSha` to resolve
|
|
232
|
+
* the task as superseded instead of leaving it running for the stall
|
|
233
|
+
* watchdog to eventually -- and misleadingly -- report as "stalled".
|
|
234
|
+
*/
|
|
235
|
+
var StalePullRequestHeadError = class extends Error {
|
|
236
|
+
expectedSha;
|
|
237
|
+
actualSha;
|
|
238
|
+
constructor(expectedSha, actualSha) {
|
|
239
|
+
super(`pull request changed after review: expected ${expectedSha}, found ${actualSha}`);
|
|
240
|
+
this.name = "StalePullRequestHeadError";
|
|
241
|
+
this.expectedSha = expectedSha;
|
|
242
|
+
this.actualSha = actualSha;
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
/** Whether a GitHub user may make repository-scoped Factory decisions. */
|
|
246
|
+
async function hasGitHubRepositoryWriteAccess(input) {
|
|
247
|
+
const { permission } = collaboratorPermissionSchema.parse(await gitHubRequest(input, `/collaborators/${encodeURIComponent(input.author)}/permission`));
|
|
248
|
+
return writePermissions.has(permission);
|
|
249
|
+
}
|
|
115
250
|
/** Create a pull request from an existing head branch. */
|
|
116
251
|
async function createPullRequest(input) {
|
|
117
252
|
const pull = pullRequestSchema.parse(await gitHubRequest(input, "/pulls", {
|
|
@@ -125,14 +260,13 @@ async function createPullRequest(input) {
|
|
|
125
260
|
})
|
|
126
261
|
}));
|
|
127
262
|
return {
|
|
128
|
-
|
|
129
|
-
|
|
263
|
+
pullRequestNumber: pull.number,
|
|
264
|
+
pullRequestUrl: pull.html_url
|
|
130
265
|
};
|
|
131
266
|
}
|
|
132
267
|
/** Create a check run for one commit. Requires a GitHub App token with checks:write. */
|
|
133
268
|
async function createCheckRun(input) {
|
|
134
|
-
|
|
135
|
-
if (input.status !== "completed" && input.conclusion !== void 0) throw new Error("creating a check run with a conclusion requires completed status");
|
|
269
|
+
assertCheckRunFields(input);
|
|
136
270
|
return parseCheckRun(await gitHubRequest(input, "/check-runs", {
|
|
137
271
|
method: "POST",
|
|
138
272
|
body: JSON.stringify({
|
|
@@ -144,7 +278,7 @@ async function createCheckRun(input) {
|
|
|
144
278
|
}
|
|
145
279
|
/** Update a check run previously created by the authenticated GitHub App. */
|
|
146
280
|
async function updateCheckRun(input) {
|
|
147
|
-
|
|
281
|
+
assertCheckRunFields(input);
|
|
148
282
|
return parseCheckRun(await gitHubRequest(input, `/check-runs/${positiveInteger(input.checkRunId, "checkRunId")}`, {
|
|
149
283
|
method: "PATCH",
|
|
150
284
|
body: JSON.stringify({
|
|
@@ -182,25 +316,47 @@ async function updatePullRequestComment(input) {
|
|
|
182
316
|
body: JSON.stringify({ body: input.body })
|
|
183
317
|
}));
|
|
184
318
|
}
|
|
319
|
+
const readIssueCommentSchema = issueCommentSchema.extend({ issue_url: z.string().min(1) });
|
|
320
|
+
/**
|
|
321
|
+
* Read one issue comment from GitHub. A delivery authenticated as a workload
|
|
322
|
+
* rather than by body signature can name any author and any text, so the
|
|
323
|
+
* comment it refers to has to be read back before either is believed.
|
|
324
|
+
*/
|
|
325
|
+
async function readIssueComment(input) {
|
|
326
|
+
const comment = readIssueCommentSchema.parse(await gitHubRequest(input, `/issues/comments/${positiveInteger(input.commentId, "commentId")}`));
|
|
327
|
+
const issueNumber = Number(comment.issue_url.split("/").pop());
|
|
328
|
+
if (!Number.isSafeInteger(issueNumber) || issueNumber < 1) throw new Error("GitHub returned an issue comment without a usable issue reference.");
|
|
329
|
+
return {
|
|
330
|
+
id: comment.id,
|
|
331
|
+
url: comment.html_url,
|
|
332
|
+
author: comment.user.login,
|
|
333
|
+
authorType: comment.user.type,
|
|
334
|
+
body: comment.body,
|
|
335
|
+
issueNumber
|
|
336
|
+
};
|
|
337
|
+
}
|
|
185
338
|
/** Read one inline review comment after applying the author policy, which requires write access by default. */
|
|
186
339
|
async function readReviewComment(input) {
|
|
187
340
|
const comment = parseReviewComment(await gitHubRequest(input, `/pulls/comments/${positiveInteger(input.commentId, "commentId")}`));
|
|
341
|
+
assertReviewCommentPullRequest(input, comment);
|
|
188
342
|
await assertReviewCommentAuthor(input, comment.author);
|
|
189
343
|
return comment;
|
|
190
344
|
}
|
|
191
345
|
/** Reply to an inline review comment after applying the author policy, which requires write access by default. */
|
|
192
346
|
async function answerReviewComment(input) {
|
|
193
347
|
await readReviewComment(input);
|
|
194
|
-
|
|
348
|
+
const reply = parseReviewComment(await gitHubRequest(input, `/pulls/${positiveInteger(input.pullRequestNumber, "pullRequestNumber")}/comments/${positiveInteger(input.commentId, "commentId")}/replies`, {
|
|
195
349
|
method: "POST",
|
|
196
350
|
body: JSON.stringify({ body: input.body })
|
|
197
351
|
}));
|
|
352
|
+
assertReviewCommentPullRequest(input, reply);
|
|
353
|
+
return reply;
|
|
198
354
|
}
|
|
199
355
|
/** Submit a summary and optional inline comments against a reviewed pull request commit. */
|
|
200
356
|
async function submitPullRequestReview(input) {
|
|
201
357
|
const commitId = z.string().regex(/^[0-9a-f]{40}$/).parse(input.commitId);
|
|
202
358
|
const head = await readPullRequestHead(input);
|
|
203
|
-
if (head.sha !== commitId) throw new
|
|
359
|
+
if (head.sha !== commitId) throw new StalePullRequestHeadError(commitId, head.sha);
|
|
204
360
|
const review = submittedReviewSchema.parse(await gitHubRequest(input, `/pulls/${positiveInteger(input.pullRequestNumber, "pullRequestNumber")}/reviews`, {
|
|
205
361
|
method: "POST",
|
|
206
362
|
body: JSON.stringify({
|
|
@@ -227,16 +383,31 @@ async function readPullRequestHead(input) {
|
|
|
227
383
|
return {
|
|
228
384
|
branch: pull.head.ref,
|
|
229
385
|
sha: pull.head.sha,
|
|
230
|
-
repository: pull.head.repo.full_name
|
|
386
|
+
repository: pull.head.repo.full_name
|
|
231
387
|
};
|
|
232
388
|
}
|
|
233
389
|
/** Read the provider-owned identity and lifecycle of one pull request. */
|
|
234
390
|
async function readPullRequest(input) {
|
|
235
391
|
const pull = readablePullRequestSchema.parse(await gitHubRequest(input, `/pulls/${positiveInteger(input.pullRequestNumber, "pullRequestNumber")}`));
|
|
236
392
|
return {
|
|
237
|
-
|
|
238
|
-
|
|
393
|
+
pullRequestNumber: pull.number,
|
|
394
|
+
pullRequestUrl: pull.html_url,
|
|
395
|
+
author: pull.user.login,
|
|
396
|
+
authorType: pull.user.type,
|
|
397
|
+
state: pull.state
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
/** Close an open pull request without merging it. */
|
|
401
|
+
async function closePullRequest(input) {
|
|
402
|
+
const pull = readablePullRequestSchema.parse(await gitHubRequest(input, `/pulls/${positiveInteger(input.pullRequestNumber, "pullRequestNumber")}`, {
|
|
403
|
+
method: "PATCH",
|
|
404
|
+
body: JSON.stringify({ state: "closed" })
|
|
405
|
+
}));
|
|
406
|
+
return {
|
|
407
|
+
pullRequestNumber: pull.number,
|
|
408
|
+
pullRequestUrl: pull.html_url,
|
|
239
409
|
author: pull.user.login,
|
|
410
|
+
authorType: pull.user.type,
|
|
240
411
|
state: pull.state
|
|
241
412
|
};
|
|
242
413
|
}
|
|
@@ -247,8 +418,8 @@ async function listConflictedPullRequests(input) {
|
|
|
247
418
|
for (const candidate of candidates) {
|
|
248
419
|
const pull = pullRequestDetailSchema.parse(await gitHubRequest(input, `/pulls/${candidate.number}`));
|
|
249
420
|
if (pull.mergeable === false || pull.mergeable_state === "dirty") conflicted.push({
|
|
250
|
-
|
|
251
|
-
|
|
421
|
+
pullRequestNumber: pull.number,
|
|
422
|
+
pullRequestUrl: pull.html_url,
|
|
252
423
|
headBranch: pull.head.ref,
|
|
253
424
|
headSha: pull.head.sha,
|
|
254
425
|
baseBranch: pull.base.ref,
|
|
@@ -257,6 +428,17 @@ async function listConflictedPullRequests(input) {
|
|
|
257
428
|
}
|
|
258
429
|
return conflicted;
|
|
259
430
|
}
|
|
431
|
+
/** List open pull requests in a repository, newest first, to check for existing work before triage. */
|
|
432
|
+
async function listOpenPullRequests(input) {
|
|
433
|
+
return z.array(openPullRequestSummarySchema).parse(await gitHubRequest(input, `/pulls?state=open&per_page=100&sort=created&direction=desc`)).map((pull) => ({
|
|
434
|
+
prNumber: pull.number,
|
|
435
|
+
prUrl: pull.html_url,
|
|
436
|
+
title: pull.title,
|
|
437
|
+
author: pull.user.login,
|
|
438
|
+
headBranch: pull.head.ref,
|
|
439
|
+
draft: pull.draft
|
|
440
|
+
}));
|
|
441
|
+
}
|
|
260
442
|
/** Add one label to a pull request. */
|
|
261
443
|
async function addLabel(input) {
|
|
262
444
|
return parseLabels(await gitHubRequest(input, `/issues/${positiveInteger(input.pullRequestNumber, "pullRequestNumber")}/labels`, {
|
|
@@ -269,8 +451,8 @@ async function removeLabel(input) {
|
|
|
269
451
|
return parseLabels(await gitHubRequest(input, `/issues/${positiveInteger(input.pullRequestNumber, "pullRequestNumber")}/labels/${encodeURIComponent(input.label)}`, { method: "DELETE" }));
|
|
270
452
|
}
|
|
271
453
|
async function gitHubRequest(input, path, init = {}) {
|
|
272
|
-
|
|
273
|
-
const response = await (input.fetch ?? globalThis.fetch)(`${gitHubApiUrl}/repos/${
|
|
454
|
+
const repository = repositorySlugSchema.parse(input.repository);
|
|
455
|
+
const response = await (input.fetch ?? globalThis.fetch)(`${gitHubApiUrl}/repos/${repository}${path}`, {
|
|
274
456
|
...init,
|
|
275
457
|
headers: {
|
|
276
458
|
Accept: "application/vnd.github+json",
|
|
@@ -289,14 +471,21 @@ async function gitHubRequest(input, path, init = {}) {
|
|
|
289
471
|
}
|
|
290
472
|
function parseReviewComment(value) {
|
|
291
473
|
const comment = reviewCommentSchema.parse(value);
|
|
474
|
+
const pullRequestMatch = /\/pulls\/([1-9]\d*)\/?$/.exec(new URL(comment.pull_request_url).pathname);
|
|
475
|
+
if (pullRequestMatch?.[1] === void 0) throw new Error("GitHub review comment has an invalid pull request URL");
|
|
292
476
|
return {
|
|
293
477
|
id: comment.id,
|
|
478
|
+
pullRequestNumber: positiveInteger(Number(pullRequestMatch[1]), "pullRequestNumber"),
|
|
294
479
|
body: comment.body,
|
|
295
480
|
url: comment.html_url,
|
|
296
481
|
author: comment.user.login,
|
|
297
482
|
inReplyToId: comment.in_reply_to_id ?? null
|
|
298
483
|
};
|
|
299
484
|
}
|
|
485
|
+
function assertReviewCommentPullRequest(input, comment) {
|
|
486
|
+
const expected = positiveInteger(input.pullRequestNumber, "pullRequestNumber");
|
|
487
|
+
if (comment.pullRequestNumber !== expected) throw new Error(`GitHub review comment ${comment.id} does not belong to pull request ${expected}`);
|
|
488
|
+
}
|
|
300
489
|
function parseIssueComment(value) {
|
|
301
490
|
const comment = issueCommentSchema.parse(value);
|
|
302
491
|
return {
|
|
@@ -336,6 +525,14 @@ function checkRunFields(input) {
|
|
|
336
525
|
...input.output === void 0 ? {} : { output: checkRunOutput(input.output) }
|
|
337
526
|
};
|
|
338
527
|
}
|
|
528
|
+
function assertCheckRunFields(input) {
|
|
529
|
+
if (input.status === "completed") {
|
|
530
|
+
if (input.conclusion === void 0) throw new Error("completed check runs require a conclusion");
|
|
531
|
+
return;
|
|
532
|
+
}
|
|
533
|
+
if (input.conclusion !== void 0) throw new Error("a check run conclusion requires completed status");
|
|
534
|
+
if (input.completedAt !== void 0) throw new Error("a check run completion time requires completed status");
|
|
535
|
+
}
|
|
339
536
|
function checkRunOutput(output) {
|
|
340
537
|
return {
|
|
341
538
|
title: output.title,
|
|
@@ -356,8 +553,10 @@ function checkRunOutput(output) {
|
|
|
356
553
|
}
|
|
357
554
|
async function assertReviewCommentAuthor(input, author) {
|
|
358
555
|
if (input.authorPolicy === "any") return;
|
|
359
|
-
|
|
360
|
-
|
|
556
|
+
if (!await hasGitHubRepositoryWriteAccess({
|
|
557
|
+
...input,
|
|
558
|
+
author
|
|
559
|
+
})) throw new GitHubReviewCommentAuthorError(author);
|
|
361
560
|
}
|
|
362
561
|
function positiveInteger(value, name) {
|
|
363
562
|
if (!Number.isInteger(value) || value < 1) throw new Error(`${name} must be a positive integer`);
|
|
@@ -383,7 +582,7 @@ const pushEventSchema = z.looseObject({
|
|
|
383
582
|
ref: z.string().min(1),
|
|
384
583
|
repository: z.looseObject({
|
|
385
584
|
default_branch: z.string().min(1),
|
|
386
|
-
full_name:
|
|
585
|
+
full_name: gitHubRepositorySlugSchema
|
|
387
586
|
})
|
|
388
587
|
});
|
|
389
588
|
/** Normalize a push to a repository's default branch for deterministic reconciliation. */
|
|
@@ -394,7 +593,7 @@ function normalizeGitHubDefaultBranchPush(options) {
|
|
|
394
593
|
return {
|
|
395
594
|
source: "github_default_branch_push",
|
|
396
595
|
deliveryId: options.deliveryId,
|
|
397
|
-
repositorySlug: parsed.data.repository.full_name
|
|
596
|
+
repositorySlug: parsed.data.repository.full_name,
|
|
398
597
|
defaultBranch: parsed.data.repository.default_branch
|
|
399
598
|
};
|
|
400
599
|
}
|
|
@@ -408,14 +607,14 @@ const pullRequestEventSchema = z.looseObject({
|
|
|
408
607
|
head: z.looseObject({
|
|
409
608
|
sha: z.string().regex(/^[0-9a-f]{40}$/),
|
|
410
609
|
ref: z.string().min(1),
|
|
411
|
-
repo: z.looseObject({ full_name:
|
|
610
|
+
repo: z.looseObject({ full_name: gitHubRepositorySlugSchema })
|
|
412
611
|
}),
|
|
413
612
|
base: z.looseObject({
|
|
414
613
|
sha: z.string().regex(/^[0-9a-f]{40}$/),
|
|
415
614
|
ref: z.string().min(1)
|
|
416
615
|
})
|
|
417
616
|
}),
|
|
418
|
-
repository: z.looseObject({ full_name:
|
|
617
|
+
repository: z.looseObject({ full_name: gitHubRepositorySlugSchema }),
|
|
419
618
|
sender: z.looseObject({ login: z.string().min(1) })
|
|
420
619
|
});
|
|
421
620
|
const reviewablePullRequestActions = /* @__PURE__ */ new Set([
|
|
@@ -430,7 +629,7 @@ function normalizeGitHubPullRequest(options) {
|
|
|
430
629
|
const parsed = pullRequestEventSchema.safeParse(options.payload);
|
|
431
630
|
if (!parsed.success || !reviewablePullRequestActions.has(parsed.data.action)) return null;
|
|
432
631
|
if (parsed.data.pull_request.draft && parsed.data.action !== "ready_for_review") return null;
|
|
433
|
-
const slug = parsed.data.repository.full_name
|
|
632
|
+
const slug = parsed.data.repository.full_name;
|
|
434
633
|
const pull = parsed.data.pull_request;
|
|
435
634
|
return {
|
|
436
635
|
source: "github_pr",
|
|
@@ -441,13 +640,13 @@ function normalizeGitHubPullRequest(options) {
|
|
|
441
640
|
address: `${slug}/pull/${parsed.data.number}`
|
|
442
641
|
},
|
|
443
642
|
pullRequest: {
|
|
444
|
-
|
|
445
|
-
|
|
643
|
+
pullRequestNumber: parsed.data.number,
|
|
644
|
+
pullRequestUrl: pull.html_url,
|
|
446
645
|
author: pull.user.login,
|
|
447
646
|
draft: pull.draft,
|
|
448
647
|
headSha: pull.head.sha,
|
|
449
648
|
headBranch: pull.head.ref,
|
|
450
|
-
headRepositorySlug: pull.head.repo.full_name
|
|
649
|
+
headRepositorySlug: pull.head.repo.full_name,
|
|
451
650
|
baseSha: pull.base.sha,
|
|
452
651
|
baseBranch: pull.base.ref,
|
|
453
652
|
sender: parsed.data.sender.login
|
|
@@ -462,7 +661,7 @@ const issueEventSchema = z.looseObject({
|
|
|
462
661
|
title: z.string(),
|
|
463
662
|
body: z.string().nullable()
|
|
464
663
|
}),
|
|
465
|
-
repository: z.looseObject({ full_name:
|
|
664
|
+
repository: z.looseObject({ full_name: gitHubRepositorySlugSchema })
|
|
466
665
|
});
|
|
467
666
|
const failedWorkflowConclusions = /* @__PURE__ */ new Set([
|
|
468
667
|
"action_required",
|
|
@@ -475,14 +674,14 @@ const workflowRunEventSchema = z.looseObject({
|
|
|
475
674
|
action: z.string(),
|
|
476
675
|
repository: z.looseObject({
|
|
477
676
|
default_branch: z.string().min(1),
|
|
478
|
-
full_name:
|
|
677
|
+
full_name: gitHubRepositorySlugSchema
|
|
479
678
|
}),
|
|
480
679
|
workflow_run: z.looseObject({
|
|
481
680
|
id: z.number().int().min(1),
|
|
482
681
|
name: z.string().min(1),
|
|
483
682
|
event: z.string().min(1),
|
|
484
683
|
head_branch: z.string().min(1).nullable(),
|
|
485
|
-
head_repository: z.looseObject({ full_name:
|
|
684
|
+
head_repository: z.looseObject({ full_name: gitHubRepositorySlugSchema }).nullable(),
|
|
486
685
|
head_sha: z.string().min(1),
|
|
487
686
|
html_url: z.url(),
|
|
488
687
|
conclusion: z.string().nullable(),
|
|
@@ -498,7 +697,7 @@ function normalizeGitHubIssueOpened(options) {
|
|
|
498
697
|
if (options.event !== "issues") return null;
|
|
499
698
|
const parsed = issueEventSchema.safeParse(options.payload);
|
|
500
699
|
if (!parsed.success || parsed.data.action !== "opened") return null;
|
|
501
|
-
const slug = parsed.data.repository.full_name
|
|
700
|
+
const slug = parsed.data.repository.full_name;
|
|
502
701
|
const { number, title, body } = parsed.data.issue;
|
|
503
702
|
return {
|
|
504
703
|
source: "github_issue",
|
|
@@ -525,7 +724,7 @@ const pullRequestClosedSchema = z.looseObject({
|
|
|
525
724
|
merged_by: z.looseObject({ login: z.string().min(1) }).nullable().optional(),
|
|
526
725
|
merge_commit_sha: z.string().regex(/^[0-9a-f]{40}$/).nullable().optional()
|
|
527
726
|
}),
|
|
528
|
-
repository: z.looseObject({ full_name:
|
|
727
|
+
repository: z.looseObject({ full_name: gitHubRepositorySlugSchema }),
|
|
529
728
|
sender: z.looseObject({ login: z.string().min(1) })
|
|
530
729
|
});
|
|
531
730
|
/**
|
|
@@ -542,9 +741,9 @@ function normalizeGitHubPullRequestClosed(options) {
|
|
|
542
741
|
return {
|
|
543
742
|
source: "github_pull_request_closed",
|
|
544
743
|
deliveryId: options.deliveryId,
|
|
545
|
-
repositorySlug: parsed.data.repository.full_name
|
|
546
|
-
|
|
547
|
-
|
|
744
|
+
repositorySlug: parsed.data.repository.full_name,
|
|
745
|
+
pullRequestNumber: pr.number,
|
|
746
|
+
pullRequestUrl: pr.html_url,
|
|
548
747
|
merged: pr.merged,
|
|
549
748
|
mergeCommitSha: pr.merged ? pr.merge_commit_sha ?? null : null,
|
|
550
749
|
decidedBy: pr.merged ? pr.merged_by?.login ?? sender : sender
|
|
@@ -558,7 +757,7 @@ function normalizeGitHubWorkflowRunFailure(options) {
|
|
|
558
757
|
const run = parsed.data.workflow_run;
|
|
559
758
|
const conclusion = run.conclusion;
|
|
560
759
|
if (conclusion === null || !failedWorkflowConclusions.has(conclusion)) return null;
|
|
561
|
-
const slug = parsed.data.repository.full_name
|
|
760
|
+
const slug = parsed.data.repository.full_name;
|
|
562
761
|
return {
|
|
563
762
|
source: "github_ci_failure",
|
|
564
763
|
deliveryId: options.deliveryId,
|
|
@@ -573,7 +772,7 @@ function normalizeGitHubWorkflowRunFailure(options) {
|
|
|
573
772
|
name: run.name,
|
|
574
773
|
trigger: run.event,
|
|
575
774
|
branch: run.head_branch,
|
|
576
|
-
headRepositorySlug: run.head_repository?.full_name
|
|
775
|
+
headRepositorySlug: run.head_repository?.full_name ?? null,
|
|
577
776
|
headSha: run.head_sha,
|
|
578
777
|
url: run.html_url,
|
|
579
778
|
conclusion,
|
|
@@ -583,6 +782,6 @@ function normalizeGitHubWorkflowRunFailure(options) {
|
|
|
583
782
|
};
|
|
584
783
|
}
|
|
585
784
|
//#endregion
|
|
586
|
-
export { GitHubReviewCommentAuthorError, addLabel, answerReviewComment, createCheckRun, createPullRequest, createPullRequestComment, listCheckRunsForRef, listConflictedPullRequests, listPullRequestComments, normalizeGitHubDefaultBranchPush, normalizeGitHubIssueOpened, normalizeGitHubPullRequest, normalizeGitHubPullRequestClosed, normalizeGitHubWorkflowRunFailure, readPullRequest, readPullRequestHead, readReviewComment, removeLabel, submitPullRequestReview, updateCheckRun, updatePullRequestComment, verifyGitHubSignature };
|
|
785
|
+
export { GitHubCheckoutConflictError, GitHubPublicationApiError, GitHubReviewCommentAuthorError, StalePullRequestHeadError, addLabel, answerReviewComment, checkoutGitHubRepository, closePullRequest, configuredEventRepositorySlug, createCheckRun, createGitHubPublicationClient, createPullRequest, createPullRequestComment, factorySessionBranch, factoryTaskBranch, hasGitHubRepositoryWriteAccess, isSafeGitRef, listCheckRunsForRef, listConflictedPullRequests, listOpenPullRequests, listPullRequestComments, mintGitHubAppInstallationToken, normalizeFactoryQuestionReply, normalizeFactoryReviewComment, normalizeGitHubDefaultBranchPush, normalizeGitHubIssueOpened, normalizeGitHubPullRequest, normalizeGitHubPullRequestClosed, normalizeGitHubWorkflowRunFailure, readCommittedGitChange, readIssueComment, readPullRequest, readPullRequestHead, readReviewComment, removeLabel, runSandboxGit, stripFactoryQuestionMention, submitPullRequestReview, updateCheckRun, updatePullRequestComment, verifyGitHubSignature };
|
|
587
786
|
|
|
588
787
|
//# sourceMappingURL=github.mjs.map
|