@mastra/factory 0.0.0-fix-thread-subscription-multi-instance-redis-streams-20260730204150

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 (313) hide show
  1. package/CHANGELOG.md +695 -0
  2. package/LICENSE.md +30 -0
  3. package/README.md +27 -0
  4. package/dist/auth.d.ts +181 -0
  5. package/dist/auth.d.ts.map +1 -0
  6. package/dist/auth.js +505 -0
  7. package/dist/auth.js.map +1 -0
  8. package/dist/capabilities/connection.d.ts +9 -0
  9. package/dist/capabilities/connection.d.ts.map +1 -0
  10. package/dist/capabilities/connection.js +1 -0
  11. package/dist/capabilities/intake.d.ts +140 -0
  12. package/dist/capabilities/intake.d.ts.map +1 -0
  13. package/dist/capabilities/intake.js +1 -0
  14. package/dist/capabilities/version-control.d.ts +245 -0
  15. package/dist/capabilities/version-control.d.ts.map +1 -0
  16. package/dist/capabilities/version-control.js +1 -0
  17. package/dist/factory.d.ts +156 -0
  18. package/dist/factory.d.ts.map +1 -0
  19. package/dist/factory.js +483 -0
  20. package/dist/factory.js.map +1 -0
  21. package/dist/index.d.ts +14 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +7 -0
  24. package/dist/integrations/base.d.ts +210 -0
  25. package/dist/integrations/base.d.ts.map +1 -0
  26. package/dist/integrations/base.js +1 -0
  27. package/dist/integrations/github/config.d.ts +60 -0
  28. package/dist/integrations/github/config.d.ts.map +1 -0
  29. package/dist/integrations/github/config.js +42 -0
  30. package/dist/integrations/github/config.js.map +1 -0
  31. package/dist/integrations/github/factory-session.d.ts +12 -0
  32. package/dist/integrations/github/factory-session.d.ts.map +1 -0
  33. package/dist/integrations/github/factory-session.js +37 -0
  34. package/dist/integrations/github/factory-session.js.map +1 -0
  35. package/dist/integrations/github/integration.d.ts +191 -0
  36. package/dist/integrations/github/integration.d.ts.map +1 -0
  37. package/dist/integrations/github/integration.js +1077 -0
  38. package/dist/integrations/github/integration.js.map +1 -0
  39. package/dist/integrations/github/issue-triage.d.ts +27 -0
  40. package/dist/integrations/github/issue-triage.d.ts.map +1 -0
  41. package/dist/integrations/github/issue-triage.js +82 -0
  42. package/dist/integrations/github/issue-triage.js.map +1 -0
  43. package/dist/integrations/github/pat.d.ts +38 -0
  44. package/dist/integrations/github/pat.d.ts.map +1 -0
  45. package/dist/integrations/github/pat.js +59 -0
  46. package/dist/integrations/github/pat.js.map +1 -0
  47. package/dist/integrations/github/provenance.d.ts +27 -0
  48. package/dist/integrations/github/provenance.d.ts.map +1 -0
  49. package/dist/integrations/github/provenance.js +75 -0
  50. package/dist/integrations/github/provenance.js.map +1 -0
  51. package/dist/integrations/github/routes.d.ts +69 -0
  52. package/dist/integrations/github/routes.d.ts.map +1 -0
  53. package/dist/integrations/github/routes.js +1324 -0
  54. package/dist/integrations/github/routes.js.map +1 -0
  55. package/dist/integrations/github/rules.d.ts +78 -0
  56. package/dist/integrations/github/rules.d.ts.map +1 -0
  57. package/dist/integrations/github/rules.js +362 -0
  58. package/dist/integrations/github/rules.js.map +1 -0
  59. package/dist/integrations/github/sandbox-release.d.ts +38 -0
  60. package/dist/integrations/github/sandbox-release.d.ts.map +1 -0
  61. package/dist/integrations/github/sandbox-release.js +74 -0
  62. package/dist/integrations/github/sandbox-release.js.map +1 -0
  63. package/dist/integrations/github/sandbox.d.ts +281 -0
  64. package/dist/integrations/github/sandbox.d.ts.map +1 -0
  65. package/dist/integrations/github/sandbox.js +547 -0
  66. package/dist/integrations/github/sandbox.js.map +1 -0
  67. package/dist/integrations/github/session-subscriptions.d.ts +26 -0
  68. package/dist/integrations/github/session-subscriptions.d.ts.map +1 -0
  69. package/dist/integrations/github/session-subscriptions.js +192 -0
  70. package/dist/integrations/github/session-subscriptions.js.map +1 -0
  71. package/dist/integrations/github/subscriptions.d.ts +54 -0
  72. package/dist/integrations/github/subscriptions.d.ts.map +1 -0
  73. package/dist/integrations/github/subscriptions.js +62 -0
  74. package/dist/integrations/github/subscriptions.js.map +1 -0
  75. package/dist/integrations/github/token-refresh.d.ts +12 -0
  76. package/dist/integrations/github/token-refresh.d.ts.map +1 -0
  77. package/dist/integrations/github/token-refresh.js +24 -0
  78. package/dist/integrations/github/token-refresh.js.map +1 -0
  79. package/dist/integrations/github/webhook.d.ts +87 -0
  80. package/dist/integrations/github/webhook.d.ts.map +1 -0
  81. package/dist/integrations/github/webhook.js +397 -0
  82. package/dist/integrations/github/webhook.js.map +1 -0
  83. package/dist/integrations/linear/agent-tools.d.ts +34 -0
  84. package/dist/integrations/linear/agent-tools.d.ts.map +1 -0
  85. package/dist/integrations/linear/agent-tools.js +85 -0
  86. package/dist/integrations/linear/agent-tools.js.map +1 -0
  87. package/dist/integrations/linear/integration.d.ts +233 -0
  88. package/dist/integrations/linear/integration.d.ts.map +1 -0
  89. package/dist/integrations/linear/integration.js +672 -0
  90. package/dist/integrations/linear/integration.js.map +1 -0
  91. package/dist/integrations/linear/routes.d.ts +61 -0
  92. package/dist/integrations/linear/routes.d.ts.map +1 -0
  93. package/dist/integrations/linear/routes.js +239 -0
  94. package/dist/integrations/linear/routes.js.map +1 -0
  95. package/dist/integrations/linear/rules.d.ts +42 -0
  96. package/dist/integrations/linear/rules.d.ts.map +1 -0
  97. package/dist/integrations/linear/rules.js +133 -0
  98. package/dist/integrations/linear/rules.js.map +1 -0
  99. package/dist/integrations/linear/storage.d.ts +65 -0
  100. package/dist/integrations/linear/storage.d.ts.map +1 -0
  101. package/dist/integrations/linear/storage.js +1 -0
  102. package/dist/integrations/platform/api-client.d.ts +26 -0
  103. package/dist/integrations/platform/api-client.d.ts.map +1 -0
  104. package/dist/integrations/platform/api-client.js +156 -0
  105. package/dist/integrations/platform/api-client.js.map +1 -0
  106. package/dist/integrations/platform/github/event-worker.d.ts +49 -0
  107. package/dist/integrations/platform/github/event-worker.d.ts.map +1 -0
  108. package/dist/integrations/platform/github/event-worker.js +348 -0
  109. package/dist/integrations/platform/github/event-worker.js.map +1 -0
  110. package/dist/integrations/platform/github/integration.d.ts +50 -0
  111. package/dist/integrations/platform/github/integration.d.ts.map +1 -0
  112. package/dist/integrations/platform/github/integration.js +961 -0
  113. package/dist/integrations/platform/github/integration.js.map +1 -0
  114. package/dist/integrations/platform/linear/integration.d.ts +46 -0
  115. package/dist/integrations/platform/linear/integration.d.ts.map +1 -0
  116. package/dist/integrations/platform/linear/integration.js +483 -0
  117. package/dist/integrations/platform/linear/integration.js.map +1 -0
  118. package/dist/integrations/workos/integration.d.ts +39 -0
  119. package/dist/integrations/workos/integration.d.ts.map +1 -0
  120. package/dist/integrations/workos/integration.js +91 -0
  121. package/dist/integrations/workos/integration.js.map +1 -0
  122. package/dist/routes/config.d.ts +235 -0
  123. package/dist/routes/config.d.ts.map +1 -0
  124. package/dist/routes/config.js +972 -0
  125. package/dist/routes/config.js.map +1 -0
  126. package/dist/routes/custom-provider-source.d.ts +52 -0
  127. package/dist/routes/custom-provider-source.d.ts.map +1 -0
  128. package/dist/routes/custom-provider-source.js +124 -0
  129. package/dist/routes/custom-provider-source.js.map +1 -0
  130. package/dist/routes/fs.d.ts +151 -0
  131. package/dist/routes/fs.d.ts.map +1 -0
  132. package/dist/routes/fs.js +708 -0
  133. package/dist/routes/fs.js.map +1 -0
  134. package/dist/routes/intake.d.ts +23 -0
  135. package/dist/routes/intake.d.ts.map +1 -0
  136. package/dist/routes/intake.js +179 -0
  137. package/dist/routes/intake.js.map +1 -0
  138. package/dist/routes/oauth.d.ts +43 -0
  139. package/dist/routes/oauth.d.ts.map +1 -0
  140. package/dist/routes/oauth.js +463 -0
  141. package/dist/routes/oauth.js.map +1 -0
  142. package/dist/routes/projects.d.ts +19 -0
  143. package/dist/routes/projects.d.ts.map +1 -0
  144. package/dist/routes/projects.js +461 -0
  145. package/dist/routes/projects.js.map +1 -0
  146. package/dist/routes/provider-credentials.d.ts +81 -0
  147. package/dist/routes/provider-credentials.d.ts.map +1 -0
  148. package/dist/routes/provider-credentials.js +86 -0
  149. package/dist/routes/provider-credentials.js.map +1 -0
  150. package/dist/routes/route.d.ts +48 -0
  151. package/dist/routes/route.d.ts.map +1 -0
  152. package/dist/routes/route.js +15 -0
  153. package/dist/routes/route.js.map +1 -0
  154. package/dist/routes/skills.d.ts +30 -0
  155. package/dist/routes/skills.d.ts.map +1 -0
  156. package/dist/routes/skills.js +168 -0
  157. package/dist/routes/skills.js.map +1 -0
  158. package/dist/routes/surface.d.ts +91 -0
  159. package/dist/routes/surface.d.ts.map +1 -0
  160. package/dist/routes/surface.js +260 -0
  161. package/dist/routes/surface.js.map +1 -0
  162. package/dist/routes/tenant-credentials.d.ts +74 -0
  163. package/dist/routes/tenant-credentials.d.ts.map +1 -0
  164. package/dist/routes/tenant-credentials.js +156 -0
  165. package/dist/routes/tenant-credentials.js.map +1 -0
  166. package/dist/routes/work-items.d.ts +40 -0
  167. package/dist/routes/work-items.d.ts.map +1 -0
  168. package/dist/routes/work-items.js +695 -0
  169. package/dist/routes/work-items.js.map +1 -0
  170. package/dist/rules/binding-context.d.ts +5 -0
  171. package/dist/rules/binding-context.d.ts.map +1 -0
  172. package/dist/rules/binding-context.js +28 -0
  173. package/dist/rules/binding-context.js.map +1 -0
  174. package/dist/rules/defaults.d.ts +9 -0
  175. package/dist/rules/defaults.d.ts.map +1 -0
  176. package/dist/rules/defaults.js +260 -0
  177. package/dist/rules/defaults.js.map +1 -0
  178. package/dist/rules/dispatcher.d.ts +42 -0
  179. package/dist/rules/dispatcher.d.ts.map +1 -0
  180. package/dist/rules/dispatcher.js +518 -0
  181. package/dist/rules/dispatcher.js.map +1 -0
  182. package/dist/rules/index.d.ts +7 -0
  183. package/dist/rules/index.d.ts.map +1 -0
  184. package/dist/rules/index.js +5 -0
  185. package/dist/rules/processor.d.ts +54 -0
  186. package/dist/rules/processor.d.ts.map +1 -0
  187. package/dist/rules/processor.js +378 -0
  188. package/dist/rules/processor.js.map +1 -0
  189. package/dist/rules/resolve.d.ts +17 -0
  190. package/dist/rules/resolve.d.ts.map +1 -0
  191. package/dist/rules/resolve.js +30 -0
  192. package/dist/rules/resolve.js.map +1 -0
  193. package/dist/rules/start-coordinator.d.ts +60 -0
  194. package/dist/rules/start-coordinator.d.ts.map +1 -0
  195. package/dist/rules/start-coordinator.js +194 -0
  196. package/dist/rules/start-coordinator.js.map +1 -0
  197. package/dist/rules/tools.d.ts +10 -0
  198. package/dist/rules/tools.d.ts.map +1 -0
  199. package/dist/rules/tools.js +58 -0
  200. package/dist/rules/tools.js.map +1 -0
  201. package/dist/rules/transition-service.d.ts +49 -0
  202. package/dist/rules/transition-service.d.ts.map +1 -0
  203. package/dist/rules/transition-service.js +232 -0
  204. package/dist/rules/transition-service.js.map +1 -0
  205. package/dist/rules/types.d.ts +234 -0
  206. package/dist/rules/types.d.ts.map +1 -0
  207. package/dist/rules/types.js +38 -0
  208. package/dist/rules/types.js.map +1 -0
  209. package/dist/rules/validation.d.ts +11 -0
  210. package/dist/rules/validation.d.ts.map +1 -0
  211. package/dist/rules/validation.js +308 -0
  212. package/dist/rules/validation.js.map +1 -0
  213. package/dist/sandbox/fleet.d.ts +222 -0
  214. package/dist/sandbox/fleet.d.ts.map +1 -0
  215. package/dist/sandbox/fleet.js +322 -0
  216. package/dist/sandbox/fleet.js.map +1 -0
  217. package/dist/sandbox/reattach.d.ts +3 -0
  218. package/dist/sandbox/reattach.d.ts.map +1 -0
  219. package/dist/sandbox/reattach.js +16 -0
  220. package/dist/sandbox/reattach.js.map +1 -0
  221. package/dist/server-error.d.ts +12 -0
  222. package/dist/server-error.d.ts.map +1 -0
  223. package/dist/server-error.js +16 -0
  224. package/dist/server-error.js.map +1 -0
  225. package/dist/skills/service.d.ts +48 -0
  226. package/dist/skills/service.d.ts.map +1 -0
  227. package/dist/skills/service.js +40 -0
  228. package/dist/skills/service.js.map +1 -0
  229. package/dist/spa-static.d.ts +33 -0
  230. package/dist/spa-static.d.ts.map +1 -0
  231. package/dist/spa-static.js +104 -0
  232. package/dist/spa-static.js.map +1 -0
  233. package/dist/state-signing.d.ts +59 -0
  234. package/dist/state-signing.d.ts.map +1 -0
  235. package/dist/state-signing.js +83 -0
  236. package/dist/state-signing.js.map +1 -0
  237. package/dist/storage/domains/audit/agent-audit.d.ts +27 -0
  238. package/dist/storage/domains/audit/agent-audit.d.ts.map +1 -0
  239. package/dist/storage/domains/audit/agent-audit.js +66 -0
  240. package/dist/storage/domains/audit/agent-audit.js.map +1 -0
  241. package/dist/storage/domains/audit/base.d.ts +140 -0
  242. package/dist/storage/domains/audit/base.d.ts.map +1 -0
  243. package/dist/storage/domains/audit/base.js +184 -0
  244. package/dist/storage/domains/audit/base.js.map +1 -0
  245. package/dist/storage/domains/audit/domain.d.ts +69 -0
  246. package/dist/storage/domains/audit/domain.d.ts.map +1 -0
  247. package/dist/storage/domains/audit/domain.js +167 -0
  248. package/dist/storage/domains/audit/domain.js.map +1 -0
  249. package/dist/storage/domains/channel-identity/base.d.ts +96 -0
  250. package/dist/storage/domains/channel-identity/base.d.ts.map +1 -0
  251. package/dist/storage/domains/channel-identity/base.js +149 -0
  252. package/dist/storage/domains/channel-identity/base.js.map +1 -0
  253. package/dist/storage/domains/credentials/base.d.ts +134 -0
  254. package/dist/storage/domains/credentials/base.d.ts.map +1 -0
  255. package/dist/storage/domains/credentials/base.js +273 -0
  256. package/dist/storage/domains/credentials/base.js.map +1 -0
  257. package/dist/storage/domains/custom-providers/base.d.ts +57 -0
  258. package/dist/storage/domains/custom-providers/base.d.ts.map +1 -0
  259. package/dist/storage/domains/custom-providers/base.js +145 -0
  260. package/dist/storage/domains/custom-providers/base.js.map +1 -0
  261. package/dist/storage/domains/intake/base.d.ts +38 -0
  262. package/dist/storage/domains/intake/base.d.ts.map +1 -0
  263. package/dist/storage/domains/intake/base.js +80 -0
  264. package/dist/storage/domains/intake/base.js.map +1 -0
  265. package/dist/storage/domains/integrations/base.d.ts +126 -0
  266. package/dist/storage/domains/integrations/base.d.ts.map +1 -0
  267. package/dist/storage/domains/integrations/base.js +317 -0
  268. package/dist/storage/domains/integrations/base.js.map +1 -0
  269. package/dist/storage/domains/memory-settings/base.d.ts +62 -0
  270. package/dist/storage/domains/memory-settings/base.d.ts.map +1 -0
  271. package/dist/storage/domains/memory-settings/base.js +126 -0
  272. package/dist/storage/domains/memory-settings/base.js.map +1 -0
  273. package/dist/storage/domains/model-packs/base.d.ts +49 -0
  274. package/dist/storage/domains/model-packs/base.d.ts.map +1 -0
  275. package/dist/storage/domains/model-packs/base.js +96 -0
  276. package/dist/storage/domains/model-packs/base.js.map +1 -0
  277. package/dist/storage/domains/projects/base.d.ts +58 -0
  278. package/dist/storage/domains/projects/base.d.ts.map +1 -0
  279. package/dist/storage/domains/projects/base.js +111 -0
  280. package/dist/storage/domains/projects/base.js.map +1 -0
  281. package/dist/storage/domains/queue-health/base.d.ts +52 -0
  282. package/dist/storage/domains/queue-health/base.d.ts.map +1 -0
  283. package/dist/storage/domains/queue-health/base.js +122 -0
  284. package/dist/storage/domains/queue-health/base.js.map +1 -0
  285. package/dist/storage/domains/source-control/base.d.ts +358 -0
  286. package/dist/storage/domains/source-control/base.d.ts.map +1 -0
  287. package/dist/storage/domains/source-control/base.js +908 -0
  288. package/dist/storage/domains/source-control/base.js.map +1 -0
  289. package/dist/storage/domains/source-control/inmemory.d.ts +175 -0
  290. package/dist/storage/domains/source-control/inmemory.d.ts.map +1 -0
  291. package/dist/storage/domains/source-control/inmemory.js +377 -0
  292. package/dist/storage/domains/source-control/inmemory.js.map +1 -0
  293. package/dist/storage/domains/work-items/base.d.ts +412 -0
  294. package/dist/storage/domains/work-items/base.d.ts.map +1 -0
  295. package/dist/storage/domains/work-items/base.js +1309 -0
  296. package/dist/storage/domains/work-items/base.js.map +1 -0
  297. package/dist/storage/domains/work-items/metrics.d.ts +101 -0
  298. package/dist/storage/domains/work-items/metrics.d.ts.map +1 -0
  299. package/dist/storage/domains/work-items/metrics.js +221 -0
  300. package/dist/storage/domains/work-items/metrics.js.map +1 -0
  301. package/dist/timing.d.ts +15 -0
  302. package/dist/timing.d.ts.map +1 -0
  303. package/dist/timing.js +34 -0
  304. package/dist/timing.js.map +1 -0
  305. package/dist/workspace.d.ts +24 -0
  306. package/dist/workspace.d.ts.map +1 -0
  307. package/dist/workspace.js +286 -0
  308. package/dist/workspace.js.map +1 -0
  309. package/factory-skills/configure-factory-rules/SKILL.md +67 -0
  310. package/factory-skills/factory-plan/SKILL.md +61 -0
  311. package/factory-skills/factory-review/SKILL.md +155 -0
  312. package/factory-skills/factory-triage/SKILL.md +77 -0
  313. package/package.json +81 -0
