@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
@@ -1,4 +1,4 @@
1
- //#region src/platform-auth-host.ts
1
+ // src/platform-auth-host.ts
2
2
  const PLATFORM_AUTH_PROVIDER = "mastra-studio";
3
3
  const CUSTOM_DOMAIN_UNSUPPORTED_ERROR = "custom_domain_unsupported";
4
4
  const PLATFORM_AUTH_DOMAINS = ["mastra.cloud", "mastra.ai"];
@@ -12,7 +12,6 @@ function isPlatformAuthSupportedHost(hostname) {
12
12
  if (LOOPBACK_HOSTS.has(normalizedHostname) || normalizedHostname.endsWith(".localhost")) return true;
13
13
  return PLATFORM_AUTH_DOMAINS.some((domain) => normalizedHostname === domain || normalizedHostname.endsWith(`.${domain}`));
14
14
  }
15
- //#endregion
16
15
  export { CUSTOM_DOMAIN_UNSUPPORTED_ERROR, PLATFORM_AUTH_PROVIDER, isPlatformAuthSupportedHost };
17
16
 
18
17
  //# sourceMappingURL=platform-auth-host.js.map
@@ -1,4 +1,4 @@
1
- //#region src/provider-display-name.ts
1
+ // src/provider-display-name.ts
2
2
  const PROVIDER_DISPLAY_NAMES = {
3
3
  anthropic: "Anthropic",
4
4
  "github-copilot": "GitHub Copilot",
@@ -10,7 +10,6 @@ const PROVIDER_DISPLAY_NAMES = {
10
10
  function providerDisplayName(provider) {
11
11
  return PROVIDER_DISPLAY_NAMES[provider] ?? provider.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
12
12
  }
13
- //#endregion
14
13
  export { providerDisplayName };
15
14
 
16
15
  //# sourceMappingURL=provider-display-name.js.map
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Normalizes the first non-empty line of a review body so its `Verdict:` line can be read
3
3
  * regardless of the markdown it is wrapped in (`**Verdict:** request changes`, `# Verdict: ...`).
4
+ * A leading proxy attribution line is skipped.
4
5
  */
5
6
  export declare function normalizedVerdictLine(body: string | undefined): string | undefined;
6
7
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"review-verdict.d.ts","sourceRoot":"","sources":["../src/review-verdict.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAUlF;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAOxE"}
1
+ {"version":3,"file":"review-verdict.d.ts","sourceRoot":"","sources":["../src/review-verdict.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAWlF;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAOxE"}
@@ -1,10 +1,17 @@
1
- //#region src/review-verdict.ts
1
+ // src/review-verdict.ts
2
+ /**
3
+ * The Platform GitHub proxy prefixes bodies it writes for a session with
4
+ * `> Opened by @<actor>`, which pushes the skill's verdict off the first line.
5
+ */
6
+ const ACTOR_ATTRIBUTION_LINE = /^>\s*Opened by\s+\S+$/;
2
7
  /**
3
8
  * Normalizes the first non-empty line of a review body so its `Verdict:` line can be read
4
9
  * regardless of the markdown it is wrapped in (`**Verdict:** request changes`, `# Verdict: ...`).
10
+ * A leading proxy attribution line is skipped.
5
11
  */
6
12
  function normalizedVerdictLine(body) {
7
- const firstLine = body?.split("\n").map((line) => line.trim()).find((line) => line.length > 0);
13
+ const lines = body?.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
14
+ const firstLine = lines?.[0] && ACTOR_ATTRIBUTION_LINE.test(lines[0]) ? lines[1] : lines?.[0];
8
15
  if (!firstLine) return void 0;
9
16
  return firstLine.replaceAll(/[*_`#>\s]+/g, " ").trim().toLowerCase();
10
17
  }
@@ -23,7 +30,6 @@ function requestsChangesVerdict(body) {
23
30
  if (!normalized) return false;
24
31
  return /^verdict: ?(request changes|changes requested)$/.test(normalized);
25
32
  }
26
- //#endregion
27
33
  export { normalizedVerdictLine, requestsChangesVerdict };
28
34
 
29
35
  //# sourceMappingURL=review-verdict.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"review-verdict.js","names":[],"sources":["../src/review-verdict.ts"],"sourcesContent":["/**\n * Normalizes the first non-empty line of a review body so its `Verdict:` line can be read\n * regardless of the markdown it is wrapped in (`**Verdict:** request changes`, `# Verdict: ...`).\n */\nexport function normalizedVerdictLine(body: string | undefined): string | undefined {\n const firstLine = body\n ?.split('\\n')\n .map(line => line.trim())\n .find(line => line.length > 0);\n if (!firstLine) return undefined;\n return firstLine\n .replaceAll(/[*_`#>\\s]+/g, ' ')\n .trim()\n .toLowerCase();\n}\n\n/**\n * Detects the `factory-review` handoff verdict in a comment body.\n *\n * GitHub forbids an app from reviewing a pull request it authored, so on\n * Factory-authored PRs the review skill falls back to posting its verdict as a\n * plain comment. That comment is the only signal the authoring agent gets, so\n * it has to be readable back out. The skill's handoff contract puts the verdict\n * on the first line (`Verdict: request changes`), so only that line is\n * inspected — a verdict quoted later in the findings must not count.\n */\nexport function requestsChangesVerdict(body: string | undefined): boolean {\n // Tolerate the markdown the skill wraps the line in (`**Verdict: ...**`).\n const normalized = normalizedVerdictLine(body);\n if (!normalized) return false;\n // Match the verdict exactly so negated phrasings (\"Verdict: do not request\n // changes\") cannot wake the author.\n return /^verdict: ?(request changes|changes requested)$/.test(normalized);\n}\n"],"mappings":";;;;;AAIA,SAAgB,sBAAsB,MAA8C;CAClF,MAAM,YAAY,MACd,MAAM,IAAI,CAAC,CACZ,KAAI,SAAQ,KAAK,KAAK,CAAC,CAAC,CACxB,MAAK,SAAQ,KAAK,SAAS,CAAC;CAC/B,IAAI,CAAC,WAAW,OAAO,KAAA;CACvB,OAAO,UACJ,WAAW,eAAe,GAAG,CAAC,CAC9B,KAAK,CAAC,CACN,YAAY;AACjB;;;;;;;;;;;AAYA,SAAgB,uBAAuB,MAAmC;CAExE,MAAM,aAAa,sBAAsB,IAAI;CAC7C,IAAI,CAAC,YAAY,OAAO;CAGxB,OAAO,kDAAkD,KAAK,UAAU;AAC1E"}
1
+ {"version":3,"file":"review-verdict.js","names":[],"sources":["../src/review-verdict.ts"],"sourcesContent":["/**\n * The Platform GitHub proxy prefixes bodies it writes for a session with\n * `> Opened by @<actor>`, which pushes the skill's verdict off the first line.\n */\nconst ACTOR_ATTRIBUTION_LINE = /^>\\s*Opened by\\s+\\S+$/;\n\n/**\n * Normalizes the first non-empty line of a review body so its `Verdict:` line can be read\n * regardless of the markdown it is wrapped in (`**Verdict:** request changes`, `# Verdict: ...`).\n * A leading proxy attribution line is skipped.\n */\nexport function normalizedVerdictLine(body: string | undefined): string | undefined {\n const lines = body\n ?.split('\\n')\n .map(line => line.trim())\n .filter(line => line.length > 0);\n const firstLine = lines?.[0] && ACTOR_ATTRIBUTION_LINE.test(lines[0]) ? lines[1] : lines?.[0];\n if (!firstLine) return undefined;\n return firstLine\n .replaceAll(/[*_`#>\\s]+/g, ' ')\n .trim()\n .toLowerCase();\n}\n\n/**\n * Detects the `factory-review` handoff verdict in a comment body.\n *\n * GitHub forbids an app from reviewing a pull request it authored, so on\n * Factory-authored PRs the review skill falls back to posting its verdict as a\n * plain comment. That comment is the only signal the authoring agent gets, so\n * it has to be readable back out. The skill's handoff contract puts the verdict\n * on the first line (`Verdict: request changes`), so only that line is\n * inspected — a verdict quoted later in the findings must not count.\n */\nexport function requestsChangesVerdict(body: string | undefined): boolean {\n // Tolerate the markdown the skill wraps the line in (`**Verdict: ...**`).\n const normalized = normalizedVerdictLine(body);\n if (!normalized) return false;\n // Match the verdict exactly so negated phrasings (\"Verdict: do not request\n // changes\") cannot wake the author.\n return /^verdict: ?(request changes|changes requested)$/.test(normalized);\n}\n"],"mappings":";;;;;AAIA,MAAM,yBAAyB;;;;;;AAO/B,SAAgB,sBAAsB,MAA8C;CAClF,MAAM,QAAQ,MACV,MAAM,IAAI,CAAC,CACZ,KAAI,SAAQ,KAAK,KAAK,CAAC,CAAC,CACxB,QAAO,SAAQ,KAAK,SAAS,CAAC;CACjC,MAAM,YAAY,QAAQ,MAAM,uBAAuB,KAAK,MAAM,EAAE,IAAI,MAAM,KAAK,QAAQ;CAC3F,IAAI,CAAC,WAAW,OAAO,KAAA;CACvB,OAAO,UACJ,WAAW,eAAe,GAAG,CAAC,CAC9B,KAAK,CAAC,CACN,YAAY;AACjB;;;;;;;;;;;AAYA,SAAgB,uBAAuB,MAAmC;CAExE,MAAM,aAAa,sBAAsB,IAAI;CAC7C,IAAI,CAAC,YAAY,OAAO;CAGxB,OAAO,kDAAkD,KAAK,UAAU;AAC1E"}
@@ -2,7 +2,7 @@ import { boardForWorkItem } from "../boards/semantics.js";
2
2
  import "../boards/index.js";
3
3
  import { factoryActivityAttentionIdentity, factoryAttentionKey } from "../storage/domains/work-items/base.js";
4
4
  import { collectPage, markScanRead, matchesView, receiptScope, scanBatches } from "./attention-providers.js";
5
- //#region src/routes/attention-activity.ts
5
+ // src/routes/attention-activity.ts
6
6
  /** Projects `activity.ts` fan-out rows. */
7
7
  var ActivityAttentionProvider = class {
8
8
  kind = "activity";
@@ -149,7 +149,6 @@ function toActivityItem(scope, resolved) {
149
149
  }
150
150
  };
151
151
  }
152
- //#endregion
153
152
  export { ActivityAttentionProvider };
154
153
 
155
154
  //# sourceMappingURL=attention-activity.js.map
@@ -1,6 +1,6 @@
1
1
  import { factoryAgentWaitingAttentionIdentity, factoryAttentionKey } from "../storage/domains/work-items/base.js";
2
2
  import { matchesView, receiptScope } from "./attention-providers.js";
3
- //#region src/routes/attention-parked.ts
3
+ // src/routes/attention-parked.ts
4
4
  function parkedRunLabel(toolName) {
5
5
  return toolName === "submit_plan" ? "Plan waiting for review" : "Agent is waiting for an answer";
6
6
  }
@@ -130,7 +130,6 @@ var ParkedRunAttentionProvider = class {
130
130
  return { hasMore: false };
131
131
  }
132
132
  };
133
- //#endregion
134
133
  export { ParkedRunAttentionProvider };
135
134
 
136
135
  //# sourceMappingURL=attention-parked.js.map
@@ -1,6 +1,6 @@
1
1
  import { factoryProposalAttentionIdentity } from "../storage/domains/work-items/base.js";
2
2
  import { factoryDecisionType } from "./attention-providers.js";
3
- //#region src/routes/attention-proposed.ts
3
+ // src/routes/attention-proposed.ts
4
4
  function proposedAction(decision) {
5
5
  const { type, stage, role } = decision.decision;
6
6
  if (type === "transition" && typeof stage === "string") return `move to ${stage.slice(0, 64)}`;
@@ -15,7 +15,6 @@ const proposedDecisionAttentionSpec = {
15
15
  detail: (decision) => `Waiting for approval to ${proposedAction(decision)}`,
16
16
  matches: (decision, item, search) => item?.title.toLowerCase().includes(search) === true || proposedAction(decision).toLowerCase().includes(search) || factoryDecisionType(decision).toLowerCase().includes(search)
17
17
  };
18
- //#endregion
19
18
  export { proposedDecisionAttentionSpec };
20
19
 
21
20
  //# sourceMappingURL=attention-proposed.js.map
@@ -3,7 +3,7 @@ import "../boards/index.js";
3
3
  import { factoryDispatchFailureMetadata } from "../rules/dispatch-errors.js";
4
4
  import { factoryAttentionKey, factoryDecisionAttentionIdentity, factoryMentionAttentionIdentity } from "../storage/domains/work-items/base.js";
5
5
  import { decisionRetryable, overtakenDecisionIds } from "../rules/decision-applicability.js";
6
- //#region src/routes/attention-providers.ts
6
+ // src/routes/attention-providers.ts
7
7
  /**
8
8
  * Per-kind attention providers. Each kind owns its counts, its bounded page
9
9
  * scan, and its wire item shape; the route layer k-way merges provider pages
@@ -391,7 +391,6 @@ function receiptScope(scope) {
391
391
  userId: scope.userId
392
392
  };
393
393
  }
394
- //#endregion
395
394
  export { DecisionAttentionProvider, MentionAttentionProvider, SCAN_PAGE_SIZE, collectPage, factoryDecisionType, failedDecisionAttentionSpec, markScanRead, matchesView, receiptScope, scanBatches };
396
395
 
397
396
  //# sourceMappingURL=attention-providers.js.map
@@ -5,7 +5,7 @@ import { ActivityAttentionProvider } from "./attention-activity.js";
5
5
  import { ParkedRunAttentionProvider } from "./attention-parked.js";
6
6
  import { proposedDecisionAttentionSpec } from "./attention-proposed.js";
7
7
  import { registerApiRoute } from "@mastra/core/server";
8
- //#region src/routes/attention.ts
8
+ // src/routes/attention.ts
9
9
  function encodeAttentionCursor(cursors) {
10
10
  const wire = {};
11
11
  for (const [kind, position] of cursors) wire[kind] = position ? [position.occurredAt.toISOString(), position.id] : null;
@@ -212,7 +212,6 @@ function buildAttentionRoutes(dependencies) {
212
212
  receiptRoute(dependencies, "restore", "restore")
213
213
  ];
214
214
  }
215
- //#endregion
216
215
  export { buildAttentionRoutes, factoryDecisionType };
217
216
 
218
217
  //# sourceMappingURL=attention.js.map
@@ -2,7 +2,7 @@ import { FACTORY_ROUTE_CONTRACTS } from "./contracts.js";
2
2
  import { Route } from "./route.js";
3
3
  import { auditRequestContext } from "../storage/domains/audit/domain.js";
4
4
  import { registerApiRoute } from "@mastra/core/server";
5
- //#region src/routes/automation-runs.ts
5
+ // src/routes/automation-runs.ts
6
6
  function loose(c) {
7
7
  return c;
8
8
  }
@@ -190,7 +190,6 @@ var AutomationRunRoutes = class extends Route {
190
190
  function buildAutomationRunRoutes(deps) {
191
191
  return new AutomationRunRoutes(deps).routes();
192
192
  }
193
- //#endregion
194
193
  export { AutomationRunRoutes, buildAutomationRunRoutes };
195
194
 
196
195
  //# sourceMappingURL=automation-runs.js.map
@@ -48,8 +48,12 @@ export interface ProviderInfo {
48
48
  * when one shadows the other.
49
49
  */
50
50
  userCredential?: 'oauth' | 'api_key';
51
+ /** Tenant mode: the caller's personal sign-in could not be renewed and must be redone. */
52
+ userCredentialExpired?: true;
51
53
  /** Tenant mode: the shared org credential for this provider, if any. */
52
54
  orgCredential?: 'oauth' | 'api_key';
55
+ /** Tenant mode: the shared org sign-in could not be renewed and must be redone. */
56
+ orgCredentialExpired?: true;
53
57
  /** Web OAuth sign-in capability, when the provider supports it. */
54
58
  oauth?: {
55
59
  supported: true;
@@ -81,6 +85,9 @@ export interface ModelCatalog {
81
85
  id: string;
82
86
  defaultModelId?: string;
83
87
  }>;
88
+ getDefaultMode?: () => {
89
+ defaultModelId?: string;
90
+ };
84
91
  getSession?: (sessionId: string) => Promise<OMSession | undefined>;
85
92
  }
86
93
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/routes/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,KAAK,EAAE,cAAc,EAAuB,MAAM,mCAAmC,CAAC;AAO7F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAOpD,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAEhH,OAAO,KAAK,EAGV,qBAAqB,EACtB,MAAM,4CAA4C,CAAC;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEtF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AAC5F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAU9E,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC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AM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC/D;;;OAGG;IACH,mBAAmB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC3C;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,YAAa,SAAQ,KAAK,CAAC,gBAAgB,CAAC;IACvD,MAAM,IAAI,QAAQ,EAAE;CAywBrB"}
@@ -1,4 +1,5 @@
1
1
  import { WEB_OAUTH_PROVIDERS, credentialLabel, getAuthProviderId, listTenantCredentialsForRequest, resolveCredentialContext, tenantOrgId } from "./provider-credentials.js";
2
+ import { resolveTenantProviderDefaultModel } from "./tenant-credentials.js";
2
3
  import { effectiveModelScope } from "../storage/domains/projects/base.js";
3
4
  import { THINKING_LEVELS } from "./contracts.js";
4
5
  import { resolveFactoryModelPolicy, routedPersonalDefaults } from "../session/credential-policy.js";
@@ -14,7 +15,7 @@ import { resolveAutoOMModelId } from "@mastra/code-sdk/onboarding/packs";
14
15
  import { MASTRA_GATEWAY_PROVIDER, getCustomProviderId } from "@mastra/code-sdk/onboarding/settings";
15
16
  import { AMAZON_BEDROCK_GATEWAY_ID } from "@mastra/code-sdk/providers/amazon-bedrock-gateway";
16
17
  import { getModelReasoningOptions } from "@mastra/core/llm";
17
- //#region src/routes/config.ts
18
+ // src/routes/config.ts
18
19
  /** Widen a route-local Hono context to the plain `Context` the auth helpers take. */
19
20
  function loose(c) {
20
21
  return c;
@@ -44,13 +45,17 @@ async function listProviders({ controller, authStorage, tenantCredentials, deplo
44
45
  let source = "none";
45
46
  let orgKey;
46
47
  let userCredential;
48
+ let userCredentialExpired = false;
47
49
  let orgCredential;
50
+ let orgCredentialExpired = false;
48
51
  if (tenantCredentials) {
49
52
  const userRec = tenantCredentials.find((r) => r.scope === "user" && r.provider === authProviderId);
50
53
  const orgRec = tenantCredentials.find((r) => r.scope === "org" && r.provider === authProviderId);
51
54
  orgKey = orgRec !== void 0;
52
55
  userCredential = userRec?.credential.type;
56
+ userCredentialExpired = userRec?.refreshFailedAt !== void 0;
53
57
  orgCredential = orgRec?.credential.type;
58
+ orgCredentialExpired = orgRec?.refreshFailedAt !== void 0;
54
59
  if (userRec?.credential.type === "oauth") source = "oauth-user";
55
60
  else if (userRec?.credential.type === "api_key") source = "stored-user";
56
61
  else if (orgRec?.credential.type === "oauth") source = "oauth-org";
@@ -66,7 +71,9 @@ async function listProviders({ controller, authStorage, tenantCredentials, deplo
66
71
  source,
67
72
  ...orgKey !== void 0 ? { orgKey } : {},
68
73
  ...userCredential ? { userCredential } : {},
74
+ ...userCredentialExpired ? { userCredentialExpired: true } : {},
69
75
  ...orgCredential ? { orgCredential } : {},
76
+ ...orgCredentialExpired ? { orgCredentialExpired: true } : {},
70
77
  ...flowKind ? { oauth: {
71
78
  supported: true,
72
79
  modes: [flowKind]
@@ -647,6 +654,7 @@ var ConfigRoutes = class extends Route {
647
654
  const tenant = auth.tenant(c);
648
655
  let tenantCredentials = allTenantCredentials;
649
656
  let sessionPolicy;
657
+ let credentialTenant;
650
658
  const resourceId = c.req.query("resourceId");
651
659
  const threadId = c.req.query("threadId");
652
660
  const sessionId = c.req.query("sessionId");
@@ -710,6 +718,11 @@ var ConfigRoutes = class extends Route {
710
718
  const scope = z.enum(["org", "user"]).safeParse(c.req.query("scope"));
711
719
  if (!scope.success) return c.json({ error: "invalid_model_scope" }, 400);
712
720
  tenantCredentials = allTenantCredentials?.filter((record) => record.scope === scope.data);
721
+ if (tenant) credentialTenant = {
722
+ orgId: tenantOrgId(tenant),
723
+ userId: tenant.userId,
724
+ credentialScope: scope.data === "user" ? "user" : "factory"
725
+ };
713
726
  } else if (allTenantCredentials && factoryProjectId && tenant) {
714
727
  if (!options.factoryProjects) return c.json({ error: "factory_unavailable" }, 503);
715
728
  await options.factoryProjects.ensureReady();
@@ -720,6 +733,11 @@ var ConfigRoutes = class extends Route {
720
733
  if (!project) return c.json({ error: "factory_project_not_found" }, 404);
721
734
  const credentialScope = project.modelScope === "user" ? "user" : "org";
722
735
  tenantCredentials = allTenantCredentials.filter((record) => record.scope === credentialScope);
736
+ credentialTenant = {
737
+ orgId: tenantOrgId(tenant),
738
+ userId: tenant.userId,
739
+ credentialScope: credentialScope === "user" ? "user" : "factory"
740
+ };
723
741
  }
724
742
  const customProviders = options.customProviders;
725
743
  const models = await buildModelCatalog({
@@ -736,10 +754,19 @@ var ConfigRoutes = class extends Route {
736
754
  return "response" in ctx ? [] : ctx.storage.list({ orgId: ctx.orgId });
737
755
  } : void 0
738
756
  });
739
- return c.json({
757
+ if (!credentialTenant) return c.json({
740
758
  ...sessionPolicy,
741
759
  models
742
760
  });
761
+ const modeModelId = controller.getDefaultMode?.().defaultModelId;
762
+ const candidate = await resolveTenantProviderDefaultModel(credentialTenant, modeModelId).catch((error) => {
763
+ console.warn("[Factory Config] Failed to resolve a provider default model", { error: error instanceof Error ? error.message : String(error) });
764
+ }) ?? modeModelId;
765
+ const fallbackModelId = models.find((model) => model.id === candidate)?.id ?? null;
766
+ return c.json({
767
+ fallbackModelId,
768
+ models
769
+ });
743
770
  } catch (error) {
744
771
  return c.json({ error: error instanceof Error ? error.message : String(error) }, 500);
745
772
  }
@@ -1099,7 +1126,6 @@ var ConfigRoutes = class extends Route {
1099
1126
  ];
1100
1127
  }
1101
1128
  };
1102
- //#endregion
1103
1129
  export { ConfigRoutes, DEPLOYMENT_MODEL_PROVIDERS, buildModelCatalog, buildProviderAccess, isDeploymentModelProvider, listProviders, listSessionScopedCredentials, resolveDeploymentModelProviders };
1104
1130
 
1105
1131
  //# sourceMappingURL=config.js.map