@mastra/factory 0.29.0-alpha.5 → 0.29.0-alpha.7

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 (183) hide show
  1. package/README.md +55 -31
  2. package/dist/boards/semantics.d.ts.map +1 -1
  3. package/dist/boards/semantics.js +7 -1
  4. package/dist/boards/semantics.js.map +1 -1
  5. package/dist/factory.d.ts +10 -0
  6. package/dist/factory.d.ts.map +1 -1
  7. package/dist/factory.js +98 -41
  8. package/dist/factory.js.map +1 -1
  9. package/dist/integrations/github/issue-intake.d.ts +15 -0
  10. package/dist/integrations/github/issue-intake.d.ts.map +1 -0
  11. package/dist/integrations/github/issue-intake.js +50 -0
  12. package/dist/integrations/github/issue-intake.js.map +1 -0
  13. package/dist/integrations/github/issue-reconciler.d.ts.map +1 -1
  14. package/dist/integrations/github/issue-reconciler.js +10 -1
  15. package/dist/integrations/github/issue-reconciler.js.map +1 -1
  16. package/dist/integrations/github/rules.d.ts +2 -0
  17. package/dist/integrations/github/rules.d.ts.map +1 -1
  18. package/dist/integrations/github/rules.js +3 -0
  19. package/dist/integrations/github/rules.js.map +1 -1
  20. package/dist/integrations/platform/connect/routes.d.ts +43 -1
  21. package/dist/integrations/platform/connect/routes.d.ts.map +1 -1
  22. package/dist/integrations/platform/connect/routes.js +82 -7
  23. package/dist/integrations/platform/connect/routes.js.map +1 -1
  24. package/dist/integrations/platform/connect/session-tools.d.ts +12 -0
  25. package/dist/integrations/platform/connect/session-tools.d.ts.map +1 -1
  26. package/dist/integrations/platform/connect/session-tools.js +28 -10
  27. package/dist/integrations/platform/connect/session-tools.js.map +1 -1
  28. package/dist/integrations/platform/vanta/integration.d.ts.map +1 -1
  29. package/dist/integrations/platform/vanta/integration.js +3 -3
  30. package/dist/integrations/platform/vanta/integration.js.map +1 -1
  31. package/dist/integrations/vanta/sync.d.ts +9 -0
  32. package/dist/integrations/vanta/sync.d.ts.map +1 -1
  33. package/dist/integrations/vanta/sync.js +10 -1
  34. package/dist/integrations/vanta/sync.js.map +1 -1
  35. package/dist/routes/board-snapshot.d.ts +5 -5
  36. package/dist/routes/board-snapshot.d.ts.map +1 -1
  37. package/dist/routes/board-snapshot.js +10 -14
  38. package/dist/routes/board-snapshot.js.map +1 -1
  39. package/dist/routes/config.d.ts +11 -2
  40. package/dist/routes/config.d.ts.map +1 -1
  41. package/dist/routes/config.js +242 -75
  42. package/dist/routes/config.js.map +1 -1
  43. package/dist/routes/contracts.d.ts +43 -14
  44. package/dist/routes/contracts.d.ts.map +1 -1
  45. package/dist/routes/contracts.js +27 -17
  46. package/dist/routes/contracts.js.map +1 -1
  47. package/dist/routes/custom-endpoint-url.d.ts +8 -0
  48. package/dist/routes/custom-endpoint-url.d.ts.map +1 -0
  49. package/dist/routes/custom-endpoint-url.js +45 -0
  50. package/dist/routes/custom-endpoint-url.js.map +1 -0
  51. package/dist/routes/custom-provider-source.d.ts +24 -8
  52. package/dist/routes/custom-provider-source.d.ts.map +1 -1
  53. package/dist/routes/custom-provider-source.js +93 -43
  54. package/dist/routes/custom-provider-source.js.map +1 -1
  55. package/dist/routes/intake.d.ts +6 -0
  56. package/dist/routes/intake.d.ts.map +1 -1
  57. package/dist/routes/intake.js +20 -0
  58. package/dist/routes/intake.js.map +1 -1
  59. package/dist/routes/project-sessions.d.ts +15 -3
  60. package/dist/routes/project-sessions.d.ts.map +1 -1
  61. package/dist/routes/project-sessions.js +56 -14
  62. package/dist/routes/project-sessions.js.map +1 -1
  63. package/dist/routes/projects.d.ts +6 -1
  64. package/dist/routes/projects.d.ts.map +1 -1
  65. package/dist/routes/projects.js +19 -3
  66. package/dist/routes/projects.js.map +1 -1
  67. package/dist/routes/provider-credentials.d.ts +10 -1
  68. package/dist/routes/provider-credentials.d.ts.map +1 -1
  69. package/dist/routes/provider-credentials.js +13 -16
  70. package/dist/routes/provider-credentials.js.map +1 -1
  71. package/dist/routes/session-rows.d.ts +1 -1
  72. package/dist/routes/session-rows.d.ts.map +1 -1
  73. package/dist/routes/session-rows.js +38 -42
  74. package/dist/routes/session-rows.js.map +1 -1
  75. package/dist/routes/source-control-sessions.d.ts.map +1 -1
  76. package/dist/routes/source-control-sessions.js +4 -4
  77. package/dist/routes/source-control-sessions.js.map +1 -1
  78. package/dist/routes/surface.d.ts +3 -0
  79. package/dist/routes/surface.d.ts.map +1 -1
  80. package/dist/routes/surface.js +20 -7
  81. package/dist/routes/surface.js.map +1 -1
  82. package/dist/routes/tenant-credentials.d.ts.map +1 -1
  83. package/dist/routes/tenant-credentials.js +4 -4
  84. package/dist/routes/tenant-credentials.js.map +1 -1
  85. package/dist/routes/work-items.d.ts +9 -3
  86. package/dist/routes/work-items.d.ts.map +1 -1
  87. package/dist/routes/work-items.js +39 -16
  88. package/dist/routes/work-items.js.map +1 -1
  89. package/dist/rules/binding-context.d.ts +5 -0
  90. package/dist/rules/binding-context.d.ts.map +1 -1
  91. package/dist/rules/binding-context.js +51 -5
  92. package/dist/rules/binding-context.js.map +1 -1
  93. package/dist/rules/dispatcher.d.ts.map +1 -1
  94. package/dist/rules/dispatcher.js +2 -1
  95. package/dist/rules/dispatcher.js.map +1 -1
  96. package/dist/rules/start-coordinator.d.ts.map +1 -1
  97. package/dist/rules/start-coordinator.js +2 -7
  98. package/dist/rules/start-coordinator.js.map +1 -1
  99. package/dist/sandbox/session-retirement.d.ts +6 -0
  100. package/dist/sandbox/session-retirement.d.ts.map +1 -1
  101. package/dist/sandbox/session-retirement.js +17 -0
  102. package/dist/sandbox/session-retirement.js.map +1 -1
  103. package/dist/session/factory-session.d.ts.map +1 -1
  104. package/dist/session/factory-session.js +2 -1
  105. package/dist/session/factory-session.js.map +1 -1
  106. package/dist/session/live-sessions.d.ts +6 -1
  107. package/dist/session/live-sessions.d.ts.map +1 -1
  108. package/dist/session/live-sessions.js +4 -0
  109. package/dist/session/live-sessions.js.map +1 -1
  110. package/dist/session/run-audit.d.ts +1 -1
  111. package/dist/session/run-audit.d.ts.map +1 -1
  112. package/dist/session/run-audit.js.map +1 -1
  113. package/dist/session/session-row-status.d.ts +3 -3
  114. package/dist/session/session-row-status.js +4 -4
  115. package/dist/session/session-row-status.js.map +1 -1
  116. package/dist/session/session-row-view.d.ts +3 -4
  117. package/dist/session/session-row-view.d.ts.map +1 -1
  118. package/dist/session/session-row-view.js +14 -21
  119. package/dist/session/session-row-view.js.map +1 -1
  120. package/dist/session/session-rows.d.ts +22 -8
  121. package/dist/session/session-rows.d.ts.map +1 -1
  122. package/dist/session/session-rows.js +158 -83
  123. package/dist/session/session-rows.js.map +1 -1
  124. package/dist/session/session-unloader.d.ts +101 -0
  125. package/dist/session/session-unloader.d.ts.map +1 -0
  126. package/dist/session/session-unloader.js +278 -0
  127. package/dist/session/session-unloader.js.map +1 -0
  128. package/dist/session/work-item-repository.d.ts +5 -1
  129. package/dist/session/work-item-repository.d.ts.map +1 -1
  130. package/dist/session/work-item-repository.js +39 -15
  131. package/dist/session/work-item-repository.js.map +1 -1
  132. package/dist/session-list-changes.d.ts +9 -0
  133. package/dist/session-list-changes.d.ts.map +1 -0
  134. package/dist/session-list-changes.js +54 -0
  135. package/dist/session-list-changes.js.map +1 -0
  136. package/dist/storage/announced-lists.d.ts +14 -0
  137. package/dist/storage/announced-lists.d.ts.map +1 -0
  138. package/dist/storage/announced-lists.js +78 -0
  139. package/dist/storage/announced-lists.js.map +1 -0
  140. package/dist/storage/domains/boards/base.d.ts +1 -1
  141. package/dist/storage/domains/boards/base.d.ts.map +1 -1
  142. package/dist/storage/domains/boards/base.js +27 -9
  143. package/dist/storage/domains/boards/base.js.map +1 -1
  144. package/dist/storage/domains/custom-providers/base.d.ts +62 -19
  145. package/dist/storage/domains/custom-providers/base.d.ts.map +1 -1
  146. package/dist/storage/domains/custom-providers/base.js +131 -100
  147. package/dist/storage/domains/custom-providers/base.js.map +1 -1
  148. package/dist/storage/domains/intake/base.d.ts +25 -7
  149. package/dist/storage/domains/intake/base.d.ts.map +1 -1
  150. package/dist/storage/domains/intake/base.js +83 -19
  151. package/dist/storage/domains/intake/base.js.map +1 -1
  152. package/dist/storage/domains/source-control/base.d.ts +8 -0
  153. package/dist/storage/domains/source-control/base.d.ts.map +1 -1
  154. package/dist/storage/domains/source-control/base.js +110 -64
  155. package/dist/storage/domains/source-control/base.js.map +1 -1
  156. package/dist/storage/domains/source-control/inmemory.d.ts +4 -0
  157. package/dist/storage/domains/source-control/inmemory.d.ts.map +1 -1
  158. package/dist/storage/domains/source-control/inmemory.js +8 -5
  159. package/dist/storage/domains/source-control/inmemory.js.map +1 -1
  160. package/dist/storage/domains/work-items/base.d.ts +9 -1
  161. package/dist/storage/domains/work-items/base.d.ts.map +1 -1
  162. package/dist/storage/domains/work-items/base.js +43 -11
  163. package/dist/storage/domains/work-items/base.js.map +1 -1
  164. package/dist/tools/read-tools.d.ts +9 -2
  165. package/dist/tools/read-tools.d.ts.map +1 -1
  166. package/dist/tools/read-tools.js +57 -12
  167. package/dist/tools/read-tools.js.map +1 -1
  168. package/dist/tools/session-tools.d.ts +0 -13
  169. package/dist/tools/session-tools.d.ts.map +1 -1
  170. package/dist/tools/session-tools.js +127 -336
  171. package/dist/tools/session-tools.js.map +1 -1
  172. package/dist/tools/work-item-tools.d.ts.map +1 -1
  173. package/dist/tools/work-item-tools.js +91 -23
  174. package/dist/tools/work-item-tools.js.map +1 -1
  175. package/dist/work-items/card-reference.d.ts +21 -0
  176. package/dist/work-items/card-reference.d.ts.map +1 -0
  177. package/dist/work-items/card-reference.js +58 -0
  178. package/dist/work-items/card-reference.js.map +1 -0
  179. package/package.json +7 -7
  180. package/dist/storage/probed-list.d.ts +0 -11
  181. package/dist/storage/probed-list.d.ts.map +0 -1
  182. package/dist/storage/probed-list.js +0 -52
  183. package/dist/storage/probed-list.js.map +0 -1
