@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
package/dist/factory.js
ADDED
|
@@ -0,0 +1,1006 @@
|
|
|
1
|
+
import { timedPhase } from "./timing.js";
|
|
2
|
+
import { buildAuthDisabledRoutes, buildAuthRoutes, createFactoryAuthGate, createFactoryRouteAuth, factoryUserOrgId, getFactoryAuthOrgId, getFactoryAuthUserFromContext, getFactoryAuthUserId } from "./auth.js";
|
|
3
|
+
import { assertFactoryConfigVersion } from "./rules/validation.js";
|
|
4
|
+
import { isTerminalWorkItem } from "./boards/semantics.js";
|
|
5
|
+
import { createBoardRegistry } from "./boards/registry.js";
|
|
6
|
+
import "./boards/index.js";
|
|
7
|
+
import { isValidGitRef } from "./sandbox/git-ref.js";
|
|
8
|
+
import { FactoryEnvironmentStateProcessor } from "./session/environment-state-processor.js";
|
|
9
|
+
import { createPlaintextFactorySecretEncryption } from "./secret-encryption.js";
|
|
10
|
+
import { ModelCredentialsStorage } from "./storage/domains/credentials/base.js";
|
|
11
|
+
import { createTenantCredentialPrimer, primeTenantCredentials, registerTenantCredentialResolver } from "./routes/tenant-credentials.js";
|
|
12
|
+
import { FactoryProjectsStorage } from "./storage/domains/projects/base.js";
|
|
13
|
+
import { SourceControlStorage } from "./storage/domains/source-control/base.js";
|
|
14
|
+
import { environmentSlugs, resolveSessionRepositories } from "./session/environment-repositories.js";
|
|
15
|
+
import { createSourceControlSessionLookup } from "./session/factory-session.js";
|
|
16
|
+
import { hydrateSupervisorSession, parseSupervisorResourceId, resolveSupervisorScope } from "./supervisor/session.js";
|
|
17
|
+
import { FactoryWorkspaceRegistry, createWorkspaceFactory } from "./workspace.js";
|
|
18
|
+
import { ENVIRONMENT_BUILD_WORKFLOW_ID } from "./environment/build-workflow.js";
|
|
19
|
+
import { EnvironmentBuildRunner } from "./environment/build-runner.js";
|
|
20
|
+
import { touchFeed } from "./feed-events.js";
|
|
21
|
+
import { reconcileGithubAcceptanceLabels } from "./integrations/github/acceptance-labels.js";
|
|
22
|
+
import { WorkItemsStorage } from "./storage/domains/work-items/base.js";
|
|
23
|
+
import { IntakeStorage } from "./storage/domains/intake/base.js";
|
|
24
|
+
import { isFactoryGithubLogin, trustedCollaborator } from "./integrations/github/rules.js";
|
|
25
|
+
import { recordFactoryPullRequestProvenance, resolveFactoryPullRequestParentWorkItemId } from "./integrations/github/provenance.js";
|
|
26
|
+
import { dismissStaleFactoryReviews } from "./integrations/github/stale-reviews.js";
|
|
27
|
+
import { PlatformApiClient, platformApiClientConfigFromEnv } from "./integrations/platform/api-client.js";
|
|
28
|
+
import { buildPlatformConnectRoutes } from "./integrations/platform/connect/routes.js";
|
|
29
|
+
import { observeSessionFirstExec } from "./session/first-exec-capture.js";
|
|
30
|
+
import { observeSessionFilesystem } from "./session/filesystem-capture.js";
|
|
31
|
+
import { prepareSessionRunContext } from "./integrations/subscription-session.js";
|
|
32
|
+
import { PlatformGithubIntegration } from "./integrations/platform/github/integration.js";
|
|
33
|
+
import { PlatformGitLabIntegration } from "./integrations/platform/gitlab/integration.js";
|
|
34
|
+
import { PlatformIncidentioIntegration } from "./integrations/platform/incidentio/integration.js";
|
|
35
|
+
import { PlatformJiraIntegration } from "./integrations/platform/jira/integration.js";
|
|
36
|
+
import { PlatformLinearIntegration } from "./integrations/platform/linear/integration.js";
|
|
37
|
+
import { resolveFactoryCredentialTenant } from "./session/credential-policy.js";
|
|
38
|
+
import { hydrateSessionMemorySettings, layerPersonalMemorySettings } from "./session/memory-settings-hydration.js";
|
|
39
|
+
import { MemorySettingsStorage, factoryMemorySettingsUserId } from "./storage/domains/memory-settings/base.js";
|
|
40
|
+
import { resolveDeploymentModelProviders } from "./routes/config.js";
|
|
41
|
+
import { createCustomProvidersPrimer, registerCustomProvidersSource } from "./routes/custom-provider-source.js";
|
|
42
|
+
import { ProjectRoutes } from "./routes/projects.js";
|
|
43
|
+
import { FactoryTransitionService } from "./rules/transition-service.js";
|
|
44
|
+
import { AuditStorage } from "./storage/domains/audit/base.js";
|
|
45
|
+
import { AuditDomain } from "./storage/domains/audit/domain.js";
|
|
46
|
+
import { QueueHealthStorage } from "./storage/domains/queue-health/base.js";
|
|
47
|
+
import { assembleFactoryApiRoutes, buildIntegrationContext } from "./routes/surface.js";
|
|
48
|
+
import { TelemetryRoutes } from "./routes/telemetry.js";
|
|
49
|
+
import { readFactorySessionScope, resolveFactorySessionAddress } from "./rules/binding-context.js";
|
|
50
|
+
import { observeSessionRunEnd } from "./session/run-audit.js";
|
|
51
|
+
import { FactoryFeedReader } from "./storage/domains/comments/feed-context.js";
|
|
52
|
+
import { FactoryDecisionDispatcher } from "./rules/dispatcher.js";
|
|
53
|
+
import { FactoryPhaseStateProcessor, reportMemorySettingsUnavailable } from "./rules/processor.js";
|
|
54
|
+
import { createReviewSourceTool, resolveReviewSourceUiOrigin } from "./rules/review-source-tool.js";
|
|
55
|
+
import { createTerminalStageCleanup } from "./rules/terminal-cleanup.js";
|
|
56
|
+
import { createFactoryTransitionTools } from "./rules/tools.js";
|
|
57
|
+
import { CallbackFactorySandbox } from "./sandbox/callback-factory-sandbox.js";
|
|
58
|
+
import { SessionRetirementCoordinator } from "./sandbox/session-retirement.js";
|
|
59
|
+
import { handleServerError } from "./server-error.js";
|
|
60
|
+
import { hydrateSessionDefaultModel } from "./session/default-model-hydration.js";
|
|
61
|
+
import { observeSessionFirstMessage } from "./session/first-message-capture.js";
|
|
62
|
+
import { LiveSessions } from "./session/live-sessions.js";
|
|
63
|
+
import { createSourceControlTools } from "./session/source-control-tools.js";
|
|
64
|
+
import { observeSessionThreadTitle } from "./session/thread-title-mirror.js";
|
|
65
|
+
import { createSpaStaticMiddleware, resolveUiDistDir } from "./spa-static.js";
|
|
66
|
+
import { createStateSigner } from "./state-signing.js";
|
|
67
|
+
import { observeAgentGitAction } from "./storage/domains/audit/agent-audit.js";
|
|
68
|
+
import { ChannelIdentityStorage } from "./storage/domains/channel-identity/base.js";
|
|
69
|
+
import { WorkItemCommentsStorage } from "./storage/domains/comments/base.js";
|
|
70
|
+
import { CommentsDomain } from "./storage/domains/comments/domain.js";
|
|
71
|
+
import { CustomProvidersStorage } from "./storage/domains/custom-providers/base.js";
|
|
72
|
+
import { FilesystemStorage } from "./storage/domains/filesystem/base.js";
|
|
73
|
+
import { IntegrationStorage } from "./storage/domains/integrations/base.js";
|
|
74
|
+
import { ModelDefaultsStorage } from "./storage/domains/model-defaults/base.js";
|
|
75
|
+
import { FactorySupervisorHealthWorker } from "./supervisor/health-worker.js";
|
|
76
|
+
import { SUPERVISOR_INSTRUCTIONS } from "./supervisor/instructions.js";
|
|
77
|
+
import { createFactorySupervisorReadTools } from "./supervisor/read-tools.js";
|
|
78
|
+
import { messageWorkerSession } from "./supervisor/session-messaging.js";
|
|
79
|
+
import { createFactorySupervisorWriteTools } from "./supervisor/write-tools.js";
|
|
80
|
+
import { hasAuthInit, isUserProvider } from "@mastra/core/server";
|
|
81
|
+
import { MastraAuthStudio } from "@mastra/auth-studio";
|
|
82
|
+
import { prepareAgentControllerMount } from "@mastra/code-sdk";
|
|
83
|
+
import { AgentControllerChannels } from "@mastra/core/channels";
|
|
84
|
+
import { EventEmitterPubSub } from "@mastra/core/events";
|
|
85
|
+
import { describeFactorySandbox, isFactorySandbox } from "@mastra/core/workspace";
|
|
86
|
+
//#region src/factory.ts
|
|
87
|
+
/**
|
|
88
|
+
* `MastraFactory` — the single entry point to the whole Mastra Software Factory.
|
|
89
|
+
*
|
|
90
|
+
* The consumer's deploy entry constructs deployment-specific config instances
|
|
91
|
+
* (auth adapter, pubsub) and passes them here explicitly. The only provider
|
|
92
|
+
* defaults constructed here are Platform GitHub, GitLab, Jira, incident.io, and
|
|
93
|
+
* Linear integrations when Platform credentials exist and the caller did not
|
|
94
|
+
* provide those integrations.
|
|
95
|
+
*
|
|
96
|
+
* `prepare()` resolves feature readiness, threads every dependency explicitly,
|
|
97
|
+
* assembles the web routes/middleware, and returns the constructor args for
|
|
98
|
+
* `new Mastra(...)`. The literal `export const mastra = new Mastra(...)` must
|
|
99
|
+
* stay in the entry file — the deployer's `checkConfigExport` Babel plugin
|
|
100
|
+
* only marks the config valid when it finds that literal in the entry AST —
|
|
101
|
+
* so the factory produces args instead of the instance. `finalize()` runs the
|
|
102
|
+
* post-construct boot (controller init + workers).
|
|
103
|
+
*
|
|
104
|
+
* Integration readiness is derived from each instance's declared capabilities
|
|
105
|
+
* and the storage domains those capabilities require.
|
|
106
|
+
*/
|
|
107
|
+
const CONTROLLER_ID = "code";
|
|
108
|
+
function hasPlatformCredentials() {
|
|
109
|
+
return Boolean(process.env.MASTRA_PLATFORM_ACCESS_TOKEN?.trim() || process.env.MASTRA_PLATFORM_SECRET_KEY?.trim());
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Default auth provider — `MastraAuthStudio`, which proxies identity to the
|
|
113
|
+
* shared Mastra platform API. `MastraAuthStudio` resolves `MASTRA_SHARED_API_URL`,
|
|
114
|
+
* `MASTRA_ORGANIZATION_ID`, and `MASTRA_COOKIE_DOMAIN` from env on its own —
|
|
115
|
+
* this helper only derives a cookie-domain fallback from the factory's
|
|
116
|
+
* `publicUrl`.
|
|
117
|
+
*
|
|
118
|
+
* Cookie-domain resolution (Studio picks the first that wins):
|
|
119
|
+
* 1. explicit `MASTRA_COOKIE_DOMAIN` env, if set;
|
|
120
|
+
* 2. `.mastra.ai` when `sharedApiUrl` is on `.mastra.ai`;
|
|
121
|
+
* 3. this parent-domain fallback derived from `publicUrl` — so a deploy on
|
|
122
|
+
* `https://foo.mastra.cloud` mints cookies with `Domain=.mastra.cloud`
|
|
123
|
+
* without the caller wiring the env var by hand.
|
|
124
|
+
* 4. otherwise host-only (no `Domain=`), which is correct for `localhost`.
|
|
125
|
+
*/
|
|
126
|
+
function buildDefaultStudioAuth(publicUrl) {
|
|
127
|
+
return new MastraAuthStudio({ cookieDomain: parentDomainFromPublicUrl(publicUrl) });
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Derive a parent cookie domain from `publicUrl` by stripping the leftmost
|
|
131
|
+
* label — the same shape platform-API's env injection uses (see
|
|
132
|
+
* `platform/servers/api/src/lib/studio-env-vars.ts`: `.${routingDomain.replace(/^[^.]+\./, '')}`).
|
|
133
|
+
*
|
|
134
|
+
* Rather than a generic `strip-left-label` heuristic — which either emits
|
|
135
|
+
* cookies scoped to a public suffix (`sub.example.co.uk` → `.example.co.uk`
|
|
136
|
+
* requires PSL data to be safe) or misclassifies numeric hostnames like
|
|
137
|
+
* `3scale.example.com` as IPv4 — we only derive a parent domain when the
|
|
138
|
+
* host sits under one of the platform's known registrable domains. Anything
|
|
139
|
+
* else (custom domains, arbitrary tenant hostnames, IPs, `localhost`)
|
|
140
|
+
* falls through to host-only cookies. Callers that need a different scope
|
|
141
|
+
* pass `MASTRA_COOKIE_DOMAIN` explicitly (Studio honors that first).
|
|
142
|
+
*/
|
|
143
|
+
const KNOWN_PLATFORM_COOKIE_PARENTS = ["mastra.cloud", "mastra.ai"];
|
|
144
|
+
function isIpLiteral(hostname) {
|
|
145
|
+
if (hostname.includes(":")) return true;
|
|
146
|
+
return /^\d+(?:\.\d+){3}$/.test(hostname);
|
|
147
|
+
}
|
|
148
|
+
function parentDomainFromPublicUrl(publicUrl) {
|
|
149
|
+
let hostname;
|
|
150
|
+
try {
|
|
151
|
+
hostname = new URL(publicUrl).hostname.toLowerCase();
|
|
152
|
+
} catch {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
if (hostname === "localhost" || isIpLiteral(hostname)) return void 0;
|
|
156
|
+
for (const parent of KNOWN_PLATFORM_COOKIE_PARENTS) {
|
|
157
|
+
if (hostname === parent) return void 0;
|
|
158
|
+
if (hostname.endsWith(`.${parent}`)) return `.${parent}`;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/** A session parking or being answered is inbox news, so the registry bumps the project's feed. */
|
|
162
|
+
function liveSessionsTouchingTheFeed(controller, eventBus) {
|
|
163
|
+
const liveSessions = new LiveSessions(controller);
|
|
164
|
+
liveSessions.onParkedChanged((session) => {
|
|
165
|
+
const { factoryOrgId, factoryProjectId } = session.state.get();
|
|
166
|
+
if (factoryOrgId && factoryProjectId) touchFeed(eventBus, {
|
|
167
|
+
orgId: factoryOrgId,
|
|
168
|
+
factoryProjectId
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
return liveSessions;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* The fleet-era `sandbox` options and what replaced each one. Only the keys
|
|
175
|
+
* the host actually passed are explained, so a host that never used the fleet
|
|
176
|
+
* gets the short message.
|
|
177
|
+
*/
|
|
178
|
+
const RETIRED_SANDBOX_OPTIONS = {
|
|
179
|
+
machine: "'machine' becomes the provider instance: one sandbox per session, constructed by the FactorySandbox, instead of one template machine cloned per repository",
|
|
180
|
+
workdir: "'workdir' becomes the workingDirectory of the FactorySandboxContext, which every provider passes to its sandbox; when it is absent the provider uses its own default",
|
|
181
|
+
maxSandboxes: "'maxSandboxes' is gone with the sandbox fleet: there is one sandbox per session and no pool to cap"
|
|
182
|
+
};
|
|
183
|
+
function invalidSandboxOptionMessage(option) {
|
|
184
|
+
const lines = [
|
|
185
|
+
`MastraFactory: 'sandbox' must be a FactorySandbox instance or a callback constructing a MastraSandbox from a FactorySandboxContext:`,
|
|
186
|
+
` sandbox: new PlatformFactorySandbox()`,
|
|
187
|
+
` sandbox: ctx => new PlatformSandbox({ id: ctx.sessionId, sandboxId: ctx.sandboxId })`
|
|
188
|
+
];
|
|
189
|
+
if (typeof option === "object" && option !== null) {
|
|
190
|
+
const retired = Object.keys(RETIRED_SANDBOX_OPTIONS).filter((key) => key in option);
|
|
191
|
+
if (retired.length > 0) {
|
|
192
|
+
lines.push(`The object you passed is the retired alpha sandbox config. Its options map as follows:`);
|
|
193
|
+
for (const key of retired) lines.push(` ${RETIRED_SANDBOX_OPTIONS[key]}.`);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return lines.join("\n");
|
|
197
|
+
}
|
|
198
|
+
var MastraFactory = class {
|
|
199
|
+
#config;
|
|
200
|
+
/** The normalized sandbox, set by `prepare()`. Undefined until then and when sandboxes are disabled. */
|
|
201
|
+
#sandbox;
|
|
202
|
+
#sandboxDescription;
|
|
203
|
+
#boards;
|
|
204
|
+
#configVersion;
|
|
205
|
+
#prepared;
|
|
206
|
+
#dispatcher;
|
|
207
|
+
#factoryProcessor;
|
|
208
|
+
/** Environment builds through the sandbox's `builds`; undefined when the sandbox has none. */
|
|
209
|
+
#environmentBuilds;
|
|
210
|
+
#preparing = false;
|
|
211
|
+
constructor(config) {
|
|
212
|
+
if (!config?.storage) throw new Error("MastraFactory: 'storage' is required. Pass a FactoryStorage backend — e.g. new PgFactoryStorage({ connectionString }) from '@mastra/pg' for deployments, or new LibSQLFactoryStorage({ url }) from '@mastra/libsql' for local dev.");
|
|
213
|
+
this.#boards = createBoardRegistry({
|
|
214
|
+
boards: config.boards,
|
|
215
|
+
includeDefaultBoards: config.includeDefaultBoards
|
|
216
|
+
});
|
|
217
|
+
if ("rules" in config) throw new Error("MastraFactory: 'rules' was removed. Set 'configVersion' for the audit label and declare tool-result rules on the owning board via defineBoard({ tools }).");
|
|
218
|
+
this.#configVersion = assertFactoryConfigVersion(config.configVersion ?? "factory-config-v1");
|
|
219
|
+
this.#config = config;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* The host sandbox's provider, settings schema (JSON Schema) and
|
|
223
|
+
* capabilities, as the environment route reports them. Undefined before
|
|
224
|
+
* `prepare()` and when sandboxes are disabled.
|
|
225
|
+
*/
|
|
226
|
+
get sandboxDescription() {
|
|
227
|
+
if (!this.#sandbox) return void 0;
|
|
228
|
+
this.#sandboxDescription ??= describeFactorySandbox(this.#sandbox);
|
|
229
|
+
return this.#sandboxDescription;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Resolve feature readiness, wire every dependency explicitly, and assemble
|
|
233
|
+
* everything needed to construct the server-owned Mastra. Returns the args
|
|
234
|
+
* for the `new Mastra(...)` literal that must live in the entry file.
|
|
235
|
+
*/
|
|
236
|
+
async prepare() {
|
|
237
|
+
if (this.#preparing) throw new Error("MastraFactory.prepare() called twice");
|
|
238
|
+
this.#preparing = true;
|
|
239
|
+
const publicOrigin = (this.#config.publicUrl ?? "http://localhost:4111").replace(/\/+$/, "");
|
|
240
|
+
const allowedOrigins = (this.#config.allowedOrigins ?? []).map((o) => o.replace(/\/+$/, "")).filter(Boolean);
|
|
241
|
+
const storage = this.#config.storage;
|
|
242
|
+
const vector = this.#config.vector;
|
|
243
|
+
const pubsub = this.#config.pubsub;
|
|
244
|
+
const eventBus = pubsub ?? new EventEmitterPubSub();
|
|
245
|
+
const configuredAuth = this.#config.auth;
|
|
246
|
+
const auth = configuredAuth === null ? void 0 : configuredAuth ?? buildDefaultStudioAuth(publicOrigin);
|
|
247
|
+
if (auth && !this.#config.secretEncryption) console.warn("[factory] auth is enabled but 'secretEncryption' is not configured. Persisted model credentials, custom-provider API keys, and integration secrets will be stored as plaintext. Provide 'secretEncryption' (e.g. via FACTORY_CREDENTIAL_ENCRYPTION_KEY) to encrypt them at rest.");
|
|
248
|
+
const secretEncryption = this.#config.secretEncryption ?? createPlaintextFactorySecretEncryption();
|
|
249
|
+
const deploymentModelProviders = resolveDeploymentModelProviders(this.#config.deploymentModelProviders);
|
|
250
|
+
const routeAuth = createFactoryRouteAuth(auth);
|
|
251
|
+
const integrations = [...this.#config.integrations ?? []];
|
|
252
|
+
const explicitGithub = integrations.some((integration) => integration.id === "github");
|
|
253
|
+
let installedPlatformGithub = false;
|
|
254
|
+
if (hasPlatformCredentials()) {
|
|
255
|
+
if (!explicitGithub) {
|
|
256
|
+
integrations.push(new PlatformGithubIntegration({
|
|
257
|
+
rules: this.#config.platform?.github?.rules,
|
|
258
|
+
slug: this.#config.platform?.github?.slug ?? this.#config.platform?.githubAppSlug
|
|
259
|
+
}));
|
|
260
|
+
installedPlatformGithub = true;
|
|
261
|
+
}
|
|
262
|
+
if (!integrations.some((integration) => integration.id === "incidentio")) integrations.push(new PlatformIncidentioIntegration());
|
|
263
|
+
if (!integrations.some((integration) => integration.id === "jira")) integrations.push(new PlatformJiraIntegration());
|
|
264
|
+
if (!integrations.some((integration) => integration.id === "gitlab")) integrations.push(new PlatformGitLabIntegration());
|
|
265
|
+
if (!integrations.some((integration) => integration.id === "linear")) integrations.push(new PlatformLinearIntegration());
|
|
266
|
+
}
|
|
267
|
+
if (this.#config.platform?.github && !installedPlatformGithub) console.warn("[factory] 'platform.github' config was provided but the factory installed no GitHub integration of its own " + (explicitGithub ? "(an explicit integration with id 'github' takes precedence, so these options were ignored)." : "(no Platform credentials are configured and no explicit GitHub integration was passed)."));
|
|
268
|
+
const integrationIds = /* @__PURE__ */ new Set();
|
|
269
|
+
for (const integration of integrations) {
|
|
270
|
+
if (integrationIds.has(integration.id)) throw new Error(`MastraFactory: duplicate integration id '${integration.id}' in 'integrations'.`);
|
|
271
|
+
integrationIds.add(integration.id);
|
|
272
|
+
}
|
|
273
|
+
const configVersion = this.#configVersion;
|
|
274
|
+
const intakeStorage = storage.registerDomain(new IntakeStorage());
|
|
275
|
+
const auditStorage = storage.registerDomain(new AuditStorage());
|
|
276
|
+
const workItemsStorage = storage.registerDomain(new WorkItemsStorage());
|
|
277
|
+
workItemsStorage.onAttentionChanged((scope) => touchFeed(eventBus, scope));
|
|
278
|
+
workItemsStorage.useTerminalPhasePredicate((item) => isTerminalWorkItem(this.#boards, item));
|
|
279
|
+
const modelCredentialsStorage = storage.registerDomain(new ModelCredentialsStorage(secretEncryption));
|
|
280
|
+
const modelDefaultsStorage = storage.registerDomain(new ModelDefaultsStorage());
|
|
281
|
+
const memorySettingsStorage = storage.registerDomain(new MemorySettingsStorage());
|
|
282
|
+
const customProvidersStorage = storage.registerDomain(new CustomProvidersStorage(secretEncryption));
|
|
283
|
+
const queueHealthStorage = storage.registerDomain(new QueueHealthStorage());
|
|
284
|
+
const integrationStorage = storage.registerDomain(new IntegrationStorage(secretEncryption));
|
|
285
|
+
const factoryProjectsStorage = storage.registerDomain(new FactoryProjectsStorage());
|
|
286
|
+
const filesystemStorage = storage.registerDomain(new FilesystemStorage());
|
|
287
|
+
const sourceControlStorage = storage.registerDomain(new SourceControlStorage());
|
|
288
|
+
const channelIdentityStorage = storage.registerDomain(new ChannelIdentityStorage());
|
|
289
|
+
const workItemCommentsStorage = storage.registerDomain(new WorkItemCommentsStorage());
|
|
290
|
+
const domains = {
|
|
291
|
+
intake: intakeStorage,
|
|
292
|
+
modelCredentials: modelCredentialsStorage,
|
|
293
|
+
modelDefaults: modelDefaultsStorage,
|
|
294
|
+
memorySettings: memorySettingsStorage,
|
|
295
|
+
customProviders: customProvidersStorage,
|
|
296
|
+
filesystem: filesystemStorage,
|
|
297
|
+
projects: factoryProjectsStorage,
|
|
298
|
+
queueHealth: queueHealthStorage,
|
|
299
|
+
workItems: workItemsStorage,
|
|
300
|
+
channelIdentity: channelIdentityStorage,
|
|
301
|
+
comments: workItemCommentsStorage
|
|
302
|
+
};
|
|
303
|
+
const auditDomain = new AuditDomain({
|
|
304
|
+
auth: routeAuth,
|
|
305
|
+
audit: auditStorage,
|
|
306
|
+
projects: factoryProjectsStorage,
|
|
307
|
+
users: auth && isUserProvider(auth) ? auth : void 0,
|
|
308
|
+
sinks: integrations,
|
|
309
|
+
agentTenant: (requestContext) => {
|
|
310
|
+
const user = getFactoryAuthUserFromContext(requestContext);
|
|
311
|
+
return {
|
|
312
|
+
orgId: getFactoryAuthOrgId(user),
|
|
313
|
+
userId: getFactoryAuthUserId(user)
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
const feedPublishers = [];
|
|
318
|
+
const commentsDomain = new CommentsDomain({
|
|
319
|
+
auth: routeAuth,
|
|
320
|
+
comments: workItemCommentsStorage,
|
|
321
|
+
workItems: workItemsStorage,
|
|
322
|
+
projects: factoryProjectsStorage,
|
|
323
|
+
channelIdentity: channelIdentityStorage,
|
|
324
|
+
audit: auditDomain,
|
|
325
|
+
publishers: feedPublishers,
|
|
326
|
+
pubsub: eventBus
|
|
327
|
+
});
|
|
328
|
+
const sandboxOption = this.#config.sandbox;
|
|
329
|
+
let sandboxConfig;
|
|
330
|
+
if (sandboxOption === void 0 || isFactorySandbox(sandboxOption)) sandboxConfig = sandboxOption;
|
|
331
|
+
else if (typeof sandboxOption === "function") sandboxConfig = new CallbackFactorySandbox(sandboxOption);
|
|
332
|
+
else throw new Error(invalidSandboxOptionMessage(sandboxOption));
|
|
333
|
+
this.#sandbox = sandboxConfig;
|
|
334
|
+
const workspaceRegistry = new FactoryWorkspaceRegistry();
|
|
335
|
+
const stateSigner = createStateSigner(this.#config.stateSecret);
|
|
336
|
+
if (auth && hasAuthInit(auth)) await timedPhase("prepare.auth.init", () => auth.init({
|
|
337
|
+
database: storage.authDatabase?.(),
|
|
338
|
+
publicUrl: publicOrigin,
|
|
339
|
+
allowedOrigins
|
|
340
|
+
}));
|
|
341
|
+
await timedPhase("prepare.storage.init", () => storage.init());
|
|
342
|
+
registerCustomProvidersSource({
|
|
343
|
+
storage: customProvidersStorage,
|
|
344
|
+
authEnabled: Boolean(auth)
|
|
345
|
+
});
|
|
346
|
+
for (const integration of integrations) {
|
|
347
|
+
const integrationSourceControl = integration.versionControl ? sourceControlStorage.forIntegration(integration.id) : void 0;
|
|
348
|
+
integration.initialize?.({
|
|
349
|
+
storage: integrationStorage.forIntegration(integration.id),
|
|
350
|
+
projects: factoryProjectsStorage,
|
|
351
|
+
auth: routeAuth,
|
|
352
|
+
intake: intakeStorage,
|
|
353
|
+
...integrationSourceControl ? { sourceControl: integrationSourceControl } : {}
|
|
354
|
+
});
|
|
355
|
+
if (integration.versionControl && integrationSourceControl) integration.versionControl.initialize({ storage: integrationSourceControl });
|
|
356
|
+
}
|
|
357
|
+
const sourceControlSessions = createSourceControlSessionLookup([.../* @__PURE__ */ new Set(["github", ...integrations.filter((integration) => integration.versionControl).map(({ id }) => id)])].map((id) => sourceControlStorage.forIntegration(id)));
|
|
358
|
+
if (auth) registerTenantCredentialResolver(modelCredentialsStorage, deploymentModelProviders, (requestContext) => resolveFactoryCredentialTenant(requestContext, {
|
|
359
|
+
projects: factoryProjectsStorage,
|
|
360
|
+
sourceControl: sourceControlSessions,
|
|
361
|
+
workItems: workItemsStorage
|
|
362
|
+
}));
|
|
363
|
+
const integrationRegistrations = integrations.map((integration) => {
|
|
364
|
+
const requiredDomains = [
|
|
365
|
+
"integrations",
|
|
366
|
+
...integration.versionControl ? ["source-control"] : [],
|
|
367
|
+
...integration.channels ? ["channel-identity"] : []
|
|
368
|
+
];
|
|
369
|
+
return {
|
|
370
|
+
integration,
|
|
371
|
+
ready: requiredDomains.every((domain) => storage.isDomainReady(domain)),
|
|
372
|
+
ensureReady: async () => {
|
|
373
|
+
for (const domain of requiredDomains) await storage.ensureDomainReady(domain);
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
});
|
|
377
|
+
const intakeReady = integrations.some((integration) => integration.intake !== void 0) && storage.isDomainReady("intake");
|
|
378
|
+
const factoryReady = storage.isDomainReady("projects") && storage.isDomainReady("work-items");
|
|
379
|
+
const knowledgeEnabled = this.#config.knowledge !== void 0 || process.env.MASTRACODE_EXPERIMENTAL_SUBCONSCIOUS === "1";
|
|
380
|
+
const deploymentOrganizationId = process.env.MASTRACODE_DEPLOYMENT_ORGANIZATION_ID?.trim() || void 0;
|
|
381
|
+
const githubIntegration = integrations.find((integration) => integration.id === "github");
|
|
382
|
+
const gitlabIntegration = integrations.find((integration) => integration.id === "gitlab" && integration.intake && integration.versionControl);
|
|
383
|
+
const workItemsReady = storage.isDomainReady("work-items");
|
|
384
|
+
const sessionRetirement = sandboxConfig && storage.isDomainReady("source-control") ? new SessionRetirementCoordinator({ invalidateSession: (sessionId) => workspaceRegistry.invalidateSession(sessionId) }) : void 0;
|
|
385
|
+
const retireTerminalSessions = sessionRetirement && workItemsReady ? async ({ orgId, workItemId }) => {
|
|
386
|
+
const item = await workItemsStorage.get({
|
|
387
|
+
orgId,
|
|
388
|
+
id: workItemId
|
|
389
|
+
});
|
|
390
|
+
if (!item) return;
|
|
391
|
+
const sessionIds = [...new Set(Object.values(item.sessions).map((session) => session.sessionId))];
|
|
392
|
+
await Promise.all(sessionIds.map(async (sessionId) => {
|
|
393
|
+
const sourceControl = await sourceControlSessions.getSourceControlBySessionId(sessionId);
|
|
394
|
+
if (!sourceControl) return;
|
|
395
|
+
await sessionRetirement.retireSession({
|
|
396
|
+
sourceControl,
|
|
397
|
+
orgId,
|
|
398
|
+
sessionId,
|
|
399
|
+
deleteSession: false
|
|
400
|
+
});
|
|
401
|
+
}));
|
|
402
|
+
} : void 0;
|
|
403
|
+
const terminalCleanup = workItemsReady ? createTerminalStageCleanup({
|
|
404
|
+
workItems: workItemsStorage,
|
|
405
|
+
reconcileBinding: async (binding) => {
|
|
406
|
+
await factoryProcessor?.reconcileBinding(binding);
|
|
407
|
+
},
|
|
408
|
+
abortSession: async (binding) => {
|
|
409
|
+
const controller = this.#prepared?.base.controller;
|
|
410
|
+
if (!controller) return;
|
|
411
|
+
const session = await controller.getSessionByResource(binding.resourceId);
|
|
412
|
+
if (session?.stream.isActive()) session.abort();
|
|
413
|
+
},
|
|
414
|
+
...retireTerminalSessions ? { releaseSandboxes: retireTerminalSessions } : {}
|
|
415
|
+
}) : void 0;
|
|
416
|
+
const onTerminalStage = terminalCleanup ? (args) => terminalCleanup({
|
|
417
|
+
orgId: args.orgId,
|
|
418
|
+
factoryProjectId: args.factoryProjectId,
|
|
419
|
+
workItemId: args.workItemId,
|
|
420
|
+
revision: args.revision,
|
|
421
|
+
...args.actor.type === "agent" ? { initiatingBindingId: args.actor.bindingId } : {}
|
|
422
|
+
}) : retireTerminalSessions;
|
|
423
|
+
const transitionService = workItemsReady ? new FactoryTransitionService({
|
|
424
|
+
configVersion,
|
|
425
|
+
boards: this.#boards,
|
|
426
|
+
storage: workItemsStorage,
|
|
427
|
+
audit: auditDomain,
|
|
428
|
+
autoApprovePlans: async ({ orgId, factoryProjectId }) => {
|
|
429
|
+
await factoryProjectsStorage.ensureReady();
|
|
430
|
+
return (await factoryProjectsStorage.get({
|
|
431
|
+
orgId,
|
|
432
|
+
id: factoryProjectId
|
|
433
|
+
}))?.autoApprovePlans ?? false;
|
|
434
|
+
},
|
|
435
|
+
...onTerminalStage ? { onTerminalStage } : {},
|
|
436
|
+
...githubIntegration ? { onAccepted: (args) => reconcileGithubAcceptanceLabels(githubIntegration, sourceControlStorage.forIntegration(githubIntegration.id), args) } : {}
|
|
437
|
+
}) : void 0;
|
|
438
|
+
this.#environmentBuilds = this.#sandbox?.builds ? new EnvironmentBuildRunner({
|
|
439
|
+
sandbox: this.#sandbox,
|
|
440
|
+
projects: factoryProjectsStorage,
|
|
441
|
+
sourceControl: githubIntegration?.versionControl ? {
|
|
442
|
+
storage: sourceControlStorage.forIntegration(githubIntegration.id),
|
|
443
|
+
versionControl: githubIntegration.versionControl
|
|
444
|
+
} : void 0,
|
|
445
|
+
logger: { info: (msg, meta) => console.info(`[Mastra Factory] ${msg}`, meta ?? {}) }
|
|
446
|
+
}, { getMastra: () => this.#prepared?.base.controller.getMastra() }) : void 0;
|
|
447
|
+
const environmentBuilds = this.#environmentBuilds;
|
|
448
|
+
const projectRoutes = new ProjectRoutes({
|
|
449
|
+
auth: routeAuth,
|
|
450
|
+
sandbox: this.#sandbox,
|
|
451
|
+
...environmentBuilds ? { environmentBuilds } : {},
|
|
452
|
+
projects: factoryProjectsStorage,
|
|
453
|
+
sourceControl: sourceControlStorage,
|
|
454
|
+
versionControlIntegrationIds: integrations.filter((integration) => integration.versionControl).map((integration) => integration.id),
|
|
455
|
+
...githubIntegration || gitlabIntegration ? { resolveRepository: async ({ integrationId, orgId, userId, installationId, externalId, slug }) => {
|
|
456
|
+
if (githubIntegration && integrationId === githubIntegration.id) {
|
|
457
|
+
const installation = await githubIntegration.sourceControlStorage.installations.get({
|
|
458
|
+
orgId,
|
|
459
|
+
id: installationId
|
|
460
|
+
});
|
|
461
|
+
if (!installation) return null;
|
|
462
|
+
const selected = (await githubIntegration.listInstallationRepos(Number(installation.externalId))).find((repo) => repo.id.toString() === externalId && repo.fullName === slug);
|
|
463
|
+
if (!selected) return null;
|
|
464
|
+
return githubIntegration.sourceControlStorage.repositories.upsert({
|
|
465
|
+
orgId,
|
|
466
|
+
input: {
|
|
467
|
+
installationId,
|
|
468
|
+
externalId,
|
|
469
|
+
slug: selected.fullName,
|
|
470
|
+
defaultBranch: isValidGitRef(selected.defaultBranch) ? selected.defaultBranch : "main",
|
|
471
|
+
providerMetadata: {
|
|
472
|
+
private: selected.private,
|
|
473
|
+
owner: selected.owner
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
if (!gitlabIntegration?.intake || !gitlabIntegration.versionControl || integrationId !== gitlabIntegration.id) return null;
|
|
479
|
+
const installation = await sourceControlStorage.forIntegration(gitlabIntegration.id).installations.get({
|
|
480
|
+
orgId,
|
|
481
|
+
id: installationId
|
|
482
|
+
});
|
|
483
|
+
if (!installation) return null;
|
|
484
|
+
const selected = (await gitlabIntegration.intake.listSources({
|
|
485
|
+
orgId,
|
|
486
|
+
userId
|
|
487
|
+
})).find((source) => source.name === slug && typeof source.metadata?.projectId === "string" && source.metadata.projectId === externalId && source.metadata.connectionId === installation.externalId);
|
|
488
|
+
if (!selected) return null;
|
|
489
|
+
const [repository] = await gitlabIntegration.versionControl.registerRepositories({
|
|
490
|
+
orgId,
|
|
491
|
+
installationId,
|
|
492
|
+
repositories: [{
|
|
493
|
+
externalId,
|
|
494
|
+
slug,
|
|
495
|
+
defaultBranch: typeof selected.metadata?.defaultBranch === "string" && isValidGitRef(selected.metadata.defaultBranch) ? selected.metadata.defaultBranch : "main",
|
|
496
|
+
metadata: selected.metadata
|
|
497
|
+
}]
|
|
498
|
+
});
|
|
499
|
+
return repository ?? null;
|
|
500
|
+
} } : {},
|
|
501
|
+
...typeof githubIntegration?.ingestLinkedRepositoryBacklog === "function" ? { onProjectRepositoryLinked: ({ orgId, projectRepository }) => {
|
|
502
|
+
githubIntegration.ingestLinkedRepositoryBacklog({
|
|
503
|
+
orgId,
|
|
504
|
+
projectRepositoryId: projectRepository.id
|
|
505
|
+
}).catch((error) => {
|
|
506
|
+
console.warn("[factory] Failed to import a linked repository backlog:", error);
|
|
507
|
+
});
|
|
508
|
+
} } : {},
|
|
509
|
+
...sessionRetirement ? { sessionRetirement } : {},
|
|
510
|
+
...workItemsReady ? {
|
|
511
|
+
workItems: workItemsStorage,
|
|
512
|
+
controller: { getSessionByResource: async (resourceId) => this.#prepared?.base.controller.getSessionByResource(resourceId) }
|
|
513
|
+
} : {}
|
|
514
|
+
});
|
|
515
|
+
const loadMemorySettings = async ({ requestContext, binding }) => {
|
|
516
|
+
if (!requestContext) return;
|
|
517
|
+
const scope = readFactorySessionScope(requestContext);
|
|
518
|
+
const user = getFactoryAuthUserFromContext(requestContext);
|
|
519
|
+
const callerUserId = getFactoryAuthUserId(user);
|
|
520
|
+
const callerOrgId = factoryUserOrgId(user);
|
|
521
|
+
const factoryProjectId = binding?.factoryProjectId ?? scope?.factoryProjectId;
|
|
522
|
+
const target = factoryProjectId ? {
|
|
523
|
+
orgId: binding?.orgId ?? scope?.factoryOrgId ?? callerOrgId ?? "local",
|
|
524
|
+
userId: factoryMemorySettingsUserId(factoryProjectId)
|
|
525
|
+
} : callerUserId && callerOrgId ? {
|
|
526
|
+
orgId: callerOrgId,
|
|
527
|
+
userId: callerUserId
|
|
528
|
+
} : {
|
|
529
|
+
orgId: "local",
|
|
530
|
+
userId: "local"
|
|
531
|
+
};
|
|
532
|
+
const record = await memorySettingsStorage.get(target);
|
|
533
|
+
let personal = null;
|
|
534
|
+
if (factoryProjectId && requestContext.get("channel") && callerUserId && callerOrgId) try {
|
|
535
|
+
personal = await memorySettingsStorage.get({
|
|
536
|
+
orgId: callerOrgId,
|
|
537
|
+
userId: callerUserId
|
|
538
|
+
});
|
|
539
|
+
} catch (error) {
|
|
540
|
+
console.warn("[Factory Memory Settings] Unable to read the sender's memory settings", { error: error instanceof Error ? error.message : String(error) });
|
|
541
|
+
}
|
|
542
|
+
requestContext.set("mastra__factoryMemorySettings", layerPersonalMemorySettings(record, personal));
|
|
543
|
+
};
|
|
544
|
+
const factoryProcessor = workItemsReady ? new FactoryPhaseStateProcessor({
|
|
545
|
+
configVersion,
|
|
546
|
+
storage: workItemsStorage,
|
|
547
|
+
boards: this.#boards,
|
|
548
|
+
loadMemorySettings,
|
|
549
|
+
...transitionService ? { transitionService } : {},
|
|
550
|
+
...githubIntegration ? { recordPullRequestProvenance: (input) => recordFactoryPullRequestProvenance(githubIntegration, sourceControlStorage.forIntegration("github"), integrationStorage.forIntegration("github"), workItemsStorage, input) } : {},
|
|
551
|
+
messageReader: { listMessages: async (input) => {
|
|
552
|
+
const memory = await storage.getMastraStorage().getStore("memory");
|
|
553
|
+
return memory ? memory.listMessages(input) : {
|
|
554
|
+
messages: [],
|
|
555
|
+
hasMore: false
|
|
556
|
+
};
|
|
557
|
+
} }
|
|
558
|
+
}) : void 0;
|
|
559
|
+
for (const { integration } of integrationRegistrations) if (integration.requiresStableStateSigner && !stateSigner.stable) throw new Error(`MastraFactory: integration '${integration.id}' signs OAuth state and requires a replica-stable state secret, but none is configured. Set 'stateSecret' on the factory config.`);
|
|
560
|
+
const mastraStorageBackend = (() => {
|
|
561
|
+
for (let proto = Object.getPrototypeOf(storage); proto; proto = Object.getPrototypeOf(proto)) {
|
|
562
|
+
if (proto.constructor?.name === "PgFactoryStorage") return "pg";
|
|
563
|
+
if (proto.constructor?.name === "LibSQLFactoryStorage") return "libsql";
|
|
564
|
+
}
|
|
565
|
+
})();
|
|
566
|
+
const toolIntegrations = integrationRegistrations.filter(({ integration }) => integration.agentTools || integration.sessionTools);
|
|
567
|
+
const sourceControlToolProviders = integrations.flatMap((integration) => integration.versionControl ? [{
|
|
568
|
+
id: integration.id,
|
|
569
|
+
versionControl: integration.versionControl,
|
|
570
|
+
storage: sourceControlStorage.forIntegration(integration.id)
|
|
571
|
+
}] : []);
|
|
572
|
+
const prepared = await timedPhase("prepare.controllerMount", () => prepareAgentControllerMount({
|
|
573
|
+
controllerId: CONTROLLER_ID,
|
|
574
|
+
coAuthor: { name: "mastra-platform[bot]" },
|
|
575
|
+
...this.#config.disableBuiltinTools?.length ? { disableBuiltinTools: this.#config.disableBuiltinTools } : {},
|
|
576
|
+
modes: false,
|
|
577
|
+
workspace: createWorkspaceFactory({
|
|
578
|
+
...sandboxConfig ? { sandbox: sandboxConfig } : {},
|
|
579
|
+
...this.#config.sandboxStart ? { sandboxStart: this.#config.sandboxStart } : {},
|
|
580
|
+
sourceControls: integrations.flatMap((integration) => integration.versionControl ? [{
|
|
581
|
+
id: integration.id,
|
|
582
|
+
versionControl: integration.versionControl,
|
|
583
|
+
storage: sourceControlStorage.forIntegration(integration.id),
|
|
584
|
+
...integration.id === "github" && githubIntegration ? { github: githubIntegration } : {}
|
|
585
|
+
}] : []),
|
|
586
|
+
...factoryProjectsStorage ? { projects: factoryProjectsStorage } : {},
|
|
587
|
+
...workItemsStorage ? { workItems: workItemsStorage } : {},
|
|
588
|
+
workspaceRegistry
|
|
589
|
+
}),
|
|
590
|
+
disableGithubSignals: true,
|
|
591
|
+
prepareWakeRequestContext: async ({ requestContext, resourceId }) => {
|
|
592
|
+
if (!storage.isDomainReady("source-control")) return;
|
|
593
|
+
await prepareSessionRunContext(requestContext, resourceId, { sessions: sourceControlSessions });
|
|
594
|
+
},
|
|
595
|
+
disableSettingsOmSeed: true,
|
|
596
|
+
hostInstructions: async ({ requestContext }) => {
|
|
597
|
+
const context = requestContext.get("controller");
|
|
598
|
+
if (parseSupervisorResourceId(context?.resourceId)) return SUPERVISOR_INSTRUCTIONS;
|
|
599
|
+
if (context?.threadId && context.resourceId) {
|
|
600
|
+
const current = context.getState();
|
|
601
|
+
if (!(Boolean(current.factoryProjectId) && Boolean(current.factoryOrgId) && typeof current.untrustedCheckout === "boolean")) {
|
|
602
|
+
const recovered = await resolveFactorySessionAddress({
|
|
603
|
+
requestContext,
|
|
604
|
+
storage: workItemsStorage,
|
|
605
|
+
forceBindingLookup: true,
|
|
606
|
+
...storage.isDomainReady("source-control") ? { sessions: sourceControlSessions } : {}
|
|
607
|
+
});
|
|
608
|
+
if (recovered?.binding) {
|
|
609
|
+
const state = context.getState();
|
|
610
|
+
if (state.factoryProjectId !== recovered.binding.factoryProjectId || recovered.binding.role === "review" && state.untrustedCheckout !== true) throw new Error("Factory review session security state could not be restored before prompt creation.");
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
},
|
|
615
|
+
initialState: {
|
|
616
|
+
skipGlobalInstructions: true,
|
|
617
|
+
factoryOrgUnresolved: true,
|
|
618
|
+
projectPath: "",
|
|
619
|
+
projectName: "",
|
|
620
|
+
gitBranch: ""
|
|
621
|
+
},
|
|
622
|
+
storage: storage.getMastraStorage(),
|
|
623
|
+
...mastraStorageBackend ? { storageBackend: mastraStorageBackend } : {},
|
|
624
|
+
...this.#config.knowledge ? { knowledge: this.#config.knowledge } : {},
|
|
625
|
+
inputProcessors: async ({ requestContext }) => {
|
|
626
|
+
const environmentProcessor = new FactoryEnvironmentStateProcessor();
|
|
627
|
+
if (factoryProcessor) {
|
|
628
|
+
await factoryProcessor.prepareMemorySettings(requestContext);
|
|
629
|
+
return [environmentProcessor, factoryProcessor];
|
|
630
|
+
}
|
|
631
|
+
try {
|
|
632
|
+
await loadMemorySettings({
|
|
633
|
+
requestContext,
|
|
634
|
+
binding: null
|
|
635
|
+
});
|
|
636
|
+
} catch (error) {
|
|
637
|
+
reportMemorySettingsUnavailable(requestContext, error instanceof Error ? error.message : String(error));
|
|
638
|
+
}
|
|
639
|
+
return [environmentProcessor];
|
|
640
|
+
},
|
|
641
|
+
...vector ? { vector } : {},
|
|
642
|
+
...toolIntegrations.length > 0 || sourceControlToolProviders.length > 0 || workItemsStorage && transitionService ? { extraTools: async ({ requestContext }) => {
|
|
643
|
+
const tools = {};
|
|
644
|
+
const toolOwners = /* @__PURE__ */ new Map();
|
|
645
|
+
const mergeTools = (ownerId, contributed) => {
|
|
646
|
+
for (const [name, tool] of Object.entries(contributed)) {
|
|
647
|
+
const owner = toolOwners.get(name);
|
|
648
|
+
if (owner) throw new Error(`MastraFactory: integration tool '${name}' from '${ownerId}' conflicts with '${owner}'.`);
|
|
649
|
+
toolOwners.set(name, ownerId);
|
|
650
|
+
tools[name] = tool;
|
|
651
|
+
}
|
|
652
|
+
};
|
|
653
|
+
if (storage.isDomainReady("source-control")) mergeTools("source-control", await createSourceControlTools({
|
|
654
|
+
requestContext,
|
|
655
|
+
providers: sourceControlToolProviders,
|
|
656
|
+
audit: auditDomain
|
|
657
|
+
}));
|
|
658
|
+
if (workItemsStorage && transitionService) {
|
|
659
|
+
mergeTools("factory", await createFactoryTransitionTools({
|
|
660
|
+
requestContext,
|
|
661
|
+
storage: workItemsStorage,
|
|
662
|
+
transitionService,
|
|
663
|
+
boards: this.#boards,
|
|
664
|
+
...storage.isDomainReady("source-control") ? { sessions: sourceControlSessions } : {}
|
|
665
|
+
}));
|
|
666
|
+
const reviewSourceUiOrigin = resolveReviewSourceUiOrigin(process.env.MASTRACODE_PUBLIC_URL);
|
|
667
|
+
mergeTools("factory-review-source", await createReviewSourceTool({
|
|
668
|
+
requestContext,
|
|
669
|
+
storage: workItemsStorage,
|
|
670
|
+
uiOrigin: reviewSourceUiOrigin,
|
|
671
|
+
...storage.isDomainReady("source-control") ? { sessions: sourceControlSessions } : {}
|
|
672
|
+
}));
|
|
673
|
+
const supervisorScope = await resolveSupervisorScope({
|
|
674
|
+
requestContext,
|
|
675
|
+
projects: factoryProjectsStorage
|
|
676
|
+
});
|
|
677
|
+
if (supervisorScope) {
|
|
678
|
+
const userId = getFactoryAuthUserId(getFactoryAuthUserFromContext(requestContext));
|
|
679
|
+
mergeTools("factory-supervisor", createFactorySupervisorReadTools({
|
|
680
|
+
scope: supervisorScope,
|
|
681
|
+
workItems: workItemsStorage,
|
|
682
|
+
boards: this.#boards,
|
|
683
|
+
comments: workItemCommentsStorage,
|
|
684
|
+
audit: auditStorage,
|
|
685
|
+
messageReader: { listMessages: async (input) => {
|
|
686
|
+
const memory = await storage.getMastraStorage().getStore("memory");
|
|
687
|
+
return memory ? memory.listMessages(input) : {
|
|
688
|
+
messages: [],
|
|
689
|
+
hasMore: false
|
|
690
|
+
};
|
|
691
|
+
} }
|
|
692
|
+
}));
|
|
693
|
+
if (userId) mergeTools("factory-supervisor-write", createFactorySupervisorWriteTools({
|
|
694
|
+
scope: supervisorScope,
|
|
695
|
+
userId,
|
|
696
|
+
workItems: workItemsStorage,
|
|
697
|
+
boards: this.#boards,
|
|
698
|
+
audit: auditDomain,
|
|
699
|
+
transitionService,
|
|
700
|
+
...githubIntegration ? { reconcileAcceptanceLabels: (args) => reconcileGithubAcceptanceLabels(githubIntegration, sourceControlStorage.forIntegration(githubIntegration.id), args) } : {},
|
|
701
|
+
messageSession: ({ sessionId, message, delivery }) => messageWorkerSession({
|
|
702
|
+
controller: prepared.base.controller,
|
|
703
|
+
sessionId,
|
|
704
|
+
message,
|
|
705
|
+
delivery,
|
|
706
|
+
...requestContext ? { requestContext } : {}
|
|
707
|
+
})
|
|
708
|
+
}));
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
for (const { integration, ready, ensureReady } of toolIntegrations) {
|
|
712
|
+
if (!ready && ensureReady) try {
|
|
713
|
+
await ensureReady();
|
|
714
|
+
} catch {
|
|
715
|
+
continue;
|
|
716
|
+
}
|
|
717
|
+
if (integration.agentTools) mergeTools(integration.id, await integration.agentTools({ requestContext }));
|
|
718
|
+
if (integration.sessionTools) mergeTools(integration.id, integration.sessionTools({ requestContext }));
|
|
719
|
+
}
|
|
720
|
+
return tools;
|
|
721
|
+
} } : {},
|
|
722
|
+
postToolObserver: async (toolContext) => {
|
|
723
|
+
const requestContext = toolContext.context?.requestContext;
|
|
724
|
+
if (requestContext) await observeAgentGitAction({
|
|
725
|
+
audit: auditDomain,
|
|
726
|
+
toolContext: {
|
|
727
|
+
...toolContext,
|
|
728
|
+
context: requestContext
|
|
729
|
+
},
|
|
730
|
+
resolveRepositorySlugs: async (sessionId) => {
|
|
731
|
+
for (const provider of sourceControlToolProviders) {
|
|
732
|
+
const session = await provider.storage.sessions.getBySessionId(sessionId);
|
|
733
|
+
if (!session) continue;
|
|
734
|
+
return environmentSlugs(await resolveSessionRepositories({
|
|
735
|
+
sourceControl: provider.storage,
|
|
736
|
+
session
|
|
737
|
+
}));
|
|
738
|
+
}
|
|
739
|
+
return [];
|
|
740
|
+
}
|
|
741
|
+
});
|
|
742
|
+
await Promise.all(integrations.map(async (integration) => {
|
|
743
|
+
if (!integration.postToolObserver) return;
|
|
744
|
+
try {
|
|
745
|
+
await integration.postToolObserver({
|
|
746
|
+
toolContext,
|
|
747
|
+
requestContext
|
|
748
|
+
});
|
|
749
|
+
} catch (error) {
|
|
750
|
+
console.warn(`[factory] Integration '${integration.id}' post-tool observer failed:`, error);
|
|
751
|
+
}
|
|
752
|
+
}));
|
|
753
|
+
},
|
|
754
|
+
...pubsub ? {
|
|
755
|
+
pubsub,
|
|
756
|
+
crossProcessPubSub: true
|
|
757
|
+
} : {},
|
|
758
|
+
buildApiRoutes: ({ controller, authStorage }) => [
|
|
759
|
+
...auth ? buildAuthRoutes(auth, { publicUrl: publicOrigin }) : buildAuthDisabledRoutes(),
|
|
760
|
+
...new TelemetryRoutes({
|
|
761
|
+
auth: routeAuth,
|
|
762
|
+
providerName: auth?.name,
|
|
763
|
+
publicOrigin,
|
|
764
|
+
allowedOrigins
|
|
765
|
+
}).routes(),
|
|
766
|
+
...assembleFactoryApiRoutes({
|
|
767
|
+
controllerId: CONTROLLER_ID,
|
|
768
|
+
controller,
|
|
769
|
+
liveSessions: liveSessionsTouchingTheFeed(controller, eventBus),
|
|
770
|
+
auth: routeAuth,
|
|
771
|
+
...auth && isUserProvider(auth) ? { users: auth } : {},
|
|
772
|
+
authStorage,
|
|
773
|
+
audit: auditDomain,
|
|
774
|
+
publicOrigin,
|
|
775
|
+
stateSigner,
|
|
776
|
+
sandbox: sandboxConfig,
|
|
777
|
+
...environmentBuilds ? { onRepositoryPush: environmentBuilds.onRepositoryPush } : {},
|
|
778
|
+
sessionRetirement,
|
|
779
|
+
factoryStorage: storage,
|
|
780
|
+
integrationStorage,
|
|
781
|
+
sourceControlStorage,
|
|
782
|
+
domains,
|
|
783
|
+
feed: commentsDomain,
|
|
784
|
+
integrations: integrationRegistrations,
|
|
785
|
+
intakeReady,
|
|
786
|
+
factoryReady,
|
|
787
|
+
knowledgeEnabled,
|
|
788
|
+
deploymentOrganizationId,
|
|
789
|
+
deploymentModelProviders,
|
|
790
|
+
knowledgeKey: this.#config.knowledge?.key,
|
|
791
|
+
configVersion,
|
|
792
|
+
boardRegistry: this.#boards,
|
|
793
|
+
factoryTransitionService: transitionService,
|
|
794
|
+
onFactoryRuntime: ({ transitionService: runtimeTransitionService, prepareBinding }) => {
|
|
795
|
+
this.#dispatcher ??= new FactoryDecisionDispatcher({
|
|
796
|
+
controller,
|
|
797
|
+
transitionService: runtimeTransitionService,
|
|
798
|
+
storage: storage.getDomain("work-items"),
|
|
799
|
+
audit: auditDomain,
|
|
800
|
+
boards: this.#boards,
|
|
801
|
+
maxInFlight: this.#config.dispatcher?.maxInFlight,
|
|
802
|
+
isAutoRunEnabled: async ({ orgId, factoryProjectId }) => {
|
|
803
|
+
await factoryProjectsStorage.ensureReady();
|
|
804
|
+
return (await factoryProjectsStorage.get({
|
|
805
|
+
orgId,
|
|
806
|
+
id: factoryProjectId
|
|
807
|
+
}))?.autoRunEnabled ?? false;
|
|
808
|
+
},
|
|
809
|
+
autoApprovePlans: async ({ orgId, factoryProjectId }) => {
|
|
810
|
+
await factoryProjectsStorage.ensureReady();
|
|
811
|
+
return (await factoryProjectsStorage.get({
|
|
812
|
+
orgId,
|
|
813
|
+
id: factoryProjectId
|
|
814
|
+
}))?.autoApprovePlans ?? false;
|
|
815
|
+
},
|
|
816
|
+
reconcileToolResults: () => factoryProcessor?.reconcileAllBoundThreads() ?? Promise.resolve(),
|
|
817
|
+
prepareBinding,
|
|
818
|
+
feedReader: new FactoryFeedReader(workItemCommentsStorage),
|
|
819
|
+
...githubIntegration ? { dismissStaleReviews: async (decision) => {
|
|
820
|
+
await dismissStaleFactoryReviews(githubIntegration.versionControl, decision, (login) => isFactoryGithubLogin(githubIntegration, login), (login) => trustedCollaborator(githubIntegration, {
|
|
821
|
+
installationId: decision.installationId,
|
|
822
|
+
repository: decision.repository,
|
|
823
|
+
login
|
|
824
|
+
}));
|
|
825
|
+
} } : {},
|
|
826
|
+
primeCredentials: (tenant) => primeTenantCredentials({
|
|
827
|
+
tenant,
|
|
828
|
+
credentials: modelCredentialsStorage
|
|
829
|
+
}),
|
|
830
|
+
resolveLinkedWorkItemParentId: async ({ orgId, factoryProjectId, decision }) => {
|
|
831
|
+
if (decision.source !== "github-pr") return null;
|
|
832
|
+
const repositoryId = decision.metadata?.githubRepositoryId;
|
|
833
|
+
const pullRequestNumber = decision.metadata?.githubPullRequestNumber;
|
|
834
|
+
if (typeof repositoryId !== "number" || typeof pullRequestNumber !== "number") return null;
|
|
835
|
+
return resolveFactoryPullRequestParentWorkItemId(integrationStorage.forIntegration("github"), {
|
|
836
|
+
orgId,
|
|
837
|
+
factoryProjectId,
|
|
838
|
+
repositoryId,
|
|
839
|
+
pullRequestNumber
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
});
|
|
843
|
+
}
|
|
844
|
+
}),
|
|
845
|
+
...projectRoutes.routes(),
|
|
846
|
+
...auditDomain.routes(),
|
|
847
|
+
...commentsDomain.routes(),
|
|
848
|
+
...hasPlatformCredentials() ? buildPlatformConnectRoutes({
|
|
849
|
+
auth: routeAuth,
|
|
850
|
+
client: new PlatformApiClient(platformApiClientConfigFromEnv())
|
|
851
|
+
}) : []
|
|
852
|
+
],
|
|
853
|
+
buildServerConfig: () => {
|
|
854
|
+
const cors = allowedOrigins.length ? { cors: {
|
|
855
|
+
origin: allowedOrigins,
|
|
856
|
+
credentials: true
|
|
857
|
+
} } : {};
|
|
858
|
+
const onError = { onError: handleServerError };
|
|
859
|
+
const uiDist = resolveUiDistDir();
|
|
860
|
+
const spa = uiDist ? [createSpaStaticMiddleware(uiDist)] : [];
|
|
861
|
+
if (!auth) return {
|
|
862
|
+
middleware: [createCustomProvidersPrimer({
|
|
863
|
+
auth: routeAuth,
|
|
864
|
+
storage: customProvidersStorage,
|
|
865
|
+
authEnabled: false
|
|
866
|
+
}), ...spa],
|
|
867
|
+
...cors,
|
|
868
|
+
...onError
|
|
869
|
+
};
|
|
870
|
+
return {
|
|
871
|
+
auth,
|
|
872
|
+
middleware: [
|
|
873
|
+
createFactoryAuthGate(auth),
|
|
874
|
+
createTenantCredentialPrimer({
|
|
875
|
+
auth: routeAuth,
|
|
876
|
+
credentials: modelCredentialsStorage
|
|
877
|
+
}),
|
|
878
|
+
createCustomProvidersPrimer({
|
|
879
|
+
auth: routeAuth,
|
|
880
|
+
storage: customProvidersStorage,
|
|
881
|
+
authEnabled: Boolean(auth)
|
|
882
|
+
}),
|
|
883
|
+
...spa
|
|
884
|
+
],
|
|
885
|
+
...cors,
|
|
886
|
+
...onError
|
|
887
|
+
};
|
|
888
|
+
}
|
|
889
|
+
}));
|
|
890
|
+
prepared.base.controller.onSessionCreated((session) => {
|
|
891
|
+
observeSessionFilesystem(session, {
|
|
892
|
+
filesystem: filesystemStorage,
|
|
893
|
+
sourceControl: { sessions: sourceControlSessions }
|
|
894
|
+
});
|
|
895
|
+
observeSessionFirstMessage(session, { sourceControl: { sessions: sourceControlSessions } });
|
|
896
|
+
observeSessionFirstExec(session, { sourceControl: { sessions: sourceControlSessions } });
|
|
897
|
+
observeSessionThreadTitle(session, { sourceControl: { sessions: sourceControlSessions } });
|
|
898
|
+
observeSessionRunEnd(session, { audit: auditDomain });
|
|
899
|
+
});
|
|
900
|
+
prepared.base.controller.onSessionCreated((session) => hydrateSupervisorSession(session, {
|
|
901
|
+
projects: factoryProjectsStorage,
|
|
902
|
+
modelDefaults: modelDefaultsStorage
|
|
903
|
+
}).catch((error) => {
|
|
904
|
+
console.warn("[Factory Supervisor] Failed to hydrate supervisor session", { error: error instanceof Error ? error.message : String(error) });
|
|
905
|
+
}), { blocking: true });
|
|
906
|
+
prepared.base.controller.onSessionCreated((session) => hydrateSessionMemorySettings(session, { sourceControl: { sessions: sourceControlSessions } }), { blocking: true });
|
|
907
|
+
prepared.base.controller.onSessionCreated((session) => hydrateSessionDefaultModel(session, {
|
|
908
|
+
sourceControl: sourceControlSessions,
|
|
909
|
+
projects: factoryProjectsStorage,
|
|
910
|
+
workItems: workItemsStorage,
|
|
911
|
+
modelDefaults: modelDefaultsStorage
|
|
912
|
+
}), { blocking: true });
|
|
913
|
+
this.#prepared = prepared;
|
|
914
|
+
this.#factoryProcessor = factoryProcessor;
|
|
915
|
+
const channelRegistrations = integrationRegistrations.filter(({ integration, ready }) => ready && integration.channels);
|
|
916
|
+
if (channelRegistrations.length > 1) throw new Error(`MastraFactory: integrations [${channelRegistrations.map(({ integration }) => integration.id).join(", ")}] all provide channels, but only one may. Remove all but one.`);
|
|
917
|
+
for (const { integration } of channelRegistrations) {
|
|
918
|
+
const context = buildIntegrationContext({
|
|
919
|
+
controller: prepared.base.controller,
|
|
920
|
+
publicOrigin,
|
|
921
|
+
auth: routeAuth,
|
|
922
|
+
stateSigner,
|
|
923
|
+
sandbox: sandboxConfig,
|
|
924
|
+
factoryStorage: storage,
|
|
925
|
+
integrationStorage,
|
|
926
|
+
sourceControlStorage,
|
|
927
|
+
integrations: integrationRegistrations,
|
|
928
|
+
configVersion,
|
|
929
|
+
boardRegistry: this.#boards,
|
|
930
|
+
factoryReady,
|
|
931
|
+
domains,
|
|
932
|
+
feed: commentsDomain,
|
|
933
|
+
...githubIntegration ? { sourceControlOwnerId: "github" } : {}
|
|
934
|
+
}, integration.id);
|
|
935
|
+
prepared.base.controller.setChannels(new AgentControllerChannels(integration.channels(context)));
|
|
936
|
+
}
|
|
937
|
+
for (const { integration } of integrationRegistrations.filter(({ integration, ready }) => ready && integration.feedPublisher)) {
|
|
938
|
+
const context = buildIntegrationContext({
|
|
939
|
+
controller: prepared.base.controller,
|
|
940
|
+
publicOrigin,
|
|
941
|
+
auth: routeAuth,
|
|
942
|
+
stateSigner,
|
|
943
|
+
sandbox: sandboxConfig,
|
|
944
|
+
factoryStorage: storage,
|
|
945
|
+
integrationStorage,
|
|
946
|
+
sourceControlStorage,
|
|
947
|
+
integrations: integrationRegistrations,
|
|
948
|
+
configVersion,
|
|
949
|
+
boardRegistry: this.#boards,
|
|
950
|
+
factoryReady,
|
|
951
|
+
domains,
|
|
952
|
+
feed: commentsDomain,
|
|
953
|
+
...githubIntegration ? { sourceControlOwnerId: "github" } : {}
|
|
954
|
+
}, integration.id);
|
|
955
|
+
const publisher = integration.feedPublisher(context);
|
|
956
|
+
if (publisher) feedPublishers.push(publisher);
|
|
957
|
+
}
|
|
958
|
+
const integrationWorkers = [...factoryReady ? [new FactorySupervisorHealthWorker({
|
|
959
|
+
projects: factoryProjectsStorage,
|
|
960
|
+
workItems: workItemsStorage,
|
|
961
|
+
boards: this.#boards
|
|
962
|
+
})] : [], ...integrationRegistrations.filter(({ integration, ready }) => ready && integration.workers).flatMap(({ integration }) => integration.workers(buildIntegrationContext({
|
|
963
|
+
controller: prepared.base.controller,
|
|
964
|
+
publicOrigin,
|
|
965
|
+
auth: routeAuth,
|
|
966
|
+
stateSigner,
|
|
967
|
+
sandbox: sandboxConfig,
|
|
968
|
+
factoryStorage: storage,
|
|
969
|
+
integrationStorage,
|
|
970
|
+
sourceControlStorage,
|
|
971
|
+
integrations: integrationRegistrations,
|
|
972
|
+
configVersion,
|
|
973
|
+
boardRegistry: this.#boards,
|
|
974
|
+
factoryReady,
|
|
975
|
+
domains,
|
|
976
|
+
feed: commentsDomain,
|
|
977
|
+
...githubIntegration ? { sourceControlOwnerId: "github" } : {}
|
|
978
|
+
}, integration.id)))];
|
|
979
|
+
return {
|
|
980
|
+
...prepared.mastraArgs,
|
|
981
|
+
...auth ? { studio: { auth } } : {},
|
|
982
|
+
...integrationWorkers.length > 0 ? { workers: integrationWorkers } : {},
|
|
983
|
+
...environmentBuilds ? { workflows: { [ENVIRONMENT_BUILD_WORKFLOW_ID]: environmentBuilds.workflow } } : {}
|
|
984
|
+
};
|
|
985
|
+
}
|
|
986
|
+
/**
|
|
987
|
+
* Post-construct boot: initialize the controller (which inherits the
|
|
988
|
+
* constructed Mastra's storage) and start its workers. Call AFTER the entry
|
|
989
|
+
* has run `new Mastra(prepare()'s args)`.
|
|
990
|
+
*/
|
|
991
|
+
async finalize() {
|
|
992
|
+
if (!this.#prepared) throw new Error("MastraFactory.finalize() called before prepare()");
|
|
993
|
+
await timedPhase("finalize.controller", () => this.#prepared.finalize());
|
|
994
|
+
await this.#environmentBuilds?.probeSchedules();
|
|
995
|
+
await timedPhase("finalize.reconcileBoundThreads", () => this.#factoryProcessor?.reconcileAllBoundThreads() ?? Promise.resolve());
|
|
996
|
+
this.#dispatcher?.start();
|
|
997
|
+
}
|
|
998
|
+
/** Stop Factory-owned background dispatch before the host process shuts down. */
|
|
999
|
+
async shutdown() {
|
|
1000
|
+
await this.#dispatcher?.stop();
|
|
1001
|
+
}
|
|
1002
|
+
};
|
|
1003
|
+
//#endregion
|
|
1004
|
+
export { MastraFactory };
|
|
1005
|
+
|
|
1006
|
+
//# sourceMappingURL=factory.js.map
|