@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,916 @@
|
|
|
1
|
+
import { requireExec } from "../sandbox/materialization.js";
|
|
2
|
+
import { peekSessionSandbox, sessionLayout } from "../sandbox/session-sandbox.js";
|
|
3
|
+
import { peekSessionEnvironment } from "../session/environment-state-processor.js";
|
|
4
|
+
import { waitForPendingFilesystemCapture } from "../session/filesystem-capture.js";
|
|
5
|
+
import { registerApiRoute } from "@mastra/core/server";
|
|
6
|
+
import { isAbsolute, join, posix, resolve, sep } from "path";
|
|
7
|
+
import { SandboxFilesystem } from "@mastra/code-sdk/agents/sandbox-filesystem";
|
|
8
|
+
import { lstat, open, readdir, realpath, stat } from "fs/promises";
|
|
9
|
+
import { homedir } from "os";
|
|
10
|
+
import { detectProject, getResourceIdOverride } from "@mastra/code-sdk/utils/project";
|
|
11
|
+
//#region src/routes/fs.ts
|
|
12
|
+
const MAX_TEXT_FILE_BYTES = 512 * 1024;
|
|
13
|
+
const MAX_DIFF_BYTES = 512 * 1024;
|
|
14
|
+
const WORKSPACE_NUMSTAT_SCRIPT = `
|
|
15
|
+
set -e
|
|
16
|
+
workdir=$1
|
|
17
|
+
base=$2
|
|
18
|
+
index_file=$(mktemp)
|
|
19
|
+
untracked_file=$(mktemp)
|
|
20
|
+
object_dir=$(mktemp -d)
|
|
21
|
+
trap 'rm -f "$index_file" "$untracked_file"; rm -rf "$object_dir"' EXIT
|
|
22
|
+
rm -f "$index_file"
|
|
23
|
+
git -C "$workdir" diff --numstat -z --find-renames --no-ext-diff --no-textconv "$base"
|
|
24
|
+
git -C "$workdir" ls-files --others --exclude-standard -z >"$untracked_file"
|
|
25
|
+
git_dir=$(git -C "$workdir" rev-parse --absolute-git-dir)
|
|
26
|
+
export GIT_INDEX_FILE="$index_file"
|
|
27
|
+
export GIT_OBJECT_DIRECTORY="$object_dir"
|
|
28
|
+
export GIT_ALTERNATE_OBJECT_DIRECTORIES="$git_dir/objects"
|
|
29
|
+
git -C "$workdir" read-tree --empty
|
|
30
|
+
git -C "$workdir" update-index --add -z --stdin <"$untracked_file"
|
|
31
|
+
empty_tree=$(git -C "$workdir" hash-object -t tree /dev/null)
|
|
32
|
+
git -C "$workdir" diff --cached --numstat -z --no-ext-diff --no-textconv "$empty_tree"
|
|
33
|
+
`;
|
|
34
|
+
const BOUNDED_GIT_DIFF_SCRIPT = `
|
|
35
|
+
allow_exit_one=$1
|
|
36
|
+
shift
|
|
37
|
+
status_file=$(mktemp)
|
|
38
|
+
stderr_file=$(mktemp)
|
|
39
|
+
trap 'rm -f "$status_file" "$stderr_file"' EXIT
|
|
40
|
+
(
|
|
41
|
+
git "$@" 2>"$stderr_file"
|
|
42
|
+
printf '%s' "$?" >"$status_file"
|
|
43
|
+
) | head -c 524289
|
|
44
|
+
status=$(cat "$status_file")
|
|
45
|
+
case "$status" in
|
|
46
|
+
0|141) exit 0 ;;
|
|
47
|
+
1) [ "$allow_exit_one" = "1" ] && exit 0 ;;
|
|
48
|
+
esac
|
|
49
|
+
cat "$stderr_file" >&2
|
|
50
|
+
exit "\${status:-1}"
|
|
51
|
+
`;
|
|
52
|
+
const TEXT_DECODER = new TextDecoder("utf-8", { fatal: true });
|
|
53
|
+
const APPROVED_RENDERED_ROOTS = /* @__PURE__ */ new Set([".artifacts"]);
|
|
54
|
+
/** Erase a route handler's path-parameterized context to a plain `Context`. */
|
|
55
|
+
function loose(c) {
|
|
56
|
+
return c;
|
|
57
|
+
}
|
|
58
|
+
/** Resolve the browsable root, defaulting to the user's home directory. */
|
|
59
|
+
function resolveFsRoot(root) {
|
|
60
|
+
return resolve(root && root.trim() ? root : homedir());
|
|
61
|
+
}
|
|
62
|
+
/** True when `candidate` is `root` or nested under it. */
|
|
63
|
+
function isWithinRoot(candidate, root) {
|
|
64
|
+
if (candidate === root) return true;
|
|
65
|
+
const rootWithSep = root.endsWith(sep) ? root : root + sep;
|
|
66
|
+
return candidate.startsWith(rootWithSep);
|
|
67
|
+
}
|
|
68
|
+
async function realOrResolved(path) {
|
|
69
|
+
try {
|
|
70
|
+
return await realpath(path);
|
|
71
|
+
} catch {
|
|
72
|
+
return path;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Resolve a path's real location (following symlinks) and confirm it stays
|
|
77
|
+
* within `root`. Returns the real path when confined, or `null` when it escapes
|
|
78
|
+
* the root or does not exist. Used so a symlink inside the root that points
|
|
79
|
+
* outside it cannot be browsed or selected.
|
|
80
|
+
*/
|
|
81
|
+
async function realPathWithinRoot(candidate, root) {
|
|
82
|
+
try {
|
|
83
|
+
const real = await realpath(candidate);
|
|
84
|
+
return isWithinRoot(real, root) ? real : null;
|
|
85
|
+
} catch {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function assertRelativePath(path, label) {
|
|
90
|
+
const trimmed = path.trim();
|
|
91
|
+
if (!trimmed) throw new Error(`Missing required query param: ${label}`);
|
|
92
|
+
if (isAbsolute(trimmed)) throw new Error(`${label} must be relative`);
|
|
93
|
+
if (trimmed.split(/[\\/]+/).includes("..")) throw new Error(`${label} escapes workspace`);
|
|
94
|
+
const normalized = resolve("/", trimmed).slice(1);
|
|
95
|
+
if (!normalized || normalized === ".." || normalized.startsWith(`..${sep}`)) throw new Error(`${label} escapes workspace`);
|
|
96
|
+
return normalized;
|
|
97
|
+
}
|
|
98
|
+
function assertApprovedRenderedRoot(renderedRoot) {
|
|
99
|
+
const safeRoot = assertRelativePath(renderedRoot, "root");
|
|
100
|
+
if (!APPROVED_RENDERED_ROOTS.has(safeRoot)) throw new Error("Root is not approved for rendered workspace access");
|
|
101
|
+
return safeRoot;
|
|
102
|
+
}
|
|
103
|
+
async function confinedWorkspacePath(root, workspacePath) {
|
|
104
|
+
const resolvedRoot = await realOrResolved(resolveFsRoot(root));
|
|
105
|
+
const workspace = await realPathWithinRoot(isAbsolute(workspacePath) ? resolve(workspacePath) : resolve(resolvedRoot, workspacePath), resolvedRoot);
|
|
106
|
+
if (!workspace) throw new Error("Path is outside the browsable root");
|
|
107
|
+
return {
|
|
108
|
+
resolvedRoot,
|
|
109
|
+
workspace
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
async function confinedWorkspaceRelativePath(root, workspacePath, relativePath) {
|
|
113
|
+
const safeRelativePath = assertRelativePath(relativePath, "path");
|
|
114
|
+
const { workspace } = await confinedWorkspacePath(root, workspacePath);
|
|
115
|
+
const candidate = resolve(workspace, safeRelativePath);
|
|
116
|
+
if (!isWithinRoot(candidate, workspace)) throw new Error("Path escapes workspace");
|
|
117
|
+
const confinedPath = await realPathWithinRoot(candidate, workspace);
|
|
118
|
+
if (!confinedPath) throw new Error("Path is outside the workspace");
|
|
119
|
+
return {
|
|
120
|
+
workspace,
|
|
121
|
+
path: confinedPath,
|
|
122
|
+
relativePath: safeRelativePath
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* List the directories inside `requestedPath`, confined to `root`. An absent or
|
|
127
|
+
* out-of-root path is clamped to the root, so the worst a malicious client can
|
|
128
|
+
* do is browse within the allowed root.
|
|
129
|
+
*/
|
|
130
|
+
async function listDirectory(root, requestedPath) {
|
|
131
|
+
const resolvedRoot = await realOrResolved(resolveFsRoot(root));
|
|
132
|
+
let target = resolvedRoot;
|
|
133
|
+
if (requestedPath && requestedPath.trim()) target = await realPathWithinRoot(isAbsolute(requestedPath) ? resolve(requestedPath) : resolve(resolvedRoot, requestedPath), resolvedRoot) ?? resolvedRoot;
|
|
134
|
+
try {
|
|
135
|
+
if (!(await stat(target)).isDirectory()) target = resolvedRoot;
|
|
136
|
+
} catch {
|
|
137
|
+
target = resolvedRoot;
|
|
138
|
+
}
|
|
139
|
+
const dirents = await readdir(target, { withFileTypes: true });
|
|
140
|
+
const entries = [];
|
|
141
|
+
for (const dirent of dirents) {
|
|
142
|
+
if (dirent.name.startsWith(".")) continue;
|
|
143
|
+
const entryPath = join(target, dirent.name);
|
|
144
|
+
let isDir = dirent.isDirectory();
|
|
145
|
+
if (dirent.isSymbolicLink()) {
|
|
146
|
+
const real = await realPathWithinRoot(entryPath, resolvedRoot);
|
|
147
|
+
isDir = real ? (await stat(real).catch(() => null))?.isDirectory() === true : false;
|
|
148
|
+
}
|
|
149
|
+
if (isDir) entries.push({
|
|
150
|
+
name: dirent.name,
|
|
151
|
+
path: entryPath
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
entries.sort((a, b) => a.name.localeCompare(b.name));
|
|
155
|
+
const parent = target === resolvedRoot ? null : resolve(target, "..");
|
|
156
|
+
return {
|
|
157
|
+
root: resolvedRoot,
|
|
158
|
+
path: target,
|
|
159
|
+
parent,
|
|
160
|
+
entries
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
async function listRenderedEntries(rootPath, currentPath = rootPath) {
|
|
164
|
+
const dirents = await readdir(currentPath, { withFileTypes: true });
|
|
165
|
+
const entries = [];
|
|
166
|
+
for (const dirent of dirents) {
|
|
167
|
+
const entryPath = join(currentPath, dirent.name);
|
|
168
|
+
const info = await lstat(entryPath);
|
|
169
|
+
const relativePath = entryPath.slice(rootPath.length + 1);
|
|
170
|
+
if (info.isDirectory()) {
|
|
171
|
+
entries.push({
|
|
172
|
+
name: dirent.name,
|
|
173
|
+
path: relativePath,
|
|
174
|
+
type: "directory",
|
|
175
|
+
size: info.size,
|
|
176
|
+
updatedAt: info.mtime.toISOString()
|
|
177
|
+
});
|
|
178
|
+
entries.push(...await listRenderedEntries(rootPath, entryPath));
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
if (info.isFile()) entries.push({
|
|
182
|
+
name: dirent.name,
|
|
183
|
+
path: relativePath,
|
|
184
|
+
type: "file",
|
|
185
|
+
size: info.size,
|
|
186
|
+
updatedAt: info.mtime.toISOString()
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
return entries.sort((a, b) => a.path.localeCompare(b.path));
|
|
190
|
+
}
|
|
191
|
+
async function listWorkspaceRenderedPath(root, workspacePath, renderedRoot) {
|
|
192
|
+
const safeRoot = assertApprovedRenderedRoot(renderedRoot);
|
|
193
|
+
const { workspace } = await confinedWorkspacePath(root, workspacePath);
|
|
194
|
+
const renderedPath = resolve(workspace, safeRoot);
|
|
195
|
+
if (!isWithinRoot(renderedPath, workspace)) throw new Error("Root escapes workspace");
|
|
196
|
+
const confinedRootPath = await realPathWithinRoot(renderedPath, workspace);
|
|
197
|
+
if (!confinedRootPath) return {
|
|
198
|
+
workspacePath: workspace,
|
|
199
|
+
root: safeRoot,
|
|
200
|
+
rootPath: renderedPath,
|
|
201
|
+
entries: []
|
|
202
|
+
};
|
|
203
|
+
if (!(await stat(confinedRootPath)).isDirectory()) return {
|
|
204
|
+
workspacePath: workspace,
|
|
205
|
+
root: safeRoot,
|
|
206
|
+
rootPath: confinedRootPath,
|
|
207
|
+
entries: []
|
|
208
|
+
};
|
|
209
|
+
return {
|
|
210
|
+
workspacePath: workspace,
|
|
211
|
+
root: safeRoot,
|
|
212
|
+
rootPath: confinedRootPath,
|
|
213
|
+
entries: await listRenderedEntries(confinedRootPath)
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
async function readWorkspaceFile(root, workspacePath, path) {
|
|
217
|
+
assertApprovedRenderedRoot(assertRelativePath(path, "path").split("/")[0] ?? "");
|
|
218
|
+
const { workspace, path: confinedPath, relativePath } = await confinedWorkspaceRelativePath(root, workspacePath, path);
|
|
219
|
+
const info = await lstat(confinedPath);
|
|
220
|
+
if (info.isDirectory()) throw new Error("Path is a directory");
|
|
221
|
+
if (!info.isFile()) throw new Error("Unsupported file type");
|
|
222
|
+
const bytesToRead = Math.min(info.size, MAX_TEXT_FILE_BYTES);
|
|
223
|
+
const contentBuffer = Buffer.alloc(bytesToRead);
|
|
224
|
+
const handle = await open(confinedPath, "r");
|
|
225
|
+
try {
|
|
226
|
+
await handle.read(contentBuffer, 0, bytesToRead, 0);
|
|
227
|
+
} finally {
|
|
228
|
+
await handle.close();
|
|
229
|
+
}
|
|
230
|
+
try {
|
|
231
|
+
const content = TEXT_DECODER.decode(contentBuffer);
|
|
232
|
+
return {
|
|
233
|
+
workspacePath: workspace,
|
|
234
|
+
path: relativePath,
|
|
235
|
+
name: relativePath.split("/").pop() ?? relativePath,
|
|
236
|
+
size: info.size,
|
|
237
|
+
updatedAt: info.mtime.toISOString(),
|
|
238
|
+
contentType: "text",
|
|
239
|
+
content,
|
|
240
|
+
truncated: info.size > MAX_TEXT_FILE_BYTES
|
|
241
|
+
};
|
|
242
|
+
} catch {
|
|
243
|
+
return {
|
|
244
|
+
workspacePath: workspace,
|
|
245
|
+
path: relativePath,
|
|
246
|
+
name: relativePath.split("/").pop() ?? relativePath,
|
|
247
|
+
size: info.size,
|
|
248
|
+
updatedAt: info.mtime.toISOString(),
|
|
249
|
+
contentType: "unsupported"
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
async function listArtifacts(root, workspacePath) {
|
|
254
|
+
const listing = await listWorkspaceRenderedPath(root, workspacePath, ".artifacts");
|
|
255
|
+
return {
|
|
256
|
+
rootPath: listing.workspacePath,
|
|
257
|
+
artifactsPath: listing.rootPath,
|
|
258
|
+
entries: listing.entries
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Resolve a `workspacePath` query param as a Factory session id. Returns the
|
|
263
|
+
* session when one exists and the caller owns it, `null` when no session
|
|
264
|
+
* matches (the caller should fall back to local-path handling), and throws
|
|
265
|
+
* when a session exists but belongs to another tenant.
|
|
266
|
+
*/
|
|
267
|
+
async function resolveAuthorizedSession(c, deps, workspacePath) {
|
|
268
|
+
if (!deps) return null;
|
|
269
|
+
const session = await deps.sessions.getBySessionId(workspacePath);
|
|
270
|
+
if (!session) return null;
|
|
271
|
+
if (deps.auth.enabled()) {
|
|
272
|
+
await deps.auth.ensureUser(c);
|
|
273
|
+
const tenant = deps.auth.tenant(c);
|
|
274
|
+
if (!tenant || tenant.orgId !== session.orgId || tenant.userId !== session.userId) throw new Error("Session is not available to the current user");
|
|
275
|
+
}
|
|
276
|
+
return session;
|
|
277
|
+
}
|
|
278
|
+
async function listSessionFilesystemFiles(filesystem, session, threadId) {
|
|
279
|
+
const safeThreadId = threadId.trim();
|
|
280
|
+
if (!safeThreadId) throw new Error("Missing required query param: threadId");
|
|
281
|
+
await waitForPendingFilesystemCapture(session.sessionId);
|
|
282
|
+
const layout = sessionLayout(peekSessionSandbox(session.id));
|
|
283
|
+
return {
|
|
284
|
+
workspacePath: session.sessionId,
|
|
285
|
+
threadId: safeThreadId,
|
|
286
|
+
files: await filesystem.listFiles({
|
|
287
|
+
resourceId: session.sessionId,
|
|
288
|
+
threadId: safeThreadId
|
|
289
|
+
}),
|
|
290
|
+
...layout && layout.repos.length > 1 ? { repositories: layout.repos.map((repo) => ({
|
|
291
|
+
slug: repo.slug,
|
|
292
|
+
prefix: repo.prefix
|
|
293
|
+
})) } : {}
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Resolve the session's sandbox from the per-process memo and wrap the
|
|
298
|
+
* session layout's root in a `SandboxFilesystem`: the checkout for a
|
|
299
|
+
* one-repository session, the workspace root (one directory per repository)
|
|
300
|
+
* otherwise. Returns `null` when the session has no sandbox in this process
|
|
301
|
+
* (never opened here, or evicted by retirement). This is a passive read path,
|
|
302
|
+
* so it never constructs or provisions: the session's files come back the
|
|
303
|
+
* next time the workspace is actually opened (e.g. by sending a message).
|
|
304
|
+
*/
|
|
305
|
+
async function sessionSandbox(session) {
|
|
306
|
+
const entry = peekSessionSandbox(session.id);
|
|
307
|
+
const layout = sessionLayout(entry);
|
|
308
|
+
if (!entry || !layout) return null;
|
|
309
|
+
const sandbox = requireExec(entry.sandbox);
|
|
310
|
+
return {
|
|
311
|
+
sandbox,
|
|
312
|
+
filesystem: new SandboxFilesystem({
|
|
313
|
+
sandbox,
|
|
314
|
+
workdir: layout.root
|
|
315
|
+
}),
|
|
316
|
+
layout,
|
|
317
|
+
baseBranches: repositoryBaseBranches(session, layout, entry.ownRepo)
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* The branch each layout repository is compared against: the session base
|
|
322
|
+
* branch for the session's own repository (session branch vs base), the
|
|
323
|
+
* default branch the boot recorded for every other one, `HEAD` (the checkout's
|
|
324
|
+
* own `origin/HEAD`) until the boot has recorded it.
|
|
325
|
+
*/
|
|
326
|
+
function repositoryBaseBranches(session, layout, ownRepo) {
|
|
327
|
+
const environment = layout.repos.length > 1 ? peekSessionEnvironment(session.sessionId) : void 0;
|
|
328
|
+
const bases = /* @__PURE__ */ new Map();
|
|
329
|
+
for (const repo of layout.repos) {
|
|
330
|
+
if (layout.repos.length === 1 || repo.slug.toLowerCase() === ownRepo.toLowerCase()) {
|
|
331
|
+
bases.set(repo.slug, session.baseBranch);
|
|
332
|
+
continue;
|
|
333
|
+
}
|
|
334
|
+
const state = environment?.repositories.find((candidate) => candidate.slug.toLowerCase() === repo.slug.toLowerCase());
|
|
335
|
+
bases.set(repo.slug, state?.defaultBranch ?? "HEAD");
|
|
336
|
+
}
|
|
337
|
+
return bases;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Split a client path into the layout repository it belongs to and the path
|
|
341
|
+
* inside that checkout. Longest prefix wins; the inside path is validated
|
|
342
|
+
* again so a prefix cannot smuggle a traversal. A path matching no repository
|
|
343
|
+
* (including a bare prefix) is not available: the file routes only serve the
|
|
344
|
+
* checkouts, never the workspace root itself.
|
|
345
|
+
*/
|
|
346
|
+
function resolveLayoutPath(layout, path, label) {
|
|
347
|
+
const safePath = assertRelativePath(path, label);
|
|
348
|
+
if (layout.repos.length === 1) return {
|
|
349
|
+
repo: layout.repos[0],
|
|
350
|
+
relative: safePath
|
|
351
|
+
};
|
|
352
|
+
const repo = layout.repos.filter((candidate) => safePath.startsWith(candidate.prefix) && safePath.length > candidate.prefix.length).toSorted((a, b) => b.prefix.length - a.prefix.length)[0];
|
|
353
|
+
if (!repo) throw new Error(`${label} is not available in this session's repositories`);
|
|
354
|
+
return {
|
|
355
|
+
repo,
|
|
356
|
+
relative: assertRelativePath(safePath.slice(repo.prefix.length), label)
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
/** List an approved rendered root inside a Factory session's sandbox workdir. */
|
|
360
|
+
async function listSessionRenderedPath(session, renderedRoot) {
|
|
361
|
+
const safeRoot = assertApprovedRenderedRoot(renderedRoot);
|
|
362
|
+
const handle = await sessionSandbox(session);
|
|
363
|
+
const rootPath = posix.join(handle?.layout.root ?? "", safeRoot);
|
|
364
|
+
const empty = {
|
|
365
|
+
workspacePath: session.sessionId,
|
|
366
|
+
root: safeRoot,
|
|
367
|
+
rootPath,
|
|
368
|
+
entries: []
|
|
369
|
+
};
|
|
370
|
+
if (!handle) return empty;
|
|
371
|
+
const quotedRoot = `'${rootPath.replace(/'/g, `'\\''`)}'`;
|
|
372
|
+
const result = await handle.sandbox.executeCommand("sh", ["-c", `test -d ${quotedRoot} && find ${quotedRoot} -mindepth 1 -printf '%y\\t%s\\t%T@\\t%p\\n' 2>/dev/null || true`], {
|
|
373
|
+
timeout: 3e4,
|
|
374
|
+
maxRetainedBytes: Infinity
|
|
375
|
+
});
|
|
376
|
+
if (result.exitCode !== 0) return empty;
|
|
377
|
+
const entries = [];
|
|
378
|
+
for (const line of result.stdout.split("\n")) {
|
|
379
|
+
if (!line) continue;
|
|
380
|
+
const [type, sizeStr, mtimeStr, ...pathParts] = line.split(" ");
|
|
381
|
+
const fullPath = pathParts.join(" ");
|
|
382
|
+
if (!fullPath || !fullPath.startsWith(`${rootPath}/`)) continue;
|
|
383
|
+
const relativePath = fullPath.slice(rootPath.length + 1);
|
|
384
|
+
entries.push({
|
|
385
|
+
name: posix.basename(relativePath),
|
|
386
|
+
path: relativePath,
|
|
387
|
+
type: type === "d" ? "directory" : "file",
|
|
388
|
+
size: type === "d" ? 0 : Number(sizeStr) || 0,
|
|
389
|
+
updatedAt: (/* @__PURE__ */ new Date((Number(mtimeStr) || 0) * 1e3)).toISOString()
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
entries.sort((a, b) => a.path.localeCompare(b.path));
|
|
393
|
+
return {
|
|
394
|
+
workspacePath: session.sessionId,
|
|
395
|
+
root: safeRoot,
|
|
396
|
+
rootPath,
|
|
397
|
+
entries
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
/** Read a file inside a session's sandbox. Paths outside rendered roots require a persisted-file allowlist check in the route. */
|
|
401
|
+
async function readSessionWorkspaceFile(session, path, options = {}) {
|
|
402
|
+
const safePath = assertRelativePath(path, "path");
|
|
403
|
+
if (!options.allowUnapprovedPath) assertApprovedRenderedRoot(safePath.split("/")[0] ?? "");
|
|
404
|
+
const handle = await sessionSandbox(session);
|
|
405
|
+
if (!handle) throw new Error("Session workspace is not available");
|
|
406
|
+
const { filesystem } = handle;
|
|
407
|
+
const info = await filesystem.stat(safePath);
|
|
408
|
+
if (info.type === "directory") throw new Error("Path is a directory");
|
|
409
|
+
const buffer = await filesystem.readFile(safePath);
|
|
410
|
+
const truncated = buffer.length > MAX_TEXT_FILE_BYTES;
|
|
411
|
+
const base = {
|
|
412
|
+
workspacePath: session.sessionId,
|
|
413
|
+
path: safePath,
|
|
414
|
+
name: posix.basename(safePath),
|
|
415
|
+
size: buffer.length,
|
|
416
|
+
updatedAt: info.modifiedAt.toISOString()
|
|
417
|
+
};
|
|
418
|
+
try {
|
|
419
|
+
const content = TEXT_DECODER.decode(truncated ? buffer.subarray(0, MAX_TEXT_FILE_BYTES) : buffer);
|
|
420
|
+
return {
|
|
421
|
+
...base,
|
|
422
|
+
contentType: "text",
|
|
423
|
+
content,
|
|
424
|
+
truncated
|
|
425
|
+
};
|
|
426
|
+
} catch {
|
|
427
|
+
return {
|
|
428
|
+
...base,
|
|
429
|
+
contentType: "unsupported"
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
function changeStatus(code) {
|
|
434
|
+
if (code === "??") return "untracked";
|
|
435
|
+
if (code.includes("U") || code === "AA" || code === "DD") return "conflicted";
|
|
436
|
+
if (code.includes("R")) return "renamed";
|
|
437
|
+
if (code.includes("C")) return "copied";
|
|
438
|
+
if (code.includes("D")) return "deleted";
|
|
439
|
+
if (code.includes("A")) return "added";
|
|
440
|
+
return "modified";
|
|
441
|
+
}
|
|
442
|
+
function parseWorkspaceChanges(output) {
|
|
443
|
+
const records = output.split("\0");
|
|
444
|
+
const changes = [];
|
|
445
|
+
for (let index = 0; index < records.length; index += 1) {
|
|
446
|
+
const record = records[index];
|
|
447
|
+
if (!record || record.length < 4) continue;
|
|
448
|
+
const code = record.slice(0, 2);
|
|
449
|
+
const path = record.slice(3);
|
|
450
|
+
const status = changeStatus(code);
|
|
451
|
+
if (status === "renamed" || status === "copied") {
|
|
452
|
+
const previousPath = records[index + 1];
|
|
453
|
+
if (previousPath) index += 1;
|
|
454
|
+
changes.push({
|
|
455
|
+
path,
|
|
456
|
+
previousPath: previousPath || void 0,
|
|
457
|
+
status
|
|
458
|
+
});
|
|
459
|
+
continue;
|
|
460
|
+
}
|
|
461
|
+
changes.push({
|
|
462
|
+
path,
|
|
463
|
+
status
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
return changes.toSorted((a, b) => a.path.localeCompare(b.path));
|
|
467
|
+
}
|
|
468
|
+
function parseWorkspaceTrackedChanges(output) {
|
|
469
|
+
const records = output.split("\0");
|
|
470
|
+
const changes = [];
|
|
471
|
+
for (let index = 0; index < records.length;) {
|
|
472
|
+
const code = records[index++];
|
|
473
|
+
if (!code) continue;
|
|
474
|
+
const status = changeStatus(code);
|
|
475
|
+
if (status === "renamed" || status === "copied") {
|
|
476
|
+
const previousPath = records[index++];
|
|
477
|
+
const path = records[index++];
|
|
478
|
+
if (path) changes.push({
|
|
479
|
+
path,
|
|
480
|
+
previousPath: previousPath || void 0,
|
|
481
|
+
status
|
|
482
|
+
});
|
|
483
|
+
continue;
|
|
484
|
+
}
|
|
485
|
+
const path = records[index++];
|
|
486
|
+
if (path) changes.push({
|
|
487
|
+
path,
|
|
488
|
+
status
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
return changes.toSorted((a, b) => a.path.localeCompare(b.path));
|
|
492
|
+
}
|
|
493
|
+
function parseWorkspaceChangeStats(output) {
|
|
494
|
+
const records = output.split("\0");
|
|
495
|
+
const stats = /* @__PURE__ */ new Map();
|
|
496
|
+
for (let index = 0; index < records.length; index += 1) {
|
|
497
|
+
const record = records[index];
|
|
498
|
+
if (!record) continue;
|
|
499
|
+
const firstTab = record.indexOf(" ");
|
|
500
|
+
const secondTab = record.indexOf(" ", firstTab + 1);
|
|
501
|
+
if (firstTab < 0 || secondTab < 0) continue;
|
|
502
|
+
const additionsText = record.slice(0, firstTab);
|
|
503
|
+
const deletionsText = record.slice(firstTab + 1, secondTab);
|
|
504
|
+
let path = record.slice(secondTab + 1);
|
|
505
|
+
if (!path) {
|
|
506
|
+
const renamedPath = records[index + 2];
|
|
507
|
+
if (!renamedPath) continue;
|
|
508
|
+
path = renamedPath;
|
|
509
|
+
index += 2;
|
|
510
|
+
}
|
|
511
|
+
if (path.startsWith("./")) path = path.slice(2);
|
|
512
|
+
if (additionsText === "-" || deletionsText === "-") {
|
|
513
|
+
stats.set(path, { binary: true });
|
|
514
|
+
continue;
|
|
515
|
+
}
|
|
516
|
+
const additions = Number(additionsText);
|
|
517
|
+
const deletions = Number(deletionsText);
|
|
518
|
+
if (Number.isFinite(additions) && Number.isFinite(deletions)) stats.set(path, {
|
|
519
|
+
additions,
|
|
520
|
+
deletions
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
return stats;
|
|
524
|
+
}
|
|
525
|
+
function unavailableWorkspaceChanges(workspacePath) {
|
|
526
|
+
return {
|
|
527
|
+
workspacePath,
|
|
528
|
+
available: false,
|
|
529
|
+
changes: []
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
async function resolveSessionComparisonBase(sandbox, workdir, baseBranch) {
|
|
533
|
+
const result = await sandbox.executeCommand("git", [
|
|
534
|
+
"-C",
|
|
535
|
+
workdir,
|
|
536
|
+
"merge-base",
|
|
537
|
+
"HEAD",
|
|
538
|
+
`origin/${baseBranch}`
|
|
539
|
+
], { timeout: 3e4 });
|
|
540
|
+
const sha = result.stdout.trim();
|
|
541
|
+
return result.exitCode === 0 && /^[0-9a-f]{40,64}$/i.test(sha) ? sha : "HEAD";
|
|
542
|
+
}
|
|
543
|
+
/** The changes of one checkout against its comparison base; `available: false` when git cannot inspect it. */
|
|
544
|
+
async function listRepositoryChanges(sandbox, workdir, baseBranch) {
|
|
545
|
+
const comparisonBase = await resolveSessionComparisonBase(sandbox, workdir, baseBranch);
|
|
546
|
+
const [statusResult, trackedResult, statsResult] = await Promise.all([
|
|
547
|
+
sandbox.executeCommand("git", [
|
|
548
|
+
"-C",
|
|
549
|
+
workdir,
|
|
550
|
+
"status",
|
|
551
|
+
"--porcelain=v1",
|
|
552
|
+
"-z",
|
|
553
|
+
"--untracked-files=all"
|
|
554
|
+
], {
|
|
555
|
+
timeout: 3e4,
|
|
556
|
+
maxRetainedBytes: Infinity
|
|
557
|
+
}),
|
|
558
|
+
sandbox.executeCommand("git", [
|
|
559
|
+
"-C",
|
|
560
|
+
workdir,
|
|
561
|
+
"diff",
|
|
562
|
+
"--name-status",
|
|
563
|
+
"-z",
|
|
564
|
+
"--find-renames",
|
|
565
|
+
comparisonBase
|
|
566
|
+
], {
|
|
567
|
+
timeout: 3e4,
|
|
568
|
+
maxRetainedBytes: Infinity
|
|
569
|
+
}),
|
|
570
|
+
sandbox.executeCommand("sh", [
|
|
571
|
+
"-c",
|
|
572
|
+
WORKSPACE_NUMSTAT_SCRIPT,
|
|
573
|
+
"mastracode-numstat",
|
|
574
|
+
workdir,
|
|
575
|
+
comparisonBase
|
|
576
|
+
], {
|
|
577
|
+
timeout: 3e4,
|
|
578
|
+
maxRetainedBytes: Infinity
|
|
579
|
+
})
|
|
580
|
+
]);
|
|
581
|
+
if (statusResult.exitCode !== 0) return {
|
|
582
|
+
available: false,
|
|
583
|
+
changes: []
|
|
584
|
+
};
|
|
585
|
+
const statusChanges = parseWorkspaceChanges(statusResult.stdout);
|
|
586
|
+
const trackedChanges = trackedResult.exitCode === 0 ? parseWorkspaceTrackedChanges(trackedResult.stdout) : [];
|
|
587
|
+
const changesByPath = new Map(trackedChanges.map((change) => [change.path, change]));
|
|
588
|
+
for (const change of statusChanges) if (trackedResult.exitCode !== 0 || change.status === "untracked" || change.status === "conflicted") changesByPath.set(change.path, change);
|
|
589
|
+
const changes = [...changesByPath.values()].toSorted((a, b) => a.path.localeCompare(b.path));
|
|
590
|
+
if (statsResult.exitCode !== 0) return {
|
|
591
|
+
available: true,
|
|
592
|
+
changes
|
|
593
|
+
};
|
|
594
|
+
const stats = parseWorkspaceChangeStats(statsResult.stdout);
|
|
595
|
+
let additions = 0;
|
|
596
|
+
let deletions = 0;
|
|
597
|
+
return {
|
|
598
|
+
available: true,
|
|
599
|
+
changes: changes.map((change) => {
|
|
600
|
+
const changeStats = stats.get(change.path);
|
|
601
|
+
additions += changeStats?.additions ?? 0;
|
|
602
|
+
deletions += changeStats?.deletions ?? 0;
|
|
603
|
+
return {
|
|
604
|
+
...change,
|
|
605
|
+
...changeStats
|
|
606
|
+
};
|
|
607
|
+
}),
|
|
608
|
+
additions,
|
|
609
|
+
deletions
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
function prefixChange(change, prefix) {
|
|
613
|
+
if (!prefix) return change;
|
|
614
|
+
return {
|
|
615
|
+
...change,
|
|
616
|
+
path: `${prefix}${change.path}`,
|
|
617
|
+
...change.previousPath ? { previousPath: `${prefix}${change.previousPath}` } : {}
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
async function listSessionWorkspaceChanges(session) {
|
|
621
|
+
const handle = await sessionSandbox(session);
|
|
622
|
+
if (!handle) return unavailableWorkspaceChanges(session.sessionId);
|
|
623
|
+
const { layout, baseBranches: bases } = handle;
|
|
624
|
+
if (layout.repos.length === 1) {
|
|
625
|
+
const repo = layout.repos[0];
|
|
626
|
+
const result = await listRepositoryChanges(handle.sandbox, repo.dir, bases.get(repo.slug) ?? session.baseBranch);
|
|
627
|
+
if (!result.available) return unavailableWorkspaceChanges(session.sessionId);
|
|
628
|
+
return {
|
|
629
|
+
workspacePath: session.sessionId,
|
|
630
|
+
...result
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
const groups = await Promise.all(layout.repos.map(async (repo) => {
|
|
634
|
+
const result = await listRepositoryChanges(handle.sandbox, repo.dir, bases.get(repo.slug));
|
|
635
|
+
return {
|
|
636
|
+
slug: repo.slug,
|
|
637
|
+
prefix: repo.prefix,
|
|
638
|
+
...result,
|
|
639
|
+
changes: result.changes.map((change) => prefixChange(change, repo.prefix))
|
|
640
|
+
};
|
|
641
|
+
}));
|
|
642
|
+
const available = groups.filter((group) => group.available);
|
|
643
|
+
const changes = available.flatMap((group) => group.changes).toSorted((a, b) => a.path.localeCompare(b.path));
|
|
644
|
+
const counted = available.filter((group) => group.additions !== void 0);
|
|
645
|
+
const totals = counted.length > 0 ? {
|
|
646
|
+
additions: counted.reduce((sum, group) => sum + (group.additions ?? 0), 0),
|
|
647
|
+
deletions: counted.reduce((sum, group) => sum + (group.deletions ?? 0), 0)
|
|
648
|
+
} : {};
|
|
649
|
+
return {
|
|
650
|
+
workspacePath: session.sessionId,
|
|
651
|
+
available: available.length > 0,
|
|
652
|
+
changes,
|
|
653
|
+
...totals,
|
|
654
|
+
repositories: groups
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
async function executeBoundedGitDiff(sandbox, args, allowExitOne = false) {
|
|
658
|
+
return sandbox.executeCommand("sh", [
|
|
659
|
+
"-c",
|
|
660
|
+
BOUNDED_GIT_DIFF_SCRIPT,
|
|
661
|
+
"mastracode-diff",
|
|
662
|
+
allowExitOne ? "1" : "0",
|
|
663
|
+
...args
|
|
664
|
+
], { timeout: 3e4 });
|
|
665
|
+
}
|
|
666
|
+
function truncatePatch(patchBuffer) {
|
|
667
|
+
const patch = patchBuffer.subarray(0, MAX_DIFF_BYTES).toString("utf8");
|
|
668
|
+
const lastNewline = patch.lastIndexOf("\n");
|
|
669
|
+
if (lastNewline >= 0) return patch.slice(0, lastNewline + 1);
|
|
670
|
+
return patch.replace(/\uFFFD+$/, "");
|
|
671
|
+
}
|
|
672
|
+
async function readSessionWorkspaceDiff(session, path, previousPath) {
|
|
673
|
+
const safePath = assertRelativePath(path, "path");
|
|
674
|
+
if (previousPath) assertRelativePath(previousPath, "previousPath");
|
|
675
|
+
const handle = await sessionSandbox(session);
|
|
676
|
+
if (!handle) throw new Error("Session workspace is not available");
|
|
677
|
+
const target = resolveLayoutPath(handle.layout, safePath, "path");
|
|
678
|
+
const previous = previousPath ? resolveLayoutPath(handle.layout, previousPath, "previousPath") : void 0;
|
|
679
|
+
if (previous && previous.repo !== target.repo) throw new Error("previousPath is not available in the repository of path");
|
|
680
|
+
const workdir = target.repo.dir;
|
|
681
|
+
const comparisonBase = await resolveSessionComparisonBase(handle.sandbox, workdir, handle.baseBranches.get(target.repo.slug));
|
|
682
|
+
const pathspecs = previous ? [previous.relative, target.relative] : [target.relative];
|
|
683
|
+
let result = await executeBoundedGitDiff(handle.sandbox, [
|
|
684
|
+
"--literal-pathspecs",
|
|
685
|
+
"-C",
|
|
686
|
+
workdir,
|
|
687
|
+
"diff",
|
|
688
|
+
"--find-renames",
|
|
689
|
+
"--no-ext-diff",
|
|
690
|
+
"--no-color",
|
|
691
|
+
"--unified=3",
|
|
692
|
+
comparisonBase,
|
|
693
|
+
"--",
|
|
694
|
+
...pathspecs
|
|
695
|
+
]);
|
|
696
|
+
if (result.exitCode !== 0) throw new Error(result.stderr || "Unable to read workspace diff");
|
|
697
|
+
if (!result.stdout) {
|
|
698
|
+
const untracked = await handle.sandbox.executeCommand("git", [
|
|
699
|
+
"--literal-pathspecs",
|
|
700
|
+
"-C",
|
|
701
|
+
workdir,
|
|
702
|
+
"ls-files",
|
|
703
|
+
"--others",
|
|
704
|
+
"--exclude-standard",
|
|
705
|
+
"--",
|
|
706
|
+
target.relative
|
|
707
|
+
], {
|
|
708
|
+
timeout: 3e4,
|
|
709
|
+
maxRetainedBytes: Infinity
|
|
710
|
+
});
|
|
711
|
+
if (untracked.exitCode === 0 && untracked.stdout.trim()) {
|
|
712
|
+
result = await executeBoundedGitDiff(handle.sandbox, [
|
|
713
|
+
"-C",
|
|
714
|
+
workdir,
|
|
715
|
+
"diff",
|
|
716
|
+
"--no-index",
|
|
717
|
+
"--no-ext-diff",
|
|
718
|
+
"--no-color",
|
|
719
|
+
"--unified=3",
|
|
720
|
+
"--",
|
|
721
|
+
"/dev/null",
|
|
722
|
+
target.relative
|
|
723
|
+
], true);
|
|
724
|
+
if (result.exitCode !== 0 && result.exitCode !== 1) throw new Error(result.stderr || "Unable to read workspace diff");
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
const patchBuffer = Buffer.from(result.stdout);
|
|
728
|
+
const truncated = patchBuffer.length > MAX_DIFF_BYTES;
|
|
729
|
+
return {
|
|
730
|
+
workspacePath: session.sessionId,
|
|
731
|
+
path: safePath,
|
|
732
|
+
patch: truncated ? truncatePatch(patchBuffer) : result.stdout,
|
|
733
|
+
truncated
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Resolve a project path to the same resourceId the TUI uses. Mirrors
|
|
738
|
+
* `createMastraCode`: detect the project, then apply any resourceId override
|
|
739
|
+
* (MASTRA_RESOURCE_ID env var or `.mastracode/database.json`). This is the
|
|
740
|
+
* shared continuity point — start in the TUI, continue on the web, same path
|
|
741
|
+
* → same resourceId → same session.
|
|
742
|
+
*/
|
|
743
|
+
function resolveCodebase(projectPath) {
|
|
744
|
+
const info = detectProject(projectPath);
|
|
745
|
+
return {
|
|
746
|
+
resourceId: getResourceIdOverride(info.rootPath) ?? info.resourceId,
|
|
747
|
+
name: info.name,
|
|
748
|
+
rootPath: info.rootPath,
|
|
749
|
+
gitUrl: info.gitUrl,
|
|
750
|
+
gitBranch: info.gitBranch
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Build the web filesystem routes as Mastra `apiRoutes`:
|
|
755
|
+
* - `GET /web/fs/list?path=...` — browse directories (confined to root)
|
|
756
|
+
* - `GET /web/codebase/resolve?path=...` — TUI-compatible codebase resourceId
|
|
757
|
+
*/
|
|
758
|
+
function buildFsRoutes(options = {}) {
|
|
759
|
+
const root = resolveFsRoot(options.root);
|
|
760
|
+
const sessionFs = options.sessionFs;
|
|
761
|
+
return [
|
|
762
|
+
registerApiRoute("/web/fs/list", {
|
|
763
|
+
method: "GET",
|
|
764
|
+
requiresAuth: false,
|
|
765
|
+
handler: async (c) => {
|
|
766
|
+
const path = c.req.query("path");
|
|
767
|
+
try {
|
|
768
|
+
const listing = await listDirectory(root, path);
|
|
769
|
+
return c.json(listing);
|
|
770
|
+
} catch (error) {
|
|
771
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
772
|
+
return c.json({ error: message }, 500);
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
}),
|
|
776
|
+
registerApiRoute("/web/artifacts/list", {
|
|
777
|
+
method: "GET",
|
|
778
|
+
requiresAuth: false,
|
|
779
|
+
handler: async (c) => {
|
|
780
|
+
const path = c.req.query("path");
|
|
781
|
+
if (!path) return c.json({ error: "Missing required query param: path" }, 400);
|
|
782
|
+
try {
|
|
783
|
+
return c.json(await listArtifacts(root, path));
|
|
784
|
+
} catch (error) {
|
|
785
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
786
|
+
const status = message === "Path is outside the browsable root" ? 403 : 500;
|
|
787
|
+
return c.json({ error: message }, status);
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}),
|
|
791
|
+
registerApiRoute("/web/workspace/rendered/list", {
|
|
792
|
+
method: "GET",
|
|
793
|
+
requiresAuth: false,
|
|
794
|
+
handler: async (c) => {
|
|
795
|
+
const workspacePath = c.req.query("workspacePath");
|
|
796
|
+
const renderedRoot = c.req.query("root");
|
|
797
|
+
if (!workspacePath) return c.json({ error: "Missing required query param: workspacePath" }, 400);
|
|
798
|
+
if (!renderedRoot) return c.json({ error: "Missing required query param: root" }, 400);
|
|
799
|
+
try {
|
|
800
|
+
const session = await resolveAuthorizedSession(loose(c), sessionFs, workspacePath);
|
|
801
|
+
if (session && sessionFs) return c.json(await listSessionRenderedPath(session, renderedRoot));
|
|
802
|
+
return c.json(await listWorkspaceRenderedPath(root, workspacePath, renderedRoot));
|
|
803
|
+
} catch (error) {
|
|
804
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
805
|
+
const status = message.includes("outside") || message.includes("relative") || message.includes("escapes") || message.includes("not approved") || message.includes("not available") ? 403 : 500;
|
|
806
|
+
return c.json({ error: message }, status);
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
}),
|
|
810
|
+
registerApiRoute("/web/workspace/files", {
|
|
811
|
+
method: "GET",
|
|
812
|
+
requiresAuth: false,
|
|
813
|
+
handler: async (c) => {
|
|
814
|
+
const workspacePath = c.req.query("workspacePath");
|
|
815
|
+
const threadId = c.req.query("threadId")?.trim();
|
|
816
|
+
if (!workspacePath) return c.json({ error: "Missing required query param: workspacePath" }, 400);
|
|
817
|
+
if (!threadId) return c.json({ error: "Missing required query param: threadId" }, 400);
|
|
818
|
+
try {
|
|
819
|
+
const session = await resolveAuthorizedSession(loose(c), sessionFs, workspacePath);
|
|
820
|
+
if (!session || !sessionFs) return c.json({ error: "Session workspace is not available" }, 403);
|
|
821
|
+
return c.json(await listSessionFilesystemFiles(sessionFs.filesystem, session, threadId));
|
|
822
|
+
} catch (error) {
|
|
823
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
824
|
+
const status = message.includes("not available") ? 403 : 500;
|
|
825
|
+
return c.json({ error: message }, status);
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
}),
|
|
829
|
+
registerApiRoute("/web/workspace/changes", {
|
|
830
|
+
method: "GET",
|
|
831
|
+
requiresAuth: false,
|
|
832
|
+
handler: async (c) => {
|
|
833
|
+
const workspacePath = c.req.query("workspacePath");
|
|
834
|
+
if (!workspacePath) return c.json({ error: "Missing required query param: workspacePath" }, 400);
|
|
835
|
+
try {
|
|
836
|
+
const session = await resolveAuthorizedSession(loose(c), sessionFs, workspacePath);
|
|
837
|
+
if (!session || !sessionFs) return c.json(unavailableWorkspaceChanges(workspacePath));
|
|
838
|
+
return c.json(await listSessionWorkspaceChanges(session));
|
|
839
|
+
} catch (error) {
|
|
840
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
841
|
+
return c.json({ error: message }, message.includes("not available") ? 403 : 500);
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
}),
|
|
845
|
+
registerApiRoute("/web/workspace/changes/diff", {
|
|
846
|
+
method: "GET",
|
|
847
|
+
requiresAuth: false,
|
|
848
|
+
handler: async (c) => {
|
|
849
|
+
const workspacePath = c.req.query("workspacePath");
|
|
850
|
+
const path = c.req.query("path");
|
|
851
|
+
const previousPath = c.req.query("previousPath");
|
|
852
|
+
if (!workspacePath) return c.json({ error: "Missing required query param: workspacePath" }, 400);
|
|
853
|
+
if (!path) return c.json({ error: "Missing required query param: path" }, 400);
|
|
854
|
+
try {
|
|
855
|
+
const session = await resolveAuthorizedSession(loose(c), sessionFs, workspacePath);
|
|
856
|
+
if (!session || !sessionFs) return c.json({ error: "Session workspace is not available" }, 403);
|
|
857
|
+
return c.json(await readSessionWorkspaceDiff(session, path, previousPath));
|
|
858
|
+
} catch (error) {
|
|
859
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
860
|
+
const status = message.includes("relative") || message.includes("escapes") || message.includes("not available") ? 403 : 500;
|
|
861
|
+
return c.json({ error: message }, status);
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
}),
|
|
865
|
+
registerApiRoute("/web/workspace/file", {
|
|
866
|
+
method: "GET",
|
|
867
|
+
requiresAuth: false,
|
|
868
|
+
handler: async (c) => {
|
|
869
|
+
const workspacePath = c.req.query("workspacePath");
|
|
870
|
+
const path = c.req.query("path");
|
|
871
|
+
const requestedThreadId = c.req.query("threadId");
|
|
872
|
+
const threadId = requestedThreadId?.trim();
|
|
873
|
+
if (!workspacePath) return c.json({ error: "Missing required query param: workspacePath" }, 400);
|
|
874
|
+
if (!path) return c.json({ error: "Missing required query param: path" }, 400);
|
|
875
|
+
if (requestedThreadId !== void 0 && !threadId) return c.json({ error: "Missing required query param: threadId" }, 400);
|
|
876
|
+
try {
|
|
877
|
+
const session = await resolveAuthorizedSession(loose(c), sessionFs, workspacePath);
|
|
878
|
+
if (session && sessionFs) {
|
|
879
|
+
if (threadId) {
|
|
880
|
+
const safePath = assertRelativePath(path, "path");
|
|
881
|
+
if (!(await listSessionFilesystemFiles(sessionFs.filesystem, session, threadId)).files.some((file) => file.path === safePath)) return c.json({ error: "Path is not available for this thread" }, 404);
|
|
882
|
+
return c.json(await readSessionWorkspaceFile(session, safePath, { allowUnapprovedPath: true }));
|
|
883
|
+
}
|
|
884
|
+
return c.json(await readSessionWorkspaceFile(session, path));
|
|
885
|
+
}
|
|
886
|
+
if (threadId) return c.json({ error: "Session workspace is not available" }, 403);
|
|
887
|
+
return c.json(await readWorkspaceFile(root, workspacePath, path));
|
|
888
|
+
} catch (error) {
|
|
889
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
890
|
+
const status = message.includes("outside") || message.includes("relative") || message.includes("escapes") || message.includes("not approved") || message.includes("not available") ? 403 : message.includes("directory") ? 400 : message.includes("not found") ? 404 : 500;
|
|
891
|
+
return c.json({ error: message }, status);
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
}),
|
|
895
|
+
registerApiRoute("/web/codebase/resolve", {
|
|
896
|
+
method: "GET",
|
|
897
|
+
requiresAuth: false,
|
|
898
|
+
handler: async (c) => {
|
|
899
|
+
const path = c.req.query("path");
|
|
900
|
+
if (!path) return c.json({ error: "Missing required query param: path" }, 400);
|
|
901
|
+
const confined = await realPathWithinRoot(isAbsolute(path) ? resolve(path) : resolve(root, path), root);
|
|
902
|
+
if (!confined) return c.json({ error: "Path is outside the browsable root" }, 403);
|
|
903
|
+
try {
|
|
904
|
+
return c.json(resolveCodebase(confined));
|
|
905
|
+
} catch (error) {
|
|
906
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
907
|
+
return c.json({ error: message }, 500);
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
})
|
|
911
|
+
];
|
|
912
|
+
}
|
|
913
|
+
//#endregion
|
|
914
|
+
export { buildFsRoutes, listArtifacts, listDirectory, listSessionFilesystemFiles, listSessionRenderedPath, listSessionWorkspaceChanges, listWorkspaceRenderedPath, parseWorkspaceChangeStats, parseWorkspaceChanges, parseWorkspaceTrackedChanges, readSessionWorkspaceDiff, readSessionWorkspaceFile, readWorkspaceFile, resolveCodebase, resolveFsRoot };
|
|
915
|
+
|
|
916
|
+
//# sourceMappingURL=fs.js.map
|