@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,919 @@
|
|
|
1
|
+
import { redactCredentials } from "../environment/build.js";
|
|
2
|
+
import { ensureSchedule, invalidCronMessage, readSchedule, scheduleIdFor } from "../environment/build-schedule.js";
|
|
3
|
+
import { ACTIVE_RUN_BINDING_STAGES } from "../storage/domains/work-items/base.js";
|
|
4
|
+
import { FACTORY_ROUTE_CONTRACTS } from "./contracts.js";
|
|
5
|
+
import { Route } from "./route.js";
|
|
6
|
+
import { registerApiRoute } from "@mastra/core/server";
|
|
7
|
+
import { describeFactorySandbox, normalizeFactorySandboxSettings } from "@mastra/core/workspace";
|
|
8
|
+
import { MastraError } from "@mastra/core/error";
|
|
9
|
+
//#region src/routes/projects.ts
|
|
10
|
+
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
11
|
+
const MAX_NAME_LENGTH = 200;
|
|
12
|
+
const MAX_REPOSITORY_COMMAND_LENGTH = 2e3;
|
|
13
|
+
const MAX_BRANCH_LENGTH = 255;
|
|
14
|
+
const MAX_SANDBOX_PROVIDER_LENGTH = 100;
|
|
15
|
+
const MAX_SANDBOX_WORKDIR_LENGTH = 1e3;
|
|
16
|
+
const CONTROL_CHAR_RE = /[\0-\x08\x0b\x0c\x0e-\x1f\x7f]/;
|
|
17
|
+
function loose(context) {
|
|
18
|
+
return context;
|
|
19
|
+
}
|
|
20
|
+
async function readJson(context) {
|
|
21
|
+
try {
|
|
22
|
+
return await context.req.json();
|
|
23
|
+
} catch {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function parseConnectionInput(value) {
|
|
28
|
+
if (!value || typeof value !== "object") return null;
|
|
29
|
+
const input = value;
|
|
30
|
+
if (typeof input.integrationId !== "string" || !input.integrationId.trim()) return null;
|
|
31
|
+
if (typeof input.installationId !== "string" || !UUID_RE.test(input.installationId)) return null;
|
|
32
|
+
return {
|
|
33
|
+
integrationId: input.integrationId.trim(),
|
|
34
|
+
installationId: input.installationId
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function parseOptionalString(value, { maxLength, nullable = false }) {
|
|
38
|
+
if (value === void 0) return void 0;
|
|
39
|
+
if (value === null) return nullable ? null : false;
|
|
40
|
+
if (typeof value !== "string") return false;
|
|
41
|
+
const normalized = value.trim();
|
|
42
|
+
if (!normalized) return nullable ? null : false;
|
|
43
|
+
if (normalized.length > maxLength || CONTROL_CHAR_RE.test(normalized)) return false;
|
|
44
|
+
return normalized;
|
|
45
|
+
}
|
|
46
|
+
function parseRepositoryLinkInput(value) {
|
|
47
|
+
if (!value || typeof value !== "object") return null;
|
|
48
|
+
const input = value;
|
|
49
|
+
const repositoryId = typeof input.repositoryId === "string" && UUID_RE.test(input.repositoryId) ? input.repositoryId : void 0;
|
|
50
|
+
const repositoryInput = input.repository;
|
|
51
|
+
let repository;
|
|
52
|
+
if (repositoryInput && typeof repositoryInput === "object") {
|
|
53
|
+
const candidate = repositoryInput;
|
|
54
|
+
const externalId = parseOptionalString(candidate.externalId, { maxLength: MAX_NAME_LENGTH });
|
|
55
|
+
const slug = parseOptionalString(candidate.slug, { maxLength: MAX_NAME_LENGTH });
|
|
56
|
+
if (typeof externalId !== "string" || typeof slug !== "string") return null;
|
|
57
|
+
repository = {
|
|
58
|
+
externalId,
|
|
59
|
+
slug
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
if (!repositoryId && !repository) return null;
|
|
63
|
+
const branch = parseOptionalString(input.branch, {
|
|
64
|
+
maxLength: MAX_BRANCH_LENGTH,
|
|
65
|
+
nullable: true
|
|
66
|
+
});
|
|
67
|
+
const sandboxProvider = parseOptionalString(input.sandboxProvider, { maxLength: MAX_SANDBOX_PROVIDER_LENGTH });
|
|
68
|
+
const sandboxWorkdir = parseOptionalString(input.sandboxWorkdir, { maxLength: MAX_SANDBOX_WORKDIR_LENGTH });
|
|
69
|
+
const setupCommand = parseOptionalString(input.setupCommand, {
|
|
70
|
+
maxLength: MAX_REPOSITORY_COMMAND_LENGTH,
|
|
71
|
+
nullable: true
|
|
72
|
+
});
|
|
73
|
+
const teardownCommand = parseOptionalString(input.teardownCommand, {
|
|
74
|
+
maxLength: MAX_REPOSITORY_COMMAND_LENGTH,
|
|
75
|
+
nullable: true
|
|
76
|
+
});
|
|
77
|
+
if (branch === false || typeof sandboxProvider !== "string" || typeof sandboxWorkdir !== "string" || setupCommand === false || teardownCommand === false) return null;
|
|
78
|
+
return {
|
|
79
|
+
...repositoryId ? { repositoryId } : {},
|
|
80
|
+
...repository ? { repository } : {},
|
|
81
|
+
branch: branch ?? null,
|
|
82
|
+
sandboxProvider,
|
|
83
|
+
sandboxWorkdir,
|
|
84
|
+
setupCommand: setupCommand ?? null,
|
|
85
|
+
teardownCommand: teardownCommand ?? null
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function parseRepositoryUpdateInput(value) {
|
|
89
|
+
if (!value || typeof value !== "object") return null;
|
|
90
|
+
const input = value;
|
|
91
|
+
const patch = {};
|
|
92
|
+
const branch = parseOptionalString(input.branch, {
|
|
93
|
+
maxLength: MAX_BRANCH_LENGTH,
|
|
94
|
+
nullable: true
|
|
95
|
+
});
|
|
96
|
+
const sandboxProvider = parseOptionalString(input.sandboxProvider, { maxLength: MAX_SANDBOX_PROVIDER_LENGTH });
|
|
97
|
+
const sandboxWorkdir = parseOptionalString(input.sandboxWorkdir, { maxLength: MAX_SANDBOX_WORKDIR_LENGTH });
|
|
98
|
+
const setupCommand = parseOptionalString(input.setupCommand, {
|
|
99
|
+
maxLength: MAX_REPOSITORY_COMMAND_LENGTH,
|
|
100
|
+
nullable: true
|
|
101
|
+
});
|
|
102
|
+
const teardownCommand = parseOptionalString(input.teardownCommand, {
|
|
103
|
+
maxLength: MAX_REPOSITORY_COMMAND_LENGTH,
|
|
104
|
+
nullable: true
|
|
105
|
+
});
|
|
106
|
+
if (branch === false || sandboxProvider === false || sandboxProvider === null || sandboxWorkdir === false || sandboxWorkdir === null || setupCommand === false || teardownCommand === false) return null;
|
|
107
|
+
if (branch !== void 0) patch.branch = branch;
|
|
108
|
+
if (sandboxProvider !== void 0) patch.sandboxProvider = sandboxProvider;
|
|
109
|
+
if (sandboxWorkdir !== void 0) patch.sandboxWorkdir = sandboxWorkdir;
|
|
110
|
+
if (setupCommand !== void 0) patch.setupCommand = setupCommand;
|
|
111
|
+
if (teardownCommand !== void 0) patch.teardownCommand = teardownCommand;
|
|
112
|
+
return Object.keys(patch).length > 0 ? patch : null;
|
|
113
|
+
}
|
|
114
|
+
/** Provider output is shown to the user; strip any clone credential from it first. */
|
|
115
|
+
function redactBuild(build) {
|
|
116
|
+
return {
|
|
117
|
+
...build,
|
|
118
|
+
...build.error !== void 0 ? { error: redactCredentials(build.error) } : {},
|
|
119
|
+
...build.logs ? { logs: build.logs.map(redactCredentials) } : {}
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
/** What the environment reports when the factory has no sandbox configured. */
|
|
123
|
+
const NO_SANDBOX = {
|
|
124
|
+
provider: "none",
|
|
125
|
+
settingsSchema: {
|
|
126
|
+
type: "object",
|
|
127
|
+
properties: {},
|
|
128
|
+
additionalProperties: false
|
|
129
|
+
},
|
|
130
|
+
capabilities: {
|
|
131
|
+
template: false,
|
|
132
|
+
builds: {
|
|
133
|
+
available: false,
|
|
134
|
+
history: false
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
var ProjectRoutes = class extends Route {
|
|
139
|
+
#versionControlIntegrationIds;
|
|
140
|
+
#sandboxDescription;
|
|
141
|
+
#settingsSchema;
|
|
142
|
+
constructor(deps) {
|
|
143
|
+
super(deps);
|
|
144
|
+
this.#versionControlIntegrationIds = new Set(deps.versionControlIntegrationIds ?? []);
|
|
145
|
+
}
|
|
146
|
+
#describeSandbox() {
|
|
147
|
+
if (!this.deps.sandbox) return NO_SANDBOX;
|
|
148
|
+
this.#sandboxDescription ??= describeFactorySandbox(this.deps.sandbox);
|
|
149
|
+
return this.#sandboxDescription;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Merge a settings patch onto the stored document (null removes a key) and
|
|
153
|
+
* validate the result through the sandbox's schema. Returns the issues when
|
|
154
|
+
* the merged document is rejected.
|
|
155
|
+
*
|
|
156
|
+
* A stored key the current schema does not declare, or whose stored value it
|
|
157
|
+
* now rejects (a tightened range or choice list), is left over from another
|
|
158
|
+
* provider or an older schema. When the merged document fails validation, the
|
|
159
|
+
* merge retries without those keys so one stale value cannot lock every later
|
|
160
|
+
* update; keys the patch itself sets are never pruned.
|
|
161
|
+
*/
|
|
162
|
+
async #mergeSettings(stored, patch) {
|
|
163
|
+
const merged = { ...stored };
|
|
164
|
+
for (const [key, value] of Object.entries(patch)) if (value === null) delete merged[key];
|
|
165
|
+
else merged[key] = value;
|
|
166
|
+
this.#settingsSchema ??= normalizeFactorySandboxSettings(this.deps.sandbox);
|
|
167
|
+
const result = await this.#settingsSchema["~standard"].validate(merged);
|
|
168
|
+
if (!result.issues) return { merged: Object.keys(merged).length > 0 ? merged : null };
|
|
169
|
+
const declared = this.#describeSandbox().settingsSchema.properties ?? {};
|
|
170
|
+
const rejected = new Set(result.issues.map((issue) => {
|
|
171
|
+
const segment = issue.path?.[0];
|
|
172
|
+
return typeof segment === "object" && segment !== null ? segment.key : segment;
|
|
173
|
+
}));
|
|
174
|
+
const pruned = Object.fromEntries(Object.entries(merged).filter(([key]) => key in patch || Object.hasOwn(declared, key) && !rejected.has(key)));
|
|
175
|
+
if (Object.keys(pruned).length === Object.keys(merged).length) return { issues: result.issues };
|
|
176
|
+
if ((await this.#settingsSchema["~standard"].validate(pruned)).issues) return { issues: result.issues };
|
|
177
|
+
return { merged: Object.keys(pruned).length > 0 ? pruned : null };
|
|
178
|
+
}
|
|
179
|
+
async #projects() {
|
|
180
|
+
await this.deps.projects.ensureReady();
|
|
181
|
+
return this.deps.projects;
|
|
182
|
+
}
|
|
183
|
+
async #sourceControl() {
|
|
184
|
+
await this.deps.sourceControl.ensureReady();
|
|
185
|
+
return this.deps.sourceControl;
|
|
186
|
+
}
|
|
187
|
+
async #handles() {
|
|
188
|
+
const storage = await this.#sourceControl();
|
|
189
|
+
return [...this.#versionControlIntegrationIds].map((integrationId) => storage.forIntegration(integrationId));
|
|
190
|
+
}
|
|
191
|
+
async #project(orgId, id) {
|
|
192
|
+
return (await this.#projects()).get({
|
|
193
|
+
orgId,
|
|
194
|
+
id
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
async #findConnection({ orgId, projectId, id }) {
|
|
198
|
+
for (const handle of await this.#handles()) {
|
|
199
|
+
const connection = await handle.connections.get({
|
|
200
|
+
orgId,
|
|
201
|
+
id
|
|
202
|
+
});
|
|
203
|
+
if (connection?.factoryProjectId === projectId) return {
|
|
204
|
+
handle,
|
|
205
|
+
connection
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
async #findProjectRepository({ orgId, projectId, id }) {
|
|
211
|
+
for (const handle of await this.#handles()) {
|
|
212
|
+
const projectRepository = await handle.projectRepositories.get({
|
|
213
|
+
orgId,
|
|
214
|
+
id
|
|
215
|
+
});
|
|
216
|
+
if (!projectRepository) continue;
|
|
217
|
+
const connection = await handle.connections.get({
|
|
218
|
+
orgId,
|
|
219
|
+
id: projectRepository.connectionId
|
|
220
|
+
});
|
|
221
|
+
if (connection?.factoryProjectId === projectId) return {
|
|
222
|
+
handle,
|
|
223
|
+
connection,
|
|
224
|
+
projectRepository
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
async #repositoryPayload(handle, orgId, projectRepository) {
|
|
230
|
+
const repository = await handle.repositories.get({
|
|
231
|
+
orgId,
|
|
232
|
+
id: projectRepository.repositoryId
|
|
233
|
+
});
|
|
234
|
+
return {
|
|
235
|
+
...projectRepository,
|
|
236
|
+
repository
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
/** Every link of the project across every handle, with the handle that owns it, in position order. */
|
|
240
|
+
async #environmentLinks(orgId, projectId) {
|
|
241
|
+
const links = [];
|
|
242
|
+
for (const handle of await this.#handles()) for (const projectRepository of await handle.projectRepositories.listByProject({
|
|
243
|
+
orgId,
|
|
244
|
+
factoryProjectId: projectId
|
|
245
|
+
})) links.push({
|
|
246
|
+
handle,
|
|
247
|
+
projectRepository
|
|
248
|
+
});
|
|
249
|
+
return links.sort((a, b) => a.projectRepository.position - b.projectRepository.position || a.projectRepository.createdAt.getTime() - b.projectRepository.createdAt.getTime());
|
|
250
|
+
}
|
|
251
|
+
async #environmentPayload(orgId, project) {
|
|
252
|
+
const repositories = [];
|
|
253
|
+
for (const { handle, projectRepository } of await this.#environmentLinks(orgId, project.id)) {
|
|
254
|
+
const repository = await handle.repositories.get({
|
|
255
|
+
orgId,
|
|
256
|
+
id: projectRepository.repositoryId
|
|
257
|
+
});
|
|
258
|
+
repositories.push({
|
|
259
|
+
projectRepositoryId: projectRepository.id,
|
|
260
|
+
connectionId: projectRepository.connectionId,
|
|
261
|
+
repositoryId: projectRepository.repositoryId,
|
|
262
|
+
slug: repository?.slug ?? null,
|
|
263
|
+
defaultBranch: repository?.defaultBranch ?? null,
|
|
264
|
+
position: projectRepository.position,
|
|
265
|
+
inEnvironment: projectRepository.inEnvironment,
|
|
266
|
+
setupCommand: projectRepository.setupCommand,
|
|
267
|
+
teardownCommand: projectRepository.teardownCommand,
|
|
268
|
+
lastBuildStatus: projectRepository.lastBuildStatus,
|
|
269
|
+
lastBuildError: projectRepository.lastBuildError,
|
|
270
|
+
lastBuiltAt: projectRepository.lastBuiltAt
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
return { environment: {
|
|
274
|
+
sandbox: this.#describeSandbox(),
|
|
275
|
+
settings: project.sandboxSettings ?? {},
|
|
276
|
+
sandboxWorkingDirectory: project.sandboxWorkingDirectory,
|
|
277
|
+
workspaceSetupCommand: project.workspaceSetupCommand,
|
|
278
|
+
activeTemplateId: project.activeTemplateId,
|
|
279
|
+
activeTemplateHeads: project.activeTemplateHeads,
|
|
280
|
+
repositories,
|
|
281
|
+
...await this.#buildPayload(project)
|
|
282
|
+
} };
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* The build keys of the environment payload, present only when the
|
|
286
|
+
* sandbox can build. Reads the project row and the schedule row; never
|
|
287
|
+
* the provider (live status is the builds routes' job).
|
|
288
|
+
*/
|
|
289
|
+
async #buildPayload(project) {
|
|
290
|
+
const builds = this.deps.environmentBuilds;
|
|
291
|
+
if (!builds) return {};
|
|
292
|
+
const schedules = builds.scheduleAvailable ? builds.schedules() : void 0;
|
|
293
|
+
return {
|
|
294
|
+
buildTriggers: {
|
|
295
|
+
schedule: {
|
|
296
|
+
...schedules ? await readSchedule(schedules, project.id) : {
|
|
297
|
+
enabled: false,
|
|
298
|
+
cron: null,
|
|
299
|
+
timezone: null
|
|
300
|
+
},
|
|
301
|
+
scheduleAvailable: builds.scheduleAvailable
|
|
302
|
+
},
|
|
303
|
+
push: {
|
|
304
|
+
enabled: project.buildOnPushEnabled,
|
|
305
|
+
debounceMinutes: project.buildPushDebounceMinutes
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
build: project.lastBuildId ? {
|
|
309
|
+
buildId: project.lastBuildId,
|
|
310
|
+
attemptedAt: project.lastBuildAttemptedAt?.toISOString() ?? null
|
|
311
|
+
} : null
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
/** The builds capability behind the routes, or the 404 to answer with. */
|
|
315
|
+
#builds(context) {
|
|
316
|
+
const builds = this.deps.sandbox?.builds;
|
|
317
|
+
const runner = this.deps.environmentBuilds;
|
|
318
|
+
if (!builds || !runner) return { response: context.json({ error: "no_builds" }, 404) };
|
|
319
|
+
return {
|
|
320
|
+
builds,
|
|
321
|
+
runner
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
#buildRoutes() {
|
|
325
|
+
return [
|
|
326
|
+
registerApiRoute(FACTORY_ROUTE_CONTRACTS.projectEnvironmentBuild.path, {
|
|
327
|
+
method: FACTORY_ROUTE_CONTRACTS.projectEnvironmentBuild.method,
|
|
328
|
+
requiresAuth: false,
|
|
329
|
+
handler: async (routeContext) => {
|
|
330
|
+
const context = loose(routeContext);
|
|
331
|
+
const tenant = await this.#resolveTenant(context);
|
|
332
|
+
if ("response" in tenant) return tenant.response;
|
|
333
|
+
const projectId = context.req.param("id");
|
|
334
|
+
if (!projectId || !UUID_RE.test(projectId)) return context.json({ error: "Project not found" }, 404);
|
|
335
|
+
const project = await this.#project(tenant.orgId, projectId);
|
|
336
|
+
if (!project) return context.json({ error: "Project not found" }, 404);
|
|
337
|
+
const capability = this.#builds(context);
|
|
338
|
+
if ("response" in capability) return capability.response;
|
|
339
|
+
const { heads: _heads, ...outcome } = await capability.runner.start(project.id, "manual");
|
|
340
|
+
return context.json(outcome);
|
|
341
|
+
}
|
|
342
|
+
}),
|
|
343
|
+
registerApiRoute(FACTORY_ROUTE_CONTRACTS.projectEnvironmentBuilds.path, {
|
|
344
|
+
method: FACTORY_ROUTE_CONTRACTS.projectEnvironmentBuilds.method,
|
|
345
|
+
requiresAuth: false,
|
|
346
|
+
handler: async (routeContext) => {
|
|
347
|
+
const context = loose(routeContext);
|
|
348
|
+
const tenant = await this.#resolveTenant(context);
|
|
349
|
+
if ("response" in tenant) return tenant.response;
|
|
350
|
+
const projectId = context.req.param("id");
|
|
351
|
+
if (!projectId || !UUID_RE.test(projectId)) return context.json({ error: "Project not found" }, 404);
|
|
352
|
+
const project = await this.#project(tenant.orgId, projectId);
|
|
353
|
+
if (!project) return context.json({ error: "Project not found" }, 404);
|
|
354
|
+
const capability = this.#builds(context);
|
|
355
|
+
if ("response" in capability) return capability.response;
|
|
356
|
+
if (!capability.builds.list) return context.json({ error: "no_history" }, 404);
|
|
357
|
+
const read = await capability.runner.readContext(project.id);
|
|
358
|
+
if (!read) return context.json({ error: "no_environment" }, 404);
|
|
359
|
+
const builds = await capability.builds.list(read.ctx, read.settings);
|
|
360
|
+
return context.json({ builds: builds.map(redactBuild) });
|
|
361
|
+
}
|
|
362
|
+
}),
|
|
363
|
+
registerApiRoute(FACTORY_ROUTE_CONTRACTS.projectEnvironmentBuildGet.path, {
|
|
364
|
+
method: FACTORY_ROUTE_CONTRACTS.projectEnvironmentBuildGet.method,
|
|
365
|
+
requiresAuth: false,
|
|
366
|
+
handler: async (routeContext) => {
|
|
367
|
+
const context = loose(routeContext);
|
|
368
|
+
const tenant = await this.#resolveTenant(context);
|
|
369
|
+
if ("response" in tenant) return tenant.response;
|
|
370
|
+
const projectId = context.req.param("id");
|
|
371
|
+
if (!projectId || !UUID_RE.test(projectId)) return context.json({ error: "Project not found" }, 404);
|
|
372
|
+
const project = await this.#project(tenant.orgId, projectId);
|
|
373
|
+
if (!project) return context.json({ error: "Project not found" }, 404);
|
|
374
|
+
const capability = this.#builds(context);
|
|
375
|
+
if ("response" in capability) return capability.response;
|
|
376
|
+
const buildId = context.req.param("buildId") ?? "";
|
|
377
|
+
if (!buildId) return context.json({ error: "Build not found" }, 404);
|
|
378
|
+
const read = await capability.runner.readContext(project.id);
|
|
379
|
+
if (!read) return context.json({ error: "no_environment" }, 404);
|
|
380
|
+
if (buildId !== project.lastBuildId) {
|
|
381
|
+
if (!(capability.builds.list ? await capability.builds.list(read.ctx, read.settings) : []).some((build) => build.buildId === buildId)) return context.json({ error: "Build not found" }, 404);
|
|
382
|
+
}
|
|
383
|
+
return context.json({ build: redactBuild(await capability.builds.get(read.ctx, read.settings, buildId)) });
|
|
384
|
+
}
|
|
385
|
+
})
|
|
386
|
+
];
|
|
387
|
+
}
|
|
388
|
+
/** Best effort: a deleted project's cron schedule must not keep firing. */
|
|
389
|
+
async #dropSchedule(projectId) {
|
|
390
|
+
const runner = this.deps.environmentBuilds;
|
|
391
|
+
if (!runner?.scheduleAvailable) return;
|
|
392
|
+
try {
|
|
393
|
+
await runner.schedules().delete(scheduleIdFor(projectId));
|
|
394
|
+
} catch (error) {
|
|
395
|
+
if (error instanceof MastraError && error.id === "SCHEDULES_NOT_FOUND") return;
|
|
396
|
+
console.warn("[factory] could not delete the environment build schedule of a deleted project:", error);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
async #retireProjectRepositorySessions(handle, orgId, projectRepositoryId) {
|
|
400
|
+
if ((await handle.sessions.listByProjectRepository({ projectRepositoryId })).length === 0) return true;
|
|
401
|
+
if (!this.deps.sessionRetirement) return false;
|
|
402
|
+
await this.deps.sessionRetirement.retireProjectRepositorySessions({
|
|
403
|
+
sourceControl: handle,
|
|
404
|
+
...this.deps.workItems ? { workItems: this.deps.workItems } : {},
|
|
405
|
+
orgId,
|
|
406
|
+
projectRepositoryId
|
|
407
|
+
});
|
|
408
|
+
return true;
|
|
409
|
+
}
|
|
410
|
+
async #resolveTenant(context) {
|
|
411
|
+
await this.deps.auth.ensureUser(context);
|
|
412
|
+
const tenant = this.deps.auth.tenant(context);
|
|
413
|
+
if (!tenant) return { response: context.json({ error: "unauthorized" }, 401) };
|
|
414
|
+
if (!tenant.orgId) return { response: context.json({
|
|
415
|
+
error: "organization_required",
|
|
416
|
+
message: "Factory projects require an organization."
|
|
417
|
+
}, 403) };
|
|
418
|
+
return {
|
|
419
|
+
orgId: tenant.orgId,
|
|
420
|
+
userId: tenant.userId
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
routes() {
|
|
424
|
+
return [
|
|
425
|
+
registerApiRoute(FACTORY_ROUTE_CONTRACTS.projectList.path, {
|
|
426
|
+
method: FACTORY_ROUTE_CONTRACTS.projectList.method,
|
|
427
|
+
requiresAuth: false,
|
|
428
|
+
handler: async (routeContext) => {
|
|
429
|
+
const context = loose(routeContext);
|
|
430
|
+
const tenant = await this.#resolveTenant(context);
|
|
431
|
+
if ("response" in tenant) return tenant.response;
|
|
432
|
+
return context.json({ projects: await (await this.#projects()).list({ orgId: tenant.orgId }) });
|
|
433
|
+
}
|
|
434
|
+
}),
|
|
435
|
+
registerApiRoute(FACTORY_ROUTE_CONTRACTS.projectCreate.path, {
|
|
436
|
+
method: FACTORY_ROUTE_CONTRACTS.projectCreate.method,
|
|
437
|
+
requiresAuth: false,
|
|
438
|
+
handler: async (routeContext) => {
|
|
439
|
+
const context = loose(routeContext);
|
|
440
|
+
const tenant = await this.#resolveTenant(context);
|
|
441
|
+
if ("response" in tenant) return tenant.response;
|
|
442
|
+
const parsed = FACTORY_ROUTE_CONTRACTS.projectCreate.bodySchema.safeParse(await readJson(context));
|
|
443
|
+
if (!parsed.success) return context.json({ error: "invalid_project" }, 400);
|
|
444
|
+
const project = await (await this.#projects()).create({
|
|
445
|
+
orgId: tenant.orgId,
|
|
446
|
+
userId: tenant.userId,
|
|
447
|
+
input: parsed.data
|
|
448
|
+
});
|
|
449
|
+
return context.json({ project }, 201);
|
|
450
|
+
}
|
|
451
|
+
}),
|
|
452
|
+
registerApiRoute(FACTORY_ROUTE_CONTRACTS.projectGet.path, {
|
|
453
|
+
method: FACTORY_ROUTE_CONTRACTS.projectGet.method,
|
|
454
|
+
requiresAuth: false,
|
|
455
|
+
handler: async (routeContext) => {
|
|
456
|
+
const context = loose(routeContext);
|
|
457
|
+
const tenant = await this.#resolveTenant(context);
|
|
458
|
+
if ("response" in tenant) return tenant.response;
|
|
459
|
+
const parsedPath = FACTORY_ROUTE_CONTRACTS.projectGet.pathSchema.safeParse({ id: context.req.param("id") });
|
|
460
|
+
if (!parsedPath.success) return context.json({ error: "Project not found" }, 404);
|
|
461
|
+
const { id } = parsedPath.data;
|
|
462
|
+
const project = await this.#project(tenant.orgId, id);
|
|
463
|
+
return project ? context.json({ project }) : context.json({ error: "Project not found" }, 404);
|
|
464
|
+
}
|
|
465
|
+
}),
|
|
466
|
+
registerApiRoute(FACTORY_ROUTE_CONTRACTS.projectUpdate.path, {
|
|
467
|
+
method: FACTORY_ROUTE_CONTRACTS.projectUpdate.method,
|
|
468
|
+
requiresAuth: false,
|
|
469
|
+
handler: async (routeContext) => {
|
|
470
|
+
const context = loose(routeContext);
|
|
471
|
+
const tenant = await this.#resolveTenant(context);
|
|
472
|
+
if ("response" in tenant) return tenant.response;
|
|
473
|
+
const parsedPath = FACTORY_ROUTE_CONTRACTS.projectUpdate.pathSchema.safeParse({ id: context.req.param("id") });
|
|
474
|
+
if (!parsedPath.success) return context.json({ error: "Project not found" }, 404);
|
|
475
|
+
const parsedBody = FACTORY_ROUTE_CONTRACTS.projectUpdate.bodySchema.safeParse(await readJson(context));
|
|
476
|
+
if (!parsedBody.success) return context.json({ error: "invalid_project" }, 400);
|
|
477
|
+
if (parsedBody.data.modelScope !== void 0 && this.deps.auth.enabled() && !await this.deps.auth.isOrganizationAdmin(context, tenant.orgId)) return context.json({
|
|
478
|
+
error: "forbidden",
|
|
479
|
+
message: "Organization administrator access is required to change the model scope."
|
|
480
|
+
}, 403);
|
|
481
|
+
const project = await (await this.#projects()).update({
|
|
482
|
+
orgId: tenant.orgId,
|
|
483
|
+
id: parsedPath.data.id,
|
|
484
|
+
input: parsedBody.data
|
|
485
|
+
});
|
|
486
|
+
return project ? context.json({ project }) : context.json({ error: "Project not found" }, 404);
|
|
487
|
+
}
|
|
488
|
+
}),
|
|
489
|
+
registerApiRoute(FACTORY_ROUTE_CONTRACTS.projectApplyDefaultModel.path, {
|
|
490
|
+
method: FACTORY_ROUTE_CONTRACTS.projectApplyDefaultModel.method,
|
|
491
|
+
requiresAuth: false,
|
|
492
|
+
handler: async (routeContext) => {
|
|
493
|
+
const context = loose(routeContext);
|
|
494
|
+
const tenant = await this.#resolveTenant(context);
|
|
495
|
+
if ("response" in tenant) return tenant.response;
|
|
496
|
+
if (!await this.deps.auth.isOrganizationAdmin(context, tenant.orgId)) return context.json({
|
|
497
|
+
error: "forbidden",
|
|
498
|
+
message: "Organization administrator access is required to update running sessions."
|
|
499
|
+
}, 403);
|
|
500
|
+
const parsedPath = FACTORY_ROUTE_CONTRACTS.projectApplyDefaultModel.pathSchema.safeParse({ id: context.req.param("id") });
|
|
501
|
+
if (!parsedPath.success) return context.json({ error: "Project not found" }, 404);
|
|
502
|
+
const project = await this.#project(tenant.orgId, parsedPath.data.id);
|
|
503
|
+
if (!project) return context.json({ error: "Project not found" }, 404);
|
|
504
|
+
const modelId = project.defaultModelId;
|
|
505
|
+
if (!modelId) return context.json({
|
|
506
|
+
error: "default_model_not_set",
|
|
507
|
+
message: "Set a default model on the project first."
|
|
508
|
+
}, 400);
|
|
509
|
+
const { workItems, controller } = this.deps;
|
|
510
|
+
if (!workItems || !controller) return context.json({ error: "model_apply_unavailable" }, 503);
|
|
511
|
+
const bindings = (await workItems.listRunBindings(tenant.orgId, project.id)).filter((binding) => binding.status === "active");
|
|
512
|
+
const seen = /* @__PURE__ */ new Set();
|
|
513
|
+
const applied = [];
|
|
514
|
+
const skipped = [];
|
|
515
|
+
for (const binding of bindings) {
|
|
516
|
+
const key = `${binding.sessionId}:${binding.threadId}`;
|
|
517
|
+
if (seen.has(key)) continue;
|
|
518
|
+
seen.add(key);
|
|
519
|
+
const item = await workItems.get({
|
|
520
|
+
orgId: tenant.orgId,
|
|
521
|
+
id: binding.workItemId
|
|
522
|
+
});
|
|
523
|
+
if (!item || item.factoryProjectId !== project.id) {
|
|
524
|
+
skipped.push({
|
|
525
|
+
threadId: binding.threadId,
|
|
526
|
+
reason: "work-item-missing"
|
|
527
|
+
});
|
|
528
|
+
continue;
|
|
529
|
+
}
|
|
530
|
+
if (!ACTIVE_RUN_BINDING_STAGES.has(item.stages[0] ?? "")) {
|
|
531
|
+
skipped.push({
|
|
532
|
+
threadId: binding.threadId,
|
|
533
|
+
reason: "stage-inactive"
|
|
534
|
+
});
|
|
535
|
+
continue;
|
|
536
|
+
}
|
|
537
|
+
const session = await controller.getSessionByResource(binding.resourceId);
|
|
538
|
+
if (!session) {
|
|
539
|
+
skipped.push({
|
|
540
|
+
threadId: binding.threadId,
|
|
541
|
+
reason: "not-running"
|
|
542
|
+
});
|
|
543
|
+
continue;
|
|
544
|
+
}
|
|
545
|
+
if (!await session.thread.getById({ threadId: binding.threadId })) {
|
|
546
|
+
skipped.push({
|
|
547
|
+
threadId: binding.threadId,
|
|
548
|
+
reason: "thread-missing"
|
|
549
|
+
});
|
|
550
|
+
continue;
|
|
551
|
+
}
|
|
552
|
+
try {
|
|
553
|
+
await session.thread.setSettingOn({
|
|
554
|
+
threadId: binding.threadId,
|
|
555
|
+
key: "currentModelId",
|
|
556
|
+
value: modelId
|
|
557
|
+
});
|
|
558
|
+
applied.push(binding.threadId);
|
|
559
|
+
} catch (error) {
|
|
560
|
+
console.warn("[factory] apply-default-model failed for thread", binding.threadId, error);
|
|
561
|
+
skipped.push({
|
|
562
|
+
threadId: binding.threadId,
|
|
563
|
+
reason: "apply-failed"
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
return context.json({
|
|
568
|
+
modelId,
|
|
569
|
+
applied,
|
|
570
|
+
skipped
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
}),
|
|
574
|
+
registerApiRoute(FACTORY_ROUTE_CONTRACTS.projectDelete.path, {
|
|
575
|
+
method: FACTORY_ROUTE_CONTRACTS.projectDelete.method,
|
|
576
|
+
requiresAuth: false,
|
|
577
|
+
handler: async (routeContext) => {
|
|
578
|
+
const context = loose(routeContext);
|
|
579
|
+
const tenant = await this.#resolveTenant(context);
|
|
580
|
+
if ("response" in tenant) return tenant.response;
|
|
581
|
+
const parsedPath = FACTORY_ROUTE_CONTRACTS.projectDelete.pathSchema.safeParse({ id: context.req.param("id") });
|
|
582
|
+
if (!parsedPath.success) return context.json({ error: "Project not found" }, 404);
|
|
583
|
+
const { id } = parsedPath.data;
|
|
584
|
+
if (!await this.#project(tenant.orgId, id)) return context.json({ error: "Project not found" }, 404);
|
|
585
|
+
for (const handle of await this.#handles()) for (const connection of await handle.connections.list({
|
|
586
|
+
orgId: tenant.orgId,
|
|
587
|
+
factoryProjectId: id
|
|
588
|
+
})) {
|
|
589
|
+
for (const projectRepository of await handle.projectRepositories.list({
|
|
590
|
+
orgId: tenant.orgId,
|
|
591
|
+
connectionId: connection.id
|
|
592
|
+
})) if (!await this.#retireProjectRepositorySessions(handle, tenant.orgId, projectRepository.id)) return context.json({ error: "session_retirement_unavailable" }, 409);
|
|
593
|
+
await handle.connections.delete({
|
|
594
|
+
orgId: tenant.orgId,
|
|
595
|
+
id: connection.id
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
await (await this.#projects()).delete({
|
|
599
|
+
orgId: tenant.orgId,
|
|
600
|
+
id
|
|
601
|
+
});
|
|
602
|
+
await this.#dropSchedule(id);
|
|
603
|
+
return context.body(null, 204);
|
|
604
|
+
}
|
|
605
|
+
}),
|
|
606
|
+
registerApiRoute("/web/factory/projects/:id/source-control-connections", {
|
|
607
|
+
method: "GET",
|
|
608
|
+
requiresAuth: false,
|
|
609
|
+
handler: async (routeContext) => {
|
|
610
|
+
const context = loose(routeContext);
|
|
611
|
+
const tenant = await this.#resolveTenant(context);
|
|
612
|
+
if ("response" in tenant) return tenant.response;
|
|
613
|
+
const projectId = context.req.param("id");
|
|
614
|
+
if (!projectId || !UUID_RE.test(projectId) || !await this.#project(tenant.orgId, projectId)) return context.json({ error: "Project not found" }, 404);
|
|
615
|
+
const connections = [];
|
|
616
|
+
for (const handle of await this.#handles()) for (const connection of await handle.connections.list({
|
|
617
|
+
orgId: tenant.orgId,
|
|
618
|
+
factoryProjectId: projectId
|
|
619
|
+
})) {
|
|
620
|
+
const installation = await handle.installations.get({
|
|
621
|
+
orgId: tenant.orgId,
|
|
622
|
+
id: connection.installationId
|
|
623
|
+
});
|
|
624
|
+
if (!installation) continue;
|
|
625
|
+
const links = await handle.projectRepositories.list({
|
|
626
|
+
orgId: tenant.orgId,
|
|
627
|
+
connectionId: connection.id
|
|
628
|
+
});
|
|
629
|
+
connections.push({
|
|
630
|
+
...connection,
|
|
631
|
+
installation,
|
|
632
|
+
repositories: await Promise.all(links.map((link) => this.#repositoryPayload(handle, tenant.orgId, link)))
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
return context.json({ connections });
|
|
636
|
+
}
|
|
637
|
+
}),
|
|
638
|
+
registerApiRoute("/web/factory/projects/:id/source-control-connections", {
|
|
639
|
+
method: "POST",
|
|
640
|
+
requiresAuth: false,
|
|
641
|
+
handler: async (routeContext) => {
|
|
642
|
+
const context = loose(routeContext);
|
|
643
|
+
const tenant = await this.#resolveTenant(context);
|
|
644
|
+
if ("response" in tenant) return tenant.response;
|
|
645
|
+
const projectId = context.req.param("id");
|
|
646
|
+
if (!projectId || !UUID_RE.test(projectId) || !await this.#project(tenant.orgId, projectId)) return context.json({ error: "Project not found" }, 404);
|
|
647
|
+
const input = parseConnectionInput(await readJson(context));
|
|
648
|
+
if (!input) return context.json({ error: "invalid_source_control_connection" }, 400);
|
|
649
|
+
if (!this.#versionControlIntegrationIds.has(input.integrationId)) return context.json({ error: "Source-control integration not found" }, 404);
|
|
650
|
+
const handle = (await this.#sourceControl()).forIntegration(input.integrationId);
|
|
651
|
+
if (!await handle.installations.get({
|
|
652
|
+
orgId: tenant.orgId,
|
|
653
|
+
id: input.installationId
|
|
654
|
+
})) return context.json({ error: "Source-control installation not found" }, 404);
|
|
655
|
+
const connection = await handle.connections.create({
|
|
656
|
+
orgId: tenant.orgId,
|
|
657
|
+
factoryProjectId: projectId,
|
|
658
|
+
installationId: input.installationId,
|
|
659
|
+
createdByUserId: tenant.userId
|
|
660
|
+
});
|
|
661
|
+
return context.json({ connection }, 201);
|
|
662
|
+
}
|
|
663
|
+
}),
|
|
664
|
+
registerApiRoute("/web/factory/projects/:id/source-control-connections/:connectionId", {
|
|
665
|
+
method: "DELETE",
|
|
666
|
+
requiresAuth: false,
|
|
667
|
+
handler: async (routeContext) => {
|
|
668
|
+
const context = loose(routeContext);
|
|
669
|
+
const tenant = await this.#resolveTenant(context);
|
|
670
|
+
if ("response" in tenant) return tenant.response;
|
|
671
|
+
const projectId = context.req.param("id");
|
|
672
|
+
const connectionId = context.req.param("connectionId");
|
|
673
|
+
if (!projectId || !UUID_RE.test(projectId) || !connectionId || !UUID_RE.test(connectionId)) return context.json({ error: "Source-control connection not found" }, 404);
|
|
674
|
+
const found = await this.#findConnection({
|
|
675
|
+
orgId: tenant.orgId,
|
|
676
|
+
projectId,
|
|
677
|
+
id: connectionId
|
|
678
|
+
});
|
|
679
|
+
if (!found) return context.json({ error: "Source-control connection not found" }, 404);
|
|
680
|
+
for (const projectRepository of await found.handle.projectRepositories.list({
|
|
681
|
+
orgId: tenant.orgId,
|
|
682
|
+
connectionId
|
|
683
|
+
})) if (!await this.#retireProjectRepositorySessions(found.handle, tenant.orgId, projectRepository.id)) return context.json({ error: "session_retirement_unavailable" }, 409);
|
|
684
|
+
await found.handle.connections.delete({
|
|
685
|
+
orgId: tenant.orgId,
|
|
686
|
+
id: connectionId
|
|
687
|
+
});
|
|
688
|
+
return context.body(null, 204);
|
|
689
|
+
}
|
|
690
|
+
}),
|
|
691
|
+
registerApiRoute("/web/factory/projects/:id/source-control-connections/:connectionId/repositories", {
|
|
692
|
+
method: "POST",
|
|
693
|
+
requiresAuth: false,
|
|
694
|
+
handler: async (routeContext) => {
|
|
695
|
+
const context = loose(routeContext);
|
|
696
|
+
const tenant = await this.#resolveTenant(context);
|
|
697
|
+
if ("response" in tenant) return tenant.response;
|
|
698
|
+
const projectId = context.req.param("id");
|
|
699
|
+
const connectionId = context.req.param("connectionId");
|
|
700
|
+
if (!projectId || !UUID_RE.test(projectId) || !connectionId || !UUID_RE.test(connectionId)) return context.json({ error: "Source-control connection not found" }, 404);
|
|
701
|
+
const found = await this.#findConnection({
|
|
702
|
+
orgId: tenant.orgId,
|
|
703
|
+
projectId,
|
|
704
|
+
id: connectionId
|
|
705
|
+
});
|
|
706
|
+
if (!found) return context.json({ error: "Source-control connection not found" }, 404);
|
|
707
|
+
const input = parseRepositoryLinkInput(await readJson(context));
|
|
708
|
+
if (!input) return context.json({ error: "invalid_project_repository" }, 400);
|
|
709
|
+
const repository = input.repositoryId ? await found.handle.repositories.get({
|
|
710
|
+
orgId: tenant.orgId,
|
|
711
|
+
id: input.repositoryId
|
|
712
|
+
}) : input.repository && this.deps.resolveRepository ? await this.deps.resolveRepository({
|
|
713
|
+
integrationId: found.connection.integrationId,
|
|
714
|
+
orgId: tenant.orgId,
|
|
715
|
+
userId: tenant.userId,
|
|
716
|
+
installationId: found.connection.installationId,
|
|
717
|
+
...input.repository
|
|
718
|
+
}) : null;
|
|
719
|
+
if (!repository || repository.installationId !== found.connection.installationId) return context.json({ error: "Source-control repository not found" }, 404);
|
|
720
|
+
const { repositoryId: _repositoryId, repository: _repository, ...linkInput } = input;
|
|
721
|
+
const projectRepository = await found.handle.projectRepositories.link({
|
|
722
|
+
orgId: tenant.orgId,
|
|
723
|
+
connectionId,
|
|
724
|
+
createdByUserId: tenant.userId,
|
|
725
|
+
repositoryId: repository.id,
|
|
726
|
+
...linkInput
|
|
727
|
+
});
|
|
728
|
+
try {
|
|
729
|
+
this.deps.onProjectRepositoryLinked?.({
|
|
730
|
+
orgId: tenant.orgId,
|
|
731
|
+
projectRepository
|
|
732
|
+
});
|
|
733
|
+
} catch (error) {
|
|
734
|
+
console.warn("[factory] onProjectRepositoryLinked failed after a successful repository link:", error);
|
|
735
|
+
}
|
|
736
|
+
return context.json({ projectRepository: await this.#repositoryPayload(found.handle, tenant.orgId, projectRepository) }, 201);
|
|
737
|
+
}
|
|
738
|
+
}),
|
|
739
|
+
registerApiRoute(FACTORY_ROUTE_CONTRACTS.projectEnvironmentGet.path, {
|
|
740
|
+
method: FACTORY_ROUTE_CONTRACTS.projectEnvironmentGet.method,
|
|
741
|
+
requiresAuth: false,
|
|
742
|
+
handler: async (routeContext) => {
|
|
743
|
+
const context = loose(routeContext);
|
|
744
|
+
const tenant = await this.#resolveTenant(context);
|
|
745
|
+
if ("response" in tenant) return tenant.response;
|
|
746
|
+
const projectId = context.req.param("id");
|
|
747
|
+
if (!projectId || !UUID_RE.test(projectId)) return context.json({ error: "Project not found" }, 404);
|
|
748
|
+
const project = await this.#project(tenant.orgId, projectId);
|
|
749
|
+
if (!project) return context.json({ error: "Project not found" }, 404);
|
|
750
|
+
return context.json(await this.#environmentPayload(tenant.orgId, project));
|
|
751
|
+
}
|
|
752
|
+
}),
|
|
753
|
+
registerApiRoute(FACTORY_ROUTE_CONTRACTS.projectEnvironmentUpdate.path, {
|
|
754
|
+
method: FACTORY_ROUTE_CONTRACTS.projectEnvironmentUpdate.method,
|
|
755
|
+
requiresAuth: false,
|
|
756
|
+
handler: async (routeContext) => {
|
|
757
|
+
const context = loose(routeContext);
|
|
758
|
+
const tenant = await this.#resolveTenant(context);
|
|
759
|
+
if ("response" in tenant) return tenant.response;
|
|
760
|
+
const projectId = context.req.param("id");
|
|
761
|
+
if (!projectId || !UUID_RE.test(projectId)) return context.json({ error: "Project not found" }, 404);
|
|
762
|
+
const project = await this.#project(tenant.orgId, projectId);
|
|
763
|
+
if (!project) return context.json({ error: "Project not found" }, 404);
|
|
764
|
+
const parsed = FACTORY_ROUTE_CONTRACTS.projectEnvironmentUpdate.bodySchema.safeParse(await readJson(context));
|
|
765
|
+
if (!parsed.success) return context.json({ error: "invalid_environment" }, 400);
|
|
766
|
+
const { repositories: repositoryPatches, settings: settingsPatch, buildTriggers, ...projectInput } = parsed.data;
|
|
767
|
+
const input = projectInput;
|
|
768
|
+
const runner = this.deps.environmentBuilds;
|
|
769
|
+
if (buildTriggers !== void 0) {
|
|
770
|
+
if (!runner) return context.json({ error: "no_builds" }, 400);
|
|
771
|
+
if (buildTriggers.push?.enabled !== void 0) input.buildOnPushEnabled = buildTriggers.push.enabled;
|
|
772
|
+
if (buildTriggers.push?.debounceMinutes !== void 0) input.buildPushDebounceMinutes = buildTriggers.push.debounceMinutes;
|
|
773
|
+
if (buildTriggers.schedule) if (!runner.scheduleAvailable) {
|
|
774
|
+
if (buildTriggers.schedule.enabled) return context.json({ error: "schedules_unavailable" }, 400);
|
|
775
|
+
} else {
|
|
776
|
+
const { cron, timezone } = buildTriggers.schedule;
|
|
777
|
+
const stored = await readSchedule(runner.schedules(), project.id);
|
|
778
|
+
const nextCron = cron ?? stored.cron;
|
|
779
|
+
if (!nextCron && buildTriggers.schedule.enabled) return context.json({
|
|
780
|
+
error: "invalid_environment",
|
|
781
|
+
issues: [{
|
|
782
|
+
message: "cron is required",
|
|
783
|
+
path: [
|
|
784
|
+
"buildTriggers",
|
|
785
|
+
"schedule",
|
|
786
|
+
"cron"
|
|
787
|
+
]
|
|
788
|
+
}]
|
|
789
|
+
}, 400);
|
|
790
|
+
const nextTimezone = timezone ?? stored.timezone ?? void 0;
|
|
791
|
+
const message = nextCron ? invalidCronMessage(nextCron, nextTimezone) : void 0;
|
|
792
|
+
if (message) return context.json({
|
|
793
|
+
error: "invalid_environment",
|
|
794
|
+
issues: [{
|
|
795
|
+
message,
|
|
796
|
+
path: [
|
|
797
|
+
"buildTriggers",
|
|
798
|
+
"schedule",
|
|
799
|
+
"cron"
|
|
800
|
+
]
|
|
801
|
+
}]
|
|
802
|
+
}, 400);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
if (settingsPatch !== void 0 && !this.deps.sandbox) return context.json({ error: "no_sandbox" }, 400);
|
|
806
|
+
let updated = project;
|
|
807
|
+
if (Object.keys(input).length > 0 || settingsPatch !== void 0 || repositoryPatches !== void 0) {
|
|
808
|
+
let issues;
|
|
809
|
+
let repositoryOutcome;
|
|
810
|
+
const sourceControl = await this.#sourceControl();
|
|
811
|
+
const result = await (await this.#projects()).update({
|
|
812
|
+
orgId: tenant.orgId,
|
|
813
|
+
id: projectId,
|
|
814
|
+
input: async (current, ops) => {
|
|
815
|
+
let sandboxSettings;
|
|
816
|
+
if (settingsPatch !== void 0) {
|
|
817
|
+
const settings = await this.#mergeSettings(current.sandboxSettings ?? {}, settingsPatch);
|
|
818
|
+
if ("issues" in settings) {
|
|
819
|
+
issues = settings.issues;
|
|
820
|
+
return null;
|
|
821
|
+
}
|
|
822
|
+
sandboxSettings = settings.merged;
|
|
823
|
+
}
|
|
824
|
+
if (repositoryPatches !== void 0) {
|
|
825
|
+
repositoryOutcome = await sourceControl.updateEnvironmentRepositories(ops, {
|
|
826
|
+
factoryProjectId: current.id,
|
|
827
|
+
integrationIds: [...this.#versionControlIntegrationIds],
|
|
828
|
+
patches: repositoryPatches
|
|
829
|
+
});
|
|
830
|
+
if (repositoryOutcome !== "updated") return null;
|
|
831
|
+
}
|
|
832
|
+
return {
|
|
833
|
+
...input,
|
|
834
|
+
...sandboxSettings !== void 0 ? { sandboxSettings } : {}
|
|
835
|
+
};
|
|
836
|
+
}
|
|
837
|
+
});
|
|
838
|
+
if (repositoryOutcome === "not_found") return context.json({ error: "Project repository not found" }, 404);
|
|
839
|
+
if (repositoryOutcome === "incomplete_reorder") return context.json({ error: "invalid_environment" }, 400);
|
|
840
|
+
if (issues) return context.json({
|
|
841
|
+
error: "invalid_environment",
|
|
842
|
+
issues: issues.map((issue) => ({
|
|
843
|
+
message: issue.message,
|
|
844
|
+
path: Array.isArray(issue.path) ? issue.path.map((segment) => typeof segment === "object" && segment !== null && "key" in segment ? segment.key : segment) : []
|
|
845
|
+
}))
|
|
846
|
+
}, 400);
|
|
847
|
+
if (!result) return context.json({ error: "Project not found" }, 404);
|
|
848
|
+
updated = result;
|
|
849
|
+
}
|
|
850
|
+
if (buildTriggers?.schedule && runner?.scheduleAvailable) {
|
|
851
|
+
const stored = await readSchedule(runner.schedules(), project.id);
|
|
852
|
+
const cron = buildTriggers.schedule.cron ?? stored.cron;
|
|
853
|
+
if (cron) await ensureSchedule(runner.schedules(), project.id, {
|
|
854
|
+
enabled: buildTriggers.schedule.enabled,
|
|
855
|
+
cron,
|
|
856
|
+
...buildTriggers.schedule.timezone ?? stored.timezone ? { timezone: buildTriggers.schedule.timezone ?? stored.timezone } : {}
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
return context.json(await this.#environmentPayload(tenant.orgId, updated));
|
|
860
|
+
}
|
|
861
|
+
}),
|
|
862
|
+
registerApiRoute("/web/factory/projects/:id/repositories/:projectRepositoryId", {
|
|
863
|
+
method: "PATCH",
|
|
864
|
+
requiresAuth: false,
|
|
865
|
+
handler: async (routeContext) => {
|
|
866
|
+
const context = loose(routeContext);
|
|
867
|
+
const tenant = await this.#resolveTenant(context);
|
|
868
|
+
if ("response" in tenant) return tenant.response;
|
|
869
|
+
const projectId = context.req.param("id");
|
|
870
|
+
const projectRepositoryId = context.req.param("projectRepositoryId");
|
|
871
|
+
if (!projectId || !UUID_RE.test(projectId) || !projectRepositoryId || !UUID_RE.test(projectRepositoryId)) return context.json({ error: "Project repository not found" }, 404);
|
|
872
|
+
const found = await this.#findProjectRepository({
|
|
873
|
+
orgId: tenant.orgId,
|
|
874
|
+
projectId,
|
|
875
|
+
id: projectRepositoryId
|
|
876
|
+
});
|
|
877
|
+
if (!found) return context.json({ error: "Project repository not found" }, 404);
|
|
878
|
+
const input = parseRepositoryUpdateInput(await readJson(context));
|
|
879
|
+
if (!input) return context.json({ error: "invalid_project_repository" }, 400);
|
|
880
|
+
const projectRepository = await found.handle.projectRepositories.update({
|
|
881
|
+
orgId: tenant.orgId,
|
|
882
|
+
id: projectRepositoryId,
|
|
883
|
+
input
|
|
884
|
+
});
|
|
885
|
+
return context.json({ projectRepository: await this.#repositoryPayload(found.handle, tenant.orgId, projectRepository) });
|
|
886
|
+
}
|
|
887
|
+
}),
|
|
888
|
+
registerApiRoute("/web/factory/projects/:id/repositories/:projectRepositoryId", {
|
|
889
|
+
method: "DELETE",
|
|
890
|
+
requiresAuth: false,
|
|
891
|
+
handler: async (routeContext) => {
|
|
892
|
+
const context = loose(routeContext);
|
|
893
|
+
const tenant = await this.#resolveTenant(context);
|
|
894
|
+
if ("response" in tenant) return tenant.response;
|
|
895
|
+
const projectId = context.req.param("id");
|
|
896
|
+
const projectRepositoryId = context.req.param("projectRepositoryId");
|
|
897
|
+
if (!projectId || !UUID_RE.test(projectId) || !projectRepositoryId || !UUID_RE.test(projectRepositoryId)) return context.json({ error: "Project repository not found" }, 404);
|
|
898
|
+
const found = await this.#findProjectRepository({
|
|
899
|
+
orgId: tenant.orgId,
|
|
900
|
+
projectId,
|
|
901
|
+
id: projectRepositoryId
|
|
902
|
+
});
|
|
903
|
+
if (!found) return context.json({ error: "Project repository not found" }, 404);
|
|
904
|
+
if (!await this.#retireProjectRepositorySessions(found.handle, tenant.orgId, projectRepositoryId)) return context.json({ error: "session_retirement_unavailable" }, 409);
|
|
905
|
+
await found.handle.projectRepositories.unlink({
|
|
906
|
+
orgId: tenant.orgId,
|
|
907
|
+
id: projectRepositoryId
|
|
908
|
+
});
|
|
909
|
+
return context.body(null, 204);
|
|
910
|
+
}
|
|
911
|
+
}),
|
|
912
|
+
...this.#buildRoutes()
|
|
913
|
+
];
|
|
914
|
+
}
|
|
915
|
+
};
|
|
916
|
+
//#endregion
|
|
917
|
+
export { ProjectRoutes };
|
|
918
|
+
|
|
919
|
+
//# sourceMappingURL=projects.js.map
|