@mastra/factory 0.25.0-alpha.4 → 0.25.0-alpha.6

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 (358) hide show
  1. package/README.md +3 -1
  2. package/dist/auth.js +1 -2
  3. package/dist/boards/define-board.js +1 -2
  4. package/dist/boards/index.js +1 -2
  5. package/dist/boards/registry.js +1 -2
  6. package/dist/boards/relocate.js +1 -2
  7. package/dist/boards/review.js +1 -2
  8. package/dist/boards/semantics.js +1 -2
  9. package/dist/boards/transition-policy.js +1 -2
  10. package/dist/boards/work-tool-rules.js +1 -2
  11. package/dist/boards/work-transition-policy.js +1 -2
  12. package/dist/boards/work.js +1 -2
  13. package/dist/default-thinking-level.d.ts +3 -0
  14. package/dist/default-thinking-level.d.ts.map +1 -0
  15. package/dist/default-thinking-level.js +5 -0
  16. package/dist/default-thinking-level.js.map +1 -0
  17. package/dist/environment/build-runner.js +1 -2
  18. package/dist/environment/build-schedule.js +1 -2
  19. package/dist/environment/build-workflow.js +1 -2
  20. package/dist/environment/build.js +1 -2
  21. package/dist/environment/heads.js +1 -2
  22. package/dist/factory.d.ts +4 -2
  23. package/dist/factory.d.ts.map +1 -1
  24. package/dist/factory.js +62 -21
  25. package/dist/factory.js.map +1 -1
  26. package/dist/feed-events.js +1 -2
  27. package/dist/index.js +2 -2
  28. package/dist/integrations/channel-thread-announcements.d.ts +8 -0
  29. package/dist/integrations/channel-thread-announcements.d.ts.map +1 -0
  30. package/dist/integrations/channel-thread-announcements.js +16 -0
  31. package/dist/integrations/channel-thread-announcements.js.map +1 -0
  32. package/dist/integrations/github/acceptance-labels.js +1 -2
  33. package/dist/integrations/github/app-identity.js +1 -2
  34. package/dist/integrations/github/commits.js +1 -2
  35. package/dist/integrations/github/config.js +1 -2
  36. package/dist/integrations/github/default-rules.js +2 -3
  37. package/dist/integrations/github/integration.js +3 -4
  38. package/dist/integrations/github/issue-reconciler.js +1 -2
  39. package/dist/integrations/github/pat.js +1 -2
  40. package/dist/integrations/github/provenance.d.ts.map +1 -1
  41. package/dist/integrations/github/provenance.js +2 -5
  42. package/dist/integrations/github/provenance.js.map +1 -1
  43. package/dist/integrations/github/reconcile-worker.js +1 -2
  44. package/dist/integrations/github/reconciliation-config.js +1 -2
  45. package/dist/integrations/github/routes.js +4 -5
  46. package/dist/integrations/github/rules.d.ts.map +1 -1
  47. package/dist/integrations/github/rules.js +14 -3
  48. package/dist/integrations/github/rules.js.map +1 -1
  49. package/dist/integrations/github/sandbox-release.js +1 -2
  50. package/dist/integrations/github/sandbox.js +1 -2
  51. package/dist/integrations/github/session-subscriptions.js +1 -2
  52. package/dist/integrations/github/settle-or-abort.js +1 -2
  53. package/dist/integrations/github/stale-reviews.js +1 -2
  54. package/dist/integrations/github/subscriptions.js +1 -2
  55. package/dist/integrations/github/token-refresh.js +1 -2
  56. package/dist/integrations/github/webhook.d.ts.map +1 -1
  57. package/dist/integrations/github/webhook.js +17 -3
  58. package/dist/integrations/github/webhook.js.map +1 -1
  59. package/dist/integrations/gitlab/agent-tools.js +1 -2
  60. package/dist/integrations/gitlab/api.js +1 -2
  61. package/dist/integrations/gitlab/default-rules.js +1 -2
  62. package/dist/integrations/gitlab/integration.d.ts +4 -0
  63. package/dist/integrations/gitlab/integration.d.ts.map +1 -1
  64. package/dist/integrations/gitlab/integration.js +12 -4
  65. package/dist/integrations/gitlab/integration.js.map +1 -1
  66. package/dist/integrations/gitlab/issue-reconciler.js +1 -2
  67. package/dist/integrations/gitlab/merge-request-reconciler.js +1 -2
  68. package/dist/integrations/gitlab/reconciler.js +1 -2
  69. package/dist/integrations/gitlab/reconciliation-config.js +1 -2
  70. package/dist/integrations/gitlab/routes.d.ts +6 -0
  71. package/dist/integrations/gitlab/routes.d.ts.map +1 -1
  72. package/dist/integrations/gitlab/routes.js +154 -3
  73. package/dist/integrations/gitlab/routes.js.map +1 -1
  74. package/dist/integrations/gitlab/rules.d.ts.map +1 -1
  75. package/dist/integrations/gitlab/rules.js +5 -3
  76. package/dist/integrations/gitlab/rules.js.map +1 -1
  77. package/dist/integrations/gitlab/session-subscriptions.js +1 -2
  78. package/dist/integrations/gitlab/subscriptions.js +1 -2
  79. package/dist/integrations/gitlab/version-control.js +1 -2
  80. package/dist/integrations/gitlab/webhook-dispatch.js +1 -2
  81. package/dist/integrations/gitlab/webhook.js +1 -2
  82. package/dist/integrations/incidentio/agent-tools.js +1 -2
  83. package/dist/integrations/incidentio/api.js +1 -2
  84. package/dist/integrations/incidentio/claim.js +1 -2
  85. package/dist/integrations/incidentio/default-rules.js +1 -2
  86. package/dist/integrations/incidentio/intake.js +1 -2
  87. package/dist/integrations/incidentio/integration.js +1 -2
  88. package/dist/integrations/incidentio/issue-reconciler.js +1 -2
  89. package/dist/integrations/incidentio/reconciliation-config.js +1 -2
  90. package/dist/integrations/incidentio/routes.js +1 -2
  91. package/dist/integrations/incidentio/rules.js +1 -2
  92. package/dist/integrations/issue-reconcile-worker.js +1 -2
  93. package/dist/integrations/issue-reconciler.js +1 -2
  94. package/dist/integrations/jira/adf.js +1 -2
  95. package/dist/integrations/jira/agent-tools.js +1 -2
  96. package/dist/integrations/jira/api.d.ts +1 -1
  97. package/dist/integrations/jira/api.d.ts.map +1 -1
  98. package/dist/integrations/jira/api.js +2 -3
  99. package/dist/integrations/jira/api.js.map +1 -1
  100. package/dist/integrations/jira/claim.js +1 -2
  101. package/dist/integrations/jira/default-rules.js +1 -2
  102. package/dist/integrations/jira/integration.d.ts +3 -1
  103. package/dist/integrations/jira/integration.d.ts.map +1 -1
  104. package/dist/integrations/jira/integration.js +18 -4
  105. package/dist/integrations/jira/integration.js.map +1 -1
  106. package/dist/integrations/jira/issue-reconciler.js +1 -2
  107. package/dist/integrations/jira/reconciliation-config.js +1 -2
  108. package/dist/integrations/jira/routes.js +1 -2
  109. package/dist/integrations/jira/rules.js +1 -2
  110. package/dist/integrations/linear/agent-tools.d.ts +1 -1
  111. package/dist/integrations/linear/agent-tools.d.ts.map +1 -1
  112. package/dist/integrations/linear/agent-tools.js +5 -5
  113. package/dist/integrations/linear/agent-tools.js.map +1 -1
  114. package/dist/integrations/linear/claim.js +1 -2
  115. package/dist/integrations/linear/default-rules.js +1 -2
  116. package/dist/integrations/linear/integration.d.ts +2 -0
  117. package/dist/integrations/linear/integration.d.ts.map +1 -1
  118. package/dist/integrations/linear/integration.js +2 -2
  119. package/dist/integrations/linear/integration.js.map +1 -1
  120. package/dist/integrations/linear/issue-reconciler.js +1 -2
  121. package/dist/integrations/linear/reconciliation-config.js +1 -2
  122. package/dist/integrations/linear/routes.js +1 -2
  123. package/dist/integrations/linear/rules.js +1 -2
  124. package/dist/integrations/platform/api-client.js +1 -2
  125. package/dist/integrations/platform/connect/routes.js +1 -2
  126. package/dist/integrations/platform/github/event-worker.js +6 -2
  127. package/dist/integrations/platform/github/event-worker.js.map +1 -1
  128. package/dist/integrations/platform/github/integration.js +1 -2
  129. package/dist/integrations/platform/gitlab/event-worker.js +1 -2
  130. package/dist/integrations/platform/gitlab/integration.js +1 -2
  131. package/dist/integrations/platform/incidentio/integration.js +1 -2
  132. package/dist/integrations/platform/jira/agent-tools.js +1 -2
  133. package/dist/integrations/platform/jira/integration.js +1 -2
  134. package/dist/integrations/platform/jira/routes.js +1 -2
  135. package/dist/integrations/platform/linear/event-worker.js +1 -2
  136. package/dist/integrations/platform/linear/integration.d.ts.map +1 -1
  137. package/dist/integrations/platform/linear/integration.js +2 -2
  138. package/dist/integrations/platform/linear/integration.js.map +1 -1
  139. package/dist/integrations/pull-request-head.d.ts +1 -0
  140. package/dist/integrations/pull-request-head.d.ts.map +1 -1
  141. package/dist/integrations/pull-request-head.js +3 -3
  142. package/dist/integrations/pull-request-head.js.map +1 -1
  143. package/dist/integrations/reconciliation-config.js +1 -2
  144. package/dist/integrations/slack/channel-reply-processor.d.ts +1 -0
  145. package/dist/integrations/slack/channel-reply-processor.d.ts.map +1 -1
  146. package/dist/integrations/slack/channel-reply-processor.js +16 -6
  147. package/dist/integrations/slack/channel-reply-processor.js.map +1 -1
  148. package/dist/integrations/slack/channel-session-link-processor.d.ts +1 -0
  149. package/dist/integrations/slack/channel-session-link-processor.d.ts.map +1 -1
  150. package/dist/integrations/slack/channel-session-link-processor.js +2 -3
  151. package/dist/integrations/slack/channel-session-link-processor.js.map +1 -1
  152. package/dist/integrations/slack/connect-route.js +1 -2
  153. package/dist/integrations/slack/emoji-shortcodes.generated.js +1 -2
  154. package/dist/integrations/slack/emoji.js +1 -2
  155. package/dist/integrations/slack/feed-publisher.js +1 -2
  156. package/dist/integrations/slack/integration.d.ts +5 -0
  157. package/dist/integrations/slack/integration.d.ts.map +1 -1
  158. package/dist/integrations/slack/integration.js +13 -2
  159. package/dist/integrations/slack/integration.js.map +1 -1
  160. package/dist/integrations/slack/reply-reminder-processor.js +1 -2
  161. package/dist/integrations/slack/reply-tool.d.ts.map +1 -1
  162. package/dist/integrations/slack/reply-tool.js +4 -13
  163. package/dist/integrations/slack/reply-tool.js.map +1 -1
  164. package/dist/integrations/slack/run-error-card.d.ts +3 -0
  165. package/dist/integrations/slack/run-error-card.d.ts.map +1 -0
  166. package/dist/integrations/slack/run-error-card.js +44 -0
  167. package/dist/integrations/slack/run-error-card.js.map +1 -0
  168. package/dist/integrations/slack/share-file-tool.js +1 -2
  169. package/dist/integrations/slack/slack.d.ts.map +1 -1
  170. package/dist/integrations/slack/slack.js +7 -4
  171. package/dist/integrations/slack/slack.js.map +1 -1
  172. package/dist/integrations/subscription-session.js +1 -2
  173. package/dist/integrations/workos/integration.js +1 -2
  174. package/dist/mcp/disconnect.js +1 -2
  175. package/dist/mcp/events.js +2 -3
  176. package/dist/mcp/routes.js +1 -2
  177. package/dist/packages/_internals/workspace/dist/index.js +1 -2
  178. package/dist/packages/_internals/workspace/dist/index.js.map +1 -1
  179. package/dist/platform-auth-host.js +1 -2
  180. package/dist/provider-display-name.js +1 -2
  181. package/dist/review-verdict.d.ts +1 -0
  182. package/dist/review-verdict.d.ts.map +1 -1
  183. package/dist/review-verdict.js +9 -3
  184. package/dist/review-verdict.js.map +1 -1
  185. package/dist/routes/attention-activity.js +1 -2
  186. package/dist/routes/attention-parked.js +1 -2
  187. package/dist/routes/attention-proposed.js +1 -2
  188. package/dist/routes/attention-providers.js +1 -2
  189. package/dist/routes/attention.js +1 -2
  190. package/dist/routes/automation-runs.js +1 -2
  191. package/dist/routes/config.d.ts +7 -0
  192. package/dist/routes/config.d.ts.map +1 -1
  193. package/dist/routes/config.js +29 -3
  194. package/dist/routes/config.js.map +1 -1
  195. package/dist/routes/contracts.js +1 -2
  196. package/dist/routes/custom-provider-source.js +1 -2
  197. package/dist/routes/fs.js +1 -2
  198. package/dist/routes/intake.js +6 -4
  199. package/dist/routes/intake.js.map +1 -1
  200. package/dist/routes/knowledge.js +1 -2
  201. package/dist/routes/oauth.js +1 -2
  202. package/dist/routes/projects.js +1 -2
  203. package/dist/routes/provider-credentials.js +1 -2
  204. package/dist/routes/route.js +1 -2
  205. package/dist/routes/session-access.js +1 -2
  206. package/dist/routes/skills.js +1 -2
  207. package/dist/routes/source-control-sessions.js +5 -6
  208. package/dist/routes/source-control-settings.js +1 -2
  209. package/dist/routes/surface.js +3 -4
  210. package/dist/routes/surface.js.map +1 -1
  211. package/dist/routes/telemetry.js +1 -2
  212. package/dist/routes/tenant-credentials.js +1 -2
  213. package/dist/routes/work-items.js +2 -3
  214. package/dist/rules/binding-context.js +1 -2
  215. package/dist/rules/decision-applicability.js +1 -2
  216. package/dist/rules/dispatch-errors.js +1 -2
  217. package/dist/rules/dispatcher.d.ts.map +1 -1
  218. package/dist/rules/dispatcher.js +9 -3
  219. package/dist/rules/dispatcher.js.map +1 -1
  220. package/dist/rules/event-rules.js +1 -2
  221. package/dist/rules/processor.js +1 -2
  222. package/dist/rules/resolve.js +1 -2
  223. package/dist/rules/review-source-tool.js +1 -2
  224. package/dist/rules/start-coordinator.js +1 -2
  225. package/dist/rules/terminal-cleanup.js +1 -2
  226. package/dist/rules/tools.js +1 -2
  227. package/dist/rules/transition-service.js +1 -2
  228. package/dist/rules/types.d.ts +4 -1
  229. package/dist/rules/types.d.ts.map +1 -1
  230. package/dist/rules/types.js +1 -2
  231. package/dist/rules/types.js.map +1 -1
  232. package/dist/rules/validation.js +1 -2
  233. package/dist/run-error.d.ts +13 -0
  234. package/dist/run-error.d.ts.map +1 -0
  235. package/dist/run-error.js +81 -0
  236. package/dist/run-error.js.map +1 -0
  237. package/dist/sandbox/callback-factory-sandbox.js +1 -2
  238. package/dist/sandbox/git-ref.js +1 -2
  239. package/dist/sandbox/local-factory-sandbox.d.ts +12 -4
  240. package/dist/sandbox/local-factory-sandbox.d.ts.map +1 -1
  241. package/dist/sandbox/local-factory-sandbox.js +32 -7
  242. package/dist/sandbox/local-factory-sandbox.js.map +1 -1
  243. package/dist/sandbox/materialization.js +1 -2
  244. package/dist/sandbox/session-retirement.js +1 -2
  245. package/dist/sandbox/session-sandbox.js +1 -2
  246. package/dist/sandbox/workdir.js +1 -2
  247. package/dist/secret-encryption.js +1 -2
  248. package/dist/server-error.js +1 -2
  249. package/dist/session/credential-policy.js +1 -2
  250. package/dist/session/default-model-hydration.js +1 -2
  251. package/dist/session/environment-repositories.js +1 -2
  252. package/dist/session/environment-state-processor.d.ts +0 -1
  253. package/dist/session/environment-state-processor.d.ts.map +1 -1
  254. package/dist/session/environment-state-processor.js +2 -3
  255. package/dist/session/environment-state-processor.js.map +1 -1
  256. package/dist/session/factory-session.js +1 -2
  257. package/dist/session/filesystem-capture.js +2 -3
  258. package/dist/session/filesystem-capture.js.map +1 -1
  259. package/dist/session/first-exec-capture.js +2 -3
  260. package/dist/session/first-exec-capture.js.map +1 -1
  261. package/dist/session/first-message-capture.js +1 -2
  262. package/dist/session/live-sessions.js +1 -2
  263. package/dist/session/memory-settings-hydration.js +1 -2
  264. package/dist/session/org-seed.js +1 -2
  265. package/dist/session/reply-credential-processor.js +1 -2
  266. package/dist/session/resource-migration.js +1 -2
  267. package/dist/session/run-audit.js +1 -2
  268. package/dist/session/session-threads.js +1 -2
  269. package/dist/session/session-title.js +1 -2
  270. package/dist/session/shell-commands.js +1 -2
  271. package/dist/session/source-control-tools.js +2 -3
  272. package/dist/session/thinking-default.d.ts +1 -1
  273. package/dist/session/thinking-default.d.ts.map +1 -1
  274. package/dist/session/thinking-default.js +11 -13
  275. package/dist/session/thinking-default.js.map +1 -1
  276. package/dist/session/thread-session-stamp.js +1 -2
  277. package/dist/session/thread-title-mirror.js +1 -2
  278. package/dist/session/thread-title-mirror.js.map +1 -1
  279. package/dist/session/work-item-repository.js +1 -2
  280. package/dist/session-owner-signal.js +1 -2
  281. package/dist/skills/catalog.js +1 -2
  282. package/dist/skills/service.js +1 -2
  283. package/dist/spa-static.js +1 -2
  284. package/dist/state-signing.js +1 -2
  285. package/dist/storage/domains/audit/actions.js +1 -2
  286. package/dist/storage/domains/audit/actors.js +1 -2
  287. package/dist/storage/domains/audit/agent-audit.js +1 -2
  288. package/dist/storage/domains/audit/base.js +1 -2
  289. package/dist/storage/domains/audit/domain.js +1 -2
  290. package/dist/storage/domains/audit/wire.js +1 -2
  291. package/dist/storage/domains/channel-identity/base.js +1 -2
  292. package/dist/storage/domains/comments/activity.js +1 -2
  293. package/dist/storage/domains/comments/actor.js +1 -2
  294. package/dist/storage/domains/comments/base.js +1 -2
  295. package/dist/storage/domains/comments/domain.js +1 -2
  296. package/dist/storage/domains/comments/feed-context.js +1 -2
  297. package/dist/storage/domains/comments/parse.js +1 -2
  298. package/dist/storage/domains/comments/routes.js +1 -2
  299. package/dist/storage/domains/comments/schema.js +1 -2
  300. package/dist/storage/domains/comments/wire.js +1 -2
  301. package/dist/storage/domains/credentials/base.d.ts +4 -1
  302. package/dist/storage/domains/credentials/base.d.ts.map +1 -1
  303. package/dist/storage/domains/credentials/base.js +40 -44
  304. package/dist/storage/domains/credentials/base.js.map +1 -1
  305. package/dist/storage/domains/custom-providers/base.js +1 -2
  306. package/dist/storage/domains/filesystem/base.js +1 -2
  307. package/dist/storage/domains/intake/base.d.ts +5 -0
  308. package/dist/storage/domains/intake/base.d.ts.map +1 -1
  309. package/dist/storage/domains/intake/base.js +10 -2
  310. package/dist/storage/domains/intake/base.js.map +1 -1
  311. package/dist/storage/domains/integrations/base.js +1 -2
  312. package/dist/storage/domains/memory-settings/base.js +1 -2
  313. package/dist/storage/domains/model-defaults/base.js +1 -2
  314. package/dist/storage/domains/projects/base.d.ts +0 -1
  315. package/dist/storage/domains/projects/base.d.ts.map +1 -1
  316. package/dist/storage/domains/projects/base.js +5 -6
  317. package/dist/storage/domains/projects/base.js.map +1 -1
  318. package/dist/storage/domains/queue-health/base.js +1 -2
  319. package/dist/storage/domains/source-control/base.js +1 -2
  320. package/dist/storage/domains/source-control/inmemory.js +1 -2
  321. package/dist/storage/domains/work-items/base.js +1 -2
  322. package/dist/storage/domains/work-items/board-version.js +1 -2
  323. package/dist/storage/domains/work-items/metrics.js +1 -2
  324. package/dist/telemetry-types.js +1 -2
  325. package/dist/telemetry.js +1 -2
  326. package/dist/timing.js +1 -2
  327. package/dist/tools/annotations.js +1 -2
  328. package/dist/tools/approval-tools.js +1 -2
  329. package/dist/tools/deliver.js +2 -3
  330. package/dist/tools/index.js +1 -2
  331. package/dist/tools/messaging-tools.js +1 -2
  332. package/dist/tools/permissions.js +1 -2
  333. package/dist/tools/read-tools.js +1 -2
  334. package/dist/tools/reports.js +1 -2
  335. package/dist/tools/run-watch.d.ts +0 -2
  336. package/dist/tools/run-watch.d.ts.map +1 -1
  337. package/dist/tools/run-watch.js +4 -44
  338. package/dist/tools/run-watch.js.map +1 -1
  339. package/dist/tools/sandbox-tools.js +1 -2
  340. package/dist/tools/scope.js +2 -3
  341. package/dist/tools/session-tools.js +1 -2
  342. package/dist/tools/sessions-state-processor.js +1 -2
  343. package/dist/tools/side-sessions.js +1 -2
  344. package/dist/tools/work-item-tools.js +1 -2
  345. package/dist/work-item-branch.js +1 -2
  346. package/dist/work-item-branch.js.map +1 -1
  347. package/dist/work-items/create-work-item.js +1 -2
  348. package/dist/work-items/decision-actions.js +1 -2
  349. package/dist/workspace.d.ts.map +1 -1
  350. package/dist/workspace.js +1 -3
  351. package/dist/workspace.js.map +1 -1
  352. package/factory-skills/factory-gitlab-review/SKILL.md +1 -1
  353. package/factory-skills/factory-plan/SKILL.md +1 -1
  354. package/factory-skills/factory-rereview/SKILL.md +14 -3
  355. package/factory-skills/factory-review/SKILL.md +14 -3
  356. package/factory-skills/factory-self-review/SKILL.md +1 -1
  357. package/factory-skills/factory-triage/SKILL.md +52 -29
  358. package/package.json +19 -17
