@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,1021 @@
|
|
|
1
|
+
import { assertFactoryDecisionTarget, validateFactoryRuleDecisions } from "../../rules/validation.js";
|
|
2
|
+
import { boardEventHandlers, boardForWorkItem, eventBoardId, rulePhaseField, withBoardClosure, workItemPhaseSemantics } from "../../boards/semantics.js";
|
|
3
|
+
import "../../boards/index.js";
|
|
4
|
+
import { FACTORY_PULL_REQUEST_RECONCILIATION_KEY, WorkItemUpdateConflictError } from "../../storage/domains/work-items/base.js";
|
|
5
|
+
import { cardLabels, moveCardToBoard } from "../../boards/relocate.js";
|
|
6
|
+
import { selectEventRule } from "../../rules/event-rules.js";
|
|
7
|
+
import { resolveIntakeLabelRoute } from "../../storage/domains/intake/base.js";
|
|
8
|
+
import { recordPullRequestHead } from "../pull-request-head.js";
|
|
9
|
+
import { changeRequestTargetKey } from "./subscriptions.js";
|
|
10
|
+
import { createHash } from "crypto";
|
|
11
|
+
//#region src/integrations/github/rules.ts
|
|
12
|
+
const TRUSTED_PERMISSIONS = /* @__PURE__ */ new Set(["write", "admin"]);
|
|
13
|
+
const RULE_TIMEOUT_MS = 5e3;
|
|
14
|
+
const FACTORY_TRIAGE_COMMENT_MARKER = "<!-- mastra-factory-triage -->";
|
|
15
|
+
async function withRuleTimeout(promise) {
|
|
16
|
+
let timeout;
|
|
17
|
+
try {
|
|
18
|
+
return await Promise.race([promise, new Promise((_, reject) => {
|
|
19
|
+
timeout = setTimeout(() => reject(/* @__PURE__ */ new Error("FACTORY_RULE_TIMEOUT")), RULE_TIMEOUT_MS);
|
|
20
|
+
})]);
|
|
21
|
+
} finally {
|
|
22
|
+
if (timeout) clearTimeout(timeout);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function object(value) {
|
|
26
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
27
|
+
}
|
|
28
|
+
function timestamp(value) {
|
|
29
|
+
const parsed = typeof value === "string" ? Date.parse(value) : NaN;
|
|
30
|
+
return Number.isNaN(parsed) ? void 0 : parsed;
|
|
31
|
+
}
|
|
32
|
+
function string(value) {
|
|
33
|
+
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
34
|
+
}
|
|
35
|
+
function number(value) {
|
|
36
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
37
|
+
}
|
|
38
|
+
function boolean(value) {
|
|
39
|
+
return typeof value === "boolean" ? value : void 0;
|
|
40
|
+
}
|
|
41
|
+
function actorLogins(value) {
|
|
42
|
+
if (!Array.isArray(value)) return [];
|
|
43
|
+
return value.flatMap((actor) => {
|
|
44
|
+
const login = string(object(actor)?.login);
|
|
45
|
+
return login ? [login] : [];
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function sameLabels(a, b) {
|
|
49
|
+
return a.length === b.length && a.every((label, index) => label === b[index]);
|
|
50
|
+
}
|
|
51
|
+
function labelNames(value) {
|
|
52
|
+
if (!Array.isArray(value)) return [];
|
|
53
|
+
return value.flatMap((label) => {
|
|
54
|
+
if (typeof label === "string") return label ? [label] : [];
|
|
55
|
+
const name = string(object(label)?.name);
|
|
56
|
+
return name ? [name] : [];
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function parseFactoryReviewCommand(body, target) {
|
|
60
|
+
if (!body || !target) return void 0;
|
|
61
|
+
const firstLine = body.split("\n").map((line) => line.trim()).find((line) => line.length > 0)?.toLowerCase();
|
|
62
|
+
if (!firstLine) return void 0;
|
|
63
|
+
const mention = `@${target.toLowerCase().replace(/\[bot\]$/, "")}`;
|
|
64
|
+
if (firstLine === `${mention} review`) return {
|
|
65
|
+
command: "review",
|
|
66
|
+
target
|
|
67
|
+
};
|
|
68
|
+
if (firstLine === `${mention} re-review`) return {
|
|
69
|
+
command: "re-review",
|
|
70
|
+
target
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function eventName(parsed) {
|
|
74
|
+
const action = string(parsed.payload.action);
|
|
75
|
+
if (parsed.event === "issues" && action === "opened") return "issueOpened";
|
|
76
|
+
if (parsed.event === "issues" && action === "edited") {
|
|
77
|
+
const changes = object(parsed.payload.changes);
|
|
78
|
+
return object(changes?.title) || object(changes?.body) ? "issueEdited" : void 0;
|
|
79
|
+
}
|
|
80
|
+
if (parsed.event === "issues" && action === "closed") return "issueClosed";
|
|
81
|
+
if (parsed.event === "issue_comment") {
|
|
82
|
+
if (object(object(parsed.payload.issue)?.pull_request)) return action === "created" ? "pullRequestCommentCreated" : void 0;
|
|
83
|
+
if (action === "created") return "issueCommentCreated";
|
|
84
|
+
if (action === "edited") return "issueCommentEdited";
|
|
85
|
+
if (action === "deleted") return "issueCommentDeleted";
|
|
86
|
+
}
|
|
87
|
+
if (parsed.event === "pull_request" && action === "opened") return "pullRequestOpened";
|
|
88
|
+
if (parsed.event === "pull_request" && action === "synchronize") return "pullRequestUpdated";
|
|
89
|
+
if (parsed.event === "pull_request" && action === "closed") return boolean(object(parsed.payload.pull_request)?.merged) ? "pullRequestMerged" : "pullRequestClosed";
|
|
90
|
+
if (parsed.event === "pull_request" && action === "review_requested") return "pullRequestReviewRequested";
|
|
91
|
+
if (parsed.event === "pull_request_review" && action === "submitted") return "pullRequestReviewSubmitted";
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Canonical source keys (`github-issue:N`, `github-pr:N`) do not identify a
|
|
95
|
+
* repository, so a project linked to several repositories could bind repo A's
|
|
96
|
+
* event to repo B's same-numbered card. The card's intake-stamped URL is
|
|
97
|
+
* authoritative; the intake-stamped `githubRepositoryId` covers URL-less
|
|
98
|
+
* cards. A card with neither signal cannot be attributed by number alone.
|
|
99
|
+
*/
|
|
100
|
+
const MAX_STALE_RULE_ATTEMPTS = 3;
|
|
101
|
+
function cardBelongsToRepository(item, repositoryId, repositoryFullName) {
|
|
102
|
+
const url = item.externalSource?.url;
|
|
103
|
+
if (url) {
|
|
104
|
+
const match = /^https?:\/\/[^/]+\/(.+)\/(?:issues|pull)\/\d+(?:[/?#]|$)/.exec(url);
|
|
105
|
+
if (match && match[1] === repositoryFullName) return true;
|
|
106
|
+
}
|
|
107
|
+
return item.metadata?.githubRepositoryId === repositoryId;
|
|
108
|
+
}
|
|
109
|
+
function canonicalSourceKey(kind, itemNumber) {
|
|
110
|
+
return kind === "issue" ? `github-issue:${itemNumber}` : `github-pr:${itemNumber}`;
|
|
111
|
+
}
|
|
112
|
+
function legacySourceKey(repositoryId, kind, itemNumber) {
|
|
113
|
+
return `github:${repositoryId}:${kind}:${itemNumber}`;
|
|
114
|
+
}
|
|
115
|
+
function provenanceTarget(repositoryId, pullRequestNumber) {
|
|
116
|
+
return `factory-pr-provenance:${repositoryId}:${pullRequestNumber}`;
|
|
117
|
+
}
|
|
118
|
+
function workItemSource(item) {
|
|
119
|
+
if (!item.externalSource) return "manual";
|
|
120
|
+
return item.externalSource.type === "pull-request" ? "github-pr" : "github-issue";
|
|
121
|
+
}
|
|
122
|
+
function workItemSourceKey(item) {
|
|
123
|
+
return item.externalSource?.externalId ?? null;
|
|
124
|
+
}
|
|
125
|
+
async function trustedCollaborator(github, input) {
|
|
126
|
+
const permission = await github.getRepositoryCollaboratorPermission(input.installationId, input.repository, input.login);
|
|
127
|
+
return permission !== void 0 && TRUSTED_PERMISSIONS.has(permission);
|
|
128
|
+
}
|
|
129
|
+
function authorAwaitingTrust(item, repository) {
|
|
130
|
+
const metadata = item.metadata ?? {};
|
|
131
|
+
if (typeof metadata.author !== "string" || metadata.authorTrusted !== void 0) return void 0;
|
|
132
|
+
if ((reconcilablePullRequestNumber(item, repository) ?? reconcilableIssueNumber(item, repository)) === void 0) return void 0;
|
|
133
|
+
if (!item.externalSource?.url && /^github-(?:pr|issue):\d+$/.test(item.externalSource?.externalId ?? "") && metadata.githubRepositoryId !== repository.id) return void 0;
|
|
134
|
+
return metadata.author;
|
|
135
|
+
}
|
|
136
|
+
function sweepTrustLookup(github, repository) {
|
|
137
|
+
const cache = /* @__PURE__ */ new Map();
|
|
138
|
+
return async (login) => {
|
|
139
|
+
const cached = cache.get(login);
|
|
140
|
+
if (cached !== void 0) return cached;
|
|
141
|
+
const trusted = await trustedCollaborator(github, {
|
|
142
|
+
installationId: repository.installationId,
|
|
143
|
+
repository: repository.fullName,
|
|
144
|
+
login
|
|
145
|
+
});
|
|
146
|
+
cache.set(login, trusted);
|
|
147
|
+
return trusted;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
async function githubActor(github, input) {
|
|
151
|
+
const trusted = await trustedCollaborator(github, input).catch(() => false);
|
|
152
|
+
return {
|
|
153
|
+
type: "github",
|
|
154
|
+
login: input.login,
|
|
155
|
+
trusted,
|
|
156
|
+
factoryAuthored: input.factoryAuthored
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
function pullRequestProvenance(data, factoryProjectId) {
|
|
160
|
+
if (!data || data.kind !== "factory-pr-provenance" || typeof data.workItemId !== "string") return null;
|
|
161
|
+
if (data.factoryProjectId !== factoryProjectId) return null;
|
|
162
|
+
return {
|
|
163
|
+
kind: "factory-pr-provenance",
|
|
164
|
+
workItemId: data.workItemId
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/** Identity under which label-driven relocations are recorded. */
|
|
168
|
+
const LABEL_ROUTE_USER_ID = "factory-rule-dispatcher";
|
|
169
|
+
function issueLabelChange(parsed) {
|
|
170
|
+
const action = string(parsed.payload.action);
|
|
171
|
+
return parsed.event === "issues" && (action === "labeled" || action === "unlabeled");
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Whether a login is Factory itself. Prefers the resolved identity, which is
|
|
175
|
+
* observed from Factory's own writes, and falls back to the configured slug.
|
|
176
|
+
*/
|
|
177
|
+
function isFactoryGithubLogin(github, login) {
|
|
178
|
+
if (github.identity?.known) return github.identity.matches(login);
|
|
179
|
+
const slug = github.slug?.trim();
|
|
180
|
+
if (!slug || !login) return false;
|
|
181
|
+
return login.toLowerCase() === `${slug.toLowerCase()}[bot]`;
|
|
182
|
+
}
|
|
183
|
+
var GithubRules = class {
|
|
184
|
+
options;
|
|
185
|
+
constructor(options) {
|
|
186
|
+
this.options = options;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Whether a login is Factory itself. Prefers the resolved identity, which is
|
|
190
|
+
* observed from Factory's own writes, and falls back to the configured slug.
|
|
191
|
+
* An unset slug must not silently answer "not Factory" — that is what
|
|
192
|
+
* disabled every self-loop guard.
|
|
193
|
+
*/
|
|
194
|
+
#isFactoryLogin(login) {
|
|
195
|
+
return isFactoryGithubLogin(this.options.github, login);
|
|
196
|
+
}
|
|
197
|
+
#factoryMentionTarget() {
|
|
198
|
+
const identity = this.options.github.identity;
|
|
199
|
+
if (identity?.known) return identity.login;
|
|
200
|
+
const slug = this.options.github.slug?.trim();
|
|
201
|
+
return slug ? `${slug.toLowerCase()}[bot]` : void 0;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Board an issue lands on: the one its labels select under the project's label routes, else the
|
|
205
|
+
* board the repository's intake source binding names. Only installed boards count. Undefined
|
|
206
|
+
* leaves built-in routing (Work) in charge.
|
|
207
|
+
*/
|
|
208
|
+
async #intakeTarget(project, repositoryName, labels) {
|
|
209
|
+
const intake = this.options.intake;
|
|
210
|
+
if (!intake) return void 0;
|
|
211
|
+
const { orgId, factoryProjectId } = project;
|
|
212
|
+
if (labels.length > 0) {
|
|
213
|
+
const route = resolveIntakeLabelRoute(await intake.listLabelRoutes({
|
|
214
|
+
orgId,
|
|
215
|
+
factoryProjectId,
|
|
216
|
+
integrationId: "github"
|
|
217
|
+
}), labels);
|
|
218
|
+
const board = route ? this.options.boards.get(route.board) : void 0;
|
|
219
|
+
if (board) return {
|
|
220
|
+
board: board.id,
|
|
221
|
+
initialPhase: board.initialPhase
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
const slug = repositoryName.toLowerCase();
|
|
225
|
+
const binding = (await intake.listBindings({
|
|
226
|
+
orgId,
|
|
227
|
+
integrationId: "github"
|
|
228
|
+
})).find((candidate) => candidate.factoryProjectId === factoryProjectId && (candidate.sourceId === project.projectRepository.repositoryId || candidate.sourceId.toLowerCase() === slug));
|
|
229
|
+
const board = binding?.board ? this.options.boards.get(binding.board) : void 0;
|
|
230
|
+
return board ? {
|
|
231
|
+
board: board.id,
|
|
232
|
+
initialPhase: board.initialPhase
|
|
233
|
+
} : void 0;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* `labeled` / `unlabeled` are not rule events: the labels only decide which board the card belongs
|
|
237
|
+
* on, so the card is re-routed here and its label metadata refreshed. Cards a run owns, and
|
|
238
|
+
* finished cards, stay where they are.
|
|
239
|
+
*/
|
|
240
|
+
async #relocateLabeledIssue(parsed, repositoryId, repositoryName, project) {
|
|
241
|
+
const issue = object(parsed.payload.issue);
|
|
242
|
+
const issueNumber = issue?.pull_request === void 0 ? number(issue?.number) : void 0;
|
|
243
|
+
if (!issueNumber) return { status: "ignored" };
|
|
244
|
+
const found = await this.#relatedItem(project.orgId, project.factoryProjectId, repositoryId, repositoryName, issueNumber, void 0, void 0, null);
|
|
245
|
+
if (!found || found.externalSource?.type !== "issue") return { status: "ignored" };
|
|
246
|
+
const labels = labelNames(issue?.labels);
|
|
247
|
+
let item = found;
|
|
248
|
+
let changed = false;
|
|
249
|
+
if (!sameLabels(cardLabels(item), labels)) {
|
|
250
|
+
let updated;
|
|
251
|
+
try {
|
|
252
|
+
updated = await this.options.storage.update({
|
|
253
|
+
orgId: item.orgId,
|
|
254
|
+
id: item.id,
|
|
255
|
+
userId: LABEL_ROUTE_USER_ID,
|
|
256
|
+
patch: { metadata: {
|
|
257
|
+
...item.metadata ?? {},
|
|
258
|
+
labels
|
|
259
|
+
} },
|
|
260
|
+
expectedRevision: item.revision
|
|
261
|
+
});
|
|
262
|
+
} catch (error) {
|
|
263
|
+
if (!(error instanceof WorkItemUpdateConflictError)) throw error;
|
|
264
|
+
return { status: "ignored" };
|
|
265
|
+
}
|
|
266
|
+
if (!updated) return { status: "ignored" };
|
|
267
|
+
item = updated.item;
|
|
268
|
+
changed = true;
|
|
269
|
+
}
|
|
270
|
+
const target = await this.#intakeTarget(project, repositoryName, labels);
|
|
271
|
+
const outcome = await moveCardToBoard({
|
|
272
|
+
workItems: this.options.storage,
|
|
273
|
+
boardRegistry: this.options.boards,
|
|
274
|
+
userId: LABEL_ROUTE_USER_ID,
|
|
275
|
+
item,
|
|
276
|
+
targetBoard: target?.board ?? "work"
|
|
277
|
+
});
|
|
278
|
+
return { status: changed || outcome === "moved" ? "committed" : "ignored" };
|
|
279
|
+
}
|
|
280
|
+
async ingest(parsed) {
|
|
281
|
+
const event = eventName(parsed);
|
|
282
|
+
const labelChange = issueLabelChange(parsed);
|
|
283
|
+
const repository = object(parsed.payload.repository);
|
|
284
|
+
const installationId = number(object(parsed.payload.installation)?.id);
|
|
285
|
+
const repositoryId = number(repository?.id);
|
|
286
|
+
const repositoryName = string(repository?.full_name);
|
|
287
|
+
const login = string(object(parsed.payload.sender)?.login);
|
|
288
|
+
if (parsed.event === "push" && installationId && repositoryId) {
|
|
289
|
+
await this.#handOffPush(parsed, installationId, repositoryId);
|
|
290
|
+
return { status: "ignored" };
|
|
291
|
+
}
|
|
292
|
+
if (!event && !labelChange || !installationId || !repositoryId || !repositoryName || !login) return { status: "ignored" };
|
|
293
|
+
const projects = await this.options.sourceControl.projectRepositories.listByExternalRepository({
|
|
294
|
+
installationExternalId: String(installationId),
|
|
295
|
+
repositoryExternalId: String(repositoryId)
|
|
296
|
+
});
|
|
297
|
+
if (projects.length === 0) return { status: "ignored" };
|
|
298
|
+
const results = [];
|
|
299
|
+
for (const project of projects) results.push(event ? await this.#ingestProject(parsed, event, installationId, repositoryId, repositoryName, login, project) : await this.#relocateLabeledIssue(parsed, repositoryId, repositoryName, project));
|
|
300
|
+
if (results.some((result) => result.status === "committed")) return { status: "committed" };
|
|
301
|
+
if (results.some((result) => result.status === "replayed")) return { status: "replayed" };
|
|
302
|
+
return results[0] ?? { status: "ignored" };
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* A push is not a work-item event; it only reaches the environment build
|
|
306
|
+
* hand-off, once per project the repository is linked to. The hook decides
|
|
307
|
+
* whether the project builds on push.
|
|
308
|
+
*/
|
|
309
|
+
async #handOffPush(parsed, installationId, repositoryId) {
|
|
310
|
+
const onRepositoryPush = this.options.onRepositoryPush;
|
|
311
|
+
const ref = string(parsed.payload.ref);
|
|
312
|
+
const defaultBranch = string(object(parsed.payload.repository)?.default_branch);
|
|
313
|
+
if (!onRepositoryPush || !ref || !defaultBranch) return;
|
|
314
|
+
const projects = await this.options.sourceControl.projectRepositories.listByExternalRepository({
|
|
315
|
+
installationExternalId: String(installationId),
|
|
316
|
+
repositoryExternalId: String(repositoryId)
|
|
317
|
+
});
|
|
318
|
+
for (const project of projects) onRepositoryPush({
|
|
319
|
+
orgId: project.orgId,
|
|
320
|
+
factoryProjectId: project.factoryProjectId,
|
|
321
|
+
projectRepository: {
|
|
322
|
+
id: project.projectRepository.id,
|
|
323
|
+
inEnvironment: project.projectRepository.inEnvironment
|
|
324
|
+
},
|
|
325
|
+
ref,
|
|
326
|
+
defaultBranch
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
async #ingestProject(parsed, event, installationId, repositoryId, repositoryName, login, project) {
|
|
330
|
+
const factoryProject = await this.options.projects.get({
|
|
331
|
+
orgId: project.orgId,
|
|
332
|
+
id: project.factoryProjectId
|
|
333
|
+
});
|
|
334
|
+
if (!factoryProject) return { status: "missing" };
|
|
335
|
+
const issue = object(parsed.payload.issue);
|
|
336
|
+
const issueComment = object(parsed.payload.comment);
|
|
337
|
+
const changes = object(parsed.payload.changes);
|
|
338
|
+
const commentOnPullRequest = object(parsed.payload.issue)?.pull_request !== void 0;
|
|
339
|
+
const pullRequest = object(parsed.payload.pull_request) ?? (commentOnPullRequest ? issue : void 0);
|
|
340
|
+
const issueNumber = commentOnPullRequest ? void 0 : number(issue?.number);
|
|
341
|
+
const pullRequestNumber = number(pullRequest?.number);
|
|
342
|
+
const provenance = pullRequestNumber ? pullRequestProvenance((await this.options.integrationStorage.subscriptions.listByTarget(provenanceTarget(repositoryId, pullRequestNumber), { status: "active" })).find((subscription) => subscription.orgId === project.orgId && subscription.data?.factoryProjectId === project.factoryProjectId)?.data, project.factoryProjectId) : null;
|
|
343
|
+
const reviewRequested = event === "pullRequestReviewRequested";
|
|
344
|
+
const reviewCommand = event === "pullRequestCommentCreated" ? parseFactoryReviewCommand(string(issueComment?.body), this.#factoryMentionTarget()) : void 0;
|
|
345
|
+
const reviewEntryRequested = reviewRequested || reviewCommand !== void 0;
|
|
346
|
+
const senderIsResponder = reviewRequested || event === "pullRequestCommentCreated" || event === "pullRequestReviewSubmitted";
|
|
347
|
+
const reReviewEvent = reviewEntryRequested || event === "pullRequestUpdated";
|
|
348
|
+
const requestedReviewer = string(object(parsed.payload.requested_reviewer)?.login);
|
|
349
|
+
const pullRequestAuthor = string(object(pullRequest?.user)?.login);
|
|
350
|
+
const pullRequestFactoryAuthored = provenance !== null || this.#isFactoryLogin(pullRequestAuthor);
|
|
351
|
+
const resolvedItem = await this.#relatedItem(project.orgId, project.factoryProjectId, repositoryId, repositoryName, issueNumber, pullRequestNumber, string(object(pullRequest?.head)?.ref), reReviewEvent ? null : provenance, senderIsResponder && !reviewEntryRequested);
|
|
352
|
+
const relatedItem = reviewEntryRequested && resolvedItem?.externalSource?.type !== "pull-request" ? void 0 : resolvedItem;
|
|
353
|
+
const intake = issueNumber ? await this.#intakeTarget(project, repositoryName, labelNames(issue?.labels)) : void 0;
|
|
354
|
+
const actor = await githubActor(this.options.github, {
|
|
355
|
+
installationId,
|
|
356
|
+
repository: repositoryName,
|
|
357
|
+
login,
|
|
358
|
+
factoryAuthored: !senderIsResponder && provenance !== null || this.#isFactoryLogin(login)
|
|
359
|
+
});
|
|
360
|
+
if (actor.type === "github" && actor.factoryAuthored && (event === "issueCommentCreated" || event === "issueCommentEdited") && string(issueComment?.body)?.includes(FACTORY_TRIAGE_COMMENT_MARKER)) return { status: "ignored" };
|
|
361
|
+
const evaluate = async (item, ingressIdentity, pullRequestIntake = false, attempt = 1) => {
|
|
362
|
+
const context = {
|
|
363
|
+
tenant: {
|
|
364
|
+
orgId: project.orgId,
|
|
365
|
+
projectId: project.factoryProjectId
|
|
366
|
+
},
|
|
367
|
+
actor,
|
|
368
|
+
ingress: {
|
|
369
|
+
type: "github",
|
|
370
|
+
id: ingressIdentity
|
|
371
|
+
},
|
|
372
|
+
cause: `github.${event}`,
|
|
373
|
+
causalChain: [],
|
|
374
|
+
configVersion: this.options.configVersion,
|
|
375
|
+
...item ? {
|
|
376
|
+
item: {
|
|
377
|
+
id: item.id,
|
|
378
|
+
source: workItemSource(item),
|
|
379
|
+
sourceKey: workItemSourceKey(item),
|
|
380
|
+
parentWorkItemId: item.parentWorkItemId,
|
|
381
|
+
title: item.title,
|
|
382
|
+
url: item.externalSource?.url ?? null,
|
|
383
|
+
stages: item.stages,
|
|
384
|
+
acceptedAt: item.acceptedAt,
|
|
385
|
+
metadata: item.metadata
|
|
386
|
+
},
|
|
387
|
+
board: boardForWorkItem(item),
|
|
388
|
+
itemRevision: item.revision,
|
|
389
|
+
...withBoardClosure(this.options.boards, item),
|
|
390
|
+
...rulePhaseField(this.options.boards, item)
|
|
391
|
+
} : {},
|
|
392
|
+
...intake ? { intake } : {},
|
|
393
|
+
...pullRequestIntake ? { pullRequestIntake: true } : {},
|
|
394
|
+
event,
|
|
395
|
+
deliveryId: parsed.deliveryId,
|
|
396
|
+
factory: { createdAt: factoryProject.createdAt.toISOString() },
|
|
397
|
+
repository: {
|
|
398
|
+
id: repositoryId,
|
|
399
|
+
fullName: repositoryName,
|
|
400
|
+
installationId
|
|
401
|
+
},
|
|
402
|
+
...issueNumber && string(issue?.title) && string(issue?.html_url) ? { issue: {
|
|
403
|
+
number: issueNumber,
|
|
404
|
+
title: string(issue?.title),
|
|
405
|
+
url: string(issue?.html_url),
|
|
406
|
+
...string(issue?.created_at) ? { createdAt: string(issue?.created_at) } : {},
|
|
407
|
+
...string(issue?.updated_at) ? { updatedAt: string(issue?.updated_at) } : {},
|
|
408
|
+
assignees: actorLogins(issue?.assignees),
|
|
409
|
+
labels: labelNames(issue?.labels),
|
|
410
|
+
...string(issue?.state) === "closed" || string(issue?.state) === "open" ? { state: string(issue?.state) } : {},
|
|
411
|
+
...string(issue?.state_reason) ? { stateReason: string(issue?.state_reason) } : {}
|
|
412
|
+
} } : {},
|
|
413
|
+
...event === "issueEdited" ? { issueChange: {
|
|
414
|
+
title: Boolean(object(changes?.title)),
|
|
415
|
+
body: Boolean(object(changes?.body))
|
|
416
|
+
} } : {},
|
|
417
|
+
...number(issueComment?.id) ? { issueComment: {
|
|
418
|
+
id: number(issueComment?.id),
|
|
419
|
+
...string(issueComment?.body) ? { body: string(issueComment?.body) } : {},
|
|
420
|
+
...string(issueComment?.html_url) ? { url: string(issueComment?.html_url) } : {},
|
|
421
|
+
...string(object(issueComment?.user)?.login) ? { author: string(object(issueComment?.user)?.login) } : {},
|
|
422
|
+
...string(object(issueComment?.user)?.type) ? { authorType: string(object(issueComment?.user)?.type) } : {},
|
|
423
|
+
...string(issueComment?.created_at) ? { createdAt: string(issueComment?.created_at) } : {},
|
|
424
|
+
...string(issueComment?.updated_at) ? { updatedAt: string(issueComment?.updated_at) } : {}
|
|
425
|
+
} } : {},
|
|
426
|
+
...pullRequestNumber && string(pullRequest?.title) && string(pullRequest?.html_url) ? { pullRequest: {
|
|
427
|
+
number: pullRequestNumber,
|
|
428
|
+
title: string(pullRequest?.title),
|
|
429
|
+
url: string(pullRequest?.html_url),
|
|
430
|
+
...string(pullRequest?.created_at) ? { createdAt: string(pullRequest?.created_at) } : {},
|
|
431
|
+
state: string(pullRequest?.state) === "closed" ? "closed" : "open",
|
|
432
|
+
draft: boolean(pullRequest?.draft) ?? false,
|
|
433
|
+
merged: boolean(pullRequest?.merged) ?? false,
|
|
434
|
+
assignees: actorLogins(pullRequest?.assignees),
|
|
435
|
+
requestedReviewers: actorLogins(pullRequest?.requested_reviewers),
|
|
436
|
+
labels: labelNames(pullRequest?.labels),
|
|
437
|
+
...pullRequestAuthor ? { author: pullRequestAuthor } : {},
|
|
438
|
+
factoryAuthored: pullRequestFactoryAuthored,
|
|
439
|
+
headBranch: string(object(pullRequest?.head)?.ref) ?? "",
|
|
440
|
+
baseBranch: string(object(pullRequest?.base)?.ref) ?? ""
|
|
441
|
+
} } : {},
|
|
442
|
+
...reviewRequested && requestedReviewer ? { reviewRequest: {
|
|
443
|
+
reviewer: requestedReviewer,
|
|
444
|
+
factoryReviewer: this.#isFactoryLogin(requestedReviewer)
|
|
445
|
+
} } : {},
|
|
446
|
+
...reviewCommand ? { reviewCommand } : {},
|
|
447
|
+
...object(parsed.payload.review) ? { review: {
|
|
448
|
+
id: number(object(parsed.payload.review)?.id) ?? 0,
|
|
449
|
+
state: string(object(parsed.payload.review)?.state) ?? "unknown",
|
|
450
|
+
url: string(object(parsed.payload.review)?.html_url) ?? "",
|
|
451
|
+
...string(object(object(parsed.payload.review)?.user)?.login) ? { author: string(object(object(parsed.payload.review)?.user)?.login) } : {},
|
|
452
|
+
...string(object(parsed.payload.review)?.body) ? { body: string(object(parsed.payload.review)?.body) } : {}
|
|
453
|
+
} } : {}
|
|
454
|
+
};
|
|
455
|
+
const rule = selectEventRule(this.options.github.rules, boardEventHandlers(this.options.boards, eventBoardId(context), "github"), event);
|
|
456
|
+
let decision;
|
|
457
|
+
let decisions = [];
|
|
458
|
+
let outcome = { status: "accepted" };
|
|
459
|
+
try {
|
|
460
|
+
decision = rule ? await withRuleTimeout(Promise.resolve(rule(Object.freeze(context)))) : void 0;
|
|
461
|
+
if (decision?.type === "reject") outcome = {
|
|
462
|
+
status: "rejected",
|
|
463
|
+
code: decision.code,
|
|
464
|
+
reason: decision.reason
|
|
465
|
+
};
|
|
466
|
+
else if (decision) decisions = validateFactoryRuleDecisions([decision]).map((entry) => {
|
|
467
|
+
assertFactoryDecisionTarget(entry, this.options.boards, item ? boardForWorkItem(item) : void 0);
|
|
468
|
+
return { ...entry };
|
|
469
|
+
});
|
|
470
|
+
} catch (error) {
|
|
471
|
+
const timedOut = error instanceof Error && error.message === "FACTORY_RULE_TIMEOUT";
|
|
472
|
+
outcome = {
|
|
473
|
+
status: "rejected",
|
|
474
|
+
code: timedOut ? "timeout" : "rule_error",
|
|
475
|
+
reason: timedOut ? "Factory rule evaluation timed out." : error instanceof Error ? error.message.slice(0, 2e3) : "Factory GitHub rule failed."
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
const committed = await this.options.storage.commitRuleEvaluation({
|
|
479
|
+
orgId: project.orgId,
|
|
480
|
+
factoryProjectId: project.factoryProjectId,
|
|
481
|
+
workItemId: item?.id ?? null,
|
|
482
|
+
ingress: {
|
|
483
|
+
identity: ingressIdentity,
|
|
484
|
+
triggerType: `github.${event}`
|
|
485
|
+
},
|
|
486
|
+
configVersion: this.options.configVersion,
|
|
487
|
+
expectedRevision: item?.revision ?? null,
|
|
488
|
+
actor: { ...actor },
|
|
489
|
+
outcome,
|
|
490
|
+
decisions,
|
|
491
|
+
causalChain: [],
|
|
492
|
+
now: /* @__PURE__ */ new Date()
|
|
493
|
+
});
|
|
494
|
+
if (committed.status === "stale") {
|
|
495
|
+
if (attempt >= MAX_STALE_RULE_ATTEMPTS) throw new Error(`Factory GitHub rule evaluation for ${ingressIdentity} kept losing revision races.`);
|
|
496
|
+
const fresh = item ? await this.options.storage.get({
|
|
497
|
+
orgId: project.orgId,
|
|
498
|
+
id: item.id
|
|
499
|
+
}) : null;
|
|
500
|
+
if (item && !fresh) return { status: "missing" };
|
|
501
|
+
return evaluate(fresh ?? void 0, ingressIdentity, pullRequestIntake, attempt + 1);
|
|
502
|
+
}
|
|
503
|
+
return { status: committed.status };
|
|
504
|
+
};
|
|
505
|
+
const deliveryIdentity = `${installationId}:${parsed.deliveryId}`;
|
|
506
|
+
const pullRequestOpened = event === "pullRequestOpened";
|
|
507
|
+
const primary = await evaluate(relatedItem, deliveryIdentity, pullRequestOpened);
|
|
508
|
+
const linked = (event === "pullRequestMerged" || event === "pullRequestClosed") && relatedItem && pullRequestNumber ? await this.#linkedClosureItem(project.orgId, project.factoryProjectId, repositoryId, repositoryName, pullRequestNumber, relatedItem) : void 0;
|
|
509
|
+
const stampClosed = async (companionStatus) => {
|
|
510
|
+
if (!pullRequestNumber) return;
|
|
511
|
+
if (pullRequestOpened) {
|
|
512
|
+
const trusted = actor.type === "github" && actor.trusted || pullRequestFactoryAuthored;
|
|
513
|
+
const reviewCard = authoringItem && trusted ? await this.#linkedClosureItem(project.orgId, project.factoryProjectId, repositoryId, repositoryName, pullRequestNumber, authoringItem) : void 0;
|
|
514
|
+
const stillOpen = companionStatus === "replayed" ? reviewCard !== void 0 && reviewCard.metadata?.state !== "closed" : reviewCard?.metadata?.state !== "closed";
|
|
515
|
+
if (authoringItem && trusted && stillOpen) {
|
|
516
|
+
const head = authoringItem.metadata?.openPullRequestNumber !== pullRequestNumber ? {
|
|
517
|
+
pullRequestHeadSha: string(object(pullRequest?.head)?.sha)?.toLowerCase() ?? null,
|
|
518
|
+
pullRequestHeadAt: timestamp(pullRequest?.updated_at) ?? null
|
|
519
|
+
} : {};
|
|
520
|
+
await this.options.storage.update({
|
|
521
|
+
orgId: authoringItem.orgId,
|
|
522
|
+
id: authoringItem.id,
|
|
523
|
+
userId: "factory-rule-dispatcher",
|
|
524
|
+
patch: { metadata: {
|
|
525
|
+
openPullRequestNumber: pullRequestNumber,
|
|
526
|
+
...head
|
|
527
|
+
} }
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
if (event !== "pullRequestMerged" && event !== "pullRequestClosed") return;
|
|
533
|
+
for (const card of [relatedItem, linked]) {
|
|
534
|
+
if (!card) continue;
|
|
535
|
+
if (card.externalSource?.type !== "pull-request") {
|
|
536
|
+
const recorded = card.metadata?.openPullRequestNumber;
|
|
537
|
+
const settled = {
|
|
538
|
+
...(typeof recorded !== "number" || recorded === pullRequestNumber) && event === "pullRequestMerged" && typeof card.metadata?.reviewVerdict === "string" ? { reviewVerdict: null } : {},
|
|
539
|
+
...recorded === pullRequestNumber ? { openPullRequestNumber: null } : {}
|
|
540
|
+
};
|
|
541
|
+
if (Object.keys(settled).length > 0) await this.options.storage.update({
|
|
542
|
+
orgId: card.orgId,
|
|
543
|
+
id: card.id,
|
|
544
|
+
userId: "factory-rule-dispatcher",
|
|
545
|
+
patch: { metadata: settled }
|
|
546
|
+
});
|
|
547
|
+
continue;
|
|
548
|
+
}
|
|
549
|
+
await this.options.storage.update({
|
|
550
|
+
orgId: card.orgId,
|
|
551
|
+
id: card.id,
|
|
552
|
+
userId: "factory-rule-dispatcher",
|
|
553
|
+
patch: { metadata: {
|
|
554
|
+
state: "closed",
|
|
555
|
+
merged: event === "pullRequestMerged"
|
|
556
|
+
} }
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
};
|
|
560
|
+
const authoringItem = linked === void 0 && pullRequestOpened && relatedItem !== void 0 && relatedItem.externalSource?.type !== "pull-request" ? relatedItem : void 0;
|
|
561
|
+
const stampHead = async () => {
|
|
562
|
+
const headSha = string(object(pullRequest?.head)?.sha)?.toLowerCase();
|
|
563
|
+
if (event !== "pullRequestUpdated" || !headSha || !pullRequestNumber) return;
|
|
564
|
+
const headAt = timestamp(pullRequest?.updated_at);
|
|
565
|
+
if (relatedItem?.externalSource?.type !== "pull-request") return;
|
|
566
|
+
const parent = await this.#linkedClosureItem(project.orgId, project.factoryProjectId, repositoryId, repositoryName, pullRequestNumber, relatedItem);
|
|
567
|
+
await recordPullRequestHead(this.options.storage, {
|
|
568
|
+
orgId: relatedItem.orgId,
|
|
569
|
+
id: relatedItem.id,
|
|
570
|
+
headSha,
|
|
571
|
+
headAt
|
|
572
|
+
});
|
|
573
|
+
if (parent) await recordPullRequestHead(this.options.storage, {
|
|
574
|
+
orgId: parent.orgId,
|
|
575
|
+
id: parent.id,
|
|
576
|
+
headSha,
|
|
577
|
+
headAt,
|
|
578
|
+
ownedPullRequestNumber: pullRequestNumber
|
|
579
|
+
});
|
|
580
|
+
};
|
|
581
|
+
if (linked === void 0 && authoringItem === void 0) {
|
|
582
|
+
await stampClosed();
|
|
583
|
+
await stampHead();
|
|
584
|
+
return primary;
|
|
585
|
+
}
|
|
586
|
+
const companion = linked ?? authoringItem;
|
|
587
|
+
const secondary = await evaluate(companion, `${deliveryIdentity}:${companion?.id ?? "pull-request"}`);
|
|
588
|
+
await stampClosed(secondary.status);
|
|
589
|
+
for (const status of ["committed", "replayed"]) if (primary.status === status || secondary.status === status) return { status };
|
|
590
|
+
return primary;
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* The other card a closed pull request concerns, joined through the Review
|
|
594
|
+
* card's `parentWorkItemId` — the link `upsertLinkedWorkItem` records when the
|
|
595
|
+
* pull request is opened, and therefore an exact join that needs no branch
|
|
596
|
+
* heuristics. Returns nothing when the pull request has only one card, which
|
|
597
|
+
* is every pull request Factory did not open from a work item's session.
|
|
598
|
+
*/
|
|
599
|
+
async #linkedClosureItem(orgId, projectId, repositoryId, repositoryFullName, pullRequestNumber, resolved) {
|
|
600
|
+
const items = await this.options.storage.list({
|
|
601
|
+
orgId,
|
|
602
|
+
factoryProjectId: projectId
|
|
603
|
+
});
|
|
604
|
+
const linked = resolved.externalSource?.type === "pull-request" ? items.find((item) => item.id === resolved.parentWorkItemId) : items.find((item) => item.parentWorkItemId === resolved.id && (item.externalSource?.externalId === canonicalSourceKey("pull-request", pullRequestNumber) || item.externalSource?.externalId === legacySourceKey(repositoryId, "pull-request", pullRequestNumber)) && cardBelongsToRepository(item, repositoryId, repositoryFullName));
|
|
605
|
+
return linked?.id === resolved.id ? void 0 : linked;
|
|
606
|
+
}
|
|
607
|
+
async #relatedItem(orgId, projectId, repositoryId, repositoryFullName, issueNumber, pullRequestNumber, pullRequestHeadBranch, provenance, preferAuthoringItem = false) {
|
|
608
|
+
const items = await this.options.storage.list({
|
|
609
|
+
orgId,
|
|
610
|
+
factoryProjectId: projectId
|
|
611
|
+
});
|
|
612
|
+
const resolved = this.#resolveItem(items, repositoryId, repositoryFullName, issueNumber, pullRequestNumber, pullRequestHeadBranch, provenance);
|
|
613
|
+
if (preferAuthoringItem && resolved?.externalSource?.type === "pull-request" && resolved.parentWorkItemId) return items.find((item) => item.id === resolved.parentWorkItemId) ?? resolved;
|
|
614
|
+
return resolved;
|
|
615
|
+
}
|
|
616
|
+
#resolveItem(items, repositoryId, repositoryFullName, issueNumber, pullRequestNumber, pullRequestHeadBranch, provenance) {
|
|
617
|
+
if (provenance) return items.find((item) => item.id === provenance.workItemId);
|
|
618
|
+
if (issueNumber) return items.find((item) => item.externalSource?.externalId === canonicalSourceKey("issue", issueNumber) && cardBelongsToRepository(item, repositoryId, repositoryFullName)) ?? items.find((item) => item.externalSource?.externalId === legacySourceKey(repositoryId, "issue", issueNumber));
|
|
619
|
+
if (pullRequestNumber) return items.find((item) => item.externalSource?.externalId === canonicalSourceKey("pull-request", pullRequestNumber) && cardBelongsToRepository(item, repositoryId, repositoryFullName)) ?? items.find((item) => item.externalSource?.externalId === legacySourceKey(repositoryId, "pull-request", pullRequestNumber)) ?? (pullRequestHeadBranch ? items.find((item) => item.externalSource?.type !== "pull-request" && Object.values(item.sessions).some((session) => session.branch === pullRequestHeadBranch)) : void 0);
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
const RECONCILE_ERROR_SAMPLE_LIMIT = 5;
|
|
623
|
+
function sameStrings(left, right) {
|
|
624
|
+
if (right === void 0) return true;
|
|
625
|
+
if (!Array.isArray(left)) return false;
|
|
626
|
+
const leftValues = new Set(left.flatMap((value) => typeof value === "string" ? [value] : []));
|
|
627
|
+
const rightValues = new Set(right);
|
|
628
|
+
return leftValues.size === rightValues.size && [...leftValues].every((value) => rightValues.has(value));
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* Extracts the PR number a work item tracks, but only when the item belongs
|
|
632
|
+
* to the given repository. Card URLs pin the repository unambiguously; the
|
|
633
|
+
* legacy source key embeds the repository id. Canonical keys (`github-pr:N`)
|
|
634
|
+
* carry no repository, so they are only trusted when the item has no URL —
|
|
635
|
+
* a project mapped to multiple repositories must not reconcile one repo's
|
|
636
|
+
* card against another repo's PR number.
|
|
637
|
+
*/
|
|
638
|
+
function reconcilablePullRequestNumber(item, repository) {
|
|
639
|
+
if (item.externalSource?.type !== "pull-request") return void 0;
|
|
640
|
+
const url = item.externalSource.url;
|
|
641
|
+
if (url) {
|
|
642
|
+
const match = /^https?:\/\/[^/]+\/(.+)\/pull\/(\d+)(?:[/?#]|$)/.exec(url);
|
|
643
|
+
if (!match) return void 0;
|
|
644
|
+
return match[1] === repository.fullName ? Number(match[2]) : void 0;
|
|
645
|
+
}
|
|
646
|
+
const externalId = item.externalSource.externalId;
|
|
647
|
+
const legacy = /^github:(\d+):pull-request:(\d+)$/.exec(externalId);
|
|
648
|
+
if (legacy) return Number(legacy[1]) === repository.id ? Number(legacy[2]) : void 0;
|
|
649
|
+
const canonical = /^github-pr:(\d+)$/.exec(externalId);
|
|
650
|
+
return canonical ? Number(canonical[1]) : void 0;
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Extracts the issue number a work item tracks, but only when the item
|
|
654
|
+
* belongs to the given repository. Stricter than
|
|
655
|
+
* {@link reconcilablePullRequestNumber}: a canonical key with no URL is only
|
|
656
|
+
* trusted when the intake-stamped `githubRepositoryId` confirms the
|
|
657
|
+
* repository, because the sweep initiates closes on its own.
|
|
658
|
+
*/
|
|
659
|
+
function reconcilableIssueNumber(item, repository) {
|
|
660
|
+
if (item.externalSource?.type !== "issue") return void 0;
|
|
661
|
+
const url = item.externalSource.url;
|
|
662
|
+
if (url) {
|
|
663
|
+
const match = /^https?:\/\/[^/]+\/(.+)\/issues\/(\d+)(?:[/?#]|$)/.exec(url);
|
|
664
|
+
if (!match) return void 0;
|
|
665
|
+
return match[1] === repository.fullName || item.metadata?.githubRepositoryId === repository.id ? Number(match[2]) : void 0;
|
|
666
|
+
}
|
|
667
|
+
const externalId = item.externalSource.externalId;
|
|
668
|
+
const legacy = /^github:(\d+):issue:(\d+)$/.exec(externalId);
|
|
669
|
+
if (legacy) return Number(legacy[1]) === repository.id ? Number(legacy[2]) : void 0;
|
|
670
|
+
const canonical = /^github-issue:(\d+)$/.exec(externalId);
|
|
671
|
+
if (!canonical) return void 0;
|
|
672
|
+
return item.metadata?.githubRepositoryId === repository.id ? Number(canonical[1]) : void 0;
|
|
673
|
+
}
|
|
674
|
+
function reconciledIssueClosedEvent(repository, issueNumber, state) {
|
|
675
|
+
return {
|
|
676
|
+
event: "issues",
|
|
677
|
+
deliveryId: `reconcile:${repository.id}:issue:${issueNumber}:closed`,
|
|
678
|
+
payload: {
|
|
679
|
+
action: "closed",
|
|
680
|
+
installation: { id: repository.installationId },
|
|
681
|
+
repository: {
|
|
682
|
+
id: repository.id,
|
|
683
|
+
full_name: repository.fullName
|
|
684
|
+
},
|
|
685
|
+
sender: { login: state.author ?? "github" },
|
|
686
|
+
issue: {
|
|
687
|
+
number: issueNumber,
|
|
688
|
+
title: state.title,
|
|
689
|
+
html_url: state.url,
|
|
690
|
+
state: "closed",
|
|
691
|
+
...state.stateReason ? { state_reason: state.stateReason } : {},
|
|
692
|
+
...state.createdAt ? { created_at: state.createdAt } : {},
|
|
693
|
+
...state.updatedAt ? { updated_at: state.updatedAt } : {},
|
|
694
|
+
assignees: githubUsers(state.assignees)
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* The label-drift replay: an open issue whose labels changed without a
|
|
701
|
+
* `labeled`/`unlabeled` webhook ever arriving (Factory was down, the delivery
|
|
702
|
+
* was lost, or the label was applied by something other than a delivery the
|
|
703
|
+
* webhook saw). Synthesized as an `opened` delivery so the deployment's
|
|
704
|
+
* `issueOpened` rule decides placement, exactly as it does at arrival — one
|
|
705
|
+
* source of placement policy for both.
|
|
706
|
+
*/
|
|
707
|
+
function reconciledIssueRelabeledEvent(repository, issueNumber, state) {
|
|
708
|
+
const labels = state.labels ?? [];
|
|
709
|
+
const digest = createHash("sha256").update([...labels].sort().join("\n")).digest("hex").slice(0, 16);
|
|
710
|
+
const version = state.updatedAt ? `:${createHash("sha256").update(state.updatedAt).digest("hex").slice(0, 16)}` : "";
|
|
711
|
+
return {
|
|
712
|
+
event: "issues",
|
|
713
|
+
deliveryId: `reconcile:${repository.id}:issue:${issueNumber}:relabeled:${digest}${version}`,
|
|
714
|
+
payload: {
|
|
715
|
+
action: "opened",
|
|
716
|
+
installation: { id: repository.installationId },
|
|
717
|
+
repository: {
|
|
718
|
+
id: repository.id,
|
|
719
|
+
full_name: repository.fullName
|
|
720
|
+
},
|
|
721
|
+
sender: { login: state.author ?? "github" },
|
|
722
|
+
issue: {
|
|
723
|
+
number: issueNumber,
|
|
724
|
+
title: state.title,
|
|
725
|
+
html_url: state.url,
|
|
726
|
+
state: "open",
|
|
727
|
+
...state.createdAt ? { created_at: state.createdAt } : {},
|
|
728
|
+
...state.updatedAt ? { updated_at: state.updatedAt } : {},
|
|
729
|
+
assignees: githubUsers(state.assignees),
|
|
730
|
+
labels: githubLabels(labels)
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* The missed-open replay: an open issue with no Work card, because its
|
|
737
|
+
* `opened` delivery never reached the rules ingress. Synthesized as the same
|
|
738
|
+
* `opened` delivery so the deployment's `issueOpened` rule decides whether and
|
|
739
|
+
* where it lands, exactly as it would have at arrival. The delivery id is
|
|
740
|
+
* stable per issue so repeat sweeps dedupe at the ingress.
|
|
741
|
+
*/
|
|
742
|
+
function reconciledIssueOpenedEvent(repository, issueNumber, state) {
|
|
743
|
+
return {
|
|
744
|
+
...reconciledIssueRelabeledEvent(repository, issueNumber, state),
|
|
745
|
+
deliveryId: `reconcile:${repository.id}:issue:${issueNumber}:opened`
|
|
746
|
+
};
|
|
747
|
+
}
|
|
748
|
+
function polledPullRequestEvent(repository, pullRequestNumber, state) {
|
|
749
|
+
return {
|
|
750
|
+
event: "pull_request",
|
|
751
|
+
deliveryId: `poll:${repository.id}:pull-request:${pullRequestNumber}:${state.createdAt}`,
|
|
752
|
+
payload: {
|
|
753
|
+
action: "opened",
|
|
754
|
+
installation: { id: repository.installationId },
|
|
755
|
+
repository: {
|
|
756
|
+
id: repository.id,
|
|
757
|
+
full_name: repository.fullName
|
|
758
|
+
},
|
|
759
|
+
sender: { login: state.author ?? "__unknown__" },
|
|
760
|
+
pull_request: pullRequestPayload(pullRequestNumber, state)
|
|
761
|
+
}
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
function reconciledClosedEvent(repository, pullRequestNumber, state) {
|
|
765
|
+
const outcome = state.merged ? "merged" : "closed";
|
|
766
|
+
return {
|
|
767
|
+
event: "pull_request",
|
|
768
|
+
deliveryId: `reconcile:${repository.id}:pull-request:${pullRequestNumber}:${outcome}`,
|
|
769
|
+
payload: {
|
|
770
|
+
action: "closed",
|
|
771
|
+
installation: { id: repository.installationId },
|
|
772
|
+
repository: {
|
|
773
|
+
id: repository.id,
|
|
774
|
+
full_name: repository.fullName
|
|
775
|
+
},
|
|
776
|
+
sender: { login: state.mergedBy ?? "github" },
|
|
777
|
+
pull_request: pullRequestPayload(pullRequestNumber, {
|
|
778
|
+
...state,
|
|
779
|
+
state: "closed"
|
|
780
|
+
})
|
|
781
|
+
}
|
|
782
|
+
};
|
|
783
|
+
}
|
|
784
|
+
function pullRequestPayload(pullRequestNumber, state) {
|
|
785
|
+
const payload = {
|
|
786
|
+
number: pullRequestNumber,
|
|
787
|
+
title: state.title,
|
|
788
|
+
html_url: state.url,
|
|
789
|
+
state: state.state,
|
|
790
|
+
draft: state.draft,
|
|
791
|
+
merged: state.merged,
|
|
792
|
+
assignees: githubUsers(state.assignees),
|
|
793
|
+
requested_reviewers: githubUsers(state.requestedReviewers),
|
|
794
|
+
labels: githubLabels(state.labels),
|
|
795
|
+
head: { ref: state.headBranch },
|
|
796
|
+
base: { ref: state.baseBranch }
|
|
797
|
+
};
|
|
798
|
+
if (state.createdAt) payload.created_at = state.createdAt;
|
|
799
|
+
if (state.author) payload.user = { login: state.author };
|
|
800
|
+
return payload;
|
|
801
|
+
}
|
|
802
|
+
function githubUsers(logins = []) {
|
|
803
|
+
return logins.map((login) => ({ login }));
|
|
804
|
+
}
|
|
805
|
+
function githubLabels(names = []) {
|
|
806
|
+
return names.map((name) => ({ name }));
|
|
807
|
+
}
|
|
808
|
+
function reconciledPullRequestMetadata(state, reconciliation, authorTrusted) {
|
|
809
|
+
return {
|
|
810
|
+
state: state.state,
|
|
811
|
+
draft: state.draft,
|
|
812
|
+
merged: state.merged,
|
|
813
|
+
...state.author ? { author: state.author } : {},
|
|
814
|
+
...state.assignees ? { assignees: state.assignees } : {},
|
|
815
|
+
...state.requestedReviewers ? { requestedReviewers: state.requestedReviewers } : {},
|
|
816
|
+
...state.labels ? { labels: state.labels } : {},
|
|
817
|
+
...authorTrusted === void 0 ? {} : { authorTrusted },
|
|
818
|
+
[FACTORY_PULL_REQUEST_RECONCILIATION_KEY]: reconciliation === "settled" ? state.merged ? "merged" : "closed" : null
|
|
819
|
+
};
|
|
820
|
+
}
|
|
821
|
+
function reconciledPullRequestOutcome(metadata) {
|
|
822
|
+
if (metadata.state !== "closed" || typeof metadata.merged !== "boolean") return void 0;
|
|
823
|
+
return metadata.merged ? "merged" : "closed";
|
|
824
|
+
}
|
|
825
|
+
/**
|
|
826
|
+
* The webhook handler retires subscriptions itself; the sweep replays only the
|
|
827
|
+
* rules ingress, so without this the thread's PR chip and the workspace row
|
|
828
|
+
* stay `open` forever on a deployment GitHub cannot reach.
|
|
829
|
+
*/
|
|
830
|
+
async function retireReconciledSubscriptions(storage, repository, pullRequestNumber, merged) {
|
|
831
|
+
const target = changeRequestTargetKey({
|
|
832
|
+
installationExternalId: String(repository.installationId),
|
|
833
|
+
repositoryExternalId: String(repository.id),
|
|
834
|
+
changeRequestId: String(pullRequestNumber)
|
|
835
|
+
});
|
|
836
|
+
const rows = await storage.subscriptions.listByTarget(target);
|
|
837
|
+
await Promise.all(rows.filter((row) => row.status === "open").map((row) => storage.subscriptions.updateStatus(row.id, merged ? "merged" : "closed")));
|
|
838
|
+
}
|
|
839
|
+
/**
|
|
840
|
+
* State-based safety net for merge signals: webhooks and event-log tailing
|
|
841
|
+
* can miss a merge (cursor gaps, downtime, terminally failed decisions), so
|
|
842
|
+
* this sweep compares still-open PR cards against actual GitHub state and
|
|
843
|
+
* replays the merge through the normal rules ingress when they disagree.
|
|
844
|
+
*/
|
|
845
|
+
function createGithubPullRequestReconciler(options, fetchPullRequest) {
|
|
846
|
+
const rules = new GithubRules(options);
|
|
847
|
+
return async (repositories) => {
|
|
848
|
+
const summary = {
|
|
849
|
+
repositories: 0,
|
|
850
|
+
checked: 0,
|
|
851
|
+
merged: 0,
|
|
852
|
+
closed: 0,
|
|
853
|
+
failed: 0,
|
|
854
|
+
errors: []
|
|
855
|
+
};
|
|
856
|
+
const recordFailure = (repository, error, pullRequestNumber) => {
|
|
857
|
+
summary.failed += 1;
|
|
858
|
+
if (summary.errors.length < 5) summary.errors.push({
|
|
859
|
+
repository: repository.fullName,
|
|
860
|
+
...pullRequestNumber === void 0 ? {} : { pullRequestNumber },
|
|
861
|
+
error: error instanceof Error ? error.message : String(error)
|
|
862
|
+
});
|
|
863
|
+
};
|
|
864
|
+
const configured = new Set((await options.sourceControl.projectRepositories.listConfiguredExternalKeys()).map((key) => `${key.installationExternalId}\u0000${key.repositoryExternalId}`));
|
|
865
|
+
const scoped = repositories.filter((repository) => configured.has(`${repository.installationId}\u0000${repository.id}`));
|
|
866
|
+
summary.repositories = scoped.length;
|
|
867
|
+
for (const repository of scoped) {
|
|
868
|
+
let cardsByNumber;
|
|
869
|
+
let unanswered;
|
|
870
|
+
try {
|
|
871
|
+
const projects = await options.sourceControl.projectRepositories.listByExternalRepository({
|
|
872
|
+
installationExternalId: String(repository.installationId),
|
|
873
|
+
repositoryExternalId: String(repository.id)
|
|
874
|
+
});
|
|
875
|
+
if (projects.length === 0) continue;
|
|
876
|
+
cardsByNumber = /* @__PURE__ */ new Map();
|
|
877
|
+
unanswered = [];
|
|
878
|
+
for (const project of projects) {
|
|
879
|
+
const items = await options.storage.list({
|
|
880
|
+
orgId: project.orgId,
|
|
881
|
+
factoryProjectId: project.factoryProjectId
|
|
882
|
+
});
|
|
883
|
+
for (const item of items) {
|
|
884
|
+
const unansweredAuthor = authorAwaitingTrust(item, repository);
|
|
885
|
+
if (unansweredAuthor) unanswered.push({
|
|
886
|
+
item,
|
|
887
|
+
author: unansweredAuthor
|
|
888
|
+
});
|
|
889
|
+
const pullRequestNumber = reconcilablePullRequestNumber(item, repository);
|
|
890
|
+
if (!pullRequestNumber) continue;
|
|
891
|
+
const metadata = item.metadata ?? {};
|
|
892
|
+
const reconciliation = metadata[FACTORY_PULL_REQUEST_RECONCILIATION_KEY];
|
|
893
|
+
const reconciledOutcome = reconciledPullRequestOutcome(metadata);
|
|
894
|
+
if (workItemPhaseSemantics(options.boards, item)?.kind === "terminal" && reconciledOutcome !== void 0 && reconciliation === reconciledOutcome) continue;
|
|
895
|
+
const cards = cardsByNumber.get(pullRequestNumber) ?? [];
|
|
896
|
+
cards.push(item);
|
|
897
|
+
cardsByNumber.set(pullRequestNumber, cards);
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
} catch (error) {
|
|
901
|
+
recordFailure(repository, error);
|
|
902
|
+
continue;
|
|
903
|
+
}
|
|
904
|
+
const authorTrust = sweepTrustLookup(options.github, repository);
|
|
905
|
+
for (const { item, author } of unanswered) try {
|
|
906
|
+
await options.storage.update({
|
|
907
|
+
orgId: item.orgId,
|
|
908
|
+
id: item.id,
|
|
909
|
+
userId: "factory-rule-dispatcher",
|
|
910
|
+
patch: { metadata: { authorTrusted: await authorTrust(author) } }
|
|
911
|
+
});
|
|
912
|
+
} catch (error) {
|
|
913
|
+
recordFailure(repository, error);
|
|
914
|
+
}
|
|
915
|
+
for (const [pullRequestNumber, cards] of cardsByNumber) try {
|
|
916
|
+
const state = await fetchPullRequest({
|
|
917
|
+
installationId: repository.installationId,
|
|
918
|
+
repository: repository.fullName,
|
|
919
|
+
number: pullRequestNumber
|
|
920
|
+
});
|
|
921
|
+
summary.checked += 1;
|
|
922
|
+
if (!state) continue;
|
|
923
|
+
let authorTrusted;
|
|
924
|
+
if (state.author !== void 0) try {
|
|
925
|
+
authorTrusted = await authorTrust(state.author);
|
|
926
|
+
} catch (error) {
|
|
927
|
+
recordFailure(repository, error, pullRequestNumber);
|
|
928
|
+
}
|
|
929
|
+
for (const card of cards) {
|
|
930
|
+
if (state.state === "closed") continue;
|
|
931
|
+
const metadata = card.metadata ?? {};
|
|
932
|
+
const statusChanged = metadata.state !== state.state || metadata.draft !== state.draft || metadata.merged !== state.merged;
|
|
933
|
+
const authorChanged = state.author !== void 0 && metadata.author !== state.author;
|
|
934
|
+
const assigneesChanged = !sameStrings(metadata.assignees, state.assignees);
|
|
935
|
+
const reviewersChanged = !sameStrings(metadata.requestedReviewers, state.requestedReviewers);
|
|
936
|
+
const labelsChanged = !sameStrings(metadata.labels, state.labels);
|
|
937
|
+
const trustStale = authorTrusted !== void 0 && metadata.authorTrusted !== authorTrusted;
|
|
938
|
+
const metadataChanged = statusChanged || authorChanged || assigneesChanged || reviewersChanged || labelsChanged || trustStale;
|
|
939
|
+
const reconciliation = metadata[FACTORY_PULL_REQUEST_RECONCILIATION_KEY];
|
|
940
|
+
if (!metadataChanged && reconciliation !== "merged" && reconciliation !== "closed") continue;
|
|
941
|
+
try {
|
|
942
|
+
await options.storage.update({
|
|
943
|
+
orgId: card.orgId,
|
|
944
|
+
id: card.id,
|
|
945
|
+
userId: "factory-rule-dispatcher",
|
|
946
|
+
patch: { metadata: reconciledPullRequestMetadata(state, "clear", trustStale ? authorTrusted : void 0) }
|
|
947
|
+
});
|
|
948
|
+
} catch (error) {
|
|
949
|
+
recordFailure(repository, error, pullRequestNumber);
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
if (state.state !== "closed") continue;
|
|
953
|
+
const cleanupFailures = /* @__PURE__ */ new Set();
|
|
954
|
+
for (const card of cards) {
|
|
955
|
+
if (workItemPhaseSemantics(options.boards, card)?.kind !== "terminal") continue;
|
|
956
|
+
try {
|
|
957
|
+
await options.storage.supersedeDecisionsForWorkItem({
|
|
958
|
+
orgId: card.orgId,
|
|
959
|
+
factoryProjectId: card.factoryProjectId,
|
|
960
|
+
workItemId: card.id,
|
|
961
|
+
supersededAt: /* @__PURE__ */ new Date()
|
|
962
|
+
});
|
|
963
|
+
} catch (error) {
|
|
964
|
+
recordFailure(repository, error, pullRequestNumber);
|
|
965
|
+
cleanupFailures.add(card.id);
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
await rules.ingest(reconciledClosedEvent(repository, pullRequestNumber, state));
|
|
969
|
+
await retireReconciledSubscriptions(options.integrationStorage, repository, pullRequestNumber, state.merged);
|
|
970
|
+
for (const card of cards) {
|
|
971
|
+
if (cleanupFailures.has(card.id)) continue;
|
|
972
|
+
const trustStale = authorTrusted !== void 0 && (card.metadata ?? {}).authorTrusted !== authorTrusted;
|
|
973
|
+
try {
|
|
974
|
+
await options.storage.update({
|
|
975
|
+
orgId: card.orgId,
|
|
976
|
+
id: card.id,
|
|
977
|
+
userId: "factory-rule-dispatcher",
|
|
978
|
+
patch: { metadata: reconciledPullRequestMetadata(state, "settled", trustStale ? authorTrusted : void 0) }
|
|
979
|
+
});
|
|
980
|
+
} catch (error) {
|
|
981
|
+
recordFailure(repository, error, pullRequestNumber);
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
if (state.merged) summary.merged += 1;
|
|
985
|
+
else summary.closed += 1;
|
|
986
|
+
} catch (error) {
|
|
987
|
+
recordFailure(repository, error, pullRequestNumber);
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
return summary;
|
|
991
|
+
};
|
|
992
|
+
}
|
|
993
|
+
function githubRulesOptions(github, context) {
|
|
994
|
+
if (!context.runtime) return void 0;
|
|
995
|
+
return {
|
|
996
|
+
github,
|
|
997
|
+
sourceControl: context.storage.sourceControl,
|
|
998
|
+
integrationStorage: context.storage.generic,
|
|
999
|
+
projects: context.storage.projects,
|
|
1000
|
+
storage: context.runtime.workItems,
|
|
1001
|
+
configVersion: context.runtime.configVersion,
|
|
1002
|
+
boards: context.runtime.boards,
|
|
1003
|
+
intake: context.storage.intake,
|
|
1004
|
+
...context.hooks?.onRepositoryPush ? { onRepositoryPush: context.hooks.onRepositoryPush } : {}
|
|
1005
|
+
};
|
|
1006
|
+
}
|
|
1007
|
+
function attachGithubRules(github, context) {
|
|
1008
|
+
const options = githubRulesOptions(github, context);
|
|
1009
|
+
if (!options) return void 0;
|
|
1010
|
+
const rules = new GithubRules(options);
|
|
1011
|
+
return (event) => rules.ingest(event);
|
|
1012
|
+
}
|
|
1013
|
+
function attachGithubReconciler(github, context, fetchPullRequest) {
|
|
1014
|
+
const options = githubRulesOptions(github, context);
|
|
1015
|
+
if (!options) return void 0;
|
|
1016
|
+
return createGithubPullRequestReconciler(options, fetchPullRequest);
|
|
1017
|
+
}
|
|
1018
|
+
//#endregion
|
|
1019
|
+
export { GithubRules, RECONCILE_ERROR_SAMPLE_LIMIT, attachGithubReconciler, attachGithubRules, cardBelongsToRepository, createGithubPullRequestReconciler, githubRulesOptions, isFactoryGithubLogin, polledPullRequestEvent, reconcilableIssueNumber, reconciledClosedEvent, reconciledIssueClosedEvent, reconciledIssueOpenedEvent, reconciledIssueRelabeledEvent, sameStrings, sweepTrustLookup, trustedCollaborator };
|
|
1020
|
+
|
|
1021
|
+
//# sourceMappingURL=rules.js.map
|