@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 @@
|
|
|
1
|
+
{"version":3,"file":"integration.js","names":["#rules","#resolveIntakeDispatch","#listIntakeIssues","#getIntakeIssue","#createIntakeComment","#updateIntakeIssue","#sourceControlStorage","#listPullRequests","#getPullRequest","#createPullRequest","#updatePullRequest","#closePullRequest","#mergePullRequest","#listComments","#createComment","#updateComment","#deleteComment","#listReviews","#getReview","#createReview","#updateReview","#submitReview","#dismissReview","#deletePendingReview","#listReviewComments","#createReviewComment","#updateReviewComment","#deleteReviewComment","#listRequestedReviewers","#requestReviewers","#removeReviewers","#appId","#privateKey","#clientId","#clientSecret","#slug","#webhookSecret","#authorizedBots","#collaboratorPermissionCache","#collaboratorPermissionInFlight","#installationOctokits","#storage","#appAuth","#repositoryClient","#ingestFactoryEvent"],"sources":["../../../src/integrations/github/integration.ts"],"sourcesContent":["/**\n * `GithubIntegration` — the injectable GitHub App integration for the web\n * factory.\n *\n * The deploy entry (`src/mastra/index.ts`) reads the `GITHUB_APP_*` env vars\n * once, constructs an instance, and passes it to `MastraFactory` (the same\n * dependency-injection pattern as the auth adapter and the sandbox machine).\n * The factory seeds it into the runtime-config registry for the feature gate\n * (`./config.ts`) and hands the instance to every consumer explicitly — route\n * handlers receive it through `routes()`, the webhook fan-out and session\n * subscription tools through their deps.\n *\n * The class owns:\n * - the GitHub App credentials (validated + PEM-normalized at construction),\n * - every GitHub API operation the web surface performs (Octokit factories,\n * token minting, installation/repo/issue/PR listings, OAuth exchange),\n * - the webhook secret used to verify GitHub webhook deliveries,\n * - its own HTTP surface: `routes()` returns the `/web/github/*` +\n * `/auth/github/*` Mastra `apiRoutes`.\n *\n * A custom integration (different app per tenant, custom Octokit config) can\n * subclass this and override individual methods — everything downstream only\n * talks to the instance.\n */\n\nimport type { RequestContext } from '@mastra/core/request-context';\nimport type { ApiRoute } from '@mastra/core/server';\nimport type { MastraWorker } from '@mastra/core/worker';\nimport { createAppAuth } from '@octokit/auth-app';\nimport { Octokit } from '@octokit/rest';\n\nimport type { IntegrationConnection } from '../../capabilities/connection.js';\nimport type {\n CreateIntakeCommentInput,\n GetIntakeIssueInput,\n Intake,\n IntakeIssue,\n IntakeIssueDetail,\n ListIntakeIssuesInput,\n UpdateIntakeIssueInput,\n} from '../../capabilities/intake.js';\nimport type {\n PullRequest,\n PullRequestComment,\n Review,\n ReviewComment,\n VersionControl,\n} from '../../capabilities/version-control.js';\nimport type { FactoryIntegration, IntegrationContext, IntegrationTools } from '../base.js';\nimport type { GithubEventRules, GithubRuleOverrides } from './default-rules.js';\nimport { resolveGithubRules } from './default-rules.js';\nimport { attachGithubIssueReconciler } from './issue-reconciler.js';\nimport { GithubReconcileWorker } from './reconcile-worker.js';\nimport { reconcileInterval, reconciliationEnabled } from './reconciliation-config.js';\nimport { buildGithubRoutes, ingestLinkedRepositoryBacklog } from './routes.js';\nimport { attachGithubReconciler, attachGithubRules } from './rules.js';\nimport type { ReconcileIssueState, ReconcilePullRequestState } from './rules.js';\nimport {\n createGithubSubscriptionTools,\n parseCreatedPullRequest,\n subscribeCurrentSessionToPullRequest,\n} from './session-subscriptions.js';\nimport { settleOrAbort } from './settle-or-abort.js';\nimport type { GithubSubscriptionStorage } from './subscriptions.js';\n\ntype InputOf<TMethod extends keyof VersionControl> = VersionControl[TMethod] extends (input: infer TInput) => unknown\n ? TInput\n : never;\n\n/**\n * Normalize a PEM private key supplied via env. Env tooling tends to mangle\n * multi-line PEMs, so two single-line forms are supported:\n * - `\\n`-escaped: literal `\\n` sequences become real newlines\n * - fully flattened: newlines stripped entirely — the PEM is rebuilt by\n * re-wrapping the base64 body (Node's decoder rejects header/body/footer\n * on one line with `error:1E08010C:DECODER routines::unsupported`)\n */\nexport function normalizePrivateKey(raw: string): string {\n const key = raw.replace(/\\\\n/g, '\\n');\n if (key.includes('\\n')) return key;\n const flattened = key.trim().match(/^(-----BEGIN [A-Z0-9 ]+-----)\\s*(.+?)\\s*(-----END [A-Z0-9 ]+-----)$/);\n if (!flattened) return key;\n const body = flattened[2]!.replace(/\\s+/g, '');\n return `${flattened[1]}\\n${body.match(/.{1,64}/g)!.join('\\n')}\\n${flattened[3]}\\n`;\n}\n\nexport interface UserInstallation {\n installationId: number;\n accountLogin: string | null;\n accountType: string | null;\n}\n\nexport interface RepoSummary {\n id: number;\n fullName: string;\n name: string;\n owner: string;\n defaultBranch: string;\n private: boolean;\n installationId: number;\n}\n\nexport interface GithubTriageCommentUpsertInput {\n installationId: number;\n repository: string;\n issueNumber: number;\n body: string;\n}\n\nexport interface GithubTriageCommentUpsertResult {\n action: 'created' | 'updated';\n commentId: string;\n url: string;\n}\n\nexport type GithubRepositoryPermission = 'admin' | 'maintain' | 'write' | 'triage' | 'read' | 'none';\n\n/**\n * How long a collaborator permission lookup may be reused. The reconcile\n * sweep re-stamps every open card's author and webhook gating checks every\n * human sender, so one login can cost dozens of identical requests per cycle\n * against the installation's REST budget. Revoked access reads as trusted for\n * at most this long.\n */\nconst COLLABORATOR_PERMISSION_CACHE_TTL_MS = 30 * 60_000;\nconst COLLABORATOR_PERMISSION_CACHE_MAX_ENTRIES = 1000;\n/** Bound on the shared upstream lookup; callers race their own signal against it. */\nconst COLLABORATOR_PERMISSION_LOOKUP_TIMEOUT_MS = 10_000;\n/** Installations whose Octokit (and cached token) is kept; least recently used is evicted. */\nconst INSTALLATION_OCTOKIT_CACHE_MAX_ENTRIES = 1000;\n/** Missed-open issue discovery reads at most this many pages per repository per sweep. */\nconst OPEN_ISSUE_DISCOVERY_MAX_PAGES = 5;\nconst OPEN_ISSUE_DISCOVERY_PAGE_SIZE = 100;\n\nexport interface IssueSummary {\n number: number;\n title: string;\n url: string;\n author: string | null;\n assignees: string[];\n labels: string[];\n comments: number;\n createdAt: string;\n updatedAt: string;\n}\n\n/** Page size for issue/PR listings; one GitHub API call per page. */\nexport const LIST_PAGE_SIZE = 30;\n\n/** Allow GitHub OAuth token exchanges enough time to complete during installation callbacks. */\nconst GITHUB_OAUTH_TOKEN_TIMEOUT_MS = 10_000;\n\nexport interface IssuePage {\n issues: IssueSummary[];\n /** Next page number to request, or `null` when this was the last page. */\n nextPage: number | null;\n}\n\nexport interface ListRepoOpenIssuesOptions {\n label?: string;\n}\n\nexport interface GithubIntegrationConfig {\n /** Replace an event handler, or disable it with null; omitted events keep defaults. */\n rules?: GithubRuleOverrides;\n /** GitHub App id (the numeric id, as a string). */\n appId: string;\n /**\n * App private key (PEM). Multi-line, `\\n`-escaped, and fully flattened\n * single-line forms are all accepted (normalized at construction).\n */\n privateKey: string;\n /** OAuth client id of the GitHub App. */\n clientId: string;\n /** OAuth client secret of the GitHub App. */\n clientSecret: string;\n /** App slug — the URL name used to build the install URL. */\n slug: string;\n /**\n * Secret GitHub uses to sign webhook deliveries. Omitted → webhook\n * signature verification rejects all deliveries. Also serves as the default\n * replica-stable OAuth/install `state` secret (see `./config.ts`).\n */\n webhookSecret?: string;\n /**\n * Extra bot logins authorized to trigger author-gated PR notifications\n * (reviews and comments). Merged over the built-in defaults, matched\n * case-insensitively. Deployments running their own reviewer bots opt them\n * in here; every other bot stays gated.\n */\n authorizedBots?: string[];\n}\n\n/** Human-readable names of the required config fields, for construction errors. */\nconst REQUIRED_FIELDS = ['appId', 'privateKey', 'clientId', 'clientSecret', 'slug'] as const;\n\nexport class GithubIntegration implements FactoryIntegration {\n /** Stable integration identifier (see `../factory-integration.ts`). */\n readonly id = 'github';\n readonly #rules: GithubEventRules;\n\n get rules(): GithubEventRules {\n return this.#rules;\n }\n readonly intake: Intake = {\n resolveIntakeDispatch: input => this.#resolveIntakeDispatch(input),\n listSources: async ({ orgId }) => {\n const installations = await this.sourceControlStorage.installations.list({ orgId });\n const repositories = await Promise.all(\n installations.map(installation =>\n this.sourceControlStorage.repositories.list({ orgId, installationId: installation.id }),\n ),\n );\n return repositories.flat().map(repository => ({\n id: repository.id,\n name: repository.slug,\n type: 'repository',\n metadata: { defaultBranch: repository.defaultBranch },\n }));\n },\n listItems: async ({ orgId, sourceIds, cursor }) => {\n const page = cursor ? Number.parseInt(cursor, 10) : 1;\n const requestedPage = Number.isSafeInteger(page) && page > 0 ? page : 1;\n const pages = await Promise.all(\n sourceIds.map(async sourceId => {\n const repository = await this.sourceControlStorage.repositories.get({ orgId, id: sourceId });\n if (!repository) return { items: [], hasNextPage: false };\n const installation = await this.sourceControlStorage.installations.get({\n orgId,\n id: repository.installationId,\n });\n if (!installation) return { items: [], hasNextPage: false };\n const installationId = Number.parseInt(installation.externalId, 10);\n if (!Number.isSafeInteger(installationId)) return { items: [], hasNextPage: false };\n const [issues, pullRequests] = await Promise.all([\n this.listRepoOpenIssues(installationId, repository.slug, requestedPage),\n this.versionControl.listPullRequests({\n connection: { type: 'app-installation', installationId },\n sourceId: repository.slug,\n includeDrafts: false,\n cursor: String(requestedPage),\n }),\n ]);\n return {\n items: [\n ...issues.issues.map(issue => ({\n source: { type: 'issue', externalId: `${repository.externalId}:${issue.number}`, url: issue.url },\n sourceId: repository.id,\n title: issue.title,\n status: 'open',\n labels: issue.labels,\n createdAt: issue.createdAt,\n updatedAt: issue.updatedAt,\n metadata: { repository: repository.slug, number: issue.number, author: issue.author },\n })),\n ...pullRequests.pullRequests.map(pullRequest => ({\n source: {\n type: 'pull-request',\n externalId: `${repository.externalId}:${pullRequest.id}`,\n url: pullRequest.url,\n },\n sourceId: repository.id,\n title: pullRequest.title,\n status: 'open',\n createdAt: pullRequest.createdAt,\n updatedAt: pullRequest.updatedAt,\n metadata: {\n repository: repository.slug,\n number: Number(pullRequest.id),\n author: pullRequest.author,\n baseBranch: pullRequest.baseBranch,\n headBranch: pullRequest.headBranch,\n },\n })),\n ],\n hasNextPage: issues.nextPage !== null || pullRequests.nextCursor !== null,\n };\n }),\n );\n return {\n items: pages.flatMap(result => result.items),\n nextCursor: pages.some(result => result.hasNextPage) ? String(requestedPage + 1) : null,\n };\n },\n listIssues: input => this.#listIntakeIssues(input),\n getIssue: input => this.#getIntakeIssue(input),\n createComment: input => this.#createIntakeComment(input),\n updateIssue: input => this.#updateIntakeIssue(input),\n };\n readonly versionControl: VersionControl = {\n initialize: ({ storage }) => {\n this.#sourceControlStorage = storage;\n },\n registerInstallation: ({ orgId, userId, installation }) =>\n this.sourceControlStorage.installations.upsert({\n orgId,\n connectedByUserId: userId,\n externalId: installation.externalId,\n accountName: installation.accountName,\n accountType: installation.accountType,\n providerMetadata: installation.metadata,\n }),\n registerRepositories: ({ orgId, installationId, repositories }) =>\n Promise.all(\n repositories.map(repository =>\n this.sourceControlStorage.repositories.upsert({\n orgId,\n input: {\n installationId,\n externalId: repository.externalId,\n slug: repository.slug,\n defaultBranch: repository.defaultBranch,\n providerMetadata: repository.metadata,\n },\n }),\n ),\n ),\n getRepositoryTarget: async ({ orgId, repositoryId }) => {\n const repository = await this.sourceControlStorage.repositories.get({ orgId, id: repositoryId });\n if (!repository) throw new Error('Version-control repository not found.');\n const installation = await this.sourceControlStorage.installations.get({\n orgId,\n id: repository.installationId,\n });\n if (!installation) throw new Error('Version-control installation not found.');\n const installationId = Number.parseInt(installation.externalId, 10);\n if (!Number.isSafeInteger(installationId)) throw new Error('GitHub installation id is invalid.');\n return {\n connection: { type: 'app-installation', installationId },\n sourceId: repository.slug,\n };\n },\n getRepositoryAccess: async ({ orgId, repositoryId }) => {\n const repository = await this.sourceControlStorage.repositories.get({ orgId, id: repositoryId });\n if (!repository) throw new Error('Version-control repository not found.');\n const installation = await this.sourceControlStorage.installations.get({\n orgId,\n id: repository.installationId,\n });\n if (!installation) throw new Error('Version-control installation not found.');\n const installationId = Number.parseInt(installation.externalId, 10);\n if (!Number.isSafeInteger(installationId)) throw new Error('GitHub installation id is invalid.');\n return {\n cloneUrl: `https://github.com/${repository.slug}.git`,\n authorization: { scheme: 'bearer', token: await this.mintInstallationToken(installationId) },\n };\n },\n listPullRequests: input => this.#listPullRequests(input),\n getPullRequest: input => this.#getPullRequest(input),\n createPullRequest: input => this.#createPullRequest(input),\n updatePullRequest: input => this.#updatePullRequest(input),\n closePullRequest: input => this.#closePullRequest(input),\n mergePullRequest: input => this.#mergePullRequest(input),\n listComments: input => this.#listComments(input),\n createComment: input => this.#createComment(input),\n updateComment: input => this.#updateComment(input),\n deleteComment: input => this.#deleteComment(input),\n listReviews: input => this.#listReviews(input),\n getReview: input => this.#getReview(input),\n createReview: input => this.#createReview(input),\n updateReview: input => this.#updateReview(input),\n submitReview: input => this.#submitReview(input),\n dismissReview: input => this.#dismissReview(input),\n deletePendingReview: input => this.#deletePendingReview(input),\n listReviewComments: input => this.#listReviewComments(input),\n createReviewComment: input => this.#createReviewComment(input),\n updateReviewComment: input => this.#updateReviewComment(input),\n deleteReviewComment: input => this.#deleteReviewComment(input),\n listRequestedReviewers: input => this.#listRequestedReviewers(input),\n requestReviewers: input => this.#requestReviewers(input),\n removeRequestedReviewers: input => this.#removeReviewers(input),\n };\n /**\n * The OAuth/install flow round-trips a signed `state` through GitHub, so a\n * multi-replica deploy needs a deployment-stable state secret.\n */\n readonly requiresStableStateSigner = true;\n\n readonly #appId: string;\n readonly #privateKey: string;\n readonly #clientId: string;\n readonly #clientSecret: string;\n readonly #slug: string;\n readonly #webhookSecret: string | undefined;\n readonly #authorizedBots: readonly string[];\n #storage: IntegrationContext['storage'] | undefined;\n #ingestFactoryEvent: ReturnType<typeof attachGithubRules>;\n #sourceControlStorage: IntegrationContext['storage']['sourceControl'] | undefined;\n /** `installationId:owner/repo:login` → cached collaborator permission (TTL-bounded). */\n readonly #collaboratorPermissionCache = new Map<\n string,\n { permission: GithubRepositoryPermission; expiresAt: number }\n >();\n /** Same key → lookup already in flight, so overlapping callers share one request. */\n readonly #collaboratorPermissionInFlight = new Map<string, Promise<GithubRepositoryPermission | undefined>>();\n /**\n * One Octokit per installation, so its auth instance keeps the installation\n * token cached (auth-app refreshes it before expiry) instead of minting a new\n * token on every call.\n */\n readonly #installationOctokits = new Map<number, Octokit>();\n\n constructor(config: GithubIntegrationConfig) {\n this.#rules = resolveGithubRules(config.rules);\n const missing = REQUIRED_FIELDS.filter(field => !config[field]);\n if (missing.length > 0) {\n throw new Error(\n `GithubIntegration: missing required config field(s): ${missing.join(', ')}. ` +\n `Provide the full GitHub App credentials (appId, privateKey, clientId, clientSecret, slug) ` +\n `or omit the integration to disable GitHub-backed repositories.`,\n );\n }\n this.#appId = config.appId;\n this.#privateKey = normalizePrivateKey(config.privateKey);\n this.#clientId = config.clientId;\n this.#clientSecret = config.clientSecret;\n this.#slug = config.slug;\n this.#webhookSecret = config.webhookSecret || undefined;\n this.#authorizedBots = (config.authorizedBots ?? []).map(bot => bot.trim()).filter(Boolean);\n }\n\n /** App slug — the URL name used to build the install URL. */\n get slug(): string {\n return this.#slug;\n }\n\n /** Whether a GitHub login belongs to this integration's App. */\n isFactoryCommentAuthor(login: string | null | undefined): boolean {\n return typeof login === 'string' && login.toLowerCase() === `${this.#slug}[bot]`.toLowerCase();\n }\n\n /** Extra bot logins authorized to trigger author-gated PR notifications. */\n get authorizedBots(): readonly string[] {\n return this.#authorizedBots;\n }\n\n get genericStorage(): IntegrationContext['storage']['generic'] {\n if (!this.#storage) throw new Error('GithubIntegration storage has not been initialized.');\n return this.#storage.generic;\n }\n\n get sourceControlStorage(): IntegrationContext['storage']['sourceControl'] {\n const storage = this.#sourceControlStorage ?? this.#storage?.sourceControl;\n if (!storage) throw new Error('GithubIntegration source-control storage has not been initialized.');\n return storage;\n }\n\n get integrationStorage(): GithubSubscriptionStorage {\n if (!this.#storage) throw new Error('GithubIntegration storage has not been initialized.');\n return this.#storage.generic as unknown as GithubSubscriptionStorage;\n }\n\n /** Resolve a stored GitHub locator without scanning installations or repositories. */\n async #resolveIntakeDispatch({\n orgId,\n externalSource,\n }: {\n orgId: string;\n externalSource: { type: string; externalId: string };\n }): Promise<{ connection: IntegrationConnection; sourceId: string; issueId: string } | null> {\n const target = parseGithubExternalTarget(externalSource.externalId);\n if (!target) return null;\n const repository = await this.sourceControlStorage.repositories.findByExternalId({\n orgId,\n externalId: target.repositoryId,\n });\n if (!repository) return null;\n const installation = await this.sourceControlStorage.installations.get({ orgId, id: repository.installationId });\n if (!installation) return null;\n const installationId = Number.parseInt(installation.externalId, 10);\n if (!Number.isSafeInteger(installationId)) return null;\n return {\n connection: { type: 'app-installation', installationId },\n sourceId: repository.slug,\n issueId: target.issueId,\n };\n }\n\n /** Secret GitHub uses to sign webhook deliveries, when configured. */\n get webhookSecret(): string | undefined {\n return this.#webhookSecret;\n }\n\n #appAuth() {\n return {\n appId: this.#appId,\n privateKey: this.#privateKey,\n clientId: this.#clientId,\n clientSecret: this.#clientSecret,\n };\n }\n\n /**\n * Octokit authenticated as the GitHub App itself (app JWT). Used for\n * app-level operations and to mint installation tokens.\n */\n getAppOctokit(): Octokit {\n return new Octokit({ authStrategy: createAppAuth, auth: this.#appAuth() });\n }\n\n /**\n * Octokit authenticated as a specific installation (installation access\n * token). Used to list repos and to operate on a repo on the user's behalf.\n */\n getInstallationOctokit(installationId: number): Octokit {\n let octokit = this.#installationOctokits.get(installationId);\n if (octokit) {\n // Re-insert so Map order tracks recency for LRU eviction.\n this.#installationOctokits.delete(installationId);\n } else {\n const created = new Octokit({ authStrategy: createAppAuth, auth: { ...this.#appAuth(), installationId } });\n // auth-app keeps serving a cached token GitHub has revoked (it only retries\n // 401s within 5 s of minting), so drop this client and mint fresh next call.\n // Not on 403: GitHub also uses it for rate limits.\n created.hook.error('request', error => {\n if ('status' in error && error.status === 401 && this.#installationOctokits.get(installationId) === created) {\n this.#installationOctokits.delete(installationId);\n }\n throw error;\n });\n octokit = created;\n if (this.#installationOctokits.size >= INSTALLATION_OCTOKIT_CACHE_MAX_ENTRIES) {\n const oldest = this.#installationOctokits.keys().next().value;\n if (oldest !== undefined) this.#installationOctokits.delete(oldest);\n }\n }\n this.#installationOctokits.set(installationId, octokit);\n return octokit;\n }\n\n /** Octokit authenticated as a user via their OAuth token (the identify step). */\n getUserOctokit(userToken: string): Octokit {\n return new Octokit({ auth: userToken });\n }\n\n /**\n * Mint a short-lived installation access token. Returned token is used only\n * server-side / inside the sandbox clone URL and never sent to the browser.\n */\n async mintInstallationToken(installationId: number): Promise<string> {\n const auth = createAppAuth(this.#appAuth());\n const installationAuth = await auth({ type: 'installation', installationId });\n return installationAuth.token;\n }\n\n /**\n * List the installations the authenticated user can access, via their OAuth\n * token (`GET /user/installations`).\n */\n async listUserInstallations(userToken: string): Promise<UserInstallation[]> {\n const octokit = this.getUserOctokit(userToken);\n const installations = await octokit.paginate(octokit.apps.listInstallationsForAuthenticatedUser, {\n per_page: 100,\n });\n return installations.map(inst => ({\n installationId: inst.id,\n accountLogin: inst.account && 'login' in inst.account ? inst.account.login : null,\n accountType: inst.account && 'type' in inst.account ? inst.account.type : null,\n }));\n }\n\n /**\n * List repos accessible to an installation (paginated). Always reads\n * GitHub directly, so `fresh` has nothing to bypass here.\n */\n async listInstallationRepos(installationId: number, _options?: { fresh?: boolean }): Promise<RepoSummary[]> {\n const octokit = this.getInstallationOctokit(installationId);\n const repos = await octokit.paginate(octokit.apps.listReposAccessibleToInstallation, {\n per_page: 100,\n });\n return repos.map(repo => ({\n id: repo.id,\n fullName: repo.full_name,\n name: repo.name,\n owner: repo.owner.login,\n defaultBranch: repo.default_branch,\n private: repo.private,\n installationId,\n }));\n }\n\n /**\n * The authenticated user's permission level on a repo, through the\n * installation. `undefined` when the repo/user is not accessible.\n */\n async getRepositoryCollaboratorPermission(\n installationId: number,\n repoFullName: string,\n username: string,\n signal?: AbortSignal,\n ): Promise<GithubRepositoryPermission | undefined> {\n const parts = splitRepoFullName(repoFullName);\n if (!parts) return undefined;\n const cacheKey = `${installationId}:${parts.owner}/${parts.repo}:${username.toLowerCase()}`;\n const cached = this.#collaboratorPermissionCache.get(cacheKey);\n if (cached && cached.expiresAt > Date.now()) return cached.permission;\n this.#collaboratorPermissionCache.delete(cacheKey);\n const inFlight = this.#collaboratorPermissionInFlight.get(cacheKey);\n if (inFlight) return settleOrAbort(inFlight, signal, undefined);\n const lookup = (async () => {\n try {\n const { data } = await this.getInstallationOctokit(installationId).repos.getCollaboratorPermissionLevel({\n ...parts,\n username,\n request: { signal: AbortSignal.timeout(COLLABORATOR_PERMISSION_LOOKUP_TIMEOUT_MS) },\n });\n const permission = data.permission as GithubRepositoryPermission;\n // Failures are not cached: a rate-limited or aborted lookup must retry\n // on the next call rather than pin the login as unknown.\n this.#collaboratorPermissionCache.set(cacheKey, {\n permission,\n expiresAt: Date.now() + COLLABORATOR_PERMISSION_CACHE_TTL_MS,\n });\n if (this.#collaboratorPermissionCache.size > COLLABORATOR_PERMISSION_CACHE_MAX_ENTRIES) {\n const oldest = this.#collaboratorPermissionCache.keys().next().value;\n if (oldest !== undefined) this.#collaboratorPermissionCache.delete(oldest);\n }\n return permission;\n } catch {\n return undefined;\n } finally {\n this.#collaboratorPermissionInFlight.delete(cacheKey);\n }\n })();\n this.#collaboratorPermissionInFlight.set(cacheKey, lookup);\n return settleOrAbort(lookup, signal, undefined);\n }\n\n /**\n * Fetch a single repo's metadata through an installation token and confirm\n * the installation actually has access to it. Returns `null` when the repo\n * is not accessible to the installation (so a client can't create a project\n * for an arbitrary repo under an installation id it merely owns).\n */\n async getInstallationRepo(installationId: number, repoFullName: string): Promise<RepoSummary | null> {\n const parts = splitRepoFullName(repoFullName);\n if (!parts) return null;\n const octokit = this.getInstallationOctokit(installationId);\n try {\n const { data } = await octokit.repos.get(parts);\n return {\n id: data.id,\n fullName: data.full_name,\n name: data.name,\n owner: data.owner.login,\n defaultBranch: data.default_branch,\n private: data.private,\n installationId,\n };\n } catch {\n return null;\n }\n }\n\n async #listIntakeIssues(input: ListIntakeIssuesInput): Promise<{ issues: IntakeIssue[]; nextCursor: string | null }> {\n const installationId = getGithubInstallationId(input.connection);\n const repoFullName = getSingleSourceId(input.sourceIds, 'GitHub Intake requires exactly one repository source.');\n const page = parsePositiveCursor(input.cursor);\n const labels = normalizeLabels(input.labels);\n const result = await this.listRepoOpenIssues(installationId, repoFullName, page, {\n label: labels.length > 0 ? labels.join(',') : undefined,\n });\n return {\n issues: result.issues.map(issue => ({\n id: String(issue.number),\n identifier: `#${issue.number}`,\n title: issue.title,\n url: issue.url,\n author: issue.author,\n state: 'open',\n stateType: 'open',\n priority: null,\n assignee: issue.assignees[0] ?? null,\n assignees: issue.assignees,\n source: repoFullName,\n labels: issue.labels,\n commentCount: issue.comments,\n createdAt: issue.createdAt,\n updatedAt: issue.updatedAt,\n })),\n nextCursor: result.nextPage === null ? null : String(result.nextPage),\n };\n }\n\n async #getIntakeIssue(input: GetIntakeIssueInput): Promise<IntakeIssueDetail | null> {\n const installationId = getGithubInstallationId(input.connection);\n const repoFullName = requireSourceId(input.sourceId, 'GitHub Intake requires a repository source.');\n const parts = splitRepoFullName(repoFullName);\n const issueNumber = parsePositiveInteger(input.issueId);\n if (!parts || issueNumber === null) return null;\n const octokit = this.getInstallationOctokit(installationId);\n try {\n const [{ data: issue }, comments] = await Promise.all([\n octokit.issues.get({ owner: parts.owner, repo: parts.repo, issue_number: issueNumber }),\n octokit.paginate(octokit.issues.listComments, {\n owner: parts.owner,\n repo: parts.repo,\n issue_number: issueNumber,\n per_page: 100,\n }),\n ]);\n if (issue.pull_request) return null;\n return {\n id: String(issue.number),\n identifier: `#${issue.number}`,\n title: issue.title,\n url: issue.html_url,\n author: issue.user?.login ?? null,\n state: issue.state,\n stateType: issue.state,\n priority: null,\n assignee: issue.assignee?.login ?? null,\n assignees: (issue.assignees ?? []).map(user => user.login).filter((login): login is string => Boolean(login)),\n source: repoFullName,\n labels: issue.labels.map(label => (typeof label === 'string' ? label : (label.name ?? ''))).filter(Boolean),\n commentCount: issue.comments,\n createdAt: issue.created_at,\n updatedAt: issue.updated_at,\n description: issue.body?.trim() ? issue.body : null,\n comments: comments.map(comment => ({\n author: comment.user?.login ?? null,\n body: comment.body ?? '',\n createdAt: comment.created_at,\n })),\n };\n } catch (err) {\n if (isNotFoundError(err)) return null;\n throw err;\n }\n }\n\n async #updateIntakeIssue(input: UpdateIntakeIssueInput): Promise<IntakeIssue | null> {\n const installationId = getGithubInstallationId(input.connection);\n const repoFullName = requireSourceId(input.sourceId, 'GitHub Intake requires a repository source.');\n const parts = splitRepoFullName(repoFullName);\n const issueNumber = parsePositiveInteger(input.issueId);\n if (!parts || issueNumber === null) return null;\n // GitHub has no custom workflow states; only open/closed. `byName` is a\n // no-op with a warn log.\n if (input.state.kind === 'byName') {\n console.warn(`GitHub integration: updateIssue byName is not supported (name=${input.state.name}); ignoring.`);\n return null;\n }\n const targetState: 'open' | 'closed' =\n input.state.stateType === 'unstarted' || input.state.stateType === 'started' ? 'open' : 'closed';\n const stateReason: 'completed' | 'not_planned' | null =\n targetState === 'closed' ? (input.state.stateType === 'canceled' ? 'not_planned' : 'completed') : null;\n const octokit = this.getInstallationOctokit(installationId);\n try {\n // Pre-flight: Factory does not close pull requests via `updateIssue`.\n // PR merges/closes belong to the version-control pipeline.\n const { data: current } = await octokit.issues.get({\n owner: parts.owner,\n repo: parts.repo,\n issue_number: issueNumber,\n });\n if (current.pull_request) {\n console.warn(\n `GitHub integration: updateIssue rejected — target ${repoFullName}#${issueNumber} is a pull request.`,\n );\n return null;\n }\n const { data: issue } = await octokit.issues.update({\n owner: parts.owner,\n repo: parts.repo,\n issue_number: issueNumber,\n state: targetState,\n ...(stateReason ? { state_reason: stateReason } : {}),\n });\n return {\n id: String(issue.number),\n identifier: `#${issue.number}`,\n title: issue.title,\n url: issue.html_url,\n author: issue.user?.login ?? null,\n state: issue.state,\n stateType: issue.state,\n priority: null,\n assignee: issue.assignee?.login ?? null,\n assignees: (issue.assignees ?? []).map(user => user.login).filter((login): login is string => Boolean(login)),\n source: repoFullName,\n labels: issue.labels.map(label => (typeof label === 'string' ? label : (label.name ?? ''))).filter(Boolean),\n commentCount: issue.comments,\n createdAt: issue.created_at,\n updatedAt: issue.updated_at,\n };\n } catch (err) {\n if (isNotFoundError(err)) return null;\n throw err;\n }\n }\n\n async #createIntakeComment(input: CreateIntakeCommentInput): Promise<{ id: string; url: string } | null> {\n const installationId = getGithubInstallationId(input.connection);\n const repoFullName = requireSourceId(input.sourceId, 'GitHub Intake requires a repository source.');\n const parts = splitRepoFullName(repoFullName);\n const issueNumber = parsePositiveInteger(input.issueId);\n if (!parts || issueNumber === null) return null;\n const octokit = this.getInstallationOctokit(installationId);\n try {\n const { data } = await octokit.issues.createComment({\n owner: parts.owner,\n repo: parts.repo,\n issue_number: issueNumber,\n body: input.body,\n });\n return { id: String(data.id), url: data.html_url };\n } catch (err) {\n if (isNotFoundError(err)) return null;\n throw err;\n }\n }\n\n #repositoryClient(connection: IntegrationConnection, sourceId: string) {\n const installationId = getGithubInstallationId(connection);\n const parts = splitRepoFullName(sourceId);\n if (!parts) throw new Error('GitHub pull requests require an owner/repository source.');\n return { octokit: this.getInstallationOctokit(installationId), parts };\n }\n\n async #listPullRequests(input: InputOf<'listPullRequests'>) {\n const { octokit, parts } = this.#repositoryClient(input.connection, input.sourceId);\n const page = parsePositiveCursor(input.cursor);\n const response = await octokit.pulls.list({\n ...parts,\n state: input.state ?? 'open',\n per_page: LIST_PAGE_SIZE,\n page,\n });\n const pullRequests = response.data\n .filter(pr => input.includeDrafts !== false || !pr.draft)\n .map(pr => parsePullRequest(pr));\n return {\n pullRequests,\n nextCursor: response.data.length === LIST_PAGE_SIZE ? String(page + 1) : null,\n };\n }\n\n async #getPullRequest(input: InputOf<'getPullRequest'>) {\n const { octokit, parts } = this.#repositoryClient(input.connection, input.sourceId);\n const pullNumber = requirePullRequestNumber(input.pullRequestId);\n try {\n const { data } = await octokit.pulls.get({ ...parts, pull_number: pullNumber });\n return parsePullRequest(data);\n } catch (err) {\n if (isNotFoundError(err)) return null;\n throw err;\n }\n }\n\n async #createPullRequest(input: InputOf<'createPullRequest'>) {\n const { octokit, parts } = this.#repositoryClient(input.connection, input.sourceId);\n const { data } = await octokit.pulls.create({\n ...parts,\n title: input.title,\n body: input.body,\n base: input.baseBranch,\n head: input.headBranch,\n draft: input.draft,\n });\n return parsePullRequest(data);\n }\n\n async #updatePullRequest(input: InputOf<'updatePullRequest'>) {\n const { octokit, parts } = this.#repositoryClient(input.connection, input.sourceId);\n const { data } = await octokit.pulls.update({\n ...parts,\n pull_number: requirePullRequestNumber(input.pullRequestId),\n title: input.title,\n body: input.body === null ? '' : input.body,\n base: input.baseBranch,\n state: input.state,\n });\n return parsePullRequest(data);\n }\n\n async #closePullRequest(input: InputOf<'closePullRequest'>) {\n return this.#updatePullRequest({ ...input, state: 'closed' });\n }\n\n async #mergePullRequest(input: InputOf<'mergePullRequest'>) {\n const { octokit, parts } = this.#repositoryClient(input.connection, input.sourceId);\n const { data } = await octokit.pulls.merge({\n ...parts,\n pull_number: requirePullRequestNumber(input.pullRequestId),\n commit_title: input.commitTitle,\n commit_message: input.commitMessage,\n merge_method: input.method,\n });\n return { merged: data.merged, message: data.message, sha: data.sha ?? null };\n }\n\n async #listComments(input: InputOf<'listComments'>) {\n const { octokit, parts } = this.#repositoryClient(input.connection, input.sourceId);\n const page = parsePositiveCursor(input.cursor);\n const response = await octokit.issues.listComments({\n ...parts,\n issue_number: requirePullRequestNumber(input.pullRequestId),\n per_page: LIST_PAGE_SIZE,\n page,\n });\n return {\n comments: response.data.map(comment => parsePullRequestComment(comment)),\n nextCursor: response.data.length === LIST_PAGE_SIZE ? String(page + 1) : null,\n };\n }\n\n async #createComment(input: InputOf<'createComment'>) {\n const { octokit, parts } = this.#repositoryClient(input.connection, input.sourceId);\n const { data } = await octokit.issues.createComment({\n ...parts,\n issue_number: requirePullRequestNumber(input.pullRequestId),\n body: input.body,\n });\n return parsePullRequestComment(data);\n }\n\n async #updateComment(input: InputOf<'updateComment'>) {\n const { octokit, parts } = this.#repositoryClient(input.connection, input.sourceId);\n const { data } = await octokit.issues.updateComment({\n ...parts,\n comment_id: requirePositiveId(input.commentId, 'comment'),\n body: input.body,\n });\n return parsePullRequestComment(data);\n }\n\n async #deleteComment(input: InputOf<'deleteComment'>) {\n const { octokit, parts } = this.#repositoryClient(input.connection, input.sourceId);\n await octokit.issues.deleteComment({ ...parts, comment_id: requirePositiveId(input.commentId, 'comment') });\n }\n\n async #listReviews(input: InputOf<'listReviews'>) {\n const { octokit, parts } = this.#repositoryClient(input.connection, input.sourceId);\n const page = parsePositiveCursor(input.cursor);\n const response = await octokit.pulls.listReviews({\n ...parts,\n pull_number: requirePullRequestNumber(input.pullRequestId),\n per_page: LIST_PAGE_SIZE,\n page,\n });\n return {\n reviews: response.data.map(review => parseReview(review)),\n nextCursor: response.data.length === LIST_PAGE_SIZE ? String(page + 1) : null,\n };\n }\n\n async #getReview(input: InputOf<'getReview'>) {\n const { octokit, parts } = this.#repositoryClient(input.connection, input.sourceId);\n try {\n const { data } = await octokit.pulls.getReview({\n ...parts,\n pull_number: requirePullRequestNumber(input.pullRequestId),\n review_id: requirePositiveId(input.reviewId, 'review'),\n });\n return parseReview(data);\n } catch (err) {\n if (isNotFoundError(err)) return null;\n throw err;\n }\n }\n\n async #createReview(input: InputOf<'createReview'>) {\n const { octokit, parts } = this.#repositoryClient(input.connection, input.sourceId);\n const { data } = await octokit.pulls.createReview({\n ...parts,\n pull_number: requirePullRequestNumber(input.pullRequestId),\n body: input.body,\n commit_id: input.commitId,\n event: input.event ? reviewEventToGithub(input.event) : undefined,\n });\n return parseReview(data);\n }\n\n async #updateReview(input: InputOf<'updateReview'>) {\n const { octokit, parts } = this.#repositoryClient(input.connection, input.sourceId);\n const { data } = await octokit.pulls.updateReview({\n ...parts,\n pull_number: requirePullRequestNumber(input.pullRequestId),\n review_id: requirePositiveId(input.reviewId, 'review'),\n body: input.body,\n });\n return parseReview(data);\n }\n\n async #submitReview(input: InputOf<'submitReview'>) {\n const { octokit, parts } = this.#repositoryClient(input.connection, input.sourceId);\n const { data } = await octokit.pulls.submitReview({\n ...parts,\n pull_number: requirePullRequestNumber(input.pullRequestId),\n review_id: requirePositiveId(input.reviewId, 'review'),\n body: input.body,\n event: reviewEventToGithub(input.event),\n });\n return parseReview(data);\n }\n\n async #dismissReview(input: InputOf<'dismissReview'>) {\n const { octokit, parts } = this.#repositoryClient(input.connection, input.sourceId);\n const { data } = await octokit.pulls.dismissReview({\n ...parts,\n pull_number: requirePullRequestNumber(input.pullRequestId),\n review_id: requirePositiveId(input.reviewId, 'review'),\n message: input.message,\n });\n return parseReview(data);\n }\n\n async #deletePendingReview(input: InputOf<'deletePendingReview'>) {\n const { octokit, parts } = this.#repositoryClient(input.connection, input.sourceId);\n await octokit.pulls.deletePendingReview({\n ...parts,\n pull_number: requirePullRequestNumber(input.pullRequestId),\n review_id: requirePositiveId(input.reviewId, 'review'),\n });\n }\n\n async #listReviewComments(input: InputOf<'listReviewComments'>) {\n const { octokit, parts } = this.#repositoryClient(input.connection, input.sourceId);\n const page = parsePositiveCursor(input.cursor);\n const response = await octokit.pulls.listReviewComments({\n ...parts,\n pull_number: requirePullRequestNumber(input.pullRequestId),\n per_page: LIST_PAGE_SIZE,\n page,\n });\n return {\n comments: response.data.map(comment => parseReviewComment(comment)),\n nextCursor: response.data.length === LIST_PAGE_SIZE ? String(page + 1) : null,\n };\n }\n\n async #createReviewComment(input: InputOf<'createReviewComment'>) {\n const { octokit, parts } = this.#repositoryClient(input.connection, input.sourceId);\n const pullNumber = requirePullRequestNumber(input.pullRequestId);\n if (input.replyToId) {\n const { data } = await octokit.pulls.createReplyForReviewComment({\n ...parts,\n pull_number: pullNumber,\n comment_id: requirePositiveId(input.replyToId, 'review comment'),\n body: input.body,\n });\n return parseReviewComment(data);\n }\n if (!input.commitId || !input.path || input.line === undefined || !input.side) {\n throw new Error('A review comment requires commitId, path, line, and side unless it is a reply.');\n }\n if ((input.startLine === undefined) !== (input.startSide === undefined)) {\n throw new Error('A multi-line review comment requires both startLine and startSide.');\n }\n const { data } = await octokit.pulls.createReviewComment({\n ...parts,\n pull_number: pullNumber,\n body: input.body,\n commit_id: input.commitId,\n path: input.path,\n line: input.line,\n side: input.side.toUpperCase() as 'LEFT' | 'RIGHT',\n start_line: input.startLine,\n start_side: input.startSide?.toUpperCase() as 'LEFT' | 'RIGHT' | undefined,\n });\n return parseReviewComment(data);\n }\n\n async #updateReviewComment(input: InputOf<'updateReviewComment'>) {\n const { octokit, parts } = this.#repositoryClient(input.connection, input.sourceId);\n const { data } = await octokit.pulls.updateReviewComment({\n ...parts,\n comment_id: requirePositiveId(input.commentId, 'review comment'),\n body: input.body,\n });\n return parseReviewComment(data);\n }\n\n async #deleteReviewComment(input: InputOf<'deleteReviewComment'>) {\n const { octokit, parts } = this.#repositoryClient(input.connection, input.sourceId);\n await octokit.pulls.deleteReviewComment({\n ...parts,\n comment_id: requirePositiveId(input.commentId, 'review comment'),\n });\n }\n\n async #listRequestedReviewers(input: InputOf<'listRequestedReviewers'>) {\n const { octokit, parts } = this.#repositoryClient(input.connection, input.sourceId);\n const { data } = await octokit.pulls.listRequestedReviewers({\n ...parts,\n pull_number: requirePullRequestNumber(input.pullRequestId),\n });\n return parseRequestedReviewers(data);\n }\n\n async #requestReviewers(input: InputOf<'requestReviewers'>) {\n const { octokit, parts } = this.#repositoryClient(input.connection, input.sourceId);\n const { data } = await octokit.pulls.requestReviewers({\n ...parts,\n pull_number: requirePullRequestNumber(input.pullRequestId),\n reviewers: input.users ?? [],\n team_reviewers: input.teams ?? [],\n });\n return parseRequestedReviewers(data);\n }\n\n async #removeReviewers(input: InputOf<'removeRequestedReviewers'>) {\n const { octokit, parts } = this.#repositoryClient(input.connection, input.sourceId);\n const { data } = await octokit.pulls.removeRequestedReviewers({\n ...parts,\n pull_number: requirePullRequestNumber(input.pullRequestId),\n reviewers: input.users ?? [],\n team_reviewers: input.teams ?? [],\n });\n return parseRequestedReviewers(data);\n }\n\n /** Add labels to an issue (deduplicated; no-op on empty/malformed input). */\n async addIssueLabels(\n installationId: number,\n repoFullName: string,\n issueNumber: number,\n labels: string[],\n ): Promise<void> {\n const parts = splitRepoFullName(repoFullName);\n if (!parts) return;\n const uniqueLabels = [...new Set(labels.map(label => label.trim()).filter(Boolean))];\n if (uniqueLabels.length === 0) return;\n const octokit = this.getInstallationOctokit(installationId);\n await octokit.issues.addLabels({\n owner: parts.owner,\n repo: parts.repo,\n issue_number: issueNumber,\n labels: uniqueLabels,\n });\n }\n\n /** Remove one label from an issue. */\n async removeIssueLabel(\n installationId: number,\n repoFullName: string,\n issueNumber: number,\n label: string,\n ): Promise<void> {\n const parts = splitRepoFullName(repoFullName);\n const labelName = label.trim();\n if (!parts || !labelName) return;\n const octokit = this.getInstallationOctokit(installationId);\n await octokit.issues.removeLabel({\n owner: parts.owner,\n repo: parts.repo,\n issue_number: issueNumber,\n name: labelName,\n });\n }\n\n /**\n * List one page of a repo's open issues through an installation token. The\n * issues API also returns pull requests, so those are filtered out (the\n * filter can make a non-final page shorter than the page size — `nextPage`\n * is derived from the raw response length, not the filtered one).\n */\n async listRepoOpenIssues(\n installationId: number,\n repoFullName: string,\n page: number,\n options: ListRepoOpenIssuesOptions = {},\n ): Promise<IssuePage> {\n const parts = splitRepoFullName(repoFullName);\n if (!parts) return { issues: [], nextPage: null };\n const octokit = this.getInstallationOctokit(installationId);\n const response = await octokit.issues.listForRepo({\n owner: parts.owner,\n repo: parts.repo,\n state: 'open',\n labels: options.label,\n per_page: LIST_PAGE_SIZE,\n page,\n });\n const issues = response.data\n .filter(issue => !issue.pull_request)\n .map(issue => ({\n number: issue.number,\n title: issue.title,\n url: issue.html_url,\n author: issue.user?.login ?? null,\n assignees: issue.assignees?.flatMap(assignee => (assignee.login ? [assignee.login] : [])) ?? [],\n labels: issue.labels.map(label => (typeof label === 'string' ? label : (label.name ?? ''))).filter(Boolean),\n comments: issue.comments,\n createdAt: issue.created_at,\n updatedAt: issue.updated_at,\n }));\n return { issues, nextPage: response.data.length === LIST_PAGE_SIZE ? page + 1 : null };\n }\n\n /**\n * Build the GitHub App install URL. `state` is carried through the install\n * flow and validated on callback.\n */\n buildInstallUrl(state: string): string {\n const url = new URL(`https://github.com/apps/${this.#slug}/installations/new`);\n url.searchParams.set('state', state);\n return url.toString();\n }\n\n /**\n * Build the OAuth identify URL (authorize) used to confirm the user's\n * identity and obtain a user token for listing their installations.\n */\n buildOAuthIdentifyUrl(state: string, redirectUri: string): string {\n const url = new URL('https://github.com/login/oauth/authorize');\n url.searchParams.set('client_id', this.#clientId);\n url.searchParams.set('redirect_uri', redirectUri);\n url.searchParams.set('state', state);\n return url.toString();\n }\n\n /** Exchange an OAuth `code` for a user access token. */\n async exchangeOAuthCode(code: string, redirectUri: string): Promise<string> {\n const res = await fetch('https://github.com/login/oauth/access_token', {\n method: 'POST',\n signal: AbortSignal.timeout(GITHUB_OAUTH_TOKEN_TIMEOUT_MS),\n headers: { 'content-type': 'application/json', accept: 'application/json' },\n body: JSON.stringify({\n client_id: this.#clientId,\n client_secret: this.#clientSecret,\n code,\n redirect_uri: redirectUri,\n }),\n });\n if (!res.ok) {\n throw new Error(`GitHub OAuth token exchange failed: ${res.status}`);\n }\n const data = (await res.json()) as { access_token?: string; error?: string; error_description?: string };\n if (!data.access_token) {\n throw new Error(\n `GitHub OAuth token exchange returned no token: ${data.error_description ?? data.error ?? 'unknown'}`,\n );\n }\n return data.access_token;\n }\n\n /**\n * The integration's HTTP surface: the `/web/github/*` + `/auth/github/*`\n * Mastra `apiRoutes` (webhook handler, install/OAuth flow, project +\n * worktree + session operations). The factory folds these into the server's\n * `apiRoutes` when the feature is ready. Handlers operate on this instance.\n */\n routes(ctx: IntegrationContext): ApiRoute[] {\n this.#storage = ctx.storage;\n const ingestFactoryEvent = attachGithubRules(this, ctx);\n this.#ingestFactoryEvent = ingestFactoryEvent;\n return buildGithubRoutes({\n github: this,\n auth: ctx.auth,\n sandbox: ctx.sandbox,\n ...(ctx.users ? { users: ctx.users } : {}),\n storage: ctx.factoryStorage,\n stateSigner: ctx.stateSigner,\n baseUrl: ctx.baseUrl,\n controller: ctx.controller,\n memorySettings: ctx.storage.memorySettings,\n emitAudit: ctx.hooks?.emitAudit,\n projects: ctx.storage.projects,\n ingestFactoryEvent,\n sessionRetirement: ctx.sessionRetirement,\n ...(ctx.workItems ? { workItems: ctx.workItems } : {}),\n });\n }\n\n /**\n * Import a newly linked repository's open issues and pull requests onto\n * the board. No-op until routes are mounted with rules configured.\n */\n async ingestLinkedRepositoryBacklog(args: { orgId: string; projectRepositoryId: string }): Promise<void> {\n await ingestLinkedRepositoryBacklog({ github: this, ...args, ingestFactoryEvent: this.#ingestFactoryEvent });\n }\n\n /**\n * Pull-request and issue sweeps share a worker and lease, but can be enabled\n * and paced independently. The legacy combined controls remain the fallback.\n */\n workers(ctx: IntegrationContext): MastraWorker[] {\n const pullRequestEnabled = reconciliationEnabled(\n process.env.MASTRACODE_GITHUB_PR_RECONCILE_ENABLED,\n process.env.MASTRACODE_GITHUB_RECONCILE_ENABLED,\n );\n const issueEnabled = reconciliationEnabled(\n process.env.MASTRACODE_GITHUB_ISSUE_RECONCILE_ENABLED,\n process.env.MASTRACODE_GITHUB_RECONCILE_ENABLED,\n );\n if (!pullRequestEnabled && !issueEnabled) return [];\n\n const reconcile = pullRequestEnabled\n ? attachGithubReconciler(this, ctx, input => this.fetchPullRequestState(input))\n : undefined;\n const issues = issueEnabled\n ? attachGithubIssueReconciler(\n this,\n ctx,\n input => this.fetchIssueState(input),\n input => this.listOpenIssueStates(input),\n )\n : undefined;\n if (!reconcile && !issues) return [];\n\n const legacyInterval = reconcileInterval(process.env.MASTRACODE_GITHUB_RECONCILE_INTERVAL_MS);\n const intervalMs = reconcileInterval(process.env.MASTRACODE_GITHUB_PR_RECONCILE_INTERVAL_MS) ?? legacyInterval;\n const issueIntervalMs =\n reconcileInterval(process.env.MASTRACODE_GITHUB_ISSUE_RECONCILE_INTERVAL_MS) ?? legacyInterval;\n return [\n new GithubReconcileWorker({\n ...(reconcile ? { reconcile } : {}),\n ...(issues ? { reconcileIssues: issues } : {}),\n sourceControl: ctx.storage.sourceControl,\n ...(intervalMs ? { intervalMs } : {}),\n ...(issueIntervalMs ? { issueIntervalMs } : {}),\n }),\n ];\n }\n\n /**\n * Reads live PR state for the merge reconciler. Returns undefined when the PR\n * cannot be resolved so a sweep never fabricates a merge.\n */\n async fetchPullRequestState(input: {\n installationId: number;\n repository: string;\n number: number;\n }): Promise<ReconcilePullRequestState | undefined> {\n try {\n const pullRequest = await this.#getPullRequest({\n connection: { type: 'app-installation', installationId: input.installationId },\n sourceId: input.repository,\n pullRequestId: String(input.number),\n });\n if (!pullRequest) return undefined;\n return {\n title: pullRequest.title,\n url: pullRequest.url,\n state: pullRequest.state === 'closed' ? 'closed' : 'open',\n draft: pullRequest.draft,\n merged: pullRequest.merged,\n assignees: pullRequest.assignees ?? [],\n requestedReviewers: pullRequest.requestedReviewers ?? [],\n labels: pullRequest.labels ?? [],\n headBranch: pullRequest.headBranch,\n baseBranch: pullRequest.baseBranch,\n ...(pullRequest.author ? { author: pullRequest.author } : {}),\n ...(pullRequest.createdAt ? { createdAt: pullRequest.createdAt } : {}),\n };\n } catch {\n return undefined;\n }\n }\n\n /**\n * Reads live issue state for the reconciler. Returns undefined when the\n * issue cannot be resolved (missing, is actually a PR, API error) so a\n * sweep never fabricates a close.\n */\n async fetchIssueState(input: {\n installationId: number;\n repository: string;\n number: number;\n }): Promise<ReconcileIssueState | undefined> {\n const parts = splitRepoFullName(input.repository);\n if (!parts) return undefined;\n try {\n const octokit = this.getInstallationOctokit(input.installationId);\n const { data: issue } = await octokit.issues.get({\n owner: parts.owner,\n repo: parts.repo,\n issue_number: input.number,\n });\n if (issue.pull_request) return undefined;\n return {\n title: issue.title,\n url: issue.html_url,\n state: issue.state === 'closed' ? 'closed' : 'open',\n ...(issue.state_reason ? { stateReason: issue.state_reason } : {}),\n assignees: (issue.assignees ?? []).map(user => user.login).filter((login): login is string => Boolean(login)),\n labels: (issue.labels ?? [])\n .map(label => (typeof label === 'string' ? label : label.name))\n .filter((name): name is string => Boolean(name)),\n ...(issue.user?.login ? { author: issue.user.login } : {}),\n createdAt: issue.created_at,\n updatedAt: issue.updated_at,\n };\n } catch {\n return undefined;\n }\n }\n\n /**\n * Lists a repository's open issues (pull requests excluded) so the issue\n * sweep can mint cards for issues whose webhook never arrived.\n */\n async listOpenIssueStates(input: {\n installationId: number;\n repository: string;\n }): Promise<Array<ReconcileIssueState & { number: number }>> {\n const parts = splitRepoFullName(input.repository);\n if (!parts) return [];\n const octokit = this.getInstallationOctokit(input.installationId);\n const issues: Array<ReconcileIssueState & { number: number }> = [];\n for (let page = 1; page <= OPEN_ISSUE_DISCOVERY_MAX_PAGES; page += 1) {\n const { data } = await octokit.issues.listForRepo({\n owner: parts.owner,\n repo: parts.repo,\n state: 'open',\n per_page: OPEN_ISSUE_DISCOVERY_PAGE_SIZE,\n page,\n });\n for (const issue of data) {\n if (issue.pull_request) continue;\n issues.push({\n number: issue.number,\n title: issue.title,\n url: issue.html_url,\n state: 'open',\n assignees: (issue.assignees ?? []).map(user => user.login).filter((login): login is string => Boolean(login)),\n labels: (issue.labels ?? [])\n .map(label => (typeof label === 'string' ? label : label.name))\n .filter((name): name is string => Boolean(name)),\n ...(issue.user?.login ? { author: issue.user.login } : {}),\n createdAt: issue.created_at,\n updatedAt: issue.updated_at,\n });\n }\n if (data.length < OPEN_ISSUE_DISCOVERY_PAGE_SIZE) break;\n }\n return issues;\n }\n\n /**\n * Session-scoped agent tools for token refresh and PR subscriptions in\n * sessions bound to a GitHub-backed project. Empty elsewhere.\n */\n async upsertFactoryTriageComment(input: GithubTriageCommentUpsertInput): Promise<GithubTriageCommentUpsertResult> {\n const parts = splitRepoFullName(input.repository);\n if (!parts) throw new Error('GitHub triage comments require an owner/repository source.');\n const octokit = this.getInstallationOctokit(input.installationId);\n const comments = [] as Array<{\n id: number;\n body?: string | null;\n user?: { login?: string } | null;\n html_url: string;\n }>;\n for (let page = 1; ; page += 1) {\n const response = await octokit.issues.listComments({\n ...parts,\n issue_number: input.issueNumber,\n per_page: 100,\n page,\n });\n comments.push(...response.data);\n if (response.data.length < 100) break;\n }\n const existing = comments\n .filter(\n comment =>\n comment.body?.includes('<!-- mastra-factory-triage -->') && this.isFactoryCommentAuthor(comment.user?.login),\n )\n .sort((left, right) => left.id - right.id)[0];\n if (existing) {\n const { data } = await octokit.issues.updateComment({ ...parts, comment_id: existing.id, body: input.body });\n return { action: 'updated', commentId: String(data.id), url: data.html_url };\n }\n const { data } = await octokit.issues.createComment({\n ...parts,\n issue_number: input.issueNumber,\n body: input.body,\n });\n return { action: 'created', commentId: String(data.id), url: data.html_url };\n }\n\n sessionTools({ requestContext }: { requestContext: RequestContext }): IntegrationTools {\n return createGithubSubscriptionTools(requestContext, this);\n }\n\n async postToolObserver({\n toolContext,\n requestContext,\n }: Parameters<NonNullable<FactoryIntegration['postToolObserver']>>[0]): Promise<void> {\n const pullRequestUrl = parseCreatedPullRequest(toolContext);\n if (!pullRequestUrl || !requestContext) return;\n await subscribeCurrentSessionToPullRequest(requestContext, pullRequestUrl, 'auto-gh-pr-create', this);\n }\n\n /** Non-secret config snapshot for system diagnostics/startup logs. */\n diagnostics(): Record<string, unknown> {\n return {\n slug: this.#slug,\n webhookSecretConfigured: this.#webhookSecret !== undefined,\n };\n }\n}\n\ninterface GithubPullRequestData {\n number: number;\n title: string;\n html_url: string;\n user: { login?: string } | null;\n assignees?: Array<{ login?: string }> | null;\n requested_reviewers?: Array<{ login?: string }> | null;\n labels?: Array<{ name?: string } | string> | null;\n body?: string | null;\n state: string;\n draft?: boolean | null;\n merged?: boolean;\n merged_at?: string | null;\n mergeable?: boolean | null;\n base: { ref: string };\n head: { ref: string; sha: string };\n created_at: string;\n updated_at: string;\n}\n\ninterface GithubCommentData {\n id: number;\n html_url: string;\n user: { login?: string } | null;\n body?: string | null;\n created_at: string;\n updated_at: string;\n}\n\ninterface GithubReviewData {\n id: number;\n html_url?: string;\n user: { login?: string } | null;\n body?: string | null;\n state: string;\n commit_id?: string | null;\n submitted_at?: string | null;\n}\n\ninterface GithubReviewCommentData extends GithubCommentData {\n path: string;\n line?: number | null;\n side?: string | null;\n commit_id: string;\n in_reply_to_id?: number | null;\n}\n\nfunction parsePullRequest(pr: GithubPullRequestData): PullRequest {\n return {\n id: String(pr.number),\n title: pr.title,\n url: pr.html_url,\n author: pr.user?.login ?? null,\n assignees: (pr.assignees ?? []).flatMap(assignee => (assignee.login ? [assignee.login] : [])),\n requestedReviewers: (pr.requested_reviewers ?? []).flatMap(reviewer => (reviewer.login ? [reviewer.login] : [])),\n labels: (pr.labels ?? []).flatMap(label => (typeof label === 'string' ? [label] : label.name ? [label.name] : [])),\n body: pr.body?.trim() ? pr.body : null,\n state: pr.state === 'closed' ? 'closed' : 'open',\n draft: pr.draft ?? false,\n merged: pr.merged ?? Boolean(pr.merged_at),\n mergeable: typeof pr.mergeable === 'boolean' ? pr.mergeable : null,\n baseBranch: pr.base.ref,\n headBranch: pr.head.ref,\n headSha: pr.head.sha,\n createdAt: pr.created_at,\n updatedAt: pr.updated_at,\n };\n}\n\nfunction parsePullRequestComment(comment: GithubCommentData): PullRequestComment {\n return {\n id: String(comment.id),\n url: comment.html_url,\n author: comment.user?.login ?? null,\n body: comment.body ?? '',\n createdAt: comment.created_at,\n updatedAt: comment.updated_at,\n };\n}\n\nfunction parseReview(review: GithubReviewData): Review {\n return {\n id: String(review.id),\n url: review.html_url ?? null,\n author: review.user?.login ?? null,\n body: review.body?.trim() ? review.body : null,\n state: parseReviewState(review.state),\n commitId: review.commit_id ?? null,\n submittedAt: review.submitted_at ?? null,\n };\n}\n\nfunction parseReviewComment(comment: GithubReviewCommentData): ReviewComment {\n const parsed = parsePullRequestComment(comment);\n const side = comment.side?.toLowerCase();\n return {\n ...parsed,\n path: comment.path,\n line: comment.line ?? null,\n side: side === 'left' || side === 'right' ? side : null,\n commitId: comment.commit_id,\n replyToId: comment.in_reply_to_id ? String(comment.in_reply_to_id) : null,\n };\n}\n\nfunction parseRequestedReviewers(data: {\n users?: Array<{ login?: string }> | null;\n teams?: Array<{ slug?: string }> | null;\n requested_reviewers?: Array<{ login?: string }> | null;\n requested_teams?: Array<{ slug?: string }> | null;\n}) {\n return {\n users: (data.users ?? data.requested_reviewers ?? []).flatMap(user => (user.login ? [user.login] : [])),\n teams: (data.teams ?? data.requested_teams ?? []).flatMap(team => (team.slug ? [team.slug] : [])),\n };\n}\n\nfunction parseReviewState(state: string): Review['state'] {\n if (state === 'PENDING') return 'pending';\n if (state === 'COMMENTED') return 'commented';\n if (state === 'APPROVED') return 'approved';\n if (state === 'CHANGES_REQUESTED') return 'changes-requested';\n if (state === 'DISMISSED') return 'dismissed';\n throw new Error(`Unsupported GitHub review state: ${state}`);\n}\n\nfunction reviewEventToGithub(event: Exclude<InputOf<'createReview'>['event'], undefined>) {\n if (event === 'approve') return 'APPROVE' as const;\n if (event === 'request-changes') return 'REQUEST_CHANGES' as const;\n return 'COMMENT' as const;\n}\n\nfunction requirePullRequestNumber(value: string): number {\n return requirePositiveId(value, 'pull request');\n}\n\nfunction requirePositiveId(value: string, resource: string): number {\n const parsed = parsePositiveInteger(value);\n if (parsed === null) throw new Error(`GitHub ${resource} id must be a positive integer.`);\n return parsed;\n}\n\nfunction getGithubInstallationId(connection: IntegrationConnection): number {\n if (connection.type !== 'app-installation') {\n throw new Error('GitHub capabilities require an app-installation connection.');\n }\n return connection.installationId;\n}\n\nfunction getSingleSourceId(sourceIds: string[], message: string): string {\n if (sourceIds.length !== 1) throw new Error(message);\n return sourceIds[0]!;\n}\n\nfunction normalizeLabels(labels: string[] | undefined): string[] {\n return [...new Set((labels ?? []).map(label => label.trim()).filter(Boolean))];\n}\n\nfunction requireSourceId(sourceId: string | undefined, message: string): string {\n if (!sourceId) throw new Error(message);\n return sourceId;\n}\n\nfunction parsePositiveCursor(cursor: string | undefined): number {\n if (cursor === undefined) return 1;\n const page = parsePositiveInteger(cursor);\n if (page === null) throw new Error('GitHub cursor must be a positive page number.');\n return page;\n}\n\nfunction parsePositiveInteger(value: string): number | null {\n if (!/^\\d+$/.test(value)) return null;\n const parsed = Number(value);\n return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : null;\n}\n\nfunction isNotFoundError(error: unknown): boolean {\n return typeof error === 'object' && error !== null && 'status' in error && error.status === 404;\n}\n\n/** Split an `owner/name` full name into its parts, or `null` when malformed. */\nfunction splitRepoFullName(repoFullName: string): { owner: string; repo: string } | null {\n const slash = repoFullName.indexOf('/');\n if (slash <= 0 || slash === repoFullName.length - 1) return null;\n return { owner: repoFullName.slice(0, slash), repo: repoFullName.slice(slash + 1) };\n}\n\nfunction parseGithubExternalTarget(externalId: string): { repositoryId: string; issueId: string } | null {\n const match = externalId.match(/^github:(\\d+):(?:issue|pull-request):(\\d+)$/) ?? externalId.match(/^(\\d+):(\\d+)$/);\n if (!match?.[1] || !match[2]) return null;\n const repositoryId = parsePositiveInteger(match[1]);\n const issueId = parsePositiveInteger(match[2]);\n return repositoryId && issueId ? { repositoryId: String(repositoryId), issueId: String(issueId) } : null;\n}\n"],"mapp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AAO;CACjC,MAAM,OAAO,qBAAqB,MAAM;CACxC,IAAI,SAAS,MAAM,MAAM,IAAI,MAAM,+CAA+C;CAClF,OAAO;AACT;AAEA,SAAS,qBAAqB,OAA8B;CAC1D,IAAI,CAAC,QAAQ,KAAK,KAAK,GAAG,OAAO;CACjC,MAAM,SAAS,OAAO,KAAK;CAC3B,OAAO,OAAO,cAAc,MAAM,KAAK,SAAS,IAAI,SAAS;AAC/D;AAEA,SAAS,gBAAgB,OAAyB;CAChD,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,YAAY,SAAS,MAAM,WAAW;AAC9F;;AAGA,SAAS,kBAAkB,cAA8D;CACvF,MAAM,QAAQ,aAAa,QAAQ,GAAG;CACtC,IAAI,SAAS,KAAK,UAAU,aAAa,SAAS,GAAG,OAAO;CAC5D,OAAO;EAAE,OAAO,aAAa,MAAM,GAAG,KAAK;EAAG,MAAM,aAAa,MAAM,QAAQ,CAAC;CAAE;AACpF;AAEA,SAAS,0BAA0B,YAAsE;CACvG,MAAM,QAAQ,WAAW,MAAM,6CAA6C,KAAK,WAAW,MAAM,eAAe;CACjH,IAAI,CAAC,QAAQ,MAAM,CAAC,MAAM,IAAI,OAAO;CACrC,MAAM,eAAe,qBAAqB,MAAM,EAAE;CAClD,MAAM,UAAU,qBAAqB,MAAM,EAAE;CAC7C,OAAO,gBAAgB,UAAU;EAAE,cAAc,OAAO,YAAY;EAAG,SAAS,OAAO,OAAO;CAAE,IAAI;AACtG"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { IntegrationContext } from '../base.js';
|
|
2
|
+
import type { GithubIssueFetcher, GithubOpenIssueLister, GithubRulesIntegration, GithubRulesOptions, ReconcileRepository } from './rules.js';
|
|
3
|
+
export interface GithubIssueReconcileSummary {
|
|
4
|
+
/** Repositories included in the sweep. */
|
|
5
|
+
repositories: number;
|
|
6
|
+
/** Issue cards whose live state was fetched. */
|
|
7
|
+
checked: number;
|
|
8
|
+
/** Open issues with metadata patches. */
|
|
9
|
+
updated: number;
|
|
10
|
+
/** Closed issues replayed through the rules ingress. */
|
|
11
|
+
closed: number;
|
|
12
|
+
/** Open issues whose changed labels were replayed through the rules ingress. */
|
|
13
|
+
relabeled: number;
|
|
14
|
+
/** Open issues with no Work card replayed as `opened` through the rules ingress. */
|
|
15
|
+
created: number;
|
|
16
|
+
/** Errors encountered during the sweep. */
|
|
17
|
+
failed: number;
|
|
18
|
+
/** Error samples with context. */
|
|
19
|
+
errors: Array<{
|
|
20
|
+
repository: string;
|
|
21
|
+
issueNumber?: number;
|
|
22
|
+
error: string;
|
|
23
|
+
}>;
|
|
24
|
+
}
|
|
25
|
+
export type GithubIssueReconciler = (repositories: ReconcileRepository[]) => Promise<GithubIssueReconcileSummary>;
|
|
26
|
+
export declare function createGithubIssueReconciler(options: GithubRulesOptions, fetchIssue: GithubIssueFetcher, listOpenIssues?: GithubOpenIssueLister): GithubIssueReconciler;
|
|
27
|
+
export declare function attachGithubIssueReconciler(github: GithubRulesIntegration, context: IntegrationContext, fetchIssue: GithubIssueFetcher, listOpenIssues?: GithubOpenIssueLister): GithubIssueReconciler | undefined;
|
|
28
|
+
//# sourceMappingURL=issue-reconciler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issue-reconciler.d.ts","sourceRoot":"","sources":["../../../src/integrations/github/issue-reconciler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAYrD,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,2BAA2B;IAC1C,0CAA0C;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,MAAM,EAAE,MAAM,CAAC;IACf,gFAAgF;IAChF,SAAS,EAAE,MAAM,CAAC;IAClB,oFAAoF;IACpF,OAAO,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,MAAM,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC5E;AAED,MAAM,MAAM,qBAAqB,GAAG,CAAC,YAAY,EAAE,mBAAmB,EAAE,KAAK,OAAO,CAAC,2BAA2B,CAAC,CAAC;AAElH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,kBAAkB,EAC3B,UAAU,EAAE,kBAAkB,EAC9B,cAAc,CAAC,EAAE,qBAAqB,GACrC,qBAAqB,CAyKvB;AAED,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,sBAAsB,EAC9B,OAAO,EAAE,kBAAkB,EAC3B,UAAU,EAAE,kBAAkB,EAC9B,cAAc,CAAC,EAAE,qBAAqB,GACrC,qBAAqB,GAAG,SAAS,CAKnC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { workItemPhaseSemantics } from "../../boards/semantics.js";
|
|
2
|
+
import "../../boards/index.js";
|
|
3
|
+
import { GithubRules, githubRulesOptions, reconcilableIssueNumber, reconciledIssueClosedEvent, reconciledIssueOpenedEvent, reconciledIssueRelabeledEvent, sameStrings, sweepTrustLookup } from "./rules.js";
|
|
4
|
+
//#region src/integrations/github/issue-reconciler.ts
|
|
5
|
+
function createGithubIssueReconciler(options, fetchIssue, listOpenIssues) {
|
|
6
|
+
const rules = new GithubRules(options);
|
|
7
|
+
return async (repositories) => {
|
|
8
|
+
const summary = {
|
|
9
|
+
repositories: 0,
|
|
10
|
+
checked: 0,
|
|
11
|
+
updated: 0,
|
|
12
|
+
closed: 0,
|
|
13
|
+
relabeled: 0,
|
|
14
|
+
created: 0,
|
|
15
|
+
failed: 0,
|
|
16
|
+
errors: []
|
|
17
|
+
};
|
|
18
|
+
const recordFailure = (repository, error, issueNumber) => {
|
|
19
|
+
summary.failed += 1;
|
|
20
|
+
if (summary.errors.length < 5) summary.errors.push({
|
|
21
|
+
repository: repository.fullName,
|
|
22
|
+
...issueNumber === void 0 ? {} : { issueNumber },
|
|
23
|
+
error: error instanceof Error ? error.message : String(error)
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
for (const repository of repositories) {
|
|
27
|
+
summary.repositories += 1;
|
|
28
|
+
const authorTrust = sweepTrustLookup(options.github, repository);
|
|
29
|
+
try {
|
|
30
|
+
const projects = await options.sourceControl.projectRepositories.listByExternalRepository({
|
|
31
|
+
installationExternalId: String(repository.installationId),
|
|
32
|
+
repositoryExternalId: String(repository.id)
|
|
33
|
+
});
|
|
34
|
+
if (projects.length === 0) continue;
|
|
35
|
+
const itemsByNumber = /* @__PURE__ */ new Map();
|
|
36
|
+
const carded = /* @__PURE__ */ new Set();
|
|
37
|
+
for (const project of projects) {
|
|
38
|
+
const items = await options.storage.list({
|
|
39
|
+
orgId: project.orgId,
|
|
40
|
+
factoryProjectId: project.factoryProjectId
|
|
41
|
+
});
|
|
42
|
+
for (const item of items) {
|
|
43
|
+
const issueNumber = reconcilableIssueNumber(item, repository);
|
|
44
|
+
if (!issueNumber) continue;
|
|
45
|
+
carded.add(issueNumber);
|
|
46
|
+
if (workItemPhaseSemantics(options.boards, item)?.kind === "terminal") continue;
|
|
47
|
+
let list = itemsByNumber.get(issueNumber);
|
|
48
|
+
if (!list) {
|
|
49
|
+
list = [];
|
|
50
|
+
itemsByNumber.set(issueNumber, list);
|
|
51
|
+
}
|
|
52
|
+
list.push(item);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (listOpenIssues) {
|
|
56
|
+
const linkedAt = Math.min(...projects.map((project) => project.projectRepository.createdAt.getTime()));
|
|
57
|
+
const openIssues = await listOpenIssues({
|
|
58
|
+
installationId: repository.installationId,
|
|
59
|
+
repository: repository.fullName
|
|
60
|
+
});
|
|
61
|
+
for (const issue of openIssues) {
|
|
62
|
+
if (carded.has(issue.number)) continue;
|
|
63
|
+
const createdAt = issue.createdAt ? Date.parse(issue.createdAt) : NaN;
|
|
64
|
+
if (!Number.isFinite(createdAt) || createdAt < linkedAt) continue;
|
|
65
|
+
try {
|
|
66
|
+
if ((await rules.ingest(reconciledIssueOpenedEvent(repository, issue.number, issue))).status === "committed") summary.created += 1;
|
|
67
|
+
} catch (error) {
|
|
68
|
+
recordFailure(repository, error, issue.number);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
for (const [issueNumber, items] of itemsByNumber) try {
|
|
73
|
+
const state = await fetchIssue({
|
|
74
|
+
installationId: repository.installationId,
|
|
75
|
+
repository: repository.fullName,
|
|
76
|
+
number: issueNumber
|
|
77
|
+
});
|
|
78
|
+
if (!state) continue;
|
|
79
|
+
summary.checked += 1;
|
|
80
|
+
if (state.state === "closed") {
|
|
81
|
+
await rules.ingest(reconciledIssueClosedEvent(repository, issueNumber, state));
|
|
82
|
+
summary.closed += 1;
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
const desiredMetadata = {
|
|
86
|
+
githubRepositoryId: repository.id,
|
|
87
|
+
githubIssueNumber: issueNumber,
|
|
88
|
+
state: "open",
|
|
89
|
+
...state.author === void 0 ? {} : { author: state.author },
|
|
90
|
+
...state.assignees === void 0 ? {} : { assignees: state.assignees },
|
|
91
|
+
...state.labels === void 0 ? {} : { labels: state.labels }
|
|
92
|
+
};
|
|
93
|
+
let authorTrusted;
|
|
94
|
+
if (state.author !== void 0) try {
|
|
95
|
+
authorTrusted = await authorTrust(state.author);
|
|
96
|
+
} catch (error) {
|
|
97
|
+
recordFailure(repository, error, issueNumber);
|
|
98
|
+
}
|
|
99
|
+
if (state.labels !== void 0 && items.some((item) => Array.isArray(item.metadata?.labels) && !sameStrings(item.metadata.labels, state.labels))) {
|
|
100
|
+
await rules.ingest(reconciledIssueRelabeledEvent(repository, issueNumber, state));
|
|
101
|
+
summary.relabeled += 1;
|
|
102
|
+
}
|
|
103
|
+
for (const item of items) {
|
|
104
|
+
const current = item.metadata ?? {};
|
|
105
|
+
const trustStale = authorTrusted !== void 0 && current.authorTrusted !== authorTrusted;
|
|
106
|
+
if (!(trustStale || current.githubRepositoryId !== desiredMetadata.githubRepositoryId || current.githubIssueNumber !== desiredMetadata.githubIssueNumber || current.state !== desiredMetadata.state || state.author !== void 0 && current.author !== state.author || state.assignees !== void 0 && !sameStrings(current.assignees, state.assignees) || state.labels !== void 0 && !sameStrings(current.labels, state.labels))) continue;
|
|
107
|
+
await options.storage.update({
|
|
108
|
+
orgId: item.orgId,
|
|
109
|
+
id: item.id,
|
|
110
|
+
userId: "factory-rule-dispatcher",
|
|
111
|
+
patch: { metadata: {
|
|
112
|
+
...current,
|
|
113
|
+
...desiredMetadata,
|
|
114
|
+
...trustStale ? { authorTrusted } : {}
|
|
115
|
+
} }
|
|
116
|
+
});
|
|
117
|
+
summary.updated += 1;
|
|
118
|
+
}
|
|
119
|
+
} catch (error) {
|
|
120
|
+
recordFailure(repository, error, issueNumber);
|
|
121
|
+
}
|
|
122
|
+
} catch (error) {
|
|
123
|
+
recordFailure(repository, error);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return summary;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function attachGithubIssueReconciler(github, context, fetchIssue, listOpenIssues) {
|
|
130
|
+
if (!context.runtime) return void 0;
|
|
131
|
+
const options = githubRulesOptions(github, context);
|
|
132
|
+
if (!options) return void 0;
|
|
133
|
+
return createGithubIssueReconciler(options, fetchIssue, listOpenIssues);
|
|
134
|
+
}
|
|
135
|
+
//#endregion
|
|
136
|
+
export { attachGithubIssueReconciler, createGithubIssueReconciler };
|
|
137
|
+
|
|
138
|
+
//# sourceMappingURL=issue-reconciler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issue-reconciler.js","names":[],"sources":["../../../src/integrations/github/issue-reconciler.ts"],"sourcesContent":["import { workItemPhaseSemantics } from '../../boards/index.js';\nimport type { IntegrationContext } from '../base.js';\nimport {\n githubRulesOptions,\n reconcilableIssueNumber,\n reconciledIssueClosedEvent,\n reconciledIssueOpenedEvent,\n reconciledIssueRelabeledEvent,\n RECONCILE_ERROR_SAMPLE_LIMIT,\n sameStrings,\n sweepTrustLookup,\n GithubRules,\n} from './rules.js';\nimport type {\n GithubIssueFetcher,\n GithubOpenIssueLister,\n GithubRulesIntegration,\n GithubRulesOptions,\n ReconcileRepository,\n} from './rules.js';\n\nexport interface GithubIssueReconcileSummary {\n /** Repositories included in the sweep. */\n repositories: number;\n /** Issue cards whose live state was fetched. */\n checked: number;\n /** Open issues with metadata patches. */\n updated: number;\n /** Closed issues replayed through the rules ingress. */\n closed: number;\n /** Open issues whose changed labels were replayed through the rules ingress. */\n relabeled: number;\n /** Open issues with no Work card replayed as `opened` through the rules ingress. */\n created: number;\n /** Errors encountered during the sweep. */\n failed: number;\n /** Error samples with context. */\n errors: Array<{ repository: string; issueNumber?: number; error: string }>;\n}\n\nexport type GithubIssueReconciler = (repositories: ReconcileRepository[]) => Promise<GithubIssueReconcileSummary>;\n\nexport function createGithubIssueReconciler(\n options: GithubRulesOptions,\n fetchIssue: GithubIssueFetcher,\n listOpenIssues?: GithubOpenIssueLister,\n): GithubIssueReconciler {\n const rules = new GithubRules(options);\n return async repositories => {\n const summary: GithubIssueReconcileSummary = {\n repositories: 0,\n checked: 0,\n updated: 0,\n closed: 0,\n relabeled: 0,\n created: 0,\n failed: 0,\n errors: [],\n };\n const recordFailure = (repository: ReconcileRepository, error: unknown, issueNumber?: number) => {\n summary.failed += 1;\n if (summary.errors.length < RECONCILE_ERROR_SAMPLE_LIMIT) {\n summary.errors.push({\n repository: repository.fullName,\n ...(issueNumber === undefined ? {} : { issueNumber }),\n error: error instanceof Error ? error.message : String(error),\n });\n }\n };\n\n for (const repository of repositories) {\n summary.repositories += 1;\n const authorTrust = sweepTrustLookup(options.github, repository);\n\n try {\n const projects = await options.sourceControl.projectRepositories.listByExternalRepository({\n installationExternalId: String(repository.installationId),\n repositoryExternalId: String(repository.id),\n });\n if (projects.length === 0) continue;\n\n // Collect issue cards: number -> items (skip terminal stages)\n const itemsByNumber = new Map<number, import('../../storage/domains/work-items/base.js').WorkItemRow[]>();\n // Every issue with any card, terminal included: a finished card must\n // not be re-minted by missed-open discovery.\n const carded = new Set<number>();\n\n for (const project of projects) {\n const items = await options.storage.list({\n orgId: project.orgId,\n factoryProjectId: project.factoryProjectId,\n });\n for (const item of items) {\n const issueNumber = reconcilableIssueNumber(item, repository);\n if (!issueNumber) continue;\n carded.add(issueNumber);\n if (workItemPhaseSemantics(options.boards, item)?.kind === 'terminal') continue;\n let list = itemsByNumber.get(issueNumber);\n if (!list) {\n list = [];\n itemsByNumber.set(issueNumber, list);\n }\n list.push(item);\n }\n }\n\n // Missed-open discovery: an `opened` delivery that never reached the\n // ingress leaves no card for the sweeps above to repair. Only issues\n // filed after the repository was linked are replayed, so linking a\n // repository never backfills its existing backlog.\n if (listOpenIssues) {\n const linkedAt = Math.min(...projects.map(project => project.projectRepository.createdAt.getTime()));\n const openIssues = await listOpenIssues({\n installationId: repository.installationId,\n repository: repository.fullName,\n });\n for (const issue of openIssues) {\n if (carded.has(issue.number)) continue;\n const createdAt = issue.createdAt ? Date.parse(issue.createdAt) : Number.NaN;\n if (!Number.isFinite(createdAt) || createdAt < linkedAt) continue;\n try {\n const result = await rules.ingest(reconciledIssueOpenedEvent(repository, issue.number, issue));\n if (result.status === 'committed') summary.created += 1;\n } catch (error) {\n recordFailure(repository, error, issue.number);\n }\n }\n }\n\n // Fetch and reconcile each unique issue\n for (const [issueNumber, items] of itemsByNumber) {\n try {\n const state = await fetchIssue({\n installationId: repository.installationId,\n repository: repository.fullName,\n number: issueNumber,\n });\n if (!state) continue; // missing or PR-backed\n summary.checked += 1;\n\n // Close detection: replay through rules ingress\n if (state.state === 'closed') {\n await rules.ingest(reconciledIssueClosedEvent(repository, issueNumber, state));\n summary.closed += 1;\n continue; // card transitions, skip metadata patch\n }\n\n // Metadata sync for open issues\n const desiredMetadata = {\n githubRepositoryId: repository.id,\n githubIssueNumber: issueNumber,\n state: 'open' as const,\n ...(state.author === undefined ? {} : { author: state.author }),\n ...(state.assignees === undefined ? {} : { assignees: state.assignees }),\n ...(state.labels === undefined ? {} : { labels: state.labels }),\n };\n // Re-stamped on every sweep so revoked write access reads untrusted\n // within one cycle; a failed lookup keeps the last stamp and retries.\n let authorTrusted: boolean | undefined;\n if (state.author !== undefined) {\n try {\n authorTrusted = await authorTrust(state.author);\n } catch (error) {\n recordFailure(repository, error, issueNumber);\n }\n }\n\n // Label drift decides where the card belongs, and the rule that owns\n // that decision has to run again — mirrored from the `labeled` /\n // `unlabeled` webhook, replayed here so a label Factory never saw a\n // delivery for still re-places the card. Replayed before the\n // metadata patch, so the ingress sees the drift it acts on.\n if (\n state.labels !== undefined &&\n items.some(\n item => Array.isArray(item.metadata?.labels) && !sameStrings(item.metadata.labels, state.labels),\n )\n ) {\n await rules.ingest(reconciledIssueRelabeledEvent(repository, issueNumber, state));\n summary.relabeled += 1;\n }\n\n for (const item of items) {\n const current = item.metadata ?? {};\n const trustStale = authorTrusted !== undefined && current.authorTrusted !== authorTrusted;\n const metadataChanged =\n trustStale ||\n current.githubRepositoryId !== desiredMetadata.githubRepositoryId ||\n current.githubIssueNumber !== desiredMetadata.githubIssueNumber ||\n current.state !== desiredMetadata.state ||\n (state.author !== undefined && current.author !== state.author) ||\n (state.assignees !== undefined && !sameStrings(current.assignees, state.assignees)) ||\n (state.labels !== undefined && !sameStrings(current.labels, state.labels));\n\n if (!metadataChanged) continue;\n\n await options.storage.update({\n orgId: item.orgId,\n id: item.id,\n userId: 'factory-rule-dispatcher',\n patch: { metadata: { ...current, ...desiredMetadata, ...(trustStale ? { authorTrusted } : {}) } },\n });\n summary.updated += 1;\n }\n } catch (error) {\n recordFailure(repository, error, issueNumber);\n }\n }\n } catch (error) {\n recordFailure(repository, error);\n }\n }\n\n return summary;\n };\n}\n\nexport function attachGithubIssueReconciler(\n github: GithubRulesIntegration,\n context: IntegrationContext,\n fetchIssue: GithubIssueFetcher,\n listOpenIssues?: GithubOpenIssueLister,\n): GithubIssueReconciler | undefined {\n if (!context.runtime) return undefined;\n const options = githubRulesOptions(github, context);\n if (!options) return undefined;\n return createGithubIssueReconciler(options, fetchIssue, listOpenIssues);\n}\n"],"mappings":";;;;AA0CA,SAAgB,4BACd,SACA,YACA,gBACuB;CACvB,MAAM,QAAQ,IAAI,YAAY,OAAO;CACrC,OAAO,OAAM,iBAAgB;EAC3B,MAAM,UAAuC;GAC3C,cAAc;GACd,SAAS;GACT,SAAS;GACT,QAAQ;GACR,WAAW;GACX,SAAS;GACT,QAAQ;GACR,QAAQ,CAAC;EACX;EACA,MAAM,iBAAiB,YAAiC,OAAgB,gBAAyB;GAC/F,QAAQ,UAAU;GAClB,IAAI,QAAQ,OAAO,SAAA,GACjB,QAAQ,OAAO,KAAK;IAClB,YAAY,WAAW;IACvB,GAAI,gBAAgB,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY;IACnD,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GAC9D,CAAC;EAEL;EAEA,KAAK,MAAM,cAAc,cAAc;GACrC,QAAQ,gBAAgB;GACxB,MAAM,cAAc,iBAAiB,QAAQ,QAAQ,UAAU;GAE/D,IAAI;IACF,MAAM,WAAW,MAAM,QAAQ,cAAc,oBAAoB,yBAAyB;KACxF,wBAAwB,OAAO,WAAW,cAAc;KACxD,sBAAsB,OAAO,WAAW,EAAE;IAC5C,CAAC;IACD,IAAI,SAAS,WAAW,GAAG;IAG3B,MAAM,gCAAgB,IAAI,IAA8E;IAGxG,MAAM,yBAAS,IAAI,IAAY;IAE/B,KAAK,MAAM,WAAW,UAAU;KAC9B,MAAM,QAAQ,MAAM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O,EAAE,UAAU;QAAE,GAAG;QAAS,GAAG;QAAiB,GAAI,aAAa,EAAE,cAAc,IAAI,CAAC;OAAG,EAAE;MAClG,CAAC;MACD,QAAQ,WAAW;KACrB;IACF,SAAS,OAAO;KACd,cAAc,YAAY,OAAO,WAAW;IAC9C;GAEJ,SAAS,OAAO;IACd,cAAc,YAAY,KAAK;GACjC;EACF;EAEA,OAAO;CACT;AACF;AAEA,SAAgB,4BACd,QACA,SACA,YACA,gBACmC;CACnC,IAAI,CAAC,QAAQ,SAAS,OAAO,KAAA;CAC7B,MAAM,UAAU,mBAAmB,QAAQ,OAAO;CAClD,IAAI,CAAC,SAAS,OAAO,KAAA;CACrB,OAAO,4BAA4B,SAAS,YAAY,cAAc;AACxE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Org-scoped GitHub Personal Access Token settings.
|
|
3
|
+
*
|
|
4
|
+
* GitHub App installation tokens are the wrong credential for the `gh` CLI —
|
|
5
|
+
* they hit "Resource not accessible by integration" on endpoints the CLI
|
|
6
|
+
* needs regardless of the minted permission set. When an org pastes a PAT in
|
|
7
|
+
* Settings, the sandbox `GH_TOKEN` injection sites and the
|
|
8
|
+
* `github_refresh_token` tool use it instead of a minted installation token.
|
|
9
|
+
* Tokens must be classic PATs whose account has access to the linked repos.
|
|
10
|
+
*
|
|
11
|
+
* Two kinds:
|
|
12
|
+
* - `default` — the worker token every sandbox gets.
|
|
13
|
+
* - `reviewer` — optional second token for review-board sessions, so PR
|
|
14
|
+
* reviews come from a different account than the author. When it isn't
|
|
15
|
+
* configured, review sessions fall back to the worker token.
|
|
16
|
+
*
|
|
17
|
+
* Both live in the generic `integration_settings` collection for the
|
|
18
|
+
* `github` integration under a sentinel user id (the settings are org-wide,
|
|
19
|
+
* but the schema keys settings per `(org, user)`). Tokens are never returned
|
|
20
|
+
* to the browser — the routes only report whether each is configured.
|
|
21
|
+
*/
|
|
22
|
+
import type { GithubSubscriptionStorage } from './subscriptions.js';
|
|
23
|
+
export type GithubPatKind = 'default' | 'reviewer';
|
|
24
|
+
/** The PAT to install for `kind`, or null. `reviewer` falls back to the
|
|
25
|
+
* worker token so review sessions still authenticate when no dedicated
|
|
26
|
+
* reviewer token is configured. Fail-soft: storage errors (e.g. integration
|
|
27
|
+
* storage not initialized in a partial test harness) read as "no PAT
|
|
28
|
+
* configured" so token minting still works. */
|
|
29
|
+
export declare function getGithubPat(getStorage: () => GithubSubscriptionStorage, orgId: string, kind?: GithubPatKind): Promise<string | null>;
|
|
30
|
+
/** Which tokens are configured, without fallback semantics — feeds the
|
|
31
|
+
* settings UI status badges. */
|
|
32
|
+
export declare function getGithubPatStatus(getStorage: () => GithubSubscriptionStorage, orgId: string): Promise<{
|
|
33
|
+
configured: boolean;
|
|
34
|
+
reviewerConfigured: boolean;
|
|
35
|
+
}>;
|
|
36
|
+
export declare function setGithubPat(storage: GithubSubscriptionStorage, orgId: string, pat: string, kind?: GithubPatKind): Promise<void>;
|
|
37
|
+
export declare function clearGithubPat(storage: GithubSubscriptionStorage, orgId: string, kind?: GithubPatKind): Promise<void>;
|
|
38
|
+
//# sourceMappingURL=pat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pat.d.ts","sourceRoot":"","sources":["../../../src/integrations/github/pat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAKpE,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,UAAU,CAAC;AAanD;;;;+CAI+C;AAC/C,wBAAsB,YAAY,CAChC,UAAU,EAAE,MAAM,yBAAyB,EAC3C,KAAK,EAAE,MAAM,EACb,IAAI,GAAE,aAAyB,GAC9B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CASxB;AAED;gCACgC;AAChC,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,MAAM,yBAAyB,EAC3C,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC;IAAE,UAAU,EAAE,OAAO,CAAC;IAAC,kBAAkB,EAAE,OAAO,CAAA;CAAE,CAAC,CAU/D;AAED,wBAAsB,YAAY,CAChC,OAAO,EAAE,yBAAyB,EAClC,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,aAAyB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAGf;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,yBAAyB,EAClC,KAAK,EAAE,MAAM,EACb,IAAI,GAAE,aAAyB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAMf"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
//#region src/integrations/github/pat.ts
|
|
2
|
+
/** Sentinel `user_id` for the org-wide settings row. */
|
|
3
|
+
const PAT_SETTINGS_USER_ID = "__github_org_settings__";
|
|
4
|
+
const FIELD_FOR_KIND = {
|
|
5
|
+
default: "pat",
|
|
6
|
+
reviewer: "reviewerPat"
|
|
7
|
+
};
|
|
8
|
+
function asToken(value) {
|
|
9
|
+
return typeof value === "string" && value.length > 0 ? value : null;
|
|
10
|
+
}
|
|
11
|
+
/** The PAT to install for `kind`, or null. `reviewer` falls back to the
|
|
12
|
+
* worker token so review sessions still authenticate when no dedicated
|
|
13
|
+
* reviewer token is configured. Fail-soft: storage errors (e.g. integration
|
|
14
|
+
* storage not initialized in a partial test harness) read as "no PAT
|
|
15
|
+
* configured" so token minting still works. */
|
|
16
|
+
async function getGithubPat(getStorage, orgId, kind = "default") {
|
|
17
|
+
try {
|
|
18
|
+
const settings = await getStorage().settings.get(orgId, PAT_SETTINGS_USER_ID);
|
|
19
|
+
if (!settings) return null;
|
|
20
|
+
if (kind === "reviewer") return asToken(settings.reviewerPat) ?? asToken(settings.pat);
|
|
21
|
+
return asToken(settings.pat);
|
|
22
|
+
} catch {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/** Which tokens are configured, without fallback semantics — feeds the
|
|
27
|
+
* settings UI status badges. */
|
|
28
|
+
async function getGithubPatStatus(getStorage, orgId) {
|
|
29
|
+
try {
|
|
30
|
+
const settings = await getStorage().settings.get(orgId, PAT_SETTINGS_USER_ID);
|
|
31
|
+
return {
|
|
32
|
+
configured: asToken(settings?.pat) !== null,
|
|
33
|
+
reviewerConfigured: asToken(settings?.reviewerPat) !== null
|
|
34
|
+
};
|
|
35
|
+
} catch {
|
|
36
|
+
return {
|
|
37
|
+
configured: false,
|
|
38
|
+
reviewerConfigured: false
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async function setGithubPat(storage, orgId, pat, kind = "default") {
|
|
43
|
+
const existing = await storage.settings.get(orgId, PAT_SETTINGS_USER_ID) ?? {};
|
|
44
|
+
await storage.settings.save(orgId, PAT_SETTINGS_USER_ID, {
|
|
45
|
+
...existing,
|
|
46
|
+
[FIELD_FOR_KIND[kind]]: pat
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
async function clearGithubPat(storage, orgId, kind = "default") {
|
|
50
|
+
const existing = await storage.settings.get(orgId, PAT_SETTINGS_USER_ID);
|
|
51
|
+
const field = FIELD_FOR_KIND[kind];
|
|
52
|
+
if (!existing?.[field]) return;
|
|
53
|
+
const { [field]: _removed, ...rest } = existing;
|
|
54
|
+
await storage.settings.save(orgId, PAT_SETTINGS_USER_ID, rest);
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { clearGithubPat, getGithubPat, getGithubPatStatus, setGithubPat };
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=pat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pat.js","names":[],"sources":["../../../src/integrations/github/pat.ts"],"sourcesContent":["/**\n * Org-scoped GitHub Personal Access Token settings.\n *\n * GitHub App installation tokens are the wrong credential for the `gh` CLI —\n * they hit \"Resource not accessible by integration\" on endpoints the CLI\n * needs regardless of the minted permission set. When an org pastes a PAT in\n * Settings, the sandbox `GH_TOKEN` injection sites and the\n * `github_refresh_token` tool use it instead of a minted installation token.\n * Tokens must be classic PATs whose account has access to the linked repos.\n *\n * Two kinds:\n * - `default` — the worker token every sandbox gets.\n * - `reviewer` — optional second token for review-board sessions, so PR\n * reviews come from a different account than the author. When it isn't\n * configured, review sessions fall back to the worker token.\n *\n * Both live in the generic `integration_settings` collection for the\n * `github` integration under a sentinel user id (the settings are org-wide,\n * but the schema keys settings per `(org, user)`). Tokens are never returned\n * to the browser — the routes only report whether each is configured.\n */\n\nimport type { GithubSubscriptionStorage } from './subscriptions.js';\n\n/** Sentinel `user_id` for the org-wide settings row. */\nconst PAT_SETTINGS_USER_ID = '__github_org_settings__';\n\nexport type GithubPatKind = 'default' | 'reviewer';\n\ntype GithubOrgSettings = { pat?: string; reviewerPat?: string };\n\nconst FIELD_FOR_KIND: Record<GithubPatKind, keyof GithubOrgSettings> = {\n default: 'pat',\n reviewer: 'reviewerPat',\n};\n\nfunction asToken(value: unknown): string | null {\n return typeof value === 'string' && value.length > 0 ? value : null;\n}\n\n/** The PAT to install for `kind`, or null. `reviewer` falls back to the\n * worker token so review sessions still authenticate when no dedicated\n * reviewer token is configured. Fail-soft: storage errors (e.g. integration\n * storage not initialized in a partial test harness) read as \"no PAT\n * configured\" so token minting still works. */\nexport async function getGithubPat(\n getStorage: () => GithubSubscriptionStorage,\n orgId: string,\n kind: GithubPatKind = 'default',\n): Promise<string | null> {\n try {\n const settings = (await getStorage().settings.get(orgId, PAT_SETTINGS_USER_ID)) as GithubOrgSettings | null;\n if (!settings) return null;\n if (kind === 'reviewer') return asToken(settings.reviewerPat) ?? asToken(settings.pat);\n return asToken(settings.pat);\n } catch {\n return null;\n }\n}\n\n/** Which tokens are configured, without fallback semantics — feeds the\n * settings UI status badges. */\nexport async function getGithubPatStatus(\n getStorage: () => GithubSubscriptionStorage,\n orgId: string,\n): Promise<{ configured: boolean; reviewerConfigured: boolean }> {\n try {\n const settings = (await getStorage().settings.get(orgId, PAT_SETTINGS_USER_ID)) as GithubOrgSettings | null;\n return {\n configured: asToken(settings?.pat) !== null,\n reviewerConfigured: asToken(settings?.reviewerPat) !== null,\n };\n } catch {\n return { configured: false, reviewerConfigured: false };\n }\n}\n\nexport async function setGithubPat(\n storage: GithubSubscriptionStorage,\n orgId: string,\n pat: string,\n kind: GithubPatKind = 'default',\n): Promise<void> {\n const existing = ((await storage.settings.get(orgId, PAT_SETTINGS_USER_ID)) ?? {}) as GithubOrgSettings;\n await storage.settings.save(orgId, PAT_SETTINGS_USER_ID, { ...existing, [FIELD_FOR_KIND[kind]]: pat });\n}\n\nexport async function clearGithubPat(\n storage: GithubSubscriptionStorage,\n orgId: string,\n kind: GithubPatKind = 'default',\n): Promise<void> {\n const existing = (await storage.settings.get(orgId, PAT_SETTINGS_USER_ID)) as GithubOrgSettings | null;\n const field = FIELD_FOR_KIND[kind];\n if (!existing?.[field]) return;\n const { [field]: _removed, ...rest } = existing;\n await storage.settings.save(orgId, PAT_SETTINGS_USER_ID, rest);\n}\n"],"mappings":";;AAyBA,MAAM,uBAAuB;AAM7B,MAAM,iBAAiE;CACrE,SAAS;CACT,UAAU;AACZ;AAEA,SAAS,QAAQ,OAA+B;CAC9C,OAAO,OAAO,UAAU,YAAY,MAAM,SAAS,IAAI,QAAQ;AACjE;;;;;;AAOA,eAAsB,aACpB,YACA,OACA,OAAsB,WACE;CACxB,IAAI;EACF,MAAM,WAAY,MAAM,WAAW,CAAC,CAAC,SAAS,IAAI,OAAO,oBAAoB;EAC7E,IAAI,CAAC,UAAU,OAAO;EACtB,IAAI,SAAS,YAAY,OAAO,QAAQ,SAAS,WAAW,KAAK,QAAQ,SAAS,GAAG;EACrF,OAAO,QAAQ,SAAS,GAAG;CAC7B,QAAQ;EACN,OAAO;CACT;AACF;;;AAIA,eAAsB,mBACpB,YACA,OAC+D;CAC/D,IAAI;EACF,MAAM,WAAY,MAAM,WAAW,CAAC,CAAC,SAAS,IAAI,OAAO,oBAAoB;EAC7E,OAAO;GACL,YAAY,QAAQ,UAAU,GAAG,MAAM;GACvC,oBAAoB,QAAQ,UAAU,WAAW,MAAM;EACzD;CACF,QAAQ;EACN,OAAO;GAAE,YAAY;GAAO,oBAAoB;EAAM;CACxD;AACF;AAEA,eAAsB,aACpB,SACA,OACA,KACA,OAAsB,WACP;CACf,MAAM,WAAa,MAAM,QAAQ,SAAS,IAAI,OAAO,oBAAoB,KAAM,CAAC;CAChF,MAAM,QAAQ,SAAS,KAAK,OAAO,sBAAsB;EAAE,GAAG;GAAW,eAAe,QAAQ;CAAI,CAAC;AACvG;AAEA,eAAsB,eACpB,SACA,OACA,OAAsB,WACP;CACf,MAAM,WAAY,MAAM,QAAQ,SAAS,IAAI,OAAO,oBAAoB;CACxE,MAAM,QAAQ,eAAe;CAC7B,IAAI,CAAC,WAAW,QAAQ;CACxB,MAAM,GAAG,QAAQ,UAAU,GAAG,SAAS;CACvC,MAAM,QAAQ,SAAS,KAAK,OAAO,sBAAsB,IAAI;AAC/D"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { FactoryRuleJsonValue } from '../../rules/types.js';
|
|
2
|
+
import type { IntegrationStorageHandle } from '../../storage/domains/integrations/base.js';
|
|
3
|
+
import type { SourceControlStorageHandle } from '../../storage/domains/source-control/base.js';
|
|
4
|
+
import type { FactoryRunBindingRecord, WorkItemRow, WorkItemsStorage } from '../../storage/domains/work-items/base.js';
|
|
5
|
+
import type { GithubIntegration } from './integration.js';
|
|
6
|
+
export interface RecordFactoryPullRequestProvenanceInput {
|
|
7
|
+
binding: FactoryRunBindingRecord;
|
|
8
|
+
item: WorkItemRow;
|
|
9
|
+
assistantMessageId: string;
|
|
10
|
+
toolCallId: string;
|
|
11
|
+
toolName: string;
|
|
12
|
+
toolInput: FactoryRuleJsonValue;
|
|
13
|
+
toolResult: FactoryRuleJsonValue;
|
|
14
|
+
status: 'success' | 'error';
|
|
15
|
+
}
|
|
16
|
+
export interface FactoryPullRequestProvenanceData {
|
|
17
|
+
kind: 'factory-pr-provenance';
|
|
18
|
+
bindingId: string;
|
|
19
|
+
workItemId: string;
|
|
20
|
+
factoryProjectId: string;
|
|
21
|
+
repositoryId: number;
|
|
22
|
+
pullRequestNumber: number;
|
|
23
|
+
pullRequestUrl: string;
|
|
24
|
+
assistantMessageId: string;
|
|
25
|
+
toolCallId: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function resolveFactoryPullRequestParentWorkItemId(integrationStorage: IntegrationStorageHandle<Record<string, unknown>, Record<string, unknown>, FactoryPullRequestProvenanceData>, input: {
|
|
28
|
+
orgId: string;
|
|
29
|
+
factoryProjectId: string;
|
|
30
|
+
repositoryId: number;
|
|
31
|
+
pullRequestNumber: number;
|
|
32
|
+
}): Promise<string | null>;
|
|
33
|
+
export declare function recordFactoryPullRequestProvenance(github: GithubIntegration, sourceControl: SourceControlStorageHandle, integrationStorage: IntegrationStorageHandle<Record<string, unknown>, Record<string, unknown>, FactoryPullRequestProvenanceData>, workItems: WorkItemsStorage, input: RecordFactoryPullRequestProvenanceInput): Promise<void>;
|
|
34
|
+
//# sourceMappingURL=provenance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provenance.d.ts","sourceRoot":"","sources":["../../../src/integrations/github/provenance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAC3F,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAC/F,OAAO,KAAK,EAAE,uBAAuB,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AACvH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAI1D,MAAM,WAAW,uCAAuC;IACtD,OAAO,EAAE,uBAAuB,CAAC;IACjC,IAAI,EAAE,WAA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