@github-tools/sdk 1.16.1 → 1.18.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 +51 -15
- package/dist/connect/eve.d.mts +2 -2
- package/dist/connect/eve.d.mts.map +1 -1
- package/dist/connect/eve.mjs +1 -1
- package/dist/connect.d.mts +12 -4
- package/dist/connect.d.mts.map +1 -1
- package/dist/connect.mjs +2 -2
- package/dist/cores-BeLZwcde.mjs +269 -0
- package/dist/cores-BeLZwcde.mjs.map +1 -0
- package/dist/evaluation-f-2QwBid.mjs +210 -0
- package/dist/evaluation-f-2QwBid.mjs.map +1 -0
- package/dist/{eve-runtime-BnWUzXdV.d.mts → eve-runtime-DNQrQZ36.d.mts} +5 -5
- package/dist/{eve-runtime-BnWUzXdV.d.mts.map → eve-runtime-DNQrQZ36.d.mts.map} +1 -1
- package/dist/{eve-runtime-Cfyy1tzp.mjs → eve-runtime-DnhM9Vog.mjs} +14 -11
- package/dist/eve-runtime-DnhM9Vog.mjs.map +1 -0
- package/dist/eve-runtime.d.mts +5 -5
- package/dist/eve-runtime.mjs +4 -3
- package/dist/eve.d.mts +4 -4
- package/dist/eve.d.mts.map +1 -1
- package/dist/eve.mjs +2 -2
- package/dist/{index-JH3DVh1R.d.mts → index-DkZvveZP.d.mts} +337 -11
- package/dist/index-DkZvveZP.d.mts.map +1 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -3
- package/dist/instructions-BuypoY0x.mjs +148 -0
- package/dist/instructions-BuypoY0x.mjs.map +1 -0
- package/dist/interrupts-BSDPwdJ2.d.mts +60 -0
- package/dist/interrupts-BSDPwdJ2.d.mts.map +1 -0
- package/dist/{src-C54blWpT.mjs → src-Bx5p1Unc.mjs} +130 -232
- package/dist/src-Bx5p1Unc.mjs.map +1 -0
- package/dist/tanstack/interrupts.d.mts +2 -0
- package/dist/tanstack/interrupts.mjs +17 -0
- package/dist/tanstack/interrupts.mjs.map +1 -0
- package/dist/tanstack.d.mts +4971 -0
- package/dist/tanstack.d.mts.map +1 -0
- package/dist/tanstack.mjs +465 -0
- package/dist/tanstack.mjs.map +1 -0
- package/dist/{token-Iop2lapd.mjs → token-BOLrrbTS.mjs} +65 -10
- package/dist/token-BOLrrbTS.mjs.map +1 -0
- package/dist/tool-types-CrC80SIL.d.mts +1573 -0
- package/dist/tool-types-CrC80SIL.d.mts.map +1 -0
- package/dist/{types-ve9shBaf.d.mts → types-BmwOpI5-.d.mts} +19 -8
- package/dist/types-BmwOpI5-.d.mts.map +1 -0
- package/dist/{types-BKXTeCqT.d.mts → types-CPAsEMzx.d.mts} +2 -2
- package/dist/{types-BKXTeCqT.d.mts.map → types-CPAsEMzx.d.mts.map} +1 -1
- package/dist/workflow.d.mts +7 -5
- package/dist/workflow.d.mts.map +1 -1
- package/dist/workflow.mjs +3 -2
- package/dist/workflow.mjs.map +1 -1
- package/dist/{write-tools-BvuWAzwo.mjs → write-tools-BaoTUCg7.mjs} +2293 -2558
- package/dist/write-tools-BaoTUCg7.mjs.map +1 -0
- package/package.json +32 -16
- package/dist/eve-runtime-Cfyy1tzp.mjs.map +0 -1
- package/dist/index-JH3DVh1R.d.mts.map +0 -1
- package/dist/src-C54blWpT.mjs.map +0 -1
- package/dist/token-Iop2lapd.mjs.map +0 -1
- package/dist/tool-types-BsfalcyC.d.mts +0 -4163
- package/dist/tool-types-BsfalcyC.d.mts.map +0 -1
- package/dist/types-ve9shBaf.d.mts.map +0 -1
- package/dist/write-tools-BvuWAzwo.mjs.map +0 -1
|
@@ -1,10 +1,311 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as GithubTokenInput, E as GithubToolPreset, O as PresetToolName, T as CombinedPresetToolNames, c as GithubTool, j as GithubToolName, l as Octokit$1, n as GithubToolsBaseOptions, o as CommitIdentity, s as CommitToolOptions, t as AllGithubTools, u as ToolOptions } from "./tool-types-CrC80SIL.mjs";
|
|
2
2
|
import { ToolLoopAgent, ToolLoopAgentSettings, ToolSet } from "ai";
|
|
3
|
+
import { z } from "zod";
|
|
3
4
|
import { Octokit } from "octokit";
|
|
4
5
|
import "evlog";
|
|
6
|
+
//#endregion
|
|
5
7
|
//#region src/client.d.ts
|
|
6
8
|
declare function createOctokit(token: string): Octokit;
|
|
7
9
|
//#endregion
|
|
10
|
+
//#region src/core/pagination.d.ts
|
|
11
|
+
type PagingFields = {
|
|
12
|
+
hasMore: boolean;
|
|
13
|
+
page: number;
|
|
14
|
+
perPage: number;
|
|
15
|
+
nextPage?: number;
|
|
16
|
+
};
|
|
17
|
+
type PagedList<T> = {
|
|
18
|
+
items: T[];
|
|
19
|
+
} & PagingFields;
|
|
20
|
+
declare namespace repository_d_exports {
|
|
21
|
+
export { composeCommitMessage, createBranchCore, createBranchDescription, createBranchInputSchema, createCommitOnBranch, createOrUpdateFileCore, createOrUpdateFileDescription, createOrUpdateFileInputSchema, createRepositoryCore, createRepositoryDescription, createRepositoryInputSchema, deleteBranchCore, deleteBranchDescription, deleteBranchInputSchema, forkRepositoryCore, forkRepositoryDescription, forkRepositoryInputSchema, getFileContentCore, getFileContentDescription, getFileContentInputSchema, getRepositoryCore, getRepositoryDescription, getRepositoryInputSchema, getRepositoryTreeCore, getRepositoryTreeDescription, getRepositoryTreeInputSchema, listBranchesCore, listBranchesDescription, listBranchesInputSchema };
|
|
22
|
+
}
|
|
23
|
+
declare function createCommitOnBranch(octokit: Octokit$1, input: {
|
|
24
|
+
owner: string;
|
|
25
|
+
repo: string;
|
|
26
|
+
branch: string;
|
|
27
|
+
expectedHeadOid: string;
|
|
28
|
+
headline: string;
|
|
29
|
+
body?: string;
|
|
30
|
+
additions?: Array<{
|
|
31
|
+
path: string;
|
|
32
|
+
contents: string;
|
|
33
|
+
}>;
|
|
34
|
+
deletions?: Array<{
|
|
35
|
+
path: string;
|
|
36
|
+
}>;
|
|
37
|
+
}): Promise<{
|
|
38
|
+
commitSha: string;
|
|
39
|
+
commitUrl: string;
|
|
40
|
+
}>;
|
|
41
|
+
declare function composeCommitMessage(message: string, coAuthors?: CommitIdentity[]): string;
|
|
42
|
+
declare const getRepositoryInputSchema: z.ZodObject<{
|
|
43
|
+
owner: z.ZodString;
|
|
44
|
+
repo: z.ZodString;
|
|
45
|
+
}, z.core.$strip>;
|
|
46
|
+
declare const getRepositoryDescription = "Get information about a GitHub repository including description, stars, forks, language, and default branch";
|
|
47
|
+
declare function getRepositoryCore({ token, owner, repo }: {
|
|
48
|
+
token: string;
|
|
49
|
+
owner: string;
|
|
50
|
+
repo: string;
|
|
51
|
+
}): Promise<{
|
|
52
|
+
name: string;
|
|
53
|
+
fullName: string;
|
|
54
|
+
description: string | null;
|
|
55
|
+
url: string;
|
|
56
|
+
defaultBranch: string;
|
|
57
|
+
stars: number;
|
|
58
|
+
forks: number;
|
|
59
|
+
openIssues: number;
|
|
60
|
+
language: string | null;
|
|
61
|
+
private: boolean;
|
|
62
|
+
createdAt: string;
|
|
63
|
+
updatedAt: string;
|
|
64
|
+
}>;
|
|
65
|
+
declare const listBranchesInputSchema: z.ZodObject<{
|
|
66
|
+
owner: z.ZodString;
|
|
67
|
+
repo: z.ZodString;
|
|
68
|
+
perPage: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
69
|
+
page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
70
|
+
}, z.core.$strip>;
|
|
71
|
+
declare const listBranchesDescription = "List branches in a GitHub repository. When hasMore, pass nextPage — do not repeat the same call.";
|
|
72
|
+
declare function listBranchesCore({ token, owner, repo, perPage, page }: {
|
|
73
|
+
token: string;
|
|
74
|
+
owner: string;
|
|
75
|
+
repo: string;
|
|
76
|
+
perPage: number;
|
|
77
|
+
page?: number;
|
|
78
|
+
}): Promise<PagedList<{
|
|
79
|
+
name: string;
|
|
80
|
+
sha: string;
|
|
81
|
+
protected: boolean;
|
|
82
|
+
}>>;
|
|
83
|
+
declare const getFileContentInputSchema: z.ZodObject<{
|
|
84
|
+
owner: z.ZodString;
|
|
85
|
+
repo: z.ZodString;
|
|
86
|
+
path: z.ZodString;
|
|
87
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
88
|
+
startLine: z.ZodOptional<z.ZodNumber>;
|
|
89
|
+
endLine: z.ZodOptional<z.ZodNumber>;
|
|
90
|
+
maxLines: z.ZodOptional<z.ZodNumber>;
|
|
91
|
+
}, z.core.$strip>;
|
|
92
|
+
declare const getFileContentDescription = "Get the content of a file from a GitHub repository. Prefer startLine/endLine or maxLines to read only the lines you need";
|
|
93
|
+
declare function getFileContentCore({ token, owner, repo, path, ref, startLine, endLine, maxLines }: {
|
|
94
|
+
token: string;
|
|
95
|
+
owner: string;
|
|
96
|
+
repo: string;
|
|
97
|
+
path: string;
|
|
98
|
+
ref?: string;
|
|
99
|
+
startLine?: number;
|
|
100
|
+
endLine?: number;
|
|
101
|
+
maxLines?: number;
|
|
102
|
+
}): Promise<{
|
|
103
|
+
type: "directory";
|
|
104
|
+
entries: {
|
|
105
|
+
name: string;
|
|
106
|
+
type: "file" | "dir" | "submodule" | "symlink";
|
|
107
|
+
path: string;
|
|
108
|
+
}[];
|
|
109
|
+
path?: undefined;
|
|
110
|
+
sha?: undefined;
|
|
111
|
+
size?: undefined;
|
|
112
|
+
totalLines?: undefined;
|
|
113
|
+
content?: undefined;
|
|
114
|
+
startLine?: undefined;
|
|
115
|
+
endLine?: undefined;
|
|
116
|
+
truncated?: undefined;
|
|
117
|
+
} | {
|
|
118
|
+
type: "submodule" | "symlink";
|
|
119
|
+
path: string;
|
|
120
|
+
entries?: undefined;
|
|
121
|
+
sha?: undefined;
|
|
122
|
+
size?: undefined;
|
|
123
|
+
totalLines?: undefined;
|
|
124
|
+
content?: undefined;
|
|
125
|
+
startLine?: undefined;
|
|
126
|
+
endLine?: undefined;
|
|
127
|
+
truncated?: undefined;
|
|
128
|
+
} | {
|
|
129
|
+
type: "file";
|
|
130
|
+
path: string;
|
|
131
|
+
sha: string;
|
|
132
|
+
size: number;
|
|
133
|
+
totalLines: number;
|
|
134
|
+
content: string;
|
|
135
|
+
entries?: undefined;
|
|
136
|
+
startLine?: undefined;
|
|
137
|
+
endLine?: undefined;
|
|
138
|
+
truncated?: undefined;
|
|
139
|
+
} | {
|
|
140
|
+
type: "file";
|
|
141
|
+
path: string;
|
|
142
|
+
sha: string;
|
|
143
|
+
size: number;
|
|
144
|
+
totalLines: number;
|
|
145
|
+
startLine: number;
|
|
146
|
+
endLine: number;
|
|
147
|
+
truncated: boolean;
|
|
148
|
+
content: string;
|
|
149
|
+
entries?: undefined;
|
|
150
|
+
}>;
|
|
151
|
+
declare const getRepositoryTreeInputSchema: z.ZodObject<{
|
|
152
|
+
owner: z.ZodString;
|
|
153
|
+
repo: z.ZodString;
|
|
154
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
155
|
+
path: z.ZodOptional<z.ZodString>;
|
|
156
|
+
recursive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
157
|
+
}, z.core.$strip>;
|
|
158
|
+
declare const getRepositoryTreeDescription = "List the file and directory structure of a repository at a given ref. Prefer a path prefix over recursive true. If truncated, narrow path instead of recalling the full tree.";
|
|
159
|
+
declare function getRepositoryTreeCore({ token, owner, repo, ref, path, recursive }: {
|
|
160
|
+
token: string;
|
|
161
|
+
owner: string;
|
|
162
|
+
repo: string;
|
|
163
|
+
ref?: string;
|
|
164
|
+
path?: string;
|
|
165
|
+
recursive: boolean;
|
|
166
|
+
}): Promise<{
|
|
167
|
+
sha: string;
|
|
168
|
+
truncated: boolean;
|
|
169
|
+
path: string | undefined;
|
|
170
|
+
entries: {
|
|
171
|
+
path: string;
|
|
172
|
+
type: string;
|
|
173
|
+
size: number | undefined;
|
|
174
|
+
sha: string;
|
|
175
|
+
}[];
|
|
176
|
+
}>;
|
|
177
|
+
declare const createBranchInputSchema: z.ZodObject<{
|
|
178
|
+
owner: z.ZodString;
|
|
179
|
+
repo: z.ZodString;
|
|
180
|
+
branch: z.ZodString;
|
|
181
|
+
from: z.ZodOptional<z.ZodString>;
|
|
182
|
+
}, z.core.$strip>;
|
|
183
|
+
declare const createBranchDescription = "Create a new branch in a GitHub repository from an existing branch or commit SHA";
|
|
184
|
+
/** Idempotent when the branch already exists at the target SHA. Not idempotent otherwise. */
|
|
185
|
+
declare function createBranchCore({ token, owner, repo, branch, from }: {
|
|
186
|
+
token: string;
|
|
187
|
+
owner: string;
|
|
188
|
+
repo: string;
|
|
189
|
+
branch: string;
|
|
190
|
+
from?: string;
|
|
191
|
+
}): Promise<{
|
|
192
|
+
ref: string;
|
|
193
|
+
sha: string;
|
|
194
|
+
url: string;
|
|
195
|
+
}>;
|
|
196
|
+
declare const deleteBranchInputSchema: z.ZodObject<{
|
|
197
|
+
owner: z.ZodString;
|
|
198
|
+
repo: z.ZodString;
|
|
199
|
+
branch: z.ZodString;
|
|
200
|
+
}, z.core.$strip>;
|
|
201
|
+
declare const deleteBranchDescription = "Delete a branch from a GitHub repository permanently";
|
|
202
|
+
/** Not idempotent — deleting a branch that no longer exists fails with a 422. */
|
|
203
|
+
declare function deleteBranchCore({ token, owner, repo, branch }: {
|
|
204
|
+
token: string;
|
|
205
|
+
owner: string;
|
|
206
|
+
repo: string;
|
|
207
|
+
branch: string;
|
|
208
|
+
}): Promise<{
|
|
209
|
+
deleted: boolean;
|
|
210
|
+
branch: string;
|
|
211
|
+
}>;
|
|
212
|
+
declare const forkRepositoryInputSchema: z.ZodObject<{
|
|
213
|
+
owner: z.ZodString;
|
|
214
|
+
repo: z.ZodString;
|
|
215
|
+
organization: z.ZodOptional<z.ZodString>;
|
|
216
|
+
name: z.ZodOptional<z.ZodString>;
|
|
217
|
+
}, z.core.$strip>;
|
|
218
|
+
declare const forkRepositoryDescription = "Fork a GitHub repository to the authenticated user account or a specified organization";
|
|
219
|
+
/** Not idempotent — each call may create another fork attempt. */
|
|
220
|
+
declare function forkRepositoryCore({ token, owner, repo, organization, name }: {
|
|
221
|
+
token: string;
|
|
222
|
+
owner: string;
|
|
223
|
+
repo: string;
|
|
224
|
+
organization?: string;
|
|
225
|
+
name?: string;
|
|
226
|
+
}): Promise<{
|
|
227
|
+
name: string;
|
|
228
|
+
fullName: string;
|
|
229
|
+
url: string;
|
|
230
|
+
cloneUrl: string;
|
|
231
|
+
sshUrl: string;
|
|
232
|
+
defaultBranch: string;
|
|
233
|
+
private: boolean;
|
|
234
|
+
parent: {
|
|
235
|
+
fullName: string;
|
|
236
|
+
url: string;
|
|
237
|
+
} | null;
|
|
238
|
+
}>;
|
|
239
|
+
declare const createRepositoryInputSchema: z.ZodObject<{
|
|
240
|
+
name: z.ZodString;
|
|
241
|
+
description: z.ZodOptional<z.ZodString>;
|
|
242
|
+
isPrivate: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
243
|
+
autoInit: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
244
|
+
gitignoreTemplate: z.ZodOptional<z.ZodString>;
|
|
245
|
+
licenseTemplate: z.ZodOptional<z.ZodString>;
|
|
246
|
+
org: z.ZodOptional<z.ZodString>;
|
|
247
|
+
}, z.core.$strip>;
|
|
248
|
+
declare const createRepositoryDescription = "Create a new GitHub repository for the authenticated user or a specified organization";
|
|
249
|
+
/** Not idempotent — each call creates a new repository. */
|
|
250
|
+
declare function createRepositoryCore({ token, name, description, isPrivate, autoInit, gitignoreTemplate, licenseTemplate, org }: {
|
|
251
|
+
token: string;
|
|
252
|
+
name: string;
|
|
253
|
+
description?: string;
|
|
254
|
+
isPrivate: boolean;
|
|
255
|
+
autoInit: boolean;
|
|
256
|
+
gitignoreTemplate?: string;
|
|
257
|
+
licenseTemplate?: string;
|
|
258
|
+
org?: string;
|
|
259
|
+
}): Promise<{
|
|
260
|
+
name: string;
|
|
261
|
+
fullName: string;
|
|
262
|
+
description: string | null;
|
|
263
|
+
url: string;
|
|
264
|
+
cloneUrl: string;
|
|
265
|
+
sshUrl: string;
|
|
266
|
+
defaultBranch: string;
|
|
267
|
+
private: boolean;
|
|
268
|
+
createdAt: string;
|
|
269
|
+
}>;
|
|
270
|
+
declare const createOrUpdateFileInputSchema: z.ZodObject<{
|
|
271
|
+
owner: z.ZodString;
|
|
272
|
+
repo: z.ZodString;
|
|
273
|
+
path: z.ZodString;
|
|
274
|
+
message: z.ZodString;
|
|
275
|
+
content: z.ZodString;
|
|
276
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
277
|
+
sha: z.ZodOptional<z.ZodString>;
|
|
278
|
+
}, z.core.$strip>;
|
|
279
|
+
declare const createOrUpdateFileDescription = "Create or update a file in a GitHub repository. Provide the SHA when updating an existing file.";
|
|
280
|
+
/** Idempotent when updating with sha and content is unchanged. Not idempotent for new commits. */
|
|
281
|
+
declare function createOrUpdateFileCore({ token, owner, repo, path, message, content, branch, sha, author, committer, coAuthors }: {
|
|
282
|
+
token: string;
|
|
283
|
+
owner: string;
|
|
284
|
+
repo: string;
|
|
285
|
+
path: string;
|
|
286
|
+
message: string;
|
|
287
|
+
content: string;
|
|
288
|
+
branch?: string;
|
|
289
|
+
sha?: string;
|
|
290
|
+
author?: CommitIdentity;
|
|
291
|
+
committer?: CommitIdentity;
|
|
292
|
+
coAuthors?: CommitIdentity[];
|
|
293
|
+
}): Promise<{
|
|
294
|
+
path: string;
|
|
295
|
+
sha: string;
|
|
296
|
+
skipped: true;
|
|
297
|
+
message: string;
|
|
298
|
+
commitSha?: undefined;
|
|
299
|
+
commitUrl?: undefined;
|
|
300
|
+
} | {
|
|
301
|
+
path: string | undefined;
|
|
302
|
+
sha: string | undefined;
|
|
303
|
+
commitSha: string | undefined;
|
|
304
|
+
commitUrl: string | undefined;
|
|
305
|
+
skipped?: undefined;
|
|
306
|
+
message?: undefined;
|
|
307
|
+
}>;
|
|
308
|
+
//#endregion
|
|
8
309
|
//#region src/tools/repository.d.ts
|
|
9
310
|
/** Get information about a GitHub repository including description, stars, forks, language, and default branch. */
|
|
10
311
|
declare const getRepository: (token: GithubTokenInput) => GithubTool;
|
|
@@ -260,20 +561,39 @@ declare const githubToolsErrors: import("evlog").ErrorCatalog<"github_tools", {
|
|
|
260
561
|
};
|
|
261
562
|
readonly CONNECT_INSTALLATION_REQUIRED: {
|
|
262
563
|
readonly status: 401;
|
|
263
|
-
readonly message: ({ detail }: {
|
|
564
|
+
readonly message: ({ detail, owner }: {
|
|
264
565
|
detail: string;
|
|
566
|
+
owner?: string;
|
|
265
567
|
}) => string;
|
|
266
|
-
readonly why: "The connector exists but its GitHub App is not installed on the target org or user account.";
|
|
267
|
-
readonly fix: "Install the connector's GitHub App on the org or account the
|
|
568
|
+
readonly why: "The connector exists but its GitHub App is not installed on the target org or user account, so Connect cannot mint a token for it.";
|
|
569
|
+
readonly fix: "Install the connector's GitHub App on the org or account named in the message (from the Vercel Connect dashboard), or target a repository on an account where it is installed.";
|
|
268
570
|
readonly link: "https://github-tools.com/guide/vercel-connect#create-a-github-connector";
|
|
269
571
|
};
|
|
270
572
|
readonly SUBJECT_CONTEXT_REQUIRED: {
|
|
271
573
|
readonly status: 500;
|
|
272
|
-
readonly message: "connect.subject resolver needs the tool execution context — it is only available while a tool call executes.";
|
|
273
|
-
readonly why: "
|
|
274
|
-
readonly fix: "Keep
|
|
574
|
+
readonly message: "A `connect` or `connect.subject` resolver needs the tool execution context — it is only available while a tool call executes.";
|
|
575
|
+
readonly why: "A per-call Connect resolver was invoked without an eve ToolContext and tool call, which only exist during tool execution.";
|
|
576
|
+
readonly fix: "Keep Connect resolver calls on the tool execute path; use static `connect` params when no execution context is available.";
|
|
275
577
|
readonly link: "https://github-tools.com/frameworks/eve-extension#per-user-tokens";
|
|
276
578
|
};
|
|
579
|
+
readonly EVALUATION_UNAVAILABLE: {
|
|
580
|
+
readonly status: 500;
|
|
581
|
+
readonly message: "`requireApproval: 'auto'` and `preset: 'auto'` need `experimental_evaluate` from `ai` 7.0.105 or later.";
|
|
582
|
+
readonly why: "The installed `ai` package does not export `experimental_evaluate`, which runs the evaluation model behind the `'auto'` options.";
|
|
583
|
+
readonly fix: "Upgrade `ai` to 7.0.105 or later, or replace `'auto'` with `true` / `false` or an explicit preset.";
|
|
584
|
+
readonly link: "https://github-tools.com/guide/approval-control#auto-approval";
|
|
585
|
+
};
|
|
586
|
+
readonly EVALUATION_FAILED: {
|
|
587
|
+
readonly status: 502;
|
|
588
|
+
readonly message: ({ model, fallback, detail }: {
|
|
589
|
+
model: string;
|
|
590
|
+
fallback: string;
|
|
591
|
+
detail: string;
|
|
592
|
+
}) => string;
|
|
593
|
+
readonly why: "The `experimental_evaluate` call behind `requireApproval: 'auto'` or `preset: 'auto'` threw — typically the model is not enabled for the AI Gateway project, the team has no credits, or the gateway is rate limiting or unavailable.";
|
|
594
|
+
readonly fix: "Check the evaluation model is available to the project on AI Gateway and has credits, or set `evaluation.model` to one that is. The agent keeps running on the fallback until then.";
|
|
595
|
+
readonly link: "https://github-tools.com/guide/approval-control#auto-approval";
|
|
596
|
+
};
|
|
277
597
|
readonly UNAUTHORIZED: {
|
|
278
598
|
readonly status: 401;
|
|
279
599
|
readonly message: ({ detail }: {
|
|
@@ -336,9 +656,15 @@ type CreateGithubAgentOptions = AgentOptions & GithubToolsBaseOptions & {
|
|
|
336
656
|
* Selects a subset of tools and, when a single preset is passed,
|
|
337
657
|
* sets a matching system prompt. Combine presets with an array to merge tool sets.
|
|
338
658
|
*
|
|
659
|
+
* `'auto'` picks presets per call from the latest user message with an evaluation model
|
|
660
|
+
* (Jev by default, see `evaluation`), then narrows `activeTools` and uses the matching
|
|
661
|
+
* system prompt. Combines at most two presets (`evaluation.maxPresets`), and only uses
|
|
662
|
+
* read-only `repo-explorer` when no other preset qualifies; when none clears the threshold,
|
|
663
|
+
* uses the most likely one. Never exposes the full catalog. Needs `ai` 7.0.105 or later.
|
|
664
|
+
*
|
|
339
665
|
* @see {@link GithubToolPreset} for available presets and included tools.
|
|
340
666
|
*/
|
|
341
|
-
preset?: GithubToolPreset | GithubToolPreset[];
|
|
667
|
+
preset?: GithubToolPreset | GithubToolPreset[] | 'auto';
|
|
342
668
|
/**
|
|
343
669
|
* Fully replace the default system prompt.
|
|
344
670
|
* When set, `preset` system prompts and `additionalInstructions` are ignored.
|
|
@@ -352,7 +678,7 @@ type CreateGithubAgentOptions = AgentOptions & GithubToolsBaseOptions & {
|
|
|
352
678
|
additionalInstructions?: string;
|
|
353
679
|
};
|
|
354
680
|
declare function createGithubAgent(options: CreateGithubAgentOptions & {
|
|
355
|
-
preset?: undefined;
|
|
681
|
+
preset?: undefined | 'auto';
|
|
356
682
|
}): ToolLoopAgent<never, AllGithubTools>;
|
|
357
683
|
declare function createGithubAgent<P extends GithubToolPreset>(options: CreateGithubAgentOptions & {
|
|
358
684
|
preset: P;
|
|
@@ -395,5 +721,5 @@ declare function createGithubTools<P extends readonly GithubToolPreset[]>(option
|
|
|
395
721
|
declare function createGithubTools(options?: GithubToolsOptions): AllGithubTools | Pick<AllGithubTools, GithubToolName>;
|
|
396
722
|
type GithubTools = AllGithubTools & ToolSet;
|
|
397
723
|
//#endregion
|
|
398
|
-
export { addLabels as $, deleteGist as A, createOrUpdateFile as At, searchIssues as B, listWorkflowJobs as C, mergePullRequest as Ct, triggerWorkflow as D, updatePullRequest as Dt, rerunWorkflowRun as E, resolveReviewThread as Et, compareCommits as F, getRepository as Ft, getDiscussion as G, listNotifications as H, getBlame as I, getRepositoryTree as It, addIssueReaction as J, listDiscussions as K, getCommit as L, listBranches as Lt, listGistComments as M, deleteBranch as Mt, listGists as N, forkRepository as Nt, createGist as O, updatePullRequestComment as Ot, updateGist as P, getFileContent as Pt, addIssueComment as Q, listCommits as R,
|
|
399
|
-
//# sourceMappingURL=index-
|
|
724
|
+
export { addLabels as $, deleteGist as A, createOrUpdateFile as At, searchIssues as B, createRepositoryCore as Bt, listWorkflowJobs as C, mergePullRequest as Ct, triggerWorkflow as D, updatePullRequest as Dt, rerunWorkflowRun as E, resolveReviewThread as Et, compareCommits as F, getRepository as Ft, getDiscussion as G, getRepositoryTreeCore as Gt, listNotifications as H, forkRepositoryCore as Ht, getBlame as I, getRepositoryTree as It, addIssueReaction as J, PagedList as Jt, listDiscussions as K, listBranchesCore as Kt, getCommit as L, listBranches as Lt, listGistComments as M, deleteBranch as Mt, listGists as N, forkRepository as Nt, createGist as O, updatePullRequestComment as Ot, updateGist as P, getFileContent as Pt, addIssueComment as Q, listCommits as R, createBranchCore as Rt, getWorkflowRun as S, listPullRequests as St, listWorkflows as T, requestReviewers as Tt, markNotificationRead as U, getFileContentCore as Ut, searchRepositories as V, deleteBranchCore as Vt, addDiscussionComment as W, getRepositoryCore as Wt, listIssueReactions as X, __exportAll as Xt, listCommentReactions as Y, createOctokit as Yt, addAssignees as Z, updateRelease as _, deletePullRequestComment as _t, createGithubAgent as a, getIssue as at, cancelWorkflowRun as b, listPullRequestReviewThreads as bt, getCiFailureContext as c, listLabels as ct, getReleaseContext as d, updateIssue as dt, closeIssue as et, createRelease as f, updateIssueComment as ft, listReleases as g, createPullRequestReview as gt, getRelease as h, createPullRequest as ht, CreateGithubAgentOptions as i, deleteLabel as it, getGist as j, createRepository as jt, createGistComment as k, createBranch as kt, getIssueContext as l, removeAssignees as lt, getLatestRelease as m, addPullRequestComment as mt, GithubToolsOptions as n, createLabel as nt, githubToolsErrors as o, listIssueComments as ot, deleteRelease as p, updateLabel as pt, addCommentReaction as q, repository_d_exports as qt, createGithubTools as r, deleteIssueComment as rt, GithubRateLimit as s, listIssues as st, GithubTools as t, createIssue as tt, getPullRequestContext as u, removeLabel as ut, getCombinedStatus as v, getPullRequest as vt, listWorkflowRuns as w, replyToReviewComment as wt, getWorkflowJobLogs as x, listPullRequestReviews as xt, listCheckRuns as y, listPullRequestFiles as yt, searchCode as z, createOrUpdateFileCore as zt };
|
|
725
|
+
//# sourceMappingURL=index-DkZvveZP.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DkZvveZP.d.mts","names":[],"sources":["../src/client.ts","../src/core/pagination.ts","../src/core/repository.ts","../src/tools/repository.ts","../src/tools/pull-requests.ts","../src/tools/issues.ts","../src/tools/reactions.ts","../src/tools/discussions.ts","../src/tools/notifications.ts","../src/tools/search.ts","../src/tools/commits.ts","../src/tools/gists.ts","../src/tools/workflows.ts","../src/tools/checks.ts","../src/tools/releases.ts","../src/tools/bundles.ts","../src/core/rate-limit.ts","../src/core/errors.ts","../src/agents.ts","../src/index.ts"],"mappings":";;;;;;;iBAiBgB,cAAc,gBAAgB;;;KCTlC;EACV;EACA;EACA;EACA;;KAGU,UAAU;EAAO,OAAO;IAAQ;;;;iBCKtB,qBAAqB,SAAS,WAAS;EAC3D;EACA;EACA;EACA;EACA;EACA;EACA,YAAY;IAAQ;IAAc;;EAClC,YAAY;IAAQ;;IAClB;EAAU;EAAmB;;iBAsBjB,qBACd,iBACA,YAAY;cASD,0BAAwB,EAAA;;;GAGnC,EAAA,KAAA;cAEW;iBAES,oBAAoB,OAAO,OAAO;EAAU;EAAe;EAAe;IAAc;;;;;;;;;;;;;;cAoBjG,yBAAuB,EAAA;;;;;GAKlC,EAAA,KAAA;cAEW;iBAES,mBAAmB,OAAO,OAAO,MAAM,SAAS;EAAc;EAAe;EAAe;EAAc;EAAiB;IAAe,QAA1F;;;;;cAWzD,2BAAyB,EAAA;;;;;;;;GAQpC,EAAA,KAAA;cAEW;iBAES,qBACpB,OACA,OACA,MACA,MACA,KACA,WACA,SACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;IACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA6CY,8BAA4B,EAAA;;;;;;GAMvC,EAAA,KAAA;cAEW;iBAES,wBAAwB,OAAO,OAAO,MAAM,KAAK,MAAM;EAAe;EAAe;EAAe;EAAc;EAAc;EAAe;IAAoB;;;;;;;;;;;cAyB5K,yBAAuB,EAAA;;;;;GAKlC,EAAA,KAAA;cAEW;;iBAGS,mBAAmB,OAAO,OAAO,MAAM,QAAQ;EAAU;EAAe;EAAe;EAAc;EAAgB;IAAe;;;;;cAuC7I,yBAAuB,EAAA;;;;GAIlC,EAAA,KA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e;iBACvB,kBAAkB,mBAAmB,oBACnD,SAAS;EAA2B,QAAQ;IAC3C,KAAK,gBAAgB,wBAAwB;iBAChC,kBAAkB,UAAU,qBAAqB,iBAAiB,KAAK,gBAAgB;KAmL3F,cAAc,iBAAiB"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { S as
|
|
2
|
-
import {
|
|
3
|
-
export { type AllGithubTools, type ApprovalConfig, type CombinedPresetToolNames, type CommitIdentity, type CommitToolOptions, type CreateGithubAgentOptions, GITHUB_TOOL_NAMES, GITHUB_WRITE_TOOLS, type GithubRateLimit, type GithubTokenInput, type GithubTool, type GithubToolName, type GithubToolPreset, GithubTools, type GithubToolsContext, type GithubToolsForPreset, GithubToolsOptions, type GithubWriteToolName, type Octokit, PRESET_TOOLS, type PickGithubTools, type PresetToolName, type ToolOptions, type ToolOverrides, addAssignees, addCommentReaction, addDiscussionComment, addIssueComment, addIssueReaction, addLabels, addPullRequestComment, cancelWorkflowRun, closeIssue, compareCommits, createBranch, createGist, createGistComment, createGithubAgent, createGithubTools, createIssue, createLabel, createOctokit, createOrUpdateFile, createPullRequest, createPullRequestReview, createRelease, createRepository, deleteBranch, deleteGist, deleteIssueComment, deleteLabel, deletePullRequestComment, deleteRelease, forkRepository, getBlame, getCiFailureContext, getCombinedStatus, getCommit, getDiscussion, getFileContent, getGist, getIssue, getIssueContext, getLatestRelease, getPullRequest, getPullRequestContext, getRelease, getReleaseContext, getRepository, getRepositoryTree, getWorkflowJobLogs, getWorkflowRun, githubToolsErrors, listBranches, listCheckRuns, listCommentReactions, listCommits, listDiscussions, listGistComments, listGists, listIssueComments, listIssueReactions, listIssues, listLabels, listNotifications, listPullRequestFiles, listPullRequestReviewThreads, listPullRequestReviews, listPullRequests, listReleases, listWorkflowJobs, listWorkflowRuns, listWorkflows, markNotificationRead, mergePullRequest, removeAssignees, removeLabel, replyToReviewComment, requestReviewers, rerunWorkflowRun, resolveGithubToken, resolveReviewThread, searchCode, searchIssues, searchRepositories, triggerWorkflow, updateGist, updateIssue, updateIssueComment, updateLabel, updatePullRequest, updatePullRequestComment, updateRelease };
|
|
1
|
+
import { $ as addLabels, A as deleteGist, At as createOrUpdateFile, B as searchIssues, C as listWorkflowJobs, Ct as mergePullRequest, D as triggerWorkflow, Dt as updatePullRequest, E as rerunWorkflowRun, Et as resolveReviewThread, F as compareCommits, Ft as getRepository, G as getDiscussion, H as listNotifications, I as getBlame, It as getRepositoryTree, J as addIssueReaction, K as listDiscussions, L as getCommit, Lt as listBranches, M as listGistComments, Mt as deleteBranch, N as listGists, Nt as forkRepository, O as createGist, Ot as updatePullRequestComment, P as updateGist, Pt as getFileContent, Q as addIssueComment, R as listCommits, S as getWorkflowRun, St as listPullRequests, T as listWorkflows, Tt as requestReviewers, U as markNotificationRead, V as searchRepositories, W as addDiscussionComment, X as listIssueReactions, Y as listCommentReactions, Yt as createOctokit, Z as addAssignees, _ as updateRelease, _t as deletePullRequestComment, a as createGithubAgent, at as getIssue, b as cancelWorkflowRun, bt as listPullRequestReviewThreads, c as getCiFailureContext, ct as listLabels, d as getReleaseContext, dt as updateIssue, et as closeIssue, f as createRelease, ft as updateIssueComment, g as listReleases, gt as createPullRequestReview, h as getRelease, ht as createPullRequest, i as CreateGithubAgentOptions, it as deleteLabel, j as getGist, jt as createRepository, k as createGistComment, kt as createBranch, l as getIssueContext, lt as removeAssignees, m as getLatestRelease, mt as addPullRequestComment, n as GithubToolsOptions, nt as createLabel, o as githubToolsErrors, ot as listIssueComments, p as deleteRelease, pt as updateLabel, q as addCommentReaction, r as createGithubTools, rt as deleteIssueComment, s as GithubRateLimit, st as listIssues, t as GithubTools, tt as createIssue, u as getPullRequestContext, ut as removeLabel, v as getCombinedStatus, vt as getPullRequest, w as listWorkflowRuns, wt as replyToReviewComment, x as getWorkflowJobLogs, xt as listPullRequestReviews, y as listCheckRuns, yt as listPullRequestFiles, z as searchCode } from "./index-DkZvveZP.mjs";
|
|
2
|
+
import { C as GithubTokenInput, D as PRESET_TOOLS, E as GithubToolPreset, M as GithubWriteToolName, O as PresetToolName, S as GithubTokenCall, T as CombinedPresetToolNames, a as GithubToolsContext, b as AUTO_APPROVAL_TOOLS, c as GithubTool, d as ToolOverrides, f as ApprovalConfig, h as GithubEvaluationOptions, i as PickGithubTools, j as GithubToolName, k as GITHUB_TOOL_NAMES, l as Octokit, m as ToolApprovalMode, o as CommitIdentity, p as StaticApprovalConfig, r as GithubToolsForPreset, s as CommitToolOptions, t as AllGithubTools, u as ToolOptions, w as resolveGithubToken, x as DEFAULT_EVALUATION_MODEL, y as GITHUB_WRITE_TOOLS } from "./tool-types-CrC80SIL.mjs";
|
|
3
|
+
export { AUTO_APPROVAL_TOOLS, type AllGithubTools, type ApprovalConfig, type CombinedPresetToolNames, type CommitIdentity, type CommitToolOptions, type CreateGithubAgentOptions, DEFAULT_EVALUATION_MODEL, GITHUB_TOOL_NAMES, GITHUB_WRITE_TOOLS, type GithubEvaluationOptions, type GithubRateLimit, type GithubTokenCall, type GithubTokenInput, type GithubTool, type GithubToolName, type GithubToolPreset, GithubTools, type GithubToolsContext, type GithubToolsForPreset, GithubToolsOptions, type GithubWriteToolName, type Octokit, PRESET_TOOLS, type PickGithubTools, type PresetToolName, type StaticApprovalConfig, type ToolApprovalMode, type ToolOptions, type ToolOverrides, addAssignees, addCommentReaction, addDiscussionComment, addIssueComment, addIssueReaction, addLabels, addPullRequestComment, cancelWorkflowRun, closeIssue, compareCommits, createBranch, createGist, createGistComment, createGithubAgent, createGithubTools, createIssue, createLabel, createOctokit, createOrUpdateFile, createPullRequest, createPullRequestReview, createRelease, createRepository, deleteBranch, deleteGist, deleteIssueComment, deleteLabel, deletePullRequestComment, deleteRelease, forkRepository, getBlame, getCiFailureContext, getCombinedStatus, getCommit, getDiscussion, getFileContent, getGist, getIssue, getIssueContext, getLatestRelease, getPullRequest, getPullRequestContext, getRelease, getReleaseContext, getRepository, getRepositoryTree, getWorkflowJobLogs, getWorkflowRun, githubToolsErrors, listBranches, listCheckRuns, listCommentReactions, listCommits, listDiscussions, listGistComments, listGists, listIssueComments, listIssueReactions, listIssues, listLabels, listNotifications, listPullRequestFiles, listPullRequestReviewThreads, listPullRequestReviews, listPullRequests, listReleases, listWorkflowJobs, listWorkflowRuns, listWorkflows, markNotificationRead, mergePullRequest, removeAssignees, removeLabel, replyToReviewComment, requestReviewers, rerunWorkflowRun, resolveGithubToken, resolveReviewThread, searchCode, searchIssues, searchRepositories, triggerWorkflow, updateGist, updateIssue, updateIssueComment, updateLabel, updatePullRequest, updatePullRequestComment, updateRelease };
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { $ as
|
|
3
|
-
export { GITHUB_TOOL_NAMES, GITHUB_WRITE_TOOLS, PRESET_TOOLS, addAssignees, addCommentReaction, addDiscussionComment, addIssueComment, addIssueReaction, addLabels, addPullRequestComment, cancelWorkflowRun, closeIssue, compareCommits, createBranch, createGist, createGistComment, createGithubAgent, createGithubTools, createIssue, createLabel, createOctokit, createOrUpdateFile, createPullRequest, createPullRequestReview, createRelease, createRepository, deleteBranch, deleteGist, deleteIssueComment, deleteLabel, deletePullRequestComment, deleteRelease, forkRepository, getBlame, getCiFailureContext, getCombinedStatus, getCommit, getDiscussion, getFileContent, getGist, getIssue, getIssueContext, getLatestRelease, getPullRequest, getPullRequestContext, getRelease, getReleaseContext, getRepository, getRepositoryTree, getWorkflowJobLogs, getWorkflowRun, githubToolsErrors, listBranches, listCheckRuns, listCommentReactions, listCommits, listDiscussions, listGistComments, listGists, listIssueComments, listIssueReactions, listIssues, listLabels, listNotifications, listPullRequestFiles, listPullRequestReviewThreads, listPullRequestReviews, listPullRequests, listReleases, listWorkflowJobs, listWorkflowRuns, listWorkflows, markNotificationRead, mergePullRequest, removeAssignees, removeLabel, replyToReviewComment, requestReviewers, rerunWorkflowRun, resolveGithubToken, resolveReviewThread, searchCode, searchIssues, searchRepositories, triggerWorkflow, updateGist, updateIssue, updateIssueComment, updateLabel, updatePullRequest, updatePullRequestComment, updateRelease };
|
|
1
|
+
import { c as DEFAULT_EVALUATION_MODEL, ia as createOctokit, m as PRESET_TOOLS, n as GITHUB_TOOL_NAMES, oa as githubToolsErrors, s as AUTO_APPROVAL_TOOLS, t as GITHUB_WRITE_TOOLS, v as resolveGithubToken } from "./write-tools-BaoTUCg7.mjs";
|
|
2
|
+
import { $ as deleteLabel, A as compareCommits, At as getRepository, B as getDiscussion, C as createGist, Ct as updatePullRequestComment, D as listGistComments, Dt as deleteBranch, E as getGist, Et as createRepository, F as searchIssues, G as listIssueReactions, H as addCommentReaction, I as searchRepositories, J as addLabels, K as addAssignees, L as listNotifications, M as getCommit, Mt as listBranches, N as listCommits, O as listGists, Ot as forkRepository, P as searchCode, Q as deleteIssueComment, R as markNotificationRead, S as triggerWorkflow, St as updatePullRequest, T as deleteGist, Tt as createOrUpdateFile, U as addIssueReaction, V as listDiscussions, W as listCommentReactions, X as createIssue, Y as closeIssue, Z as createLabel, _ as getWorkflowRun, _t as listPullRequests, a as getPullRequestContext, at as removeLabel, b as listWorkflows, bt as requestReviewers, c as deleteRelease, ct as updateLabel, d as listReleases, dt as createPullRequestReview, et as getIssue, f as updateRelease, ft as deletePullRequestComment, g as getWorkflowJobLogs, gt as listPullRequestReviews, h as cancelWorkflowRun, ht as listPullRequestReviewThreads, i as getIssueContext, it as removeAssignees, j as getBlame, jt as getRepositoryTree, k as updateGist, kt as getFileContent, l as getLatestRelease, lt as addPullRequestComment, m as listCheckRuns, mt as listPullRequestFiles, n as createGithubAgent, nt as listIssues, o as getReleaseContext, ot as updateIssue, p as getCombinedStatus, pt as getPullRequest, q as addIssueComment, r as getCiFailureContext, rt as listLabels, s as createRelease, st as updateIssueComment, t as createGithubTools, tt as listIssueComments, u as getRelease, ut as createPullRequest, v as listWorkflowJobs, vt as mergePullRequest, w as createGistComment, wt as createBranch, x as rerunWorkflowRun, xt as resolveReviewThread, y as listWorkflowRuns, yt as replyToReviewComment, z as addDiscussionComment } from "./src-Bx5p1Unc.mjs";
|
|
3
|
+
export { AUTO_APPROVAL_TOOLS, DEFAULT_EVALUATION_MODEL, GITHUB_TOOL_NAMES, GITHUB_WRITE_TOOLS, PRESET_TOOLS, addAssignees, addCommentReaction, addDiscussionComment, addIssueComment, addIssueReaction, addLabels, addPullRequestComment, cancelWorkflowRun, closeIssue, compareCommits, createBranch, createGist, createGistComment, createGithubAgent, createGithubTools, createIssue, createLabel, createOctokit, createOrUpdateFile, createPullRequest, createPullRequestReview, createRelease, createRepository, deleteBranch, deleteGist, deleteIssueComment, deleteLabel, deletePullRequestComment, deleteRelease, forkRepository, getBlame, getCiFailureContext, getCombinedStatus, getCommit, getDiscussion, getFileContent, getGist, getIssue, getIssueContext, getLatestRelease, getPullRequest, getPullRequestContext, getRelease, getReleaseContext, getRepository, getRepositoryTree, getWorkflowJobLogs, getWorkflowRun, githubToolsErrors, listBranches, listCheckRuns, listCommentReactions, listCommits, listDiscussions, listGistComments, listGists, listIssueComments, listIssueReactions, listIssues, listLabels, listNotifications, listPullRequestFiles, listPullRequestReviewThreads, listPullRequestReviews, listPullRequests, listReleases, listWorkflowJobs, listWorkflowRuns, listWorkflows, markNotificationRead, mergePullRequest, removeAssignees, removeLabel, replyToReviewComment, requestReviewers, rerunWorkflowRun, resolveGithubToken, resolveReviewThread, searchCode, searchIssues, searchRepositories, triggerWorkflow, updateGist, updateIssue, updateIssueComment, updateLabel, updatePullRequest, updatePullRequestComment, updateRelease };
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { i as formatContextInstructions, s as AUTO_APPROVAL_TOOLS } from "./write-tools-BaoTUCg7.mjs";
|
|
2
|
+
//#region src/core/approval-policy.ts
|
|
3
|
+
const autoApprovalTools = new Set(AUTO_APPROVAL_TOOLS);
|
|
4
|
+
/**
|
|
5
|
+
* Resolve a write tool's approval mode from global or per-tool config.
|
|
6
|
+
*
|
|
7
|
+
* @returns `'auto'` only for tools that opt into evaluation; defaults to `true` for unspecified tools in object mode.
|
|
8
|
+
*/
|
|
9
|
+
function resolveApprovalMode(toolName, config) {
|
|
10
|
+
if (config === "auto") return autoApprovalTools.has(toolName) ? "auto" : true;
|
|
11
|
+
if (typeof config === "boolean") return config;
|
|
12
|
+
return config[toolName] ?? true;
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/core/instructions.ts
|
|
16
|
+
const SHARED_RULES = `When a tool execution is denied by the user, do not retry it. Briefly acknowledge the decision and move on.
|
|
17
|
+
Call independent read tools in the same step when you already know the arguments — never serialize reads that could run in parallel.
|
|
18
|
+
Bodies default to detail summary; patches default to includePatch false; prefer getFileContent with startLine/endLine or maxLines for large files.
|
|
19
|
+
Paged lists return { items, hasMore, page, nextPage }. When hasMore, call with nextPage or raise maxPages — never the same page. Prefer path/author/since/until on listCommits instead of walking history. Prefer a path prefix on getRepositoryTree over recursive true.`;
|
|
20
|
+
const DEFAULT_INSTRUCTIONS = `You are a helpful GitHub assistant. You can read and explore repositories, issues, pull requests, discussions, commits, code, gists, and workflows. You can also create issues, pull requests, comments, gists, reactions, trigger workflows, and update files when asked.
|
|
21
|
+
|
|
22
|
+
Prefer getPullRequestContext, getIssueContext, getReleaseContext, or getCiFailureContext for multi-part reads instead of chaining separate tools.
|
|
23
|
+
|
|
24
|
+
${SHARED_RULES}`;
|
|
25
|
+
const PRESET_INSTRUCTIONS = {
|
|
26
|
+
"code-review": `You are a code review assistant. Your job is to review pull requests thoroughly and provide constructive feedback.
|
|
27
|
+
|
|
28
|
+
When reviewing a PR:
|
|
29
|
+
- Start with getPullRequestContext (set includeChecks true when CI matters)
|
|
30
|
+
- Then listPullRequestFiles with includePatch true and filenames for only the files you need — in the same step as any getFileContent / getBlame calls when possible
|
|
31
|
+
- Use getBlame then getCommit(includePatch true) only when line history matters
|
|
32
|
+
- Check for bugs, logic errors, and edge cases; be constructive
|
|
33
|
+
- Use createPullRequestReview for formal reviews when asked
|
|
34
|
+
- Use listPullRequestReviewThreads (unresolved by default) to see open feedback; replyToReviewComment to answer in a thread and resolveReviewThread once it is addressed
|
|
35
|
+
- Use updatePullRequest to change title, body, base branch, or draft status; addPullRequestComment / updatePullRequestComment / deletePullRequestComment to manage comments
|
|
36
|
+
|
|
37
|
+
${SHARED_RULES}`,
|
|
38
|
+
"issue-triage": `You are an issue triage assistant. Your job is to help manage and organize GitHub issues.
|
|
39
|
+
|
|
40
|
+
When triaging issues:
|
|
41
|
+
- Call getIssueContext exactly once (full body + labelNames + recent comments). In that same step, call listIssues or searchIssues if you need duplicate checks
|
|
42
|
+
- Never re-call getIssueContext for the same issue
|
|
43
|
+
- Use listIssueComments to paginate beyond the comments returned by getIssueContext
|
|
44
|
+
- Pick labels from labelNames; use addLabels / removeLabel to apply them. Use createLabel / updateLabel / deleteLabel when the repository taxonomy itself needs changing
|
|
45
|
+
- Create issues with clear titles and descriptions when asked
|
|
46
|
+
- Use updateIssue to edit title, body, labels, milestone, or assignees, and to reopen a closed issue (state: 'open') — there is no separate reopen tool
|
|
47
|
+
- Use updateIssueComment / deleteIssueComment to correct or remove existing comments
|
|
48
|
+
- Acknowledge a report or a comment with addIssueReaction / addCommentReaction instead of posting a comment that says nothing new
|
|
49
|
+
|
|
50
|
+
${SHARED_RULES}`,
|
|
51
|
+
"ci-ops": `You are a CI/CD operations assistant. Your job is to help monitor and manage GitHub Actions workflows.
|
|
52
|
+
|
|
53
|
+
When working with workflows:
|
|
54
|
+
- Prefer getCiFailureContext first when diagnosing a failing ref
|
|
55
|
+
- Read the failing job's output with getWorkflowJobLogs (the default 200-line tail is usually enough; raise maxLines only when the error is higher up)
|
|
56
|
+
- Use listCheckRuns / getCombinedStatus for narrower follow-ups
|
|
57
|
+
- Inspect job steps to find the failing step; confirm before cancel/re-run
|
|
58
|
+
- Trigger workflow_dispatch with the correct inputs and branch when asked
|
|
59
|
+
|
|
60
|
+
${SHARED_RULES}`,
|
|
61
|
+
"security-audit": `You are a security audit assistant. Your job is to review repositories for security risks and report findings clearly — you never make destructive changes.
|
|
62
|
+
|
|
63
|
+
When auditing a repository:
|
|
64
|
+
- Use searchCode for secrets and unsafe patterns; getBlame / listCommits to trace introductions
|
|
65
|
+
- Use searchIssues to check for prior reports of the same vulnerability before filing a duplicate
|
|
66
|
+
- Prefer getCiFailureContext or getPullRequestContext for CI / PR context
|
|
67
|
+
- Use compareCommits to scope changes (includePatch only when you need diffs)
|
|
68
|
+
- Report findings as issues with reproduction, impact, and severity
|
|
69
|
+
- Read-only plus createIssue / addIssueComment / addLabels — never assume you can fix code directly
|
|
70
|
+
|
|
71
|
+
${SHARED_RULES}`,
|
|
72
|
+
"repo-explorer": `You are a repository explorer. Your job is to help users understand codebases and find information across GitHub repositories.
|
|
73
|
+
|
|
74
|
+
When exploring repos:
|
|
75
|
+
- Answer questions about structure and organization; find files and patterns with searchCode / getFileContent
|
|
76
|
+
- Use searchIssues to find issues or pull requests by qualifier across a repository or organization
|
|
77
|
+
- Use listDiscussions / getDiscussion for questions answered in the repository's discussions rather than its issues
|
|
78
|
+
- Prefer getPullRequestContext or getCiFailureContext when summarizing a PR or failing CI
|
|
79
|
+
- Use getBlame for line ownership; summarize recent commits / PRs / issues when asked
|
|
80
|
+
- Read-only — you cannot make changes
|
|
81
|
+
|
|
82
|
+
${SHARED_RULES}`,
|
|
83
|
+
"release-manager": `You are a release management assistant. Your job is to help prepare and publish GitHub releases.
|
|
84
|
+
|
|
85
|
+
When preparing a release:
|
|
86
|
+
- Prefer getReleaseContext first (current/latest release, previous release, tag compare)
|
|
87
|
+
- Use compareCommits / listCommits for more changelog detail; getCiFailureContext before cutting
|
|
88
|
+
- createRelease with generateReleaseNotes when there is no manual changelog
|
|
89
|
+
- Double-check the target branch or SHA — releases and tags are hard to undo
|
|
90
|
+
- Use updateRelease to fix notes or toggle draft/prerelease after publishing; deleteRelease only when explicitly asked — it does not delete the underlying tag
|
|
91
|
+
|
|
92
|
+
${SHARED_RULES}`,
|
|
93
|
+
"discussion-moderator": `You are a discussion moderator. Your job is to answer and guide repository Discussions clearly and on-topic.
|
|
94
|
+
|
|
95
|
+
When working in discussions:
|
|
96
|
+
- Use listDiscussions / getDiscussion to load the thread before replying
|
|
97
|
+
- Prefer addDiscussionComment for answers that belong in Discussions
|
|
98
|
+
- Use searchIssues / getIssueContext when the question overlaps an existing issue; addIssueComment only when the follow-up belongs on that issue
|
|
99
|
+
- Keep replies concise and point to docs or code when helpful
|
|
100
|
+
|
|
101
|
+
${SHARED_RULES}`,
|
|
102
|
+
"notification-inbox": `You are a notification inbox assistant. Your job is to help triage GitHub notification threads for the authenticated user.
|
|
103
|
+
|
|
104
|
+
When clearing the inbox:
|
|
105
|
+
- Use listNotifications to see unread threads (set all true only when asked)
|
|
106
|
+
- Open the related getIssue or getPullRequest when you need context before acting
|
|
107
|
+
- Use markNotificationRead once a thread is handled or is noise
|
|
108
|
+
- These tools need a user PAT with Notifications access — say so if calls fail for that reason
|
|
109
|
+
|
|
110
|
+
${SHARED_RULES}`,
|
|
111
|
+
"pr-author": `You are a pull request authoring assistant. Your job is to prepare branches, edit files, and open focused PRs.
|
|
112
|
+
|
|
113
|
+
When opening a PR:
|
|
114
|
+
- Inspect the repo with getRepository / listBranches / getFileContent before editing
|
|
115
|
+
- createBranch from a sensible base, then createOrUpdateFile for the change set
|
|
116
|
+
- createPullRequest with a clear title and body; updatePullRequest if the draft or description needs a fix
|
|
117
|
+
- Use listPullRequestFiles / compareCommits / getCommit to verify what will land
|
|
118
|
+
- Address review feedback: listPullRequestReviewThreads for open threads, replyToReviewComment to answer, resolveReviewThread once fixed
|
|
119
|
+
- Use deleteBranch to clean up a merged or abandoned branch when asked
|
|
120
|
+
- Stay scoped to authoring — you do not review, merge, or manage issues
|
|
121
|
+
|
|
122
|
+
${SHARED_RULES}`,
|
|
123
|
+
"maintainer": `You are a repository maintainer assistant. You have full access to manage repositories, issues, pull requests, discussions, notifications, gists, and workflows.
|
|
124
|
+
|
|
125
|
+
When maintaining repos:
|
|
126
|
+
- Prefer getPullRequestContext or getCiFailureContext for multi-part reads
|
|
127
|
+
- Be careful with writes — review before acting
|
|
128
|
+
- Keep issues, PRs, and commits clear and well-structured
|
|
129
|
+
- Use listNotifications to find what needs attention, then markNotificationRead once a thread is handled
|
|
130
|
+
- Acknowledge a thread with addIssueReaction / addCommentReaction instead of a comment that adds nothing
|
|
131
|
+
- Answer questions in discussions with addDiscussionComment
|
|
132
|
+
|
|
133
|
+
${SHARED_RULES}`
|
|
134
|
+
};
|
|
135
|
+
function resolveInstructions(options) {
|
|
136
|
+
const defaultPrompt = options.preset && !Array.isArray(options.preset) ? PRESET_INSTRUCTIONS[options.preset] : DEFAULT_INSTRUCTIONS;
|
|
137
|
+
let prompt;
|
|
138
|
+
if (options.instructions) prompt = options.instructions;
|
|
139
|
+
else if (options.additionalInstructions) prompt = `${defaultPrompt}\n\n${options.additionalInstructions}`;
|
|
140
|
+
else prompt = defaultPrompt;
|
|
141
|
+
const contextBlock = options.context ? formatContextInstructions(options.context) : "";
|
|
142
|
+
if (contextBlock) return `${prompt}\n\n${contextBlock}`;
|
|
143
|
+
return prompt;
|
|
144
|
+
}
|
|
145
|
+
//#endregion
|
|
146
|
+
export { resolveApprovalMode as n, resolveInstructions as t };
|
|
147
|
+
|
|
148
|
+
//# sourceMappingURL=instructions-BuypoY0x.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instructions-BuypoY0x.mjs","names":[],"sources":["../src/core/approval-policy.ts","../src/core/instructions.ts"],"sourcesContent":["import { AUTO_APPROVAL_TOOLS } from './evaluation-policy'\nimport type { GithubWriteToolName } from './write-tools'\n\n/**\n * Approval for a single write tool.\n *\n * - `true` — always ask the user\n * - `false` — never ask\n * - `'auto'` — ask only when an evaluation model (Jev by default) rates the call risky\n * or not asked for by the latest user message. AI SDK evaluation needs `ai` 7.0.105 or later.\n */\nexport type ToolApprovalMode = boolean | 'auto'\n\n/**\n * Whether write operations require user approval.\n *\n * - `true` — all write tools need approval (default)\n * - `false` — no approval needed for any write tool\n * - `'auto'` — low-risk write tools ({@link AUTO_APPROVAL_TOOLS}) are evaluated per call;\n * every other write tool needs approval\n * - object — per-tool {@link ToolApprovalMode} via {@link GithubWriteToolName}; unspecified write tools default to `true`\n *\n * @example Global disable\n * ```ts\n * createGithubTools({ token, requireApproval: false })\n * ```\n *\n * @example Auto approval for low-risk writes\n * ```ts\n * createGithubTools({ token, requireApproval: 'auto' })\n * ```\n *\n * @example Granular per write tool\n * ```ts\n * createGithubTools({\n * token,\n * requireApproval: {\n * mergePullRequest: true,\n * createOrUpdateFile: true,\n * addPullRequestComment: 'auto',\n * },\n * })\n * ```\n */\nexport type ApprovalConfig = ToolApprovalMode | Partial<Record<GithubWriteToolName, ToolApprovalMode>>\n\n/** {@link ApprovalConfig} without `'auto'`, for runtimes that cannot run the evaluation model. */\nexport type StaticApprovalConfig = boolean | Partial<Record<GithubWriteToolName, boolean>>\n\nconst autoApprovalTools: ReadonlySet<string> = new Set(AUTO_APPROVAL_TOOLS)\n\n/**\n * Resolve a write tool's approval mode from global or per-tool config.\n *\n * @returns `'auto'` only for tools that opt into evaluation; defaults to `true` for unspecified tools in object mode.\n */\nexport function resolveApprovalMode(toolName: GithubWriteToolName, config: ApprovalConfig): ToolApprovalMode {\n if (config === 'auto') return autoApprovalTools.has(toolName) ? 'auto' : true\n if (typeof config === 'boolean') return config\n return config[toolName] ?? true\n}\n","import type { GithubToolPreset } from './presets'\nimport { formatContextInstructions, type GithubToolsContext } from './context'\n\nconst SHARED_RULES = `When a tool execution is denied by the user, do not retry it. Briefly acknowledge the decision and move on.\nCall independent read tools in the same step when you already know the arguments — never serialize reads that could run in parallel.\nBodies default to detail summary; patches default to includePatch false; prefer getFileContent with startLine/endLine or maxLines for large files.\nPaged lists return { items, hasMore, page, nextPage }. When hasMore, call with nextPage or raise maxPages — never the same page. Prefer path/author/since/until on listCommits instead of walking history. Prefer a path prefix on getRepositoryTree over recursive true.`\n\nconst DEFAULT_INSTRUCTIONS = `You are a helpful GitHub assistant. You can read and explore repositories, issues, pull requests, discussions, commits, code, gists, and workflows. You can also create issues, pull requests, comments, gists, reactions, trigger workflows, and update files when asked.\n\nPrefer getPullRequestContext, getIssueContext, getReleaseContext, or getCiFailureContext for multi-part reads instead of chaining separate tools.\n\n${SHARED_RULES}`\n\nconst PRESET_INSTRUCTIONS: Record<GithubToolPreset, string> = {\n 'code-review': `You are a code review assistant. Your job is to review pull requests thoroughly and provide constructive feedback.\n\nWhen reviewing a PR:\n- Start with getPullRequestContext (set includeChecks true when CI matters)\n- Then listPullRequestFiles with includePatch true and filenames for only the files you need — in the same step as any getFileContent / getBlame calls when possible\n- Use getBlame then getCommit(includePatch true) only when line history matters\n- Check for bugs, logic errors, and edge cases; be constructive\n- Use createPullRequestReview for formal reviews when asked\n- Use listPullRequestReviewThreads (unresolved by default) to see open feedback; replyToReviewComment to answer in a thread and resolveReviewThread once it is addressed\n- Use updatePullRequest to change title, body, base branch, or draft status; addPullRequestComment / updatePullRequestComment / deletePullRequestComment to manage comments\n\n${SHARED_RULES}`,\n\n 'issue-triage': `You are an issue triage assistant. Your job is to help manage and organize GitHub issues.\n\nWhen triaging issues:\n- Call getIssueContext exactly once (full body + labelNames + recent comments). In that same step, call listIssues or searchIssues if you need duplicate checks\n- Never re-call getIssueContext for the same issue\n- Use listIssueComments to paginate beyond the comments returned by getIssueContext\n- Pick labels from labelNames; use addLabels / removeLabel to apply them. Use createLabel / updateLabel / deleteLabel when the repository taxonomy itself needs changing\n- Create issues with clear titles and descriptions when asked\n- Use updateIssue to edit title, body, labels, milestone, or assignees, and to reopen a closed issue (state: 'open') — there is no separate reopen tool\n- Use updateIssueComment / deleteIssueComment to correct or remove existing comments\n- Acknowledge a report or a comment with addIssueReaction / addCommentReaction instead of posting a comment that says nothing new\n\n${SHARED_RULES}`,\n\n 'ci-ops': `You are a CI/CD operations assistant. Your job is to help monitor and manage GitHub Actions workflows.\n\nWhen working with workflows:\n- Prefer getCiFailureContext first when diagnosing a failing ref\n- Read the failing job's output with getWorkflowJobLogs (the default 200-line tail is usually enough; raise maxLines only when the error is higher up)\n- Use listCheckRuns / getCombinedStatus for narrower follow-ups\n- Inspect job steps to find the failing step; confirm before cancel/re-run\n- Trigger workflow_dispatch with the correct inputs and branch when asked\n\n${SHARED_RULES}`,\n\n 'security-audit': `You are a security audit assistant. Your job is to review repositories for security risks and report findings clearly — you never make destructive changes.\n\nWhen auditing a repository:\n- Use searchCode for secrets and unsafe patterns; getBlame / listCommits to trace introductions\n- Use searchIssues to check for prior reports of the same vulnerability before filing a duplicate\n- Prefer getCiFailureContext or getPullRequestContext for CI / PR context\n- Use compareCommits to scope changes (includePatch only when you need diffs)\n- Report findings as issues with reproduction, impact, and severity\n- Read-only plus createIssue / addIssueComment / addLabels — never assume you can fix code directly\n\n${SHARED_RULES}`,\n\n 'repo-explorer': `You are a repository explorer. Your job is to help users understand codebases and find information across GitHub repositories.\n\nWhen exploring repos:\n- Answer questions about structure and organization; find files and patterns with searchCode / getFileContent\n- Use searchIssues to find issues or pull requests by qualifier across a repository or organization\n- Use listDiscussions / getDiscussion for questions answered in the repository's discussions rather than its issues\n- Prefer getPullRequestContext or getCiFailureContext when summarizing a PR or failing CI\n- Use getBlame for line ownership; summarize recent commits / PRs / issues when asked\n- Read-only — you cannot make changes\n\n${SHARED_RULES}`,\n\n 'release-manager': `You are a release management assistant. Your job is to help prepare and publish GitHub releases.\n\nWhen preparing a release:\n- Prefer getReleaseContext first (current/latest release, previous release, tag compare)\n- Use compareCommits / listCommits for more changelog detail; getCiFailureContext before cutting\n- createRelease with generateReleaseNotes when there is no manual changelog\n- Double-check the target branch or SHA — releases and tags are hard to undo\n- Use updateRelease to fix notes or toggle draft/prerelease after publishing; deleteRelease only when explicitly asked — it does not delete the underlying tag\n\n${SHARED_RULES}`,\n\n 'discussion-moderator': `You are a discussion moderator. Your job is to answer and guide repository Discussions clearly and on-topic.\n\nWhen working in discussions:\n- Use listDiscussions / getDiscussion to load the thread before replying\n- Prefer addDiscussionComment for answers that belong in Discussions\n- Use searchIssues / getIssueContext when the question overlaps an existing issue; addIssueComment only when the follow-up belongs on that issue\n- Keep replies concise and point to docs or code when helpful\n\n${SHARED_RULES}`,\n\n 'notification-inbox': `You are a notification inbox assistant. Your job is to help triage GitHub notification threads for the authenticated user.\n\nWhen clearing the inbox:\n- Use listNotifications to see unread threads (set all true only when asked)\n- Open the related getIssue or getPullRequest when you need context before acting\n- Use markNotificationRead once a thread is handled or is noise\n- These tools need a user PAT with Notifications access — say so if calls fail for that reason\n\n${SHARED_RULES}`,\n\n 'pr-author': `You are a pull request authoring assistant. Your job is to prepare branches, edit files, and open focused PRs.\n\nWhen opening a PR:\n- Inspect the repo with getRepository / listBranches / getFileContent before editing\n- createBranch from a sensible base, then createOrUpdateFile for the change set\n- createPullRequest with a clear title and body; updatePullRequest if the draft or description needs a fix\n- Use listPullRequestFiles / compareCommits / getCommit to verify what will land\n- Address review feedback: listPullRequestReviewThreads for open threads, replyToReviewComment to answer, resolveReviewThread once fixed\n- Use deleteBranch to clean up a merged or abandoned branch when asked\n- Stay scoped to authoring — you do not review, merge, or manage issues\n\n${SHARED_RULES}`,\n\n 'maintainer': `You are a repository maintainer assistant. You have full access to manage repositories, issues, pull requests, discussions, notifications, gists, and workflows.\n\nWhen maintaining repos:\n- Prefer getPullRequestContext or getCiFailureContext for multi-part reads\n- Be careful with writes — review before acting\n- Keep issues, PRs, and commits clear and well-structured\n- Use listNotifications to find what needs attention, then markNotificationRead once a thread is handled\n- Acknowledge a thread with addIssueReaction / addCommentReaction instead of a comment that adds nothing\n- Answer questions in discussions with addDiscussionComment\n\n${SHARED_RULES}`\n}\n\nexport function resolveInstructions(options: {\n preset?: GithubToolPreset | GithubToolPreset[]\n instructions?: string\n additionalInstructions?: string\n context?: GithubToolsContext\n}): string {\n const defaultPrompt = options.preset && !Array.isArray(options.preset)\n ? PRESET_INSTRUCTIONS[options.preset]\n : DEFAULT_INSTRUCTIONS\n\n let prompt: string\n if (options.instructions) prompt = options.instructions\n else if (options.additionalInstructions) prompt = `${defaultPrompt}\\n\\n${options.additionalInstructions}`\n else prompt = defaultPrompt\n\n const contextBlock = options.context ? formatContextInstructions(options.context) : ''\n if (contextBlock) return `${prompt}\\n\\n${contextBlock}`\n return prompt\n}\n"],"mappings":";;AAiDA,MAAM,oBAAyC,IAAI,IAAI,mBAAmB;;;;;;AAO1E,SAAgB,oBAAoB,UAA+B,QAA0C;CAC3G,IAAI,WAAW,QAAQ,OAAO,kBAAkB,IAAI,QAAQ,IAAI,SAAS;CACzE,IAAI,OAAO,WAAW,WAAW,OAAO;CACxC,OAAO,OAAO,aAAa;AAC7B;;;ACzDA,MAAM,eAAe;;;;AAKrB,MAAM,uBAAuB;;;;EAI3B;AAEF,MAAM,sBAAwD;CAC5D,eAAe;;;;;;;;;;;EAWf;CAEA,gBAAgB;;;;;;;;;;;;EAYhB;CAEA,UAAU;;;;;;;;;EASV;CAEA,kBAAkB;;;;;;;;;;EAUlB;CAEA,iBAAiB;;;;;;;;;;EAUjB;CAEA,mBAAmB;;;;;;;;;EASnB;CAEA,wBAAwB;;;;;;;;EAQxB;CAEA,sBAAsB;;;;;;;;EAQtB;CAEA,aAAa;;;;;;;;;;;EAWb;CAEA,cAAc;;;;;;;;;;EAUd;AACF;AAEA,SAAgB,oBAAoB,SAKzB;CACT,MAAM,gBAAgB,QAAQ,UAAU,CAAC,MAAM,QAAQ,QAAQ,MAAM,IACjE,oBAAoB,QAAQ,UAC5B;CAEJ,IAAI;CACJ,IAAI,QAAQ,cAAc,SAAS,QAAQ;MACtC,IAAI,QAAQ,wBAAwB,SAAS,GAAG,cAAc,MAAM,QAAQ;MAC5E,SAAS;CAEd,MAAM,eAAe,QAAQ,UAAU,0BAA0B,QAAQ,OAAO,IAAI;CACpF,IAAI,cAAc,OAAO,GAAG,OAAO,MAAM;CACzC,OAAO;AACT"}
|