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

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 (154) hide show
  1. package/README.bridge.md +6 -0
  2. package/README.md +13 -2
  3. package/dist/approvalHttp.d.ts +11 -2
  4. package/dist/approvalHttp.js +92 -9
  5. package/dist/approvalHttp.js.map +1 -1
  6. package/dist/approvalQueue.d.ts +12 -1
  7. package/dist/approvalQueue.js +25 -3
  8. package/dist/approvalQueue.js.map +1 -1
  9. package/dist/bridge.js +127 -23
  10. package/dist/bridge.js.map +1 -1
  11. package/dist/claudeDriver.d.ts +3 -1
  12. package/dist/claudeDriver.js +48 -0
  13. package/dist/claudeDriver.js.map +1 -1
  14. package/dist/claudeOrchestrator.d.ts +1 -1
  15. package/dist/claudeOrchestrator.js +14 -8
  16. package/dist/claudeOrchestrator.js.map +1 -1
  17. package/dist/commands/launchd.d.ts +2 -0
  18. package/dist/commands/launchd.js +94 -0
  19. package/dist/commands/launchd.js.map +1 -0
  20. package/dist/config.d.ts +7 -2
  21. package/dist/config.js +85 -8
  22. package/dist/config.js.map +1 -1
  23. package/dist/connectors/github.d.ts +58 -8
  24. package/dist/connectors/github.js +321 -84
  25. package/dist/connectors/github.js.map +1 -1
  26. package/dist/connectors/gmail.d.ts +4 -1
  27. package/dist/connectors/gmail.js +77 -16
  28. package/dist/connectors/gmail.js.map +1 -1
  29. package/dist/connectors/googleCalendar.d.ts +60 -0
  30. package/dist/connectors/googleCalendar.js +329 -0
  31. package/dist/connectors/googleCalendar.js.map +1 -0
  32. package/dist/connectors/linear.d.ts +117 -0
  33. package/dist/connectors/linear.js +248 -0
  34. package/dist/connectors/linear.js.map +1 -0
  35. package/dist/connectors/mcpClient.d.ts +56 -0
  36. package/dist/connectors/mcpClient.js +189 -0
  37. package/dist/connectors/mcpClient.js.map +1 -0
  38. package/dist/connectors/mcpOAuth.d.ts +83 -0
  39. package/dist/connectors/mcpOAuth.js +363 -0
  40. package/dist/connectors/mcpOAuth.js.map +1 -0
  41. package/dist/connectors/sentry.d.ts +43 -0
  42. package/dist/connectors/sentry.js +197 -0
  43. package/dist/connectors/sentry.js.map +1 -0
  44. package/dist/connectors/slack.d.ts +50 -0
  45. package/dist/connectors/slack.js +289 -0
  46. package/dist/connectors/slack.js.map +1 -0
  47. package/dist/drivers/claude/api.d.ts +11 -0
  48. package/dist/drivers/claude/api.js +54 -0
  49. package/dist/drivers/claude/api.js.map +1 -0
  50. package/dist/drivers/claude/envSanitizer.d.ts +7 -0
  51. package/dist/drivers/claude/envSanitizer.js +18 -0
  52. package/dist/drivers/claude/envSanitizer.js.map +1 -0
  53. package/dist/drivers/claude/streamParser.d.ts +38 -0
  54. package/dist/drivers/claude/streamParser.js +34 -0
  55. package/dist/drivers/claude/streamParser.js.map +1 -0
  56. package/dist/drivers/claude/subprocess.d.ts +19 -0
  57. package/dist/drivers/claude/subprocess.js +216 -0
  58. package/dist/drivers/claude/subprocess.js.map +1 -0
  59. package/dist/drivers/claude/subprocessSettings.d.ts +9 -0
  60. package/dist/drivers/claude/subprocessSettings.js +55 -0
  61. package/dist/drivers/claude/subprocessSettings.js.map +1 -0
  62. package/dist/drivers/gemini/index.d.ts +18 -0
  63. package/dist/drivers/gemini/index.js +210 -0
  64. package/dist/drivers/gemini/index.js.map +1 -0
  65. package/dist/drivers/grok/index.d.ts +11 -0
  66. package/dist/drivers/grok/index.js +22 -0
  67. package/dist/drivers/grok/index.js.map +1 -0
  68. package/dist/drivers/index.d.ts +23 -0
  69. package/dist/drivers/index.js +31 -0
  70. package/dist/drivers/index.js.map +1 -0
  71. package/dist/drivers/openai/index.d.ts +24 -0
  72. package/dist/drivers/openai/index.js +110 -0
  73. package/dist/drivers/openai/index.js.map +1 -0
  74. package/dist/drivers/types.d.ts +72 -0
  75. package/dist/drivers/types.js +30 -0
  76. package/dist/drivers/types.js.map +1 -0
  77. package/dist/index.js +35 -1
  78. package/dist/index.js.map +1 -1
  79. package/dist/installGuard.d.ts +25 -0
  80. package/dist/installGuard.js +48 -0
  81. package/dist/installGuard.js.map +1 -0
  82. package/dist/patchworkConfig.d.ts +9 -0
  83. package/dist/patchworkConfig.js.map +1 -1
  84. package/dist/recipes/scheduler.d.ts +23 -7
  85. package/dist/recipes/scheduler.js +135 -41
  86. package/dist/recipes/scheduler.js.map +1 -1
  87. package/dist/recipes/yamlRunner.d.ts +15 -0
  88. package/dist/recipes/yamlRunner.js +325 -26
  89. package/dist/recipes/yamlRunner.js.map +1 -1
  90. package/dist/recipesHttp.d.ts +14 -1
  91. package/dist/recipesHttp.js +21 -4
  92. package/dist/recipesHttp.js.map +1 -1
  93. package/dist/runLog.d.ts +5 -0
  94. package/dist/runLog.js +51 -1
  95. package/dist/runLog.js.map +1 -1
  96. package/dist/server.d.ts +15 -1
  97. package/dist/server.js +458 -31
  98. package/dist/server.js.map +1 -1
  99. package/dist/tools/addLinearComment.d.ts +55 -0
  100. package/dist/tools/addLinearComment.js +72 -0
  101. package/dist/tools/addLinearComment.js.map +1 -0
  102. package/dist/tools/bridgeDoctor.js +2 -2
  103. package/dist/tools/bridgeDoctor.js.map +1 -1
  104. package/dist/tools/createLinearIssue.d.ts +84 -0
  105. package/dist/tools/createLinearIssue.js +146 -0
  106. package/dist/tools/createLinearIssue.js.map +1 -0
  107. package/dist/tools/ctxGetTaskContext.d.ts +4 -1
  108. package/dist/tools/ctxGetTaskContext.js +45 -2
  109. package/dist/tools/ctxGetTaskContext.js.map +1 -1
  110. package/dist/tools/fetchCalendarEvents.d.ts +94 -0
  111. package/dist/tools/fetchCalendarEvents.js +97 -0
  112. package/dist/tools/fetchCalendarEvents.js.map +1 -0
  113. package/dist/tools/fetchGithubIssue.d.ts +80 -0
  114. package/dist/tools/fetchGithubIssue.js +84 -0
  115. package/dist/tools/fetchGithubIssue.js.map +1 -0
  116. package/dist/tools/fetchGithubPR.d.ts +89 -0
  117. package/dist/tools/fetchGithubPR.js +96 -0
  118. package/dist/tools/fetchGithubPR.js.map +1 -0
  119. package/dist/tools/fetchLinearIssue.d.ts +112 -0
  120. package/dist/tools/fetchLinearIssue.js +129 -0
  121. package/dist/tools/fetchLinearIssue.js.map +1 -0
  122. package/dist/tools/fetchSentryIssue.d.ts +143 -0
  123. package/dist/tools/fetchSentryIssue.js +150 -0
  124. package/dist/tools/fetchSentryIssue.js.map +1 -0
  125. package/dist/tools/fetchSlackProfile.d.ts +43 -0
  126. package/dist/tools/fetchSlackProfile.js +46 -0
  127. package/dist/tools/fetchSlackProfile.js.map +1 -0
  128. package/dist/tools/getConnectorStatus.d.ts +58 -0
  129. package/dist/tools/getConnectorStatus.js +56 -0
  130. package/dist/tools/getConnectorStatus.js.map +1 -0
  131. package/dist/tools/github/index.d.ts +1 -1
  132. package/dist/tools/github/index.js +1 -1
  133. package/dist/tools/github/index.js.map +1 -1
  134. package/dist/tools/github/pr.d.ts +122 -0
  135. package/dist/tools/github/pr.js +183 -0
  136. package/dist/tools/github/pr.js.map +1 -1
  137. package/dist/tools/index.js +27 -1
  138. package/dist/tools/index.js.map +1 -1
  139. package/dist/tools/slackListChannels.d.ts +65 -0
  140. package/dist/tools/slackListChannels.js +70 -0
  141. package/dist/tools/slackListChannels.js.map +1 -0
  142. package/dist/tools/slackPostMessage.d.ts +57 -0
  143. package/dist/tools/slackPostMessage.js +77 -0
  144. package/dist/tools/slackPostMessage.js.map +1 -0
  145. package/dist/tools/updateLinearIssue.d.ts +89 -0
  146. package/dist/tools/updateLinearIssue.js +117 -0
  147. package/dist/tools/updateLinearIssue.js.map +1 -0
  148. package/package.json +4 -2
  149. package/scripts/start-all.sh +56 -19
  150. package/templates/co.patchwork-os.bridge.plist +34 -0
  151. package/templates/recipes/ctx-loop-test.yaml +75 -0
  152. package/templates/recipes/morning-brief-slack.yaml +57 -0
  153. package/templates/recipes/morning-brief.yaml +21 -5
  154. package/templates/recipes/sentry-to-linear.yaml +77 -0
