@vercel/factory 0.0.14 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +356 -0
- package/README.md +96 -2
- package/dist/agent-routes.d.mts +113 -0
- package/dist/agent-routes.mjs +91 -0
- package/dist/agent-routes.mjs.map +1 -0
- package/dist/api-contracts.d.mts +1768 -0
- package/dist/api-contracts.mjs +119 -0
- package/dist/api-contracts.mjs.map +1 -0
- package/dist/api-images.d.mts +30 -0
- package/dist/api-images.mjs +28 -0
- package/dist/api-images.mjs.map +1 -0
- package/dist/api-task-graph.mjs +57 -0
- package/dist/api-task-graph.mjs.map +1 -0
- package/dist/api.d.mts +111 -216
- package/dist/api.mjs +1063 -99
- package/dist/api.mjs.map +1 -1
- package/dist/approval-access.d.mts +39 -0
- package/dist/approval-access.mjs +62 -0
- package/dist/approval-access.mjs.map +1 -0
- package/dist/approval-contracts.d.mts +698 -0
- package/dist/approval-contracts.mjs +27 -0
- package/dist/approval-contracts.mjs.map +1 -0
- package/dist/approval.d.mts +49 -0
- package/dist/approval.mjs +39 -0
- package/dist/approval.mjs.map +1 -0
- package/dist/blob/artifacts.d.mts +37 -0
- package/dist/blob/artifacts.mjs +45 -0
- package/dist/blob/artifacts.mjs.map +1 -0
- package/dist/blob/index.d.mts +84 -12
- package/dist/blob/index.mjs +179 -45
- package/dist/blob/index.mjs.map +1 -1
- package/dist/budget.d.mts +115 -0
- package/dist/budget.mjs +147 -0
- package/dist/budget.mjs.map +1 -0
- package/dist/budgets.d.mts +4 -0
- package/dist/budgets.mjs +4 -0
- package/dist/build-factory.d.mts +7 -4
- package/dist/build-factory.mjs +2 -1
- package/dist/build-factory.mjs.map +1 -1
- package/dist/change-verification/brief.d.mts +9 -0
- package/dist/change-verification/brief.mjs +13 -0
- package/dist/change-verification/brief.mjs.map +1 -0
- package/dist/change-verification/dispatch.d.mts +37 -0
- package/dist/change-verification/dispatch.mjs +83 -0
- package/dist/change-verification/dispatch.mjs.map +1 -0
- package/dist/change-verification/eve-tool.d.mts +61 -0
- package/dist/change-verification/eve-tool.mjs +89 -0
- package/dist/change-verification/eve-tool.mjs.map +1 -0
- package/dist/change-verification/result.mjs +130 -0
- package/dist/change-verification/result.mjs.map +1 -0
- package/dist/changes/eve-record-change.d.mts +56 -0
- package/dist/changes/eve-record-change.mjs +131 -0
- package/dist/changes/eve-record-change.mjs.map +1 -0
- package/dist/changes/presentation.d.mts +14 -0
- package/dist/changes.d.mts +24 -0
- package/dist/changes.mjs +29 -0
- package/dist/changes.mjs.map +1 -0
- package/dist/client-events.d.mts +25 -0
- package/dist/client-events.mjs +45 -0
- package/dist/client-events.mjs.map +1 -0
- package/dist/client-stream.d.mts +28 -0
- package/dist/client-stream.mjs +210 -0
- package/dist/client-stream.mjs.map +1 -0
- package/dist/client-transcript.d.mts +41 -0
- package/dist/client-transcript.mjs +233 -0
- package/dist/client-transcript.mjs.map +1 -0
- package/dist/client.d.mts +343 -0
- package/dist/client.mjs +366 -0
- package/dist/client.mjs.map +1 -0
- package/dist/code-review/contracts.d.mts +27 -0
- package/dist/code-review/eve-post-review.d.mts +70 -0
- package/dist/code-review/eve-post-review.mjs +195 -0
- package/dist/code-review/eve-post-review.mjs.map +1 -0
- package/dist/code-review/eve-review-comments.d.mts +75 -0
- package/dist/code-review/eve-review-comments.mjs +193 -0
- package/dist/code-review/eve-review-comments.mjs.map +1 -0
- package/dist/code-review/github-contracts.d.mts +10 -0
- package/dist/code-review/github-reporter.d.mts +46 -0
- package/dist/code-review/github-reporter.mjs +262 -0
- package/dist/code-review/github-reporter.mjs.map +1 -0
- package/dist/code-review/preparation.d.mts +34 -0
- package/dist/code-review/preparation.mjs +23 -0
- package/dist/code-review/preparation.mjs.map +1 -0
- package/dist/code-review/stall.d.mts +17 -0
- package/dist/code-review/stall.mjs +30 -0
- package/dist/code-review/stall.mjs.map +1 -0
- package/dist/code-review.d.mts +7 -0
- package/dist/code-review.mjs +5 -0
- package/dist/communication.d.mts +9 -0
- package/dist/communication.mjs +9 -0
- package/dist/connectors/github.d.mts +26 -0
- package/dist/connectors/github.mjs +55 -0
- package/dist/connectors/github.mjs.map +1 -0
- package/dist/connectors/index.d.mts +35 -3
- package/dist/connectors/index.mjs +3 -52
- package/dist/connectors/index.mjs.map +1 -1
- package/dist/connectors/outbox.d.mts +34 -0
- package/dist/connectors/outbox.mjs +50 -0
- package/dist/connectors/outbox.mjs.map +1 -0
- package/dist/connectors/slack-approval-blocks.mjs +136 -0
- package/dist/connectors/slack-approval-blocks.mjs.map +1 -0
- package/dist/connectors/slack-approvals.d.mts +29 -0
- package/dist/connectors/slack-approvals.mjs +346 -0
- package/dist/connectors/slack-approvals.mjs.map +1 -0
- package/dist/connectors/slack.d.mts +35 -52
- package/dist/connectors/slack.mjs +13 -85
- package/dist/connectors/slack.mjs.map +1 -1
- package/dist/deepsec/eve-tool.d.mts +110 -0
- package/dist/deepsec/eve-tool.mjs +166 -0
- package/dist/deepsec/eve-tool.mjs.map +1 -0
- package/dist/deepsec/finding.d.mts +84 -0
- package/dist/deepsec/finding.mjs +56 -0
- package/dist/deepsec/finding.mjs.map +1 -0
- package/dist/deepsec.d.mts +3 -0
- package/dist/delivery-metrics/metrics.d.mts +93 -0
- package/dist/delivery-metrics/metrics.mjs +200 -0
- package/dist/delivery-metrics/metrics.mjs.map +1 -0
- package/dist/delivery-metrics.d.mts +2 -0
- package/dist/delivery-metrics.mjs +2 -0
- package/dist/dispatch.d.mts +152 -0
- package/dist/dispatch.mjs +199 -0
- package/dist/dispatch.mjs.map +1 -0
- package/dist/errors.d.mts +15 -0
- package/dist/errors.mjs +38 -0
- package/dist/errors.mjs.map +1 -0
- package/dist/eve/index.d.mts +209 -1277
- package/dist/eve/index.mjs +312 -1073
- package/dist/eve/index.mjs.map +1 -1
- package/dist/eve/invoke.d.mts +144 -0
- package/dist/eve/invoke.mjs +254 -0
- package/dist/eve/invoke.mjs.map +1 -0
- package/dist/eve/session-client.d.mts +186 -0
- package/dist/eve/session-client.mjs +245 -0
- package/dist/eve/session-client.mjs.map +1 -0
- package/dist/eve/task-execution.d.mts +380 -0
- package/dist/eve/task-execution.mjs +73 -0
- package/dist/eve/task-execution.mjs.map +1 -0
- package/dist/eve/task-session.d.mts +129 -0
- package/dist/eve/task-session.mjs +245 -0
- package/dist/eve/task-session.mjs.map +1 -0
- package/dist/eve/transcript.d.mts +37 -0
- package/dist/eve/transcript.mjs +69 -0
- package/dist/eve/transcript.mjs.map +1 -0
- package/dist/execution-public.d.mts +8 -0
- package/dist/execution-public.mjs +7 -0
- package/dist/execution.d.mts +183 -0
- package/dist/execution.mjs +223 -0
- package/dist/execution.mjs.map +1 -0
- package/dist/finding-remediation/admission.d.mts +53 -0
- package/dist/finding-remediation/admission.mjs +90 -0
- package/dist/finding-remediation/admission.mjs.map +1 -0
- package/dist/finding-remediation/brief.d.mts +14 -0
- package/dist/finding-remediation/brief.mjs +25 -0
- package/dist/finding-remediation/brief.mjs.map +1 -0
- package/dist/finding-remediation/eve-tool.d.mts +29 -0
- package/dist/finding-remediation/eve-tool.mjs +34 -0
- package/dist/finding-remediation/eve-tool.mjs.map +1 -0
- package/dist/findings/fingerprint.d.mts +14 -0
- package/dist/findings/fingerprint.mjs +28 -0
- package/dist/findings/fingerprint.mjs.map +1 -0
- package/dist/findings.d.mts +7 -0
- package/dist/findings.mjs +6 -0
- package/dist/github-app.d.mts +54 -0
- package/dist/github-app.mjs +121 -0
- package/dist/github-app.mjs.map +1 -0
- package/dist/github-publication.d.mts +199 -0
- package/dist/github-publication.mjs +442 -0
- package/dist/github-publication.mjs.map +1 -0
- package/dist/github-transfer.d.mts +81 -0
- package/dist/github-transfer.mjs +273 -0
- package/dist/github-transfer.mjs.map +1 -0
- package/dist/github.d.mts +446 -2
- package/dist/github.mjs +357 -56
- package/dist/github.mjs.map +1 -1
- package/dist/image-input.d.mts +51 -0
- package/dist/image-input.mjs +63 -0
- package/dist/image-input.mjs.map +1 -0
- package/dist/inbox-activity.d.mts +53 -0
- package/dist/inbox-activity.mjs +41 -0
- package/dist/inbox-activity.mjs.map +1 -0
- package/dist/index.d.mts +16 -484
- package/dist/index.mjs +15 -522
- package/dist/intake-contracts.d.mts +55 -0
- package/dist/intake-contracts.mjs +33 -0
- package/dist/intake-contracts.mjs.map +1 -0
- package/dist/integrations/deepsec.d.mts +5 -0
- package/dist/integrations/deepsec.mjs +3 -0
- package/dist/integrations/github.d.mts +11 -0
- package/dist/integrations/github.mjs +9 -0
- package/dist/integrations/slack.d.mts +5 -0
- package/dist/integrations/slack.mjs +5 -0
- package/dist/integrations/vercel.d.mts +5 -0
- package/dist/integrations/vercel.mjs +4 -0
- package/dist/merge-resolution/contracts.d.mts +17 -0
- package/dist/merge-resolution/contracts.mjs +19 -0
- package/dist/merge-resolution/contracts.mjs.map +1 -0
- package/dist/merge-resolution/eve-tools.d.mts +47 -0
- package/dist/merge-resolution/eve-tools.mjs +122 -0
- package/dist/merge-resolution/eve-tools.mjs.map +1 -0
- package/dist/model-settings.d.mts +41 -0
- package/dist/model-settings.mjs +35 -0
- package/dist/model-settings.mjs.map +1 -0
- package/dist/multi-repository-changes/coordination.d.mts +49 -0
- package/dist/multi-repository-changes/coordination.mjs +115 -0
- package/dist/multi-repository-changes/coordination.mjs.map +1 -0
- package/dist/planning/cancellation.mjs +82 -0
- package/dist/planning/cancellation.mjs.map +1 -0
- package/dist/planning/configuration.d.mts +23 -0
- package/dist/planning/configuration.mjs +56 -0
- package/dist/planning/configuration.mjs.map +1 -0
- package/dist/planning/contracts.d.mts +136 -0
- package/dist/planning/contracts.mjs +42 -0
- package/dist/planning/contracts.mjs.map +1 -0
- package/dist/planning/dependencies.mjs +44 -0
- package/dist/planning/dependencies.mjs.map +1 -0
- package/dist/planning/effects.mjs +122 -0
- package/dist/planning/effects.mjs.map +1 -0
- package/dist/planning/reconcile.mjs +279 -0
- package/dist/planning/reconcile.mjs.map +1 -0
- package/dist/planning/runtime.d.mts +27 -0
- package/dist/planning/runtime.mjs +25 -0
- package/dist/planning/runtime.mjs.map +1 -0
- package/dist/planning/state.mjs +92 -0
- package/dist/planning/state.mjs.map +1 -0
- package/dist/planning/turns.mjs +262 -0
- package/dist/planning/turns.mjs.map +1 -0
- package/dist/planning/validation.mjs +106 -0
- package/dist/planning/validation.mjs.map +1 -0
- package/dist/postgres/index.d.mts +48 -1
- package/dist/postgres/index.mjs +45 -3
- package/dist/postgres/index.mjs.map +1 -1
- package/dist/presets/software-development/approval.d.mts +14 -0
- package/dist/presets/software-development/approval.mjs +21 -0
- package/dist/presets/software-development/approval.mjs.map +1 -0
- package/dist/presets/software-development/deepsec-brief.d.mts +8 -0
- package/dist/presets/software-development/deepsec-brief.mjs +14 -0
- package/dist/presets/software-development/deepsec-brief.mjs.map +1 -0
- package/dist/presets/software-development/dispatch.d.mts +56 -0
- package/dist/presets/software-development/dispatch.mjs +67 -0
- package/dist/presets/software-development/dispatch.mjs.map +1 -0
- package/dist/presets/software-development/eve-delegation-policy.d.mts +7 -0
- package/dist/presets/software-development/eve-delegation-policy.mjs +34 -0
- package/dist/presets/software-development/eve-delegation-policy.mjs.map +1 -0
- package/dist/presets/software-development/eve.d.mts +18 -0
- package/dist/presets/software-development/eve.mjs +19 -0
- package/dist/presets/software-development/eve.mjs.map +1 -0
- package/dist/presets/software-development/finish-task-policy.d.mts +7 -0
- package/dist/presets/software-development/finish-task-policy.mjs +9 -0
- package/dist/presets/software-development/finish-task-policy.mjs.map +1 -0
- package/dist/presets/software-development/recovery.d.mts +32 -0
- package/dist/presets/software-development/recovery.mjs +120 -0
- package/dist/presets/software-development/recovery.mjs.map +1 -0
- package/dist/presets/software-development/task-communication.d.mts +24 -0
- package/dist/presets/software-development/task-communication.mjs +157 -0
- package/dist/presets/software-development/task-communication.mjs.map +1 -0
- package/dist/presets/software-development.d.mts +10 -0
- package/dist/presets/software-development.mjs +9 -0
- package/dist/pull-requests/contracts.d.mts +72 -0
- package/dist/pull-requests/eve-fetch.d.mts +57 -0
- package/dist/pull-requests/eve-fetch.mjs +151 -0
- package/dist/pull-requests/eve-fetch.mjs.map +1 -0
- package/dist/pull-requests/github-label-manager.d.mts +27 -0
- package/dist/pull-requests/github-label-manager.mjs +40 -0
- package/dist/pull-requests/github-label-manager.mjs.map +1 -0
- package/dist/pull-requests/github-publisher.d.mts +67 -0
- package/dist/pull-requests/github-publisher.mjs +405 -0
- package/dist/pull-requests/github-publisher.mjs.map +1 -0
- package/dist/pull-requests.d.mts +6 -0
- package/dist/pull-requests.mjs +4 -0
- package/dist/receipts.d.mts +4 -0
- package/dist/receipts.mjs +3 -0
- package/dist/repositories.d.mts +18 -0
- package/dist/repositories.mjs +33 -0
- package/dist/repositories.mjs.map +1 -0
- package/dist/sandbox/command.d.mts +18 -0
- package/dist/sandbox/execution-abort.d.mts +16 -0
- package/dist/sandbox/execution-abort.mjs +49 -0
- package/dist/sandbox/execution-abort.mjs.map +1 -0
- package/dist/sandbox/execution-environment.d.mts +25 -0
- package/dist/sandbox/execution-run-ledger.d.mts +115 -0
- package/dist/sandbox/execution-run-ledger.mjs +209 -0
- package/dist/sandbox/execution-run-ledger.mjs.map +1 -0
- package/dist/sandbox/execution.d.mts +54 -0
- package/dist/sandbox/execution.mjs +228 -0
- package/dist/sandbox/execution.mjs.map +1 -0
- package/dist/sandbox/harness-runner.d.mts +79 -0
- package/dist/sandbox/harness-runner.mjs +162 -0
- package/dist/sandbox/harness-runner.mjs.map +1 -0
- package/dist/sandbox/index.d.mts +10 -0
- package/dist/sandbox/index.mjs +7 -0
- package/dist/sandbox/task-environment.d.mts +50 -0
- package/dist/sandbox/task-environment.mjs +140 -0
- package/dist/sandbox/task-environment.mjs.map +1 -0
- package/dist/sandbox/workspace.d.mts +29 -0
- package/dist/sandbox/workspace.mjs +28 -0
- package/dist/sandbox/workspace.mjs.map +1 -0
- package/dist/schema/agent-route.d.mts +40 -0
- package/dist/schema/agent-route.mjs +33 -0
- package/dist/schema/agent-route.mjs.map +1 -0
- package/dist/schema/answer.d.mts +23 -0
- package/dist/schema/answer.mjs +21 -0
- package/dist/schema/answer.mjs.map +1 -0
- package/dist/schema/budget.d.mts +38 -0
- package/dist/schema/budget.mjs +30 -0
- package/dist/schema/budget.mjs.map +1 -0
- package/dist/schema/catalog.mjs +72 -0
- package/dist/schema/catalog.mjs.map +1 -0
- package/dist/schema/change.d.mts +117 -0
- package/dist/schema/change.mjs +68 -0
- package/dist/schema/change.mjs.map +1 -0
- package/dist/schema/common.d.mts +33 -0
- package/dist/{id-BLIkCVue.mjs → schema/common.mjs} +7 -16
- package/dist/schema/common.mjs.map +1 -0
- package/dist/schema/communication.d.mts +52 -0
- package/dist/{communication-Kd9nU5RP.mjs → schema/communication.mjs} +8 -3
- package/dist/schema/communication.mjs.map +1 -0
- package/dist/schema/execution.d.mts +101 -0
- package/dist/schema/execution.mjs +86 -0
- package/dist/schema/execution.mjs.map +1 -0
- package/dist/schema/factory-config.d.mts +122 -0
- package/dist/schema/factory-config.mjs +90 -0
- package/dist/schema/factory-config.mjs.map +1 -0
- package/dist/schema/finding.d.mts +125 -0
- package/dist/schema/finding.mjs +67 -0
- package/dist/schema/finding.mjs.map +1 -0
- package/dist/schema/id.d.mts +43 -0
- package/dist/schema/id.mjs +32 -0
- package/dist/schema/id.mjs.map +1 -0
- package/dist/schema/outbox.d.mts +240 -0
- package/dist/schema/outbox.mjs +53 -0
- package/dist/schema/outbox.mjs.map +1 -0
- package/dist/schema/question-route.mjs +16 -0
- package/dist/schema/question-route.mjs.map +1 -0
- package/dist/schema/receipt.d.mts +81 -0
- package/dist/schema/receipt.mjs +94 -0
- package/dist/schema/receipt.mjs.map +1 -0
- package/dist/schema/repository.d.mts +30 -0
- package/dist/schema/repository.mjs +29 -0
- package/dist/schema/repository.mjs.map +1 -0
- package/dist/schema/session.d.mts +136 -0
- package/dist/schema/session.mjs +54 -0
- package/dist/schema/session.mjs.map +1 -0
- package/dist/schema/signal.d.mts +105 -0
- package/dist/schema/signal.mjs +81 -0
- package/dist/schema/signal.mjs.map +1 -0
- package/dist/schema/slack-pr-notifications.d.mts +12 -0
- package/dist/schema/slack-pr-notifications.mjs +11 -0
- package/dist/schema/slack-pr-notifications.mjs.map +1 -0
- package/dist/schema/stored-session.mjs +10 -0
- package/dist/schema/stored-session.mjs.map +1 -0
- package/dist/schema/stored-task.mjs +20 -0
- package/dist/schema/stored-task.mjs.map +1 -0
- package/dist/schema/task-effect.d.mts +39 -0
- package/dist/schema/task-effect.mjs +29 -0
- package/dist/schema/task-effect.mjs.map +1 -0
- package/dist/schema/task-graph.d.mts +3173 -0
- package/dist/schema/task-graph.mjs +97 -0
- package/dist/schema/task-graph.mjs.map +1 -0
- package/dist/schema/task-message.d.mts +254 -0
- package/dist/schema/task-message.mjs +189 -0
- package/dist/schema/task-message.mjs.map +1 -0
- package/dist/schema/task.d.mts +273 -0
- package/dist/schema/task.mjs +200 -0
- package/dist/schema/task.mjs.map +1 -0
- package/dist/schema/transcript.d.mts +176 -0
- package/dist/schema/transcript.mjs +87 -0
- package/dist/schema/transcript.mjs.map +1 -0
- package/dist/schema/transitions.d.mts +50 -0
- package/dist/schema/transitions.mjs +303 -0
- package/dist/schema/transitions.mjs.map +1 -0
- package/dist/schema/work.d.mts +150 -0
- package/dist/schema/work.mjs +102 -0
- package/dist/schema/work.mjs.map +1 -0
- package/dist/session-previews.d.mts +76 -0
- package/dist/session-previews.mjs +55 -0
- package/dist/session-previews.mjs.map +1 -0
- package/dist/session-review.d.mts +120 -0
- package/dist/session-review.mjs +79 -0
- package/dist/session-review.mjs.map +1 -0
- package/dist/signal-triage.d.mts +20 -0
- package/dist/signal-triage.mjs +85 -0
- package/dist/signal-triage.mjs.map +1 -0
- package/dist/signals.d.mts +20 -0
- package/dist/signals.mjs +19 -0
- package/dist/signals.mjs.map +1 -0
- package/dist/stall.d.mts +41 -0
- package/dist/stall.mjs +83 -0
- package/dist/stall.mjs.map +1 -0
- package/dist/storage.d.mts +4 -0
- package/dist/storage.mjs +4 -0
- package/dist/store/driver.d.mts +65 -0
- package/dist/store/driver.mjs +42 -0
- package/dist/store/driver.mjs.map +1 -0
- package/dist/store/engine.d.mts +683 -0
- package/dist/store/engine.mjs +2309 -0
- package/dist/store/engine.mjs.map +1 -0
- package/dist/store/memory.d.mts +24 -0
- package/dist/store/memory.mjs +69 -0
- package/dist/store/memory.mjs.map +1 -0
- package/dist/store/slack-pr-notifications.d.mts +44 -0
- package/dist/store/slack-pr-notifications.mjs +121 -0
- package/dist/store/slack-pr-notifications.mjs.map +1 -0
- package/dist/store/task-effects.d.mts +38 -0
- package/dist/store/task-effects.mjs +118 -0
- package/dist/store/task-effects.mjs.map +1 -0
- package/dist/store/task-graphs.d.mts +60 -0
- package/dist/store/task-graphs.mjs +212 -0
- package/dist/store/task-graphs.mjs.map +1 -0
- package/dist/store/task-messages.d.mts +136 -0
- package/dist/store/task-messages.mjs +475 -0
- package/dist/store/task-messages.mjs.map +1 -0
- package/dist/store/task-work.d.mts +180 -0
- package/dist/store/task-work.mjs +137 -0
- package/dist/store/task-work.mjs.map +1 -0
- package/dist/store/work-notifications.d.mts +19 -0
- package/dist/store/work-notifications.mjs +48 -0
- package/dist/store/work-notifications.mjs.map +1 -0
- package/dist/sweep.d.mts +79 -0
- package/dist/sweep.mjs +171 -0
- package/dist/sweep.mjs.map +1 -0
- package/dist/task-communication.d.mts +35 -0
- package/dist/task-communication.mjs +47 -0
- package/dist/task-communication.mjs.map +1 -0
- package/dist/task-graph-view.d.mts +267 -0
- package/dist/task-graph-view.mjs +17 -0
- package/dist/task-graph-view.mjs.map +1 -0
- package/dist/task-message-processing.d.mts +60 -0
- package/dist/task-message-processing.mjs +200 -0
- package/dist/task-message-processing.mjs.map +1 -0
- package/dist/task-protocols.d.mts +80 -0
- package/dist/task-protocols.mjs +47 -0
- package/dist/task-protocols.mjs.map +1 -0
- package/dist/tasks.d.mts +17 -0
- package/dist/tasks.mjs +17 -0
- package/dist/vercel-git.d.mts +53 -0
- package/dist/vercel-git.mjs +344 -0
- package/dist/vercel-git.mjs.map +1 -0
- package/dist/vercel-github-api.d.mts +103 -0
- package/dist/vercel-github-api.mjs +363 -0
- package/dist/vercel-github-api.mjs.map +1 -0
- package/dist/vercel.d.mts +34 -2
- package/dist/vercel.mjs +49 -3
- package/dist/vercel.mjs.map +1 -1
- package/dist/work-triage/eve-tool.d.mts +29 -0
- package/dist/work-triage/eve-tool.mjs +32 -0
- package/dist/work-triage/eve-tool.mjs.map +1 -0
- package/dist/work-triage/find-existing-work.d.mts +32 -0
- package/dist/work-triage/find-existing-work.mjs +31 -0
- package/dist/work-triage/find-existing-work.mjs.map +1 -0
- package/dist/work-triage/github.d.mts +15 -0
- package/dist/work-triage/github.mjs +14 -0
- package/dist/work-triage/github.mjs.map +1 -0
- package/dist/work-triage.d.mts +4 -0
- package/dist/work-triage.mjs +3 -0
- package/dist/workflows.d.mts +146 -0
- package/dist/workflows.mjs +139 -0
- package/dist/workflows.mjs.map +1 -0
- package/dist/workspace-diff-assembly.d.mts +33 -0
- package/dist/workspace-diff-assembly.mjs +95 -0
- package/dist/workspace-diff-assembly.mjs.map +1 -0
- package/dist/workspace-diff.d.mts +90 -0
- package/dist/workspace-diff.mjs +61 -0
- package/dist/workspace-diff.mjs.map +1 -0
- package/dist/workspace-files-git.d.mts +15 -0
- package/dist/workspace-files-git.mjs +61 -0
- package/dist/workspace-files-git.mjs.map +1 -0
- package/dist/workspace-files.d.mts +107 -0
- package/dist/workspace-files.mjs +74 -0
- package/dist/workspace-files.mjs.map +1 -0
- package/dist/workspace-snapshot.d.mts +26 -0
- package/dist/workspace-snapshot.mjs +80 -0
- package/dist/workspace-snapshot.mjs.map +1 -0
- package/docs/getting-started.md +104 -0
- package/docs/index.md +100 -0
- package/docs/recipes/cancellation.md +215 -0
- package/docs/recipes/custom-workflow.md +153 -0
- package/docs/recipes/dependent-tasks.md +207 -0
- package/docs/recipes/eve-agent.md +277 -0
- package/docs/recipes/human-input.md +204 -0
- package/docs/recipes/persistence-recovery.md +268 -0
- package/docs/recipes/retry-recovery.md +241 -0
- package/docs/recipes/task-messaging.md +215 -0
- package/docs/recipes/typed-eve-result.md +161 -0
- package/docs/runtime-integration.md +137 -0
- package/package.json +142 -46
- package/dist/approval-JX2Px9IC.mjs +0 -132
- package/dist/approval-JX2Px9IC.mjs.map +0 -1
- package/dist/budget-DzSiIA4t.mjs +0 -42
- package/dist/budget-DzSiIA4t.mjs.map +0 -1
- package/dist/change-D2U6v7Ek.mjs +0 -554
- package/dist/change-D2U6v7Ek.mjs.map +0 -1
- package/dist/communication-Kd9nU5RP.mjs.map +0 -1
- package/dist/coordination-Cq08hb1l.mjs +0 -76
- package/dist/coordination-Cq08hb1l.mjs.map +0 -1
- package/dist/dispatch-BaZS3PT8.d.mts +0 -76
- package/dist/driver-BC0Mt5KG.d.mts +0 -34
- package/dist/driver-Bbd25rNM.mjs +0 -23
- package/dist/driver-Bbd25rNM.mjs.map +0 -1
- package/dist/engine-DFHU2Pe-.d.mts +0 -781
- package/dist/engine-WaUM2cGA.mjs +0 -1068
- package/dist/engine-WaUM2cGA.mjs.map +0 -1
- package/dist/factory-config-BoRXOw43.mjs +0 -50
- package/dist/factory-config-BoRXOw43.mjs.map +0 -1
- package/dist/factory-config-D2yU3G0c.d.mts +0 -58
- package/dist/github-C5HNBN6p.d.mts +0 -279
- package/dist/id-BLIkCVue.mjs.map +0 -1
- package/dist/index-Bw6hggoH.d.mts +0 -40
- package/dist/index.mjs.map +0 -1
- package/dist/task-CcOyOJ3k.mjs +0 -154
- package/dist/task-CcOyOJ3k.mjs.map +0 -1
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/workspace-diff.d.ts
|
|
3
|
+
/** Validates one changed file in a bounded workspace comparison. */
|
|
4
|
+
declare const workspaceDiffFileSchema: z.ZodObject<{
|
|
5
|
+
path: z.ZodString;
|
|
6
|
+
previousPath: z.ZodOptional<z.ZodString>;
|
|
7
|
+
status: z.ZodEnum<{
|
|
8
|
+
added: "added";
|
|
9
|
+
deleted: "deleted";
|
|
10
|
+
modified: "modified";
|
|
11
|
+
renamed: "renamed";
|
|
12
|
+
}>;
|
|
13
|
+
oldMode: z.ZodNullable<z.ZodString>;
|
|
14
|
+
newMode: z.ZodNullable<z.ZodString>;
|
|
15
|
+
additions: z.ZodNullable<z.ZodNumber>;
|
|
16
|
+
deletions: z.ZodNullable<z.ZodNumber>;
|
|
17
|
+
patch: z.ZodString;
|
|
18
|
+
binary: z.ZodBoolean;
|
|
19
|
+
omitted: z.ZodBoolean;
|
|
20
|
+
}, z.core.$strict>;
|
|
21
|
+
/** One changed file in a bounded workspace comparison. */
|
|
22
|
+
type WorkspaceDiffFile = Readonly<z.infer<typeof workspaceDiffFileSchema>>;
|
|
23
|
+
/** Validates either a ready comparison with pinned commits or an unavailable response with a reason. */
|
|
24
|
+
declare const workspaceDiffSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
25
|
+
state: z.ZodLiteral<"ready">;
|
|
26
|
+
executionId: z.ZodString;
|
|
27
|
+
reason: z.ZodOptional<z.ZodNever>;
|
|
28
|
+
base: z.ZodObject<{
|
|
29
|
+
sha: z.ZodString;
|
|
30
|
+
}, z.core.$strict>;
|
|
31
|
+
head: z.ZodObject<{
|
|
32
|
+
sha: z.ZodString;
|
|
33
|
+
}, z.core.$strict>;
|
|
34
|
+
truncated: z.ZodBoolean;
|
|
35
|
+
files: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
36
|
+
path: z.ZodString;
|
|
37
|
+
previousPath: z.ZodOptional<z.ZodString>;
|
|
38
|
+
status: z.ZodEnum<{
|
|
39
|
+
added: "added";
|
|
40
|
+
deleted: "deleted";
|
|
41
|
+
modified: "modified";
|
|
42
|
+
renamed: "renamed";
|
|
43
|
+
}>;
|
|
44
|
+
oldMode: z.ZodNullable<z.ZodString>;
|
|
45
|
+
newMode: z.ZodNullable<z.ZodString>;
|
|
46
|
+
additions: z.ZodNullable<z.ZodNumber>;
|
|
47
|
+
deletions: z.ZodNullable<z.ZodNumber>;
|
|
48
|
+
patch: z.ZodString;
|
|
49
|
+
binary: z.ZodBoolean;
|
|
50
|
+
omitted: z.ZodBoolean;
|
|
51
|
+
}, z.core.$strict>>>;
|
|
52
|
+
capturedAt: z.ZodISODateTime;
|
|
53
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
54
|
+
state: z.ZodLiteral<"unavailable">;
|
|
55
|
+
executionId: z.ZodNullable<z.ZodString>;
|
|
56
|
+
reason: z.ZodString;
|
|
57
|
+
base: z.ZodNull;
|
|
58
|
+
head: z.ZodNull;
|
|
59
|
+
truncated: z.ZodLiteral<false>;
|
|
60
|
+
files: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
61
|
+
path: z.ZodString;
|
|
62
|
+
previousPath: z.ZodOptional<z.ZodString>;
|
|
63
|
+
status: z.ZodEnum<{
|
|
64
|
+
added: "added";
|
|
65
|
+
deleted: "deleted";
|
|
66
|
+
modified: "modified";
|
|
67
|
+
renamed: "renamed";
|
|
68
|
+
}>;
|
|
69
|
+
oldMode: z.ZodNullable<z.ZodString>;
|
|
70
|
+
newMode: z.ZodNullable<z.ZodString>;
|
|
71
|
+
additions: z.ZodNullable<z.ZodNumber>;
|
|
72
|
+
deletions: z.ZodNullable<z.ZodNumber>;
|
|
73
|
+
patch: z.ZodString;
|
|
74
|
+
binary: z.ZodBoolean;
|
|
75
|
+
omitted: z.ZodBoolean;
|
|
76
|
+
}, z.core.$strict>>>;
|
|
77
|
+
capturedAt: z.ZodISODateTime;
|
|
78
|
+
}, z.core.$strict>], "state">;
|
|
79
|
+
/** A ready workspace comparison or an unavailable response carrying its reason. */
|
|
80
|
+
type WorkspaceDiff = Readonly<z.infer<typeof workspaceDiffSchema>>;
|
|
81
|
+
/** Identifies an execution and the reason its workspace comparison is unavailable. */
|
|
82
|
+
interface UnavailableWorkspaceDiffInput {
|
|
83
|
+
readonly executionId: string | null;
|
|
84
|
+
readonly reason: string;
|
|
85
|
+
}
|
|
86
|
+
/** Creates an unavailable workspace-diff response with a stable empty projection. */
|
|
87
|
+
declare function unavailableWorkspaceDiff(input: UnavailableWorkspaceDiffInput): WorkspaceDiff;
|
|
88
|
+
//#endregion
|
|
89
|
+
export { UnavailableWorkspaceDiffInput, WorkspaceDiff, WorkspaceDiffFile, unavailableWorkspaceDiff, workspaceDiffFileSchema, workspaceDiffSchema };
|
|
90
|
+
//# sourceMappingURL=workspace-diff.d.mts.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/workspace-diff.ts
|
|
3
|
+
const gitCommitSchema = z.strictObject({ sha: z.string().regex(/^[a-f0-9]{40,64}$/u).describe("Pinned commit used for every file in this response.") });
|
|
4
|
+
/** Validates one changed file in a bounded workspace comparison. */
|
|
5
|
+
const workspaceDiffFileSchema = z.strictObject({
|
|
6
|
+
path: z.string().describe("Repository-relative current path, or deleted path."),
|
|
7
|
+
previousPath: z.string().optional().describe("Original path of an exact-content rename."),
|
|
8
|
+
status: z.enum([
|
|
9
|
+
"added",
|
|
10
|
+
"deleted",
|
|
11
|
+
"modified",
|
|
12
|
+
"renamed"
|
|
13
|
+
]).describe("Change between the pinned base and current branch HEAD."),
|
|
14
|
+
oldMode: z.string().nullable().describe("Git file mode at the base, or null for additions."),
|
|
15
|
+
newMode: z.string().nullable().describe("Git file mode at HEAD, or null for deletions."),
|
|
16
|
+
additions: z.number().int().nonnegative().nullable().describe("Added lines; null when content is omitted."),
|
|
17
|
+
deletions: z.number().int().nonnegative().nullable().describe("Deleted lines; null when content is omitted."),
|
|
18
|
+
patch: z.string().max(1e5).describe("Unified patch; empty for binary, oversized, or mode-only changes."),
|
|
19
|
+
binary: z.boolean().describe("Content is binary or not valid UTF-8."),
|
|
20
|
+
omitted: z.boolean().describe("Content could not be displayed within inspection limits.")
|
|
21
|
+
});
|
|
22
|
+
const workspaceDiffCommon = { capturedAt: z.iso.datetime().describe("Time the branch inspection began; all returned commit SHAs are pinned.") };
|
|
23
|
+
const readyWorkspaceDiffSchema = z.strictObject({
|
|
24
|
+
...workspaceDiffCommon,
|
|
25
|
+
state: z.literal("ready").describe("The workspace comparison completed."),
|
|
26
|
+
executionId: z.string().min(1).describe("Execution whose current branch was inspected."),
|
|
27
|
+
reason: z.never().optional().describe("Ready comparisons have no unavailability reason."),
|
|
28
|
+
base: gitCommitSchema.describe("Pinned comparison base."),
|
|
29
|
+
head: gitCommitSchema.describe("Pinned current branch HEAD."),
|
|
30
|
+
truncated: z.boolean().describe("Some files or patches were omitted because of response limits."),
|
|
31
|
+
files: z.array(workspaceDiffFileSchema).max(200).describe("Bounded changed-file list; untracked files are excluded.").readonly()
|
|
32
|
+
});
|
|
33
|
+
const unavailableWorkspaceDiffSchema = z.strictObject({
|
|
34
|
+
...workspaceDiffCommon,
|
|
35
|
+
state: z.literal("unavailable").describe("The workspace comparison could not be produced."),
|
|
36
|
+
executionId: z.string().min(1).nullable().describe("Execution that could not be inspected, or null when no execution exists."),
|
|
37
|
+
reason: z.string().min(1).describe("Why the workspace comparison could not be read."),
|
|
38
|
+
base: z.null().describe("No comparison base is available."),
|
|
39
|
+
head: z.null().describe("No workspace HEAD is available."),
|
|
40
|
+
truncated: z.literal(false).describe("Unavailable comparisons never contain partial results."),
|
|
41
|
+
files: z.array(workspaceDiffFileSchema).max(0).describe("Unavailable comparisons contain no changed files.").readonly()
|
|
42
|
+
});
|
|
43
|
+
/** Validates either a ready comparison with pinned commits or an unavailable response with a reason. */
|
|
44
|
+
const workspaceDiffSchema = z.discriminatedUnion("state", [readyWorkspaceDiffSchema, unavailableWorkspaceDiffSchema]);
|
|
45
|
+
/** Creates an unavailable workspace-diff response with a stable empty projection. */
|
|
46
|
+
function unavailableWorkspaceDiff(input) {
|
|
47
|
+
return {
|
|
48
|
+
executionId: input.executionId,
|
|
49
|
+
state: "unavailable",
|
|
50
|
+
reason: input.reason,
|
|
51
|
+
base: null,
|
|
52
|
+
head: null,
|
|
53
|
+
capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
54
|
+
truncated: false,
|
|
55
|
+
files: []
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
export { unavailableWorkspaceDiff, workspaceDiffFileSchema, workspaceDiffSchema };
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=workspace-diff.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-diff.mjs","names":[],"sources":["../src/workspace-diff.ts"],"sourcesContent":["import { z } from \"zod\";\n\nconst gitCommitSchema = z.strictObject({\n sha: z\n .string()\n .regex(/^[a-f0-9]{40,64}$/u)\n .describe(\"Pinned commit used for every file in this response.\"),\n});\n\n/** Validates one changed file in a bounded workspace comparison. */\nexport const workspaceDiffFileSchema = z.strictObject({\n path: z.string().describe(\"Repository-relative current path, or deleted path.\"),\n previousPath: z.string().optional().describe(\"Original path of an exact-content rename.\"),\n status: z\n .enum([\"added\", \"deleted\", \"modified\", \"renamed\"])\n .describe(\"Change between the pinned base and current branch HEAD.\"),\n oldMode: z.string().nullable().describe(\"Git file mode at the base, or null for additions.\"),\n newMode: z.string().nullable().describe(\"Git file mode at HEAD, or null for deletions.\"),\n additions: z\n .number()\n .int()\n .nonnegative()\n .nullable()\n .describe(\"Added lines; null when content is omitted.\"),\n deletions: z\n .number()\n .int()\n .nonnegative()\n .nullable()\n .describe(\"Deleted lines; null when content is omitted.\"),\n patch: z\n .string()\n .max(100_000)\n .describe(\"Unified patch; empty for binary, oversized, or mode-only changes.\"),\n binary: z.boolean().describe(\"Content is binary or not valid UTF-8.\"),\n omitted: z.boolean().describe(\"Content could not be displayed within inspection limits.\"),\n});\n\n/** One changed file in a bounded workspace comparison. */\nexport type WorkspaceDiffFile = Readonly<z.infer<typeof workspaceDiffFileSchema>>;\n\nconst workspaceDiffCommon = {\n capturedAt: z.iso\n .datetime()\n .describe(\"Time the branch inspection began; all returned commit SHAs are pinned.\"),\n};\n\nconst readyWorkspaceDiffSchema = z.strictObject({\n ...workspaceDiffCommon,\n state: z.literal(\"ready\").describe(\"The workspace comparison completed.\"),\n executionId: z.string().min(1).describe(\"Execution whose current branch was inspected.\"),\n reason: z.never().optional().describe(\"Ready comparisons have no unavailability reason.\"),\n base: gitCommitSchema.describe(\"Pinned comparison base.\"),\n head: gitCommitSchema.describe(\"Pinned current branch HEAD.\"),\n truncated: z.boolean().describe(\"Some files or patches were omitted because of response limits.\"),\n files: z\n .array(workspaceDiffFileSchema)\n .max(200)\n .describe(\"Bounded changed-file list; untracked files are excluded.\")\n .readonly(),\n});\n\nconst unavailableWorkspaceDiffSchema = z.strictObject({\n ...workspaceDiffCommon,\n state: z.literal(\"unavailable\").describe(\"The workspace comparison could not be produced.\"),\n executionId: z\n .string()\n .min(1)\n .nullable()\n .describe(\"Execution that could not be inspected, or null when no execution exists.\"),\n reason: z.string().min(1).describe(\"Why the workspace comparison could not be read.\"),\n base: z.null().describe(\"No comparison base is available.\"),\n head: z.null().describe(\"No workspace HEAD is available.\"),\n truncated: z.literal(false).describe(\"Unavailable comparisons never contain partial results.\"),\n files: z\n .array(workspaceDiffFileSchema)\n .max(0)\n .describe(\"Unavailable comparisons contain no changed files.\")\n .readonly(),\n});\n\n/** Validates either a ready comparison with pinned commits or an unavailable response with a reason. */\nexport const workspaceDiffSchema = z.discriminatedUnion(\"state\", [\n readyWorkspaceDiffSchema,\n unavailableWorkspaceDiffSchema,\n]);\n\n/** A ready workspace comparison or an unavailable response carrying its reason. */\nexport type WorkspaceDiff = Readonly<z.infer<typeof workspaceDiffSchema>>;\n\n/** Identifies an execution and the reason its workspace comparison is unavailable. */\nexport interface UnavailableWorkspaceDiffInput {\n readonly executionId: string | null;\n readonly reason: string;\n}\n\n/** Creates an unavailable workspace-diff response with a stable empty projection. */\nexport function unavailableWorkspaceDiff(input: UnavailableWorkspaceDiffInput): WorkspaceDiff {\n return {\n executionId: input.executionId,\n state: \"unavailable\",\n reason: input.reason,\n base: null,\n head: null,\n capturedAt: new Date().toISOString(),\n truncated: false,\n files: [],\n };\n}\n"],"mappings":";;AAEA,MAAM,kBAAkB,EAAE,aAAa,EACrC,KAAK,EACF,OAAO,CAAC,CACR,MAAM,oBAAoB,CAAC,CAC3B,SAAS,qDAAqD,EACnE,CAAC;;AAGD,MAAa,0BAA0B,EAAE,aAAa;CACpD,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,oDAAoD;CAC9E,cAAc,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,2CAA2C;CACxF,QAAQ,EACL,KAAK;EAAC;EAAS;EAAW;EAAY;CAAS,CAAC,CAAC,CACjD,SAAS,yDAAyD;CACrE,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,mDAAmD;CAC3F,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,+CAA+C;CACvF,WAAW,EACR,OAAO,CAAC,CACR,IAAI,CAAC,CACL,YAAY,CAAC,CACb,SAAS,CAAC,CACV,SAAS,4CAA4C;CACxD,WAAW,EACR,OAAO,CAAC,CACR,IAAI,CAAC,CACL,YAAY,CAAC,CACb,SAAS,CAAC,CACV,SAAS,8CAA8C;CAC1D,OAAO,EACJ,OAAO,CAAC,CACR,IAAI,GAAO,CAAC,CACZ,SAAS,mEAAmE;CAC/E,QAAQ,EAAE,QAAQ,CAAC,CAAC,SAAS,uCAAuC;CACpE,SAAS,EAAE,QAAQ,CAAC,CAAC,SAAS,0DAA0D;AAC1F,CAAC;AAKD,MAAM,sBAAsB,EAC1B,YAAY,EAAE,IACX,SAAS,CAAC,CACV,SAAS,wEAAwE,EACtF;AAEA,MAAM,2BAA2B,EAAE,aAAa;CAC9C,GAAG;CACH,OAAO,EAAE,QAAQ,OAAO,CAAC,CAAC,SAAS,qCAAqC;CACxE,aAAa,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,+CAA+C;CACvF,QAAQ,EAAE,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,kDAAkD;CACxF,MAAM,gBAAgB,SAAS,yBAAyB;CACxD,MAAM,gBAAgB,SAAS,6BAA6B;CAC5D,WAAW,EAAE,QAAQ,CAAC,CAAC,SAAS,gEAAgE;CAChG,OAAO,EACJ,MAAM,uBAAuB,CAAC,CAC9B,IAAI,GAAG,CAAC,CACR,SAAS,0DAA0D,CAAC,CACpE,SAAS;AACd,CAAC;AAED,MAAM,iCAAiC,EAAE,aAAa;CACpD,GAAG;CACH,OAAO,EAAE,QAAQ,aAAa,CAAC,CAAC,SAAS,iDAAiD;CAC1F,aAAa,EACV,OAAO,CAAC,CACR,IAAI,CAAC,CAAC,CACN,SAAS,CAAC,CACV,SAAS,0EAA0E;CACtF,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,iDAAiD;CACpF,MAAM,EAAE,KAAK,CAAC,CAAC,SAAS,kCAAkC;CAC1D,MAAM,EAAE,KAAK,CAAC,CAAC,SAAS,iCAAiC;CACzD,WAAW,EAAE,QAAQ,KAAK,CAAC,CAAC,SAAS,wDAAwD;CAC7F,OAAO,EACJ,MAAM,uBAAuB,CAAC,CAC9B,IAAI,CAAC,CAAC,CACN,SAAS,mDAAmD,CAAC,CAC7D,SAAS;AACd,CAAC;;AAGD,MAAa,sBAAsB,EAAE,mBAAmB,SAAS,CAC/D,0BACA,8BACF,CAAC;;AAYD,SAAgB,yBAAyB,OAAqD;CAC5F,OAAO;EACL,aAAa,MAAM;EACnB,OAAO;EACP,QAAQ,MAAM;EACd,MAAM;EACN,MAAM;EACN,6BAAY,IAAI,KAAK,EAAA,CAAE,YAAY;EACnC,WAAW;EACX,OAAO,CAAC;CACV;AACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/workspace-files-git.d.ts
|
|
2
|
+
/** Configurable bounds for the supplied committed-Git file reader; custom adapters own their limits. */
|
|
3
|
+
interface WorkspaceGitFilesOptions {
|
|
4
|
+
readonly maxFileBytes?: number;
|
|
5
|
+
readonly maxDirectoryEntries?: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Reads committed directories or files using Node.js and Git, without changing the checkout.
|
|
9
|
+
* Pass a JSON file containing root, path, optional revision, maxFileBytes, and maxDirectoryEntries.
|
|
10
|
+
* The caller adds its authorized executionId and validates the resulting WorkspaceFiles response.
|
|
11
|
+
*/
|
|
12
|
+
declare const workspaceGitFilesScript: string;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { WorkspaceGitFilesOptions, workspaceGitFilesScript };
|
|
15
|
+
//# sourceMappingURL=workspace-files-git.d.mts.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
//#region src/workspace-files-git.ts
|
|
2
|
+
/**
|
|
3
|
+
* Reads committed directories or files using Node.js and Git, without changing the checkout.
|
|
4
|
+
* Pass a JSON file containing root, path, optional revision, maxFileBytes, and maxDirectoryEntries.
|
|
5
|
+
* The caller adds its authorized executionId and validates the resulting WorkspaceFiles response.
|
|
6
|
+
*/
|
|
7
|
+
const workspaceGitFilesScript = String.raw`
|
|
8
|
+
const fs = require('node:fs');
|
|
9
|
+
const { execFileSync } = require('node:child_process');
|
|
10
|
+
const input = JSON.parse(fs.readFileSync(process.argv[1], 'utf8'));
|
|
11
|
+
const root = fs.realpathSync(input.root);
|
|
12
|
+
const maxBytes = input.maxFileBytes ?? 2000000;
|
|
13
|
+
const maxEntries = input.maxDirectoryEntries ?? 2000;
|
|
14
|
+
const git = (args, encoding = 'utf8') => execFileSync('git', ['--no-optional-locks', '--literal-pathspecs', '-c', 'core.fsmonitor=false', ...args], { cwd: root, encoding, timeout: 10000, maxBuffer: Math.max(16000000, maxBytes + 1024), env: { ...process.env, GIT_OPTIONAL_LOCKS: '0' } });
|
|
15
|
+
const safe = (p) => p === '' || (!p.includes('\\') && !p.includes('\0') && p.split('/').every(v => v && v !== '.' && v !== '..' && v.toLowerCase() !== '.git'));
|
|
16
|
+
const unavailable = (reason) => ({ state: 'unavailable', path: input.path, reason });
|
|
17
|
+
const entryType = (mode, type) => mode === '120000' ? 'symlink' : type === 'tree' ? 'directory' : type === 'commit' ? 'submodule' : 'file';
|
|
18
|
+
function entries(ref, selected) {
|
|
19
|
+
return git(['ls-tree', '-z', '-l', ref, ...(selected ? ['--', selected] : [])]).split('\0').filter(Boolean).map(line => {
|
|
20
|
+
const m = /^(\d+) (\w+) ([a-f0-9]+)\s+(-|\d+)\t([\s\S]+)$/u.exec(line);
|
|
21
|
+
if (!m) throw new Error('Invalid tree entry');
|
|
22
|
+
return { path: m[5], type: entryType(m[1], m[2]), sha: m[3], size: m[4] === '-' ? null : Number(m[4]) };
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function inspect() {
|
|
26
|
+
if (!safe(input.path) || !Number.isSafeInteger(maxBytes) || maxBytes < 1 || !Number.isSafeInteger(maxEntries) || maxEntries < 1) return unavailable('Invalid file inspection options.');
|
|
27
|
+
if (fs.realpathSync(git(['rev-parse', '--show-toplevel']).trim()) !== root) return unavailable('The workspace checkout is unavailable.');
|
|
28
|
+
const head = git(['rev-parse', '--verify', 'HEAD']).trim();
|
|
29
|
+
const revision = input.revision ?? head;
|
|
30
|
+
if (!/^[a-f0-9]{40,64}$/u.test(revision)) return unavailable('Select an immutable commit from this workspace.');
|
|
31
|
+
try { git(['merge-base', '--is-ancestor', revision, head]); }
|
|
32
|
+
catch { return unavailable('This revision is no longer part of the workspace history. Refresh files.'); }
|
|
33
|
+
const entry = input.path ? entries(revision, input.path).find(e => e.path === input.path) : null;
|
|
34
|
+
if (input.path && !entry) return unavailable('This path does not exist at the selected revision.');
|
|
35
|
+
if (!entry || entry.type === 'directory') {
|
|
36
|
+
const all = entries(entry ? entry.sha : revision);
|
|
37
|
+
const children = all.slice(0, maxEntries).map(e => ({ name: e.path, path: input.path ? input.path + '/' + e.path : e.path, type: e.type, size: e.size }));
|
|
38
|
+
if (children.some(e => !safe(e.path))) return unavailable('The directory contains an unsupported path.');
|
|
39
|
+
return { state: 'directory', path: input.path, revision, entries: children, truncated: all.length > maxEntries };
|
|
40
|
+
}
|
|
41
|
+
const metadata = { name: input.path.split('/').at(-1), path: input.path, type: entry.type, size: entry.size };
|
|
42
|
+
const result = content => ({ state: 'file', path: input.path, revision, entry: metadata, content });
|
|
43
|
+
if (entry.type === 'submodule') return result({ kind: 'unavailable', reason: 'Submodule contents belong to a separate repository.' });
|
|
44
|
+
if (entry.size === null || entry.size > maxBytes) return result({ kind: 'unavailable', reason: 'This file exceeds the configured ' + maxBytes.toLocaleString('en-US') + '-byte preview limit.' });
|
|
45
|
+
const bytes = git(['cat-file', 'blob', entry.sha], null);
|
|
46
|
+
if (bytes.length > maxBytes) return result({ kind: 'unavailable', reason: 'This file exceeds the configured preview limit.' });
|
|
47
|
+
const ext = input.path.split('.').at(-1).toLowerCase();
|
|
48
|
+
const mediaType = { png: 'image/png', jpg: 'image/jpeg', jpeg: 'image/jpeg', gif: 'image/gif', webp: 'image/webp', avif: 'image/avif', svg: 'image/svg+xml' }[ext];
|
|
49
|
+
if (mediaType && entry.type === 'file') return result({ kind: 'image', mediaType, base64: bytes.toString('base64') });
|
|
50
|
+
try {
|
|
51
|
+
if (bytes.includes(0)) throw new Error('Binary');
|
|
52
|
+
return result({ kind: 'text', text: new TextDecoder('utf-8', { fatal: true }).decode(bytes) });
|
|
53
|
+
} catch { return result({ kind: 'unavailable', reason: 'This binary format cannot be previewed.' }); }
|
|
54
|
+
}
|
|
55
|
+
try { process.stdout.write(JSON.stringify(inspect())); }
|
|
56
|
+
catch { process.stdout.write(JSON.stringify(unavailable('The committed file could not be read. Refresh files after the current Git operation finishes.'))); }
|
|
57
|
+
`;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { workspaceGitFilesScript };
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=workspace-files-git.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-files-git.mjs","names":[],"sources":["../src/workspace-files-git.ts"],"sourcesContent":["/** Configurable bounds for the supplied committed-Git file reader; custom adapters own their limits. */\nexport interface WorkspaceGitFilesOptions {\n readonly maxFileBytes?: number;\n readonly maxDirectoryEntries?: number;\n}\n\n/**\n * Reads committed directories or files using Node.js and Git, without changing the checkout.\n * Pass a JSON file containing root, path, optional revision, maxFileBytes, and maxDirectoryEntries.\n * The caller adds its authorized executionId and validates the resulting WorkspaceFiles response.\n */\nexport const workspaceGitFilesScript = String.raw`\nconst fs = require('node:fs');\nconst { execFileSync } = require('node:child_process');\nconst input = JSON.parse(fs.readFileSync(process.argv[1], 'utf8'));\nconst root = fs.realpathSync(input.root);\nconst maxBytes = input.maxFileBytes ?? 2000000;\nconst maxEntries = input.maxDirectoryEntries ?? 2000;\nconst git = (args, encoding = 'utf8') => execFileSync('git', ['--no-optional-locks', '--literal-pathspecs', '-c', 'core.fsmonitor=false', ...args], { cwd: root, encoding, timeout: 10000, maxBuffer: Math.max(16000000, maxBytes + 1024), env: { ...process.env, GIT_OPTIONAL_LOCKS: '0' } });\nconst safe = (p) => p === '' || (!p.includes('\\\\') && !p.includes('\\0') && p.split('/').every(v => v && v !== '.' && v !== '..' && v.toLowerCase() !== '.git'));\nconst unavailable = (reason) => ({ state: 'unavailable', path: input.path, reason });\nconst entryType = (mode, type) => mode === '120000' ? 'symlink' : type === 'tree' ? 'directory' : type === 'commit' ? 'submodule' : 'file';\nfunction entries(ref, selected) {\n return git(['ls-tree', '-z', '-l', ref, ...(selected ? ['--', selected] : [])]).split('\\0').filter(Boolean).map(line => {\n const m = /^(\\d+) (\\w+) ([a-f0-9]+)\\s+(-|\\d+)\\t([\\s\\S]+)$/u.exec(line);\n if (!m) throw new Error('Invalid tree entry');\n return { path: m[5], type: entryType(m[1], m[2]), sha: m[3], size: m[4] === '-' ? null : Number(m[4]) };\n });\n}\nfunction inspect() {\n if (!safe(input.path) || !Number.isSafeInteger(maxBytes) || maxBytes < 1 || !Number.isSafeInteger(maxEntries) || maxEntries < 1) return unavailable('Invalid file inspection options.');\n if (fs.realpathSync(git(['rev-parse', '--show-toplevel']).trim()) !== root) return unavailable('The workspace checkout is unavailable.');\n const head = git(['rev-parse', '--verify', 'HEAD']).trim();\n const revision = input.revision ?? head;\n if (!/^[a-f0-9]{40,64}$/u.test(revision)) return unavailable('Select an immutable commit from this workspace.');\n try { git(['merge-base', '--is-ancestor', revision, head]); }\n catch { return unavailable('This revision is no longer part of the workspace history. Refresh files.'); }\n const entry = input.path ? entries(revision, input.path).find(e => e.path === input.path) : null;\n if (input.path && !entry) return unavailable('This path does not exist at the selected revision.');\n if (!entry || entry.type === 'directory') {\n const all = entries(entry ? entry.sha : revision);\n const children = all.slice(0, maxEntries).map(e => ({ name: e.path, path: input.path ? input.path + '/' + e.path : e.path, type: e.type, size: e.size }));\n if (children.some(e => !safe(e.path))) return unavailable('The directory contains an unsupported path.');\n return { state: 'directory', path: input.path, revision, entries: children, truncated: all.length > maxEntries };\n }\n const metadata = { name: input.path.split('/').at(-1), path: input.path, type: entry.type, size: entry.size };\n const result = content => ({ state: 'file', path: input.path, revision, entry: metadata, content });\n if (entry.type === 'submodule') return result({ kind: 'unavailable', reason: 'Submodule contents belong to a separate repository.' });\n if (entry.size === null || entry.size > maxBytes) return result({ kind: 'unavailable', reason: 'This file exceeds the configured ' + maxBytes.toLocaleString('en-US') + '-byte preview limit.' });\n const bytes = git(['cat-file', 'blob', entry.sha], null);\n if (bytes.length > maxBytes) return result({ kind: 'unavailable', reason: 'This file exceeds the configured preview limit.' });\n const ext = input.path.split('.').at(-1).toLowerCase();\n const mediaType = { png: 'image/png', jpg: 'image/jpeg', jpeg: 'image/jpeg', gif: 'image/gif', webp: 'image/webp', avif: 'image/avif', svg: 'image/svg+xml' }[ext];\n if (mediaType && entry.type === 'file') return result({ kind: 'image', mediaType, base64: bytes.toString('base64') });\n try {\n if (bytes.includes(0)) throw new Error('Binary');\n return result({ kind: 'text', text: new TextDecoder('utf-8', { fatal: true }).decode(bytes) });\n } catch { return result({ kind: 'unavailable', reason: 'This binary format cannot be previewed.' }); }\n}\ntry { process.stdout.write(JSON.stringify(inspect())); }\ncatch { process.stdout.write(JSON.stringify(unavailable('The committed file could not be read. Refresh files after the current Git operation finishes.'))); }\n`;\n"],"mappings":";;;;;;AAWA,MAAa,0BAA0B,OAAO,GAAG"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/workspace-files.d.ts
|
|
3
|
+
/** Validates a workspace-relative path, with the empty string identifying the root. */
|
|
4
|
+
declare const workspacePathSchema: z.ZodString;
|
|
5
|
+
/** Validates a directory or file inspection at an optional provider-owned immutable revision. */
|
|
6
|
+
declare const workspaceFilesRequestSchema: z.ZodObject<{
|
|
7
|
+
path: z.ZodDefault<z.ZodString>;
|
|
8
|
+
revision: z.ZodOptional<z.ZodString>;
|
|
9
|
+
}, z.core.$strict>;
|
|
10
|
+
/** A directory or file inspection at an optional provider-owned immutable revision. */
|
|
11
|
+
type WorkspaceFilesRequest = Readonly<z.input<typeof workspaceFilesRequestSchema>>;
|
|
12
|
+
/** Validates an immediate child of a workspace directory. */
|
|
13
|
+
declare const workspaceFileEntrySchema: z.ZodObject<{
|
|
14
|
+
name: z.ZodString;
|
|
15
|
+
path: z.ZodString;
|
|
16
|
+
type: z.ZodEnum<{
|
|
17
|
+
file: "file";
|
|
18
|
+
directory: "directory";
|
|
19
|
+
symlink: "symlink";
|
|
20
|
+
submodule: "submodule";
|
|
21
|
+
}>;
|
|
22
|
+
size: z.ZodNullable<z.ZodNumber>;
|
|
23
|
+
}, z.core.$strict>;
|
|
24
|
+
/** An immediate child of a workspace directory. */
|
|
25
|
+
type WorkspaceFileEntry = Readonly<z.infer<typeof workspaceFileEntrySchema>>;
|
|
26
|
+
/** Validates text, an image, or an explicit explanation for an undisplayable file. */
|
|
27
|
+
declare const workspaceFileContentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
28
|
+
kind: z.ZodLiteral<"text">;
|
|
29
|
+
text: z.ZodString;
|
|
30
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
31
|
+
kind: z.ZodLiteral<"image">;
|
|
32
|
+
mediaType: z.ZodEnum<{
|
|
33
|
+
"image/png": "image/png";
|
|
34
|
+
"image/jpeg": "image/jpeg";
|
|
35
|
+
"image/webp": "image/webp";
|
|
36
|
+
"image/gif": "image/gif";
|
|
37
|
+
"image/avif": "image/avif";
|
|
38
|
+
"image/svg+xml": "image/svg+xml";
|
|
39
|
+
}>;
|
|
40
|
+
base64: z.ZodString;
|
|
41
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
42
|
+
kind: z.ZodLiteral<"unavailable">;
|
|
43
|
+
reason: z.ZodString;
|
|
44
|
+
}, z.core.$strict>], "kind">;
|
|
45
|
+
/** Validates a pinned directory listing, a complete file, or an unavailable workspace response. */
|
|
46
|
+
declare const workspaceFilesSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
47
|
+
state: z.ZodLiteral<"directory">;
|
|
48
|
+
revision: z.ZodString;
|
|
49
|
+
entries: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
50
|
+
name: z.ZodString;
|
|
51
|
+
path: z.ZodString;
|
|
52
|
+
type: z.ZodEnum<{
|
|
53
|
+
file: "file";
|
|
54
|
+
directory: "directory";
|
|
55
|
+
symlink: "symlink";
|
|
56
|
+
submodule: "submodule";
|
|
57
|
+
}>;
|
|
58
|
+
size: z.ZodNullable<z.ZodNumber>;
|
|
59
|
+
}, z.core.$strict>>>;
|
|
60
|
+
truncated: z.ZodBoolean;
|
|
61
|
+
executionId: z.ZodNullable<z.ZodString>;
|
|
62
|
+
path: z.ZodString;
|
|
63
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
64
|
+
state: z.ZodLiteral<"file">;
|
|
65
|
+
revision: z.ZodString;
|
|
66
|
+
entry: z.ZodObject<{
|
|
67
|
+
name: z.ZodString;
|
|
68
|
+
path: z.ZodString;
|
|
69
|
+
type: z.ZodEnum<{
|
|
70
|
+
file: "file";
|
|
71
|
+
directory: "directory";
|
|
72
|
+
symlink: "symlink";
|
|
73
|
+
submodule: "submodule";
|
|
74
|
+
}>;
|
|
75
|
+
size: z.ZodNullable<z.ZodNumber>;
|
|
76
|
+
}, z.core.$strict>;
|
|
77
|
+
content: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
78
|
+
kind: z.ZodLiteral<"text">;
|
|
79
|
+
text: z.ZodString;
|
|
80
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
81
|
+
kind: z.ZodLiteral<"image">;
|
|
82
|
+
mediaType: z.ZodEnum<{
|
|
83
|
+
"image/png": "image/png";
|
|
84
|
+
"image/jpeg": "image/jpeg";
|
|
85
|
+
"image/webp": "image/webp";
|
|
86
|
+
"image/gif": "image/gif";
|
|
87
|
+
"image/avif": "image/avif";
|
|
88
|
+
"image/svg+xml": "image/svg+xml";
|
|
89
|
+
}>;
|
|
90
|
+
base64: z.ZodString;
|
|
91
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
92
|
+
kind: z.ZodLiteral<"unavailable">;
|
|
93
|
+
reason: z.ZodString;
|
|
94
|
+
}, z.core.$strict>], "kind">;
|
|
95
|
+
executionId: z.ZodNullable<z.ZodString>;
|
|
96
|
+
path: z.ZodString;
|
|
97
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
98
|
+
state: z.ZodLiteral<"unavailable">;
|
|
99
|
+
reason: z.ZodString;
|
|
100
|
+
executionId: z.ZodNullable<z.ZodString>;
|
|
101
|
+
path: z.ZodString;
|
|
102
|
+
}, z.core.$strict>], "state">;
|
|
103
|
+
/** A pinned directory listing, complete file, or unavailable workspace response. */
|
|
104
|
+
type WorkspaceFiles = Readonly<z.infer<typeof workspaceFilesSchema>>;
|
|
105
|
+
//#endregion
|
|
106
|
+
export { WorkspaceFileEntry, WorkspaceFiles, WorkspaceFilesRequest, workspaceFileContentSchema, workspaceFileEntrySchema, workspaceFilesRequestSchema, workspaceFilesSchema, workspacePathSchema };
|
|
107
|
+
//# sourceMappingURL=workspace-files.d.mts.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/workspace-files.ts
|
|
3
|
+
/** Validates a workspace-relative path, with the empty string identifying the root. */
|
|
4
|
+
const workspacePathSchema = z.string().refine((path) => path === "" || !path.includes("\\") && !path.includes("\0") && path.split("/").every((part) => part !== "" && part !== "." && part !== ".." && part.toLowerCase() !== ".git"), "Use a workspace-relative path without traversal or Git metadata");
|
|
5
|
+
/** Validates a directory or file inspection at an optional provider-owned immutable revision. */
|
|
6
|
+
const workspaceFilesRequestSchema = z.strictObject({
|
|
7
|
+
path: workspacePathSchema.default("").describe("Workspace-relative file or directory; empty for root."),
|
|
8
|
+
revision: z.string().min(1).optional().describe("Opaque immutable revision; absent selects the current revision.")
|
|
9
|
+
});
|
|
10
|
+
/** Validates an immediate child of a workspace directory. */
|
|
11
|
+
const workspaceFileEntrySchema = z.strictObject({
|
|
12
|
+
name: z.string().min(1).describe("Display name within its parent directory."),
|
|
13
|
+
path: workspacePathSchema.describe("Workspace-relative entry path."),
|
|
14
|
+
type: z.enum([
|
|
15
|
+
"file",
|
|
16
|
+
"directory",
|
|
17
|
+
"symlink",
|
|
18
|
+
"submodule"
|
|
19
|
+
]).describe("Entry kind; links are never followed."),
|
|
20
|
+
size: z.number().int().nonnegative().nullable().describe("Byte length when known; null for directories or unknown sizes.")
|
|
21
|
+
});
|
|
22
|
+
/** Validates text, an image, or an explicit explanation for an undisplayable file. */
|
|
23
|
+
const workspaceFileContentSchema = z.discriminatedUnion("kind", [
|
|
24
|
+
z.strictObject({
|
|
25
|
+
kind: z.literal("text").describe("Complete UTF-8 text, including an empty file."),
|
|
26
|
+
text: z.string().describe("Complete file contents; never a silently truncated prefix.")
|
|
27
|
+
}),
|
|
28
|
+
z.strictObject({
|
|
29
|
+
kind: z.literal("image").describe("Image bytes rendered in an image element, never as HTML."),
|
|
30
|
+
mediaType: z.enum([
|
|
31
|
+
"image/png",
|
|
32
|
+
"image/jpeg",
|
|
33
|
+
"image/gif",
|
|
34
|
+
"image/webp",
|
|
35
|
+
"image/avif",
|
|
36
|
+
"image/svg+xml"
|
|
37
|
+
]).describe("Image media type."),
|
|
38
|
+
base64: z.string().regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u).describe("Base64-encoded image bytes.")
|
|
39
|
+
}),
|
|
40
|
+
z.strictObject({
|
|
41
|
+
kind: z.literal("unavailable").describe("File exists but its content cannot be displayed."),
|
|
42
|
+
reason: z.string().min(1).describe("Why content is unavailable, such as a size limit or binary format.")
|
|
43
|
+
})
|
|
44
|
+
]);
|
|
45
|
+
const common = {
|
|
46
|
+
executionId: z.string().min(1).nullable().describe("Authorized execution whose workspace is being inspected."),
|
|
47
|
+
path: workspacePathSchema.describe("Requested workspace-relative path.")
|
|
48
|
+
};
|
|
49
|
+
/** Validates a pinned directory listing, a complete file, or an unavailable workspace response. */
|
|
50
|
+
const workspaceFilesSchema = z.discriminatedUnion("state", [
|
|
51
|
+
z.strictObject({
|
|
52
|
+
...common,
|
|
53
|
+
state: z.literal("directory").describe("A directory listing at the returned revision."),
|
|
54
|
+
revision: z.string().min(1).describe("Immutable provider-owned revision for subsequent reads."),
|
|
55
|
+
entries: z.array(workspaceFileEntrySchema).readonly().describe("Immediate directory children."),
|
|
56
|
+
truncated: z.boolean().describe("The provider's configured directory limit omitted entries.")
|
|
57
|
+
}),
|
|
58
|
+
z.strictObject({
|
|
59
|
+
...common,
|
|
60
|
+
state: z.literal("file").describe("A file at the returned revision."),
|
|
61
|
+
revision: z.string().min(1).describe("Immutable provider-owned revision for subsequent reads."),
|
|
62
|
+
entry: workspaceFileEntrySchema.describe("Metadata for the requested file."),
|
|
63
|
+
content: workspaceFileContentSchema.describe("Complete contents or an explicit unavailability reason.")
|
|
64
|
+
}),
|
|
65
|
+
z.strictObject({
|
|
66
|
+
...common,
|
|
67
|
+
state: z.literal("unavailable").describe("The requested workspace, revision, or path cannot be read."),
|
|
68
|
+
reason: z.string().min(1).describe("Why the requested inspection is unavailable.")
|
|
69
|
+
})
|
|
70
|
+
]);
|
|
71
|
+
//#endregion
|
|
72
|
+
export { workspaceFileContentSchema, workspaceFileEntrySchema, workspaceFilesRequestSchema, workspaceFilesSchema, workspacePathSchema };
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=workspace-files.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-files.mjs","names":[],"sources":["../src/workspace-files.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/** Validates a workspace-relative path, with the empty string identifying the root. */\nexport const workspacePathSchema = z\n .string()\n .refine(\n (path) =>\n path === \"\" ||\n (!path.includes(\"\\\\\") &&\n !path.includes(\"\\0\") &&\n path\n .split(\"/\")\n .every(\n (part) => part !== \"\" && part !== \".\" && part !== \"..\" && part.toLowerCase() !== \".git\",\n )),\n \"Use a workspace-relative path without traversal or Git metadata\",\n );\n\n/** Validates a directory or file inspection at an optional provider-owned immutable revision. */\nexport const workspaceFilesRequestSchema = z.strictObject({\n path: workspacePathSchema\n .default(\"\")\n .describe(\"Workspace-relative file or directory; empty for root.\"),\n revision: z\n .string()\n .min(1)\n .optional()\n .describe(\"Opaque immutable revision; absent selects the current revision.\"),\n});\n\n/** A directory or file inspection at an optional provider-owned immutable revision. */\nexport type WorkspaceFilesRequest = Readonly<z.input<typeof workspaceFilesRequestSchema>>;\n\n/** Validates an immediate child of a workspace directory. */\nexport const workspaceFileEntrySchema = z.strictObject({\n name: z.string().min(1).describe(\"Display name within its parent directory.\"),\n path: workspacePathSchema.describe(\"Workspace-relative entry path.\"),\n type: z\n .enum([\"file\", \"directory\", \"symlink\", \"submodule\"])\n .describe(\"Entry kind; links are never followed.\"),\n size: z\n .number()\n .int()\n .nonnegative()\n .nullable()\n .describe(\"Byte length when known; null for directories or unknown sizes.\"),\n});\n\n/** An immediate child of a workspace directory. */\nexport type WorkspaceFileEntry = Readonly<z.infer<typeof workspaceFileEntrySchema>>;\n\n/** Validates text, an image, or an explicit explanation for an undisplayable file. */\nexport const workspaceFileContentSchema = z.discriminatedUnion(\"kind\", [\n z.strictObject({\n kind: z.literal(\"text\").describe(\"Complete UTF-8 text, including an empty file.\"),\n text: z.string().describe(\"Complete file contents; never a silently truncated prefix.\"),\n }),\n z.strictObject({\n kind: z.literal(\"image\").describe(\"Image bytes rendered in an image element, never as HTML.\"),\n mediaType: z\n .enum([\"image/png\", \"image/jpeg\", \"image/gif\", \"image/webp\", \"image/avif\", \"image/svg+xml\"])\n .describe(\"Image media type.\"),\n base64: z\n .string()\n .regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u)\n .describe(\"Base64-encoded image bytes.\"),\n }),\n z.strictObject({\n kind: z.literal(\"unavailable\").describe(\"File exists but its content cannot be displayed.\"),\n reason: z\n .string()\n .min(1)\n .describe(\"Why content is unavailable, such as a size limit or binary format.\"),\n }),\n]);\n\nconst common = {\n executionId: z\n .string()\n .min(1)\n .nullable()\n .describe(\"Authorized execution whose workspace is being inspected.\"),\n path: workspacePathSchema.describe(\"Requested workspace-relative path.\"),\n};\n\n/** Validates a pinned directory listing, a complete file, or an unavailable workspace response. */\nexport const workspaceFilesSchema = z.discriminatedUnion(\"state\", [\n z.strictObject({\n ...common,\n state: z.literal(\"directory\").describe(\"A directory listing at the returned revision.\"),\n revision: z.string().min(1).describe(\"Immutable provider-owned revision for subsequent reads.\"),\n entries: z.array(workspaceFileEntrySchema).readonly().describe(\"Immediate directory children.\"),\n truncated: z.boolean().describe(\"The provider's configured directory limit omitted entries.\"),\n }),\n z.strictObject({\n ...common,\n state: z.literal(\"file\").describe(\"A file at the returned revision.\"),\n revision: z.string().min(1).describe(\"Immutable provider-owned revision for subsequent reads.\"),\n entry: workspaceFileEntrySchema.describe(\"Metadata for the requested file.\"),\n content: workspaceFileContentSchema.describe(\n \"Complete contents or an explicit unavailability reason.\",\n ),\n }),\n z.strictObject({\n ...common,\n state: z\n .literal(\"unavailable\")\n .describe(\"The requested workspace, revision, or path cannot be read.\"),\n reason: z.string().min(1).describe(\"Why the requested inspection is unavailable.\"),\n }),\n]);\n\n/** A pinned directory listing, complete file, or unavailable workspace response. */\nexport type WorkspaceFiles = Readonly<z.infer<typeof workspaceFilesSchema>>;\n"],"mappings":";;;AAGA,MAAa,sBAAsB,EAChC,OAAO,CAAC,CACR,QACE,SACC,SAAS,MACR,CAAC,KAAK,SAAS,IAAI,KAClB,CAAC,KAAK,SAAS,IAAI,KACnB,KACG,MAAM,GAAG,CAAC,CACV,OACE,SAAS,SAAS,MAAM,SAAS,OAAO,SAAS,QAAQ,KAAK,YAAY,MAAM,MACnF,GACN,iEACF;;AAGF,MAAa,8BAA8B,EAAE,aAAa;CACxD,MAAM,oBACH,QAAQ,EAAE,CAAC,CACX,SAAS,uDAAuD;CACnE,UAAU,EACP,OAAO,CAAC,CACR,IAAI,CAAC,CAAC,CACN,SAAS,CAAC,CACV,SAAS,iEAAiE;AAC/E,CAAC;;AAMD,MAAa,2BAA2B,EAAE,aAAa;CACrD,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,2CAA2C;CAC5E,MAAM,oBAAoB,SAAS,gCAAgC;CACnE,MAAM,EACH,KAAK;EAAC;EAAQ;EAAa;EAAW;CAAW,CAAC,CAAC,CACnD,SAAS,uCAAuC;CACnD,MAAM,EACH,OAAO,CAAC,CACR,IAAI,CAAC,CACL,YAAY,CAAC,CACb,SAAS,CAAC,CACV,SAAS,gEAAgE;AAC9E,CAAC;;AAMD,MAAa,6BAA6B,EAAE,mBAAmB,QAAQ;CACrE,EAAE,aAAa;EACb,MAAM,EAAE,QAAQ,MAAM,CAAC,CAAC,SAAS,+CAA+C;EAChF,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,4DAA4D;CACxF,CAAC;CACD,EAAE,aAAa;EACb,MAAM,EAAE,QAAQ,OAAO,CAAC,CAAC,SAAS,0DAA0D;EAC5F,WAAW,EACR,KAAK;GAAC;GAAa;GAAc;GAAa;GAAc;GAAc;EAAe,CAAC,CAAC,CAC3F,SAAS,mBAAmB;EAC/B,QAAQ,EACL,OAAO,CAAC,CACR,MAAM,mEAAmE,CAAC,CAC1E,SAAS,6BAA6B;CAC3C,CAAC;CACD,EAAE,aAAa;EACb,MAAM,EAAE,QAAQ,aAAa,CAAC,CAAC,SAAS,kDAAkD;EAC1F,QAAQ,EACL,OAAO,CAAC,CACR,IAAI,CAAC,CAAC,CACN,SAAS,oEAAoE;CAClF,CAAC;AACH,CAAC;AAED,MAAM,SAAS;CACb,aAAa,EACV,OAAO,CAAC,CACR,IAAI,CAAC,CAAC,CACN,SAAS,CAAC,CACV,SAAS,0DAA0D;CACtE,MAAM,oBAAoB,SAAS,oCAAoC;AACzE;;AAGA,MAAa,uBAAuB,EAAE,mBAAmB,SAAS;CAChE,EAAE,aAAa;EACb,GAAG;EACH,OAAO,EAAE,QAAQ,WAAW,CAAC,CAAC,SAAS,+CAA+C;EACtF,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,yDAAyD;EAC9F,SAAS,EAAE,MAAM,wBAAwB,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,+BAA+B;EAC9F,WAAW,EAAE,QAAQ,CAAC,CAAC,SAAS,4DAA4D;CAC9F,CAAC;CACD,EAAE,aAAa;EACb,GAAG;EACH,OAAO,EAAE,QAAQ,MAAM,CAAC,CAAC,SAAS,kCAAkC;EACpE,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,yDAAyD;EAC9F,OAAO,yBAAyB,SAAS,kCAAkC;EAC3E,SAAS,2BAA2B,SAClC,yDACF;CACF,CAAC;CACD,EAAE,aAAa;EACb,GAAG;EACH,OAAO,EACJ,QAAQ,aAAa,CAAC,CACtB,SAAS,4DAA4D;EACxE,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,8CAA8C;CACnF,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/workspace-snapshot.d.ts
|
|
3
|
+
/** Validates the bounded committed-tree snapshot captured inside an execution workspace. */
|
|
4
|
+
declare const workspaceSnapshotSchema: z.ZodObject<{
|
|
5
|
+
truncated: z.ZodBoolean;
|
|
6
|
+
files: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
7
|
+
path: z.ZodString;
|
|
8
|
+
oldMode: z.ZodNullable<z.ZodString>;
|
|
9
|
+
newMode: z.ZodNullable<z.ZodString>;
|
|
10
|
+
oldSha: z.ZodNullable<z.ZodString>;
|
|
11
|
+
newSha: z.ZodNullable<z.ZodString>;
|
|
12
|
+
content: z.ZodNullable<z.ZodString>;
|
|
13
|
+
binary: z.ZodBoolean;
|
|
14
|
+
omitted: z.ZodBoolean;
|
|
15
|
+
}, z.core.$strip>>>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
/** A bounded committed-tree snapshot captured inside an execution workspace. */
|
|
18
|
+
type WorkspaceSnapshot = z.infer<typeof workspaceSnapshotSchema>;
|
|
19
|
+
/**
|
|
20
|
+
* Captures a bounded committed-tree snapshot using only sandbox Node.js built-ins without
|
|
21
|
+
* writing the checkout or Git index.
|
|
22
|
+
*/
|
|
23
|
+
declare const workspaceSnapshotScript: string;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { WorkspaceSnapshot, workspaceSnapshotSchema, workspaceSnapshotScript };
|
|
26
|
+
//# sourceMappingURL=workspace-snapshot.d.mts.map
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/workspace-snapshot.ts
|
|
3
|
+
/** Validates the bounded committed-tree snapshot captured inside an execution workspace. */
|
|
4
|
+
const workspaceSnapshotSchema = z.object({
|
|
5
|
+
truncated: z.boolean(),
|
|
6
|
+
files: z.array(z.object({
|
|
7
|
+
path: z.string(),
|
|
8
|
+
oldMode: z.string().nullable(),
|
|
9
|
+
newMode: z.string().nullable(),
|
|
10
|
+
oldSha: z.string().nullable(),
|
|
11
|
+
newSha: z.string().nullable(),
|
|
12
|
+
content: z.string().max(2e5).nullable(),
|
|
13
|
+
binary: z.boolean(),
|
|
14
|
+
omitted: z.boolean()
|
|
15
|
+
})).max(200).readonly()
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Captures a bounded committed-tree snapshot using only sandbox Node.js built-ins without
|
|
19
|
+
* writing the checkout or Git index.
|
|
20
|
+
*/
|
|
21
|
+
const workspaceSnapshotScript = String.raw`
|
|
22
|
+
const fs = require('node:fs');
|
|
23
|
+
const path = require('node:path');
|
|
24
|
+
const { execFileSync } = require('node:child_process');
|
|
25
|
+
const input = JSON.parse(fs.readFileSync(process.argv[1], 'utf8'));
|
|
26
|
+
const root = input.root;
|
|
27
|
+
const started = Date.now();
|
|
28
|
+
const runGit = (args, encoding) => execFileSync('git', ['--no-optional-locks', '-c', 'core.fsmonitor=false', ...args], { cwd: root, timeout: 10000, maxBuffer: 16000000, encoding, env: { ...process.env, GIT_OPTIONAL_LOCKS: '0' } });
|
|
29
|
+
const git = (args) => runGit(args, 'utf8');
|
|
30
|
+
const safe = (p) => p && !path.isAbsolute(p) && !p.split('/').some((v) => v === '..' || v === '.' || v.toLowerCase() === '.git' || !v);
|
|
31
|
+
function tree(ref) {
|
|
32
|
+
const entries = new Map();
|
|
33
|
+
for (const line of git(['ls-tree', '-rz', '-r', '--long', '--full-tree', ref]).split('\0').filter(Boolean)) {
|
|
34
|
+
const match = /^(\d+) (\w+) ([a-f0-9]+)\s+(-|\d+)\t([\s\S]+)$/u.exec(line);
|
|
35
|
+
if (!match || !safe(match[5])) throw new Error('Invalid repository tree');
|
|
36
|
+
entries.set(match[5], { mode: match[1], type: match[2], sha: match[3], size: match[4] === '-' ? null : Number(match[4]) });
|
|
37
|
+
}
|
|
38
|
+
return entries;
|
|
39
|
+
}
|
|
40
|
+
function entryBytes(entry) {
|
|
41
|
+
if (!entry) return Buffer.alloc(0);
|
|
42
|
+
if (entry.type !== 'blob' || entry.size === null || entry.size > 200000) return null;
|
|
43
|
+
return runGit(['cat-file', 'blob', entry.sha], null);
|
|
44
|
+
}
|
|
45
|
+
function text(data) {
|
|
46
|
+
if (data === null) return { content: null, binary: false };
|
|
47
|
+
if (data.includes(0)) return { content: null, binary: true };
|
|
48
|
+
try { return { content: new TextDecoder('utf-8', { fatal: true }).decode(data), binary: false }; }
|
|
49
|
+
catch { return { content: null, binary: true }; }
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
if (fs.realpathSync(root) !== root || !fs.lstatSync(path.join(root, '.git')).isDirectory()) throw new Error('Workspace checkout unavailable');
|
|
53
|
+
if (!/^[a-f0-9]{40,64}$/u.test(input.headSha) || git(['rev-parse', '--verify', input.headSha + '^{commit}']).trim() !== input.headSha) throw new Error('Invalid branch head');
|
|
54
|
+
const base = new Map(input.tree.map((file) => [file.path, file]));
|
|
55
|
+
const head = tree(input.headSha);
|
|
56
|
+
const paths = [...new Set([...base.keys(), ...head.keys()])].sort();
|
|
57
|
+
const files = [];
|
|
58
|
+
let truncated = false, bytes = 0;
|
|
59
|
+
for (const p of paths) {
|
|
60
|
+
if (!safe(p)) throw new Error('Invalid repository path');
|
|
61
|
+
if (Date.now() - started > 15000 || files.length >= 200) { truncated = true; break; }
|
|
62
|
+
const before = base.get(p);
|
|
63
|
+
const after = head.get(p);
|
|
64
|
+
if (before && after && before.sha === after.sha && before.mode === after.mode) continue;
|
|
65
|
+
const decoded = text(entryBytes(after));
|
|
66
|
+
if (decoded.content !== null) bytes += Buffer.byteLength(decoded.content);
|
|
67
|
+
const omitted = Boolean(after && decoded.content === null && !decoded.binary) || bytes > 2000000 || before?.mode === '160000' || after?.mode === '160000';
|
|
68
|
+
files.push({ path: p, oldMode: before?.mode ?? null, newMode: after?.mode ?? null, oldSha: before?.sha ?? null, newSha: after?.sha ?? null, content: omitted ? null : decoded.content, binary: decoded.binary, omitted });
|
|
69
|
+
if (bytes > 2000000) truncated = true;
|
|
70
|
+
}
|
|
71
|
+
process.stdout.write(JSON.stringify({ files, truncated }));
|
|
72
|
+
} catch (error) {
|
|
73
|
+
process.stderr.write('Workspace inspection failed\n');
|
|
74
|
+
process.exitCode = 1;
|
|
75
|
+
}
|
|
76
|
+
`;
|
|
77
|
+
//#endregion
|
|
78
|
+
export { workspaceSnapshotSchema, workspaceSnapshotScript };
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=workspace-snapshot.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-snapshot.mjs","names":[],"sources":["../src/workspace-snapshot.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/** Validates the bounded committed-tree snapshot captured inside an execution workspace. */\nexport const workspaceSnapshotSchema = z.object({\n truncated: z.boolean(),\n files: z\n .array(\n z.object({\n path: z.string(),\n oldMode: z.string().nullable(),\n newMode: z.string().nullable(),\n oldSha: z.string().nullable(),\n newSha: z.string().nullable(),\n content: z.string().max(200_000).nullable(),\n binary: z.boolean(),\n omitted: z.boolean(),\n }),\n )\n .max(200)\n .readonly(),\n});\n\n/** A bounded committed-tree snapshot captured inside an execution workspace. */\nexport type WorkspaceSnapshot = z.infer<typeof workspaceSnapshotSchema>;\n\n/**\n * Captures a bounded committed-tree snapshot using only sandbox Node.js built-ins without\n * writing the checkout or Git index.\n */\nexport const workspaceSnapshotScript = String.raw`\nconst fs = require('node:fs');\nconst path = require('node:path');\nconst { execFileSync } = require('node:child_process');\nconst input = JSON.parse(fs.readFileSync(process.argv[1], 'utf8'));\nconst root = input.root;\nconst started = Date.now();\nconst runGit = (args, encoding) => execFileSync('git', ['--no-optional-locks', '-c', 'core.fsmonitor=false', ...args], { cwd: root, timeout: 10000, maxBuffer: 16000000, encoding, env: { ...process.env, GIT_OPTIONAL_LOCKS: '0' } });\nconst git = (args) => runGit(args, 'utf8');\nconst safe = (p) => p && !path.isAbsolute(p) && !p.split('/').some((v) => v === '..' || v === '.' || v.toLowerCase() === '.git' || !v);\nfunction tree(ref) {\n const entries = new Map();\n for (const line of git(['ls-tree', '-rz', '-r', '--long', '--full-tree', ref]).split('\\0').filter(Boolean)) {\n const match = /^(\\d+) (\\w+) ([a-f0-9]+)\\s+(-|\\d+)\\t([\\s\\S]+)$/u.exec(line);\n if (!match || !safe(match[5])) throw new Error('Invalid repository tree');\n entries.set(match[5], { mode: match[1], type: match[2], sha: match[3], size: match[4] === '-' ? null : Number(match[4]) });\n }\n return entries;\n}\nfunction entryBytes(entry) {\n if (!entry) return Buffer.alloc(0);\n if (entry.type !== 'blob' || entry.size === null || entry.size > 200000) return null;\n return runGit(['cat-file', 'blob', entry.sha], null);\n}\nfunction text(data) {\n if (data === null) return { content: null, binary: false };\n if (data.includes(0)) return { content: null, binary: true };\n try { return { content: new TextDecoder('utf-8', { fatal: true }).decode(data), binary: false }; }\n catch { return { content: null, binary: true }; }\n}\ntry {\n if (fs.realpathSync(root) !== root || !fs.lstatSync(path.join(root, '.git')).isDirectory()) throw new Error('Workspace checkout unavailable');\n if (!/^[a-f0-9]{40,64}$/u.test(input.headSha) || git(['rev-parse', '--verify', input.headSha + '^{commit}']).trim() !== input.headSha) throw new Error('Invalid branch head');\n const base = new Map(input.tree.map((file) => [file.path, file]));\n const head = tree(input.headSha);\n const paths = [...new Set([...base.keys(), ...head.keys()])].sort();\n const files = [];\n let truncated = false, bytes = 0;\n for (const p of paths) {\n if (!safe(p)) throw new Error('Invalid repository path');\n if (Date.now() - started > 15000 || files.length >= 200) { truncated = true; break; }\n const before = base.get(p);\n const after = head.get(p);\n if (before && after && before.sha === after.sha && before.mode === after.mode) continue;\n const decoded = text(entryBytes(after));\n if (decoded.content !== null) bytes += Buffer.byteLength(decoded.content);\n const omitted = Boolean(after && decoded.content === null && !decoded.binary) || bytes > 2000000 || before?.mode === '160000' || after?.mode === '160000';\n files.push({ path: p, oldMode: before?.mode ?? null, newMode: after?.mode ?? null, oldSha: before?.sha ?? null, newSha: after?.sha ?? null, content: omitted ? null : decoded.content, binary: decoded.binary, omitted });\n if (bytes > 2000000) truncated = true;\n }\n process.stdout.write(JSON.stringify({ files, truncated }));\n} catch (error) {\n process.stderr.write('Workspace inspection failed\\n');\n process.exitCode = 1;\n}\n`;\n"],"mappings":";;;AAGA,MAAa,0BAA0B,EAAE,OAAO;CAC9C,WAAW,EAAE,QAAQ;CACrB,OAAO,EACJ,MACC,EAAE,OAAO;EACP,MAAM,EAAE,OAAO;EACf,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS;EAC7B,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS;EAC7B,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;EAC5B,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;EAC5B,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,GAAO,CAAC,CAAC,SAAS;EAC1C,QAAQ,EAAE,QAAQ;EAClB,SAAS,EAAE,QAAQ;CACrB,CAAC,CACH,CAAC,CACA,IAAI,GAAG,CAAC,CACR,SAAS;AACd,CAAC;;;;;AASD,MAAa,0BAA0B,OAAO,GAAG"}
|