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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (313) hide show
  1. package/CHANGELOG.md +695 -0
  2. package/LICENSE.md +30 -0
  3. package/README.md +27 -0
  4. package/dist/auth.d.ts +181 -0
  5. package/dist/auth.d.ts.map +1 -0
  6. package/dist/auth.js +505 -0
  7. package/dist/auth.js.map +1 -0
  8. package/dist/capabilities/connection.d.ts +9 -0
  9. package/dist/capabilities/connection.d.ts.map +1 -0
  10. package/dist/capabilities/connection.js +1 -0
  11. package/dist/capabilities/intake.d.ts +140 -0
  12. package/dist/capabilities/intake.d.ts.map +1 -0
  13. package/dist/capabilities/intake.js +1 -0
  14. package/dist/capabilities/version-control.d.ts +245 -0
  15. package/dist/capabilities/version-control.d.ts.map +1 -0
  16. package/dist/capabilities/version-control.js +1 -0
  17. package/dist/factory.d.ts +156 -0
  18. package/dist/factory.d.ts.map +1 -0
  19. package/dist/factory.js +483 -0
  20. package/dist/factory.js.map +1 -0
  21. package/dist/index.d.ts +14 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +7 -0
  24. package/dist/integrations/base.d.ts +210 -0
  25. package/dist/integrations/base.d.ts.map +1 -0
  26. package/dist/integrations/base.js +1 -0
  27. package/dist/integrations/github/config.d.ts +60 -0
  28. package/dist/integrations/github/config.d.ts.map +1 -0
  29. package/dist/integrations/github/config.js +42 -0
  30. package/dist/integrations/github/config.js.map +1 -0
  31. package/dist/integrations/github/factory-session.d.ts +12 -0
  32. package/dist/integrations/github/factory-session.d.ts.map +1 -0
  33. package/dist/integrations/github/factory-session.js +37 -0
  34. package/dist/integrations/github/factory-session.js.map +1 -0
  35. package/dist/integrations/github/integration.d.ts +191 -0
  36. package/dist/integrations/github/integration.d.ts.map +1 -0
  37. package/dist/integrations/github/integration.js +1077 -0
  38. package/dist/integrations/github/integration.js.map +1 -0
  39. package/dist/integrations/github/issue-triage.d.ts +27 -0
  40. package/dist/integrations/github/issue-triage.d.ts.map +1 -0
  41. package/dist/integrations/github/issue-triage.js +82 -0
  42. package/dist/integrations/github/issue-triage.js.map +1 -0
  43. package/dist/integrations/github/pat.d.ts +38 -0
  44. package/dist/integrations/github/pat.d.ts.map +1 -0
  45. package/dist/integrations/github/pat.js +59 -0
  46. package/dist/integrations/github/pat.js.map +1 -0
  47. package/dist/integrations/github/provenance.d.ts +27 -0
  48. package/dist/integrations/github/provenance.d.ts.map +1 -0
  49. package/dist/integrations/github/provenance.js +75 -0
  50. package/dist/integrations/github/provenance.js.map +1 -0
  51. package/dist/integrations/github/routes.d.ts +69 -0
  52. package/dist/integrations/github/routes.d.ts.map +1 -0
  53. package/dist/integrations/github/routes.js +1324 -0
  54. package/dist/integrations/github/routes.js.map +1 -0
  55. package/dist/integrations/github/rules.d.ts +78 -0
  56. package/dist/integrations/github/rules.d.ts.map +1 -0
  57. package/dist/integrations/github/rules.js +362 -0
  58. package/dist/integrations/github/rules.js.map +1 -0
  59. package/dist/integrations/github/sandbox-release.d.ts +38 -0
  60. package/dist/integrations/github/sandbox-release.d.ts.map +1 -0
  61. package/dist/integrations/github/sandbox-release.js +74 -0
  62. package/dist/integrations/github/sandbox-release.js.map +1 -0
  63. package/dist/integrations/github/sandbox.d.ts +281 -0
  64. package/dist/integrations/github/sandbox.d.ts.map +1 -0
  65. package/dist/integrations/github/sandbox.js +547 -0
  66. package/dist/integrations/github/sandbox.js.map +1 -0
  67. package/dist/integrations/github/session-subscriptions.d.ts +26 -0
  68. package/dist/integrations/github/session-subscriptions.d.ts.map +1 -0
  69. package/dist/integrations/github/session-subscriptions.js +192 -0
  70. package/dist/integrations/github/session-subscriptions.js.map +1 -0
  71. package/dist/integrations/github/subscriptions.d.ts +54 -0
  72. package/dist/integrations/github/subscriptions.d.ts.map +1 -0
  73. package/dist/integrations/github/subscriptions.js +62 -0
  74. package/dist/integrations/github/subscriptions.js.map +1 -0
  75. package/dist/integrations/github/token-refresh.d.ts +12 -0
  76. package/dist/integrations/github/token-refresh.d.ts.map +1 -0
  77. package/dist/integrations/github/token-refresh.js +24 -0
  78. package/dist/integrations/github/token-refresh.js.map +1 -0
  79. package/dist/integrations/github/webhook.d.ts +87 -0
  80. package/dist/integrations/github/webhook.d.ts.map +1 -0
  81. package/dist/integrations/github/webhook.js +397 -0
  82. package/dist/integrations/github/webhook.js.map +1 -0
  83. package/dist/integrations/linear/agent-tools.d.ts +34 -0
  84. package/dist/integrations/linear/agent-tools.d.ts.map +1 -0
  85. package/dist/integrations/linear/agent-tools.js +85 -0
  86. package/dist/integrations/linear/agent-tools.js.map +1 -0
  87. package/dist/integrations/linear/integration.d.ts +233 -0
  88. package/dist/integrations/linear/integration.d.ts.map +1 -0
  89. package/dist/integrations/linear/integration.js +672 -0
  90. package/dist/integrations/linear/integration.js.map +1 -0
  91. package/dist/integrations/linear/routes.d.ts +61 -0
  92. package/dist/integrations/linear/routes.d.ts.map +1 -0
  93. package/dist/integrations/linear/routes.js +239 -0
  94. package/dist/integrations/linear/routes.js.map +1 -0
  95. package/dist/integrations/linear/rules.d.ts +42 -0
  96. package/dist/integrations/linear/rules.d.ts.map +1 -0
  97. package/dist/integrations/linear/rules.js +133 -0
  98. package/dist/integrations/linear/rules.js.map +1 -0
  99. package/dist/integrations/linear/storage.d.ts +65 -0
  100. package/dist/integrations/linear/storage.d.ts.map +1 -0
  101. package/dist/integrations/linear/storage.js +1 -0
  102. package/dist/integrations/platform/api-client.d.ts +26 -0
  103. package/dist/integrations/platform/api-client.d.ts.map +1 -0
  104. package/dist/integrations/platform/api-client.js +156 -0
  105. package/dist/integrations/platform/api-client.js.map +1 -0
  106. package/dist/integrations/platform/github/event-worker.d.ts +49 -0
  107. package/dist/integrations/platform/github/event-worker.d.ts.map +1 -0
  108. package/dist/integrations/platform/github/event-worker.js +348 -0
  109. package/dist/integrations/platform/github/event-worker.js.map +1 -0
  110. package/dist/integrations/platform/github/integration.d.ts +50 -0
  111. package/dist/integrations/platform/github/integration.d.ts.map +1 -0
  112. package/dist/integrations/platform/github/integration.js +961 -0
  113. package/dist/integrations/platform/github/integration.js.map +1 -0
  114. package/dist/integrations/platform/linear/integration.d.ts +46 -0
  115. package/dist/integrations/platform/linear/integration.d.ts.map +1 -0
  116. package/dist/integrations/platform/linear/integration.js +483 -0
  117. package/dist/integrations/platform/linear/integration.js.map +1 -0
  118. package/dist/integrations/workos/integration.d.ts +39 -0
  119. package/dist/integrations/workos/integration.d.ts.map +1 -0
  120. package/dist/integrations/workos/integration.js +91 -0
  121. package/dist/integrations/workos/integration.js.map +1 -0
  122. package/dist/routes/config.d.ts +235 -0
  123. package/dist/routes/config.d.ts.map +1 -0
  124. package/dist/routes/config.js +972 -0
  125. package/dist/routes/config.js.map +1 -0
  126. package/dist/routes/custom-provider-source.d.ts +52 -0
  127. package/dist/routes/custom-provider-source.d.ts.map +1 -0
  128. package/dist/routes/custom-provider-source.js +124 -0
  129. package/dist/routes/custom-provider-source.js.map +1 -0
  130. package/dist/routes/fs.d.ts +151 -0
  131. package/dist/routes/fs.d.ts.map +1 -0
  132. package/dist/routes/fs.js +708 -0
  133. package/dist/routes/fs.js.map +1 -0
  134. package/dist/routes/intake.d.ts +23 -0
  135. package/dist/routes/intake.d.ts.map +1 -0
  136. package/dist/routes/intake.js +179 -0
  137. package/dist/routes/intake.js.map +1 -0
  138. package/dist/routes/oauth.d.ts +43 -0
  139. package/dist/routes/oauth.d.ts.map +1 -0
  140. package/dist/routes/oauth.js +463 -0
  141. package/dist/routes/oauth.js.map +1 -0
  142. package/dist/routes/projects.d.ts +19 -0
  143. package/dist/routes/projects.d.ts.map +1 -0
  144. package/dist/routes/projects.js +461 -0
  145. package/dist/routes/projects.js.map +1 -0
  146. package/dist/routes/provider-credentials.d.ts +81 -0
  147. package/dist/routes/provider-credentials.d.ts.map +1 -0
  148. package/dist/routes/provider-credentials.js +86 -0
  149. package/dist/routes/provider-credentials.js.map +1 -0
  150. package/dist/routes/route.d.ts +48 -0
  151. package/dist/routes/route.d.ts.map +1 -0
  152. package/dist/routes/route.js +15 -0
  153. package/dist/routes/route.js.map +1 -0
  154. package/dist/routes/skills.d.ts +30 -0
  155. package/dist/routes/skills.d.ts.map +1 -0
  156. package/dist/routes/skills.js +168 -0
  157. package/dist/routes/skills.js.map +1 -0
  158. package/dist/routes/surface.d.ts +91 -0
  159. package/dist/routes/surface.d.ts.map +1 -0
  160. package/dist/routes/surface.js +260 -0
  161. package/dist/routes/surface.js.map +1 -0
  162. package/dist/routes/tenant-credentials.d.ts +74 -0
  163. package/dist/routes/tenant-credentials.d.ts.map +1 -0
  164. package/dist/routes/tenant-credentials.js +156 -0
  165. package/dist/routes/tenant-credentials.js.map +1 -0
  166. package/dist/routes/work-items.d.ts +40 -0
  167. package/dist/routes/work-items.d.ts.map +1 -0
  168. package/dist/routes/work-items.js +695 -0
  169. package/dist/routes/work-items.js.map +1 -0
  170. package/dist/rules/binding-context.d.ts +5 -0
  171. package/dist/rules/binding-context.d.ts.map +1 -0
  172. package/dist/rules/binding-context.js +28 -0
  173. package/dist/rules/binding-context.js.map +1 -0
  174. package/dist/rules/defaults.d.ts +9 -0
  175. package/dist/rules/defaults.d.ts.map +1 -0
  176. package/dist/rules/defaults.js +260 -0
  177. package/dist/rules/defaults.js.map +1 -0
  178. package/dist/rules/dispatcher.d.ts +42 -0
  179. package/dist/rules/dispatcher.d.ts.map +1 -0
  180. package/dist/rules/dispatcher.js +518 -0
  181. package/dist/rules/dispatcher.js.map +1 -0
  182. package/dist/rules/index.d.ts +7 -0
  183. package/dist/rules/index.d.ts.map +1 -0
  184. package/dist/rules/index.js +5 -0
  185. package/dist/rules/processor.d.ts +54 -0
  186. package/dist/rules/processor.d.ts.map +1 -0
  187. package/dist/rules/processor.js +378 -0
  188. package/dist/rules/processor.js.map +1 -0
  189. package/dist/rules/resolve.d.ts +17 -0
  190. package/dist/rules/resolve.d.ts.map +1 -0
  191. package/dist/rules/resolve.js +30 -0
  192. package/dist/rules/resolve.js.map +1 -0
  193. package/dist/rules/start-coordinator.d.ts +60 -0
  194. package/dist/rules/start-coordinator.d.ts.map +1 -0
  195. package/dist/rules/start-coordinator.js +194 -0
  196. package/dist/rules/start-coordinator.js.map +1 -0
  197. package/dist/rules/tools.d.ts +10 -0
  198. package/dist/rules/tools.d.ts.map +1 -0
  199. package/dist/rules/tools.js +58 -0
  200. package/dist/rules/tools.js.map +1 -0
  201. package/dist/rules/transition-service.d.ts +49 -0
  202. package/dist/rules/transition-service.d.ts.map +1 -0
  203. package/dist/rules/transition-service.js +232 -0
  204. package/dist/rules/transition-service.js.map +1 -0
  205. package/dist/rules/types.d.ts +234 -0
  206. package/dist/rules/types.d.ts.map +1 -0
  207. package/dist/rules/types.js +38 -0
  208. package/dist/rules/types.js.map +1 -0
  209. package/dist/rules/validation.d.ts +11 -0
  210. package/dist/rules/validation.d.ts.map +1 -0
  211. package/dist/rules/validation.js +308 -0
  212. package/dist/rules/validation.js.map +1 -0
  213. package/dist/sandbox/fleet.d.ts +222 -0
  214. package/dist/sandbox/fleet.d.ts.map +1 -0
  215. package/dist/sandbox/fleet.js +322 -0
  216. package/dist/sandbox/fleet.js.map +1 -0
  217. package/dist/sandbox/reattach.d.ts +3 -0
  218. package/dist/sandbox/reattach.d.ts.map +1 -0
  219. package/dist/sandbox/reattach.js +16 -0
  220. package/dist/sandbox/reattach.js.map +1 -0
  221. package/dist/server-error.d.ts +12 -0
  222. package/dist/server-error.d.ts.map +1 -0
  223. package/dist/server-error.js +16 -0
  224. package/dist/server-error.js.map +1 -0
  225. package/dist/skills/service.d.ts +48 -0
  226. package/dist/skills/service.d.ts.map +1 -0
  227. package/dist/skills/service.js +40 -0
  228. package/dist/skills/service.js.map +1 -0
  229. package/dist/spa-static.d.ts +33 -0
  230. package/dist/spa-static.d.ts.map +1 -0
  231. package/dist/spa-static.js +104 -0
  232. package/dist/spa-static.js.map +1 -0
  233. package/dist/state-signing.d.ts +59 -0
  234. package/dist/state-signing.d.ts.map +1 -0
  235. package/dist/state-signing.js +83 -0
  236. package/dist/state-signing.js.map +1 -0
  237. package/dist/storage/domains/audit/agent-audit.d.ts +27 -0
  238. package/dist/storage/domains/audit/agent-audit.d.ts.map +1 -0
  239. package/dist/storage/domains/audit/agent-audit.js +66 -0
  240. package/dist/storage/domains/audit/agent-audit.js.map +1 -0
  241. package/dist/storage/domains/audit/base.d.ts +140 -0
  242. package/dist/storage/domains/audit/base.d.ts.map +1 -0
  243. package/dist/storage/domains/audit/base.js +184 -0
  244. package/dist/storage/domains/audit/base.js.map +1 -0
  245. package/dist/storage/domains/audit/domain.d.ts +69 -0
  246. package/dist/storage/domains/audit/domain.d.ts.map +1 -0
  247. package/dist/storage/domains/audit/domain.js +167 -0
  248. package/dist/storage/domains/audit/domain.js.map +1 -0
  249. package/dist/storage/domains/channel-identity/base.d.ts +96 -0
  250. package/dist/storage/domains/channel-identity/base.d.ts.map +1 -0
  251. package/dist/storage/domains/channel-identity/base.js +149 -0
  252. package/dist/storage/domains/channel-identity/base.js.map +1 -0
  253. package/dist/storage/domains/credentials/base.d.ts +134 -0
  254. package/dist/storage/domains/credentials/base.d.ts.map +1 -0
  255. package/dist/storage/domains/credentials/base.js +273 -0
  256. package/dist/storage/domains/credentials/base.js.map +1 -0
  257. package/dist/storage/domains/custom-providers/base.d.ts +57 -0
  258. package/dist/storage/domains/custom-providers/base.d.ts.map +1 -0
  259. package/dist/storage/domains/custom-providers/base.js +145 -0
  260. package/dist/storage/domains/custom-providers/base.js.map +1 -0
  261. package/dist/storage/domains/intake/base.d.ts +38 -0
  262. package/dist/storage/domains/intake/base.d.ts.map +1 -0
  263. package/dist/storage/domains/intake/base.js +80 -0
  264. package/dist/storage/domains/intake/base.js.map +1 -0
  265. package/dist/storage/domains/integrations/base.d.ts +126 -0
  266. package/dist/storage/domains/integrations/base.d.ts.map +1 -0
  267. package/dist/storage/domains/integrations/base.js +317 -0
  268. package/dist/storage/domains/integrations/base.js.map +1 -0
  269. package/dist/storage/domains/memory-settings/base.d.ts +62 -0
  270. package/dist/storage/domains/memory-settings/base.d.ts.map +1 -0
  271. package/dist/storage/domains/memory-settings/base.js +126 -0
  272. package/dist/storage/domains/memory-settings/base.js.map +1 -0
  273. package/dist/storage/domains/model-packs/base.d.ts +49 -0
  274. package/dist/storage/domains/model-packs/base.d.ts.map +1 -0
  275. package/dist/storage/domains/model-packs/base.js +96 -0
  276. package/dist/storage/domains/model-packs/base.js.map +1 -0
  277. package/dist/storage/domains/projects/base.d.ts +58 -0
  278. package/dist/storage/domains/projects/base.d.ts.map +1 -0
  279. package/dist/storage/domains/projects/base.js +111 -0
  280. package/dist/storage/domains/projects/base.js.map +1 -0
  281. package/dist/storage/domains/queue-health/base.d.ts +52 -0
  282. package/dist/storage/domains/queue-health/base.d.ts.map +1 -0
  283. package/dist/storage/domains/queue-health/base.js +122 -0
  284. package/dist/storage/domains/queue-health/base.js.map +1 -0
  285. package/dist/storage/domains/source-control/base.d.ts +358 -0
  286. package/dist/storage/domains/source-control/base.d.ts.map +1 -0
  287. package/dist/storage/domains/source-control/base.js +908 -0
  288. package/dist/storage/domains/source-control/base.js.map +1 -0
  289. package/dist/storage/domains/source-control/inmemory.d.ts +175 -0
  290. package/dist/storage/domains/source-control/inmemory.d.ts.map +1 -0
  291. package/dist/storage/domains/source-control/inmemory.js +377 -0
  292. package/dist/storage/domains/source-control/inmemory.js.map +1 -0
  293. package/dist/storage/domains/work-items/base.d.ts +412 -0
  294. package/dist/storage/domains/work-items/base.d.ts.map +1 -0
  295. package/dist/storage/domains/work-items/base.js +1309 -0
  296. package/dist/storage/domains/work-items/base.js.map +1 -0
  297. package/dist/storage/domains/work-items/metrics.d.ts +101 -0
  298. package/dist/storage/domains/work-items/metrics.d.ts.map +1 -0
  299. package/dist/storage/domains/work-items/metrics.js +221 -0
  300. package/dist/storage/domains/work-items/metrics.js.map +1 -0
  301. package/dist/timing.d.ts +15 -0
  302. package/dist/timing.d.ts.map +1 -0
  303. package/dist/timing.js +34 -0
  304. package/dist/timing.js.map +1 -0
  305. package/dist/workspace.d.ts +24 -0
  306. package/dist/workspace.d.ts.map +1 -0
  307. package/dist/workspace.js +286 -0
  308. package/dist/workspace.js.map +1 -0
  309. package/factory-skills/configure-factory-rules/SKILL.md +67 -0
  310. package/factory-skills/factory-plan/SKILL.md +61 -0
  311. package/factory-skills/factory-review/SKILL.md +155 -0
  312. package/factory-skills/factory-triage/SKILL.md +77 -0
  313. package/package.json +81 -0
