@mastra/factory 0.24.0-alpha.0 → 0.24.0-alpha.2

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 (196) hide show
  1. package/README.md +80 -4
  2. package/dist/auth.d.ts +8 -0
  3. package/dist/auth.d.ts.map +1 -1
  4. package/dist/auth.js +15 -1
  5. package/dist/auth.js.map +1 -1
  6. package/dist/boards/work-transition-policy.d.ts.map +1 -1
  7. package/dist/boards/work-transition-policy.js +10 -0
  8. package/dist/boards/work-transition-policy.js.map +1 -1
  9. package/dist/boards/work.d.ts +14 -0
  10. package/dist/boards/work.d.ts.map +1 -1
  11. package/dist/boards/work.js +70 -7
  12. package/dist/boards/work.js.map +1 -1
  13. package/dist/capabilities/version-control.d.ts +26 -0
  14. package/dist/capabilities/version-control.d.ts.map +1 -1
  15. package/dist/factory.d.ts.map +1 -1
  16. package/dist/factory.js +173 -11
  17. package/dist/factory.js.map +1 -1
  18. package/dist/integrations/github/integration.d.ts.map +1 -1
  19. package/dist/integrations/github/integration.js +37 -1
  20. package/dist/integrations/github/integration.js.map +1 -1
  21. package/dist/integrations/gitlab/api.d.ts +15 -0
  22. package/dist/integrations/gitlab/api.d.ts.map +1 -1
  23. package/dist/integrations/gitlab/api.js +9 -0
  24. package/dist/integrations/gitlab/api.js.map +1 -1
  25. package/dist/integrations/gitlab/version-control.d.ts.map +1 -1
  26. package/dist/integrations/gitlab/version-control.js +37 -3
  27. package/dist/integrations/gitlab/version-control.js.map +1 -1
  28. package/dist/integrations/incidentio/api.d.ts +9 -0
  29. package/dist/integrations/incidentio/api.d.ts.map +1 -1
  30. package/dist/integrations/incidentio/api.js +3 -0
  31. package/dist/integrations/incidentio/api.js.map +1 -1
  32. package/dist/integrations/incidentio/integration.d.ts.map +1 -1
  33. package/dist/integrations/incidentio/integration.js +1 -0
  34. package/dist/integrations/incidentio/integration.js.map +1 -1
  35. package/dist/integrations/jira/api.d.ts +7 -0
  36. package/dist/integrations/jira/api.d.ts.map +1 -1
  37. package/dist/integrations/jira/api.js +4 -0
  38. package/dist/integrations/jira/api.js.map +1 -1
  39. package/dist/integrations/platform/api-client.d.ts +6 -0
  40. package/dist/integrations/platform/api-client.d.ts.map +1 -1
  41. package/dist/integrations/platform/api-client.js +6 -1
  42. package/dist/integrations/platform/api-client.js.map +1 -1
  43. package/dist/integrations/platform/github/integration.d.ts.map +1 -1
  44. package/dist/integrations/platform/github/integration.js +27 -1
  45. package/dist/integrations/platform/github/integration.js.map +1 -1
  46. package/dist/integrations/platform/incidentio/integration.d.ts.map +1 -1
  47. package/dist/integrations/platform/incidentio/integration.js +1 -0
  48. package/dist/integrations/platform/incidentio/integration.js.map +1 -1
  49. package/dist/integrations/platform/jira/integration.d.ts.map +1 -1
  50. package/dist/integrations/platform/jira/integration.js +1 -0
  51. package/dist/integrations/platform/jira/integration.js.map +1 -1
  52. package/dist/integrations/subscription-session.d.ts +15 -0
  53. package/dist/integrations/subscription-session.d.ts.map +1 -1
  54. package/dist/integrations/subscription-session.js +30 -13
  55. package/dist/integrations/subscription-session.js.map +1 -1
  56. package/dist/provider-display-name.d.ts +2 -0
  57. package/dist/provider-display-name.d.ts.map +1 -0
  58. package/dist/provider-display-name.js +16 -0
  59. package/dist/provider-display-name.js.map +1 -0
  60. package/dist/routes/config.js +2 -2
  61. package/dist/routes/config.js.map +1 -1
  62. package/dist/routes/contracts.d.ts +4 -0
  63. package/dist/routes/contracts.d.ts.map +1 -1
  64. package/dist/routes/contracts.js +3 -1
  65. package/dist/routes/contracts.js.map +1 -1
  66. package/dist/routes/oauth.js +1 -1
  67. package/dist/routes/oauth.js.map +1 -1
  68. package/dist/routes/provider-credentials.d.ts +6 -2
  69. package/dist/routes/provider-credentials.d.ts.map +1 -1
  70. package/dist/routes/provider-credentials.js +20 -7
  71. package/dist/routes/provider-credentials.js.map +1 -1
  72. package/dist/routes/source-control-sessions.d.ts +1 -0
  73. package/dist/routes/source-control-sessions.d.ts.map +1 -1
  74. package/dist/routes/source-control-sessions.js +1 -1
  75. package/dist/routes/source-control-sessions.js.map +1 -1
  76. package/dist/routes/surface.d.ts +1 -0
  77. package/dist/routes/surface.d.ts.map +1 -1
  78. package/dist/routes/surface.js +1 -0
  79. package/dist/routes/surface.js.map +1 -1
  80. package/dist/routes/work-items.d.ts.map +1 -1
  81. package/dist/routes/work-items.js +57 -117
  82. package/dist/routes/work-items.js.map +1 -1
  83. package/dist/rules/dispatcher.d.ts +7 -0
  84. package/dist/rules/dispatcher.d.ts.map +1 -1
  85. package/dist/rules/dispatcher.js +60 -3
  86. package/dist/rules/dispatcher.js.map +1 -1
  87. package/dist/rules/processor.d.ts.map +1 -1
  88. package/dist/rules/processor.js +2 -1
  89. package/dist/rules/processor.js.map +1 -1
  90. package/dist/rules/tools.d.ts.map +1 -1
  91. package/dist/rules/tools.js +82 -3
  92. package/dist/rules/tools.js.map +1 -1
  93. package/dist/rules/transition-service.d.ts +17 -0
  94. package/dist/rules/transition-service.d.ts.map +1 -1
  95. package/dist/rules/transition-service.js +25 -0
  96. package/dist/rules/transition-service.js.map +1 -1
  97. package/dist/rules/types.d.ts +2 -0
  98. package/dist/rules/types.d.ts.map +1 -1
  99. package/dist/rules/types.js.map +1 -1
  100. package/dist/sandbox/local-factory-sandbox.d.ts.map +1 -1
  101. package/dist/sandbox/local-factory-sandbox.js +1 -0
  102. package/dist/sandbox/local-factory-sandbox.js.map +1 -1
  103. package/dist/session/factory-session.d.ts +15 -1
  104. package/dist/session/factory-session.d.ts.map +1 -1
  105. package/dist/session/factory-session.js +4 -2
  106. package/dist/session/factory-session.js.map +1 -1
  107. package/dist/session/reply-credential-processor.d.ts +15 -0
  108. package/dist/session/reply-credential-processor.d.ts.map +1 -0
  109. package/dist/session/reply-credential-processor.js +40 -0
  110. package/dist/session/reply-credential-processor.js.map +1 -0
  111. package/dist/session/source-control-tools.d.ts +19 -1
  112. package/dist/session/source-control-tools.d.ts.map +1 -1
  113. package/dist/session/source-control-tools.js +70 -3
  114. package/dist/session/source-control-tools.js.map +1 -1
  115. package/dist/storage/domains/projects/base.d.ts +6 -0
  116. package/dist/storage/domains/projects/base.d.ts.map +1 -1
  117. package/dist/storage/domains/projects/base.js +12 -0
  118. package/dist/storage/domains/projects/base.js.map +1 -1
  119. package/dist/storage/domains/source-control/base.d.ts +17 -0
  120. package/dist/storage/domains/source-control/base.d.ts.map +1 -1
  121. package/dist/storage/domains/source-control/base.js +23 -0
  122. package/dist/storage/domains/source-control/base.js.map +1 -1
  123. package/dist/storage/domains/source-control/inmemory.d.ts +4 -0
  124. package/dist/storage/domains/source-control/inmemory.d.ts.map +1 -1
  125. package/dist/storage/domains/source-control/inmemory.js +5 -1
  126. package/dist/storage/domains/source-control/inmemory.js.map +1 -1
  127. package/dist/storage/domains/work-items/base.d.ts +56 -0
  128. package/dist/storage/domains/work-items/base.d.ts.map +1 -1
  129. package/dist/storage/domains/work-items/base.js +139 -25
  130. package/dist/storage/domains/work-items/base.js.map +1 -1
  131. package/dist/tools/approval-tools.d.ts +15 -0
  132. package/dist/tools/approval-tools.d.ts.map +1 -0
  133. package/dist/tools/approval-tools.js +77 -0
  134. package/dist/tools/approval-tools.js.map +1 -0
  135. package/dist/tools/deliver.d.ts +54 -0
  136. package/dist/tools/deliver.d.ts.map +1 -0
  137. package/dist/tools/deliver.js +105 -0
  138. package/dist/tools/deliver.js.map +1 -0
  139. package/dist/tools/index.d.ts +29 -0
  140. package/dist/tools/index.d.ts.map +1 -0
  141. package/dist/tools/index.js +39 -0
  142. package/dist/tools/index.js.map +1 -0
  143. package/dist/tools/messaging-tools.d.ts +28 -0
  144. package/dist/tools/messaging-tools.d.ts.map +1 -0
  145. package/dist/tools/messaging-tools.js +312 -0
  146. package/dist/tools/messaging-tools.js.map +1 -0
  147. package/dist/tools/permissions.d.ts +31 -0
  148. package/dist/tools/permissions.d.ts.map +1 -0
  149. package/dist/tools/permissions.js +44 -0
  150. package/dist/tools/permissions.js.map +1 -0
  151. package/dist/tools/read-tools.d.ts +27 -0
  152. package/dist/tools/read-tools.d.ts.map +1 -0
  153. package/dist/tools/read-tools.js +285 -0
  154. package/dist/tools/read-tools.js.map +1 -0
  155. package/dist/tools/reports.d.ts +163 -0
  156. package/dist/tools/reports.d.ts.map +1 -0
  157. package/dist/tools/reports.js +352 -0
  158. package/dist/tools/reports.js.map +1 -0
  159. package/dist/tools/run-watch.d.ts +46 -0
  160. package/dist/tools/run-watch.d.ts.map +1 -0
  161. package/dist/tools/run-watch.js +102 -0
  162. package/dist/tools/run-watch.js.map +1 -0
  163. package/dist/tools/scope.d.ts +45 -0
  164. package/dist/tools/scope.d.ts.map +1 -0
  165. package/dist/tools/scope.js +73 -0
  166. package/dist/tools/scope.js.map +1 -0
  167. package/dist/tools/session-tools.d.ts +31 -0
  168. package/dist/tools/session-tools.d.ts.map +1 -0
  169. package/dist/tools/session-tools.js +312 -0
  170. package/dist/tools/session-tools.js.map +1 -0
  171. package/dist/tools/sessions-state-processor.d.ts +37 -0
  172. package/dist/tools/sessions-state-processor.d.ts.map +1 -0
  173. package/dist/tools/sessions-state-processor.js +206 -0
  174. package/dist/tools/sessions-state-processor.js.map +1 -0
  175. package/dist/tools/work-item-tools.d.ts +28 -0
  176. package/dist/tools/work-item-tools.d.ts.map +1 -0
  177. package/dist/tools/work-item-tools.js +322 -0
  178. package/dist/tools/work-item-tools.js.map +1 -0
  179. package/dist/work-items/create-work-item.d.ts +55 -0
  180. package/dist/work-items/create-work-item.d.ts.map +1 -0
  181. package/dist/work-items/create-work-item.js +101 -0
  182. package/dist/work-items/create-work-item.js.map +1 -0
  183. package/dist/work-items/decision-actions.d.ts +42 -0
  184. package/dist/work-items/decision-actions.d.ts.map +1 -0
  185. package/dist/work-items/decision-actions.js +70 -0
  186. package/dist/work-items/decision-actions.js.map +1 -0
  187. package/dist/workspace.d.ts.map +1 -1
  188. package/dist/workspace.js +3 -1
  189. package/dist/workspace.js.map +1 -1
  190. package/factory-skills/factory-gitlab-rereview/SKILL.md +1 -1
  191. package/factory-skills/factory-gitlab-review/SKILL.md +1 -1
  192. package/factory-skills/factory-plan/SKILL.md +4 -4
  193. package/factory-skills/factory-rereview/SKILL.md +3 -1
  194. package/factory-skills/factory-review/SKILL.md +3 -1
  195. package/factory-skills/factory-self-review/SKILL.md +46 -0
  196. package/package.json +7 -7
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Filing a work item, shared by the board's create route and the Factory tools
3
+ * so a card filed from a session goes through exactly what "New card" does.
4
+ */
5
+ import type { BoardRegistry } from '../boards/index.js';
6
+ import type { FactoryTransitionRequest, FactoryTransitionService } from '../rules/transition-service.js';
7
+ import type { EmitAuditInput } from '../storage/domains/audit/domain.js';
8
+ import type { CreateWorkItemInput, WorkItemRow, WorkItemsStorage } from '../storage/domains/work-items/base.js';
9
+ /** Records one audit event for the caller; routes bind it to the request, tools to the session's person. */
10
+ export type FactoryAuditEmit = (input: EmitAuditInput) => Promise<void>;
11
+ type TransitionResult = Awaited<ReturnType<FactoryTransitionService['transition']>>;
12
+ export type CreateFactoryWorkItemResult =
13
+ /** A new card, entered into its board's first phase and audited. */
14
+ {
15
+ status: 'created';
16
+ item: WorkItemRow;
17
+ }
18
+ /** The source key matched an existing card, which was updated instead (the caller audits the patch). */
19
+ | {
20
+ status: 'reused';
21
+ item: WorkItemRow;
22
+ } | {
23
+ status: 'refused';
24
+ code: 'invalid_board' | 'governed_transition_required' | 'factory_transitions_unavailable';
25
+ message: string;
26
+ }
27
+ /** The first phase's entry rules refused the card; it was removed again. */
28
+ | {
29
+ status: 'rejected';
30
+ code: Extract<TransitionResult, {
31
+ status: 'rejected';
32
+ }>['code'];
33
+ reason: string;
34
+ };
35
+ export interface CreateFactoryWorkItemArgs {
36
+ workItems: WorkItemsStorage;
37
+ boards: BoardRegistry;
38
+ transitionService: Pick<FactoryTransitionService, 'transition'> | undefined;
39
+ audit: FactoryAuditEmit;
40
+ orgId: string;
41
+ /** Who files the card; becomes its `created_by` and the human actor of its first phase entry. */
42
+ userId: string;
43
+ factoryProjectId: string;
44
+ input: CreateWorkItemInput;
45
+ /** Where a browser request came from; a session's tool call carries none. */
46
+ origin?: Pick<FactoryTransitionRequest, 'actorProfile' | 'context'>;
47
+ }
48
+ /**
49
+ * Upserts the card into its board's first phase, enters that phase as the
50
+ * person (rolling the card back if its entry rules refuse it), then audits
51
+ * `factory.work_item.created`. Throws `WorkItemRelationError` for a bad parent.
52
+ */
53
+ export declare function createFactoryWorkItem({ workItems, boards, transitionService, audit, orgId, userId, factoryProjectId, input, origin, }: CreateFactoryWorkItemArgs): Promise<CreateFactoryWorkItemResult>;
54
+ export {};
55
+ //# sourceMappingURL=create-work-item.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-work-item.d.ts","sourceRoot":"","sources":["../../src/work-items/create-work-item.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AACzG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAEhH,4GAA4G;AAC5G,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAExE,KAAK,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC,wBAAwB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;AAEpF,MAAM,MAAM,2BAA2B;AACrC,oEAAoE;AAClE;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,WAAW,CAAA;CAAE;AAC1C,wGAAwG;GACtG;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,WAAW,CAAA;CAAE,GACvC;IACE,MAAM,EAAE,SAAS,CAAC;IAClB,IAAI,EAAE,eAAe,GAAG,8BAA8B,GAAG,iCAAiC,CAAC;IAC3F,OAAO,EAAE,MAAM,CAAC;CACjB;AACH,4EAA4E;GAC1E;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC,gBAAgB,EAAE;QAAE,MAAM,EAAE,UAAU,CAAA;KAAE,CAAC,CAAC,MAAM,CAAC,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5G,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,gBAAgB,CAAC;IAC5B,MAAM,EAAE,aAAa,CAAC;IACtB,iBAAiB,EAAE,IAAI,CAAC,wBAAwB,EAAE,YAAY,CAAC,GAAG,SAAS,CAAC;IAC5E,KAAK,EAAE,gBAAgB,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,iGAAiG;IACjG,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,mBAAmB,CAAC;IAC3B,6EAA6E;IAC7E,MAAM,CAAC,EAAE,IAAI,CAAC,wBAAwB,EAAE,cAAc,GAAG,SAAS,CAAC,CAAC;CACrE;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,EAC1C,SAAS,EACT,MAAM,EACN,iBAAiB,EACjB,KAAK,EACL,KAAK,EACL,MAAM,EACN,gBAAgB,EAChB,KAAK,EACL,MAAM,GACP,EAAE,yBAAyB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAyDlE"}
@@ -0,0 +1,101 @@
1
+ //#region src/work-items/create-work-item.ts
2
+ /**
3
+ * Upserts the card into its board's first phase, enters that phase as the
4
+ * person (rolling the card back if its entry rules refuse it), then audits
5
+ * `factory.work_item.created`. Throws `WorkItemRelationError` for a bad parent.
6
+ */
7
+ async function createFactoryWorkItem({ workItems, boards, transitionService, audit, orgId, userId, factoryProjectId, input, origin }) {
8
+ const boardId = input.board ?? (input.externalSource?.type === "pull-request" ? "review" : "work");
9
+ const board = boards.get(boardId);
10
+ if (!board) return {
11
+ status: "refused",
12
+ code: "invalid_board",
13
+ message: `Board '${boardId}' is not installed.`
14
+ };
15
+ const initialStages = input.stages ?? [board.initialPhase];
16
+ if (initialStages.length !== 1 || initialStages[0] !== board.initialPhase) return {
17
+ status: "refused",
18
+ code: "governed_transition_required",
19
+ message: `New work items must enter through the '${board.initialPhase}' phase of board '${boardId}'.`
20
+ };
21
+ await workItems.ensureReady();
22
+ const result = await workItems.upsert({
23
+ orgId,
24
+ userId,
25
+ factoryProjectId,
26
+ input: {
27
+ ...input,
28
+ board: boardId,
29
+ stages: initialStages
30
+ },
31
+ reuseMode: "non-stage"
32
+ });
33
+ if (!result.created) return {
34
+ status: "reused",
35
+ item: result.item
36
+ };
37
+ const created = result.item;
38
+ if (!transitionService) {
39
+ await workItems.delete({
40
+ orgId,
41
+ id: created.id
42
+ });
43
+ return {
44
+ status: "refused",
45
+ code: "factory_transitions_unavailable",
46
+ message: "Factory stage transitions are not available right now."
47
+ };
48
+ }
49
+ const entered = await transitionService.transition({
50
+ orgId,
51
+ factoryProjectId,
52
+ workItemId: created.id,
53
+ board: boardId,
54
+ stage: board.initialPhase,
55
+ expectedRevision: created.revision,
56
+ actor: {
57
+ type: "human",
58
+ id: userId
59
+ },
60
+ ...origin,
61
+ ingress: {
62
+ type: "human",
63
+ identity: `work-item:${created.id}:initial-entry`
64
+ },
65
+ cause: "work_item_created",
66
+ initialEntry: true
67
+ });
68
+ if (entered.status === "rejected") {
69
+ await workItems.delete({
70
+ orgId,
71
+ id: created.id
72
+ });
73
+ return {
74
+ status: "rejected",
75
+ code: entered.code,
76
+ reason: entered.reason
77
+ };
78
+ }
79
+ const item = await workItems.getForProject(orgId, factoryProjectId, created.id) ?? created;
80
+ await audit({
81
+ action: "factory.work_item.created",
82
+ factoryProjectId,
83
+ targets: [{
84
+ type: "work_item",
85
+ id: item.id,
86
+ name: item.title
87
+ }],
88
+ metadata: {
89
+ externalSource: item.externalSource,
90
+ stages: item.stages
91
+ }
92
+ });
93
+ return {
94
+ status: "created",
95
+ item
96
+ };
97
+ }
98
+ //#endregion
99
+ export { createFactoryWorkItem };
100
+
101
+ //# sourceMappingURL=create-work-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-work-item.js","names":[],"sources":["../../src/work-items/create-work-item.ts"],"sourcesContent":["/**\n * Filing a work item, shared by the board's create route and the Factory tools\n * so a card filed from a session goes through exactly what \"New card\" does.\n */\n\nimport type { BoardRegistry } from '../boards/index.js';\nimport type { FactoryTransitionRequest, FactoryTransitionService } from '../rules/transition-service.js';\nimport type { EmitAuditInput } from '../storage/domains/audit/domain.js';\nimport type { CreateWorkItemInput, WorkItemRow, WorkItemsStorage } from '../storage/domains/work-items/base.js';\n\n/** Records one audit event for the caller; routes bind it to the request, tools to the session's person. */\nexport type FactoryAuditEmit = (input: EmitAuditInput) => Promise<void>;\n\ntype TransitionResult = Awaited<ReturnType<FactoryTransitionService['transition']>>;\n\nexport type CreateFactoryWorkItemResult =\n /** A new card, entered into its board's first phase and audited. */\n | { status: 'created'; item: WorkItemRow }\n /** The source key matched an existing card, which was updated instead (the caller audits the patch). */\n | { status: 'reused'; item: WorkItemRow }\n | {\n status: 'refused';\n code: 'invalid_board' | 'governed_transition_required' | 'factory_transitions_unavailable';\n message: string;\n }\n /** The first phase's entry rules refused the card; it was removed again. */\n | { status: 'rejected'; code: Extract<TransitionResult, { status: 'rejected' }>['code']; reason: string };\n\nexport interface CreateFactoryWorkItemArgs {\n workItems: WorkItemsStorage;\n boards: BoardRegistry;\n transitionService: Pick<FactoryTransitionService, 'transition'> | undefined;\n audit: FactoryAuditEmit;\n orgId: string;\n /** Who files the card; becomes its `created_by` and the human actor of its first phase entry. */\n userId: string;\n factoryProjectId: string;\n input: CreateWorkItemInput;\n /** Where a browser request came from; a session's tool call carries none. */\n origin?: Pick<FactoryTransitionRequest, 'actorProfile' | 'context'>;\n}\n\n/**\n * Upserts the card into its board's first phase, enters that phase as the\n * person (rolling the card back if its entry rules refuse it), then audits\n * `factory.work_item.created`. Throws `WorkItemRelationError` for a bad parent.\n */\nexport async function createFactoryWorkItem({\n workItems,\n boards,\n transitionService,\n audit,\n orgId,\n userId,\n factoryProjectId,\n input,\n origin,\n}: CreateFactoryWorkItemArgs): Promise<CreateFactoryWorkItemResult> {\n const boardId = input.board ?? (input.externalSource?.type === 'pull-request' ? 'review' : 'work');\n const board = boards.get(boardId);\n if (!board) return { status: 'refused', code: 'invalid_board', message: `Board '${boardId}' is not installed.` };\n const initialStages = input.stages ?? [board.initialPhase];\n if (initialStages.length !== 1 || initialStages[0] !== board.initialPhase) {\n return {\n status: 'refused',\n code: 'governed_transition_required',\n message: `New work items must enter through the '${board.initialPhase}' phase of board '${boardId}'.`,\n };\n }\n\n await workItems.ensureReady();\n const result = await workItems.upsert({\n orgId,\n userId,\n factoryProjectId,\n input: { ...input, board: boardId, stages: initialStages },\n reuseMode: 'non-stage',\n });\n if (!result.created) return { status: 'reused', item: result.item };\n\n const created = result.item;\n if (!transitionService) {\n await workItems.delete({ orgId, id: created.id });\n return {\n status: 'refused',\n code: 'factory_transitions_unavailable',\n message: 'Factory stage transitions are not available right now.',\n };\n }\n const entered = await transitionService.transition({\n orgId,\n factoryProjectId,\n workItemId: created.id,\n board: boardId,\n stage: board.initialPhase,\n expectedRevision: created.revision,\n actor: { type: 'human', id: userId },\n ...origin,\n ingress: { type: 'human', identity: `work-item:${created.id}:initial-entry` },\n cause: 'work_item_created',\n initialEntry: true,\n });\n if (entered.status === 'rejected') {\n await workItems.delete({ orgId, id: created.id });\n return { status: 'rejected', code: entered.code, reason: entered.reason };\n }\n const item = (await workItems.getForProject(orgId, factoryProjectId, created.id)) ?? created;\n await audit({\n action: 'factory.work_item.created',\n factoryProjectId,\n targets: [{ type: 'work_item', id: item.id, name: item.title }],\n metadata: { externalSource: item.externalSource, stages: item.stages },\n });\n return { status: 'created', item };\n}\n"],"mappings":";;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E,QAAQ;GAAY,MAAM,QAAQ;GAAM,QAAQ,QAAQ;EAAO;CAC1E;CACA,MAAM,OAAQ,MAAM,UAAU,cAAc,OAAO,kBAAkB,QAAQ,EAAE,KAAM;CACrF,MAAM,MAAM;EACV,QAAQ;EACR;EACA,SAAS,CAAC;GAAE,MAAM;GAAa,IAAI,KAAK;GAAI,MAAM,KAAK;EAAM,CAAC;EAC9D,UAAU;GAAE,gBAAgB,KAAK;GAAgB,QAAQ,KAAK;EAAO;CACvE,CAAC;CACD,OAAO;EAAE,QAAQ;EAAW;CAAK;AACnC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Retrying, approving and dismissing Factory decisions, shared by the board's
3
+ * routes and the Factory tools so both refuse and audit the same way.
4
+ */
5
+ import type { BoardRegistry } from '../boards/index.js';
6
+ import type { FactoryDeferredDecisionRecord, WorkItemsStorage } from '../storage/domains/work-items/base.js';
7
+ import type { FactoryAuditEmit } from './create-work-item.js';
8
+ export type FactoryDecisionActionResult = {
9
+ ok: true;
10
+ decision: FactoryDeferredDecisionRecord;
11
+ } | {
12
+ ok: false;
13
+ code: 'decision_not_retryable' | 'decision_not_proposed';
14
+ message: string;
15
+ };
16
+ interface DecisionActionArgs {
17
+ workItems: WorkItemsStorage;
18
+ orgId: string;
19
+ factoryProjectId: string;
20
+ decisionId: string;
21
+ }
22
+ /** Re-queue a failed run, unless its failure can't be fixed by retrying or the card has left the run's phase. */
23
+ export declare function retryFactoryDecision({ workItems, boards, orgId, factoryProjectId, decisionId, }: DecisionActionArgs & {
24
+ boards: BoardRegistry;
25
+ }): Promise<FactoryDecisionActionResult>;
26
+ /**
27
+ * Release (approve) or drop (dismiss) a parked proposal as `userId`, audited as
28
+ * consent. Approval arms the item's autonomy inside the same storage
29
+ * transaction (see approveDeferredDecision), so follow-up runs no longer wait.
30
+ */
31
+ export declare function resolveFactoryProposal({ workItems, audit, orgId, factoryProjectId, userId, decisionId, action, }: DecisionActionArgs & {
32
+ audit: FactoryAuditEmit;
33
+ userId: string;
34
+ action: 'approve' | 'dismiss';
35
+ }): Promise<FactoryDecisionActionResult>;
36
+ /** Drop a parked proposal; the same as dismissing it through {@link resolveFactoryProposal}. */
37
+ export declare function dismissFactoryDecision(args: DecisionActionArgs & {
38
+ audit: FactoryAuditEmit;
39
+ userId: string;
40
+ }): Promise<FactoryDecisionActionResult>;
41
+ export {};
42
+ //# sourceMappingURL=decision-actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decision-actions.d.ts","sourceRoot":"","sources":["../../src/work-items/decision-actions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGxD,OAAO,KAAK,EAAE,6BAA6B,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAC7G,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,MAAM,MAAM,2BAA2B,GACnC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,6BAA6B,CAAA;CAAE,GACrD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,wBAAwB,GAAG,uBAAuB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7F,UAAU,kBAAkB;IAC1B,SAAS,EAAE,gBAAgB,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;CACpB;AAQD,iHAAiH;AACjH,wBAAsB,oBAAoB,CAAC,EACzC,SAAS,EACT,MAAM,EACN,KAAK,EACL,gBAAgB,EAChB,UAAU,GACX,EAAE,kBAAkB,GAAG;IAAE,MAAM,EAAE,aAAa,CAAA;CAAE,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAevF;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,EAC3C,SAAS,EACT,KAAK,EACL,KAAK,EACL,gBAAgB,EAChB,MAAM,EACN,UAAU,EACV,MAAM,GACP,EAAE,kBAAkB,GAAG;IACtB,KAAK,EAAE,gBAAgB,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC;CAC/B,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAuBvC;AAED,gGAAgG;AAChG,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,kBAAkB,GAAG;IAAE,KAAK,EAAE,gBAAgB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACrE,OAAO,CAAC,2BAA2B,CAAC,CAEtC"}
@@ -0,0 +1,70 @@
1
+ import { decisionRetryable, overtakenDecisionIds } from "../rules/decision-applicability.js";
2
+ import { factoryDecisionType } from "../routes/attention-providers.js";
3
+ import "../routes/attention.js";
4
+ //#region src/work-items/decision-actions.ts
5
+ const notRetryable = (message) => ({
6
+ ok: false,
7
+ code: "decision_not_retryable",
8
+ message
9
+ });
10
+ /** Re-queue a failed run, unless its failure can't be fixed by retrying or the card has left the run's phase. */
11
+ async function retryFactoryDecision({ workItems, boards, orgId, factoryProjectId, decisionId }) {
12
+ await workItems.ensureReady();
13
+ const current = await workItems.getDeferredDecision(orgId, factoryProjectId, decisionId);
14
+ if (!current || !decisionRetryable(current, false)) return notRetryable("The decision is not a retryable failure, no longer exists, or belongs to another Factory.");
15
+ if ((await overtakenDecisionIds(workItems, boards, {
16
+ orgId,
17
+ factoryProjectId
18
+ }, [current])).size > 0) return notRetryable("The work item has moved on from the phase this run was decided for; it cannot be retried.");
19
+ const decision = await workItems.retryDeferredDecision(orgId, factoryProjectId, decisionId, /* @__PURE__ */ new Date());
20
+ if (!decision) return notRetryable("The decision is not a retryable failure, no longer exists, or belongs to another Factory.");
21
+ return {
22
+ ok: true,
23
+ decision
24
+ };
25
+ }
26
+ /**
27
+ * Release (approve) or drop (dismiss) a parked proposal as `userId`, audited as
28
+ * consent. Approval arms the item's autonomy inside the same storage
29
+ * transaction (see approveDeferredDecision), so follow-up runs no longer wait.
30
+ */
31
+ async function resolveFactoryProposal({ workItems, audit, orgId, factoryProjectId, userId, decisionId, action }) {
32
+ await workItems.ensureReady();
33
+ const now = /* @__PURE__ */ new Date();
34
+ const decision = action === "approve" ? await workItems.approveDeferredDecision(orgId, factoryProjectId, decisionId, now, userId) : await workItems.dismissDeferredDecision(orgId, factoryProjectId, decisionId, now);
35
+ if (!decision) return {
36
+ ok: false,
37
+ code: "decision_not_proposed",
38
+ message: "The decision is not an open proposal, no longer exists, or belongs to another Factory."
39
+ };
40
+ await audit({
41
+ action: action === "approve" ? "factory.run.approved" : "factory.run.dismissed",
42
+ factoryProjectId,
43
+ targets: decision.workItemId ? [{
44
+ type: "work_item",
45
+ id: decision.workItemId
46
+ }] : [{
47
+ type: "rule_decision",
48
+ id: decision.id
49
+ }],
50
+ metadata: {
51
+ decisionId: decision.id,
52
+ effect: factoryDecisionType(decision)
53
+ }
54
+ });
55
+ return {
56
+ ok: true,
57
+ decision
58
+ };
59
+ }
60
+ /** Drop a parked proposal; the same as dismissing it through {@link resolveFactoryProposal}. */
61
+ function dismissFactoryDecision(args) {
62
+ return resolveFactoryProposal({
63
+ ...args,
64
+ action: "dismiss"
65
+ });
66
+ }
67
+ //#endregion
68
+ export { dismissFactoryDecision, resolveFactoryProposal, retryFactoryDecision };
69
+
70
+ //# sourceMappingURL=decision-actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decision-actions.js","names":[],"sources":["../../src/work-items/decision-actions.ts"],"sourcesContent":["/**\n * Retrying, approving and dismissing Factory decisions, shared by the board's\n * routes and the Factory tools so both refuse and audit the same way.\n */\n\nimport type { BoardRegistry } from '../boards/index.js';\nimport { factoryDecisionType } from '../routes/attention.js';\nimport { decisionRetryable, overtakenDecisionIds } from '../rules/decision-applicability.js';\nimport type { FactoryDeferredDecisionRecord, WorkItemsStorage } from '../storage/domains/work-items/base.js';\nimport type { FactoryAuditEmit } from './create-work-item.js';\n\nexport type FactoryDecisionActionResult =\n | { ok: true; decision: FactoryDeferredDecisionRecord }\n | { ok: false; code: 'decision_not_retryable' | 'decision_not_proposed'; message: string };\n\ninterface DecisionActionArgs {\n workItems: WorkItemsStorage;\n orgId: string;\n factoryProjectId: string;\n decisionId: string;\n}\n\nconst notRetryable = (message: string): FactoryDecisionActionResult => ({\n ok: false,\n code: 'decision_not_retryable',\n message,\n});\n\n/** Re-queue a failed run, unless its failure can't be fixed by retrying or the card has left the run's phase. */\nexport async function retryFactoryDecision({\n workItems,\n boards,\n orgId,\n factoryProjectId,\n decisionId,\n}: DecisionActionArgs & { boards: BoardRegistry }): Promise<FactoryDecisionActionResult> {\n await workItems.ensureReady();\n const current = await workItems.getDeferredDecision(orgId, factoryProjectId, decisionId);\n if (!current || !decisionRetryable(current, false)) {\n return notRetryable('The decision is not a retryable failure, no longer exists, or belongs to another Factory.');\n }\n // A run decided for a phase the card has left would seat the old role on it.\n if ((await overtakenDecisionIds(workItems, boards, { orgId, factoryProjectId }, [current])).size > 0) {\n return notRetryable('The work item has moved on from the phase this run was decided for; it cannot be retried.');\n }\n const decision = await workItems.retryDeferredDecision(orgId, factoryProjectId, decisionId, new Date());\n if (!decision) {\n return notRetryable('The decision is not a retryable failure, no longer exists, or belongs to another Factory.');\n }\n return { ok: true, decision };\n}\n\n/**\n * Release (approve) or drop (dismiss) a parked proposal as `userId`, audited as\n * consent. Approval arms the item's autonomy inside the same storage\n * transaction (see approveDeferredDecision), so follow-up runs no longer wait.\n */\nexport async function resolveFactoryProposal({\n workItems,\n audit,\n orgId,\n factoryProjectId,\n userId,\n decisionId,\n action,\n}: DecisionActionArgs & {\n audit: FactoryAuditEmit;\n userId: string;\n action: 'approve' | 'dismiss';\n}): Promise<FactoryDecisionActionResult> {\n await workItems.ensureReady();\n const now = new Date();\n const decision =\n action === 'approve'\n ? await workItems.approveDeferredDecision(orgId, factoryProjectId, decisionId, now, userId)\n : await workItems.dismissDeferredDecision(orgId, factoryProjectId, decisionId, now);\n if (!decision) {\n return {\n ok: false,\n code: 'decision_not_proposed',\n message: 'The decision is not an open proposal, no longer exists, or belongs to another Factory.',\n };\n }\n await audit({\n action: action === 'approve' ? 'factory.run.approved' : 'factory.run.dismissed',\n factoryProjectId,\n targets: decision.workItemId\n ? [{ type: 'work_item', id: decision.workItemId }]\n : [{ type: 'rule_decision', id: decision.id }],\n metadata: { decisionId: decision.id, effect: factoryDecisionType(decision) },\n });\n return { ok: true, decision };\n}\n\n/** Drop a parked proposal; the same as dismissing it through {@link resolveFactoryProposal}. */\nexport function dismissFactoryDecision(\n args: DecisionActionArgs & { audit: FactoryAuditEmit; userId: string },\n): Promise<FactoryDecisionActionResult> {\n return resolveFactoryProposal({ ...args, action: 'dismiss' });\n}\n"],"mappings":";;;;AAsBA,MAAM,gBAAgB,aAAkD;CACtE,IAAI;CACJ,MAAM;CACN;AACF;;AAGA,eAAsB,qBAAqB,EACzC,WACA,QACA,OACA,kBACA,cACuF;CACvF,MAAM,UAAU,YAAY;CAC5B,MAAM,UAAU,MAAM,UAAU,oBAAoB,OAAO,kBAAkB,UAAU;CACvF,IAAI,CAAC,WAAW,CAAC,kBAAkB,SAAS,KAAK,GAC/C,OAAO,aAAa,2FAA2F;CAGjH,KAAK,MAAM,qBAAqB,WAAW,QAAQ;EAAE;EAAO;CAAiB,GAAG,CAAC,OAAO,CAAC,EAAA,CAAG,OAAO,GACjG,OAAO,aAAa,2FAA2F;CAEjH,MAAM,WAAW,MAAM,UAAU,sBAAsB,OAAO,kBAAkB,4BAAY,IAAI,KAAK,CAAC;CACtG,IAAI,CAAC,UACH,OAAO,aAAa,2FAA2F;CAEjH,OAAO;EAAE,IAAI;EAAM;CAAS;AAC9B;;;;;;AAOA,eAAsB,uBAAuB,EAC3C,WACA,OACA,OACA,kBACA,QACA,YACA,UAKuC;CACvC,MAAM,UAAU,YAAY;CAC5B,MAAM,sBAAM,IAAI,KAAK;CACrB,MAAM,WACJ,WAAW,YACP,MAAM,UA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IAAI,CAAC,0BAA0B,EAAE,qBAAqB,GAAG,cAAc,CAAC,EACjF,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,kBAAkB,CAAC,CAqD7B;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,kBAAkB,EAC/B,OAAO,EAAE;IACP,KAAK,EAAE,MAAM,CAAC;IACd,mBAAmB,EAAE,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAClG,WAAW,CAAC,EAAE,qBAAqB,CAAC,aAAa,CAAC,CAAC;CACpD,GACA,IAAI,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAe1C;AAED,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,6BAAkC,IAmClE,4CAA4C,uBAAuB,2MAk7BlF"}
package/dist/workspace.js CHANGED
@@ -44,6 +44,7 @@ const FACTORY_SKILL_NAMES = /* @__PURE__ */ new Set([
44
44
  "factory-plan",
45
45
  "factory-rereview",
46
46
  "factory-review",
47
+ "factory-self-review",
47
48
  "factory-triage"
48
49
  ]);
49
50
  /** Review skills only sessions with an active review run binding may discover or load. */
@@ -51,7 +52,8 @@ const REVIEW_ONLY_FACTORY_SKILLS = /* @__PURE__ */ new Set([
51
52
  "factory-gitlab-rereview",
52
53
  "factory-gitlab-review",
53
54
  "factory-rereview",
54
- "factory-review"
55
+ "factory-review",
56
+ "factory-self-review"
55
57
  ]);
56
58
  /**
57
59
  * Skill caches rescanned outside the workspace resolver. The resolver records