@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,754 @@
|
|
|
1
|
+
import { PlatformApiClient, PlatformApiError, logPlatformInfo, logPlatformWarn, platformApiClientConfigFromEnv } from "../api-client.js";
|
|
2
|
+
import { resolveLinearRules } from "../../linear/default-rules.js";
|
|
3
|
+
import { attachLinearRules } from "../../linear/rules.js";
|
|
4
|
+
import { attachLinearIssueReconciler } from "../../linear/issue-reconciler.js";
|
|
5
|
+
import { linearIssueReconciliationEnabled, linearIssueReconciliationInterval } from "../../linear/reconciliation-config.js";
|
|
6
|
+
import { buildLinearRoutes } from "../../linear/routes.js";
|
|
7
|
+
import { buildLinearAgentTools } from "../../linear/agent-tools.js";
|
|
8
|
+
import { PlatformLinearEventWorker } from "./event-worker.js";
|
|
9
|
+
import { registerApiRoute } from "@mastra/core/server";
|
|
10
|
+
//#region src/integrations/platform/linear/integration.ts
|
|
11
|
+
const API_PREFIX = "/v1/server/linear";
|
|
12
|
+
const PAGE_SIZE = 30;
|
|
13
|
+
const MAX_REFERENCE_PAGES = 20;
|
|
14
|
+
const MAX_COMMENT_PAGES = 20;
|
|
15
|
+
const PLATFORM_MANAGED_CONNECTION_TOKEN = "platform-managed";
|
|
16
|
+
function loose(c) {
|
|
17
|
+
return c;
|
|
18
|
+
}
|
|
19
|
+
function routeBaseUrl(ctx, requestUrl) {
|
|
20
|
+
return (ctx.baseUrl || new URL(requestUrl).origin).replace(/\/+$/, "");
|
|
21
|
+
}
|
|
22
|
+
var PlatformLinearIntegration = class {
|
|
23
|
+
id = "linear";
|
|
24
|
+
#client;
|
|
25
|
+
#endpointHost;
|
|
26
|
+
#projects;
|
|
27
|
+
#auth;
|
|
28
|
+
/**
|
|
29
|
+
* Per-instance workflow-state cache keyed by `${workspaceId}:${teamId}`. Scoped to the process
|
|
30
|
+
* lifetime; not shared across requests intentionally to keep failure modes simple (stale states
|
|
31
|
+
* clear on process restart). Populated lazily on first `updateIssue` per team.
|
|
32
|
+
*/
|
|
33
|
+
#workflowStatesByTeam = /* @__PURE__ */ new Map();
|
|
34
|
+
intake = {
|
|
35
|
+
resolveIntakeDispatch: (input) => this.#resolveIntakeDispatch(input),
|
|
36
|
+
listSources: async () => {
|
|
37
|
+
const [projectSources, teamSources] = await Promise.all([this.#listProjectSources(), this.#listTeamSources()]);
|
|
38
|
+
const projects = projectSources.map(({ workspace, project }) => ({
|
|
39
|
+
id: encodeSourceId(workspace.linearWorkspaceId, project.id),
|
|
40
|
+
name: project.name,
|
|
41
|
+
type: "project",
|
|
42
|
+
metadata: {
|
|
43
|
+
workspaceId: workspace.linearWorkspaceId,
|
|
44
|
+
workspaceName: workspace.linearWorkspaceName,
|
|
45
|
+
workspaceUrlKey: workspace.urlKey,
|
|
46
|
+
state: project.state,
|
|
47
|
+
teams: project.teams
|
|
48
|
+
}
|
|
49
|
+
}));
|
|
50
|
+
const teams = teamSources.map(({ workspace, team }) => ({
|
|
51
|
+
id: encodeTeamSourceId(workspace.linearWorkspaceId, team.id),
|
|
52
|
+
name: team.name,
|
|
53
|
+
type: "team",
|
|
54
|
+
metadata: {
|
|
55
|
+
workspaceId: workspace.linearWorkspaceId,
|
|
56
|
+
workspaceName: workspace.linearWorkspaceName,
|
|
57
|
+
workspaceUrlKey: workspace.urlKey,
|
|
58
|
+
teamKey: team.key
|
|
59
|
+
}
|
|
60
|
+
}));
|
|
61
|
+
return [...projects, ...teams];
|
|
62
|
+
},
|
|
63
|
+
listItems: async ({ sourceIds, attributionSourceIds, cursor }) => {
|
|
64
|
+
const result = await this.#listIssues(sourceIds, cursor, void 0, attributionSourceIds);
|
|
65
|
+
return {
|
|
66
|
+
items: result.issues.map(({ issue, sourceId, workspace }) => ({
|
|
67
|
+
source: {
|
|
68
|
+
type: "issue",
|
|
69
|
+
externalId: issue.id,
|
|
70
|
+
url: issue.url
|
|
71
|
+
},
|
|
72
|
+
sourceId,
|
|
73
|
+
title: issue.title,
|
|
74
|
+
status: issue.state.name,
|
|
75
|
+
labels: issue.labels.map((label) => label.name),
|
|
76
|
+
assignee: issue.assignee?.displayName ?? issue.assignee?.name ?? null,
|
|
77
|
+
createdAt: issue.createdAt,
|
|
78
|
+
updatedAt: issue.updatedAt,
|
|
79
|
+
metadata: {
|
|
80
|
+
identifier: issue.identifier,
|
|
81
|
+
workspaceId: workspace.linearWorkspaceId,
|
|
82
|
+
workspaceName: workspace.linearWorkspaceName,
|
|
83
|
+
projectId: issue.project?.id ?? null,
|
|
84
|
+
team: issue.team.key,
|
|
85
|
+
priority: issue.priorityLabel
|
|
86
|
+
}
|
|
87
|
+
})),
|
|
88
|
+
nextCursor: result.nextCursor
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
listIssues: async ({ connection, sourceIds, attributionSourceIds, labels, cursor }) => {
|
|
92
|
+
requireLinearConnection(connection);
|
|
93
|
+
const result = await this.#listIssues(sourceIds, cursor, labels, attributionSourceIds);
|
|
94
|
+
return {
|
|
95
|
+
issues: result.issues.map(({ issue, sourceId, workspace }) => ({
|
|
96
|
+
...parseIssue(issue, workspace.linearWorkspaceId),
|
|
97
|
+
sourceId
|
|
98
|
+
})),
|
|
99
|
+
nextCursor: result.nextCursor
|
|
100
|
+
};
|
|
101
|
+
},
|
|
102
|
+
getIssue: async ({ connection, sourceId, issueId }) => {
|
|
103
|
+
requireLinearConnection(connection);
|
|
104
|
+
const located = await this.#findIssue(sourceId, issueId);
|
|
105
|
+
if (!located) return null;
|
|
106
|
+
const comments = await this.#loadComments(located.workspaceId, issueId, located.issue.comments);
|
|
107
|
+
return parseIssueDetail(located.issue, comments, located.workspaceId);
|
|
108
|
+
},
|
|
109
|
+
createComment: async ({ connection, sourceId, issueId, body }) => {
|
|
110
|
+
requireLinearConnection(connection);
|
|
111
|
+
const workspaceId = await this.#resolveWorkspaceForIssue(sourceId, issueId);
|
|
112
|
+
if (!workspaceId) return null;
|
|
113
|
+
try {
|
|
114
|
+
const comment = await this.#client.request("POST", `${API_PREFIX}/workspaces/${encodeURIComponent(workspaceId)}/issues/${encodeURIComponent(issueId)}/comments`, { body });
|
|
115
|
+
return {
|
|
116
|
+
id: comment.id,
|
|
117
|
+
url: comment.url
|
|
118
|
+
};
|
|
119
|
+
} catch (error) {
|
|
120
|
+
if (isNotFound(error)) return null;
|
|
121
|
+
throw error;
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
updateIssue: async (input) => {
|
|
125
|
+
requireLinearConnection(input.connection);
|
|
126
|
+
const located = await this.#findIssue(input.sourceId, input.issueId);
|
|
127
|
+
if (!located) return null;
|
|
128
|
+
const { workspaceId, issue } = located;
|
|
129
|
+
const target = input.state;
|
|
130
|
+
if (target.kind === "byType" && issue.state.type === target.stateType) return parseIssue(issue, workspaceId);
|
|
131
|
+
if (target.kind === "byName" && issue.state.name.toLowerCase() === target.name.toLowerCase()) return parseIssue(issue, workspaceId);
|
|
132
|
+
let states;
|
|
133
|
+
try {
|
|
134
|
+
states = await this.#listWorkflowStates(workspaceId, issue.team.id);
|
|
135
|
+
} catch (error) {
|
|
136
|
+
if (isNotFound(error)) {
|
|
137
|
+
logPlatformWarn("Platform Linear: workflow-states endpoint not available; skipping updateIssue.", {
|
|
138
|
+
workspaceId,
|
|
139
|
+
teamId: issue.team.id
|
|
140
|
+
});
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
throw error;
|
|
144
|
+
}
|
|
145
|
+
let matched;
|
|
146
|
+
if (target.kind === "byType") matched = states.slice().sort((a, b) => a.position - b.position).find((s) => s.type === target.stateType);
|
|
147
|
+
else {
|
|
148
|
+
const wanted = target.name.toLowerCase();
|
|
149
|
+
matched = states.find((s) => s.name.toLowerCase() === wanted);
|
|
150
|
+
}
|
|
151
|
+
if (!matched) {
|
|
152
|
+
logPlatformWarn("Platform Linear: no workflow state matched target; skipping updateIssue.", {
|
|
153
|
+
workspaceId,
|
|
154
|
+
teamId: issue.team.id,
|
|
155
|
+
target
|
|
156
|
+
});
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
try {
|
|
160
|
+
await this.#client.request("PATCH", `${API_PREFIX}/workspaces/${encodeURIComponent(workspaceId)}/issues/${encodeURIComponent(input.issueId)}`, { stateId: matched.id });
|
|
161
|
+
} catch (error) {
|
|
162
|
+
if (isNotFound(error)) return null;
|
|
163
|
+
throw error;
|
|
164
|
+
}
|
|
165
|
+
const refreshed = await this.#findIssue(input.sourceId, input.issueId);
|
|
166
|
+
return refreshed ? parseIssue(refreshed.issue, refreshed.workspaceId) : null;
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
#rules;
|
|
170
|
+
get rules() {
|
|
171
|
+
return this.#rules;
|
|
172
|
+
}
|
|
173
|
+
constructor({ rules } = {}) {
|
|
174
|
+
this.#rules = resolveLinearRules(rules);
|
|
175
|
+
const config = platformApiClientConfigFromEnv();
|
|
176
|
+
this.#client = new PlatformApiClient(config);
|
|
177
|
+
this.#endpointHost = new URL(config.baseUrl).host;
|
|
178
|
+
}
|
|
179
|
+
get storage() {
|
|
180
|
+
const now = /* @__PURE__ */ new Date();
|
|
181
|
+
return {
|
|
182
|
+
integrationId: this.id,
|
|
183
|
+
connections: { get: async (orgId) => ({
|
|
184
|
+
id: `platform-linear:${orgId}`,
|
|
185
|
+
orgId,
|
|
186
|
+
userId: null,
|
|
187
|
+
data: {
|
|
188
|
+
accessToken: PLATFORM_MANAGED_CONNECTION_TOKEN,
|
|
189
|
+
refreshToken: null,
|
|
190
|
+
expiresAtMs: null,
|
|
191
|
+
scope: "read,comments:create",
|
|
192
|
+
workspaceName: null,
|
|
193
|
+
workspaceUrlKey: null
|
|
194
|
+
},
|
|
195
|
+
metadata: {},
|
|
196
|
+
createdAt: now,
|
|
197
|
+
updatedAt: now
|
|
198
|
+
}) }
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
get projects() {
|
|
202
|
+
if (!this.#projects) throw new Error("PlatformLinearIntegration projects storage has not been initialized.");
|
|
203
|
+
return this.#projects;
|
|
204
|
+
}
|
|
205
|
+
initialize({ projects, auth }) {
|
|
206
|
+
this.#projects = projects;
|
|
207
|
+
this.#auth = auth;
|
|
208
|
+
logPlatformInfo("Platform Linear integration initialized", { endpointHost: this.#endpointHost });
|
|
209
|
+
}
|
|
210
|
+
get authEnabled() {
|
|
211
|
+
return this.#auth?.enabled() ?? false;
|
|
212
|
+
}
|
|
213
|
+
async resolveOrgId(resourceId) {
|
|
214
|
+
try {
|
|
215
|
+
return (await this.projects.getById({ id: resourceId }))?.orgId ?? null;
|
|
216
|
+
} catch {
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
async loadConnection(orgId) {
|
|
221
|
+
const workspace = (await this.#listWorkspaces())[0];
|
|
222
|
+
if (!workspace) return null;
|
|
223
|
+
const now = /* @__PURE__ */ new Date();
|
|
224
|
+
return {
|
|
225
|
+
id: `platform-linear:${orgId}`,
|
|
226
|
+
orgId,
|
|
227
|
+
userId: null,
|
|
228
|
+
accessToken: PLATFORM_MANAGED_CONNECTION_TOKEN,
|
|
229
|
+
scope: "read,comments:create",
|
|
230
|
+
refreshToken: null,
|
|
231
|
+
expiresAt: null,
|
|
232
|
+
workspaceName: workspace.linearWorkspaceName,
|
|
233
|
+
workspaceUrlKey: workspace.urlKey,
|
|
234
|
+
createdAt: now,
|
|
235
|
+
updatedAt: now
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
async getFreshAccessToken(_connection) {
|
|
239
|
+
return PLATFORM_MANAGED_CONNECTION_TOKEN;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Background-dispatch context: platform-managed connection token when the
|
|
243
|
+
* org has a connected workspace. Linear work items store the issue UUID
|
|
244
|
+
* directly as `externalId`.
|
|
245
|
+
*/
|
|
246
|
+
async #resolveIntakeDispatch({ orgId, externalSource }) {
|
|
247
|
+
if (externalSource.type !== "issue") return null;
|
|
248
|
+
if (!await this.loadConnection(orgId)) return null;
|
|
249
|
+
return {
|
|
250
|
+
connection: {
|
|
251
|
+
type: "oauth",
|
|
252
|
+
accessToken: PLATFORM_MANAGED_CONNECTION_TOKEN
|
|
253
|
+
},
|
|
254
|
+
issueId: externalSource.externalId
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
canPostComments(connection) {
|
|
258
|
+
return (connection.scope ?? "").split(/[\s,]+/).filter(Boolean).some((scope) => scope === "comments:create" || scope === "write" || scope === "admin");
|
|
259
|
+
}
|
|
260
|
+
async checkConnection(orgId) {
|
|
261
|
+
const connection = await this.loadConnection(orgId);
|
|
262
|
+
return {
|
|
263
|
+
connected: connection !== null,
|
|
264
|
+
canComment: connection !== null && this.canPostComments(connection),
|
|
265
|
+
checkedAt: Date.now()
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
workers(ctx) {
|
|
269
|
+
const pollingEnabled = process.env.MASTRACODE_PLATFORM_LINEAR_POLLING_ENABLED?.trim().toLowerCase() !== "false";
|
|
270
|
+
const reconcileEnabled = linearIssueReconciliationEnabled();
|
|
271
|
+
if (!pollingEnabled && !reconcileEnabled) return [];
|
|
272
|
+
const ingest = attachLinearRules(this, ctx);
|
|
273
|
+
const reconcile = reconcileEnabled ? attachLinearIssueReconciler(this, ctx) : void 0;
|
|
274
|
+
const workItems = ctx.runtime?.workItems;
|
|
275
|
+
if (!workItems) return [];
|
|
276
|
+
if (!ingest && !reconcile) return [];
|
|
277
|
+
const pollIntervalMs = optionalPositiveIntegerEnv("MASTRACODE_PLATFORM_LINEAR_POLLING_INTERVAL_MS");
|
|
278
|
+
const reconcileIntervalMs = linearIssueReconciliationInterval();
|
|
279
|
+
return [new PlatformLinearEventWorker({
|
|
280
|
+
client: this.#client,
|
|
281
|
+
linear: { listWorkspaces: () => this.listWorkspaces() },
|
|
282
|
+
storage: ctx.storage.generic,
|
|
283
|
+
projects: ctx.storage.projects,
|
|
284
|
+
workItems,
|
|
285
|
+
...ingest ? { ingestFactoryIssue: ingest } : {},
|
|
286
|
+
...reconcile ? { reconcileFactoryState: reconcile } : {},
|
|
287
|
+
pollEventsEnabled: pollingEnabled,
|
|
288
|
+
...pollIntervalMs !== void 0 ? { intervalMs: pollIntervalMs } : {},
|
|
289
|
+
...reconcileIntervalMs !== void 0 ? { reconcileIntervalMs } : {}
|
|
290
|
+
})];
|
|
291
|
+
}
|
|
292
|
+
routes(ctx) {
|
|
293
|
+
return [this.#connectRoute(ctx), ...buildLinearRoutes({
|
|
294
|
+
auth: ctx.auth,
|
|
295
|
+
linear: this,
|
|
296
|
+
stateSigner: ctx.stateSigner,
|
|
297
|
+
baseUrl: ctx.baseUrl,
|
|
298
|
+
intake: ctx.storage.intake,
|
|
299
|
+
projects: ctx.storage.projects,
|
|
300
|
+
ingestFactoryIssues: attachLinearRules(this, ctx),
|
|
301
|
+
workItems: ctx.runtime?.workItems,
|
|
302
|
+
boards: ctx.runtime?.boards
|
|
303
|
+
}).filter((route) => !route.path.startsWith("/auth/linear/"))];
|
|
304
|
+
}
|
|
305
|
+
#connectRoute(ctx) {
|
|
306
|
+
return registerApiRoute("/auth/linear/connect", {
|
|
307
|
+
method: "GET",
|
|
308
|
+
requiresAuth: false,
|
|
309
|
+
handler: async (c) => {
|
|
310
|
+
await ctx.auth.ensureUser(loose(c));
|
|
311
|
+
const tenant = ctx.auth.tenant(loose(c));
|
|
312
|
+
if (!tenant?.orgId) return c.json({ error: "unauthorized" }, 401);
|
|
313
|
+
const returnTo = c.req.query("return_to") || "/";
|
|
314
|
+
const originator = routeBaseUrl(ctx, c.req.url);
|
|
315
|
+
logPlatformInfo("Starting Platform Linear connect flow", {
|
|
316
|
+
orgId: tenant.orgId,
|
|
317
|
+
returnTo,
|
|
318
|
+
originator
|
|
319
|
+
});
|
|
320
|
+
const query = new URLSearchParams({
|
|
321
|
+
return_to: returnTo,
|
|
322
|
+
originator
|
|
323
|
+
});
|
|
324
|
+
const location = await this.#client.requestRedirect("GET", `${API_PREFIX}/authorize?${query}`);
|
|
325
|
+
return c.redirect(location);
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
async agentTools({ requestContext }) {
|
|
330
|
+
return buildLinearAgentTools({
|
|
331
|
+
requestContext,
|
|
332
|
+
linear: this
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
diagnostics() {
|
|
336
|
+
return {
|
|
337
|
+
mode: "platform",
|
|
338
|
+
endpointHost: this.#endpointHost
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
async listProjects() {
|
|
342
|
+
return (await this.#listProjectSources()).map(({ workspace, project }) => ({
|
|
343
|
+
...project,
|
|
344
|
+
id: encodeSourceId(workspace.linearWorkspaceId, project.id),
|
|
345
|
+
workspaceId: workspace.linearWorkspaceId
|
|
346
|
+
}));
|
|
347
|
+
}
|
|
348
|
+
async listTeams(_accessToken) {
|
|
349
|
+
return (await this.#listTeamSources()).map(({ workspace, team }) => ({
|
|
350
|
+
...team,
|
|
351
|
+
workspaceId: workspace.linearWorkspaceId,
|
|
352
|
+
sourceId: encodeTeamSourceId(workspace.linearWorkspaceId, team.id)
|
|
353
|
+
}));
|
|
354
|
+
}
|
|
355
|
+
async fetchIssueDetail(_accessToken, idOrIdentifier, sourceIds, routedSourceIds) {
|
|
356
|
+
const located = await this.#findIssue(void 0, idOrIdentifier, sourceIds, routedSourceIds);
|
|
357
|
+
if (!located) return null;
|
|
358
|
+
const comments = await this.#loadComments(located.workspaceId, located.issue.id, located.issue.comments);
|
|
359
|
+
const issue = located.issue;
|
|
360
|
+
return {
|
|
361
|
+
id: issue.id,
|
|
362
|
+
projectId: issue.project?.id ?? null,
|
|
363
|
+
workspaceId: located.workspaceId,
|
|
364
|
+
teamId: issue.team.id,
|
|
365
|
+
identifier: issue.identifier,
|
|
366
|
+
title: issue.title,
|
|
367
|
+
description: issue.description?.trim() ? issue.description : null,
|
|
368
|
+
url: issue.url,
|
|
369
|
+
state: issue.state.name,
|
|
370
|
+
stateType: issue.state.type,
|
|
371
|
+
priorityLabel: issue.priorityLabel,
|
|
372
|
+
assignee: issue.assignee?.displayName ?? issue.assignee?.name ?? null,
|
|
373
|
+
creator: issue.creator?.displayName ?? issue.creator?.name ?? null,
|
|
374
|
+
team: issue.team.key,
|
|
375
|
+
labels: issue.labels.map((label) => label.name),
|
|
376
|
+
createdAt: issue.createdAt,
|
|
377
|
+
updatedAt: issue.updatedAt,
|
|
378
|
+
comments: comments.map((comment) => ({
|
|
379
|
+
author: comment.user?.displayName ?? comment.user?.name ?? null,
|
|
380
|
+
body: comment.body,
|
|
381
|
+
createdAt: comment.createdAt
|
|
382
|
+
}))
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
sourceMatchesIssue(sourceId, issue) {
|
|
386
|
+
const source = parseSourceId(sourceId);
|
|
387
|
+
if (issue.workspaceId !== source.workspaceId) return false;
|
|
388
|
+
return source.kind === "team" ? issue.teamId === source.teamId : issue.projectId === source.projectId;
|
|
389
|
+
}
|
|
390
|
+
async #listProjectSources(workspaceIds) {
|
|
391
|
+
const workspaces = await this.#listWorkspaces();
|
|
392
|
+
const scopedWorkspaces = workspaceIds ? workspaces.filter((workspace) => workspaceIds.has(workspace.linearWorkspaceId)) : workspaces;
|
|
393
|
+
return (await Promise.all(scopedWorkspaces.map(async (workspace) => {
|
|
394
|
+
const projects = [];
|
|
395
|
+
let after;
|
|
396
|
+
for (let page = 0; page < MAX_REFERENCE_PAGES; page += 1) {
|
|
397
|
+
const query = new URLSearchParams({ first: "200" });
|
|
398
|
+
if (after) query.set("after", after);
|
|
399
|
+
const result = await this.#client.request("GET", `${API_PREFIX}/workspaces/${encodeURIComponent(workspace.linearWorkspaceId)}/projects?${query}`);
|
|
400
|
+
projects.push(...result.projects);
|
|
401
|
+
if (!result.pageInfo.hasNextPage || !result.pageInfo.endCursor) break;
|
|
402
|
+
if (result.pageInfo.endCursor === after) throw invalidLinearCursor();
|
|
403
|
+
after = result.pageInfo.endCursor;
|
|
404
|
+
}
|
|
405
|
+
return projects.map((project) => ({
|
|
406
|
+
workspace,
|
|
407
|
+
project
|
|
408
|
+
}));
|
|
409
|
+
}))).flat();
|
|
410
|
+
}
|
|
411
|
+
async #listTeamSources(workspaceIds) {
|
|
412
|
+
const workspaces = await this.#listWorkspaces();
|
|
413
|
+
const scopedWorkspaces = workspaceIds ? workspaces.filter((workspace) => workspaceIds.has(workspace.linearWorkspaceId)) : workspaces;
|
|
414
|
+
return (await Promise.all(scopedWorkspaces.map(async (workspace) => {
|
|
415
|
+
const teams = [];
|
|
416
|
+
let after;
|
|
417
|
+
for (let page = 0; page < MAX_REFERENCE_PAGES; page += 1) {
|
|
418
|
+
const query = new URLSearchParams({ first: "200" });
|
|
419
|
+
if (after) query.set("after", after);
|
|
420
|
+
const result = await this.#client.request("GET", `${API_PREFIX}/workspaces/${encodeURIComponent(workspace.linearWorkspaceId)}/teams?${query}`);
|
|
421
|
+
teams.push(...result.teams);
|
|
422
|
+
if (!result.pageInfo.hasNextPage || !result.pageInfo.endCursor) break;
|
|
423
|
+
if (result.pageInfo.endCursor === after) throw invalidLinearCursor();
|
|
424
|
+
after = result.pageInfo.endCursor;
|
|
425
|
+
}
|
|
426
|
+
return teams.map((team) => ({
|
|
427
|
+
workspace,
|
|
428
|
+
team
|
|
429
|
+
}));
|
|
430
|
+
}))).flat();
|
|
431
|
+
}
|
|
432
|
+
async listWorkspaces() {
|
|
433
|
+
return this.#listWorkspaces();
|
|
434
|
+
}
|
|
435
|
+
async #listWorkspaces() {
|
|
436
|
+
return (await this.#client.request("GET", `${API_PREFIX}/workspaces`)).workspaces.filter((workspace) => workspace.connected);
|
|
437
|
+
}
|
|
438
|
+
async #listIssues(sourceIds, cursor, labels, attributionSourceIds = sourceIds) {
|
|
439
|
+
if (sourceIds.length === 0) return {
|
|
440
|
+
issues: [],
|
|
441
|
+
nextCursor: null
|
|
442
|
+
};
|
|
443
|
+
const parsedSources = sourceIds.map((sourceId) => parseSourceId(sourceId));
|
|
444
|
+
const projectWorkspaceIds = new Set(parsedSources.flatMap((source) => source.kind === "project" ? [source.workspaceId] : []));
|
|
445
|
+
const teamWorkspaceIds = new Set(parsedSources.flatMap((source) => source.kind === "team" ? [source.workspaceId] : []));
|
|
446
|
+
const [projectSources, teamSources] = await Promise.all([projectWorkspaceIds.size > 0 ? this.#listProjectSources(projectWorkspaceIds) : Promise.resolve([]), teamWorkspaceIds.size > 0 ? this.#listTeamSources(teamWorkspaceIds) : Promise.resolve([])]);
|
|
447
|
+
const projectMap = new Map(projectSources.map((source) => [encodeSourceId(source.workspace.linearWorkspaceId, source.project.id), source]));
|
|
448
|
+
const teamMap = new Map(teamSources.map((source) => [encodeTeamSourceId(source.workspace.linearWorkspaceId, source.team.id), source]));
|
|
449
|
+
const descriptors = [];
|
|
450
|
+
const selectedProjectIdsByWorkspace = /* @__PURE__ */ new Map();
|
|
451
|
+
for (const attributionSourceId of attributionSourceIds) {
|
|
452
|
+
const source = parseSourceId(attributionSourceId);
|
|
453
|
+
if (source.kind !== "project") continue;
|
|
454
|
+
const selectedProjectIds = selectedProjectIdsByWorkspace.get(source.workspaceId) ?? /* @__PURE__ */ new Set();
|
|
455
|
+
selectedProjectIds.add(source.projectId);
|
|
456
|
+
selectedProjectIdsByWorkspace.set(source.workspaceId, selectedProjectIds);
|
|
457
|
+
}
|
|
458
|
+
for (const sourceId of sourceIds) {
|
|
459
|
+
const projectSource = projectMap.get(sourceId);
|
|
460
|
+
if (projectSource) {
|
|
461
|
+
const query = new URLSearchParams({
|
|
462
|
+
first: String(PAGE_SIZE),
|
|
463
|
+
projectIds: projectSource.project.id,
|
|
464
|
+
stateType: "triage,backlog,unstarted,started",
|
|
465
|
+
orderBy: "updatedAt"
|
|
466
|
+
});
|
|
467
|
+
const workspaceId = projectSource.workspace.linearWorkspaceId;
|
|
468
|
+
const selectedProjectIds = selectedProjectIdsByWorkspace.get(workspaceId) ?? /* @__PURE__ */ new Set();
|
|
469
|
+
selectedProjectIds.add(projectSource.project.id);
|
|
470
|
+
selectedProjectIdsByWorkspace.set(workspaceId, selectedProjectIds);
|
|
471
|
+
descriptors.push({
|
|
472
|
+
kind: "project",
|
|
473
|
+
sourceId,
|
|
474
|
+
workspace: projectSource.workspace,
|
|
475
|
+
query
|
|
476
|
+
});
|
|
477
|
+
continue;
|
|
478
|
+
}
|
|
479
|
+
const teamSource = teamMap.get(sourceId);
|
|
480
|
+
if (teamSource) {
|
|
481
|
+
const query = new URLSearchParams({
|
|
482
|
+
first: String(PAGE_SIZE),
|
|
483
|
+
teamId: teamSource.team.id,
|
|
484
|
+
stateType: "triage,backlog,unstarted,started",
|
|
485
|
+
orderBy: "updatedAt"
|
|
486
|
+
});
|
|
487
|
+
descriptors.push({
|
|
488
|
+
kind: "team",
|
|
489
|
+
sourceId,
|
|
490
|
+
workspace: teamSource.workspace,
|
|
491
|
+
query
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
const cursors = await decodeCursor(cursor, sourceIds, attributionSourceIds);
|
|
496
|
+
const normalizedLabels = normalizeLabels(labels);
|
|
497
|
+
const nextState = {};
|
|
498
|
+
let hasNextPage = false;
|
|
499
|
+
return {
|
|
500
|
+
issues: dedupeIssuesBySource((await Promise.all(descriptors.map(async ({ kind, sourceId, workspace, query }) => {
|
|
501
|
+
if (cursors[sourceId] === null) {
|
|
502
|
+
nextState[sourceId] = null;
|
|
503
|
+
return [];
|
|
504
|
+
}
|
|
505
|
+
const after = cursors[sourceId];
|
|
506
|
+
if (after) query.set("after", after);
|
|
507
|
+
const result = await this.#client.request("GET", `${API_PREFIX}/workspaces/${encodeURIComponent(workspace.linearWorkspaceId)}/issues?${query}`);
|
|
508
|
+
const next = result.pageInfo.hasNextPage ? result.pageInfo.endCursor : null;
|
|
509
|
+
if (next !== null && next === after) throw invalidLinearCursor();
|
|
510
|
+
nextState[sourceId] = next;
|
|
511
|
+
hasNextPage ||= next !== null;
|
|
512
|
+
return result.issues.filter((issue) => normalizedLabels.length === 0 || issue.labels.some((label) => normalizedLabels.includes(label.name))).filter((issue) => kind === "project" || issue.project === null || !selectedProjectIdsByWorkspace.get(workspace.linearWorkspaceId)?.has(issue.project.id)).map((issue) => ({
|
|
513
|
+
issue,
|
|
514
|
+
sourceId,
|
|
515
|
+
workspace
|
|
516
|
+
}));
|
|
517
|
+
}))).flat(), sourceIds),
|
|
518
|
+
nextCursor: hasNextPage ? await encodeCursor(nextState, sourceIds, attributionSourceIds) : null
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
async #findIssue(sourceId, issueId, sourceIds, routedSourceIds) {
|
|
522
|
+
const scopedSources = (sourceIds ?? (sourceId ? [sourceId] : void 0))?.map((sourceKey) => ({
|
|
523
|
+
sourceKey,
|
|
524
|
+
source: parseSourceId(sourceKey)
|
|
525
|
+
}));
|
|
526
|
+
const routedSourceSet = routedSourceIds ? new Set(routedSourceIds) : void 0;
|
|
527
|
+
const workspaceIds = routedSourceIds ? [...new Set(routedSourceIds.map((sourceKey) => parseSourceId(sourceKey).workspaceId))] : scopedSources ? [...new Set(scopedSources.map(({ source }) => source.workspaceId))] : await this.#candidateWorkspaceIds(void 0);
|
|
528
|
+
for (const workspaceId of workspaceIds) try {
|
|
529
|
+
const issue = await this.#client.request("GET", `${API_PREFIX}/workspaces/${encodeURIComponent(workspaceId)}/issues/${encodeURIComponent(issueId)}?include=comments`);
|
|
530
|
+
if (scopedSources) {
|
|
531
|
+
const matching = scopedSources.filter(({ source }) => source.workspaceId === workspaceId && (source.kind === "team" ? issue.team.id === source.teamId : issue.project?.id === source.projectId));
|
|
532
|
+
const winner = matching.find(({ source }) => source.kind === "project") ?? matching[0];
|
|
533
|
+
if (!winner || routedSourceSet && !routedSourceSet.has(winner.sourceKey)) continue;
|
|
534
|
+
}
|
|
535
|
+
return {
|
|
536
|
+
workspaceId,
|
|
537
|
+
issue
|
|
538
|
+
};
|
|
539
|
+
} catch (error) {
|
|
540
|
+
if (!isNotFound(error)) throw error;
|
|
541
|
+
}
|
|
542
|
+
return null;
|
|
543
|
+
}
|
|
544
|
+
async #resolveWorkspaceForIssue(sourceId, issueId) {
|
|
545
|
+
const workspaceIds = await this.#candidateWorkspaceIds(sourceId);
|
|
546
|
+
if (workspaceIds.length === 1) return workspaceIds[0];
|
|
547
|
+
for (const workspaceId of workspaceIds) try {
|
|
548
|
+
await this.#client.request("GET", `${API_PREFIX}/workspaces/${encodeURIComponent(workspaceId)}/issues/${encodeURIComponent(issueId)}`);
|
|
549
|
+
return workspaceId;
|
|
550
|
+
} catch (error) {
|
|
551
|
+
if (!isNotFound(error)) throw error;
|
|
552
|
+
}
|
|
553
|
+
return null;
|
|
554
|
+
}
|
|
555
|
+
async #listWorkflowStates(workspaceId, teamId) {
|
|
556
|
+
const cacheKey = `${workspaceId}:${teamId}`;
|
|
557
|
+
const cached = this.#workflowStatesByTeam.get(cacheKey);
|
|
558
|
+
if (cached) return cached;
|
|
559
|
+
const result = await this.#client.request("GET", `${API_PREFIX}/workspaces/${encodeURIComponent(workspaceId)}/workflow-states?teamId=${encodeURIComponent(teamId)}&first=100`);
|
|
560
|
+
this.#workflowStatesByTeam.set(cacheKey, result.workflowStates);
|
|
561
|
+
return result.workflowStates;
|
|
562
|
+
}
|
|
563
|
+
async #candidateWorkspaceIds(sourceId) {
|
|
564
|
+
if (sourceId) return [parseSourceId(sourceId).workspaceId];
|
|
565
|
+
return (await this.#listWorkspaces()).map((workspace) => workspace.linearWorkspaceId);
|
|
566
|
+
}
|
|
567
|
+
async #loadComments(workspaceId, issueId, embedded) {
|
|
568
|
+
const comments = [...embedded?.nodes ?? []];
|
|
569
|
+
let pageInfo = embedded?.pageInfo;
|
|
570
|
+
let page = 0;
|
|
571
|
+
while (pageInfo?.hasNextPage && pageInfo.endCursor && page < MAX_COMMENT_PAGES) {
|
|
572
|
+
const result = await this.#client.request("GET", `${API_PREFIX}/workspaces/${encodeURIComponent(workspaceId)}/issues/${encodeURIComponent(issueId)}/comments?first=200&after=${encodeURIComponent(pageInfo.endCursor)}`);
|
|
573
|
+
comments.push(...result.comments);
|
|
574
|
+
if (result.pageInfo.hasNextPage && result.pageInfo.endCursor === pageInfo.endCursor) throw invalidLinearCursor();
|
|
575
|
+
pageInfo = result.pageInfo;
|
|
576
|
+
page += 1;
|
|
577
|
+
}
|
|
578
|
+
return comments;
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
function parseIssue(issue, workspaceId) {
|
|
582
|
+
return {
|
|
583
|
+
id: issue.id,
|
|
584
|
+
identifier: issue.identifier,
|
|
585
|
+
title: issue.title,
|
|
586
|
+
url: issue.url,
|
|
587
|
+
author: issue.creator?.displayName ?? issue.creator?.name ?? null,
|
|
588
|
+
state: issue.state.name,
|
|
589
|
+
stateType: issue.state.type,
|
|
590
|
+
priority: issue.priorityLabel,
|
|
591
|
+
assignee: issue.assignee?.displayName ?? issue.assignee?.name ?? null,
|
|
592
|
+
source: issue.team.key,
|
|
593
|
+
projectId: issue.project ? encodeSourceId(workspaceId, issue.project.id) : null,
|
|
594
|
+
labels: issue.labels.map((label) => label.name),
|
|
595
|
+
commentCount: null,
|
|
596
|
+
createdAt: issue.createdAt,
|
|
597
|
+
updatedAt: issue.updatedAt
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
function parseIssueDetail(issue, comments, workspaceId) {
|
|
601
|
+
return {
|
|
602
|
+
...parseIssue(issue, workspaceId),
|
|
603
|
+
commentCount: comments.length,
|
|
604
|
+
description: issue.description?.trim() ? issue.description : null,
|
|
605
|
+
comments: comments.map((comment) => ({
|
|
606
|
+
author: comment.user?.displayName ?? comment.user?.name ?? null,
|
|
607
|
+
body: comment.body,
|
|
608
|
+
createdAt: comment.createdAt
|
|
609
|
+
}))
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Deduplicate issues that surfaced from more than one selected source (a team
|
|
614
|
+
* source and one of its projects both select the same issue). Keeps one entry
|
|
615
|
+
* per Linear issue UUID.
|
|
616
|
+
*
|
|
617
|
+
* Tie-breaker — MOST-SPECIFIC-WINS: a project source beats a team source, so an
|
|
618
|
+
* issue that belongs to a selected project is attributed to that project's
|
|
619
|
+
* source (and therefore routes to the project's board). The team source covers
|
|
620
|
+
* only the remainder — projectless issues and issues in projects that were not
|
|
621
|
+
* separately selected. `selectionOrder` breaks a same-kind tie deterministically
|
|
622
|
+
* by the order the sources were selected.
|
|
623
|
+
*
|
|
624
|
+
* This function is the single precedence point; change the comparison here to
|
|
625
|
+
* change the routing policy.
|
|
626
|
+
*/
|
|
627
|
+
function dedupeIssuesBySource(entries, selectionOrder) {
|
|
628
|
+
const rank = new Map(selectionOrder.map((id, index) => [id, index]));
|
|
629
|
+
const specificity = (sourceId) => parseSourceId(sourceId).kind === "project" ? 0 : 1;
|
|
630
|
+
const winners = /* @__PURE__ */ new Map();
|
|
631
|
+
for (const entry of entries) {
|
|
632
|
+
const existing = winners.get(entry.issue.id);
|
|
633
|
+
if (!existing) {
|
|
634
|
+
winners.set(entry.issue.id, entry);
|
|
635
|
+
continue;
|
|
636
|
+
}
|
|
637
|
+
const bySpecificity = specificity(entry.sourceId) - specificity(existing.sourceId);
|
|
638
|
+
if (bySpecificity < 0 || bySpecificity === 0 && (rank.get(entry.sourceId) ?? Number.MAX_SAFE_INTEGER) < (rank.get(existing.sourceId) ?? Number.MAX_SAFE_INTEGER)) winners.set(entry.issue.id, entry);
|
|
639
|
+
}
|
|
640
|
+
const seen = /* @__PURE__ */ new Set();
|
|
641
|
+
const ordered = [];
|
|
642
|
+
for (const entry of entries) {
|
|
643
|
+
if (seen.has(entry.issue.id)) continue;
|
|
644
|
+
seen.add(entry.issue.id);
|
|
645
|
+
ordered.push(winners.get(entry.issue.id));
|
|
646
|
+
}
|
|
647
|
+
return ordered;
|
|
648
|
+
}
|
|
649
|
+
function encodeSourceId(workspaceId, projectId) {
|
|
650
|
+
return `linear-project:${Buffer.from(JSON.stringify({
|
|
651
|
+
workspaceId,
|
|
652
|
+
projectId
|
|
653
|
+
})).toString("base64url")}`;
|
|
654
|
+
}
|
|
655
|
+
function decodeSourceId(sourceId) {
|
|
656
|
+
if (!sourceId.startsWith("linear-project:")) throw new Error("Linear project source id is invalid.");
|
|
657
|
+
try {
|
|
658
|
+
const parsed = JSON.parse(Buffer.from(sourceId.slice(15), "base64url").toString("utf8"));
|
|
659
|
+
if (typeof parsed.workspaceId !== "string" || !parsed.workspaceId) throw new Error();
|
|
660
|
+
if (typeof parsed.projectId !== "string" || !parsed.projectId) throw new Error();
|
|
661
|
+
return {
|
|
662
|
+
workspaceId: parsed.workspaceId,
|
|
663
|
+
projectId: parsed.projectId
|
|
664
|
+
};
|
|
665
|
+
} catch {
|
|
666
|
+
throw new Error("Linear project source id is invalid.");
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
const TEAM_SOURCE_PREFIX = "linear-team:";
|
|
670
|
+
function encodeTeamSourceId(workspaceId, teamId) {
|
|
671
|
+
return `${TEAM_SOURCE_PREFIX}${Buffer.from(JSON.stringify({
|
|
672
|
+
workspaceId,
|
|
673
|
+
teamId
|
|
674
|
+
})).toString("base64url")}`;
|
|
675
|
+
}
|
|
676
|
+
function decodeTeamSourceId(sourceId) {
|
|
677
|
+
if (!sourceId.startsWith(TEAM_SOURCE_PREFIX)) throw new Error("Linear team source id is invalid.");
|
|
678
|
+
try {
|
|
679
|
+
const parsed = JSON.parse(Buffer.from(sourceId.slice(12), "base64url").toString("utf8"));
|
|
680
|
+
if (typeof parsed.workspaceId !== "string" || !parsed.workspaceId) throw new Error();
|
|
681
|
+
if (typeof parsed.teamId !== "string" || !parsed.teamId) throw new Error();
|
|
682
|
+
return {
|
|
683
|
+
workspaceId: parsed.workspaceId,
|
|
684
|
+
teamId: parsed.teamId
|
|
685
|
+
};
|
|
686
|
+
} catch {
|
|
687
|
+
throw new Error("Linear team source id is invalid.");
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
/** Discriminate any Linear source id by its prefix and decode it. */
|
|
691
|
+
function parseSourceId(sourceId) {
|
|
692
|
+
if (sourceId.startsWith(TEAM_SOURCE_PREFIX)) return {
|
|
693
|
+
kind: "team",
|
|
694
|
+
...decodeTeamSourceId(sourceId)
|
|
695
|
+
};
|
|
696
|
+
return {
|
|
697
|
+
kind: "project",
|
|
698
|
+
...decodeSourceId(sourceId)
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
function normalizeLabels(labels) {
|
|
702
|
+
return [...new Set((labels ?? []).map((label) => label.trim()).filter(Boolean))];
|
|
703
|
+
}
|
|
704
|
+
function canonicalSourceIds(sourceIds) {
|
|
705
|
+
return [...new Set(sourceIds)].sort();
|
|
706
|
+
}
|
|
707
|
+
async function linearSourceSetFingerprint(sourceIds, attributionSourceIds) {
|
|
708
|
+
const scope = {
|
|
709
|
+
sourceIds: canonicalSourceIds(sourceIds),
|
|
710
|
+
attributionSourceIds: canonicalSourceIds(attributionSourceIds)
|
|
711
|
+
};
|
|
712
|
+
const bytes = new TextEncoder().encode(JSON.stringify(scope));
|
|
713
|
+
return Buffer.from(await globalThis.crypto.subtle.digest("SHA-256", bytes)).toString("base64url");
|
|
714
|
+
}
|
|
715
|
+
function invalidLinearCursor() {
|
|
716
|
+
return Object.assign(/* @__PURE__ */ new Error("Linear cursor is invalid or stale."), { code: "invalid_cursor" });
|
|
717
|
+
}
|
|
718
|
+
async function decodeCursor(cursor, sourceIds, attributionSourceIds) {
|
|
719
|
+
if (!cursor) return {};
|
|
720
|
+
try {
|
|
721
|
+
const parsed = JSON.parse(Buffer.from(cursor, "base64url").toString("utf8"));
|
|
722
|
+
const canonical = canonicalSourceIds(sourceIds);
|
|
723
|
+
if (parsed.v !== 1 || parsed.sourceSet !== await linearSourceSetFingerprint(sourceIds, attributionSourceIds) || !Array.isArray(parsed.cursors) || parsed.cursors.length !== canonical.length || !parsed.cursors.every((value) => value === null || typeof value === "string")) throw invalidLinearCursor();
|
|
724
|
+
return Object.fromEntries(canonical.map((sourceId, index) => [sourceId, parsed.cursors[index]]));
|
|
725
|
+
} catch {
|
|
726
|
+
throw invalidLinearCursor();
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
async function encodeCursor(state, sourceIds, attributionSourceIds) {
|
|
730
|
+
const canonical = canonicalSourceIds(sourceIds);
|
|
731
|
+
const cursor = {
|
|
732
|
+
v: 1,
|
|
733
|
+
sourceSet: await linearSourceSetFingerprint(sourceIds, attributionSourceIds),
|
|
734
|
+
cursors: canonical.map((sourceId) => state[sourceId] ?? null)
|
|
735
|
+
};
|
|
736
|
+
return Buffer.from(JSON.stringify(cursor)).toString("base64url");
|
|
737
|
+
}
|
|
738
|
+
function requireLinearConnection(connection) {
|
|
739
|
+
if (connection.type !== "oauth") throw new Error("Linear capabilities require an OAuth connection.");
|
|
740
|
+
}
|
|
741
|
+
function isNotFound(error) {
|
|
742
|
+
return error instanceof PlatformApiError && error.status === 404;
|
|
743
|
+
}
|
|
744
|
+
function optionalPositiveIntegerEnv(name) {
|
|
745
|
+
const value = process.env[name]?.trim();
|
|
746
|
+
if (!value) return void 0;
|
|
747
|
+
const parsed = Number(value);
|
|
748
|
+
if (!Number.isSafeInteger(parsed) || parsed <= 0) throw new Error(`${name} must be a positive integer.`);
|
|
749
|
+
return parsed;
|
|
750
|
+
}
|
|
751
|
+
//#endregion
|
|
752
|
+
export { PlatformLinearIntegration, decodeTeamSourceId, encodeSourceId, encodeTeamSourceId, parseSourceId };
|
|
753
|
+
|
|
754
|
+
//# sourceMappingURL=integration.js.map
|