@mastra/factory 0.27.0-alpha.2 → 0.27.0-alpha.3

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.
Files changed (260) hide show
  1. package/README.md +94 -47
  2. package/dist/boards/card-facts.d.ts +4 -2
  3. package/dist/boards/card-facts.d.ts.map +1 -1
  4. package/dist/boards/card-facts.js +7 -4
  5. package/dist/boards/card-facts.js.map +1 -1
  6. package/dist/boards/define-board.d.ts +2 -0
  7. package/dist/boards/define-board.d.ts.map +1 -1
  8. package/dist/boards/define-board.js +1 -0
  9. package/dist/boards/define-board.js.map +1 -1
  10. package/dist/boards/intake-routing.d.ts +2 -2
  11. package/dist/boards/intake-routing.d.ts.map +1 -1
  12. package/dist/boards/intake-routing.js.map +1 -1
  13. package/dist/boards/phase-automation.d.ts +4 -4
  14. package/dist/boards/phase-automation.d.ts.map +1 -1
  15. package/dist/boards/phase-automation.js.map +1 -1
  16. package/dist/boards/pull-request-review.d.ts +0 -7
  17. package/dist/boards/pull-request-review.d.ts.map +1 -1
  18. package/dist/boards/pull-request-review.js +15 -14
  19. package/dist/boards/pull-request-review.js.map +1 -1
  20. package/dist/boards/relocate.d.ts +4 -4
  21. package/dist/boards/relocate.d.ts.map +1 -1
  22. package/dist/boards/relocate.js +1 -1
  23. package/dist/boards/relocate.js.map +1 -1
  24. package/dist/boards/review.d.ts.map +1 -1
  25. package/dist/boards/review.js +1 -2
  26. package/dist/boards/review.js.map +1 -1
  27. package/dist/boards/semantics.d.ts +8 -8
  28. package/dist/boards/semantics.d.ts.map +1 -1
  29. package/dist/boards/semantics.js.map +1 -1
  30. package/dist/boards/transition-policy.d.ts +7 -0
  31. package/dist/boards/transition-policy.d.ts.map +1 -1
  32. package/dist/boards/transition-policy.js.map +1 -1
  33. package/dist/boards/work.d.ts +6 -0
  34. package/dist/boards/work.d.ts.map +1 -1
  35. package/dist/boards/work.js +71 -25
  36. package/dist/boards/work.js.map +1 -1
  37. package/dist/factory.d.ts.map +1 -1
  38. package/dist/factory.js +6 -15
  39. package/dist/factory.js.map +1 -1
  40. package/dist/index.d.ts +3 -1
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +3 -2
  43. package/dist/integrations/github/acceptance-labels.d.ts +2 -2
  44. package/dist/integrations/github/acceptance-labels.d.ts.map +1 -1
  45. package/dist/integrations/github/acceptance-labels.js +2 -2
  46. package/dist/integrations/github/acceptance-labels.js.map +1 -1
  47. package/dist/integrations/github/default-rules.d.ts +5 -11
  48. package/dist/integrations/github/default-rules.d.ts.map +1 -1
  49. package/dist/integrations/github/default-rules.js +6 -22
  50. package/dist/integrations/github/default-rules.js.map +1 -1
  51. package/dist/integrations/github/issue-reconciler.js +6 -4
  52. package/dist/integrations/github/issue-reconciler.js.map +1 -1
  53. package/dist/integrations/github/provenance.d.ts +2 -2
  54. package/dist/integrations/github/provenance.d.ts.map +1 -1
  55. package/dist/integrations/github/provenance.js.map +1 -1
  56. package/dist/integrations/github/routes.d.ts.map +1 -1
  57. package/dist/integrations/github/routes.js +46 -1
  58. package/dist/integrations/github/routes.js.map +1 -1
  59. package/dist/integrations/github/rules.d.ts +3 -3
  60. package/dist/integrations/github/rules.d.ts.map +1 -1
  61. package/dist/integrations/github/rules.js +43 -39
  62. package/dist/integrations/github/rules.js.map +1 -1
  63. package/dist/integrations/gitlab/default-rules.d.ts +2 -9
  64. package/dist/integrations/gitlab/default-rules.d.ts.map +1 -1
  65. package/dist/integrations/gitlab/default-rules.js +2 -19
  66. package/dist/integrations/gitlab/default-rules.js.map +1 -1
  67. package/dist/integrations/gitlab/issue-reconciler.js +2 -2
  68. package/dist/integrations/gitlab/issue-reconciler.js.map +1 -1
  69. package/dist/integrations/gitlab/merge-request-reconciler.d.ts.map +1 -1
  70. package/dist/integrations/gitlab/merge-request-reconciler.js +11 -11
  71. package/dist/integrations/gitlab/merge-request-reconciler.js.map +1 -1
  72. package/dist/integrations/gitlab/rules.d.ts.map +1 -1
  73. package/dist/integrations/gitlab/rules.js +2 -1
  74. package/dist/integrations/gitlab/rules.js.map +1 -1
  75. package/dist/integrations/incidentio/rules.d.ts.map +1 -1
  76. package/dist/integrations/incidentio/rules.js +1 -0
  77. package/dist/integrations/incidentio/rules.js.map +1 -1
  78. package/dist/integrations/issue-reconciler.d.ts +7 -7
  79. package/dist/integrations/issue-reconciler.d.ts.map +1 -1
  80. package/dist/integrations/issue-reconciler.js +11 -14
  81. package/dist/integrations/issue-reconciler.js.map +1 -1
  82. package/dist/integrations/jira/rules.d.ts.map +1 -1
  83. package/dist/integrations/jira/rules.js +1 -0
  84. package/dist/integrations/jira/rules.js.map +1 -1
  85. package/dist/integrations/linear/issue-reconciler.js +2 -2
  86. package/dist/integrations/linear/issue-reconciler.js.map +1 -1
  87. package/dist/integrations/linear/routes.d.ts.map +1 -1
  88. package/dist/integrations/linear/routes.js +1 -1
  89. package/dist/integrations/linear/routes.js.map +1 -1
  90. package/dist/integrations/linear/rules.d.ts.map +1 -1
  91. package/dist/integrations/linear/rules.js +2 -1
  92. package/dist/integrations/linear/rules.js.map +1 -1
  93. package/dist/integrations/slack/feed-publisher.d.ts +2 -2
  94. package/dist/integrations/slack/feed-publisher.d.ts.map +1 -1
  95. package/dist/integrations/slack/feed-publisher.js.map +1 -1
  96. package/dist/integrations/slack/slack.d.ts.map +1 -1
  97. package/dist/integrations/slack/slack.js.map +1 -1
  98. package/dist/packages/_internals/workspace/dist/index.js +1 -1
  99. package/dist/routes/attention-activity.js +1 -1
  100. package/dist/routes/attention-activity.js.map +1 -1
  101. package/dist/routes/attention-parked.js.map +1 -1
  102. package/dist/routes/attention-providers.d.ts +4 -4
  103. package/dist/routes/attention-providers.d.ts.map +1 -1
  104. package/dist/routes/attention-providers.js +2 -2
  105. package/dist/routes/attention-providers.js.map +1 -1
  106. package/dist/routes/contracts.d.ts +33 -5
  107. package/dist/routes/contracts.d.ts.map +1 -1
  108. package/dist/routes/contracts.js +13 -4
  109. package/dist/routes/contracts.js.map +1 -1
  110. package/dist/routes/intake.d.ts.map +1 -1
  111. package/dist/routes/intake.js +1 -1
  112. package/dist/routes/intake.js.map +1 -1
  113. package/dist/routes/projects.js +3 -2
  114. package/dist/routes/projects.js.map +1 -1
  115. package/dist/routes/surface.js +4 -4
  116. package/dist/routes/surface.js.map +1 -1
  117. package/dist/routes/work-items.d.ts.map +1 -1
  118. package/dist/routes/work-items.js +9 -3
  119. package/dist/routes/work-items.js.map +1 -1
  120. package/dist/rules/binding-context.js +1 -1
  121. package/dist/rules/binding-context.js.map +1 -1
  122. package/dist/rules/decision-applicability.d.ts +2 -2
  123. package/dist/rules/decision-applicability.d.ts.map +1 -1
  124. package/dist/rules/decision-applicability.js +1 -1
  125. package/dist/rules/decision-applicability.js.map +1 -1
  126. package/dist/rules/dispatcher.d.ts +2 -7
  127. package/dist/rules/dispatcher.d.ts.map +1 -1
  128. package/dist/rules/dispatcher.js +13 -17
  129. package/dist/rules/dispatcher.js.map +1 -1
  130. package/dist/rules/processor.d.ts +2 -2
  131. package/dist/rules/processor.d.ts.map +1 -1
  132. package/dist/rules/processor.js +4 -2
  133. package/dist/rules/processor.js.map +1 -1
  134. package/dist/rules/review-source-tool.d.ts.map +1 -1
  135. package/dist/rules/review-source-tool.js +2 -4
  136. package/dist/rules/review-source-tool.js.map +1 -1
  137. package/dist/rules/start-coordinator.d.ts.map +1 -1
  138. package/dist/rules/start-coordinator.js +5 -2
  139. package/dist/rules/start-coordinator.js.map +1 -1
  140. package/dist/rules/tools.d.ts.map +1 -1
  141. package/dist/rules/tools.js +7 -10
  142. package/dist/rules/tools.js.map +1 -1
  143. package/dist/rules/transition-service.d.ts +8 -16
  144. package/dist/rules/transition-service.d.ts.map +1 -1
  145. package/dist/rules/transition-service.js +19 -21
  146. package/dist/rules/transition-service.js.map +1 -1
  147. package/dist/rules/types.d.ts +9 -3
  148. package/dist/rules/types.d.ts.map +1 -1
  149. package/dist/rules/types.js +2 -2
  150. package/dist/rules/types.js.map +1 -1
  151. package/dist/session/resource-migration.d.ts +3 -3
  152. package/dist/session/resource-migration.d.ts.map +1 -1
  153. package/dist/session/resource-migration.js.map +1 -1
  154. package/dist/session/work-item-repository.d.ts +4 -2
  155. package/dist/session/work-item-repository.d.ts.map +1 -1
  156. package/dist/session/work-item-repository.js +2 -2
  157. package/dist/session/work-item-repository.js.map +1 -1
  158. package/dist/skills/catalog.js +1 -1
  159. package/dist/storage/domains/comments/base.d.ts.map +1 -1
  160. package/dist/storage/domains/comments/base.js +15 -8
  161. package/dist/storage/domains/comments/base.js.map +1 -1
  162. package/dist/storage/domains/comments/domain.d.ts +2 -2
  163. package/dist/storage/domains/comments/domain.d.ts.map +1 -1
  164. package/dist/storage/domains/comments/domain.js +1 -1
  165. package/dist/storage/domains/comments/domain.js.map +1 -1
  166. package/dist/storage/domains/comments/feed-sync.d.ts +2 -2
  167. package/dist/storage/domains/comments/feed-sync.d.ts.map +1 -1
  168. package/dist/storage/domains/projects/base.d.ts +0 -3
  169. package/dist/storage/domains/projects/base.d.ts.map +1 -1
  170. package/dist/storage/domains/projects/base.js +0 -3
  171. package/dist/storage/domains/projects/base.js.map +1 -1
  172. package/dist/storage/domains/work-items/base.d.ts +94 -34
  173. package/dist/storage/domains/work-items/base.d.ts.map +1 -1
  174. package/dist/storage/domains/work-items/base.js +311 -160
  175. package/dist/storage/domains/work-items/base.js.map +1 -1
  176. package/dist/storage/domains/work-items/board-version.d.ts +2 -2
  177. package/dist/storage/domains/work-items/board-version.d.ts.map +1 -1
  178. package/dist/storage/domains/work-items/board-version.js +16 -5
  179. package/dist/storage/domains/work-items/board-version.js.map +1 -1
  180. package/dist/storage/domains/work-items/cards.d.ts +50 -0
  181. package/dist/storage/domains/work-items/cards.d.ts.map +1 -0
  182. package/dist/storage/domains/work-items/cards.js +284 -0
  183. package/dist/storage/domains/work-items/cards.js.map +1 -0
  184. package/dist/storage/domains/work-items/metrics.d.ts +2 -2
  185. package/dist/storage/domains/work-items/metrics.d.ts.map +1 -1
  186. package/dist/storage/domains/work-items/metrics.js.map +1 -1
  187. package/dist/storage/domains/work-items/work-item-schema.d.ts +117 -0
  188. package/dist/storage/domains/work-items/work-item-schema.d.ts.map +1 -0
  189. package/dist/storage/domains/work-items/work-item-schema.js +300 -0
  190. package/dist/storage/domains/work-items/work-item-schema.js.map +1 -0
  191. package/dist/tools/read-tools.d.ts +4 -4
  192. package/dist/tools/read-tools.d.ts.map +1 -1
  193. package/dist/tools/read-tools.js +19 -9
  194. package/dist/tools/read-tools.js.map +1 -1
  195. package/dist/tools/session-tools.d.ts.map +1 -1
  196. package/dist/tools/session-tools.js.map +1 -1
  197. package/dist/tools/side-sessions.d.ts +2 -2
  198. package/dist/tools/side-sessions.d.ts.map +1 -1
  199. package/dist/tools/side-sessions.js.map +1 -1
  200. package/dist/tools/work-item-tools.d.ts.map +1 -1
  201. package/dist/tools/work-item-tools.js +12 -17
  202. package/dist/tools/work-item-tools.js.map +1 -1
  203. package/dist/work-items/create-work-item.d.ts +3 -3
  204. package/dist/work-items/create-work-item.d.ts.map +1 -1
  205. package/dist/work-items/create-work-item.js.map +1 -1
  206. package/dist/work-items/providers/base.d.ts +22 -0
  207. package/dist/work-items/providers/base.d.ts.map +1 -0
  208. package/dist/work-items/providers/base.js +44 -0
  209. package/dist/work-items/providers/base.js.map +1 -0
  210. package/dist/work-items/providers/factory.d.ts +4 -0
  211. package/dist/work-items/providers/factory.d.ts.map +1 -0
  212. package/dist/work-items/providers/factory.js +13 -0
  213. package/dist/work-items/providers/factory.js.map +1 -0
  214. package/dist/work-items/providers/github.d.ts +3 -0
  215. package/dist/work-items/providers/github.d.ts.map +1 -0
  216. package/dist/work-items/providers/github.js +30 -0
  217. package/dist/work-items/providers/github.js.map +1 -0
  218. package/dist/work-items/providers/gitlab.d.ts +3 -0
  219. package/dist/work-items/providers/gitlab.d.ts.map +1 -0
  220. package/dist/work-items/providers/gitlab.js +35 -0
  221. package/dist/work-items/providers/gitlab.js.map +1 -0
  222. package/dist/work-items/providers/incidentio.d.ts +3 -0
  223. package/dist/work-items/providers/incidentio.d.ts.map +1 -0
  224. package/dist/work-items/providers/incidentio.js +23 -0
  225. package/dist/work-items/providers/incidentio.js.map +1 -0
  226. package/dist/work-items/providers/index.d.ts +8 -0
  227. package/dist/work-items/providers/index.d.ts.map +1 -0
  228. package/dist/work-items/providers/index.js +34 -0
  229. package/dist/work-items/providers/index.js.map +1 -0
  230. package/dist/work-items/providers/jira.d.ts +3 -0
  231. package/dist/work-items/providers/jira.d.ts.map +1 -0
  232. package/dist/work-items/providers/jira.js +16 -0
  233. package/dist/work-items/providers/jira.js.map +1 -0
  234. package/dist/work-items/providers/linear.d.ts +3 -0
  235. package/dist/work-items/providers/linear.d.ts.map +1 -0
  236. package/dist/work-items/providers/linear.js +24 -0
  237. package/dist/work-items/providers/linear.js.map +1 -0
  238. package/dist/work-items/providers/metadata-keys.d.ts +24 -0
  239. package/dist/work-items/providers/metadata-keys.d.ts.map +1 -0
  240. package/dist/work-items/providers/metadata-keys.js +84 -0
  241. package/dist/work-items/providers/metadata-keys.js.map +1 -0
  242. package/dist/work-items/providers/slack.d.ts +6 -0
  243. package/dist/work-items/providers/slack.d.ts.map +1 -0
  244. package/dist/work-items/providers/slack.js +15 -0
  245. package/dist/work-items/providers/slack.js.map +1 -0
  246. package/dist/work-items/providers/types.d.ts +23 -0
  247. package/dist/work-items/providers/types.d.ts.map +1 -0
  248. package/dist/work-items/providers/types.js +1 -0
  249. package/dist/work-items/split-migration.d.ts +51 -0
  250. package/dist/work-items/split-migration.d.ts.map +1 -0
  251. package/dist/work-items/split-migration.js +293 -0
  252. package/dist/work-items/split-migration.js.map +1 -0
  253. package/factory-skills/configure-factory-rules/SKILL.md +12 -16
  254. package/factory-skills/factory-self-review/SKILL.md +1 -1
  255. package/factory-skills/factory-triage/SKILL.md +3 -3
  256. package/package.json +11 -11
  257. package/dist/boards/work-transition-policy.d.ts +0 -3
  258. package/dist/boards/work-transition-policy.d.ts.map +0 -1
  259. package/dist/boards/work-transition-policy.js +0 -78
  260. package/dist/boards/work-transition-policy.js.map +0 -1
