@mastra/factory 0.0.0-aggregate-trace-20261015182851
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +32 -0
- package/README.md +671 -0
- package/dist/auth.d.ts +201 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +623 -0
- package/dist/auth.js.map +1 -0
- package/dist/boards/define-board.d.ts +111 -0
- package/dist/boards/define-board.d.ts.map +1 -0
- package/dist/boards/define-board.js +156 -0
- package/dist/boards/define-board.js.map +1 -0
- package/dist/boards/index.d.ts +14 -0
- package/dist/boards/index.d.ts.map +1 -0
- package/dist/boards/index.js +21 -0
- package/dist/boards/index.js.map +1 -0
- package/dist/boards/registry.d.ts +16 -0
- package/dist/boards/registry.d.ts.map +1 -0
- package/dist/boards/registry.js +25 -0
- package/dist/boards/registry.js.map +1 -0
- package/dist/boards/relocate.d.ts +21 -0
- package/dist/boards/relocate.d.ts.map +1 -0
- package/dist/boards/relocate.js +58 -0
- package/dist/boards/relocate.js.map +1 -0
- package/dist/boards/review.d.ts +6 -0
- package/dist/boards/review.d.ts.map +1 -0
- package/dist/boards/review.js +104 -0
- package/dist/boards/review.js.map +1 -0
- package/dist/boards/semantics.d.ts +68 -0
- package/dist/boards/semantics.d.ts.map +1 -0
- package/dist/boards/semantics.js +119 -0
- package/dist/boards/semantics.js.map +1 -0
- package/dist/boards/transition-policy.d.ts +67 -0
- package/dist/boards/transition-policy.d.ts.map +1 -0
- package/dist/boards/transition-policy.js +36 -0
- package/dist/boards/transition-policy.js.map +1 -0
- package/dist/boards/work-tool-rules.d.ts +8 -0
- package/dist/boards/work-tool-rules.d.ts.map +1 -0
- package/dist/boards/work-tool-rules.js +20 -0
- package/dist/boards/work-tool-rules.js.map +1 -0
- package/dist/boards/work-transition-policy.d.ts +3 -0
- package/dist/boards/work-transition-policy.d.ts.map +1 -0
- package/dist/boards/work-transition-policy.js +46 -0
- package/dist/boards/work-transition-policy.js.map +1 -0
- package/dist/boards/work.d.ts +4 -0
- package/dist/boards/work.d.ts.map +1 -0
- package/dist/boards/work.js +222 -0
- package/dist/boards/work.js.map +1 -0
- package/dist/capabilities/connection.d.ts +9 -0
- package/dist/capabilities/connection.d.ts.map +1 -0
- package/dist/capabilities/connection.js +1 -0
- package/dist/capabilities/intake.d.ts +153 -0
- package/dist/capabilities/intake.d.ts.map +1 -0
- package/dist/capabilities/intake.js +1 -0
- package/dist/capabilities/version-control.d.ts +268 -0
- package/dist/capabilities/version-control.d.ts.map +1 -0
- package/dist/capabilities/version-control.js +1 -0
- package/dist/environment/build-runner.d.ts +72 -0
- package/dist/environment/build-runner.d.ts.map +1 -0
- package/dist/environment/build-runner.js +131 -0
- package/dist/environment/build-runner.js.map +1 -0
- package/dist/environment/build-schedule.d.ts +40 -0
- package/dist/environment/build-schedule.d.ts.map +1 -0
- package/dist/environment/build-schedule.js +94 -0
- package/dist/environment/build-schedule.js.map +1 -0
- package/dist/environment/build-workflow.d.ts +62 -0
- package/dist/environment/build-workflow.d.ts.map +1 -0
- package/dist/environment/build-workflow.js +149 -0
- package/dist/environment/build-workflow.js.map +1 -0
- package/dist/environment/build.d.ts +111 -0
- package/dist/environment/build.d.ts.map +1 -0
- package/dist/environment/build.js +344 -0
- package/dist/environment/build.js.map +1 -0
- package/dist/environment/heads.d.ts +36 -0
- package/dist/environment/heads.d.ts.map +1 -0
- package/dist/environment/heads.js +60 -0
- package/dist/environment/heads.js.map +1 -0
- package/dist/factory.d.ts +225 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/factory.js +1006 -0
- package/dist/factory.js.map +1 -0
- package/dist/feed-events.d.ts +13 -0
- package/dist/feed-events.d.ts.map +1 -0
- package/dist/feed-events.js +25 -0
- package/dist/feed-events.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/integrations/base.d.ts +302 -0
- package/dist/integrations/base.d.ts.map +1 -0
- package/dist/integrations/base.js +1 -0
- package/dist/integrations/github/acceptance-labels.d.ts +16 -0
- package/dist/integrations/github/acceptance-labels.d.ts.map +1 -0
- package/dist/integrations/github/acceptance-labels.js +55 -0
- package/dist/integrations/github/acceptance-labels.js.map +1 -0
- package/dist/integrations/github/app-identity.d.ts +43 -0
- package/dist/integrations/github/app-identity.d.ts.map +1 -0
- package/dist/integrations/github/app-identity.js +62 -0
- package/dist/integrations/github/app-identity.js.map +1 -0
- package/dist/integrations/github/commits.d.ts +40 -0
- package/dist/integrations/github/commits.d.ts.map +1 -0
- package/dist/integrations/github/commits.js +48 -0
- package/dist/integrations/github/commits.js.map +1 -0
- package/dist/integrations/github/config.d.ts +60 -0
- package/dist/integrations/github/config.d.ts.map +1 -0
- package/dist/integrations/github/config.js +42 -0
- package/dist/integrations/github/config.js.map +1 -0
- package/dist/integrations/github/default-rules.d.ts +218 -0
- package/dist/integrations/github/default-rules.d.ts.map +1 -0
- package/dist/integrations/github/default-rules.js +296 -0
- package/dist/integrations/github/default-rules.js.map +1 -0
- package/dist/integrations/github/integration.d.ts +270 -0
- package/dist/integrations/github/integration.d.ts.map +1 -0
- package/dist/integrations/github/integration.js +1375 -0
- package/dist/integrations/github/integration.js.map +1 -0
- package/dist/integrations/github/issue-reconciler.d.ts +28 -0
- package/dist/integrations/github/issue-reconciler.d.ts.map +1 -0
- package/dist/integrations/github/issue-reconciler.js +138 -0
- package/dist/integrations/github/issue-reconciler.js.map +1 -0
- package/dist/integrations/github/pat.d.ts +38 -0
- package/dist/integrations/github/pat.d.ts.map +1 -0
- package/dist/integrations/github/pat.js +59 -0
- package/dist/integrations/github/pat.js.map +1 -0
- package/dist/integrations/github/provenance.d.ts +34 -0
- package/dist/integrations/github/provenance.d.ts.map +1 -0
- package/dist/integrations/github/provenance.js +91 -0
- package/dist/integrations/github/provenance.js.map +1 -0
- package/dist/integrations/github/reconcile-worker.d.ts +45 -0
- package/dist/integrations/github/reconcile-worker.d.ts.map +1 -0
- package/dist/integrations/github/reconcile-worker.js +189 -0
- package/dist/integrations/github/reconcile-worker.js.map +1 -0
- package/dist/integrations/github/reconciliation-config.d.ts +3 -0
- package/dist/integrations/github/reconciliation-config.d.ts.map +1 -0
- package/dist/integrations/github/reconciliation-config.js +19 -0
- package/dist/integrations/github/reconciliation-config.js.map +1 -0
- package/dist/integrations/github/routes.d.ts +90 -0
- package/dist/integrations/github/routes.d.ts.map +1 -0
- package/dist/integrations/github/routes.js +1362 -0
- package/dist/integrations/github/routes.js.map +1 -0
- package/dist/integrations/github/rules.d.ts +173 -0
- package/dist/integrations/github/rules.d.ts.map +1 -0
- package/dist/integrations/github/rules.js +1021 -0
- package/dist/integrations/github/rules.js.map +1 -0
- package/dist/integrations/github/sandbox-release.d.ts +25 -0
- package/dist/integrations/github/sandbox-release.d.ts.map +1 -0
- package/dist/integrations/github/sandbox-release.js +38 -0
- package/dist/integrations/github/sandbox-release.js.map +1 -0
- package/dist/integrations/github/sandbox.d.ts +234 -0
- package/dist/integrations/github/sandbox.d.ts.map +1 -0
- package/dist/integrations/github/sandbox.js +947 -0
- package/dist/integrations/github/sandbox.js.map +1 -0
- package/dist/integrations/github/session-subscriptions.d.ts +28 -0
- package/dist/integrations/github/session-subscriptions.d.ts.map +1 -0
- package/dist/integrations/github/session-subscriptions.js +283 -0
- package/dist/integrations/github/session-subscriptions.js.map +1 -0
- package/dist/integrations/github/settle-or-abort.d.ts +7 -0
- package/dist/integrations/github/settle-or-abort.d.ts.map +1 -0
- package/dist/integrations/github/settle-or-abort.js +25 -0
- package/dist/integrations/github/settle-or-abort.js.map +1 -0
- package/dist/integrations/github/stale-reviews.d.ts +22 -0
- package/dist/integrations/github/stale-reviews.d.ts.map +1 -0
- package/dist/integrations/github/stale-reviews.js +70 -0
- package/dist/integrations/github/stale-reviews.js.map +1 -0
- package/dist/integrations/github/subscriptions.d.ts +54 -0
- package/dist/integrations/github/subscriptions.d.ts.map +1 -0
- package/dist/integrations/github/subscriptions.js +64 -0
- package/dist/integrations/github/subscriptions.js.map +1 -0
- package/dist/integrations/github/token-refresh.d.ts +31 -0
- package/dist/integrations/github/token-refresh.d.ts.map +1 -0
- package/dist/integrations/github/token-refresh.js +42 -0
- package/dist/integrations/github/token-refresh.js.map +1 -0
- package/dist/integrations/github/webhook.d.ts +139 -0
- package/dist/integrations/github/webhook.d.ts.map +1 -0
- package/dist/integrations/github/webhook.js +432 -0
- package/dist/integrations/github/webhook.js.map +1 -0
- package/dist/integrations/gitlab/agent-tools.d.ts +14 -0
- package/dist/integrations/gitlab/agent-tools.d.ts.map +1 -0
- package/dist/integrations/gitlab/agent-tools.js +42 -0
- package/dist/integrations/gitlab/agent-tools.js.map +1 -0
- package/dist/integrations/gitlab/api.d.ts +222 -0
- package/dist/integrations/gitlab/api.d.ts.map +1 -0
- package/dist/integrations/gitlab/api.js +274 -0
- package/dist/integrations/gitlab/api.js.map +1 -0
- package/dist/integrations/gitlab/default-rules.d.ts +125 -0
- package/dist/integrations/gitlab/default-rules.d.ts.map +1 -0
- package/dist/integrations/gitlab/default-rules.js +180 -0
- package/dist/integrations/gitlab/default-rules.js.map +1 -0
- package/dist/integrations/gitlab/integration.d.ts +138 -0
- package/dist/integrations/gitlab/integration.d.ts.map +1 -0
- package/dist/integrations/gitlab/integration.js +705 -0
- package/dist/integrations/gitlab/integration.js.map +1 -0
- package/dist/integrations/gitlab/issue-reconciler.d.ts +6 -0
- package/dist/integrations/gitlab/issue-reconciler.d.ts.map +1 -0
- package/dist/integrations/gitlab/issue-reconciler.js +123 -0
- package/dist/integrations/gitlab/issue-reconciler.js.map +1 -0
- package/dist/integrations/gitlab/merge-request-reconciler.d.ts +6 -0
- package/dist/integrations/gitlab/merge-request-reconciler.d.ts.map +1 -0
- package/dist/integrations/gitlab/merge-request-reconciler.js +267 -0
- package/dist/integrations/gitlab/merge-request-reconciler.js.map +1 -0
- package/dist/integrations/gitlab/reconciler.d.ts +5 -0
- package/dist/integrations/gitlab/reconciler.d.ts.map +1 -0
- package/dist/integrations/gitlab/reconciler.js +31 -0
- package/dist/integrations/gitlab/reconciler.js.map +1 -0
- package/dist/integrations/gitlab/reconciliation-config.d.ts +3 -0
- package/dist/integrations/gitlab/reconciliation-config.d.ts.map +1 -0
- package/dist/integrations/gitlab/reconciliation-config.js +17 -0
- package/dist/integrations/gitlab/reconciliation-config.js.map +1 -0
- package/dist/integrations/gitlab/routes.d.ts +20 -0
- package/dist/integrations/gitlab/routes.d.ts.map +1 -0
- package/dist/integrations/gitlab/routes.js +474 -0
- package/dist/integrations/gitlab/routes.js.map +1 -0
- package/dist/integrations/gitlab/rules.d.ts +35 -0
- package/dist/integrations/gitlab/rules.d.ts.map +1 -0
- package/dist/integrations/gitlab/rules.js +502 -0
- package/dist/integrations/gitlab/rules.js.map +1 -0
- package/dist/integrations/gitlab/session-subscriptions.d.ts +32 -0
- package/dist/integrations/gitlab/session-subscriptions.d.ts.map +1 -0
- package/dist/integrations/gitlab/session-subscriptions.js +193 -0
- package/dist/integrations/gitlab/session-subscriptions.js.map +1 -0
- package/dist/integrations/gitlab/subscriptions.d.ts +70 -0
- package/dist/integrations/gitlab/subscriptions.d.ts.map +1 -0
- package/dist/integrations/gitlab/subscriptions.js +76 -0
- package/dist/integrations/gitlab/subscriptions.js.map +1 -0
- package/dist/integrations/gitlab/version-control.d.ts +16 -0
- package/dist/integrations/gitlab/version-control.d.ts.map +1 -0
- package/dist/integrations/gitlab/version-control.js +621 -0
- package/dist/integrations/gitlab/version-control.js.map +1 -0
- package/dist/integrations/gitlab/webhook-dispatch.d.ts +75 -0
- package/dist/integrations/gitlab/webhook-dispatch.d.ts.map +1 -0
- package/dist/integrations/gitlab/webhook-dispatch.js +235 -0
- package/dist/integrations/gitlab/webhook-dispatch.js.map +1 -0
- package/dist/integrations/gitlab/webhook.d.ts +72 -0
- package/dist/integrations/gitlab/webhook.d.ts.map +1 -0
- package/dist/integrations/gitlab/webhook.js +201 -0
- package/dist/integrations/gitlab/webhook.js.map +1 -0
- package/dist/integrations/incidentio/agent-tools.d.ts +49 -0
- package/dist/integrations/incidentio/agent-tools.d.ts.map +1 -0
- package/dist/integrations/incidentio/agent-tools.js +90 -0
- package/dist/integrations/incidentio/agent-tools.js.map +1 -0
- package/dist/integrations/incidentio/api.d.ts +400 -0
- package/dist/integrations/incidentio/api.d.ts.map +1 -0
- package/dist/integrations/incidentio/api.js +192 -0
- package/dist/integrations/incidentio/api.js.map +1 -0
- package/dist/integrations/incidentio/claim.d.ts +8 -0
- package/dist/integrations/incidentio/claim.d.ts.map +1 -0
- package/dist/integrations/incidentio/claim.js +14 -0
- package/dist/integrations/incidentio/claim.js.map +1 -0
- package/dist/integrations/incidentio/default-rules.d.ts +46 -0
- package/dist/integrations/incidentio/default-rules.d.ts.map +1 -0
- package/dist/integrations/incidentio/default-rules.js +68 -0
- package/dist/integrations/incidentio/default-rules.js.map +1 -0
- package/dist/integrations/incidentio/intake.d.ts +10 -0
- package/dist/integrations/incidentio/intake.d.ts.map +1 -0
- package/dist/integrations/incidentio/intake.js +307 -0
- package/dist/integrations/incidentio/intake.js.map +1 -0
- package/dist/integrations/incidentio/integration.d.ts +63 -0
- package/dist/integrations/incidentio/integration.d.ts.map +1 -0
- package/dist/integrations/incidentio/integration.js +141 -0
- package/dist/integrations/incidentio/integration.js.map +1 -0
- package/dist/integrations/incidentio/issue-reconciler.d.ts +10 -0
- package/dist/integrations/incidentio/issue-reconciler.d.ts.map +1 -0
- package/dist/integrations/incidentio/issue-reconciler.js +75 -0
- package/dist/integrations/incidentio/issue-reconciler.js.map +1 -0
- package/dist/integrations/incidentio/reconciliation-config.d.ts +3 -0
- package/dist/integrations/incidentio/reconciliation-config.d.ts.map +1 -0
- package/dist/integrations/incidentio/reconciliation-config.js +17 -0
- package/dist/integrations/incidentio/reconciliation-config.js.map +1 -0
- package/dist/integrations/incidentio/routes.d.ts +76 -0
- package/dist/integrations/incidentio/routes.d.ts.map +1 -0
- package/dist/integrations/incidentio/routes.js +249 -0
- package/dist/integrations/incidentio/routes.js.map +1 -0
- package/dist/integrations/incidentio/rules.d.ts +55 -0
- package/dist/integrations/incidentio/rules.d.ts.map +1 -0
- package/dist/integrations/incidentio/rules.js +189 -0
- package/dist/integrations/incidentio/rules.js.map +1 -0
- package/dist/integrations/issue-reconcile-worker.d.ts +19 -0
- package/dist/integrations/issue-reconcile-worker.d.ts.map +1 -0
- package/dist/integrations/issue-reconcile-worker.js +97 -0
- package/dist/integrations/issue-reconcile-worker.js.map +1 -0
- package/dist/integrations/issue-reconciler.d.ts +51 -0
- package/dist/integrations/issue-reconciler.d.ts.map +1 -0
- package/dist/integrations/issue-reconciler.js +158 -0
- package/dist/integrations/issue-reconciler.js.map +1 -0
- package/dist/integrations/jira/adf.d.ts +26 -0
- package/dist/integrations/jira/adf.d.ts.map +1 -0
- package/dist/integrations/jira/adf.js +73 -0
- package/dist/integrations/jira/adf.js.map +1 -0
- package/dist/integrations/jira/agent-tools.d.ts +45 -0
- package/dist/integrations/jira/agent-tools.d.ts.map +1 -0
- package/dist/integrations/jira/agent-tools.js +87 -0
- package/dist/integrations/jira/agent-tools.js.map +1 -0
- package/dist/integrations/jira/api.d.ts +157 -0
- package/dist/integrations/jira/api.d.ts.map +1 -0
- package/dist/integrations/jira/api.js +141 -0
- package/dist/integrations/jira/api.js.map +1 -0
- package/dist/integrations/jira/claim.d.ts +9 -0
- package/dist/integrations/jira/claim.d.ts.map +1 -0
- package/dist/integrations/jira/claim.js +15 -0
- package/dist/integrations/jira/claim.js.map +1 -0
- package/dist/integrations/jira/default-rules.d.ts +47 -0
- package/dist/integrations/jira/default-rules.d.ts.map +1 -0
- package/dist/integrations/jira/default-rules.js +69 -0
- package/dist/integrations/jira/default-rules.js.map +1 -0
- package/dist/integrations/jira/integration.d.ts +114 -0
- package/dist/integrations/jira/integration.d.ts.map +1 -0
- package/dist/integrations/jira/integration.js +407 -0
- package/dist/integrations/jira/integration.js.map +1 -0
- package/dist/integrations/jira/issue-reconciler.d.ts +10 -0
- package/dist/integrations/jira/issue-reconciler.d.ts.map +1 -0
- package/dist/integrations/jira/issue-reconciler.js +70 -0
- package/dist/integrations/jira/issue-reconciler.js.map +1 -0
- package/dist/integrations/jira/reconciliation-config.d.ts +3 -0
- package/dist/integrations/jira/reconciliation-config.d.ts.map +1 -0
- package/dist/integrations/jira/reconciliation-config.js +17 -0
- package/dist/integrations/jira/reconciliation-config.js.map +1 -0
- package/dist/integrations/jira/routes.d.ts +54 -0
- package/dist/integrations/jira/routes.d.ts.map +1 -0
- package/dist/integrations/jira/routes.js +260 -0
- package/dist/integrations/jira/routes.js.map +1 -0
- package/dist/integrations/jira/rules.d.ts +57 -0
- package/dist/integrations/jira/rules.d.ts.map +1 -0
- package/dist/integrations/jira/rules.js +189 -0
- package/dist/integrations/jira/rules.js.map +1 -0
- package/dist/integrations/linear/agent-tools.d.ts +34 -0
- package/dist/integrations/linear/agent-tools.d.ts.map +1 -0
- package/dist/integrations/linear/agent-tools.js +87 -0
- package/dist/integrations/linear/agent-tools.js.map +1 -0
- package/dist/integrations/linear/claim.d.ts +8 -0
- package/dist/integrations/linear/claim.d.ts.map +1 -0
- package/dist/integrations/linear/claim.js +14 -0
- package/dist/integrations/linear/claim.js.map +1 -0
- package/dist/integrations/linear/default-rules.d.ts +46 -0
- package/dist/integrations/linear/default-rules.d.ts.map +1 -0
- package/dist/integrations/linear/default-rules.js +70 -0
- package/dist/integrations/linear/default-rules.js.map +1 -0
- package/dist/integrations/linear/integration.d.ts +260 -0
- package/dist/integrations/linear/integration.d.ts.map +1 -0
- package/dist/integrations/linear/integration.js +900 -0
- package/dist/integrations/linear/integration.js.map +1 -0
- package/dist/integrations/linear/issue-reconciler.d.ts +8 -0
- package/dist/integrations/linear/issue-reconciler.d.ts.map +1 -0
- package/dist/integrations/linear/issue-reconciler.js +73 -0
- package/dist/integrations/linear/issue-reconciler.js.map +1 -0
- package/dist/integrations/linear/reconciliation-config.d.ts +3 -0
- package/dist/integrations/linear/reconciliation-config.d.ts.map +1 -0
- package/dist/integrations/linear/reconciliation-config.js +21 -0
- package/dist/integrations/linear/reconciliation-config.js.map +1 -0
- package/dist/integrations/linear/routes.d.ts +81 -0
- package/dist/integrations/linear/routes.d.ts.map +1 -0
- package/dist/integrations/linear/routes.js +380 -0
- package/dist/integrations/linear/routes.js.map +1 -0
- package/dist/integrations/linear/rules.d.ts +54 -0
- package/dist/integrations/linear/rules.d.ts.map +1 -0
- package/dist/integrations/linear/rules.js +189 -0
- package/dist/integrations/linear/rules.js.map +1 -0
- package/dist/integrations/linear/storage.d.ts +65 -0
- package/dist/integrations/linear/storage.d.ts.map +1 -0
- package/dist/integrations/linear/storage.js +1 -0
- package/dist/integrations/platform/api-client.d.ts +26 -0
- package/dist/integrations/platform/api-client.d.ts.map +1 -0
- package/dist/integrations/platform/api-client.js +177 -0
- package/dist/integrations/platform/api-client.js.map +1 -0
- package/dist/integrations/platform/connect/routes.d.ts +39 -0
- package/dist/integrations/platform/connect/routes.d.ts.map +1 -0
- package/dist/integrations/platform/connect/routes.js +133 -0
- package/dist/integrations/platform/connect/routes.js.map +1 -0
- package/dist/integrations/platform/github/event-worker.d.ts +58 -0
- package/dist/integrations/platform/github/event-worker.d.ts.map +1 -0
- package/dist/integrations/platform/github/event-worker.js +449 -0
- package/dist/integrations/platform/github/event-worker.js.map +1 -0
- package/dist/integrations/platform/github/integration.d.ts +89 -0
- package/dist/integrations/platform/github/integration.d.ts.map +1 -0
- package/dist/integrations/platform/github/integration.js +1266 -0
- package/dist/integrations/platform/github/integration.js.map +1 -0
- package/dist/integrations/platform/gitlab/event-worker.d.ts +64 -0
- package/dist/integrations/platform/gitlab/event-worker.d.ts.map +1 -0
- package/dist/integrations/platform/gitlab/event-worker.js +305 -0
- package/dist/integrations/platform/gitlab/event-worker.js.map +1 -0
- package/dist/integrations/platform/gitlab/integration.d.ts +57 -0
- package/dist/integrations/platform/gitlab/integration.d.ts.map +1 -0
- package/dist/integrations/platform/gitlab/integration.js +113 -0
- package/dist/integrations/platform/gitlab/integration.js.map +1 -0
- package/dist/integrations/platform/incidentio/integration.d.ts +74 -0
- package/dist/integrations/platform/incidentio/integration.d.ts.map +1 -0
- package/dist/integrations/platform/incidentio/integration.js +406 -0
- package/dist/integrations/platform/incidentio/integration.js.map +1 -0
- package/dist/integrations/platform/jira/agent-tools.d.ts +36 -0
- package/dist/integrations/platform/jira/agent-tools.d.ts.map +1 -0
- package/dist/integrations/platform/jira/agent-tools.js +85 -0
- package/dist/integrations/platform/jira/agent-tools.js.map +1 -0
- package/dist/integrations/platform/jira/integration.d.ts +65 -0
- package/dist/integrations/platform/jira/integration.d.ts.map +1 -0
- package/dist/integrations/platform/jira/integration.js +546 -0
- package/dist/integrations/platform/jira/integration.js.map +1 -0
- package/dist/integrations/platform/jira/routes.d.ts +55 -0
- package/dist/integrations/platform/jira/routes.d.ts.map +1 -0
- package/dist/integrations/platform/jira/routes.js +274 -0
- package/dist/integrations/platform/jira/routes.js.map +1 -0
- package/dist/integrations/platform/linear/event-worker.d.ts +105 -0
- package/dist/integrations/platform/linear/event-worker.d.ts.map +1 -0
- package/dist/integrations/platform/linear/event-worker.js +379 -0
- package/dist/integrations/platform/linear/event-worker.js.map +1 -0
- package/dist/integrations/platform/linear/integration.d.ts +92 -0
- package/dist/integrations/platform/linear/integration.d.ts.map +1 -0
- package/dist/integrations/platform/linear/integration.js +754 -0
- package/dist/integrations/platform/linear/integration.js.map +1 -0
- package/dist/integrations/pull-request-head.d.ts +18 -0
- package/dist/integrations/pull-request-head.d.ts.map +1 -0
- package/dist/integrations/pull-request-head.js +45 -0
- package/dist/integrations/pull-request-head.js.map +1 -0
- package/dist/integrations/reconciliation-config.d.ts +3 -0
- package/dist/integrations/reconciliation-config.d.ts.map +1 -0
- package/dist/integrations/reconciliation-config.js +16 -0
- package/dist/integrations/reconciliation-config.js.map +1 -0
- package/dist/integrations/slack/connect-route.d.ts +46 -0
- package/dist/integrations/slack/connect-route.d.ts.map +1 -0
- package/dist/integrations/slack/connect-route.js +186 -0
- package/dist/integrations/slack/connect-route.js.map +1 -0
- package/dist/integrations/slack/emoji-shortcodes.generated.d.ts +8 -0
- package/dist/integrations/slack/emoji-shortcodes.generated.d.ts.map +1 -0
- package/dist/integrations/slack/emoji-shortcodes.generated.js +1985 -0
- package/dist/integrations/slack/emoji-shortcodes.generated.js.map +1 -0
- package/dist/integrations/slack/emoji.d.ts +3 -0
- package/dist/integrations/slack/emoji.d.ts.map +1 -0
- package/dist/integrations/slack/emoji.js +12 -0
- package/dist/integrations/slack/emoji.js.map +1 -0
- package/dist/integrations/slack/feed-publisher.d.ts +26 -0
- package/dist/integrations/slack/feed-publisher.d.ts.map +1 -0
- package/dist/integrations/slack/feed-publisher.js +44 -0
- package/dist/integrations/slack/feed-publisher.js.map +1 -0
- package/dist/integrations/slack/integration.d.ts +80 -0
- package/dist/integrations/slack/integration.d.ts.map +1 -0
- package/dist/integrations/slack/integration.js +93 -0
- package/dist/integrations/slack/integration.js.map +1 -0
- package/dist/integrations/slack/slack.d.ts +205 -0
- package/dist/integrations/slack/slack.d.ts.map +1 -0
- package/dist/integrations/slack/slack.js +653 -0
- package/dist/integrations/slack/slack.js.map +1 -0
- package/dist/integrations/subscription-session.d.ts +49 -0
- package/dist/integrations/subscription-session.d.ts.map +1 -0
- package/dist/integrations/subscription-session.js +103 -0
- package/dist/integrations/subscription-session.js.map +1 -0
- package/dist/integrations/workos/integration.d.ts +39 -0
- package/dist/integrations/workos/integration.d.ts.map +1 -0
- package/dist/integrations/workos/integration.js +91 -0
- package/dist/integrations/workos/integration.js.map +1 -0
- package/dist/packages/_internals/workspace/dist/index.js +48 -0
- package/dist/packages/_internals/workspace/dist/index.js.map +1 -0
- package/dist/platform-auth-host.d.ts +4 -0
- package/dist/platform-auth-host.d.ts.map +1 -0
- package/dist/platform-auth-host.js +18 -0
- package/dist/platform-auth-host.js.map +1 -0
- package/dist/review-verdict.d.ts +6 -0
- package/dist/review-verdict.d.ts.map +1 -0
- package/dist/review-verdict.js +14 -0
- package/dist/review-verdict.js.map +1 -0
- package/dist/routes/attention-activity.d.ts +23 -0
- package/dist/routes/attention-activity.d.ts.map +1 -0
- package/dist/routes/attention-activity.js +152 -0
- package/dist/routes/attention-activity.js.map +1 -0
- package/dist/routes/attention-parked.d.ts +22 -0
- package/dist/routes/attention-parked.d.ts.map +1 -0
- package/dist/routes/attention-parked.js +136 -0
- package/dist/routes/attention-parked.js.map +1 -0
- package/dist/routes/attention-proposed.d.ts +3 -0
- package/dist/routes/attention-proposed.d.ts.map +1 -0
- package/dist/routes/attention-proposed.js +21 -0
- package/dist/routes/attention-proposed.js.map +1 -0
- package/dist/routes/attention-providers.d.ts +159 -0
- package/dist/routes/attention-providers.d.ts.map +1 -0
- package/dist/routes/attention-providers.js +524 -0
- package/dist/routes/attention-providers.js.map +1 -0
- package/dist/routes/attention.d.ts +23 -0
- package/dist/routes/attention.d.ts.map +1 -0
- package/dist/routes/attention.js +219 -0
- package/dist/routes/attention.js.map +1 -0
- package/dist/routes/automation-runs.d.ts +37 -0
- package/dist/routes/automation-runs.d.ts.map +1 -0
- package/dist/routes/automation-runs.js +196 -0
- package/dist/routes/automation-runs.js.map +1 -0
- package/dist/routes/config.d.ts +238 -0
- package/dist/routes/config.d.ts.map +1 -0
- package/dist/routes/config.js +1011 -0
- package/dist/routes/config.js.map +1 -0
- package/dist/routes/contracts.d.ts +1080 -0
- package/dist/routes/contracts.d.ts.map +1 -0
- package/dist/routes/contracts.js +673 -0
- package/dist/routes/contracts.js.map +1 -0
- package/dist/routes/custom-provider-source.d.ts +52 -0
- package/dist/routes/custom-provider-source.d.ts.map +1 -0
- package/dist/routes/custom-provider-source.js +124 -0
- package/dist/routes/custom-provider-source.js.map +1 -0
- package/dist/routes/fs.d.ts +189 -0
- package/dist/routes/fs.d.ts.map +1 -0
- package/dist/routes/fs.js +916 -0
- package/dist/routes/fs.js.map +1 -0
- package/dist/routes/intake.d.ts +64 -0
- package/dist/routes/intake.d.ts.map +1 -0
- package/dist/routes/intake.js +627 -0
- package/dist/routes/intake.js.map +1 -0
- package/dist/routes/knowledge.d.ts +247 -0
- package/dist/routes/knowledge.d.ts.map +1 -0
- package/dist/routes/knowledge.js +1128 -0
- package/dist/routes/knowledge.js.map +1 -0
- package/dist/routes/oauth.d.ts +43 -0
- package/dist/routes/oauth.d.ts.map +1 -0
- package/dist/routes/oauth.js +477 -0
- package/dist/routes/oauth.js.map +1 -0
- package/dist/routes/projects.d.ts +68 -0
- package/dist/routes/projects.d.ts.map +1 -0
- package/dist/routes/projects.js +919 -0
- package/dist/routes/projects.js.map +1 -0
- package/dist/routes/provider-credentials.d.ts +82 -0
- package/dist/routes/provider-credentials.d.ts.map +1 -0
- package/dist/routes/provider-credentials.js +80 -0
- package/dist/routes/provider-credentials.js.map +1 -0
- package/dist/routes/route.d.ts +48 -0
- package/dist/routes/route.d.ts.map +1 -0
- package/dist/routes/route.js +15 -0
- package/dist/routes/route.js.map +1 -0
- package/dist/routes/skills.d.ts +30 -0
- package/dist/routes/skills.d.ts.map +1 -0
- package/dist/routes/skills.js +198 -0
- package/dist/routes/skills.js.map +1 -0
- package/dist/routes/source-control-sessions.d.ts +22 -0
- package/dist/routes/source-control-sessions.d.ts.map +1 -0
- package/dist/routes/source-control-sessions.js +356 -0
- package/dist/routes/source-control-sessions.js.map +1 -0
- package/dist/routes/source-control-settings.d.ts +10 -0
- package/dist/routes/source-control-settings.d.ts.map +1 -0
- package/dist/routes/source-control-settings.js +87 -0
- package/dist/routes/source-control-settings.js.map +1 -0
- package/dist/routes/supervisor.d.ts +25 -0
- package/dist/routes/supervisor.d.ts.map +1 -0
- package/dist/routes/supervisor.js +35 -0
- package/dist/routes/supervisor.js.map +1 -0
- package/dist/routes/surface.d.ts +133 -0
- package/dist/routes/surface.d.ts.map +1 -0
- package/dist/routes/surface.js +518 -0
- package/dist/routes/surface.js.map +1 -0
- package/dist/routes/telemetry.d.ts +13 -0
- package/dist/routes/telemetry.d.ts.map +1 -0
- package/dist/routes/telemetry.js +60 -0
- package/dist/routes/telemetry.js.map +1 -0
- package/dist/routes/tenant-credentials.d.ts +87 -0
- package/dist/routes/tenant-credentials.d.ts.map +1 -0
- package/dist/routes/tenant-credentials.js +219 -0
- package/dist/routes/tenant-credentials.js.map +1 -0
- package/dist/routes/work-items.d.ts +49 -0
- package/dist/routes/work-items.d.ts.map +1 -0
- package/dist/routes/work-items.js +633 -0
- package/dist/routes/work-items.js.map +1 -0
- package/dist/rules/binding-context.d.ts +59 -0
- package/dist/rules/binding-context.d.ts.map +1 -0
- package/dist/rules/binding-context.js +134 -0
- package/dist/rules/binding-context.js.map +1 -0
- package/dist/rules/decision-applicability.d.ts +32 -0
- package/dist/rules/decision-applicability.d.ts.map +1 -0
- package/dist/rules/decision-applicability.js +56 -0
- package/dist/rules/decision-applicability.js.map +1 -0
- package/dist/rules/dispatch-errors.d.ts +13 -0
- package/dist/rules/dispatch-errors.d.ts.map +1 -0
- package/dist/rules/dispatch-errors.js +105 -0
- package/dist/rules/dispatch-errors.js.map +1 -0
- package/dist/rules/dispatcher.d.ts +86 -0
- package/dist/rules/dispatcher.d.ts.map +1 -0
- package/dist/rules/dispatcher.js +1159 -0
- package/dist/rules/dispatcher.js.map +1 -0
- package/dist/rules/event-rules.d.ts +23 -0
- package/dist/rules/event-rules.d.ts.map +1 -0
- package/dist/rules/event-rules.js +46 -0
- package/dist/rules/event-rules.js.map +1 -0
- package/dist/rules/index.d.ts +6 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +4 -0
- package/dist/rules/processor.d.ts +90 -0
- package/dist/rules/processor.d.ts.map +1 -0
- package/dist/rules/processor.js +486 -0
- package/dist/rules/processor.js.map +1 -0
- package/dist/rules/resolve.d.ts +15 -0
- package/dist/rules/resolve.d.ts.map +1 -0
- package/dist/rules/resolve.js +23 -0
- package/dist/rules/resolve.js.map +1 -0
- package/dist/rules/review-source-tool.d.ts +105 -0
- package/dist/rules/review-source-tool.d.ts.map +1 -0
- package/dist/rules/review-source-tool.js +109 -0
- package/dist/rules/review-source-tool.js.map +1 -0
- package/dist/rules/start-coordinator.d.ts +64 -0
- package/dist/rules/start-coordinator.d.ts.map +1 -0
- package/dist/rules/start-coordinator.js +246 -0
- package/dist/rules/start-coordinator.js.map +1 -0
- package/dist/rules/terminal-cleanup.d.ts +38 -0
- package/dist/rules/terminal-cleanup.d.ts.map +1 -0
- package/dist/rules/terminal-cleanup.js +68 -0
- package/dist/rules/terminal-cleanup.js.map +1 -0
- package/dist/rules/tools.d.ts +15 -0
- package/dist/rules/tools.d.ts.map +1 -0
- package/dist/rules/tools.js +185 -0
- package/dist/rules/tools.js.map +1 -0
- package/dist/rules/transition-service.d.ts +93 -0
- package/dist/rules/transition-service.d.ts.map +1 -0
- package/dist/rules/transition-service.js +402 -0
- package/dist/rules/transition-service.js.map +1 -0
- package/dist/rules/types.d.ts +553 -0
- package/dist/rules/types.d.ts.map +1 -0
- package/dist/rules/types.js +154 -0
- package/dist/rules/types.js.map +1 -0
- package/dist/rules/validation.d.ts +21 -0
- package/dist/rules/validation.d.ts.map +1 -0
- package/dist/rules/validation.js +327 -0
- package/dist/rules/validation.js.map +1 -0
- package/dist/sandbox/callback-factory-sandbox.d.ts +15 -0
- package/dist/sandbox/callback-factory-sandbox.d.ts.map +1 -0
- package/dist/sandbox/callback-factory-sandbox.js +22 -0
- package/dist/sandbox/callback-factory-sandbox.js.map +1 -0
- package/dist/sandbox/git-ref.d.ts +7 -0
- package/dist/sandbox/git-ref.d.ts.map +1 -0
- package/dist/sandbox/git-ref.js +15 -0
- package/dist/sandbox/git-ref.js.map +1 -0
- package/dist/sandbox/local-factory-sandbox.d.ts +20 -0
- package/dist/sandbox/local-factory-sandbox.d.ts.map +1 -0
- package/dist/sandbox/local-factory-sandbox.js +27 -0
- package/dist/sandbox/local-factory-sandbox.js.map +1 -0
- package/dist/sandbox/materialization.d.ts +41 -0
- package/dist/sandbox/materialization.d.ts.map +1 -0
- package/dist/sandbox/materialization.js +18 -0
- package/dist/sandbox/materialization.js.map +1 -0
- package/dist/sandbox/session-retirement.d.ts +45 -0
- package/dist/sandbox/session-retirement.d.ts.map +1 -0
- package/dist/sandbox/session-retirement.js +153 -0
- package/dist/sandbox/session-retirement.js.map +1 -0
- package/dist/sandbox/session-sandbox.d.ts +185 -0
- package/dist/sandbox/session-sandbox.d.ts.map +1 -0
- package/dist/sandbox/session-sandbox.js +248 -0
- package/dist/sandbox/session-sandbox.js.map +1 -0
- package/dist/sandbox/workdir.d.ts +45 -0
- package/dist/sandbox/workdir.d.ts.map +1 -0
- package/dist/sandbox/workdir.js +64 -0
- package/dist/sandbox/workdir.js.map +1 -0
- package/dist/secret-encryption.d.ts +25 -0
- package/dist/secret-encryption.d.ts.map +1 -0
- package/dist/secret-encryption.js +107 -0
- package/dist/secret-encryption.js.map +1 -0
- package/dist/server-error.d.ts +12 -0
- package/dist/server-error.d.ts.map +1 -0
- package/dist/server-error.js +16 -0
- package/dist/server-error.js.map +1 -0
- package/dist/session/credential-policy.d.ts +20 -0
- package/dist/session/credential-policy.d.ts.map +1 -0
- package/dist/session/credential-policy.js +70 -0
- package/dist/session/credential-policy.js.map +1 -0
- package/dist/session/default-model-hydration.d.ts +46 -0
- package/dist/session/default-model-hydration.d.ts.map +1 -0
- package/dist/session/default-model-hydration.js +85 -0
- package/dist/session/default-model-hydration.js.map +1 -0
- package/dist/session/environment-repositories.d.ts +31 -0
- package/dist/session/environment-repositories.d.ts.map +1 -0
- package/dist/session/environment-repositories.js +89 -0
- package/dist/session/environment-repositories.js.map +1 -0
- package/dist/session/environment-state-processor.d.ts +59 -0
- package/dist/session/environment-state-processor.d.ts.map +1 -0
- package/dist/session/environment-state-processor.js +105 -0
- package/dist/session/environment-state-processor.js.map +1 -0
- package/dist/session/factory-session.d.ts +159 -0
- package/dist/session/factory-session.d.ts.map +1 -0
- package/dist/session/factory-session.js +226 -0
- package/dist/session/factory-session.js.map +1 -0
- package/dist/session/filesystem-capture.d.ts +50 -0
- package/dist/session/filesystem-capture.d.ts.map +1 -0
- package/dist/session/filesystem-capture.js +231 -0
- package/dist/session/filesystem-capture.js.map +1 -0
- package/dist/session/first-exec-capture.d.ts +38 -0
- package/dist/session/first-exec-capture.d.ts.map +1 -0
- package/dist/session/first-exec-capture.js +91 -0
- package/dist/session/first-exec-capture.js.map +1 -0
- package/dist/session/first-message-capture.d.ts +33 -0
- package/dist/session/first-message-capture.d.ts.map +1 -0
- package/dist/session/first-message-capture.js +35 -0
- package/dist/session/first-message-capture.js.map +1 -0
- package/dist/session/live-sessions.d.ts +63 -0
- package/dist/session/live-sessions.d.ts.map +1 -0
- package/dist/session/live-sessions.js +90 -0
- package/dist/session/live-sessions.js.map +1 -0
- package/dist/session/memory-settings-hydration.d.ts +36 -0
- package/dist/session/memory-settings-hydration.d.ts.map +1 -0
- package/dist/session/memory-settings-hydration.js +43 -0
- package/dist/session/memory-settings-hydration.js.map +1 -0
- package/dist/session/org-seed.d.ts +67 -0
- package/dist/session/org-seed.d.ts.map +1 -0
- package/dist/session/org-seed.js +53 -0
- package/dist/session/org-seed.js.map +1 -0
- package/dist/session/run-audit.d.ts +54 -0
- package/dist/session/run-audit.d.ts.map +1 -0
- package/dist/session/run-audit.js +124 -0
- package/dist/session/run-audit.js.map +1 -0
- package/dist/session/session-title.d.ts +7 -0
- package/dist/session/session-title.d.ts.map +1 -0
- package/dist/session/session-title.js +14 -0
- package/dist/session/session-title.js.map +1 -0
- package/dist/session/shell-commands.d.ts +5 -0
- package/dist/session/shell-commands.d.ts.map +1 -0
- package/dist/session/shell-commands.js +25 -0
- package/dist/session/shell-commands.js.map +1 -0
- package/dist/session/source-control-tools.d.ts +25 -0
- package/dist/session/source-control-tools.d.ts.map +1 -0
- package/dist/session/source-control-tools.js +594 -0
- package/dist/session/source-control-tools.js.map +1 -0
- package/dist/session/thread-title-mirror.d.ts +35 -0
- package/dist/session/thread-title-mirror.d.ts.map +1 -0
- package/dist/session/thread-title-mirror.js +51 -0
- package/dist/session/thread-title-mirror.js.map +1 -0
- package/dist/session/work-item-repository.d.ts +21 -0
- package/dist/session/work-item-repository.d.ts.map +1 -0
- package/dist/session/work-item-repository.js +113 -0
- package/dist/session/work-item-repository.js.map +1 -0
- package/dist/skills/catalog.d.ts +14 -0
- package/dist/skills/catalog.d.ts.map +1 -0
- package/dist/skills/catalog.js +62 -0
- package/dist/skills/catalog.js.map +1 -0
- package/dist/skills/service.d.ts +70 -0
- package/dist/skills/service.d.ts.map +1 -0
- package/dist/skills/service.js +88 -0
- package/dist/skills/service.js.map +1 -0
- package/dist/spa-static.d.ts +33 -0
- package/dist/spa-static.d.ts.map +1 -0
- package/dist/spa-static.js +104 -0
- package/dist/spa-static.js.map +1 -0
- package/dist/state-signing.d.ts +59 -0
- package/dist/state-signing.d.ts.map +1 -0
- package/dist/state-signing.js +83 -0
- package/dist/state-signing.js.map +1 -0
- package/dist/storage/domains/audit/actions.d.ts +24 -0
- package/dist/storage/domains/audit/actions.d.ts.map +1 -0
- package/dist/storage/domains/audit/actions.js +69 -0
- package/dist/storage/domains/audit/actions.js.map +1 -0
- package/dist/storage/domains/audit/actors.d.ts +5 -0
- package/dist/storage/domains/audit/actors.d.ts.map +1 -0
- package/dist/storage/domains/audit/actors.js +25 -0
- package/dist/storage/domains/audit/actors.js.map +1 -0
- package/dist/storage/domains/audit/agent-audit.d.ts +30 -0
- package/dist/storage/domains/audit/agent-audit.d.ts.map +1 -0
- package/dist/storage/domains/audit/agent-audit.js +93 -0
- package/dist/storage/domains/audit/agent-audit.js.map +1 -0
- package/dist/storage/domains/audit/base.d.ts +133 -0
- package/dist/storage/domains/audit/base.d.ts.map +1 -0
- package/dist/storage/domains/audit/base.js +206 -0
- package/dist/storage/domains/audit/base.js.map +1 -0
- package/dist/storage/domains/audit/domain.d.ts +79 -0
- package/dist/storage/domains/audit/domain.d.ts.map +1 -0
- package/dist/storage/domains/audit/domain.js +248 -0
- package/dist/storage/domains/audit/domain.js.map +1 -0
- package/dist/storage/domains/audit/wire.d.ts +24 -0
- package/dist/storage/domains/audit/wire.d.ts.map +1 -0
- package/dist/storage/domains/audit/wire.js +16 -0
- package/dist/storage/domains/audit/wire.js.map +1 -0
- package/dist/storage/domains/channel-identity/base.d.ts +100 -0
- package/dist/storage/domains/channel-identity/base.d.ts.map +1 -0
- package/dist/storage/domains/channel-identity/base.js +164 -0
- package/dist/storage/domains/channel-identity/base.js.map +1 -0
- package/dist/storage/domains/comments/activity.d.ts +40 -0
- package/dist/storage/domains/comments/activity.d.ts.map +1 -0
- package/dist/storage/domains/comments/activity.js +94 -0
- package/dist/storage/domains/comments/activity.js.map +1 -0
- package/dist/storage/domains/comments/actor.d.ts +51 -0
- package/dist/storage/domains/comments/actor.d.ts.map +1 -0
- package/dist/storage/domains/comments/actor.js +38 -0
- package/dist/storage/domains/comments/actor.js.map +1 -0
- package/dist/storage/domains/comments/base.d.ts +245 -0
- package/dist/storage/domains/comments/base.d.ts.map +1 -0
- package/dist/storage/domains/comments/base.js +533 -0
- package/dist/storage/domains/comments/base.js.map +1 -0
- package/dist/storage/domains/comments/domain.d.ts +135 -0
- package/dist/storage/domains/comments/domain.d.ts.map +1 -0
- package/dist/storage/domains/comments/domain.js +285 -0
- package/dist/storage/domains/comments/domain.js.map +1 -0
- package/dist/storage/domains/comments/feed-context.d.ts +22 -0
- package/dist/storage/domains/comments/feed-context.d.ts.map +1 -0
- package/dist/storage/domains/comments/feed-context.js +89 -0
- package/dist/storage/domains/comments/feed-context.js.map +1 -0
- package/dist/storage/domains/comments/feed-sync.d.ts +21 -0
- package/dist/storage/domains/comments/feed-sync.d.ts.map +1 -0
- package/dist/storage/domains/comments/feed-sync.js +1 -0
- package/dist/storage/domains/comments/parse.d.ts +23 -0
- package/dist/storage/domains/comments/parse.d.ts.map +1 -0
- package/dist/storage/domains/comments/parse.js +90 -0
- package/dist/storage/domains/comments/parse.js.map +1 -0
- package/dist/storage/domains/comments/routes.d.ts +24 -0
- package/dist/storage/domains/comments/routes.d.ts.map +1 -0
- package/dist/storage/domains/comments/routes.js +302 -0
- package/dist/storage/domains/comments/routes.js.map +1 -0
- package/dist/storage/domains/comments/schema.d.ts +5 -0
- package/dist/storage/domains/comments/schema.d.ts.map +1 -0
- package/dist/storage/domains/comments/schema.js +179 -0
- package/dist/storage/domains/comments/schema.js.map +1 -0
- package/dist/storage/domains/comments/wire.d.ts +40 -0
- package/dist/storage/domains/comments/wire.d.ts.map +1 -0
- package/dist/storage/domains/comments/wire.js +37 -0
- package/dist/storage/domains/comments/wire.js.map +1 -0
- package/dist/storage/domains/credentials/base.d.ts +136 -0
- package/dist/storage/domains/credentials/base.d.ts.map +1 -0
- package/dist/storage/domains/credentials/base.js +294 -0
- package/dist/storage/domains/credentials/base.js.map +1 -0
- package/dist/storage/domains/custom-providers/base.d.ts +59 -0
- package/dist/storage/domains/custom-providers/base.d.ts.map +1 -0
- package/dist/storage/domains/custom-providers/base.js +176 -0
- package/dist/storage/domains/custom-providers/base.js.map +1 -0
- package/dist/storage/domains/filesystem/base.d.ts +26 -0
- package/dist/storage/domains/filesystem/base.d.ts.map +1 -0
- package/dist/storage/domains/filesystem/base.js +74 -0
- package/dist/storage/domains/filesystem/base.js.map +1 -0
- package/dist/storage/domains/intake/base.d.ts +150 -0
- package/dist/storage/domains/intake/base.d.ts.map +1 -0
- package/dist/storage/domains/intake/base.js +431 -0
- package/dist/storage/domains/intake/base.js.map +1 -0
- package/dist/storage/domains/integrations/base.d.ts +128 -0
- package/dist/storage/domains/integrations/base.d.ts.map +1 -0
- package/dist/storage/domains/integrations/base.js +333 -0
- package/dist/storage/domains/integrations/base.js.map +1 -0
- package/dist/storage/domains/memory-settings/base.d.ts +58 -0
- package/dist/storage/domains/memory-settings/base.d.ts.map +1 -0
- package/dist/storage/domains/memory-settings/base.js +129 -0
- package/dist/storage/domains/memory-settings/base.js.map +1 -0
- package/dist/storage/domains/model-defaults/base.d.ts +29 -0
- package/dist/storage/domains/model-defaults/base.d.ts.map +1 -0
- package/dist/storage/domains/model-defaults/base.js +79 -0
- package/dist/storage/domains/model-defaults/base.js.map +1 -0
- package/dist/storage/domains/projects/base.d.ts +191 -0
- package/dist/storage/domains/projects/base.d.ts.map +1 -0
- package/dist/storage/domains/projects/base.js +352 -0
- package/dist/storage/domains/projects/base.js.map +1 -0
- package/dist/storage/domains/queue-health/base.d.ts +52 -0
- package/dist/storage/domains/queue-health/base.d.ts.map +1 -0
- package/dist/storage/domains/queue-health/base.js +122 -0
- package/dist/storage/domains/queue-health/base.js.map +1 -0
- package/dist/storage/domains/source-control/base.d.ts +422 -0
- package/dist/storage/domains/source-control/base.d.ts.map +1 -0
- package/dist/storage/domains/source-control/base.js +1114 -0
- package/dist/storage/domains/source-control/base.js.map +1 -0
- package/dist/storage/domains/source-control/inmemory.d.ts +147 -0
- package/dist/storage/domains/source-control/inmemory.d.ts.map +1 -0
- package/dist/storage/domains/source-control/inmemory.js +416 -0
- package/dist/storage/domains/source-control/inmemory.js.map +1 -0
- package/dist/storage/domains/work-items/base.d.ts +794 -0
- package/dist/storage/domains/work-items/base.d.ts.map +1 -0
- package/dist/storage/domains/work-items/base.js +2747 -0
- package/dist/storage/domains/work-items/base.js.map +1 -0
- package/dist/storage/domains/work-items/board-version.d.ts +26 -0
- package/dist/storage/domains/work-items/board-version.d.ts.map +1 -0
- package/dist/storage/domains/work-items/board-version.js +110 -0
- package/dist/storage/domains/work-items/board-version.js.map +1 -0
- package/dist/storage/domains/work-items/metrics.d.ts +97 -0
- package/dist/storage/domains/work-items/metrics.d.ts.map +1 -0
- package/dist/storage/domains/work-items/metrics.js +226 -0
- package/dist/storage/domains/work-items/metrics.js.map +1 -0
- package/dist/supervisor/health-worker.d.ts +19 -0
- package/dist/supervisor/health-worker.d.ts.map +1 -0
- package/dist/supervisor/health-worker.js +74 -0
- package/dist/supervisor/health-worker.js.map +1 -0
- package/dist/supervisor/health.d.ts +79 -0
- package/dist/supervisor/health.d.ts.map +1 -0
- package/dist/supervisor/health.js +228 -0
- package/dist/supervisor/health.js.map +1 -0
- package/dist/supervisor/instructions.d.ts +6 -0
- package/dist/supervisor/instructions.d.ts.map +1 -0
- package/dist/supervisor/instructions.js +66 -0
- package/dist/supervisor/instructions.js.map +1 -0
- package/dist/supervisor/read-tools.d.ts +43 -0
- package/dist/supervisor/read-tools.d.ts.map +1 -0
- package/dist/supervisor/read-tools.js +343 -0
- package/dist/supervisor/read-tools.js.map +1 -0
- package/dist/supervisor/session-messaging.d.ts +26 -0
- package/dist/supervisor/session-messaging.d.ts.map +1 -0
- package/dist/supervisor/session-messaging.js +21 -0
- package/dist/supervisor/session-messaging.js.map +1 -0
- package/dist/supervisor/session.d.ts +38 -0
- package/dist/supervisor/session.d.ts.map +1 -0
- package/dist/supervisor/session.js +79 -0
- package/dist/supervisor/session.js.map +1 -0
- package/dist/supervisor/write-tools.d.ts +30 -0
- package/dist/supervisor/write-tools.d.ts.map +1 -0
- package/dist/supervisor/write-tools.js +231 -0
- package/dist/supervisor/write-tools.js.map +1 -0
- package/dist/telemetry-types.d.ts +7 -0
- package/dist/telemetry-types.d.ts.map +1 -0
- package/dist/telemetry-types.js +24 -0
- package/dist/telemetry-types.js.map +1 -0
- package/dist/telemetry.d.ts +9 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +47 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/timing.d.ts +15 -0
- package/dist/timing.d.ts.map +1 -0
- package/dist/timing.js +34 -0
- package/dist/timing.js.map +1 -0
- package/dist/work-item-branch.d.ts +33 -0
- package/dist/work-item-branch.d.ts.map +1 -0
- package/dist/work-item-branch.js +70 -0
- package/dist/work-item-branch.js.map +1 -0
- package/dist/workspace.d.ts +131 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +995 -0
- package/dist/workspace.js.map +1 -0
- package/factory-skills/configure-factory-rules/SKILL.md +122 -0
- package/factory-skills/factory-complete-issue/SKILL.md +24 -0
- package/factory-skills/factory-gitlab-rereview/SKILL.md +22 -0
- package/factory-skills/factory-gitlab-review/SKILL.md +48 -0
- package/factory-skills/factory-plan/SKILL.md +72 -0
- package/factory-skills/factory-rereview/SKILL.md +225 -0
- package/factory-skills/factory-review/SKILL.md +214 -0
- package/factory-skills/factory-review/references/archaeology.md +225 -0
- package/factory-skills/factory-review/references/categories/README.md +34 -0
- package/factory-skills/factory-review/references/categories/behavior-change.md +36 -0
- package/factory-skills/factory-review/references/categories/bug-fix.md +37 -0
- package/factory-skills/factory-review/references/categories/docs.md +32 -0
- package/factory-skills/factory-review/references/categories/experimental-flagged.md +34 -0
- package/factory-skills/factory-review/references/categories/infra-tooling.md +37 -0
- package/factory-skills/factory-review/references/categories/internal-capability.md +35 -0
- package/factory-skills/factory-review/references/categories/large-cross-cutting.md +35 -0
- package/factory-skills/factory-review/references/categories/mechanical.md +36 -0
- package/factory-skills/factory-review/references/categories/performance.md +33 -0
- package/factory-skills/factory-review/references/categories/public-api.md +38 -0
- package/factory-skills/factory-review/references/categories/refactor.md +35 -0
- package/factory-skills/factory-review/references/categories/revert.md +31 -0
- package/factory-skills/factory-review/references/categories/schema-storage.md +39 -0
- package/factory-skills/factory-review/references/categories/security.md +35 -0
- package/factory-skills/factory-review/references/categories/tests-only.md +38 -0
- package/factory-skills/factory-triage/SKILL.md +197 -0
- package/package.json +92 -0
|
@@ -0,0 +1,1011 @@
|
|
|
1
|
+
import { WEB_OAUTH_FLOW_KINDS, getAuthProviderId, listTenantCredentialsForRequest, resolveCredentialContext, tenantOrgId } from "./provider-credentials.js";
|
|
2
|
+
import { resolveFactoryModelPolicy } from "../session/credential-policy.js";
|
|
3
|
+
import "../session/memory-settings-hydration.js";
|
|
4
|
+
import { factoryMemorySettingsUserId } from "../storage/domains/memory-settings/base.js";
|
|
5
|
+
import { Route } from "./route.js";
|
|
6
|
+
import { RequestContext } from "@mastra/core/request-context";
|
|
7
|
+
import { registerApiRoute } from "@mastra/core/server";
|
|
8
|
+
import { MASTRA_GATEWAY_PREFIX } from "@mastra/code-sdk/providers/model-ids";
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
import { MastraCodeGateway } from "@mastra/code-sdk/agents/mastracode-gateway";
|
|
11
|
+
import { resolveAutoOMModelId } from "@mastra/code-sdk/onboarding/packs";
|
|
12
|
+
import { MASTRA_GATEWAY_PROVIDER, THINKING_LEVEL_VALUES, getCustomProviderId, isThinkingLevelSetting, loadSettings, saveSettings } from "@mastra/code-sdk/onboarding/settings";
|
|
13
|
+
import { AMAZON_BEDROCK_GATEWAY_ID } from "@mastra/code-sdk/providers/amazon-bedrock-gateway";
|
|
14
|
+
import { getModelReasoningOptions } from "@mastra/core/llm";
|
|
15
|
+
//#region src/routes/config.ts
|
|
16
|
+
/** Widen a route-local Hono context to the plain `Context` the auth helpers take. */
|
|
17
|
+
function loose(c) {
|
|
18
|
+
return c;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Build a deduplicated, sorted list of providers from the model catalog,
|
|
22
|
+
* annotated with where each provider's credential currently comes from.
|
|
23
|
+
* Mirrors the TUI's `/api-keys` provider list.
|
|
24
|
+
*
|
|
25
|
+
* When `tenantCredentials` is given (deployed mode), sources reflect the
|
|
26
|
+
* *caller's* tenant rows with user > org precedence and the server-global
|
|
27
|
+
* `authStorage` is ignored; otherwise the local `auth.json` view is reported.
|
|
28
|
+
*/
|
|
29
|
+
async function listProviders({ controller, authStorage, tenantCredentials, deploymentProviders }) {
|
|
30
|
+
const models = await controller.listAvailableModels();
|
|
31
|
+
const seen = /* @__PURE__ */ new Map();
|
|
32
|
+
for (const model of models) {
|
|
33
|
+
if (seen.has(model.provider)) continue;
|
|
34
|
+
if (tenantCredentials && isDeploymentModelProvider(model.provider)) {
|
|
35
|
+
if (deploymentProviders?.has(model.provider) && models.some((m) => m.provider === model.provider && m.hasApiKey)) seen.set(model.provider, {
|
|
36
|
+
provider: model.provider,
|
|
37
|
+
source: "deployment"
|
|
38
|
+
});
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
const authProviderId = getAuthProviderId(model.provider);
|
|
42
|
+
let source = "none";
|
|
43
|
+
let orgKey;
|
|
44
|
+
let userCredential;
|
|
45
|
+
let orgCredential;
|
|
46
|
+
if (tenantCredentials) {
|
|
47
|
+
const userRec = tenantCredentials.find((r) => r.scope === "user" && r.provider === authProviderId);
|
|
48
|
+
const orgRec = tenantCredentials.find((r) => r.scope === "org" && r.provider === authProviderId);
|
|
49
|
+
orgKey = orgRec !== void 0;
|
|
50
|
+
userCredential = userRec?.credential.type;
|
|
51
|
+
orgCredential = orgRec?.credential.type;
|
|
52
|
+
if (userRec?.credential.type === "oauth") source = "oauth-user";
|
|
53
|
+
else if (userRec?.credential.type === "api_key") source = "stored-user";
|
|
54
|
+
else if (orgRec?.credential.type === "oauth") source = "oauth-org";
|
|
55
|
+
else if (orgRec?.credential.type === "api_key") source = "stored-org";
|
|
56
|
+
} else if (authStorage?.isLoggedIn(authProviderId)) source = "oauth";
|
|
57
|
+
else if (authStorage?.hasStoredApiKey(model.provider)) source = "stored";
|
|
58
|
+
else if (model.apiKeyEnvVar && process.env[model.apiKeyEnvVar]) source = "env";
|
|
59
|
+
else if (model.hasApiKey) source = "env";
|
|
60
|
+
const flowKind = WEB_OAUTH_FLOW_KINDS[model.provider];
|
|
61
|
+
seen.set(model.provider, {
|
|
62
|
+
provider: model.provider,
|
|
63
|
+
envVar: model.apiKeyEnvVar,
|
|
64
|
+
source,
|
|
65
|
+
...orgKey !== void 0 ? { orgKey } : {},
|
|
66
|
+
...userCredential ? { userCredential } : {},
|
|
67
|
+
...orgCredential ? { orgCredential } : {},
|
|
68
|
+
...flowKind ? { oauth: {
|
|
69
|
+
supported: true,
|
|
70
|
+
modes: [flowKind]
|
|
71
|
+
} } : {}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
return Array.from(seen.values()).sort((a, b) => a.provider.localeCompare(b.provider));
|
|
75
|
+
}
|
|
76
|
+
/** Redact a stored custom-provider row for the client (key presence only). */
|
|
77
|
+
function toCustomProviderInfo(record) {
|
|
78
|
+
return {
|
|
79
|
+
id: record.providerId,
|
|
80
|
+
name: record.name,
|
|
81
|
+
url: record.url,
|
|
82
|
+
hasApiKey: Boolean(record.apiKey),
|
|
83
|
+
models: record.models
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Resolve the custom-providers context for a request, or a ready-to-return
|
|
88
|
+
* error response. Same posture as memory settings: tenant rows in deployed
|
|
89
|
+
* mode, a sentinel `local` org in no-auth mode — never settings.json.
|
|
90
|
+
*/
|
|
91
|
+
async function resolveCustomProvidersContext({ c, auth, customProviders }) {
|
|
92
|
+
await auth.ensureUser(c);
|
|
93
|
+
const tenant = auth.tenant(c);
|
|
94
|
+
if (!tenant && auth.enabled()) return { response: c.json({ error: "unauthorized" }, 401) };
|
|
95
|
+
if (customProviders) try {
|
|
96
|
+
await customProviders.ensureReady();
|
|
97
|
+
return tenant ? {
|
|
98
|
+
storage: customProviders,
|
|
99
|
+
orgId: tenantOrgId(tenant),
|
|
100
|
+
userId: tenant.userId
|
|
101
|
+
} : {
|
|
102
|
+
storage: customProviders,
|
|
103
|
+
orgId: "local",
|
|
104
|
+
userId: "local"
|
|
105
|
+
};
|
|
106
|
+
} catch {}
|
|
107
|
+
return { response: c.json({
|
|
108
|
+
error: "custom_providers_unavailable",
|
|
109
|
+
message: "Custom provider storage is unavailable — the app database is not configured or failed to start."
|
|
110
|
+
}, 503) };
|
|
111
|
+
}
|
|
112
|
+
/** Validate + coerce a request body into a CustomProviderSetting. */
|
|
113
|
+
function parseCustomProviderBody(body) {
|
|
114
|
+
if (!body || typeof body !== "object") return { error: "Invalid JSON body" };
|
|
115
|
+
const b = body;
|
|
116
|
+
const name = typeof b.name === "string" ? b.name.trim() : "";
|
|
117
|
+
if (!name) return { error: "Missing required field: name" };
|
|
118
|
+
const url = typeof b.url === "string" ? b.url.trim() : "";
|
|
119
|
+
if (!url) return { error: "Missing required field: url" };
|
|
120
|
+
try {
|
|
121
|
+
const parsed = new URL(url);
|
|
122
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") return { error: "url must be an http(s) URL" };
|
|
123
|
+
} catch {
|
|
124
|
+
return { error: "url must be a valid URL" };
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
name,
|
|
128
|
+
url,
|
|
129
|
+
apiKey: typeof b.apiKey === "string" && b.apiKey.trim() ? b.apiKey.trim() : void 0,
|
|
130
|
+
models: Array.isArray(b.models) ? b.models.filter((m) => typeof m === "string" && m.trim().length > 0).map((m) => m.trim()) : []
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Providers whose credentials can only come from the server process (Amazon
|
|
135
|
+
* Bedrock authenticates through the AWS credential chain). In tenant mode they
|
|
136
|
+
* are usable only when the operator lists them in
|
|
137
|
+
* `MastraFactoryConfig.deploymentModelProviders`.
|
|
138
|
+
*/
|
|
139
|
+
const DEPLOYMENT_MODEL_PROVIDERS = [AMAZON_BEDROCK_GATEWAY_ID];
|
|
140
|
+
function isDeploymentModelProvider(provider) {
|
|
141
|
+
return DEPLOYMENT_MODEL_PROVIDERS.includes(provider);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Normalize the operator's `deploymentModelProviders` list. Unsupported ids are
|
|
145
|
+
* ignored with a warning rather than failing boot.
|
|
146
|
+
*/
|
|
147
|
+
function resolveDeploymentModelProviders(providers) {
|
|
148
|
+
const resolved = /* @__PURE__ */ new Set();
|
|
149
|
+
for (const raw of providers ?? []) {
|
|
150
|
+
const provider = raw.trim();
|
|
151
|
+
if (!provider) continue;
|
|
152
|
+
if (isDeploymentModelProvider(provider)) resolved.add(provider);
|
|
153
|
+
else console.warn(`[factory] Ignoring deployment model provider "${provider}". Supported: ${DEPLOYMENT_MODEL_PROVIDERS.join(", ")}.`);
|
|
154
|
+
}
|
|
155
|
+
return resolved;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Compute which providers the user can reach, mirroring the TUI's
|
|
159
|
+
* `/models-pack` access derivation: OAuth/api-key from the credential store for
|
|
160
|
+
* the named providers, plus any other provider that has a usable key.
|
|
161
|
+
*/
|
|
162
|
+
async function buildProviderAccess({ controller, authStorage, tenantCredentials, deploymentProviders }) {
|
|
163
|
+
const models = await controller.listAvailableModels();
|
|
164
|
+
const hasModelKey = (provider) => models.some((m) => m.provider === provider && m.hasApiKey);
|
|
165
|
+
const accessLevel = (provider) => {
|
|
166
|
+
const authProviderId = getAuthProviderId(provider);
|
|
167
|
+
if (tenantCredentials) {
|
|
168
|
+
if (isDeploymentModelProvider(provider)) return deploymentProviders?.has(provider) && hasModelKey(provider) ? "apikey" : false;
|
|
169
|
+
const userRec = tenantCredentials.find((r) => r.scope === "user" && r.provider === authProviderId);
|
|
170
|
+
const orgRec = tenantCredentials.find((r) => r.scope === "org" && r.provider === authProviderId);
|
|
171
|
+
const credential = userRec?.credential ?? orgRec?.credential;
|
|
172
|
+
if (credential?.type === "oauth") return "oauth";
|
|
173
|
+
if (credential?.type === "api_key" && credential.key.trim().length > 0) return "apikey";
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
if ((authStorage?.get(authProviderId))?.type === "oauth") return "oauth";
|
|
177
|
+
if (authStorage?.hasStoredApiKey(provider)) return "apikey";
|
|
178
|
+
const directCredential = authStorage?.get(provider);
|
|
179
|
+
if (directCredential?.type === "api_key" && directCredential.key.trim().length > 0) return "apikey";
|
|
180
|
+
return hasModelKey(provider) ? "apikey" : false;
|
|
181
|
+
};
|
|
182
|
+
const access = {
|
|
183
|
+
anthropic: accessLevel("anthropic"),
|
|
184
|
+
openai: accessLevel("openai"),
|
|
185
|
+
cerebras: accessLevel("cerebras"),
|
|
186
|
+
google: accessLevel("google"),
|
|
187
|
+
deepseek: accessLevel("deepseek"),
|
|
188
|
+
"github-copilot": accessLevel("github-copilot")
|
|
189
|
+
};
|
|
190
|
+
const seen = new Set(Object.keys(access));
|
|
191
|
+
for (const m of models) if (!seen.has(m.provider)) {
|
|
192
|
+
access[m.provider] = accessLevel(m.provider);
|
|
193
|
+
seen.add(m.provider);
|
|
194
|
+
}
|
|
195
|
+
return access;
|
|
196
|
+
}
|
|
197
|
+
function canUseModelProvider(access, provider) {
|
|
198
|
+
return Boolean(access[provider]);
|
|
199
|
+
}
|
|
200
|
+
/** Resolve the default-model context for a request, or a ready-to-return error response. */
|
|
201
|
+
async function resolveModelDefaultsContext({ c, auth, modelDefaults }) {
|
|
202
|
+
await auth.ensureUser(c);
|
|
203
|
+
const tenant = auth.tenant(c);
|
|
204
|
+
if (!tenant && auth.enabled()) return { response: c.json({ error: "unauthorized" }, 401) };
|
|
205
|
+
if (modelDefaults) try {
|
|
206
|
+
await modelDefaults.ensureReady();
|
|
207
|
+
return tenant ? {
|
|
208
|
+
storage: modelDefaults,
|
|
209
|
+
orgId: tenantOrgId(tenant),
|
|
210
|
+
userId: tenant.userId
|
|
211
|
+
} : {
|
|
212
|
+
storage: modelDefaults,
|
|
213
|
+
orgId: "local",
|
|
214
|
+
userId: "local"
|
|
215
|
+
};
|
|
216
|
+
} catch {}
|
|
217
|
+
return { response: c.json({
|
|
218
|
+
error: "model_defaults_unavailable",
|
|
219
|
+
message: "Default model storage is unavailable — the app database is not configured or failed to start."
|
|
220
|
+
}, 503) };
|
|
221
|
+
}
|
|
222
|
+
function modelProvider(modelId) {
|
|
223
|
+
return modelId.replace(/^mastracode\//, "").replace(/^mastra\//, "").split("/", 1)[0] ?? "";
|
|
224
|
+
}
|
|
225
|
+
function roleConfig(model, effectiveModelId, autoModelSource, availableProviders) {
|
|
226
|
+
return {
|
|
227
|
+
model,
|
|
228
|
+
effectiveModelId,
|
|
229
|
+
effectiveModelSource: model === "auto" ? autoModelSource : "explicit",
|
|
230
|
+
providerStatus: availableProviders.has(modelProvider(effectiveModelId)) || effectiveModelId.startsWith(MASTRA_GATEWAY_PREFIX) && availableProviders.has(MASTRA_GATEWAY_PROVIDER) ? "available" : "unavailable"
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
function readStoredOMConfig(record, currentModelId, autoModelSource, availableProviders) {
|
|
234
|
+
const autoModelId = resolveAutoOMModelId(currentModelId);
|
|
235
|
+
const observerModelId = record?.observerModelId ?? autoModelId;
|
|
236
|
+
const reflectorModelId = record?.reflectorModelId ?? autoModelId;
|
|
237
|
+
return {
|
|
238
|
+
observer: roleConfig(record?.observerModelId ?? "auto", observerModelId, autoModelSource, availableProviders),
|
|
239
|
+
reflector: roleConfig(record?.reflectorModelId ?? "auto", reflectorModelId, autoModelSource, availableProviders),
|
|
240
|
+
observerModelId,
|
|
241
|
+
reflectorModelId,
|
|
242
|
+
observationThreshold: record?.observationThreshold ?? 3e4,
|
|
243
|
+
reflectionThreshold: record?.reflectionThreshold ?? 4e4,
|
|
244
|
+
observeAttachments: record?.observeAttachments ?? "auto"
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Resolve the memory-settings context for a request, or a ready-to-return
|
|
249
|
+
* error response. When `factoryProjectId` is provided the row addressed is the
|
|
250
|
+
* factory project's shared settings (a sentinel user id in the caller's org)
|
|
251
|
+
* instead of the caller's personal row — this is what factory board runs and
|
|
252
|
+
* channel sessions hydrate from.
|
|
253
|
+
*/
|
|
254
|
+
async function resolveMemorySettingsContext({ c, auth, memorySettings, factoryProjectId, factoryProjects }) {
|
|
255
|
+
await auth.ensureUser(c);
|
|
256
|
+
const tenant = auth.tenant(c);
|
|
257
|
+
if (!tenant && auth.enabled()) return { response: c.json({ error: "unauthorized" }, 401) };
|
|
258
|
+
if (factoryProjectId && tenant) {
|
|
259
|
+
if (!factoryProjects) return { response: c.json({ error: "factory_unavailable" }, 503) };
|
|
260
|
+
try {
|
|
261
|
+
await factoryProjects.ensureReady();
|
|
262
|
+
if (!await factoryProjects.get({
|
|
263
|
+
orgId: tenantOrgId(tenant),
|
|
264
|
+
id: factoryProjectId
|
|
265
|
+
})) return { response: c.json({ error: "factory_project_not_found" }, 404) };
|
|
266
|
+
} catch {
|
|
267
|
+
return { response: c.json({ error: "factory_unavailable" }, 503) };
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
if (memorySettings) try {
|
|
271
|
+
await memorySettings.ensureReady();
|
|
272
|
+
const factoryUserId = factoryProjectId ? factoryMemorySettingsUserId(factoryProjectId) : void 0;
|
|
273
|
+
return tenant ? {
|
|
274
|
+
storage: memorySettings,
|
|
275
|
+
orgId: tenantOrgId(tenant),
|
|
276
|
+
userId: factoryUserId ?? tenant.userId
|
|
277
|
+
} : {
|
|
278
|
+
storage: memorySettings,
|
|
279
|
+
orgId: "local",
|
|
280
|
+
userId: factoryUserId ?? "local"
|
|
281
|
+
};
|
|
282
|
+
} catch {}
|
|
283
|
+
return { response: c.json({
|
|
284
|
+
error: "memory_settings_unavailable",
|
|
285
|
+
message: "Memory settings storage is unavailable — the app database is not configured or failed to start."
|
|
286
|
+
}, 503) };
|
|
287
|
+
}
|
|
288
|
+
/** Persist an OM knob change to the caller's memory-settings row. */
|
|
289
|
+
async function persistMemorySettings(context, patch) {
|
|
290
|
+
await context.storage.patch({
|
|
291
|
+
orgId: context.orgId,
|
|
292
|
+
userId: context.userId,
|
|
293
|
+
patch
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* The web config routes as Mastra `apiRoutes`:
|
|
298
|
+
* - `GET /web/config/features` — list server-enabled product features
|
|
299
|
+
* - `GET /web/config/providers` — list providers + key source
|
|
300
|
+
* - `PUT /web/config/providers/:provider/key` — set/update a provider's API key
|
|
301
|
+
* - `DELETE /web/config/providers/:provider/key` — remove a stored API key
|
|
302
|
+
* - `GET /web/config/models` — list available models (credentialed providers)
|
|
303
|
+
* - `GET /web/config/custom-providers` — list custom OpenAI-compatible providers
|
|
304
|
+
* - `POST /web/config/custom-providers` — create/update a custom provider
|
|
305
|
+
* - `DELETE /web/config/custom-providers/:id` — remove a custom provider
|
|
306
|
+
* - `GET /web/config/thinking` — read thinking (reasoning-effort) defaults
|
|
307
|
+
* - `PUT /web/config/thinking` — set the global thinking default
|
|
308
|
+
* - `GET /web/config/om` — read OM models/thresholds/observe-attachments
|
|
309
|
+
* - `PUT /web/config/om/:role/model` — switch observer/reflector model
|
|
310
|
+
* - `PUT /web/config/om/thresholds` — set observation/reflection thresholds
|
|
311
|
+
* - `PUT /web/config/om/observe-attachments` — set observe-attachments (auto/on/off)
|
|
312
|
+
*/
|
|
313
|
+
var ConfigRoutes = class extends Route {
|
|
314
|
+
routes() {
|
|
315
|
+
const options = this.deps;
|
|
316
|
+
const { controller, authStorage, auth, deploymentProviders } = options;
|
|
317
|
+
const onCredentialsChanged = options.onCredentialsChanged ?? (() => {});
|
|
318
|
+
const onCustomProvidersChanged = options.onCustomProvidersChanged ?? (() => {});
|
|
319
|
+
const resolveOMResponseContext = async (c) => {
|
|
320
|
+
const tenantCredentials = await listTenantCredentialsForRequest({
|
|
321
|
+
c: loose(c),
|
|
322
|
+
auth,
|
|
323
|
+
credentials: options.modelCredentials
|
|
324
|
+
});
|
|
325
|
+
const access = await buildProviderAccess({
|
|
326
|
+
controller,
|
|
327
|
+
authStorage: tenantCredentials ? void 0 : authStorage,
|
|
328
|
+
tenantCredentials,
|
|
329
|
+
deploymentProviders
|
|
330
|
+
});
|
|
331
|
+
const availableProviders = new Set(Object.entries(access).flatMap(([providerId, configured]) => configured ? [providerId] : []));
|
|
332
|
+
if (MastraCodeGateway.getMastraGatewayApiKey()) availableProviders.add(MASTRA_GATEWAY_PROVIDER);
|
|
333
|
+
if (options.customProviders) {
|
|
334
|
+
const context = await resolveCustomProvidersContext({
|
|
335
|
+
c: loose(c),
|
|
336
|
+
auth,
|
|
337
|
+
customProviders: options.customProviders
|
|
338
|
+
});
|
|
339
|
+
if (!("response" in context)) for (const provider of await context.storage.list({ orgId: context.orgId })) availableProviders.add(provider.providerId);
|
|
340
|
+
}
|
|
341
|
+
return availableProviders;
|
|
342
|
+
};
|
|
343
|
+
const factoryOmFallback = async (factoryProjectId) => {
|
|
344
|
+
try {
|
|
345
|
+
const defaultModelId = factoryProjectId ? await options.factoryProjects?.getById({ id: factoryProjectId }).then((project) => project?.defaultModelId ?? void 0) : controller.listModes?.().find((mode) => mode.defaultModelId)?.defaultModelId;
|
|
346
|
+
return defaultModelId ? resolveAutoOMModelId(defaultModelId) : void 0;
|
|
347
|
+
} catch {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
const deploymentThinkingAccess = async (c) => {
|
|
352
|
+
if (!auth.enabled()) return { ok: true };
|
|
353
|
+
await auth.ensureUser(c);
|
|
354
|
+
const tenant = auth.tenant(c);
|
|
355
|
+
if (!tenant) return {
|
|
356
|
+
ok: false,
|
|
357
|
+
status: 401,
|
|
358
|
+
error: "unauthorized"
|
|
359
|
+
};
|
|
360
|
+
const orgId = tenantOrgId(tenant);
|
|
361
|
+
if (!options.deploymentOrganizationId || orgId !== options.deploymentOrganizationId) return {
|
|
362
|
+
ok: false,
|
|
363
|
+
status: 403,
|
|
364
|
+
error: "deployment_organization_required",
|
|
365
|
+
message: "Deployment thinking defaults are shared by the whole deployment. Set MASTRACODE_DEPLOYMENT_ORGANIZATION_ID to let that organization's admins change them while authentication is enabled"
|
|
366
|
+
};
|
|
367
|
+
if (!await auth.isOrganizationAdmin(c, orgId)) return {
|
|
368
|
+
ok: false,
|
|
369
|
+
status: 403,
|
|
370
|
+
error: "organization_admin_required",
|
|
371
|
+
message: "Only organization admins can change deployment thinking defaults while authentication is enabled"
|
|
372
|
+
};
|
|
373
|
+
return { ok: true };
|
|
374
|
+
};
|
|
375
|
+
return [
|
|
376
|
+
registerApiRoute("/web/config/features", {
|
|
377
|
+
method: "GET",
|
|
378
|
+
requiresAuth: false,
|
|
379
|
+
handler: async (c) => c.json({ knowledge: options.features?.knowledge ?? false })
|
|
380
|
+
}),
|
|
381
|
+
registerApiRoute("/web/config/providers", {
|
|
382
|
+
method: "GET",
|
|
383
|
+
requiresAuth: false,
|
|
384
|
+
handler: async (c) => {
|
|
385
|
+
try {
|
|
386
|
+
const tenantCredentials = await listTenantCredentialsForRequest({
|
|
387
|
+
c: loose(c),
|
|
388
|
+
auth,
|
|
389
|
+
credentials: options.modelCredentials
|
|
390
|
+
});
|
|
391
|
+
const tenant = auth.tenant(loose(c));
|
|
392
|
+
const orgKeyAdmin = tenant ? await auth.isOrganizationAdmin(loose(c), tenantOrgId(tenant)) : void 0;
|
|
393
|
+
return c.json({
|
|
394
|
+
providers: await listProviders({
|
|
395
|
+
controller,
|
|
396
|
+
authStorage: tenantCredentials ? void 0 : authStorage,
|
|
397
|
+
tenantCredentials,
|
|
398
|
+
deploymentProviders
|
|
399
|
+
}),
|
|
400
|
+
...orgKeyAdmin !== void 0 ? { orgKeyAdmin } : {}
|
|
401
|
+
});
|
|
402
|
+
} catch (error) {
|
|
403
|
+
return c.json({ error: error instanceof Error ? error.message : String(error) }, 500);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}),
|
|
407
|
+
registerApiRoute("/web/config/providers/:provider/key", {
|
|
408
|
+
method: "PUT",
|
|
409
|
+
requiresAuth: false,
|
|
410
|
+
handler: async (c) => {
|
|
411
|
+
const ctx = await resolveCredentialContext({
|
|
412
|
+
c: loose(c),
|
|
413
|
+
auth,
|
|
414
|
+
credentials: options.modelCredentials
|
|
415
|
+
});
|
|
416
|
+
if ("response" in ctx) return ctx.response;
|
|
417
|
+
const provider = c.req.param("provider");
|
|
418
|
+
let body;
|
|
419
|
+
try {
|
|
420
|
+
body = await c.req.json();
|
|
421
|
+
} catch {
|
|
422
|
+
return c.json({ error: "Invalid JSON body" }, 400);
|
|
423
|
+
}
|
|
424
|
+
const key = typeof body.key === "string" ? body.key.trim() : "";
|
|
425
|
+
if (!key) return c.json({ error: "Missing required field: key" }, 400);
|
|
426
|
+
const envVar = typeof body.envVar === "string" ? body.envVar : void 0;
|
|
427
|
+
const scope = body.scope === "org" ? "org" : "user";
|
|
428
|
+
try {
|
|
429
|
+
if (ctx.mode === "tenant") {
|
|
430
|
+
if (isDeploymentModelProvider(provider)) return c.json({
|
|
431
|
+
error: "provider_configured_by_deployment",
|
|
432
|
+
message: `${provider} is configured by the Factory deployment (credentials on the server), not per account.`
|
|
433
|
+
}, 400);
|
|
434
|
+
if (scope === "org" && !await auth.isOrganizationAdmin(loose(c), ctx.orgId)) return c.json({ error: "organization_admin_required" }, 403);
|
|
435
|
+
const tenant = scope === "org" ? { orgId: ctx.orgId } : {
|
|
436
|
+
orgId: ctx.orgId,
|
|
437
|
+
userId: ctx.userId
|
|
438
|
+
};
|
|
439
|
+
await ctx.storage.setCredential(tenant, getAuthProviderId(provider), {
|
|
440
|
+
type: "api_key",
|
|
441
|
+
key
|
|
442
|
+
});
|
|
443
|
+
onCredentialsChanged(tenant);
|
|
444
|
+
const records = await ctx.storage.listCredentials(ctx.orgId, ctx.userId);
|
|
445
|
+
const providers = await listProviders({
|
|
446
|
+
controller,
|
|
447
|
+
tenantCredentials: records,
|
|
448
|
+
deploymentProviders
|
|
449
|
+
});
|
|
450
|
+
return c.json({
|
|
451
|
+
ok: true,
|
|
452
|
+
provider: providers.find((p) => p.provider === provider)
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
if (!authStorage) return c.json({ error: "Credential storage is not available" }, 503);
|
|
456
|
+
authStorage.setStoredApiKey(provider, key, envVar);
|
|
457
|
+
const providers = await listProviders({
|
|
458
|
+
controller,
|
|
459
|
+
authStorage
|
|
460
|
+
});
|
|
461
|
+
return c.json({
|
|
462
|
+
ok: true,
|
|
463
|
+
provider: providers.find((p) => p.provider === provider)
|
|
464
|
+
});
|
|
465
|
+
} catch (error) {
|
|
466
|
+
return c.json({ error: error instanceof Error ? error.message : String(error) }, 500);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}),
|
|
470
|
+
registerApiRoute("/web/config/providers/:provider/key", {
|
|
471
|
+
method: "DELETE",
|
|
472
|
+
requiresAuth: false,
|
|
473
|
+
handler: async (c) => {
|
|
474
|
+
const ctx = await resolveCredentialContext({
|
|
475
|
+
c: loose(c),
|
|
476
|
+
auth,
|
|
477
|
+
credentials: options.modelCredentials
|
|
478
|
+
});
|
|
479
|
+
if ("response" in ctx) return ctx.response;
|
|
480
|
+
const provider = c.req.param("provider");
|
|
481
|
+
const scope = c.req.query("scope") === "org" ? "org" : "user";
|
|
482
|
+
try {
|
|
483
|
+
if (ctx.mode === "tenant") {
|
|
484
|
+
if (scope === "org" && !await auth.isOrganizationAdmin(loose(c), ctx.orgId)) return c.json({ error: "organization_admin_required" }, 403);
|
|
485
|
+
const tenant = scope === "org" ? { orgId: ctx.orgId } : {
|
|
486
|
+
orgId: ctx.orgId,
|
|
487
|
+
userId: ctx.userId
|
|
488
|
+
};
|
|
489
|
+
await ctx.storage.removeCredential(tenant, getAuthProviderId(provider));
|
|
490
|
+
onCredentialsChanged(tenant);
|
|
491
|
+
const records = await ctx.storage.listCredentials(ctx.orgId, ctx.userId);
|
|
492
|
+
const providers = await listProviders({
|
|
493
|
+
controller,
|
|
494
|
+
tenantCredentials: records,
|
|
495
|
+
deploymentProviders
|
|
496
|
+
});
|
|
497
|
+
return c.json({
|
|
498
|
+
ok: true,
|
|
499
|
+
provider: providers.find((p) => p.provider === provider)
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
if (!authStorage) return c.json({ error: "Credential storage is not available" }, 503);
|
|
503
|
+
authStorage.remove(`apikey:${provider}`);
|
|
504
|
+
const providers = await listProviders({
|
|
505
|
+
controller,
|
|
506
|
+
authStorage
|
|
507
|
+
});
|
|
508
|
+
return c.json({
|
|
509
|
+
ok: true,
|
|
510
|
+
provider: providers.find((p) => p.provider === provider)
|
|
511
|
+
});
|
|
512
|
+
} catch (error) {
|
|
513
|
+
return c.json({ error: error instanceof Error ? error.message : String(error) }, 500);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}),
|
|
517
|
+
registerApiRoute("/web/config/custom-providers", {
|
|
518
|
+
method: "GET",
|
|
519
|
+
requiresAuth: false,
|
|
520
|
+
handler: async (c) => {
|
|
521
|
+
const ctx = await resolveCustomProvidersContext({
|
|
522
|
+
c: loose(c),
|
|
523
|
+
auth,
|
|
524
|
+
customProviders: options.customProviders
|
|
525
|
+
});
|
|
526
|
+
if ("response" in ctx) return ctx.response;
|
|
527
|
+
try {
|
|
528
|
+
const records = await ctx.storage.list({ orgId: ctx.orgId });
|
|
529
|
+
return c.json({ providers: records.map(toCustomProviderInfo) });
|
|
530
|
+
} catch (error) {
|
|
531
|
+
return c.json({ error: error instanceof Error ? error.message : String(error) }, 500);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}),
|
|
535
|
+
registerApiRoute("/web/config/custom-providers", {
|
|
536
|
+
method: "POST",
|
|
537
|
+
requiresAuth: false,
|
|
538
|
+
handler: async (c) => {
|
|
539
|
+
const ctx = await resolveCustomProvidersContext({
|
|
540
|
+
c: loose(c),
|
|
541
|
+
auth,
|
|
542
|
+
customProviders: options.customProviders
|
|
543
|
+
});
|
|
544
|
+
if ("response" in ctx) return ctx.response;
|
|
545
|
+
let body;
|
|
546
|
+
try {
|
|
547
|
+
body = await c.req.json();
|
|
548
|
+
} catch {
|
|
549
|
+
return c.json({ error: "Invalid JSON body" }, 400);
|
|
550
|
+
}
|
|
551
|
+
const parsed = parseCustomProviderBody(body);
|
|
552
|
+
if ("error" in parsed) return c.json({ error: parsed.error }, 400);
|
|
553
|
+
const previousId = body && typeof body === "object" && typeof body.previousId === "string" ? body.previousId : void 0;
|
|
554
|
+
try {
|
|
555
|
+
const record = await ctx.storage.upsert({
|
|
556
|
+
orgId: ctx.orgId,
|
|
557
|
+
userId: ctx.userId,
|
|
558
|
+
input: {
|
|
559
|
+
providerId: getCustomProviderId(parsed.name),
|
|
560
|
+
name: parsed.name,
|
|
561
|
+
url: parsed.url,
|
|
562
|
+
apiKey: parsed.apiKey,
|
|
563
|
+
models: parsed.models
|
|
564
|
+
},
|
|
565
|
+
previousProviderId: previousId
|
|
566
|
+
});
|
|
567
|
+
onCustomProvidersChanged({ orgId: ctx.orgId });
|
|
568
|
+
return c.json({
|
|
569
|
+
ok: true,
|
|
570
|
+
provider: toCustomProviderInfo(record)
|
|
571
|
+
});
|
|
572
|
+
} catch (error) {
|
|
573
|
+
return c.json({ error: error instanceof Error ? error.message : String(error) }, 500);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}),
|
|
577
|
+
registerApiRoute("/web/config/custom-providers/:id", {
|
|
578
|
+
method: "DELETE",
|
|
579
|
+
requiresAuth: false,
|
|
580
|
+
handler: async (c) => {
|
|
581
|
+
const ctx = await resolveCustomProvidersContext({
|
|
582
|
+
c: loose(c),
|
|
583
|
+
auth,
|
|
584
|
+
customProviders: options.customProviders
|
|
585
|
+
});
|
|
586
|
+
if ("response" in ctx) return ctx.response;
|
|
587
|
+
const id = c.req.param("id");
|
|
588
|
+
try {
|
|
589
|
+
await ctx.storage.delete({
|
|
590
|
+
orgId: ctx.orgId,
|
|
591
|
+
providerId: id
|
|
592
|
+
});
|
|
593
|
+
onCustomProvidersChanged({ orgId: ctx.orgId });
|
|
594
|
+
return c.json({ ok: true });
|
|
595
|
+
} catch (error) {
|
|
596
|
+
return c.json({ error: error instanceof Error ? error.message : String(error) }, 500);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
}),
|
|
600
|
+
registerApiRoute("/web/config/models", {
|
|
601
|
+
method: "GET",
|
|
602
|
+
requiresAuth: false,
|
|
603
|
+
handler: async (c) => {
|
|
604
|
+
try {
|
|
605
|
+
const allTenantCredentials = await listTenantCredentialsForRequest({
|
|
606
|
+
c: loose(c),
|
|
607
|
+
auth,
|
|
608
|
+
credentials: options.modelCredentials
|
|
609
|
+
});
|
|
610
|
+
const factoryProjectId = c.req.query("factoryId") || void 0;
|
|
611
|
+
const tenant = auth.tenant(c);
|
|
612
|
+
let tenantCredentials = allTenantCredentials;
|
|
613
|
+
let sessionPolicy;
|
|
614
|
+
const resourceId = c.req.query("resourceId");
|
|
615
|
+
const threadId = c.req.query("threadId");
|
|
616
|
+
if (resourceId !== void 0 || threadId !== void 0) {
|
|
617
|
+
const address = z.object({
|
|
618
|
+
resourceId: z.string().trim().min(1),
|
|
619
|
+
threadId: z.string().trim().min(1)
|
|
620
|
+
}).safeParse({
|
|
621
|
+
resourceId,
|
|
622
|
+
threadId
|
|
623
|
+
});
|
|
624
|
+
if (!address.success) return c.json({ error: "invalid_session_context" }, 400);
|
|
625
|
+
if (!tenant && auth.enabled()) return c.json({ error: "unauthorized" }, 401);
|
|
626
|
+
if (tenant) {
|
|
627
|
+
if (!options.factoryProjects || !options.sourceControlSessions || !options.workItems || !options.modelCredentials) return c.json({ error: "session_model_policy_unavailable" }, 503);
|
|
628
|
+
const requestContext = new RequestContext();
|
|
629
|
+
requestContext.set("user", {
|
|
630
|
+
id: tenant.userId,
|
|
631
|
+
organizationId: tenantOrgId(tenant)
|
|
632
|
+
});
|
|
633
|
+
requestContext.set("controller", address.data);
|
|
634
|
+
let policy;
|
|
635
|
+
try {
|
|
636
|
+
policy = await resolveFactoryModelPolicy(requestContext, {
|
|
637
|
+
projects: options.factoryProjects,
|
|
638
|
+
sourceControl: options.sourceControlSessions,
|
|
639
|
+
workItems: options.workItems
|
|
640
|
+
});
|
|
641
|
+
} catch {
|
|
642
|
+
return c.json({ error: "session_model_policy_unavailable" }, 403);
|
|
643
|
+
}
|
|
644
|
+
if (!policy) return c.json({ error: "unauthorized" }, 401);
|
|
645
|
+
const orgId = policy.tenant.orgId ?? tenantOrgId(tenant);
|
|
646
|
+
const modelScope = policy.tenant.credentialScope ?? "user";
|
|
647
|
+
const storageScope = modelScope === "factory" ? "org" : "user";
|
|
648
|
+
tenantCredentials = (await options.modelCredentials.listCredentials(orgId, policy.tenant.userId)).filter((record) => record.scope === storageScope);
|
|
649
|
+
let defaultModelId = policy.factoryDefaultModelId ?? null;
|
|
650
|
+
if (modelScope === "user") {
|
|
651
|
+
if (!options.modelDefaults) return c.json({ error: "model_defaults_unavailable" }, 503);
|
|
652
|
+
await options.modelDefaults.ensureReady();
|
|
653
|
+
defaultModelId = (await options.modelDefaults.get({
|
|
654
|
+
orgId,
|
|
655
|
+
userId: policy.tenant.userId
|
|
656
|
+
}))?.modelId ?? null;
|
|
657
|
+
}
|
|
658
|
+
sessionPolicy = {
|
|
659
|
+
modelScope,
|
|
660
|
+
defaultModelId
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
} else if (allTenantCredentials && c.req.query("scope") === "user") tenantCredentials = allTenantCredentials.filter((record) => record.scope === "user");
|
|
664
|
+
else if (allTenantCredentials && factoryProjectId && tenant) {
|
|
665
|
+
if (!options.factoryProjects) return c.json({ error: "factory_unavailable" }, 503);
|
|
666
|
+
await options.factoryProjects.ensureReady();
|
|
667
|
+
const project = await options.factoryProjects.get({
|
|
668
|
+
orgId: tenantOrgId(tenant),
|
|
669
|
+
id: factoryProjectId
|
|
670
|
+
});
|
|
671
|
+
if (!project) return c.json({ error: "factory_project_not_found" }, 404);
|
|
672
|
+
const credentialScope = project.modelScope === "user" ? "user" : "org";
|
|
673
|
+
tenantCredentials = allTenantCredentials.filter((record) => record.scope === credentialScope);
|
|
674
|
+
}
|
|
675
|
+
const [models, access] = await Promise.all([controller.listAvailableModels(), buildProviderAccess({
|
|
676
|
+
controller,
|
|
677
|
+
authStorage: tenantCredentials ? void 0 : authStorage,
|
|
678
|
+
tenantCredentials,
|
|
679
|
+
deploymentProviders
|
|
680
|
+
})]);
|
|
681
|
+
const catalog = models.flatMap(({ id, provider, modelName }) => typeof id === "string" && canUseModelProvider(access, provider) ? [{
|
|
682
|
+
id,
|
|
683
|
+
provider,
|
|
684
|
+
modelName,
|
|
685
|
+
hasApiKey: true,
|
|
686
|
+
reasoningOptions: getModelReasoningOptions(id)
|
|
687
|
+
}] : []);
|
|
688
|
+
if (options.customProviders) try {
|
|
689
|
+
const ctx = await resolveCustomProvidersContext({
|
|
690
|
+
c: loose(c),
|
|
691
|
+
auth,
|
|
692
|
+
customProviders: options.customProviders
|
|
693
|
+
});
|
|
694
|
+
if (!("response" in ctx)) {
|
|
695
|
+
const known = new Set(catalog.map((m) => m.id));
|
|
696
|
+
for (const record of await ctx.storage.list({ orgId: ctx.orgId })) for (const model of record.models) {
|
|
697
|
+
const id = `${record.providerId}/${model}`;
|
|
698
|
+
if (known.has(id)) continue;
|
|
699
|
+
known.add(id);
|
|
700
|
+
catalog.push({
|
|
701
|
+
id,
|
|
702
|
+
provider: record.providerId,
|
|
703
|
+
modelName: model,
|
|
704
|
+
hasApiKey: true,
|
|
705
|
+
reasoningOptions: void 0
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
} catch {}
|
|
710
|
+
return c.json({
|
|
711
|
+
...sessionPolicy,
|
|
712
|
+
models: catalog.sort((a, b) => a.provider === b.provider ? a.id.localeCompare(b.id) : a.provider.localeCompare(b.provider))
|
|
713
|
+
});
|
|
714
|
+
} catch (error) {
|
|
715
|
+
return c.json({ error: error instanceof Error ? error.message : String(error) }, 500);
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
}),
|
|
719
|
+
registerApiRoute("/web/config/default-model", {
|
|
720
|
+
method: "GET",
|
|
721
|
+
requiresAuth: false,
|
|
722
|
+
handler: async (c) => {
|
|
723
|
+
const context = await resolveModelDefaultsContext({
|
|
724
|
+
c: loose(c),
|
|
725
|
+
auth,
|
|
726
|
+
modelDefaults: options.modelDefaults
|
|
727
|
+
});
|
|
728
|
+
if ("response" in context) return context.response;
|
|
729
|
+
try {
|
|
730
|
+
const record = await context.storage.get({
|
|
731
|
+
orgId: context.orgId,
|
|
732
|
+
userId: context.userId
|
|
733
|
+
});
|
|
734
|
+
return c.json({ modelId: record?.modelId ?? null });
|
|
735
|
+
} catch (error) {
|
|
736
|
+
return c.json({ error: error instanceof Error ? error.message : String(error) }, 500);
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
}),
|
|
740
|
+
registerApiRoute("/web/config/default-model", {
|
|
741
|
+
method: "PUT",
|
|
742
|
+
requiresAuth: false,
|
|
743
|
+
handler: async (c) => {
|
|
744
|
+
const context = await resolveModelDefaultsContext({
|
|
745
|
+
c: loose(c),
|
|
746
|
+
auth,
|
|
747
|
+
modelDefaults: options.modelDefaults
|
|
748
|
+
});
|
|
749
|
+
if ("response" in context) return context.response;
|
|
750
|
+
let body;
|
|
751
|
+
try {
|
|
752
|
+
body = await c.req.json();
|
|
753
|
+
} catch {
|
|
754
|
+
return c.json({ error: "Invalid JSON body" }, 400);
|
|
755
|
+
}
|
|
756
|
+
const parsed = z.object({ modelId: z.string().trim().min(1).max(256) }).safeParse(body);
|
|
757
|
+
if (!parsed.success) return c.json({ error: "Missing required field: modelId" }, 400);
|
|
758
|
+
const { modelId } = parsed.data;
|
|
759
|
+
try {
|
|
760
|
+
await context.storage.set({
|
|
761
|
+
orgId: context.orgId,
|
|
762
|
+
userId: context.userId,
|
|
763
|
+
modelId
|
|
764
|
+
});
|
|
765
|
+
return c.json({
|
|
766
|
+
ok: true,
|
|
767
|
+
modelId
|
|
768
|
+
});
|
|
769
|
+
} catch (error) {
|
|
770
|
+
return c.json({ error: error instanceof Error ? error.message : String(error) }, 500);
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
}),
|
|
774
|
+
registerApiRoute("/web/config/default-model", {
|
|
775
|
+
method: "DELETE",
|
|
776
|
+
requiresAuth: false,
|
|
777
|
+
handler: async (c) => {
|
|
778
|
+
const context = await resolveModelDefaultsContext({
|
|
779
|
+
c: loose(c),
|
|
780
|
+
auth,
|
|
781
|
+
modelDefaults: options.modelDefaults
|
|
782
|
+
});
|
|
783
|
+
if ("response" in context) return context.response;
|
|
784
|
+
try {
|
|
785
|
+
await context.storage.clear({
|
|
786
|
+
orgId: context.orgId,
|
|
787
|
+
userId: context.userId
|
|
788
|
+
});
|
|
789
|
+
return c.json({
|
|
790
|
+
ok: true,
|
|
791
|
+
modelId: null
|
|
792
|
+
});
|
|
793
|
+
} catch (error) {
|
|
794
|
+
return c.json({ error: error instanceof Error ? error.message : String(error) }, 500);
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
}),
|
|
798
|
+
registerApiRoute("/web/config/thinking", {
|
|
799
|
+
method: "GET",
|
|
800
|
+
requiresAuth: false,
|
|
801
|
+
handler: async (c) => {
|
|
802
|
+
try {
|
|
803
|
+
const settings = loadSettings(options.settingsPath);
|
|
804
|
+
return c.json({
|
|
805
|
+
levels: THINKING_LEVEL_VALUES,
|
|
806
|
+
globalDefault: settings.preferences.thinkingLevel,
|
|
807
|
+
editable: (await deploymentThinkingAccess(loose(c))).ok
|
|
808
|
+
});
|
|
809
|
+
} catch (error) {
|
|
810
|
+
return c.json({ error: error instanceof Error ? error.message : String(error) }, 500);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
}),
|
|
814
|
+
registerApiRoute("/web/config/thinking", {
|
|
815
|
+
method: "PUT",
|
|
816
|
+
requiresAuth: false,
|
|
817
|
+
handler: async (c) => {
|
|
818
|
+
const access = await deploymentThinkingAccess(loose(c));
|
|
819
|
+
if (!access.ok) return c.json({
|
|
820
|
+
error: access.error,
|
|
821
|
+
...access.message ? { message: access.message } : {}
|
|
822
|
+
}, access.status);
|
|
823
|
+
let body;
|
|
824
|
+
try {
|
|
825
|
+
body = await c.req.json();
|
|
826
|
+
} catch {
|
|
827
|
+
return c.json({ error: "Invalid JSON body" }, 400);
|
|
828
|
+
}
|
|
829
|
+
const parsed = z.object({ globalDefault: z.custom(isThinkingLevelSetting) }).strict().safeParse(body);
|
|
830
|
+
if (!parsed.success) return c.json({ error: `Expected only globalDefault, one of: ${THINKING_LEVEL_VALUES.join(", ")}` }, 400);
|
|
831
|
+
const { globalDefault } = parsed.data;
|
|
832
|
+
try {
|
|
833
|
+
const settings = loadSettings(options.settingsPath);
|
|
834
|
+
settings.preferences.thinkingLevel = globalDefault;
|
|
835
|
+
saveSettings(settings, options.settingsPath);
|
|
836
|
+
return c.json({
|
|
837
|
+
ok: true,
|
|
838
|
+
globalDefault: settings.preferences.thinkingLevel
|
|
839
|
+
});
|
|
840
|
+
} catch (error) {
|
|
841
|
+
return c.json({ error: error instanceof Error ? error.message : String(error) }, 500);
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
}),
|
|
845
|
+
registerApiRoute("/web/config/om", {
|
|
846
|
+
method: "GET",
|
|
847
|
+
requiresAuth: false,
|
|
848
|
+
handler: async (c) => {
|
|
849
|
+
const resourceId = c.req.query("resourceId");
|
|
850
|
+
const scope = c.req.query("scope") || void 0;
|
|
851
|
+
const factoryProjectId = c.req.query("factoryId") || void 0;
|
|
852
|
+
const context = await resolveMemorySettingsContext({
|
|
853
|
+
c: loose(c),
|
|
854
|
+
auth,
|
|
855
|
+
memorySettings: options.memorySettings,
|
|
856
|
+
factoryProjectId,
|
|
857
|
+
factoryProjects: options.factoryProjects
|
|
858
|
+
});
|
|
859
|
+
if ("response" in context) return context.response;
|
|
860
|
+
try {
|
|
861
|
+
const record = await context.storage.get({
|
|
862
|
+
orgId: context.orgId,
|
|
863
|
+
userId: context.userId
|
|
864
|
+
});
|
|
865
|
+
const fallback = await factoryOmFallback(factoryProjectId);
|
|
866
|
+
const availableProviders = await resolveOMResponseContext(loose(c));
|
|
867
|
+
const sessionModelId = (resourceId ? await controller.getSessionByResource?.(resourceId, scope) : void 0)?.model.get();
|
|
868
|
+
return c.json({ config: readStoredOMConfig(record, sessionModelId || fallback, sessionModelId ? "live-session" : "configured-default", availableProviders) });
|
|
869
|
+
} catch (error) {
|
|
870
|
+
return c.json({ error: error instanceof Error ? error.message : String(error) }, 500);
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
}),
|
|
874
|
+
registerApiRoute("/web/config/om/:role/model", {
|
|
875
|
+
method: "PUT",
|
|
876
|
+
requiresAuth: false,
|
|
877
|
+
handler: async (c) => {
|
|
878
|
+
const role = c.req.param("role");
|
|
879
|
+
if (role !== "observer" && role !== "reflector") return c.json({ error: `Unknown OM role "${role}"` }, 400);
|
|
880
|
+
let body;
|
|
881
|
+
try {
|
|
882
|
+
body = await c.req.json();
|
|
883
|
+
} catch {
|
|
884
|
+
return c.json({ error: "Invalid JSON body" }, 400);
|
|
885
|
+
}
|
|
886
|
+
const resourceId = typeof body.resourceId === "string" ? body.resourceId : "";
|
|
887
|
+
const scope = typeof body.scope === "string" && body.scope ? body.scope : void 0;
|
|
888
|
+
const factoryProjectId = typeof body.factoryId === "string" && body.factoryId ? body.factoryId : void 0;
|
|
889
|
+
const model = typeof body.modelId === "string" ? body.modelId.trim() : "";
|
|
890
|
+
if (!model) return c.json({ error: "Missing required field: modelId" }, 400);
|
|
891
|
+
const wantsAuto = model === "auto";
|
|
892
|
+
const context = await resolveMemorySettingsContext({
|
|
893
|
+
c: loose(c),
|
|
894
|
+
auth,
|
|
895
|
+
memorySettings: options.memorySettings,
|
|
896
|
+
factoryProjectId,
|
|
897
|
+
factoryProjects: options.factoryProjects
|
|
898
|
+
});
|
|
899
|
+
if ("response" in context) return context.response;
|
|
900
|
+
const availableProviders = await resolveOMResponseContext(loose(c));
|
|
901
|
+
try {
|
|
902
|
+
await persistMemorySettings(context, { [role === "observer" ? "observerModelId" : "reflectorModelId"]: wantsAuto ? null : model });
|
|
903
|
+
const record = await context.storage.get({
|
|
904
|
+
orgId: context.orgId,
|
|
905
|
+
userId: context.userId
|
|
906
|
+
});
|
|
907
|
+
const sessionModelId = (resourceId ? await controller.getSessionByResource?.(resourceId, scope) : void 0)?.model.get();
|
|
908
|
+
const config = readStoredOMConfig(record, sessionModelId || await factoryOmFallback(factoryProjectId), sessionModelId ? "live-session" : "configured-default", availableProviders);
|
|
909
|
+
return c.json({
|
|
910
|
+
ok: true,
|
|
911
|
+
config
|
|
912
|
+
});
|
|
913
|
+
} catch (error) {
|
|
914
|
+
return c.json({ error: error instanceof Error ? error.message : String(error) }, 500);
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
}),
|
|
918
|
+
registerApiRoute("/web/config/om/thresholds", {
|
|
919
|
+
method: "PUT",
|
|
920
|
+
requiresAuth: false,
|
|
921
|
+
handler: async (c) => {
|
|
922
|
+
let body;
|
|
923
|
+
try {
|
|
924
|
+
body = await c.req.json();
|
|
925
|
+
} catch {
|
|
926
|
+
return c.json({ error: "Invalid JSON body" }, 400);
|
|
927
|
+
}
|
|
928
|
+
const resourceId = typeof body.resourceId === "string" ? body.resourceId : "";
|
|
929
|
+
const scope = typeof body.scope === "string" && body.scope ? body.scope : void 0;
|
|
930
|
+
const factoryProjectId = typeof body.factoryId === "string" && body.factoryId ? body.factoryId : void 0;
|
|
931
|
+
const observation = typeof body.observationThreshold === "number" && body.observationThreshold > 0 ? Math.round(body.observationThreshold) : void 0;
|
|
932
|
+
const reflection = typeof body.reflectionThreshold === "number" && body.reflectionThreshold > 0 ? Math.round(body.reflectionThreshold) : void 0;
|
|
933
|
+
if (observation === void 0 && reflection === void 0) return c.json({ error: "Provide observationThreshold and/or reflectionThreshold (positive numbers)" }, 400);
|
|
934
|
+
const context = await resolveMemorySettingsContext({
|
|
935
|
+
c: loose(c),
|
|
936
|
+
auth,
|
|
937
|
+
memorySettings: options.memorySettings,
|
|
938
|
+
factoryProjectId,
|
|
939
|
+
factoryProjects: options.factoryProjects
|
|
940
|
+
});
|
|
941
|
+
if ("response" in context) return context.response;
|
|
942
|
+
const availableProviders = await resolveOMResponseContext(loose(c));
|
|
943
|
+
try {
|
|
944
|
+
await persistMemorySettings(context, {
|
|
945
|
+
...observation !== void 0 ? { observationThreshold: observation } : {},
|
|
946
|
+
...reflection !== void 0 ? { reflectionThreshold: reflection } : {}
|
|
947
|
+
});
|
|
948
|
+
const record = await context.storage.get({
|
|
949
|
+
orgId: context.orgId,
|
|
950
|
+
userId: context.userId
|
|
951
|
+
});
|
|
952
|
+
const sessionModelId = (resourceId ? await controller.getSessionByResource?.(resourceId, scope) : void 0)?.model.get();
|
|
953
|
+
const config = readStoredOMConfig(record, sessionModelId || await factoryOmFallback(factoryProjectId), sessionModelId ? "live-session" : "configured-default", availableProviders);
|
|
954
|
+
return c.json({
|
|
955
|
+
ok: true,
|
|
956
|
+
config
|
|
957
|
+
});
|
|
958
|
+
} catch (error) {
|
|
959
|
+
return c.json({ error: error instanceof Error ? error.message : String(error) }, 500);
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
}),
|
|
963
|
+
registerApiRoute("/web/config/om/observe-attachments", {
|
|
964
|
+
method: "PUT",
|
|
965
|
+
requiresAuth: false,
|
|
966
|
+
handler: async (c) => {
|
|
967
|
+
let body;
|
|
968
|
+
try {
|
|
969
|
+
body = await c.req.json();
|
|
970
|
+
} catch {
|
|
971
|
+
return c.json({ error: "Invalid JSON body" }, 400);
|
|
972
|
+
}
|
|
973
|
+
const resourceId = typeof body.resourceId === "string" ? body.resourceId : "";
|
|
974
|
+
const scope = typeof body.scope === "string" && body.scope ? body.scope : void 0;
|
|
975
|
+
const factoryProjectId = typeof body.factoryId === "string" && body.factoryId ? body.factoryId : void 0;
|
|
976
|
+
const raw = body.value;
|
|
977
|
+
const value = raw === "auto" || raw === true || raw === false ? raw : "auto";
|
|
978
|
+
if (raw !== "auto" && raw !== true && raw !== false) return c.json({ error: "value must be 'auto', true, or false" }, 400);
|
|
979
|
+
const context = await resolveMemorySettingsContext({
|
|
980
|
+
c: loose(c),
|
|
981
|
+
auth,
|
|
982
|
+
memorySettings: options.memorySettings,
|
|
983
|
+
factoryProjectId,
|
|
984
|
+
factoryProjects: options.factoryProjects
|
|
985
|
+
});
|
|
986
|
+
if ("response" in context) return context.response;
|
|
987
|
+
const availableProviders = await resolveOMResponseContext(loose(c));
|
|
988
|
+
try {
|
|
989
|
+
await persistMemorySettings(context, { observeAttachments: value });
|
|
990
|
+
const record = await context.storage.get({
|
|
991
|
+
orgId: context.orgId,
|
|
992
|
+
userId: context.userId
|
|
993
|
+
});
|
|
994
|
+
const sessionModelId = (resourceId ? await controller.getSessionByResource?.(resourceId, scope) : void 0)?.model.get();
|
|
995
|
+
const config = readStoredOMConfig(record, sessionModelId || await factoryOmFallback(factoryProjectId), sessionModelId ? "live-session" : "configured-default", availableProviders);
|
|
996
|
+
return c.json({
|
|
997
|
+
ok: true,
|
|
998
|
+
config
|
|
999
|
+
});
|
|
1000
|
+
} catch (error) {
|
|
1001
|
+
return c.json({ error: error instanceof Error ? error.message : String(error) }, 500);
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
})
|
|
1005
|
+
];
|
|
1006
|
+
}
|
|
1007
|
+
};
|
|
1008
|
+
//#endregion
|
|
1009
|
+
export { ConfigRoutes, DEPLOYMENT_MODEL_PROVIDERS, buildProviderAccess, isDeploymentModelProvider, listProviders, resolveDeploymentModelProviders };
|
|
1010
|
+
|
|
1011
|
+
//# sourceMappingURL=config.js.map
|