@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,900 @@
|
|
|
1
|
+
import { IssueReconcileWorker } from "../issue-reconcile-worker.js";
|
|
2
|
+
import { resolveLinearRules } from "./default-rules.js";
|
|
3
|
+
import { attachLinearRules } from "./rules.js";
|
|
4
|
+
import { attachLinearIssueReconciler } from "./issue-reconciler.js";
|
|
5
|
+
import { linearIssueReconciliationEnabled, linearIssueReconciliationInterval } from "./reconciliation-config.js";
|
|
6
|
+
import { buildLinearRoutes } from "./routes.js";
|
|
7
|
+
import { buildLinearAgentTools } from "./agent-tools.js";
|
|
8
|
+
//#region src/integrations/linear/integration.ts
|
|
9
|
+
const LINEAR_GRAPHQL_URL = "https://api.linear.app/graphql";
|
|
10
|
+
const LINEAR_TOKEN_URL = "https://api.linear.app/oauth/token";
|
|
11
|
+
const LINEAR_AUTHORIZE_URL = "https://linear.app/oauth/authorize";
|
|
12
|
+
const LINEAR_ISSUES_PAGE_SIZE = 30;
|
|
13
|
+
const ISSUE_COMMENTS_PAGE_SIZE = 50;
|
|
14
|
+
const LINEAR_TEAMS_PAGE_SIZE = 100;
|
|
15
|
+
const LINEAR_TEAMS_MAX_PAGES = 20;
|
|
16
|
+
/** Hard stop for comment pagination so a misbehaving cursor can't loop forever. */
|
|
17
|
+
const ISSUE_COMMENTS_MAX_PAGES = 20;
|
|
18
|
+
/** Refresh this many ms before the recorded expiry to absorb clock skew. */
|
|
19
|
+
const TOKEN_REFRESH_SKEW_MS = 6e4;
|
|
20
|
+
/** Re-check an org's Linear connection (and its scopes) at most this often. */
|
|
21
|
+
const CONNECTION_TTL_MS = 6e4;
|
|
22
|
+
const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
23
|
+
/** Thrown when the org's Linear authorization can no longer be renewed. */
|
|
24
|
+
var LinearReauthRequiredError = class extends Error {
|
|
25
|
+
constructor() {
|
|
26
|
+
super("Linear authorization expired. Reconnect Linear to keep syncing intake issues.");
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
/** POST a GraphQL query to Linear with the given OAuth access token. */
|
|
30
|
+
async function linearGraphql(accessToken, query, variables) {
|
|
31
|
+
const res = await fetch(LINEAR_GRAPHQL_URL, {
|
|
32
|
+
method: "POST",
|
|
33
|
+
signal: AbortSignal.timeout(15e3),
|
|
34
|
+
headers: {
|
|
35
|
+
"content-type": "application/json",
|
|
36
|
+
authorization: `Bearer ${accessToken}`
|
|
37
|
+
},
|
|
38
|
+
body: JSON.stringify({
|
|
39
|
+
query,
|
|
40
|
+
variables
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
if (!res.ok) {
|
|
44
|
+
let detail = null;
|
|
45
|
+
try {
|
|
46
|
+
detail = (await res.json()).errors?.[0]?.message ?? null;
|
|
47
|
+
} catch {}
|
|
48
|
+
const err = /* @__PURE__ */ new Error(`Linear API request failed (${res.status})${detail ? `: ${detail}` : ""}`);
|
|
49
|
+
err.status = res.status;
|
|
50
|
+
throw err;
|
|
51
|
+
}
|
|
52
|
+
const body = await res.json();
|
|
53
|
+
if (body.errors?.length) throw new Error(`Linear API error: ${body.errors[0]?.message ?? "unknown error"}`);
|
|
54
|
+
if (!body.data) throw new Error("Linear API returned no data.");
|
|
55
|
+
return body.data;
|
|
56
|
+
}
|
|
57
|
+
var LinearIntegration = class {
|
|
58
|
+
/** Stable integration identifier (see `../base.ts`). */
|
|
59
|
+
id = "linear";
|
|
60
|
+
/** Bound once by the factory via `initialize()` before any surface is used. */
|
|
61
|
+
#storage;
|
|
62
|
+
#projects;
|
|
63
|
+
#auth;
|
|
64
|
+
/** Bind Linear's slice of the generic integration storage, the projects domain, and the host auth seam. */
|
|
65
|
+
initialize({ storage, projects, auth }) {
|
|
66
|
+
this.#storage = storage;
|
|
67
|
+
this.#projects = projects;
|
|
68
|
+
this.#auth = auth;
|
|
69
|
+
}
|
|
70
|
+
get storage() {
|
|
71
|
+
if (!this.#storage) throw new Error("LinearIntegration is not initialized — the factory binds storage during prepare().");
|
|
72
|
+
return this.#storage;
|
|
73
|
+
}
|
|
74
|
+
/** Factory projects domain — maps a session's resourceId to its owning org. */
|
|
75
|
+
get projects() {
|
|
76
|
+
if (!this.#projects) throw new Error("LinearIntegration is not initialized — the factory binds storage during prepare().");
|
|
77
|
+
return this.#projects;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Whether the host runs with web auth enabled. Linear connections are
|
|
81
|
+
* org-owned, so every Linear surface is inert without a tenant auth seam.
|
|
82
|
+
*/
|
|
83
|
+
get authEnabled() {
|
|
84
|
+
return this.#auth?.enabled() ?? false;
|
|
85
|
+
}
|
|
86
|
+
/** Load the org's Linear connection, or `null` when not connected. */
|
|
87
|
+
async loadConnection(orgId) {
|
|
88
|
+
const connection = await this.storage.connections.get(orgId);
|
|
89
|
+
if (!connection) return null;
|
|
90
|
+
const { data } = connection;
|
|
91
|
+
return {
|
|
92
|
+
id: connection.id,
|
|
93
|
+
orgId: connection.orgId,
|
|
94
|
+
userId: connection.userId,
|
|
95
|
+
accessToken: data.accessToken,
|
|
96
|
+
scope: data.scope ?? null,
|
|
97
|
+
refreshToken: data.refreshToken ?? null,
|
|
98
|
+
expiresAt: data.expiresAtMs === null || data.expiresAtMs === void 0 ? null : new Date(data.expiresAtMs),
|
|
99
|
+
workspaceName: data.workspaceName ?? null,
|
|
100
|
+
workspaceUrlKey: data.workspaceUrlKey ?? null,
|
|
101
|
+
createdAt: connection.createdAt,
|
|
102
|
+
updatedAt: connection.updatedAt
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/** Insert or replace the org's connection (one per org). */
|
|
106
|
+
async upsertConnection(input) {
|
|
107
|
+
await this.storage.connections.upsert(input.orgId, {
|
|
108
|
+
userId: input.userId,
|
|
109
|
+
data: {
|
|
110
|
+
accessToken: input.accessToken,
|
|
111
|
+
refreshToken: input.refreshToken,
|
|
112
|
+
expiresAtMs: input.expiresAt?.getTime() ?? null,
|
|
113
|
+
scope: input.scope,
|
|
114
|
+
workspaceName: input.workspaceName,
|
|
115
|
+
workspaceUrlKey: input.workspaceUrlKey
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
this.invalidateConnectionCache(input.orgId);
|
|
119
|
+
}
|
|
120
|
+
/** Persist a rotated token set on the org's existing connection row. */
|
|
121
|
+
async #updateTokens(orgId, tokens) {
|
|
122
|
+
await this.storage.connections.update(orgId, (data) => ({
|
|
123
|
+
...data,
|
|
124
|
+
accessToken: tokens.accessToken,
|
|
125
|
+
refreshToken: tokens.refreshToken,
|
|
126
|
+
expiresAtMs: tokens.expiresAt?.getTime() ?? null,
|
|
127
|
+
scope: tokens.scope ?? data.scope
|
|
128
|
+
}));
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Whether the connection's token can post issue comments. Legacy rows
|
|
132
|
+
* without a recorded scope were minted with `read` only, so they count as
|
|
133
|
+
* read-only until the org reconnects Linear.
|
|
134
|
+
*/
|
|
135
|
+
canPostComments(connection) {
|
|
136
|
+
return (connection.scope ?? "").split(/[\s,]+/).filter(Boolean).some((scope) => scope === "comments:create" || scope === "write" || scope === "admin");
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* In-flight refreshes keyed by org. Linear rotates refresh tokens, so two
|
|
140
|
+
* concurrent refreshes with the same token would invalidate each other —
|
|
141
|
+
* single-flight ensures one exchange per org and shares the result.
|
|
142
|
+
*/
|
|
143
|
+
#inflightRefreshes = /* @__PURE__ */ new Map();
|
|
144
|
+
/**
|
|
145
|
+
* Return a usable access token for the connection, proactively refreshing
|
|
146
|
+
* it when the recorded expiry is past (or imminent). Throws
|
|
147
|
+
* `LinearReauthRequiredError` when the token is expired and cannot be
|
|
148
|
+
* refreshed — the org has to go through the OAuth flow again.
|
|
149
|
+
*/
|
|
150
|
+
async getFreshAccessToken(connection) {
|
|
151
|
+
if (!(connection.expiresAt !== null && connection.expiresAt.getTime() - TOKEN_REFRESH_SKEW_MS <= Date.now())) return connection.accessToken;
|
|
152
|
+
if (!connection.refreshToken) throw new LinearReauthRequiredError();
|
|
153
|
+
const existing = this.#inflightRefreshes.get(connection.orgId);
|
|
154
|
+
if (existing) return existing;
|
|
155
|
+
const latest = await this.loadConnection(connection.orgId);
|
|
156
|
+
if (!latest) throw new LinearReauthRequiredError();
|
|
157
|
+
const concurrent = this.#inflightRefreshes.get(connection.orgId);
|
|
158
|
+
if (concurrent) return concurrent;
|
|
159
|
+
if (!(latest.expiresAt !== null && latest.expiresAt.getTime() - TOKEN_REFRESH_SKEW_MS <= Date.now())) return latest.accessToken;
|
|
160
|
+
if (!latest.refreshToken) throw new LinearReauthRequiredError();
|
|
161
|
+
const refreshToken = latest.refreshToken;
|
|
162
|
+
const refresh = (async () => {
|
|
163
|
+
try {
|
|
164
|
+
const tokens = await this.refreshAccessToken(refreshToken);
|
|
165
|
+
await this.#updateTokens(connection.orgId, tokens);
|
|
166
|
+
return tokens.accessToken;
|
|
167
|
+
} catch (err) {
|
|
168
|
+
const status = err.status;
|
|
169
|
+
if (status === 400 || status === 401) throw new LinearReauthRequiredError();
|
|
170
|
+
throw err;
|
|
171
|
+
} finally {
|
|
172
|
+
this.#inflightRefreshes.delete(connection.orgId);
|
|
173
|
+
}
|
|
174
|
+
})();
|
|
175
|
+
this.#inflightRefreshes.set(connection.orgId, refresh);
|
|
176
|
+
return refresh;
|
|
177
|
+
}
|
|
178
|
+
/** Re-check an org's Linear connection (and its scopes) at most this often. */
|
|
179
|
+
#connectionChecks = /* @__PURE__ */ new Map();
|
|
180
|
+
/**
|
|
181
|
+
* Whether the org has an active connection and whether its granted scope
|
|
182
|
+
* allows posting comments. Cached per org with a short TTL — tool-set
|
|
183
|
+
* resolution runs on every request.
|
|
184
|
+
*/
|
|
185
|
+
async checkConnection(orgId) {
|
|
186
|
+
const cached = this.#connectionChecks.get(orgId);
|
|
187
|
+
if (cached && Date.now() - cached.checkedAt < CONNECTION_TTL_MS) return cached;
|
|
188
|
+
const connection = await this.loadConnection(orgId);
|
|
189
|
+
const check = {
|
|
190
|
+
connected: connection !== null,
|
|
191
|
+
canComment: connection !== null && this.canPostComments(connection),
|
|
192
|
+
checkedAt: Date.now()
|
|
193
|
+
};
|
|
194
|
+
this.#connectionChecks.set(orgId, check);
|
|
195
|
+
return check;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Drop the cached connection check for an org. Called after a connection is
|
|
199
|
+
* persisted so the tools show up on the very next run instead of after the
|
|
200
|
+
* TTL lapses.
|
|
201
|
+
*/
|
|
202
|
+
invalidateConnectionCache(orgId) {
|
|
203
|
+
this.#connectionChecks.delete(orgId);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* A project's org never changes, so the resourceId → orgId mapping is
|
|
207
|
+
* cached forever. `null` marks resource ids that aren't factory projects
|
|
208
|
+
* (e.g. local default resources) so we don't re-query them on every
|
|
209
|
+
* tool-set resolution.
|
|
210
|
+
*/
|
|
211
|
+
#orgIdByResourceId = /* @__PURE__ */ new Map();
|
|
212
|
+
/** Map a session's resourceId to its owning org, or `null` when it isn't a project. */
|
|
213
|
+
async resolveOrgId(resourceId) {
|
|
214
|
+
const cached = this.#orgIdByResourceId.get(resourceId);
|
|
215
|
+
if (cached !== void 0) return cached;
|
|
216
|
+
if (!UUID_PATTERN.test(resourceId)) {
|
|
217
|
+
this.#orgIdByResourceId.set(resourceId, null);
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
let orgId;
|
|
221
|
+
try {
|
|
222
|
+
await this.projects.ensureReady();
|
|
223
|
+
orgId = (await this.projects.getById({ id: resourceId }))?.orgId ?? null;
|
|
224
|
+
} catch {
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
227
|
+
this.#orgIdByResourceId.set(resourceId, orgId);
|
|
228
|
+
return orgId;
|
|
229
|
+
}
|
|
230
|
+
/** Test hook: clear the org/connection caches between specs. */
|
|
231
|
+
clearCaches() {
|
|
232
|
+
this.#orgIdByResourceId.clear();
|
|
233
|
+
this.#connectionChecks.clear();
|
|
234
|
+
}
|
|
235
|
+
intake = {
|
|
236
|
+
resolveIntakeDispatch: (input) => this.#resolveIntakeDispatch(input),
|
|
237
|
+
listSources: async ({ orgId }) => {
|
|
238
|
+
const connection = await this.loadConnection(orgId);
|
|
239
|
+
if (!connection) return [];
|
|
240
|
+
const accessToken = await this.getFreshAccessToken(connection);
|
|
241
|
+
const [projects, teams] = await Promise.all([this.listProjects(accessToken), this.listTeams(accessToken)]);
|
|
242
|
+
return [...projects.map((project) => ({
|
|
243
|
+
id: project.id,
|
|
244
|
+
name: project.name,
|
|
245
|
+
type: "project"
|
|
246
|
+
})), ...teams.map((team) => ({
|
|
247
|
+
id: encodeSelfManagedTeamSourceId(team.id),
|
|
248
|
+
name: team.name,
|
|
249
|
+
type: "team",
|
|
250
|
+
metadata: { teamKey: team.key }
|
|
251
|
+
}))];
|
|
252
|
+
},
|
|
253
|
+
listItems: async ({ orgId, sourceIds, attributionSourceIds, cursor }) => {
|
|
254
|
+
if (sourceIds.length === 0) return {
|
|
255
|
+
items: [],
|
|
256
|
+
nextCursor: null
|
|
257
|
+
};
|
|
258
|
+
const connection = await this.loadConnection(orgId);
|
|
259
|
+
if (!connection) return {
|
|
260
|
+
items: [],
|
|
261
|
+
nextCursor: null
|
|
262
|
+
};
|
|
263
|
+
const accessToken = await this.getFreshAccessToken(connection);
|
|
264
|
+
const page = await this.#listIntakeIssues({
|
|
265
|
+
connection: {
|
|
266
|
+
type: "oauth",
|
|
267
|
+
accessToken
|
|
268
|
+
},
|
|
269
|
+
sourceIds,
|
|
270
|
+
attributionSourceIds,
|
|
271
|
+
cursor
|
|
272
|
+
});
|
|
273
|
+
return {
|
|
274
|
+
items: page.issues.flatMap((issue) => {
|
|
275
|
+
if (!issue.sourceId) return [];
|
|
276
|
+
return [{
|
|
277
|
+
source: {
|
|
278
|
+
type: "issue",
|
|
279
|
+
externalId: issue.id,
|
|
280
|
+
url: issue.url
|
|
281
|
+
},
|
|
282
|
+
sourceId: issue.sourceId,
|
|
283
|
+
title: `${issue.identifier}: ${issue.title}`,
|
|
284
|
+
status: issue.state ?? "",
|
|
285
|
+
labels: issue.labels,
|
|
286
|
+
assignee: issue.assignee,
|
|
287
|
+
createdAt: issue.createdAt,
|
|
288
|
+
updatedAt: issue.updatedAt,
|
|
289
|
+
metadata: {
|
|
290
|
+
identifier: issue.identifier,
|
|
291
|
+
...issue.projectId ? { linearProjectId: issue.projectId } : {},
|
|
292
|
+
stateType: issue.stateType,
|
|
293
|
+
priority: issue.priority,
|
|
294
|
+
team: issue.source
|
|
295
|
+
}
|
|
296
|
+
}];
|
|
297
|
+
}),
|
|
298
|
+
nextCursor: page.nextCursor
|
|
299
|
+
};
|
|
300
|
+
},
|
|
301
|
+
listIssues: (input) => this.#listIntakeIssues(input),
|
|
302
|
+
getIssue: (input) => this.#getIntakeIssue(input),
|
|
303
|
+
createComment: (input) => this.#createIntakeComment(input),
|
|
304
|
+
updateIssue: (input) => this.#updateIntakeIssue(input)
|
|
305
|
+
};
|
|
306
|
+
/**
|
|
307
|
+
* Background-dispatch context: the org's OAuth connection with a fresh
|
|
308
|
+
* token. Linear work items store the issue UUID directly as `externalId`.
|
|
309
|
+
*/
|
|
310
|
+
async #resolveIntakeDispatch({ orgId, externalSource }) {
|
|
311
|
+
if (externalSource.type !== "issue") return null;
|
|
312
|
+
const connection = await this.loadConnection(orgId);
|
|
313
|
+
if (!connection) return null;
|
|
314
|
+
return {
|
|
315
|
+
connection: {
|
|
316
|
+
type: "oauth",
|
|
317
|
+
accessToken: await this.getFreshAccessToken(connection)
|
|
318
|
+
},
|
|
319
|
+
issueId: externalSource.externalId
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* The OAuth connect/callback flow round-trips a signed `state` through
|
|
324
|
+
* Linear, so a multi-replica deploy needs a deployment-stable state secret.
|
|
325
|
+
*/
|
|
326
|
+
requiresStableStateSigner = true;
|
|
327
|
+
#clientId;
|
|
328
|
+
#clientSecret;
|
|
329
|
+
#rules;
|
|
330
|
+
get rules() {
|
|
331
|
+
return this.#rules;
|
|
332
|
+
}
|
|
333
|
+
constructor(config) {
|
|
334
|
+
this.#rules = resolveLinearRules(config.rules);
|
|
335
|
+
const missing = ["clientId", "clientSecret"].filter((key) => !config[key]);
|
|
336
|
+
if (missing.length > 0) throw new Error(`LinearIntegration is missing required config: ${missing.join(", ")}.`);
|
|
337
|
+
this.#clientId = config.clientId;
|
|
338
|
+
this.#clientSecret = config.clientSecret;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Build the OAuth authorize URL. `prompt=consent` forces the workspace
|
|
342
|
+
* picker even for an already-authorized user, so "reconnect" can switch
|
|
343
|
+
* workspaces.
|
|
344
|
+
*/
|
|
345
|
+
buildAuthorizeUrl(state, redirectUri) {
|
|
346
|
+
const url = new URL(LINEAR_AUTHORIZE_URL);
|
|
347
|
+
url.searchParams.set("client_id", this.#clientId);
|
|
348
|
+
url.searchParams.set("redirect_uri", redirectUri);
|
|
349
|
+
url.searchParams.set("response_type", "code");
|
|
350
|
+
url.searchParams.set("scope", "read,comments:create");
|
|
351
|
+
url.searchParams.set("state", state);
|
|
352
|
+
url.searchParams.set("prompt", "consent");
|
|
353
|
+
return url.toString();
|
|
354
|
+
}
|
|
355
|
+
/** Exchange an OAuth `code` for a workspace-scoped token set. */
|
|
356
|
+
async exchangeOAuthCode(code, redirectUri) {
|
|
357
|
+
return this.#requestTokens({
|
|
358
|
+
grant_type: "authorization_code",
|
|
359
|
+
code,
|
|
360
|
+
redirect_uri: redirectUri
|
|
361
|
+
}, "token exchange");
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Exchange a refresh token for a new token set. Linear rotates refresh
|
|
365
|
+
* tokens, so the returned set replaces the stored one entirely. A 400/401
|
|
366
|
+
* here means the refresh token is invalid/revoked and the org must
|
|
367
|
+
* re-authorize.
|
|
368
|
+
*/
|
|
369
|
+
async refreshAccessToken(refreshToken) {
|
|
370
|
+
return this.#requestTokens({
|
|
371
|
+
grant_type: "refresh_token",
|
|
372
|
+
refresh_token: refreshToken
|
|
373
|
+
}, "token refresh");
|
|
374
|
+
}
|
|
375
|
+
/** POST to Linear's token endpoint and normalize the response. */
|
|
376
|
+
async #requestTokens(params, label) {
|
|
377
|
+
const res = await fetch(LINEAR_TOKEN_URL, {
|
|
378
|
+
method: "POST",
|
|
379
|
+
signal: AbortSignal.timeout(1e4),
|
|
380
|
+
headers: { "content-type": "application/x-www-form-urlencoded" },
|
|
381
|
+
body: new URLSearchParams({
|
|
382
|
+
...params,
|
|
383
|
+
client_id: this.#clientId,
|
|
384
|
+
client_secret: this.#clientSecret
|
|
385
|
+
})
|
|
386
|
+
});
|
|
387
|
+
if (!res.ok) {
|
|
388
|
+
const err = /* @__PURE__ */ new Error(`Linear ${label} failed (${res.status})`);
|
|
389
|
+
err.status = res.status;
|
|
390
|
+
throw err;
|
|
391
|
+
}
|
|
392
|
+
const body = await res.json();
|
|
393
|
+
if (!body.access_token) throw new Error(`Linear ${label} returned no access token.`);
|
|
394
|
+
return {
|
|
395
|
+
accessToken: body.access_token,
|
|
396
|
+
refreshToken: body.refresh_token ?? null,
|
|
397
|
+
expiresAt: typeof body.expires_in === "number" ? new Date(Date.now() + body.expires_in * 1e3) : null,
|
|
398
|
+
scope: body.scope ?? null
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
/** Fetch the workspace (organization) the access token is scoped to. */
|
|
402
|
+
async fetchWorkspace(accessToken) {
|
|
403
|
+
const data = await linearGraphql(accessToken, `query { organization { name urlKey } }`);
|
|
404
|
+
return {
|
|
405
|
+
name: data.organization.name,
|
|
406
|
+
urlKey: data.organization.urlKey
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
async #listIntakeIssues(input) {
|
|
410
|
+
const accessToken = getLinearAccessToken(input.connection);
|
|
411
|
+
if (input.sourceIds.length === 0) return {
|
|
412
|
+
issues: [],
|
|
413
|
+
nextCursor: null
|
|
414
|
+
};
|
|
415
|
+
const attributionSourceIds = input.attributionSourceIds ?? input.sourceIds;
|
|
416
|
+
const { projectIds, teamIds } = splitSelfManagedSourceIds(input.sourceIds);
|
|
417
|
+
const cursors = await decodeSelfManagedListCursor(input.cursor, input.sourceIds, attributionSourceIds);
|
|
418
|
+
if (teamIds.length === 0) {
|
|
419
|
+
if (cursors.projects === null) return {
|
|
420
|
+
issues: [],
|
|
421
|
+
nextCursor: null
|
|
422
|
+
};
|
|
423
|
+
const result = await this.listActiveIssues(accessToken, cursors.projects, projectIds, input.labels);
|
|
424
|
+
return {
|
|
425
|
+
issues: result.issues.map((issue) => linearIssueToIntakeIssue(issue)),
|
|
426
|
+
nextCursor: await encodeSelfManagedListCursor({
|
|
427
|
+
projects: result.nextCursor,
|
|
428
|
+
teams: null
|
|
429
|
+
}, input.sourceIds, attributionSourceIds)
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
const projectResult = projectIds.length > 0 && cursors.projects !== null ? await this.listActiveIssues(accessToken, cursors.projects, projectIds, input.labels) : {
|
|
433
|
+
issues: [],
|
|
434
|
+
nextCursor: null
|
|
435
|
+
};
|
|
436
|
+
const teamResult = cursors.teams !== null ? await this.listActiveIssues(accessToken, cursors.teams, void 0, input.labels, teamIds) : {
|
|
437
|
+
issues: [],
|
|
438
|
+
nextCursor: null
|
|
439
|
+
};
|
|
440
|
+
const projectIssues = projectResult.issues.map((issue) => linearIssueToIntakeIssue(issue));
|
|
441
|
+
const selectedTeamSourceById = new Map(teamIds.map((teamId) => [teamId, encodeSelfManagedTeamSourceId(teamId)]));
|
|
442
|
+
const selectedProjectIds = new Set(splitSelfManagedSourceIds(attributionSourceIds).projectIds);
|
|
443
|
+
const teamIssues = teamResult.issues.filter((issue) => issue.projectId === null || !selectedProjectIds.has(issue.projectId)).map((issue) => {
|
|
444
|
+
const teamSourceId = issue.teamId ? selectedTeamSourceById.get(issue.teamId) : void 0;
|
|
445
|
+
if (!teamSourceId) throw new Error("Linear returned an issue outside the selected teams.");
|
|
446
|
+
return {
|
|
447
|
+
...linearIssueToIntakeIssue(issue),
|
|
448
|
+
sourceId: teamSourceId
|
|
449
|
+
};
|
|
450
|
+
});
|
|
451
|
+
return {
|
|
452
|
+
issues: dedupeSelfManagedIssues([...projectIssues, ...teamIssues]),
|
|
453
|
+
nextCursor: await encodeSelfManagedListCursor({
|
|
454
|
+
projects: projectResult.nextCursor,
|
|
455
|
+
teams: teamResult.nextCursor
|
|
456
|
+
}, input.sourceIds, attributionSourceIds)
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
async #getIntakeIssue(input) {
|
|
460
|
+
const accessToken = getLinearAccessToken(input.connection);
|
|
461
|
+
const issue = await this.fetchIssueDetail(accessToken, input.issueId);
|
|
462
|
+
if (!issue) return null;
|
|
463
|
+
return {
|
|
464
|
+
...linearIssueToIntakeIssue(issue),
|
|
465
|
+
description: issue.description,
|
|
466
|
+
commentCount: issue.comments.length,
|
|
467
|
+
comments: issue.comments
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
async #createIntakeComment(input) {
|
|
471
|
+
const accessToken = getLinearAccessToken(input.connection);
|
|
472
|
+
return this.createIssueComment(accessToken, input.issueId, input.body);
|
|
473
|
+
}
|
|
474
|
+
async #updateIntakeIssue(input) {
|
|
475
|
+
const accessToken = getLinearAccessToken(input.connection);
|
|
476
|
+
const issue = await this.fetchIssueDetail(accessToken, input.issueId);
|
|
477
|
+
if (!issue) return null;
|
|
478
|
+
const teamKey = issue.team;
|
|
479
|
+
if (!teamKey) return null;
|
|
480
|
+
const states = await this.#listTeamWorkflowStates(accessToken, teamKey);
|
|
481
|
+
let targetState = null;
|
|
482
|
+
if (input.state.kind === "byType") {
|
|
483
|
+
const wantedType = input.state.stateType;
|
|
484
|
+
targetState = states.find((state) => state.type === wantedType) ?? null;
|
|
485
|
+
} else {
|
|
486
|
+
const wanted = input.state.name.toLowerCase();
|
|
487
|
+
targetState = states.find((state) => state.name.toLowerCase() === wanted) ?? null;
|
|
488
|
+
}
|
|
489
|
+
if (!targetState) return null;
|
|
490
|
+
if (targetState.name === issue.state) return linearIssueToIntakeIssue(issue);
|
|
491
|
+
if (!(await linearGraphql(accessToken, `mutation UpdateIssueState($id: String!, $stateId: String!) {
|
|
492
|
+
issueUpdate(id: $id, input: { stateId: $stateId }) { success }
|
|
493
|
+
}`, {
|
|
494
|
+
id: issue.id,
|
|
495
|
+
stateId: targetState.id
|
|
496
|
+
})).issueUpdate.success) throw new Error("Linear did not accept the issue update.");
|
|
497
|
+
const fresh = await this.fetchIssueDetail(accessToken, issue.id);
|
|
498
|
+
if (!fresh) return null;
|
|
499
|
+
return linearIssueToIntakeIssue(fresh);
|
|
500
|
+
}
|
|
501
|
+
async #listTeamWorkflowStates(accessToken, teamKey) {
|
|
502
|
+
return (await linearGraphql(accessToken, `query TeamStates($key: String!) {
|
|
503
|
+
team(id: $key) { states(first: 100) { nodes { id name type } } }
|
|
504
|
+
}`, { key: teamKey })).team?.states.nodes ?? [];
|
|
505
|
+
}
|
|
506
|
+
/** List the workspace's projects (for the Settings intake-source picker). */
|
|
507
|
+
async listProjects(accessToken) {
|
|
508
|
+
return (await linearGraphql(accessToken, `query { projects(first: 100) { nodes { id name state teams(first: 10) { nodes { id key name } } } } }`)).projects.nodes.map((node) => ({
|
|
509
|
+
id: node.id,
|
|
510
|
+
name: node.name,
|
|
511
|
+
state: node.state,
|
|
512
|
+
teams: node.teams.nodes.map((team) => ({
|
|
513
|
+
id: team.id,
|
|
514
|
+
key: team.key,
|
|
515
|
+
name: team.name
|
|
516
|
+
}))
|
|
517
|
+
}));
|
|
518
|
+
}
|
|
519
|
+
/** List the workspace's teams (for the Settings intake-source picker). */
|
|
520
|
+
async listTeams(accessToken) {
|
|
521
|
+
const teams = [];
|
|
522
|
+
let after;
|
|
523
|
+
for (let page = 0; page < LINEAR_TEAMS_MAX_PAGES; page += 1) {
|
|
524
|
+
const data = await linearGraphql(accessToken, `query Teams($first: Int!, $after: String) {
|
|
525
|
+
teams(first: $first, after: $after) {
|
|
526
|
+
nodes { id key name }
|
|
527
|
+
pageInfo { hasNextPage endCursor }
|
|
528
|
+
}
|
|
529
|
+
}`, {
|
|
530
|
+
first: LINEAR_TEAMS_PAGE_SIZE,
|
|
531
|
+
...after ? { after } : {}
|
|
532
|
+
});
|
|
533
|
+
teams.push(...data.teams.nodes);
|
|
534
|
+
if (!data.teams.pageInfo.hasNextPage || !data.teams.pageInfo.endCursor) break;
|
|
535
|
+
if (data.teams.pageInfo.endCursor === after) throw invalidLinearCursor();
|
|
536
|
+
after = data.teams.pageInfo.endCursor;
|
|
537
|
+
}
|
|
538
|
+
return teams.map((team) => ({
|
|
539
|
+
id: team.id,
|
|
540
|
+
key: team.key,
|
|
541
|
+
name: team.name,
|
|
542
|
+
sourceId: encodeSelfManagedTeamSourceId(team.id)
|
|
543
|
+
}));
|
|
544
|
+
}
|
|
545
|
+
sourceMatchesIssue(sourceId, issue) {
|
|
546
|
+
return isSelfManagedTeamSourceId(sourceId) ? issue.teamId === decodeSelfManagedTeamSourceId(sourceId) : issue.projectId === sourceId;
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* List one page of the workspace's active issues (triage/backlog/unstarted/
|
|
550
|
+
* started — completed and canceled are excluded), most recently updated
|
|
551
|
+
* first. When `projectIds` is provided, only issues from those projects are
|
|
552
|
+
* returned. When `teamIds` is provided, only issues in those teams are
|
|
553
|
+
* returned, including issues that belong to no project. Callers list team
|
|
554
|
+
* sources and project sources in separate calls so the two filters are not
|
|
555
|
+
* AND-ed together.
|
|
556
|
+
*/
|
|
557
|
+
async listActiveIssues(accessToken, after, projectIds, labels, teamIds) {
|
|
558
|
+
const normalizedLabels = [...new Set((labels ?? []).map((label) => label.trim()).filter(Boolean))];
|
|
559
|
+
const projectFilter = projectIds?.length ? ", project: { id: { in: $projectIds } }" : "";
|
|
560
|
+
const projectVar = projectIds?.length ? ", $projectIds: [ID!]" : "";
|
|
561
|
+
const teamFilter = teamIds?.length ? ", team: { id: { in: $teamIds } }" : "";
|
|
562
|
+
const teamVar = teamIds?.length ? ", $teamIds: [ID!]" : "";
|
|
563
|
+
const labelFilter = normalizedLabels.length > 0 ? ", labels: { name: { in: $labels } }" : "";
|
|
564
|
+
const { nodes, pageInfo } = (await linearGraphql(accessToken, `query Intake($first: Int!, $after: String${projectVar}${teamVar}${normalizedLabels.length > 0 ? ", $labels: [String!]" : ""}) {
|
|
565
|
+
issues(
|
|
566
|
+
first: $first
|
|
567
|
+
after: $after
|
|
568
|
+
orderBy: updatedAt
|
|
569
|
+
filter: { state: { type: { in: ["triage", "backlog", "unstarted", "started"] } }${projectFilter}${teamFilter}${labelFilter} }
|
|
570
|
+
) {
|
|
571
|
+
nodes {
|
|
572
|
+
id
|
|
573
|
+
identifier
|
|
574
|
+
title
|
|
575
|
+
url
|
|
576
|
+
priorityLabel
|
|
577
|
+
createdAt
|
|
578
|
+
updatedAt
|
|
579
|
+
state { name type }
|
|
580
|
+
project { id }
|
|
581
|
+
assignee { name }
|
|
582
|
+
creator { name }
|
|
583
|
+
team { id key }
|
|
584
|
+
labels { nodes { name } }
|
|
585
|
+
}
|
|
586
|
+
pageInfo { hasNextPage endCursor }
|
|
587
|
+
}
|
|
588
|
+
}`, {
|
|
589
|
+
first: LINEAR_ISSUES_PAGE_SIZE,
|
|
590
|
+
after: after ?? null,
|
|
591
|
+
...projectIds?.length ? { projectIds } : {},
|
|
592
|
+
...teamIds?.length ? { teamIds } : {},
|
|
593
|
+
...normalizedLabels.length > 0 ? { labels: normalizedLabels } : {}
|
|
594
|
+
})).issues;
|
|
595
|
+
return {
|
|
596
|
+
issues: nodes.map((node) => ({
|
|
597
|
+
id: node.id,
|
|
598
|
+
projectId: node.project?.id ?? null,
|
|
599
|
+
identifier: node.identifier,
|
|
600
|
+
title: node.title,
|
|
601
|
+
url: node.url,
|
|
602
|
+
state: node.state.name,
|
|
603
|
+
stateType: node.state.type,
|
|
604
|
+
priorityLabel: node.priorityLabel,
|
|
605
|
+
assignee: node.assignee?.name ?? null,
|
|
606
|
+
creator: node.creator?.name ?? null,
|
|
607
|
+
team: node.team?.key ?? null,
|
|
608
|
+
labels: node.labels.nodes.map((label) => label.name),
|
|
609
|
+
createdAt: node.createdAt,
|
|
610
|
+
updatedAt: node.updatedAt,
|
|
611
|
+
teamId: node.team?.id ?? null
|
|
612
|
+
})),
|
|
613
|
+
nextCursor: pageInfo.hasNextPage ? pageInfo.endCursor : null
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
/** Follow `comments.pageInfo` until exhausted so long discussions aren't truncated. */
|
|
617
|
+
async #fetchRemainingIssueComments(accessToken, issueId, firstPage) {
|
|
618
|
+
const nodes = [...firstPage.nodes];
|
|
619
|
+
let { hasNextPage, endCursor } = firstPage.pageInfo;
|
|
620
|
+
for (let page = 1; hasNextPage && endCursor && page < ISSUE_COMMENTS_MAX_PAGES; page++) {
|
|
621
|
+
const comments = (await linearGraphql(accessToken, `query IssueComments($id: String!, $first: Int!, $after: String!) {
|
|
622
|
+
issue(id: $id) {
|
|
623
|
+
comments(first: $first, after: $after) {
|
|
624
|
+
nodes { body createdAt user { name } }
|
|
625
|
+
pageInfo { hasNextPage endCursor }
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
}`, {
|
|
629
|
+
id: issueId,
|
|
630
|
+
first: ISSUE_COMMENTS_PAGE_SIZE,
|
|
631
|
+
after: endCursor
|
|
632
|
+
})).issue?.comments;
|
|
633
|
+
if (!comments) break;
|
|
634
|
+
nodes.push(...comments.nodes);
|
|
635
|
+
if (comments.pageInfo.hasNextPage && comments.pageInfo.endCursor === endCursor) throw invalidLinearCursor();
|
|
636
|
+
({hasNextPage, endCursor} = comments.pageInfo);
|
|
637
|
+
}
|
|
638
|
+
return nodes;
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Fetch one issue with its description and comments. `idOrIdentifier`
|
|
642
|
+
* accepts both the Linear UUID and the human key (`ENG-123`). Returns
|
|
643
|
+
* `null` when the issue doesn't exist (Linear reports it as an "Entity not
|
|
644
|
+
* found" error).
|
|
645
|
+
*/
|
|
646
|
+
async fetchIssueDetail(accessToken, idOrIdentifier, _sourceIds, _routedSourceIds) {
|
|
647
|
+
let data;
|
|
648
|
+
try {
|
|
649
|
+
data = await linearGraphql(accessToken, `query IssueDetail($id: String!, $commentsFirst: Int!) {
|
|
650
|
+
issue(id: $id) {
|
|
651
|
+
id
|
|
652
|
+
identifier
|
|
653
|
+
title
|
|
654
|
+
description
|
|
655
|
+
url
|
|
656
|
+
priorityLabel
|
|
657
|
+
createdAt
|
|
658
|
+
updatedAt
|
|
659
|
+
state { name type }
|
|
660
|
+
project { id }
|
|
661
|
+
assignee { name }
|
|
662
|
+
creator { name }
|
|
663
|
+
team { id key }
|
|
664
|
+
labels { nodes { name } }
|
|
665
|
+
comments(first: $commentsFirst) {
|
|
666
|
+
nodes { body createdAt user { name } }
|
|
667
|
+
pageInfo { hasNextPage endCursor }
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
}`, {
|
|
671
|
+
id: idOrIdentifier,
|
|
672
|
+
commentsFirst: ISSUE_COMMENTS_PAGE_SIZE
|
|
673
|
+
});
|
|
674
|
+
} catch (err) {
|
|
675
|
+
if (err instanceof Error && /entity not found/i.test(err.message)) return null;
|
|
676
|
+
throw err;
|
|
677
|
+
}
|
|
678
|
+
const issue = data.issue;
|
|
679
|
+
if (!issue) return null;
|
|
680
|
+
const comments = (await this.#fetchRemainingIssueComments(accessToken, issue.id, issue.comments)).sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime());
|
|
681
|
+
return {
|
|
682
|
+
id: issue.id,
|
|
683
|
+
projectId: issue.project?.id ?? null,
|
|
684
|
+
teamId: issue.team?.id ?? null,
|
|
685
|
+
identifier: issue.identifier,
|
|
686
|
+
title: issue.title,
|
|
687
|
+
description: issue.description?.trim() ? issue.description : null,
|
|
688
|
+
url: issue.url,
|
|
689
|
+
state: issue.state.name,
|
|
690
|
+
stateType: issue.state.type,
|
|
691
|
+
priorityLabel: issue.priorityLabel,
|
|
692
|
+
assignee: issue.assignee?.name ?? null,
|
|
693
|
+
creator: issue.creator?.name ?? null,
|
|
694
|
+
team: issue.team?.key ?? null,
|
|
695
|
+
labels: issue.labels.nodes.map((label) => label.name),
|
|
696
|
+
createdAt: issue.createdAt,
|
|
697
|
+
updatedAt: issue.updatedAt,
|
|
698
|
+
comments: comments.map((comment) => ({
|
|
699
|
+
author: comment.user?.name ?? null,
|
|
700
|
+
body: comment.body,
|
|
701
|
+
createdAt: comment.createdAt
|
|
702
|
+
}))
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* Post a comment on an issue. `idOrIdentifier` accepts both the Linear UUID
|
|
707
|
+
* and the human key (`ENG-123`) — the identifier is resolved to a UUID
|
|
708
|
+
* first because `commentCreate` only accepts UUIDs. Returns `null` when the
|
|
709
|
+
* issue doesn't exist.
|
|
710
|
+
*/
|
|
711
|
+
async createIssueComment(accessToken, idOrIdentifier, body) {
|
|
712
|
+
let issueId;
|
|
713
|
+
try {
|
|
714
|
+
const data = await linearGraphql(accessToken, `query IssueId($id: String!) { issue(id: $id) { id } }`, { id: idOrIdentifier });
|
|
715
|
+
if (!data.issue) return null;
|
|
716
|
+
issueId = data.issue.id;
|
|
717
|
+
} catch (err) {
|
|
718
|
+
if (err instanceof Error && /entity not found/i.test(err.message)) return null;
|
|
719
|
+
throw err;
|
|
720
|
+
}
|
|
721
|
+
const data = await linearGraphql(accessToken, `mutation CommentCreate($input: CommentCreateInput!) {
|
|
722
|
+
commentCreate(input: $input) { success comment { id url } }
|
|
723
|
+
}`, { input: {
|
|
724
|
+
issueId,
|
|
725
|
+
body
|
|
726
|
+
} });
|
|
727
|
+
if (!data.commentCreate.success || !data.commentCreate.comment) throw new Error("Linear did not accept the comment.");
|
|
728
|
+
return data.commentCreate.comment;
|
|
729
|
+
}
|
|
730
|
+
workers(ctx) {
|
|
731
|
+
if (!linearIssueReconciliationEnabled()) return [];
|
|
732
|
+
const reconcile = attachLinearIssueReconciler(this, ctx);
|
|
733
|
+
if (!reconcile) return [];
|
|
734
|
+
const intervalMs = linearIssueReconciliationInterval();
|
|
735
|
+
return [new IssueReconcileWorker({
|
|
736
|
+
integrationId: this.id,
|
|
737
|
+
reconcile,
|
|
738
|
+
...intervalMs ? { intervalMs } : {}
|
|
739
|
+
})];
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* The integration's HTTP surface: `/web/linear/*` + `/auth/linear/*` Mastra
|
|
743
|
+
* `apiRoutes` (status, OAuth connect/callback, projects + issues for
|
|
744
|
+
* Intake). Handlers operate on this instance.
|
|
745
|
+
*/
|
|
746
|
+
routes(ctx) {
|
|
747
|
+
return buildLinearRoutes({
|
|
748
|
+
linear: this,
|
|
749
|
+
auth: ctx.auth,
|
|
750
|
+
stateSigner: ctx.stateSigner,
|
|
751
|
+
baseUrl: ctx.baseUrl,
|
|
752
|
+
intake: ctx.storage.intake,
|
|
753
|
+
projects: ctx.storage.projects,
|
|
754
|
+
ingestFactoryIssues: attachLinearRules(this, ctx),
|
|
755
|
+
workItems: ctx.runtime?.workItems,
|
|
756
|
+
boards: ctx.runtime?.boards
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* Org-scoped agent tools: issue detail + comment tools for sessions whose
|
|
761
|
+
* project belongs to an org with an active Linear connection.
|
|
762
|
+
*/
|
|
763
|
+
async agentTools(args) {
|
|
764
|
+
return buildLinearAgentTools({
|
|
765
|
+
requestContext: args.requestContext,
|
|
766
|
+
linear: this
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
/** Non-secret config snapshot for system diagnostics/startup logs. */
|
|
770
|
+
diagnostics() {
|
|
771
|
+
return { oauthAppConfigured: true };
|
|
772
|
+
}
|
|
773
|
+
};
|
|
774
|
+
function getLinearAccessToken(connection) {
|
|
775
|
+
if (connection.type !== "oauth") throw new Error("Linear capabilities require an OAuth connection.");
|
|
776
|
+
return connection.accessToken;
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* Self-managed source ids. Projects use their raw Linear project id (no prefix,
|
|
780
|
+
* preserving existing intake bindings). Teams are prefixed so the two never
|
|
781
|
+
* collide and callers can tell them apart.
|
|
782
|
+
*/
|
|
783
|
+
const SELF_MANAGED_TEAM_SOURCE_PREFIX = "linear-team:";
|
|
784
|
+
function encodeSelfManagedTeamSourceId(teamId) {
|
|
785
|
+
return `${SELF_MANAGED_TEAM_SOURCE_PREFIX}${teamId}`;
|
|
786
|
+
}
|
|
787
|
+
function isSelfManagedTeamSourceId(sourceId) {
|
|
788
|
+
return sourceId.startsWith(SELF_MANAGED_TEAM_SOURCE_PREFIX);
|
|
789
|
+
}
|
|
790
|
+
function decodeSelfManagedTeamSourceId(sourceId) {
|
|
791
|
+
return sourceId.slice(12);
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* Split selected source ids into raw project ids and raw team ids. A team
|
|
795
|
+
* source id carries the `linear-team:` prefix; everything else is a project id.
|
|
796
|
+
*/
|
|
797
|
+
function splitSelfManagedSourceIds(sourceIds) {
|
|
798
|
+
const projectIds = [];
|
|
799
|
+
const teamIds = [];
|
|
800
|
+
for (const sourceId of sourceIds) if (isSelfManagedTeamSourceId(sourceId)) teamIds.push(decodeSelfManagedTeamSourceId(sourceId));
|
|
801
|
+
else projectIds.push(sourceId);
|
|
802
|
+
return {
|
|
803
|
+
projectIds,
|
|
804
|
+
teamIds
|
|
805
|
+
};
|
|
806
|
+
}
|
|
807
|
+
async function linearSourceSetFingerprint(sourceIds, attributionSourceIds) {
|
|
808
|
+
const scope = {
|
|
809
|
+
sourceIds: [...new Set(sourceIds)].sort(),
|
|
810
|
+
attributionSourceIds: [...new Set(attributionSourceIds)].sort()
|
|
811
|
+
};
|
|
812
|
+
const bytes = new TextEncoder().encode(JSON.stringify(scope));
|
|
813
|
+
return Buffer.from(await globalThis.crypto.subtle.digest("SHA-256", bytes)).toString("base64url");
|
|
814
|
+
}
|
|
815
|
+
function invalidLinearCursor() {
|
|
816
|
+
return Object.assign(/* @__PURE__ */ new Error("Linear cursor is invalid or stale."), { code: "invalid_cursor" });
|
|
817
|
+
}
|
|
818
|
+
function isCursorValue(value) {
|
|
819
|
+
return value === null || typeof value === "string";
|
|
820
|
+
}
|
|
821
|
+
async function decodeSelfManagedListCursor(cursor, sourceIds, attributionSourceIds) {
|
|
822
|
+
const { projectIds, teamIds } = splitSelfManagedSourceIds(sourceIds);
|
|
823
|
+
if (!cursor) return {
|
|
824
|
+
projects: projectIds.length > 0 ? void 0 : null,
|
|
825
|
+
teams: teamIds.length > 0 ? void 0 : null
|
|
826
|
+
};
|
|
827
|
+
try {
|
|
828
|
+
const parsed = JSON.parse(Buffer.from(cursor, "base64url").toString("utf8"));
|
|
829
|
+
if (parsed.v !== 1 || parsed.sourceSet !== await linearSourceSetFingerprint(sourceIds, attributionSourceIds) || !isCursorValue(parsed.projects) || !isCursorValue(parsed.teams)) throw invalidLinearCursor();
|
|
830
|
+
return {
|
|
831
|
+
projects: parsed.projects,
|
|
832
|
+
teams: parsed.teams
|
|
833
|
+
};
|
|
834
|
+
} catch {
|
|
835
|
+
throw invalidLinearCursor();
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
async function encodeSelfManagedListCursor(state, sourceIds, attributionSourceIds) {
|
|
839
|
+
if (state.projects === null && state.teams === null) return null;
|
|
840
|
+
return Buffer.from(JSON.stringify({
|
|
841
|
+
v: 1,
|
|
842
|
+
sourceSet: await linearSourceSetFingerprint(sourceIds, attributionSourceIds),
|
|
843
|
+
...state
|
|
844
|
+
})).toString("base64url");
|
|
845
|
+
}
|
|
846
|
+
/**
|
|
847
|
+
* Deduplicate issues that surfaced from both a selected team and one of its
|
|
848
|
+
* selected projects. Keeps one entry per Linear issue UUID.
|
|
849
|
+
*
|
|
850
|
+
* Tie-breaker — MOST-SPECIFIC-WINS: an issue in a selected project is
|
|
851
|
+
* attributed to that project source (routes to the project's board); the team
|
|
852
|
+
* source covers only the remainder (projectless issues and issues in projects
|
|
853
|
+
* that were not separately selected). Change the comparison here to change the
|
|
854
|
+
* routing policy — this is the single precedence point for the self-managed
|
|
855
|
+
* integration, mirroring the platform-backed one.
|
|
856
|
+
*/
|
|
857
|
+
function dedupeSelfManagedIssues(issues) {
|
|
858
|
+
const isProjectSource = (sourceId) => typeof sourceId === "string" && sourceId.length > 0 && !isSelfManagedTeamSourceId(sourceId);
|
|
859
|
+
const winners = /* @__PURE__ */ new Map();
|
|
860
|
+
for (const issue of issues) {
|
|
861
|
+
const existing = winners.get(issue.id);
|
|
862
|
+
if (!existing) {
|
|
863
|
+
winners.set(issue.id, issue);
|
|
864
|
+
continue;
|
|
865
|
+
}
|
|
866
|
+
if (isProjectSource(issue.sourceId) && !isProjectSource(existing.sourceId)) winners.set(issue.id, issue);
|
|
867
|
+
}
|
|
868
|
+
const seen = /* @__PURE__ */ new Set();
|
|
869
|
+
const ordered = [];
|
|
870
|
+
for (const issue of issues) {
|
|
871
|
+
if (seen.has(issue.id)) continue;
|
|
872
|
+
seen.add(issue.id);
|
|
873
|
+
ordered.push(winners.get(issue.id));
|
|
874
|
+
}
|
|
875
|
+
return ordered;
|
|
876
|
+
}
|
|
877
|
+
function linearIssueToIntakeIssue(issue) {
|
|
878
|
+
return {
|
|
879
|
+
id: issue.id,
|
|
880
|
+
sourceId: issue.projectId ?? null,
|
|
881
|
+
projectId: issue.projectId ?? null,
|
|
882
|
+
identifier: issue.identifier,
|
|
883
|
+
title: issue.title,
|
|
884
|
+
url: issue.url,
|
|
885
|
+
author: issue.creator,
|
|
886
|
+
state: issue.state,
|
|
887
|
+
stateType: issue.stateType,
|
|
888
|
+
priority: issue.priorityLabel,
|
|
889
|
+
assignee: issue.assignee,
|
|
890
|
+
source: issue.team,
|
|
891
|
+
labels: issue.labels,
|
|
892
|
+
commentCount: null,
|
|
893
|
+
createdAt: issue.createdAt,
|
|
894
|
+
updatedAt: issue.updatedAt
|
|
895
|
+
};
|
|
896
|
+
}
|
|
897
|
+
//#endregion
|
|
898
|
+
export { LinearIntegration, LinearReauthRequiredError };
|
|
899
|
+
|
|
900
|
+
//# sourceMappingURL=integration.js.map
|