@@ -41,28 +41,24 @@ Do not create an `actions` config or execute authoritative policy in React. Each
41
41
 
42
42
  A pull request's own card and the Work card that authored it move independently, whether the pull request card sits on Work or on the legacy Review board. Never mirror their stages or mark Work Done only because a pull request merged.
43
43
 
44
- ## Configure board transition policy
44
+ ## Restrict where cards move
45
45
 
46
- Search the installed `defineBoard()` definition for `transitionPolicy`. Read `src/boards/transition-policy.ts` for the public contract and `src/boards/work-transition-policy.ts` for Work's automatic classification, approval, and acceptance policy. Review has no additional policy. Custom boards without a policy do not inherit Work's classification or acceptance behavior through phase or role names.
47
-
48
- Topology declares allowed moves; transition policy adds business restrictions; lifecycle handlers return effects. Add custom restrictions to the board definition, not the generic transition service or global rules:
46
+ Topology (`nextPhases`) declares the moves that exist, for everyone: people dragging cards, agents and board rules (lifecycle, tool-result and integration handlers). To keep a move from happening, leave it out of the source phase's `nextPhases`. Do not add restrictions to the generic transition service or global rules.
49
47
 
50
48
  ```typescript
51
- import type { BoardTransitionPolicy } from '@mastra/factory/boards';
52
-
53
- const transitionPolicy: BoardTransitionPolicy = context => {
54
- if (context.toStage === 'shipped' && !context.isHumanTransition) {
55
- return { type: 'reject', code: 'approval_required', reason: 'A person must approve this release.' };
56
- }
57
- };
58
- // Pass transitionPolicy to the installed custom defineBoard() definition.
49
+ backlog: {
50
+ name: 'Backlog',
51
+ kind: 'resting',
52
+ // Cards are built before they ship; nobody closes a card straight from the backlog.
53
+ nextPhases: ['build', 'canceled'],
54
+ },
59
55
  ```