package/README.md CHANGED
@@ -535,7 +535,7 @@ A decision _without_ the flag that reaches a card which already exists keeps the
535
535
 
536
536
  Reconciliation re-applies label-derived placement. The issue sweep replays an open issue through the rules ingress whenever the issue's live labels differ from the card's stored ones — the `labeled`/`unlabeled` webhook may never have arrived (Factory was down, or the label was applied by something else). The deployment rule decides placement, exactly as at arrival, and the context carries the existing card on `item`, so one handler answers for both: a card still resting on the board's initial phase is landed the normal way, and a card that has already left it is re-placed with `skipRules` and no phase rule run. Cards parked by hand are untouched while an issue's labels are unchanged.
537
537
 
538
- A delivery that concerns two cards is evaluated once per card, each under its own ingress identity: every decision is committed against one card, at that card's revision. A merged pull request is the standard case — its Review card closes and the Work item that wrote the code assesses whether it is finished. An opening pull request is evaluated the same way. Its own Review card is filed by the arrival, the evaluation flagged `pullRequestIntake`, which is committed against the Work item that authored the pull request when provenance or a matching session branch names one; that binding is what links the new card to its item. The authoring item is then answered in a second evaluation of its own (`pullRequestIntake` unset), which is where a handler places the item that is now out for review. The built-in `pullRequestOpened` files the card only on the arrival and returns nothing for the authoring item.
538
+ A delivery that concerns two cards is evaluated once per card, each under its own ingress identity: every decision is committed against one card, at that card's revision. A merged pull request is the standard case — its Review card closes, and the built-in `pullRequestMerged` rule moves the Work item that wrote the code to Done. If that Work item has another pull request open, it stays where it is and its session is told which pull request is still out. An opening pull request is evaluated the same way. Its own Review card is filed by the arrival, the evaluation flagged `pullRequestIntake`, which is committed against the Work item that authored the pull request when provenance or a matching session branch names one; that binding is what links the new card to its item. The authoring item is then answered in a second evaluation of its own (`pullRequestIntake` unset), which is where a handler places the item that is now out for review. The built-in `pullRequestOpened` files the card only on the arrival and returns nothing for the authoring item.
539
539
 