@@ -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;YACnC,WAAW,EAAE;gBACX,IAAI,EAAE,QAAiB;gBACvB,QAAQ,EAAE,CAAC,SAAS,CAAC;gBACrB,UAAU,EAAE;oBACV,OAAO,EAAE;wBACP,IAAI,EAAE,QAAQ;wBACd,WAAW,EACT,iHAAiH;wBACnH,SAAS,EAAE,GAAG;qBACf;oBACD,SAAS,EAAE;wBACT,IAAI,EAAE,SAAS;wBACf,OAAO,EAAE,CAAC;wBACV,OAAO,EAAE,EAAE;wBACX,WAAW,EAAE,wCAAwC;qBACtD;iBACF;gBACD,oBAAoB,EAAE,KAAc;aACrC;YACD,YAAY,EAAE;gBACZ,IAAI,EAAE,QAAiB;gBACvB,UAAU,EAAE;oBACV,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBAC3B,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBACzB,UAA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;oBACd,MAAM,EAAE,EAAE;oBACV,UAAU,EAAE,IAAI;oBAChB,UAAU,EAAE,KAAc;oBAC1B,YAAY,EAAE,CAAC;oBACf,YAAY,EAAE,CAAC;oBACf,YAAY,EAAE,KAAK;oBACnB,eAAe;oBACf,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;iBACxD,CAAC,CAAC;YACL,CAAC;YAED,+DAA+D;YAC/D,MAAM,YAAY,GAAG,MAAM,UAAU,CAAC,OAAO,CAC3C,EAAE,UAAU,EAAE,SAAS,EAAE,EACzB,MAAM,CACP,CAAC;YAEF,mEAAmE;YACnE,MAAM,UAAU,GACd,YAAY,CAAC,iBAAiB;gBAC9B,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,KAAK,MAAM;oBACzC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;oBAC1C,CAAC,CAAC,EAAE,CAAC,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;I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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,MAAM,UAAU,4BAA4B;IAC1C,OAAO;QACL,MAAM,EAAE;YACN,IAAI,EAAE,oBAAoB;YAC1B,WAAW,EACT,0KAA0K;YAC5K,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,UAAU,EAAE;wBACV,IAAI,EAAE,OAAO;wBACb,KAAK,EAAE;4BACL,IAAI,EAAE,QAAQ;4BACd,UAAU,EAAE;gCACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gCAC1B,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;gCAC9B,SAAS,EAAE,E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from "./actions.js";
2
2
  export { createGithubCommentIssueTool, createGithubCreateIssueTool, createGithubGetIssueTool, createGithubListIssuesTool, } from "./issues.js";
