@mastra/factory 0.0.0-aggregate-trace-20261015182851
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +32 -0
- package/README.md +671 -0
- package/dist/auth.d.ts +201 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +623 -0
- package/dist/auth.js.map +1 -0
- package/dist/boards/define-board.d.ts +111 -0
- package/dist/boards/define-board.d.ts.map +1 -0
- package/dist/boards/define-board.js +156 -0
- package/dist/boards/define-board.js.map +1 -0
- package/dist/boards/index.d.ts +14 -0
- package/dist/boards/index.d.ts.map +1 -0
- package/dist/boards/index.js +21 -0
- package/dist/boards/index.js.map +1 -0
- package/dist/boards/registry.d.ts +16 -0
- package/dist/boards/registry.d.ts.map +1 -0
- package/dist/boards/registry.js +25 -0
- package/dist/boards/registry.js.map +1 -0
- package/dist/boards/relocate.d.ts +21 -0
- package/dist/boards/relocate.d.ts.map +1 -0
- package/dist/boards/relocate.js +58 -0
- package/dist/boards/relocate.js.map +1 -0
- package/dist/boards/review.d.ts +6 -0
- package/dist/boards/review.d.ts.map +1 -0
- package/dist/boards/review.js +104 -0
- package/dist/boards/review.js.map +1 -0
- package/dist/boards/semantics.d.ts +68 -0
- package/dist/boards/semantics.d.ts.map +1 -0
- package/dist/boards/semantics.js +119 -0
- package/dist/boards/semantics.js.map +1 -0
- package/dist/boards/transition-policy.d.ts +67 -0
- package/dist/boards/transition-policy.d.ts.map +1 -0
- package/dist/boards/transition-policy.js +36 -0
- package/dist/boards/transition-policy.js.map +1 -0
- package/dist/boards/work-tool-rules.d.ts +8 -0
- package/dist/boards/work-tool-rules.d.ts.map +1 -0
- package/dist/boards/work-tool-rules.js +20 -0
- package/dist/boards/work-tool-rules.js.map +1 -0
- package/dist/boards/work-transition-policy.d.ts +3 -0
- package/dist/boards/work-transition-policy.d.ts.map +1 -0
- package/dist/boards/work-transition-policy.js +46 -0
- package/dist/boards/work-transition-policy.js.map +1 -0
- package/dist/boards/work.d.ts +4 -0
- package/dist/boards/work.d.ts.map +1 -0
- package/dist/boards/work.js +222 -0
- package/dist/boards/work.js.map +1 -0
- package/dist/capabilities/connection.d.ts +9 -0
- package/dist/capabilities/connection.d.ts.map +1 -0
- package/dist/capabilities/connection.js +1 -0
- package/dist/capabilities/intake.d.ts +153 -0
- package/dist/capabilities/intake.d.ts.map +1 -0
- package/dist/capabilities/intake.js +1 -0
- package/dist/capabilities/version-control.d.ts +268 -0
- package/dist/capabilities/version-control.d.ts.map +1 -0
- package/dist/capabilities/version-control.js +1 -0
- package/dist/environment/build-runner.d.ts +72 -0
- package/dist/environment/build-runner.d.ts.map +1 -0
- package/dist/environment/build-runner.js +131 -0
- package/dist/environment/build-runner.js.map +1 -0
- package/dist/environment/build-schedule.d.ts +40 -0
- package/dist/environment/build-schedule.d.ts.map +1 -0
- package/dist/environment/build-schedule.js +94 -0
- package/dist/environment/build-schedule.js.map +1 -0
- package/dist/environment/build-workflow.d.ts +62 -0
- package/dist/environment/build-workflow.d.ts.map +1 -0
- package/dist/environment/build-workflow.js +149 -0
- package/dist/environment/build-workflow.js.map +1 -0
- package/dist/environment/build.d.ts +111 -0
- package/dist/environment/build.d.ts.map +1 -0
- package/dist/environment/build.js +344 -0
- package/dist/environment/build.js.map +1 -0
- package/dist/environment/heads.d.ts +36 -0
- package/dist/environment/heads.d.ts.map +1 -0
- package/dist/environment/heads.js +60 -0
- package/dist/environment/heads.js.map +1 -0
- package/dist/factory.d.ts +225 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/factory.js +1006 -0
- package/dist/factory.js.map +1 -0
- package/dist/feed-events.d.ts +13 -0
- package/dist/feed-events.d.ts.map +1 -0
- package/dist/feed-events.js +25 -0
- package/dist/feed-events.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/integrations/base.d.ts +302 -0
- package/dist/integrations/base.d.ts.map +1 -0
- package/dist/integrations/base.js +1 -0
- package/dist/integrations/github/acceptance-labels.d.ts +16 -0
- package/dist/integrations/github/acceptance-labels.d.ts.map +1 -0
- package/dist/integrations/github/acceptance-labels.js +55 -0
- package/dist/integrations/github/acceptance-labels.js.map +1 -0
- package/dist/integrations/github/app-identity.d.ts +43 -0
- package/dist/integrations/github/app-identity.d.ts.map +1 -0
- package/dist/integrations/github/app-identity.js +62 -0
- package/dist/integrations/github/app-identity.js.map +1 -0
- package/dist/integrations/github/commits.d.ts +40 -0
- package/dist/integrations/github/commits.d.ts.map +1 -0
- package/dist/integrations/github/commits.js +48 -0
- package/dist/integrations/github/commits.js.map +1 -0
- package/dist/integrations/github/config.d.ts +60 -0
- package/dist/integrations/github/config.d.ts.map +1 -0
- package/dist/integrations/github/config.js +42 -0
- package/dist/integrations/github/config.js.map +1 -0
- package/dist/integrations/github/default-rules.d.ts +218 -0
- package/dist/integrations/github/default-rules.d.ts.map +1 -0
- package/dist/integrations/github/default-rules.js +296 -0
- package/dist/integrations/github/default-rules.js.map +1 -0
- package/dist/integrations/github/integration.d.ts +270 -0
- package/dist/integrations/github/integration.d.ts.map +1 -0
- package/dist/integrations/github/integration.js +1375 -0
- package/dist/integrations/github/integration.js.map +1 -0
- package/dist/integrations/github/issue-reconciler.d.ts +28 -0
- package/dist/integrations/github/issue-reconciler.d.ts.map +1 -0
- package/dist/integrations/github/issue-reconciler.js +138 -0
- package/dist/integrations/github/issue-reconciler.js.map +1 -0
- package/dist/integrations/github/pat.d.ts +38 -0
- package/dist/integrations/github/pat.d.ts.map +1 -0
- package/dist/integrations/github/pat.js +59 -0
- package/dist/integrations/github/pat.js.map +1 -0
- package/dist/integrations/github/provenance.d.ts +34 -0
- package/dist/integrations/github/provenance.d.ts.map +1 -0
- package/dist/integrations/github/provenance.js +91 -0
- package/dist/integrations/github/provenance.js.map +1 -0
- package/dist/integrations/github/reconcile-worker.d.ts +45 -0
- package/dist/integrations/github/reconcile-worker.d.ts.map +1 -0
- package/dist/integrations/github/reconcile-worker.js +189 -0
- package/dist/integrations/github/reconcile-worker.js.map +1 -0
- package/dist/integrations/github/reconciliation-config.d.ts +3 -0
- package/dist/integrations/github/reconciliation-config.d.ts.map +1 -0
- package/dist/integrations/github/reconciliation-config.js +19 -0
- package/dist/integrations/github/reconciliation-config.js.map +1 -0
- package/dist/integrations/github/routes.d.ts +90 -0
- package/dist/integrations/github/routes.d.ts.map +1 -0
- package/dist/integrations/github/routes.js +1362 -0
- package/dist/integrations/github/routes.js.map +1 -0
- package/dist/integrations/github/rules.d.ts +173 -0
- package/dist/integrations/github/rules.d.ts.map +1 -0
- package/dist/integrations/github/rules.js +1021 -0
- package/dist/integrations/github/rules.js.map +1 -0
- package/dist/integrations/github/sandbox-release.d.ts +25 -0
- package/dist/integrations/github/sandbox-release.d.ts.map +1 -0
- package/dist/integrations/github/sandbox-release.js +38 -0
- package/dist/integrations/github/sandbox-release.js.map +1 -0
- package/dist/integrations/github/sandbox.d.ts +234 -0
- package/dist/integrations/github/sandbox.d.ts.map +1 -0
- package/dist/integrations/github/sandbox.js +947 -0
- package/dist/integrations/github/sandbox.js.map +1 -0
- package/dist/integrations/github/session-subscriptions.d.ts +28 -0
- package/dist/integrations/github/session-subscriptions.d.ts.map +1 -0
- package/dist/integrations/github/session-subscriptions.js +283 -0
- package/dist/integrations/github/session-subscriptions.js.map +1 -0
- package/dist/integrations/github/settle-or-abort.d.ts +7 -0
- package/dist/integrations/github/settle-or-abort.d.ts.map +1 -0
- package/dist/integrations/github/settle-or-abort.js +25 -0
- package/dist/integrations/github/settle-or-abort.js.map +1 -0
- package/dist/integrations/github/stale-reviews.d.ts +22 -0
- package/dist/integrations/github/stale-reviews.d.ts.map +1 -0
- package/dist/integrations/github/stale-reviews.js +70 -0
- package/dist/integrations/github/stale-reviews.js.map +1 -0
- package/dist/integrations/github/subscriptions.d.ts +54 -0
- package/dist/integrations/github/subscriptions.d.ts.map +1 -0
- package/dist/integrations/github/subscriptions.js +64 -0
- package/dist/integrations/github/subscriptions.js.map +1 -0
- package/dist/integrations/github/token-refresh.d.ts +31 -0
- package/dist/integrations/github/token-refresh.d.ts.map +1 -0
- package/dist/integrations/github/token-refresh.js +42 -0
- package/dist/integrations/github/token-refresh.js.map +1 -0
- package/dist/integrations/github/webhook.d.ts +139 -0
- package/dist/integrations/github/webhook.d.ts.map +1 -0
- package/dist/integrations/github/webhook.js +432 -0
- package/dist/integrations/github/webhook.js.map +1 -0
- package/dist/integrations/gitlab/agent-tools.d.ts +14 -0
- package/dist/integrations/gitlab/agent-tools.d.ts.map +1 -0
- package/dist/integrations/gitlab/agent-tools.js +42 -0
- package/dist/integrations/gitlab/agent-tools.js.map +1 -0
- package/dist/integrations/gitlab/api.d.ts +222 -0
- package/dist/integrations/gitlab/api.d.ts.map +1 -0
- package/dist/integrations/gitlab/api.js +274 -0
- package/dist/integrations/gitlab/api.js.map +1 -0
- package/dist/integrations/gitlab/default-rules.d.ts +125 -0
- package/dist/integrations/gitlab/default-rules.d.ts.map +1 -0
- package/dist/integrations/gitlab/default-rules.js +180 -0
- package/dist/integrations/gitlab/default-rules.js.map +1 -0
- package/dist/integrations/gitlab/integration.d.ts +138 -0
- package/dist/integrations/gitlab/integration.d.ts.map +1 -0
- package/dist/integrations/gitlab/integration.js +705 -0
- package/dist/integrations/gitlab/integration.js.map +1 -0
- package/dist/integrations/gitlab/issue-reconciler.d.ts +6 -0
- package/dist/integrations/gitlab/issue-reconciler.d.ts.map +1 -0
- package/dist/integrations/gitlab/issue-reconciler.js +123 -0
- package/dist/integrations/gitlab/issue-reconciler.js.map +1 -0
- package/dist/integrations/gitlab/merge-request-reconciler.d.ts +6 -0
- package/dist/integrations/gitlab/merge-request-reconciler.d.ts.map +1 -0
- package/dist/integrations/gitlab/merge-request-reconciler.js +267 -0
- package/dist/integrations/gitlab/merge-request-reconciler.js.map +1 -0
- package/dist/integrations/gitlab/reconciler.d.ts +5 -0
- package/dist/integrations/gitlab/reconciler.d.ts.map +1 -0
- package/dist/integrations/gitlab/reconciler.js +31 -0
- package/dist/integrations/gitlab/reconciler.js.map +1 -0
- package/dist/integrations/gitlab/reconciliation-config.d.ts +3 -0
- package/dist/integrations/gitlab/reconciliation-config.d.ts.map +1 -0
- package/dist/integrations/gitlab/reconciliation-config.js +17 -0
- package/dist/integrations/gitlab/reconciliation-config.js.map +1 -0
- package/dist/integrations/gitlab/routes.d.ts +20 -0
- package/dist/integrations/gitlab/routes.d.ts.map +1 -0
- package/dist/integrations/gitlab/routes.js +474 -0
- package/dist/integrations/gitlab/routes.js.map +1 -0
- package/dist/integrations/gitlab/rules.d.ts +35 -0
- package/dist/integrations/gitlab/rules.d.ts.map +1 -0
- package/dist/integrations/gitlab/rules.js +502 -0
- package/dist/integrations/gitlab/rules.js.map +1 -0
- package/dist/integrations/gitlab/session-subscriptions.d.ts +32 -0
- package/dist/integrations/gitlab/session-subscriptions.d.ts.map +1 -0
- package/dist/integrations/gitlab/session-subscriptions.js +193 -0
- package/dist/integrations/gitlab/session-subscriptions.js.map +1 -0
- package/dist/integrations/gitlab/subscriptions.d.ts +70 -0
- package/dist/integrations/gitlab/subscriptions.d.ts.map +1 -0
- package/dist/integrations/gitlab/subscriptions.js +76 -0
- package/dist/integrations/gitlab/subscriptions.js.map +1 -0
- package/dist/integrations/gitlab/version-control.d.ts +16 -0
- package/dist/integrations/gitlab/version-control.d.ts.map +1 -0
- package/dist/integrations/gitlab/version-control.js +621 -0
- package/dist/integrations/gitlab/version-control.js.map +1 -0
- package/dist/integrations/gitlab/webhook-dispatch.d.ts +75 -0
- package/dist/integrations/gitlab/webhook-dispatch.d.ts.map +1 -0
- package/dist/integrations/gitlab/webhook-dispatch.js +235 -0
- package/dist/integrations/gitlab/webhook-dispatch.js.map +1 -0
- package/dist/integrations/gitlab/webhook.d.ts +72 -0
- package/dist/integrations/gitlab/webhook.d.ts.map +1 -0
- package/dist/integrations/gitlab/webhook.js +201 -0
- package/dist/integrations/gitlab/webhook.js.map +1 -0
- package/dist/integrations/incidentio/agent-tools.d.ts +49 -0
- package/dist/integrations/incidentio/agent-tools.d.ts.map +1 -0
- package/dist/integrations/incidentio/agent-tools.js +90 -0
- package/dist/integrations/incidentio/agent-tools.js.map +1 -0
- package/dist/integrations/incidentio/api.d.ts +400 -0
- package/dist/integrations/incidentio/api.d.ts.map +1 -0
- package/dist/integrations/incidentio/api.js +192 -0
- package/dist/integrations/incidentio/api.js.map +1 -0
- package/dist/integrations/incidentio/claim.d.ts +8 -0
- package/dist/integrations/incidentio/claim.d.ts.map +1 -0
- package/dist/integrations/incidentio/claim.js +14 -0
- package/dist/integrations/incidentio/claim.js.map +1 -0
- package/dist/integrations/incidentio/default-rules.d.ts +46 -0
- package/dist/integrations/incidentio/default-rules.d.ts.map +1 -0
- package/dist/integrations/incidentio/default-rules.js +68 -0
- package/dist/integrations/incidentio/default-rules.js.map +1 -0
- package/dist/integrations/incidentio/intake.d.ts +10 -0
- package/dist/integrations/incidentio/intake.d.ts.map +1 -0
- package/dist/integrations/incidentio/intake.js +307 -0
- package/dist/integrations/incidentio/intake.js.map +1 -0
- package/dist/integrations/incidentio/integration.d.ts +63 -0
- package/dist/integrations/incidentio/integration.d.ts.map +1 -0
- package/dist/integrations/incidentio/integration.js +141 -0
- package/dist/integrations/incidentio/integration.js.map +1 -0
- package/dist/integrations/incidentio/issue-reconciler.d.ts +10 -0
- package/dist/integrations/incidentio/issue-reconciler.d.ts.map +1 -0
- package/dist/integrations/incidentio/issue-reconciler.js +75 -0
- package/dist/integrations/incidentio/issue-reconciler.js.map +1 -0
- package/dist/integrations/incidentio/reconciliation-config.d.ts +3 -0
- package/dist/integrations/incidentio/reconciliation-config.d.ts.map +1 -0
- package/dist/integrations/incidentio/reconciliation-config.js +17 -0
- package/dist/integrations/incidentio/reconciliation-config.js.map +1 -0
- package/dist/integrations/incidentio/routes.d.ts +76 -0
- package/dist/integrations/incidentio/routes.d.ts.map +1 -0
- package/dist/integrations/incidentio/routes.js +249 -0
- package/dist/integrations/incidentio/routes.js.map +1 -0
- package/dist/integrations/incidentio/rules.d.ts +55 -0
- package/dist/integrations/incidentio/rules.d.ts.map +1 -0
- package/dist/integrations/incidentio/rules.js +189 -0
- package/dist/integrations/incidentio/rules.js.map +1 -0
- package/dist/integrations/issue-reconcile-worker.d.ts +19 -0
- package/dist/integrations/issue-reconcile-worker.d.ts.map +1 -0
- package/dist/integrations/issue-reconcile-worker.js +97 -0
- package/dist/integrations/issue-reconcile-worker.js.map +1 -0
- package/dist/integrations/issue-reconciler.d.ts +51 -0
- package/dist/integrations/issue-reconciler.d.ts.map +1 -0
- package/dist/integrations/issue-reconciler.js +158 -0
- package/dist/integrations/issue-reconciler.js.map +1 -0
- package/dist/integrations/jira/adf.d.ts +26 -0
- package/dist/integrations/jira/adf.d.ts.map +1 -0
- package/dist/integrations/jira/adf.js +73 -0
- package/dist/integrations/jira/adf.js.map +1 -0
- package/dist/integrations/jira/agent-tools.d.ts +45 -0
- package/dist/integrations/jira/agent-tools.d.ts.map +1 -0
- package/dist/integrations/jira/agent-tools.js +87 -0
- package/dist/integrations/jira/agent-tools.js.map +1 -0
- package/dist/integrations/jira/api.d.ts +157 -0
- package/dist/integrations/jira/api.d.ts.map +1 -0
- package/dist/integrations/jira/api.js +141 -0
- package/dist/integrations/jira/api.js.map +1 -0
- package/dist/integrations/jira/claim.d.ts +9 -0
- package/dist/integrations/jira/claim.d.ts.map +1 -0
- package/dist/integrations/jira/claim.js +15 -0
- package/dist/integrations/jira/claim.js.map +1 -0
- package/dist/integrations/jira/default-rules.d.ts +47 -0
- package/dist/integrations/jira/default-rules.d.ts.map +1 -0
- package/dist/integrations/jira/default-rules.js +69 -0
- package/dist/integrations/jira/default-rules.js.map +1 -0
- package/dist/integrations/jira/integration.d.ts +114 -0
- package/dist/integrations/jira/integration.d.ts.map +1 -0
- package/dist/integrations/jira/integration.js +407 -0
- package/dist/integrations/jira/integration.js.map +1 -0
- package/dist/integrations/jira/issue-reconciler.d.ts +10 -0
- package/dist/integrations/jira/issue-reconciler.d.ts.map +1 -0
- package/dist/integrations/jira/issue-reconciler.js +70 -0
- package/dist/integrations/jira/issue-reconciler.js.map +1 -0
- package/dist/integrations/jira/reconciliation-config.d.ts +3 -0
- package/dist/integrations/jira/reconciliation-config.d.ts.map +1 -0
- package/dist/integrations/jira/reconciliation-config.js +17 -0
- package/dist/integrations/jira/reconciliation-config.js.map +1 -0
- package/dist/integrations/jira/routes.d.ts +54 -0
- package/dist/integrations/jira/routes.d.ts.map +1 -0
- package/dist/integrations/jira/routes.js +260 -0
- package/dist/integrations/jira/routes.js.map +1 -0
- package/dist/integrations/jira/rules.d.ts +57 -0
- package/dist/integrations/jira/rules.d.ts.map +1 -0
- package/dist/integrations/jira/rules.js +189 -0
- package/dist/integrations/jira/rules.js.map +1 -0
- package/dist/integrations/linear/agent-tools.d.ts +34 -0
- package/dist/integrations/linear/agent-tools.d.ts.map +1 -0
- package/dist/integrations/linear/agent-tools.js +87 -0
- package/dist/integrations/linear/agent-tools.js.map +1 -0
- package/dist/integrations/linear/claim.d.ts +8 -0
- package/dist/integrations/linear/claim.d.ts.map +1 -0
- package/dist/integrations/linear/claim.js +14 -0
- package/dist/integrations/linear/claim.js.map +1 -0
- package/dist/integrations/linear/default-rules.d.ts +46 -0
- package/dist/integrations/linear/default-rules.d.ts.map +1 -0
- package/dist/integrations/linear/default-rules.js +70 -0
- package/dist/integrations/linear/default-rules.js.map +1 -0
- package/dist/integrations/linear/integration.d.ts +260 -0
- package/dist/integrations/linear/integration.d.ts.map +1 -0
- package/dist/integrations/linear/integration.js +900 -0
- package/dist/integrations/linear/integration.js.map +1 -0
- package/dist/integrations/linear/issue-reconciler.d.ts +8 -0
- package/dist/integrations/linear/issue-reconciler.d.ts.map +1 -0
- package/dist/integrations/linear/issue-reconciler.js +73 -0
- package/dist/integrations/linear/issue-reconciler.js.map +1 -0
- package/dist/integrations/linear/reconciliation-config.d.ts +3 -0
- package/dist/integrations/linear/reconciliation-config.d.ts.map +1 -0
- package/dist/integrations/linear/reconciliation-config.js +21 -0
- package/dist/integrations/linear/reconciliation-config.js.map +1 -0
- package/dist/integrations/linear/routes.d.ts +81 -0
- package/dist/integrations/linear/routes.d.ts.map +1 -0
- package/dist/integrations/linear/routes.js +380 -0
- package/dist/integrations/linear/routes.js.map +1 -0
- package/dist/integrations/linear/rules.d.ts +54 -0
- package/dist/integrations/linear/rules.d.ts.map +1 -0
- package/dist/integrations/linear/rules.js +189 -0
- package/dist/integrations/linear/rules.js.map +1 -0
- package/dist/integrations/linear/storage.d.ts +65 -0
- package/dist/integrations/linear/storage.d.ts.map +1 -0
- package/dist/integrations/linear/storage.js +1 -0
- package/dist/integrations/platform/api-client.d.ts +26 -0
- package/dist/integrations/platform/api-client.d.ts.map +1 -0
- package/dist/integrations/platform/api-client.js +177 -0
- package/dist/integrations/platform/api-client.js.map +1 -0
- package/dist/integrations/platform/connect/routes.d.ts +39 -0
- package/dist/integrations/platform/connect/routes.d.ts.map +1 -0
- package/dist/integrations/platform/connect/routes.js +133 -0
- package/dist/integrations/platform/connect/routes.js.map +1 -0
- package/dist/integrations/platform/github/event-worker.d.ts +58 -0
- package/dist/integrations/platform/github/event-worker.d.ts.map +1 -0
- package/dist/integrations/platform/github/event-worker.js +449 -0
- package/dist/integrations/platform/github/event-worker.js.map +1 -0
- package/dist/integrations/platform/github/integration.d.ts +89 -0
- package/dist/integrations/platform/github/integration.d.ts.map +1 -0
- package/dist/integrations/platform/github/integration.js +1266 -0
- package/dist/integrations/platform/github/integration.js.map +1 -0
- package/dist/integrations/platform/gitlab/event-worker.d.ts +64 -0
- package/dist/integrations/platform/gitlab/event-worker.d.ts.map +1 -0
- package/dist/integrations/platform/gitlab/event-worker.js +305 -0
- package/dist/integrations/platform/gitlab/event-worker.js.map +1 -0
- package/dist/integrations/platform/gitlab/integration.d.ts +57 -0
- package/dist/integrations/platform/gitlab/integration.d.ts.map +1 -0
- package/dist/integrations/platform/gitlab/integration.js +113 -0
- package/dist/integrations/platform/gitlab/integration.js.map +1 -0
- package/dist/integrations/platform/incidentio/integration.d.ts +74 -0
- package/dist/integrations/platform/incidentio/integration.d.ts.map +1 -0
- package/dist/integrations/platform/incidentio/integration.js +406 -0
- package/dist/integrations/platform/incidentio/integration.js.map +1 -0
- package/dist/integrations/platform/jira/agent-tools.d.ts +36 -0
- package/dist/integrations/platform/jira/agent-tools.d.ts.map +1 -0
- package/dist/integrations/platform/jira/agent-tools.js +85 -0
- package/dist/integrations/platform/jira/agent-tools.js.map +1 -0
- package/dist/integrations/platform/jira/integration.d.ts +65 -0
- package/dist/integrations/platform/jira/integration.d.ts.map +1 -0
- package/dist/integrations/platform/jira/integration.js +546 -0
- package/dist/integrations/platform/jira/integration.js.map +1 -0
- package/dist/integrations/platform/jira/routes.d.ts +55 -0
- package/dist/integrations/platform/jira/routes.d.ts.map +1 -0
- package/dist/integrations/platform/jira/routes.js +274 -0
- package/dist/integrations/platform/jira/routes.js.map +1 -0
- package/dist/integrations/platform/linear/event-worker.d.ts +105 -0
- package/dist/integrations/platform/linear/event-worker.d.ts.map +1 -0
- package/dist/integrations/platform/linear/event-worker.js +379 -0
- package/dist/integrations/platform/linear/event-worker.js.map +1 -0
- package/dist/integrations/platform/linear/integration.d.ts +92 -0
- package/dist/integrations/platform/linear/integration.d.ts.map +1 -0
- package/dist/integrations/platform/linear/integration.js +754 -0
- package/dist/integrations/platform/linear/integration.js.map +1 -0
- package/dist/integrations/pull-request-head.d.ts +18 -0
- package/dist/integrations/pull-request-head.d.ts.map +1 -0
- package/dist/integrations/pull-request-head.js +45 -0
- package/dist/integrations/pull-request-head.js.map +1 -0
- package/dist/integrations/reconciliation-config.d.ts +3 -0
- package/dist/integrations/reconciliation-config.d.ts.map +1 -0
- package/dist/integrations/reconciliation-config.js +16 -0
- package/dist/integrations/reconciliation-config.js.map +1 -0
- package/dist/integrations/slack/connect-route.d.ts +46 -0
- package/dist/integrations/slack/connect-route.d.ts.map +1 -0
- package/dist/integrations/slack/connect-route.js +186 -0
- package/dist/integrations/slack/connect-route.js.map +1 -0
- package/dist/integrations/slack/emoji-shortcodes.generated.d.ts +8 -0
- package/dist/integrations/slack/emoji-shortcodes.generated.d.ts.map +1 -0
- package/dist/integrations/slack/emoji-shortcodes.generated.js +1985 -0
- package/dist/integrations/slack/emoji-shortcodes.generated.js.map +1 -0
- package/dist/integrations/slack/emoji.d.ts +3 -0
- package/dist/integrations/slack/emoji.d.ts.map +1 -0
- package/dist/integrations/slack/emoji.js +12 -0
- package/dist/integrations/slack/emoji.js.map +1 -0
- package/dist/integrations/slack/feed-publisher.d.ts +26 -0
- package/dist/integrations/slack/feed-publisher.d.ts.map +1 -0
- package/dist/integrations/slack/feed-publisher.js +44 -0
- package/dist/integrations/slack/feed-publisher.js.map +1 -0
- package/dist/integrations/slack/integration.d.ts +80 -0
- package/dist/integrations/slack/integration.d.ts.map +1 -0
- package/dist/integrations/slack/integration.js +93 -0
- package/dist/integrations/slack/integration.js.map +1 -0
- package/dist/integrations/slack/slack.d.ts +205 -0
- package/dist/integrations/slack/slack.d.ts.map +1 -0
- package/dist/integrations/slack/slack.js +653 -0
- package/dist/integrations/slack/slack.js.map +1 -0
- package/dist/integrations/subscription-session.d.ts +49 -0
- package/dist/integrations/subscription-session.d.ts.map +1 -0
- package/dist/integrations/subscription-session.js +103 -0
- package/dist/integrations/subscription-session.js.map +1 -0
- package/dist/integrations/workos/integration.d.ts +39 -0
- package/dist/integrations/workos/integration.d.ts.map +1 -0
- package/dist/integrations/workos/integration.js +91 -0
- package/dist/integrations/workos/integration.js.map +1 -0
- package/dist/packages/_internals/workspace/dist/index.js +48 -0
- package/dist/packages/_internals/workspace/dist/index.js.map +1 -0
- package/dist/platform-auth-host.d.ts +4 -0
- package/dist/platform-auth-host.d.ts.map +1 -0
- package/dist/platform-auth-host.js +18 -0
- package/dist/platform-auth-host.js.map +1 -0
- package/dist/review-verdict.d.ts +6 -0
- package/dist/review-verdict.d.ts.map +1 -0
- package/dist/review-verdict.js +14 -0
- package/dist/review-verdict.js.map +1 -0
- package/dist/routes/attention-activity.d.ts +23 -0
- package/dist/routes/attention-activity.d.ts.map +1 -0
- package/dist/routes/attention-activity.js +152 -0
- package/dist/routes/attention-activity.js.map +1 -0
- package/dist/routes/attention-parked.d.ts +22 -0
- package/dist/routes/attention-parked.d.ts.map +1 -0
- package/dist/routes/attention-parked.js +136 -0
- package/dist/routes/attention-parked.js.map +1 -0
- package/dist/routes/attention-proposed.d.ts +3 -0
- package/dist/routes/attention-proposed.d.ts.map +1 -0
- package/dist/routes/attention-proposed.js +21 -0
- package/dist/routes/attention-proposed.js.map +1 -0
- package/dist/routes/attention-providers.d.ts +159 -0
- package/dist/routes/attention-providers.d.ts.map +1 -0
- package/dist/routes/attention-providers.js +524 -0
- package/dist/routes/attention-providers.js.map +1 -0
- package/dist/routes/attention.d.ts +23 -0
- package/dist/routes/attention.d.ts.map +1 -0
- package/dist/routes/attention.js +219 -0
- package/dist/routes/attention.js.map +1 -0
- package/dist/routes/automation-runs.d.ts +37 -0
- package/dist/routes/automation-runs.d.ts.map +1 -0
- package/dist/routes/automation-runs.js +196 -0
- package/dist/routes/automation-runs.js.map +1 -0
- package/dist/routes/config.d.ts +238 -0
- package/dist/routes/config.d.ts.map +1 -0
- package/dist/routes/config.js +1011 -0
- package/dist/routes/config.js.map +1 -0
- package/dist/routes/contracts.d.ts +1080 -0
- package/dist/routes/contracts.d.ts.map +1 -0
- package/dist/routes/contracts.js +673 -0
- package/dist/routes/contracts.js.map +1 -0
- package/dist/routes/custom-provider-source.d.ts +52 -0
- package/dist/routes/custom-provider-source.d.ts.map +1 -0
- package/dist/routes/custom-provider-source.js +124 -0
- package/dist/routes/custom-provider-source.js.map +1 -0
- package/dist/routes/fs.d.ts +189 -0
- package/dist/routes/fs.d.ts.map +1 -0
- package/dist/routes/fs.js +916 -0
- package/dist/routes/fs.js.map +1 -0
- package/dist/routes/intake.d.ts +64 -0
- package/dist/routes/intake.d.ts.map +1 -0
- package/dist/routes/intake.js +627 -0
- package/dist/routes/intake.js.map +1 -0
- package/dist/routes/knowledge.d.ts +247 -0
- package/dist/routes/knowledge.d.ts.map +1 -0
- package/dist/routes/knowledge.js +1128 -0
- package/dist/routes/knowledge.js.map +1 -0
- package/dist/routes/oauth.d.ts +43 -0
- package/dist/routes/oauth.d.ts.map +1 -0
- package/dist/routes/oauth.js +477 -0
- package/dist/routes/oauth.js.map +1 -0
- package/dist/routes/projects.d.ts +68 -0
- package/dist/routes/projects.d.ts.map +1 -0
- package/dist/routes/projects.js +919 -0
- package/dist/routes/projects.js.map +1 -0
- package/dist/routes/provider-credentials.d.ts +82 -0
- package/dist/routes/provider-credentials.d.ts.map +1 -0
- package/dist/routes/provider-credentials.js +80 -0
- package/dist/routes/provider-credentials.js.map +1 -0
- package/dist/routes/route.d.ts +48 -0
- package/dist/routes/route.d.ts.map +1 -0
- package/dist/routes/route.js +15 -0
- package/dist/routes/route.js.map +1 -0
- package/dist/routes/skills.d.ts +30 -0
- package/dist/routes/skills.d.ts.map +1 -0
- package/dist/routes/skills.js +198 -0
- package/dist/routes/skills.js.map +1 -0
- package/dist/routes/source-control-sessions.d.ts +22 -0
- package/dist/routes/source-control-sessions.d.ts.map +1 -0
- package/dist/routes/source-control-sessions.js +356 -0
- package/dist/routes/source-control-sessions.js.map +1 -0
- package/dist/routes/source-control-settings.d.ts +10 -0
- package/dist/routes/source-control-settings.d.ts.map +1 -0
- package/dist/routes/source-control-settings.js +87 -0
- package/dist/routes/source-control-settings.js.map +1 -0
- package/dist/routes/supervisor.d.ts +25 -0
- package/dist/routes/supervisor.d.ts.map +1 -0
- package/dist/routes/supervisor.js +35 -0
- package/dist/routes/supervisor.js.map +1 -0
- package/dist/routes/surface.d.ts +133 -0
- package/dist/routes/surface.d.ts.map +1 -0
- package/dist/routes/surface.js +518 -0
- package/dist/routes/surface.js.map +1 -0
- package/dist/routes/telemetry.d.ts +13 -0
- package/dist/routes/telemetry.d.ts.map +1 -0
- package/dist/routes/telemetry.js +60 -0
- package/dist/routes/telemetry.js.map +1 -0
- package/dist/routes/tenant-credentials.d.ts +87 -0
- package/dist/routes/tenant-credentials.d.ts.map +1 -0
- package/dist/routes/tenant-credentials.js +219 -0
- package/dist/routes/tenant-credentials.js.map +1 -0
- package/dist/routes/work-items.d.ts +49 -0
- package/dist/routes/work-items.d.ts.map +1 -0
- package/dist/routes/work-items.js +633 -0
- package/dist/routes/work-items.js.map +1 -0
- package/dist/rules/binding-context.d.ts +59 -0
- package/dist/rules/binding-context.d.ts.map +1 -0
- package/dist/rules/binding-context.js +134 -0
- package/dist/rules/binding-context.js.map +1 -0
- package/dist/rules/decision-applicability.d.ts +32 -0
- package/dist/rules/decision-applicability.d.ts.map +1 -0
- package/dist/rules/decision-applicability.js +56 -0
- package/dist/rules/decision-applicability.js.map +1 -0
- package/dist/rules/dispatch-errors.d.ts +13 -0
- package/dist/rules/dispatch-errors.d.ts.map +1 -0
- package/dist/rules/dispatch-errors.js +105 -0
- package/dist/rules/dispatch-errors.js.map +1 -0
- package/dist/rules/dispatcher.d.ts +86 -0
- package/dist/rules/dispatcher.d.ts.map +1 -0
- package/dist/rules/dispatcher.js +1159 -0
- package/dist/rules/dispatcher.js.map +1 -0
- package/dist/rules/event-rules.d.ts +23 -0
- package/dist/rules/event-rules.d.ts.map +1 -0
- package/dist/rules/event-rules.js +46 -0
- package/dist/rules/event-rules.js.map +1 -0
- package/dist/rules/index.d.ts +6 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +4 -0
- package/dist/rules/processor.d.ts +90 -0
- package/dist/rules/processor.d.ts.map +1 -0
- package/dist/rules/processor.js +486 -0
- package/dist/rules/processor.js.map +1 -0
- package/dist/rules/resolve.d.ts +15 -0
- package/dist/rules/resolve.d.ts.map +1 -0
- package/dist/rules/resolve.js +23 -0
- package/dist/rules/resolve.js.map +1 -0
- package/dist/rules/review-source-tool.d.ts +105 -0
- package/dist/rules/review-source-tool.d.ts.map +1 -0
- package/dist/rules/review-source-tool.js +109 -0
- package/dist/rules/review-source-tool.js.map +1 -0
- package/dist/rules/start-coordinator.d.ts +64 -0
- package/dist/rules/start-coordinator.d.ts.map +1 -0
- package/dist/rules/start-coordinator.js +246 -0
- package/dist/rules/start-coordinator.js.map +1 -0
- package/dist/rules/terminal-cleanup.d.ts +38 -0
- package/dist/rules/terminal-cleanup.d.ts.map +1 -0
- package/dist/rules/terminal-cleanup.js +68 -0
- package/dist/rules/terminal-cleanup.js.map +1 -0
- package/dist/rules/tools.d.ts +15 -0
- package/dist/rules/tools.d.ts.map +1 -0
- package/dist/rules/tools.js +185 -0
- package/dist/rules/tools.js.map +1 -0
- package/dist/rules/transition-service.d.ts +93 -0
- package/dist/rules/transition-service.d.ts.map +1 -0
- package/dist/rules/transition-service.js +402 -0
- package/dist/rules/transition-service.js.map +1 -0
- package/dist/rules/types.d.ts +553 -0
- package/dist/rules/types.d.ts.map +1 -0
- package/dist/rules/types.js +154 -0
- package/dist/rules/types.js.map +1 -0
- package/dist/rules/validation.d.ts +21 -0
- package/dist/rules/validation.d.ts.map +1 -0
- package/dist/rules/validation.js +327 -0
- package/dist/rules/validation.js.map +1 -0
- package/dist/sandbox/callback-factory-sandbox.d.ts +15 -0
- package/dist/sandbox/callback-factory-sandbox.d.ts.map +1 -0
- package/dist/sandbox/callback-factory-sandbox.js +22 -0
- package/dist/sandbox/callback-factory-sandbox.js.map +1 -0
- package/dist/sandbox/git-ref.d.ts +7 -0
- package/dist/sandbox/git-ref.d.ts.map +1 -0
- package/dist/sandbox/git-ref.js +15 -0
- package/dist/sandbox/git-ref.js.map +1 -0
- package/dist/sandbox/local-factory-sandbox.d.ts +20 -0
- package/dist/sandbox/local-factory-sandbox.d.ts.map +1 -0
- package/dist/sandbox/local-factory-sandbox.js +27 -0
- package/dist/sandbox/local-factory-sandbox.js.map +1 -0
- package/dist/sandbox/materialization.d.ts +41 -0
- package/dist/sandbox/materialization.d.ts.map +1 -0
- package/dist/sandbox/materialization.js +18 -0
- package/dist/sandbox/materialization.js.map +1 -0
- package/dist/sandbox/session-retirement.d.ts +45 -0
- package/dist/sandbox/session-retirement.d.ts.map +1 -0
- package/dist/sandbox/session-retirement.js +153 -0
- package/dist/sandbox/session-retirement.js.map +1 -0
- package/dist/sandbox/session-sandbox.d.ts +185 -0
- package/dist/sandbox/session-sandbox.d.ts.map +1 -0
- package/dist/sandbox/session-sandbox.js +248 -0
- package/dist/sandbox/session-sandbox.js.map +1 -0
- package/dist/sandbox/workdir.d.ts +45 -0
- package/dist/sandbox/workdir.d.ts.map +1 -0
- package/dist/sandbox/workdir.js +64 -0
- package/dist/sandbox/workdir.js.map +1 -0
- package/dist/secret-encryption.d.ts +25 -0
- package/dist/secret-encryption.d.ts.map +1 -0
- package/dist/secret-encryption.js +107 -0
- package/dist/secret-encryption.js.map +1 -0
- package/dist/server-error.d.ts +12 -0
- package/dist/server-error.d.ts.map +1 -0
- package/dist/server-error.js +16 -0
- package/dist/server-error.js.map +1 -0
- package/dist/session/credential-policy.d.ts +20 -0
- package/dist/session/credential-policy.d.ts.map +1 -0
- package/dist/session/credential-policy.js +70 -0
- package/dist/session/credential-policy.js.map +1 -0
- package/dist/session/default-model-hydration.d.ts +46 -0
- package/dist/session/default-model-hydration.d.ts.map +1 -0
- package/dist/session/default-model-hydration.js +85 -0
- package/dist/session/default-model-hydration.js.map +1 -0
- package/dist/session/environment-repositories.d.ts +31 -0
- package/dist/session/environment-repositories.d.ts.map +1 -0
- package/dist/session/environment-repositories.js +89 -0
- package/dist/session/environment-repositories.js.map +1 -0
- package/dist/session/environment-state-processor.d.ts +59 -0
- package/dist/session/environment-state-processor.d.ts.map +1 -0
- package/dist/session/environment-state-processor.js +105 -0
- package/dist/session/environment-state-processor.js.map +1 -0
- package/dist/session/factory-session.d.ts +159 -0
- package/dist/session/factory-session.d.ts.map +1 -0
- package/dist/session/factory-session.js +226 -0
- package/dist/session/factory-session.js.map +1 -0
- package/dist/session/filesystem-capture.d.ts +50 -0
- package/dist/session/filesystem-capture.d.ts.map +1 -0
- package/dist/session/filesystem-capture.js +231 -0
- package/dist/session/filesystem-capture.js.map +1 -0
- package/dist/session/first-exec-capture.d.ts +38 -0
- package/dist/session/first-exec-capture.d.ts.map +1 -0
- package/dist/session/first-exec-capture.js +91 -0
- package/dist/session/first-exec-capture.js.map +1 -0
- package/dist/session/first-message-capture.d.ts +33 -0
- package/dist/session/first-message-capture.d.ts.map +1 -0
- package/dist/session/first-message-capture.js +35 -0
- package/dist/session/first-message-capture.js.map +1 -0
- package/dist/session/live-sessions.d.ts +63 -0
- package/dist/session/live-sessions.d.ts.map +1 -0
- package/dist/session/live-sessions.js +90 -0
- package/dist/session/live-sessions.js.map +1 -0
- package/dist/session/memory-settings-hydration.d.ts +36 -0
- package/dist/session/memory-settings-hydration.d.ts.map +1 -0
- package/dist/session/memory-settings-hydration.js +43 -0
- package/dist/session/memory-settings-hydration.js.map +1 -0
- package/dist/session/org-seed.d.ts +67 -0
- package/dist/session/org-seed.d.ts.map +1 -0
- package/dist/session/org-seed.js +53 -0
- package/dist/session/org-seed.js.map +1 -0
- package/dist/session/run-audit.d.ts +54 -0
- package/dist/session/run-audit.d.ts.map +1 -0
- package/dist/session/run-audit.js +124 -0
- package/dist/session/run-audit.js.map +1 -0
- package/dist/session/session-title.d.ts +7 -0
- package/dist/session/session-title.d.ts.map +1 -0
- package/dist/session/session-title.js +14 -0
- package/dist/session/session-title.js.map +1 -0
- package/dist/session/shell-commands.d.ts +5 -0
- package/dist/session/shell-commands.d.ts.map +1 -0
- package/dist/session/shell-commands.js +25 -0
- package/dist/session/shell-commands.js.map +1 -0
- package/dist/session/source-control-tools.d.ts +25 -0
- package/dist/session/source-control-tools.d.ts.map +1 -0
- package/dist/session/source-control-tools.js +594 -0
- package/dist/session/source-control-tools.js.map +1 -0
- package/dist/session/thread-title-mirror.d.ts +35 -0
- package/dist/session/thread-title-mirror.d.ts.map +1 -0
- package/dist/session/thread-title-mirror.js +51 -0
- package/dist/session/thread-title-mirror.js.map +1 -0
- package/dist/session/work-item-repository.d.ts +21 -0
- package/dist/session/work-item-repository.d.ts.map +1 -0
- package/dist/session/work-item-repository.js +113 -0
- package/dist/session/work-item-repository.js.map +1 -0
- package/dist/skills/catalog.d.ts +14 -0
- package/dist/skills/catalog.d.ts.map +1 -0
- package/dist/skills/catalog.js +62 -0
- package/dist/skills/catalog.js.map +1 -0
- package/dist/skills/service.d.ts +70 -0
- package/dist/skills/service.d.ts.map +1 -0
- package/dist/skills/service.js +88 -0
- package/dist/skills/service.js.map +1 -0
- package/dist/spa-static.d.ts +33 -0
- package/dist/spa-static.d.ts.map +1 -0
- package/dist/spa-static.js +104 -0
- package/dist/spa-static.js.map +1 -0
- package/dist/state-signing.d.ts +59 -0
- package/dist/state-signing.d.ts.map +1 -0
- package/dist/state-signing.js +83 -0
- package/dist/state-signing.js.map +1 -0
- package/dist/storage/domains/audit/actions.d.ts +24 -0
- package/dist/storage/domains/audit/actions.d.ts.map +1 -0
- package/dist/storage/domains/audit/actions.js +69 -0
- package/dist/storage/domains/audit/actions.js.map +1 -0
- package/dist/storage/domains/audit/actors.d.ts +5 -0
- package/dist/storage/domains/audit/actors.d.ts.map +1 -0
- package/dist/storage/domains/audit/actors.js +25 -0
- package/dist/storage/domains/audit/actors.js.map +1 -0
- package/dist/storage/domains/audit/agent-audit.d.ts +30 -0
- package/dist/storage/domains/audit/agent-audit.d.ts.map +1 -0
- package/dist/storage/domains/audit/agent-audit.js +93 -0
- package/dist/storage/domains/audit/agent-audit.js.map +1 -0
- package/dist/storage/domains/audit/base.d.ts +133 -0
- package/dist/storage/domains/audit/base.d.ts.map +1 -0
- package/dist/storage/domains/audit/base.js +206 -0
- package/dist/storage/domains/audit/base.js.map +1 -0
- package/dist/storage/domains/audit/domain.d.ts +79 -0
- package/dist/storage/domains/audit/domain.d.ts.map +1 -0
- package/dist/storage/domains/audit/domain.js +248 -0
- package/dist/storage/domains/audit/domain.js.map +1 -0
- package/dist/storage/domains/audit/wire.d.ts +24 -0
- package/dist/storage/domains/audit/wire.d.ts.map +1 -0
- package/dist/storage/domains/audit/wire.js +16 -0
- package/dist/storage/domains/audit/wire.js.map +1 -0
- package/dist/storage/domains/channel-identity/base.d.ts +100 -0
- package/dist/storage/domains/channel-identity/base.d.ts.map +1 -0
- package/dist/storage/domains/channel-identity/base.js +164 -0
- package/dist/storage/domains/channel-identity/base.js.map +1 -0
- package/dist/storage/domains/comments/activity.d.ts +40 -0
- package/dist/storage/domains/comments/activity.d.ts.map +1 -0
- package/dist/storage/domains/comments/activity.js +94 -0
- package/dist/storage/domains/comments/activity.js.map +1 -0
- package/dist/storage/domains/comments/actor.d.ts +51 -0
- package/dist/storage/domains/comments/actor.d.ts.map +1 -0
- package/dist/storage/domains/comments/actor.js +38 -0
- package/dist/storage/domains/comments/actor.js.map +1 -0
- package/dist/storage/domains/comments/base.d.ts +245 -0
- package/dist/storage/domains/comments/base.d.ts.map +1 -0
- package/dist/storage/domains/comments/base.js +533 -0
- package/dist/storage/domains/comments/base.js.map +1 -0
- package/dist/storage/domains/comments/domain.d.ts +135 -0
- package/dist/storage/domains/comments/domain.d.ts.map +1 -0
- package/dist/storage/domains/comments/domain.js +285 -0
- package/dist/storage/domains/comments/domain.js.map +1 -0
- package/dist/storage/domains/comments/feed-context.d.ts +22 -0
- package/dist/storage/domains/comments/feed-context.d.ts.map +1 -0
- package/dist/storage/domains/comments/feed-context.js +89 -0
- package/dist/storage/domains/comments/feed-context.js.map +1 -0
- package/dist/storage/domains/comments/feed-sync.d.ts +21 -0
- package/dist/storage/domains/comments/feed-sync.d.ts.map +1 -0
- package/dist/storage/domains/comments/feed-sync.js +1 -0
- package/dist/storage/domains/comments/parse.d.ts +23 -0
- package/dist/storage/domains/comments/parse.d.ts.map +1 -0
- package/dist/storage/domains/comments/parse.js +90 -0
- package/dist/storage/domains/comments/parse.js.map +1 -0
- package/dist/storage/domains/comments/routes.d.ts +24 -0
- package/dist/storage/domains/comments/routes.d.ts.map +1 -0
- package/dist/storage/domains/comments/routes.js +302 -0
- package/dist/storage/domains/comments/routes.js.map +1 -0
- package/dist/storage/domains/comments/schema.d.ts +5 -0
- package/dist/storage/domains/comments/schema.d.ts.map +1 -0
- package/dist/storage/domains/comments/schema.js +179 -0
- package/dist/storage/domains/comments/schema.js.map +1 -0
- package/dist/storage/domains/comments/wire.d.ts +40 -0
- package/dist/storage/domains/comments/wire.d.ts.map +1 -0
- package/dist/storage/domains/comments/wire.js +37 -0
- package/dist/storage/domains/comments/wire.js.map +1 -0
- package/dist/storage/domains/credentials/base.d.ts +136 -0
- package/dist/storage/domains/credentials/base.d.ts.map +1 -0
- package/dist/storage/domains/credentials/base.js +294 -0
- package/dist/storage/domains/credentials/base.js.map +1 -0
- package/dist/storage/domains/custom-providers/base.d.ts +59 -0
- package/dist/storage/domains/custom-providers/base.d.ts.map +1 -0
- package/dist/storage/domains/custom-providers/base.js +176 -0
- package/dist/storage/domains/custom-providers/base.js.map +1 -0
- package/dist/storage/domains/filesystem/base.d.ts +26 -0
- package/dist/storage/domains/filesystem/base.d.ts.map +1 -0
- package/dist/storage/domains/filesystem/base.js +74 -0
- package/dist/storage/domains/filesystem/base.js.map +1 -0
- package/dist/storage/domains/intake/base.d.ts +150 -0
- package/dist/storage/domains/intake/base.d.ts.map +1 -0
- package/dist/storage/domains/intake/base.js +431 -0
- package/dist/storage/domains/intake/base.js.map +1 -0
- package/dist/storage/domains/integrations/base.d.ts +128 -0
- package/dist/storage/domains/integrations/base.d.ts.map +1 -0
- package/dist/storage/domains/integrations/base.js +333 -0
- package/dist/storage/domains/integrations/base.js.map +1 -0
- package/dist/storage/domains/memory-settings/base.d.ts +58 -0
- package/dist/storage/domains/memory-settings/base.d.ts.map +1 -0
- package/dist/storage/domains/memory-settings/base.js +129 -0
- package/dist/storage/domains/memory-settings/base.js.map +1 -0
- package/dist/storage/domains/model-defaults/base.d.ts +29 -0
- package/dist/storage/domains/model-defaults/base.d.ts.map +1 -0
- package/dist/storage/domains/model-defaults/base.js +79 -0
- package/dist/storage/domains/model-defaults/base.js.map +1 -0
- package/dist/storage/domains/projects/base.d.ts +191 -0
- package/dist/storage/domains/projects/base.d.ts.map +1 -0
- package/dist/storage/domains/projects/base.js +352 -0
- package/dist/storage/domains/projects/base.js.map +1 -0
- package/dist/storage/domains/queue-health/base.d.ts +52 -0
- package/dist/storage/domains/queue-health/base.d.ts.map +1 -0
- package/dist/storage/domains/queue-health/base.js +122 -0
- package/dist/storage/domains/queue-health/base.js.map +1 -0
- package/dist/storage/domains/source-control/base.d.ts +422 -0
- package/dist/storage/domains/source-control/base.d.ts.map +1 -0
- package/dist/storage/domains/source-control/base.js +1114 -0
- package/dist/storage/domains/source-control/base.js.map +1 -0
- package/dist/storage/domains/source-control/inmemory.d.ts +147 -0
- package/dist/storage/domains/source-control/inmemory.d.ts.map +1 -0
- package/dist/storage/domains/source-control/inmemory.js +416 -0
- package/dist/storage/domains/source-control/inmemory.js.map +1 -0
- package/dist/storage/domains/work-items/base.d.ts +794 -0
- package/dist/storage/domains/work-items/base.d.ts.map +1 -0
- package/dist/storage/domains/work-items/base.js +2747 -0
- package/dist/storage/domains/work-items/base.js.map +1 -0
- package/dist/storage/domains/work-items/board-version.d.ts +26 -0
- package/dist/storage/domains/work-items/board-version.d.ts.map +1 -0
- package/dist/storage/domains/work-items/board-version.js +110 -0
- package/dist/storage/domains/work-items/board-version.js.map +1 -0
- package/dist/storage/domains/work-items/metrics.d.ts +97 -0
- package/dist/storage/domains/work-items/metrics.d.ts.map +1 -0
- package/dist/storage/domains/work-items/metrics.js +226 -0
- package/dist/storage/domains/work-items/metrics.js.map +1 -0
- package/dist/supervisor/health-worker.d.ts +19 -0
- package/dist/supervisor/health-worker.d.ts.map +1 -0
- package/dist/supervisor/health-worker.js +74 -0
- package/dist/supervisor/health-worker.js.map +1 -0
- package/dist/supervisor/health.d.ts +79 -0
- package/dist/supervisor/health.d.ts.map +1 -0
- package/dist/supervisor/health.js +228 -0
- package/dist/supervisor/health.js.map +1 -0
- package/dist/supervisor/instructions.d.ts +6 -0
- package/dist/supervisor/instructions.d.ts.map +1 -0
- package/dist/supervisor/instructions.js +66 -0
- package/dist/supervisor/instructions.js.map +1 -0
- package/dist/supervisor/read-tools.d.ts +43 -0
- package/dist/supervisor/read-tools.d.ts.map +1 -0
- package/dist/supervisor/read-tools.js +343 -0
- package/dist/supervisor/read-tools.js.map +1 -0
- package/dist/supervisor/session-messaging.d.ts +26 -0
- package/dist/supervisor/session-messaging.d.ts.map +1 -0
- package/dist/supervisor/session-messaging.js +21 -0
- package/dist/supervisor/session-messaging.js.map +1 -0
- package/dist/supervisor/session.d.ts +38 -0
- package/dist/supervisor/session.d.ts.map +1 -0
- package/dist/supervisor/session.js +79 -0
- package/dist/supervisor/session.js.map +1 -0
- package/dist/supervisor/write-tools.d.ts +30 -0
- package/dist/supervisor/write-tools.d.ts.map +1 -0
- package/dist/supervisor/write-tools.js +231 -0
- package/dist/supervisor/write-tools.js.map +1 -0
- package/dist/telemetry-types.d.ts +7 -0
- package/dist/telemetry-types.d.ts.map +1 -0
- package/dist/telemetry-types.js +24 -0
- package/dist/telemetry-types.js.map +1 -0
- package/dist/telemetry.d.ts +9 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +47 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/timing.d.ts +15 -0
- package/dist/timing.d.ts.map +1 -0
- package/dist/timing.js +34 -0
- package/dist/timing.js.map +1 -0
- package/dist/work-item-branch.d.ts +33 -0
- package/dist/work-item-branch.d.ts.map +1 -0
- package/dist/work-item-branch.js +70 -0
- package/dist/work-item-branch.js.map +1 -0
- package/dist/workspace.d.ts +131 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +995 -0
- package/dist/workspace.js.map +1 -0
- package/factory-skills/configure-factory-rules/SKILL.md +122 -0
- package/factory-skills/factory-complete-issue/SKILL.md +24 -0
- package/factory-skills/factory-gitlab-rereview/SKILL.md +22 -0
- package/factory-skills/factory-gitlab-review/SKILL.md +48 -0
- package/factory-skills/factory-plan/SKILL.md +72 -0
- package/factory-skills/factory-rereview/SKILL.md +225 -0
- package/factory-skills/factory-review/SKILL.md +214 -0
- package/factory-skills/factory-review/references/archaeology.md +225 -0
- package/factory-skills/factory-review/references/categories/README.md +34 -0
- package/factory-skills/factory-review/references/categories/behavior-change.md +36 -0
- package/factory-skills/factory-review/references/categories/bug-fix.md +37 -0
- package/factory-skills/factory-review/references/categories/docs.md +32 -0
- package/factory-skills/factory-review/references/categories/experimental-flagged.md +34 -0
- package/factory-skills/factory-review/references/categories/infra-tooling.md +37 -0
- package/factory-skills/factory-review/references/categories/internal-capability.md +35 -0
- package/factory-skills/factory-review/references/categories/large-cross-cutting.md +35 -0
- package/factory-skills/factory-review/references/categories/mechanical.md +36 -0
- package/factory-skills/factory-review/references/categories/performance.md +33 -0
- package/factory-skills/factory-review/references/categories/public-api.md +38 -0
- package/factory-skills/factory-review/references/categories/refactor.md +35 -0
- package/factory-skills/factory-review/references/categories/revert.md +31 -0
- package/factory-skills/factory-review/references/categories/schema-storage.md +39 -0
- package/factory-skills/factory-review/references/categories/security.md +35 -0
- package/factory-skills/factory-review/references/categories/tests-only.md +38 -0
- package/factory-skills/factory-triage/SKILL.md +197 -0
- package/package.json +92 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"board-version.js","names":["#scopes"],"sources":["../../../../src/storage/domains/work-items/board-version.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport type { CollectionSchema, CollectionWhere, FactoryStorageOps } from '@mastra/core/storage';\n\n/**\n * One row per project whose `version` is replaced after every committed write to that project's\n * `work_items`. Readers of the full card list compare it against the version their snapshot was\n * taken at, so an unchanged board costs one indexed row read instead of every card.\n */\nexport const FACTORY_BOARD_VERSIONS_SCHEMA: CollectionSchema = {\n name: 'factory_board_versions',\n columns: {\n id: { type: 'uuid-pk' },\n org_id: { type: 'text' },\n factory_project_id: { type: 'text' },\n version: { type: 'text' },\n updated_at: { type: 'timestamp' },\n },\n uniqueIndexes: [{ name: 'factory_board_versions_scope_unique', columns: ['org_id', 'factory_project_id'] }],\n};\n\n/** A project, or every project in an org when a write's filter only names the org. */\nexport interface BoardScope {\n orgId: string;\n factoryProjectId?: string;\n}\n\nconst scopeKey = (scope: BoardScope) => `${scope.orgId}\\u0000${scope.factoryProjectId ?? ''}`;\n\nfunction scopeOfRow(row: Record<string, unknown> | null): BoardScope | undefined {\n if (!row || typeof row.org_id !== 'string') return undefined;\n return typeof row.factory_project_id === 'string'\n ? { orgId: row.org_id, factoryProjectId: row.factory_project_id }\n : { orgId: row.org_id };\n}\n\nfunction scopeOfWhere(where: CollectionWhere): BoardScope | undefined {\n if (typeof where.org_id !== 'string') return undefined;\n return typeof where.factory_project_id === 'string'\n ? { orgId: where.org_id, factoryProjectId: where.factory_project_id }\n : { orgId: where.org_id };\n}\n\n/**\n * Wrap `ops` so every write to `work_items` reports the board it changed, once the write has\n * resolved. Writes outside any tenant (`dangerouslyClearAll`) report nothing.\n */\nexport function trackBoardWrites(\n ops: FactoryStorageOps,\n changed: (scope: BoardScope) => void | Promise<void>,\n): FactoryStorageOps {\n const report = async (scope: BoardScope | undefined) => {\n if (scope) await changed(scope);\n };\n return new Proxy(ops, {\n get(target, property, receiver) {\n const value = Reflect.get(target, property, receiver);\n if (typeof value !== 'function') return value;\n switch (property) {\n case 'updateAtomic':\n return async (collection: string, where: unknown, updater: (row: unknown) => unknown, ...args: unknown[]) => {\n let patched = false;\n const row = await value.call(\n target,\n collection,\n where,\n async (current: unknown) => {\n const patch = await updater(current);\n patched = patch != null;\n return patch;\n },\n ...args,\n );\n if (collection === 'work_items' && patched) await report(scopeOfRow(row));\n return row;\n };\n case 'insertOne':\n case 'upsertOne':\n return async (collection: string, ...args: unknown[]) => {\n const row = await value.call(target, collection, ...args);\n if (collection === 'work_items') await report(scopeOfRow(row));\n return row;\n };\n case 'updateMany':\n case 'deleteMany':\n return async (collection: string, where: CollectionWhere, ...args: unknown[]) => {\n const count: number = await value.call(target, collection, where, ...args);\n if (collection === 'work_items' && count > 0) await report(scopeOfWhere(where));\n return count;\n };\n default:\n return value.bind(target);\n }\n },\n });\n}\n\n/** Collects the boards a transaction changed so they can be bumped once it has committed. */\nexport class BoardScopes {\n readonly #scopes = new Map<string, BoardScope>();\n\n add = (scope: BoardScope): void => {\n this.#scopes.set(scopeKey(scope), scope);\n };\n\n values(): BoardScope[] {\n return [...this.#scopes.values()];\n }\n}\n\nexport async function bumpBoardVersions(ops: FactoryStorageOps, scopes: readonly BoardScope[]): Promise<void> {\n for (const scope of scopes) {\n const version = randomUUID();\n const updated_at = new Date();\n if (scope.factoryProjectId) {\n await ops.upsertOne(FACTORY_BOARD_VERSIONS_SCHEMA.name, ['org_id', 'factory_project_id'], {\n org_id: scope.orgId,\n factory_project_id: scope.factoryProjectId,\n version,\n updated_at,\n });\n } else {\n // Projects without a row yet have no version, which never matches a snapshot.\n await ops.updateMany(FACTORY_BOARD_VERSIONS_SCHEMA.name, { org_id: scope.orgId }, { version, updated_at });\n }\n }\n}\n\nexport async function readBoardVersion(\n ops: FactoryStorageOps,\n orgId: string,\n factoryProjectId: string,\n): Promise<string | undefined> {\n const row = await ops.findOne<{ version: string }>(FACTORY_BOARD_VERSIONS_SCHEMA.name, {\n org_id: orgId,\n factory_project_id: factoryProjectId,\n });\n return row?.version;\n}\n"],"mappings":";;;;;;;AAQA,MAAa,gCAAkD;CAC7D,MAAM;CACN,SAAS;EACP,IAAI,EAAE,MAAM,UAAU;EACtB,QAAQ,EAAE,MAAM,OAAO;EACvB,oBAAoB,EAAE,MAAM,OAAO;EACnC,SAAS,EAAE,MAAM,OAAO;EACxB,YAAY,EAAE,MAAM,YAAY;CAClC;CACA,eAAe,CAAC;EAAE,MAAM;EAAuC,SAAS,CAAC,UAAU,oBAAoB;CAAE,CAAC;AAC5G;AAQA,MAAM,YAAY,UAAsB,GAAG,MAAM,MAAM,QAAQ,MAAM,oBAAoB;AAEzF,SAAS,WAAW,K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,SAAoB;IAC/E,MAAM,QAAgB,MAAM,MAAM,KAAK,QAAQ,YAAY,OAAO,GAAG,IAAI;IACzE,IAAI,eAAe,gBAAgB,QAAQ,GAAG,MAAM,OAAO,aAAa,KAAK,CAAC;IAC9E,OAAO;GACT;GACF,SACE,OAAO,MAAM,KAAK,MAAM;EAC5B;CACF,EACF,CAAC;AACH;;AAGA,IAAa,cAAb,MAAyB;CACvB,0BAAmB,IAAI,IAAwB;CAE/C,OAAO,UAA4B;EACjC,KAAKA,QAAQ,IAAI,SAAS,KAAK,GAAG,KAAK;CACzC;CAEA,SAAuB;EACrB,OAAO,CAAC,GAAG,KAAKA,QAAQ,OAAO,CAAC;CAClC;AACF;AAEA,eAAsB,kBAAkB,KAAwB,QAA8C;CAC5G,KAAK,MAAM,SAAS,QAAQ;EAC1B,MAAM,UAAU,WAAW;EAC3B,MAAM,6BAAa,IAAI,KAAK;EAC5B,IAAI,MAAM,kBACR,MAAM,IAAI,UAAU,8BAA8B,MAAM,CAAC,UAAU,oBAAoB,GAAG;GACxF,QAAQ,MAAM;GACd,oBAAoB,MAAM;GAC1B;GACA;EACF,CAAC;OAGD,MAAM,IAAI,WAAW,8BAA8B,MAAM,EAAE,QAAQ,MAAM,MAAM,GAAG;GAAE;GAAS;EAAW,CAAC;CAE7G;AACF;AAEA,eAAsB,iBACpB,KACA,OACA,kBAC6B;CAK7B,QAAO,MAJW,IAAI,QAA6B,8BAA8B,MAAM;EACrF,QAAQ;EACR,oBAAoB;CACtB,CAAC,EAAA,EACW;AACd"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Aggregation math for the Factory Overview page.
|
|
3
|
+
*
|
|
4
|
+
* Pure functions over `work_items` rows — throughput, lead time, in-flight
|
|
5
|
+
* count, demand mix and per-stage agent coverage, all read from the
|
|
6
|
+
* server-appended `stageHistory` log. Keeping this DB-free makes the math unit
|
|
7
|
+
* testable and lets the route stay a thin shell.
|
|
8
|
+
*
|
|
9
|
+
* Everything windowed is counted as an event that happened inside the window,
|
|
10
|
+
* never as "the state the board happens to be in now", so re-querying a past
|
|
11
|
+
* window always returns the same numbers.
|
|
12
|
+
*/
|
|
13
|
+
import type { WorkItemRow } from './base.js';
|
|
14
|
+
/** Default window span (days) when the request omits or malforms the range. */
|
|
15
|
+
export declare const DEFAULT_METRICS_WINDOW = 30;
|
|
16
|
+
/** Hard cap on the range span (days) — bounds the gap-filled throughput array. */
|
|
17
|
+
export declare const MAX_METRICS_WINDOW = 366;
|
|
18
|
+
/**
|
|
19
|
+
* Flow metrics over the cards the Factory ran ({@link hasFactoryRun}) — synced
|
|
20
|
+
* upstream issues and PRs nobody started a run on are not the Factory's work
|
|
21
|
+
* and are excluded from every field below.
|
|
22
|
+
*/
|
|
23
|
+
export interface FactoryMetrics {
|
|
24
|
+
/**
|
|
25
|
+
* Days the series covers: the requested window clipped to the board's life.
|
|
26
|
+
* Days before the first card could hold no completion, so counting them would
|
|
27
|
+
* drag the per-day rate toward zero on a young board.
|
|
28
|
+
*/
|
|
29
|
+
daysCovered: number;
|
|
30
|
+
/** Entries into `done` per UTC day, gap-filled across the covered days. */
|
|
31
|
+
throughput: {
|
|
32
|
+
date: string;
|
|
33
|
+
count: number;
|
|
34
|
+
}[];
|
|
35
|
+
/** Card creation → `done` for every completion that landed in the window. */
|
|
36
|
+
leadTime: {
|
|
37
|
+
medianMs: number | null;
|
|
38
|
+
p90Ms: number | null;
|
|
39
|
+
samples: number;
|
|
40
|
+
};
|
|
41
|
+
/** Distinct cards in a pipeline stage — past intake, not yet terminal. */
|
|
42
|
+
wipTotal: number;
|
|
43
|
+
/** Cards created in the window, by source. */
|
|
44
|
+
sourceMix: {
|
|
45
|
+
source: string;
|
|
46
|
+
count: number;
|
|
47
|
+
}[];
|
|
48
|
+
/** Per-stage agent coverage over first visits that ended in the window. */
|
|
49
|
+
agentCoverage: {
|
|
50
|
+
stage: string;
|
|
51
|
+
/**
|
|
52
|
+
* First visits to this stage that ended in the window. Repeat visits are
|
|
53
|
+
* excluded from both sides: they are rework, already reported as such, and
|
|
54
|
+
* counting them in the denominator alone caps a fully agent-run stage below
|
|
55
|
+
* 100%.
|
|
56
|
+
*/
|
|
57
|
+
passes: number;
|
|
58
|
+
/**
|
|
59
|
+
* Of those: passes an agent finished (`exitedBy` is an agent actor). The
|
|
60
|
+
* entry actor is not required — the rules engine is what queues a card into
|
|
61
|
+
* a stage, so demanding both ends would report 0% for stages agents run
|
|
62
|
+
* end to end. Missing `exitedBy` (entries written before exit stamping)
|
|
63
|
+
* does not count.
|
|
64
|
+
*/
|
|
65
|
+
byAgent: number;
|
|
66
|
+
/**
|
|
67
|
+
* Outcomes of the agent-finished passes' items as of the window's end,
|
|
68
|
+
* mutually exclusive, first match wins: `reworked` (a later visit to the
|
|
69
|
+
* same stage — deliberately outranks `done`: a pass that needed a redo is a
|
|
70
|
+
* failed pass even if the item eventually merged), then `done`, then
|
|
71
|
+
* `canceled`, then `inFlight`.
|
|
72
|
+
*/
|
|
73
|
+
outcomes: {
|
|
74
|
+
done: number;
|
|
75
|
+
canceled: number;
|
|
76
|
+
reworked: number;
|
|
77
|
+
inFlight: number;
|
|
78
|
+
};
|
|
79
|
+
}[];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Resolve untrusted `from`/`to` into a bounded half-open UTC window. A date-only
|
|
83
|
+
* `to` covers the whole day; an open/future end resolves to the end of the
|
|
84
|
+
* current UTC day (not `now`) so an event at this instant stays inside the
|
|
85
|
+
* window instead of on its excluded edge.
|
|
86
|
+
*/
|
|
87
|
+
export declare function parseMetricsRange(fromParam: unknown, toParam: unknown, now: Date): {
|
|
88
|
+
windowStart: number;
|
|
89
|
+
windowEnd: number;
|
|
90
|
+
};
|
|
91
|
+
type Window = {
|
|
92
|
+
windowStart: number;
|
|
93
|
+
windowEnd: number;
|
|
94
|
+
};
|
|
95
|
+
export declare function computeFactoryMetrics(boardItems: WorkItemRow[], window: Window): FactoryMetrics;
|
|
96
|
+
export {};
|
|
97
|
+
//# sourceMappingURL=metrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/work-items/metrics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,+EAA+E;AAC/E,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,kFAAkF;AAClF,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAqCtC;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,2EAA2E;IAC3E,UAAU,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC9C,6EAA6E;IAC7E,QAAQ,EAAE;QAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7E,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,CAAC;IACjB,8CAA8C;IAC9C,SAAS,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC/C,2EAA2E;IAC3E,aAAa,EAAE;QACb,KAAK,EAAE,MAAM,CAAC;QACd;;;;;WAKG;QACH,MAAM,EAAE,MAAM,CAAC;QACf;;;;;;WAMG;QACH,OAAO,EAAE,MAAM,CAAC;QAChB;;;;;;WAMG;QACH,QAAQ,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAC;KAClF,EAAE,CAAC;CACL;AAqBD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,OAAO,EAClB,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,IAAI,GACR;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAY5C;AA2CD,KAAK,MAAM,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AA8FzD,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,WAAW,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc,CAoB/F"}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { isAgentActor } from "./base.js";
|
|
2
|
+
//#region src/storage/domains/work-items/metrics.ts
|
|
3
|
+
/**
|
|
4
|
+
* Aggregation math for the Factory Overview page.
|
|
5
|
+
*
|
|
6
|
+
* Pure functions over `work_items` rows — throughput, lead time, in-flight
|
|
7
|
+
* count, demand mix and per-stage agent coverage, all read from the
|
|
8
|
+
* server-appended `stageHistory` log. Keeping this DB-free makes the math unit
|
|
9
|
+
* testable and lets the route stay a thin shell.
|
|
10
|
+
*
|
|
11
|
+
* Everything windowed is counted as an event that happened inside the window,
|
|
12
|
+
* never as "the state the board happens to be in now", so re-querying a past
|
|
13
|
+
* window always returns the same numbers.
|
|
14
|
+
*/
|
|
15
|
+
/** Default window span (days) when the request omits or malforms the range. */
|
|
16
|
+
const DEFAULT_METRICS_WINDOW = 30;
|
|
17
|
+
/** Hard cap on the range span (days) — bounds the gap-filled throughput array. */
|
|
18
|
+
const MAX_METRICS_WINDOW = 366;
|
|
19
|
+
const DAY_MS = 864e5;
|
|
20
|
+
/** Terminal stage — items here count as completed, not in-flight. */
|
|
21
|
+
const DONE_STAGE = "done";
|
|
22
|
+
/** Terminal stage for tracked non-completions — never a completion. */
|
|
23
|
+
const CANCELED_STAGE = "canceled";
|
|
24
|
+
/**
|
|
25
|
+
* Terminal stages — items holding only these are not in-flight. `done` is a
|
|
26
|
+
* completion (feeds throughput/lead time); `canceled` is a tracked
|
|
27
|
+
* non-completion outcome and feeds neither.
|
|
28
|
+
*/
|
|
29
|
+
const TERMINAL_STAGES = /* @__PURE__ */ new Set([DONE_STAGE, CANCELED_STAGE]);
|
|
30
|
+
const INTAKE_STAGE = "intake";
|
|
31
|
+
/**
|
|
32
|
+
* Pipeline work excludes the inbox as well as the terminal stages: an intake
|
|
33
|
+
* card is queued, not in flight, and its pass through is the poller filing it.
|
|
34
|
+
*/
|
|
35
|
+
function isPipelineStage(stage) {
|
|
36
|
+
return !TERMINAL_STAGES.has(stage) && stage !== INTAKE_STAGE;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Cards the Factory ran: starting a run records its session on the row. The
|
|
40
|
+
* integrations sync every issue and PR of a connected repo into the board and
|
|
41
|
+
* those outnumber the Factory's own work by an order of magnitude, so counting
|
|
42
|
+
* them reports the upstream repo's flow as the Factory's.
|
|
43
|
+
*/
|
|
44
|
+
function hasFactoryRun(item) {
|
|
45
|
+
return Object.keys(item.sessions).length > 0;
|
|
46
|
+
}
|
|
47
|
+
const DATE_ONLY_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
48
|
+
/** Datetime carrying an explicit `Z` or `±HH:MM` offset. */
|
|
49
|
+
const ZONED_DATETIME_RE = /(?:[Zz]|[+-]\d{2}:?\d{2})$/;
|
|
50
|
+
function parseRangeParam(value, boundary) {
|
|
51
|
+
if (typeof value !== "string" || value.length === 0) return void 0;
|
|
52
|
+
const dateOnly = DATE_ONLY_RE.test(value);
|
|
53
|
+
if (!dateOnly && !ZONED_DATETIME_RE.test(value)) return void 0;
|
|
54
|
+
const time = Date.parse(value);
|
|
55
|
+
if (Number.isNaN(time)) return void 0;
|
|
56
|
+
return boundary === "to" && dateOnly ? time + DAY_MS : time;
|
|
57
|
+
}
|
|
58
|
+
function utcDayStart(time) {
|
|
59
|
+
return Date.parse(`${utcDay(time)}T00:00:00Z`);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Resolve untrusted `from`/`to` into a bounded half-open UTC window. A date-only
|
|
63
|
+
* `to` covers the whole day; an open/future end resolves to the end of the
|
|
64
|
+
* current UTC day (not `now`) so an event at this instant stays inside the
|
|
65
|
+
* window instead of on its excluded edge.
|
|
66
|
+
*/
|
|
67
|
+
function parseMetricsRange(fromParam, toParam, now) {
|
|
68
|
+
const endOfToday = utcDayStart(now.getTime()) + DAY_MS;
|
|
69
|
+
const requestedEnd = parseRangeParam(toParam, "to") ?? endOfToday;
|
|
70
|
+
const windowEnd = Math.min(requestedEnd, endOfToday);
|
|
71
|
+
const lastIncludedDay = utcDayStart(windowEnd - 1);
|
|
72
|
+
const defaultStart = lastIncludedDay - 29 * DAY_MS;
|
|
73
|
+
const parsedFrom = parseRangeParam(fromParam, "from");
|
|
74
|
+
let windowStart = parsedFrom !== void 0 && parsedFrom < windowEnd ? parsedFrom : defaultStart;
|
|
75
|
+
const earliestStart = lastIncludedDay - 365 * DAY_MS;
|
|
76
|
+
if (windowStart < earliestStart) windowStart = earliestStart;
|
|
77
|
+
return {
|
|
78
|
+
windowStart,
|
|
79
|
+
windowEnd
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/** Stage history is server-appended, so an unparsable stamp is a corrupt row. */
|
|
83
|
+
function parseTime(iso) {
|
|
84
|
+
const time = Date.parse(iso);
|
|
85
|
+
if (Number.isNaN(time)) throw new Error(`Unparsable stage-history timestamp: ${iso}`);
|
|
86
|
+
return time;
|
|
87
|
+
}
|
|
88
|
+
/** Asserted up front so a corrupt row fails every window, not just the ones that read it. */
|
|
89
|
+
function assertParsableHistory(items) {
|
|
90
|
+
for (const item of items) for (const entry of item.stageHistory) {
|
|
91
|
+
parseTime(entry.enteredAt);
|
|
92
|
+
if (entry.exitedAt !== void 0) parseTime(entry.exitedAt);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/** Nearest-rank percentile over an unsorted sample list. */
|
|
96
|
+
function percentile(samples, fraction) {
|
|
97
|
+
if (samples.length === 0) return null;
|
|
98
|
+
const sorted = [...samples].sort((a, b) => a - b);
|
|
99
|
+
return sorted[Math.max(1, Math.ceil(fraction * sorted.length)) - 1];
|
|
100
|
+
}
|
|
101
|
+
/** UTC `YYYY-MM-DD` for a timestamp. */
|
|
102
|
+
function utcDay(time) {
|
|
103
|
+
return new Date(time).toISOString().slice(0, 10);
|
|
104
|
+
}
|
|
105
|
+
/** Stages the item was holding at `time`, replayed from its history. */
|
|
106
|
+
function stagesHeldAt(item, time) {
|
|
107
|
+
const held = /* @__PURE__ */ new Set();
|
|
108
|
+
for (const entry of item.stageHistory) {
|
|
109
|
+
if (parseTime(entry.enteredAt) >= time) continue;
|
|
110
|
+
if (entry.exitedAt !== void 0 && parseTime(entry.exitedAt) <= time) continue;
|
|
111
|
+
held.add(entry.stage);
|
|
112
|
+
}
|
|
113
|
+
return held;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Completions per UTC day, plus one lead-time sample each. A completion is an
|
|
117
|
+
* entry *into* `done`, not the state of the card now: a card reopened today
|
|
118
|
+
* must not erase the day it shipped, and a card that shipped twice shipped
|
|
119
|
+
* twice. Days before the oldest card are left out rather than gap-filled with
|
|
120
|
+
* zeroes that would drag the daily average down.
|
|
121
|
+
*/
|
|
122
|
+
function completions(items, { windowStart, windowEnd }) {
|
|
123
|
+
let earliestItem = Infinity;
|
|
124
|
+
for (const item of items) earliestItem = Math.min(earliestItem, item.createdAt.getTime());
|
|
125
|
+
const boardStart = Number.isFinite(earliestItem) ? utcDayStart(earliestItem) : -Infinity;
|
|
126
|
+
const byDay = /* @__PURE__ */ new Map();
|
|
127
|
+
for (let day = Math.max(utcDayStart(windowStart), boardStart); day < windowEnd; day += DAY_MS) byDay.set(utcDay(day), 0);
|
|
128
|
+
const leadSamples = [];
|
|
129
|
+
for (const item of items) for (const entry of item.stageHistory) {
|
|
130
|
+
if (entry.stage !== DONE_STAGE) continue;
|
|
131
|
+
const doneAt = parseTime(entry.enteredAt);
|
|
132
|
+
if (doneAt < windowStart || doneAt >= windowEnd) continue;
|
|
133
|
+
byDay.set(utcDay(doneAt), (byDay.get(utcDay(doneAt)) ?? 0) + 1);
|
|
134
|
+
leadSamples.push(Math.max(0, doneAt - item.createdAt.getTime()));
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
byDay,
|
|
138
|
+
leadSamples
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
/** Cards holding at least one pipeline stage right now — window-independent. */
|
|
142
|
+
function countInFlight(items) {
|
|
143
|
+
return items.filter((item) => item.stages.some(isPipelineStage)).length;
|
|
144
|
+
}
|
|
145
|
+
/** Where the window's cards came from, most common first. */
|
|
146
|
+
function demandMix(items, { windowStart, windowEnd }) {
|
|
147
|
+
const counts = /* @__PURE__ */ new Map();
|
|
148
|
+
for (const item of items) {
|
|
149
|
+
const created = item.createdAt.getTime();
|
|
150
|
+
if (created < windowStart || created >= windowEnd) continue;
|
|
151
|
+
const source = item.externalSource ? `${item.externalSource.integrationId}:${item.externalSource.type}` : "manual";
|
|
152
|
+
counts.set(source, (counts.get(source) ?? 0) + 1);
|
|
153
|
+
}
|
|
154
|
+
return [...counts.entries()].map(([source, count]) => ({
|
|
155
|
+
source,
|
|
156
|
+
count
|
|
157
|
+
})).sort((a, b) => b.count - a.count);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* How much of each stage's work an agent finished, counting a card's first
|
|
161
|
+
* visit to a stage once. Rows appear in insertion order of each stage's first
|
|
162
|
+
* counted exit; only pipeline stages get rows, since intake and terminal
|
|
163
|
+
* stages have no pass to hand over.
|
|
164
|
+
*/
|
|
165
|
+
function agentCoverage(items, { windowStart, windowEnd }) {
|
|
166
|
+
const byStage = /* @__PURE__ */ new Map();
|
|
167
|
+
for (const item of items) {
|
|
168
|
+
const heldAtWindowEnd = stagesHeldAt(item, windowEnd);
|
|
169
|
+
const visited = /* @__PURE__ */ new Set();
|
|
170
|
+
for (let i = 0; i < item.stageHistory.length; i++) {
|
|
171
|
+
const entry = item.stageHistory[i];
|
|
172
|
+
if (!isPipelineStage(entry.stage) || visited.has(entry.stage)) continue;
|
|
173
|
+
visited.add(entry.stage);
|
|
174
|
+
if (entry.exitedAt === void 0) continue;
|
|
175
|
+
const exited = parseTime(entry.exitedAt);
|
|
176
|
+
if (exited < windowStart || exited >= windowEnd) continue;
|
|
177
|
+
let row = byStage.get(entry.stage);
|
|
178
|
+
if (!row) {
|
|
179
|
+
row = {
|
|
180
|
+
stage: entry.stage,
|
|
181
|
+
passes: 0,
|
|
182
|
+
byAgent: 0,
|
|
183
|
+
outcomes: {
|
|
184
|
+
done: 0,
|
|
185
|
+
canceled: 0,
|
|
186
|
+
reworked: 0,
|
|
187
|
+
inFlight: 0
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
byStage.set(entry.stage, row);
|
|
191
|
+
}
|
|
192
|
+
row.passes += 1;
|
|
193
|
+
if (!isAgentActor(entry.exitedBy)) continue;
|
|
194
|
+
row.byAgent += 1;
|
|
195
|
+
if (item.stageHistory.some((later, j) => j > i && later.stage === entry.stage && parseTime(later.enteredAt) < windowEnd)) row.outcomes.reworked += 1;
|
|
196
|
+
else if (heldAtWindowEnd.has(DONE_STAGE)) row.outcomes.done += 1;
|
|
197
|
+
else if (heldAtWindowEnd.has(CANCELED_STAGE)) row.outcomes.canceled += 1;
|
|
198
|
+
else row.outcomes.inFlight += 1;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return [...byStage.values()];
|
|
202
|
+
}
|
|
203
|
+
function computeFactoryMetrics(boardItems, window) {
|
|
204
|
+
const items = boardItems.filter(hasFactoryRun);
|
|
205
|
+
assertParsableHistory(items);
|
|
206
|
+
const { byDay, leadSamples } = completions(items, window);
|
|
207
|
+
return {
|
|
208
|
+
daysCovered: byDay.size,
|
|
209
|
+
throughput: [...byDay.entries()].map(([date, count]) => ({
|
|
210
|
+
date,
|
|
211
|
+
count
|
|
212
|
+
})).sort((a, b) => a.date.localeCompare(b.date)),
|
|
213
|
+
leadTime: {
|
|
214
|
+
medianMs: percentile(leadSamples, .5),
|
|
215
|
+
p90Ms: percentile(leadSamples, .9),
|
|
216
|
+
samples: leadSamples.length
|
|
217
|
+
},
|
|
218
|
+
wipTotal: countInFlight(items),
|
|
219
|
+
sourceMix: demandMix(items, window),
|
|
220
|
+
agentCoverage: agentCoverage(items, window)
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
//#endregion
|
|
224
|
+
export { DEFAULT_METRICS_WINDOW, MAX_METRICS_WINDOW, computeFactoryMetrics, parseMetricsRange };
|
|
225
|
+
|
|
226
|
+
//# sourceMappingURL=metrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.js","names":[],"sources":["../../../../src/storage/domains/work-items/metrics.ts"],"sourcesContent":["/**\n * Aggregation math for the Factory Overview page.\n *\n * Pure functions over `work_items` rows — throughput, lead time, in-flight\n * count, demand mix and per-stage agent coverage, all read from the\n * server-appended `stageHistory` log. Keeping this DB-free makes the math unit\n * testable and lets the route stay a thin shell.\n *\n * Everything windowed is counted as an event that happened inside the window,\n * never as \"the state the board happens to be in now\", so re-querying a past\n * window always returns the same numbers.\n */\n\nimport { isAgentActor } from './base.js';\nimport type { WorkItemRow } from './base.js';\n\n/** Default window span (days) when the request omits or malforms the range. */\nexport const DEFAULT_METRICS_WINDOW = 30;\n/** Hard cap on the range span (days) — bounds the gap-filled throughput array. */\nexport const MAX_METRICS_WINDOW = 366;\n\nconst DAY_MS = 86_400_000;\n\n/** Terminal stage — items here count as completed, not in-flight. */\nconst DONE_STAGE = 'done';\n\n/** Terminal stage for tracked non-completions — never a completion. */\nconst CANCELED_STAGE = 'canceled';\n\n/**\n * Terminal stages — items holding only these are not in-flight. `done` is a\n * completion (feeds throughput/lead time); `canceled` is a tracked\n * non-completion outcome and feeds neither.\n */\nconst TERMINAL_STAGES = new Set([DONE_STAGE, CANCELED_STAGE]);\n\nconst INTAKE_STAGE = 'intake';\n\n/**\n * Pipeline work excludes the inbox as well as the terminal stages: an intake\n * card is queued, not in flight, and its pass through is the poller filing it.\n */\nfunction isPipelineStage(stage: string): boolean {\n return !TERMINAL_STAGES.has(stage) && stage !== INTAKE_STAGE;\n}\n\n/**\n * Cards the Factory ran: starting a run records its session on the row. The\n * integrations sync every issue and PR of a connected repo into the board and\n * those outnumber the Factory's own work by an order of magnitude, so counting\n * them reports the upstream repo's flow as the Factory's.\n */\nfunction hasFactoryRun(item: WorkItemRow): boolean {\n return Object.keys(item.sessions).length > 0;\n}\n\n/**\n * Flow metrics over the cards the Factory ran ({@link hasFactoryRun}) — synced\n * upstream issues and PRs nobody started a run on are not the Factory's work\n * and are excluded from every field below.\n */\nexport interface FactoryMetrics {\n /**\n * Days the series covers: the requested window clipped to the board's life.\n * Days before the first card could hold no completion, so counting them would\n * drag the per-day rate toward zero on a young board.\n */\n daysCovered: number;\n /** Entries into `done` per UTC day, gap-filled across the covered days. */\n throughput: { date: string; count: number }[];\n /** Card creation → `done` for every completion that landed in the window. */\n leadTime: { medianMs: number | null; p90Ms: number | null; samples: number };\n /** Distinct cards in a pipeline stage — past intake, not yet terminal. */\n wipTotal: number;\n /** Cards created in the window, by source. */\n sourceMix: { source: string; count: number }[];\n /** Per-stage agent coverage over first visits that ended in the window. */\n agentCoverage: {\n stage: string;\n /**\n * First visits to this stage that ended in the window. Repeat visits are\n * excluded from both sides: they are rework, already reported as such, and\n * counting them in the denominator alone caps a fully agent-run stage below\n * 100%.\n */\n passes: number;\n /**\n * Of those: passes an agent finished (`exitedBy` is an agent actor). The\n * entry actor is not required — the rules engine is what queues a card into\n * a stage, so demanding both ends would report 0% for stages agents run\n * end to end. Missing `exitedBy` (entries written before exit stamping)\n * does not count.\n */\n byAgent: number;\n /**\n * Outcomes of the agent-finished passes' items as of the window's end,\n * mutually exclusive, first match wins: `reworked` (a later visit to the\n * same stage — deliberately outranks `done`: a pass that needed a redo is a\n * failed pass even if the item eventually merged), then `done`, then\n * `canceled`, then `inFlight`.\n */\n outcomes: { done: number; canceled: number; reworked: number; inFlight: number };\n }[];\n}\n\nconst DATE_ONLY_RE = /^\\d{4}-\\d{2}-\\d{2}$/;\n/** Datetime carrying an explicit `Z` or `±HH:MM` offset. */\nconst ZONED_DATETIME_RE = /(?:[Zz]|[+-]\\d{2}:?\\d{2})$/;\n\nfunction parseRangeParam(value: unknown, boundary: 'from' | 'to'): number | undefined {\n if (typeof value !== 'string' || value.length === 0) return undefined;\n const dateOnly = DATE_ONLY_RE.test(value);\n // Timezone-less datetimes are parsed as server-local by Date.parse, so the\n // window would shift by deployment region — reject them as invalid.\n if (!dateOnly && !ZONED_DATETIME_RE.test(value)) return undefined;\n const time = Date.parse(value);\n if (Number.isNaN(time)) return undefined;\n return boundary === 'to' && dateOnly ? time + DAY_MS : time;\n}\n\nfunction utcDayStart(time: number): number {\n return Date.parse(`${utcDay(time)}T00:00:00Z`);\n}\n\n/**\n * Resolve untrusted `from`/`to` into a bounded half-open UTC window. A date-only\n * `to` covers the whole day; an open/future end resolves to the end of the\n * current UTC day (not `now`) so an event at this instant stays inside the\n * window instead of on its excluded edge.\n */\nexport function parseMetricsRange(\n fromParam: unknown,\n toParam: unknown,\n now: Date,\n): { windowStart: number; windowEnd: number } {\n const nowMs = now.getTime();\n const endOfToday = utcDayStart(nowMs) + DAY_MS;\n const requestedEnd = parseRangeParam(toParam, 'to') ?? endOfToday;\n const windowEnd = Math.min(requestedEnd, endOfToday);\n const lastIncludedDay = utcDayStart(windowEnd - 1);\n const defaultStart = lastIncludedDay - (DEFAULT_METRICS_WINDOW - 1) * DAY_MS;\n const parsedFrom = parseRangeParam(fromParam, 'from');\n let windowStart = parsedFrom !== undefined && parsedFrom < windowEnd ? parsedFrom : defaultStart;\n const earliestStart = lastIncludedDay - (MAX_METRICS_WINDOW - 1) * DAY_MS;\n if (windowStart < earliestStart) windowStart = earliestStart;\n return { windowStart, windowEnd };\n}\n\n/** Stage history is server-appended, so an unparsable stamp is a corrupt row. */\nfunction parseTime(iso: string): number {\n const time = Date.parse(iso);\n if (Number.isNaN(time)) throw new Error(`Unparsable stage-history timestamp: ${iso}`);\n return time;\n}\n\n/** Asserted up front so a corrupt row fails every window, not just the ones that read it. */\nfunction assertParsableHistory(items: WorkItemRow[]): void {\n for (const item of items) {\n for (const entry of item.stageHistory) {\n parseTime(entry.enteredAt);\n if (entry.exitedAt !== undefined) parseTime(entry.exitedAt);\n }\n }\n}\n\n/** Nearest-rank percentile over an unsorted sample list. */\nfunction percentile(samples: number[], fraction: number): number | null {\n if (samples.length === 0) return null;\n const sorted = [...samples].sort((a, b) => a - b);\n const rank = Math.max(1, Math.ceil(fraction * sorted.length));\n return sorted[rank - 1]!;\n}\n\n/** UTC `YYYY-MM-DD` for a timestamp. */\nfunction utcDay(time: number): string {\n return new Date(time).toISOString().slice(0, 10);\n}\n\n/** Stages the item was holding at `time`, replayed from its history. */\nfunction stagesHeldAt(item: WorkItemRow, time: number): Set<string> {\n const held = new Set<string>();\n for (const entry of item.stageHistory) {\n if (parseTime(entry.enteredAt) >= time) continue;\n if (entry.exitedAt !== undefined && parseTime(entry.exitedAt) <= time) continue;\n held.add(entry.stage);\n }\n return held;\n}\n\ntype Window = { windowStart: number; windowEnd: number };\n\n/**\n * Completions per UTC day, plus one lead-time sample each. A completion is an\n * entry *into* `done`, not the state of the card now: a card reopened today\n * must not erase the day it shipped, and a card that shipped twice shipped\n * twice. Days before the oldest card are left out rather than gap-filled with\n * zeroes that would drag the daily average down.\n */\nfunction completions(items: WorkItemRow[], { windowStart, windowEnd }: Window) {\n let earliestItem = Infinity;\n for (const item of items) earliestItem = Math.min(earliestItem, item.createdAt.getTime());\n const boardStart = Number.isFinite(earliestItem) ? utcDayStart(earliestItem) : -Infinity;\n\n const byDay = new Map<string, number>();\n for (let day = Math.max(utcDayStart(windowStart), boardStart); day < windowEnd; day += DAY_MS) {\n byDay.set(utcDay(day), 0);\n }\n\n const leadSamples: number[] = [];\n for (const item of items) {\n for (const entry of item.stageHistory) {\n if (entry.stage !== DONE_STAGE) continue;\n const doneAt = parseTime(entry.enteredAt);\n if (doneAt < windowStart || doneAt >= windowEnd) continue;\n byDay.set(utcDay(doneAt), (byDay.get(utcDay(doneAt)) ?? 0) + 1);\n leadSamples.push(Math.max(0, doneAt - item.createdAt.getTime()));\n }\n }\n return { byDay, leadSamples };\n}\n\n/** Cards holding at least one pipeline stage right now — window-independent. */\nfunction countInFlight(items: WorkItemRow[]): number {\n return items.filter(item => item.stages.some(isPipelineStage)).length;\n}\n\n/** Where the window's cards came from, most common first. */\nfunction demandMix(items: WorkItemRow[], { windowStart, windowEnd }: Window): FactoryMetrics['sourceMix'] {\n const counts = new Map<string, number>();\n for (const item of items) {\n const created = item.createdAt.getTime();\n if (created < windowStart || created >= windowEnd) continue;\n const source = item.externalSource ? `${item.externalSource.integrationId}:${item.externalSource.type}` : 'manual';\n counts.set(source, (counts.get(source) ?? 0) + 1);\n }\n return [...counts.entries()].map(([source, count]) => ({ source, count })).sort((a, b) => b.count - a.count);\n}\n\n/**\n * How much of each stage's work an agent finished, counting a card's first\n * visit to a stage once. Rows appear in insertion order of each stage's first\n * counted exit; only pipeline stages get rows, since intake and terminal\n * stages have no pass to hand over.\n */\nfunction agentCoverage(items: WorkItemRow[], { windowStart, windowEnd }: Window): FactoryMetrics['agentCoverage'] {\n const byStage = new Map<string, FactoryMetrics['agentCoverage'][number]>();\n for (const item of items) {\n const heldAtWindowEnd = stagesHeldAt(item, windowEnd);\n const visited = new Set<string>();\n for (let i = 0; i < item.stageHistory.length; i++) {\n const entry = item.stageHistory[i]!;\n if (!isPipelineStage(entry.stage) || visited.has(entry.stage)) continue;\n visited.add(entry.stage);\n if (entry.exitedAt === undefined) continue;\n const exited = parseTime(entry.exitedAt);\n if (exited < windowStart || exited >= windowEnd) continue;\n\n let row = byStage.get(entry.stage);\n if (!row) {\n row = {\n stage: entry.stage,\n passes: 0,\n byAgent: 0,\n outcomes: { done: 0, canceled: 0, reworked: 0, inFlight: 0 },\n };\n byStage.set(entry.stage, row);\n }\n row.passes += 1;\n if (!isAgentActor(entry.exitedBy)) continue;\n row.byAgent += 1;\n\n const reworked = item.stageHistory.some(\n (later, j) => j > i && later.stage === entry.stage && parseTime(later.enteredAt) < windowEnd,\n );\n if (reworked) row.outcomes.reworked += 1;\n else if (heldAtWindowEnd.has(DONE_STAGE)) row.outcomes.done += 1;\n else if (heldAtWindowEnd.has(CANCELED_STAGE)) row.outcomes.canceled += 1;\n else row.outcomes.inFlight += 1;\n }\n }\n return [...byStage.values()];\n}\n\nexport function computeFactoryMetrics(boardItems: WorkItemRow[], window: Window): FactoryMetrics {\n const items = boardItems.filter(hasFactoryRun);\n assertParsableHistory(items);\n\n const { byDay, leadSamples } = completions(items, window);\n\n return {\n daysCovered: byDay.size,\n throughput: [...byDay.entries()]\n .map(([date, count]) => ({ date, count }))\n .sort((a, b) => a.date.localeCompare(b.date)),\n leadTime: {\n medianMs: percentile(leadSamples, 0.5),\n p90Ms: percentile(leadSamples, 0.9),\n samples: leadSamples.length,\n },\n wipTotal: countInFlight(items),\n sourceMix: demandMix(items, window),\n agentCoverage: agentCoverage(items, window),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiBA,MAAa,yBAAyB;;AAEtC,MAAa,qBAAqB;AAElC,MAAM,SAAS;;AAGf,MAAM,aAAa;;AAGnB,MAAM,iBAAiB;;;;;;AAOvB,MAAM,kCAAkB,IAAI,IAAI,CAAC,YAAY,cAAc,CAAC;AAE5D,MAAM,eAAe;;;;;AAMrB,SAAS,gBAAgB,OAAwB;CAC/C,OAAO,CAAC,gBAAgB,IAAI,KAAK,KAAK,UAAU;AAClD;;;;;;;AAQA,SAAS,cAAc,MAA4B;CACjD,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,SAAS;AAC7C;AAmDA,MAAM,eAAe;;AAErB,MAAM,oBAAoB;AAE1B,SAAS,gBAAgB,OAA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Registry } from '../boards/index.js';
|
|
3
|
+
import type { FactoryProjectsStorage } from '../storage/domains/projects/base.js';
|
|
4
|
+
import type { WorkItemsStorage } from '../storage/domains/work-items/base.js';
|
|
5
|
+
export declare const DEFAULT_SUPERVISOR_HEALTH_INTERVAL_MS: number;
|
|
6
|
+
export declare class FactorySupervisorHealthWorker extends MastraWorker {
|
|
7
|
+
#private;
|
|
8
|
+
readonly name = "factory-supervisor-health";
|
|
9
|
+
constructor(input: {
|
|
10
|
+
projects: FactoryProjectsStorage;
|
|
11
|
+
workItems: WorkItemsStorage;
|
|
12
|
+
boards: BoardRegistry;
|
|
13
|
+
intervalMs?: number;
|
|
14
|
+
});
|
|
15
|
+
start(): Promise<void>;
|
|
16
|
+
stop(): Promise<void>;
|
|
17
|
+
get isRunning(): boolean;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=health-worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-worker.d.ts","sourceRoot":"","sources":["../../src/supervisor/health-worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAG9E,eAAO,MAAM,qCAAqC,QAAa,CAAC;AAEhE,qBAAa,6BAA8B,SAAQ,YAAY;;IAC7D,QAAQ,CAAC,IAAI,+BAA+B;gBAUhC,KAAK,EAAE;QACjB,QAAQ,EAAE,sBAAsB,CAAC;QACjC,SAAS,EAAE,gBAAgB,CAAC;QAC5B,MAAM,EAAE,aAAa,CAAC;QACtB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB;IAQK,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAOtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAO3B,IAAI,SAAS,IAAI,OAAO,CAEvB;CA4CF"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { runFactoryHealthCheck } from "./health.js";
|
|
2
|
+
import { MastraWorker } from "@mastra/core/worker";
|
|
3
|
+
//#region src/supervisor/health-worker.ts
|
|
4
|
+
const DEFAULT_SUPERVISOR_HEALTH_INTERVAL_MS = 5 * 6e4;
|
|
5
|
+
var FactorySupervisorHealthWorker = class extends MastraWorker {
|
|
6
|
+
name = "factory-supervisor-health";
|
|
7
|
+
#projects;
|
|
8
|
+
#workItems;
|
|
9
|
+
#boards;
|
|
10
|
+
#intervalMs;
|
|
11
|
+
#running = false;
|
|
12
|
+
#timer;
|
|
13
|
+
#inFlight;
|
|
14
|
+
constructor(input) {
|
|
15
|
+
super();
|
|
16
|
+
this.#projects = input.projects;
|
|
17
|
+
this.#workItems = input.workItems;
|
|
18
|
+
this.#boards = input.boards;
|
|
19
|
+
this.#intervalMs = input.intervalMs ?? 3e5;
|
|
20
|
+
}
|
|
21
|
+
async start() {
|
|
22
|
+
if (this.#running) return;
|
|
23
|
+
if (!this.deps) throw new Error("FactorySupervisorHealthWorker: call init() before start()");
|
|
24
|
+
this.#running = true;
|
|
25
|
+
this.#schedule(0);
|
|
26
|
+
}
|
|
27
|
+
async stop() {
|
|
28
|
+
this.#running = false;
|
|
29
|
+
if (this.#timer) clearTimeout(this.#timer);
|
|
30
|
+
this.#timer = void 0;
|
|
31
|
+
await this.#inFlight;
|
|
32
|
+
}
|
|
33
|
+
get isRunning() {
|
|
34
|
+
return this.#running;
|
|
35
|
+
}
|
|
36
|
+
#schedule(delayMs) {
|
|
37
|
+
if (!this.#running) return;
|
|
38
|
+
this.#timer = setTimeout(() => {
|
|
39
|
+
this.#timer = void 0;
|
|
40
|
+
this.#inFlight = this.#tick().catch((error) => this.deps?.logger.error("Factory supervisor health sweep failed", { error })).finally(() => {
|
|
41
|
+
this.#inFlight = void 0;
|
|
42
|
+
this.#schedule(this.#intervalMs);
|
|
43
|
+
});
|
|
44
|
+
}, delayMs);
|
|
45
|
+
this.#timer.unref?.();
|
|
46
|
+
}
|
|
47
|
+
async #tick() {
|
|
48
|
+
const now = /* @__PURE__ */ new Date();
|
|
49
|
+
const projects = await this.#projects.listAll();
|
|
50
|
+
const concurrency = 4;
|
|
51
|
+
let nextIndex = 0;
|
|
52
|
+
const failure = (await Promise.allSettled(Array.from({ length: Math.min(concurrency, projects.length) }, async () => {
|
|
53
|
+
while (nextIndex < projects.length) {
|
|
54
|
+
const project = projects[nextIndex++];
|
|
55
|
+
if (!project) return;
|
|
56
|
+
const report = await runFactoryHealthCheck(this.#workItems, this.#boards, {
|
|
57
|
+
orgId: project.orgId,
|
|
58
|
+
factoryProjectId: project.id
|
|
59
|
+
}, { now });
|
|
60
|
+
await this.#workItems.syncSupervisorFindings({
|
|
61
|
+
orgId: project.orgId,
|
|
62
|
+
factoryProjectId: project.id,
|
|
63
|
+
findings: report.findings,
|
|
64
|
+
now
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}))).find((result) => result.status === "rejected");
|
|
68
|
+
if (failure) throw failure.reason;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
//#endregion
|
|
72
|
+
export { DEFAULT_SUPERVISOR_HEALTH_INTERVAL_MS, FactorySupervisorHealthWorker };
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=health-worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-worker.js","names":["#projects","#workItems","#boards","#intervalMs","#running","#schedule","#timer","#inFlight","#tick"],"sources":["../../src/supervisor/health-worker.ts"],"sourcesContent":["import { MastraWorker } from '@mastra/core/worker';\n\nimport type { BoardRegistry } from '../boards/index.js';\nimport type { FactoryProjectsStorage } from '../storage/domains/projects/base.js';\nimport type { WorkItemsStorage } from '../storage/domains/work-items/base.js';\nimport { runFactoryHealthCheck } from './health.js';\n\nexport const DEFAULT_SUPERVISOR_HEALTH_INTERVAL_MS = 5 * 60_000;\n\nexport class FactorySupervisorHealthWorker extends MastraWorker {\n readonly name = 'factory-supervisor-health';\n\n readonly #projects: FactoryProjectsStorage;\n readonly #workItems: WorkItemsStorage;\n readonly #boards: BoardRegistry;\n readonly #intervalMs: number;\n #running = false;\n #timer: ReturnType<typeof setTimeout> | undefined;\n #inFlight: Promise<void> | undefined;\n\n constructor(input: {\n projects: FactoryProjectsStorage;\n workItems: WorkItemsStorage;\n boards: BoardRegistry;\n intervalMs?: number;\n }) {\n super();\n this.#projects = input.projects;\n this.#workItems = input.workItems;\n this.#boards = input.boards;\n this.#intervalMs = input.intervalMs ?? DEFAULT_SUPERVISOR_HEALTH_INTERVAL_MS;\n }\n\n async start(): Promise<void> {\n if (this.#running) return;\n if (!this.deps) throw new Error('FactorySupervisorHealthWorker: call init() before start()');\n this.#running = true;\n this.#schedule(0);\n }\n\n async stop(): Promise<void> {\n this.#running = false;\n if (this.#timer) clearTimeout(this.#timer);\n this.#timer = undefined;\n await this.#inFlight;\n }\n\n get isRunning(): boolean {\n return this.#running;\n }\n\n #schedule(delayMs: number): void {\n if (!this.#running) return;\n this.#timer = setTimeout(() => {\n this.#timer = undefined;\n this.#inFlight = this.#tick()\n .catch(error => this.deps?.logger.error('Factory supervisor health sweep failed', { error }))\n .finally(() => {\n this.#inFlight = undefined;\n this.#schedule(this.#intervalMs);\n });\n }, delayMs);\n this.#timer.unref?.();\n }\n\n async #tick(): Promise<void> {\n const now = new Date();\n const projects = await this.#projects.listAll();\n const concurrency = 4;\n let nextIndex = 0;\n const results = await Promise.allSettled(\n Array.from({ length: Math.min(concurrency, projects.length) }, async () => {\n while (nextIndex < projects.length) {\n const project = projects[nextIndex++];\n if (!project) return;\n const report = await runFactoryHealthCheck(\n this.#workItems,\n this.#boards,\n { orgId: project.orgId, factoryProjectId: project.id },\n { now },\n );\n await this.#workItems.syncSupervisorFindings({\n orgId: project.orgId,\n factoryProjectId: project.id,\n findings: report.findings,\n now,\n });\n }\n }),\n );\n const failure = results.find((result): result is PromiseRejectedResult => result.status === 'rejected');\n if (failure) throw failure.reason;\n }\n}\n"],"mappings":";;;AAOA,MAAa,wCAAwC,IAAI;AAEzD,IAAa,gCAAb,cAAmD,aAAa;CAC9D,OAAgB;CAEhB;CACA;CACA;CACA;CACA,WAAW;CACX;CACA;CAEA,YAAY,OAKT;EACD,MAAM;EACN,KAAKA,YAAY,MAAM;EACvB,KAAKC,aAAa,MAAM;EACxB,KAAKC,UAAU,MAAM;EACrB,KAAKC,cAAc,MAAM,cAAA;CAC3B;CAEA,MAAM,QAAuB;EAC3B,IAAI,KAAKC,UAAU;EACnB,IAAI,CAAC,KAAK,MAAM,MAAM,IAAI,MAAM,2DAA2D;EAC3F,KAAKA,WAAW;EAChB,KAAKC,UAAU,CAAC;CAClB;CAEA,MAAM,OAAsB;EAC1B,KAAKD,WAAW;EAChB,IAAI,KAAKE,QAAQ,aAAa,KAAKA,MAAM;EACzC,KAAKA,SAAS,KAAA;EACd,MAAM,KAAKC;CACb;CAEA,IAAI,YAAqB;EACvB,OAAO,KAAKH;CACd;CAEA,UAAU,SAAuB;EAC/B,IAAI,CAAC,KAAKA,UAAU;EACpB,KAAKE,SAAS,iBAAiB;GAC7B,KAAKA,SAAS,KAAA;GACd,KAAKC,YAAY,KAAKC,MAAM,CAAC,CAC1B,OAAM,UAAS,KAAK,MAAM,OAAO,MAAM,0CAA0C,EAAE,MAAM,CAAC,CAAC,CAAC,CAC5F,cAAc;IACb,KAAKD,YAAY,KAAA;IACjB,KAAKF,UAAU,KAAKF,WAAW;GACjC,CAAC;EACL,GAAG,OAAO;EACV,KAAKG,OAAO,QAAQ;CACtB;CAEA,MAAME,QAAuB;EAC3B,MAAM,sBAAM,IAAI,KAAK;EACrB,MAAM,WAAW,MAAM,KAAKR,UAAU,QAAQ;EAC9C,MAAM,cAAc;EACpB,IAAI,YAAY;EAqBhB,MAAM,WAAU,MApBM,QAAQ,WAC5B,MAAM,KAAK,EAAE,QAAQ,KAAK,IAAI,aAAa,SAAS,MAAM,EAAE,GAAG,YAAY;GACzE,OAAO,YAAY,SAAS,QAAQ;IAClC,MAAM,UAAU,SAAS;IACzB,IAAI,CAAC,SAAS;IACd,MAAM,SAAS,MAAM,sBACnB,KAAKC,YACL,KAAKC,SACL;KAAE,OAAO,QAAQ;KAAO,kBAAkB,QAAQ;IAAG,GACrD,EAAE,IAAI,CACR;IACA,MAAM,KAAKD,WAAW,uBAAuB;KAC3C,OAAO,QAAQ;KACf,kBAAkB,QAAQ;KAC1B,UAAU,OAAO;KACjB;IACF,CAAC;GACH;EACF,CAAC,CACH,EAAA,CACwB,MAAM,WAA4C,OAAO,WAAW,UAAU;EACtG,IAAI,SAAS,MAAM,QAAQ;CAC7B;AACF"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic Factory health check.
|
|
3
|
+
*
|
|
4
|
+
* Every finding is computed from storage rows alone — no model, no controller —
|
|
5
|
+
* so the supervisor agent explains findings rather than inventing them, and the
|
|
6
|
+
* same list can be rendered by the UI or polled by a timer. Each finding names
|
|
7
|
+
* the row it came from and the standard repair a person (or the supervisor's
|
|
8
|
+
* write tools) would apply.
|
|
9
|
+
*/
|
|
10
|
+
import type { BoardRegistry, PhaseSemantics } from '../boards/index.js';
|
|
11
|
+
import type { FactoryDeferredDecisionRecord, FactoryPendingStartRecord, FactoryRunBindingRecord, WorkItemRow, WorkItemsStorage } from '../storage/domains/work-items/base.js';
|
|
12
|
+
export type FactoryHealthFindingKind = 'decision-stuck' | 'start-stalled' | 'seat-orphaned' | 'seat-missing' | 'held-waiting' | 'label-drift';
|
|
13
|
+
export type FactoryHealthRepair = {
|
|
14
|
+
action: 'revoke-binding';
|
|
15
|
+
bindingId: string;
|
|
16
|
+
} | {
|
|
17
|
+
action: 'accept-work-item';
|
|
18
|
+
workItemId: string;
|
|
19
|
+
} | {
|
|
20
|
+
action: 'start-run';
|
|
21
|
+
workItemId: string;
|
|
22
|
+
role: string;
|
|
23
|
+
} | {
|
|
24
|
+
action: 'reconcile-labels';
|
|
25
|
+
workItemId: string;
|
|
26
|
+
};
|
|
27
|
+
export interface FactoryHealthFinding {
|
|
28
|
+
kind: FactoryHealthFindingKind;
|
|
29
|
+
/** Stable per (kind, subject) so the UI and attention inbox can dedupe. */
|
|
30
|
+
id: string;
|
|
31
|
+
workItemId: string | null;
|
|
32
|
+
/** Card number as shown on the board, when the row carries one. */
|
|
33
|
+
workItemNumber: number | null;
|
|
34
|
+
title: string;
|
|
35
|
+
/** One sentence of grounded evidence: ids, timestamps, error text. */
|
|
36
|
+
evidence: string;
|
|
37
|
+
/** ISO instant the condition began, when it is age-based. */
|
|
38
|
+
beganAt: string | null;
|
|
39
|
+
suggestedRepair: FactoryHealthRepair | null;
|
|
40
|
+
}
|
|
41
|
+
export interface FactoryHealthReport {
|
|
42
|
+
checkedAt: string;
|
|
43
|
+
findings: FactoryHealthFinding[];
|
|
44
|
+
counts: Record<FactoryHealthFindingKind, number>;
|
|
45
|
+
}
|
|
46
|
+
export interface FactoryHealthThresholds {
|
|
47
|
+
/** A retry/pending decision whose `availableAt` is this far in the past never got picked up. */
|
|
48
|
+
stuckDecisionMs: number;
|
|
49
|
+
/** A lease this far past its expiry belongs to a worker that died mid-dispatch. */
|
|
50
|
+
expiredLeaseMs: number;
|
|
51
|
+
/** A pending start this old is not "booting", it is stalled. */
|
|
52
|
+
stalledStartMs: number;
|
|
53
|
+
/** Held cards older than this are worth nudging a maintainer about. */
|
|
54
|
+
waitingOnPersonMs: number;
|
|
55
|
+
}
|
|
56
|
+
export declare const DEFAULT_HEALTH_THRESHOLDS: FactoryHealthThresholds;
|
|
57
|
+
interface HealthInputs {
|
|
58
|
+
items: WorkItemRow[];
|
|
59
|
+
decisions: FactoryDeferredDecisionRecord[];
|
|
60
|
+
bindings: FactoryRunBindingRecord[];
|
|
61
|
+
pendingStarts: FactoryPendingStartRecord[];
|
|
62
|
+
/**
|
|
63
|
+
* What the item's installed board says its current phase means. Undefined when the
|
|
64
|
+
* board is not installed, the phase is undeclared, or the row spans several stages;
|
|
65
|
+
* the check then neither revokes nor starts anything on a guess.
|
|
66
|
+
*/
|
|
67
|
+
phaseSemantics: (item: WorkItemRow) => PhaseSemantics | undefined;
|
|
68
|
+
}
|
|
69
|
+
/** Pure: findings from rows. Exported so tests can feed fixtures directly. */
|
|
70
|
+
export declare function computeFactoryHealth(inputs: HealthInputs, now: Date, thresholds?: FactoryHealthThresholds): FactoryHealthReport;
|
|
71
|
+
export declare function runFactoryHealthCheck(workItems: WorkItemsStorage, boards: BoardRegistry, scope: {
|
|
72
|
+
orgId: string;
|
|
73
|
+
factoryProjectId: string;
|
|
74
|
+
}, options?: {
|
|
75
|
+
now?: Date;
|
|
76
|
+
thresholds?: FactoryHealthThresholds;
|
|
77
|
+
}): Promise<FactoryHealthReport>;
|
|
78
|
+
export {};
|
|
79
|
+
//# sourceMappingURL=health.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/supervisor/health.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAExE,OAAO,KAAK,EACV,6BAA6B,EAC7B,yBAAyB,EACzB,uBAAuB,EACvB,WAAW,EACX,gBAAgB,EACjB,MAAM,uCAAuC,CAAC;AAE/C,MAAM,MAAM,wBAAwB,GAChC,gBAAgB,GAChB,eAAe,GACf,eAAe,GACf,cAAc,GACd,cAAc,GACd,aAAa,CAAC;AAElB,MAAM,MAAM,mBAAmB,GAC3B;IAAE,MAAM,EAAE,gBAAgB,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAC/C;IAAE,MAAM,EAAE,kBAAkB,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAClD;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,UAAU,E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