540
540
  ### GitHub CLI authentication in Factory sessions
541
541
 
@@ -563,6 +563,8 @@ With no constructor options, the integration reads `GITLAB_ACCESS_TOKEN`, `GITLA
563
563
 
564
564
  `GITLAB_BASE_URL` must use HTTPS. Plain HTTP is accepted only for loopback development instances (`localhost`, `127.0.0.0/8`, or `::1`), where the access token is sent without transport encryption.
565
565
 
566
+ Linking a GitLab repository imports its open issues and merge requests (up to five pages each). Without a webhook, later items are discovered when their lists are requested, and changed merge-request heads are recorded when the merge-request list is requested. Existing cards can still be reconciled. For ongoing issue changes, comments, and merge-request lifecycle events, configure the direct project webhook with `GITLAB_WEBHOOK_SECRET`.
567
+
566
568
  For a Mastra Platform/Nango connection, use `PlatformGitLabIntegration`. `MastraFactory` installs it automatically whenever Platform credentials are configured and no integration with id `gitlab` was supplied. It discovers every active connection of the organization on the Platform's `gitlab` (OAuth) integration, proxies provider requests through `/v2/connections/{connectionId}/proxy`, and polls the Platform event log for GitLab events. `MASTRA_GITLAB_CONNECTION_ID` (or the `connectionId` constructor option) is optional and only narrows discovery to one connection. An explicit integration with id `gitlab` takes precedence.
567
569
 
568
570
  ```typescript