3
- export { createGithubCreatePRTool, createGithubGetPRDiffTool, createGithubListPRsTool, createGithubPostPRReviewTool, createGithubViewPRTool, } from "./pr.js";
3
+ export { createGithubApprovePRTool, createGithubCreatePRTool, createGithubGetPRDiffTool, createGithubListPRsTool, createGithubMergePRTool, createGithubPostPRReviewTool, createGithubViewPRTool, } from "./pr.js";
@@ -1,4 +1,4 @@
1
1
  export { createGithubGetRunLogsTool, createGithubListRunsTool, } from "./actions.js";
2
2
  export { createGithubCommentIssueTool, createGithubCreateIssueTool, createGithubGetIssueTool, createGithubListIssuesTool, } from "./issues.js";
3
- export { createGithubCreatePRTool, createGithubGetPRDiffTool, createGithubListPRsTool, createGithubPostPRReviewTool, createGithubViewPRTool, } from "./pr.js";
3
+ export { createGithubApprovePRTool, createGithubCreatePRTool, createGithubGetPRDiffTool, createGithubListPRsTool, createGithubMergePRTool, createGithubPostPRReviewTool, createGithubViewPRTool, } from "./pr.js";
4
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/github/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,GACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,4BAA4B,EAC5B,2BAA2B,EAC3B,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,uBAAuB,EACvB,4BAA4B,EAC5B,sBAAsB,GACvB,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/github/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,GACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,4BAA4B,EAC5B,2BAA2B,EAC3B,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,EACvB,4BAA4B,EAC5B,sBAAsB,GACvB,MAAM,SAAS,CAAC"}
@@ -431,3 +431,125 @@ export declare function createGithubPostPRReviewTool(workspace: string): {
431
431
  }>;
