@mastra/factory 0.28.0-alpha.1 → 0.28.0-alpha.10
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/README.md +361 -162
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +12 -6
- package/dist/auth.js.map +1 -1
- package/dist/boards/board-events.d.ts +23 -3
- package/dist/boards/board-events.d.ts.map +1 -1
- package/dist/boards/board-events.js +44 -7
- package/dist/boards/board-events.js.map +1 -1
- package/dist/boards/board-writes.d.ts +2 -2
- package/dist/boards/board-writes.d.ts.map +1 -1
- package/dist/boards/board-writes.js +23 -9
- package/dist/boards/board-writes.js.map +1 -1
- package/dist/boards/card-facts.d.ts +3 -1
- package/dist/boards/card-facts.d.ts.map +1 -1
- package/dist/boards/card-facts.js +30 -4
- package/dist/boards/card-facts.js.map +1 -1
- package/dist/boards/default-board.d.ts +7 -0
- package/dist/boards/default-board.d.ts.map +1 -0
- package/dist/boards/default-board.js +10 -0
- package/dist/boards/default-board.js.map +1 -0
- package/dist/boards/define-board.d.ts +40 -18
- package/dist/boards/define-board.d.ts.map +1 -1
- package/dist/boards/define-board.js +64 -42
- package/dist/boards/define-board.js.map +1 -1
- package/dist/boards/index.d.ts +6 -9
- package/dist/boards/index.d.ts.map +1 -1
- package/dist/boards/index.js +6 -20
- package/dist/boards/intake-routing.d.ts +29 -9
- package/dist/boards/intake-routing.d.ts.map +1 -1
- package/dist/boards/intake-routing.js +72 -20
- package/dist/boards/intake-routing.js.map +1 -1
- package/dist/boards/legacy-plan-role.d.ts.map +1 -1
- package/dist/boards/legacy-plan-role.js +7 -2
- package/dist/boards/legacy-plan-role.js.map +1 -1
- package/dist/boards/phase-automation.d.ts +7 -0
- package/dist/boards/phase-automation.d.ts.map +1 -1
- package/dist/boards/phase-automation.js +16 -5
- package/dist/boards/phase-automation.js.map +1 -1
- package/dist/boards/phase-runner.d.ts +18 -10
- package/dist/boards/phase-runner.d.ts.map +1 -1
- package/dist/boards/phase-runner.js +39 -34
- package/dist/boards/phase-runner.js.map +1 -1
- package/dist/boards/project-boards.d.ts +57 -11
- package/dist/boards/project-boards.d.ts.map +1 -1
- package/dist/boards/project-boards.js +161 -34
- package/dist/boards/project-boards.js.map +1 -1
- package/dist/boards/registry.d.ts +7 -1
- package/dist/boards/registry.d.ts.map +1 -1
- package/dist/boards/registry.js +19 -4
- package/dist/boards/registry.js.map +1 -1
- package/dist/boards/relocate.d.ts +1 -1
- package/dist/boards/relocate.d.ts.map +1 -1
- package/dist/boards/relocate.js +3 -2
- package/dist/boards/relocate.js.map +1 -1
- package/dist/boards/review.d.ts +5 -2
- package/dist/boards/review.d.ts.map +1 -1
- package/dist/boards/review.js +12 -11
- package/dist/boards/review.js.map +1 -1
- package/dist/boards/semantics.d.ts +160 -20
- package/dist/boards/semantics.d.ts.map +1 -1
- package/dist/boards/semantics.js +255 -23
- package/dist/boards/semantics.js.map +1 -1
- package/dist/boards/stored-board.d.ts +32 -18
- package/dist/boards/stored-board.d.ts.map +1 -1
- package/dist/boards/stored-board.js +31 -97
- package/dist/boards/stored-board.js.map +1 -1
- package/dist/boards/work-migrations.d.ts +43 -0
- package/dist/boards/work-migrations.d.ts.map +1 -0
- package/dist/boards/work-migrations.js +353 -0
- package/dist/boards/work-migrations.js.map +1 -0
- package/dist/boards/work-routes.d.ts +58 -0
- package/dist/boards/work-routes.d.ts.map +1 -0
- package/dist/boards/work-routes.js +270 -0
- package/dist/boards/work-routes.js.map +1 -0
- package/dist/boards/work-seeds.d.ts +9 -0
- package/dist/boards/work-seeds.d.ts.map +1 -0
- package/dist/boards/work-seeds.js +56 -0
- package/dist/boards/work-seeds.js.map +1 -0
- package/dist/boards/work.d.ts +8 -19
- package/dist/boards/work.d.ts.map +1 -1
- package/dist/boards/work.js +33 -281
- package/dist/boards/work.js.map +1 -1
- package/dist/environment/build-runner.d.ts.map +1 -1
- package/dist/environment/build-runner.js +2 -2
- package/dist/environment/build-runner.js.map +1 -1
- package/dist/environment/build-workflow.d.ts.map +1 -1
- package/dist/environment/build-workflow.js +6 -5
- package/dist/environment/build-workflow.js.map +1 -1
- package/dist/environment/build.d.ts +15 -2
- package/dist/environment/build.d.ts.map +1 -1
- package/dist/environment/build.js +32 -9
- package/dist/environment/build.js.map +1 -1
- package/dist/factory.d.ts +34 -7
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +161 -133
- package/dist/factory.js.map +1 -1
- package/dist/feed-events.d.ts +4 -4
- package/dist/feed-events.d.ts.map +1 -1
- package/dist/feed-events.js +6 -6
- package/dist/feed-events.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/integrations/base.d.ts +6 -13
- package/dist/integrations/base.d.ts.map +1 -1
- package/dist/integrations/closing-references.d.ts +15 -0
- package/dist/integrations/closing-references.d.ts.map +1 -0
- package/dist/integrations/closing-references.js +69 -0
- package/dist/integrations/closing-references.js.map +1 -0
- package/dist/integrations/github/default-rules.d.ts +15 -66
- package/dist/integrations/github/default-rules.d.ts.map +1 -1
- package/dist/integrations/github/default-rules.js +129 -73
- package/dist/integrations/github/default-rules.js.map +1 -1
- package/dist/integrations/github/integration.d.ts.map +1 -1
- package/dist/integrations/github/integration.js +7 -3
- package/dist/integrations/github/integration.js.map +1 -1
- package/dist/integrations/github/issue-reconciler.d.ts.map +1 -1
- package/dist/integrations/github/issue-reconciler.js +5 -3
- package/dist/integrations/github/issue-reconciler.js.map +1 -1
- package/dist/integrations/github/provenance.js +1 -1
- package/dist/integrations/github/provenance.js.map +1 -1
- package/dist/integrations/github/pull-request-source.d.ts +8 -0
- package/dist/integrations/github/pull-request-source.d.ts.map +1 -0
- package/dist/integrations/github/pull-request-source.js +17 -0
- package/dist/integrations/github/pull-request-source.js.map +1 -0
- package/dist/integrations/github/reconcile-worker.d.ts +5 -1
- package/dist/integrations/github/reconcile-worker.d.ts.map +1 -1
- package/dist/integrations/github/reconcile-worker.js +39 -6
- package/dist/integrations/github/reconcile-worker.js.map +1 -1
- package/dist/integrations/github/review-status-reporter.d.ts.map +1 -1
- package/dist/integrations/github/review-status-reporter.js +7 -3
- package/dist/integrations/github/review-status-reporter.js.map +1 -1
- package/dist/integrations/github/routes.d.ts +4 -3
- package/dist/integrations/github/routes.d.ts.map +1 -1
- package/dist/integrations/github/routes.js +10 -87
- package/dist/integrations/github/routes.js.map +1 -1
- package/dist/integrations/github/rules.d.ts +79 -7
- package/dist/integrations/github/rules.d.ts.map +1 -1
- package/dist/integrations/github/rules.js +426 -102
- package/dist/integrations/github/rules.js.map +1 -1
- package/dist/integrations/github/sandbox.d.ts +10 -2
- package/dist/integrations/github/sandbox.d.ts.map +1 -1
- package/dist/integrations/github/sandbox.js +20 -4
- package/dist/integrations/github/sandbox.js.map +1 -1
- package/dist/integrations/github/session-subscriptions.js +2 -2
- package/dist/integrations/github/session-subscriptions.js.map +1 -1
- package/dist/integrations/github/token-refresh.d.ts +2 -1
- package/dist/integrations/github/token-refresh.d.ts.map +1 -1
- package/dist/integrations/github/token-refresh.js.map +1 -1
- package/dist/integrations/gitlab/agent-tools.js +1 -1
- package/dist/integrations/gitlab/default-rules.d.ts +73 -31
- package/dist/integrations/gitlab/default-rules.d.ts.map +1 -1
- package/dist/integrations/gitlab/default-rules.js +106 -43
- package/dist/integrations/gitlab/default-rules.js.map +1 -1
- package/dist/integrations/gitlab/issue-reconciler.d.ts.map +1 -1
- package/dist/integrations/gitlab/issue-reconciler.js +2 -1
- package/dist/integrations/gitlab/issue-reconciler.js.map +1 -1
- package/dist/integrations/gitlab/merge-request-reconciler.d.ts.map +1 -1
- package/dist/integrations/gitlab/merge-request-reconciler.js +12 -5
- package/dist/integrations/gitlab/merge-request-reconciler.js.map +1 -1
- package/dist/integrations/gitlab/routes.d.ts.map +1 -1
- package/dist/integrations/gitlab/routes.js +1 -3
- package/dist/integrations/gitlab/routes.js.map +1 -1
- package/dist/integrations/gitlab/rules.d.ts +6 -1
- package/dist/integrations/gitlab/rules.d.ts.map +1 -1
- package/dist/integrations/gitlab/rules.js +119 -30
- package/dist/integrations/gitlab/rules.js.map +1 -1
- package/dist/integrations/gitlab/session-subscriptions.js +1 -1
- package/dist/integrations/incidentio/agent-tools.js +6 -6
- package/dist/integrations/incidentio/agent-tools.js.map +1 -1
- package/dist/integrations/incidentio/default-rules.d.ts.map +1 -1
- package/dist/integrations/incidentio/default-rules.js +3 -3
- package/dist/integrations/incidentio/default-rules.js.map +1 -1
- package/dist/integrations/incidentio/issue-reconciler.d.ts.map +1 -1
- package/dist/integrations/incidentio/issue-reconciler.js +2 -1
- package/dist/integrations/incidentio/issue-reconciler.js.map +1 -1
- package/dist/integrations/incidentio/routes.d.ts +2 -2
- package/dist/integrations/incidentio/routes.d.ts.map +1 -1
- package/dist/integrations/incidentio/routes.js +10 -13
- package/dist/integrations/incidentio/routes.js.map +1 -1
- package/dist/integrations/incidentio/rules.d.ts +4 -4
- package/dist/integrations/incidentio/rules.d.ts.map +1 -1
- package/dist/integrations/incidentio/rules.js +18 -14
- package/dist/integrations/incidentio/rules.js.map +1 -1
- package/dist/integrations/issue-reconciler.js +1 -1
- package/dist/integrations/issue-reconciler.js.map +1 -1
- package/dist/integrations/jira/agent-tools.js +1 -1
- package/dist/integrations/jira/binding-scope.d.ts +5 -6
- package/dist/integrations/jira/binding-scope.d.ts.map +1 -1
- package/dist/integrations/jira/binding-scope.js +9 -11
- package/dist/integrations/jira/binding-scope.js.map +1 -1
- package/dist/integrations/jira/default-rules.d.ts.map +1 -1
- package/dist/integrations/jira/default-rules.js +3 -3
- package/dist/integrations/jira/default-rules.js.map +1 -1
- package/dist/integrations/jira/issue-reconciler.d.ts.map +1 -1
- package/dist/integrations/jira/issue-reconciler.js +2 -1
- package/dist/integrations/jira/issue-reconciler.js.map +1 -1
- package/dist/integrations/jira/routes.d.ts.map +1 -1
- package/dist/integrations/jira/routes.js +3 -5
- package/dist/integrations/jira/routes.js.map +1 -1
- package/dist/integrations/jira/rules.d.ts +4 -4
- package/dist/integrations/jira/rules.d.ts.map +1 -1
- package/dist/integrations/jira/rules.js +18 -14
- package/dist/integrations/jira/rules.js.map +1 -1
- package/dist/integrations/linear/agent-tools.d.ts +9 -1
- package/dist/integrations/linear/agent-tools.d.ts.map +1 -1
- package/dist/integrations/linear/agent-tools.js +81 -3
- package/dist/integrations/linear/agent-tools.js.map +1 -1
- package/dist/integrations/linear/default-rules.d.ts.map +1 -1
- package/dist/integrations/linear/default-rules.js +3 -3
- package/dist/integrations/linear/default-rules.js.map +1 -1
- package/dist/integrations/linear/integration.d.ts +4 -1
- package/dist/integrations/linear/integration.d.ts.map +1 -1
- package/dist/integrations/linear/integration.js +21 -1
- package/dist/integrations/linear/integration.js.map +1 -1
- package/dist/integrations/linear/issue-reconciler.d.ts.map +1 -1
- package/dist/integrations/linear/issue-reconciler.js +2 -1
- package/dist/integrations/linear/issue-reconciler.js.map +1 -1
- package/dist/integrations/linear/routes.d.ts +2 -1
- package/dist/integrations/linear/routes.d.ts.map +1 -1
- package/dist/integrations/linear/routes.js +15 -17
- package/dist/integrations/linear/routes.js.map +1 -1
- package/dist/integrations/linear/rules.d.ts +4 -4
- package/dist/integrations/linear/rules.d.ts.map +1 -1
- package/dist/integrations/linear/rules.js +16 -15
- package/dist/integrations/linear/rules.js.map +1 -1
- package/dist/integrations/platform/connect/session-tools.d.ts +5 -0
- package/dist/integrations/platform/connect/session-tools.d.ts.map +1 -1
- package/dist/integrations/platform/connect/session-tools.js +5 -0
- package/dist/integrations/platform/connect/session-tools.js.map +1 -1
- package/dist/integrations/platform/github/event-worker.d.ts +4 -1
- package/dist/integrations/platform/github/event-worker.d.ts.map +1 -1
- package/dist/integrations/platform/github/event-worker.js +39 -3
- package/dist/integrations/platform/github/event-worker.js.map +1 -1
- package/dist/integrations/platform/github/integration.d.ts +8 -0
- package/dist/integrations/platform/github/integration.d.ts.map +1 -1
- package/dist/integrations/platform/github/integration.js +131 -87
- package/dist/integrations/platform/github/integration.js.map +1 -1
- package/dist/integrations/platform/jira/agent-tools.js +1 -1
- package/dist/integrations/platform/jira/routes.d.ts.map +1 -1
- package/dist/integrations/platform/jira/routes.js +3 -5
- package/dist/integrations/platform/jira/routes.js.map +1 -1
- package/dist/integrations/platform/linear/event-worker.d.ts +1 -1
- package/dist/integrations/platform/linear/event-worker.d.ts.map +1 -1
- package/dist/integrations/platform/linear/event-worker.js +1 -1
- package/dist/integrations/platform/linear/event-worker.js.map +1 -1
- package/dist/integrations/platform/linear/integration.d.ts +1 -1
- package/dist/integrations/platform/linear/integration.d.ts.map +1 -1
- package/dist/integrations/platform/linear/integration.js +6 -5
- package/dist/integrations/platform/linear/integration.js.map +1 -1
- package/dist/integrations/slack/chat-tools.js +1 -1
- package/dist/integrations/slack/integration.d.ts +0 -2
- package/dist/integrations/slack/integration.d.ts.map +1 -1
- package/dist/integrations/slack/integration.js +0 -5
- package/dist/integrations/slack/integration.js.map +1 -1
- package/dist/integrations/slack/reply-tool.js +1 -1
- package/dist/integrations/slack/run-error-card.js +1 -0
- package/dist/integrations/slack/run-error-card.js.map +1 -1
- package/dist/integrations/slack/share-file-tool.js +1 -1
- package/dist/integrations/slack/slack.d.ts +13 -22
- package/dist/integrations/slack/slack.d.ts.map +1 -1
- package/dist/integrations/slack/slack.js +22 -83
- package/dist/integrations/slack/slack.js.map +1 -1
- package/dist/links.d.ts +1 -2
- package/dist/links.d.ts.map +1 -1
- package/dist/links.js +4 -4
- package/dist/links.js.map +1 -1
- package/dist/mcp/routes.js +3 -3
- package/dist/mcp/routes.js.map +1 -1
- package/dist/provider-display-name.d.ts.map +1 -1
- package/dist/provider-display-name.js +1 -0
- package/dist/provider-display-name.js.map +1 -1
- package/dist/routes/attention-parked.d.ts +1 -0
- package/dist/routes/attention-parked.d.ts.map +1 -1
- package/dist/routes/attention-parked.js +2 -2
- package/dist/routes/attention-parked.js.map +1 -1
- package/dist/routes/attention-providers.d.ts +0 -25
- package/dist/routes/attention-providers.d.ts.map +1 -1
- package/dist/routes/attention-providers.js +2 -150
- package/dist/routes/attention-providers.js.map +1 -1
- package/dist/routes/attention.d.ts +0 -2
- package/dist/routes/attention.d.ts.map +1 -1
- package/dist/routes/attention.js +2 -13
- package/dist/routes/attention.js.map +1 -1
- package/dist/routes/automation-runs.d.ts +5 -1
- package/dist/routes/automation-runs.d.ts.map +1 -1
- package/dist/routes/automation-runs.js +15 -0
- package/dist/routes/automation-runs.js.map +1 -1
- package/dist/routes/board-snapshot.d.ts +15 -0
- package/dist/routes/board-snapshot.d.ts.map +1 -0
- package/dist/routes/board-snapshot.js +41 -0
- package/dist/routes/board-snapshot.js.map +1 -0
- package/dist/routes/boards.d.ts +2 -2
- package/dist/routes/boards.d.ts.map +1 -1
- package/dist/routes/boards.js +1 -17
- package/dist/routes/boards.js.map +1 -1
- package/dist/routes/config.d.ts +11 -1
- package/dist/routes/config.d.ts.map +1 -1
- package/dist/routes/config.js +120 -22
- package/dist/routes/config.js.map +1 -1
- package/dist/routes/contracts.d.ts +251 -51
- package/dist/routes/contracts.d.ts.map +1 -1
- package/dist/routes/contracts.js +120 -40
- package/dist/routes/contracts.js.map +1 -1
- package/dist/routes/feed-events.d.ts +15 -0
- package/dist/routes/feed-events.d.ts.map +1 -0
- package/dist/routes/feed-events.js +68 -0
- package/dist/routes/feed-events.js.map +1 -0
- package/dist/routes/fs.d.ts +4 -0
- package/dist/routes/fs.d.ts.map +1 -1
- package/dist/routes/fs.js +8 -4
- package/dist/routes/fs.js.map +1 -1
- package/dist/routes/intake-routes.d.ts.map +1 -1
- package/dist/routes/intake-routes.js +6 -1
- package/dist/routes/intake-routes.js.map +1 -1
- package/dist/routes/intake.d.ts +0 -23
- package/dist/routes/intake.d.ts.map +1 -1
- package/dist/routes/intake.js +13 -309
- package/dist/routes/intake.js.map +1 -1
- package/dist/routes/knowledge.js +1 -1
- package/dist/routes/mastra-gateway.d.ts +19 -0
- package/dist/routes/mastra-gateway.d.ts.map +1 -0
- package/dist/routes/mastra-gateway.js +120 -0
- package/dist/routes/mastra-gateway.js.map +1 -0
- package/dist/routes/projects.d.ts +1 -1
- package/dist/routes/projects.d.ts.map +1 -1
- package/dist/routes/projects.js +74 -58
- package/dist/routes/projects.js.map +1 -1
- package/dist/routes/provider-credentials.d.ts +6 -1
- package/dist/routes/provider-credentials.d.ts.map +1 -1
- package/dist/routes/provider-credentials.js +42 -7
- package/dist/routes/provider-credentials.js.map +1 -1
- package/dist/routes/route.d.ts +6 -0
- package/dist/routes/route.d.ts.map +1 -1
- package/dist/routes/route.js.map +1 -1
- package/dist/routes/running-packages.d.ts +13 -0
- package/dist/routes/running-packages.d.ts.map +1 -0
- package/dist/routes/running-packages.js +45 -0
- package/dist/routes/running-packages.js.map +1 -0
- package/dist/routes/sandbox-envs.d.ts +26 -0
- package/dist/routes/sandbox-envs.d.ts.map +1 -0
- package/dist/routes/sandbox-envs.js +180 -0
- package/dist/routes/sandbox-envs.js.map +1 -0
- package/dist/routes/session-access.d.ts.map +1 -1
- package/dist/routes/session-access.js +12 -3
- package/dist/routes/session-access.js.map +1 -1
- package/dist/routes/surface.d.ts +10 -8
- package/dist/routes/surface.d.ts.map +1 -1
- package/dist/routes/surface.js +105 -42
- package/dist/routes/surface.js.map +1 -1
- package/dist/routes/tenant-credentials.d.ts.map +1 -1
- package/dist/routes/tenant-credentials.js +5 -1
- package/dist/routes/tenant-credentials.js.map +1 -1
- package/dist/routes/work-items.d.ts +0 -3
- package/dist/routes/work-items.d.ts.map +1 -1
- package/dist/routes/work-items.js +38 -10
- package/dist/routes/work-items.js.map +1 -1
- package/dist/rules/binding-context.d.ts.map +1 -1
- package/dist/rules/binding-context.js +1 -0
- package/dist/rules/binding-context.js.map +1 -1
- package/dist/rules/dispatcher.d.ts +0 -9
- package/dist/rules/dispatcher.d.ts.map +1 -1
- package/dist/rules/dispatcher.js +362 -69
- package/dist/rules/dispatcher.js.map +1 -1
- package/dist/rules/event-rules.d.ts +33 -2
- package/dist/rules/event-rules.d.ts.map +1 -1
- package/dist/rules/event-rules.js +46 -11
- package/dist/rules/event-rules.js.map +1 -1
- package/dist/rules/index.d.ts +2 -4
- package/dist/rules/index.d.ts.map +1 -1
- package/dist/rules/index.js +2 -3
- package/dist/rules/phase-goal.d.ts +54 -0
- package/dist/rules/phase-goal.d.ts.map +1 -0
- package/dist/rules/phase-goal.js +70 -0
- package/dist/rules/phase-goal.js.map +1 -0
- package/dist/rules/phase-tools.d.ts +11 -0
- package/dist/rules/phase-tools.d.ts.map +1 -0
- package/dist/rules/phase-tools.js +19 -0
- package/dist/rules/phase-tools.js.map +1 -0
- package/dist/rules/processor.d.ts.map +1 -1
- package/dist/rules/processor.js +116 -15
- package/dist/rules/processor.js.map +1 -1
- package/dist/rules/review-source-tool.d.ts +4 -1
- package/dist/rules/review-source-tool.d.ts.map +1 -1
- package/dist/rules/review-source-tool.js +24 -4
- package/dist/rules/review-source-tool.js.map +1 -1
- package/dist/rules/rule-group.d.ts +1 -1
- package/dist/rules/rule-group.d.ts.map +1 -1
- package/dist/rules/rule-group.js +15 -6
- package/dist/rules/rule-group.js.map +1 -1
- package/dist/rules/start-coordinator.d.ts +5 -1
- package/dist/rules/start-coordinator.d.ts.map +1 -1
- package/dist/rules/start-coordinator.js +9 -3
- package/dist/rules/start-coordinator.js.map +1 -1
- package/dist/rules/tools.d.ts.map +1 -1
- package/dist/rules/tools.js +39 -28
- package/dist/rules/tools.js.map +1 -1
- package/dist/rules/transition-service.d.ts +4 -10
- package/dist/rules/transition-service.d.ts.map +1 -1
- package/dist/rules/transition-service.js +61 -55
- package/dist/rules/transition-service.js.map +1 -1
- package/dist/rules/types.d.ts +86 -36
- package/dist/rules/types.d.ts.map +1 -1
- package/dist/rules/types.js +5 -41
- package/dist/rules/types.js.map +1 -1
- package/dist/rules/validation.d.ts.map +1 -1
- package/dist/rules/validation.js +32 -2
- package/dist/rules/validation.js.map +1 -1
- package/dist/run-error.d.ts +1 -1
- package/dist/run-error.d.ts.map +1 -1
- package/dist/run-error.js +38 -5
- package/dist/run-error.js.map +1 -1
- package/dist/sandbox/sandbox-env-cache.d.ts +33 -0
- package/dist/sandbox/sandbox-env-cache.d.ts.map +1 -0
- package/dist/sandbox/sandbox-env-cache.js +140 -0
- package/dist/sandbox/sandbox-env-cache.js.map +1 -0
- package/dist/sandbox/sandbox-env.d.ts +77 -0
- package/dist/sandbox/sandbox-env.d.ts.map +1 -0
- package/dist/sandbox/sandbox-env.js +130 -0
- package/dist/sandbox/sandbox-env.js.map +1 -0
- package/dist/secret-encryption.d.ts +21 -0
- package/dist/secret-encryption.d.ts.map +1 -1
- package/dist/secret-encryption.js +31 -4
- package/dist/secret-encryption.js.map +1 -1
- package/dist/session/live-sessions.d.ts +11 -4
- package/dist/session/live-sessions.d.ts.map +1 -1
- package/dist/session/live-sessions.js +31 -10
- package/dist/session/live-sessions.js.map +1 -1
- package/dist/session/self-review-gate.d.ts +6 -4
- package/dist/session/self-review-gate.d.ts.map +1 -1
- package/dist/session/self-review-gate.js +9 -12
- package/dist/session/self-review-gate.js.map +1 -1
- package/dist/session/session-threads.d.ts +2 -3
- package/dist/session/session-threads.d.ts.map +1 -1
- package/dist/session/session-threads.js.map +1 -1
- package/dist/session/source-control-tools.d.ts +39 -13
- package/dist/session/source-control-tools.d.ts.map +1 -1
- package/dist/session/source-control-tools.js +55 -61
- package/dist/session/source-control-tools.js.map +1 -1
- package/dist/session/work-item-state-processor.d.ts +24 -0
- package/dist/session/work-item-state-processor.d.ts.map +1 -0
- package/dist/session/work-item-state-processor.js +275 -0
- package/dist/session/work-item-state-processor.js.map +1 -0
- package/dist/storage/domains/audit/actions.d.ts +2 -1
- package/dist/storage/domains/audit/actions.d.ts.map +1 -1
- package/dist/storage/domains/audit/actions.js +5 -4
- package/dist/storage/domains/audit/actions.js.map +1 -1
- package/dist/storage/domains/boards/base.d.ts +85 -32
- package/dist/storage/domains/boards/base.d.ts.map +1 -1
- package/dist/storage/domains/boards/base.js +120 -131
- package/dist/storage/domains/boards/base.js.map +1 -1
- package/dist/storage/domains/boards/schemas.d.ts.map +1 -1
- package/dist/storage/domains/boards/schemas.js +12 -0
- package/dist/storage/domains/boards/schemas.js.map +1 -1
- package/dist/storage/domains/channel-identity/base.d.ts +0 -4
- package/dist/storage/domains/channel-identity/base.d.ts.map +1 -1
- package/dist/storage/domains/channel-identity/base.js +0 -7
- package/dist/storage/domains/channel-identity/base.js.map +1 -1
- package/dist/storage/domains/intake/base.d.ts +5 -45
- package/dist/storage/domains/intake/base.d.ts.map +1 -1
- package/dist/storage/domains/intake/base.js +11 -89
- package/dist/storage/domains/intake/base.js.map +1 -1
- package/dist/storage/domains/projects/base.d.ts +17 -9
- package/dist/storage/domains/projects/base.d.ts.map +1 -1
- package/dist/storage/domains/projects/base.js +15 -7
- package/dist/storage/domains/projects/base.js.map +1 -1
- package/dist/storage/domains/sandbox-envs/base.d.ts +70 -0
- package/dist/storage/domains/sandbox-envs/base.d.ts.map +1 -0
- package/dist/storage/domains/sandbox-envs/base.js +227 -0
- package/dist/storage/domains/sandbox-envs/base.js.map +1 -0
- package/dist/storage/domains/work-items/base.d.ts +62 -22
- package/dist/storage/domains/work-items/base.d.ts.map +1 -1
- package/dist/storage/domains/work-items/base.js +218 -146
- package/dist/storage/domains/work-items/base.js.map +1 -1
- package/dist/storage/domains/work-items/board-version.d.ts +6 -2
- package/dist/storage/domains/work-items/board-version.d.ts.map +1 -1
- package/dist/storage/domains/work-items/board-version.js +20 -9
- package/dist/storage/domains/work-items/board-version.js.map +1 -1
- package/dist/storage/domains/work-items/cards.d.ts +28 -5
- package/dist/storage/domains/work-items/cards.d.ts.map +1 -1
- package/dist/storage/domains/work-items/cards.js +156 -23
- package/dist/storage/domains/work-items/cards.js.map +1 -1
- package/dist/storage/domains/work-items/legacy-review.d.ts +63 -0
- package/dist/storage/domains/work-items/legacy-review.d.ts.map +1 -0
- package/dist/storage/domains/work-items/legacy-review.js +109 -0
- package/dist/storage/domains/work-items/legacy-review.js.map +1 -0
- package/dist/storage/domains/work-items/metrics.d.ts +12 -4
- package/dist/storage/domains/work-items/metrics.d.ts.map +1 -1
- package/dist/storage/domains/work-items/metrics.js +14 -32
- package/dist/storage/domains/work-items/metrics.js.map +1 -1
- package/dist/storage/domains/work-items/work-item-schema.d.ts +4 -2
- package/dist/storage/domains/work-items/work-item-schema.d.ts.map +1 -1
- package/dist/storage/domains/work-items/work-item-schema.js +59 -26
- package/dist/storage/domains/work-items/work-item-schema.js.map +1 -1
- package/dist/tools/approval-tools.d.ts.map +1 -1
- package/dist/tools/approval-tools.js +28 -9
- package/dist/tools/approval-tools.js.map +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/messaging-tools.d.ts +3 -0
- package/dist/tools/messaging-tools.d.ts.map +1 -1
- package/dist/tools/messaging-tools.js +2 -1
- package/dist/tools/messaging-tools.js.map +1 -1
- package/dist/tools/read-tools.d.ts +8 -4
- package/dist/tools/read-tools.d.ts.map +1 -1
- package/dist/tools/read-tools.js +86 -37
- package/dist/tools/read-tools.js.map +1 -1
- package/dist/tools/reports.d.ts +1 -0
- package/dist/tools/reports.d.ts.map +1 -1
- package/dist/tools/reports.js +2 -1
- package/dist/tools/reports.js.map +1 -1
- package/dist/tools/run-watch.d.ts +1 -1
- package/dist/tools/run-watch.d.ts.map +1 -1
- package/dist/tools/run-watch.js +1 -0
- package/dist/tools/run-watch.js.map +1 -1
- package/dist/tools/sandbox-tools.js +1 -1
- package/dist/tools/session-tools.js +1 -1
- package/dist/tools/sessions-state-processor.d.ts +2 -0
- package/dist/tools/sessions-state-processor.d.ts.map +1 -1
- package/dist/tools/sessions-state-processor.js +4 -2
- package/dist/tools/sessions-state-processor.js.map +1 -1
- package/dist/tools/side-sessions.d.ts +2 -0
- package/dist/tools/side-sessions.d.ts.map +1 -1
- package/dist/tools/side-sessions.js +2 -1
- package/dist/tools/side-sessions.js.map +1 -1
- package/dist/tools/work-item-tools.d.ts +0 -3
- package/dist/tools/work-item-tools.d.ts.map +1 -1
- package/dist/tools/work-item-tools.js +10 -20
- package/dist/tools/work-item-tools.js.map +1 -1
- package/dist/work-item-branch.d.ts +13 -0
- package/dist/work-item-branch.d.ts.map +1 -1
- package/dist/work-item-branch.js +16 -1
- package/dist/work-item-branch.js.map +1 -1
- package/dist/work-items/create-work-item.d.ts +6 -0
- package/dist/work-items/create-work-item.d.ts.map +1 -1
- package/dist/work-items/create-work-item.js +28 -3
- package/dist/work-items/create-work-item.js.map +1 -1
- package/dist/work-items/description-context.d.ts +5 -0
- package/dist/work-items/description-context.d.ts.map +1 -0
- package/dist/work-items/description-context.js +17 -0
- package/dist/work-items/description-context.js.map +1 -0
- package/dist/work-items/providers/base.d.ts +4 -1
- package/dist/work-items/providers/base.d.ts.map +1 -1
- package/dist/work-items/providers/base.js +6 -1
- package/dist/work-items/providers/base.js.map +1 -1
- package/dist/work-items/providers/github.d.ts.map +1 -1
- package/dist/work-items/providers/github.js +2 -1
- package/dist/work-items/providers/github.js.map +1 -1
- package/dist/work-items/providers/gitlab.d.ts.map +1 -1
- package/dist/work-items/providers/gitlab.js +2 -1
- package/dist/work-items/providers/gitlab.js.map +1 -1
- package/dist/work-items/providers/jira.d.ts.map +1 -1
- package/dist/work-items/providers/jira.js +3 -2
- package/dist/work-items/providers/jira.js.map +1 -1
- package/dist/work-items/providers/linear.d.ts.map +1 -1
- package/dist/work-items/providers/linear.js +3 -2
- package/dist/work-items/providers/linear.js.map +1 -1
- package/dist/work-items/providers/types.d.ts +6 -0
- package/dist/work-items/providers/types.d.ts.map +1 -1
- package/dist/work-items/split-migration.d.ts.map +1 -1
- package/dist/work-items/split-migration.js +8 -8
- package/dist/work-items/split-migration.js.map +1 -1
- package/dist/workspace.d.ts +3 -1
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +116 -32
- package/dist/workspace.js.map +1 -1
- package/factory-skills/configure-factory-rules/SKILL.md +13 -11
- package/factory-skills/factory-build/SKILL.md +64 -0
- package/factory-skills/factory-gitlab-rereview/SKILL.md +4 -4
- package/factory-skills/factory-gitlab-review/SKILL.md +6 -6
- package/factory-skills/factory-plan/SKILL.md +8 -10
- package/factory-skills/factory-rereview/SKILL.md +74 -28
- package/factory-skills/factory-review/SKILL.md +85 -29
- package/factory-skills/factory-self-review/SKILL.md +32 -13
- package/factory-skills/factory-triage/SKILL.md +36 -32
- package/package.json +12 -12
- package/dist/boards/index.js.map +0 -1
- package/dist/boards/pull-request-review.d.ts +0 -14
- package/dist/boards/pull-request-review.d.ts.map +0 -1
- package/dist/boards/pull-request-review.js +0 -81
- package/dist/boards/pull-request-review.js.map +0 -1
- package/dist/boards/work-tool-rules.d.ts +0 -8
- package/dist/boards/work-tool-rules.d.ts.map +0 -1
- package/dist/boards/work-tool-rules.js +0 -19
- package/dist/boards/work-tool-rules.js.map +0 -1
- package/dist/integrations/slack/emoji-shortcodes.generated.d.ts +0 -8
- package/dist/integrations/slack/emoji-shortcodes.generated.d.ts.map +0 -1
- package/dist/integrations/slack/emoji-shortcodes.generated.js +0 -1984
- package/dist/integrations/slack/emoji-shortcodes.generated.js.map +0 -1
- package/dist/integrations/slack/emoji.d.ts +0 -3
- package/dist/integrations/slack/emoji.d.ts.map +0 -1
- package/dist/integrations/slack/emoji.js +0 -11
- package/dist/integrations/slack/emoji.js.map +0 -1
- package/dist/integrations/slack/feed-publisher.d.ts +0 -26
- package/dist/integrations/slack/feed-publisher.d.ts.map +0 -1
- package/dist/integrations/slack/feed-publisher.js +0 -43
- package/dist/integrations/slack/feed-publisher.js.map +0 -1
- package/dist/routes/attention-activity.d.ts +0 -23
- package/dist/routes/attention-activity.d.ts.map +0 -1
- package/dist/routes/attention-activity.js +0 -154
- package/dist/routes/attention-activity.js.map +0 -1
- package/dist/rules/resolve.d.ts +0 -15
- package/dist/rules/resolve.d.ts.map +0 -1
- package/dist/rules/resolve.js +0 -22
- package/dist/rules/resolve.js.map +0 -1
- package/dist/storage/domains/comments/activity.d.ts +0 -40
- package/dist/storage/domains/comments/activity.d.ts.map +0 -1
- package/dist/storage/domains/comments/activity.js +0 -93
- package/dist/storage/domains/comments/activity.js.map +0 -1
- package/dist/storage/domains/comments/actor.d.ts +0 -51
- package/dist/storage/domains/comments/actor.d.ts.map +0 -1
- package/dist/storage/domains/comments/actor.js +0 -37
- package/dist/storage/domains/comments/actor.js.map +0 -1
- package/dist/storage/domains/comments/base.d.ts +0 -245
- package/dist/storage/domains/comments/base.d.ts.map +0 -1
- package/dist/storage/domains/comments/base.js +0 -539
- package/dist/storage/domains/comments/base.js.map +0 -1
- package/dist/storage/domains/comments/domain.d.ts +0 -135
- package/dist/storage/domains/comments/domain.d.ts.map +0 -1
- package/dist/storage/domains/comments/domain.js +0 -284
- package/dist/storage/domains/comments/domain.js.map +0 -1
- package/dist/storage/domains/comments/feed-context.d.ts +0 -22
- package/dist/storage/domains/comments/feed-context.d.ts.map +0 -1
- package/dist/storage/domains/comments/feed-context.js +0 -88
- package/dist/storage/domains/comments/feed-context.js.map +0 -1
- package/dist/storage/domains/comments/feed-sync.d.ts +0 -21
- package/dist/storage/domains/comments/feed-sync.d.ts.map +0 -1
- package/dist/storage/domains/comments/feed-sync.js +0 -1
- package/dist/storage/domains/comments/parse.d.ts +0 -23
- package/dist/storage/domains/comments/parse.d.ts.map +0 -1
- package/dist/storage/domains/comments/parse.js +0 -89
- package/dist/storage/domains/comments/parse.js.map +0 -1
- package/dist/storage/domains/comments/routes.d.ts +0 -24
- package/dist/storage/domains/comments/routes.d.ts.map +0 -1
- package/dist/storage/domains/comments/routes.js +0 -299
- package/dist/storage/domains/comments/routes.js.map +0 -1
- package/dist/storage/domains/comments/schema.d.ts +0 -5
- package/dist/storage/domains/comments/schema.d.ts.map +0 -1
- package/dist/storage/domains/comments/schema.js +0 -178
- package/dist/storage/domains/comments/schema.js.map +0 -1
- package/dist/storage/domains/comments/wire.d.ts +0 -40
- package/dist/storage/domains/comments/wire.d.ts.map +0 -1
- package/dist/storage/domains/comments/wire.js +0 -36
- package/dist/storage/domains/comments/wire.js.map +0 -1
- package/factory-skills/factory-complete-issue/SKILL.md +0 -24
|
@@ -12,6 +12,7 @@ export interface WorkItemDbRecord extends Record<string, unknown> {
|
|
|
12
12
|
org_id: string;
|
|
13
13
|
factory_project_id: string;
|
|
14
14
|
title: string;
|
|
15
|
+
description: string | null;
|
|
15
16
|
parent_work_item_id: string | null;
|
|
16
17
|
revision: number;
|
|
17
18
|
created_at: Date;
|
|
@@ -34,11 +35,13 @@ export interface WorkItemSourceDbRecord extends Record<string, unknown> {
|
|
|
34
35
|
labels: string[];
|
|
35
36
|
author: string | null;
|
|
36
37
|
metadata: Record<string, unknown> | null;
|
|
38
|
+
role?: WorkItemSourceRole | null;
|
|
37
39
|
revision: number;
|
|
38
40
|
synced_at: Date | null;
|
|
39
41
|
created_at: Date;
|
|
40
42
|
updated_at: Date;
|
|
41
43
|
}
|
|
44
|
+
export type WorkItemSourceRole = 'origin' | 'attached';
|
|
42
45
|
export interface WorkItemSourceRow {
|
|
43
46
|
id: string;
|
|
44
47
|
workItemId: string;
|
|
@@ -99,14 +102,13 @@ export interface BoardItemDbRecord extends Record<string, unknown> {
|
|
|
99
102
|
stage_history: unknown[];
|
|
100
103
|
sessions: Record<string, unknown>;
|
|
101
104
|
metadata: Record<string, unknown> | null;
|
|
102
|
-
comment_count: number;
|
|
103
|
-
feed_activity_at: Date | null;
|
|
104
105
|
revision: number;
|
|
105
106
|
created_by: string;
|
|
106
107
|
created_at: Date;
|
|
107
108
|
updated_at: Date;
|
|
108
109
|
migrated_from_updated_at: Date | null;
|
|
109
110
|
migrated_from_hash: string | null;
|
|
111
|
+
changed_at?: Date | null;
|
|
110
112
|
}
|
|
111
113
|
/** Serializes first-copy migration with deletion without locking an entire project's cards. */
|
|
112
114
|
export declare const FACTORY_WORK_ITEM_SPLIT_LOCKS_SCHEMA: CollectionSchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"work-item-schema.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/work-items/work-item-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,MAAM,MAAM,gBAAgB,GACxB,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,OAAO,GACP,YAAY,GACZ,SAAS,GACT,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB,4EAA4E;AAC5E,eAAO,MAAM,yBAAyB,EAAE,
|
|
1
|
+
{"version":3,"file":"work-item-schema.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/work-items/work-item-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,MAAM,MAAM,gBAAgB,GACxB,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,OAAO,GACP,YAAY,GACZ,SAAS,GACT,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB,4EAA4E;AAC5E,eAAO,MAAM,yBAAyB,EAAE,gBAcvC,CAAC;AAEF,sFAAsF;AACtF,eAAO,MAAM,gCAAgC,EAAE,gBAoC9C,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,0BAA0B,EAAE,gBAyCxC,CAAC;AAEF,MAAM,WAAW,gBAAiB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC/D,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,EAAE,MAAM,CA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A6G;AAC7G,eAAO,MAAM,oCAAoC,EAAE,gBAQlD,CAAC"}
|
|
@@ -7,6 +7,10 @@ const FACTORY_WORK_ITEMS_SCHEMA = {
|
|
|
7
7
|
org_id: { type: "text" },
|
|
8
8
|
factory_project_id: { type: "text" },
|
|
9
9
|
title: { type: "text" },
|
|
10
|
+
description: {
|
|
11
|
+
type: "text",
|
|
12
|
+
nullable: true
|
|
13
|
+
},
|
|
10
14
|
parent_work_item_id: {
|
|
11
15
|
type: "text",
|
|
12
16
|
nullable: true
|
|
@@ -64,6 +68,11 @@ const FACTORY_WORK_ITEM_SOURCES_SCHEMA = {
|
|
|
64
68
|
type: "json",
|
|
65
69
|
nullable: true
|
|
66
70
|
},
|
|
71
|
+
/** `origin` for the record the work item was created from, `attached` for one added later. Null (rows written before this column) reads as `origin`. */
|
|
72
|
+
role: {
|
|
73
|
+
type: "text",
|
|
74
|
+
nullable: true
|
|
75
|
+
},
|
|
67
76
|
revision: {
|
|
68
77
|
type: "integer",
|
|
69
78
|
default: 1
|
|
@@ -131,14 +140,6 @@ const FACTORY_BOARD_ITEMS_SCHEMA = {
|
|
|
131
140
|
type: "json",
|
|
132
141
|
nullable: true
|
|
133
142
|
},
|
|
134
|
-
comment_count: {
|
|
135
|
-
type: "integer",
|
|
136
|
-
default: 0
|
|
137
|
-
},
|
|
138
|
-
feed_activity_at: {
|
|
139
|
-
type: "timestamp",
|
|
140
|
-
nullable: true
|
|
141
|
-
},
|
|
142
143
|
revision: {
|
|
143
144
|
type: "integer",
|
|
144
145
|
default: 1
|
|
@@ -153,28 +154,44 @@ const FACTORY_BOARD_ITEMS_SCHEMA = {
|
|
|
153
154
|
migrated_from_hash: {
|
|
154
155
|
type: "text",
|
|
155
156
|
nullable: true
|
|
157
|
+
},
|
|
158
|
+
/** Moves on every change to the card, in any of its tables; board reloads read rows changed since. */
|
|
159
|
+
changed_at: {
|
|
160
|
+
type: "timestamp",
|
|
161
|
+
nullable: true
|
|
156
162
|
}
|
|
157
163
|
},
|
|
158
164
|
uniqueIndexes: [{
|
|
159
165
|
name: "factory_board_items_work_item_unique",
|
|
160
166
|
columns: ["work_item_id"]
|
|
161
167
|
}],
|
|
162
|
-
indexes: [
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
168
|
+
indexes: [
|
|
169
|
+
{
|
|
170
|
+
name: "factory_board_items_project_changed_at_idx",
|
|
171
|
+
columns: [
|
|
172
|
+
"org_id",
|
|
173
|
+
"factory_project_id",
|
|
174
|
+
"changed_at"
|
|
175
|
+
]
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
name: "factory_board_items_org_project_created_at_id_idx",
|
|
179
|
+
columns: [
|
|
180
|
+
"org_id",
|
|
181
|
+
"factory_project_id",
|
|
182
|
+
"created_at",
|
|
183
|
+
"id"
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
name: "factory_board_items_project_parent_idx",
|
|
188
|
+
columns: [
|
|
189
|
+
"org_id",
|
|
190
|
+
"factory_project_id",
|
|
191
|
+
"parent_board_item_id"
|
|
192
|
+
]
|
|
193
|
+
}
|
|
194
|
+
]
|
|
178
195
|
};
|
|
179
196
|
function primarySource(card) {
|
|
180
197
|
return card.workItem.sources[0] ?? null;
|
|
@@ -194,8 +211,20 @@ const FACTORY_BOARD_ITEM_TOMBSTONES_SCHEMA = {
|
|
|
194
211
|
columns: {
|
|
195
212
|
id: { type: "uuid-pk" },
|
|
196
213
|
org_id: { type: "text" },
|
|
197
|
-
factory_project_id: { type: "text" }
|
|
198
|
-
|
|
214
|
+
factory_project_id: { type: "text" },
|
|
215
|
+
deleted_at: {
|
|
216
|
+
type: "timestamp",
|
|
217
|
+
nullable: true
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
indexes: [{
|
|
221
|
+
name: "factory_board_item_tombstones_project_deleted_at_idx",
|
|
222
|
+
columns: [
|
|
223
|
+
"org_id",
|
|
224
|
+
"factory_project_id",
|
|
225
|
+
"deleted_at"
|
|
226
|
+
]
|
|
227
|
+
}]
|
|
199
228
|
};
|
|
200
229
|
/** The pre-split card table. Frozen: only the split migration reads it. */
|
|
201
230
|
const WORK_ITEMS_SCHEMA = {
|
|
@@ -225,6 +254,10 @@ const WORK_ITEMS_SCHEMA = {
|
|
|
225
254
|
nullable: true
|
|
226
255
|
},
|
|
227
256
|
title: { type: "text" },
|
|
257
|
+
description: {
|
|
258
|
+
type: "text",
|
|
259
|
+
nullable: true
|
|
260
|
+
},
|
|
228
261
|
stages: { type: "json" },
|
|
229
262
|
stage_history: { type: "json" },
|
|
230
263
|
sessions: { type: "json" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"work-item-schema.js","names":[],"sources":["../../../../src/storage/domains/work-items/work-item-schema.ts"],"sourcesContent":["import type { CollectionSchema } from '@mastra/core/storage';\n\nimport type { FactoryTriageType } from '../../../rules/types.js';\n\nexport type WorkItemProvider =\n | 'github'\n | 'gitlab'\n | 'jira'\n | 'linear'\n | 'slack'\n | 'incidentio'\n | 'factory'\n | (string & {});\n\n/** The work itself; external identities and facts belong to its sources. */\nexport const FACTORY_WORK_ITEMS_SCHEMA: CollectionSchema = {\n name: 'factory_work_items',\n columns: {\n id: { type: 'uuid-pk' },\n org_id: { type: 'text' },\n factory_project_id: { type: 'text' },\n title: { type: 'text' },\n parent_work_item_id: { type: 'text', nullable: true },\n revision: { type: 'integer', default: 1 },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n },\n indexes: [{ name: 'factory_work_items_org_project_idx', columns: ['org_id', 'factory_project_id'] }],\n};\n\n/** Several external records can describe one work item. Native work has no source. */\nexport const FACTORY_WORK_ITEM_SOURCES_SCHEMA: CollectionSchema = {\n name: 'factory_work_item_sources',\n columns: {\n id: { type: 'uuid-pk' },\n org_id: { type: 'text' },\n factory_project_id: { type: 'text' },\n work_item_id: { type: 'text' },\n provider: { type: 'text' },\n integration_id: { type: 'text' },\n source_type: { type: 'text' },\n workspace_id: { type: 'text', nullable: true },\n external_id: { type: 'text' },\n source_key: { type: 'text', nullable: true },\n url: { type: 'text', nullable: true },\n key: { type: 'text', nullable: true },\n state: { type: 'text', nullable: true },\n labels: { type: 'json' },\n author: { type: 'text', nullable: true },\n metadata: { type: 'json', nullable: true },\n revision: { type: 'integer', default: 1 },\n synced_at: { type: 'timestamp', nullable: true },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'factory_work_item_sources_project_provider_external_unique',\n columns: ['org_id', 'factory_project_id', 'provider', 'external_id'],\n },\n ],\n indexes: [\n { name: 'factory_work_item_sources_work_item_idx', columns: ['work_item_id'] },\n { name: 'factory_work_item_sources_source_key_idx', columns: ['source_key'] },\n ],\n};\n\n/** Placement/process state. Its id preserves every legacy card reference. */\nexport const FACTORY_BOARD_ITEMS_SCHEMA: CollectionSchema = {\n name: 'factory_board_items',\n columns: {\n id: { type: 'uuid-pk' },\n org_id: { type: 'text' },\n factory_project_id: { type: 'text' },\n work_item_id: { type: 'text' },\n triage_type: { type: 'text', nullable: true },\n accepted_at: { type: 'timestamp', nullable: true },\n autonomy_armed_at: { type: 'timestamp', nullable: true },\n plans_preapproved_at: { type: 'timestamp', nullable: true },\n board: { type: 'text', nullable: true },\n parent_board_item_id: { type: 'text', nullable: true },\n stages: { type: 'json' },\n stage_history: { type: 'json' },\n sessions: { type: 'json' },\n metadata: { type: 'json', nullable: true },\n comment_count: { type: 'integer', default: 0 },\n feed_activity_at: { type: 'timestamp', nullable: true },\n revision: { type: 'integer', default: 1 },\n created_by: { type: 'text' },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n migrated_from_updated_at: { type: 'timestamp', nullable: true },\n migrated_from_hash: { type: 'text', nullable: true },\n },\n uniqueIndexes: [{ name: 'factory_board_items_work_item_unique', columns: ['work_item_id'] }],\n indexes: [\n {\n name: 'factory_board_items_org_project_created_at_id_idx',\n columns: ['org_id', 'factory_project_id', 'created_at', 'id'],\n },\n {\n name: 'factory_board_items_project_parent_idx',\n columns: ['org_id', 'factory_project_id', 'parent_board_item_id'],\n },\n ],\n};\n\nexport interface WorkItemDbRecord extends Record<string, unknown> {\n id: string;\n org_id: string;\n factory_project_id: string;\n title: string;\n parent_work_item_id: string | null;\n revision: number;\n created_at: Date;\n updated_at: Date;\n}\n\nexport interface WorkItemSourceDbRecord extends Record<string, unknown> {\n id: string;\n org_id: string;\n factory_project_id: string;\n work_item_id: string;\n provider: WorkItemProvider;\n integration_id: string;\n source_type: string;\n workspace_id: string | null;\n external_id: string;\n source_key: string | null;\n url: string | null;\n key: string | null;\n state: string | null;\n labels: string[];\n author: string | null;\n metadata: Record<string, unknown> | null;\n revision: number;\n synced_at: Date | null;\n created_at: Date;\n updated_at: Date;\n}\n\nexport interface WorkItemSourceRow {\n id: string;\n workItemId: string;\n provider: WorkItemProvider;\n integrationId: string;\n sourceType: string;\n workspaceId: string | null;\n externalId: string;\n sourceKey: string | null;\n key: string | null;\n url: string | null;\n state: string | null;\n labels: string[];\n author: string | null;\n metadata: Record<string, unknown> | null;\n revision: number;\n syncedAt: Date | null;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport function primarySource(card: { workItem: { sources: readonly WorkItemSourceRow[] } }): WorkItemSourceRow | null {\n return card.workItem.sources[0] ?? null;\n}\n\nexport interface WorkItemRow {\n sources: WorkItemSourceRow[];\n id: string;\n orgId: string;\n factoryProjectId: string;\n provider: WorkItemProvider;\n externalId: string;\n key: string | null;\n url: string | null;\n title: string;\n state: string | null;\n labels: string[];\n author: string | null;\n parentWorkItemId: string | null;\n metadata: Record<string, unknown> | null;\n revision: number;\n syncedAt: Date | null;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface BoardItemDbRecord extends Record<string, unknown> {\n id: string;\n org_id: string;\n factory_project_id: string;\n work_item_id: string;\n triage_type: FactoryTriageType | null;\n accepted_at: Date | null;\n autonomy_armed_at: Date | null;\n plans_preapproved_at: Date | null;\n board: string | null;\n parent_board_item_id: string | null;\n stages: string[];\n stage_history: unknown[];\n sessions: Record<string, unknown>;\n metadata: Record<string, unknown> | null;\n comment_count: number;\n feed_activity_at: Date | null;\n revision: number;\n created_by: string;\n created_at: Date;\n updated_at: Date;\n migrated_from_updated_at: Date | null;\n migrated_from_hash: string | null;\n}\n\n/** Serializes first-copy migration with deletion without locking an entire project's cards. */\nexport const FACTORY_WORK_ITEM_SPLIT_LOCKS_SCHEMA: CollectionSchema = {\n name: 'factory_work_item_split_locks',\n columns: {\n id: { type: 'uuid-pk' },\n org_id: { type: 'text' },\n factory_project_id: { type: 'text' },\n },\n};\n\n/** Deleted card ids prevent the boot migration resurrecting frozen legacy rows. */\nexport const FACTORY_BOARD_ITEM_TOMBSTONES_SCHEMA: CollectionSchema = {\n name: 'factory_board_item_tombstones',\n columns: {\n id: { type: 'uuid-pk' },\n org_id: { type: 'text' },\n factory_project_id: { type: 'text' },\n },\n};\n\n/** The pre-split card table. Frozen: only the split migration reads it. */\nexport const WORK_ITEMS_SCHEMA: CollectionSchema = {\n name: 'work_items',\n columns: {\n id: { type: 'uuid-pk' },\n org_id: { type: 'text' },\n factory_project_id: { type: 'text' },\n board: { type: 'text', nullable: true },\n external_source: { type: 'json', nullable: true },\n source_key: { type: 'text', nullable: true },\n // Retained for existing tables; claims no longer govern work-item identity.\n claim_key: { type: 'text', nullable: true },\n parent_work_item_id: { type: 'text', nullable: true },\n title: { type: 'text' },\n stages: { type: 'json' },\n stage_history: { type: 'json' },\n sessions: { type: 'json' },\n metadata: { type: 'json', nullable: true },\n triage_type: { type: 'text', nullable: true },\n autonomy_armed_at: { type: 'timestamp', nullable: true },\n // Retired hands-off plan grant: plans are approved per board (`exitTool`).\n plans_preapproved_at: { type: 'timestamp', nullable: true },\n accepted_at: { type: 'timestamp', nullable: true },\n comment_count: { type: 'integer', default: 0 },\n feed_activity_at: { type: 'timestamp', nullable: true },\n revision: { type: 'integer', default: 1 },\n created_by: { type: 'text' },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'work_items_project_source_key_unique',\n columns: ['factory_project_id', 'source_key'],\n },\n {\n // One live card per claimed external record per org. NULL keys never\n // collide, so unclaimed cards are unaffected.\n name: 'work_items_org_claim_key_unique',\n columns: ['org_id', 'claim_key'],\n },\n ],\n indexes: [\n {\n name: 'work_items_org_project_created_at_id_idx',\n columns: ['org_id', 'factory_project_id', 'created_at', 'id'],\n },\n {\n name: 'work_items_project_parent_idx',\n columns: ['org_id', 'factory_project_id', 'parent_work_item_id'],\n },\n {\n // The unique index leads with `factory_project_id`, so it cannot serve a\n // lookup by the key alone — which is what a platform message has.\n name: 'work_items_source_key_idx',\n columns: ['source_key'],\n },\n {\n // Finds the newest legacy write without a scan, so a finished split can be confirmed at boot.\n name: 'work_items_updated_at_id_idx',\n columns: ['updated_at', 'id'],\n },\n ],\n};\n\n/** Records the newest legacy row a finished split pass covered; later boots skip unchanged legacy tables. */\nexport const FACTORY_WORK_ITEM_SPLIT_STATE_SCHEMA: CollectionSchema = {\n name: 'factory_work_item_split_state',\n columns: {\n id: { type: 'text', primaryKey: true },\n legacy_updated_at: { type: 'timestamp', nullable: true },\n legacy_id: { type: 'text', nullable: true },\n completed_at: { type: 'timestamp' },\n },\n};\n"],"mappings":";;AAeA,MAAa,4BAA8C;CACzD,MAAM;CACN,SAAS;EACP,IAAI,EAAE,MAAM,UAAU;EACtB,QAAQ,EAAE,MAAM,OAAO;EACvB,oBAAoB,EAAE,MAAM,OAAO;EACnC,OAAO,EAAE,MAAM,OAAO;EACtB,qBAAqB;GAAE,MAAM;GAAQ,UAAU;EAAK;EACpD,UAAU;GAAE,MAAM;GAAW,SAAS;EAAE;EACxC,YAAY,EAAE,MAAM,YAAY;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EAC9D;EACA;GACE,MAAM;GACN,SAAS;IAAC;IAAU;IAAsB;GAAqB;EACjE;EACA;GAGE,MAAM;GACN,SAAS,CAAC,YAAY;EACxB;EACA;GAEE,MAAM;GACN,SAAS,CAAC,cAAc,IAAI;EAC9B;CACF;AACF;;AAGA,MAAa,uCAAyD;CACpE,MAAM;CACN,SAAS;EACP,IAAI;GAAE,MAAM;GAAQ,YAAY;EAAK;EACrC,mBAAmB;GAAE,MAAM;GAAa,UAAU;EAAK;EACvD,WAAW;GAAE,MAAM;GAAQ,UAAU;EAAK;EAC1C,cAAc,EAAE,MAAM,YAAY;CACpC;AACF"}
|
|
1
|
+
{"version":3,"file":"work-item-schema.js","names":[],"sources":["../../../../src/storage/domains/work-items/work-item-schema.ts"],"sourcesContent":["import type { CollectionSchema } from '@mastra/core/storage';\n\nimport type { FactoryTriageType } from '../../../rules/types.js';\n\nexport type WorkItemProvider =\n | 'github'\n | 'gitlab'\n | 'jira'\n | 'linear'\n | 'slack'\n | 'incidentio'\n | 'factory'\n | (string & {});\n\n/** The work itself; external identities and facts belong to its sources. */\nexport const FACTORY_WORK_ITEMS_SCHEMA: CollectionSchema = {\n name: 'factory_work_items',\n columns: {\n id: { type: 'uuid-pk' },\n org_id: { type: 'text' },\n factory_project_id: { type: 'text' },\n title: { type: 'text' },\n description: { type: 'text', nullable: true },\n parent_work_item_id: { type: 'text', nullable: true },\n revision: { type: 'integer', default: 1 },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n },\n indexes: [{ name: 'factory_work_items_org_project_idx', columns: ['org_id', 'factory_project_id'] }],\n};\n\n/** Several external records can describe one work item. Native work has no source. */\nexport const FACTORY_WORK_ITEM_SOURCES_SCHEMA: CollectionSchema = {\n name: 'factory_work_item_sources',\n columns: {\n id: { type: 'uuid-pk' },\n org_id: { type: 'text' },\n factory_project_id: { type: 'text' },\n work_item_id: { type: 'text' },\n provider: { type: 'text' },\n integration_id: { type: 'text' },\n source_type: { type: 'text' },\n workspace_id: { type: 'text', nullable: true },\n external_id: { type: 'text' },\n source_key: { type: 'text', nullable: true },\n url: { type: 'text', nullable: true },\n key: { type: 'text', nullable: true },\n state: { type: 'text', nullable: true },\n labels: { type: 'json' },\n author: { type: 'text', nullable: true },\n metadata: { type: 'json', nullable: true },\n /** `origin` for the record the work item was created from, `attached` for one added later. Null (rows written before this column) reads as `origin`. */\n role: { type: 'text', nullable: true },\n revision: { type: 'integer', default: 1 },\n synced_at: { type: 'timestamp', nullable: true },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'factory_work_item_sources_project_provider_external_unique',\n columns: ['org_id', 'factory_project_id', 'provider', 'external_id'],\n },\n ],\n indexes: [\n { name: 'factory_work_item_sources_work_item_idx', columns: ['work_item_id'] },\n { name: 'factory_work_item_sources_source_key_idx', columns: ['source_key'] },\n ],\n};\n\n/** Placement/process state. Its id preserves every legacy card reference. */\nexport const FACTORY_BOARD_ITEMS_SCHEMA: CollectionSchema = {\n name: 'factory_board_items',\n columns: {\n id: { type: 'uuid-pk' },\n org_id: { type: 'text' },\n factory_project_id: { type: 'text' },\n work_item_id: { type: 'text' },\n triage_type: { type: 'text', nullable: true },\n accepted_at: { type: 'timestamp', nullable: true },\n autonomy_armed_at: { type: 'timestamp', nullable: true },\n plans_preapproved_at: { type: 'timestamp', nullable: true },\n board: { type: 'text', nullable: true },\n parent_board_item_id: { type: 'text', nullable: true },\n stages: { type: 'json' },\n stage_history: { type: 'json' },\n sessions: { type: 'json' },\n metadata: { type: 'json', nullable: true },\n revision: { type: 'integer', default: 1 },\n created_by: { type: 'text' },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n migrated_from_updated_at: { type: 'timestamp', nullable: true },\n migrated_from_hash: { type: 'text', nullable: true },\n /** Moves on every change to the card, in any of its tables; board reloads read rows changed since. */\n changed_at: { type: 'timestamp', nullable: true },\n },\n uniqueIndexes: [{ name: 'factory_board_items_work_item_unique', columns: ['work_item_id'] }],\n indexes: [\n {\n name: 'factory_board_items_project_changed_at_idx',\n columns: ['org_id', 'factory_project_id', 'changed_at'],\n },\n {\n name: 'factory_board_items_org_project_created_at_id_idx',\n columns: ['org_id', 'factory_project_id', 'created_at', 'id'],\n },\n {\n name: 'factory_board_items_project_parent_idx',\n columns: ['org_id', 'factory_project_id', 'parent_board_item_id'],\n },\n ],\n};\n\nexport interface WorkItemDbRecord extends Record<string, unknown> {\n id: string;\n org_id: string;\n factory_project_id: string;\n title: string;\n description: string | null;\n parent_work_item_id: string | null;\n revision: number;\n created_at: Date;\n updated_at: Date;\n}\n\nexport interface WorkItemSourceDbRecord extends Record<string, unknown> {\n id: string;\n org_id: string;\n factory_project_id: string;\n work_item_id: string;\n provider: WorkItemProvider;\n integration_id: string;\n source_type: string;\n workspace_id: string | null;\n external_id: string;\n source_key: string | null;\n url: string | null;\n key: string | null;\n state: string | null;\n labels: string[];\n author: string | null;\n metadata: Record<string, unknown> | null;\n role?: WorkItemSourceRole | null;\n revision: number;\n synced_at: Date | null;\n created_at: Date;\n updated_at: Date;\n}\n\nexport type WorkItemSourceRole = 'origin' | 'attached';\n\nexport interface WorkItemSourceRow {\n id: string;\n workItemId: string;\n provider: WorkItemProvider;\n integrationId: string;\n sourceType: string;\n workspaceId: string | null;\n externalId: string;\n sourceKey: string | null;\n key: string | null;\n url: string | null;\n state: string | null;\n labels: string[];\n author: string | null;\n metadata: Record<string, unknown> | null;\n revision: number;\n syncedAt: Date | null;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport function primarySource(card: { workItem: { sources: readonly WorkItemSourceRow[] } }): WorkItemSourceRow | null {\n return card.workItem.sources[0] ?? null;\n}\n\nexport interface WorkItemRow {\n sources: WorkItemSourceRow[];\n id: string;\n orgId: string;\n factoryProjectId: string;\n provider: WorkItemProvider;\n externalId: string;\n key: string | null;\n url: string | null;\n title: string;\n state: string | null;\n labels: string[];\n author: string | null;\n parentWorkItemId: string | null;\n metadata: Record<string, unknown> | null;\n revision: number;\n syncedAt: Date | null;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface BoardItemDbRecord extends Record<string, unknown> {\n id: string;\n org_id: string;\n factory_project_id: string;\n work_item_id: string;\n triage_type: FactoryTriageType | null;\n accepted_at: Date | null;\n autonomy_armed_at: Date | null;\n plans_preapproved_at: Date | null;\n board: string | null;\n parent_board_item_id: string | null;\n stages: string[];\n stage_history: unknown[];\n sessions: Record<string, unknown>;\n metadata: Record<string, unknown> | null;\n revision: number;\n created_by: string;\n created_at: Date;\n updated_at: Date;\n migrated_from_updated_at: Date | null;\n migrated_from_hash: string | null;\n changed_at?: Date | null;\n}\n\n/** Serializes first-copy migration with deletion without locking an entire project's cards. */\nexport const FACTORY_WORK_ITEM_SPLIT_LOCKS_SCHEMA: CollectionSchema = {\n name: 'factory_work_item_split_locks',\n columns: {\n id: { type: 'uuid-pk' },\n org_id: { type: 'text' },\n factory_project_id: { type: 'text' },\n },\n};\n\n/** Deleted card ids prevent the boot migration resurrecting frozen legacy rows. */\nexport const FACTORY_BOARD_ITEM_TOMBSTONES_SCHEMA: CollectionSchema = {\n name: 'factory_board_item_tombstones',\n columns: {\n id: { type: 'uuid-pk' },\n org_id: { type: 'text' },\n factory_project_id: { type: 'text' },\n deleted_at: { type: 'timestamp', nullable: true },\n },\n indexes: [\n {\n name: 'factory_board_item_tombstones_project_deleted_at_idx',\n columns: ['org_id', 'factory_project_id', 'deleted_at'],\n },\n ],\n};\n\n/** The pre-split card table. Frozen: only the split migration reads it. */\nexport const WORK_ITEMS_SCHEMA: CollectionSchema = {\n name: 'work_items',\n columns: {\n id: { type: 'uuid-pk' },\n org_id: { type: 'text' },\n factory_project_id: { type: 'text' },\n board: { type: 'text', nullable: true },\n external_source: { type: 'json', nullable: true },\n source_key: { type: 'text', nullable: true },\n // Retained for existing tables; claims no longer govern work-item identity.\n claim_key: { type: 'text', nullable: true },\n parent_work_item_id: { type: 'text', nullable: true },\n title: { type: 'text' },\n description: { type: 'text', nullable: true },\n stages: { type: 'json' },\n stage_history: { type: 'json' },\n sessions: { type: 'json' },\n metadata: { type: 'json', nullable: true },\n triage_type: { type: 'text', nullable: true },\n autonomy_armed_at: { type: 'timestamp', nullable: true },\n // Retired hands-off plan grant: plans are approved per board (`exitTool`).\n plans_preapproved_at: { type: 'timestamp', nullable: true },\n accepted_at: { type: 'timestamp', nullable: true },\n // Retired comment summaries: kept so replicas still on the old release can write them.\n comment_count: { type: 'integer', default: 0 },\n feed_activity_at: { type: 'timestamp', nullable: true },\n revision: { type: 'integer', default: 1 },\n created_by: { type: 'text' },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'work_items_project_source_key_unique',\n columns: ['factory_project_id', 'source_key'],\n },\n {\n // One live card per claimed external record per org. NULL keys never\n // collide, so unclaimed cards are unaffected.\n name: 'work_items_org_claim_key_unique',\n columns: ['org_id', 'claim_key'],\n },\n ],\n indexes: [\n {\n name: 'work_items_org_project_created_at_id_idx',\n columns: ['org_id', 'factory_project_id', 'created_at', 'id'],\n },\n {\n name: 'work_items_project_parent_idx',\n columns: ['org_id', 'factory_project_id', 'parent_work_item_id'],\n },\n {\n // The unique index leads with `factory_project_id`, so it cannot serve a\n // lookup by the key alone — which is what a platform message has.\n name: 'work_items_source_key_idx',\n columns: ['source_key'],\n },\n {\n // Finds the newest legacy write without a scan, so a finished split can be confirmed at boot.\n name: 'work_items_updated_at_id_idx',\n columns: ['updated_at', 'id'],\n },\n ],\n};\n\n/** Records the newest legacy row a finished split pass covered; later boots skip unchanged legacy tables. */\nexport const FACTORY_WORK_ITEM_SPLIT_STATE_SCHEMA: CollectionSchema = {\n name: 'factory_work_item_split_state',\n columns: {\n id: { type: 'text', primaryKey: true },\n legacy_updated_at: { type: 'timestamp', nullable: true },\n legacy_id: { type: 'text', nullable: true },\n completed_at: { type: 'timestamp' },\n },\n};\n"],"mappings":";;AAeA,MAAa,4BAA8C;CACzD,MAAM;CACN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EAAK;EAEvD,sBAAsB;GAAE,MAAM;GAAa,UAAU;EAAK;EAC1D,aAAa;GAAE,MAAM;GAAa,UAAU;EAAK;EAEjD,eAAe;GAAE,MAAM;GAAW,SAAS;EAAE;EAC7C,kBAAkB;GAAE,MAAM;GAAa,UAAU;EAAK;EACtD,UAAU;GAAE,MAAM;GAAW,SAAS;EAAE;EACxC,YAAY,EAAE,MAAM,OAAO;EAC3B,YAAY,EAAE,MAAM,YAAY;EAChC,YAAY,EAAE,MAAM,YAAY;CAClC;CACA,eAAe,CACb;EACE,MAAM;EACN,SAAS,CAAC,sBAAsB,YAAY;CAC9C,GACA;EAGE,MAAM;EACN,SAAS,CAAC,UAAU,WAAW;CACjC,CACF;CACA,SAAS;EACP;GACE,MAAM;GACN,SAAS;IAAC;IAAU;IAAsB;IAAc;GAAI;EAC9D;EACA;GACE,MAAM;GACN,SAAS;IAAC;IAAU;IAAsB;GAAqB;EACjE;EACA;GAGE,MAAM;GACN,SAAS,CAAC,YAAY;EACxB;EACA;GAEE,MAAM;GACN,SAAS,CAAC,cAAc,IAAI;EAC9B;CACF;AACF;;AAGA,MAAa,uCAAyD;CACpE,MAAM;CACN,SAAS;EACP,IAAI;GAAE,MAAM;GAAQ,YAAY;EAAK;EACrC,mBAAmB;GAAE,MAAM;GAAa,UAAU;EAAK;EACvD,WAAW;GAAE,MAAM;GAAQ,UAAU;EAAK;EAC1C,cAAc,EAAE,MAAM,YAAY;CACpC;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approval-tools.d.ts","sourceRoot":"","sources":["../../src/tools/approval-tools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"approval-tools.d.ts","sourceRoot":"","sources":["../../src/tools/approval-tools.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,EAAE,IAAI,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,CAAC;IAC7D,SAAS,EAAE,IAAI,CAAC,gBAAgB,EAAE,gCAAgC,GAAG,0BAA0B,CAAC,CAAC;IACjG,aAAa,EAAE,aAAa,CAAC;IAC7B,SAAS,EAAE,MAAM,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;CACnD;AAkBD,yGAAyG;AACzG,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,gBAAgB,EACvB,IAAI,EAAE,+BAA+B,GACpC,gBAAgB,CAoGlB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { requirePerson } from "./scope.js";
|
|
2
|
-
import {
|
|
2
|
+
import { RequestContext } from "@mastra/core/request-context";
|
|
3
3
|
import { createTool } from "@mastra/core/tools";
|
|
4
|
+
import { z } from "zod";
|
|
4
5
|
// src/tools/approval-tools.ts
|
|
5
6
|
/** Answers a tool call another session holds for approval. Only a signed-in person's turn may answer. */
|
|
6
7
|
function createFactoryApprovalTools(scope, deps) {
|
|
@@ -8,7 +9,8 @@ function createFactoryApprovalTools(scope, deps) {
|
|
|
8
9
|
id: "factory_answer_approval",
|
|
9
10
|
description: [
|
|
10
11
|
"Approve or decline a tool call a session you follow is waiting on, as you.",
|
|
11
|
-
"A `factory-session` notification of kind `approval` names the session, tool, arguments and toolCallId
|
|
12
|
+
"A `factory-session` notification of kind `approval` names the session, tool, arguments and toolCallId;",
|
|
13
|
+
"a `blocked` notice for a session parked on submit_plan names the toolCallId of the plan to approve or decline.",
|
|
12
14
|
"Answer only what the person in this conversation agreed to; decline with a reason the session will see."
|
|
13
15
|
].join(" "),
|
|
14
16
|
inputSchema: z.object({
|
|
@@ -37,13 +39,30 @@ function createFactoryApprovalTools(scope, deps) {
|
|
|
37
39
|
const messaging = await deps.messaging();
|
|
38
40
|
if (!messaging) throw new Error("Answering approvals is not available on this server.");
|
|
39
41
|
const live = await messaging.controller.getSession(sessionId);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
const parkedPlan = live?.suspensions.resolve({ toolCallId })?.toolName === "submit_plan";
|
|
43
|
+
if (!live || !parkedPlan && !live.approval.isArmed({ toolCallId })) throw new Error("Nothing is waiting on that tool call any more: the run that asked has ended or it was already answered. Message the session with factory_signal_session if it should try again.");
|
|
44
|
+
if (parkedPlan) {
|
|
45
|
+
const requestContext = new RequestContext();
|
|
46
|
+
requestContext.set("user", {
|
|
47
|
+
workosId: scope.userId,
|
|
48
|
+
organizationId: scope.orgId
|
|
49
|
+
});
|
|
50
|
+
await live.respondToToolSuspension({
|
|
51
|
+
resumeData: decision === "approve" ? { action: "approved" } : {
|
|
52
|
+
action: "rejected",
|
|
53
|
+
feedback: reason ?? "Declined by a session following it."
|
|
54
|
+
},
|
|
55
|
+
toolCallId,
|
|
56
|
+
requestContext
|
|
57
|
+
});
|
|
58
|
+
} else {
|
|
59
|
+
const result = live.respondToToolApproval({
|
|
60
|
+
decision,
|
|
61
|
+
toolCallId,
|
|
62
|
+
...decision === "decline" ? { declineContext: { reason: reason ?? "Declined by a session following it." } } : {}
|
|
63
|
+
});
|
|
64
|
+
if (!result.accepted) throw new Error(`The answer was not accepted (${result.reason}).`);
|
|
65
|
+
}
|
|
47
66
|
deps.auditRecorder.record({
|
|
48
67
|
orgId: scope.orgId,
|
|
49
68
|
actorId: scope.userId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approval-tools.js","names":[],"sources":["../../src/tools/approval-tools.ts"],"sourcesContent":["import { createTool } from '@mastra/core/tools';\nimport { z } from 'zod';\n\nimport type { IntegrationTools } from '../integrations/base.js';\nimport type { SourceControlSessionLookup } from '../session/factory-session.js';\nimport type { AuditRecorder } from '../storage/domains/audit/domain.js';\nimport type { WorkItemsStorage } from '../storage/domains/work-items/base.js';\nimport type { FactoryMessaging } from './messaging-tools.js';\nimport { requirePerson } from './scope.js';\nimport type { FactoryToolScope } from './scope.js';\n\nexport interface FactoryApprovalToolDependencies {\n sessions: Pick<SourceControlSessionLookup, 'getBySessionId'>;\n workItems: Pick<WorkItemsStorage, 'findActiveRunBindingForSession' | 'listSessionSubscriptions'>;\n auditRecorder: AuditRecorder;\n messaging: () => Promise<FactoryMessaging | null>;\n}\n\n/** The parts of a live session an answer needs: its open approval gates. */\ninterface ApprovalGateSession {\n approval: { isArmed(filter: { toolCallId: string }): boolean };\n respondToToolApproval(input: {\n decision: 'approve' | 'decline';\n toolCallId: string;\n declineContext?: { reason?: string };\n }): { accepted: true } | { accepted: false; reason: string };\n}\n\n/** Answers a tool call another session holds for approval. Only a signed-in person's turn may answer. */\nexport function createFactoryApprovalTools(\n scope: FactoryToolScope,\n deps: FactoryApprovalToolDependencies,\n): IntegrationTools {\n const answer = createTool({\n id: 'factory_answer_approval',\n description: [\n 'Approve or decline a tool call a session you follow is waiting on, as you.',\n 'A `factory-session` notification of kind `approval` names the session, tool, arguments and toolCallId.',\n 'Answer only what the person in this conversation agreed to; decline with a reason the session will see.',\n ].join(' '),\n inputSchema: z\n .object({\n sessionId: z.string().uuid().describe('The session holding the call, from the approval notice.'),\n toolCallId: z.string().trim().min(1).max(200),\n decision: z.enum(['approve', 'decline']),\n reason: z.string().trim().min(1).max(1000).optional().describe('Why, when declining.'),\n })\n .strict(),\n execute: async ({ sessionId, toolCallId, decision, reason }) => {\n requirePerson(scope, 'answer an approval');\n const row = await deps.sessions.getBySessionId(sessionId);\n if (!row || row.orgId !== scope.orgId || row.factoryProjectId !== scope.factoryProjectId) {\n throw new Error(`Session ${sessionId} was not found in this Factory.`);\n }\n if (row.visibility === 'private' && row.userId !== scope.userId) {\n throw new Error(`Session ${sessionId} is private to its owner.`);\n }\n\n // Only the sessions it reports to may answer it: its origin, or followers of its item.\n const binding = await deps.workItems.findActiveRunBindingForSession({\n orgId: scope.orgId,\n factoryProjectId: scope.factoryProjectId,\n sessionId,\n });\n const isOrigin = row.originSessionId === scope.sessionId;\n const follows =\n binding !== null &&\n (\n await deps.workItems.listSessionSubscriptions({\n orgId: scope.orgId,\n factoryProjectId: scope.factoryProjectId,\n sessionId: scope.sessionId,\n })\n ).some(subscription => subscription.workItemId === binding.workItemId);\n if (!isOrigin && !follows) {\n throw new Error(\n `This session doesn't follow session ${sessionId}: follow its work item first, or answer from that session.`,\n );\n }\n\n const messaging = await deps.messaging();\n if (!messaging) throw new Error('Answering approvals is not available on this server.');\n const live = (await messaging.controller.getSession(sessionId)) as ApprovalGateSession | null;\n if (!live
|
|
1
|
+
{"version":3,"file":"approval-tools.js","names":[],"sources":["../../src/tools/approval-tools.ts"],"sourcesContent":["import { RequestContext } from '@mastra/core/request-context';\nimport { createTool } from '@mastra/core/tools';\nimport { z } from 'zod';\n\nimport type { IntegrationTools } from '../integrations/base.js';\nimport type { SourceControlSessionLookup } from '../session/factory-session.js';\nimport type { AuditRecorder } from '../storage/domains/audit/domain.js';\nimport type { WorkItemsStorage } from '../storage/domains/work-items/base.js';\nimport type { FactoryMessaging } from './messaging-tools.js';\nimport { requirePerson } from './scope.js';\nimport type { FactoryToolScope } from './scope.js';\n\nexport interface FactoryApprovalToolDependencies {\n sessions: Pick<SourceControlSessionLookup, 'getBySessionId'>;\n workItems: Pick<WorkItemsStorage, 'findActiveRunBindingForSession' | 'listSessionSubscriptions'>;\n auditRecorder: AuditRecorder;\n messaging: () => Promise<FactoryMessaging | null>;\n}\n\n/** The parts of a live session an answer needs: its open approval gates. */\ninterface ApprovalGateSession {\n approval: { isArmed(filter: { toolCallId: string }): boolean };\n respondToToolApproval(input: {\n decision: 'approve' | 'decline';\n toolCallId: string;\n declineContext?: { reason?: string };\n }): { accepted: true } | { accepted: false; reason: string };\n suspensions: { resolve(filter: { toolCallId: string }): { toolName: string } | undefined };\n respondToToolSuspension(input: {\n resumeData: { action: 'approved' | 'rejected'; feedback?: string };\n toolCallId: string;\n requestContext?: RequestContext;\n }): Promise<void>;\n}\n\n/** Answers a tool call another session holds for approval. Only a signed-in person's turn may answer. */\nexport function createFactoryApprovalTools(\n scope: FactoryToolScope,\n deps: FactoryApprovalToolDependencies,\n): IntegrationTools {\n const answer = createTool({\n id: 'factory_answer_approval',\n description: [\n 'Approve or decline a tool call a session you follow is waiting on, as you.',\n 'A `factory-session` notification of kind `approval` names the session, tool, arguments and toolCallId;',\n 'a `blocked` notice for a session parked on submit_plan names the toolCallId of the plan to approve or decline.',\n 'Answer only what the person in this conversation agreed to; decline with a reason the session will see.',\n ].join(' '),\n inputSchema: z\n .object({\n sessionId: z.string().uuid().describe('The session holding the call, from the approval notice.'),\n toolCallId: z.string().trim().min(1).max(200),\n decision: z.enum(['approve', 'decline']),\n reason: z.string().trim().min(1).max(1000).optional().describe('Why, when declining.'),\n })\n .strict(),\n execute: async ({ sessionId, toolCallId, decision, reason }) => {\n requirePerson(scope, 'answer an approval');\n const row = await deps.sessions.getBySessionId(sessionId);\n if (!row || row.orgId !== scope.orgId || row.factoryProjectId !== scope.factoryProjectId) {\n throw new Error(`Session ${sessionId} was not found in this Factory.`);\n }\n if (row.visibility === 'private' && row.userId !== scope.userId) {\n throw new Error(`Session ${sessionId} is private to its owner.`);\n }\n\n // Only the sessions it reports to may answer it: its origin, or followers of its item.\n const binding = await deps.workItems.findActiveRunBindingForSession({\n orgId: scope.orgId,\n factoryProjectId: scope.factoryProjectId,\n sessionId,\n });\n const isOrigin = row.originSessionId === scope.sessionId;\n const follows =\n binding !== null &&\n (\n await deps.workItems.listSessionSubscriptions({\n orgId: scope.orgId,\n factoryProjectId: scope.factoryProjectId,\n sessionId: scope.sessionId,\n })\n ).some(subscription => subscription.workItemId === binding.workItemId);\n if (!isOrigin && !follows) {\n throw new Error(\n `This session doesn't follow session ${sessionId}: follow its work item first, or answer from that session.`,\n );\n }\n\n const messaging = await deps.messaging();\n if (!messaging) throw new Error('Answering approvals is not available on this server.');\n const live = (await messaging.controller.getSession(sessionId)) as ApprovalGateSession | null;\n const parkedPlan = live?.suspensions.resolve({ toolCallId })?.toolName === 'submit_plan';\n if (!live || (!parkedPlan && !live.approval.isArmed({ toolCallId }))) {\n throw new Error(\n 'Nothing is waiting on that tool call any more: the run that asked has ended or it was already answered. ' +\n 'Message the session with factory_signal_session if it should try again.',\n );\n }\n if (parkedPlan) {\n // The resumed run acts for the person answering, so it can resolve their model credentials.\n const requestContext = new RequestContext();\n requestContext.set('user', { workosId: scope.userId, organizationId: scope.orgId });\n await live.respondToToolSuspension({\n resumeData:\n decision === 'approve'\n ? { action: 'approved' }\n : { action: 'rejected', feedback: reason ?? 'Declined by a session following it.' },\n toolCallId,\n requestContext,\n });\n } else {\n const result = live.respondToToolApproval({\n decision,\n toolCallId,\n ...(decision === 'decline'\n ? { declineContext: { reason: reason ?? 'Declined by a session following it.' } }\n : {}),\n });\n if (!result.accepted) throw new Error(`The answer was not accepted (${result.reason}).`);\n }\n\n deps.auditRecorder.record({\n orgId: scope.orgId,\n actorId: scope.userId,\n actorType: 'human',\n ...(scope.actorProfile ? { actorProfile: scope.actorProfile } : {}),\n action: decision === 'approve' ? 'factory.run.approved' : 'factory.run.dismissed',\n factoryProjectId: scope.factoryProjectId,\n targets: [\n { type: 'session', id: sessionId },\n ...(binding ? [{ type: 'work_item' as const, id: binding.workItemId }] : []),\n ],\n metadata: { toolCallId, sessionId, decision, cause: 'factory_tools' },\n });\n return { answered: decision, sessionId, toolCallId };\n },\n });\n\n return { factory_answer_approval: answer };\n}\n"],"mappings":";;;;;;AAoCA,SAAgB,2BACd,OACA,MACkB;CAmGlB,OAAO,EAAE,yBAlGM,W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ools/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export interface CreateFactoryToolsOptions {
|
|
|
22
22
|
* Worker and side sessions only answer messages. User sessions get every tool
|
|
23
23
|
* on every turn. Turns nobody signed in started (notification wakes, webhooks,
|
|
24
24
|
* dispatcher notices) carry text other people wrote, so each tool limits what
|
|
25
|
-
* it does on them itself: approvals, proposals
|
|
25
|
+
* it does on them itself: approvals, proposals and muting
|
|
26
26
|
* side sessions need a person, moves run as an agent, model switches reach
|
|
27
27
|
* only this session and its side sessions, and starts are side sessions only.
|
|
28
28
|
*/
|
package/dist/tools/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import { resolveFactoryToolScope } from "./scope.js";
|
|
|
15
15
|
* Worker and side sessions only answer messages. User sessions get every tool
|
|
16
16
|
* on every turn. Turns nobody signed in started (notification wakes, webhooks,
|
|
17
17
|
* dispatcher notices) carry text other people wrote, so each tool limits what
|
|
18
|
-
* it does on them itself: approvals, proposals
|
|
18
|
+
* it does on them itself: approvals, proposals and muting
|
|
19
19
|
* side sessions need a person, moves run as an agent, model switches reach
|
|
20
20
|
* only this session and its side sessions, and starts are side sessions only.
|
|
21
21
|
*/
|
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/tools/index.ts"],"sourcesContent":["import type { IntegrationTools } from '../integrations/base.js';\nimport { createFactoryApprovalTools } from './approval-tools.js';\nimport type { FactoryApprovalToolDependencies } from './approval-tools.js';\nimport { createFactoryMessagingTools } from './messaging-tools.js';\nimport type { FactoryMessagingToolDependencies } from './messaging-tools.js';\nimport { createFactoryReadTools } from './read-tools.js';\nimport type { FactoryReadToolDependencies } from './read-tools.js';\nimport type { FactoryToolScope } from './scope.js';\nimport { createFactorySessionTools } from './session-tools.js';\nimport type { FactorySessionToolDependencies } from './session-tools.js';\nimport { createFactoryWorkItemTools } from './work-item-tools.js';\nimport type { FactoryWorkItemToolDependencies } from './work-item-tools.js';\n\nexport { FACTORY_TOOLS_WITHOUT_APPROVAL, applyFactoryToolPermissions } from './permissions.js';\nexport { FACTORY_INTERACTIVE_KEY, resolveFactoryToolScope } from './scope.js';\nexport type { FactoryToolScope } from './scope.js';\n\n/** Storage and services the Factory tools act through. */\nexport type FactoryToolDependencies = FactoryReadToolDependencies &\n FactoryWorkItemToolDependencies &\n FactoryMessagingToolDependencies &\n FactorySessionToolDependencies &\n FactoryApprovalToolDependencies;\n\nexport interface CreateFactoryToolsOptions {\n scope: FactoryToolScope;\n deps: FactoryToolDependencies;\n}\n\n/**\n * The Factory toolset for a resolved scope. Tools take scope and storage by\n * closure and never read the request context, so a non-session transport\n * (an MCP server) can mount the same set with a scope it resolved itself.\n *\n * Worker and side sessions only answer messages. User sessions get every tool\n * on every turn. Turns nobody signed in started (notification wakes, webhooks,\n * dispatcher notices) carry text other people wrote, so each tool limits what\n * it does on them itself: approvals, proposals
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/tools/index.ts"],"sourcesContent":["import type { IntegrationTools } from '../integrations/base.js';\nimport { createFactoryApprovalTools } from './approval-tools.js';\nimport type { FactoryApprovalToolDependencies } from './approval-tools.js';\nimport { createFactoryMessagingTools } from './messaging-tools.js';\nimport type { FactoryMessagingToolDependencies } from './messaging-tools.js';\nimport { createFactoryReadTools } from './read-tools.js';\nimport type { FactoryReadToolDependencies } from './read-tools.js';\nimport type { FactoryToolScope } from './scope.js';\nimport { createFactorySessionTools } from './session-tools.js';\nimport type { FactorySessionToolDependencies } from './session-tools.js';\nimport { createFactoryWorkItemTools } from './work-item-tools.js';\nimport type { FactoryWorkItemToolDependencies } from './work-item-tools.js';\n\nexport { FACTORY_TOOLS_WITHOUT_APPROVAL, applyFactoryToolPermissions } from './permissions.js';\nexport { FACTORY_INTERACTIVE_KEY, resolveFactoryToolScope } from './scope.js';\nexport type { FactoryToolScope } from './scope.js';\n\n/** Storage and services the Factory tools act through. */\nexport type FactoryToolDependencies = FactoryReadToolDependencies &\n FactoryWorkItemToolDependencies &\n FactoryMessagingToolDependencies &\n FactorySessionToolDependencies &\n FactoryApprovalToolDependencies;\n\nexport interface CreateFactoryToolsOptions {\n scope: FactoryToolScope;\n deps: FactoryToolDependencies;\n}\n\n/**\n * The Factory toolset for a resolved scope. Tools take scope and storage by\n * closure and never read the request context, so a non-session transport\n * (an MCP server) can mount the same set with a scope it resolved itself.\n *\n * Worker and side sessions only answer messages. User sessions get every tool\n * on every turn. Turns nobody signed in started (notification wakes, webhooks,\n * dispatcher notices) carry text other people wrote, so each tool limits what\n * it does on them itself: approvals, proposals and muting\n * side sessions need a person, moves run as an agent, model switches reach\n * only this session and its side sessions, and starts are side sessions only.\n */\nexport function createFactoryTools({ scope, deps }: CreateFactoryToolsOptions): IntegrationTools {\n const messagingTools = createFactoryMessagingTools(scope, deps);\n if (scope.kind !== 'user') return messagingTools;\n return {\n ...createFactoryReadTools(scope, deps),\n ...messagingTools,\n ...createFactoryWorkItemTools(scope, deps),\n ...createFactorySessionTools(scope, deps),\n ...createFactoryApprovalTools(scope, deps),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAyCA,SAAgB,mBAAmB,EAAE,OAAO,QAAqD;CAC/F,MAAM,iBAAiB,4BAA4B,OAAO,IAAI;CAC9D,IAAI,MAAM,SAAS,QAAQ,OAAO;CAClC,OAAO;EACL,GAAG,uBAAuB,OAAO,IAAI;EACrC,GAAG;EACH,GAAG,2BAA2B,OAAO,IAAI;EACzC,GAAG,0BAA0B,OAAO,IAAI;EACxC,GAAG,2BAA2B,OAAO,IAAI;CAC3C;AACF"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import type { NotificationsStorage } from '@mastra/core/notifications';
|
|
7
7
|
import type { IntegrationTools } from '../integrations/base.js';
|
|
8
8
|
import type { SourceControlSessionLookup } from '../session/factory-session.js';
|
|
9
|
+
import type { LiveSessions } from '../session/live-sessions.js';
|
|
9
10
|
import type { AuditRecorder } from '../storage/domains/audit/domain.js';
|
|
10
11
|
import type { WorkItemsStorage } from '../storage/domains/work-items/base.js';
|
|
11
12
|
import type { FactoryDeliveryController } from './deliver.js';
|
|
@@ -23,6 +24,8 @@ export interface FactoryMessagingToolDependencies {
|
|
|
23
24
|
auditRecorder: AuditRecorder;
|
|
24
25
|
/** The live controller and notifications store; resolved per call because they exist only once the mount is up. */
|
|
25
26
|
messaging: () => Promise<FactoryMessaging | null>;
|
|
27
|
+
/** Which live sessions are parked on a tool prompt; absent before the mount is up. */
|
|
28
|
+
liveSessions?: () => Pick<LiveSessions, 'parked' | 'parkedIn'> | undefined;
|
|
26
29
|
}
|
|
27
30
|
export declare function createFactoryMessagingTools(scope: FactoryToolScope, deps: FactoryMessagingToolDependencies): IntegrationTools;
|
|
28
31
|
//# sourceMappingURL=messaging-tools.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messaging-tools.d.ts","sourceRoot":"","sources":["../../src/tools/messaging-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAGV,oBAAoB,EAErB,MAAM,4BAA4B,CAAC;AAIpC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAExE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAM9E,OAAO,KAAK,EAAE,yBAAyB,EAAyB,MAAM,cAAc,CAAC;AAIrF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGnD,gFAAgF;AAChF,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,qBAAqB,QAAiB,CAAC;AAyCpD,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,yBAAyB,CAAC;IACtC,aAAa,EAAE,IAAI,CAAC,oBAA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AED,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,EAAE,IAAI,CAAC,0BAA0B,EAAE,gBAAgB,GAAG,cAAc,GAAG,gBAAgB,CAAC,CAAC;IACjG,SAAS,EAAE,IAAI,CACb,gBAAgB,EACd,gCAAgC,GAChC,eAAe,GACf,yBAAyB,GACzB,0BAA0B,GAC1B,iBAAiB,GACjB,yBAAyB,CAC5B,CAAC;IACF,aAAa,EAAE,aAAa,CAAC;IAC7B,mHAAmH;IACnH,SAAS,EAAE,MAAM,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IAClD,sFAAsF;IACtF,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC,YAAY,EAAE,QAAQ,GAAG,UAAU,CAAC,GAAG,SAAS,CAAC;CAC5E;AAgBD,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,gBAAgB,EACvB,IAAI,EAAE,gCAAgC,GACrC,gBAAgB,CAqhBlB"}
|
|
@@ -3,8 +3,8 @@ import { workItemNumber } from "./read-tools.js";
|
|
|
3
3
|
import { reportNotification, workItemReportAttributes, workItemReportRecipients } from "./reports.js";
|
|
4
4
|
import { requirePerson } from "./scope.js";
|
|
5
5
|
import { listSideSessions, sessionModel } from "./side-sessions.js";
|
|
6
|
-
import { z } from "zod";
|
|
7
6
|
import { createTool } from "@mastra/core/tools";
|
|
7
|
+
import { z } from "zod";
|
|
8
8
|
// src/tools/messaging-tools.ts
|
|
9
9
|
/** Messages plus replies, per sender session, per target thread, per window. */
|
|
10
10
|
const SIGNAL_RATE_LIMIT = 10;
|
|
@@ -459,6 +459,7 @@ function createFactoryMessagingTools(scope, deps) {
|
|
|
459
459
|
workItems: deps.workItems,
|
|
460
460
|
notifications: messaging?.notifications ?? null,
|
|
461
461
|
isRunning: async (sessionId) => (await messaging?.controller.getSession(sessionId))?.stream.isActive() ?? false,
|
|
462
|
+
isParked: (sessionId) => deps.liveSessions?.()?.parked(sessionId) !== void 0,
|
|
462
463
|
model: messaging ? (sessionId) => sessionModel(messaging.controller, deps.sessions, deps.workItems, sessionId) : void 0
|
|
463
464
|
}, scope)).filter((row) => (!state || row.state === state) && (muted === void 0 || row.mutedAt !== null === muted)) };
|
|
464
465
|
}
|