@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
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { TaskId } from "./schema/id.mjs";
|
|
2
|
+
import { RepositorySlug } from "./schema/repository.mjs";
|
|
3
|
+
import { AgentSessionId } from "./schema/session.mjs";
|
|
4
|
+
import { GitHubGitTransport, GitTransferSandbox } from "./github-transfer.mjs";
|
|
5
|
+
//#region src/github-publication.d.ts
|
|
6
|
+
/** Minimal sandbox command boundary required by Git checkout and publication helpers. */
|
|
7
|
+
interface SandboxGit {
|
|
8
|
+
run(options: SandboxGitCommandInput): PromiseLike<SandboxGitCommandResult>;
|
|
9
|
+
}
|
|
10
|
+
/** Shell command submitted through the minimal Git sandbox boundary. */
|
|
11
|
+
interface SandboxGitCommandInput {
|
|
12
|
+
command: string;
|
|
13
|
+
}
|
|
14
|
+
/** Captured output and optional exit status from a sandbox Git command. */
|
|
15
|
+
interface SandboxGitCommandResult {
|
|
16
|
+
stdout: string;
|
|
17
|
+
stderr?: string;
|
|
18
|
+
exitCode?: number;
|
|
19
|
+
}
|
|
20
|
+
/** Bounds applied while translating committed workspace changes into GitHub tree entries. */
|
|
21
|
+
interface GitHubPublicationLimits {
|
|
22
|
+
maxChangedFiles?: number;
|
|
23
|
+
maxFileBytes?: number;
|
|
24
|
+
}
|
|
25
|
+
/** Repository-scoped credentials and transport for the GitHub publication client. */
|
|
26
|
+
interface GitHubPublicationClientOptions {
|
|
27
|
+
repository: RepositorySlug;
|
|
28
|
+
token: string;
|
|
29
|
+
fetch?: typeof globalThis.fetch;
|
|
30
|
+
}
|
|
31
|
+
/** Pull-request snapshot used to reconcile idempotent publication effects. */
|
|
32
|
+
interface GitHubPublicationPullRequest {
|
|
33
|
+
pullRequestNumber: number;
|
|
34
|
+
pullRequestUrl: string;
|
|
35
|
+
nodeId: string;
|
|
36
|
+
title: string;
|
|
37
|
+
body: string | null;
|
|
38
|
+
state: "open" | "closed";
|
|
39
|
+
draft: boolean;
|
|
40
|
+
head: {
|
|
41
|
+
branch: string;
|
|
42
|
+
sha: string;
|
|
43
|
+
repository: RepositorySlug | null;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/** Git Data and pull-request operations needed by supplied publication workflows. */
|
|
47
|
+
interface GitHubPublicationClient {
|
|
48
|
+
commit(input: ReadGitHubCommitInput): Promise<GitHubCommit>;
|
|
49
|
+
branchHead(input: ReadGitHubBranchHeadInput): Promise<string | null>;
|
|
50
|
+
createTree(input: CreateGitHubTreeInput): Promise<string>;
|
|
51
|
+
createCommit(input: CreateGitHubCommitInput): Promise<string>;
|
|
52
|
+
createBranch(input: CreateGitHubBranchInput): Promise<void>;
|
|
53
|
+
updateBranch(input: UpdateGitHubBranchInput): Promise<void>;
|
|
54
|
+
createPullRequest(input: CreateGitHubPublicationPullRequestInput): Promise<CreatedGitHubPublicationPullRequest>;
|
|
55
|
+
pullRequest(input: ReadGitHubPullRequestInput): Promise<GitHubPublicationPullRequest>;
|
|
56
|
+
pullRequests(input: ListGitHubPublicationPullRequestsInput): Promise<readonly GitHubPublicationPullRequest[]>;
|
|
57
|
+
markReady(input: MarkGitHubPullRequestReadyInput): Promise<void>;
|
|
58
|
+
}
|
|
59
|
+
/** Exact commit requested from GitHub's Git Data API. */
|
|
60
|
+
interface ReadGitHubCommitInput {
|
|
61
|
+
sha: string;
|
|
62
|
+
}
|
|
63
|
+
/** Tree and parents recorded for one GitHub commit. */
|
|
64
|
+
interface GitHubCommit {
|
|
65
|
+
treeSha: string;
|
|
66
|
+
parentShas: readonly string[];
|
|
67
|
+
}
|
|
68
|
+
/** Exact branch whose current GitHub head should be read. */
|
|
69
|
+
interface ReadGitHubBranchHeadInput {
|
|
70
|
+
branch: string;
|
|
71
|
+
}
|
|
72
|
+
/** Base tree and exclusive file operations used to create a GitHub tree. */
|
|
73
|
+
interface CreateGitHubTreeInput {
|
|
74
|
+
baseTreeSha: string;
|
|
75
|
+
entries: readonly GitHubTreeEntry[];
|
|
76
|
+
}
|
|
77
|
+
/** Commit content and parent identities used to create a GitHub commit. */
|
|
78
|
+
interface CreateGitHubCommitInput {
|
|
79
|
+
message: string;
|
|
80
|
+
treeSha: string;
|
|
81
|
+
parentShas: readonly string[];
|
|
82
|
+
}
|
|
83
|
+
/** Branch and commit identity used to create a GitHub branch. */
|
|
84
|
+
interface CreateGitHubBranchInput {
|
|
85
|
+
branch: string;
|
|
86
|
+
sha: string;
|
|
87
|
+
}
|
|
88
|
+
/** Branch update and force policy used to move a GitHub branch. */
|
|
89
|
+
interface UpdateGitHubBranchInput extends CreateGitHubBranchInput {
|
|
90
|
+
force: boolean;
|
|
91
|
+
}
|
|
92
|
+
/** Provider-owned pull-request number to read. */
|
|
93
|
+
interface ReadGitHubPullRequestInput {
|
|
94
|
+
pullRequestNumber: number;
|
|
95
|
+
}
|
|
96
|
+
/** Provider GraphQL node identity of a draft pull request to mark ready. */
|
|
97
|
+
interface MarkGitHubPullRequestReadyInput {
|
|
98
|
+
nodeId: string;
|
|
99
|
+
}
|
|
100
|
+
/** Pull-request presentation and branch inputs used during GitHub publication. */
|
|
101
|
+
interface CreateGitHubPublicationPullRequestInput {
|
|
102
|
+
title: string;
|
|
103
|
+
body: string;
|
|
104
|
+
head: string;
|
|
105
|
+
base: string;
|
|
106
|
+
draft: boolean;
|
|
107
|
+
}
|
|
108
|
+
/** Provider identity and draft state returned after creating a pull request. */
|
|
109
|
+
interface CreatedGitHubPublicationPullRequest {
|
|
110
|
+
pullRequestNumber: number;
|
|
111
|
+
pullRequestUrl: string;
|
|
112
|
+
draft: boolean;
|
|
113
|
+
}
|
|
114
|
+
/** State and optional exact head filter used to list publication pull requests. */
|
|
115
|
+
interface ListGitHubPublicationPullRequestsInput {
|
|
116
|
+
state: "open" | "all";
|
|
117
|
+
head?: string;
|
|
118
|
+
}
|
|
119
|
+
/** GitHub publication failure that preserves the provider HTTP status. */
|
|
120
|
+
declare class GitHubPublicationApiError extends Error {
|
|
121
|
+
readonly status: number;
|
|
122
|
+
constructor(status: number, message: string);
|
|
123
|
+
}
|
|
124
|
+
interface GitHubTreeEntryBase {
|
|
125
|
+
path: string;
|
|
126
|
+
mode: "100644" | "100755";
|
|
127
|
+
type: "blob";
|
|
128
|
+
}
|
|
129
|
+
/** File content uploaded through GitHub's Git Data API. */
|
|
130
|
+
interface GitHubTreeUpsert extends GitHubTreeEntryBase {
|
|
131
|
+
content: string;
|
|
132
|
+
sha?: never;
|
|
133
|
+
}
|
|
134
|
+
/** Existing file removed through GitHub's Git Data API. */
|
|
135
|
+
interface GitHubTreeDeletion extends GitHubTreeEntryBase {
|
|
136
|
+
sha: null;
|
|
137
|
+
content?: never;
|
|
138
|
+
}
|
|
139
|
+
/** Exclusive bounded file upsert or deletion accepted by GitHub's Git Data API. */
|
|
140
|
+
type GitHubTreeEntry = GitHubTreeUpsert | GitHubTreeDeletion;
|
|
141
|
+
/** Committed workspace delta represented against a specific base commit. */
|
|
142
|
+
interface CommittedGitChange {
|
|
143
|
+
base: string;
|
|
144
|
+
tree: readonly GitHubTreeEntry[];
|
|
145
|
+
changedFiles: number;
|
|
146
|
+
}
|
|
147
|
+
/** Sandbox, repository, and bounds for reading a committed workspace delta. */
|
|
148
|
+
interface ReadCommittedGitChangeInput extends GitHubPublicationLimits {
|
|
149
|
+
sandbox: SandboxGit;
|
|
150
|
+
repositorySlug: RepositorySlug;
|
|
151
|
+
baseRef?: string;
|
|
152
|
+
allowEmpty?: boolean;
|
|
153
|
+
}
|
|
154
|
+
/** Common dependencies for an authorized repository checkout. */
|
|
155
|
+
interface CheckoutGitHubRepositoryBaseInput {
|
|
156
|
+
sandbox: GitTransferSandbox;
|
|
157
|
+
repositorySlug: RepositorySlug;
|
|
158
|
+
transport: GitHubGitTransport;
|
|
159
|
+
}
|
|
160
|
+
/** Authorized repository checkout with recovery options that require a branch to resume. */
|
|
161
|
+
type CheckoutGitHubRepositoryInput = CheckoutGitHubRepositoryBaseInput & ({
|
|
162
|
+
resumeBranch?: never;
|
|
163
|
+
rememberPublishedHead?: never;
|
|
164
|
+
} | {
|
|
165
|
+
/** Resume this remote branch when it exists after refreshing the default branch. */
|
|
166
|
+
resumeBranch: string;
|
|
167
|
+
/** Remember the resumed remote head for later publication reconciliation. */
|
|
168
|
+
rememberPublishedHead?: true;
|
|
169
|
+
});
|
|
170
|
+
/** Refusal raised when an existing sandbox checkout points at another repository. */
|
|
171
|
+
declare class GitHubCheckoutConflictError extends Error {
|
|
172
|
+
readonly existingOrigin: string;
|
|
173
|
+
readonly expectedOrigin: string;
|
|
174
|
+
constructor(existingOrigin: string, expectedOrigin: string);
|
|
175
|
+
}
|
|
176
|
+
/** GitHub Git Data and pull-request operations used by publication workflows. */
|
|
177
|
+
declare function createGitHubPublicationClient(options: GitHubPublicationClientOptions): GitHubPublicationClient;
|
|
178
|
+
/** Derive the deterministic publication branch owned by a durable Task. */
|
|
179
|
+
declare function factoryTaskBranch(taskId: TaskId): string;
|
|
180
|
+
/** Derive the deterministic publication branch owned by an operator session. */
|
|
181
|
+
declare function factorySessionBranch(sessionId: AgentSessionId): string;
|
|
182
|
+
/** Check whether a Git reference is safe to interpolate into supplied Git commands. */
|
|
183
|
+
declare function isSafeGitRef(ref: string): boolean;
|
|
184
|
+
/** Clone or refresh one authorized GitHub repository without retaining credentials. */
|
|
185
|
+
declare function checkoutGitHubRepository(input: CheckoutGitHubRepositoryInput): Promise<void>;
|
|
186
|
+
/** Sandbox and argument vector for one Git command in a repository checkout. */
|
|
187
|
+
interface RunSandboxGitInput {
|
|
188
|
+
sandbox: SandboxGit;
|
|
189
|
+
args: readonly string[];
|
|
190
|
+
repositoryPath?: string;
|
|
191
|
+
}
|
|
192
|
+
/** Run a Git argument vector in a sandbox repository and reject nonzero exits. */
|
|
193
|
+
declare function runSandboxGit(input: RunSandboxGitInput): Promise<string>;
|
|
194
|
+
/** Read committed sandbox changes as a bounded GitHub Git Data API tree. */
|
|
195
|
+
declare function readCommittedGitChange(input: ReadCommittedGitChangeInput): Promise<CommittedGitChange>;
|
|
196
|
+
//#endregion
|
|
197
|
+
export { CheckoutGitHubRepositoryInput, CommittedGitChange, CreateGitHubBranchInput, CreateGitHubCommitInput, CreateGitHubPublicationPullRequestInput, CreateGitHubTreeInput, CreatedGitHubPublicationPullRequest, GitHubCheckoutConflictError, GitHubCommit, GitHubPublicationApiError, GitHubPublicationClient, GitHubPublicationClientOptions, GitHubPublicationLimits, GitHubPublicationPullRequest, GitHubTreeDeletion, GitHubTreeEntry, GitHubTreeUpsert, ListGitHubPublicationPullRequestsInput, MarkGitHubPullRequestReadyInput, ReadCommittedGitChangeInput, ReadGitHubBranchHeadInput, ReadGitHubCommitInput, ReadGitHubPullRequestInput, RunSandboxGitInput, SandboxGit, SandboxGitCommandInput, SandboxGitCommandResult, UpdateGitHubBranchInput, checkoutGitHubRepository, createGitHubPublicationClient, factorySessionBranch, factoryTaskBranch, isSafeGitRef, readCommittedGitChange, runSandboxGit };
|
|
198
|
+
//# sourceMappingURL=github-publication.d.mts.map
|
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
import { repositorySlugSchema } from "./schema/repository.mjs";
|
|
2
|
+
import { agentSessionIdSchema } from "./schema/session.mjs";
|
|
3
|
+
import { quoteShellArgument, runSandboxCommand, withSandboxGitBundle } from "./github-transfer.mjs";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
//#region src/github-publication.ts
|
|
6
|
+
/** GitHub publication failure that preserves the provider HTTP status. */
|
|
7
|
+
var GitHubPublicationApiError = class extends Error {
|
|
8
|
+
status;
|
|
9
|
+
constructor(status, message) {
|
|
10
|
+
super(`GitHub API request failed (${status}): ${message}`);
|
|
11
|
+
this.status = status;
|
|
12
|
+
this.name = "GitHubPublicationApiError";
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
/** Refusal raised when an existing sandbox checkout points at another repository. */
|
|
16
|
+
var GitHubCheckoutConflictError = class extends Error {
|
|
17
|
+
existingOrigin;
|
|
18
|
+
expectedOrigin;
|
|
19
|
+
constructor(existingOrigin, expectedOrigin) {
|
|
20
|
+
super(`sandbox checkout ${existingOrigin} does not match ${expectedOrigin}`);
|
|
21
|
+
this.existingOrigin = existingOrigin;
|
|
22
|
+
this.expectedOrigin = expectedOrigin;
|
|
23
|
+
this.name = "GitHubCheckoutConflictError";
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const safePathPattern = /^[A-Za-z0-9.][A-Za-z0-9._/-]*$/u;
|
|
27
|
+
const safeRefPattern = /^[A-Za-z0-9][A-Za-z0-9._/-]*$/u;
|
|
28
|
+
const allowedModes = /* @__PURE__ */ new Set(["100644", "100755"]);
|
|
29
|
+
const gitHubApiUrl = "https://api.github.com";
|
|
30
|
+
const shaSchema = z.string().min(1);
|
|
31
|
+
const pullRequestSchema = z.object({
|
|
32
|
+
number: z.number().int().positive(),
|
|
33
|
+
html_url: z.url(),
|
|
34
|
+
node_id: z.string().min(1),
|
|
35
|
+
title: z.string(),
|
|
36
|
+
body: z.string().nullable(),
|
|
37
|
+
state: z.enum(["open", "closed"]),
|
|
38
|
+
draft: z.boolean(),
|
|
39
|
+
head: z.object({
|
|
40
|
+
ref: z.string().min(1),
|
|
41
|
+
sha: shaSchema,
|
|
42
|
+
repo: z.object({ full_name: z.string().min(1) }).nullable()
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
/** GitHub Git Data and pull-request operations used by publication workflows. */
|
|
46
|
+
function createGitHubPublicationClient(options) {
|
|
47
|
+
const repository = repositorySlugSchema.parse(options.repository.toLowerCase());
|
|
48
|
+
const request = async (path, init = {}) => {
|
|
49
|
+
let response;
|
|
50
|
+
try {
|
|
51
|
+
response = await (options.fetch ?? globalThis.fetch)(`${gitHubApiUrl}/repos/${repository}${path}`, {
|
|
52
|
+
...init,
|
|
53
|
+
headers: {
|
|
54
|
+
Accept: "application/vnd.github+json",
|
|
55
|
+
Authorization: `Bearer ${options.token}`,
|
|
56
|
+
"Content-Type": "application/json",
|
|
57
|
+
"X-GitHub-Api-Version": "2022-11-28",
|
|
58
|
+
...init.headers
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
} catch (error) {
|
|
62
|
+
throw new Error("GitHub API request failed", { cause: error });
|
|
63
|
+
}
|
|
64
|
+
const body = await response.json().catch(() => null);
|
|
65
|
+
if (!response.ok) {
|
|
66
|
+
const parsed = z.object({ message: z.string() }).safeParse(body);
|
|
67
|
+
throw new GitHubPublicationApiError(response.status, parsed.success ? parsed.data.message : response.statusText);
|
|
68
|
+
}
|
|
69
|
+
return body;
|
|
70
|
+
};
|
|
71
|
+
const graphql = async (query, variables) => {
|
|
72
|
+
let response;
|
|
73
|
+
try {
|
|
74
|
+
response = await (options.fetch ?? globalThis.fetch)(`${gitHubApiUrl}/graphql`, {
|
|
75
|
+
method: "POST",
|
|
76
|
+
headers: {
|
|
77
|
+
Accept: "application/vnd.github+json",
|
|
78
|
+
Authorization: `Bearer ${options.token}`,
|
|
79
|
+
"Content-Type": "application/json",
|
|
80
|
+
"X-GitHub-Api-Version": "2022-11-28"
|
|
81
|
+
},
|
|
82
|
+
body: JSON.stringify({
|
|
83
|
+
query,
|
|
84
|
+
variables
|
|
85
|
+
})
|
|
86
|
+
});
|
|
87
|
+
} catch (error) {
|
|
88
|
+
throw new Error("GitHub GraphQL request failed", { cause: error });
|
|
89
|
+
}
|
|
90
|
+
const body = await response.json().catch(() => null);
|
|
91
|
+
const parsed = z.object({ errors: z.array(z.object({ message: z.string() })).optional() }).safeParse(body);
|
|
92
|
+
if (!response.ok || parsed.success && parsed.data.errors?.length) throw new GitHubPublicationApiError(response.status, parsed.success && parsed.data.errors?.[0] !== void 0 ? parsed.data.errors[0].message : response.statusText);
|
|
93
|
+
};
|
|
94
|
+
const parsePullRequest = (value) => {
|
|
95
|
+
const pull = pullRequestSchema.parse(value);
|
|
96
|
+
return {
|
|
97
|
+
pullRequestNumber: pull.number,
|
|
98
|
+
pullRequestUrl: pull.html_url,
|
|
99
|
+
nodeId: pull.node_id,
|
|
100
|
+
title: pull.title,
|
|
101
|
+
body: pull.body,
|
|
102
|
+
state: pull.state,
|
|
103
|
+
draft: pull.draft,
|
|
104
|
+
head: {
|
|
105
|
+
branch: pull.head.ref,
|
|
106
|
+
sha: pull.head.sha,
|
|
107
|
+
repository: pull.head.repo === null ? null : repositorySlugSchema.parse(pull.head.repo.full_name.toLowerCase())
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
const branchPath = (branch) => {
|
|
112
|
+
if (!isSafeGitRef(branch)) throw new Error(`refusing to use unsafe branch name: ${branch}`);
|
|
113
|
+
return branch;
|
|
114
|
+
};
|
|
115
|
+
return {
|
|
116
|
+
async commit(input) {
|
|
117
|
+
const commit = z.object({
|
|
118
|
+
tree: z.object({ sha: shaSchema }),
|
|
119
|
+
parents: z.array(z.object({ sha: shaSchema }))
|
|
120
|
+
}).parse(await request(`/git/commits/${encodeURIComponent(input.sha)}`));
|
|
121
|
+
return {
|
|
122
|
+
treeSha: commit.tree.sha,
|
|
123
|
+
parentShas: commit.parents.map((parent) => parent.sha)
|
|
124
|
+
};
|
|
125
|
+
},
|
|
126
|
+
async branchHead(input) {
|
|
127
|
+
try {
|
|
128
|
+
return z.object({ object: z.object({ sha: shaSchema }) }).parse(await request(`/git/ref/heads/${branchPath(input.branch)}`)).object.sha;
|
|
129
|
+
} catch (error) {
|
|
130
|
+
if (error instanceof GitHubPublicationApiError && error.status === 404) return null;
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
async createTree(input) {
|
|
135
|
+
return z.object({ sha: shaSchema }).parse(await request("/git/trees", {
|
|
136
|
+
method: "POST",
|
|
137
|
+
body: JSON.stringify({
|
|
138
|
+
base_tree: input.baseTreeSha,
|
|
139
|
+
tree: input.entries
|
|
140
|
+
})
|
|
141
|
+
})).sha;
|
|
142
|
+
},
|
|
143
|
+
async createCommit(input) {
|
|
144
|
+
return z.object({ sha: shaSchema }).parse(await request("/git/commits", {
|
|
145
|
+
method: "POST",
|
|
146
|
+
body: JSON.stringify({
|
|
147
|
+
message: input.message,
|
|
148
|
+
tree: input.treeSha,
|
|
149
|
+
parents: input.parentShas
|
|
150
|
+
})
|
|
151
|
+
})).sha;
|
|
152
|
+
},
|
|
153
|
+
async createBranch(input) {
|
|
154
|
+
await request("/git/refs", {
|
|
155
|
+
method: "POST",
|
|
156
|
+
body: JSON.stringify({
|
|
157
|
+
ref: `refs/heads/${branchPath(input.branch)}`,
|
|
158
|
+
sha: input.sha
|
|
159
|
+
})
|
|
160
|
+
});
|
|
161
|
+
},
|
|
162
|
+
async updateBranch(input) {
|
|
163
|
+
await request(`/git/refs/heads/${branchPath(input.branch)}`, {
|
|
164
|
+
method: "PATCH",
|
|
165
|
+
body: JSON.stringify({
|
|
166
|
+
sha: input.sha,
|
|
167
|
+
force: input.force
|
|
168
|
+
})
|
|
169
|
+
});
|
|
170
|
+
},
|
|
171
|
+
async createPullRequest(input) {
|
|
172
|
+
const pull = z.object({
|
|
173
|
+
number: z.number().int().positive(),
|
|
174
|
+
html_url: z.url(),
|
|
175
|
+
draft: z.boolean()
|
|
176
|
+
}).parse(await request("/pulls", {
|
|
177
|
+
method: "POST",
|
|
178
|
+
body: JSON.stringify(input)
|
|
179
|
+
}));
|
|
180
|
+
return {
|
|
181
|
+
pullRequestNumber: pull.number,
|
|
182
|
+
pullRequestUrl: pull.html_url,
|
|
183
|
+
draft: pull.draft
|
|
184
|
+
};
|
|
185
|
+
},
|
|
186
|
+
async pullRequest(input) {
|
|
187
|
+
return parsePullRequest(await request(`/pulls/${input.pullRequestNumber}`));
|
|
188
|
+
},
|
|
189
|
+
async pullRequests(input) {
|
|
190
|
+
const query = new URLSearchParams({
|
|
191
|
+
state: input.state,
|
|
192
|
+
per_page: "100"
|
|
193
|
+
});
|
|
194
|
+
if (input.head !== void 0) query.set("head", input.head);
|
|
195
|
+
return z.array(pullRequestSchema).parse(await request(`/pulls?${query.toString()}`)).map(parsePullRequest);
|
|
196
|
+
},
|
|
197
|
+
async markReady(input) {
|
|
198
|
+
await graphql("mutation($id: ID!) { markPullRequestReadyForReview(input: { pullRequestId: $id }) { clientMutationId } }", { id: input.nodeId });
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
/** Derive the deterministic publication branch owned by a durable Task. */
|
|
203
|
+
function factoryTaskBranch(taskId) {
|
|
204
|
+
return `factory/${taskId}`;
|
|
205
|
+
}
|
|
206
|
+
/** Derive the deterministic publication branch owned by an operator session. */
|
|
207
|
+
function factorySessionBranch(sessionId) {
|
|
208
|
+
return `factory/${agentSessionIdSchema.parse(sessionId)}`;
|
|
209
|
+
}
|
|
210
|
+
/** Check whether a Git reference is safe to interpolate into supplied Git commands. */
|
|
211
|
+
function isSafeGitRef(ref) {
|
|
212
|
+
return safeRefPattern.test(ref) && !ref.includes("..");
|
|
213
|
+
}
|
|
214
|
+
/** Clone or refresh one authorized GitHub repository without retaining credentials. */
|
|
215
|
+
async function checkoutGitHubRepository(input) {
|
|
216
|
+
const slug = repositorySlugSchema.parse(input.repositorySlug.toLowerCase());
|
|
217
|
+
const expectedOrigin = `https://github.com/${slug}.git`;
|
|
218
|
+
const checkout = await input.sandbox.run({ command: "test -d repo/.git" });
|
|
219
|
+
const existingOrigin = checkout.exitCode === void 0 || checkout.exitCode === 0 ? (await runSandboxCommand(input.sandbox, [
|
|
220
|
+
"git",
|
|
221
|
+
"-C",
|
|
222
|
+
"repo",
|
|
223
|
+
"remote",
|
|
224
|
+
"get-url",
|
|
225
|
+
"origin"
|
|
226
|
+
])).trim() : "";
|
|
227
|
+
if (existingOrigin !== "" && existingOrigin.toLowerCase() !== expectedOrigin) throw new GitHubCheckoutConflictError(existingOrigin, expectedOrigin);
|
|
228
|
+
const resume = input.resumeBranch;
|
|
229
|
+
if (resume !== void 0 && !isSafeGitRef(resume)) throw new Error(`refusing to resume unsafe branch name: ${resume}`);
|
|
230
|
+
const bundle = await input.transport.fetch({
|
|
231
|
+
repository: slug,
|
|
232
|
+
refs: []
|
|
233
|
+
});
|
|
234
|
+
await withSandboxGitBundle({
|
|
235
|
+
sandbox: input.sandbox,
|
|
236
|
+
bundle,
|
|
237
|
+
async use(path) {
|
|
238
|
+
if (existingOrigin === "") {
|
|
239
|
+
await runSandboxCommand(input.sandbox, [
|
|
240
|
+
"git",
|
|
241
|
+
"clone",
|
|
242
|
+
path,
|
|
243
|
+
"repo"
|
|
244
|
+
]);
|
|
245
|
+
await runSandboxCommand(input.sandbox, [
|
|
246
|
+
"git",
|
|
247
|
+
"-C",
|
|
248
|
+
"repo",
|
|
249
|
+
"remote",
|
|
250
|
+
"set-url",
|
|
251
|
+
"origin",
|
|
252
|
+
expectedOrigin
|
|
253
|
+
]);
|
|
254
|
+
await runSandboxCommand(input.sandbox, [
|
|
255
|
+
"git",
|
|
256
|
+
"-C",
|
|
257
|
+
"repo",
|
|
258
|
+
"config",
|
|
259
|
+
"user.name",
|
|
260
|
+
"factory"
|
|
261
|
+
]);
|
|
262
|
+
await runSandboxCommand(input.sandbox, [
|
|
263
|
+
"git",
|
|
264
|
+
"-C",
|
|
265
|
+
"repo",
|
|
266
|
+
"config",
|
|
267
|
+
"user.email",
|
|
268
|
+
"factory@localhost"
|
|
269
|
+
]);
|
|
270
|
+
} else {
|
|
271
|
+
await runSandboxCommand(input.sandbox, [
|
|
272
|
+
"git",
|
|
273
|
+
"-C",
|
|
274
|
+
"repo",
|
|
275
|
+
"fetch",
|
|
276
|
+
path,
|
|
277
|
+
"+refs/heads/*:refs/remotes/origin/*"
|
|
278
|
+
]);
|
|
279
|
+
await runSandboxCommand(input.sandbox, [
|
|
280
|
+
"git",
|
|
281
|
+
"-C",
|
|
282
|
+
"repo",
|
|
283
|
+
"reset",
|
|
284
|
+
"--hard",
|
|
285
|
+
"origin/HEAD"
|
|
286
|
+
]);
|
|
287
|
+
}
|
|
288
|
+
if (resume === void 0) return;
|
|
289
|
+
if ((await input.sandbox.run({ command: [
|
|
290
|
+
"git",
|
|
291
|
+
"-C",
|
|
292
|
+
"repo",
|
|
293
|
+
"show-ref",
|
|
294
|
+
"--verify",
|
|
295
|
+
"--quiet",
|
|
296
|
+
`refs/remotes/origin/${resume}`
|
|
297
|
+
].map(quoteShellArgument).join(" ") })).exitCode !== 0) return;
|
|
298
|
+
await runSandboxCommand(input.sandbox, [
|
|
299
|
+
"git",
|
|
300
|
+
"-C",
|
|
301
|
+
"repo",
|
|
302
|
+
"checkout",
|
|
303
|
+
"-B",
|
|
304
|
+
resume,
|
|
305
|
+
`refs/remotes/origin/${resume}`
|
|
306
|
+
]);
|
|
307
|
+
if (input.rememberPublishedHead === true) {
|
|
308
|
+
const head = (await runSandboxCommand(input.sandbox, [
|
|
309
|
+
"git",
|
|
310
|
+
"-C",
|
|
311
|
+
"repo",
|
|
312
|
+
"rev-parse",
|
|
313
|
+
"HEAD"
|
|
314
|
+
])).trim();
|
|
315
|
+
await runSandboxCommand(input.sandbox, [
|
|
316
|
+
"git",
|
|
317
|
+
"-C",
|
|
318
|
+
"repo",
|
|
319
|
+
"config",
|
|
320
|
+
"factory.publishedHead",
|
|
321
|
+
head
|
|
322
|
+
]);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
/** Run a Git argument vector in a sandbox repository and reject nonzero exits. */
|
|
328
|
+
function runSandboxGit(input) {
|
|
329
|
+
return runSandboxCommand(input.sandbox, [
|
|
330
|
+
"git",
|
|
331
|
+
"-C",
|
|
332
|
+
input.repositoryPath ?? "repo",
|
|
333
|
+
...input.args
|
|
334
|
+
]);
|
|
335
|
+
}
|
|
336
|
+
/** Read committed sandbox changes as a bounded GitHub Git Data API tree. */
|
|
337
|
+
async function readCommittedGitChange(input) {
|
|
338
|
+
const repositorySlug = repositorySlugSchema.parse(input.repositorySlug.toLowerCase());
|
|
339
|
+
const baseRef = input.baseRef ?? "origin/HEAD";
|
|
340
|
+
if (!isSafeGitRef(baseRef)) throw new Error(`refusing to read unsafe base ref: ${baseRef}`);
|
|
341
|
+
const maxChangedFiles = input.maxChangedFiles ?? 25;
|
|
342
|
+
const maxFileBytes = input.maxFileBytes ?? 2e5;
|
|
343
|
+
if (!Number.isSafeInteger(maxChangedFiles) || maxChangedFiles < 1) throw new Error("maxChangedFiles must be a positive integer");
|
|
344
|
+
if (!Number.isSafeInteger(maxFileBytes) || maxFileBytes < 1) throw new Error("maxFileBytes must be a positive integer");
|
|
345
|
+
if ((await runSandboxGit({
|
|
346
|
+
sandbox: input.sandbox,
|
|
347
|
+
args: [
|
|
348
|
+
"remote",
|
|
349
|
+
"get-url",
|
|
350
|
+
"origin"
|
|
351
|
+
]
|
|
352
|
+
})).trim() !== `https://github.com/${repositorySlug}.git`) throw new Error(`sandbox checkout does not match task repository ${repositorySlug}`);
|
|
353
|
+
const head = (await runSandboxGit({
|
|
354
|
+
sandbox: input.sandbox,
|
|
355
|
+
args: ["rev-parse", "HEAD"]
|
|
356
|
+
})).trim();
|
|
357
|
+
const base = (await runSandboxGit({
|
|
358
|
+
sandbox: input.sandbox,
|
|
359
|
+
args: ["rev-parse", baseRef]
|
|
360
|
+
})).trim();
|
|
361
|
+
if (head === base && input.allowEmpty !== true) throw new Error("no local commits to publish; commit your changes in the repo first");
|
|
362
|
+
const nameStatus = (await runSandboxGit({
|
|
363
|
+
sandbox: input.sandbox,
|
|
364
|
+
args: [
|
|
365
|
+
"diff",
|
|
366
|
+
"--name-status",
|
|
367
|
+
base,
|
|
368
|
+
head
|
|
369
|
+
]
|
|
370
|
+
})).trim();
|
|
371
|
+
const upserts = [];
|
|
372
|
+
const deletions = [];
|
|
373
|
+
for (const line of nameStatus.split("\n").filter(Boolean)) {
|
|
374
|
+
const fields = line.split(" ");
|
|
375
|
+
const status = fields[0] ?? "";
|
|
376
|
+
if (status === "A" || status === "M" || status === "T") upserts.push(requireSafePath(fields[1]));
|
|
377
|
+
else if (status === "D") deletions.push(requireSafePath(fields[1]));
|
|
378
|
+
else if (status.startsWith("R") || status.startsWith("C")) {
|
|
379
|
+
if (status.startsWith("R")) deletions.push(requireSafePath(fields[1]));
|
|
380
|
+
upserts.push(requireSafePath(fields[2]));
|
|
381
|
+
} else throw new Error(`unsupported change status "${status}" in ${line}`);
|
|
382
|
+
}
|
|
383
|
+
const changedFiles = upserts.length + deletions.length;
|
|
384
|
+
if (changedFiles === 0 && input.allowEmpty !== true) throw new Error("the local commits contain no file changes");
|
|
385
|
+
if (changedFiles > maxChangedFiles) throw new Error(`too many changed files (${changedFiles} > ${maxChangedFiles})`);
|
|
386
|
+
const tree = [];
|
|
387
|
+
for (const path of upserts) {
|
|
388
|
+
const mode = (await runSandboxGit({
|
|
389
|
+
sandbox: input.sandbox,
|
|
390
|
+
args: [
|
|
391
|
+
"ls-tree",
|
|
392
|
+
head,
|
|
393
|
+
"--",
|
|
394
|
+
path
|
|
395
|
+
]
|
|
396
|
+
})).trim().split(" ")[0];
|
|
397
|
+
if (mode === void 0 || !allowedModes.has(mode)) throw new Error(`unsupported file mode ${mode || "(none)"} for ${path}`);
|
|
398
|
+
const content = await runSandboxGit({
|
|
399
|
+
sandbox: input.sandbox,
|
|
400
|
+
args: ["show", `${head}:${path}`]
|
|
401
|
+
});
|
|
402
|
+
if (Buffer.byteLength(content, "utf8") > maxFileBytes) throw new Error(`${path} exceeds the ${maxFileBytes} byte publication limit`);
|
|
403
|
+
tree.push({
|
|
404
|
+
path,
|
|
405
|
+
mode,
|
|
406
|
+
type: "blob",
|
|
407
|
+
content
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
for (const path of deletions) tree.push({
|
|
411
|
+
path,
|
|
412
|
+
mode: "100644",
|
|
413
|
+
type: "blob",
|
|
414
|
+
sha: null
|
|
415
|
+
});
|
|
416
|
+
return {
|
|
417
|
+
base,
|
|
418
|
+
tree,
|
|
419
|
+
changedFiles
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
function requireSafePath(path) {
|
|
423
|
+
if (path === void 0 || path === "" || !safePathPattern.test(path) || path.includes("..")) throw new Error(`refusing to publish unsafe path: ${path ?? "(missing)"}`);
|
|
424
|
+
return path;
|
|
425
|
+
}
|
|
426
|
+
//#endregion
|
|
427
|
+
export { GitHubCheckoutConflictError, GitHubPublicationApiError, checkoutGitHubRepository, createGitHubPublicationClient, factorySessionBranch, factoryTaskBranch, isSafeGitRef, readCommittedGitChange, runSandboxGit };
|
|
428
|
+
|
|
429
|
+
//# sourceMappingURL=github-publication.mjs.map
|