432
432
  timeoutMs: number;
433
433
  };
434
+ export declare function createGithubApprovePRTool(workspace: string): {
435
+ schema: {
436
+ name: string;
437
+ description: string;
438
+ annotations: {
439
+ destructiveHint: boolean;
440
+ openWorldHint: boolean;
441
+ };
442
+ inputSchema: {
443
+ type: "object";
444
+ required: string[];
445
+ properties: {
446
+ prNumber: {
447
+ type: string;
448
+ description: string;
449
+ };
450
+ body: {
451
+ type: string;
452
+ description: string;
453
+ };
454
+ repo: {
455
+ type: string;
456
+ description: string;
457
+ };
458
+ };
459
+ additionalProperties: false;
460
+ };
461
+ outputSchema: {
462
+ type: "object";
463
+ properties: {
464
+ reviewId: {
465
+ type: string[];
466
+ };
467
+ url: {
468
+ type: string;
469
+ };
470
+ };
471
+ required: string[];
472
+ };
473
+ };
474
+ handler: (args: Record<string, unknown>, signal?: AbortSignal) => Promise<{
475
+ content: Array<{
476
+ type: string;
477
+ text: string;
478
+ }>;
479
+ structuredContent: unknown;
480
+ } | {
481
+ content: Array<{
482
+ type: string;
483
+ text: string;
484
+ }>;
485
+ isError: true;
486
+ }>;
487
+ timeoutMs: number;
488
+ };
489
+ export declare function createGithubMergePRTool(workspace: string): {
490
+ schema: {
491
+ name: string;
492
+ description: string;
493
+ annotations: {
494
+ destructiveHint: boolean;
495
+ openWorldHint: boolean;
496
+ };
497
+ inputSchema: {
498
+ type: "object";
499
+ required: string[];
500
+ properties: {
501
+ prNumber: {
502
+ type: string;
503
+ description: string;
504
+ };
505
+ mergeMethod: {
506
+ type: string;
507
+ enum: string[];
508
+ description: string;
509
+ };
510
+ commitTitle: {
511
+ type: string;
512
+ description: string;
513
+ };
514
+ commitMessage: {
515
+ type: string;
516
+ description: string;
517
+ };
518
+ repo: {
519
+ type: string;
520
+ description: string;
521
+ };
522
+ };
523
+ additionalProperties: false;
524
+ };
525
+ outputSchema: {
526
+ type: "object";
527
+ properties: {
528
+ merged: {
529
+ type: string;
530
+ };
531
+ sha: {
532
+ type: string;
533
+ };
534
+ message: {
535
+ type: string;
536
+ };
537
+ };
538
+ required: string[];
539
+ };
540
+ };
541
+ handler: (args: Record<string, unknown>, signal?: AbortSignal) => Promise<{
542
+ content: Array<{
543
+ type: string;
544
+ text: string;
545
+ }>;
546
+ structuredContent: unknown;
547
+ } | {
548
+ content: Array<{
549
+ type: string;
550
+ text: string;
551
+ }>;
552
+ isError: true;
553
+ }>;
554
+ timeoutMs: number;
555
+ };