60
56
 
61
- The policy receives a deeply readonly snapshot with ISO-string dates. Return `undefined`, `{ type: 'allow', triageType?, accept?: true }`, or `{ type: 'reject', code, reason }`, never skill calls, transitions, consent overrides, or patches. Classification intents require the existing triage-agent path and must match its requested classification. Acceptance requires both human actor and human ingress. Runtime validates results and commits intents atomically only after successful lifecycle evaluation.
57
+ Read `src/boards/work.ts` for Work's topology (no skipping Planning, Building only through an approved plan, self-review returns to Building or parks in Intake) and `src/boards/review.ts` for Review. Whether work is finished is the agent's instructions, not the board's: say when to move a card to Done in the phase's skill or `runner.instructions`.
62
58
 
63
- Policies must be side-effect-free and share the lifecycle timeout budget. Initial entry, reentry, and same-stage requests evaluate policy; completed replay does not. Concurrent attempts may evaluate more than once, and timing out does not cancel work started by a callback. Do not access storage or integrations from a policy.
59
+ A working phase whose `exitTool` has a board tool rule (`tools[exitTool.id]`) leaves through that tool: anyone but a person asking to move the card on to another working phase is rejected unless the exit tool is auto-approved for the card. Work's Planning uses `submit_plan` with `autoApprove: false`, so every plan waits for a person. To approve plans without a person on your own board, set `exitTool.autoApprove` (optionally with `autoApproveWhen`); there is no project setting.
64
60
 