@@ -0,0 +1,122 @@
1
+ import { FactoryStorageDomain, UniqueViolationError } from "@mastra/core/storage";
2
+ //#region src/storage/domains/queue-health/base.ts
3
+ /**
4
+ * Queue-health threshold configuration domain: per-project age buckets for the
5
+ * Factory Overview queue-health chart.
6
+ *
7
+ * Stored per `(org, github_project)` — each connected GitHub project gets its
8
+ * own age thresholds so a fast-moving automated pipeline and a slow human one
9
+ * can bucket "how old is the work" differently. `thresholdsSeconds` is an
10
+ * ordered-ascending list of age boundaries in seconds: an item younger than
11
+ * the first boundary is green, younger than the second amber, younger than the
12
+ * third orange, and red otherwise. Seconds (not hours) so sub-minute buckets
13
+ * are representable for fast automated flows.
14
+ */
15
+ /** Default: green <4h, amber <24h, orange <72h, red 72h+. */
16
+ const DEFAULT_QUEUE_HEALTH_CONFIG = { thresholdsSeconds: [
17
+ 14400,
18
+ 86400,
19
+ 259200
20
+ ] };
21
+ /**
22
+ * Throw unless `thresholdsSeconds` is a non-empty ascending number list. A
23
+ * descending config would silently invert bucket semantics, so validate at the
24
+ * write boundary rather than trusting callers.
25
+ */
26
+ function assertValidThresholds(config) {
27
+ const t = config.thresholdsSeconds;
28
+ if (!Array.isArray(t) || t.length === 0 || t.some((v) => typeof v !== "number" || !Number.isFinite(v))) throw new Error("[QueueHealthStorage] thresholdsSeconds must be a non-empty array of finite numbers.");
29
+ for (let i = 1; i < t.length; i++) if (t[i] <= t[i - 1]) throw new Error("[QueueHealthStorage] thresholdsSeconds must be strictly ascending.");
30
+ }
31
+ /** Validate untrusted JSON into a `QueueHealthConfig`, or `null` when invalid. */
32
+ function parseQueueHealthConfig(body) {
33
+ if (typeof body !== "object" || body === null) return null;
34
+ const config = body;
35
+ if (!Array.isArray(config.thresholdsSeconds)) return null;
36
+ try {
37
+ assertValidThresholds(config);
38
+ } catch {
39
+ return null;
40
+ }
41
+ return { thresholdsSeconds: [...config.thresholdsSeconds] };
42
+ }
43
+ /**
44
+ * Return `config.thresholdsSeconds` when valid, else the default. Validation
45
+ * lives at the `saveConfig` write boundary, but `getConfig` round-trips a
46
+ * stored JSON row — a corrupted or hand-edited row (empty / non-ascending)
47
+ * would otherwise reach the chart and invert bucket colors, so the read route
48
+ * re-validates and falls back.
49
+ */
50
+ function thresholdsOrDefault(config) {
51
+ return parseQueueHealthConfig(config)?.thresholdsSeconds ?? DEFAULT_QUEUE_HEALTH_CONFIG.thresholdsSeconds;
52
+ }
53
+ const QUEUE_HEALTH_SETTINGS_SCHEMA = {
54
+ name: "queue_health_settings",
55
+ columns: {
56
+ id: { type: "uuid-pk" },
57
+ org_id: { type: "text" },
58
+ factory_project_id: { type: "text" },
59
+ config: { type: "json" },
60
+ created_at: { type: "timestamp" },
61
+ updated_at: { type: "timestamp" }
62
+ },
63
+ uniqueIndexes: [{
64
+ name: "queue_health_settings_org_project_unique",
65
+ columns: ["org_id", "factory_project_id"]
66
+ }]
67
+ };
68
+ /**
69
+ * Queue-health settings storage, written once against the generic
70
+ * `FactoryStorageOps` surface — works on any `FactoryStorage` backend.
71
+ */
72
+ var QueueHealthStorage = class extends FactoryStorageDomain {
73
+ constructor() {
74
+ super("queue-health");
75
+ }
76
+ async init() {
77
+ await this.ensureCollections([QUEUE_HEALTH_SETTINGS_SCHEMA]);
78
+ }
79
+ async dangerouslyClearAll() {
80
+ await this.ops.deleteMany("queue_health_settings", {});
81
+ }
82
+ get #db() {
83
+ return this.ops;
84
+ }
85
+ /** Read the project's queue-health config, falling back to {@link DEFAULT_QUEUE_HEALTH_CONFIG}. */
86
+ async getConfig(orgId, factoryProjectId) {
87
+ const row = await this.#db.findOne("queue_health_settings", {
88
+ org_id: orgId,
89
+ factory_project_id: factoryProjectId
90
+ });
91
+ return structuredClone(parseQueueHealthConfig(row?.config) ?? DEFAULT_QUEUE_HEALTH_CONFIG);
92
+ }
93
+ /** Upsert the project's queue-health config (`created_at` is preserved on update). */
94
+ async saveConfig(orgId, factoryProjectId, config) {
95
+ assertValidThresholds(config);
96
+ const where = {
97
+ org_id: orgId,
98
+ factory_project_id: factoryProjectId
99
+ };
100
+ const updateExisting = () => this.#db.updateAtomic("queue_health_settings", where, () => ({
101
+ config,
102
+ updated_at: /* @__PURE__ */ new Date()
103
+ }));
104
+ if (await updateExisting()) return;
105
+ const now = /* @__PURE__ */ new Date();
106
+ try {
107
+ await this.#db.insertOne("queue_health_settings", {
108
+ ...where,
109
+ config,
110
+ created_at: now,
111
+ updated_at: now
112
+ });
113
+ } catch (error) {
114
+ if (!(error instanceof UniqueViolationError)) throw error;
115
+ if (!await updateExisting()) throw error;
116
+ }
117
+ }
118
+ };
119
+ //#endregion
120
+ export { DEFAULT_QUEUE_HEALTH_CONFIG, QUEUE_HEALTH_SETTINGS_SCHEMA, QueueHealthStorage, assertValidThresholds, parseQueueHealthConfig, thresholdsOrDefault };
121
+
122
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.js","names":["#db"],"sources":["../../../../src/storage/domains/queue-health/base.ts"],"sourcesContent":["/**\n * Queue-health threshold configuration domain: per-project age buckets for the\n * Factory Overview queue-health chart.\n *\n * Stored per `(org, github_project)` — each connected GitHub project gets its\n * own age thresholds so a fast-moving automated pipeline and a slow human one\n * can bucket \"how old is the work\" differently. `thresholdsSeconds` is an\n * ordered-ascending list of age boundaries in seconds: an item younger than\n * the first boundary is green, younger than the second amber, younger than the\n * third orange, and red otherwise. Seconds (not hours) so sub-minute buckets\n * are representable for fast automated flows.\n */\n\nimport { FactoryStorageDomain, UniqueViolationError } from '@mastra/core/storage';\nimport type { CollectionSchema, FactoryStorageOps } from '@mastra/core/storage';\n\nexport interface QueueHealthConfig {\n /** Ordered-ascending age boundaries in seconds, e.g. `[14400, 86400, 259200]`. */\n thresholdsSeconds: number[];\n}\n\n/** Default: green <4h, amber <24h, orange <72h, red 72h+. */\nexport const DEFAULT_QUEUE_HEALTH_CONFIG: QueueHealthConfig = {\n thresholdsSeconds: [14400, 86400, 259200],\n};\n\n/**\n * Throw unless `thresholdsSeconds` is a non-empty ascending number list. A\n * descending config would silently invert bucket semantics, so validate at the\n * write boundary rather than trusting callers.\n */\nexport function assertValidThresholds(config: QueueHealthConfig): void {\n const t = config.thresholdsSeconds;\n if (!Array.isArray(t) || t.length === 0 || t.some(v => typeof v !== 'number' || !Number.isFinite(v))) {\n throw new Error('[QueueHealthStorage] thresholdsSeconds must be a non-empty array of finite numbers.');\n }\n for (let i = 1; i < t.length; i++) {\n if (t[i]! <= t[i - 1]!) {\n throw new Error('[QueueHealthStorage] thresholdsSeconds must be strictly ascending.');\n }\n }\n}\n\n/** Validate untrusted JSON into a `QueueHealthConfig`, or `null` when invalid. */\nexport function parseQueueHealthConfig(body: unknown): QueueHealthConfig | null {\n if (typeof body !== 'object' || body === null) return null;\n const config = body as { thresholdsSeconds?: unknown };\n if (!Array.isArray(config.thresholdsSeconds)) return null;\n try {\n assertValidThresholds(config as QueueHealthConfig);\n } catch {\n return null;\n }\n return { thresholdsSeconds: [...(config as QueueHealthConfig).thresholdsSeconds] };\n}\n\n/**\n * Return `config.thresholdsSeconds` when valid, else the default. Validation\n * lives at the `saveConfig` write boundary, but `getConfig` round-trips a\n * stored JSON row — a corrupted or hand-edited row (empty / non-ascending)\n * would otherwise reach the chart and invert bucket colors, so the read route\n * re-validates and falls back.\n */\nexport function thresholdsOrDefault(config: QueueHealthConfig): number[] {\n return parseQueueHealthConfig(config)?.thresholdsSeconds ?? DEFAULT_QUEUE_HEALTH_CONFIG.thresholdsSeconds;\n}\n\nexport const QUEUE_HEALTH_SETTINGS_SCHEMA: CollectionSchema = {\n name: 'queue_health_settings',\n columns: {\n id: { type: 'uuid-pk' },\n org_id: { type: 'text' },\n factory_project_id: { type: 'text' },\n config: { type: 'json' },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n },\n uniqueIndexes: [{ name: 'queue_health_settings_org_project_unique', columns: ['org_id', 'factory_project_id'] }],\n};\n\n/**\n * Queue-health settings storage, written once against the generic\n * `FactoryStorageOps` surface — works on any `FactoryStorage` backend.\n */\nexport class QueueHealthStorage extends FactoryStorageDomain {\n constructor() {\n super('queue-health');\n }\n\n async init(): Promise<void> {\n await this.ensureCollections([QUEUE_HEALTH_SETTINGS_SCHEMA]);\n }\n\n async dangerouslyClearAll(): Promise<void> {\n await this.ops.deleteMany('queue_health_settings', {});\n }\n\n get #db(): FactoryStorageOps {\n return this.ops;\n }\n\n /** Read the project's queue-health config, falling back to {@link DEFAULT_QUEUE_HEALTH_CONFIG}. */\n async getConfig(orgId: string, factoryProjectId: string): Promise<QueueHealthConfig> {\n const row = await this.#db.findOne<{ config: unknown }>('queue_health_settings', {\n org_id: orgId,\n factory_project_id: factoryProjectId,\n });\n return structuredClone(parseQueueHealthConfig(row?.config) ?? DEFAULT_QUEUE_HEALTH_CONFIG);\n }\n\n /** Upsert the project's queue-health config (`created_at` is preserved on update). */\n async saveConfig(orgId: string, factoryProjectId: string, config: QueueHealthConfig): Promise<void> {\n assertValidThresholds(config);\n const where = { org_id: orgId, factory_project_id: factoryProjectId };\n const updateExisting = () =>\n this.#db.updateAtomic('queue_health_settings', where, () => ({ config, updated_at: new Date() }));\n if (await updateExisting()) return;\n\n const now = new Date();\n try {\n await this.#db.insertOne('queue_health_settings', { ...where, config, created_at: now, updated_at: now });\n } catch (error) {\n if (!(error instanceof UniqueViolationError)) throw error;\n // Lost the insert race — update the winning row under the backend's serialized write primitive.\n if (!(await updateExisting())) throw error;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAsB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C,4BAA4B,CAAC;CAC7D;CAEA,MAAM,sBAAqC;EACzC,MAAM,KAAK,IAAI,WAAW,yBAAyB,CAAC,CAAC;CACvD;CAEA,IAAIA,MAAyB;EAC3B,OAAO,KAAK;CACd;;CAGA,MAAM,UAAU,OAAe,kBAAsD;EACnF,MAAM,MAAM,MAAM,KAAKA,IAAI,QAA6B,yBAAyB;GAC/E,QAAQ;GACR,oBAAoB;EACtB,CAAC;EACD,OAAO,gBAAgB,uBAAuB,KAAK,MAAM,KAAK,2BAA2B;CAC3F;;CAGA,MAAM,WAAW,OAAe,kBAA0B,QAA0C;EAClG,sBAAsB,MAAM;EAC5B,MAAM,QAAQ;GAAE,QAAQ;GAAO,oBAAoB;EAAiB;EACpE,MAAM,uBACJ,KAAKA,IAAI,aAAa,yBAAyB,cAAc;GAAE;GAAQ,4BAAY,IAAI,KAAK;EAAE,EAAE;EAClG,IAAI,MAAM,eAAe,GAAG;EAE5B,MAAM,sBAAM,IAAI,KAAK;EACrB,IAAI;GACF,MAAM,KAAKA,IAAI,UAAU,yBAAyB;IAAE,GAAG;IAAO;IAAQ,YAAY;IAAK,YAAY;GAAI,CAAC;EAC1G,SAAS,OAAO;GACd,IAAI,EAAE,iBAAiB,uBAAuB,MAAM;GAEpD,IAAI,CAAE,MAAM,eAAe,GAAI,MAAM;EACvC;CACF;AACF"}
@@ -0,0 +1,358 @@
1
+ import { FactoryStorageDomain } from '@mastra/core/storage';
2
+ import type { CollectionSchema } from '@mastra/core/storage';
3
+ export declare const SOURCE_CONTROL_SCHEMAS: CollectionSchema[];
4
+ export type SourceControlProviderMetadata = Record<string, unknown>;
5
+ export interface SourceControlInstallation {
6
+ id: string;
7
+ integrationId: string;
8
+ orgId: string;
9
+ connectedByUserId: string;
10
+ externalId: string;
11
+ accountName: string | null;
12
+ accountType: string | null;
13
+ providerMetadata: SourceControlProviderMetadata;
14
+ createdAt: Date;
15
+ }
16
+ export interface UpsertSourceControlInstallationInput {
17
+ orgId: string;
18
+ connectedByUserId: string;
19
+ externalId: string;
20
+ accountName?: string | null;
21
+ accountType?: string | null;
22
+ providerMetadata?: SourceControlProviderMetadata;
23
+ }
24
+ export interface SourceControlRepository {
25
+ id: string;
26
+ installationId: string;
27
+ externalId: string;
28
+ slug: string;
29
+ defaultBranch: string;
30
+ providerMetadata: SourceControlProviderMetadata;
31
+ createdAt: Date;
32
+ updatedAt: Date;
33
+ }
34
+ export interface UpsertSourceControlRepositoryInput {
35
+ installationId: string;
36
+ externalId: string;
37
+ slug: string;
38
+ defaultBranch: string;
39
+ providerMetadata?: SourceControlProviderMetadata;
40
+ }
41
+ export interface ProjectSourceControlConnection {
42
+ id: string;
43
+ factoryProjectId: string;
44
+ integrationId: string;
45
+ installationId: string;
46
+ createdByUserId: string;
47
+ createdAt: Date;
48
+ }
49
+ export interface CreateProjectSourceControlConnectionInput {
50
+ orgId: string;
51
+ factoryProjectId: string;
52
+ installationId: string;
53
+ createdByUserId: string;
54
+ }
55
+ export interface ProjectRepository {
56
+ id: string;
57
+ connectionId: string;
58
+ repositoryId: string;
59
+ createdByUserId: string;
60
+ branch: string | null;
61
+ sandboxProvider: string;
62
+ sandboxWorkdir: string;
63
+ setupCommand: string | null;
64
+ createdAt: Date;
65
+ updatedAt: Date;
66
+ }
67
+ export interface ExternalRepositoryProjectTarget {
68
+ orgId: string;
69
+ factoryProjectId: string;
70
+ projectRepository: ProjectRepository;
71
+ }
72
+ /** External id pair identifying a repository linked to a factory project. */
73
+ export interface ConfiguredExternalRepositoryKey {
74
+ installationExternalId: string;
75
+ repositoryExternalId: string;
76
+ }
77
+ export interface LinkProjectRepositoryInput {
78
+ orgId: string;
79
+ connectionId: string;
80
+ repositoryId: string;
81
+ createdByUserId: string;
82
+ branch?: string | null;
83
+ sandboxProvider: string;
84
+ sandboxWorkdir: string;
85
+ setupCommand?: string | null;
86
+ }
87
+ export interface UpdateProjectRepositoryInput {
88
+ branch?: string | null;
89
+ sandboxProvider?: string;
90
+ sandboxWorkdir?: string;
91
+ setupCommand?: string | null;
92
+ }
93
+ export interface ProjectRepositorySandbox {
94
+ id: string;
95
+ projectRepositoryId: string;
96
+ userId: string;
97
+ sandboxId: string | null;
98
+ sandboxWorkdir: string;
99
+ materializedAt: Date | null;
100
+ createdAt: Date;
101
+ }
102
+ /**
103
+ * A provider sandbox that is no longer bound to any session and can be handed
104
+ * to the next session for the same project-repository link instead of
105
+ * provisioning a fresh VM. Pooling is per-repository, not per-user: no
106
+ * credentials are baked into the VM (tokens are injected per command), so any
107
+ * user's session can safely claim it. `userId` records who released it,
108
+ * purely as provenance.
109
+ */
110
+ export interface PooledSandbox {
111
+ id: string;
112
+ orgId: string;
113
+ projectRepositoryId: string;
114
+ /** User whose session released this sandbox (provenance, not a claim key). */
115
+ userId: string;
116
+ sandboxId: string;
117
+ sandboxWorkdir: string;
118
+ releasedAt: Date;
119
+ }
120
+ export interface ReleasePooledSandboxInput {
121
+ orgId: string;
122
+ projectRepositoryId: string;
123
+ userId: string;
124
+ sandboxId: string;
125
+ sandboxWorkdir: string;
126
+ }
127
+ export interface SourceControlWorktree {
128
+ id: string;
129
+ projectRepositoryId: string;
130
+ userId: string;
131
+ branch: string;
132
+ baseBranch: string;
133
+ worktreePath: string;
134
+ createdAt: Date;
135
+ }
136
+ export interface UpsertSourceControlWorktreeInput {
137
+ projectRepositoryId: string;
138
+ userId: string;
139
+ branch: string;
140
+ baseBranch: string;
141
+ worktreePath: string;
142
+ }
143
+ export interface SourceControlSession {
144
+ id: string;
145
+ sessionId: string;
146
+ projectRepositoryId: string;
147
+ orgId: string;
148
+ userId: string;
149
+ branch: string;
150
+ baseBranch: string;
151
+ sandboxId: string | null;
152
+ sandboxWorkdir: string | null;
153
+ materializedAt: Date | null;
154
+ createdAt: Date;
155
+ updatedAt: Date;
156
+ }
157
+ export interface CreateSourceControlSessionInput {
158
+ sessionId: string;
159
+ projectRepositoryId: string;
160
+ orgId: string;
161
+ userId: string;
162
+ branch: string;
163
+ baseBranch: string;
164
+ }
165
+ export interface SourceControlStorageHandle {
166
+ readonly integrationId: string;
167
+ readonly installations: {
168
+ list(args: {
169
+ orgId: string;
170
+ }): Promise<SourceControlInstallation[]>;
171
+ get(args: {
172
+ orgId: string;
173
+ id: string;
174
+ }): Promise<SourceControlInstallation | null>;
175
+ findByExternalId(args: {
176
+ orgId: string;
177
+ externalId: string;
178
+ }): Promise<SourceControlInstallation | null>;
179
+ upsert(args: UpsertSourceControlInstallationInput): Promise<SourceControlInstallation>;
180
+ delete(args: {
181
+ orgId: string;
182
+ id: string;
183
+ }): Promise<boolean>;
184
+ };
185
+ readonly repositories: {
186
+ list(args: {
187
+ orgId: string;
188
+ installationId: string;
189
+ }): Promise<SourceControlRepository[]>;
190
+ get(args: {
191
+ orgId: string;
192
+ id: string;
193
+ }): Promise<SourceControlRepository | null>;
194
+ findByExternalId(args: {
195
+ orgId: string;
196
+ externalId: string;
197
+ }): Promise<SourceControlRepository | null>;
198
+ findBySlug(args: {
199
+ orgId: string;
200
+ installationId: string;
201
+ slug: string;
202
+ }): Promise<SourceControlRepository | null>;
203
+ upsert(args: {
204
+ orgId: string;
205
+ input: UpsertSourceControlRepositoryInput;
206
+ }): Promise<SourceControlRepository>;
207
+ /**
208
+ * Migrate a repository and its dependent connections to a new installation.
209
+ * Used when a GitHub App is reinstalled with a new installation ID on the same account.
210
+ * Returns the repository under the new installation (either migrated or existing).
211
+ */
212
+ migrateInstallation(args: {
213
+ orgId: string;
214
+ id: string;
215
+ newInstallationId: string;
216
+ }): Promise<SourceControlRepository>;
217
+ };
218
+ readonly connections: {
219
+ list(args: {
220
+ orgId: string;
221
+ factoryProjectId: string;
222
+ }): Promise<ProjectSourceControlConnection[]>;
223
+ get(args: {
224
+ orgId: string;
225
+ id: string;
226
+ }): Promise<ProjectSourceControlConnection | null>;
227
+ create(args: CreateProjectSourceControlConnectionInput): Promise<ProjectSourceControlConnection>;
228
+ delete(args: {
229
+ orgId: string;
230
+ id: string;
231
+ }): Promise<boolean>;
232
+ };
233
+ readonly projectRepositories: {
234
+ list(args: {
235
+ orgId: string;
236
+ connectionId: string;
237
+ }): Promise<ProjectRepository[]>;
238
+ listByExternalRepository(args: {
239
+ installationExternalId: string;
240
+ repositoryExternalId: string;
241
+ }): Promise<ExternalRepositoryProjectTarget[]>;
242
+ /**
243
+ * Distinct external (installation, repository) id pairs linked to any
244
+ * factory project. Lets sweeps scope work to configured repositories
245
+ * without probing every repository an installation can see.
246
+ */
247
+ listConfiguredExternalKeys(): Promise<ConfiguredExternalRepositoryKey[]>;
248
+ get(args: {
249
+ orgId: string;
250
+ id: string;
251
+ }): Promise<ProjectRepository | null>;
252
+ link(args: LinkProjectRepositoryInput): Promise<ProjectRepository>;
253
+ update(args: {
254
+ orgId: string;
255
+ id: string;
256
+ input: UpdateProjectRepositoryInput;
257
+ }): Promise<ProjectRepository | null>;
258
+ unlink(args: {
259
+ orgId: string;
260
+ id: string;
261
+ }): Promise<boolean>;
262
+ };
263
+ readonly sandboxes: {
264
+ getOrCreate(args: {
265
+ projectRepository: ProjectRepository;
266
+ userId: string;
267
+ }): Promise<ProjectRepositorySandbox>;
268
+ getById(args: {
269
+ id: string;
270
+ }): Promise<ProjectRepositorySandbox | null>;
271
+ /**
272
+ * Point the binding at a new workdir and clear `materializedAt` — a moved
273
+ * workdir means the checkout must be re-cloned. Used to heal bindings whose
274
+ * inherited workdir went stale (e.g. the sandbox provider changed).
275
+ */
276
+ setWorkdir(args: {
277
+ id: string;
278
+ sandboxWorkdir: string;
279
+ }): Promise<void>;
280
+ setSandboxId(args: {
281
+ id: string;
282
+ sandboxId: string;
283
+ }): Promise<void>;
284
+ clearBinding(args: {
285
+ id: string;
286
+ }): Promise<void>;
287
+ markMaterialized(args: {
288
+ id: string;
289
+ }): Promise<void>;
290
+ };
291
+ readonly sandboxPool: {
292
+ /**
293
+ * Return a sandbox to the reuse pool. Idempotent per provider sandbox ID —
294
+ * releasing the same sandbox twice keeps one pool row.
295
+ */
296
+ release(args: ReleasePooledSandboxInput): Promise<void>;
297
+ /**
298
+ * Atomically take one pooled sandbox for the given project-repository
299
+ * link, preferring the most recently released (warmest) VM. Returns
300
+ * `null` when the pool is empty. Each pooled sandbox is handed to exactly
301
+ * one claimer even under concurrent claims.
302
+ */
303
+ claim(args: {
304
+ projectRepositoryId: string;
305
+ }): Promise<PooledSandbox | null>;
306
+ };
307
+ readonly worktrees: {
308
+ upsert(args: UpsertSourceControlWorktreeInput): Promise<void>;
309
+ list(args: {
310
+ projectRepositoryId: string;
311
+ userId: string;
312
+ }): Promise<SourceControlWorktree[]>;
313
+ get(args: {
314
+ projectRepositoryId: string;
315
+ userId: string;
316
+ branch: string;
317
+ }): Promise<SourceControlWorktree | null>;
318
+ findByPath(args: {
319
+ projectRepositoryId: string;
320
+ userId: string;
321
+ worktreePath: string;
322
+ }): Promise<SourceControlWorktree | null>;
323
+ delete(args: {
324
+ projectRepositoryId: string;
325
+ userId: string;
326
+ branch: string;
327
+ }): Promise<void>;
328
+ };
329
+ readonly sessions: {
330
+ list(args: {
331
+ projectRepositoryId: string;
332
+ userId: string;
333
+ }): Promise<SourceControlSession[]>;
334
+ getBySessionId(sessionId: string): Promise<SourceControlSession | null>;
335
+ getForBranch(args: {
336
+ projectRepositoryId: string;
337
+ userId: string;
338
+ branch: string;
339
+ }): Promise<SourceControlSession | null>;
340
+ create(input: CreateSourceControlSessionInput): Promise<SourceControlSession>;
341
+ setSandbox(args: {
342
+ id: string;
343
+ sandboxId: string | null;
344
+ sandboxWorkdir: string;
345
+ }): Promise<void>;
346
+ markMaterialized(args: {
347
+ id: string;
348
+ }): Promise<void>;
349
+ delete(id: string): Promise<void>;
350
+ };
351
+ }
352
+ export declare class SourceControlStorage extends FactoryStorageDomain {
353
+ constructor();
354
+ init(): Promise<void>;
355
+ dangerouslyClearAll(): Promise<void>;
356
+ forIntegration(integrationId: string): SourceControlStorageHandle;
357
+ }
358
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.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