package/dist/auth.js CHANGED
@@ -6,7 +6,7 @@ import { MastraAuthWorkos } from "@mastra/auth-workos";
6
6
  import { MASTRA_MESSAGE_AUTHOR_KEY } from "@mastra/core/request-context";
7
7
  import { isAuthHttpHandler, isCredentialsProvider, isOrganizationsProvider, isSSOProvider, isSessionProvider, registerApiRoute } from "@mastra/core/server";
8
8
  import { HTTPException } from "hono/http-exception";
9
- //#region src/auth.ts
9
+ // src/auth.ts
10
10
  const ORGANIZATION_ID_HEADER = "X-Mastra-Organization-Id";
11
11
  /**
12
12
  * Validate that a `returnTo` value is a safe same-site path, to prevent
@@ -667,7 +667,6 @@ function mountFactoryAuth(app, options = {}) {
667
667
  app.use("*", createFactoryAuthGate(provider));
668
668
  return true;
669
669
  }
670
- //#endregion
671
670
  export { FACTORY_INTERACTIVE_KEY, bearerTokenOrgClaim, buildAuthDisabledRoutes, buildAuthRoutes, createFactoryAuthGate, createFactoryInteractiveMarker, createFactoryRouteAuth, ensureFactoryAuthUser, factoryAuthTenant, factoryUserOrgId, getBearerToken, getFactoryAuthOrgId, getFactoryAuthUser, getFactoryAuthUserFromContext, getFactoryAuthUserId, getWorkOSProvider, isCrossSiteAuth, isOrganizationAdmin, isWorkOSAuth, mountFactoryAuth, registerAuthRoutes, sanitizeReturnTo };
672
671
 
673
672
  //# sourceMappingURL=auth.js.map
@@ -1,6 +1,6 @@
1
1
  import { FACTORY_GITHUB_EVENTS, FACTORY_GITLAB_EVENTS, FACTORY_INCIDENTIO_EVENTS, FACTORY_JIRA_EVENTS, FACTORY_LINEAR_EVENTS } from "../rules/types.js";
2
2
  import { IDENTIFIER_RE, isBoardIdentifier } from "../rules/validation.js";
3
- //#region src/boards/define-board.ts
3
+ // src/boards/define-board.ts
4
4
  const BOARD_EVENT_NAMES = {
5
5
  github: FACTORY_GITHUB_EVENTS,
6
6
  gitlab: FACTORY_GITLAB_EVENTS,
@@ -150,7 +150,6 @@ function defineBoard(config) {
150
150
  phaseForRole: (role) => phaseByRole.get(role)
151
151
  });
152
152
  }
153
- //#endregion
154
153
  export { BoardDefinitionError, defineBoard };
155
154
 
156
155
  //# sourceMappingURL=define-board.js.map
@@ -3,7 +3,7 @@ import { boardEventHandlers, boardForWorkItem, eventBoardId, isTerminalWorkItem,
3
3
  import { isReviewBoardPhase, reviewBoard } from "./review.js";
4
4
  import { isWorkBoardPhase, workBoard } from "./work.js";
5
5
  import { createBoardRegistry, defaultBoards } from "./registry.js";
6
- //#region src/boards/index.ts
6
+ // src/boards/index.ts
7
7
  const builtInBoards = {
8
8
  work: workBoard,
9
9
  review: reviewBoard
@@ -15,7 +15,6 @@ function allowsBuiltInBoardTransition(board, from, to) {
15
15
  if (board === "work") return isWorkBoardPhase(from) && isWorkBoardPhase(to) && workBoard.allowsTransition(from, to);
16
16
  return isReviewBoardPhase(from) && isReviewBoardPhase(to) && reviewBoard.allowsTransition(from, to);
17
17
  }
18
- //#endregion
19
18
  export { BoardDefinitionError, allowsBuiltInBoardTransition, boardEventHandlers, boardForWorkItem, builtInBoard, createBoardRegistry, defaultBoards, defineBoard, eventBoardId, isTerminalWorkItem, resolveBoardClosure, resolveBoardToolRule, resolvePhaseSemantics, reviewBoard, rulePhaseContext, rulePhaseField, withBoardClosure, workBoard, workItemPhaseSemantics };
20
19
 
21
20
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  import { reviewBoard } from "./review.js";
2
2
  import { workBoard } from "./work.js";
3
- //#region src/boards/registry.ts
3
+ // src/boards/registry.ts
4
4
  const defaultBoards = Object.freeze([workBoard, reviewBoard]);
5
5
  function createBoardRegistry(options = {}) {
6
6
  const installed = options.includeDefaultBoards === false ? [] : defaultBoards;
@@ -19,7 +19,6 @@ function createBoardRegistry(options = {}) {
19
19
  [Symbol.iterator]: registry[Symbol.iterator].bind(registry)
20
20
  });
21
21
  }
22
- //#endregion
23
22
  export { createBoardRegistry, defaultBoards };
24
23
 
25
24
  //# sourceMappingURL=registry.js.map
@@ -1,5 +1,5 @@
1
1
  import { WorkItemUpdateConflictError } from "../storage/domains/work-items/base.js";
2
- //#region src/boards/relocate.ts
2
+ // src/boards/relocate.ts
3
3
  /** Rows that predate persisted boards used source-type routing. */