65
- Policy allowance cannot bypass topology, board ownership, ingress authorization, external-author safety, revision checks, replay, or decision validation. Phase meaning is declared on the phase (`kind`), not in the policy. Do not invent built-in replacement APIs.
61
+ `transitionPolicy` is deprecated: it still runs for boards that set it and logs one warning per board. Do not add new policies; express the flow with `nextPhases` and `exitTool`. Factory no longer records triage classification or acceptance: Work's triage agent sends open non-bugs back to Intake, and a person moving the card on is the approval. Custom boards inherit none of Work's rules through phase or role names.
66
62
 
67
63
  ## Configure board phase semantics
68
64
 
@@ -80,7 +76,7 @@ A `transition` decision stays on the item's assigned board. An `upsertLinkedWork
80
76
 
81
77
  Working roles identify bindings on the shared Code Agent, not separately configured agents. There is no per-role agent registration option. Declare `invokeSkill` decisions with the working role and a board-owned prompt (or an available skill); do not invent an `agents` configuration. For automatic session preparation, verify the deployment's GitHub integration, project connection and linked repository, sandbox, organization model credentials, and project automatic-run setting. Enter a working phase through the public transition route as an authorized human when approval is required.
82
78
 
83
- Verify the actual journey: initial entry, lifecycle kickoff, the declared role's phase signal and binding, a bound transition tool, role handoff, completed tool-result ingestion, deferred transition, and terminal cleanup. Polling and persisted-message ingestion resolve the single current phase through the installed board. Live binding, reassignment, revision, topology, approval, and external-author checks still apply. Custom roles named `triage` do not inherit Work classification requirements. A tool-result handler receives normalized `result.status` and `result.value`; it does not receive raw tool arguments. Check the result payload needed by the board's policy rather than treating every completed tool call as business success.
79
+ Verify the actual journey: initial entry, lifecycle kickoff, the declared role's phase signal and binding, a bound transition tool, role handoff, completed tool-result ingestion, deferred transition, and terminal cleanup. Polling and persisted-message ingestion resolve the single current phase through the installed board. Live binding, reassignment, revision, topology, approval, and external-author checks still apply. Custom roles named `triage` inherit nothing from Work. A tool-result handler receives normalized `result.status` and `result.value`; it does not receive raw tool arguments. Check the result payload the board's rules need rather than treating every completed tool call as business success.
84
80
 
