@github-tools/sdk 1.12.0 → 1.14.0
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 +22 -17
- package/dist/connect/eve.d.mts +2 -3
- package/dist/connect/eve.d.mts.map +1 -1
- package/dist/connect/eve.mjs +1 -1
- package/dist/connect.d.mts +8 -86
- package/dist/connect.d.mts.map +1 -1
- package/dist/connect.mjs +2 -2
- package/dist/eve-runtime-BdolQrBF.mjs +275 -0
- package/dist/eve-runtime-BdolQrBF.mjs.map +1 -0
- package/dist/{eve-runtime-BmoVTbEU.d.mts → eve-runtime-D1v4C0UP.d.mts} +14 -6
- package/dist/eve-runtime-D1v4C0UP.d.mts.map +1 -0
- package/dist/eve-runtime.d.mts +4 -3
- package/dist/eve-runtime.mjs +2 -2
- package/dist/eve.d.mts +4 -4
- package/dist/eve.d.mts.map +1 -1
- package/dist/eve.mjs +2 -2
- package/dist/index-PqQNoVuw.d.mts +287 -0
- package/dist/index-PqQNoVuw.d.mts.map +1 -0
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +3 -3
- package/dist/{src-D45Onmsn.mjs → src-D9WxaIVj.mjs} +83 -4
- package/dist/src-D9WxaIVj.mjs.map +1 -0
- package/dist/{token-BIn80-XU.mjs → token-Dt6qs_kf.mjs} +9 -168
- package/dist/token-Dt6qs_kf.mjs.map +1 -0
- package/dist/tool-types-DbZpOYFG.d.mts +3312 -0
- package/dist/tool-types-DbZpOYFG.d.mts.map +1 -0
- package/dist/{types-CiNZNOXa.d.mts → types-BAEqBfM5.d.mts} +3 -3
- package/dist/{types-CiNZNOXa.d.mts.map → types-BAEqBfM5.d.mts.map} +1 -1
- package/dist/{types-CoTpsxxp.d.mts → types-CCoH12WC.d.mts} +4 -3
- package/dist/types-CCoH12WC.d.mts.map +1 -0
- package/dist/workflow.d.mts +2 -1
- package/dist/workflow.d.mts.map +1 -1
- package/dist/workflow.mjs +2 -2
- package/dist/{write-tools-CnJE0Vvu.mjs → write-tools-Ct0ZV87Z.mjs} +1296 -306
- package/dist/write-tools-Ct0ZV87Z.mjs.map +1 -0
- package/package.json +3 -3
- package/dist/eve-runtime-3asyv7YM.mjs +0 -771
- package/dist/eve-runtime-3asyv7YM.mjs.map +0 -1
- package/dist/eve-runtime-BmoVTbEU.d.mts.map +0 -1
- package/dist/index-CGeFo38P.d.mts +0 -783
- package/dist/index-CGeFo38P.d.mts.map +0 -1
- package/dist/src-D45Onmsn.mjs.map +0 -1
- package/dist/token-BIn80-XU.mjs.map +0 -1
- package/dist/types-CoTpsxxp.d.mts.map +0 -1
- package/dist/write-tools-CnJE0Vvu.mjs.map +0 -1
|
@@ -1,771 +0,0 @@
|
|
|
1
|
-
import { $ as listWorkflowJobsDescription, $n as getIssueDescription, $r as requestReviewersDescription, $t as searchRepositoriesDescription, A as getLatestReleaseInputSchema, Ai as getRepositoryDescription, An as addAssigneesInputSchema, Ar as createPullRequestInputSchema, At as listGistsInputSchema, B as getCombinedStatusCore, Bn as createIssueCore, Br as listPullRequestFilesCore, Bt as getCommitCore, C as createReleaseDescription, Ci as forkRepositoryCore, Cn as listCommentReactionsDescription, Cr as updateLabelDescription, Ct as getGistDescription, D as deleteReleaseInputSchema, Di as getFileContentDescription, Dn as listIssueReactionsInputSchema, Dr as addPullRequestCommentInputSchema, Dt as listGistCommentsInputSchema, E as deleteReleaseDescription, Ei as getFileContentCore, En as listIssueReactionsDescription, Er as addPullRequestCommentDescription, Et as listGistCommentsDescription, F as listReleasesDescription, Fi as listBranchesCore, Fn as addLabelsDescription, Fr as deletePullRequestCommentDescription, Ft as compareCommitsDescription, G as listCheckRunsInputSchema, Gn as createLabelInputSchema, Gr as listPullRequestReviewsInputSchema, Gt as listCommitsInputSchema, H as getCombinedStatusInputSchema, Hn as createIssueInputSchema, Hr as listPullRequestFilesInputSchema, Ht as getCommitInputSchema, I as listReleasesInputSchema, Ii as listBranchesDescription, In as addLabelsInputSchema, Ir as deletePullRequestCommentInputSchema, It as compareCommitsInputSchema, J as cancelWorkflowRunInputSchema, Jn as deleteIssueCommentInputSchema, Jr as listPullRequestsInputSchema, Jt as searchCodeInputSchema, K as cancelWorkflowRunCore, Kn as deleteIssueCommentCore, Kr as listPullRequestsCore, Kt as searchCodeCore, L as updateReleaseCore, Li as listBranchesInputSchema, Ln as closeIssueCore, Lr as getPullRequestCore, Lt as getBlameCore, M as getReleaseDescription, Mi as getRepositoryTreeCore, Mn as addIssueCommentDescription, Mr as createPullRequestReviewDescription, Mt as updateGistDescription, N as getReleaseInputSchema, Ni as getRepositoryTreeDescription, Nn as addIssueCommentInputSchema, Nr as createPullRequestReviewInputSchema, Nt as updateGistInputSchema, O as getLatestReleaseCore, Oi as getFileContentInputSchema, On as addAssigneesCore, Or as createPullRequestCore, Ot as listGistsCore, P as listReleasesCore, Pi as getRepositoryTreeInputSchema, Pn as addLabelsCore, Pr as deletePullRequestCommentCore, Pt as compareCommitsCore, Q as listWorkflowJobsCore, Qn as getIssueCore, Qr as requestReviewersCore, Qt as searchRepositoriesCore, R as updateReleaseDescription, Rn as closeIssueDescription, Rr as getPullRequestDescription, Rt as getBlameDescription, S as createReleaseCore, Si as createRepositoryInputSchema, Sn as listCommentReactionsCore, Sr as updateLabelCore, St as getGistCore, T as deleteReleaseCore, Ti as forkRepositoryInputSchema, Tn as listIssueReactionsCore, Tr as addPullRequestCommentCore, Tt as listGistCommentsCore, U as listCheckRunsCore, Un as createLabelCore, Ur as listPullRequestReviewsCore, Ut as listCommitsCore, V as getCombinedStatusDescription, Vn as createIssueDescription, Vr as listPullRequestFilesDescription, Vt as getCommitDescription, W as listCheckRunsDescription, Wn as createLabelDescription, Wr as listPullRequestReviewsDescription, Wt as listCommitsDescription, X as getWorkflowRunDescription, Xn as deleteLabelDescription, Xr as mergePullRequestDescription, Xt as searchIssuesDescription, Y as getWorkflowRunCore, Yn as deleteLabelCore, Yr as mergePullRequestCore, Yt as searchIssuesCore, Z as getWorkflowRunInputSchema, Zn as deleteLabelInputSchema, Zr as mergePullRequestInputSchema, Zt as searchIssuesInputSchema, _ as getPullRequestContextDescription, _i as createOrUpdateFileCore, _n as addCommentReactionDescription, _r as updateIssueCommentDescription, _t as createGistDescription, a as resolvePresetTools, ai as updatePullRequestDescription, an as markNotificationReadDescription, ar as listIssuesDescription, at as listWorkflowsDescription, b as getReleaseContextDescription, bi as createRepositoryCore, bn as addIssueReactionDescription, br as updateIssueDescription, bt as deleteGistDescription, c as mergeContextArgs, ci as resolveGithubToken, cn as addDiscussionCommentDescription, cr as listLabelsDescription, ct as rerunWorkflowRunDescription, d as getCiFailureContextDescription, di as getFileContentToModelOutput, dn as getDiscussionDescription, dr as removeAssigneesDescription, dt as triggerWorkflowDescription, ei as requestReviewersInputSchema, en as searchRepositoriesInputSchema, er as getIssueInputSchema, et as listWorkflowJobsInputSchema, f as getCiFailureContextInputSchema, fi as getPullRequestContextToModelOutput, fn as getDiscussionInputSchema, fr as removeAssigneesInputSchema, ft as triggerWorkflowInputSchema, g as getPullRequestContextCore, gi as createBranchInputSchema, gn as addCommentReactionCore, gr as updateIssueCommentCore, gt as createGistCore, h as getIssueContextInputSchema, hi as createBranchDescription, hn as listDiscussionsInputSchema, hr as removeLabelInputSchema, ht as createGistCommentInputSchema, ii as updatePullRequestCore, in as markNotificationReadCore, ir as listIssuesCore, it as listWorkflowsCore, j as getReleaseCore, ji as getRepositoryInputSchema, jn as addIssueCommentCore, jr as createPullRequestReviewCore, jt as updateGistCore, k as getLatestReleaseDescription, ki as getRepositoryCore, kn as addAssigneesDescription, kr as createPullRequestDescription, kt as listGistsDescription, l as softenContextSchema, li as compareCommitsToModelOutput, ln as addDiscussionCommentInputSchema, lr as listLabelsInputSchema, lt as rerunWorkflowRunInputSchema, m as getIssueContextDescription, mi as createBranchCore, mn as listDiscussionsDescription, mr as removeLabelDescription, mt as createGistCommentDescription, n as ALL_GITHUB_TOOL_NAMES, ni as updatePullRequestCommentDescription, nn as listNotificationsDescription, nr as listIssueCommentsDescription, nt as listWorkflowRunsDescription, oi as updatePullRequestInputSchema, on as markNotificationReadInputSchema, or as listIssuesInputSchema, ot as listWorkflowsInputSchema, p as getIssueContextCore, pi as listPullRequestFilesToModelOutput, pn as listDiscussionsCore, pr as removeLabelCore, pt as createGistCommentCore, q as cancelWorkflowRunDescription, qn as deleteIssueCommentDescription, qr as listPullRequestsDescription, qt as searchCodeDescription, ri as updatePullRequestCommentInputSchema, rn as listNotificationsInputSchema, rr as listIssueCommentsInputSchema, rt as listWorkflowRunsInputSchema, si as createGithubTokenResolver, sn as addDiscussionCommentCore, sr as listLabelsCore, st as rerunWorkflowRunCore, ti as updatePullRequestCommentCore, tn as listNotificationsCore, tr as listIssueCommentsCore, tt as listWorkflowRunsCore, u as getCiFailureContextCore, ui as getCommitToModelOutput, un as getDiscussionCore, ur as removeAssigneesCore, ut as triggerWorkflowCore, v as getPullRequestContextInputSchema, vi as createOrUpdateFileDescription, vn as addCommentReactionInputSchema, vr as updateIssueCommentInputSchema, vt as createGistInputSchema, w as createReleaseInputSchema, wi as forkRepositoryDescription, wn as listCommentReactionsInputSchema, wr as updateLabelInputSchema, wt as getGistInputSchema, x as getReleaseContextInputSchema, xi as createRepositoryDescription, xn as addIssueReactionInputSchema, xr as updateIssueInputSchema, xt as deleteGistInputSchema, y as getReleaseContextCore, yi as createOrUpdateFileInputSchema, yn as addIssueReactionCore, yr as updateIssueCore, yt as deleteGistCore, z as updateReleaseInputSchema, zi as stripRateLimit, zn as closeIssueInputSchema, zr as getPullRequestInputSchema, zt as getBlameInputSchema } from "./write-tools-CnJE0Vvu.mjs";
|
|
2
|
-
import * as eveTools from "eve/tools";
|
|
3
|
-
import * as eveApproval from "eve/tools/approval";
|
|
4
|
-
//#region src/eve/load-eve.ts
|
|
5
|
-
const MISSING_EVE_MESSAGE = "The \"eve\" package is required to use @github-tools/sdk/eve. Install it with: pnpm add eve";
|
|
6
|
-
function getEveTools() {
|
|
7
|
-
return eveTools;
|
|
8
|
-
}
|
|
9
|
-
function getEveApprovalHelpers() {
|
|
10
|
-
return eveApproval;
|
|
11
|
-
}
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/eve/approval.ts
|
|
14
|
-
/**
|
|
15
|
-
* `false` / `'never'` should omit the tool `approval` field entirely.
|
|
16
|
-
* eve treats a missing `approval` like `never()`; attaching `never()` is
|
|
17
|
-
* redundant and has caused approval UI noise on some channels.
|
|
18
|
-
*/
|
|
19
|
-
function isEveApprovalDisabled(value) {
|
|
20
|
-
return value === false || value === "never";
|
|
21
|
-
}
|
|
22
|
-
function mapEveApprovalValue(value) {
|
|
23
|
-
if (typeof value === "function") return value;
|
|
24
|
-
const { always, never, once } = getEveApprovalHelpers();
|
|
25
|
-
if (value === true || value === "always") return always();
|
|
26
|
-
if (value === false || value === "never") return never();
|
|
27
|
-
if (value === "once") return once();
|
|
28
|
-
return always();
|
|
29
|
-
}
|
|
30
|
-
function resolveEveApproval(toolName, config) {
|
|
31
|
-
if (config === void 0) return getEveApprovalHelpers().always();
|
|
32
|
-
if (config === true) return getEveApprovalHelpers().always();
|
|
33
|
-
if (config === false) return getEveApprovalHelpers().never();
|
|
34
|
-
const value = config[toolName];
|
|
35
|
-
if (value === void 0) return getEveApprovalHelpers().always();
|
|
36
|
-
return mapEveApprovalValue(value);
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Approval to attach on a write tool, or `undefined` to omit the field.
|
|
40
|
-
* Prefer this when building `defineTool` values so `false` / `'never'` do not
|
|
41
|
-
* attach a redundant `never()` handler.
|
|
42
|
-
*/
|
|
43
|
-
function resolveEveToolApproval(toolName, config, override) {
|
|
44
|
-
if (override !== void 0) {
|
|
45
|
-
if (isEveApprovalDisabled(override)) return void 0;
|
|
46
|
-
return mapEveApprovalValue(override);
|
|
47
|
-
}
|
|
48
|
-
if (config === false) return void 0;
|
|
49
|
-
if (typeof config === "object" && config !== null && isEveApprovalDisabled(config[toolName])) return;
|
|
50
|
-
return resolveEveApproval(toolName, config);
|
|
51
|
-
}
|
|
52
|
-
//#endregion
|
|
53
|
-
//#region src/eve/registry.ts
|
|
54
|
-
function withToken(core, ctx, extra) {
|
|
55
|
-
return async (input) => core({
|
|
56
|
-
token: await resolveGithubToken(ctx.token),
|
|
57
|
-
...extra,
|
|
58
|
-
...mergeContextArgs(input, ctx.context ?? {})
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
function modelOutputAdapter(fn) {
|
|
62
|
-
return (output) => fn({
|
|
63
|
-
toolCallId: "",
|
|
64
|
-
input: {},
|
|
65
|
-
output
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
const GITHUB_EVE_TOOL_MODEL_OUTPUT = {
|
|
69
|
-
getFileContent: modelOutputAdapter(getFileContentToModelOutput),
|
|
70
|
-
listPullRequestFiles: modelOutputAdapter(listPullRequestFilesToModelOutput),
|
|
71
|
-
getPullRequestContext: modelOutputAdapter(getPullRequestContextToModelOutput),
|
|
72
|
-
getCommit: modelOutputAdapter(getCommitToModelOutput),
|
|
73
|
-
compareCommits: modelOutputAdapter(compareCommitsToModelOutput)
|
|
74
|
-
};
|
|
75
|
-
/** Whether a GitHub tool has a built-in eve `toModelOutput` projection. */
|
|
76
|
-
function hasGithubEveToolModelOutput(name) {
|
|
77
|
-
return Object.hasOwn(GITHUB_EVE_TOOL_MODEL_OUTPUT, name);
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Apply the built-in eve `toModelOutput` projection for a tool.
|
|
81
|
-
* Strips `rateLimit` so it never reaches the model. Tools without a dedicated
|
|
82
|
-
* formatter get `{ type: 'json', value }` of the remaining payload.
|
|
83
|
-
* Used by `@github-tools/eve-extension` so the callback only closes over a serializable tool name.
|
|
84
|
-
*/
|
|
85
|
-
function formatGithubEveToolOutput(name, output) {
|
|
86
|
-
const stripped = stripRateLimit(output);
|
|
87
|
-
if (isErrorPayload(stripped)) return {
|
|
88
|
-
type: "json",
|
|
89
|
-
value: stripped
|
|
90
|
-
};
|
|
91
|
-
const format = GITHUB_EVE_TOOL_MODEL_OUTPUT[name];
|
|
92
|
-
if (!format) return {
|
|
93
|
-
type: "json",
|
|
94
|
-
value: stripped
|
|
95
|
-
};
|
|
96
|
-
return format(stripped);
|
|
97
|
-
}
|
|
98
|
-
function isErrorPayload(output) {
|
|
99
|
-
return output != null && typeof output === "object" && !Array.isArray(output) && typeof output.error === "string";
|
|
100
|
-
}
|
|
101
|
-
function createToolRegistry(ctx) {
|
|
102
|
-
const entries = [
|
|
103
|
-
{
|
|
104
|
-
name: "getRepository",
|
|
105
|
-
description: getRepositoryDescription,
|
|
106
|
-
inputSchema: getRepositoryInputSchema,
|
|
107
|
-
execute: withToken(getRepositoryCore, ctx)
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
name: "listBranches",
|
|
111
|
-
description: listBranchesDescription,
|
|
112
|
-
inputSchema: listBranchesInputSchema,
|
|
113
|
-
execute: withToken(listBranchesCore, ctx)
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
name: "getFileContent",
|
|
117
|
-
description: getFileContentDescription,
|
|
118
|
-
inputSchema: getFileContentInputSchema,
|
|
119
|
-
execute: withToken(getFileContentCore, ctx),
|
|
120
|
-
toModelOutput: GITHUB_EVE_TOOL_MODEL_OUTPUT.getFileContent
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
name: "getRepositoryTree",
|
|
124
|
-
description: getRepositoryTreeDescription,
|
|
125
|
-
inputSchema: getRepositoryTreeInputSchema,
|
|
126
|
-
execute: withToken(getRepositoryTreeCore, ctx)
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
name: "createBranch",
|
|
130
|
-
writeTool: "createBranch",
|
|
131
|
-
description: createBranchDescription,
|
|
132
|
-
inputSchema: createBranchInputSchema,
|
|
133
|
-
execute: withToken(createBranchCore, ctx)
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
name: "forkRepository",
|
|
137
|
-
writeTool: "forkRepository",
|
|
138
|
-
description: forkRepositoryDescription,
|
|
139
|
-
inputSchema: forkRepositoryInputSchema,
|
|
140
|
-
execute: withToken(forkRepositoryCore, ctx)
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
name: "createRepository",
|
|
144
|
-
writeTool: "createRepository",
|
|
145
|
-
description: createRepositoryDescription,
|
|
146
|
-
inputSchema: createRepositoryInputSchema,
|
|
147
|
-
execute: withToken(createRepositoryCore, ctx)
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
name: "createOrUpdateFile",
|
|
151
|
-
writeTool: "createOrUpdateFile",
|
|
152
|
-
description: createOrUpdateFileDescription,
|
|
153
|
-
inputSchema: createOrUpdateFileInputSchema,
|
|
154
|
-
execute: withToken(createOrUpdateFileCore, ctx, {
|
|
155
|
-
author: ctx.author,
|
|
156
|
-
committer: ctx.committer,
|
|
157
|
-
coAuthors: ctx.coAuthors
|
|
158
|
-
})
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
name: "listPullRequests",
|
|
162
|
-
description: listPullRequestsDescription,
|
|
163
|
-
inputSchema: listPullRequestsInputSchema,
|
|
164
|
-
execute: withToken(listPullRequestsCore, ctx)
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
name: "getPullRequest",
|
|
168
|
-
description: getPullRequestDescription,
|
|
169
|
-
inputSchema: getPullRequestInputSchema,
|
|
170
|
-
execute: withToken(getPullRequestCore, ctx)
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
name: "createPullRequest",
|
|
174
|
-
writeTool: "createPullRequest",
|
|
175
|
-
description: createPullRequestDescription,
|
|
176
|
-
inputSchema: createPullRequestInputSchema,
|
|
177
|
-
execute: withToken(createPullRequestCore, ctx)
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
name: "mergePullRequest",
|
|
181
|
-
writeTool: "mergePullRequest",
|
|
182
|
-
description: mergePullRequestDescription,
|
|
183
|
-
inputSchema: mergePullRequestInputSchema,
|
|
184
|
-
execute: withToken(mergePullRequestCore, ctx, { coAuthors: ctx.coAuthors })
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
name: "updatePullRequest",
|
|
188
|
-
writeTool: "updatePullRequest",
|
|
189
|
-
description: updatePullRequestDescription,
|
|
190
|
-
inputSchema: updatePullRequestInputSchema,
|
|
191
|
-
execute: withToken(updatePullRequestCore, ctx)
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
name: "addPullRequestComment",
|
|
195
|
-
writeTool: "addPullRequestComment",
|
|
196
|
-
description: addPullRequestCommentDescription,
|
|
197
|
-
inputSchema: addPullRequestCommentInputSchema,
|
|
198
|
-
execute: withToken(addPullRequestCommentCore, ctx)
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
name: "updatePullRequestComment",
|
|
202
|
-
writeTool: "updatePullRequestComment",
|
|
203
|
-
description: updatePullRequestCommentDescription,
|
|
204
|
-
inputSchema: updatePullRequestCommentInputSchema,
|
|
205
|
-
execute: withToken(updatePullRequestCommentCore, ctx)
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
name: "deletePullRequestComment",
|
|
209
|
-
writeTool: "deletePullRequestComment",
|
|
210
|
-
description: deletePullRequestCommentDescription,
|
|
211
|
-
inputSchema: deletePullRequestCommentInputSchema,
|
|
212
|
-
execute: withToken(deletePullRequestCommentCore, ctx)
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
name: "listPullRequestFiles",
|
|
216
|
-
description: listPullRequestFilesDescription,
|
|
217
|
-
inputSchema: listPullRequestFilesInputSchema,
|
|
218
|
-
execute: withToken(listPullRequestFilesCore, ctx),
|
|
219
|
-
toModelOutput: GITHUB_EVE_TOOL_MODEL_OUTPUT.listPullRequestFiles
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
name: "listPullRequestReviews",
|
|
223
|
-
description: listPullRequestReviewsDescription,
|
|
224
|
-
inputSchema: listPullRequestReviewsInputSchema,
|
|
225
|
-
execute: withToken(listPullRequestReviewsCore, ctx)
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
name: "createPullRequestReview",
|
|
229
|
-
writeTool: "createPullRequestReview",
|
|
230
|
-
description: createPullRequestReviewDescription,
|
|
231
|
-
inputSchema: createPullRequestReviewInputSchema,
|
|
232
|
-
execute: withToken(createPullRequestReviewCore, ctx)
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
name: "requestReviewers",
|
|
236
|
-
writeTool: "requestReviewers",
|
|
237
|
-
description: requestReviewersDescription,
|
|
238
|
-
inputSchema: requestReviewersInputSchema,
|
|
239
|
-
execute: withToken(requestReviewersCore, ctx)
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
name: "getPullRequestContext",
|
|
243
|
-
description: getPullRequestContextDescription,
|
|
244
|
-
inputSchema: getPullRequestContextInputSchema,
|
|
245
|
-
execute: withToken(getPullRequestContextCore, ctx),
|
|
246
|
-
toModelOutput: GITHUB_EVE_TOOL_MODEL_OUTPUT.getPullRequestContext
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
name: "getIssueContext",
|
|
250
|
-
description: getIssueContextDescription,
|
|
251
|
-
inputSchema: getIssueContextInputSchema,
|
|
252
|
-
execute: withToken(getIssueContextCore, ctx)
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
name: "listIssues",
|
|
256
|
-
description: listIssuesDescription,
|
|
257
|
-
inputSchema: listIssuesInputSchema,
|
|
258
|
-
execute: withToken(listIssuesCore, ctx)
|
|
259
|
-
},
|
|
260
|
-
{
|
|
261
|
-
name: "getIssue",
|
|
262
|
-
description: getIssueDescription,
|
|
263
|
-
inputSchema: getIssueInputSchema,
|
|
264
|
-
execute: withToken(getIssueCore, ctx)
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
name: "listIssueComments",
|
|
268
|
-
description: listIssueCommentsDescription,
|
|
269
|
-
inputSchema: listIssueCommentsInputSchema,
|
|
270
|
-
execute: withToken(listIssueCommentsCore, ctx)
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
name: "createIssue",
|
|
274
|
-
writeTool: "createIssue",
|
|
275
|
-
description: createIssueDescription,
|
|
276
|
-
inputSchema: createIssueInputSchema,
|
|
277
|
-
execute: withToken(createIssueCore, ctx)
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
name: "addIssueComment",
|
|
281
|
-
writeTool: "addIssueComment",
|
|
282
|
-
description: addIssueCommentDescription,
|
|
283
|
-
inputSchema: addIssueCommentInputSchema,
|
|
284
|
-
execute: withToken(addIssueCommentCore, ctx)
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
name: "updateIssueComment",
|
|
288
|
-
writeTool: "updateIssueComment",
|
|
289
|
-
description: updateIssueCommentDescription,
|
|
290
|
-
inputSchema: updateIssueCommentInputSchema,
|
|
291
|
-
execute: withToken(updateIssueCommentCore, ctx)
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
name: "deleteIssueComment",
|
|
295
|
-
writeTool: "deleteIssueComment",
|
|
296
|
-
description: deleteIssueCommentDescription,
|
|
297
|
-
inputSchema: deleteIssueCommentInputSchema,
|
|
298
|
-
execute: withToken(deleteIssueCommentCore, ctx)
|
|
299
|
-
},
|
|
300
|
-
{
|
|
301
|
-
name: "closeIssue",
|
|
302
|
-
writeTool: "closeIssue",
|
|
303
|
-
description: closeIssueDescription,
|
|
304
|
-
inputSchema: closeIssueInputSchema,
|
|
305
|
-
execute: withToken(closeIssueCore, ctx)
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
name: "updateIssue",
|
|
309
|
-
writeTool: "updateIssue",
|
|
310
|
-
description: updateIssueDescription,
|
|
311
|
-
inputSchema: updateIssueInputSchema,
|
|
312
|
-
execute: withToken(updateIssueCore, ctx)
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
name: "listLabels",
|
|
316
|
-
description: listLabelsDescription,
|
|
317
|
-
inputSchema: listLabelsInputSchema,
|
|
318
|
-
execute: withToken(listLabelsCore, ctx)
|
|
319
|
-
},
|
|
320
|
-
{
|
|
321
|
-
name: "addLabels",
|
|
322
|
-
writeTool: "addLabels",
|
|
323
|
-
description: addLabelsDescription,
|
|
324
|
-
inputSchema: addLabelsInputSchema,
|
|
325
|
-
execute: withToken(addLabelsCore, ctx)
|
|
326
|
-
},
|
|
327
|
-
{
|
|
328
|
-
name: "removeLabel",
|
|
329
|
-
writeTool: "removeLabel",
|
|
330
|
-
description: removeLabelDescription,
|
|
331
|
-
inputSchema: removeLabelInputSchema,
|
|
332
|
-
execute: withToken(removeLabelCore, ctx)
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
name: "createLabel",
|
|
336
|
-
writeTool: "createLabel",
|
|
337
|
-
description: createLabelDescription,
|
|
338
|
-
inputSchema: createLabelInputSchema,
|
|
339
|
-
execute: withToken(createLabelCore, ctx)
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
name: "updateLabel",
|
|
343
|
-
writeTool: "updateLabel",
|
|
344
|
-
description: updateLabelDescription,
|
|
345
|
-
inputSchema: updateLabelInputSchema,
|
|
346
|
-
execute: withToken(updateLabelCore, ctx)
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
name: "deleteLabel",
|
|
350
|
-
writeTool: "deleteLabel",
|
|
351
|
-
description: deleteLabelDescription,
|
|
352
|
-
inputSchema: deleteLabelInputSchema,
|
|
353
|
-
execute: withToken(deleteLabelCore, ctx)
|
|
354
|
-
},
|
|
355
|
-
{
|
|
356
|
-
name: "addAssignees",
|
|
357
|
-
writeTool: "addAssignees",
|
|
358
|
-
description: addAssigneesDescription,
|
|
359
|
-
inputSchema: addAssigneesInputSchema,
|
|
360
|
-
execute: withToken(addAssigneesCore, ctx)
|
|
361
|
-
},
|
|
362
|
-
{
|
|
363
|
-
name: "removeAssignees",
|
|
364
|
-
writeTool: "removeAssignees",
|
|
365
|
-
description: removeAssigneesDescription,
|
|
366
|
-
inputSchema: removeAssigneesInputSchema,
|
|
367
|
-
execute: withToken(removeAssigneesCore, ctx)
|
|
368
|
-
},
|
|
369
|
-
{
|
|
370
|
-
name: "listIssueReactions",
|
|
371
|
-
description: listIssueReactionsDescription,
|
|
372
|
-
inputSchema: listIssueReactionsInputSchema,
|
|
373
|
-
execute: withToken(listIssueReactionsCore, ctx)
|
|
374
|
-
},
|
|
375
|
-
{
|
|
376
|
-
name: "addIssueReaction",
|
|
377
|
-
writeTool: "addIssueReaction",
|
|
378
|
-
description: addIssueReactionDescription,
|
|
379
|
-
inputSchema: addIssueReactionInputSchema,
|
|
380
|
-
execute: withToken(addIssueReactionCore, ctx)
|
|
381
|
-
},
|
|
382
|
-
{
|
|
383
|
-
name: "listCommentReactions",
|
|
384
|
-
description: listCommentReactionsDescription,
|
|
385
|
-
inputSchema: listCommentReactionsInputSchema,
|
|
386
|
-
execute: withToken(listCommentReactionsCore, ctx)
|
|
387
|
-
},
|
|
388
|
-
{
|
|
389
|
-
name: "addCommentReaction",
|
|
390
|
-
writeTool: "addCommentReaction",
|
|
391
|
-
description: addCommentReactionDescription,
|
|
392
|
-
inputSchema: addCommentReactionInputSchema,
|
|
393
|
-
execute: withToken(addCommentReactionCore, ctx)
|
|
394
|
-
},
|
|
395
|
-
{
|
|
396
|
-
name: "listDiscussions",
|
|
397
|
-
description: listDiscussionsDescription,
|
|
398
|
-
inputSchema: listDiscussionsInputSchema,
|
|
399
|
-
execute: withToken(listDiscussionsCore, ctx)
|
|
400
|
-
},
|
|
401
|
-
{
|
|
402
|
-
name: "getDiscussion",
|
|
403
|
-
description: getDiscussionDescription,
|
|
404
|
-
inputSchema: getDiscussionInputSchema,
|
|
405
|
-
execute: withToken(getDiscussionCore, ctx)
|
|
406
|
-
},
|
|
407
|
-
{
|
|
408
|
-
name: "addDiscussionComment",
|
|
409
|
-
writeTool: "addDiscussionComment",
|
|
410
|
-
description: addDiscussionCommentDescription,
|
|
411
|
-
inputSchema: addDiscussionCommentInputSchema,
|
|
412
|
-
execute: withToken(addDiscussionCommentCore, ctx)
|
|
413
|
-
},
|
|
414
|
-
{
|
|
415
|
-
name: "listNotifications",
|
|
416
|
-
description: listNotificationsDescription,
|
|
417
|
-
inputSchema: listNotificationsInputSchema,
|
|
418
|
-
execute: withToken(listNotificationsCore, ctx)
|
|
419
|
-
},
|
|
420
|
-
{
|
|
421
|
-
name: "markNotificationRead",
|
|
422
|
-
writeTool: "markNotificationRead",
|
|
423
|
-
description: markNotificationReadDescription,
|
|
424
|
-
inputSchema: markNotificationReadInputSchema,
|
|
425
|
-
execute: withToken(markNotificationReadCore, ctx)
|
|
426
|
-
},
|
|
427
|
-
{
|
|
428
|
-
name: "searchCode",
|
|
429
|
-
description: searchCodeDescription,
|
|
430
|
-
inputSchema: searchCodeInputSchema,
|
|
431
|
-
execute: withToken(searchCodeCore, ctx)
|
|
432
|
-
},
|
|
433
|
-
{
|
|
434
|
-
name: "searchRepositories",
|
|
435
|
-
description: searchRepositoriesDescription,
|
|
436
|
-
inputSchema: searchRepositoriesInputSchema,
|
|
437
|
-
execute: withToken(searchRepositoriesCore, ctx)
|
|
438
|
-
},
|
|
439
|
-
{
|
|
440
|
-
name: "searchIssues",
|
|
441
|
-
description: searchIssuesDescription,
|
|
442
|
-
inputSchema: searchIssuesInputSchema,
|
|
443
|
-
execute: withToken(searchIssuesCore, ctx)
|
|
444
|
-
},
|
|
445
|
-
{
|
|
446
|
-
name: "listCommits",
|
|
447
|
-
description: listCommitsDescription,
|
|
448
|
-
inputSchema: listCommitsInputSchema,
|
|
449
|
-
execute: withToken(listCommitsCore, ctx)
|
|
450
|
-
},
|
|
451
|
-
{
|
|
452
|
-
name: "getCommit",
|
|
453
|
-
description: getCommitDescription,
|
|
454
|
-
inputSchema: getCommitInputSchema,
|
|
455
|
-
execute: withToken(getCommitCore, ctx),
|
|
456
|
-
toModelOutput: GITHUB_EVE_TOOL_MODEL_OUTPUT.getCommit
|
|
457
|
-
},
|
|
458
|
-
{
|
|
459
|
-
name: "getBlame",
|
|
460
|
-
description: getBlameDescription,
|
|
461
|
-
inputSchema: getBlameInputSchema,
|
|
462
|
-
execute: withToken(getBlameCore, ctx)
|
|
463
|
-
},
|
|
464
|
-
{
|
|
465
|
-
name: "compareCommits",
|
|
466
|
-
description: compareCommitsDescription,
|
|
467
|
-
inputSchema: compareCommitsInputSchema,
|
|
468
|
-
execute: withToken(compareCommitsCore, ctx),
|
|
469
|
-
toModelOutput: GITHUB_EVE_TOOL_MODEL_OUTPUT.compareCommits
|
|
470
|
-
},
|
|
471
|
-
{
|
|
472
|
-
name: "listGists",
|
|
473
|
-
description: listGistsDescription,
|
|
474
|
-
inputSchema: listGistsInputSchema,
|
|
475
|
-
execute: withToken(listGistsCore, ctx)
|
|
476
|
-
},
|
|
477
|
-
{
|
|
478
|
-
name: "getGist",
|
|
479
|
-
description: getGistDescription,
|
|
480
|
-
inputSchema: getGistInputSchema,
|
|
481
|
-
execute: withToken(getGistCore, ctx)
|
|
482
|
-
},
|
|
483
|
-
{
|
|
484
|
-
name: "listGistComments",
|
|
485
|
-
description: listGistCommentsDescription,
|
|
486
|
-
inputSchema: listGistCommentsInputSchema,
|
|
487
|
-
execute: withToken(listGistCommentsCore, ctx)
|
|
488
|
-
},
|
|
489
|
-
{
|
|
490
|
-
name: "createGist",
|
|
491
|
-
writeTool: "createGist",
|
|
492
|
-
description: createGistDescription,
|
|
493
|
-
inputSchema: createGistInputSchema,
|
|
494
|
-
execute: withToken(createGistCore, ctx)
|
|
495
|
-
},
|
|
496
|
-
{
|
|
497
|
-
name: "updateGist",
|
|
498
|
-
writeTool: "updateGist",
|
|
499
|
-
description: updateGistDescription,
|
|
500
|
-
inputSchema: updateGistInputSchema,
|
|
501
|
-
execute: withToken(updateGistCore, ctx)
|
|
502
|
-
},
|
|
503
|
-
{
|
|
504
|
-
name: "deleteGist",
|
|
505
|
-
writeTool: "deleteGist",
|
|
506
|
-
description: deleteGistDescription,
|
|
507
|
-
inputSchema: deleteGistInputSchema,
|
|
508
|
-
execute: withToken(deleteGistCore, ctx)
|
|
509
|
-
},
|
|
510
|
-
{
|
|
511
|
-
name: "createGistComment",
|
|
512
|
-
writeTool: "createGistComment",
|
|
513
|
-
description: createGistCommentDescription,
|
|
514
|
-
inputSchema: createGistCommentInputSchema,
|
|
515
|
-
execute: withToken(createGistCommentCore, ctx)
|
|
516
|
-
},
|
|
517
|
-
{
|
|
518
|
-
name: "listWorkflows",
|
|
519
|
-
description: listWorkflowsDescription,
|
|
520
|
-
inputSchema: listWorkflowsInputSchema,
|
|
521
|
-
execute: withToken(listWorkflowsCore, ctx)
|
|
522
|
-
},
|
|
523
|
-
{
|
|
524
|
-
name: "listWorkflowRuns",
|
|
525
|
-
description: listWorkflowRunsDescription,
|
|
526
|
-
inputSchema: listWorkflowRunsInputSchema,
|
|
527
|
-
execute: withToken(listWorkflowRunsCore, ctx)
|
|
528
|
-
},
|
|
529
|
-
{
|
|
530
|
-
name: "getWorkflowRun",
|
|
531
|
-
description: getWorkflowRunDescription,
|
|
532
|
-
inputSchema: getWorkflowRunInputSchema,
|
|
533
|
-
execute: withToken(getWorkflowRunCore, ctx)
|
|
534
|
-
},
|
|
535
|
-
{
|
|
536
|
-
name: "listWorkflowJobs",
|
|
537
|
-
description: listWorkflowJobsDescription,
|
|
538
|
-
inputSchema: listWorkflowJobsInputSchema,
|
|
539
|
-
execute: withToken(listWorkflowJobsCore, ctx)
|
|
540
|
-
},
|
|
541
|
-
{
|
|
542
|
-
name: "triggerWorkflow",
|
|
543
|
-
writeTool: "triggerWorkflow",
|
|
544
|
-
description: triggerWorkflowDescription,
|
|
545
|
-
inputSchema: triggerWorkflowInputSchema,
|
|
546
|
-
execute: withToken(triggerWorkflowCore, ctx)
|
|
547
|
-
},
|
|
548
|
-
{
|
|
549
|
-
name: "cancelWorkflowRun",
|
|
550
|
-
writeTool: "cancelWorkflowRun",
|
|
551
|
-
description: cancelWorkflowRunDescription,
|
|
552
|
-
inputSchema: cancelWorkflowRunInputSchema,
|
|
553
|
-
execute: withToken(cancelWorkflowRunCore, ctx)
|
|
554
|
-
},
|
|
555
|
-
{
|
|
556
|
-
name: "rerunWorkflowRun",
|
|
557
|
-
writeTool: "rerunWorkflowRun",
|
|
558
|
-
description: rerunWorkflowRunDescription,
|
|
559
|
-
inputSchema: rerunWorkflowRunInputSchema,
|
|
560
|
-
execute: withToken(rerunWorkflowRunCore, ctx)
|
|
561
|
-
},
|
|
562
|
-
{
|
|
563
|
-
name: "listCheckRuns",
|
|
564
|
-
description: listCheckRunsDescription,
|
|
565
|
-
inputSchema: listCheckRunsInputSchema,
|
|
566
|
-
execute: withToken(listCheckRunsCore, ctx)
|
|
567
|
-
},
|
|
568
|
-
{
|
|
569
|
-
name: "getCombinedStatus",
|
|
570
|
-
description: getCombinedStatusDescription,
|
|
571
|
-
inputSchema: getCombinedStatusInputSchema,
|
|
572
|
-
execute: withToken(getCombinedStatusCore, ctx)
|
|
573
|
-
},
|
|
574
|
-
{
|
|
575
|
-
name: "getCiFailureContext",
|
|
576
|
-
description: getCiFailureContextDescription,
|
|
577
|
-
inputSchema: getCiFailureContextInputSchema,
|
|
578
|
-
execute: withToken(getCiFailureContextCore, ctx)
|
|
579
|
-
},
|
|
580
|
-
{
|
|
581
|
-
name: "listReleases",
|
|
582
|
-
description: listReleasesDescription,
|
|
583
|
-
inputSchema: listReleasesInputSchema,
|
|
584
|
-
execute: withToken(listReleasesCore, ctx)
|
|
585
|
-
},
|
|
586
|
-
{
|
|
587
|
-
name: "getLatestRelease",
|
|
588
|
-
description: getLatestReleaseDescription,
|
|
589
|
-
inputSchema: getLatestReleaseInputSchema,
|
|
590
|
-
execute: withToken(getLatestReleaseCore, ctx)
|
|
591
|
-
},
|
|
592
|
-
{
|
|
593
|
-
name: "getRelease",
|
|
594
|
-
description: getReleaseDescription,
|
|
595
|
-
inputSchema: getReleaseInputSchema,
|
|
596
|
-
execute: withToken(getReleaseCore, ctx)
|
|
597
|
-
},
|
|
598
|
-
{
|
|
599
|
-
name: "getReleaseContext",
|
|
600
|
-
description: getReleaseContextDescription,
|
|
601
|
-
inputSchema: getReleaseContextInputSchema,
|
|
602
|
-
execute: withToken(getReleaseContextCore, ctx)
|
|
603
|
-
},
|
|
604
|
-
{
|
|
605
|
-
name: "createRelease",
|
|
606
|
-
writeTool: "createRelease",
|
|
607
|
-
description: createReleaseDescription,
|
|
608
|
-
inputSchema: createReleaseInputSchema,
|
|
609
|
-
execute: withToken(createReleaseCore, ctx)
|
|
610
|
-
},
|
|
611
|
-
{
|
|
612
|
-
name: "updateRelease",
|
|
613
|
-
writeTool: "updateRelease",
|
|
614
|
-
description: updateReleaseDescription,
|
|
615
|
-
inputSchema: updateReleaseInputSchema,
|
|
616
|
-
execute: withToken(updateReleaseCore, ctx)
|
|
617
|
-
},
|
|
618
|
-
{
|
|
619
|
-
name: "deleteRelease",
|
|
620
|
-
writeTool: "deleteRelease",
|
|
621
|
-
description: deleteReleaseDescription,
|
|
622
|
-
inputSchema: deleteReleaseInputSchema,
|
|
623
|
-
execute: withToken(deleteReleaseCore, ctx)
|
|
624
|
-
}
|
|
625
|
-
];
|
|
626
|
-
if (!ctx.context) return entries;
|
|
627
|
-
return entries.map((entry) => ({
|
|
628
|
-
...entry,
|
|
629
|
-
inputSchema: softenContextSchema(entry.inputSchema, ctx.context)
|
|
630
|
-
}));
|
|
631
|
-
}
|
|
632
|
-
//#endregion
|
|
633
|
-
//#region src/eve/steps.ts
|
|
634
|
-
async function executeGithubToolStep(name, input, ctx) {
|
|
635
|
-
"use step";
|
|
636
|
-
const entry = createToolRegistry(ctx).find((tool) => tool.name === name);
|
|
637
|
-
if (!entry) throw new Error(`Unknown GitHub tool: ${name}`);
|
|
638
|
-
return entry.execute(input);
|
|
639
|
-
}
|
|
640
|
-
async function runGithubToolStep(name, input, ctx) {
|
|
641
|
-
try {
|
|
642
|
-
const token = await resolveGithubToken(ctx.token);
|
|
643
|
-
return await executeGithubToolStep(name, input, {
|
|
644
|
-
...ctx,
|
|
645
|
-
token
|
|
646
|
-
});
|
|
647
|
-
} catch (error) {
|
|
648
|
-
return { error: error instanceof Error ? error.message : String(error) };
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
//#endregion
|
|
652
|
-
//#region src/eve/build.ts
|
|
653
|
-
function resolveAllowedToolNames(options) {
|
|
654
|
-
const presetAllowed = options.preset ? resolvePresetTools(options.preset) : null;
|
|
655
|
-
const includeAllowed = options.include ? new Set(options.include) : null;
|
|
656
|
-
const excluded = options.exclude ? new Set(options.exclude) : null;
|
|
657
|
-
const allowed = presetAllowed && includeAllowed ? /* @__PURE__ */ new Set([...presetAllowed, ...includeAllowed]) : presetAllowed ?? includeAllowed;
|
|
658
|
-
return (name) => (!allowed || allowed.has(name)) && !excluded?.has(name);
|
|
659
|
-
}
|
|
660
|
-
function applyOverrides(tool, name, overrides) {
|
|
661
|
-
const override = overrides?.[name];
|
|
662
|
-
if (!override) return tool;
|
|
663
|
-
const next = {
|
|
664
|
-
...tool,
|
|
665
|
-
...override.description !== void 0 && { description: override.description },
|
|
666
|
-
...override.toModelOutput !== void 0 && { toModelOutput: override.toModelOutput },
|
|
667
|
-
...override.outputSchema !== void 0 && { outputSchema: override.outputSchema }
|
|
668
|
-
};
|
|
669
|
-
if (override.approval === void 0) return next;
|
|
670
|
-
if (isEveApprovalDisabled(override.approval)) {
|
|
671
|
-
const rest = { ...next };
|
|
672
|
-
delete rest.approval;
|
|
673
|
-
return rest;
|
|
674
|
-
}
|
|
675
|
-
return {
|
|
676
|
-
...next,
|
|
677
|
-
approval: mapEveApprovalValue(override.approval)
|
|
678
|
-
};
|
|
679
|
-
}
|
|
680
|
-
function buildEveToolDefinition(name, options = {}) {
|
|
681
|
-
const { defineTool } = getEveTools();
|
|
682
|
-
const ctx = {
|
|
683
|
-
token: createGithubTokenResolver(options.token),
|
|
684
|
-
context: options.context,
|
|
685
|
-
author: options.author,
|
|
686
|
-
committer: options.committer,
|
|
687
|
-
coAuthors: options.coAuthors
|
|
688
|
-
};
|
|
689
|
-
const entry = createToolRegistry(ctx).find((tool) => tool.name === name);
|
|
690
|
-
if (!entry) throw new Error(`Unknown GitHub tool: ${name}`);
|
|
691
|
-
const approval = entry.writeTool ? resolveEveToolApproval(entry.writeTool, options.requireApproval) : void 0;
|
|
692
|
-
return applyOverrides(defineTool({
|
|
693
|
-
description: entry.description,
|
|
694
|
-
inputSchema: entry.inputSchema,
|
|
695
|
-
...approval && { approval },
|
|
696
|
-
toModelOutput: (output) => formatGithubEveToolOutput(name, output),
|
|
697
|
-
execute: async (input) => runGithubToolStep(name, input, ctx)
|
|
698
|
-
}), name, options.overrides);
|
|
699
|
-
}
|
|
700
|
-
function buildEveToolMap(options = {}) {
|
|
701
|
-
const { defineTool } = getEveTools();
|
|
702
|
-
const ctx = {
|
|
703
|
-
token: createGithubTokenResolver(options.token),
|
|
704
|
-
context: options.context,
|
|
705
|
-
author: options.author,
|
|
706
|
-
committer: options.committer,
|
|
707
|
-
coAuthors: options.coAuthors
|
|
708
|
-
};
|
|
709
|
-
const isAllowed = resolveAllowedToolNames(options);
|
|
710
|
-
const registry = createToolRegistry(ctx);
|
|
711
|
-
const tools = {};
|
|
712
|
-
for (const entry of registry) {
|
|
713
|
-
if (!isAllowed(entry.name)) continue;
|
|
714
|
-
const approval = entry.writeTool ? resolveEveToolApproval(entry.writeTool, options.requireApproval) : void 0;
|
|
715
|
-
const tool = defineTool({
|
|
716
|
-
description: entry.description,
|
|
717
|
-
inputSchema: entry.inputSchema,
|
|
718
|
-
...approval && { approval },
|
|
719
|
-
toModelOutput: (output) => formatGithubEveToolOutput(entry.name, output),
|
|
720
|
-
execute: async (input) => runGithubToolStep(entry.name, input, ctx)
|
|
721
|
-
});
|
|
722
|
-
tools[entry.name] = applyOverrides(tool, entry.name, options.overrides);
|
|
723
|
-
}
|
|
724
|
-
return tools;
|
|
725
|
-
}
|
|
726
|
-
function createEveGithubToolsDynamic(options = {}) {
|
|
727
|
-
const { defineDynamic } = getEveTools();
|
|
728
|
-
return defineDynamic({ events: { "step.started": async () => buildEveToolMap(options) } });
|
|
729
|
-
}
|
|
730
|
-
function listResolvedEveToolNames(options = {}) {
|
|
731
|
-
const isAllowed = resolveAllowedToolNames(options);
|
|
732
|
-
return ALL_GITHUB_TOOL_NAMES.filter(isAllowed);
|
|
733
|
-
}
|
|
734
|
-
/**
|
|
735
|
-
* Tool descriptors (no `execute`) for authored eve `defineTool` loops.
|
|
736
|
-
* Prefer this when registering tools outside the SDK package so durable transforms can hoist inline execute.
|
|
737
|
-
*/
|
|
738
|
-
function listEveToolDescriptors(options = {}) {
|
|
739
|
-
const ctx = {
|
|
740
|
-
token: createGithubTokenResolver(options.token),
|
|
741
|
-
context: options.context,
|
|
742
|
-
author: options.author,
|
|
743
|
-
committer: options.committer,
|
|
744
|
-
coAuthors: options.coAuthors
|
|
745
|
-
};
|
|
746
|
-
const isAllowed = resolveAllowedToolNames(options);
|
|
747
|
-
return createToolRegistry(ctx).filter((entry) => isAllowed(entry.name)).map((entry) => ({
|
|
748
|
-
name: entry.name,
|
|
749
|
-
description: entry.description,
|
|
750
|
-
inputSchema: entry.inputSchema,
|
|
751
|
-
writeTool: entry.writeTool,
|
|
752
|
-
toModelOutput: entry.toModelOutput
|
|
753
|
-
}));
|
|
754
|
-
}
|
|
755
|
-
/**
|
|
756
|
-
* Execute a GitHub tool by name with the given eve options (token/context/attribution).
|
|
757
|
-
* Used by `@github-tools/eve-extension` so `execute` only closes over a serializable tool name.
|
|
758
|
-
*/
|
|
759
|
-
async function executeGithubEveTool(name, input, options = {}) {
|
|
760
|
-
return runGithubToolStep(name, input, {
|
|
761
|
-
token: createGithubTokenResolver(options.token),
|
|
762
|
-
context: options.context,
|
|
763
|
-
author: options.author,
|
|
764
|
-
committer: options.committer,
|
|
765
|
-
coAuthors: options.coAuthors
|
|
766
|
-
});
|
|
767
|
-
}
|
|
768
|
-
//#endregion
|
|
769
|
-
export { listEveToolDescriptors as a, hasGithubEveToolModelOutput as c, resolveEveApproval as d, resolveEveToolApproval as f, executeGithubEveTool as i, isEveApprovalDisabled as l, buildEveToolMap as n, listResolvedEveToolNames as o, MISSING_EVE_MESSAGE as p, createEveGithubToolsDynamic as r, formatGithubEveToolOutput as s, buildEveToolDefinition as t, mapEveApprovalValue as u };
|
|
770
|
-
|
|
771
|
-
//# sourceMappingURL=eve-runtime-3asyv7YM.mjs.map
|