4
4
  function effectiveBoard(item) {
5
5
  return item.board ?? (item.externalSource?.type === "pull-request" ? "review" : "work");
@@ -52,7 +52,6 @@ function cardLabels(item) {
52
52
  const labels = item.metadata?.labels;
53
53
  return Array.isArray(labels) ? labels.filter((label) => typeof label === "string") : [];
54
54
  }
55
- //#endregion
56
55
  export { cardLabels, effectiveBoard, moveCardToBoard };
57
56
 
58
57
  //# sourceMappingURL=relocate.js.map
@@ -1,6 +1,6 @@
1
1
  import { defineBoard } from "./define-board.js";
2
2
  import { legacyGithubWorkItemBranch, workItemBranch, workItemNumber } from "../work-item-branch.js";
3
- //#region src/boards/review.ts
3
+ // src/boards/review.ts
4
4
  function sourceRef(item) {
5
5
  const link = item.url ? ` (${item.url})` : "";
6
6
  const number = workItemNumber(item);
@@ -119,7 +119,6 @@ const reviewBoard = defineBoard({
119
119
  function isReviewBoardPhase(value) {
120
120
  return value in reviewBoard.phases;
121
121
  }
122
- //#endregion
123
122
  export { hasRecordedVerdict, isReviewBoardPhase, reviewBoard };
124
123
 
125
124
  //# sourceMappingURL=review.js.map
@@ -1,4 +1,4 @@
1
- //#region src/boards/semantics.ts
1
+ // src/boards/semantics.ts
2
2
  /**
3
3
  * Board that owns a work item. Rows created before boards were persisted carry no `board`;
4
4
  * they belong to Review when they track a pull request and to Work otherwise, matching the
@@ -113,7 +113,6 @@ function rulePhaseField(boards, item) {
113
113
  const phase = rulePhaseContext(boards, item);
114
114
  return phase ? { phase } : {};
115
115
  }
116
- //#endregion
117
116
  export { boardEventHandlers, boardForWorkItem, eventBoardId, isTerminalWorkItem, resolveBoardClosure, resolveBoardToolRule, resolvePhaseSemantics, rulePhaseContext, rulePhaseField, withBoardClosure, workItemPhaseSemantics };
118
117
 
119
118
  //# sourceMappingURL=semantics.js.map
@@ -1,6 +1,6 @@
1
1
  import { FACTORY_TRIAGE_TYPES } from "../rules/types.js";
2
2
  import { z } from "zod";
3
- //#region src/boards/transition-policy.ts
3
+ // src/boards/transition-policy.ts
4
4
  function immutablePolicySnapshot(value) {
5
5
  if (value instanceof Date) return value.toISOString();
6
6
  if (Array.isArray(value)) return Object.freeze(value.map((entry) => immutablePolicySnapshot(entry)));
@@ -30,7 +30,6 @@ const boardTransitionPolicyResultSchema = z.union([z.undefined(), z.discriminate
30
30
  ]),
31
31
  reason: z.string().trim().min(1).max(512)
32
32
  }).strict()])]);
33
- //#endregion
34
33
  export { boardTransitionPolicyResultSchema, immutablePolicySnapshot };
35
34
 
36
35
  //# sourceMappingURL=transition-policy.js.map
@@ -1,4 +1,4 @@
1
- //#region src/boards/work-tool-rules.ts
1
+ // src/boards/work-tool-rules.ts
2
2
  function resultContent(value) {
3
3
  if (typeof value === "string") return value;
4
4
  if (!value || typeof value !== "object" || Array.isArray(value)) return;
@@ -14,7 +14,6 @@ function advanceApprovedPlan(context) {
14
14
  stage: "execute"
15
15
  };
16
16
  }
17
- //#endregion
18
17
  export { advanceApprovedPlan };
19
18
 
20
19
  //# sourceMappingURL=work-tool-rules.js.map
@@ -1,4 +1,4 @@
1
- //#region src/boards/work-transition-policy.ts
1
+ // src/boards/work-transition-policy.ts
2
2
  const workTransitionPolicy = (context) => {
3
3
  const { item, requestedTriageType, actor, fromStage, toStage, isHumanTransition, plansAutoApproved, planApproved } = context;
4
4
  const triageAgent = actor.type === "agent" && actor.role === "triage";
@@ -51,7 +51,6 @@ const workTransitionPolicy = (context) => {
51
51
  ...isHumanTransition && entersWork && !item.acceptedAt ? { accept: true } : {}
52
52
  };
53
53
  };
54
- //#endregion
55
54
  export { workTransitionPolicy };
56
55
 
57
56
  //# sourceMappingURL=work-transition-policy.js.map
@@ -3,7 +3,7 @@ import { defineBoard } from "./define-board.js";
3
3
  import { workItemNumber } from "../work-item-branch.js";
4
4
  import { advanceApprovedPlan } from "./work-tool-rules.js";
5
5
  import { workTransitionPolicy } from "./work-transition-policy.js";
6
- //#region src/boards/work.ts
6
+ // src/boards/work.ts
7
7
  function sourceIdentifier(item) {
8
8
  const identifier = item.metadata?.identifier;
9
9
  return typeof identifier === "string" ? identifier : void 0;
@@ -279,7 +279,6 @@ const workBoard = defineBoard({
279
279
  function isWorkBoardPhase(value) {
280
280
  return Object.prototype.hasOwnProperty.call(workBoard.phases, value);
281
281
  }
282
- //#endregion
283
282
  export { SELF_REVIEW_ROUND_LIMIT, isWorkBoardPhase, openApprovedChangeRequest, selfReviewRounds, workBoard };
284
283
 
285
284
  //# sourceMappingURL=work.js.map
@@ -0,0 +1,3 @@
1
+ import type { ThinkingLevelSetting } from '@mastra/code-sdk/thinking';
2
+ export declare const DEFAULT_THINKING_LEVEL: ThinkingLevelSetting;
3
+ //# sourceMappingURL=default-thinking-level.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-thinking-level.d.ts","sourceRoot":"","sources":["../src/default-thinking-level.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,eAAO,MAAM,sBAAsB,EAAE,oBAA+B,CAAC"}
@@ -0,0 +1,5 @@
1
+ // src/default-thinking-level.ts
2
+ const DEFAULT_THINKING_LEVEL = "medium";
3
+ export { DEFAULT_THINKING_LEVEL };
4
+
5
+ //# sourceMappingURL=default-thinking-level.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-thinking-level.js","names":[],"sources":["../src/default-thinking-level.ts"],"sourcesContent":["import type { ThinkingLevelSetting } from '@mastra/code-sdk/thinking';\n\nexport const DEFAULT_THINKING_LEVEL: ThinkingLevelSetting = 'medium';\n"],"mappings":";AAEA,MAAa,yBAA+C"}
@@ -2,7 +2,7 @@ import { environmentBuildContext, errorReason, resolveEnvironmentHeads } from ".
2
2
  import { resolveProjectEnvironment } from "../workspace.js";
3
3
  import { ENVIRONMENT_BUILD_WORKFLOW_ID, createEnvironmentBuildWorkflow } from "./build-workflow.js";
4
4
  import { probeSchedulesAvailable } from "./build-schedule.js";
5
- //#region src/environment/build-runner.ts
5
+ // src/environment/build-runner.ts
6
6
  var EnvironmentBuildRunner = class {
7
7
  workflow;
8
8
  #deps;
@@ -126,7 +126,6 @@ var EnvironmentBuildRunner = class {
126
126
  return outcome;
127
127
  };
128
128
  };
129
- //#endregion
130
129
  export { EnvironmentBuildRunner };
131
130
 
132
131
  //# sourceMappingURL=build-runner.js.map
@@ -1,6 +1,6 @@
1
1
  import { ENVIRONMENT_BUILD_WORKFLOW_ID } from "./build-workflow.js";
2
2
  import { validateCron } from "@mastra/core/workflows";
3
- //#region src/environment/build-schedule.ts
3
+ // src/environment/build-schedule.ts
4
4
  const SCHEDULES_UNAVAILABLE_ERROR_ID = "SCHEDULES_NO_SCHEDULES_STORAGE";
5
5
  /**
6
6
  * The project's schedule id in its stored form. Core normalizes a created
@@ -88,7 +88,6 @@ async function ensureSchedule(schedules, projectId, input) {
88
88
  if (!input.enabled && next.status === "active") next = await schedules.pause(current.id);
89
89
  return toView(isWorkflowSchedule(next) ? next : null);
90
90
  }
91
- //#endregion
92
91
  export { SCHEDULES_UNAVAILABLE_ERROR_ID, ensureSchedule, invalidCronMessage, probeSchedulesAvailable, readSchedule, scheduleIdFor };
93
92
 
94
93
  //# sourceMappingURL=build-schedule.js.map
@@ -2,7 +2,7 @@ import { ENVIRONMENT_BUILD_TRIGGERS, environmentBuildContext, errorReason, redac
2
2
  import { resolveProjectEnvironment } from "../workspace.js";
3
3
  import { createStep, createWorkflow } from "@mastra/core/workflows";
4
4
  import { z } from "zod";
5
- //#region src/environment/build-workflow.ts
5
+ // src/environment/build-workflow.ts
6
6
  /**
7
7
  * The `factory-environment-build` workflow: step one decides and starts a
8
8
  * build (`runEnvironmentBuild`), step two polls the provider until the build
@@ -143,7 +143,6 @@ function createEnvironmentBuildWorkflow(deps, options = {}) {
143
143
  outputSchema: environmentBuildOutputSchema
144
144
  }).then(start).then(awaitBuild).commit();
145
145
  }
146
- //#endregion
147
146
  export { DEFAULT_BUILD_POLL_MS, ENVIRONMENT_BUILD_WORKFLOW_ID, MAX_BUILD_WAIT_MS, createEnvironmentBuildWorkflow, environmentBuildInputSchema, environmentBuildOutputSchema };
148
147
 
149
148
  //# sourceMappingURL=build-workflow.js.map
@@ -1,7 +1,7 @@
1
1
  import { headsChanged, recordedHeadResolver, resolveCurrentHeads } from "./heads.js";
2
2
  import { environmentSandboxContext, resolveProjectEnvironment } from "../workspace.js";
3
3
  import { createHash, randomUUID } from "crypto";
4
- //#region src/environment/build.ts
4
+ // src/environment/build.ts
5
5
  /**
6
6
  * One proactive environment build: decide whether a trigger should build,
7
7
  * hand the sandbox's `builds` capability a context identical to a session's,
@@ -340,7 +340,6 @@ async function runEnvironmentBuild(deps, input) {
340
340
  clearInterval(renewal);
341
341
  }
342
342
  }
343
- //#endregion
344
343
  export { BUILD_START_LEASE_MS, ENVIRONMENT_BUILD_TRIGGERS, environmentBuildContext, environmentBuildInputs, environmentBuildSessionId, errorReason, redactCredentials, resolveEnvironmentHeads, runEnvironmentBuild };
345
344
 
346
345
  //# sourceMappingURL=build.js.map
@@ -1,5 +1,5 @@
1
1
  import { getBranchHead } from "../integrations/github/commits.js";
2
- //#region src/environment/heads.ts
2
+ // src/environment/heads.ts
3
3
  /** `owner/repo` from a clone URL in any common spelling, lower-cased, `.git` stripped; undefined when unparseable. */
4
4
  function cloneUrlSlug(cloneUrl) {
5
5
  let path;
@@ -54,7 +54,6 @@ async function resolveCurrentHeads(github, input) {
54
54
  });
55
55
  return heads;
56
56
  }
57
- //#endregion
58
57
  export { cloneUrlSlug, headsChanged, matchEnvironmentSlug, recordedHeadResolver, resolveCurrentHeads };
59
58
 
60
59
  //# sourceMappingURL=heads.js.map
package/dist/factory.d.ts CHANGED
@@ -108,8 +108,10 @@ export interface MastraFactoryConfig {
108
108
  * `new PlatformFactorySandbox({ ... })`, which owns the session sandbox
109
109
  * constructor, the repo template and the schema of environment settings.
110
110
  * A bare callback is also accepted and wrapped as a `provider: 'custom'`
111
- * sandbox with no settings. Omitted → repository sandboxes are
112
- * disabled.
111
+ * sandbox with no settings. Omitted with Platform credentials → the factory
112
+ * installs a `LocalFactorySandbox` under `mastra dev` and a
113
+ * `PlatformFactorySandbox` in built deployments. Omitted without Platform
114
+ * credentials → repository sandboxes are disabled.
113
115
  */
114
116
  sandbox?: MastraFactorySandboxOption;
115
117
  /** Browser automation provider for Factory agent sessions. */
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":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;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAsB/B,iFAAiF;IAC3E,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAGhC"}
package/dist/factory.js CHANGED
@@ -19,25 +19,17 @@ import { recordFactoryPullRequestProvenance, resolveFactoryPullRequestParentWork
19
19
  import { dismissStaleFactoryReviews } from "./integrations/github/stale-reviews.js";
20
20
  import { PlatformApiClient, platformApiClientConfigFromEnv } from "./integrations/platform/api-client.js";
21
21
  import { buildPlatformConnectRoutes } from "./integrations/platform/connect/routes.js";
22
- import { createSessionAccessGuard } from "./routes/session-access.js";
23
- import { observeSessionFirstExec } from "./session/first-exec-capture.js";
24
- import { observeSessionFilesystem } from "./session/filesystem-capture.js";
25
- import { sessionMemoryResourceId, sessionStampCounts } from "./session/session-threads.js";
26
22
  import { createPlaintextFactorySecretEncryption } from "./secret-encryption.js";
27
23
  import { ModelCredentialsStorage } from "./storage/domains/credentials/base.js";
28
24
  import { tenantOrgId } from "./routes/provider-credentials.js";
29
25
  import { createTenantCredentialPrimer, primeTenantCredentials, registerTenantCredentialResolver } from "./routes/tenant-credentials.js";
30
26
  import { hasResolvedOrg } from "./session/org-seed.js";
31
27
  import { createSessionAsRowOwner, prepareSessionRunContext } from "./integrations/subscription-session.js";
32
- import { PlatformGithubIntegration } from "./integrations/platform/github/integration.js";
33
- import { PlatformGitLabIntegration } from "./integrations/platform/gitlab/integration.js";
34
- import { PlatformIncidentioIntegration } from "./integrations/platform/incidentio/integration.js";
35
- import { PlatformJiraIntegration } from "./integrations/platform/jira/integration.js";
36
- import { PlatformLinearIntegration } from "./integrations/platform/linear/integration.js";
37
28
  import { FactoryProjectsStorage } from "./storage/domains/projects/base.js";
38
29
  import { SourceControlStorage } from "./storage/domains/source-control/base.js";
39
30
  import { createSourceControlSessionLookup } from "./session/factory-session.js";
40
31
  import { AuditStorage } from "./storage/domains/audit/base.js";
32
+ import { sessionMemoryResourceId, sessionStampCounts } from "./session/session-threads.js";
41
33
  import { resolveFactoryToolScope } from "./tools/scope.js";
42
34
  import { deliverFactorySessionNotification } from "./tools/deliver.js";
43
35
  import { createSessionApprovalNotifier, createSessionRunEndReporter, createStageChangeNotifier, createWorkItemRunEndReporter } from "./tools/reports.js";
@@ -45,6 +37,9 @@ import { resolveFactoryCredentialTenant, resolveFactoryModelPolicy } from "./ses
45
37
  import { hydrateSessionMemorySettings } from "./session/memory-settings-hydration.js";
46
38
  import { MemorySettingsStorage, factoryMemorySettingsUserId } from "./storage/domains/memory-settings/base.js";
47
39
  import { resolveDeploymentModelProviders } from "./routes/config.js";
40
+ import { observeSessionFirstExec } from "./session/first-exec-capture.js";
41
+ import { observeSessionFilesystem } from "./session/filesystem-capture.js";
42
+ import { createSessionAccessGuard } from "./routes/session-access.js";
48
43
  import { observeSessionRunEnd } from "./session/run-audit.js";
49
44
  import { observeSessionRunReports } from "./tools/run-watch.js";
50
45
  import { applyFactoryToolPermissions } from "./tools/permissions.js";
@@ -65,6 +60,7 @@ import { createReviewSourceTool, resolveReviewSourceUiOrigin } from "./rules/rev
65
60
  import { createTerminalStageCleanup } from "./rules/terminal-cleanup.js";
66
61
  import { createFactoryTransitionTools } from "./rules/tools.js";
67
62
  import { CallbackFactorySandbox } from "./sandbox/callback-factory-sandbox.js";
63
+ import { LocalFactorySandbox } from "./sandbox/local-factory-sandbox.js";
68
64
  import { SessionRetirementCoordinator } from "./sandbox/session-retirement.js";
69
65
  import { handleServerError } from "./server-error.js";
70
66
  import { hydrateSessionDefaultModel } from "./session/default-model-hydration.js";
@@ -96,7 +92,7 @@ import { getDynamicMemory } from "@mastra/code-sdk/agents/memory";
96
92
  import { AgentControllerChannels } from "@mastra/core/channels";
97
93
  import { EventEmitterPubSub } from "@mastra/core/events";
98
94
  import { describeFactorySandbox, isFactorySandbox } from "@mastra/core/workspace";
99
- //#region src/factory.ts
95
+ // src/factory.ts
100
96
  /**
101
97
  * `MastraFactory` — the single entry point to the whole Mastra Software Factory.
102
98
  *
@@ -134,6 +130,24 @@ function hasPlatformCredentials() {
134
130
  return Boolean(process.env.MASTRA_PLATFORM_ACCESS_TOKEN?.trim() || process.env.MASTRA_PLATFORM_SECRET_KEY?.trim());
135
131
  }
136
132
  /**
133
+ * The sandbox the factory installs when the host passes none and Platform
134
+ * credentials are present: a local sandbox under `mastra dev` (or
135
+ * NODE_ENV=development), so development never boots remote machines, and
136
+ * a Platform sandbox in built deployments. Without credentials, sandboxes
137
+ * stay disabled.
138
+ */
139
+ async function platformDefaultSandbox() {
140
+ if (!hasPlatformCredentials()) return void 0;
141
+ if (process.env.MASTRA_DEV === "true" || process.env.NODE_ENV === "development") return new LocalFactorySandbox();
142
+ const missing = ["MASTRA_PROJECT_ID", "MASTRA_ENVIRONMENT_ID"].filter((key) => !process.env[key]?.trim());
143
+ if (missing.length > 0) {
144
+ console.warn(`MastraFactory: Platform credentials are set but ${missing.join(" and ")} ${missing.length > 1 ? "are" : "is"} missing, so no Platform sandbox was installed and repository sandboxes are disabled.`);
145
+ return;
146
+ }
147
+ const { PlatformFactorySandbox } = await import("@mastra/platform-workspace");
148
+ return new PlatformFactorySandbox();
149
+ }
150
+ /**
137
151
  * Default auth provider — `MastraAuthStudio`, which proxies identity to the
138
152
  * shared Mastra platform API and resolves its own env (`MASTRA_SHARED_API_URL`,
139
153
  * `MASTRA_ORGANIZATION_ID`, ...).
@@ -249,16 +263,29 @@ var MastraFactory = class {
249
263
  let installedPlatformGithub = false;
250
264
  if (hasPlatformCredentials()) {
251
265
  if (!explicitGithub) {
266
+ const { PlatformGithubIntegration } = await import("./integrations/platform/github/integration.js");
252
267
  integrations.push(new PlatformGithubIntegration({
253
268
  rules: this.#config.platform?.github?.rules,
254
269
  slug: this.#config.platform?.github?.slug ?? this.#config.platform?.githubAppSlug
255
270
  }));
256
271
  installedPlatformGithub = true;
257
272
  }
258
- if (!integrations.some((integration) => integration.id === "incidentio")) integrations.push(new PlatformIncidentioIntegration());
259
- if (!integrations.some((integration) => integration.id === "jira")) integrations.push(new PlatformJiraIntegration());
260
- if (!integrations.some((integration) => integration.id === "gitlab")) integrations.push(new PlatformGitLabIntegration());
261
- if (!integrations.some((integration) => integration.id === "linear")) integrations.push(new PlatformLinearIntegration());
273
+ if (!integrations.some((integration) => integration.id === "incidentio")) {
274
+ const { PlatformIncidentioIntegration } = await import("./integrations/platform/incidentio/integration.js");
275
+ integrations.push(new PlatformIncidentioIntegration());
276
+ }
277
+ if (!integrations.some((integration) => integration.id === "jira")) {
278
+ const { PlatformJiraIntegration } = await import("./integrations/platform/jira/integration.js");
279
+ integrations.push(new PlatformJiraIntegration());
280
+ }
281
+ if (!integrations.some((integration) => integration.id === "gitlab")) {
282
+ const { PlatformGitLabIntegration } = await import("./integrations/platform/gitlab/integration.js");
283
+ integrations.push(new PlatformGitLabIntegration());
284
+ }
285
+ if (!integrations.some((integration) => integration.id === "linear")) {
286
+ const { PlatformLinearIntegration } = await import("./integrations/platform/linear/integration.js");
287
+ integrations.push(new PlatformLinearIntegration());
288
+ }
262
289
  }
263
290
  if (this.#config.platform?.github && !installedPlatformGithub) console.warn("[factory] 'platform.github' config was provided but the factory installed no GitHub integration of its own " + (explicitGithub ? "(an explicit integration with id 'github' takes precedence, so these options were ignored)." : "(no Platform credentials are configured and no explicit GitHub integration was passed)."));
264
291
  const integrationIds = /* @__PURE__ */ new Set();
@@ -323,7 +350,8 @@ var MastraFactory = class {
323
350
  });
324
351
  const sandboxOption = this.#config.sandbox;
325
352
  let sandboxConfig;
326
- if (sandboxOption === void 0 || isFactorySandbox(sandboxOption)) sandboxConfig = sandboxOption;
353
+ if (sandboxOption === void 0) sandboxConfig = await platformDefaultSandbox();
354
+ else if (isFactorySandbox(sandboxOption)) sandboxConfig = sandboxOption;
327
355
  else if (typeof sandboxOption === "function") sandboxConfig = new CallbackFactorySandbox(sandboxOption);
328
356
  else throw new Error(invalidSandboxOptionMessage(sandboxOption));
329
357
  this.#sandbox = sandboxConfig;
@@ -619,11 +647,25 @@ var MastraFactory = class {
619
647
  });
620
648
  return repository ?? null;
621
649
  } } : {},
