@github-tools/sdk 1.7.0 → 1.8.1
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.
- package/README.md +78 -3
- package/dist/connect/eve.d.mts +18 -0
- package/dist/connect/eve.d.mts.map +1 -0
- package/dist/connect/eve.mjs +27 -0
- package/dist/connect/eve.mjs.map +1 -0
- package/dist/connect.d.mts +46 -0
- package/dist/connect.d.mts.map +1 -0
- package/dist/connect.mjs +22 -0
- package/dist/connect.mjs.map +1 -0
- package/dist/eve-UPaHEGVi.mjs +512 -0
- package/dist/eve-UPaHEGVi.mjs.map +1 -0
- package/dist/eve.d.mts +47 -89
- package/dist/eve.d.mts.map +1 -1
- package/dist/eve.mjs +2 -521
- package/dist/{tool-types-CuirBEc8.d.mts → index-Cs1Kebmt.d.mts} +251 -32
- package/dist/index-Cs1Kebmt.d.mts.map +1 -0
- package/dist/index.d.mts +2 -3
- package/dist/index.mjs +3 -3
- package/dist/{src-BgnkKMD7.mjs → src-CfzZfU82.mjs} +87 -87
- package/dist/src-CfzZfU82.mjs.map +1 -0
- package/dist/token-CW8lQBND.mjs +100 -0
- package/dist/token-CW8lQBND.mjs.map +1 -0
- package/dist/types-B0mvQgJf.d.mts +49 -0
- package/dist/types-B0mvQgJf.d.mts.map +1 -0
- package/dist/types-DwHrGKWO.d.mts +27 -0
- package/dist/types-DwHrGKWO.d.mts.map +1 -0
- package/dist/workflow.d.mts +4 -5
- package/dist/workflow.d.mts.map +1 -1
- package/dist/workflow.mjs +3 -3
- package/dist/workflow.mjs.map +1 -1
- package/dist/{write-tools-vzlewWo5.mjs → write-tools-Dx9LfYlU.mjs} +26 -9
- package/dist/write-tools-Dx9LfYlU.mjs.map +1 -0
- package/package.json +18 -5
- package/dist/eve.mjs.map +0 -1
- package/dist/index-BRUYe5q0.d.mts +0 -220
- package/dist/index-BRUYe5q0.d.mts.map +0 -1
- package/dist/src-BgnkKMD7.mjs.map +0 -1
- package/dist/tool-types-CuirBEc8.d.mts.map +0 -1
- package/dist/write-tools-vzlewWo5.mjs.map +0 -1
package/dist/eve.mjs
CHANGED
|
@@ -1,522 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
//#region src/eve/load-eve.ts
|
|
4
|
-
const require = createRequire(import.meta.url);
|
|
5
|
-
const MISSING_EVE_MESSAGE = "The \"eve\" package is required to use @github-tools/sdk/eve. Install it with: pnpm add eve";
|
|
6
|
-
let eveToolsModule;
|
|
7
|
-
let eveApprovalModule;
|
|
8
|
-
function getEveTools() {
|
|
9
|
-
if (eveToolsModule) return eveToolsModule;
|
|
10
|
-
try {
|
|
11
|
-
eveToolsModule = require("eve/tools");
|
|
12
|
-
return eveToolsModule;
|
|
13
|
-
} catch {
|
|
14
|
-
throw new Error(MISSING_EVE_MESSAGE);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
function getEveApprovalHelpers() {
|
|
18
|
-
if (eveApprovalModule) return eveApprovalModule;
|
|
19
|
-
try {
|
|
20
|
-
eveApprovalModule = require("eve/tools/approval");
|
|
21
|
-
return eveApprovalModule;
|
|
22
|
-
} catch {
|
|
23
|
-
throw new Error(MISSING_EVE_MESSAGE);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
//#endregion
|
|
27
|
-
//#region src/eve/approval.ts
|
|
28
|
-
function mapEveApprovalValue(value) {
|
|
29
|
-
if (typeof value === "function") return value;
|
|
30
|
-
const { always, never, once } = getEveApprovalHelpers();
|
|
31
|
-
if (value === true || value === "always") return always();
|
|
32
|
-
if (value === false || value === "never") return never();
|
|
33
|
-
if (value === "once") return once();
|
|
34
|
-
return always();
|
|
35
|
-
}
|
|
36
|
-
function resolveEveApproval(toolName, config) {
|
|
37
|
-
if (config === void 0) return getEveApprovalHelpers().always();
|
|
38
|
-
if (config === true) return getEveApprovalHelpers().always();
|
|
39
|
-
if (config === false) return getEveApprovalHelpers().never();
|
|
40
|
-
const value = config[toolName];
|
|
41
|
-
if (value === void 0) return getEveApprovalHelpers().always();
|
|
42
|
-
return mapEveApprovalValue(value);
|
|
43
|
-
}
|
|
44
|
-
//#endregion
|
|
45
|
-
//#region src/eve/registry.ts
|
|
46
|
-
function withToken(core, ctx, extra) {
|
|
47
|
-
return (input) => core({
|
|
48
|
-
token: ctx.token,
|
|
49
|
-
...extra,
|
|
50
|
-
...input
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
function modelOutputAdapter(fn) {
|
|
54
|
-
return (output) => fn({
|
|
55
|
-
toolCallId: "",
|
|
56
|
-
input: {},
|
|
57
|
-
output
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
function createToolRegistry(ctx) {
|
|
61
|
-
return [
|
|
62
|
-
{
|
|
63
|
-
name: "getRepository",
|
|
64
|
-
description: getRepositoryDescription,
|
|
65
|
-
inputSchema: getRepositoryInputSchema,
|
|
66
|
-
execute: withToken(getRepositoryCore, ctx)
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
name: "listBranches",
|
|
70
|
-
description: listBranchesDescription,
|
|
71
|
-
inputSchema: listBranchesInputSchema,
|
|
72
|
-
execute: withToken(listBranchesCore, ctx)
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
name: "getFileContent",
|
|
76
|
-
description: getFileContentDescription,
|
|
77
|
-
inputSchema: getFileContentInputSchema,
|
|
78
|
-
execute: withToken(getFileContentCore, ctx),
|
|
79
|
-
toModelOutput: modelOutputAdapter(getFileContentToModelOutput)
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
name: "createBranch",
|
|
83
|
-
writeTool: "createBranch",
|
|
84
|
-
description: createBranchDescription,
|
|
85
|
-
inputSchema: createBranchInputSchema,
|
|
86
|
-
execute: withToken(createBranchCore, ctx)
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
name: "forkRepository",
|
|
90
|
-
writeTool: "forkRepository",
|
|
91
|
-
description: forkRepositoryDescription,
|
|
92
|
-
inputSchema: forkRepositoryInputSchema,
|
|
93
|
-
execute: withToken(forkRepositoryCore, ctx)
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
name: "createRepository",
|
|
97
|
-
writeTool: "createRepository",
|
|
98
|
-
description: createRepositoryDescription,
|
|
99
|
-
inputSchema: createRepositoryInputSchema,
|
|
100
|
-
execute: withToken(createRepositoryCore, ctx)
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
name: "createOrUpdateFile",
|
|
104
|
-
writeTool: "createOrUpdateFile",
|
|
105
|
-
description: createOrUpdateFileDescription,
|
|
106
|
-
inputSchema: createOrUpdateFileInputSchema,
|
|
107
|
-
execute: withToken(createOrUpdateFileCore, ctx, {
|
|
108
|
-
author: ctx.author,
|
|
109
|
-
committer: ctx.committer,
|
|
110
|
-
coAuthors: ctx.coAuthors
|
|
111
|
-
})
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
name: "listPullRequests",
|
|
115
|
-
description: listPullRequestsDescription,
|
|
116
|
-
inputSchema: listPullRequestsInputSchema,
|
|
117
|
-
execute: withToken(listPullRequestsCore, ctx)
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
name: "getPullRequest",
|
|
121
|
-
description: getPullRequestDescription,
|
|
122
|
-
inputSchema: getPullRequestInputSchema,
|
|
123
|
-
execute: withToken(getPullRequestCore, ctx)
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
name: "createPullRequest",
|
|
127
|
-
writeTool: "createPullRequest",
|
|
128
|
-
description: createPullRequestDescription,
|
|
129
|
-
inputSchema: createPullRequestInputSchema,
|
|
130
|
-
execute: withToken(createPullRequestCore, ctx)
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
name: "mergePullRequest",
|
|
134
|
-
writeTool: "mergePullRequest",
|
|
135
|
-
description: mergePullRequestDescription,
|
|
136
|
-
inputSchema: mergePullRequestInputSchema,
|
|
137
|
-
execute: withToken(mergePullRequestCore, ctx, { coAuthors: ctx.coAuthors })
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
name: "addPullRequestComment",
|
|
141
|
-
writeTool: "addPullRequestComment",
|
|
142
|
-
description: addPullRequestCommentDescription,
|
|
143
|
-
inputSchema: addPullRequestCommentInputSchema,
|
|
144
|
-
execute: withToken(addPullRequestCommentCore, ctx)
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
name: "listPullRequestFiles",
|
|
148
|
-
description: listPullRequestFilesDescription,
|
|
149
|
-
inputSchema: listPullRequestFilesInputSchema,
|
|
150
|
-
execute: withToken(listPullRequestFilesCore, ctx),
|
|
151
|
-
toModelOutput: modelOutputAdapter(listPullRequestFilesToModelOutput)
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
name: "listPullRequestReviews",
|
|
155
|
-
description: listPullRequestReviewsDescription,
|
|
156
|
-
inputSchema: listPullRequestReviewsInputSchema,
|
|
157
|
-
execute: withToken(listPullRequestReviewsCore, ctx)
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
name: "createPullRequestReview",
|
|
161
|
-
writeTool: "createPullRequestReview",
|
|
162
|
-
description: createPullRequestReviewDescription,
|
|
163
|
-
inputSchema: createPullRequestReviewInputSchema,
|
|
164
|
-
execute: withToken(createPullRequestReviewCore, ctx)
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
name: "listIssues",
|
|
168
|
-
description: listIssuesDescription,
|
|
169
|
-
inputSchema: listIssuesInputSchema,
|
|
170
|
-
execute: withToken(listIssuesCore, ctx)
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
name: "getIssue",
|
|
174
|
-
description: getIssueDescription,
|
|
175
|
-
inputSchema: getIssueInputSchema,
|
|
176
|
-
execute: withToken(getIssueCore, ctx)
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
name: "createIssue",
|
|
180
|
-
writeTool: "createIssue",
|
|
181
|
-
description: createIssueDescription,
|
|
182
|
-
inputSchema: createIssueInputSchema,
|
|
183
|
-
execute: withToken(createIssueCore, ctx)
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
name: "addIssueComment",
|
|
187
|
-
writeTool: "addIssueComment",
|
|
188
|
-
description: addIssueCommentDescription,
|
|
189
|
-
inputSchema: addIssueCommentInputSchema,
|
|
190
|
-
execute: withToken(addIssueCommentCore, ctx)
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
name: "closeIssue",
|
|
194
|
-
writeTool: "closeIssue",
|
|
195
|
-
description: closeIssueDescription,
|
|
196
|
-
inputSchema: closeIssueInputSchema,
|
|
197
|
-
execute: withToken(closeIssueCore, ctx)
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
name: "listLabels",
|
|
201
|
-
description: listLabelsDescription,
|
|
202
|
-
inputSchema: listLabelsInputSchema,
|
|
203
|
-
execute: withToken(listLabelsCore, ctx)
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
name: "addLabels",
|
|
207
|
-
writeTool: "addLabels",
|
|
208
|
-
description: addLabelsDescription,
|
|
209
|
-
inputSchema: addLabelsInputSchema,
|
|
210
|
-
execute: withToken(addLabelsCore, ctx)
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
name: "removeLabel",
|
|
214
|
-
writeTool: "removeLabel",
|
|
215
|
-
description: removeLabelDescription,
|
|
216
|
-
inputSchema: removeLabelInputSchema,
|
|
217
|
-
execute: withToken(removeLabelCore, ctx)
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
name: "searchCode",
|
|
221
|
-
description: searchCodeDescription,
|
|
222
|
-
inputSchema: searchCodeInputSchema,
|
|
223
|
-
execute: withToken(searchCodeCore, ctx)
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
name: "searchRepositories",
|
|
227
|
-
description: searchRepositoriesDescription,
|
|
228
|
-
inputSchema: searchRepositoriesInputSchema,
|
|
229
|
-
execute: withToken(searchRepositoriesCore, ctx)
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
name: "listCommits",
|
|
233
|
-
description: listCommitsDescription,
|
|
234
|
-
inputSchema: listCommitsInputSchema,
|
|
235
|
-
execute: withToken(listCommitsCore, ctx)
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
name: "getCommit",
|
|
239
|
-
description: getCommitDescription,
|
|
240
|
-
inputSchema: getCommitInputSchema,
|
|
241
|
-
execute: withToken(getCommitCore, ctx),
|
|
242
|
-
toModelOutput: modelOutputAdapter(getCommitToModelOutput)
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
name: "getBlame",
|
|
246
|
-
description: getBlameDescription,
|
|
247
|
-
inputSchema: getBlameInputSchema,
|
|
248
|
-
execute: withToken(getBlameCore, ctx)
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
name: "listGists",
|
|
252
|
-
description: listGistsDescription,
|
|
253
|
-
inputSchema: listGistsInputSchema,
|
|
254
|
-
execute: withToken(listGistsCore, ctx)
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
name: "getGist",
|
|
258
|
-
description: getGistDescription,
|
|
259
|
-
inputSchema: getGistInputSchema,
|
|
260
|
-
execute: withToken(getGistCore, ctx)
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
name: "listGistComments",
|
|
264
|
-
description: listGistCommentsDescription,
|
|
265
|
-
inputSchema: listGistCommentsInputSchema,
|
|
266
|
-
execute: withToken(listGistCommentsCore, ctx)
|
|
267
|
-
},
|
|
268
|
-
{
|
|
269
|
-
name: "createGist",
|
|
270
|
-
writeTool: "createGist",
|
|
271
|
-
description: createGistDescription,
|
|
272
|
-
inputSchema: createGistInputSchema,
|
|
273
|
-
execute: withToken(createGistCore, ctx)
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
name: "updateGist",
|
|
277
|
-
writeTool: "updateGist",
|
|
278
|
-
description: updateGistDescription,
|
|
279
|
-
inputSchema: updateGistInputSchema,
|
|
280
|
-
execute: withToken(updateGistCore, ctx)
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
name: "deleteGist",
|
|
284
|
-
writeTool: "deleteGist",
|
|
285
|
-
description: deleteGistDescription,
|
|
286
|
-
inputSchema: deleteGistInputSchema,
|
|
287
|
-
execute: withToken(deleteGistCore, ctx)
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
name: "createGistComment",
|
|
291
|
-
writeTool: "createGistComment",
|
|
292
|
-
description: createGistCommentDescription,
|
|
293
|
-
inputSchema: createGistCommentInputSchema,
|
|
294
|
-
execute: withToken(createGistCommentCore, ctx)
|
|
295
|
-
},
|
|
296
|
-
{
|
|
297
|
-
name: "listWorkflows",
|
|
298
|
-
description: listWorkflowsDescription,
|
|
299
|
-
inputSchema: listWorkflowsInputSchema,
|
|
300
|
-
execute: withToken(listWorkflowsCore, ctx)
|
|
301
|
-
},
|
|
302
|
-
{
|
|
303
|
-
name: "listWorkflowRuns",
|
|
304
|
-
description: listWorkflowRunsDescription,
|
|
305
|
-
inputSchema: listWorkflowRunsInputSchema,
|
|
306
|
-
execute: withToken(listWorkflowRunsCore, ctx)
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
name: "getWorkflowRun",
|
|
310
|
-
description: getWorkflowRunDescription,
|
|
311
|
-
inputSchema: getWorkflowRunInputSchema,
|
|
312
|
-
execute: withToken(getWorkflowRunCore, ctx)
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
name: "listWorkflowJobs",
|
|
316
|
-
description: listWorkflowJobsDescription,
|
|
317
|
-
inputSchema: listWorkflowJobsInputSchema,
|
|
318
|
-
execute: withToken(listWorkflowJobsCore, ctx)
|
|
319
|
-
},
|
|
320
|
-
{
|
|
321
|
-
name: "triggerWorkflow",
|
|
322
|
-
writeTool: "triggerWorkflow",
|
|
323
|
-
description: triggerWorkflowDescription,
|
|
324
|
-
inputSchema: triggerWorkflowInputSchema,
|
|
325
|
-
execute: withToken(triggerWorkflowCore, ctx)
|
|
326
|
-
},
|
|
327
|
-
{
|
|
328
|
-
name: "cancelWorkflowRun",
|
|
329
|
-
writeTool: "cancelWorkflowRun",
|
|
330
|
-
description: cancelWorkflowRunDescription,
|
|
331
|
-
inputSchema: cancelWorkflowRunInputSchema,
|
|
332
|
-
execute: withToken(cancelWorkflowRunCore, ctx)
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
name: "rerunWorkflowRun",
|
|
336
|
-
writeTool: "rerunWorkflowRun",
|
|
337
|
-
description: rerunWorkflowRunDescription,
|
|
338
|
-
inputSchema: rerunWorkflowRunInputSchema,
|
|
339
|
-
execute: withToken(rerunWorkflowRunCore, ctx)
|
|
340
|
-
}
|
|
341
|
-
];
|
|
342
|
-
}
|
|
343
|
-
//#endregion
|
|
344
|
-
//#region src/eve/steps.ts
|
|
345
|
-
async function executeGithubToolStep(name, input, ctx) {
|
|
346
|
-
"use step";
|
|
347
|
-
const entry = createToolRegistry(ctx).find((tool) => tool.name === name);
|
|
348
|
-
if (!entry) throw new Error(`Unknown GitHub tool: ${name}`);
|
|
349
|
-
return entry.execute(input);
|
|
350
|
-
}
|
|
351
|
-
function runGithubToolStep(name, input, ctx) {
|
|
352
|
-
return executeGithubToolStep(name, input, ctx);
|
|
353
|
-
}
|
|
354
|
-
//#endregion
|
|
355
|
-
//#region src/eve/build.ts
|
|
356
|
-
function applyOverrides(tool, name, overrides) {
|
|
357
|
-
const override = overrides?.[name];
|
|
358
|
-
if (!override) return tool;
|
|
359
|
-
return {
|
|
360
|
-
...tool,
|
|
361
|
-
...override.description !== void 0 && { description: override.description },
|
|
362
|
-
...override.approval !== void 0 && { approval: mapEveApprovalValue(override.approval) },
|
|
363
|
-
...override.toModelOutput !== void 0 && { toModelOutput: override.toModelOutput },
|
|
364
|
-
...override.outputSchema !== void 0 && { outputSchema: override.outputSchema }
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
|
-
function buildEveToolDefinition(name, options = {}) {
|
|
368
|
-
const { defineTool } = getEveTools();
|
|
369
|
-
const ctx = {
|
|
370
|
-
token: resolveGithubToken(options.token),
|
|
371
|
-
author: options.author,
|
|
372
|
-
committer: options.committer,
|
|
373
|
-
coAuthors: options.coAuthors
|
|
374
|
-
};
|
|
375
|
-
const entry = createToolRegistry(ctx).find((tool) => tool.name === name);
|
|
376
|
-
if (!entry) throw new Error(`Unknown GitHub tool: ${name}`);
|
|
377
|
-
return applyOverrides(defineTool({
|
|
378
|
-
description: entry.description,
|
|
379
|
-
inputSchema: entry.inputSchema,
|
|
380
|
-
...entry.writeTool && { approval: resolveEveApproval(entry.writeTool, options.requireApproval) },
|
|
381
|
-
...entry.toModelOutput && { toModelOutput: entry.toModelOutput },
|
|
382
|
-
execute: async (input) => runGithubToolStep(name, input, ctx)
|
|
383
|
-
}), name, options.overrides);
|
|
384
|
-
}
|
|
385
|
-
function buildEveToolMap(options = {}) {
|
|
386
|
-
const { defineTool } = getEveTools();
|
|
387
|
-
const ctx = {
|
|
388
|
-
token: resolveGithubToken(options.token),
|
|
389
|
-
author: options.author,
|
|
390
|
-
committer: options.committer,
|
|
391
|
-
coAuthors: options.coAuthors
|
|
392
|
-
};
|
|
393
|
-
const allowed = options.preset ? resolvePresetTools(options.preset) : null;
|
|
394
|
-
const registry = createToolRegistry(ctx);
|
|
395
|
-
const tools = {};
|
|
396
|
-
for (const entry of registry) {
|
|
397
|
-
if (allowed && !allowed.has(entry.name)) continue;
|
|
398
|
-
const tool = defineTool({
|
|
399
|
-
description: entry.description,
|
|
400
|
-
inputSchema: entry.inputSchema,
|
|
401
|
-
...entry.writeTool && { approval: resolveEveApproval(entry.writeTool, options.requireApproval) },
|
|
402
|
-
...entry.toModelOutput && { toModelOutput: entry.toModelOutput },
|
|
403
|
-
execute: async (input) => runGithubToolStep(entry.name, input, ctx)
|
|
404
|
-
});
|
|
405
|
-
tools[entry.name] = applyOverrides(tool, entry.name, options.overrides);
|
|
406
|
-
}
|
|
407
|
-
return tools;
|
|
408
|
-
}
|
|
409
|
-
function createEveGithubToolsDynamic(options = {}) {
|
|
410
|
-
const { defineDynamic } = getEveTools();
|
|
411
|
-
return defineDynamic({ events: { "session.started": async () => buildEveToolMap(options) } });
|
|
412
|
-
}
|
|
413
|
-
function listResolvedEveToolNames(options = {}) {
|
|
414
|
-
if (!options.preset) return [...ALL_GITHUB_TOOL_NAMES];
|
|
415
|
-
return ALL_GITHUB_TOOL_NAMES.filter((name) => resolvePresetTools(options.preset).has(name));
|
|
416
|
-
}
|
|
417
|
-
//#endregion
|
|
418
|
-
//#region src/eve.ts
|
|
419
|
-
/**
|
|
420
|
-
* Register all GitHub tools (or a preset subset) as eve dynamic capabilities.
|
|
421
|
-
*
|
|
422
|
-
* Export as the default from `agent/tools/github.ts`:
|
|
423
|
-
*
|
|
424
|
-
* ```ts
|
|
425
|
-
* import { createGithubTools } from '@github-tools/sdk/eve'
|
|
426
|
-
* export default createGithubTools({ preset: 'code-review' })
|
|
427
|
-
* ```
|
|
428
|
-
*/
|
|
429
|
-
function createGithubTools(options) {
|
|
430
|
-
return createEveGithubToolsDynamic(options ?? {});
|
|
431
|
-
}
|
|
432
|
-
function factory(name) {
|
|
433
|
-
return (options) => buildEveToolDefinition(name, options);
|
|
434
|
-
}
|
|
435
|
-
/** Get information about a GitHub repository including description, stars, forks, language, and default branch. */
|
|
436
|
-
const getRepository = factory("getRepository");
|
|
437
|
-
/** List branches in a GitHub repository. */
|
|
438
|
-
const listBranches = factory("listBranches");
|
|
439
|
-
/** Get the content of a file from a GitHub repository. */
|
|
440
|
-
const getFileContent = factory("getFileContent");
|
|
441
|
-
/** Create a new branch in a GitHub repository from an existing branch or commit SHA. Requires approval by default. */
|
|
442
|
-
const createBranch = factory("createBranch");
|
|
443
|
-
/** Fork a GitHub repository to the authenticated user account or a specified organization. Requires approval by default. */
|
|
444
|
-
const forkRepository = factory("forkRepository");
|
|
445
|
-
/** Create a new GitHub repository for the authenticated user or a specified organization. Requires approval by default. */
|
|
446
|
-
const createRepository = factory("createRepository");
|
|
447
|
-
/** Create or update a file in a GitHub repository. Provide the SHA when updating an existing file. Requires approval by default. */
|
|
448
|
-
const createOrUpdateFile = factory("createOrUpdateFile");
|
|
449
|
-
/** List pull requests for a GitHub repository. */
|
|
450
|
-
const listPullRequests = factory("listPullRequests");
|
|
451
|
-
/** Get detailed information about a specific pull request. */
|
|
452
|
-
const getPullRequest = factory("getPullRequest");
|
|
453
|
-
/** Create a new pull request in a GitHub repository. Requires approval by default. */
|
|
454
|
-
const createPullRequest = factory("createPullRequest");
|
|
455
|
-
/** Merge a pull request. Requires approval by default. */
|
|
456
|
-
const mergePullRequest = factory("mergePullRequest");
|
|
457
|
-
/** Add a comment to a pull request. Requires approval by default. */
|
|
458
|
-
const addPullRequestComment = factory("addPullRequestComment");
|
|
459
|
-
/** List files changed in a pull request, including diff status and patch content. */
|
|
460
|
-
const listPullRequestFiles = factory("listPullRequestFiles");
|
|
461
|
-
/** List reviews on a pull request (approvals, change requests, and comments). */
|
|
462
|
-
const listPullRequestReviews = factory("listPullRequestReviews");
|
|
463
|
-
/** Submit a pull request review with optional inline comments. Requires approval by default. */
|
|
464
|
-
const createPullRequestReview = factory("createPullRequestReview");
|
|
465
|
-
/** List issues for a GitHub repository (excludes pull requests). */
|
|
466
|
-
const listIssues = factory("listIssues");
|
|
467
|
-
/** Get detailed information about a specific issue. */
|
|
468
|
-
const getIssue = factory("getIssue");
|
|
469
|
-
/** Create a new issue in a GitHub repository. Requires approval by default. */
|
|
470
|
-
const createIssue = factory("createIssue");
|
|
471
|
-
/** Add a comment to a GitHub issue. Requires approval by default. */
|
|
472
|
-
const addIssueComment = factory("addIssueComment");
|
|
473
|
-
/** Close an open GitHub issue. Requires approval by default. */
|
|
474
|
-
const closeIssue = factory("closeIssue");
|
|
475
|
-
/** List labels available in a GitHub repository. */
|
|
476
|
-
const listLabels = factory("listLabels");
|
|
477
|
-
/** Add labels to an issue or pull request. Requires approval by default. */
|
|
478
|
-
const addLabels = factory("addLabels");
|
|
479
|
-
/** Remove a label from an issue or pull request. Requires approval by default. */
|
|
480
|
-
const removeLabel = factory("removeLabel");
|
|
481
|
-
/** Search for code in GitHub repositories. Use qualifiers like "repo:owner/name" to scope the search. */
|
|
482
|
-
const searchCode = factory("searchCode");
|
|
483
|
-
/** Search for GitHub repositories by keyword, topic, language, or other qualifiers. */
|
|
484
|
-
const searchRepositories = factory("searchRepositories");
|
|
485
|
-
/** List commits for a GitHub repository. Filter by file path to see commits that touched a file. */
|
|
486
|
-
const listCommits = factory("listCommits");
|
|
487
|
-
/** Get detailed information about a specific commit, including files changed with additions and deletions. */
|
|
488
|
-
const getCommit = factory("getCommit");
|
|
489
|
-
/** Line-level git blame for a file at a commit-like ref (branch, tag, or SHA). */
|
|
490
|
-
const getBlame = factory("getBlame");
|
|
491
|
-
/** List gists for the authenticated user or a specific user. */
|
|
492
|
-
const listGists = factory("listGists");
|
|
493
|
-
/** Get a gist by ID, including file contents. */
|
|
494
|
-
const getGist = factory("getGist");
|
|
495
|
-
/** List comments on a gist. */
|
|
496
|
-
const listGistComments = factory("listGistComments");
|
|
497
|
-
/** Create a new gist with one or more files. Requires approval by default. */
|
|
498
|
-
const createGist = factory("createGist");
|
|
499
|
-
/** Update an existing gist. Requires approval by default. */
|
|
500
|
-
const updateGist = factory("updateGist");
|
|
501
|
-
/** Delete a gist permanently. Requires approval by default. */
|
|
502
|
-
const deleteGist = factory("deleteGist");
|
|
503
|
-
/** Add a comment to a gist. Requires approval by default. */
|
|
504
|
-
const createGistComment = factory("createGistComment");
|
|
505
|
-
/** List GitHub Actions workflows in a repository. */
|
|
506
|
-
const listWorkflows = factory("listWorkflows");
|
|
507
|
-
/** List workflow runs for a repository, optionally filtered by workflow, branch, status, or event. */
|
|
508
|
-
const listWorkflowRuns = factory("listWorkflowRuns");
|
|
509
|
-
/** Get details of a specific workflow run including status, timing, and trigger info. */
|
|
510
|
-
const getWorkflowRun = factory("getWorkflowRun");
|
|
511
|
-
/** List jobs for a workflow run, including step-level status and timing. */
|
|
512
|
-
const listWorkflowJobs = factory("listWorkflowJobs");
|
|
513
|
-
/** Trigger a workflow via workflow_dispatch event. Requires approval by default. */
|
|
514
|
-
const triggerWorkflow = factory("triggerWorkflow");
|
|
515
|
-
/** Cancel an in-progress workflow run. Requires approval by default. */
|
|
516
|
-
const cancelWorkflowRun = factory("cancelWorkflowRun");
|
|
517
|
-
/** Re-run a workflow run, optionally only the failed jobs. Requires approval by default. */
|
|
518
|
-
const rerunWorkflowRun = factory("rerunWorkflowRun");
|
|
519
|
-
//#endregion
|
|
1
|
+
import { i as PRESET_TOOLS, r as GITHUB_TOOL_NAMES, t as GITHUB_WRITE_TOOLS } from "./write-tools-Dx9LfYlU.mjs";
|
|
2
|
+
import { A as listLabels, B as searchCode, C as getRepository, D as listGistComments, E as listCommits, F as listWorkflowRuns, G as buildEveToolMap, H as triggerWorkflow, I as listWorkflows, J as MISSING_EVE_MESSAGE, K as createEveGithubToolsDynamic, L as mergePullRequest, M as listPullRequestReviews, N as listPullRequests, O as listGists, P as listWorkflowJobs, R as removeLabel, S as getPullRequest, T as listBranches, U as updateGist, V as searchRepositories, W as buildEveToolDefinition, _ as getBlame, a as closeIssue, b as getGist, c as createGistComment, d as createOrUpdateFile, f as createPullRequest, g as forkRepository, h as deleteGist, i as cancelWorkflowRun, j as listPullRequestFiles, k as listIssues, l as createGithubTools, m as createRepository, n as addLabels, o as createBranch, p as createPullRequestReview, q as listResolvedEveToolNames, r as addPullRequestComment, s as createGist, t as addIssueComment, u as createIssue, v as getCommit, w as getWorkflowRun, x as getIssue, y as getFileContent, z as rerunWorkflowRun } from "./eve-UPaHEGVi.mjs";
|
|
520
3
|
export { GITHUB_TOOL_NAMES, GITHUB_WRITE_TOOLS, MISSING_EVE_MESSAGE, PRESET_TOOLS, addIssueComment, addLabels, addPullRequestComment, buildEveToolDefinition, buildEveToolMap, cancelWorkflowRun, closeIssue, createBranch, createEveGithubToolsDynamic, createGist, createGistComment, createGithubTools, createIssue, createOrUpdateFile, createPullRequest, createPullRequestReview, createRepository, deleteGist, forkRepository, getBlame, getCommit, getFileContent, getGist, getIssue, getPullRequest, getRepository, getWorkflowRun, listBranches, listCommits, listGistComments, listGists, listIssues, listLabels, listPullRequestFiles, listPullRequestReviews, listPullRequests, listResolvedEveToolNames, listWorkflowJobs, listWorkflowRuns, listWorkflows, mergePullRequest, removeLabel, rerunWorkflowRun, searchCode, searchRepositories, triggerWorkflow, updateGist };
|
|
521
|
-
|
|
522
|
-
//# sourceMappingURL=eve.mjs.map
|