patchwork-os 0.2.0-alpha.2 → 0.2.0-alpha.22

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 (281) hide show
  1. package/README.bridge.md +6 -0
  2. package/README.md +40 -15
  3. package/deploy/bootstrap-vps.sh +184 -0
  4. package/dist/approvalHttp.d.ts +11 -2
  5. package/dist/approvalHttp.js +98 -10
  6. package/dist/approvalHttp.js.map +1 -1
  7. package/dist/approvalQueue.d.ts +12 -1
  8. package/dist/approvalQueue.js +25 -3
  9. package/dist/approvalQueue.js.map +1 -1
  10. package/dist/automation.d.ts +20 -0
  11. package/dist/automation.js +35 -0
  12. package/dist/automation.js.map +1 -1
  13. package/dist/bridge.js +145 -23
  14. package/dist/bridge.js.map +1 -1
  15. package/dist/bridgeToken.js +57 -19
  16. package/dist/bridgeToken.js.map +1 -1
  17. package/dist/claudeDriver.d.ts +3 -1
  18. package/dist/claudeDriver.js +48 -0
  19. package/dist/claudeDriver.js.map +1 -1
  20. package/dist/claudeOrchestrator.d.ts +1 -1
  21. package/dist/claudeOrchestrator.js +14 -8
  22. package/dist/claudeOrchestrator.js.map +1 -1
  23. package/dist/commands/launchd.d.ts +2 -0
  24. package/dist/commands/launchd.js +94 -0
  25. package/dist/commands/launchd.js.map +1 -0
  26. package/dist/commands/recipe.d.ts +256 -0
  27. package/dist/commands/recipe.js +1313 -0
  28. package/dist/commands/recipe.js.map +1 -0
  29. package/dist/config.d.ts +15 -2
  30. package/dist/config.js +94 -8
  31. package/dist/config.js.map +1 -1
  32. package/dist/connectors/baseConnector.d.ts +117 -0
  33. package/dist/connectors/baseConnector.js +213 -0
  34. package/dist/connectors/baseConnector.js.map +1 -0
  35. package/dist/connectors/confluence.d.ts +111 -0
  36. package/dist/connectors/confluence.js +406 -0
  37. package/dist/connectors/confluence.js.map +1 -0
  38. package/dist/connectors/fixtureLibrary.d.ts +21 -0
  39. package/dist/connectors/fixtureLibrary.js +70 -0
  40. package/dist/connectors/fixtureLibrary.js.map +1 -0
  41. package/dist/connectors/fixtureRecorder.d.ts +1 -0
  42. package/dist/connectors/fixtureRecorder.js +35 -0
  43. package/dist/connectors/fixtureRecorder.js.map +1 -0
  44. package/dist/connectors/github.d.ts +58 -8
  45. package/dist/connectors/github.js +312 -84
  46. package/dist/connectors/github.js.map +1 -1
  47. package/dist/connectors/gmail.d.ts +4 -1
  48. package/dist/connectors/gmail.js +93 -16
  49. package/dist/connectors/gmail.js.map +1 -1
  50. package/dist/connectors/googleCalendar.d.ts +60 -0
  51. package/dist/connectors/googleCalendar.js +345 -0
  52. package/dist/connectors/googleCalendar.js.map +1 -0
  53. package/dist/connectors/jira.d.ts +98 -0
  54. package/dist/connectors/jira.js +379 -0
  55. package/dist/connectors/jira.js.map +1 -0
  56. package/dist/connectors/linear.d.ts +117 -0
  57. package/dist/connectors/linear.js +239 -0
  58. package/dist/connectors/linear.js.map +1 -0
  59. package/dist/connectors/mcpClient.d.ts +56 -0
  60. package/dist/connectors/mcpClient.js +189 -0
  61. package/dist/connectors/mcpClient.js.map +1 -0
  62. package/dist/connectors/mcpOAuth.d.ts +84 -0
  63. package/dist/connectors/mcpOAuth.js +389 -0
  64. package/dist/connectors/mcpOAuth.js.map +1 -0
  65. package/dist/connectors/mockConnector.d.ts +28 -0
  66. package/dist/connectors/mockConnector.js +81 -0
  67. package/dist/connectors/mockConnector.js.map +1 -0
  68. package/dist/connectors/notion.d.ts +143 -0
  69. package/dist/connectors/notion.js +424 -0
  70. package/dist/connectors/notion.js.map +1 -0
  71. package/dist/connectors/sentry.d.ts +43 -0
  72. package/dist/connectors/sentry.js +188 -0
  73. package/dist/connectors/sentry.js.map +1 -0
  74. package/dist/connectors/slack.d.ts +50 -0
  75. package/dist/connectors/slack.js +324 -0
  76. package/dist/connectors/slack.js.map +1 -0
  77. package/dist/connectors/tokenStorage.d.ts +35 -0
  78. package/dist/connectors/tokenStorage.js +394 -0
  79. package/dist/connectors/tokenStorage.js.map +1 -0
  80. package/dist/connectors/zendesk.d.ts +104 -0
  81. package/dist/connectors/zendesk.js +424 -0
  82. package/dist/connectors/zendesk.js.map +1 -0
  83. package/dist/drivers/claude/api.d.ts +11 -0
  84. package/dist/drivers/claude/api.js +54 -0
  85. package/dist/drivers/claude/api.js.map +1 -0
  86. package/dist/drivers/claude/envSanitizer.d.ts +7 -0
  87. package/dist/drivers/claude/envSanitizer.js +18 -0
  88. package/dist/drivers/claude/envSanitizer.js.map +1 -0
  89. package/dist/drivers/claude/streamParser.d.ts +38 -0
  90. package/dist/drivers/claude/streamParser.js +34 -0
  91. package/dist/drivers/claude/streamParser.js.map +1 -0
  92. package/dist/drivers/claude/subprocess.d.ts +19 -0
  93. package/dist/drivers/claude/subprocess.js +216 -0
  94. package/dist/drivers/claude/subprocess.js.map +1 -0
  95. package/dist/drivers/claude/subprocessSettings.d.ts +9 -0
  96. package/dist/drivers/claude/subprocessSettings.js +55 -0
  97. package/dist/drivers/claude/subprocessSettings.js.map +1 -0
  98. package/dist/drivers/gemini/index.d.ts +18 -0
  99. package/dist/drivers/gemini/index.js +210 -0
  100. package/dist/drivers/gemini/index.js.map +1 -0
  101. package/dist/drivers/grok/index.d.ts +11 -0
  102. package/dist/drivers/grok/index.js +22 -0
  103. package/dist/drivers/grok/index.js.map +1 -0
  104. package/dist/drivers/index.d.ts +23 -0
  105. package/dist/drivers/index.js +31 -0
  106. package/dist/drivers/index.js.map +1 -0
  107. package/dist/drivers/openai/index.d.ts +24 -0
  108. package/dist/drivers/openai/index.js +110 -0
  109. package/dist/drivers/openai/index.js.map +1 -0
  110. package/dist/drivers/types.d.ts +72 -0
  111. package/dist/drivers/types.js +30 -0
  112. package/dist/drivers/types.js.map +1 -0
  113. package/dist/featureFlags.d.ts +73 -0
  114. package/dist/featureFlags.js +203 -0
  115. package/dist/featureFlags.js.map +1 -0
  116. package/dist/fp/automationInterpreter.js +1 -0
  117. package/dist/fp/automationInterpreter.js.map +1 -1
  118. package/dist/fp/automationProgram.d.ts +1 -1
  119. package/dist/fp/automationProgram.js.map +1 -1
  120. package/dist/fp/policyParser.js +17 -0
  121. package/dist/fp/policyParser.js.map +1 -1
  122. package/dist/index.js +543 -37
  123. package/dist/index.js.map +1 -1
  124. package/dist/installGuard.d.ts +25 -0
  125. package/dist/installGuard.js +48 -0
  126. package/dist/installGuard.js.map +1 -0
  127. package/dist/oauth.d.ts +4 -1
  128. package/dist/oauth.js +50 -14
  129. package/dist/oauth.js.map +1 -1
  130. package/dist/patchworkConfig.d.ts +9 -0
  131. package/dist/patchworkConfig.js.map +1 -1
  132. package/dist/recipes/chainedRunner.d.ts +104 -0
  133. package/dist/recipes/chainedRunner.js +359 -0
  134. package/dist/recipes/chainedRunner.js.map +1 -0
  135. package/dist/recipes/dependencyGraph.d.ts +39 -0
  136. package/dist/recipes/dependencyGraph.js +199 -0
  137. package/dist/recipes/dependencyGraph.js.map +1 -0
  138. package/dist/recipes/legacyRecipeCompat.d.ts +1 -0
  139. package/dist/recipes/legacyRecipeCompat.js +97 -0
  140. package/dist/recipes/legacyRecipeCompat.js.map +1 -0
  141. package/dist/recipes/nestedRecipeStep.d.ts +58 -0
  142. package/dist/recipes/nestedRecipeStep.js +95 -0
  143. package/dist/recipes/nestedRecipeStep.js.map +1 -0
  144. package/dist/recipes/outputRegistry.d.ts +28 -0
  145. package/dist/recipes/outputRegistry.js +52 -0
  146. package/dist/recipes/outputRegistry.js.map +1 -0
  147. package/dist/recipes/scheduler.d.ts +23 -7
  148. package/dist/recipes/scheduler.js +135 -41
  149. package/dist/recipes/scheduler.js.map +1 -1
  150. package/dist/recipes/schemaGenerator.d.ts +28 -0
  151. package/dist/recipes/schemaGenerator.js +484 -0
  152. package/dist/recipes/schemaGenerator.js.map +1 -0
  153. package/dist/recipes/templateEngine.d.ts +62 -0
  154. package/dist/recipes/templateEngine.js +182 -0
  155. package/dist/recipes/templateEngine.js.map +1 -0
  156. package/dist/recipes/toolRegistry.d.ts +181 -0
  157. package/dist/recipes/toolRegistry.js +300 -0
  158. package/dist/recipes/toolRegistry.js.map +1 -0
  159. package/dist/recipes/tools/calendar.d.ts +6 -0
  160. package/dist/recipes/tools/calendar.js +61 -0
  161. package/dist/recipes/tools/calendar.js.map +1 -0
  162. package/dist/recipes/tools/confluence.d.ts +6 -0
  163. package/dist/recipes/tools/confluence.js +254 -0
  164. package/dist/recipes/tools/confluence.js.map +1 -0
  165. package/dist/recipes/tools/diagnostics.d.ts +6 -0
  166. package/dist/recipes/tools/diagnostics.js +36 -0
  167. package/dist/recipes/tools/diagnostics.js.map +1 -0
  168. package/dist/recipes/tools/file.d.ts +6 -0
  169. package/dist/recipes/tools/file.js +170 -0
  170. package/dist/recipes/tools/file.js.map +1 -0
  171. package/dist/recipes/tools/git.d.ts +6 -0
  172. package/dist/recipes/tools/git.js +63 -0
  173. package/dist/recipes/tools/git.js.map +1 -0
  174. package/dist/recipes/tools/github.d.ts +6 -0
  175. package/dist/recipes/tools/github.js +91 -0
  176. package/dist/recipes/tools/github.js.map +1 -0
  177. package/dist/recipes/tools/gmail.d.ts +6 -0
  178. package/dist/recipes/tools/gmail.js +210 -0
  179. package/dist/recipes/tools/gmail.js.map +1 -0
  180. package/dist/recipes/tools/index.d.ts +18 -0
  181. package/dist/recipes/tools/index.js +21 -0
  182. package/dist/recipes/tools/index.js.map +1 -0
  183. package/dist/recipes/tools/linear.d.ts +6 -0
  184. package/dist/recipes/tools/linear.js +83 -0
  185. package/dist/recipes/tools/linear.js.map +1 -0
  186. package/dist/recipes/tools/notion.d.ts +6 -0
  187. package/dist/recipes/tools/notion.js +278 -0
  188. package/dist/recipes/tools/notion.js.map +1 -0
  189. package/dist/recipes/tools/slack.d.ts +6 -0
  190. package/dist/recipes/tools/slack.js +72 -0
  191. package/dist/recipes/tools/slack.js.map +1 -0
  192. package/dist/recipes/tools/zendesk.d.ts +6 -0
  193. package/dist/recipes/tools/zendesk.js +245 -0
  194. package/dist/recipes/tools/zendesk.js.map +1 -0
  195. package/dist/recipes/yamlRunner.d.ts +79 -0
  196. package/dist/recipes/yamlRunner.js +612 -346
  197. package/dist/recipes/yamlRunner.js.map +1 -1
  198. package/dist/recipesHttp.d.ts +14 -1
  199. package/dist/recipesHttp.js +21 -4
  200. package/dist/recipesHttp.js.map +1 -1
  201. package/dist/riskTier.js +1 -0
  202. package/dist/riskTier.js.map +1 -1
  203. package/dist/runLog.d.ts +23 -0
  204. package/dist/runLog.js +56 -1
  205. package/dist/runLog.js.map +1 -1
  206. package/dist/server.d.ts +19 -1
  207. package/dist/server.js +682 -31
  208. package/dist/server.js.map +1 -1
  209. package/dist/streamableHttp.js +2 -0
  210. package/dist/streamableHttp.js.map +1 -1
  211. package/dist/tools/addLinearComment.d.ts +55 -0
  212. package/dist/tools/addLinearComment.js +72 -0
  213. package/dist/tools/addLinearComment.js.map +1 -0
  214. package/dist/tools/bridgeDoctor.js +2 -2
  215. package/dist/tools/bridgeDoctor.js.map +1 -1
  216. package/dist/tools/createLinearIssue.d.ts +84 -0
  217. package/dist/tools/createLinearIssue.js +146 -0
  218. package/dist/tools/createLinearIssue.js.map +1 -0
  219. package/dist/tools/ctxGetTaskContext.d.ts +4 -1
  220. package/dist/tools/ctxGetTaskContext.js +45 -2
  221. package/dist/tools/ctxGetTaskContext.js.map +1 -1
  222. package/dist/tools/fetchCalendarEvents.d.ts +94 -0
  223. package/dist/tools/fetchCalendarEvents.js +97 -0
  224. package/dist/tools/fetchCalendarEvents.js.map +1 -0
  225. package/dist/tools/fetchGithubIssue.d.ts +80 -0
  226. package/dist/tools/fetchGithubIssue.js +84 -0
  227. package/dist/tools/fetchGithubIssue.js.map +1 -0
  228. package/dist/tools/fetchGithubPR.d.ts +89 -0
  229. package/dist/tools/fetchGithubPR.js +96 -0
  230. package/dist/tools/fetchGithubPR.js.map +1 -0
  231. package/dist/tools/fetchLinearIssue.d.ts +112 -0
  232. package/dist/tools/fetchLinearIssue.js +129 -0
  233. package/dist/tools/fetchLinearIssue.js.map +1 -0
  234. package/dist/tools/fetchSentryIssue.d.ts +143 -0
  235. package/dist/tools/fetchSentryIssue.js +150 -0
  236. package/dist/tools/fetchSentryIssue.js.map +1 -0
  237. package/dist/tools/fetchSlackProfile.d.ts +43 -0
  238. package/dist/tools/fetchSlackProfile.js +46 -0
  239. package/dist/tools/fetchSlackProfile.js.map +1 -0
  240. package/dist/tools/getConnectorStatus.d.ts +58 -0
  241. package/dist/tools/getConnectorStatus.js +56 -0
  242. package/dist/tools/getConnectorStatus.js.map +1 -0
  243. package/dist/tools/github/actions.js +4 -2
  244. package/dist/tools/github/actions.js.map +1 -1
  245. package/dist/tools/github/composite.d.ts +339 -0
  246. package/dist/tools/github/composite.js +343 -0
  247. package/dist/tools/github/composite.js.map +1 -0
  248. package/dist/tools/github/index.d.ts +2 -1
  249. package/dist/tools/github/index.js +2 -1
  250. package/dist/tools/github/index.js.map +1 -1
  251. package/dist/tools/github/issues.js +8 -4
  252. package/dist/tools/github/issues.js.map +1 -1
  253. package/dist/tools/github/pr.d.ts +122 -0
  254. package/dist/tools/github/pr.js +195 -5
  255. package/dist/tools/github/pr.js.map +1 -1
  256. package/dist/tools/index.js +36 -1
  257. package/dist/tools/index.js.map +1 -1
  258. package/dist/tools/searchTools.js +1 -1
  259. package/dist/tools/searchTools.js.map +1 -1
  260. package/dist/tools/slackListChannels.d.ts +65 -0
  261. package/dist/tools/slackListChannels.js +70 -0
  262. package/dist/tools/slackListChannels.js.map +1 -0
  263. package/dist/tools/slackPostMessage.d.ts +57 -0
  264. package/dist/tools/slackPostMessage.js +77 -0
  265. package/dist/tools/slackPostMessage.js.map +1 -0
  266. package/dist/tools/updateLinearIssue.d.ts +89 -0
  267. package/dist/tools/updateLinearIssue.js +117 -0
  268. package/dist/tools/updateLinearIssue.js.map +1 -0
  269. package/dist/transport.d.ts +7 -1
  270. package/dist/transport.js +85 -11
  271. package/dist/transport.js.map +1 -1
  272. package/package.json +4 -2
  273. package/scripts/start-all.sh +56 -19
  274. package/templates/automation-policies/recipe-authoring.json +25 -0
  275. package/templates/automation-policy.example.json +6 -0
  276. package/templates/co.patchwork-os.bridge.plist +34 -0
  277. package/templates/recipes/ctx-loop-test.yaml +75 -0
  278. package/templates/recipes/lint-on-save.yaml +1 -2
  279. package/templates/recipes/morning-brief-slack.yaml +57 -0
  280. package/templates/recipes/morning-brief.yaml +21 -5
  281. package/templates/recipes/sentry-to-linear.yaml +77 -0