@@ -22,9 +22,16 @@ export interface FactoryReadToolDependencies {
22
22
  }
23
23
  export declare function truncate(text: string, max: number): string;
24
24
  export declare function workItemStage(item: Pick<Card, 'stages'>): string;
25
- /** A work item id or its card number; anything else can't name an item. */
25
+ /**
26
+ * A work item id, its card number, or the issue or pull request it tracks, as people paste it: a
27
+ * link, `owner/repo#123`, `group/project!7` or a tracker key like `ENG-42`. Anything else can't
28
+ * name an item.
29
+ */
26
30
  export declare const workItemRefSchema: z.ZodString;
27
- /** Resolve `<uuid>` or `#123` to an item in this Factory only. Pass a ref validated by `workItemRefSchema`. */
31
+ /**
32
+ * Resolve a ref validated by `workItemRefSchema` to an item in this Factory only. A link or
33
+ * shorthand finds the card of that issue or pull request, else the card it is attached to.
34
+ */
28
35
  export declare function findWorkItem(workItems: Pick<WorkItemsStorage, 'listShared' | 'getForProject'>, scope: Pick<FactoryToolScope, 'orgId' | 'factoryProjectId'>, ref: string): Promise<Card | null>;
29
36
  export declare function workItemNotFound(ref: string): Error;
30
37
  export declare function createFactoryReadTools(scope: FactoryToolScope, deps: FactoryReadToolDependencies): IntegrationTools;