622
- ...typeof githubIntegration?.ingestLinkedRepositoryBacklog === "function" ? { onProjectRepositoryLinked: ({ orgId, projectRepository }) => {
623
- githubIntegration.ingestLinkedRepositoryBacklog({
624
- orgId,
625
- projectRepositoryId: projectRepository.id
626
- }).catch((error) => {
650
+ ...githubIntegration || gitlabIntegration ? { onProjectRepositoryLinked: ({ orgId, projectRepository }) => {
651
+ (async () => {
652
+ if (githubIntegration && await sourceControlStorage.forIntegration("github").projectRepositories.get({
653
+ orgId,
654
+ id: projectRepository.id
655
+ })) await githubIntegration.ingestLinkedRepositoryBacklog({
656
+ orgId,
657
+ projectRepositoryId: projectRepository.id
658
+ });
659
+ else if (gitlabIntegration) {
660
+ if (await sourceControlStorage.forIntegration("gitlab").projectRepositories.get({
661
+ orgId,
662
+ id: projectRepository.id
663
+ })) await gitlabIntegration.ingestLinkedRepositoryBacklog({
664
+ orgId,
665
+ projectRepositoryId: projectRepository.id
666
+ });
667
+ }
668
+ })().catch((error) => {
627
669
  console.warn("[factory] Failed to import a linked repository backlog:", error);
628
670
  });
629
671
  } } : {},
@@ -1300,7 +1342,6 @@ var MastraFactory = class {
1300
1342
  await this.#dispatcher?.stop();
1301
1343
  }
1302
1344
  };
1303
- //#endregion
1304
1345
  export { MastraFactory };
1305
1346
 
1306
1347
  //# sourceMappingURL=factory.js.map