@@ -0,0 +1,129 @@
1
+ import { fetchIssue } from "../connectors/linear.js";
2
+ import { requireString, successStructured } from "./utils.js";
3
+ /**
4
+ * fetchLinearIssue — fetch a Linear issue by ID or URL.
5
+ *
6
+ * Returns title, description, state, assignee, labels, priority, and URL
7
+ * in a single call. Requires Linear connector to be connected.
8
+ */
9
+ export function createFetchLinearIssueTool() {
10
+ return {
11
+ schema: {
12
+ name: "fetchLinearIssue",
13
+ description: "Fetch a Linear issue by identifier or URL. Returns title, description, state, assignee, labels, and priority. Requires Linear connector connected.",
14
+ annotations: { readOnlyHint: true },
15
+ inputSchema: {
16
+ type: "object",
17
+ required: ["issueId"],
18
+ properties: {
19
+ issueId: {
20
+ type: "string",
21
+ description: "Linear issue identifier (e.g. 'LIN-42', 'TEAM-123') or full issue URL.",
22
+ maxLength: 500,
23
+ },
24
+ },
25
+ additionalProperties: false,
26
+ },
27
+ outputSchema: {
28
+ type: "object",
29
+ properties: {
30
+ id: { type: "string" },
31
+ identifier: { type: "string" },
32
+ title: { type: "string" },
33
+ description: { type: ["string", "null"] },
34
+ state: {
35
+ type: "object",
36
+ properties: {
37
+ name: { type: "string" },
38
+ type: { type: "string" },
39
+ },
40
+ required: ["name", "type"],
41
+ },
42
+ assignee: {
43
+ type: ["object", "null"],
44
+ properties: {
45
+ name: { type: "string" },
46
+ email: { type: "string" },
47
+ },
48
+ },
49
+ priority: { type: "integer" },
50
+ priorityLabel: { type: "string" },
51
+ url: { type: "string" },
52
+ team: {
53
+ type: "object",
54
+ properties: {
55
+ name: { type: "string" },
56
+ key: { type: "string" },
57
+ },
58
+ required: ["name", "key"],
59
+ },
60
+ labels: {
61
+ type: "array",
62
+ items: { type: "string" },
63
+ },
64
+ createdAt: { type: "string" },
65
+ updatedAt: { type: "string" },
66
+ linearConnected: { type: "boolean" },
67
+ },
68
+ required: [
69
+ "id",
70
+ "identifier",
71
+ "title",
72
+ "state",
73
+ "priority",
74
+ "priorityLabel",
75
+ "url",
76
+ "team",
77
+ "labels",
78
+ "createdAt",
79
+ "updatedAt",
80
+ "linearConnected",
81
+ ],
82
+ },
83
+ },
84
+ timeoutMs: 15_000,
85
+ async handler(args, signal) {
86
+ const issueId = requireString(args, "issueId", 500);
87
+ try {
88
+ const issue = await fetchIssue(issueId, signal);
89
+ return successStructured({
90
+ id: issue.id,
91
+ identifier: issue.identifier,
92
+ title: issue.title,
93
+ description: issue.description ?? null,
94
+ state: issue.state,
95
+ assignee: issue.assignee ?? null,
96
+ priority: issue.priority,
97
+ priorityLabel: issue.priorityLabel,
98
+ url: issue.url,
99
+ team: issue.team,
100
+ labels: issue.labels.nodes.map((l) => l.name),
101
+ createdAt: issue.createdAt,
102
+ updatedAt: issue.updatedAt,
103
+ linearConnected: true,
104
+ });
105
+ }
106
+ catch (err) {
107
+ const notConnected = err instanceof Error && err.message.includes("not connected");
108
+ return successStructured({
109
+ id: "",
110
+ identifier: issueId,
111
+ title: "",
112
+ description: null,
113
+ state: { name: "", type: "" },
114
+ assignee: null,
115
+ priority: 0,
116
+ priorityLabel: "",
117
+ url: "",
118
+ team: { name: "", key: "" },
119
+ labels: [],
120
+ createdAt: "",
121
+ updatedAt: "",
122
+ linearConnected: !notConnected,
123
+ error: err instanceof Error ? err.message : String(err),
124
+ });
125
+ }
126
+ },
127
+ };
128
+ }
129
+ //# sourceMappingURL=fetchLinearIssue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchLinearIssue.js","sourceRoot":"","sources":["../../src/tools/fetchLinearIssue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBA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CAAC,CAAC;YACL,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,143 @@
1
+ /**
2
+ * fetchSentryIssue — fetch a Sentry issue/event and enrich its stack trace
3
+ * with git blame data in one call.
4
+ *
5
+ * Combines:
6
+ * 1. Sentry API fetch → raw stack trace text
7
+ * 2. enrichStackTrace → per-frame commit attribution + top suspect
8
+ *
9
+ * Requires Sentry connector to be connected (POST /connections/sentry/connect).
10
+ */
11
+ export declare function createFetchSentryIssueTool(workspace: string): {
12
+ schema: {
13
+ name: string;
14
+ description: string;
15
+ annotations: {
16
+ readOnlyHint: boolean;
17
+ };
18
+ inputSchema: {
19
+ type: "object";
20
+ required: string[];
21
+ properties: {
22
+ issueId: {
23
+ type: string;
24
+ description: string;
25
+ maxLength: number;
26
+ };
27
+ maxFrames: {
28
+ type: string;
29
+ minimum: number;
30
+ maximum: number;
31
+ description: string;
32
+ };
33
+ };
34
+ additionalProperties: false;
35
+ };
36
+ outputSchema: {
37
+ type: "object";
38
+ properties: {
39
+ issueId: {
40
+ type: string;
41
+ };
42
+ title: {
43
+ type: string;
44
+ };
45
+ stackTrace: {
46
+ type: string;
47
+ };
48
+ frames: {
49
+ type: string;
50
+ items: {
51
+ type: string;
52
+ properties: {
53
+ file: {
54
+ type: string;
55
+ };
56
+ line: {
57
+ type: string;
58
+ };
59
+ column: {
60
+ type: string[];
61
+ };
62
+ function: {
63
+ type: string[];
64
+ };
65
+ language: {
66
+ type: string;
67
+ };
68
+ inWorkspace: {
69
+ type: string;
70
+ };
71
+ resolvedPath: {
72
+ type: string[];
73
+ };
74
+ commit: {
75
+ type: string[];
76
+ properties: {
77
+ sha: {
78
+ type: string;
79
+ };
80
+ author: {
81
+ type: string;
82
+ };
83
+ date: {
84
+ type: string;
85
+ };
86
+ subject: {
87
+ type: string;
88
+ };
89
+ };
90
+ };
91
+ };
92
+ required: string[];
93
+ };
94
+ };
95
+ topSuspect: {
96
+ type: string[];
97
+ properties: {
98
+ sha: {
99
+ type: string;
100
+ };
101
+ author: {
102
+ type: string;
103
+ };
104
+ date: {
105
+ type: string;
106
+ };
107
+ subject: {
108
+ type: string;
109
+ };
110
+ frameCount: {
111
+ type: string;
112
+ };
113
+ };
114
+ };
115
+ confidence: {
116
+ type: string;
117
+ enum: string[];
118
+ };
119
+ framesParsed: {
120
+ type: string;
121
+ };
122
+ framesBlamed: {
123
+ type: string;
124
+ };
125
+ gitAvailable: {
126
+ type: string;
127
+ };
128
+ sentryConnected: {
129
+ type: string;
130
+ };
131
+ };
132
+ required: string[];
133
+ };
134
+ };
135
+ timeoutMs: number;
136
+ handler(args: Record<string, unknown>, signal?: AbortSignal): Promise<{
137
+ content: Array<{
138
+ type: string;
139
+ text: string;
140
+ }>;
141
+ structuredContent: unknown;
142
+ }>;
143
+ };
@@ -0,0 +1,150 @@
1
+ import { fetchIssueStackTrace } from "../connectors/sentry.js";
2
+ import { createEnrichStackTraceTool } from "./enrichStackTrace.js";
3
+ import { optionalInt, requireString, successStructured } from "./utils.js";
4
+ /**
5
+ * fetchSentryIssue — fetch a Sentry issue/event and enrich its stack trace
6
+ * with git blame data in one call.
7
+ *
8
+ * Combines:
9
+ * 1. Sentry API fetch → raw stack trace text
10
+ * 2. enrichStackTrace → per-frame commit attribution + top suspect
11
+ *
12
+ * Requires Sentry connector to be connected (POST /connections/sentry/connect).
13
+ */
14
+ export function createFetchSentryIssueTool(workspace) {
15
+ const enrichTool = createEnrichStackTraceTool(workspace);
16
+ return {
17
+ schema: {
18
+ name: "fetchSentryIssue",
19
+ description: "Fetch a Sentry issue and enrich its stack trace with git blame. Returns per-frame commit attribution + top suspect commit. Requires Sentry connector connected.",
20
+ annotations: { readOnlyHint: true },
21
+ inputSchema: {
22
+ type: "object",
23
+ required: ["issueId"],
24
+ properties: {
25
+ issueId: {
26
+ type: "string",
27
+ description: "Sentry issue ID (e.g. '12345') or full issue URL (e.g. 'https://sentry.io/organizations/my-org/issues/12345/').",
28
+ maxLength: 500,
29
+ },
30
+ maxFrames: {
31
+ type: "integer",
32
+ minimum: 1,
33
+ maximum: 50,
34
+ description: "Max stack frames to blame. Default 10.",
35
+ },
36
+ },
37
+ additionalProperties: false,
38
+ },
39
+ outputSchema: {
40
+ type: "object",
41
+ properties: {
42
+ issueId: { type: "string" },
43
+ title: { type: "string" },
44
+ stackTrace: { type: "string" },
45
+ frames: {
46
+ type: "array",
47
+ items: {
48
+ type: "object",
49
+ properties: {
50
+ file: { type: "string" },
51
+ line: { type: "integer" },
52
+ column: { type: ["integer", "null"] },
53
+ function: { type: ["string", "null"] },
54
+ language: { type: "string" },
55
+ inWorkspace: { type: "boolean" },
56
+ resolvedPath: { type: ["string", "null"] },
57
+ commit: {
58
+ type: ["object", "null"],
59
+ properties: {
60
+ sha: { type: "string" },
61
+ author: { type: "string" },
62
+ date: { type: "string" },
63
+ subject: { type: "string" },
64
+ },
65
+ },
66
+ },
67
+ required: ["file", "line", "language", "inWorkspace"],
68
+ },
69
+ },
70
+ topSuspect: {
71
+ type: ["object", "null"],
72
+ properties: {
73
+ sha: { type: "string" },
74
+ author: { type: "string" },
75
+ date: { type: "string" },
76
+ subject: { type: "string" },
77
+ frameCount: { type: "integer" },
78
+ },
79
+ },
80
+ confidence: {
81
+ type: "string",
82
+ enum: ["high", "medium", "low"],
83
+ },
84
+ framesParsed: { type: "integer" },
85
+ framesBlamed: { type: "integer" },
86
+ gitAvailable: { type: "boolean" },
87
+ sentryConnected: { type: "boolean" },
88
+ },
89
+ required: [
90
+ "issueId",
91
+ "title",
92
+ "stackTrace",
93
+ "frames",
94
+ "confidence",
95
+ "framesParsed",
96
+ "framesBlamed",
97
+ "gitAvailable",
98
+ "sentryConnected",
99
+ ],
100
+ },
101
+ },
102
+ timeoutMs: 45_000,
103
+ async handler(args, signal) {
104
+ const issueId = requireString(args, "issueId", 500);
105
+ const maxFrames = optionalInt(args, "maxFrames", 1, 50) ?? 10;
106
+ let stackTrace;
107
+ let title;
108
+ let resolvedIssueId;
109
+ let sentryConnected = true;
110
+ try {
111
+ ({
112
+ stackTrace,
113
+ title,
114
+ issueId: resolvedIssueId,
115
+ } = await fetchIssueStackTrace(issueId, signal));
116
+ }
117
+ catch (err) {
118
+ sentryConnected = false;
119
+ return successStructured({
120
+ issueId,
121
+ title: "",
122
+ stackTrace: "",
123
+ frames: [],
124
+ topSuspect: null,
125
+ confidence: "low",
126
+ framesParsed: 0,
127
+ framesBlamed: 0,
128
+ gitAvailable: false,
129
+ sentryConnected,
130
+ error: err instanceof Error ? err.message : String(err),
131
+ });
132
+ }
133
+ // Re-use enrichStackTrace handler with the fetched stack trace
134
+ const enrichResult = await enrichTool.handler({ stackTrace, maxFrames }, signal);
135
+ // enrichResult is a McpToolResult — extract the structured content
136
+ const structured = enrichResult.structuredContent ??
137
+ (enrichResult.content?.[0]?.type === "text"
138
+ ? JSON.parse(enrichResult.content[0].text)
139
+ : {});
140
+ return successStructured({
141
+ issueId: resolvedIssueId,
142
+ title,
143
+ stackTrace,
144
+ sentryConnected,
145
+ ...structured,
146
+ });
147
+ },
148
+ };
149
+ }
150
+ //# sourceMappingURL=fetchSentryIssue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchSentryIssue.js","sourceRoot":"","sources":["../../src/tools/fetchSentryIssue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE3E;;;;;;;;;GASG;AACH,MAAM,UAAU,0BAA0B,CAAC,SAAiB;IAC1D,MAAM,UAAU,GAAG,0BAA0B,CAAC,SAAS,CAAC,CAAC;IAEzD,OAAO;QACL,MAAM,EAAE;YACN,IAAI,EAAE,kBAAkB;YACxB,WAAW,EACT,iKAAiK;YACnK,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;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AC,CAAC;YAEV,OAAO,iBAAiB,CAAC;gBACvB,OAAO,EAAE,eAAe;gBACxB,KAAK;gBACL,UAAU;gBACV,eAAe;gBACf,GAAI,UAAqB;aAC1B,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,43 @@
1
+ export declare function createFetchSlackProfileTool(): {
2
+ schema: {
3
+ name: string;
4
+ description: string;
5
+ annotations: {
6
+ readOnlyHint: boolean;
7
+ };
8
+ inputSchema: {
9
+ type: "object";
10
+ properties: {};
11
+ additionalProperties: false;
12
+ };
13
+ outputSchema: {
14
+ type: "object";
15
+ properties: {
16
+ teamId: {
17
+ type: string;
18
+ };
19
+ teamName: {
20
+ type: string;
21
+ };
22
+ botUserId: {
23
+ type: string;
24
+ };
25
+ slackConnected: {
26
+ type: string;
27
+ };
28
+ error: {
29
+ type: string;
30
+ };
31
+ };
32
+ required: string[];
33
+ };
34
+ };
35
+ timeoutMs: number;
36
+ handler(_args: Record<string, unknown>, _signal?: AbortSignal): Promise<{
37
+ content: Array<{
38
+ type: string;
39
+ text: string;
40
+ }>;
41
+ structuredContent: unknown;
42
+ }>;
43
+ };
@@ -0,0 +1,46 @@
1
+ import { getProfile, loadTokens } from "../connectors/slack.js";
2
+ import { successStructured } from "./utils.js";
3
+ export function createFetchSlackProfileTool() {
4
+ return {
5
+ schema: {
6
+ name: "fetchSlackProfile",
7
+ description: "Get the connected Slack workspace name, team ID, and bot user ID. Use to confirm Slack is connected.",
8
+ annotations: { readOnlyHint: true },
9
+ inputSchema: {
10
+ type: "object",
11
+ properties: {},
12
+ additionalProperties: false,
13
+ },
14
+ outputSchema: {
15
+ type: "object",
16
+ properties: {
17
+ teamId: { type: "string" },
18
+ teamName: { type: "string" },
19
+ botUserId: { type: "string" },
20
+ slackConnected: { type: "boolean" },
21
+ error: { type: "string" },
22
+ },
23
+ required: ["slackConnected"],
24
+ },
25
+ },
26
+ timeoutMs: 5_000,
27
+ async handler(_args, _signal) {
28
+ const tokens = loadTokens();
29
+ if (!tokens) {
30
+ return successStructured({
31
+ slackConnected: false,
32
+ error: "Slack not connected. GET /connections/slack/authorize first.",
33
+ });
34
+ }
35
+ const profile = getProfile();
36
+ if (!profile) {
37
+ return successStructured({
38
+ slackConnected: false,
39
+ error: "Could not load Slack profile.",
40
+ });
41
+ }
42
+ return successStructured({ ...profile, slackConnected: true });
43
+ },
44
+ };
45
+ }
46
+ //# sourceMappingURL=fetchSlackProfile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchSlackProfile.js","sourceRoot":"","sources":["../../src/tools/fetchSlackProfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,UAAU,2BAA2B;IACzC,OAAO;QACL,MAAM,EAAE;YACN,IAAI,EAAE,mBAAmB;YACzB,WAAW,EACT,sGAAsG;YACxG,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;YACnC,WAAW,EAAE;gBACX,IAAI,EAAE,QAAiB;gBACvB,UAAU,EAAE,EAAE;gBACd,oBAAoB,EAAE,KAAc;aACrC;YACD,YAAY,EAAE;gBACZ,IAAI,EAAE,QAAiB;gBACvB,UAAU,EAAE;oBACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBAC1B,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBAC5B,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBAC7B,cAAc,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;oBACnC,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;iBAC1B;gBACD,QAAQ,EAAE,CAAC,gBAAgB,CAAC;aAC7B;SACF;QACD,SAAS,EAAE,KAAK;QAChB,KAAK,CAAC,OAAO,CAAC,KAA8B,EAAE,OAAqB;YACjE,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;YAC5B,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO,iBAAiB,CAAC;oBACvB,cAAc,EAAE,KAAK;oBACrB,KAAK,EAAE,8DAA8D;iBACtE,CAAC,CAAC;YACL,CAAC;YACD,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;YAC7B,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,OAAO,iBAAiB,CAAC;oBACvB,cAAc,EAAE,KAAK;oBACrB,KAAK,EAAE,+BAA+B;iBACvC,CAAC,CAAC;YACL,CAAC;YACD,OAAO,iBAAiB,CAAC,EAAE,GAAG,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC;QACjE,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,58 @@
1
+ export declare function createGetConnectorStatusTool(): {
2
+ schema: {
3
+ name: string;
4
+ description: string;
5
+ annotations: {
6
+ readOnlyHint: boolean;
7
+ };
8
+ inputSchema: {
9
+ type: "object";
10
+ properties: {};
11
+ additionalProperties: false;
12
+ };
13
+ outputSchema: {
14
+ type: "object";
15
+ properties: {
16
+ connectors: {
17
+ type: string;
18
+ items: {
19
+ type: string;
20
+ properties: {
21
+ vendor: {
22
+ type: string;
23
+ };
24
+ connected: {
25
+ type: string;
26
+ };
27
+ expiresAt: {
28
+ type: string;
29
+ };
30
+ expiresInMs: {
31
+ type: string;
32
+ };
33
+ expiresInMinutes: {
34
+ type: string;
35
+ };
36
+ needsReauth: {
37
+ type: string;
38
+ };
39
+ profile: {
40
+ type: string;
41
+ };
42
+ };
43
+ required: string[];
44
+ };
45
+ };
46
+ };
47
+ required: string[];
48
+ };
49
+ };
50
+ timeoutMs: number;
51
+ handler(_args: Record<string, unknown>, _signal?: AbortSignal): Promise<{
52
+ content: Array<{
53
+ type: string;
54
+ text: string;
55
+ }>;
56
+ structuredContent: unknown;
57
+ }>;
58
+ };
@@ -0,0 +1,56 @@
1
+ import { getAllConnectorStatuses } from "../connectors/mcpOAuth.js";
2
+ import { successStructured } from "./utils.js";
3
+ export function createGetConnectorStatusTool() {
4
+ return {
5
+ schema: {
6
+ name: "getConnectorStatus",
7
+ description: "Returns the auth status of all MCP connectors (GitHub, Linear, Sentry). Shows whether each is connected, when the token expires, and whether re-authorization is needed.",
8
+ annotations: { readOnlyHint: true },
9
+ inputSchema: {
10
+ type: "object",
11
+ properties: {},
12
+ additionalProperties: false,
13
+ },
14
+ outputSchema: {
15
+ type: "object",
16
+ properties: {
17
+ connectors: {
18
+ type: "array",
19
+ items: {
20
+ type: "object",
21
+ properties: {
22
+ vendor: { type: "string" },
23
+ connected: { type: "boolean" },
24
+ expiresAt: { type: "number" },
25
+ expiresInMs: { type: "number" },
26
+ expiresInMinutes: { type: "number" },
27
+ needsReauth: { type: "boolean" },
28
+ profile: { type: "object" },
29
+ },
30
+ required: ["vendor", "connected", "needsReauth"],
31
+ },
32
+ },
33
+ },
34
+ required: ["connectors"],
35
+ },
36
+ },
37
+ timeoutMs: 5_000,
38
+ async handler(_args, _signal) {
39
+ const statuses = getAllConnectorStatuses();
40
+ return successStructured({
41
+ connectors: statuses.map((s) => ({
42
+ vendor: s.vendor,
43
+ connected: s.connected,
44
+ ...(s.expiresAt !== undefined && { expiresAt: s.expiresAt }),
45
+ ...(s.expiresInMs !== undefined && {
46
+ expiresInMs: s.expiresInMs,
47
+ expiresInMinutes: Math.round(s.expiresInMs / 60_000),
48
+ }),
49
+ needsReauth: s.needsReauth,
50
+ ...(s.profile && { profile: s.profile }),
51
+ })),
52
+ });
53
+ },
54
+ };
55
+ }
56
+ //# sourceMappingURL=getConnectorStatus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getConnectorStatus.js","sourceRoot":"","sources":["../../src/tools/getConnectorStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,MA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