85
81
  Keep the remaining limits explicit: `factory-ui` still uses built-in stages and roles, completion metrics still use Work's `done` phase, and `held-waiting` is Work-specific. Existing integration defaults do not automatically route events to a custom board.
86
82
 
@@ -41,6 +41,6 @@ Write the findings argument of the verdict call as Markdown the builder (on requ
41
41
 
42
42
  ## Verdict
43
43
 
44
- Call `factory_record_review_verdict` with `verdict` (`approve` or `request changes`), `reviewedHeadSha` (the head you tested), and `findings` (the report). Approve keeps the card in Review and wakes the builder to open the change request from that exact head. Request changes sends it back to Building with your report. After the round limit in the factory-phase arguments, a further request changes parks the card for a human, so make each round's requests complete.
44
+ Call `factory_record_review_verdict` with `verdict` (`approve` or `request changes`), `reviewedHeadSha` (the head you tested), and `findings` (the report). Approve keeps the card in Review and wakes the builder to open the change request from that exact head. Request changes sends it back to Building with your report. After the round limit in the factory-phase arguments, a further request changes parks the card for a human, so make each round's requests complete. Never move the card to Done yourself: an approving verdict hands it back to the builder, which opens the change request, and the merge finishes it.
45
45
 
46
46
  Then post the report as your final conversation message and stop.
@@ -149,7 +149,7 @@ Write one concise **handoff** for whoever plans the fix. It must begin with the
149
149
  Fill the placeholders as follows:
150
150
 
151
151
  - Write the summary for a maintainer skimming their notifications. Say what breaks for the user, not how the code breaks; no file names, function names, or internal ids — those go under Root cause.
152
- - `<Type>` is one of: bug, feature request, docs, question/support, maintenance, duplicate, resolved, invalid, spam, out-of-scope, other, capitalized for display; pass the lowercase value as `triageType`. `<Severity>` and `<level>` are the lowercase ratings from the guides below. `<Route>` is one of: Plan fix, Await approval, Ask author for info, Close as duplicate/resolved/invalid/spam/out-of-scope, Answer provided / close, No transition / refresh, Other.
152
+ - `<Type>` is one of: bug, feature request, docs, question/support, maintenance, duplicate, resolved, invalid, spam, out-of-scope, other, capitalized for display. `<Severity>` and `<level>` are the lowercase ratings from the guides below. `<Route>` is one of: Plan fix, Await approval, Ask author for info, Close as duplicate/resolved/invalid/spam/out-of-scope, Answer provided / close, No transition / refresh, Other.
153
153
  - `<dots>` shows the rating at a glance. Severity uses four dots: `●○○○` low, `●●○○` medium, `●●●○` high, `●●●●` critical. Confidence, effort, and impact use three: `●○○` low, `●●○` medium, `●●●` high. Always follow the dots with the word.
154
154
  - Each rating reason is at most 12 words.
155
155
  - Keep the collapsed sections collapsed. Only the ratings table, the summary, the next step, and open questions stay visible.
@@ -213,9 +213,9 @@ For non-GitHub sources, use the same structured handoff without attempting GitHu
213
213
 
214
214
  Post the same handoff as your final conversation message. Take the current stage and `expectedRevision` from the `factory-phase` signal.
215
215
 
216
- - When the current stage is **Intake** or **Triage**, make the terminal `factory_transition_work_item` call with `triageType` set to the exact `Type` from the handoff.
216
+ - When the current stage is **Intake** or **Triage**, make the terminal `factory_transition_work_item` call and start its `rationale` with the exact `Type` from the handoff. Factory does not record a classification; never pass a `triageType` argument.
217
217
  - Confirmed bugs with `Route: Plan fix` request `stage: "planning"`. Issues that should be closed request `stage: "done"` with the close rationale.
218
- - Features and every other non-bug classification use `Route: Await approval` and request their current Intake/Triage stage. This records the classification without advancing; stop until a maintainer moves the card or starts the next run from the Factory UI.
218
+ - Features and every other open non-bug classification use `Route: Await approval` and request `stage: "intake"`. The card rests in Intake until a maintainer moves it on; that move is the approval. Stop after the transition.
219
219
  - When the item is already in **Planning** or a later stage, this is a webhook-driven refresh: use `Route: No transition / refresh`, update the source-specific handoff, but do **not** request a stage transition. Report the updated verdict and stop.
220
220
 
221
221
  `rationale` (max 1000 chars) — the triage verdict and headline understanding in a few sentences (e.g. "Genuine regression from <commit>; root cause understood; ready to plan a fix").
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/factory",
3
- "version": "0.27.0-alpha.2",
3
+ "version": "0.27.0-alpha.3",
4
4
  "description": "Mastra Software Factory module: the server core behind the Mastra Software Factory — storage domains, integrations, and surfaces for agent-powered software delivery",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -53,32 +53,32 @@
53
53
  "dependencies": {
54
54
  "@octokit/auth-app": "^8.3.1",
55
55
  "@octokit/rest": "^22.0.1",
56
- "chat": "^4.43.0",
56
+ "chat": "^4.44.0",
57
57
  "fetch-to-node": "^2.1.0",
58
58
  "hono": "^4.13.13",
59
59
  "posthog-node": "^5.57.1",
60
60
  "zod": "^4.6.7",
61
61
  "@mastra/auth-studio": "1.3.11",
62
62
  "@mastra/auth-workos": "1.6.8",
63
- "@mastra/code-sdk": "1.18.0-alpha.2",
64
- "@mastra/core": "1.82.0-alpha.2",
65
- "@mastra/mcp": "2.8.0-alpha.1",
63
+ "@mastra/code-sdk": "1.18.0-alpha.3",
64
+ "@mastra/core": "1.82.0-alpha.3",
65
+ "@mastra/mcp": "2.8.0-alpha.2",
66
66
  "@mastra/platform-workspace": "1.12.0-alpha.1",
67
- "@mastra/slack": "1.8.0"
67
+ "@mastra/slack": "1.8.1-alpha.0"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@types/node": "22.19.15",
71
71
  "msw": "^2.12.11",
72
72
  "tsdown": "0.23.1",
73
73
  "typescript": "^6.0.3",
74
- "vitest": "4.1.12",
74
+ "vitest": "5.1.0",
75
75
  "@internal/lint": "0.0.147",
76
76
  "@internal/types-builder": "0.0.122",
77
77
  "@internal/workspace": "0.0.19",
78
- "@mastra/deployer": "1.82.0-alpha.2",
79
- "@mastra/libsql": "1.29.0-alpha.1",
80
- "@mastra/pg": "1.35.0-alpha.2",
81
- "@mastra/server": "1.82.0-alpha.2"
78
+ "@mastra/deployer": "1.82.0-alpha.3",
79
+ "@mastra/libsql": "1.29.0-alpha.2",
80
+ "@mastra/pg": "1.35.0-alpha.3",
81
+ "@mastra/server": "1.82.0-alpha.3"
82
82
  },
83
83
  "engines": {
84
84
  "node": ">=22.19.0"
@@ -1,3 +0,0 @@
1
- import type { BoardTransitionPolicy } from './transition-policy.js';
2
- export declare const workTransitionPolicy: BoardTransitionPolicy;
3
- //# sourceMappingURL=work-transition-policy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"work-transition-policy.d.ts","sourceRoot":"","sources":["../../src/boards/work-transition-policy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAKpE,eAAO,MAAM,oBAAoB,EAAE,qBAiHlC,CAAC"}
@@ -1,78 +0,0 @@
1
- import { isPullRequestCard } from "./semantics.js";
2
- import { rejectAgentDone } from "./pull-request-review.js";
3
- // src/boards/work-transition-policy.ts
4
- /** Phases a pull request's own card may hold on Work: it is reviewed, never triaged, planned, or built. */
5
- const PULL_REQUEST_PHASES = /* @__PURE__ */ new Set([
6
- "intake",
7
- "pr-review",
8
- "done",
9
- "canceled"
10
- ]);
11
- const workTransitionPolicy = (context) => {
12
- if (isPullRequestCard(context.item)) {
13
- if (!PULL_REQUEST_PHASES.has(context.toStage)) return {
14
- type: "reject",
15
- code: "invalid_transition",
16
- reason: `A pull request card is reviewed on the Work board; it cannot enter ${context.toStage}. Move it to pr-review, done, or canceled.`
17
- };
18
- return rejectAgentDone(context) ?? { type: "allow" };
19
- }
20
- if (context.toStage === "pr-review") return {
21
- type: "reject",
22
- code: "invalid_transition",
23
- reason: "PR review holds only pull request cards; this work item goes to Review after Building."
24
- };
25
- const { item, requestedTriageType, actor, fromStage, toStage, isHumanTransition, plansAutoApproved, planApproved } = context;
26
- const triageAgent = actor.type === "agent" && actor.role === "triage";
27
- if (triageAgent && requestedTriageType === void 0) return {
28
- type: "reject",
29
- code: "invalid_transition",
30
- reason: "Triage transitions must report a structured triage classification."
31
- };
32
- if (item.triageType && requestedTriageType && item.triageType !== requestedTriageType) return {
33
- type: "reject",
34
- code: "forbidden",
35
- reason: "The persisted triage classification cannot be changed by a later transition."
36
- };
37
- const skipsPlanning = (fromStage === "intake" || fromStage === "triage") && actor.type === "agent";
38
- if ((fromStage === "planning" || skipsPlanning) && toStage === "execute" && actor.type !== "human" && !plansAutoApproved && !planApproved) return {
39
- type: "reject",
40
- code: "approval_required",
41
- reason: "Auto-approve plans is off, so a person has to approve this plan. Ask them to say so in a chat they are signed in to (Slack, terminal, web); that turn can move the card into Building with factory_transition_work_item."
42
- };
43
- if (toStage === "done" && actor.type === "agent" && item.metadata?.reviewVerdict === "request changes") return {
44
- type: "reject",
45
- code: "invalid_transition",
46
- reason: "The latest Factory review requested changes on this pull request. Address them and push; the re-review updates the verdict. A merge or a maintainer can still close the work."
47
- };
48
- if (toStage === "done" && actor.type === "agent" && typeof item.metadata?.openPullRequestNumber === "number") return {
49
- type: "reject",
50
- code: "invalid_transition",
51
- reason: `Pull request #${item.metadata.openPullRequestNumber} is still open. The card moves to Done when it merges; a maintainer can still close the work.`
52
- };
53
- if (fromStage === "intake" && actor.type === "agent" && item.metadata?.selfReviewNeedsHuman === true) return {
54
- type: "reject",
55
- code: "approval_required",
56
- reason: "Self-review requested changes too many times and parked this work item for a person. Ask them to decide in a chat they are signed in to; that turn can move the card on with factory_transition_work_item."
57
- };
58
- if (fromStage === "review" && toStage === "done" && actor.type === "agent" && typeof item.metadata?.openPullRequestNumber !== "number" && item.metadata?.reviewVerdict === void 0 && item.metadata?.selfReviewVerdict !== "approve") return {
59
- type: "reject",
60
- code: "invalid_transition",
61
- reason: "This work item is in self-review and has no open change request yet. Record a self-review verdict instead; a maintainer can still close the work."
62
- };
63
- const triageType = item.triageType ?? requestedTriageType;
64
- const entersWork = toStage === "planning" || toStage === "execute";
65
- if (triageType != null && triageType !== "bug" && entersWork && !isHumanTransition && !item.acceptedAt) return {
66
- type: "reject",
67
- code: "approval_required",
68
- reason: "A person must accept this non-bug work item before it enters Planning or Execute. Ask them to say so in a chat they are signed in to; that turn can move the card with factory_transition_work_item."
69
- };
70
- return {
71
- type: "allow",
72
- ...triageAgent && requestedTriageType ? { triageType: requestedTriageType } : {},
73
- ...isHumanTransition && entersWork && !item.acceptedAt ? { accept: true } : {}
74
- };
75
- };
76
- export { workTransitionPolicy };
77
-
78
- //# sourceMappingURL=work-transition-policy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"work-transition-policy.js","names":[],"sources":["../../src/boards/work-transition-policy.ts"],"sourcesContent":["import { rejectAgentDone } from './pull-request-review.js';\nimport { isPullRequestCard } from './semantics.js';\nimport type { BoardTransitionPolicy } from './transition-policy.js';\n\n/** Phases a pull request's own card may hold on Work: it is reviewed, never triaged, planned, or built. */\nconst PULL_REQUEST_PHASES = new Set(['intake', 'pr-review', 'done', 'canceled']);\n\nexport const workTransitionPolicy: BoardTransitionPolicy = context => {\n if (isPullRequestCard(context.item)) {\n if (!PULL_REQUEST_PHASES.has(context.toStage)) {\n return {\n type: 'reject',\n code: 'invalid_transition',\n reason: `A pull request card is reviewed on the Work board; it cannot enter ${context.toStage}. Move it to pr-review, done, or canceled.`,\n };\n }\n return rejectAgentDone(context) ?? { type: 'allow' };\n }\n if (context.toStage === 'pr-review') {\n return {\n type: 'reject',\n code: 'invalid_transition',\n reason: 'PR review holds only pull request cards; this work item goes to Review after Building.',\n };\n }\n const { item, requestedTriageType, actor, fromStage, toStage, isHumanTransition, plansAutoApproved, planApproved } =\n context;\n const triageAgent = actor.type === 'agent' && actor.role === 'triage';\n if (triageAgent && requestedTriageType === undefined) {\n return {\n type: 'reject',\n code: 'invalid_transition',\n reason: 'Triage transitions must report a structured triage classification.',\n };\n }\n if (item.triageType && requestedTriageType && item.triageType !== requestedTriageType) {\n return {\n type: 'reject',\n code: 'forbidden',\n reason: 'The persisted triage classification cannot be changed by a later transition.',\n };\n }\n // Planning is the approval boundary. When project auto-approval is off, only a\n // person or a successfully approved `submit_plan` result may move the card into Building.\n // An agent cannot skip Planning from Intake or Triage either; maintainer-configured\n // system rules may still route cards there.\n const skipsPlanning = (fromStage === 'intake' || fromStage === 'triage') && actor.type === 'agent';\n if (\n (fromStage === 'planning' || skipsPlanning) &&\n toStage === 'execute' &&\n actor.type !== 'human' &&\n !plansAutoApproved &&\n !planApproved\n ) {\n return {\n type: 'reject',\n code: 'approval_required',\n reason:\n 'Auto-approve plans is off, so a person has to approve this plan. Ask them to say so in a chat they are signed in to (Slack, terminal, web); that turn can move the card into Building with factory_transition_work_item.',\n };\n }\n // A Factory review requested changes on this item's pull request. Closing the\n // work now would bury the finding; the next push re-reviews and updates it.\n if (toStage === 'done' && actor.type === 'agent' && item.metadata?.reviewVerdict === 'request changes') {\n return {\n type: 'reject',\n code: 'invalid_transition',\n reason:\n 'The latest Factory review requested changes on this pull request. Address them and push; the re-review updates the verdict. A merge or a maintainer can still close the work.',\n };\n }\n // The work ships when its pull request merges, and the merge closes the card.\n if (toStage === 'done' && actor.type === 'agent' && typeof item.metadata?.openPullRequestNumber === 'number') {\n return {\n type: 'reject',\n code: 'invalid_transition',\n reason: `Pull request #${item.metadata.openPullRequestNumber} is still open. The card moves to Done when it merges; a maintainer can still close the work.`,\n };\n }\n // Self-review hit its round limit and parked the card for a person.\n if (fromStage === 'intake' && actor.type === 'agent' && item.metadata?.selfReviewNeedsHuman === true) {\n return {\n type: 'reject',\n code: 'approval_required',\n reason:\n 'Self-review requested changes too many times and parked this work item for a person. Ask them to decide in a chat they are signed in to; that turn can move the card on with factory_transition_work_item.',\n };\n }\n // In Review without a change request, the card is waiting on self-review; an agent cannot close it from there.\n if (\n fromStage === 'review' &&\n toStage === 'done' &&\n actor.type === 'agent' &&\n typeof item.metadata?.openPullRequestNumber !== 'number' &&\n item.metadata?.reviewVerdict === undefined &&\n item.metadata?.selfReviewVerdict !== 'approve'\n ) {\n return {\n type: 'reject',\n code: 'invalid_transition',\n reason:\n 'This work item is in self-review and has no open change request yet. Record a self-review verdict instead; a maintainer can still close the work.',\n };\n }\n const triageType = item.triageType ?? requestedTriageType;\n const entersWork = toStage === 'planning' || toStage === 'execute';\n // An intermediate phase is not evidence of human approval.\n if (triageType != null && triageType !== 'bug' && entersWork && !isHumanTransition && !item.acceptedAt) {\n return {\n type: 'reject',\n code: 'approval_required',\n reason:\n 'A person must accept this non-bug work item before it enters Planning or Execute. Ask them to say so in a chat they are signed in to; that turn can move the card with factory_transition_work_item.',\n };\n }\n return {\n type: 'allow',\n ...(triageAgent && requestedTriageType ? { triageType: requestedTriageType } : {}),\n ...(isHumanTransition && entersWork && !item.acceptedAt ? { accept: true as const } : {}),\n };\n};\n"],"mappings":";;;;AAKA,MAAM,sCAAsB,IAAI,IAAI;CAAC;CAAU;CAAa;CAAQ;AAAU,CAAC;AAE/E,MAAa,wBAA8C,YAAW;CACpE,IAAI,kBAAkB,QAAQ,IAAI,GAAG;EACnC,IAAI,CAAC,oBAAoB,IAAI,QAAQ,OAAO,GAC1C,OAAO;GACL,MAAM;GACN,MAAM;GACN,QAAQ,sEAAsE,QAAQ,QAAQ;EAChG;EAEF,OAAO,gBAAgB,OAAO,KAAK,EAAE,MAAM,QAAQ;CACrD;CACA,IAAI,QAAQ,YAAY,aACtB,OAAO;EACL,MAAM;EACN,MAAM;EACN,QAAQ;CACV;CAEF,MAAM,EAAE,MAAM,qBAAqB,OAAO,WAAW,SAAS,mBAAmB,mBAAmB,iBAClG;CACF,MAAM,cAAc,MAAM,SAAS,WAAW,MAAM,SAAS;CAC7D,IAAI,eAAe,wBAAwB,KAAA,GACzC,OAAO;EACL,MAAM;EACN,MAAM;EACN,QAAQ;CACV;CAEF,IAAI,KAAK,cAAc,uBAAuB,KAAK,eAAe,qBAChE,OAAO;EACL,MAAM;EACN,MAAM;EACN,QAAQ;CACV;CAMF,MAAM,iBAAiB,cAAc,YAAY,cAAc,aAAa,MAAM,SAAS;CAC3F,KACG,cAAc,cAAc,kBAC7B,YAAY,aACZ,MAAM,SAAS,WACf,CAAC,qBACD,CAAC,cAED,OAAO;EACL,MAAM;EACN,MAAM;EACN,QACE;CACJ;CAIF,IAAI,YAAY,UAAU,MAAM,SAAS,WAAW,KAAK,UAAU,kBAAkB,mBACnF,OAAO;EACL,MAAM;EACN,MAAM;EACN,QACE;CACJ;CAGF,IAAI,YAAY,UAAU,MAAM,SAAS,WAAW,OAAO,KAAK,UAAU,0BAA0B,UAClG,OAAO;EACL,MAAM;EACN,MAAM;EACN,QAAQ,iBAAiB,KAAK,SAAS,sBAAsB;CAC/D;CAGF,IAAI,cAAc,YAAY,MAAM,SAAS,WAAW,KAAK,UAAU,yBAAyB,MAC9F,OAAO;EACL,MAAM;EACN,MAAM;EACN,QACE;CACJ;CAGF,IACE,cAAc,YACd,YAAY,UACZ,MAAM,SAAS,WACf,OAAO,KAAK,UAAU,0BAA0B,YAChD,KAAK,UAAU,kBAAkB,KAAA,KACjC,KAAK,UAAU,sBAAsB,WAErC,OAAO;EACL,MAAM;EACN,MAAM;EACN,QACE;CACJ;CAEF,MAAM,aAAa,KAAK,cAAc;CACtC,MAAM,aAAa,YAAY,cAAc,YAAY;CAEzD,IAAI,cAAc,QAAQ,eAAe,SAAS,cAAc,CAAC,qBAAqB,CAAC,KAAK,YAC1F,OAAO;EACL,MAAM;EACN,MAAM;EACN,QACE;CACJ;CAEF,OAAO;EACL,MAAM;EACN,GAAI,eAAe,sBAAsB,EAAE,YAAY,oBAAoB,IAAI,CAAC;EAChF,GAAI,qBAAqB,cAAc,CAAC,KAAK,aAAa,EAAE,QAAQ,KAAc,IAAI,CAAC;CACzF;AACF"}