@@ -0,0 +1,85 @@
1
+ import { LinearReauthRequiredError } from "./integration.js";
2
+ import { createTool } from "@mastra/core/tools";
3
+ import { z } from "zod";
4
+ //#region src/integrations/linear/agent-tools.ts
5
+ function createLinearGetIssueTool(linear, orgId) {
6
+ return createTool({
7
+ id: "linear_get_issue",
8
+ description: "Fetch a Linear issue's full details — title, description, state, assignee, labels, priority, and discussion comments. Use this whenever you're working on a Linear issue (e.g. ENG-123) to get its complete context.",
9
+ inputSchema: z.object({ issue: z.string().min(1).describe("The Linear issue identifier (e.g. \"ENG-123\") or issue UUID.") }),
10
+ execute: async ({ issue }) => {
11
+ const connection = await linear.loadConnection(orgId);
12
+ if (!connection) return { error: "Linear is not connected for this repository. Connect Linear in Settings to fetch issues." };
13
+ try {
14
+ const accessToken = await linear.getFreshAccessToken(connection);
15
+ const detail = await linear.intake.getIssue({
16
+ connection: {
17
+ type: "oauth",
18
+ accessToken
19
+ },
20
+ issueId: issue.trim()
21
+ });
22
+ if (!detail) return { error: `Linear issue "${issue}" was not found in this workspace.` };
23
+ return detail;
24
+ } catch (err) {
25
+ if (err instanceof LinearReauthRequiredError) return { error: err.message };
26
+ return { error: `Failed to fetch Linear issue: ${err instanceof Error ? err.message : String(err)}` };
27
+ }
28
+ }
29
+ });
30
+ }
31
+ function createLinearCommentTool(linear, orgId) {
32
+ return createTool({
33
+ id: "linear_create_comment",
34
+ description: "Post a comment on a Linear issue (e.g. to report investigation findings, link a PR, or ask a clarifying question). The comment is posted as the connected Linear integration, so make clear it comes from the agent.",
35
+ inputSchema: z.object({
36
+ issue: z.string().min(1).describe("The Linear issue identifier (e.g. \"ENG-123\") or issue UUID."),
37
+ body: z.string().min(1).describe("The comment body, as Linear-flavored markdown.")
38
+ }),
39
+ execute: async ({ issue, body }) => {
40
+ const connection = await linear.loadConnection(orgId);
41
+ if (!connection) return { error: "Linear is not connected for this repository. Connect Linear in Settings to post comments." };
42
+ if (!linear.canPostComments(connection)) return { error: "The Linear connection does not have comment permissions. Reconnect Linear in Settings to grant them." };
43
+ try {
44
+ const accessToken = await linear.getFreshAccessToken(connection);
45
+ const comment = await linear.intake.createComment({
46
+ connection: {
47
+ type: "oauth",
48
+ accessToken
49
+ },
50
+ issueId: issue.trim(),
51
+ body
52
+ });
53
+ if (!comment) return { error: `Linear issue "${issue}" was not found in this workspace.` };
54
+ return {
55
+ posted: true,
56
+ url: comment.url
57
+ };
58
+ } catch (err) {
59
+ if (err instanceof LinearReauthRequiredError) return { error: err.message };
60
+ return { error: `Failed to post Linear comment: ${err instanceof Error ? err.message : String(err)}` };
61
+ }
62
+ }
63
+ });
64
+ }
65
+ /**
66
+ * Async `extraTools` provider: expose Linear tools only when the session's
67
+ * project belongs to an org with an active Linear connection.
68
+ */
69
+ async function buildLinearAgentTools({ requestContext, linear }) {
70
+ if (!linear.authEnabled) return {};
71
+ const resourceId = requestContext.get("controller")?.resourceId;
72
+ if (!resourceId) return {};
73
+ const orgId = await linear.resolveOrgId(resourceId);
74
+ if (!orgId) return {};
75
+ const check = await linear.checkConnection(orgId);
76
+ if (!check.connected) return {};
77
+ return {
78
+ linear_get_issue: createLinearGetIssueTool(linear, orgId),
79
+ ...check.canComment ? { linear_create_comment: createLinearCommentTool(linear, orgId) } : {}
80
+ };
81
+ }
82
+ //#endregion
83
+ export { buildLinearAgentTools };
84
+
85
+ //# sourceMappingURL=agent-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-tools.js","names":[],"sources":["../../../src/integrations/linear/agent-tools.ts"],"sourcesContent":["/**\n * Linear tools exposed to the coding agent.\n *\n * Wired into the agent through the SDK's async `extraTools` provider: on each\n * tool-set resolution we map the session's resourceId (the factory project id)\n * to its owning org and only expose the Linear tools when that org has a\n * Linear connection. Projects whose org never connected Linear (or when the\n * feature is disabled) see no Linear tools at all — the model is never shown\n * tools it can't use.\n *\n * Tenancy mirrors the Linear API routes: everything is scoped by the org that\n * owns the project, and tokens are refreshed through the integration's shared\n * connection lifecycle.\n */\n\nimport type { AgentControllerRequestContext } from '@mastra/core/agent-controller';\nimport type { RequestContext } from '@mastra/core/request-context';\nimport { createTool } from '@mastra/core/tools';\nimport { z } from 'zod';\n\nimport type { LinearIntegration } from './integration.js';\nimport { LinearReauthRequiredError } from './integration.js';\n\nfunction createLinearGetIssueTool(linear: LinearIntegration, orgId: string) {\n return createTool({\n id: 'linear_get_issue',\n description:\n \"Fetch a Linear issue's full details — title, description, state, assignee, labels, priority, and discussion comments. Use this whenever you're working on a Linear issue (e.g. ENG-123) to get its complete context.\",\n inputSchema: z.object({\n issue: z.string().min(1).describe('The Linear issue identifier (e.g. \"ENG-123\") or issue UUID.'),\n }),\n execute: async ({ issue }: { issue: string }) => {\n const connection = await linear.loadConnection(orgId);\n if (!connection) {\n return { error: 'Linear is not connected for this repository. Connect Linear in Settings to fetch issues.' };\n }\n try {\n const accessToken = await linear.getFreshAccessToken(connection);\n const detail = await linear.intake.getIssue({\n connection: { type: 'oauth', accessToken },\n issueId: issue.trim(),\n });\n if (!detail) {\n return { error: `Linear issue \"${issue}\" was not found in this workspace.` };\n }\n return detail;\n } catch (err) {\n if (err instanceof LinearReauthRequiredError) {\n return { error: err.message };\n }\n return { error: `Failed to fetch Linear issue: ${err instanceof Error ? err.message : String(err)}` };\n }\n },\n });\n}\n\nfunction createLinearCommentTool(linear: LinearIntegration, orgId: string) {\n return createTool({\n id: 'linear_create_comment',\n description:\n 'Post a comment on a Linear issue (e.g. to report investigation findings, link a PR, or ask a clarifying question). The comment is posted as the connected Linear integration, so make clear it comes from the agent.',\n inputSchema: z.object({\n issue: z.string().min(1).describe('The Linear issue identifier (e.g. \"ENG-123\") or issue UUID.'),\n body: z.string().min(1).describe('The comment body, as Linear-flavored markdown.'),\n }),\n execute: async ({ issue, body }: { issue: string; body: string }) => {\n const connection = await linear.loadConnection(orgId);\n if (!connection) {\n return { error: 'Linear is not connected for this repository. Connect Linear in Settings to post comments.' };\n }\n if (!linear.canPostComments(connection)) {\n return {\n error: 'The Linear connection does not have comment permissions. Reconnect Linear in Settings to grant them.',\n };\n }\n try {\n const accessToken = await linear.getFreshAccessToken(connection);\n const comment = await linear.intake.createComment({\n connection: { type: 'oauth', accessToken },\n issueId: issue.trim(),\n body,\n });\n if (!comment) {\n return { error: `Linear issue \"${issue}\" was not found in this workspace.` };\n }\n return { posted: true, url: comment.url };\n } catch (err) {\n if (err instanceof LinearReauthRequiredError) {\n return { error: err.message };\n }\n return { error: `Failed to post Linear comment: ${err instanceof Error ? err.message : String(err)}` };\n }\n },\n });\n}\n\n/**\n * Async `extraTools` provider: expose Linear tools only when the session's\n * project belongs to an org with an active Linear connection.\n */\nexport async function buildLinearAgentTools({\n requestContext,\n linear,\n}: {\n requestContext: RequestContext;\n /** The integration instance providing the Linear API client. */\n linear: LinearIntegration;\n}): Promise<Record<string, ReturnType<typeof createLinearGetIssueTool> | ReturnType<typeof createLinearCommentTool>>> {\n if (!linear.authEnabled) return {};\n\n const ctx = requestContext.get('controller') as AgentControllerRequestContext | undefined;\n const resourceId = ctx?.resourceId;\n if (!resourceId) return {};\n\n const orgId = await linear.resolveOrgId(resourceId);\n if (!orgId) return {};\n const check = await linear.checkConnection(orgId);\n if (!check.connected) return {};\n\n return {\n linear_get_issue: createLinearGetIssueTool(linear, orgId),\n // Only offered when the granted OAuth scope allows posting comments —\n // connections made before `comments:create` was requested are read-only\n // until the org reconnects Linear.\n ...(check.canComment ? { linear_create_comment: createLinearCommentTool(linear, orgId) } : {}),\n };\n}\n"],"m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M,OAAO,oBAAoB,UAAU;IAC/D,MAAM,UAAU,MAAM,OAAO,OAAO,cAAc;KAChD,YAAY;MAAE,MAAM;MAAS;KAAY;KACzC,SAAS,MAAM,KAAK;KACpB;IACF,CAAC;IACD,IAAI,CAAC,SACH,OAAO,EAAE,OAAO,iBAAiB,MAAM,oCAAoC;IAE7E,OAAO;KAAE,QAAQ;KAAM,KAAK,QAAQ;IAAI;GAC1C,SAAS,KAAK;IACZ,IAAI,eAAe,2BACjB,OAAO,EAAE,OAAO,IAAI,QAAQ;IAE9B,OAAO,EAAE,OAAO,kCAAkC,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,IAAI;GACvG;EACF;CACF,CAAC;AACH;;;;;AAMA,eAAsB,sBAAsB,EAC1C,gBACA,UAKoH;CACpH,IAAI,CAAC,OAAO,aAAa,OAAO,CAAC;CAGjC,MAAM,aADM,eAAe,IAAI,YACV,CAAC,EAAE;CACxB,IAAI,CAAC,YAAY,OAAO,CAAC;CAEzB,MAAM,QAAQ,MAAM,OAAO,aAAa,UAAU;CAClD,IAAI,CAAC,OAAO,OAAO,CAAC;CACpB,MAAM,QAAQ,MAAM,OAAO,gBAAgB,KAAK;CAChD,IAAI,CAAC,MAAM,WAAW,OAAO,CAAC;CAE9B,OAAO;EACL,kBAAkB,yBAAyB,QAAQ,KAAK;EAIxD,GAAI,MAAM,aAAa,EAAE,uBAAuB,wBAAwB,QAAQ,KAAK,EAAE,IAAI,CAAC;CAC9F;AACF"}
@@ -0,0 +1,233 @@
1
+ /**
2
+ * `LinearIntegration` — the self-contained Linear integration.
3
+ *
4
+ * Implements the system-wide `FactoryIntegration` contract
5
+ * (`../factory-integration.ts`): the deploy entry reads the Linear OAuth env
6
+ * vars ONCE, constructs an instance with explicit credentials, and passes it
7
+ * to `MastraFactory`. Everything Linear-flavored the system does — the OAuth
8
+ * connect/callback flow, workspace/project/issue reads for Intake, and the
9
+ * agent's issue tools — flows through this instance. No other module reads
10
+ * `LINEAR_*` env vars.
11
+ *
12
+ * The class owns:
13
+ * - OAuth: the user-facing authorize URL, code exchange, and refresh-token
14
+ * rotation against Linear's `/oauth/token` endpoint.
15
+ * - GraphQL reads/writes: viewer workspace, projects, active issues for
16
+ * Intake, full issue detail (description + discussion), issue comments.
17
+ * - The HTTP surface (`routes()`) and per-request agent tools
18
+ * (`agentTools()`), delegating to `./routes.ts` / `./agent-tools.ts` with
19
+ * `this` as the API client.
20
+ */
21
+ import type { RequestContext } from '@mastra/core/request-context';
22
+ import type { ApiRoute } from '@mastra/core/server';
23
+ import type { Intake } from '../../capabilities/intake.js';
24
+ import type { RouteAuth } from '../../routes/route.js';
25
+ import type { IntegrationStorageHandle } from '../../storage/domains/integrations/base.js';
26
+ import type { FactoryProjectsStorage } from '../../storage/domains/projects/base.js';
27
+ import type { FactoryIntegration, IntegrationContext, IntegrationTools } from '../base.js';
28
+ import type { LinearConnectionRow, LinearStorageHandle, UpsertLinearConnectionInput } from './storage.js';
29
+ /** Credentials for the Linear OAuth application. All fields are required. */
30
+ export interface LinearIntegrationConfig {
31
+ /** OAuth client id of the Linear application. */
32
+ clientId: string;
33
+ /** OAuth client secret of the Linear application. */
34
+ clientSecret: string;
35
+ }
36
+ /**
37
+ * Tokens minted by Linear's `/oauth/token` endpoint. Linear access tokens
38
+ * expire (24h) and refresh tokens rotate: every refresh invalidates the old
39
+ * pair, so callers must persist the whole set after each exchange.
40
+ */
41
+ export interface LinearTokenSet {
42
+ accessToken: string;
43
+ /** Null when Linear issued no refresh token (legacy non-expiring apps). */
44
+ refreshToken: string | null;
45
+ /** Null when Linear reported no `expires_in`. */
46
+ expiresAt: Date | null;
47
+ /** Scopes granted to the token as reported by Linear; null when omitted. */
48
+ scope: string | null;
49
+ }
50
+ export interface LinearWorkspace {
51
+ name: string;
52
+ urlKey: string;
53
+ }
54
+ export interface LinearIssue {
55
+ id: string;
56
+ projectId: string;
57
+ /** Human key like `ENG-123`. */
58
+ identifier: string;
59
+ title: string;
60
+ url: string;
61
+ /** Workflow state name, e.g. `In Progress`. */
62
+ state: string;
63
+ /** Workflow state type, e.g. `backlog` / `unstarted` / `started` / `triage`. */
64
+ stateType: string;
65
+ priorityLabel: string;
66
+ assignee: string | null;
67
+ team: string | null;
68
+ labels: string[];
69
+ createdAt: string;
70
+ updatedAt: string;
71
+ }
72
+ export interface LinearIssuePage {
73
+ issues: LinearIssue[];
74
+ /** Opaque cursor for the next page, or `null` on the last page. */
75
+ nextCursor: string | null;
76
+ }
77
+ export interface LinearProjectTeam {
78
+ id: string;
79
+ /** Short team key, e.g. `ENG`. */
80
+ key: string;
81
+ name: string;
82
+ }
83
+ export interface LinearProject {
84
+ id: string;
85
+ name: string;
86
+ /** Project state, e.g. `planned` / `started` / `paused` / `completed`. */
87
+ state: string;
88
+ /** Teams the project belongs to (the Settings picker groups by these). */
89
+ teams: LinearProjectTeam[];
90
+ }
91
+ export interface LinearIssueComment {
92
+ author: string | null;
93
+ body: string;
94
+ createdAt: string;
95
+ }
96
+ /** Full issue payload for agent context: everything in {@link LinearIssue} plus description and discussion. */
97
+ export interface LinearIssueDetail extends LinearIssue {
98
+ /** Markdown body of the issue, or `null` when empty. */
99
+ description: string | null;
100
+ /** Discussion comments, oldest first. */
101
+ comments: LinearIssueComment[];
102
+ }
103
+ /** The comment created by {@link LinearIntegration.createIssueComment}. */
104
+ export interface LinearCreatedComment {
105
+ id: string;
106
+ url: string;
107
+ }
108
+ /** Thrown when the org's Linear authorization can no longer be renewed. */
109
+ export declare class LinearReauthRequiredError extends Error {
110
+ constructor();
111
+ }
112
+ /** Cached result of {@link LinearIntegration.checkConnection}. */
113
+ export interface LinearConnectionCheck {
114
+ connected: boolean;
115
+ /** Whether the granted OAuth scope allows posting issue comments. */
116
+ canComment: boolean;
117
+ checkedAt: number;
118
+ }
119
+ export declare class LinearIntegration implements FactoryIntegration {
120
+ #private;
121
+ /** Stable integration identifier (see `../base.ts`). */
122
+ readonly id = "linear";
123
+ /** Bind Linear's slice of the generic integration storage, the projects domain, and the host auth seam. */
124
+ initialize({ storage, projects, auth, }: {
125
+ storage: IntegrationStorageHandle;
126
+ projects: FactoryProjectsStorage;
127
+ auth: RouteAuth;
128
+ }): void;
129
+ get storage(): LinearStorageHandle;
130
+ /** Factory projects domain — maps a session's resourceId to its owning org. */
131
+ get projects(): FactoryProjectsStorage;
132
+ /**
133
+ * Whether the host runs with web auth enabled. Linear connections are
134
+ * org-owned, so every Linear surface is inert without a tenant auth seam.
135
+ */
136
+ get authEnabled(): boolean;
137
+ /** Load the org's Linear connection, or `null` when not connected. */
138
+ loadConnection(orgId: string): Promise<LinearConnectionRow | null>;
139
+ /** Insert or replace the org's connection (one per org). */
140
+ upsertConnection(input: UpsertLinearConnectionInput): Promise<void>;
141
+ /**
142
+ * Whether the connection's token can post issue comments. Legacy rows
143
+ * without a recorded scope were minted with `read` only, so they count as
144
+ * read-only until the org reconnects Linear.
145
+ */
146
+ canPostComments(connection: LinearConnectionRow): boolean;
147
+ /**
148
+ * Return a usable access token for the connection, proactively refreshing
149
+ * it when the recorded expiry is past (or imminent). Throws
150
+ * `LinearReauthRequiredError` when the token is expired and cannot be
151
+ * refreshed — the org has to go through the OAuth flow again.
152
+ */
153
+ getFreshAccessToken(connection: LinearConnectionRow): Promise<string>;
154
+ /**
155
+ * Whether the org has an active connection and whether its granted scope
156
+ * allows posting comments. Cached per org with a short TTL — tool-set
157
+ * resolution runs on every request.
158
+ */
159
+ checkConnection(orgId: string): Promise<LinearConnectionCheck>;
160
+ /**
161
+ * Drop the cached connection check for an org. Called after a connection is
162
+ * persisted so the tools show up on the very next run instead of after the
163
+ * TTL lapses.
164
+ */
165
+ invalidateConnectionCache(orgId: string): void;
166
+ /** Map a session's resourceId to its owning org, or `null` when it isn't a project. */
167
+ resolveOrgId(resourceId: string): Promise<string | null>;
168
+ /** Test hook: clear the org/connection caches between specs. */
169
+ clearCaches(): void;
170
+ readonly intake: Intake;
171
+ /**
172
+ * The OAuth connect/callback flow round-trips a signed `state` through
173
+ * Linear, so a multi-replica deploy needs a deployment-stable state secret.
174
+ */
175
+ readonly requiresStableStateSigner = true;
176
+ constructor(config: LinearIntegrationConfig);
177
+ /**
178
+ * Build the OAuth authorize URL. `prompt=consent` forces the workspace
179
+ * picker even for an already-authorized user, so "reconnect" can switch
180
+ * workspaces.
181
+ */
182
+ buildAuthorizeUrl(state: string, redirectUri: string): string;
183
+ /** Exchange an OAuth `code` for a workspace-scoped token set. */
184
+ exchangeOAuthCode(code: string, redirectUri: string): Promise<LinearTokenSet>;
185
+ /**
186
+ * Exchange a refresh token for a new token set. Linear rotates refresh
187
+ * tokens, so the returned set replaces the stored one entirely. A 400/401
188
+ * here means the refresh token is invalid/revoked and the org must
189
+ * re-authorize.
190
+ */
191
+ refreshAccessToken(refreshToken: string): Promise<LinearTokenSet>;
192
+ /** Fetch the workspace (organization) the access token is scoped to. */
193
+ fetchWorkspace(accessToken: string): Promise<LinearWorkspace>;
194
+ /** List the workspace's projects (for the Settings intake-source picker). */
195
+ listProjects(accessToken: string): Promise<LinearProject[]>;
196
+ /**
197
+ * List one page of the workspace's active issues (triage/backlog/unstarted/
198
+ * started — completed and canceled are excluded), most recently updated
199
+ * first. When `projectIds` is provided, only issues from those projects are
200
+ * returned.
201
+ */
202
+ listActiveIssues(accessToken: string, after?: string, projectIds?: string[], labels?: string[]): Promise<LinearIssuePage>;
203
+ /**
204
+ * Fetch one issue with its description and comments. `idOrIdentifier`
205
+ * accepts both the Linear UUID and the human key (`ENG-123`). Returns
206
+ * `null` when the issue doesn't exist (Linear reports it as an "Entity not
207
+ * found" error).
208
+ */
209
+ fetchIssueDetail(accessToken: string, idOrIdentifier: string): Promise<LinearIssueDetail | null>;
210
+ /**
211
+ * Post a comment on an issue. `idOrIdentifier` accepts both the Linear UUID
212
+ * and the human key (`ENG-123`) — the identifier is resolved to a UUID
213
+ * first because `commentCreate` only accepts UUIDs. Returns `null` when the
214
+ * issue doesn't exist.
215
+ */
216
+ createIssueComment(accessToken: string, idOrIdentifier: string, body: string): Promise<LinearCreatedComment | null>;
217
+ /**
218
+ * The integration's HTTP surface: `/web/linear/*` + `/auth/linear/*` Mastra
219
+ * `apiRoutes` (status, OAuth connect/callback, projects + issues for
220
+ * Intake). Handlers operate on this instance.
221
+ */
222
+ routes(ctx: IntegrationContext): ApiRoute[];
223
+ /**
224
+ * Org-scoped agent tools: issue detail + comment tools for sessions whose
225
+ * project belongs to an org with an active Linear connection.
226
+ */
227
+ agentTools(args: {
228
+ requestContext: RequestContext;
229
+ }): Promise<IntegrationTools>;
230
+ /** Non-secret config snapshot for system diagnostics/startup logs. */
231
+ diagnostics(): Record<string, unknown>;
232
+ }
233
+ //# sourceMappingURL=integration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../../src/integrations/linear/integration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,KAAK,EAGV,MAAM,EAKP,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAC3F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAI3F,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAM1G,6EAA6E;AAC7E,MAAM,WAAW,uBAAuB;IACtC,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;GA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