@@ -1 +1 @@
1
- {"version":3,"file":"read-tools.d.ts","sourceRoot":"","sources":["../../src/tools/read-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAMhE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,KAAK,EAGV,IAAI,EACJ,gBAAgB,EACjB,MAAM,uCAAuC,CAAC;AAI/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,eAAO,MAAM,QAAQ,MAAM,CAAC;AAC5B,eAAO,MAAM,SAAS,MA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AAG,UAAU,CAAC,GAAG,SAAS,CAAC;CAC5E;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAE1D;AAQD,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,MAAM,CAEhE;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,aAU3B,CAAC;AAEJ;;;GAGG;AACH,wBAAsB,YAAY,CAChC,SAAS,EAAE,IAAI,CAAC,gBAAgB,EAAE,YAAY,GAAG,eAAe,CAAC,EACjE,KAAK,EAAE,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,kBAAkB,CAAC,EAC3D,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAsBtB;AAoCD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAEnD;AAkGD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,2BAA2B,GAAG,gBAAgB,CAuOnH"}
@@ -8,6 +8,7 @@ import { decisionRetryable, overtakenDecisionIds } from "../rules/decision-appli
8
8
  import { factoryDispatchFailureMetadata } from "../rules/dispatch-errors.js";
9
9
  import { needsApproval } from "../rules/types.js";
10
10
  import { workItemNumber } from "../work-items/card-number.js";
11
+ import { cardCarries, isCardFor, isSourceReference, sourceKeyFromReference } from "../work-items/card-reference.js";
11
12
  import { sessionActivity } from "./deliver.js";
12
13
  import { createTool } from "@mastra/core/tools";
13
14
  import { z } from "zod";
@@ -27,13 +28,21 @@ function iso(value) {
27
28
  function workItemStage(item) {
28
29
  return item.stages.join("+");
29
30
  }
30
- /** A work item id or its card number; anything else can't name an item. */
31
- const workItemRefSchema = z.string().trim().max(64).refine((ref) => z.string().uuid().safeParse(ref).success || /^#?\d+$/.test(ref), { message: "Use a work item id (UUID) or its number like \"#123\"." }).describe("Work item id, or its number like \"#123\".");
32
- /** Resolve `<uuid>` or `#123` to an item in this Factory only. Pass a ref validated by `workItemRefSchema`. */
31
+ /**
32
+ * A work item id, its card number, or the issue or pull request it tracks, as people paste it: a
33
+ * link, `owner/repo#123`, `group/project!7` or a tracker key like `ENG-42`. Anything else can't
34
+ * name an item.
35
+ */
36
+ const workItemRefSchema = z.string().trim().max(512).refine((ref) => z.string().uuid().safeParse(ref).success || /^#?\d+$/.test(ref) || isSourceReference(ref), { message: "Use a work item id (UUID), its number like \"#123\", or the link or owner/repo#123 of the issue or pull request it tracks." }).describe("Work item id, its number like \"#123\", or the issue or pull request it tracks: its link, owner/repo#123, or a key like ENG-42. With several repositories, prefer the link: a bare number can belong to more than one.");
37
+ /**
38
+ * Resolve a ref validated by `workItemRefSchema` to an item in this Factory only. A link or
39
+ * shorthand finds the card of that issue or pull request, else the card it is attached to.
40
+ */
33
41
  async function findWorkItem(workItems, scope, ref) {
34
42
  const trimmed = ref.trim();
43
+ if (z.string().uuid().safeParse(trimmed).success) return workItems.getForProject(scope.orgId, scope.factoryProjectId, trimmed);
35
44
  const number = /^#?(\d+)$/.exec(trimmed)?.[1];
36
- if (number === void 0) return workItems.getForProject(scope.orgId, scope.factoryProjectId, trimmed);
45
+ if (number === void 0) return findBySource(await workItems.listShared(scope), trimmed);
37
46
  const items = await workItems.listShared(scope);
38
47
  const matches = items.filter((item) => workItemNumber(item) === Number(number));
39
48
  const workCards = matches.filter((item) => item.externalSource?.type !== "pull-request");
@@ -44,10 +53,41 @@ async function findWorkItem(workItems, scope, ref) {
44
53
  refuseAmbiguous(number, carriers);
45
54
  return carriers[0] ? structuredClone(carriers[0]) : null;
46
55
  }
47
- function refuseAmbiguous(number, items) {
56
+ function findBySource(items, ref) {
57
+ for (const tier of [items.filter((item) => isCardFor(item, ref)), items.filter((item) => cardCarries(item, ref))]) {
58
+ refuseAmbiguous(ref, tier);
59
+ if (tier[0]) return structuredClone(tier[0]);
60
+ }
61
+ return null;
62
+ }
63
+ function refuseAmbiguous(ref, items) {
48
64
  if (items.length <= 1) return;
49
- const candidates = items.map((item) => `${item.id} (${item.title})`).join(", ");
50
- throw new Error(`#${number} matches more than one work item; use its id instead: ${candidates}.`);
65
+ const candidates = items.map((item) => `${item.id} (${item.title}, ${boardForWorkItem(item)} › ${workItemStage(item)})`).join(", ");
66
+ const label = /^\d+$/.test(ref) ? `#${ref}` : ref;
67
+ throw new Error(`${label} matches more than one work item; use its id instead: ${candidates}.`);
68
+ }
69
+ /** The stage the card is in and where its board lets it go next, as the board shows its move buttons. */
70
+ function boardMoves(board, item) {
71
+ const stage = item.stages.length === 1 ? item.stages[0] : void 0;
72
+ const phase = board && stage !== void 0 && Object.hasOwn(board.phases, stage) ? board.phases[stage] : void 0;
73
+ if (!board || !phase || stage === void 0) return null;
74
+ return {
75
+ board: {
76
+ key: board.id,
77
+ name: board.name
78
+ },
79
+ stage: {
80
+ key: stage,
81
+ name: phase.name,
82
+ kind: phase.kind
83
+ },
84
+ canRerun: phase.kind === "working",
85
+ next: phase.nextPhases.filter((key) => Object.hasOwn(board.phases, key)).map((key) => ({
86
+ key,
87
+ name: board.phases[key].name,
88
+ kind: board.phases[key].kind
89
+ }))
90
+ };
51
91
  }
52
92
  function workItemNotFound(ref) {
53
93
  return /* @__PURE__ */ new Error(`No work item ${ref} was found in this Factory.`);
@@ -114,9 +154,9 @@ function isHeld(boards, item) {
114
154
  return !item.stageHistory.some((entry) => entry.stage !== triage && board.isWorking(entry.stage));
115
155
  }
116
156
  const listInputSchema = z.object({
117
- query: z.string().trim().min(1).max(200).optional().describe("Case-insensitive text in the title, or an exact card number like \"#123\"."),
118
- stage: z.string().min(1).max(64).optional().describe("Only items in this stage, e.g. \"triage\" or \"review\"."),
119
- board: z.string().min(1).max(64).optional().describe("Only items on this board, e.g. \"work\" or \"review\"."),
157
+ query: z.string().trim().min(1).max(200).optional().describe("Case-insensitive text in the title, an exact card number like \"#123\", or the link, owner/repo#123 or key (ENG-42) of an issue or pull request, which finds the cards tracking it."),
158
+ stage: z.string().min(1).max(64).optional().describe("Only items in this stage, by its key as items list it (e.g. \"intake\" or \"planning\"); a board's review stage key can differ from its name."),
159
+ board: z.string().min(1).max(64).optional().describe("Only items on this board, by its key, e.g. \"work\"."),
120
160
  role: z.string().min(1).max(64).optional().describe("Only items that have a session for this role."),
121
161
  active: z.boolean().optional().describe("true: only items with an agent working now; false: only idle items."),
122
162
  requestedBy: z.literal("me").optional().describe("\"me\": only items you filed."),
@@ -149,10 +189,13 @@ function createFactoryReadTools(scope, deps) {
149
189
  byStage[stage] = (byStage[stage] ?? 0) + 1;
150
190
  }
151
191
  const numberQuery = input.query ? /^#(\d+)$/.exec(input.query)?.[1] : void 0;
192
+ const sourceQuery = input.query && numberQuery === void 0 && sourceKeyFromReference(input.query) !== null ? input.query : void 0;
152
193
  const text = input.query?.toLowerCase();
153
194
  const matches = items.filter((item) => {
154
195
  if (numberQuery !== void 0) {
155
196
  if (workItemNumber(item) !== Number(numberQuery)) return false;
197
+ } else if (sourceQuery !== void 0) {
198
+ if (!cardCarries(item, sourceQuery)) return false;
156
199
  } else if (text && !item.title.toLowerCase().includes(text)) return false;
157
200
  if (input.stage && !item.stages.includes(input.stage)) return false;
158
201
  if (input.board && boardForWorkItem(item) !== input.board) return false;
@@ -175,7 +218,7 @@ function createFactoryReadTools(scope, deps) {
175
218
  }),
176
219
  factory_inspect_work_item: createTool({
177
220
  id: "factory_inspect_work_item",
178
- description: "Everything the Factory knows about one work item: its description, stage history, sessions by role (with whether each is mid-run and when its thread last moved), decisions with errors, recent audit events, labels, linked items and the sessions following it. Use it to explain why an item is where it is.",
221
+ description: "Everything the Factory knows about one work item: its description, the stages its board lets it move to next, stage history, sessions by role (with whether each is mid-run and when its thread last moved), decisions with errors, recent audit events, labels, linked items and the sessions following it. Use it to explain why an item is where it is, and to pick the stage key factory_transition_work_item takes.",
179
222
  inputSchema: z.object({ workItem: workItemRefSchema }).strict(),
180
223
  execute: async ({ workItem }) => {
181
224
  const item = await findWorkItem(deps.workItems, scope, workItem);
@@ -194,7 +237,8 @@ function createFactoryReadTools(scope, deps) {
194
237
  })
195
238
  ]);
196
239
  const itemDecisions = decisions.slice(-50);
197
- const overtaken = await overtakenDecisionIds(deps.workItems, await toBoardSource(deps.boards).load(project), project, itemDecisions.filter((decision) => decision.status === "failed"));
240
+ const boards = await toBoardSource(deps.boards).load(project);
241
+ const overtaken = await overtakenDecisionIds(deps.workItems, boards, project, itemDecisions.filter((decision) => decision.status === "failed"));
198
242
  const labels = Array.isArray(item.workItem.labels) ? item.workItem.labels.filter((label) => typeof label === "string").slice(0, 50) : [];
199
243
  const parent = item.parentWorkItemId ? all.find((candidate) => candidate.id === item.parentWorkItemId) : void 0;
200
244
  const children = all.filter((candidate) => candidate.parentWorkItemId === item.id);
@@ -224,6 +268,7 @@ function createFactoryReadTools(scope, deps) {
224
268
  sourceUrl: typeof item.workItem.url === "string" ? item.workItem.url : null,
225
269
  revision: item.revision
226
270
  },
271
+ moves: boardMoves(boards.get(boardForWorkItem(item)), item),
227
272
  labels,
228
273
  stageHistory: item.stageHistory.slice(-50).map((entry) => ({
229
274
  stage: entry.stage,
@@ -1 +1 @@
1
- {"version":3,"file":"read-tools.js","names":[],"sources":["../../src/tools/read-tools.ts"],"sourcesContent":["import { createTool } from '@mastra/core/tools';\nimport { z } from 'zod';\n\nimport {\n awaitsAcceptance,\n boardFlow,\n boardForWorkItem,\n pullRequestSourceNumber,\n pullRequestSources,\n} from '../boards/index.js';\nimport type { BoardRegistry } from '../boards/index.js';\nimport { toBoardSource } from '../boards/project-boards.js';\nimport type { ProjectBoardSource } from '../boards/project-boards.js';\nimport type { IntegrationTools } from '../integrations/base.js';\nimport { factorySessionUrl, factoryWorkItemUrl } from '../links.js';\nimport { parkedRunLabel } from '../routes/attention-parked.js';\nimport { decisionRetryable, overtakenDecisionIds } from '../rules/decision-applicability.js';\nimport { factoryDispatchFailureMetadata } from '../rules/dispatch-errors.js';\nimport { needsApproval } from '../rules/types.js';\nimport type { LiveSessions } from '../session/live-sessions.js';\nimport type { AuditStorage } from '../storage/domains/audit/base.js';\nimport type {\n FactoryDeferredDecisionRecord,\n FactoryRunBindingRecord,\n Card,\n WorkItemsStorage,\n} from '../storage/domains/work-items/base.js';\nimport { workItemNumber } from '../work-items/card-number.js';\nimport { sessionActivity } from './deliver.js';\nimport type { FactorySessionActivity } from './deliver.js';\nimport type { FactoryMessaging } from './messaging-tools.js';\nimport type { FactoryToolScope } from './scope.js';\n\nexport const MAX_TEXT = 600;\nexport const MAX_ERROR = 400;\nexport const MAX_LIST = 50;\nconst DEFAULT_LIST = 25;\n\nexport interface FactoryReadToolDependencies {\n workItems: Pick<\n WorkItemsStorage,\n | 'listShared'\n | 'getForProject'\n | 'listRunBindings'\n | 'listDeferredDecisions'\n | 'listByIds'\n | 'listDecisionsForEvaluations'\n | 'listWorkItemSubscribers'\n | 'listSessionSubscriptions'\n >;\n audit: Pick<AuditStorage, 'list'>;\n /** A fixed registry, or the per-project boards. */\n boards: BoardRegistry | ProjectBoardSource;\n /** The live controller, for whether a session is mid-run and when it last moved; absent before the mount is up. */\n messaging?: () => Promise<Pick<FactoryMessaging, 'controller'> | null>;\n /** Which live sessions are parked on a tool prompt; absent before the mount is up. */\n liveSessions?: () => Pick<LiveSessions, 'parked' | 'parkedIn'> | undefined;\n}\n\nexport function truncate(text: string, max: number): string {\n return text.length > max ? `${text.slice(0, max - 1)}…` : text;\n}\n\nfunction iso(value: Date | string | null | undefined): string | null {\n if (!value) return null;\n const date = value instanceof Date ? value : new Date(value);\n return Number.isFinite(date.getTime()) ? date.toISOString() : null;\n}\n\nexport function workItemStage(item: Pick<Card, 'stages'>): string {\n return item.stages.join('+');\n}\n\n/** A work item id or its card number; anything else can't name an item. */\nexport const workItemRefSchema = z\n .string()\n .trim()\n .max(64)\n .refine(ref => z.string().uuid().safeParse(ref).success || /^#?\\d+$/.test(ref), {\n message: 'Use a work item id (UUID) or its number like \"#123\".',\n })\n .describe('Work item id, or its number like \"#123\".');\n\n/** Resolve `<uuid>` or `#123` to an item in this Factory only. Pass a ref validated by `workItemRefSchema`. */\nexport async function findWorkItem(\n workItems: Pick<WorkItemsStorage, 'listShared' | 'getForProject'>,\n scope: Pick<FactoryToolScope, 'orgId' | 'factoryProjectId'>,\n ref: string,\n): Promise<Card | null> {\n const trimmed = ref.trim();\n const number = /^#?(\\d+)$/.exec(trimmed)?.[1];\n if (number === undefined) return workItems.getForProject(scope.orgId, scope.factoryProjectId, trimmed);\n const items = await workItems.listShared(scope);\n const matches = items.filter(item => workItemNumber(item) === Number(number));\n // Issue and PR numbers share a space on GitHub; prefer the issue's card.\n const workCards = matches.filter(item => item.externalSource?.type !== 'pull-request');\n // Hand-filed card numbers and issue numbers from several repositories can repeat; refuse to guess.\n refuseAmbiguous(number, workCards);\n const match = workCards[0] ?? matches[0];\n if (match) return structuredClone(match);\n // A pull request attached to an issue's card is found through that card. Pull request numbers\n // repeat across repositories too.\n const carriers = items.filter(item =>\n pullRequestSources(item).some(source => pullRequestSourceNumber(source) === Number(number)),\n );\n refuseAmbiguous(number, carriers);\n return carriers[0] ? structuredClone(carriers[0]) : null;\n}\n\nfunction refuseAmbiguous(number: string, items: readonly Card[]): void {\n if (items.length <= 1) return;\n const candidates = items.map(item => `${item.id} (${item.title})`).join(', ');\n throw new Error(`#${number} matches more than one work item; use its id instead: ${candidates}.`);\n}\n\nexport function workItemNotFound(ref: string): Error {\n return new Error(`No work item ${ref} was found in this Factory.`);\n}\n\nfunction activeWorker(bindings: FactoryRunBindingRecord[], itemId: string) {\n const binding = bindings.find(candidate => candidate.workItemId === itemId && candidate.status === 'active');\n return binding ? { role: binding.role, sessionId: binding.sessionId } : null;\n}\n\n/** The card on its Factory board; null when the server has no public URL configured. */\nfunction workItemUrl(item: Card) {\n return (\n factoryWorkItemUrl({\n factoryProjectId: item.factoryProjectId,\n board: boardForWorkItem(item),\n workItemId: item.id,\n }) ?? null\n );\n}\n\nfunction summarizeItem(item: Card, bindings: FactoryRunBindingRecord[]) {\n return {\n id: item.id,\n number: workItemNumber(item),\n title: truncate(item.title, MAX_TEXT),\n board: boardForWorkItem(item),\n stage: workItemStage(item),\n url: workItemUrl(item),\n activeWorker: activeWorker(bindings, item.id),\n requestedBy: item.createdBy,\n updatedAt: iso(item.updatedAt),\n };\n}\n\nfunction summarizeDecision(decision: FactoryDeferredDecisionRecord, overtaken = false) {\n const type = typeof decision.decision.type === 'string' ? decision.decision.type : 'decision';\n const role = typeof decision.decision.role === 'string' ? decision.decision.role : null;\n return {\n id: decision.id,\n workItemId: decision.workItemId,\n type,\n role,\n status: decision.status,\n attempts: decision.attempts,\n failureCode: decision.failureCode,\n failureLabel: decision.failureCode ? factoryDispatchFailureMetadata(decision.failureCode).label : null,\n canRetry: decisionRetryable(decision, overtaken),\n error: decision.lastError ? truncate(decision.lastError, MAX_ERROR) : null,\n approvedBy: decision.approvedBy,\n updatedAt: iso(decision.updatedAt),\n };\n}\n\n/**\n * Held: a card triage left resting (or whose source asks for approval), until a person moves it\n * on. A card that has been past triage since (parked by self-review, or dragged back) resumes\n * instead, matching the board's held state.\n */\nfunction isHeld(boards: BoardRegistry, item: Card): boolean {\n const board = boards.get(boardForWorkItem(item));\n const stage = item.stages.length === 1 ? item.stages[0]! : undefined;\n if (!board || !stage || board.phaseKind(stage) !== 'resting') return false;\n if (needsApproval(item, phase => awaitsAcceptance(board, phase))) return true;\n const triage = boardFlow(board).triage;\n const triageRole = triage ? board.roleForPhase(triage) : undefined;\n if (!triageRole || item.sessions[triageRole] === undefined) return false;\n return !item.stageHistory.some(entry => entry.stage !== triage && board.isWorking(entry.stage));\n}\n\nconst listInputSchema = z\n .object({\n query: z\n .string()\n .trim()\n .min(1)\n .max(200)\n .optional()\n .describe('Case-insensitive text in the title, or an exact card number like \"#123\".'),\n stage: z.string().min(1).max(64).optional().describe('Only items in this stage, e.g. \"triage\" or \"review\".'),\n board: z.string().min(1).max(64).optional().describe('Only items on this board, e.g. \"work\" or \"review\".'),\n role: z.string().min(1).max(64).optional().describe('Only items that have a session for this role.'),\n active: z.boolean().optional().describe('true: only items with an agent working now; false: only idle items.'),\n requestedBy: z.literal('me').optional().describe('\"me\": only items you filed.'),\n subscribed: z\n .boolean()\n .optional()\n .describe('true: only items this session follows; false: only items it does not.'),\n limit: z.number().int().min(1).max(MAX_LIST).optional().describe(`Default ${DEFAULT_LIST}, max ${MAX_LIST}.`),\n })\n .strict();\n\nexport function createFactoryReadTools(scope: FactoryToolScope, deps: FactoryReadToolDependencies): IntegrationTools {\n const project = { orgId: scope.orgId, factoryProjectId: scope.factoryProjectId };\n return {\n factory_list_work_items: createTool({\n id: 'factory_list_work_items',\n description:\n \"List this Factory's work items, newest activity first, with counts per stage for the whole Factory. Filter by text or #number, stage, board, role, whether an agent is working on it, items you filed, or items this session follows. Check here for an existing item before filing a new one.\",\n inputSchema: listInputSchema,\n execute: async input => {\n const [items, bindings, followed] = await Promise.all([\n deps.workItems.listShared(project),\n deps.workItems.listRunBindings(scope.orgId, scope.factoryProjectId),\n input.subscribed === undefined\n ? undefined\n : deps.workItems.listSessionSubscriptions({ ...project, sessionId: scope.sessionId }),\n ]);\n const followedIds = new Set(followed?.map(subscription => subscription.workItemId));\n const byStage: Record<string, number> = {};\n for (const item of items) {\n const stage = workItemStage(item);\n byStage[stage] = (byStage[stage] ?? 0) + 1;\n }\n const numberQuery = input.query ? /^#(\\d+)$/.exec(input.query)?.[1] : undefined;\n const text = input.query?.toLowerCase();\n const matches = items\n .filter(item => {\n if (numberQuery !== undefined) {\n if (workItemNumber(item) !== Number(numberQuery)) return false;\n } else if (text && !item.title.toLowerCase().includes(text)) return false;\n if (input.stage && !item.stages.includes(input.stage)) return false;\n if (input.board && boardForWorkItem(item) !== input.board) return false;\n if (input.role && !item.sessions[input.role]) return false;\n if (input.active !== undefined && (activeWorker(bindings, item.id) !== null) !== input.active) return false;\n if (input.requestedBy === 'me' && item.createdBy !== scope.userId) return false;\n if (input.subscribed !== undefined && followedIds.has(item.id) !== input.subscribed) return false;\n return true;\n })\n .sort((left, right) => right.updatedAt.getTime() - left.updatedAt.getTime());\n const limit = input.limit ?? DEFAULT_LIST;\n return {\n counts: { total: items.length, byStage },\n items: matches.slice(0, limit).map(item => summarizeItem(item, bindings)),\n truncated: matches.length > limit,\n };\n },\n }),\n\n factory_inspect_work_item: createTool({\n id: 'factory_inspect_work_item',\n description:\n 'Everything the Factory knows about one work item: its description, stage history, sessions by role (with whether each is mid-run and when its thread last moved), decisions with errors, recent audit events, labels, linked items and the sessions following it. Use it to explain why an item is where it is.',\n inputSchema: z.object({ workItem: workItemRefSchema }).strict(),\n execute: async ({ workItem }) => {\n const item = await findWorkItem(deps.workItems, scope, workItem);\n if (!item) throw workItemNotFound(workItem);\n const [bindings, decisions, audit, all, subscribers] = await Promise.all([\n deps.workItems.listRunBindings(scope.orgId, scope.factoryProjectId, item.id),\n deps.workItems.listDeferredDecisions(scope.orgId, scope.factoryProjectId, { workItemId: item.id }),\n deps.audit.list({ ...project, limit: 200 }),\n deps.workItems.listShared(project),\n deps.workItems.listWorkItemSubscribers({ orgId: scope.orgId, workItemId: item.id }),\n ]);\n const itemDecisions = decisions.slice(-MAX_LIST);\n const overtaken = await overtakenDecisionIds(\n deps.workItems,\n await toBoardSource(deps.boards).load(project),\n project,\n itemDecisions.filter(decision => decision.status === 'failed'),\n );\n const labels = Array.isArray(item.workItem.labels)\n ? item.workItem.labels.filter((label): label is string => typeof label === 'string').slice(0, MAX_LIST)\n : [];\n const parent = item.parentWorkItemId\n ? all.find(candidate => candidate.id === item.parentWorkItemId)\n : undefined;\n const children = all.filter(candidate => candidate.parentWorkItemId === item.id);\n const controller = (await deps.messaging?.())?.controller;\n const activity = async (sessionId: string, threadId: string): Promise<FactorySessionActivity | null> =>\n controller ? sessionActivity(controller, sessionId, threadId) : null;\n const sessions = await Promise.all(\n Object.entries(item.sessions).map(async ([role, ref]) => ({\n role,\n sessionId: ref.sessionId,\n threadId: ref.threadId,\n url:\n factorySessionUrl({\n factoryProjectId: item.factoryProjectId,\n sessionId: ref.sessionId,\n threadId: ref.threadId,\n }) ?? null,\n startedBy: ref.startedBy,\n active: bindings.some(\n binding => binding.role === role && binding.sessionId === ref.sessionId && binding.status === 'active',\n ),\n // `running` with an old `lastActivityAt` is a stuck run; `running` with a recent one is a long one.\n ...((await activity(ref.sessionId, ref.threadId)) ?? { running: null, lastActivityAt: null }),\n })),\n );\n return {\n item: {\n ...summarizeItem(item, bindings),\n description: item.description,\n source: item.externalSource ? `${item.externalSource.integrationId}:${item.externalSource.type}` : 'manual',\n sourceUrl: typeof item.workItem.url === 'string' ? item.workItem.url : null,\n revision: item.revision,\n },\n labels,\n stageHistory: item.stageHistory.slice(-MAX_LIST).map(entry => ({\n stage: entry.stage,\n enteredAt: entry.enteredAt,\n exitedAt: entry.exitedAt ?? null,\n by: entry.by,\n })),\n sessions,\n decisions: itemDecisions.map(decision => summarizeDecision(decision, overtaken.has(decision.id))),\n audit: audit.events\n .filter(event => event.targets.some(target => target.type === 'work_item' && target.id === item.id))\n .slice(0, 25)\n .map(event => ({\n action: event.action,\n actorId: event.actorId,\n actorType: event.actorType,\n occurredAt: iso(event.occurredAt),\n })),\n parent: parent ? summarizeItem(parent, bindings) : null,\n children: children.slice(0, MAX_LIST).map(child => summarizeItem(child, bindings)),\n subscribers: subscribers.slice(0, MAX_LIST).map(subscription => ({\n sessionId: subscription.sessionId,\n reason: subscription.reason,\n isCaller: subscription.sessionId === scope.sessionId,\n })),\n };\n },\n }),\n\n factory_list_attention: createTool({\n id: 'factory_list_attention',\n description:\n 'What in this Factory needs a person: failed decisions grouped by failure code and error (one incident per group), proposals waiting for approval, runs parked on a tool prompt (a plan to review, a question to answer) while still in flight, and Work cards triage left in Intake for a person to move on.',\n inputSchema: z.object({ limit: z.number().int().min(1).max(MAX_LIST).optional() }).strict(),\n execute: async ({ limit = DEFAULT_LIST }) => {\n const [decisions, items] = await Promise.all([\n deps.workItems.listDeferredDecisions(scope.orgId, scope.factoryProjectId, {\n statuses: ['failed', 'proposed'],\n }),\n deps.workItems.listShared(project),\n ]);\n const itemsById = new Map(items.map(item => [item.id, item]));\n const failed = decisions.filter(decision => decision.status === 'failed');\n const groups = new Map<\n string,\n { failureCode: string; error: string; decisions: FactoryDeferredDecisionRecord[] }\n >();\n for (const decision of failed) {\n const error = truncate(decision.lastError ?? '', MAX_ERROR);\n const key = `${decision.failureCode ?? 'unknown'}|${error}`;\n const group = groups.get(key) ?? { failureCode: decision.failureCode ?? 'unknown', error, decisions: [] };\n group.decisions.push(decision);\n groups.set(key, group);\n }\n const ref = (workItemId: string | null) => {\n const item = workItemId ? itemsById.get(workItemId) : undefined;\n return {\n workItemId,\n number: item ? workItemNumber(item) : null,\n title: item ? truncate(item.title, MAX_TEXT) : null,\n url: item ? workItemUrl(item) : null,\n };\n };\n const allIncidents = [...groups.values()].sort((a, b) => b.decisions.length - a.decisions.length);\n const incidents = allIncidents\n .slice(0, limit)\n .map(group => ({ ...group, shown: group.decisions.slice(0, limit) }));\n // Check exactly the decisions this call returns, so every canRetry is real.\n const boards = await toBoardSource(deps.boards).load(project);\n const overtaken = await overtakenDecisionIds(\n deps.workItems,\n boards,\n project,\n incidents.flatMap(group => group.shown),\n );\n const proposals = decisions.filter(decision => decision.status === 'proposed');\n const held = items.filter(item => isHeld(boards, item));\n const waiting = (deps.liveSessions?.()?.parkedIn(scope.factoryProjectId) ?? []).sort(\n (a, b) => a.run.suspendedAt - b.run.suspendedAt,\n );\n return {\n incidents: incidents.map(group => ({\n failureCode: group.failureCode,\n failureLabel: factoryDispatchFailureMetadata(group.decisions[0]!.failureCode).label,\n error: group.error,\n count: group.decisions.length,\n decisions: group.shown.map(decision => ({\n id: decision.id,\n ...ref(decision.workItemId),\n attempts: decision.attempts,\n canRetry: decisionRetryable(decision, overtaken.has(decision.id)),\n })),\n })),\n proposals: proposals\n .slice(0, limit)\n .map(decision => ({ ...summarizeDecision(decision), ...ref(decision.workItemId) })),\n waiting: waiting.slice(0, limit).map(({ sessionId, run }) => ({\n sessionId,\n toolName: run.toolName,\n label: parkedRunLabel(run.toolName),\n waitingSince: new Date(run.suspendedAt).toISOString(),\n })),\n held: held.slice(0, limit).map(item => ({\n ...ref(item.id),\n stage: workItemStage(item),\n })),\n truncated:\n allIncidents.length > limit ||\n incidents.some(group => group.shown.length < group.decisions.length) ||\n proposals.length > limit ||\n waiting.length > limit ||\n held.length > limit,\n };\n },\n }),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAiCA,MAAa,WAAW;AACxB,MAAa,YAAY;AACzB,MAAa,WAAW;AACxB,MAAM,eAAe;AAuBrB,SAAgB,SAAS,MAAc,KAAqB;CAC1D,OAAO,KAAK,SAAS,MAAM,GAAG,KAAK,MAAM,GAAG,MAAM,CAAC,EAAE,KAAK;AAC5D;AAEA,SAAS,IAAI,OAAwD;CACnE,IAAI,CAAC,OAAO,OAAO;CACnB,MAAM,OAAO,iBAAiB,OAAO,QAAQ,IAAI,KAAK,KAAK;CAC3D,OAAO,OAAO,SAAS,KAAK,QAAQ,CAAC,IAAI,KAAK,YAAY,IAAI;AAChE;AAEA,SAAgB,cAAc,MAAoC;CAChE,OAAO,KAAK,OAAO,KAAK,GAAG;AAC7B;;AAGA,MAAa,oBAAoB,EAC9B,OAAO,CAAC,CACR,KAAK,CAAC,CACN,IAAI,EAAE,CAAC,CACP,QAAO,QAAO,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,WAAW,UAAU,KAAK,GAAG,GAAG,EAC9E,SAAS,yDACX,CAAC,CAAC,CACD,SAAS,4CAA0C;;AAGtD,eAAsB,aACpB,WACA,OACA,KACsB;CACtB,MAAM,UAAU,IAAI,KAAK;CACzB,MAAM,SAAS,YAAY,KAAK,OAAO,CAAC,GAAG;CAC3C,IAAI,WAAW,KAAA,GAAW,OAAO,UAAU,cAAc,MAAM,OAAO,MAAM,kBAAkB,OAAO;CACrG,MAAM,QAAQ,MAAM,UA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U,SAAS;OACnB,UAAU,kBAAkB,UAAU,UAAU,IAAI,SAAS,EAAE,CAAC;MAClE,EAAE;KACJ,EAAE;KACF,WAAW,UACR,MAAM,GAAG,KAAK,CAAC,CACf,KAAI,cAAa;MAAE,GAAG,kBAAkB,QAAQ;MAAG,GAAG,IAAI,SAAS,UAAU;KAAE,EAAE;KACpF,SAAS,QAAQ,MAAM,GAAG,KAAK,CAAC,CAAC,KAAK,EAAE,WAAW,WAAW;MAC5D;MACA,UAAU,IAAI;MACd,OAAO,eAAe,IAAI,QAAQ;MAClC,cAAc,IAAI,KAAK,IAAI,WAAW,CAAC,CAAC,YAAY;KACtD,EAAE;KACF,MAAM,KAAK,MAAM,GAAG,KAAK,CAAC,CAAC,KAAI,UAAS;MACtC,GAAG,IAAI,KAAK,EAAE;MACd,OAAO,cAAc,IAAI;KAC3B,EAAE;KACF,WACE,aAAa,SAAS,SACtB,UAAU,MAAK,UAAS,MAAM,MAAM,SAAS,MAAM,UAAU,MAAM,KACnE,UAAU,SAAS,SACnB,QAAQ,SAAS,SACjB,KAAK,SAAS;IAClB;GACF;EACF,CAAC;CACH;AACF"}
1
+ {"version":3,"file":"read-tools.js","names":[],"sources":["../../src/tools/read-tools.ts"],"sourcesContent":["import { createTool } from '@mastra/core/tools';\nimport { z } from 'zod';\n\nimport {\n awaitsAcceptance,\n boardFlow,\n boardForWorkItem,\n pullRequestSourceNumber,\n pullRequestSources,\n} from '../boards/index.js';\nimport type { BoardRegistry, InstalledBoard } from '../boards/index.js';\nimport { toBoardSource } from '../boards/project-boards.js';\nimport type { ProjectBoardSource } from '../boards/project-boards.js';\nimport type { IntegrationTools } from '../integrations/base.js';\nimport { factorySessionUrl, factoryWorkItemUrl } from '../links.js';\nimport { parkedRunLabel } from '../routes/attention-parked.js';\nimport { decisionRetryable, overtakenDecisionIds } from '../rules/decision-applicability.js';\nimport { factoryDispatchFailureMetadata } from '../rules/dispatch-errors.js';\nimport { needsApproval } from '../rules/types.js';\nimport type { LiveSessions } from '../session/live-sessions.js';\nimport type { AuditStorage } from '../storage/domains/audit/base.js';\nimport type {\n FactoryDeferredDecisionRecord,\n FactoryRunBindingRecord,\n Card,\n WorkItemsStorage,\n} from '../storage/domains/work-items/base.js';\nimport { workItemNumber } from '../work-items/card-number.js';\nimport { cardCarries, isCardFor, isSourceReference, sourceKeyFromReference } from '../work-items/card-reference.js';\nimport { sessionActivity } from './deliver.js';\nimport type { FactorySessionActivity } from './deliver.js';\nimport type { FactoryMessaging } from './messaging-tools.js';\nimport type { FactoryToolScope } from './scope.js';\n\nexport const MAX_TEXT = 600;\nexport const MAX_ERROR = 400;\nexport const MAX_LIST = 50;\nconst DEFAULT_LIST = 25;\n\nexport interface FactoryReadToolDependencies {\n workItems: Pick<\n WorkItemsStorage,\n | 'listShared'\n | 'getForProject'\n | 'listRunBindings'\n | 'listDeferredDecisions'\n | 'listByIds'\n | 'listDecisionsForEvaluations'\n | 'listWorkItemSubscribers'\n | 'listSessionSubscriptions'\n >;\n audit: Pick<AuditStorage, 'list'>;\n /** A fixed registry, or the per-project boards. */\n boards: BoardRegistry | ProjectBoardSource;\n /** The live controller, for whether a session is mid-run and when it last moved; absent before the mount is up. */\n messaging?: () => Promise<Pick<FactoryMessaging, 'controller'> | null>;\n /** Which live sessions are parked on a tool prompt; absent before the mount is up. */\n liveSessions?: () => Pick<LiveSessions, 'parked' | 'parkedIn'> | undefined;\n}\n\nexport function truncate(text: string, max: number): string {\n return text.length > max ? `${text.slice(0, max - 1)}…` : text;\n}\n\nfunction iso(value: Date | string | null | undefined): string | null {\n if (!value) return null;\n const date = value instanceof Date ? value : new Date(value);\n return Number.isFinite(date.getTime()) ? date.toISOString() : null;\n}\n\nexport function workItemStage(item: Pick<Card, 'stages'>): string {\n return item.stages.join('+');\n}\n\n/**\n * A work item id, its card number, or the issue or pull request it tracks, as people paste it: a\n * link, `owner/repo#123`, `group/project!7` or a tracker key like `ENG-42`. Anything else can't\n * name an item.\n */\nexport const workItemRefSchema = z\n .string()\n .trim()\n .max(512)\n .refine(ref => z.string().uuid().safeParse(ref).success || /^#?\\d+$/.test(ref) || isSourceReference(ref), {\n message:\n 'Use a work item id (UUID), its number like \"#123\", or the link or owner/repo#123 of the issue or pull request it tracks.',\n })\n .describe(\n 'Work item id, its number like \"#123\", or the issue or pull request it tracks: its link, owner/repo#123, or a key like ENG-42. With several repositories, prefer the link: a bare number can belong to more than one.',\n );\n\n/**\n * Resolve a ref validated by `workItemRefSchema` to an item in this Factory only. A link or\n * shorthand finds the card of that issue or pull request, else the card it is attached to.\n */\nexport async function findWorkItem(\n workItems: Pick<WorkItemsStorage, 'listShared' | 'getForProject'>,\n scope: Pick<FactoryToolScope, 'orgId' | 'factoryProjectId'>,\n ref: string,\n): Promise<Card | null> {\n const trimmed = ref.trim();\n if (z.string().uuid().safeParse(trimmed).success) {\n return workItems.getForProject(scope.orgId, scope.factoryProjectId, trimmed);\n }\n const number = /^#?(\\d+)$/.exec(trimmed)?.[1];\n if (number === undefined) return findBySource(await workItems.listShared(scope), trimmed);\n const items = await workItems.listShared(scope);\n const matches = items.filter(item => workItemNumber(item) === Number(number));\n // Issue and PR numbers share a space on GitHub; prefer the issue's card.\n const workCards = matches.filter(item => item.externalSource?.type !== 'pull-request');\n // Hand-filed card numbers and issue numbers from several repositories can repeat; refuse to guess.\n refuseAmbiguous(number, workCards);\n const match = workCards[0] ?? matches[0];\n if (match) return structuredClone(match);\n // A pull request attached to an issue's card is found through that card. Pull request numbers\n // repeat across repositories too.\n const carriers = items.filter(item =>\n pullRequestSources(item).some(source => pullRequestSourceNumber(source) === Number(number)),\n );\n refuseAmbiguous(number, carriers);\n return carriers[0] ? structuredClone(carriers[0]) : null;\n}\n\nfunction findBySource(items: readonly Card[], ref: string): Card | null {\n // The issue's or pull request's own card first, then a card it is attached to (a pull request on its issue's card).\n for (const tier of [items.filter(item => isCardFor(item, ref)), items.filter(item => cardCarries(item, ref))]) {\n refuseAmbiguous(ref, tier);\n if (tier[0]) return structuredClone(tier[0]);\n }\n return null;\n}\n\nfunction refuseAmbiguous(ref: string, items: readonly Card[]): void {\n if (items.length <= 1) return;\n const candidates = items\n .map(item => `${item.id} (${item.title}, ${boardForWorkItem(item)} › ${workItemStage(item)})`)\n .join(', ');\n const label = /^\\d+$/.test(ref) ? `#${ref}` : ref;\n throw new Error(`${label} matches more than one work item; use its id instead: ${candidates}.`);\n}\n\n/** The stage the card is in and where its board lets it go next, as the board shows its move buttons. */\nfunction boardMoves(board: InstalledBoard | undefined, item: Card) {\n const stage = item.stages.length === 1 ? item.stages[0]! : undefined;\n const phase = board && stage !== undefined && Object.hasOwn(board.phases, stage) ? board.phases[stage] : undefined;\n if (!board || !phase || stage === undefined) return null;\n return {\n board: { key: board.id, name: board.name },\n stage: { key: stage, name: phase.name, kind: phase.kind },\n // A working stage runs its skill again when the card is moved to the stage it is in.\n canRerun: phase.kind === 'working',\n next: phase.nextPhases\n .filter(key => Object.hasOwn(board.phases, key))\n .map(key => ({ key, name: board.phases[key]!.name, kind: board.phases[key]!.kind })),\n };\n}\n\nexport function workItemNotFound(ref: string): Error {\n return new Error(`No work item ${ref} was found in this Factory.`);\n}\n\nfunction activeWorker(bindings: FactoryRunBindingRecord[], itemId: string) {\n const binding = bindings.find(candidate => candidate.workItemId === itemId && candidate.status === 'active');\n return binding ? { role: binding.role, sessionId: binding.sessionId } : null;\n}\n\n/** The card on its Factory board; null when the server has no public URL configured. */\nfunction workItemUrl(item: Card) {\n return (\n factoryWorkItemUrl({\n factoryProjectId: item.factoryProjectId,\n board: boardForWorkItem(item),\n workItemId: item.id,\n }) ?? null\n );\n}\n\nfunction summarizeItem(item: Card, bindings: FactoryRunBindingRecord[]) {\n return {\n id: item.id,\n number: workItemNumber(item),\n title: truncate(item.title, MAX_TEXT),\n board: boardForWorkItem(item),\n stage: workItemStage(item),\n url: workItemUrl(item),\n activeWorker: activeWorker(bindings, item.id),\n requestedBy: item.createdBy,\n updatedAt: iso(item.updatedAt),\n };\n}\n\nfunction summarizeDecision(decision: FactoryDeferredDecisionRecord, overtaken = false) {\n const type = typeof decision.decision.type === 'string' ? decision.decision.type : 'decision';\n const role = typeof decision.decision.role === 'string' ? decision.decision.role : null;\n return {\n id: decision.id,\n workItemId: decision.workItemId,\n type,\n role,\n status: decision.status,\n attempts: decision.attempts,\n failureCode: decision.failureCode,\n failureLabel: decision.failureCode ? factoryDispatchFailureMetadata(decision.failureCode).label : null,\n canRetry: decisionRetryable(decision, overtaken),\n error: decision.lastError ? truncate(decision.lastError, MAX_ERROR) : null,\n approvedBy: decision.approvedBy,\n updatedAt: iso(decision.updatedAt),\n };\n}\n\n/**\n * Held: a card triage left resting (or whose source asks for approval), until a person moves it\n * on. A card that has been past triage since (parked by self-review, or dragged back) resumes\n * instead, matching the board's held state.\n */\nfunction isHeld(boards: BoardRegistry, item: Card): boolean {\n const board = boards.get(boardForWorkItem(item));\n const stage = item.stages.length === 1 ? item.stages[0]! : undefined;\n if (!board || !stage || board.phaseKind(stage) !== 'resting') return false;\n if (needsApproval(item, phase => awaitsAcceptance(board, phase))) return true;\n const triage = boardFlow(board).triage;\n const triageRole = triage ? board.roleForPhase(triage) : undefined;\n if (!triageRole || item.sessions[triageRole] === undefined) return false;\n return !item.stageHistory.some(entry => entry.stage !== triage && board.isWorking(entry.stage));\n}\n\nconst listInputSchema = z\n .object({\n query: z\n .string()\n .trim()\n .min(1)\n .max(200)\n .optional()\n .describe(\n 'Case-insensitive text in the title, an exact card number like \"#123\", or the link, owner/repo#123 or key (ENG-42) of an issue or pull request, which finds the cards tracking it.',\n ),\n stage: z\n .string()\n .min(1)\n .max(64)\n .optional()\n .describe(\n 'Only items in this stage, by its key as items list it (e.g. \"intake\" or \"planning\"); a board\\'s review stage key can differ from its name.',\n ),\n board: z.string().min(1).max(64).optional().describe('Only items on this board, by its key, e.g. \"work\".'),\n role: z.string().min(1).max(64).optional().describe('Only items that have a session for this role.'),\n active: z.boolean().optional().describe('true: only items with an agent working now; false: only idle items.'),\n requestedBy: z.literal('me').optional().describe('\"me\": only items you filed.'),\n subscribed: z\n .boolean()\n .optional()\n .describe('true: only items this session follows; false: only items it does not.'),\n limit: z.number().int().min(1).max(MAX_LIST).optional().describe(`Default ${DEFAULT_LIST}, max ${MAX_LIST}.`),\n })\n .strict();\n\nexport function createFactoryReadTools(scope: FactoryToolScope, deps: FactoryReadToolDependencies): IntegrationTools {\n const project = { orgId: scope.orgId, factoryProjectId: scope.factoryProjectId };\n return {\n factory_list_work_items: createTool({\n id: 'factory_list_work_items',\n description:\n \"List this Factory's work items, newest activity first, with counts per stage for the whole Factory. Filter by text or #number, stage, board, role, whether an agent is working on it, items you filed, or items this session follows. Check here for an existing item before filing a new one.\",\n inputSchema: listInputSchema,\n execute: async input => {\n const [items, bindings, followed] = await Promise.all([\n deps.workItems.listShared(project),\n deps.workItems.listRunBindings(scope.orgId, scope.factoryProjectId),\n input.subscribed === undefined\n ? undefined\n : deps.workItems.listSessionSubscriptions({ ...project, sessionId: scope.sessionId }),\n ]);\n const followedIds = new Set(followed?.map(subscription => subscription.workItemId));\n const byStage: Record<string, number> = {};\n for (const item of items) {\n const stage = workItemStage(item);\n byStage[stage] = (byStage[stage] ?? 0) + 1;\n }\n const numberQuery = input.query ? /^#(\\d+)$/.exec(input.query)?.[1] : undefined;\n // A pasted link or owner/repo#123 finds the cards tracking that issue or pull request, not titles.\n const sourceQuery =\n input.query && numberQuery === undefined && sourceKeyFromReference(input.query) !== null\n ? input.query\n : undefined;\n const text = input.query?.toLowerCase();\n const matches = items\n .filter(item => {\n if (numberQuery !== undefined) {\n if (workItemNumber(item) !== Number(numberQuery)) return false;\n } else if (sourceQuery !== undefined) {\n if (!cardCarries(item, sourceQuery)) return false;\n } else if (text && !item.title.toLowerCase().includes(text)) return false;\n if (input.stage && !item.stages.includes(input.stage)) return false;\n if (input.board && boardForWorkItem(item) !== input.board) return false;\n if (input.role && !item.sessions[input.role]) return false;\n if (input.active !== undefined && (activeWorker(bindings, item.id) !== null) !== input.active) return false;\n if (input.requestedBy === 'me' && item.createdBy !== scope.userId) return false;\n if (input.subscribed !== undefined && followedIds.has(item.id) !== input.subscribed) return false;\n return true;\n })\n .sort((left, right) => right.updatedAt.getTime() - left.updatedAt.getTime());\n const limit = input.limit ?? DEFAULT_LIST;\n return {\n counts: { total: items.length, byStage },\n items: matches.slice(0, limit).map(item => summarizeItem(item, bindings)),\n truncated: matches.length > limit,\n };\n },\n }),\n\n factory_inspect_work_item: createTool({\n id: 'factory_inspect_work_item',\n description:\n 'Everything the Factory knows about one work item: its description, the stages its board lets it move to next, stage history, sessions by role (with whether each is mid-run and when its thread last moved), decisions with errors, recent audit events, labels, linked items and the sessions following it. Use it to explain why an item is where it is, and to pick the stage key factory_transition_work_item takes.',\n inputSchema: z.object({ workItem: workItemRefSchema }).strict(),\n execute: async ({ workItem }) => {\n const item = await findWorkItem(deps.workItems, scope, workItem);\n if (!item) throw workItemNotFound(workItem);\n const [bindings, decisions, audit, all, subscribers] = await Promise.all([\n deps.workItems.listRunBindings(scope.orgId, scope.factoryProjectId, item.id),\n deps.workItems.listDeferredDecisions(scope.orgId, scope.factoryProjectId, { workItemId: item.id }),\n deps.audit.list({ ...project, limit: 200 }),\n deps.workItems.listShared(project),\n deps.workItems.listWorkItemSubscribers({ orgId: scope.orgId, workItemId: item.id }),\n ]);\n const itemDecisions = decisions.slice(-MAX_LIST);\n const boards = await toBoardSource(deps.boards).load(project);\n const overtaken = await overtakenDecisionIds(\n deps.workItems,\n boards,\n project,\n itemDecisions.filter(decision => decision.status === 'failed'),\n );\n const labels = Array.isArray(item.workItem.labels)\n ? item.workItem.labels.filter((label): label is string => typeof label === 'string').slice(0, MAX_LIST)\n : [];\n const parent = item.parentWorkItemId\n ? all.find(candidate => candidate.id === item.parentWorkItemId)\n : undefined;\n const children = all.filter(candidate => candidate.parentWorkItemId === item.id);\n const controller = (await deps.messaging?.())?.controller;\n const activity = async (sessionId: string, threadId: string): Promise<FactorySessionActivity | null> =>\n controller ? sessionActivity(controller, sessionId, threadId) : null;\n const sessions = await Promise.all(\n Object.entries(item.sessions).map(async ([role, ref]) => ({\n role,\n sessionId: ref.sessionId,\n threadId: ref.threadId,\n url:\n factorySessionUrl({\n factoryProjectId: item.factoryProjectId,\n sessionId: ref.sessionId,\n threadId: ref.threadId,\n }) ?? null,\n startedBy: ref.startedBy,\n active: bindings.some(\n binding => binding.role === role && binding.sessionId === ref.sessionId && binding.status === 'active',\n ),\n // `running` with an old `lastActivityAt` is a stuck run; `running` with a recent one is a long one.\n ...((await activity(ref.sessionId, ref.threadId)) ?? { running: null, lastActivityAt: null }),\n })),\n );\n return {\n item: {\n ...summarizeItem(item, bindings),\n description: item.description,\n source: item.externalSource ? `${item.externalSource.integrationId}:${item.externalSource.type}` : 'manual',\n sourceUrl: typeof item.workItem.url === 'string' ? item.workItem.url : null,\n revision: item.revision,\n },\n moves: boardMoves(boards.get(boardForWorkItem(item)), item),\n labels,\n stageHistory: item.stageHistory.slice(-MAX_LIST).map(entry => ({\n stage: entry.stage,\n enteredAt: entry.enteredAt,\n exitedAt: entry.exitedAt ?? null,\n by: entry.by,\n })),\n sessions,\n decisions: itemDecisions.map(decision => summarizeDecision(decision, overtaken.has(decision.id))),\n audit: audit.events\n .filter(event => event.targets.some(target => target.type === 'work_item' && target.id === item.id))\n .slice(0, 25)\n .map(event => ({\n action: event.action,\n actorId: event.actorId,\n actorType: event.actorType,\n occurredAt: iso(event.occurredAt),\n })),\n parent: parent ? summarizeItem(parent, bindings) : null,\n children: children.slice(0, MAX_LIST).map(child => summarizeItem(child, bindings)),\n subscribers: subscribers.slice(0, MAX_LIST).map(subscription => ({\n sessionId: subscription.sessionId,\n reason: subscription.reason,\n isCaller: subscription.sessionId === scope.sessionId,\n })),\n };\n },\n }),\n\n factory_list_attention: createTool({\n id: 'factory_list_attention',\n description:\n 'What in this Factory needs a person: failed decisions grouped by failure code and error (one incident per group), proposals waiting for approval, runs parked on a tool prompt (a plan to review, a question to answer) while still in flight, and Work cards triage left in Intake for a person to move on.',\n inputSchema: z.object({ limit: z.number().int().min(1).max(MAX_LIST).optional() }).strict(),\n execute: async ({ limit = DEFAULT_LIST }) => {\n const [decisions, items] = await Promise.all([\n deps.workItems.listDeferredDecisions(scope.orgId, scope.factoryProjectId, {\n statuses: ['failed', 'proposed'],\n }),\n deps.workItems.listShared(project),\n ]);\n const itemsById = new Map(items.map(item => [item.id, item]));\n const failed = decisions.filter(decision => decision.status === 'failed');\n const groups = new Map<\n string,\n { failureCode: string; error: string; decisions: FactoryDeferredDecisionRecord[] }\n >();\n for (const decision of failed) {\n const error = truncate(decision.lastError ?? '', MAX_ERROR);\n const key = `${decision.failureCode ?? 'unknown'}|${error}`;\n const group = groups.get(key) ?? { failureCode: decision.failureCode ?? 'unknown', error, decisions: [] };\n group.decisions.push(decision);\n groups.set(key, group);\n }\n const ref = (workItemId: string | null) => {\n const item = workItemId ? itemsById.get(workItemId) : undefined;\n return {\n workItemId,\n number: item ? workItemNumber(item) : null,\n title: item ? truncate(item.title, MAX_TEXT) : null,\n url: item ? workItemUrl(item) : null,\n };\n };\n const allIncidents = [...groups.values()].sort((a, b) => b.decisions.length - a.decisions.length);\n const incidents = allIncidents\n .slice(0, limit)\n .map(group => ({ ...group, shown: group.decisions.slice(0, limit) }));\n // Check exactly the decisions this call returns, so every canRetry is real.\n const boards = await toBoardSource(deps.boards).load(project);\n const overtaken = await overtakenDecisionIds(\n deps.workItems,\n boards,\n project,\n incidents.flatMap(group => group.shown),\n );\n const proposals = decisions.filter(decision => decision.status === 'proposed');\n const held = items.filter(item => isHeld(boards, item));\n const waiting = (deps.liveSessions?.()?.parkedIn(scope.factoryProjectId) ?? []).sort(\n (a, b) => a.run.suspendedAt - b.run.suspendedAt,\n );\n return {\n incidents: incidents.map(group => ({\n failureCode: group.failureCode,\n failureLabel: factoryDispatchFailureMetadata(group.decisions[0]!.failureCode).label,\n error: group.error,\n count: group.decisions.length,\n decisions: group.shown.map(decision => ({\n id: decision.id,\n ...ref(decision.workItemId),\n attempts: decision.attempts,\n canRetry: decisionRetryable(decision, overtaken.has(decision.id)),\n })),\n })),\n proposals: proposals\n .slice(0, limit)\n .map(decision => ({ ...summarizeDecision(decision), ...ref(decision.workItemId) })),\n waiting: waiting.slice(0, limit).map(({ sessionId, run }) => ({\n sessionId,\n toolName: run.toolName,\n label: parkedRunLabel(run.toolName),\n waitingSince: new Date(run.suspendedAt).toISOString(),\n })),\n held: held.slice(0, limit).map(item => ({\n ...ref(item.id),\n stage: workItemStage(item),\n })),\n truncated:\n allIncidents.length > limit ||\n incidents.some(group => group.shown.length < group.decisions.length) ||\n proposals.length > limit ||\n waiting.length > limit ||\n held.length > limit,\n };\n },\n }),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAkCA,MAAa,WAAW;AACxB,MAAa,YAAY;AACzB,MAAa,WAAW;AACxB,MAAM,eAAe;AAuBrB,SAAgB,SAAS,MAAc,KAAqB;CAC1D,OAAO,KAAK,SAAS,MAAM,GAAG,KAAK,MAAM,GAAG,MAAM,CAAC,EAAE,KAAK;AAC5D;AAEA,SAAS,IAAI,OAAwD;CACnE,IAAI,CAAC,OAAO,OAAO;CACnB,MAAM,OAAO,iBAAiB,OAAO,QAAQ,IAAI,KAAK,KAAK;CAC3D,OAAO,OAAO,SAAS,KAAK,QAAQ,CAAC,IAAI,KAAK,YAAY,IAAI;AAChE;AAEA,SAAgB,cAAc,MAAoC;CAChE,OAAO,KAAK,OAAO,KAAK,GAAG;AAC7B;;;;;;AAOA,MAAa,oBAAoB,EAC9B,OAAO,CAAC,CACR,KAAK,CAAC,CACN,IAAI,GAAG,CAAC,CACR,QAAO,QAAO,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,WAAW,UAAU,KAAK,GAAG,KAAK,kBAAkB,GAAG,GAAG,EACxG,SACE,6HACJ,CAAC,CAAC,CACD,SACC,wNACF;;;;;AAMF,eAAsB,aACpB,WACA,OACA,KACsB;CACtB,MAA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,EAAA,CAAG,MAC7E,GAAG,MAAM,EAAE,IAAI,cAAc,EAAE,IAAI,WACtC;IACA,OAAO;KACL,WAAW,UAAU,KAAI,WAAU;MACjC,aAAa,MAAM;MACnB,cAAc,+BAA+B,MAAM,UAAU,EAAE,CAAE,WAAW,CAAC,CAAC;MAC9E,OAAO,MAAM;MACb,OAAO,MAAM,UAAU;MACvB,WAAW,MAAM,MAAM,KAAI,cAAa;OACtC,IAAI,SAAS;OACb,GAAG,IAAI,SAAS,UAAU;OAC1B,UAAU,SAAS;OACnB,UAAU,kBAAkB,UAAU,UAAU,IAAI,SAAS,EAAE,CAAC;MAClE,EAAE;KACJ,EAAE;KACF,WAAW,UACR,MAAM,GAAG,KAAK,CAAC,CACf,KAAI,cAAa;MAAE,GAAG,kBAAkB,QAAQ;MAAG,GAAG,IAAI,SAAS,UAAU;KAAE,EAAE;KACpF,SAAS,QAAQ,MAAM,GAAG,KAAK,CAAC,CAAC,KAAK,EAAE,WAAW,WAAW;MAC5D;MACA,UAAU,IAAI;MACd,OAAO,eAAe,IAAI,QAAQ;MAClC,cAAc,IAAI,KAAK,IAAI,WAAW,CAAC,CAAC,YAAY;KACtD,EAAE;KACF,MAAM,KAAK,MAAM,GAAG,KAAK,CAAC,CAAC,KAAI,UAAS;MACtC,GAAG,IAAI,KAAK,EAAE;MACd,OAAO,cAAc,IAAI;KAC3B,EAAE;KACF,WACE,aAAa,SAAS,SACtB,UAAU,MAAK,UAAS,MAAM,MAAM,SAAS,MAAM,UAAU,MAAM,KACnE,UAAU,SAAS,SACnB,QAAQ,SAAS,SACjB,KAAK,SAAS;IAClB;GACF;EACF,CAAC;CACH;AACF"}
@@ -1,19 +1,12 @@
1
- import type { ProjectBoardSource } from '../boards/project-boards.js';
2
- import type { BoardRegistry } from '../boards/registry.js';
3
1
  import type { IntegrationTools } from '../integrations/base.js';
4
- import type { FactoryStartCoordinator } from '../rules/start-coordinator.js';
5
2
  import type { SourceControlSessionLookup } from '../session/factory-session.js';
6
- import type { AuditRecorder } from '../storage/domains/audit/domain.js';
7
3
  import type { ModelCredentialsStorage } from '../storage/domains/credentials/base.js';
8
4
  import type { CustomProvidersStorage } from '../storage/domains/custom-providers/base.js';
9
- import type { IntakeStorage } from '../storage/domains/intake/base.js';
10
5
  import type { ModelDefaultsStorage } from '../storage/domains/model-defaults/base.js';
11
6
  import type { FactoryProjectsStorage } from '../storage/domains/projects/base.js';
12
7
  import type { WorkItemsStorage } from '../storage/domains/work-items/base.js';
13
8
  import type { FactoryMessaging } from './messaging-tools.js';
14
9
  import type { FactoryToolScope } from './scope.js';
15
- /** Who renews the open-run entries this process writes; one id per process, like the dispatcher's. */
16
- export declare const FACTORY_TOOLS_OWNER_ID: string;
17
10
  export interface FactorySessionToolDependencies {
18
11
  sessions: Pick<SourceControlSessionLookup, 'getBySessionId' | 'getSourceControlBySessionId'>;
19
12
  sessionModel: {
@@ -33,12 +26,6 @@ export interface FactorySessionToolDependencies {
33
26
  /** Resolved lazily: the controller only exists once the mount is up. */
34
27
  messaging: () => Promise<FactoryMessaging | null>;
35
28
  workItems: Pick<WorkItemsStorage, 'listShared' | 'getForProject' | 'listRunBindings' | 'findActiveRunBindingForSession' | 'findRunBindingByThread' | 'hasRunBindingForSession' | 'subscribeToWorkItem' | 'unsubscribeFromWorkItem' | 'listSessionSubscriptions' | 'listWorkItemSubscribers'>;
36
- /** A fixed registry, or the per-project boards. */
37
- boards: BoardRegistry | ProjectBoardSource;
38
- auditRecorder: AuditRecorder;
39
- intake?: Pick<IntakeStorage, 'getConfig'>;
40
- /** The browser Start's coordinator; absent until the Factory runtime is ready. */
41
- startCoordinator: () => Pick<FactoryStartCoordinator, 'prepare'> | undefined;
42
29
  }
43
30
  /** Tools that start sessions on the caller's behalf, or switch their models. User sessions only. */
44
31
  export declare function createFactorySessionTools(scope: FactoryToolScope, deps: FactorySessionToolDependencies): IntegrationTools;
@@ -1 +1 @@
1
- {"version":3,"file":"session-tools.d.ts","sourceRoot":"","sources":["../../src/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