@mastra/factory 0.0.0-aggregate-trace-20261015182851
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/LICENSE.md +32 -0
- package/README.md +671 -0
- package/dist/auth.d.ts +201 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +623 -0
- package/dist/auth.js.map +1 -0
- package/dist/boards/define-board.d.ts +111 -0
- package/dist/boards/define-board.d.ts.map +1 -0
- package/dist/boards/define-board.js +156 -0
- package/dist/boards/define-board.js.map +1 -0
- package/dist/boards/index.d.ts +14 -0
- package/dist/boards/index.d.ts.map +1 -0
- package/dist/boards/index.js +21 -0
- package/dist/boards/index.js.map +1 -0
- package/dist/boards/registry.d.ts +16 -0
- package/dist/boards/registry.d.ts.map +1 -0
- package/dist/boards/registry.js +25 -0
- package/dist/boards/registry.js.map +1 -0
- package/dist/boards/relocate.d.ts +21 -0
- package/dist/boards/relocate.d.ts.map +1 -0
- package/dist/boards/relocate.js +58 -0
- package/dist/boards/relocate.js.map +1 -0
- package/dist/boards/review.d.ts +6 -0
- package/dist/boards/review.d.ts.map +1 -0
- package/dist/boards/review.js +104 -0
- package/dist/boards/review.js.map +1 -0
- package/dist/boards/semantics.d.ts +68 -0
- package/dist/boards/semantics.d.ts.map +1 -0
- package/dist/boards/semantics.js +119 -0
- package/dist/boards/semantics.js.map +1 -0
- package/dist/boards/transition-policy.d.ts +67 -0
- package/dist/boards/transition-policy.d.ts.map +1 -0
- package/dist/boards/transition-policy.js +36 -0
- package/dist/boards/transition-policy.js.map +1 -0
- package/dist/boards/work-tool-rules.d.ts +8 -0
- package/dist/boards/work-tool-rules.d.ts.map +1 -0
- package/dist/boards/work-tool-rules.js +20 -0
- package/dist/boards/work-tool-rules.js.map +1 -0
- package/dist/boards/work-transition-policy.d.ts +3 -0
- package/dist/boards/work-transition-policy.d.ts.map +1 -0
- package/dist/boards/work-transition-policy.js +46 -0
- package/dist/boards/work-transition-policy.js.map +1 -0
- package/dist/boards/work.d.ts +4 -0
- package/dist/boards/work.d.ts.map +1 -0
- package/dist/boards/work.js +222 -0
- package/dist/boards/work.js.map +1 -0
- package/dist/capabilities/connection.d.ts +9 -0
- package/dist/capabilities/connection.d.ts.map +1 -0
- package/dist/capabilities/connection.js +1 -0
- package/dist/capabilities/intake.d.ts +153 -0
- package/dist/capabilities/intake.d.ts.map +1 -0
- package/dist/capabilities/intake.js +1 -0
- package/dist/capabilities/version-control.d.ts +268 -0
- package/dist/capabilities/version-control.d.ts.map +1 -0
- package/dist/capabilities/version-control.js +1 -0
- package/dist/environment/build-runner.d.ts +72 -0
- package/dist/environment/build-runner.d.ts.map +1 -0
- package/dist/environment/build-runner.js +131 -0
- package/dist/environment/build-runner.js.map +1 -0
- package/dist/environment/build-schedule.d.ts +40 -0
- package/dist/environment/build-schedule.d.ts.map +1 -0
- package/dist/environment/build-schedule.js +94 -0
- package/dist/environment/build-schedule.js.map +1 -0
- package/dist/environment/build-workflow.d.ts +62 -0
- package/dist/environment/build-workflow.d.ts.map +1 -0
- package/dist/environment/build-workflow.js +149 -0
- package/dist/environment/build-workflow.js.map +1 -0
- package/dist/environment/build.d.ts +111 -0
- package/dist/environment/build.d.ts.map +1 -0
- package/dist/environment/build.js +344 -0
- package/dist/environment/build.js.map +1 -0
- package/dist/environment/heads.d.ts +36 -0
- package/dist/environment/heads.d.ts.map +1 -0
- package/dist/environment/heads.js +60 -0
- package/dist/environment/heads.js.map +1 -0
- package/dist/factory.d.ts +225 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/factory.js +1006 -0
- package/dist/factory.js.map +1 -0
- package/dist/feed-events.d.ts +13 -0
- package/dist/feed-events.d.ts.map +1 -0
- package/dist/feed-events.js +25 -0
- package/dist/feed-events.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/integrations/base.d.ts +302 -0
- package/dist/integrations/base.d.ts.map +1 -0
- package/dist/integrations/base.js +1 -0
- package/dist/integrations/github/acceptance-labels.d.ts +16 -0
- package/dist/integrations/github/acceptance-labels.d.ts.map +1 -0
- package/dist/integrations/github/acceptance-labels.js +55 -0
- package/dist/integrations/github/acceptance-labels.js.map +1 -0
- package/dist/integrations/github/app-identity.d.ts +43 -0
- package/dist/integrations/github/app-identity.d.ts.map +1 -0
- package/dist/integrations/github/app-identity.js +62 -0
- package/dist/integrations/github/app-identity.js.map +1 -0
- package/dist/integrations/github/commits.d.ts +40 -0
- package/dist/integrations/github/commits.d.ts.map +1 -0
- package/dist/integrations/github/commits.js +48 -0
- package/dist/integrations/github/commits.js.map +1 -0
- package/dist/integrations/github/config.d.ts +60 -0
- package/dist/integrations/github/config.d.ts.map +1 -0
- package/dist/integrations/github/config.js +42 -0
- package/dist/integrations/github/config.js.map +1 -0
- package/dist/integrations/github/default-rules.d.ts +218 -0
- package/dist/integrations/github/default-rules.d.ts.map +1 -0
- package/dist/integrations/github/default-rules.js +296 -0
- package/dist/integrations/github/default-rules.js.map +1 -0
- package/dist/integrations/github/integration.d.ts +270 -0
- package/dist/integrations/github/integration.d.ts.map +1 -0
- package/dist/integrations/github/integration.js +1375 -0
- package/dist/integrations/github/integration.js.map +1 -0
- package/dist/integrations/github/issue-reconciler.d.ts +28 -0
- package/dist/integrations/github/issue-reconciler.d.ts.map +1 -0
- package/dist/integrations/github/issue-reconciler.js +138 -0
- package/dist/integrations/github/issue-reconciler.js.map +1 -0
- package/dist/integrations/github/pat.d.ts +38 -0
- package/dist/integrations/github/pat.d.ts.map +1 -0
- package/dist/integrations/github/pat.js +59 -0
- package/dist/integrations/github/pat.js.map +1 -0
- package/dist/integrations/github/provenance.d.ts +34 -0
- package/dist/integrations/github/provenance.d.ts.map +1 -0
- package/dist/integrations/github/provenance.js +91 -0
- package/dist/integrations/github/provenance.js.map +1 -0
- package/dist/integrations/github/reconcile-worker.d.ts +45 -0
- package/dist/integrations/github/reconcile-worker.d.ts.map +1 -0
- package/dist/integrations/github/reconcile-worker.js +189 -0
- package/dist/integrations/github/reconcile-worker.js.map +1 -0
- package/dist/integrations/github/reconciliation-config.d.ts +3 -0
- package/dist/integrations/github/reconciliation-config.d.ts.map +1 -0
- package/dist/integrations/github/reconciliation-config.js +19 -0
- package/dist/integrations/github/reconciliation-config.js.map +1 -0
- package/dist/integrations/github/routes.d.ts +90 -0
- package/dist/integrations/github/routes.d.ts.map +1 -0
- package/dist/integrations/github/routes.js +1362 -0
- package/dist/integrations/github/routes.js.map +1 -0
- package/dist/integrations/github/rules.d.ts +173 -0
- package/dist/integrations/github/rules.d.ts.map +1 -0
- package/dist/integrations/github/rules.js +1021 -0
- package/dist/integrations/github/rules.js.map +1 -0
- package/dist/integrations/github/sandbox-release.d.ts +25 -0
- package/dist/integrations/github/sandbox-release.d.ts.map +1 -0
- package/dist/integrations/github/sandbox-release.js +38 -0
- package/dist/integrations/github/sandbox-release.js.map +1 -0
- package/dist/integrations/github/sandbox.d.ts +234 -0
- package/dist/integrations/github/sandbox.d.ts.map +1 -0
- package/dist/integrations/github/sandbox.js +947 -0
- package/dist/integrations/github/sandbox.js.map +1 -0
- package/dist/integrations/github/session-subscriptions.d.ts +28 -0
- package/dist/integrations/github/session-subscriptions.d.ts.map +1 -0
- package/dist/integrations/github/session-subscriptions.js +283 -0
- package/dist/integrations/github/session-subscriptions.js.map +1 -0
- package/dist/integrations/github/settle-or-abort.d.ts +7 -0
- package/dist/integrations/github/settle-or-abort.d.ts.map +1 -0
- package/dist/integrations/github/settle-or-abort.js +25 -0
- package/dist/integrations/github/settle-or-abort.js.map +1 -0
- package/dist/integrations/github/stale-reviews.d.ts +22 -0
- package/dist/integrations/github/stale-reviews.d.ts.map +1 -0
- package/dist/integrations/github/stale-reviews.js +70 -0
- package/dist/integrations/github/stale-reviews.js.map +1 -0
- package/dist/integrations/github/subscriptions.d.ts +54 -0
- package/dist/integrations/github/subscriptions.d.ts.map +1 -0
- package/dist/integrations/github/subscriptions.js +64 -0
- package/dist/integrations/github/subscriptions.js.map +1 -0
- package/dist/integrations/github/token-refresh.d.ts +31 -0
- package/dist/integrations/github/token-refresh.d.ts.map +1 -0
- package/dist/integrations/github/token-refresh.js +42 -0
- package/dist/integrations/github/token-refresh.js.map +1 -0
- package/dist/integrations/github/webhook.d.ts +139 -0
- package/dist/integrations/github/webhook.d.ts.map +1 -0
- package/dist/integrations/github/webhook.js +432 -0
- package/dist/integrations/github/webhook.js.map +1 -0
- package/dist/integrations/gitlab/agent-tools.d.ts +14 -0
- package/dist/integrations/gitlab/agent-tools.d.ts.map +1 -0
- package/dist/integrations/gitlab/agent-tools.js +42 -0
- package/dist/integrations/gitlab/agent-tools.js.map +1 -0
- package/dist/integrations/gitlab/api.d.ts +222 -0
- package/dist/integrations/gitlab/api.d.ts.map +1 -0
- package/dist/integrations/gitlab/api.js +274 -0
- package/dist/integrations/gitlab/api.js.map +1 -0
- package/dist/integrations/gitlab/default-rules.d.ts +125 -0
- package/dist/integrations/gitlab/default-rules.d.ts.map +1 -0
- package/dist/integrations/gitlab/default-rules.js +180 -0
- package/dist/integrations/gitlab/default-rules.js.map +1 -0
- package/dist/integrations/gitlab/integration.d.ts +138 -0
- package/dist/integrations/gitlab/integration.d.ts.map +1 -0
- package/dist/integrations/gitlab/integration.js +705 -0
- package/dist/integrations/gitlab/integration.js.map +1 -0
- package/dist/integrations/gitlab/issue-reconciler.d.ts +6 -0
- package/dist/integrations/gitlab/issue-reconciler.d.ts.map +1 -0
- package/dist/integrations/gitlab/issue-reconciler.js +123 -0
- package/dist/integrations/gitlab/issue-reconciler.js.map +1 -0
- package/dist/integrations/gitlab/merge-request-reconciler.d.ts +6 -0
- package/dist/integrations/gitlab/merge-request-reconciler.d.ts.map +1 -0
- package/dist/integrations/gitlab/merge-request-reconciler.js +267 -0
- package/dist/integrations/gitlab/merge-request-reconciler.js.map +1 -0
- package/dist/integrations/gitlab/reconciler.d.ts +5 -0
- package/dist/integrations/gitlab/reconciler.d.ts.map +1 -0
- package/dist/integrations/gitlab/reconciler.js +31 -0
- package/dist/integrations/gitlab/reconciler.js.map +1 -0
- package/dist/integrations/gitlab/reconciliation-config.d.ts +3 -0
- package/dist/integrations/gitlab/reconciliation-config.d.ts.map +1 -0
- package/dist/integrations/gitlab/reconciliation-config.js +17 -0
- package/dist/integrations/gitlab/reconciliation-config.js.map +1 -0
- package/dist/integrations/gitlab/routes.d.ts +20 -0
- package/dist/integrations/gitlab/routes.d.ts.map +1 -0
- package/dist/integrations/gitlab/routes.js +474 -0
- package/dist/integrations/gitlab/routes.js.map +1 -0
- package/dist/integrations/gitlab/rules.d.ts +35 -0
- package/dist/integrations/gitlab/rules.d.ts.map +1 -0
- package/dist/integrations/gitlab/rules.js +502 -0
- package/dist/integrations/gitlab/rules.js.map +1 -0
- package/dist/integrations/gitlab/session-subscriptions.d.ts +32 -0
- package/dist/integrations/gitlab/session-subscriptions.d.ts.map +1 -0
- package/dist/integrations/gitlab/session-subscriptions.js +193 -0
- package/dist/integrations/gitlab/session-subscriptions.js.map +1 -0
- package/dist/integrations/gitlab/subscriptions.d.ts +70 -0
- package/dist/integrations/gitlab/subscriptions.d.ts.map +1 -0
- package/dist/integrations/gitlab/subscriptions.js +76 -0
- package/dist/integrations/gitlab/subscriptions.js.map +1 -0
- package/dist/integrations/gitlab/version-control.d.ts +16 -0
- package/dist/integrations/gitlab/version-control.d.ts.map +1 -0
- package/dist/integrations/gitlab/version-control.js +621 -0
- package/dist/integrations/gitlab/version-control.js.map +1 -0
- package/dist/integrations/gitlab/webhook-dispatch.d.ts +75 -0
- package/dist/integrations/gitlab/webhook-dispatch.d.ts.map +1 -0
- package/dist/integrations/gitlab/webhook-dispatch.js +235 -0
- package/dist/integrations/gitlab/webhook-dispatch.js.map +1 -0
- package/dist/integrations/gitlab/webhook.d.ts +72 -0
- package/dist/integrations/gitlab/webhook.d.ts.map +1 -0
- package/dist/integrations/gitlab/webhook.js +201 -0
- package/dist/integrations/gitlab/webhook.js.map +1 -0
- package/dist/integrations/incidentio/agent-tools.d.ts +49 -0
- package/dist/integrations/incidentio/agent-tools.d.ts.map +1 -0
- package/dist/integrations/incidentio/agent-tools.js +90 -0
- package/dist/integrations/incidentio/agent-tools.js.map +1 -0
- package/dist/integrations/incidentio/api.d.ts +400 -0
- package/dist/integrations/incidentio/api.d.ts.map +1 -0
- package/dist/integrations/incidentio/api.js +192 -0
- package/dist/integrations/incidentio/api.js.map +1 -0
- package/dist/integrations/incidentio/claim.d.ts +8 -0
- package/dist/integrations/incidentio/claim.d.ts.map +1 -0
- package/dist/integrations/incidentio/claim.js +14 -0
- package/dist/integrations/incidentio/claim.js.map +1 -0
- package/dist/integrations/incidentio/default-rules.d.ts +46 -0
- package/dist/integrations/incidentio/default-rules.d.ts.map +1 -0
- package/dist/integrations/incidentio/default-rules.js +68 -0
- package/dist/integrations/incidentio/default-rules.js.map +1 -0
- package/dist/integrations/incidentio/intake.d.ts +10 -0
- package/dist/integrations/incidentio/intake.d.ts.map +1 -0
- package/dist/integrations/incidentio/intake.js +307 -0
- package/dist/integrations/incidentio/intake.js.map +1 -0
- package/dist/integrations/incidentio/integration.d.ts +63 -0
- package/dist/integrations/incidentio/integration.d.ts.map +1 -0
- package/dist/integrations/incidentio/integration.js +141 -0
- package/dist/integrations/incidentio/integration.js.map +1 -0
- package/dist/integrations/incidentio/issue-reconciler.d.ts +10 -0
- package/dist/integrations/incidentio/issue-reconciler.d.ts.map +1 -0
- package/dist/integrations/incidentio/issue-reconciler.js +75 -0
- package/dist/integrations/incidentio/issue-reconciler.js.map +1 -0
- package/dist/integrations/incidentio/reconciliation-config.d.ts +3 -0
- package/dist/integrations/incidentio/reconciliation-config.d.ts.map +1 -0
- package/dist/integrations/incidentio/reconciliation-config.js +17 -0
- package/dist/integrations/incidentio/reconciliation-config.js.map +1 -0
- package/dist/integrations/incidentio/routes.d.ts +76 -0
- package/dist/integrations/incidentio/routes.d.ts.map +1 -0
- package/dist/integrations/incidentio/routes.js +249 -0
- package/dist/integrations/incidentio/routes.js.map +1 -0
- package/dist/integrations/incidentio/rules.d.ts +55 -0
- package/dist/integrations/incidentio/rules.d.ts.map +1 -0
- package/dist/integrations/incidentio/rules.js +189 -0
- package/dist/integrations/incidentio/rules.js.map +1 -0
- package/dist/integrations/issue-reconcile-worker.d.ts +19 -0
- package/dist/integrations/issue-reconcile-worker.d.ts.map +1 -0
- package/dist/integrations/issue-reconcile-worker.js +97 -0
- package/dist/integrations/issue-reconcile-worker.js.map +1 -0
- package/dist/integrations/issue-reconciler.d.ts +51 -0
- package/dist/integrations/issue-reconciler.d.ts.map +1 -0
- package/dist/integrations/issue-reconciler.js +158 -0
- package/dist/integrations/issue-reconciler.js.map +1 -0
- package/dist/integrations/jira/adf.d.ts +26 -0
- package/dist/integrations/jira/adf.d.ts.map +1 -0
- package/dist/integrations/jira/adf.js +73 -0
- package/dist/integrations/jira/adf.js.map +1 -0
- package/dist/integrations/jira/agent-tools.d.ts +45 -0
- package/dist/integrations/jira/agent-tools.d.ts.map +1 -0
- package/dist/integrations/jira/agent-tools.js +87 -0
- package/dist/integrations/jira/agent-tools.js.map +1 -0
- package/dist/integrations/jira/api.d.ts +157 -0
- package/dist/integrations/jira/api.d.ts.map +1 -0
- package/dist/integrations/jira/api.js +141 -0
- package/dist/integrations/jira/api.js.map +1 -0
- package/dist/integrations/jira/claim.d.ts +9 -0
- package/dist/integrations/jira/claim.d.ts.map +1 -0
- package/dist/integrations/jira/claim.js +15 -0
- package/dist/integrations/jira/claim.js.map +1 -0
- package/dist/integrations/jira/default-rules.d.ts +47 -0
- package/dist/integrations/jira/default-rules.d.ts.map +1 -0
- package/dist/integrations/jira/default-rules.js +69 -0
- package/dist/integrations/jira/default-rules.js.map +1 -0
- package/dist/integrations/jira/integration.d.ts +114 -0
- package/dist/integrations/jira/integration.d.ts.map +1 -0
- package/dist/integrations/jira/integration.js +407 -0
- package/dist/integrations/jira/integration.js.map +1 -0
- package/dist/integrations/jira/issue-reconciler.d.ts +10 -0
- package/dist/integrations/jira/issue-reconciler.d.ts.map +1 -0
- package/dist/integrations/jira/issue-reconciler.js +70 -0
- package/dist/integrations/jira/issue-reconciler.js.map +1 -0
- package/dist/integrations/jira/reconciliation-config.d.ts +3 -0
- package/dist/integrations/jira/reconciliation-config.d.ts.map +1 -0
- package/dist/integrations/jira/reconciliation-config.js +17 -0
- package/dist/integrations/jira/reconciliation-config.js.map +1 -0
- package/dist/integrations/jira/routes.d.ts +54 -0
- package/dist/integrations/jira/routes.d.ts.map +1 -0
- package/dist/integrations/jira/routes.js +260 -0
- package/dist/integrations/jira/routes.js.map +1 -0
- package/dist/integrations/jira/rules.d.ts +57 -0
- package/dist/integrations/jira/rules.d.ts.map +1 -0
- package/dist/integrations/jira/rules.js +189 -0
- package/dist/integrations/jira/rules.js.map +1 -0
- package/dist/integrations/linear/agent-tools.d.ts +34 -0
- package/dist/integrations/linear/agent-tools.d.ts.map +1 -0
- package/dist/integrations/linear/agent-tools.js +87 -0
- package/dist/integrations/linear/agent-tools.js.map +1 -0
- package/dist/integrations/linear/claim.d.ts +8 -0
- package/dist/integrations/linear/claim.d.ts.map +1 -0
- package/dist/integrations/linear/claim.js +14 -0
- package/dist/integrations/linear/claim.js.map +1 -0
- package/dist/integrations/linear/default-rules.d.ts +46 -0
- package/dist/integrations/linear/default-rules.d.ts.map +1 -0
- package/dist/integrations/linear/default-rules.js +70 -0
- package/dist/integrations/linear/default-rules.js.map +1 -0
- package/dist/integrations/linear/integration.d.ts +260 -0
- package/dist/integrations/linear/integration.d.ts.map +1 -0
- package/dist/integrations/linear/integration.js +900 -0
- package/dist/integrations/linear/integration.js.map +1 -0
- package/dist/integrations/linear/issue-reconciler.d.ts +8 -0
- package/dist/integrations/linear/issue-reconciler.d.ts.map +1 -0
- package/dist/integrations/linear/issue-reconciler.js +73 -0
- package/dist/integrations/linear/issue-reconciler.js.map +1 -0
- package/dist/integrations/linear/reconciliation-config.d.ts +3 -0
- package/dist/integrations/linear/reconciliation-config.d.ts.map +1 -0
- package/dist/integrations/linear/reconciliation-config.js +21 -0
- package/dist/integrations/linear/reconciliation-config.js.map +1 -0
- package/dist/integrations/linear/routes.d.ts +81 -0
- package/dist/integrations/linear/routes.d.ts.map +1 -0
- package/dist/integrations/linear/routes.js +380 -0
- package/dist/integrations/linear/routes.js.map +1 -0
- package/dist/integrations/linear/rules.d.ts +54 -0
- package/dist/integrations/linear/rules.d.ts.map +1 -0
- package/dist/integrations/linear/rules.js +189 -0
- package/dist/integrations/linear/rules.js.map +1 -0
- package/dist/integrations/linear/storage.d.ts +65 -0
- package/dist/integrations/linear/storage.d.ts.map +1 -0
- package/dist/integrations/linear/storage.js +1 -0
- package/dist/integrations/platform/api-client.d.ts +26 -0
- package/dist/integrations/platform/api-client.d.ts.map +1 -0
- package/dist/integrations/platform/api-client.js +177 -0
- package/dist/integrations/platform/api-client.js.map +1 -0
- package/dist/integrations/platform/connect/routes.d.ts +39 -0
- package/dist/integrations/platform/connect/routes.d.ts.map +1 -0
- package/dist/integrations/platform/connect/routes.js +133 -0
- package/dist/integrations/platform/connect/routes.js.map +1 -0
- package/dist/integrations/platform/github/event-worker.d.ts +58 -0
- package/dist/integrations/platform/github/event-worker.d.ts.map +1 -0
- package/dist/integrations/platform/github/event-worker.js +449 -0
- package/dist/integrations/platform/github/event-worker.js.map +1 -0
- package/dist/integrations/platform/github/integration.d.ts +89 -0
- package/dist/integrations/platform/github/integration.d.ts.map +1 -0
- package/dist/integrations/platform/github/integration.js +1266 -0
- package/dist/integrations/platform/github/integration.js.map +1 -0
- package/dist/integrations/platform/gitlab/event-worker.d.ts +64 -0
- package/dist/integrations/platform/gitlab/event-worker.d.ts.map +1 -0
- package/dist/integrations/platform/gitlab/event-worker.js +305 -0
- package/dist/integrations/platform/gitlab/event-worker.js.map +1 -0
- package/dist/integrations/platform/gitlab/integration.d.ts +57 -0
- package/dist/integrations/platform/gitlab/integration.d.ts.map +1 -0
- package/dist/integrations/platform/gitlab/integration.js +113 -0
- package/dist/integrations/platform/gitlab/integration.js.map +1 -0
- package/dist/integrations/platform/incidentio/integration.d.ts +74 -0
- package/dist/integrations/platform/incidentio/integration.d.ts.map +1 -0
- package/dist/integrations/platform/incidentio/integration.js +406 -0
- package/dist/integrations/platform/incidentio/integration.js.map +1 -0
- package/dist/integrations/platform/jira/agent-tools.d.ts +36 -0
- package/dist/integrations/platform/jira/agent-tools.d.ts.map +1 -0
- package/dist/integrations/platform/jira/agent-tools.js +85 -0
- package/dist/integrations/platform/jira/agent-tools.js.map +1 -0
- package/dist/integrations/platform/jira/integration.d.ts +65 -0
- package/dist/integrations/platform/jira/integration.d.ts.map +1 -0
- package/dist/integrations/platform/jira/integration.js +546 -0
- package/dist/integrations/platform/jira/integration.js.map +1 -0
- package/dist/integrations/platform/jira/routes.d.ts +55 -0
- package/dist/integrations/platform/jira/routes.d.ts.map +1 -0
- package/dist/integrations/platform/jira/routes.js +274 -0
- package/dist/integrations/platform/jira/routes.js.map +1 -0
- package/dist/integrations/platform/linear/event-worker.d.ts +105 -0
- package/dist/integrations/platform/linear/event-worker.d.ts.map +1 -0
- package/dist/integrations/platform/linear/event-worker.js +379 -0
- package/dist/integrations/platform/linear/event-worker.js.map +1 -0
- package/dist/integrations/platform/linear/integration.d.ts +92 -0
- package/dist/integrations/platform/linear/integration.d.ts.map +1 -0
- package/dist/integrations/platform/linear/integration.js +754 -0
- package/dist/integrations/platform/linear/integration.js.map +1 -0
- package/dist/integrations/pull-request-head.d.ts +18 -0
- package/dist/integrations/pull-request-head.d.ts.map +1 -0
- package/dist/integrations/pull-request-head.js +45 -0
- package/dist/integrations/pull-request-head.js.map +1 -0
- package/dist/integrations/reconciliation-config.d.ts +3 -0
- package/dist/integrations/reconciliation-config.d.ts.map +1 -0
- package/dist/integrations/reconciliation-config.js +16 -0
- package/dist/integrations/reconciliation-config.js.map +1 -0
- package/dist/integrations/slack/connect-route.d.ts +46 -0
- package/dist/integrations/slack/connect-route.d.ts.map +1 -0
- package/dist/integrations/slack/connect-route.js +186 -0
- package/dist/integrations/slack/connect-route.js.map +1 -0
- package/dist/integrations/slack/emoji-shortcodes.generated.d.ts +8 -0
- package/dist/integrations/slack/emoji-shortcodes.generated.d.ts.map +1 -0
- package/dist/integrations/slack/emoji-shortcodes.generated.js +1985 -0
- package/dist/integrations/slack/emoji-shortcodes.generated.js.map +1 -0
- package/dist/integrations/slack/emoji.d.ts +3 -0
- package/dist/integrations/slack/emoji.d.ts.map +1 -0
- package/dist/integrations/slack/emoji.js +12 -0
- package/dist/integrations/slack/emoji.js.map +1 -0
- package/dist/integrations/slack/feed-publisher.d.ts +26 -0
- package/dist/integrations/slack/feed-publisher.d.ts.map +1 -0
- package/dist/integrations/slack/feed-publisher.js +44 -0
- package/dist/integrations/slack/feed-publisher.js.map +1 -0
- package/dist/integrations/slack/integration.d.ts +80 -0
- package/dist/integrations/slack/integration.d.ts.map +1 -0
- package/dist/integrations/slack/integration.js +93 -0
- package/dist/integrations/slack/integration.js.map +1 -0
- package/dist/integrations/slack/slack.d.ts +205 -0
- package/dist/integrations/slack/slack.d.ts.map +1 -0
- package/dist/integrations/slack/slack.js +653 -0
- package/dist/integrations/slack/slack.js.map +1 -0
- package/dist/integrations/subscription-session.d.ts +49 -0
- package/dist/integrations/subscription-session.d.ts.map +1 -0
- package/dist/integrations/subscription-session.js +103 -0
- package/dist/integrations/subscription-session.js.map +1 -0
- package/dist/integrations/workos/integration.d.ts +39 -0
- package/dist/integrations/workos/integration.d.ts.map +1 -0
- package/dist/integrations/workos/integration.js +91 -0
- package/dist/integrations/workos/integration.js.map +1 -0
- package/dist/packages/_internals/workspace/dist/index.js +48 -0
- package/dist/packages/_internals/workspace/dist/index.js.map +1 -0
- package/dist/platform-auth-host.d.ts +4 -0
- package/dist/platform-auth-host.d.ts.map +1 -0
- package/dist/platform-auth-host.js +18 -0
- package/dist/platform-auth-host.js.map +1 -0
- package/dist/review-verdict.d.ts +6 -0
- package/dist/review-verdict.d.ts.map +1 -0
- package/dist/review-verdict.js +14 -0
- package/dist/review-verdict.js.map +1 -0
- package/dist/routes/attention-activity.d.ts +23 -0
- package/dist/routes/attention-activity.d.ts.map +1 -0
- package/dist/routes/attention-activity.js +152 -0
- package/dist/routes/attention-activity.js.map +1 -0
- package/dist/routes/attention-parked.d.ts +22 -0
- package/dist/routes/attention-parked.d.ts.map +1 -0
- package/dist/routes/attention-parked.js +136 -0
- package/dist/routes/attention-parked.js.map +1 -0
- package/dist/routes/attention-proposed.d.ts +3 -0
- package/dist/routes/attention-proposed.d.ts.map +1 -0
- package/dist/routes/attention-proposed.js +21 -0
- package/dist/routes/attention-proposed.js.map +1 -0
- package/dist/routes/attention-providers.d.ts +159 -0
- package/dist/routes/attention-providers.d.ts.map +1 -0
- package/dist/routes/attention-providers.js +524 -0
- package/dist/routes/attention-providers.js.map +1 -0
- package/dist/routes/attention.d.ts +23 -0
- package/dist/routes/attention.d.ts.map +1 -0
- package/dist/routes/attention.js +219 -0
- package/dist/routes/attention.js.map +1 -0
- package/dist/routes/automation-runs.d.ts +37 -0
- package/dist/routes/automation-runs.d.ts.map +1 -0
- package/dist/routes/automation-runs.js +196 -0
- package/dist/routes/automation-runs.js.map +1 -0
- package/dist/routes/config.d.ts +238 -0
- package/dist/routes/config.d.ts.map +1 -0
- package/dist/routes/config.js +1011 -0
- package/dist/routes/config.js.map +1 -0
- package/dist/routes/contracts.d.ts +1080 -0
- package/dist/routes/contracts.d.ts.map +1 -0
- package/dist/routes/contracts.js +673 -0
- package/dist/routes/contracts.js.map +1 -0
- package/dist/routes/custom-provider-source.d.ts +52 -0
- package/dist/routes/custom-provider-source.d.ts.map +1 -0
- package/dist/routes/custom-provider-source.js +124 -0
- package/dist/routes/custom-provider-source.js.map +1 -0
- package/dist/routes/fs.d.ts +189 -0
- package/dist/routes/fs.d.ts.map +1 -0
- package/dist/routes/fs.js +916 -0
- package/dist/routes/fs.js.map +1 -0
- package/dist/routes/intake.d.ts +64 -0
- package/dist/routes/intake.d.ts.map +1 -0
- package/dist/routes/intake.js +627 -0
- package/dist/routes/intake.js.map +1 -0
- package/dist/routes/knowledge.d.ts +247 -0
- package/dist/routes/knowledge.d.ts.map +1 -0
- package/dist/routes/knowledge.js +1128 -0
- package/dist/routes/knowledge.js.map +1 -0
- package/dist/routes/oauth.d.ts +43 -0
- package/dist/routes/oauth.d.ts.map +1 -0
- package/dist/routes/oauth.js +477 -0
- package/dist/routes/oauth.js.map +1 -0
- package/dist/routes/projects.d.ts +68 -0
- package/dist/routes/projects.d.ts.map +1 -0
- package/dist/routes/projects.js +919 -0
- package/dist/routes/projects.js.map +1 -0
- package/dist/routes/provider-credentials.d.ts +82 -0
- package/dist/routes/provider-credentials.d.ts.map +1 -0
- package/dist/routes/provider-credentials.js +80 -0
- package/dist/routes/provider-credentials.js.map +1 -0
- package/dist/routes/route.d.ts +48 -0
- package/dist/routes/route.d.ts.map +1 -0
- package/dist/routes/route.js +15 -0
- package/dist/routes/route.js.map +1 -0
- package/dist/routes/skills.d.ts +30 -0
- package/dist/routes/skills.d.ts.map +1 -0
- package/dist/routes/skills.js +198 -0
- package/dist/routes/skills.js.map +1 -0
- package/dist/routes/source-control-sessions.d.ts +22 -0
- package/dist/routes/source-control-sessions.d.ts.map +1 -0
- package/dist/routes/source-control-sessions.js +356 -0
- package/dist/routes/source-control-sessions.js.map +1 -0
- package/dist/routes/source-control-settings.d.ts +10 -0
- package/dist/routes/source-control-settings.d.ts.map +1 -0
- package/dist/routes/source-control-settings.js +87 -0
- package/dist/routes/source-control-settings.js.map +1 -0
- package/dist/routes/supervisor.d.ts +25 -0
- package/dist/routes/supervisor.d.ts.map +1 -0
- package/dist/routes/supervisor.js +35 -0
- package/dist/routes/supervisor.js.map +1 -0
- package/dist/routes/surface.d.ts +133 -0
- package/dist/routes/surface.d.ts.map +1 -0
- package/dist/routes/surface.js +518 -0
- package/dist/routes/surface.js.map +1 -0
- package/dist/routes/telemetry.d.ts +13 -0
- package/dist/routes/telemetry.d.ts.map +1 -0
- package/dist/routes/telemetry.js +60 -0
- package/dist/routes/telemetry.js.map +1 -0
- package/dist/routes/tenant-credentials.d.ts +87 -0
- package/dist/routes/tenant-credentials.d.ts.map +1 -0
- package/dist/routes/tenant-credentials.js +219 -0
- package/dist/routes/tenant-credentials.js.map +1 -0
- package/dist/routes/work-items.d.ts +49 -0
- package/dist/routes/work-items.d.ts.map +1 -0
- package/dist/routes/work-items.js +633 -0
- package/dist/routes/work-items.js.map +1 -0
- package/dist/rules/binding-context.d.ts +59 -0
- package/dist/rules/binding-context.d.ts.map +1 -0
- package/dist/rules/binding-context.js +134 -0
- package/dist/rules/binding-context.js.map +1 -0
- package/dist/rules/decision-applicability.d.ts +32 -0
- package/dist/rules/decision-applicability.d.ts.map +1 -0
- package/dist/rules/decision-applicability.js +56 -0
- package/dist/rules/decision-applicability.js.map +1 -0
- package/dist/rules/dispatch-errors.d.ts +13 -0
- package/dist/rules/dispatch-errors.d.ts.map +1 -0
- package/dist/rules/dispatch-errors.js +105 -0
- package/dist/rules/dispatch-errors.js.map +1 -0
- package/dist/rules/dispatcher.d.ts +86 -0
- package/dist/rules/dispatcher.d.ts.map +1 -0
- package/dist/rules/dispatcher.js +1159 -0
- package/dist/rules/dispatcher.js.map +1 -0
- package/dist/rules/event-rules.d.ts +23 -0
- package/dist/rules/event-rules.d.ts.map +1 -0
- package/dist/rules/event-rules.js +46 -0
- package/dist/rules/event-rules.js.map +1 -0
- package/dist/rules/index.d.ts +6 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +4 -0
- package/dist/rules/processor.d.ts +90 -0
- package/dist/rules/processor.d.ts.map +1 -0
- package/dist/rules/processor.js +486 -0
- package/dist/rules/processor.js.map +1 -0
- package/dist/rules/resolve.d.ts +15 -0
- package/dist/rules/resolve.d.ts.map +1 -0
- package/dist/rules/resolve.js +23 -0
- package/dist/rules/resolve.js.map +1 -0
- package/dist/rules/review-source-tool.d.ts +105 -0
- package/dist/rules/review-source-tool.d.ts.map +1 -0
- package/dist/rules/review-source-tool.js +109 -0
- package/dist/rules/review-source-tool.js.map +1 -0
- package/dist/rules/start-coordinator.d.ts +64 -0
- package/dist/rules/start-coordinator.d.ts.map +1 -0
- package/dist/rules/start-coordinator.js +246 -0
- package/dist/rules/start-coordinator.js.map +1 -0
- package/dist/rules/terminal-cleanup.d.ts +38 -0
- package/dist/rules/terminal-cleanup.d.ts.map +1 -0
- package/dist/rules/terminal-cleanup.js +68 -0
- package/dist/rules/terminal-cleanup.js.map +1 -0
- package/dist/rules/tools.d.ts +15 -0
- package/dist/rules/tools.d.ts.map +1 -0
- package/dist/rules/tools.js +185 -0
- package/dist/rules/tools.js.map +1 -0
- package/dist/rules/transition-service.d.ts +93 -0
- package/dist/rules/transition-service.d.ts.map +1 -0
- package/dist/rules/transition-service.js +402 -0
- package/dist/rules/transition-service.js.map +1 -0
- package/dist/rules/types.d.ts +553 -0
- package/dist/rules/types.d.ts.map +1 -0
- package/dist/rules/types.js +154 -0
- package/dist/rules/types.js.map +1 -0
- package/dist/rules/validation.d.ts +21 -0
- package/dist/rules/validation.d.ts.map +1 -0
- package/dist/rules/validation.js +327 -0
- package/dist/rules/validation.js.map +1 -0
- package/dist/sandbox/callback-factory-sandbox.d.ts +15 -0
- package/dist/sandbox/callback-factory-sandbox.d.ts.map +1 -0
- package/dist/sandbox/callback-factory-sandbox.js +22 -0
- package/dist/sandbox/callback-factory-sandbox.js.map +1 -0
- package/dist/sandbox/git-ref.d.ts +7 -0
- package/dist/sandbox/git-ref.d.ts.map +1 -0
- package/dist/sandbox/git-ref.js +15 -0
- package/dist/sandbox/git-ref.js.map +1 -0
- package/dist/sandbox/local-factory-sandbox.d.ts +20 -0
- package/dist/sandbox/local-factory-sandbox.d.ts.map +1 -0
- package/dist/sandbox/local-factory-sandbox.js +27 -0
- package/dist/sandbox/local-factory-sandbox.js.map +1 -0
- package/dist/sandbox/materialization.d.ts +41 -0
- package/dist/sandbox/materialization.d.ts.map +1 -0
- package/dist/sandbox/materialization.js +18 -0
- package/dist/sandbox/materialization.js.map +1 -0
- package/dist/sandbox/session-retirement.d.ts +45 -0
- package/dist/sandbox/session-retirement.d.ts.map +1 -0
- package/dist/sandbox/session-retirement.js +153 -0
- package/dist/sandbox/session-retirement.js.map +1 -0
- package/dist/sandbox/session-sandbox.d.ts +185 -0
- package/dist/sandbox/session-sandbox.d.ts.map +1 -0
- package/dist/sandbox/session-sandbox.js +248 -0
- package/dist/sandbox/session-sandbox.js.map +1 -0
- package/dist/sandbox/workdir.d.ts +45 -0
- package/dist/sandbox/workdir.d.ts.map +1 -0
- package/dist/sandbox/workdir.js +64 -0
- package/dist/sandbox/workdir.js.map +1 -0
- package/dist/secret-encryption.d.ts +25 -0
- package/dist/secret-encryption.d.ts.map +1 -0
- package/dist/secret-encryption.js +107 -0
- package/dist/secret-encryption.js.map +1 -0
- package/dist/server-error.d.ts +12 -0
- package/dist/server-error.d.ts.map +1 -0
- package/dist/server-error.js +16 -0
- package/dist/server-error.js.map +1 -0
- package/dist/session/credential-policy.d.ts +20 -0
- package/dist/session/credential-policy.d.ts.map +1 -0
- package/dist/session/credential-policy.js +70 -0
- package/dist/session/credential-policy.js.map +1 -0
- package/dist/session/default-model-hydration.d.ts +46 -0
- package/dist/session/default-model-hydration.d.ts.map +1 -0
- package/dist/session/default-model-hydration.js +85 -0
- package/dist/session/default-model-hydration.js.map +1 -0
- package/dist/session/environment-repositories.d.ts +31 -0
- package/dist/session/environment-repositories.d.ts.map +1 -0
- package/dist/session/environment-repositories.js +89 -0
- package/dist/session/environment-repositories.js.map +1 -0
- package/dist/session/environment-state-processor.d.ts +59 -0
- package/dist/session/environment-state-processor.d.ts.map +1 -0
- package/dist/session/environment-state-processor.js +105 -0
- package/dist/session/environment-state-processor.js.map +1 -0
- package/dist/session/factory-session.d.ts +159 -0
- package/dist/session/factory-session.d.ts.map +1 -0
- package/dist/session/factory-session.js +226 -0
- package/dist/session/factory-session.js.map +1 -0
- package/dist/session/filesystem-capture.d.ts +50 -0
- package/dist/session/filesystem-capture.d.ts.map +1 -0
- package/dist/session/filesystem-capture.js +231 -0
- package/dist/session/filesystem-capture.js.map +1 -0
- package/dist/session/first-exec-capture.d.ts +38 -0
- package/dist/session/first-exec-capture.d.ts.map +1 -0
- package/dist/session/first-exec-capture.js +91 -0
- package/dist/session/first-exec-capture.js.map +1 -0
- package/dist/session/first-message-capture.d.ts +33 -0
- package/dist/session/first-message-capture.d.ts.map +1 -0
- package/dist/session/first-message-capture.js +35 -0
- package/dist/session/first-message-capture.js.map +1 -0
- package/dist/session/live-sessions.d.ts +63 -0
- package/dist/session/live-sessions.d.ts.map +1 -0
- package/dist/session/live-sessions.js +90 -0
- package/dist/session/live-sessions.js.map +1 -0
- package/dist/session/memory-settings-hydration.d.ts +36 -0
- package/dist/session/memory-settings-hydration.d.ts.map +1 -0
- package/dist/session/memory-settings-hydration.js +43 -0
- package/dist/session/memory-settings-hydration.js.map +1 -0
- package/dist/session/org-seed.d.ts +67 -0
- package/dist/session/org-seed.d.ts.map +1 -0
- package/dist/session/org-seed.js +53 -0
- package/dist/session/org-seed.js.map +1 -0
- package/dist/session/run-audit.d.ts +54 -0
- package/dist/session/run-audit.d.ts.map +1 -0
- package/dist/session/run-audit.js +124 -0
- package/dist/session/run-audit.js.map +1 -0
- package/dist/session/session-title.d.ts +7 -0
- package/dist/session/session-title.d.ts.map +1 -0
- package/dist/session/session-title.js +14 -0
- package/dist/session/session-title.js.map +1 -0
- package/dist/session/shell-commands.d.ts +5 -0
- package/dist/session/shell-commands.d.ts.map +1 -0
- package/dist/session/shell-commands.js +25 -0
- package/dist/session/shell-commands.js.map +1 -0
- package/dist/session/source-control-tools.d.ts +25 -0
- package/dist/session/source-control-tools.d.ts.map +1 -0
- package/dist/session/source-control-tools.js +594 -0
- package/dist/session/source-control-tools.js.map +1 -0
- package/dist/session/thread-title-mirror.d.ts +35 -0
- package/dist/session/thread-title-mirror.d.ts.map +1 -0
- package/dist/session/thread-title-mirror.js +51 -0
- package/dist/session/thread-title-mirror.js.map +1 -0
- package/dist/session/work-item-repository.d.ts +21 -0
- package/dist/session/work-item-repository.d.ts.map +1 -0
- package/dist/session/work-item-repository.js +113 -0
- package/dist/session/work-item-repository.js.map +1 -0
- package/dist/skills/catalog.d.ts +14 -0
- package/dist/skills/catalog.d.ts.map +1 -0
- package/dist/skills/catalog.js +62 -0
- package/dist/skills/catalog.js.map +1 -0
- package/dist/skills/service.d.ts +70 -0
- package/dist/skills/service.d.ts.map +1 -0
- package/dist/skills/service.js +88 -0
- package/dist/skills/service.js.map +1 -0
- package/dist/spa-static.d.ts +33 -0
- package/dist/spa-static.d.ts.map +1 -0
- package/dist/spa-static.js +104 -0
- package/dist/spa-static.js.map +1 -0
- package/dist/state-signing.d.ts +59 -0
- package/dist/state-signing.d.ts.map +1 -0
- package/dist/state-signing.js +83 -0
- package/dist/state-signing.js.map +1 -0
- package/dist/storage/domains/audit/actions.d.ts +24 -0
- package/dist/storage/domains/audit/actions.d.ts.map +1 -0
- package/dist/storage/domains/audit/actions.js +69 -0
- package/dist/storage/domains/audit/actions.js.map +1 -0
- package/dist/storage/domains/audit/actors.d.ts +5 -0
- package/dist/storage/domains/audit/actors.d.ts.map +1 -0
- package/dist/storage/domains/audit/actors.js +25 -0
- package/dist/storage/domains/audit/actors.js.map +1 -0
- package/dist/storage/domains/audit/agent-audit.d.ts +30 -0
- package/dist/storage/domains/audit/agent-audit.d.ts.map +1 -0
- package/dist/storage/domains/audit/agent-audit.js +93 -0
- package/dist/storage/domains/audit/agent-audit.js.map +1 -0
- package/dist/storage/domains/audit/base.d.ts +133 -0
- package/dist/storage/domains/audit/base.d.ts.map +1 -0
- package/dist/storage/domains/audit/base.js +206 -0
- package/dist/storage/domains/audit/base.js.map +1 -0
- package/dist/storage/domains/audit/domain.d.ts +79 -0
- package/dist/storage/domains/audit/domain.d.ts.map +1 -0
- package/dist/storage/domains/audit/domain.js +248 -0
- package/dist/storage/domains/audit/domain.js.map +1 -0
- package/dist/storage/domains/audit/wire.d.ts +24 -0
- package/dist/storage/domains/audit/wire.d.ts.map +1 -0
- package/dist/storage/domains/audit/wire.js +16 -0
- package/dist/storage/domains/audit/wire.js.map +1 -0
- package/dist/storage/domains/channel-identity/base.d.ts +100 -0
- package/dist/storage/domains/channel-identity/base.d.ts.map +1 -0
- package/dist/storage/domains/channel-identity/base.js +164 -0
- package/dist/storage/domains/channel-identity/base.js.map +1 -0
- package/dist/storage/domains/comments/activity.d.ts +40 -0
- package/dist/storage/domains/comments/activity.d.ts.map +1 -0
- package/dist/storage/domains/comments/activity.js +94 -0
- package/dist/storage/domains/comments/activity.js.map +1 -0
- package/dist/storage/domains/comments/actor.d.ts +51 -0
- package/dist/storage/domains/comments/actor.d.ts.map +1 -0
- package/dist/storage/domains/comments/actor.js +38 -0
- package/dist/storage/domains/comments/actor.js.map +1 -0
- package/dist/storage/domains/comments/base.d.ts +245 -0
- package/dist/storage/domains/comments/base.d.ts.map +1 -0
- package/dist/storage/domains/comments/base.js +533 -0
- package/dist/storage/domains/comments/base.js.map +1 -0
- package/dist/storage/domains/comments/domain.d.ts +135 -0
- package/dist/storage/domains/comments/domain.d.ts.map +1 -0
- package/dist/storage/domains/comments/domain.js +285 -0
- package/dist/storage/domains/comments/domain.js.map +1 -0
- package/dist/storage/domains/comments/feed-context.d.ts +22 -0
- package/dist/storage/domains/comments/feed-context.d.ts.map +1 -0
- package/dist/storage/domains/comments/feed-context.js +89 -0
- package/dist/storage/domains/comments/feed-context.js.map +1 -0
- package/dist/storage/domains/comments/feed-sync.d.ts +21 -0
- package/dist/storage/domains/comments/feed-sync.d.ts.map +1 -0
- package/dist/storage/domains/comments/feed-sync.js +1 -0
- package/dist/storage/domains/comments/parse.d.ts +23 -0
- package/dist/storage/domains/comments/parse.d.ts.map +1 -0
- package/dist/storage/domains/comments/parse.js +90 -0
- package/dist/storage/domains/comments/parse.js.map +1 -0
- package/dist/storage/domains/comments/routes.d.ts +24 -0
- package/dist/storage/domains/comments/routes.d.ts.map +1 -0
- package/dist/storage/domains/comments/routes.js +302 -0
- package/dist/storage/domains/comments/routes.js.map +1 -0
- package/dist/storage/domains/comments/schema.d.ts +5 -0
- package/dist/storage/domains/comments/schema.d.ts.map +1 -0
- package/dist/storage/domains/comments/schema.js +179 -0
- package/dist/storage/domains/comments/schema.js.map +1 -0
- package/dist/storage/domains/comments/wire.d.ts +40 -0
- package/dist/storage/domains/comments/wire.d.ts.map +1 -0
- package/dist/storage/domains/comments/wire.js +37 -0
- package/dist/storage/domains/comments/wire.js.map +1 -0
- package/dist/storage/domains/credentials/base.d.ts +136 -0
- package/dist/storage/domains/credentials/base.d.ts.map +1 -0
- package/dist/storage/domains/credentials/base.js +294 -0
- package/dist/storage/domains/credentials/base.js.map +1 -0
- package/dist/storage/domains/custom-providers/base.d.ts +59 -0
- package/dist/storage/domains/custom-providers/base.d.ts.map +1 -0
- package/dist/storage/domains/custom-providers/base.js +176 -0
- package/dist/storage/domains/custom-providers/base.js.map +1 -0
- package/dist/storage/domains/filesystem/base.d.ts +26 -0
- package/dist/storage/domains/filesystem/base.d.ts.map +1 -0
- package/dist/storage/domains/filesystem/base.js +74 -0
- package/dist/storage/domains/filesystem/base.js.map +1 -0
- package/dist/storage/domains/intake/base.d.ts +150 -0
- package/dist/storage/domains/intake/base.d.ts.map +1 -0
- package/dist/storage/domains/intake/base.js +431 -0
- package/dist/storage/domains/intake/base.js.map +1 -0
- package/dist/storage/domains/integrations/base.d.ts +128 -0
- package/dist/storage/domains/integrations/base.d.ts.map +1 -0
- package/dist/storage/domains/integrations/base.js +333 -0
- package/dist/storage/domains/integrations/base.js.map +1 -0
- package/dist/storage/domains/memory-settings/base.d.ts +58 -0
- package/dist/storage/domains/memory-settings/base.d.ts.map +1 -0
- package/dist/storage/domains/memory-settings/base.js +129 -0
- package/dist/storage/domains/memory-settings/base.js.map +1 -0
- package/dist/storage/domains/model-defaults/base.d.ts +29 -0
- package/dist/storage/domains/model-defaults/base.d.ts.map +1 -0
- package/dist/storage/domains/model-defaults/base.js +79 -0
- package/dist/storage/domains/model-defaults/base.js.map +1 -0
- package/dist/storage/domains/projects/base.d.ts +191 -0
- package/dist/storage/domains/projects/base.d.ts.map +1 -0
- package/dist/storage/domains/projects/base.js +352 -0
- package/dist/storage/domains/projects/base.js.map +1 -0
- package/dist/storage/domains/queue-health/base.d.ts +52 -0
- package/dist/storage/domains/queue-health/base.d.ts.map +1 -0
- package/dist/storage/domains/queue-health/base.js +122 -0
- package/dist/storage/domains/queue-health/base.js.map +1 -0
- package/dist/storage/domains/source-control/base.d.ts +422 -0
- package/dist/storage/domains/source-control/base.d.ts.map +1 -0
- package/dist/storage/domains/source-control/base.js +1114 -0
- package/dist/storage/domains/source-control/base.js.map +1 -0
- package/dist/storage/domains/source-control/inmemory.d.ts +147 -0
- package/dist/storage/domains/source-control/inmemory.d.ts.map +1 -0
- package/dist/storage/domains/source-control/inmemory.js +416 -0
- package/dist/storage/domains/source-control/inmemory.js.map +1 -0
- package/dist/storage/domains/work-items/base.d.ts +794 -0
- package/dist/storage/domains/work-items/base.d.ts.map +1 -0
- package/dist/storage/domains/work-items/base.js +2747 -0
- package/dist/storage/domains/work-items/base.js.map +1 -0
- package/dist/storage/domains/work-items/board-version.d.ts +26 -0
- package/dist/storage/domains/work-items/board-version.d.ts.map +1 -0
- package/dist/storage/domains/work-items/board-version.js +110 -0
- package/dist/storage/domains/work-items/board-version.js.map +1 -0
- package/dist/storage/domains/work-items/metrics.d.ts +97 -0
- package/dist/storage/domains/work-items/metrics.d.ts.map +1 -0
- package/dist/storage/domains/work-items/metrics.js +226 -0
- package/dist/storage/domains/work-items/metrics.js.map +1 -0
- package/dist/supervisor/health-worker.d.ts +19 -0
- package/dist/supervisor/health-worker.d.ts.map +1 -0
- package/dist/supervisor/health-worker.js +74 -0
- package/dist/supervisor/health-worker.js.map +1 -0
- package/dist/supervisor/health.d.ts +79 -0
- package/dist/supervisor/health.d.ts.map +1 -0
- package/dist/supervisor/health.js +228 -0
- package/dist/supervisor/health.js.map +1 -0
- package/dist/supervisor/instructions.d.ts +6 -0
- package/dist/supervisor/instructions.d.ts.map +1 -0
- package/dist/supervisor/instructions.js +66 -0
- package/dist/supervisor/instructions.js.map +1 -0
- package/dist/supervisor/read-tools.d.ts +43 -0
- package/dist/supervisor/read-tools.d.ts.map +1 -0
- package/dist/supervisor/read-tools.js +343 -0
- package/dist/supervisor/read-tools.js.map +1 -0
- package/dist/supervisor/session-messaging.d.ts +26 -0
- package/dist/supervisor/session-messaging.d.ts.map +1 -0
- package/dist/supervisor/session-messaging.js +21 -0
- package/dist/supervisor/session-messaging.js.map +1 -0
- package/dist/supervisor/session.d.ts +38 -0
- package/dist/supervisor/session.d.ts.map +1 -0
- package/dist/supervisor/session.js +79 -0
- package/dist/supervisor/session.js.map +1 -0
- package/dist/supervisor/write-tools.d.ts +30 -0
- package/dist/supervisor/write-tools.d.ts.map +1 -0
- package/dist/supervisor/write-tools.js +231 -0
- package/dist/supervisor/write-tools.js.map +1 -0
- package/dist/telemetry-types.d.ts +7 -0
- package/dist/telemetry-types.d.ts.map +1 -0
- package/dist/telemetry-types.js +24 -0
- package/dist/telemetry-types.js.map +1 -0
- package/dist/telemetry.d.ts +9 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +47 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/timing.d.ts +15 -0
- package/dist/timing.d.ts.map +1 -0
- package/dist/timing.js +34 -0
- package/dist/timing.js.map +1 -0
- package/dist/work-item-branch.d.ts +33 -0
- package/dist/work-item-branch.d.ts.map +1 -0
- package/dist/work-item-branch.js +70 -0
- package/dist/work-item-branch.js.map +1 -0
- package/dist/workspace.d.ts +131 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +995 -0
- package/dist/workspace.js.map +1 -0
- package/factory-skills/configure-factory-rules/SKILL.md +122 -0
- package/factory-skills/factory-complete-issue/SKILL.md +24 -0
- package/factory-skills/factory-gitlab-rereview/SKILL.md +22 -0
- package/factory-skills/factory-gitlab-review/SKILL.md +48 -0
- package/factory-skills/factory-plan/SKILL.md +72 -0
- package/factory-skills/factory-rereview/SKILL.md +225 -0
- package/factory-skills/factory-review/SKILL.md +214 -0
- package/factory-skills/factory-review/references/archaeology.md +225 -0
- package/factory-skills/factory-review/references/categories/README.md +34 -0
- package/factory-skills/factory-review/references/categories/behavior-change.md +36 -0
- package/factory-skills/factory-review/references/categories/bug-fix.md +37 -0
- package/factory-skills/factory-review/references/categories/docs.md +32 -0
- package/factory-skills/factory-review/references/categories/experimental-flagged.md +34 -0
- package/factory-skills/factory-review/references/categories/infra-tooling.md +37 -0
- package/factory-skills/factory-review/references/categories/internal-capability.md +35 -0
- package/factory-skills/factory-review/references/categories/large-cross-cutting.md +35 -0
- package/factory-skills/factory-review/references/categories/mechanical.md +36 -0
- package/factory-skills/factory-review/references/categories/performance.md +33 -0
- package/factory-skills/factory-review/references/categories/public-api.md +38 -0
- package/factory-skills/factory-review/references/categories/refactor.md +35 -0
- package/factory-skills/factory-review/references/categories/revert.md +31 -0
- package/factory-skills/factory-review/references/categories/schema-storage.md +39 -0
- package/factory-skills/factory-review/references/categories/security.md +35 -0
- package/factory-skills/factory-review/references/categories/tests-only.md +38 -0
- package/factory-skills/factory-triage/SKILL.md +197 -0
- package/package.json +92 -0
|
@@ -0,0 +1,947 @@
|
|
|
1
|
+
import { timedPhase } from "../../timing.js";
|
|
2
|
+
import { isValidGitRef } from "../../sandbox/git-ref.js";
|
|
3
|
+
//#region src/integrations/github/sandbox.ts
|
|
4
|
+
/**
|
|
5
|
+
* Single-quote a string for safe POSIX shell interpolation. Wraps the value in
|
|
6
|
+
* single quotes and escapes any embedded single quote using the canonical
|
|
7
|
+
* close-quote / escaped-quote / reopen-quote sequence (`'\''`). This is the
|
|
8
|
+
* standard POSIX-safe construction and prevents the quoted string from being
|
|
9
|
+
* terminated early.
|
|
10
|
+
*/
|
|
11
|
+
function shellQuote(value) {
|
|
12
|
+
return `'` + value.split(`'`).join(`'\\''`) + `'`;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Default hang guard for sandbox shell commands. Generous by design — large
|
|
16
|
+
* clones and dependency installs legitimately take minutes; the guard exists
|
|
17
|
+
* so a wedged sandbox surfaces a failure instead of hanging the request that
|
|
18
|
+
* triggered materialization forever.
|
|
19
|
+
*/
|
|
20
|
+
const DEFAULT_COMMAND_TIMEOUT_MS = 15 * 6e4;
|
|
21
|
+
/** Branch checkout only fetches one ref — a much tighter budget applies. */
|
|
22
|
+
const CHECKOUT_COMMAND_TIMEOUT_MS = 5 * 6e4;
|
|
23
|
+
/**
|
|
24
|
+
* A thrown transport-level failure that is worth retrying: remote sandbox
|
|
25
|
+
|
|
26
|
+
* providers (e.g. the platform workspace proxy) surface transient 5xx errors
|
|
27
|
+
* as exceptions carrying an HTTP `status` — typically while a freshly
|
|
28
|
+
* provisioned VM is still coming up. Command failures are NOT exceptions
|
|
29
|
+
* (they resolve with a non-zero exit code), so retrying here never re-runs a
|
|
30
|
+
* command that the sandbox already executed and rejected.
|
|
31
|
+
*/
|
|
32
|
+
function isTransientTransportError(error) {
|
|
33
|
+
const status = error?.status;
|
|
34
|
+
return typeof status === "number" && status >= 500;
|
|
35
|
+
}
|
|
36
|
+
const SH_RETRIES = 2;
|
|
37
|
+
const SH_RETRY_DELAY_MS = 2e3;
|
|
38
|
+
/**
|
|
39
|
+
* Run a shell script in the sandbox via `sh -c`. This is reserved for the
|
|
40
|
+
* explicitly configured repository lifecycle hooks; programmatic commands use
|
|
41
|
+
* {@link execute} with an argv array.
|
|
42
|
+
*/
|
|
43
|
+
async function sh(sandbox, script, options = {}) {
|
|
44
|
+
return execute(sandbox, "sh", ["-c", script], options);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Execute one program with an argv array, bounded by a hang guard. Transient
|
|
48
|
+
* sandbox transport failures are retried without ever interpolating arguments
|
|
49
|
+
* into a shell command.
|
|
50
|
+
*/
|
|
51
|
+
async function execute(sandbox, command, args, options = {}) {
|
|
52
|
+
const deadlineMs = Date.now() + (options.timeoutMs ?? 9e5);
|
|
53
|
+
for (let attempt = 0;; attempt++) {
|
|
54
|
+
const started = performance.now();
|
|
55
|
+
try {
|
|
56
|
+
const result = await executeOnce(sandbox, command, args, {
|
|
57
|
+
...options,
|
|
58
|
+
timeoutMs: Math.max(deadlineMs - Date.now(), 1)
|
|
59
|
+
});
|
|
60
|
+
if (options.phase) process.stderr.write(`[factory:timing] ${options.phase} attempt=${attempt + 1} exit=${result.exitCode} ${Math.round(performance.now() - started)}ms\n`);
|
|
61
|
+
return result;
|
|
62
|
+
} catch (error) {
|
|
63
|
+
if (options.phase) process.stderr.write(`[factory:timing] ${options.phase} attempt=${attempt + 1} threw after ${Math.round(performance.now() - started)}ms: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
64
|
+
if (attempt >= SH_RETRIES || !isTransientTransportError(error)) throw error;
|
|
65
|
+
const delayMs = SH_RETRY_DELAY_MS * (attempt + 1);
|
|
66
|
+
if (deadlineMs - Date.now() <= delayMs) throw error;
|
|
67
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/** Single structured command execution attempt, bounded by the hang guard. */
|
|
72
|
+
async function executeOnce(sandbox, command, args, options) {
|
|
73
|
+
const timeoutMs = options.timeoutMs ?? 9e5;
|
|
74
|
+
let timer;
|
|
75
|
+
const hangGuard = new Promise((_, reject) => {
|
|
76
|
+
timer = setTimeout(() => {
|
|
77
|
+
const phase = options.phase ? ` during ${options.phase}` : "";
|
|
78
|
+
reject(/* @__PURE__ */ new Error(`Sandbox command timed out after ${Math.round(timeoutMs / 1e3)}s${phase}.`));
|
|
79
|
+
}, timeoutMs);
|
|
80
|
+
timer.unref?.();
|
|
81
|
+
});
|
|
82
|
+
try {
|
|
83
|
+
return await Promise.race([sandbox.executeCommand(command, args, {
|
|
84
|
+
timeout: timeoutMs,
|
|
85
|
+
...options.cwd !== void 0 ? { cwd: options.cwd } : {},
|
|
86
|
+
...options.env !== void 0 ? { env: options.env } : {}
|
|
87
|
+
}), hangGuard]);
|
|
88
|
+
} finally {
|
|
89
|
+
clearTimeout(timer);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const GIT_TRANSFER_RETRIES = 2;
|
|
93
|
+
const GIT_TRANSFER_RETRY_DELAY_MS = 2e3;
|
|
94
|
+
/**
|
|
95
|
+
* True when a git transfer died mid-flight rather than being refused.
|
|
96
|
+
*
|
|
97
|
+
* `sh` already retries transport errors the sandbox provider *throws*, but a
|
|
98
|
+
* git command that reaches the network and then loses it exits non-zero
|
|
99
|
+
* instead — so a single HTTP/2 framing glitch or dropped connection to
|
|
100
|
+
* github.com would otherwise permanently fail opening a workspace. These
|
|
101
|
+
* patterns all mean "the bytes stopped arriving", which says nothing about
|
|
102
|
+
* whether the operation would succeed if attempted again.
|
|
103
|
+
*
|
|
104
|
+
* Deliberately narrow: a refusal (bad credentials, missing repo, blocked
|
|
105
|
+
* egress) is terminal and must surface immediately rather than be retried into
|
|
106
|
+
* a slow failure.
|
|
107
|
+
*/
|
|
108
|
+
function isTransientGitFailure(result) {
|
|
109
|
+
const output = `${result.stderr || ""}\n${result.stdout || ""}`;
|
|
110
|
+
return /HTTP2 framing layer|RPC failed; curl|RPC failed; HTTP 5\d\d|the remote end hung up unexpectedly|early EOF|unexpected disconnect|connection reset by peer|Recv failure|Send failure|GnuTLS recv error|TLS connection was non-properly terminated|502 Bad Gateway|503 Service Unavailable/i.test(output);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Run a git command that only *reads* from the remote, retrying it when the
|
|
114
|
+
* transfer dies mid-flight. Restricted to read-only transfers on purpose:
|
|
115
|
+
* re-running a clone or a fetch is free, whereas re-running a push could
|
|
116
|
+
* duplicate work already accepted by the remote before the connection dropped.
|
|
117
|
+
*
|
|
118
|
+
* `beforeRetry` lets a call site clear whatever the aborted attempt left
|
|
119
|
+
* behind — a half-written clone directory blocks the next `git clone` outright.
|
|
120
|
+
*/
|
|
121
|
+
async function gitTransfer(sandbox, args, options = {}) {
|
|
122
|
+
const { beforeRetry, ...commandOptions } = options;
|
|
123
|
+
const deadlineMs = Date.now() + (commandOptions.timeoutMs ?? 9e5);
|
|
124
|
+
for (let attempt = 0;; attempt++) {
|
|
125
|
+
const result = await execute(sandbox, "git", args, {
|
|
126
|
+
...commandOptions,
|
|
127
|
+
timeoutMs: Math.max(deadlineMs - Date.now(), 1)
|
|
128
|
+
});
|
|
129
|
+
if (result.exitCode === 0 || attempt >= GIT_TRANSFER_RETRIES || !isTransientGitFailure(result)) return result;
|
|
130
|
+
process.stderr.write(`[factory:timing] git ${commandOptions.phase ?? "transfer"} retrying after attempt ${attempt + 1}\n`);
|
|
131
|
+
const delayMs = GIT_TRANSFER_RETRY_DELAY_MS * (attempt + 1);
|
|
132
|
+
if (deadlineMs - Date.now() <= delayMs) return result;
|
|
133
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
134
|
+
await beforeRetry?.(attempt + 1);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/** Error raised when the sandbox cannot materialize the repo (actionable). */
|
|
138
|
+
var MaterializeError = class extends Error {
|
|
139
|
+
code;
|
|
140
|
+
constructor(message, code) {
|
|
141
|
+
super(message);
|
|
142
|
+
this.code = code;
|
|
143
|
+
this.name = "MaterializeError";
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
function cleanUrl(repoFullName) {
|
|
147
|
+
return `https://github.com/${repoFullName}.git`;
|
|
148
|
+
}
|
|
149
|
+
function credentialScope(cloneUrl, code = "clone-failed") {
|
|
150
|
+
let url;
|
|
151
|
+
try {
|
|
152
|
+
url = new URL(cloneUrl);
|
|
153
|
+
} catch {
|
|
154
|
+
throw new MaterializeError("Refusing to configure credentials for an invalid repository clone URL.", code);
|
|
155
|
+
}
|
|
156
|
+
if (url.protocol !== "https:" || !url.hostname || url.username || url.password || url.search || url.hash) throw new MaterializeError("Refusing to configure credentials for an invalid repository clone URL.", code);
|
|
157
|
+
const repositoryPath = url.pathname.replace(/\/+$/, "");
|
|
158
|
+
if (!repositoryPath || repositoryPath === "/") throw new MaterializeError("Refusing to configure credentials for an invalid repository clone URL.", code);
|
|
159
|
+
return url.origin + repositoryPath;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Provide HTTP Basic credentials to one Git process without putting a secret
|
|
163
|
+
* in argv, a remote URL, or persistent git config. Git reads the URL-scoped
|
|
164
|
+
* extra header from its process environment and discards it on exit.
|
|
165
|
+
*/
|
|
166
|
+
function gitAuthenticationEnvironment(cloneUrl, token, username, code = "clone-failed") {
|
|
167
|
+
const scope = credentialScope(cloneUrl, code);
|
|
168
|
+
if (!token || !username) throw new MaterializeError("Repository access did not include usable credentials.", code);
|
|
169
|
+
const authorization = Buffer.from(`${username}:${token}`, "utf8").toString("base64");
|
|
170
|
+
const alternate = scope.endsWith(".git") ? scope.slice(0, -4) : `${scope}.git`;
|
|
171
|
+
return {
|
|
172
|
+
GIT_CONFIG_COUNT: "2",
|
|
173
|
+
GIT_CONFIG_KEY_0: `http.${scope}.extraHeader`,
|
|
174
|
+
GIT_CONFIG_VALUE_0: `Authorization: Basic ${authorization}`,
|
|
175
|
+
GIT_CONFIG_KEY_1: `http.${alternate}.extraHeader`,
|
|
176
|
+
GIT_CONFIG_VALUE_1: `Authorization: Basic ${authorization}`,
|
|
177
|
+
GIT_TERMINAL_PROMPT: "0"
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function normalizedRemoteUrl(value) {
|
|
181
|
+
let url;
|
|
182
|
+
try {
|
|
183
|
+
url = new URL(value);
|
|
184
|
+
} catch {
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
if (url.protocol !== "https:" || !url.hostname || url.search || url.hash) return null;
|
|
188
|
+
const pathname = url.pathname.replace(/\/+$/, "").replace(/\.git$/i, "");
|
|
189
|
+
const repositoryPath = url.hostname.toLowerCase() === "github.com" ? pathname.toLowerCase() : pathname;
|
|
190
|
+
return "https://" + url.host.toLowerCase() + repositoryPath;
|
|
191
|
+
}
|
|
192
|
+
async function clearWorkdir(sandbox, workdir) {
|
|
193
|
+
const mkdir = await execute(sandbox, "mkdir", ["-p", workdir]);
|
|
194
|
+
if (mkdir.exitCode !== 0) throw classifyGitFailure(mkdir, "clone-failed");
|
|
195
|
+
const clear = await execute(sandbox, "find", [
|
|
196
|
+
workdir,
|
|
197
|
+
"-mindepth",
|
|
198
|
+
"1",
|
|
199
|
+
"-maxdepth",
|
|
200
|
+
"1",
|
|
201
|
+
"-exec",
|
|
202
|
+
"rm",
|
|
203
|
+
"-rf",
|
|
204
|
+
"--",
|
|
205
|
+
"{}",
|
|
206
|
+
"+"
|
|
207
|
+
]);
|
|
208
|
+
if (clear.exitCode !== 0) throw classifyGitFailure(clear, "clone-failed");
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Materialize the repo inside the user's sandbox: clone when no checkout of
|
|
212
|
+
* this repo exists, otherwise nothing. Credentials are process-scoped and the
|
|
213
|
+
* stored remote remains credential-free. Sets `materialized_at` on the
|
|
214
|
+
* per-user sandbox binding row.
|
|
215
|
+
*/
|
|
216
|
+
async function materializeRepo(options) {
|
|
217
|
+
return timedPhase("workspace.materialize", () => materializeRepoImpl(options));
|
|
218
|
+
}
|
|
219
|
+
async function materializeRepoImpl(options) {
|
|
220
|
+
const { row: sandboxRow, repoInfo, sandbox, token, storage } = options;
|
|
221
|
+
const workdir = sandboxRow.sandboxWorkdir;
|
|
222
|
+
const repo = repoInfo.repoFullName;
|
|
223
|
+
if (!/^[\w.-]+(?:\/[\w.-]+)+$/.test(repo)) throw new MaterializeError(`Refusing to materialize: invalid repo full name '${repo}'.`, "clone-failed");
|
|
224
|
+
if (!/^[A-Za-z0-9_./-]+$/.test(repoInfo.defaultBranch)) throw new MaterializeError(`Refusing to materialize: invalid default branch '${repoInfo.defaultBranch}'.`, "clone-failed");
|
|
225
|
+
if ((await execute(sandbox, "git", ["--version"])).exitCode !== 0) throw new MaterializeError("git is not installed in the sandbox. The sandbox template must include git.", "git-missing");
|
|
226
|
+
const cleanCloneUrl = repoInfo.cloneUrl ?? cleanUrl(repo);
|
|
227
|
+
const existing = await existingCheckoutRemote(sandbox, workdir, cleanCloneUrl);
|
|
228
|
+
if (existing !== null) {
|
|
229
|
+
if (/\/\/[^/]*@/.test(existing)) await scrubRemote(sandbox, workdir, repo, cleanCloneUrl);
|
|
230
|
+
} else {
|
|
231
|
+
const authEnv = gitAuthenticationEnvironment(cleanCloneUrl, token, repoInfo.authUsername ?? "x-access-token", "clone-failed");
|
|
232
|
+
await clearWorkdir(sandbox, workdir);
|
|
233
|
+
const clone = await gitTransfer(sandbox, [
|
|
234
|
+
"clone",
|
|
235
|
+
"--depth=1",
|
|
236
|
+
"--single-branch",
|
|
237
|
+
"--branch",
|
|
238
|
+
repoInfo.defaultBranch,
|
|
239
|
+
"--",
|
|
240
|
+
cleanCloneUrl,
|
|
241
|
+
workdir
|
|
242
|
+
], {
|
|
243
|
+
env: authEnv,
|
|
244
|
+
phase: "repository clone",
|
|
245
|
+
beforeRetry: async () => {
|
|
246
|
+
await clearWorkdir(sandbox, workdir);
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
if (clone.exitCode !== 0) throw classifyGitFailure(clone, "clone-failed");
|
|
250
|
+
}
|
|
251
|
+
await storage.markMaterialized({ id: sandboxRow.id });
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Past file contents of a blob-less history load on demand; git asks gh, which
|
|
255
|
+
* answers from the session's `GH_TOKEN`, so no credential is ever written.
|
|
256
|
+
*/
|
|
257
|
+
const GH_CREDENTIAL_HELPER = "!gh auth git-credential";
|
|
258
|
+
async function fetchStartPoint(sandbox, workdir, { baseBranch, pullRequestNumber, mergeRequestNumber }, shallowClone, env) {
|
|
259
|
+
const changeRequestRef = pullRequestNumber !== void 0 ? `refs/pull/${pullRequestNumber}/head` : mergeRequestNumber !== void 0 ? `refs/merge-requests/${mergeRequestNumber}/head` : void 0;
|
|
260
|
+
const base = await gitTransfer(sandbox, [
|
|
261
|
+
"-C",
|
|
262
|
+
workdir,
|
|
263
|
+
"fetch",
|
|
264
|
+
...changeRequestRef && shallowClone ? ["--unshallow"] : [],
|
|
265
|
+
...pullRequestNumber !== void 0 ? ["--filter=blob:none"] : [],
|
|
266
|
+
"origin",
|
|
267
|
+
baseBranch
|
|
268
|
+
], {
|
|
269
|
+
env,
|
|
270
|
+
timeoutMs: CHECKOUT_COMMAND_TIMEOUT_MS,
|
|
271
|
+
phase: "branch checkout fetch"
|
|
272
|
+
});
|
|
273
|
+
if (base.exitCode !== 0 || !changeRequestRef) return base;
|
|
274
|
+
return gitTransfer(sandbox, [
|
|
275
|
+
"-C",
|
|
276
|
+
workdir,
|
|
277
|
+
"fetch",
|
|
278
|
+
...pullRequestNumber !== void 0 ? ["--filter=blob:none"] : [],
|
|
279
|
+
"origin",
|
|
280
|
+
changeRequestRef
|
|
281
|
+
], {
|
|
282
|
+
env,
|
|
283
|
+
timeoutMs: CHECKOUT_COMMAND_TIMEOUT_MS,
|
|
284
|
+
phase: "change request head fetch"
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
/** Check out a session's branch inside its isolated repository clone. */
|
|
288
|
+
async function checkoutSessionBranch(sandbox, workdir, options) {
|
|
289
|
+
return timedPhase("workspace.checkout", () => checkoutSessionBranchImpl(sandbox, workdir, options));
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Bring a secondary environment repository onto the session branch at
|
|
293
|
+
* session start. The primary repository keeps {@link checkoutSessionBranch};
|
|
294
|
+
* every other repository follows a conservative rule: resume the session
|
|
295
|
+
* branch when the remote or the local clone has it, otherwise create it from
|
|
296
|
+
* the default branch tip (a detached HEAD, the template image pinned at its
|
|
297
|
+
* build commit, is moved there first). A checkout that sits on any other
|
|
298
|
+
* branch is left alone: it may carry local-only commits.
|
|
299
|
+
*/
|
|
300
|
+
async function syncEnvironmentRepository(sandbox, workdir, options) {
|
|
301
|
+
const { branch, defaultBranch, token, repoFullName, cloneUrl, authUsername } = options;
|
|
302
|
+
if (!isValidGitRef(branch) || !isValidGitRef(defaultBranch)) throw new MaterializeError("Refusing to sync a repository from an invalid branch name.", "pull-failed");
|
|
303
|
+
const authEnv = gitAuthenticationEnvironment(cloneUrl ?? cleanUrl(repoFullName), token, authUsername ?? "x-access-token", "pull-failed");
|
|
304
|
+
const current = await execute(sandbox, "git", [
|
|
305
|
+
"-C",
|
|
306
|
+
workdir,
|
|
307
|
+
"branch",
|
|
308
|
+
"--show-current"
|
|
309
|
+
]);
|
|
310
|
+
if (current.exitCode !== 0) throw classifyGitFailure(current, "pull-failed");
|
|
311
|
+
const currentBranch = current.stdout.trim();
|
|
312
|
+
const kept = {
|
|
313
|
+
outcome: "kept",
|
|
314
|
+
branch: currentBranch || null
|
|
315
|
+
};
|
|
316
|
+
if (currentBranch === branch) return kept;
|
|
317
|
+
if ((await execute(sandbox, "git", [
|
|
318
|
+
"-C",
|
|
319
|
+
workdir,
|
|
320
|
+
"rev-parse",
|
|
321
|
+
"--verify",
|
|
322
|
+
"--quiet",
|
|
323
|
+
`refs/heads/${branch}`
|
|
324
|
+
])).exitCode === 0) {
|
|
325
|
+
const checkout = await execute(sandbox, "git", [
|
|
326
|
+
"-C",
|
|
327
|
+
workdir,
|
|
328
|
+
"checkout",
|
|
329
|
+
branch
|
|
330
|
+
], {
|
|
331
|
+
timeoutMs: CHECKOUT_COMMAND_TIMEOUT_MS,
|
|
332
|
+
phase: "environment branch checkout"
|
|
333
|
+
});
|
|
334
|
+
if (checkout.exitCode === 0) return {
|
|
335
|
+
outcome: "resumed",
|
|
336
|
+
branch
|
|
337
|
+
};
|
|
338
|
+
if (isBlockedByLocalWork(checkout)) return kept;
|
|
339
|
+
throw classifyGitFailure(checkout, "pull-failed");
|
|
340
|
+
}
|
|
341
|
+
const remoteHeads = await gitTransfer(sandbox, [
|
|
342
|
+
"-C",
|
|
343
|
+
workdir,
|
|
344
|
+
"ls-remote",
|
|
345
|
+
"--heads",
|
|
346
|
+
"origin",
|
|
347
|
+
`refs/heads/${branch}`
|
|
348
|
+
], {
|
|
349
|
+
env: authEnv,
|
|
350
|
+
timeoutMs: CHECKOUT_COMMAND_TIMEOUT_MS,
|
|
351
|
+
phase: "environment branch probe"
|
|
352
|
+
});
|
|
353
|
+
if (remoteHeads.exitCode !== 0) throw classifyGitFailure(remoteHeads, "pull-failed");
|
|
354
|
+
if (remoteHeads.stdout.trim()) {
|
|
355
|
+
const fetch = await gitTransfer(sandbox, [
|
|
356
|
+
"-C",
|
|
357
|
+
workdir,
|
|
358
|
+
"fetch",
|
|
359
|
+
"origin",
|
|
360
|
+
branch
|
|
361
|
+
], {
|
|
362
|
+
env: authEnv,
|
|
363
|
+
timeoutMs: CHECKOUT_COMMAND_TIMEOUT_MS,
|
|
364
|
+
phase: "environment branch fetch"
|
|
365
|
+
});
|
|
366
|
+
if (fetch.exitCode !== 0) throw classifyGitFailure(fetch, "pull-failed");
|
|
367
|
+
const checkout = await execute(sandbox, "git", [
|
|
368
|
+
"-C",
|
|
369
|
+
workdir,
|
|
370
|
+
"checkout",
|
|
371
|
+
"-B",
|
|
372
|
+
branch,
|
|
373
|
+
"FETCH_HEAD"
|
|
374
|
+
], {
|
|
375
|
+
env: authEnv,
|
|
376
|
+
timeoutMs: CHECKOUT_COMMAND_TIMEOUT_MS,
|
|
377
|
+
phase: "environment branch checkout"
|
|
378
|
+
});
|
|
379
|
+
if (checkout.exitCode === 0) return {
|
|
380
|
+
outcome: "resumed",
|
|
381
|
+
branch
|
|
382
|
+
};
|
|
383
|
+
if (isBlockedByLocalWork(checkout)) return kept;
|
|
384
|
+
throw classifyGitFailure(checkout, "pull-failed");
|
|
385
|
+
}
|
|
386
|
+
if (currentBranch && currentBranch !== defaultBranch) return kept;
|
|
387
|
+
if (currentBranch) {
|
|
388
|
+
const status = await execute(sandbox, "git", [
|
|
389
|
+
"-C",
|
|
390
|
+
workdir,
|
|
391
|
+
"status",
|
|
392
|
+
"--porcelain"
|
|
393
|
+
]);
|
|
394
|
+
if (status.exitCode !== 0) throw classifyGitFailure(status, "pull-failed");
|
|
395
|
+
if (status.stdout.trim()) return kept;
|
|
396
|
+
}
|
|
397
|
+
const fetch = await gitTransfer(sandbox, [
|
|
398
|
+
"-C",
|
|
399
|
+
workdir,
|
|
400
|
+
"fetch",
|
|
401
|
+
"origin",
|
|
402
|
+
defaultBranch
|
|
403
|
+
], {
|
|
404
|
+
env: authEnv,
|
|
405
|
+
timeoutMs: CHECKOUT_COMMAND_TIMEOUT_MS,
|
|
406
|
+
phase: "environment default fetch"
|
|
407
|
+
});
|
|
408
|
+
if (fetch.exitCode !== 0) throw classifyGitFailure(fetch, "pull-failed");
|
|
409
|
+
if (currentBranch) {
|
|
410
|
+
const ancestor = await execute(sandbox, "git", [
|
|
411
|
+
"-C",
|
|
412
|
+
workdir,
|
|
413
|
+
"merge-base",
|
|
414
|
+
"--is-ancestor",
|
|
415
|
+
"HEAD",
|
|
416
|
+
"FETCH_HEAD"
|
|
417
|
+
]);
|
|
418
|
+
if (ancestor.exitCode === 1) return kept;
|
|
419
|
+
if (ancestor.exitCode !== 0) throw classifyGitFailure(ancestor, "pull-failed");
|
|
420
|
+
} else {
|
|
421
|
+
const checkout = await execute(sandbox, "git", [
|
|
422
|
+
"-C",
|
|
423
|
+
workdir,
|
|
424
|
+
"checkout",
|
|
425
|
+
"-B",
|
|
426
|
+
defaultBranch,
|
|
427
|
+
"FETCH_HEAD"
|
|
428
|
+
], {
|
|
429
|
+
env: authEnv,
|
|
430
|
+
timeoutMs: CHECKOUT_COMMAND_TIMEOUT_MS,
|
|
431
|
+
phase: "environment default checkout"
|
|
432
|
+
});
|
|
433
|
+
if (checkout.exitCode !== 0) {
|
|
434
|
+
if (isBlockedByLocalWork(checkout)) return kept;
|
|
435
|
+
throw classifyGitFailure(checkout, "pull-failed");
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
const created = await execute(sandbox, "git", [
|
|
439
|
+
"-C",
|
|
440
|
+
workdir,
|
|
441
|
+
"checkout",
|
|
442
|
+
"-b",
|
|
443
|
+
branch,
|
|
444
|
+
"FETCH_HEAD"
|
|
445
|
+
], {
|
|
446
|
+
timeoutMs: CHECKOUT_COMMAND_TIMEOUT_MS,
|
|
447
|
+
phase: "environment branch create"
|
|
448
|
+
});
|
|
449
|
+
if (created.exitCode === 0) return {
|
|
450
|
+
outcome: "created",
|
|
451
|
+
branch
|
|
452
|
+
};
|
|
453
|
+
throw classifyGitFailure(created, "pull-failed");
|
|
454
|
+
}
|
|
455
|
+
/** Refresh an existing GitLab review checkout without exposing its credential to the agent. */
|
|
456
|
+
async function refreshMergeRequestCheckout(sandbox, workdir, input) {
|
|
457
|
+
const { branch, mergeRequestNumber, expectedHeadSha, access } = input;
|
|
458
|
+
if (!isValidGitRef(branch) || !Number.isSafeInteger(mergeRequestNumber) || mergeRequestNumber <= 0 || !/^[0-9a-f]{40}$/i.test(expectedHeadSha)) throw new Error("Refusing to refresh a GitLab review with invalid session or head metadata.");
|
|
459
|
+
const token = access.authorization?.token;
|
|
460
|
+
if (!token) throw new Error("GitLab repository access did not include a bearer token.");
|
|
461
|
+
const env = gitAuthenticationEnvironment(access.cloneUrl, token, access.authorization?.username ?? "oauth2", "pull-failed");
|
|
462
|
+
const current = await execute(sandbox, "git", [
|
|
463
|
+
"-C",
|
|
464
|
+
workdir,
|
|
465
|
+
"branch",
|
|
466
|
+
"--show-current"
|
|
467
|
+
]);
|
|
468
|
+
if (current.exitCode !== 0 || current.stdout.trim() !== branch) throw new Error("The active checkout is not on its bound review branch.");
|
|
469
|
+
const status = await execute(sandbox, "git", [
|
|
470
|
+
"-C",
|
|
471
|
+
workdir,
|
|
472
|
+
"status",
|
|
473
|
+
"--porcelain",
|
|
474
|
+
"--untracked-files=all"
|
|
475
|
+
]);
|
|
476
|
+
if (status.exitCode !== 0 || status.stdout.trim()) throw new Error("The review checkout has local changes; refusing to replace them.");
|
|
477
|
+
const before = await execute(sandbox, "git", [
|
|
478
|
+
"-C",
|
|
479
|
+
workdir,
|
|
480
|
+
"rev-parse",
|
|
481
|
+
"HEAD"
|
|
482
|
+
]);
|
|
483
|
+
if (before.exitCode !== 0) throw new Error("Could not read the current review checkout head.");
|
|
484
|
+
const fetch = await gitTransfer(sandbox, [
|
|
485
|
+
"-C",
|
|
486
|
+
workdir,
|
|
487
|
+
"fetch",
|
|
488
|
+
"origin",
|
|
489
|
+
`refs/merge-requests/${mergeRequestNumber}/head`
|
|
490
|
+
], {
|
|
491
|
+
env,
|
|
492
|
+
timeoutMs: CHECKOUT_COMMAND_TIMEOUT_MS,
|
|
493
|
+
phase: "GitLab review head refresh"
|
|
494
|
+
});
|
|
495
|
+
if (fetch.exitCode !== 0) throw classifyGitFailure(fetch, "pull-failed");
|
|
496
|
+
const fetched = await execute(sandbox, "git", [
|
|
497
|
+
"-C",
|
|
498
|
+
workdir,
|
|
499
|
+
"rev-parse",
|
|
500
|
+
"FETCH_HEAD"
|
|
501
|
+
]);
|
|
502
|
+
if (fetched.exitCode !== 0 || fetched.stdout.trim().toLowerCase() !== expectedHeadSha.toLowerCase()) throw new Error("The fetched GitLab review head differs from the provider-reported head; retry after it settles.");
|
|
503
|
+
if (before.stdout.trim().toLowerCase() === expectedHeadSha.toLowerCase()) return {
|
|
504
|
+
headSha: expectedHeadSha,
|
|
505
|
+
changed: false
|
|
506
|
+
};
|
|
507
|
+
const updated = await execute(sandbox, "git", [
|
|
508
|
+
"-C",
|
|
509
|
+
workdir,
|
|
510
|
+
"checkout",
|
|
511
|
+
"-B",
|
|
512
|
+
branch,
|
|
513
|
+
"FETCH_HEAD"
|
|
514
|
+
], { env });
|
|
515
|
+
if (updated.exitCode !== 0) throw classifyGitFailure(updated, "pull-failed");
|
|
516
|
+
return {
|
|
517
|
+
headSha: expectedHeadSha,
|
|
518
|
+
changed: true
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
async function checkoutSessionBranchImpl(sandbox, workdir, options) {
|
|
522
|
+
const { branch, baseBranch, token, repoFullName, pullRequestNumber, mergeRequestNumber, cloneUrl, authUsername } = options;
|
|
523
|
+
if (!isValidGitRef(branch) || !isValidGitRef(baseBranch) || pullRequestNumber !== void 0 && mergeRequestNumber !== void 0 || mergeRequestNumber !== void 0 && (!Number.isSafeInteger(mergeRequestNumber) || mergeRequestNumber <= 0)) throw new MaterializeError("Refusing to create a session from an invalid branch name.", "clone-failed");
|
|
524
|
+
const changeRequestSession = pullRequestNumber !== void 0 || mergeRequestNumber !== void 0;
|
|
525
|
+
const cleanCloneUrl = cloneUrl ?? cleanUrl(repoFullName);
|
|
526
|
+
const authEnv = gitAuthenticationEnvironment(cleanCloneUrl, token, authUsername ?? "x-access-token", "pull-failed");
|
|
527
|
+
const credentialKey = authUsername ? "credential." + credentialScope(cleanCloneUrl) + ".helper" : "credential.helper";
|
|
528
|
+
if (authUsername) await execute(sandbox, "git", [
|
|
529
|
+
"-C",
|
|
530
|
+
workdir,
|
|
531
|
+
"config",
|
|
532
|
+
"--unset-all",
|
|
533
|
+
credentialKey
|
|
534
|
+
]);
|
|
535
|
+
else {
|
|
536
|
+
const configured = await execute(sandbox, "git", [
|
|
537
|
+
"-C",
|
|
538
|
+
workdir,
|
|
539
|
+
"config",
|
|
540
|
+
credentialKey,
|
|
541
|
+
GH_CREDENTIAL_HELPER
|
|
542
|
+
]);
|
|
543
|
+
if (configured.exitCode !== 0) throw classifyGitFailure(configured, "pull-failed");
|
|
544
|
+
}
|
|
545
|
+
const current = await execute(sandbox, "git", [
|
|
546
|
+
"-C",
|
|
547
|
+
workdir,
|
|
548
|
+
"branch",
|
|
549
|
+
"--show-current"
|
|
550
|
+
]);
|
|
551
|
+
if (current.exitCode === 0 && current.stdout.trim() === branch) return;
|
|
552
|
+
if ((await execute(sandbox, "git", [
|
|
553
|
+
"-C",
|
|
554
|
+
workdir,
|
|
555
|
+
"show-ref",
|
|
556
|
+
"--verify",
|
|
557
|
+
"--quiet",
|
|
558
|
+
`refs/heads/${branch}`
|
|
559
|
+
])).exitCode === 0) {
|
|
560
|
+
const checkout = await execute(sandbox, "git", [
|
|
561
|
+
"-C",
|
|
562
|
+
workdir,
|
|
563
|
+
"checkout",
|
|
564
|
+
branch
|
|
565
|
+
], { env: authEnv });
|
|
566
|
+
if (checkout.exitCode !== 0) {
|
|
567
|
+
if (isBlockedByLocalWork(checkout)) return;
|
|
568
|
+
throw classifyGitFailure(checkout, "clone-failed");
|
|
569
|
+
}
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
572
|
+
const fetch = await fetchStartPoint(sandbox, workdir, options, changeRequestSession && (await execute(sandbox, "git", [
|
|
573
|
+
"-C",
|
|
574
|
+
workdir,
|
|
575
|
+
"rev-parse",
|
|
576
|
+
"--is-shallow-repository"
|
|
577
|
+
])).stdout.trim() === "true", authEnv);
|
|
578
|
+
if (fetch.exitCode !== 0) throw classifyGitFailure(fetch, "pull-failed");
|
|
579
|
+
const create = await execute(sandbox, "git", [
|
|
580
|
+
"-C",
|
|
581
|
+
workdir,
|
|
582
|
+
"checkout",
|
|
583
|
+
"-b",
|
|
584
|
+
branch,
|
|
585
|
+
"FETCH_HEAD"
|
|
586
|
+
], {
|
|
587
|
+
env: authEnv,
|
|
588
|
+
timeoutMs: CHECKOUT_COMMAND_TIMEOUT_MS,
|
|
589
|
+
phase: "branch checkout"
|
|
590
|
+
});
|
|
591
|
+
if (create.exitCode === 0 || isBlockedByLocalWork(create)) return;
|
|
592
|
+
if (!isBranchCollision(create)) throw classifyGitFailure(create, "clone-failed");
|
|
593
|
+
const adopt = await execute(sandbox, "git", [
|
|
594
|
+
"-C",
|
|
595
|
+
workdir,
|
|
596
|
+
"checkout",
|
|
597
|
+
branch
|
|
598
|
+
], { env: authEnv });
|
|
599
|
+
if (adopt.exitCode === 0 || isBlockedByLocalWork(adopt)) return;
|
|
600
|
+
let drop = await execute(sandbox, "git", [
|
|
601
|
+
"-C",
|
|
602
|
+
workdir,
|
|
603
|
+
"update-ref",
|
|
604
|
+
"--no-deref",
|
|
605
|
+
"-d",
|
|
606
|
+
`refs/heads/${branch}`
|
|
607
|
+
]);
|
|
608
|
+
if (drop.exitCode !== 0) {
|
|
609
|
+
const gitDir = await execute(sandbox, "git", [
|
|
610
|
+
"-C",
|
|
611
|
+
workdir,
|
|
612
|
+
"rev-parse",
|
|
613
|
+
"--absolute-git-dir"
|
|
614
|
+
]);
|
|
615
|
+
if (gitDir.exitCode !== 0 || !gitDir.stdout.trim()) throw classifyGitFailure(create, "clone-failed");
|
|
616
|
+
drop = await execute(sandbox, "rm", [
|
|
617
|
+
"-f",
|
|
618
|
+
"--",
|
|
619
|
+
`${gitDir.stdout.trim()}/refs/heads/${branch}`
|
|
620
|
+
]);
|
|
621
|
+
}
|
|
622
|
+
if (drop.exitCode !== 0) throw classifyGitFailure(create, "clone-failed");
|
|
623
|
+
const retry = await execute(sandbox, "git", [
|
|
624
|
+
"-C",
|
|
625
|
+
workdir,
|
|
626
|
+
"checkout",
|
|
627
|
+
"-b",
|
|
628
|
+
branch,
|
|
629
|
+
"FETCH_HEAD"
|
|
630
|
+
], {
|
|
631
|
+
env: authEnv,
|
|
632
|
+
timeoutMs: CHECKOUT_COMMAND_TIMEOUT_MS,
|
|
633
|
+
phase: "branch checkout retry"
|
|
634
|
+
});
|
|
635
|
+
if (retry.exitCode !== 0) {
|
|
636
|
+
if (isBlockedByLocalWork(retry)) return;
|
|
637
|
+
throw classifyGitFailure(retry, "clone-failed");
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* True when `git checkout -b` failed only because the branch ref already
|
|
642
|
+
* exists — the collision Factory hits when a pooled sandbox carries a ref the
|
|
643
|
+
* show-ref probe could not see (broken loose ref) or a concurrent
|
|
644
|
+
* materialization created the branch after the probe ran.
|
|
645
|
+
*/
|
|
646
|
+
function isBranchCollision(result) {
|
|
647
|
+
return /a branch named .* already exists/i.test(`${result.stderr || ""}\n${result.stdout || ""}`);
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
* True when a failed `git checkout` just means uncommitted or untracked files
|
|
651
|
+
* in the working tree would be clobbered by the branch switch. Those files are
|
|
652
|
+
* a session's work in progress — the switch must yield to them, never the
|
|
653
|
+
* other way around.
|
|
654
|
+
*/
|
|
655
|
+
function isBlockedByLocalWork(result) {
|
|
656
|
+
const output = `${result.stderr || ""}\n${result.stdout || ""}`;
|
|
657
|
+
return /Your local changes to the following files would be overwritten by checkout|untracked working tree files would be overwritten by checkout/i.test(output);
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* Return the origin URL when the workdir contains this repository, including a
|
|
661
|
+
* legacy checkout whose remote still embeds credentials.
|
|
662
|
+
*/
|
|
663
|
+
async function existingCheckoutRemote(sandbox, workdir, cloneUrl) {
|
|
664
|
+
const result = await execute(sandbox, "git", [
|
|
665
|
+
"-C",
|
|
666
|
+
workdir,
|
|
667
|
+
"remote",
|
|
668
|
+
"get-url",
|
|
669
|
+
"origin"
|
|
670
|
+
]);
|
|
671
|
+
if (result.exitCode !== 0) return null;
|
|
672
|
+
const url = result.stdout.trim();
|
|
673
|
+
const actual = normalizedRemoteUrl(url);
|
|
674
|
+
const expected = normalizedRemoteUrl(cloneUrl);
|
|
675
|
+
return actual !== null && expected !== null && actual === expected ? url : null;
|
|
676
|
+
}
|
|
677
|
+
/** Remove credentials persisted by an older implementation from origin. */
|
|
678
|
+
async function scrubRemote(sandbox, workdir, repoFullName, cloneUrl = cleanUrl(repoFullName)) {
|
|
679
|
+
let failure;
|
|
680
|
+
try {
|
|
681
|
+
const result = await execute(sandbox, "git", [
|
|
682
|
+
"-C",
|
|
683
|
+
workdir,
|
|
684
|
+
"remote",
|
|
685
|
+
"set-url",
|
|
686
|
+
"origin",
|
|
687
|
+
cloneUrl
|
|
688
|
+
]);
|
|
689
|
+
if (result.exitCode === 0) return;
|
|
690
|
+
failure = result.stderr.trim() || result.stdout.trim();
|
|
691
|
+
} catch (error) {
|
|
692
|
+
failure = error instanceof Error ? error.message : String(error);
|
|
693
|
+
}
|
|
694
|
+
throw new MaterializeError(`Failed to scrub installation token from git remote: ${failure}`, "pull-failed");
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* Turn a failed git command into an actionable error, detecting the common
|
|
698
|
+
* "cannot reach github.com" egress failure.
|
|
699
|
+
*/
|
|
700
|
+
function classifyGitFailure(result, fallback) {
|
|
701
|
+
const stderr = result.stderr || "";
|
|
702
|
+
if (/could not resolve host|failed to connect|network is unreachable|Connection timed out/i.test(stderr)) return new MaterializeError("The sandbox could not reach github.com. The sandbox network must allow outbound egress to github.com.", "egress-blocked");
|
|
703
|
+
return new MaterializeError(`git ${fallback === "clone-failed" ? "clone" : fallback === "pull-failed" ? "pull" : "push"} failed: ${stderr}`, fallback);
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* Resolve a concrete `{ name, email }` for git authorship from a possibly-sparse
|
|
707
|
+
* identity. Falls back to a GitHub-style noreply identity so commits are never
|
|
708
|
+
* authored with an empty or host-derived identity.
|
|
709
|
+
*/
|
|
710
|
+
function resolveGitIdentity(identity) {
|
|
711
|
+
const login = (identity.login || "").trim();
|
|
712
|
+
return {
|
|
713
|
+
name: (identity.name || "").trim() || login || "Mastra Code",
|
|
714
|
+
email: (identity.email || "").trim() || (login ? `${login}@users.noreply.github.com` : "mastra-code@users.noreply.github.com")
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
/** Configure repository-local commit identity through direct Git argv calls. */
|
|
718
|
+
async function configureGitIdentity(sandbox, workdir, identity) {
|
|
719
|
+
const { name, email } = resolveGitIdentity(identity);
|
|
720
|
+
const setName = await execute(sandbox, "git", [
|
|
721
|
+
"-C",
|
|
722
|
+
workdir,
|
|
723
|
+
"config",
|
|
724
|
+
"user.name",
|
|
725
|
+
name
|
|
726
|
+
]);
|
|
727
|
+
if (setName.exitCode !== 0) throw new MaterializeError(`Failed to set git user.name: ${setName.stderr.trim()}`, "commit-failed");
|
|
728
|
+
const setEmail = await execute(sandbox, "git", [
|
|
729
|
+
"-C",
|
|
730
|
+
workdir,
|
|
731
|
+
"config",
|
|
732
|
+
"user.email",
|
|
733
|
+
email
|
|
734
|
+
]);
|
|
735
|
+
if (setEmail.exitCode !== 0) throw new MaterializeError(`Failed to set git user.email: ${setEmail.stderr.trim()}`, "commit-failed");
|
|
736
|
+
}
|
|
737
|
+
async function pushAuthenticatedBranch(sandbox, workdir, branch, cloneUrl, token, username) {
|
|
738
|
+
const env = gitAuthenticationEnvironment(cloneUrl, token, username, "push-failed");
|
|
739
|
+
const push = await execute(sandbox, "git", [
|
|
740
|
+
"-C",
|
|
741
|
+
workdir,
|
|
742
|
+
"push",
|
|
743
|
+
"-u",
|
|
744
|
+
"origin",
|
|
745
|
+
branch
|
|
746
|
+
], { env });
|
|
747
|
+
if (push.exitCode !== 0) throw classifyGitFailure(push, "push-failed");
|
|
748
|
+
}
|
|
749
|
+
/** Whether the checkout has a local `refs/heads/<branch>`. */
|
|
750
|
+
async function hasLocalBranch(sandbox, workdir, branch) {
|
|
751
|
+
const ref = await execute(sandbox, "git", [
|
|
752
|
+
"-C",
|
|
753
|
+
workdir,
|
|
754
|
+
"show-ref",
|
|
755
|
+
"--verify",
|
|
756
|
+
"--quiet",
|
|
757
|
+
`refs/heads/${branch}`
|
|
758
|
+
]);
|
|
759
|
+
if (ref.exitCode === 0) return true;
|
|
760
|
+
if (ref.exitCode === 1) return false;
|
|
761
|
+
throw classifyGitFailure(ref, "push-failed");
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Make sure the checkout has a local `<branch>`. Where it was never created,
|
|
765
|
+
* create it at `HEAD` and switch to it, so the agent's next commits land on
|
|
766
|
+
* the branch every push sends; the index and working tree carry over.
|
|
767
|
+
*/
|
|
768
|
+
async function ensureLocalBranch(sandbox, workdir, branch) {
|
|
769
|
+
if (await hasLocalBranch(sandbox, workdir, branch)) return;
|
|
770
|
+
const created = await execute(sandbox, "git", [
|
|
771
|
+
"-C",
|
|
772
|
+
workdir,
|
|
773
|
+
"switch",
|
|
774
|
+
"-c",
|
|
775
|
+
branch
|
|
776
|
+
]);
|
|
777
|
+
if (created.exitCode !== 0) throw classifyGitFailure(created, "push-failed");
|
|
778
|
+
}
|
|
779
|
+
/** Whether `workdir` is a checkout of the repository at `cloneUrl`. */
|
|
780
|
+
async function isCheckoutOf(sandbox, workdir, cloneUrl) {
|
|
781
|
+
return await existingCheckoutRemote(sandbox, workdir, cloneUrl) !== null;
|
|
782
|
+
}
|
|
783
|
+
/**
|
|
784
|
+
* Push a branch back to GitHub with credentials scoped to the Git process.
|
|
785
|
+
* The token never enters argv, a repository URL, or persistent configuration.
|
|
786
|
+
*/
|
|
787
|
+
async function pushBranch(sandbox, workdir, branch, token, repoFullName) {
|
|
788
|
+
if (!isValidGitRef(branch)) throw new MaterializeError(`Refusing to push: invalid branch name '${branch}'.`, "push-failed");
|
|
789
|
+
if (!/^[\w.-]+(?:\/[\w.-]+)+$/.test(repoFullName)) throw new MaterializeError(`Refusing to push: invalid repo full name '${repoFullName}'.`, "push-failed");
|
|
790
|
+
await pushAuthenticatedBranch(sandbox, workdir, branch, cleanUrl(repoFullName), token, "x-access-token");
|
|
791
|
+
}
|
|
792
|
+
/**
|
|
793
|
+
* Push the active session branch through the provider-neutral repository
|
|
794
|
+
* access contract without persisting or exposing provider credentials.
|
|
795
|
+
*/
|
|
796
|
+
async function pushRepositoryBranch(sandbox, workdir, branch, access, repoFullName) {
|
|
797
|
+
if (!isValidGitRef(branch)) throw new MaterializeError(`Refusing to push: invalid branch name '${branch}'.`, "push-failed");
|
|
798
|
+
if (!/^[\w.-]+(?:\/[\w.-]+)+$/.test(repoFullName)) throw new MaterializeError(`Refusing to push: invalid repo full name '${repoFullName}'.`, "push-failed");
|
|
799
|
+
const authorization = access.authorization;
|
|
800
|
+
if (!authorization?.token) throw new MaterializeError("Repository access did not include push credentials.", "push-failed");
|
|
801
|
+
await pushAuthenticatedBranch(sandbox, workdir, branch, access.cloneUrl, authorization.token, authorization.username ?? "x-access-token");
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
804
|
+
* Stage every change in the working tree and create a commit inside the
|
|
805
|
+
* sandbox. The git identity is configured first so authorship is correct. When
|
|
806
|
+
* there is nothing to commit this is a no-op (`committed: false`) rather than an
|
|
807
|
+
* error, so callers can safely commit-then-push without first diffing.
|
|
808
|
+
*
|
|
809
|
+
* @param sandbox the live sandbox containing the checkout
|
|
810
|
+
* @param workdir the session workdir to commit in
|
|
811
|
+
* @param message the commit message (passed as one argv value)
|
|
812
|
+
* @param identity authorship identity for the commit
|
|
813
|
+
*/
|
|
814
|
+
async function commitAll(sandbox, workdir, message, identity) {
|
|
815
|
+
await configureGitIdentity(sandbox, workdir, identity);
|
|
816
|
+
const add = await execute(sandbox, "git", [
|
|
817
|
+
"-C",
|
|
818
|
+
workdir,
|
|
819
|
+
"add",
|
|
820
|
+
"-A"
|
|
821
|
+
]);
|
|
822
|
+
if (add.exitCode !== 0) throw new MaterializeError(`git add failed: ${add.stderr.trim() || add.stdout.trim()}`, "commit-failed");
|
|
823
|
+
if ((await execute(sandbox, "git", [
|
|
824
|
+
"-C",
|
|
825
|
+
workdir,
|
|
826
|
+
"diff",
|
|
827
|
+
"--cached",
|
|
828
|
+
"--quiet"
|
|
829
|
+
])).exitCode === 0) return { committed: false };
|
|
830
|
+
const commit = await execute(sandbox, "git", [
|
|
831
|
+
"-C",
|
|
832
|
+
workdir,
|
|
833
|
+
"commit",
|
|
834
|
+
"-m",
|
|
835
|
+
message
|
|
836
|
+
]);
|
|
837
|
+
if (commit.exitCode !== 0) throw new MaterializeError(`git commit failed: ${commit.stderr.trim() || commit.stdout.trim()}`, "commit-failed");
|
|
838
|
+
return { committed: true };
|
|
839
|
+
}
|
|
840
|
+
/** Error raised when the org's setup or teardown command fails in the sandbox. */
|
|
841
|
+
var SetupCommandError = class extends Error {
|
|
842
|
+
code;
|
|
843
|
+
constructor(message, code) {
|
|
844
|
+
super(message);
|
|
845
|
+
this.code = code;
|
|
846
|
+
this.name = "SetupCommandError";
|
|
847
|
+
}
|
|
848
|
+
};
|
|
849
|
+
/**
|
|
850
|
+
* Run the project's setup command (e.g. `pnpm i && pnpm build`) inside the
|
|
851
|
+
* freshly materialized session workdir. Called before the checkout is handed
|
|
852
|
+
* to any agent run so it is ready to build/test. A non-zero exit is a hard
|
|
853
|
+
* error — starting agent work in a half-set-up tree is worse than failing the
|
|
854
|
+
* request.
|
|
855
|
+
*
|
|
856
|
+
* Security model: the command is intentionally arbitrary shell — that is the
|
|
857
|
+
* feature (install deps, build, seed fixtures). It is only configurable by
|
|
858
|
+
* authenticated org members (the settings route is gated by
|
|
859
|
+
* `resolveOrgTenant` + org-scoped project lookup, with length and
|
|
860
|
+
* control-character validation), and it executes exclusively inside the
|
|
861
|
+
* project's isolated sandbox — the same environment where org members already
|
|
862
|
+
* run arbitrary shell via the agent's command tool. It never runs on the web
|
|
863
|
+
* server host, so it grants no privilege beyond what sandbox access already
|
|
864
|
+
* provides.
|
|
865
|
+
*
|
|
866
|
+
* @param sandbox live sandbox containing the checkout
|
|
867
|
+
* @param workdir the server-resolved session workdir the command runs in
|
|
868
|
+
* @param command the org-configured setup shell command
|
|
869
|
+
*/
|
|
870
|
+
async function runLifecycleCommand(sandbox, workdir, command, options) {
|
|
871
|
+
const result = await sh(sandbox, `cd ${shellQuote(workdir)} && { ${command}\n}`, {
|
|
872
|
+
phase: `${options.phase} command`,
|
|
873
|
+
...options.timeoutMs !== void 0 ? { timeoutMs: options.timeoutMs } : {}
|
|
874
|
+
});
|
|
875
|
+
if (result.exitCode !== 0) {
|
|
876
|
+
const detail = (result.stderr.trim() || result.stdout.trim()).slice(-1800);
|
|
877
|
+
throw new SetupCommandError(`${options.phase === "setup" ? "Setup" : "Teardown"} command failed (exit ${result.exitCode}): ${detail}`, options.phase === "setup" ? "setup-failed" : "teardown-failed");
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
async function runSetupCommand(sandbox, workdir, command) {
|
|
881
|
+
return runLifecycleCommand(sandbox, workdir, command, { phase: "setup" });
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* Run the repository's best-effort teardown command from the materialized
|
|
885
|
+
* session workdir. Callers own lifecycle policy: this helper reports failures
|
|
886
|
+
* so the retirement coordinator can log them while still continuing with
|
|
887
|
+
* scrub, pooling/destruction, cache invalidation, and row deletion.
|
|
888
|
+
*/
|
|
889
|
+
async function runTeardownCommand(sandbox, workdir, command, options = {}) {
|
|
890
|
+
return runLifecycleCommand(sandbox, workdir, command, {
|
|
891
|
+
phase: "teardown",
|
|
892
|
+
...options.timeoutMs !== void 0 ? { timeoutMs: options.timeoutMs } : {}
|
|
893
|
+
});
|
|
894
|
+
}
|
|
895
|
+
/**
|
|
896
|
+
* Preflight that `gh` is installed in the sandbox. Only called on the PR path so
|
|
897
|
+
* a missing `gh` never blocks clone/open. Surfaces an actionable error naming
|
|
898
|
+
* the sandbox template requirement.
|
|
899
|
+
*/
|
|
900
|
+
async function assertGhAvailable(sandbox) {
|
|
901
|
+
if ((await execute(sandbox, "gh", ["--version"])).exitCode !== 0) throw new MaterializeError("The GitHub CLI (gh) is not installed in the sandbox. The sandbox template must include gh to open pull requests.", "gh-missing");
|
|
902
|
+
}
|
|
903
|
+
/** Match the first GitHub PR URL in `gh pr create` output. */
|
|
904
|
+
function parsePullRequestUrl(stdout) {
|
|
905
|
+
return stdout.match(/https:\/\/github\.com\/[^\s]+\/pull\/\d+/)?.[0];
|
|
906
|
+
}
|
|
907
|
+
/**
|
|
908
|
+
* Open a pull request from inside the sandbox via `gh pr create`. The token is
|
|
909
|
+
* passed only through a per-invocation `GH_TOKEN` env scoped to the single `gh`
|
|
910
|
+
* process (never persisted), all arguments are passed as structured argv, and
|
|
911
|
+
* the resulting PR URL is parsed from stdout.
|
|
912
|
+
*
|
|
913
|
+
* @param sandbox live sandbox containing the checkout
|
|
914
|
+
* @param workdir the worktree (or repo) path the PR head branch is checked out in
|
|
915
|
+
*/
|
|
916
|
+
async function createPullRequest(sandbox, workdir, { token, base, head, title, body }) {
|
|
917
|
+
if (!isValidGitRef(base)) throw new MaterializeError(`Refusing to open PR: invalid base branch '${base}'.`, "pr-failed");
|
|
918
|
+
if (!isValidGitRef(head)) throw new MaterializeError(`Refusing to open PR: invalid head branch '${head}'.`, "pr-failed");
|
|
919
|
+
await assertGhAvailable(sandbox);
|
|
920
|
+
const result = await execute(sandbox, "gh", [
|
|
921
|
+
"pr",
|
|
922
|
+
"create",
|
|
923
|
+
"--base",
|
|
924
|
+
base,
|
|
925
|
+
"--head",
|
|
926
|
+
head,
|
|
927
|
+
"--title",
|
|
928
|
+
title,
|
|
929
|
+
"--body",
|
|
930
|
+
body ?? ""
|
|
931
|
+
], {
|
|
932
|
+
cwd: workdir,
|
|
933
|
+
env: { GH_TOKEN: token }
|
|
934
|
+
});
|
|
935
|
+
if (result.exitCode !== 0) {
|
|
936
|
+
const classified = classifyGitFailure(result, "push-failed");
|
|
937
|
+
if (classified.code === "egress-blocked") throw classified;
|
|
938
|
+
throw new MaterializeError(`gh pr create failed: ${result.stderr.trim() || result.stdout.trim()}`, "pr-failed");
|
|
939
|
+
}
|
|
940
|
+
const url = parsePullRequestUrl(result.stdout);
|
|
941
|
+
if (!url) throw new MaterializeError(`gh pr create succeeded but no PR URL was found in its output: ${result.stdout.trim()}`, "pr-failed");
|
|
942
|
+
return { url };
|
|
943
|
+
}
|
|
944
|
+
//#endregion
|
|
945
|
+
export { CHECKOUT_COMMAND_TIMEOUT_MS, DEFAULT_COMMAND_TIMEOUT_MS, MaterializeError, SetupCommandError, checkoutSessionBranch, commitAll, configureGitIdentity, createPullRequest, ensureLocalBranch, hasLocalBranch, isCheckoutOf, isValidGitRef, materializeRepo, pushBranch, pushRepositoryBranch, refreshMergeRequestCheckout, resolveGitIdentity, runSetupCommand, runTeardownCommand, sh, shellQuote, syncEnvironmentRepository };
|
|
946
|
+
|
|
947
|
+
//# sourceMappingURL=sandbox.js.map
|