@github-tools/sdk 1.20.0 → 1.21.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 +45 -12
- package/dist/{approval-policy--kByBqhT.mjs → approval-policy-CEMMPq92.mjs} +2 -2
- package/dist/{approval-policy--kByBqhT.mjs.map → approval-policy-CEMMPq92.mjs.map} +1 -1
- package/dist/connect/eve.d.mts +1 -1
- package/dist/connect/eve.mjs +1 -1
- package/dist/connect.d.mts +5 -5
- package/dist/connect.d.mts.map +1 -1
- package/dist/connect.mjs +2 -2
- package/dist/{cores-FLzAv2tu.mjs → cores-meFAMt2D.mjs} +20 -2
- package/dist/cores-meFAMt2D.mjs.map +1 -0
- package/dist/{tool-types-OFyE3z0C.d.mts → dry-run-DXckOam2.d.mts} +172 -18
- package/dist/dry-run-DXckOam2.d.mts.map +1 -0
- package/dist/{evaluation-BtoHbxuQ.mjs → evaluation-DJHINyAu.mjs} +2 -2
- package/dist/{evaluation-BtoHbxuQ.mjs.map → evaluation-DJHINyAu.mjs.map} +1 -1
- package/dist/{eve-runtime-CflZNuXD.d.mts → eve-runtime-B_CJE9JV.d.mts} +20 -6
- package/dist/eve-runtime-B_CJE9JV.d.mts.map +1 -0
- package/dist/{eve-runtime-C-0doyHq.mjs → eve-runtime-DPzMPCLt.mjs} +40 -12
- package/dist/eve-runtime-DPzMPCLt.mjs.map +1 -0
- package/dist/eve-runtime.d.mts +5 -5
- package/dist/eve-runtime.mjs +4 -4
- package/dist/eve.d.mts +45 -3
- package/dist/eve.d.mts.map +1 -1
- package/dist/eve.mjs +45 -3
- package/dist/eve.mjs.map +1 -1
- package/dist/{index-C3wlz660.d.mts → index-CzzrtCVj.d.mts} +32 -5
- package/dist/index-CzzrtCVj.d.mts.map +1 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +4 -4
- package/dist/{src-DyiAVHKl.mjs → src-BlhrSieS.mjs} +166 -21
- package/dist/src-BlhrSieS.mjs.map +1 -0
- package/dist/tanstack.d.mts +533 -190
- package/dist/tanstack.d.mts.map +1 -1
- package/dist/tanstack.mjs +32 -11
- package/dist/tanstack.mjs.map +1 -1
- package/dist/{token-DIwB-wtp.mjs → token-BLps09gm.mjs} +3 -2
- package/dist/token-BLps09gm.mjs.map +1 -0
- package/dist/{types-CJqhvQwi.d.mts → types-Bln8U42J.d.mts} +3 -3
- package/dist/{types-CJqhvQwi.d.mts.map → types-Bln8U42J.d.mts.map} +1 -1
- package/dist/{types-ITYfXMtY.d.mts → types-C7O2lwwz.d.mts} +14 -2
- package/dist/{types-ITYfXMtY.d.mts.map → types-C7O2lwwz.d.mts.map} +1 -1
- package/dist/workflow.d.mts +9 -2
- package/dist/workflow.d.mts.map +1 -1
- package/dist/workflow.mjs +6 -4
- package/dist/workflow.mjs.map +1 -1
- package/dist/{write-tools-DnGZw-RD.mjs → write-tools-w-8tjnDQ.mjs} +440 -33
- package/dist/write-tools-w-8tjnDQ.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/cores-FLzAv2tu.mjs.map +0 -1
- package/dist/eve-runtime-C-0doyHq.mjs.map +0 -1
- package/dist/eve-runtime-CflZNuXD.d.mts.map +0 -1
- package/dist/index-C3wlz660.d.mts.map +0 -1
- package/dist/src-DyiAVHKl.mjs.map +0 -1
- package/dist/token-DIwB-wtp.mjs.map +0 -1
- package/dist/tool-types-OFyE3z0C.d.mts.map +0 -1
- package/dist/write-tools-DnGZw-RD.mjs.map +0 -1
|
@@ -133,6 +133,16 @@ declare const GITHUB_TOOL_CATALOG: {
|
|
|
133
133
|
}, z.core.$strip>;
|
|
134
134
|
connectScopes: readonly ["contents:read", "metadata:read"];
|
|
135
135
|
};
|
|
136
|
+
/** Get a user's permission and role on a repository, to check whether they may trigger the bot or approve an action. */
|
|
137
|
+
getCollaboratorPermission: {
|
|
138
|
+
description: string;
|
|
139
|
+
inputSchema: z.ZodObject<{
|
|
140
|
+
owner: z.ZodString;
|
|
141
|
+
repo: z.ZodString;
|
|
142
|
+
username: z.ZodString;
|
|
143
|
+
}, z.core.$strip>;
|
|
144
|
+
connectScopes: readonly ["metadata:read"];
|
|
145
|
+
};
|
|
136
146
|
/** Edit files in one commit on a new or existing branch, and optionally open a pull request. Requires approval by default. */
|
|
137
147
|
editFiles: {
|
|
138
148
|
description: string;
|
|
@@ -269,6 +279,18 @@ declare const GITHUB_TOOL_CATALOG: {
|
|
|
269
279
|
write: true;
|
|
270
280
|
connectScopes: readonly ["contents:read", "metadata:read", "pull_requests:read", "pull_requests:write"];
|
|
271
281
|
};
|
|
282
|
+
/** Bring a pull request branch up to date by merging its base branch into it. Requires approval by default. */
|
|
283
|
+
updatePullRequestBranch: {
|
|
284
|
+
description: string;
|
|
285
|
+
inputSchema: z.ZodObject<{
|
|
286
|
+
owner: z.ZodString;
|
|
287
|
+
repo: z.ZodString;
|
|
288
|
+
pullNumber: z.ZodNumber;
|
|
289
|
+
expectedHeadSha: z.ZodOptional<z.ZodString>;
|
|
290
|
+
}, z.core.$strip>;
|
|
291
|
+
write: true;
|
|
292
|
+
connectScopes: readonly ["contents:read", "contents:write", "metadata:read", "pull_requests:read", "pull_requests:write"];
|
|
293
|
+
};
|
|
272
294
|
/** Add a comment to a pull request. Requires approval by default. */
|
|
273
295
|
addPullRequestComment: {
|
|
274
296
|
description: string;
|
|
@@ -511,6 +533,7 @@ declare const GITHUB_TOOL_CATALOG: {
|
|
|
511
533
|
body: z.ZodOptional<z.ZodString>;
|
|
512
534
|
labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
513
535
|
assignees: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
536
|
+
milestone: z.ZodOptional<z.ZodNumber>;
|
|
514
537
|
}, z.core.$strip>;
|
|
515
538
|
write: true;
|
|
516
539
|
connectScopes: readonly ["contents:read", "metadata:read", "issues:read", "issues:write"];
|
|
@@ -687,6 +710,48 @@ declare const GITHUB_TOOL_CATALOG: {
|
|
|
687
710
|
write: true;
|
|
688
711
|
connectScopes: readonly ["contents:read", "metadata:read", "issues:read", "issues:write"];
|
|
689
712
|
};
|
|
713
|
+
/** List milestones in a GitHub repository with their due dates and issue counts. */
|
|
714
|
+
listMilestones: {
|
|
715
|
+
description: string;
|
|
716
|
+
inputSchema: z.ZodObject<{
|
|
717
|
+
owner: z.ZodString;
|
|
718
|
+
repo: z.ZodString;
|
|
719
|
+
state: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
720
|
+
open: "open";
|
|
721
|
+
closed: "closed";
|
|
722
|
+
all: "all";
|
|
723
|
+
}>>>;
|
|
724
|
+
perPage: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
725
|
+
page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
726
|
+
}, z.core.$strip>;
|
|
727
|
+
connectScopes: readonly ["contents:read", "metadata:read", "issues:read"];
|
|
728
|
+
};
|
|
729
|
+
/** List the sub-issues of an issue. */
|
|
730
|
+
listSubIssues: {
|
|
731
|
+
description: string;
|
|
732
|
+
inputSchema: z.ZodObject<{
|
|
733
|
+
owner: z.ZodString;
|
|
734
|
+
repo: z.ZodString;
|
|
735
|
+
issueNumber: z.ZodNumber;
|
|
736
|
+
perPage: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
737
|
+
page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
738
|
+
}, z.core.$strip>;
|
|
739
|
+
connectScopes: readonly ["contents:read", "metadata:read", "issues:read"];
|
|
740
|
+
};
|
|
741
|
+
/** Add an existing issue as a sub-issue of another issue. Requires approval by default. */
|
|
742
|
+
addSubIssue: {
|
|
743
|
+
description: string;
|
|
744
|
+
inputSchema: z.ZodObject<{
|
|
745
|
+
owner: z.ZodString;
|
|
746
|
+
repo: z.ZodString;
|
|
747
|
+
issueNumber: z.ZodNumber;
|
|
748
|
+
subIssueNumber: z.ZodNumber;
|
|
749
|
+
subIssueRepo: z.ZodOptional<z.ZodString>;
|
|
750
|
+
replaceParent: z.ZodOptional<z.ZodBoolean>;
|
|
751
|
+
}, z.core.$strip>;
|
|
752
|
+
write: true;
|
|
753
|
+
connectScopes: readonly ["contents:read", "metadata:read", "issues:read", "issues:write"];
|
|
754
|
+
};
|
|
690
755
|
/** List reactions on an issue or pull request conversation, with per-emoji counts. */
|
|
691
756
|
listIssueReactions: {
|
|
692
757
|
description: string;
|
|
@@ -1145,6 +1210,26 @@ declare const GITHUB_TOOL_CATALOG: {
|
|
|
1145
1210
|
}, z.core.$strip>;
|
|
1146
1211
|
connectScopes: readonly ["contents:read", "metadata:read", "checks:read", "statuses:read"];
|
|
1147
1212
|
};
|
|
1213
|
+
/** Report a result on a commit as a commit status. Works with personal access tokens and GitHub Apps. Requires approval by default. */
|
|
1214
|
+
createCommitStatus: {
|
|
1215
|
+
description: string;
|
|
1216
|
+
inputSchema: z.ZodObject<{
|
|
1217
|
+
owner: z.ZodString;
|
|
1218
|
+
repo: z.ZodString;
|
|
1219
|
+
sha: z.ZodString;
|
|
1220
|
+
state: z.ZodEnum<{
|
|
1221
|
+
error: "error";
|
|
1222
|
+
success: "success";
|
|
1223
|
+
failure: "failure";
|
|
1224
|
+
pending: "pending";
|
|
1225
|
+
}>;
|
|
1226
|
+
context: z.ZodString;
|
|
1227
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1228
|
+
targetUrl: z.ZodOptional<z.ZodString>;
|
|
1229
|
+
}, z.core.$strip>;
|
|
1230
|
+
write: true;
|
|
1231
|
+
connectScopes: readonly ["contents:read", "metadata:read", "statuses:read", "statuses:write"];
|
|
1232
|
+
};
|
|
1148
1233
|
/** Diagnose CI failures for a ref — combined status, failing checks, and failed workflow jobs in one call. */
|
|
1149
1234
|
getCiFailureContext: {
|
|
1150
1235
|
description: string;
|
|
@@ -1362,21 +1447,22 @@ declare const PRESET_TOOLS: {
|
|
|
1362
1447
|
*
|
|
1363
1448
|
* Tools: `getPullRequest`, `listPullRequests`, `listPullRequestFiles`, `listPullRequestReviews`,
|
|
1364
1449
|
* `listPullRequestReviewThreads`, `getPullRequestContext`, `getCommit`, `getBlame`, `compareCommits`, `getRepository`,
|
|
1365
|
-
* `getFileContent`, `getRepositoryTree`, `searchCode`, `listCommits`, `listBranches`, `getBranchRules`, `
|
|
1366
|
-
* `updatePullRequest`, `addPullRequestComment`, `updatePullRequestComment`,
|
|
1367
|
-
* `createPullRequestReview`, `replyToReviewComment`, `resolveReviewThread`, `requestReviewers
|
|
1450
|
+
* `getFileContent`, `getRepositoryTree`, `searchCode`, `listCommits`, `listBranches`, `getBranchRules`, `getCollaboratorPermission`,
|
|
1451
|
+
* `listCheckRuns`, `getCombinedStatus`, `updatePullRequest`, `addPullRequestComment`, `updatePullRequestComment`,
|
|
1452
|
+
* `deletePullRequestComment`, `createPullRequestReview`, `replyToReviewComment`, `resolveReviewThread`, `requestReviewers`,
|
|
1453
|
+
* `createCommitStatus`.
|
|
1368
1454
|
*
|
|
1369
1455
|
* Agent prompt: optimized for thorough PR review with inline feedback.
|
|
1370
1456
|
*/
|
|
1371
|
-
readonly 'code-review': readonly ["getPullRequest", "listPullRequests", "listPullRequestFiles", "listPullRequestReviews", "listPullRequestReviewThreads", "getPullRequestContext", "getCommit", "getBlame", "compareCommits", "getRepository", "getFileContent", "getRepositoryTree", "searchCode", "listCommits", "listBranches", "getBranchRules", "listCheckRuns", "getCombinedStatus", "updatePullRequest", "addPullRequestComment", "updatePullRequestComment", "deletePullRequestComment", "createPullRequestReview", "replyToReviewComment", "resolveReviewThread", "requestReviewers"];
|
|
1457
|
+
readonly 'code-review': readonly ["getPullRequest", "listPullRequests", "listPullRequestFiles", "listPullRequestReviews", "listPullRequestReviewThreads", "getPullRequestContext", "getCommit", "getBlame", "compareCommits", "getRepository", "getFileContent", "getRepositoryTree", "searchCode", "listCommits", "listBranches", "getBranchRules", "getCollaboratorPermission", "listCheckRuns", "getCombinedStatus", "updatePullRequest", "addPullRequestComment", "updatePullRequestComment", "deletePullRequestComment", "createPullRequestReview", "replyToReviewComment", "resolveReviewThread", "requestReviewers", "createCommitStatus"];
|
|
1372
1458
|
/**
|
|
1373
1459
|
* **Issue triage** — manage and organize GitHub issues.
|
|
1374
1460
|
*
|
|
1375
1461
|
* Tools: `listIssues`, `getIssueContext`, `listIssueComments`, `createIssue`, `addIssueComment`, `updateIssueComment`,
|
|
1376
1462
|
* `deleteIssueComment`, `closeIssue`, `updateIssue`, `addLabels`, `removeLabel`, `createLabel`, `updateLabel`, `deleteLabel`,
|
|
1377
|
-
* `addAssignees`, `removeAssignees`, `
|
|
1378
|
-
* `
|
|
1379
|
-
* `getPullRequest`.
|
|
1463
|
+
* `addAssignees`, `removeAssignees`, `listMilestones`, `listSubIssues`, `addSubIssue`, `listIssueReactions`, `addIssueReaction`,
|
|
1464
|
+
* `listCommentReactions`, `addCommentReaction`, `getRepository`, `getFileContent`, `getRepositoryTree`, `searchCode`, `listCommits`,
|
|
1465
|
+
* `searchRepositories`, `searchIssues`, `getPullRequest`, `getCollaboratorPermission`.
|
|
1380
1466
|
*
|
|
1381
1467
|
* Prefer `getIssueContext` (issue + `labelNames` + recent comments) over separate get/list calls.
|
|
1382
1468
|
* Use `listIssueComments` to paginate beyond the comments returned by `getIssueContext`.
|
|
@@ -1384,18 +1470,19 @@ declare const PRESET_TOOLS: {
|
|
|
1384
1470
|
* Acknowledge a report with `addIssueReaction` / `addCommentReaction` instead of a comment when no reply is needed.
|
|
1385
1471
|
* Agent prompt: optimized for categorizing, labeling, and responding to issues.
|
|
1386
1472
|
*/
|
|
1387
|
-
readonly 'issue-triage': readonly ["listIssues", "getIssueContext", "listIssueComments", "createIssue", "addIssueComment", "updateIssueComment", "deleteIssueComment", "closeIssue", "updateIssue", "addLabels", "removeLabel", "createLabel", "updateLabel", "deleteLabel", "addAssignees", "removeAssignees", "listIssueReactions", "addIssueReaction", "listCommentReactions", "addCommentReaction", "getRepository", "getFileContent", "getRepositoryTree", "searchCode", "listCommits", "searchRepositories", "searchIssues", "getPullRequest"];
|
|
1473
|
+
readonly 'issue-triage': readonly ["listIssues", "getIssueContext", "listIssueComments", "createIssue", "addIssueComment", "updateIssueComment", "deleteIssueComment", "closeIssue", "updateIssue", "addLabels", "removeLabel", "createLabel", "updateLabel", "deleteLabel", "addAssignees", "removeAssignees", "listMilestones", "listSubIssues", "addSubIssue", "listIssueReactions", "addIssueReaction", "listCommentReactions", "addCommentReaction", "getRepository", "getFileContent", "getRepositoryTree", "searchCode", "listCommits", "searchRepositories", "searchIssues", "getPullRequest", "getCollaboratorPermission"];
|
|
1388
1474
|
/**
|
|
1389
1475
|
* **CI operations** — monitor and manage GitHub Actions workflows.
|
|
1390
1476
|
*
|
|
1391
1477
|
* Tools: `getRepository`, `getFileContent`, `getRepositoryTree`, `searchCode`, `listCommits`, `listBranches`, `getBranchRules`, `getCommit`,
|
|
1392
1478
|
* `getPullRequest`, `listWorkflows`, `listWorkflowRuns`, `getWorkflowRun`, `listWorkflowJobs`, `getWorkflowJobLogs`,
|
|
1393
|
-
* `listCheckRuns`, `getCombinedStatus`, `getCiFailureContext`, `triggerWorkflow`, `cancelWorkflowRun`, `rerunWorkflowRun
|
|
1479
|
+
* `listCheckRuns`, `getCombinedStatus`, `getCiFailureContext`, `triggerWorkflow`, `cancelWorkflowRun`, `rerunWorkflowRun`,
|
|
1480
|
+
* `createCommitStatus`.
|
|
1394
1481
|
*
|
|
1395
1482
|
* Diagnose a failure with `getCiFailureContext` first, then read the failing job's output with `getWorkflowJobLogs`.
|
|
1396
1483
|
* Agent prompt: optimized for diagnosing CI failures and managing workflow runs.
|
|
1397
1484
|
*/
|
|
1398
|
-
readonly 'ci-ops': readonly ["getRepository", "getFileContent", "getRepositoryTree", "searchCode", "listCommits", "listBranches", "getBranchRules", "getCommit", "getPullRequest", "listWorkflows", "listWorkflowRuns", "getWorkflowRun", "listWorkflowJobs", "getWorkflowJobLogs", "listCheckRuns", "getCombinedStatus", "getCiFailureContext", "triggerWorkflow", "cancelWorkflowRun", "rerunWorkflowRun"];
|
|
1485
|
+
readonly 'ci-ops': readonly ["getRepository", "getFileContent", "getRepositoryTree", "searchCode", "listCommits", "listBranches", "getBranchRules", "getCommit", "getPullRequest", "listWorkflows", "listWorkflowRuns", "getWorkflowRun", "listWorkflowJobs", "getWorkflowJobLogs", "listCheckRuns", "getCombinedStatus", "getCiFailureContext", "triggerWorkflow", "cancelWorkflowRun", "rerunWorkflowRun", "createCommitStatus"];
|
|
1399
1486
|
/**
|
|
1400
1487
|
* **Repository explorer** — read-only access to browse codebases.
|
|
1401
1488
|
*
|
|
@@ -1453,15 +1540,15 @@ declare const PRESET_TOOLS: {
|
|
|
1453
1540
|
/**
|
|
1454
1541
|
* **PR author** — open pull requests without the full write surface.
|
|
1455
1542
|
*
|
|
1456
|
-
* Tools: `getRepository`, `getFileContent`, `getRepositoryTree`, `searchCode`, `listCommits`, `listBranches`, `getBranchRules`,
|
|
1457
|
-
* `
|
|
1458
|
-
* `
|
|
1459
|
-
* `getCommit`.
|
|
1543
|
+
* Tools: `getRepository`, `getFileContent`, `getRepositoryTree`, `searchCode`, `listCommits`, `listBranches`, `getBranchRules`,
|
|
1544
|
+
* `getCollaboratorPermission`, `createBranch`, `deleteBranch`, `createOrUpdateFile`, `editFiles`, `createPullRequest`,
|
|
1545
|
+
* `updatePullRequest`, `updatePullRequestBranch`, `listPullRequests`, `getPullRequest`, `listPullRequestFiles`,
|
|
1546
|
+
* `listPullRequestReviewThreads`, `replyToReviewComment`, `resolveReviewThread`, `compareCommits`, `getCommit`.
|
|
1460
1547
|
*
|
|
1461
1548
|
* Respond to review feedback with `listPullRequestReviewThreads` → `replyToReviewComment` → `resolveReviewThread`.
|
|
1462
1549
|
* Agent prompt: optimized for branching, editing files, and opening focused PRs.
|
|
1463
1550
|
*/
|
|
1464
|
-
readonly 'pr-author': readonly ["getRepository", "getFileContent", "getRepositoryTree", "searchCode", "listCommits", "listBranches", "getBranchRules", "createBranch", "deleteBranch", "createOrUpdateFile", "editFiles", "createPullRequest", "updatePullRequest", "listPullRequests", "getPullRequest", "listPullRequestFiles", "listPullRequestReviewThreads", "replyToReviewComment", "resolveReviewThread", "compareCommits", "getCommit"];
|
|
1551
|
+
readonly 'pr-author': readonly ["getRepository", "getFileContent", "getRepositoryTree", "searchCode", "listCommits", "listBranches", "getBranchRules", "getCollaboratorPermission", "createBranch", "deleteBranch", "createOrUpdateFile", "editFiles", "createPullRequest", "updatePullRequest", "updatePullRequestBranch", "listPullRequests", "getPullRequest", "listPullRequestFiles", "listPullRequestReviewThreads", "replyToReviewComment", "resolveReviewThread", "compareCommits", "getCommit"];
|
|
1465
1552
|
/**
|
|
1466
1553
|
* **Maintainer** — full repository maintenance with all read and write tools.
|
|
1467
1554
|
*
|
|
@@ -1469,7 +1556,7 @@ declare const PRESET_TOOLS: {
|
|
|
1469
1556
|
*
|
|
1470
1557
|
* Agent prompt: optimized for day-to-day repo maintenance with careful write operations.
|
|
1471
1558
|
*/
|
|
1472
|
-
readonly maintainer: readonly ["getRepository", "listBranches", "getBranchRules", "getFileContent", "getRepositoryTree", "createBranch", "deleteBranch", "forkRepository", "createRepository", "createOrUpdateFile", "editFiles", "listPullRequests", "getPullRequest", "listPullRequestFiles", "listPullRequestReviews", "listPullRequestReviewThreads", "getPullRequestContext", "createPullRequest", "mergePullRequest", "enablePullRequestAutoMerge", "disablePullRequestAutoMerge", "updatePullRequest", "addPullRequestComment", "updatePullRequestComment", "deletePullRequestComment", "createPullRequestReview", "replyToReviewComment", "resolveReviewThread", "requestReviewers", "listIssues", "getIssue", "getIssueContext", "listIssueComments", "createIssue", "addIssueComment", "updateIssueComment", "deleteIssueComment", "closeIssue", "updateIssue", "listLabels", "addLabels", "removeLabel", "createLabel", "updateLabel", "deleteLabel", "addAssignees", "removeAssignees", "listIssueReactions", "addIssueReaction", "listCommentReactions", "addCommentReaction", "listDiscussions", "getDiscussion", "addDiscussionComment", "listNotifications", "markNotificationRead", "listCommits", "getCommit", "getBlame", "compareCommits", "searchCode", "searchRepositories", "searchIssues", "listGists", "getGist", "listGistComments", "createGist", "updateGist", "deleteGist", "createGistComment", "listWorkflows", "listWorkflowRuns", "getWorkflowRun", "listWorkflowJobs", "getWorkflowJobLogs", "triggerWorkflow", "cancelWorkflowRun", "rerunWorkflowRun", "listCheckRuns", "getCombinedStatus", "getCiFailureContext", "listReleases", "getLatestRelease", "getRelease", "getReleaseContext", "createRelease", "updateRelease", "deleteRelease", "listCodeScanningAlerts", "listDependabotAlerts", "listSecretScanningAlerts"];
|
|
1559
|
+
readonly maintainer: readonly ["getRepository", "listBranches", "getBranchRules", "getCollaboratorPermission", "getFileContent", "getRepositoryTree", "createBranch", "deleteBranch", "forkRepository", "createRepository", "createOrUpdateFile", "editFiles", "listPullRequests", "getPullRequest", "listPullRequestFiles", "listPullRequestReviews", "listPullRequestReviewThreads", "getPullRequestContext", "createPullRequest", "mergePullRequest", "enablePullRequestAutoMerge", "disablePullRequestAutoMerge", "updatePullRequest", "updatePullRequestBranch", "addPullRequestComment", "updatePullRequestComment", "deletePullRequestComment", "createPullRequestReview", "replyToReviewComment", "resolveReviewThread", "requestReviewers", "listIssues", "getIssue", "getIssueContext", "listIssueComments", "createIssue", "addIssueComment", "updateIssueComment", "deleteIssueComment", "closeIssue", "updateIssue", "listLabels", "addLabels", "removeLabel", "createLabel", "updateLabel", "deleteLabel", "addAssignees", "removeAssignees", "listMilestones", "listSubIssues", "addSubIssue", "listIssueReactions", "addIssueReaction", "listCommentReactions", "addCommentReaction", "listDiscussions", "getDiscussion", "addDiscussionComment", "listNotifications", "markNotificationRead", "listCommits", "getCommit", "getBlame", "compareCommits", "searchCode", "searchRepositories", "searchIssues", "listGists", "getGist", "listGistComments", "createGist", "updateGist", "deleteGist", "createGistComment", "listWorkflows", "listWorkflowRuns", "getWorkflowRun", "listWorkflowJobs", "getWorkflowJobLogs", "triggerWorkflow", "cancelWorkflowRun", "rerunWorkflowRun", "listCheckRuns", "getCombinedStatus", "createCommitStatus", "getCiFailureContext", "listReleases", "getLatestRelease", "getRelease", "getReleaseContext", "createRelease", "updateRelease", "deleteRelease", "listCodeScanningAlerts", "listDependabotAlerts", "listSecretScanningAlerts"];
|
|
1473
1560
|
};
|
|
1474
1561
|
type GithubToolPreset = keyof typeof PRESET_TOOLS;
|
|
1475
1562
|
/** Tool names included in a single preset. */
|
|
@@ -1477,6 +1564,35 @@ type PresetToolName<P extends GithubToolPreset> = Extract<(typeof PRESET_TOOLS)[
|
|
|
1477
1564
|
/** Tool names included when combining multiple presets. */
|
|
1478
1565
|
type CombinedPresetToolNames<P extends readonly GithubToolPreset[]> = PresetToolName<P[number]>;
|
|
1479
1566
|
//#endregion
|
|
1567
|
+
//#region src/core/guardrails.d.ts
|
|
1568
|
+
/**
|
|
1569
|
+
* Limits on where GitHub tools can act, checked on every call before it reaches GitHub.
|
|
1570
|
+
* Unlike approval, they hold whoever approves a call and whatever the model asks for.
|
|
1571
|
+
*/
|
|
1572
|
+
type GithubGuardrails = {
|
|
1573
|
+
/**
|
|
1574
|
+
* Repositories the tools may act on, as `owner/repo` or `owner/*`, matched case-insensitively.
|
|
1575
|
+
* A call to any other repository fails. Tools without a repository target (search, gists,
|
|
1576
|
+
* notifications) are not restricted. `createRepository` and `forkRepository` run only when the
|
|
1577
|
+
* new repository's full name matches, so they need `org` or `organization`. `addSubIssue` also
|
|
1578
|
+
* checks the sub-issue's repository, and `updatePullRequestBranch` the head's repository, which can be a fork.
|
|
1579
|
+
*/
|
|
1580
|
+
repositories?: string[];
|
|
1581
|
+
/**
|
|
1582
|
+
* Branches the tools may write to, as names or patterns where `*` matches any characters,
|
|
1583
|
+
* such as `agent/*`. Covers creating, deleting and committing to a branch, merging or enabling
|
|
1584
|
+
* auto-merge into a pull request's base branch, and updating a pull request's head branch.
|
|
1585
|
+
* A commit that doesn't name its branch fails.
|
|
1586
|
+
*/
|
|
1587
|
+
branches?: string[];
|
|
1588
|
+
/**
|
|
1589
|
+
* `'block'` (default) fails any call whose input contains what looks like a credential, such as a
|
|
1590
|
+
* GitHub token, a private key or a cloud API key, so the agent can't post one to GitHub. `'allow'`
|
|
1591
|
+
* turns the check off, for example when a repository's fixtures contain fake keys.
|
|
1592
|
+
*/
|
|
1593
|
+
secrets?: 'block' | 'allow';
|
|
1594
|
+
};
|
|
1595
|
+
//#endregion
|
|
1480
1596
|
//#region src/core/token.d.ts
|
|
1481
1597
|
/**
|
|
1482
1598
|
* The tool call a token is requested for. Passed to token providers so they
|
|
@@ -1498,8 +1614,16 @@ type GithubTokenCall = {
|
|
|
1498
1614
|
* outside a tool call.
|
|
1499
1615
|
*/
|
|
1500
1616
|
type GithubTokenInput = string | ((call?: GithubTokenCall) => Promise<string>);
|
|
1617
|
+
type GithubTokenResolver = (call?: GithubTokenCall) => Promise<string>;
|
|
1501
1618
|
/** Resolves a {@link GithubTokenInput} to a token string for an optional tool call. */
|
|
1502
1619
|
declare function resolveGithubToken(token?: GithubTokenInput, call?: GithubTokenCall): Promise<string>;
|
|
1620
|
+
/**
|
|
1621
|
+
* Wrap a token so every call it resolves for is checked against `guardrails` first, including the
|
|
1622
|
+
* default check for credentials in the input. A blocked call
|
|
1623
|
+
* throws `github_tools.GUARDRAIL_BLOCKED` before any request reaches GitHub. Use it when you build
|
|
1624
|
+
* tools from individual factories; `createGithubTools({ guardrails })` applies it for you.
|
|
1625
|
+
*/
|
|
1626
|
+
declare function withGithubGuardrails(token: GithubTokenInput | undefined, guardrails: GithubGuardrails | undefined): GithubTokenResolver;
|
|
1503
1627
|
//#endregion
|
|
1504
1628
|
//#region src/core/evaluation-policy.d.ts
|
|
1505
1629
|
/**
|
|
@@ -1792,11 +1916,41 @@ type GithubToolsBaseOptions = {
|
|
|
1792
1916
|
committer?: CommitIdentity;
|
|
1793
1917
|
/** Co-authors to attribute on all commits created by tools. */
|
|
1794
1918
|
coAuthors?: CommitIdentity[];
|
|
1919
|
+
/**
|
|
1920
|
+
* Repositories and branches the tools may act on, checked before each call reaches GitHub.
|
|
1921
|
+
* A blocked call fails with `github_tools.GUARDRAIL_BLOCKED`, whoever approves it.
|
|
1922
|
+
* @see {@link GithubGuardrails}
|
|
1923
|
+
*/
|
|
1924
|
+
guardrails?: GithubGuardrails;
|
|
1925
|
+
/**
|
|
1926
|
+
* Run reads as usual but send no write to GitHub: each write tool returns a
|
|
1927
|
+
* `GithubDryRunResult` instead, after the approval and guardrail checks. Use it to try an
|
|
1928
|
+
* agent on real repositories without changing them.
|
|
1929
|
+
*/
|
|
1930
|
+
dryRun?: boolean;
|
|
1795
1931
|
};
|
|
1796
1932
|
/** Tool set shape for a given preset option (single, combined, or all tools). */
|
|
1797
1933
|
type GithubToolsForPreset<P extends GithubToolPreset | readonly GithubToolPreset[] | undefined> = P extends GithubToolPreset ? Pick<AllGithubTools, PresetToolName<P> & GithubToolName> : P extends readonly GithubToolPreset[] ? Pick<AllGithubTools, CombinedPresetToolNames<P> & GithubToolName> : AllGithubTools;
|
|
1798
1934
|
/** Pick a subset of GitHub tools by tool name. */
|
|
1799
1935
|
type PickGithubTools<T extends GithubToolName> = Pick<AllGithubTools, T>;
|
|
1800
1936
|
//#endregion
|
|
1801
|
-
|
|
1802
|
-
|
|
1937
|
+
//#region src/core/dry-run.d.ts
|
|
1938
|
+
/** What approval would have decided for a write, had it run for real. */
|
|
1939
|
+
type GithubDryRunApproval = {
|
|
1940
|
+
/** `true` when a person would have been asked to approve the call. */
|
|
1941
|
+
required: boolean;
|
|
1942
|
+
/** The evaluation model's verdict, with `requireApproval: 'auto'`. */
|
|
1943
|
+
reason?: string;
|
|
1944
|
+
};
|
|
1945
|
+
/** What a write tool returns under `dryRun`: nothing is sent to GitHub, and nobody is asked to approve it. */
|
|
1946
|
+
type GithubDryRunResult = {
|
|
1947
|
+
dryRun: true;
|
|
1948
|
+
tool: GithubWriteToolName;
|
|
1949
|
+
input: Record<string, unknown>;
|
|
1950
|
+
/** What approval would have decided, when the integration can tell. */
|
|
1951
|
+
approval?: GithubDryRunApproval;
|
|
1952
|
+
message: string;
|
|
1953
|
+
};
|
|
1954
|
+
//#endregion
|
|
1955
|
+
export { DEFAULT_EVALUATION_MODEL as A, PRESET_TOOLS as B, fallbackTools as C, selectTools as D, selectPresets as E, withGithubGuardrails as F, GithubWriteToolName as G, GITHUB_TOOL_NAMES as H, GithubGuardrails as I, CORE_READ_TOOLS as L, GithubTokenCall as M, GithubTokenInput as N, GITHUB_WRITE_TOOLS as O, resolveGithubToken as P, CombinedPresetToolNames as R, fallbackPresets as S, needsAutoApproval as T, GITHUB_TOOL_CATALOG as U, PresetToolName as V, GithubToolName as W, AutoApprovalDecision as _, GithubToolsForPreset as a, evaluatePresets as b, CommitIdentity as c, Octokit$1 as d, ToolOptions as f, ToolApprovalMode as g, StaticApprovalConfig as h, GithubToolsBaseOptions as i, RoutablePreset as j, AUTO_APPROVAL_TOOLS as k, CommitToolOptions as l, ApprovalConfig as m, GithubDryRunResult as n, PickGithubTools as o, ToolOverrides as p, AllGithubTools as r, GithubToolsContext as s, GithubDryRunApproval as t, GithubTool as u, GithubEvaluationOptions as v, latestUserText as w, evaluateTools as x, autoApprovalDecision as y, GithubToolPreset as z };
|
|
1956
|
+
//# sourceMappingURL=dry-run-DXckOam2.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dry-run-DXckOam2.d.mts","names":[],"sources":["../src/core/catalog.ts","../src/core/tool-names.ts","../src/core/presets.ts","../src/core/guardrails.ts","../src/core/token.ts","../src/core/evaluation-policy.ts","../src/core/write-tools.ts","../src/core/evaluation.ts","../src/core/approval-policy.ts","../src/types.ts","../src/core/context.ts","../src/core/tool-types.ts","../src/core/dry-run.ts"],"mappings":";;;;;;;;;;;;;cA0Ea;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAK,gBAAgB,wBAAwB,KAAK,kBAClD;;KAGI,gBAAgB,UAAU,kBAAkB,KAAK,gBAAgB;;;;KCnDjE;;EAEV;;EAEA;;;KAIU;EACV;EACA,MAAM;EACN,OAAO;;EAEP,WAAW;EACX"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T as GITHUB_TOOL_CATALOG, Za as githubToolsErrors, _ as CORE_READ_TOOLS, d as PRESET_PURPOSES, f as RISK_QUESTION, h as requiresApproval, l as DEFAULT_EVALUATION_MODEL, m as rankPresets, p as conversationState, u as INTENT_QUESTION, v as PRESET_TOOLS, w as ALL_GITHUB_TOOL_NAMES } from "./write-tools-w-8tjnDQ.mjs";
|
|
2
2
|
import * as ai from "ai";
|
|
3
3
|
//#region src/core/model-output.ts
|
|
4
4
|
const MAX_PATCH_LENGTH = 4e3;
|
|
@@ -308,4 +308,4 @@ function messageText(message) {
|
|
|
308
308
|
//#endregion
|
|
309
309
|
export { listPullRequestFilesToModelOutput as _, evaluationRequest as a, latestUserText as c, selectTools as d, compareCommitsToModelOutput as f, getRepositoryTreeToModelOutput as g, getPullRequestContextToModelOutput as h, evaluateTools as i, needsAutoApproval as l, getFileContentToModelOutput as m, autoApprovalDecision as n, fallbackPresets as o, getCommitToModelOutput as p, evaluatePresets as r, fallbackTools as s, assertEvaluationAvailable as t, selectPresets as u };
|
|
310
310
|
|
|
311
|
-
//# sourceMappingURL=evaluation-
|
|
311
|
+
//# sourceMappingURL=evaluation-DJHINyAu.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluation-BtoHbxuQ.mjs","names":["exports"],"sources":["../src/core/model-output.ts","../src/core/evaluation.ts"],"sourcesContent":["const MAX_PATCH_LENGTH = 4000\nconst MAX_CONTENT_LENGTH = 20000\nconst MAX_MODEL_TREE_ENTRIES = 200\nconst MAX_MODEL_DIFF_FILES = 80\n\nfunction truncateText(text: string, maxLength: number): string {\n if (text.length <= maxLength) return text\n return `${text.slice(0, maxLength)}\\n\\n[truncated: ${text.length - maxLength} more characters]`\n}\n\nfunction truncatePatchFields<T extends { patch?: string }>(files: T[]): T[] {\n return files.map(file => ({\n ...file,\n patch: file.patch ? truncateText(file.patch, MAX_PATCH_LENGTH) : file.patch,\n }))\n}\n\nfunction capDiffFiles<T extends { patch?: string }>(files: T[] | undefined) {\n if (!files) return { files, filesOmitted: 0 }\n const truncated = truncatePatchFields(files)\n if (truncated.length <= MAX_MODEL_DIFF_FILES) return { files: truncated, filesOmitted: 0 }\n return {\n files: truncated.slice(0, MAX_MODEL_DIFF_FILES),\n filesOmitted: truncated.length - MAX_MODEL_DIFF_FILES,\n }\n}\n\ntype ToModelOutputOptions = {\n toolCallId: string\n input: unknown\n output: unknown\n}\n\ntype ListPullRequestFile = {\n filename: string\n status: string\n additions: number\n deletions: number\n changes: number\n patch?: string\n}\n\ntype ListPullRequestFilesOutput = {\n items: ListPullRequestFile[]\n hasMore: boolean\n page: number\n perPage: number\n nextPage?: number\n}\n\ntype GetCommitOutput = {\n sha: string\n message: string\n author?: string\n authorLogin?: string\n date?: string\n url: string\n stats: { additions: number, deletions: number, total: number } | null\n files?: Array<{\n filename: string\n status: string\n additions: number\n deletions: number\n patch?: string\n }>\n}\n\ntype GetFileContentOutput =\n | { type: 'directory', entries: Array<{ name: string, type: string, path: string }> }\n | { type: string, path: string }\n | {\n type: 'file'\n path: string\n sha: string\n size: number\n content: string\n totalLines?: number\n startLine?: number\n endLine?: number\n truncated?: boolean\n }\n\nexport function listPullRequestFilesToModelOutput({ output }: ToModelOutputOptions) {\n const result = output as ListPullRequestFilesOutput\n return {\n type: 'json' as const,\n value: {\n ...result,\n items: truncatePatchFields(result.items),\n },\n }\n}\n\nexport function getCommitToModelOutput({ output }: ToModelOutputOptions) {\n const commit = output as GetCommitOutput\n const { files, filesOmitted } = capDiffFiles(commit.files)\n return {\n type: 'json' as const,\n value: {\n ...commit,\n files,\n ...filesOmitted > 0 ? { filesOmitted } : {},\n },\n }\n}\n\ntype CompareCommitsOutput = {\n status: string\n aheadBy: number\n behindBy: number\n totalCommits: number\n url: string\n commits: Array<{ sha: string, message: string, author?: string, authorLogin?: string }>\n files?: Array<{\n filename: string\n status: string\n additions: number\n deletions: number\n patch?: string\n }>\n}\n\nexport function compareCommitsToModelOutput({ output }: ToModelOutputOptions) {\n const comparison = output as CompareCommitsOutput\n const { files, filesOmitted } = capDiffFiles(comparison.files)\n return {\n type: 'json' as const,\n value: {\n ...comparison,\n files,\n ...filesOmitted > 0 ? { filesOmitted } : {},\n },\n }\n}\n\nexport function getFileContentToModelOutput({ output }: ToModelOutputOptions) {\n const result = output as GetFileContentOutput\n if (result.type === 'directory' && 'entries' in result && result.entries.length > MAX_MODEL_TREE_ENTRIES) {\n return {\n type: 'json' as const,\n value: {\n ...result,\n truncated: true,\n entries: result.entries.slice(0, MAX_MODEL_TREE_ENTRIES),\n entriesOmitted: result.entries.length - MAX_MODEL_TREE_ENTRIES,\n },\n }\n }\n if ('content' in result && result.content.length > MAX_CONTENT_LENGTH) {\n return {\n type: 'json' as const,\n value: {\n ...result,\n content: truncateText(result.content, MAX_CONTENT_LENGTH),\n },\n }\n }\n return { type: 'json' as const, value: result }\n}\n\ntype GetRepositoryTreeOutput = {\n sha: string\n truncated: boolean\n path?: string\n entries: Array<{ path?: string, type?: string, size?: number, sha?: string }>\n}\n\nexport function getRepositoryTreeToModelOutput({ output }: ToModelOutputOptions) {\n const result = output as GetRepositoryTreeOutput\n if (result.entries.length <= MAX_MODEL_TREE_ENTRIES) {\n return { type: 'json' as const, value: result }\n }\n return {\n type: 'json' as const,\n value: {\n ...result,\n truncated: true,\n entries: result.entries.slice(0, MAX_MODEL_TREE_ENTRIES),\n entriesOmitted: result.entries.length - MAX_MODEL_TREE_ENTRIES,\n },\n }\n}\n\ntype GetPullRequestContextOutput = {\n pullRequest: {\n number: number\n title: string\n body: string | null\n state: string\n url: string\n author?: string\n branch: string\n headSha: string\n base: string\n draft?: boolean\n merged: boolean\n mergeable: boolean | null\n additions: number\n deletions: number\n changedFiles: number\n createdAt: string\n updatedAt: string\n mergedAt: string | null\n }\n files?: ListPullRequestFile[]\n filesHasMore?: boolean\n reviews?: Array<{\n id: number\n state: string\n body: string\n author?: string\n url: string\n submittedAt?: string | null\n }>\n checks?: {\n checkRuns: {\n totalCount: number\n checkRuns: Array<{\n id: number\n name: string\n status: string\n conclusion: string | null\n url: string | null\n startedAt: string | null\n completedAt: string | null\n }>\n }\n combinedStatus: {\n state: string\n totalCount: number\n statuses: Array<{\n context: string\n state: string\n description: string | null\n url: string | null\n }>\n }\n }\n}\n\nexport function getPullRequestContextToModelOutput({ output }: ToModelOutputOptions) {\n const result = output as GetPullRequestContextOutput\n const { files, filesOmitted } = capDiffFiles(result.files)\n return {\n type: 'json' as const,\n value: {\n ...result,\n files,\n ...filesOmitted > 0 ? { filesOmitted } : {},\n },\n }\n}\n","import * as ai from 'ai'\nimport type { Experimental_EvaluationModel, JSONValue, ModelMessage } from 'ai'\nimport { GITHUB_TOOL_CATALOG } from './catalog'\nimport { githubToolsErrors } from './errors'\nimport { CORE_READ_TOOLS, PRESET_TOOLS } from './presets'\nimport { ALL_GITHUB_TOOL_NAMES, type GithubToolName } from './tool-names'\nimport { DEFAULT_EVALUATION_MODEL, RISK_QUESTION, INTENT_QUESTION, PRESET_PURPOSES, conversationState, rankPresets, requiresApproval, type RoutablePreset } from './evaluation-policy'\nexport { DEFAULT_EVALUATION_MODEL, AUTO_APPROVAL_TOOLS } from './evaluation-policy'\nimport type { GithubWriteToolName } from './write-tools'\n\n/**\n * Tuning for `requireApproval: 'auto'` and `preset: 'auto'`. Every field is optional.\n */\nexport type GithubEvaluationOptions = {\n /**\n * Decision model for AI SDK `experimental_decide`: an AI Gateway ID or a model instance.\n * @default 'typesafe-ai/jev-1.14.0'\n */\n model?: Experimental_EvaluationModel\n /**\n * Provider options passed to every decision call, for example AI Gateway settings such as\n * `{ gateway: { zeroDataRetention: true } }`.\n */\n providerOptions?: Record<string, Record<string, JSONValue>>\n /**\n * Highest risk an `'auto'` tool call can have and still run without approval, on a 0–2 scale\n * (0 negligible, 1 visible but reversible, 2 hard to undo).\n * @default 1\n */\n maxRisk?: number\n /**\n * Lowest probability that the latest user message asked for the call, for it to run without approval.\n * @default 0.6\n */\n minIntent?: number\n /**\n * Lowest probability for `preset: 'auto'` to select a preset. When no preset reaches it,\n * read-only `repo-explorer` is used.\n * @default 0.7\n */\n minPresetProbability?: number\n /**\n * Most presets `preset: 'auto'` combines in one call, keeping the most likely ones.\n * @default 2\n */\n maxPresets?: number\n /**\n * What `preset: 'auto'` picks. `'tools'` asks the decision model about each tool and lists only\n * the likely ones plus the core read tools (`CORE_READ_TOOLS`), so the model sees far fewer tool\n * definitions. The rest stays reachable: eve defers it, and `createGithubAgent` adds a\n * `callGithubTool` tool. `'presets'` lists the tools of up to `maxPresets` presets and, on\n * `createGithubAgent`, uses their system prompts.\n * @default 'tools'\n */\n selection?: 'presets' | 'tools'\n /**\n * How long a `preset: 'auto'` decision lasts. `'session'` decides once, on the conversation's\n * first request, so the listed tools, and the provider's cached prompt prefix they start, stay\n * the same for the rest of the conversation; later needs go through deferred tools (eve) or\n * `callGithubTool` (`createGithubAgent`, which doesn't support it with `selection: 'presets'`).\n * `'turn'` decides again for each new request, which changes the tool list and makes the\n * provider write the whole conversation to its prompt cache again.\n * @default 'session', except `'turn'` for presets on `createGithubAgent`\n */\n scope?: 'turn' | 'session'\n /**\n * Keeps `createGithubAgent`'s `preset: 'auto'` decisions across processes, such as serverless\n * instances, under keys derived from the request and the routing settings (decision model,\n * thresholds and caps), so agents configured differently don't share decisions. Without it, a decision\n * lives in this process's memory, and another process decides again: that costs a decision\n * call, and a different pick changes the tool list and invalidates the provider's prompt cache.\n * The eve extension keeps decisions in the session and ignores this option.\n */\n store?: {\n get: (key: string) => Promise<readonly string[] | undefined>\n set: (key: string, value: readonly string[]) => Promise<void>\n }\n /**\n * Lowest probability for `selection: 'tools'` to list a tool beyond the core read tools.\n * @default 0.5\n */\n minToolProbability?: number\n /**\n * Most tools `selection: 'tools'` lists beyond the core read tools, keeping the most likely ones.\n * @default 8\n */\n maxTools?: number\n}\n\n/**\n * Throws `EVALUATION_UNAVAILABLE` when the installed `ai` has neither `experimental_decide`\n * nor `experimental_evaluate`. Call it where `'auto'` is configured, so a too-old `ai` fails\n * at setup instead of mid-conversation.\n */\nexport function assertEvaluationAvailable() {\n loadDecide()\n}\n\n// `experimental_decide` replaced `experimental_evaluate` in ai 7.0.128; the old name stays an alias.\nfunction loadDecide(): typeof ai.experimental_decide {\n const exports: Partial<Pick<typeof ai, 'experimental_decide' | 'experimental_evaluate'>> = ai\n const decide = exports.experimental_decide ?? exports.experimental_evaluate\n if (!decide) throw githubToolsErrors.EVALUATION_UNAVAILABLE()\n return decide\n}\n\n// `decide` throws when the model refuses any question; the error names the refused questions.\nfunction refusedQuestions(error: unknown): readonly string[] | undefined {\n const exports: Partial<Pick<typeof ai, 'Experimental_DecisionRefusalError'>> = ai\n return exports.Experimental_DecisionRefusalError?.isInstance(error) ? error.questionIds : undefined\n}\n\nfunction warnEvaluationFailed(model: Experimental_EvaluationModel, fallback: string, error: unknown, abortSignal?: AbortSignal) {\n abortSignal?.throwIfAborted()\n const cause = error instanceof Error ? error : new Error(String(error))\n console.warn('[github-tools]', githubToolsErrors.EVALUATION_FAILED({\n model: typeof model === 'string' ? model : model.modelId,\n fallback,\n detail: cause.message,\n cause,\n }))\n}\n\n/** Whether a person should approve a GitHub write, and why, as a short sentence for the approval request. */\nexport type AutoApprovalDecision = { ask: boolean, reason: string }\n\nconst RISK_LABELS = RISK_QUESTION.criteria.map(criterion => criterion.slice(0, criterion.indexOf(':')))\n\n/**\n * Asks the decision model how risky a GitHub write is and whether the user asked for it, and\n * explains the outcome: `ask` is true when a person should approve the call. A failed or refused\n * decision asks, since it gives no evidence that the call is safe.\n */\nexport async function autoApprovalDecision(\n toolName: GithubWriteToolName,\n input: unknown,\n messages: readonly ModelMessage[],\n { model = DEFAULT_EVALUATION_MODEL, maxRisk = 1, minIntent = 0.6, providerOptions }: GithubEvaluationOptions = {},\n abortSignal?: AbortSignal,\n): Promise<AutoApprovalDecision> {\n const decide = loadDecide()\n let refused = false\n const result = await decide({\n model,\n providerOptions,\n state: {\n ...conversationState(messages, messageText),\n toolCall: {\n tool: toolName,\n description: GITHUB_TOOL_CATALOG[toolName].description,\n input: input as JSONValue,\n },\n },\n questions: {\n risk: { type: 'score', ...RISK_QUESTION },\n intent: { type: 'boolean', ...INTENT_QUESTION },\n },\n abortSignal,\n }).catch((error: unknown) => {\n // A refusal is an answer, not an outage: it gives no evidence the call is safe, so a person decides.\n refused = Boolean(refusedQuestions(error))\n if (!refused) warnEvaluationFailed(model, `asking approval for ${toolName}`, error, abortSignal)\n return undefined\n })\n if (!result) return { ask: true, reason: refused ? 'The decision model declined to rate this call.' : 'The decision model was unavailable.' }\n const risk = result.answers.risk.score\n const intent = result.answers.intent.probability\n // Jev scores risk on a continuous 0–2 scale, so the label is the nearest rubric level.\n const verdict = `${RISK_LABELS[Math.round(risk)]} (risk ${Number(risk.toFixed(1))} of 2), ${Math.round(intent * 100)}% likely you asked for it`\n return requiresApproval(risk, intent, { maxRisk, minIntent })\n ? { ask: true, reason: `${verdict}.` }\n : { ask: false, reason: `Approved automatically: ${verdict.charAt(0).toLowerCase()}${verdict.slice(1)}.` }\n}\n\n/** Whether a GitHub write needs a person's approval; see {@link autoApprovalDecision}. */\nexport async function needsAutoApproval(\n toolName: GithubWriteToolName,\n input: unknown,\n messages: readonly ModelMessage[],\n options: GithubEvaluationOptions = {},\n abortSignal?: AbortSignal,\n): Promise<boolean> {\n return (await autoApprovalDecision(toolName, input, messages, options, abortSignal)).ask\n}\n\n/**\n * Presets the latest user message needs, from one evaluation call with an independent\n * yes/no question per preset. Returns up to `maxPresets` presets at or above\n * `minPresetProbability`, most likely first, and read-only `repo-explorer` when none qualifies.\n * `repo-explorer` is only combined with no other preset. Rejects when the evaluation call fails;\n * {@link selectPresets} falls back instead. Never returns `maintainer`, so the full catalog is never exposed.\n */\nexport async function evaluatePresets(\n messages: readonly ModelMessage[],\n options: GithubEvaluationOptions = {},\n abortSignal?: AbortSignal,\n): Promise<RoutablePreset[]> {\n const { minPresetProbability = 0.7, maxPresets = 2 } = options\n const presets = Object.keys(PRESET_PURPOSES) as RoutablePreset[]\n const probabilities = await decideEach(messages, presets, preset => ({\n instructions: 'Does handling this GitHub request need the tools of this preset?',\n criteria: { true: { purpose: PRESET_PURPOSES[preset], tools: [...PRESET_TOOLS[preset]] } },\n }), options, abortSignal)\n return rankPresets(probabilities, { minPresetProbability, maxPresets })\n}\n\n/**\n * Tools the latest user message needs, from one decision call with a yes/no question per tool:\n * the core read tools, plus up to `maxTools` others at or above `minToolProbability`, most likely\n * first. Rejects when the decision call fails; {@link selectTools} falls back instead.\n */\nexport async function evaluateTools(\n messages: readonly ModelMessage[],\n options: GithubEvaluationOptions = {},\n abortSignal?: AbortSignal,\n): Promise<GithubToolName[]> {\n const { minToolProbability = 0.5, maxTools = 8 } = options\n const core: readonly GithubToolName[] = CORE_READ_TOOLS\n const candidates = ALL_GITHUB_TOOL_NAMES.filter(name => !core.includes(name))\n const probabilities = await decideEach(messages, candidates, name => ({\n instructions: 'Does handling this GitHub request need this tool?',\n criteria: { true: { tool: name, description: GITHUB_TOOL_CATALOG[name].description } },\n }), options, abortSignal)\n const likely = candidates\n .filter(name => probabilities[name] >= minToolProbability)\n .toSorted((a, b) => probabilities[b] - probabilities[a])\n .slice(0, maxTools)\n return [...core, ...likely]\n}\n\ntype BooleanQuestion = { instructions: string, criteria: { true: Record<string, JSONValue> } }\n\n// One boolean question per key against the conversation. A refused question counts as a no:\n// ask once more without it instead of losing every answer.\nasync function decideEach<K extends string>(\n messages: readonly ModelMessage[],\n keys: readonly K[],\n question: (key: K) => BooleanQuestion,\n { model = DEFAULT_EVALUATION_MODEL, providerOptions }: GithubEvaluationOptions,\n abortSignal?: AbortSignal,\n): Promise<Record<K, number>> {\n const decide = loadDecide()\n const state = conversationState(messages, messageText)\n const ask = (asked: readonly K[]) => decide({\n model,\n providerOptions,\n state,\n questions: Object.fromEntries(asked.map(key => [key, { type: 'boolean' as const, ...question(key) }])),\n abortSignal,\n })\n const probabilities = Object.fromEntries(keys.map(key => [key, 0])) as Record<K, number>\n const { answers } = await ask(keys).catch((error: unknown) => {\n const refused = refusedQuestions(error)\n const remaining = keys.filter(key => !refused?.includes(key))\n if (!refused || remaining.length === 0) throw error\n return ask(remaining)\n })\n for (const [key, answer] of Object.entries(answers)) probabilities[key as K] = answer.probability\n return probabilities\n}\n\n/**\n * Logs `EVALUATION_FAILED` for a failed {@link evaluatePresets} call and returns the read-only\n * `repo-explorer` fallback. Rethrows when `abortSignal` is aborted.\n */\nexport function fallbackPresets(error: unknown, { model = DEFAULT_EVALUATION_MODEL }: GithubEvaluationOptions = {}, abortSignal?: AbortSignal): RoutablePreset[] {\n warnEvaluationFailed(model, 'using the repo-explorer preset', error, abortSignal)\n return ['repo-explorer']\n}\n\n/**\n * Logs `EVALUATION_FAILED` for a failed {@link evaluateTools} call and returns the read-only\n * `repo-explorer` tools. Rethrows when `abortSignal` is aborted.\n */\nexport function fallbackTools(error: unknown, { model = DEFAULT_EVALUATION_MODEL }: GithubEvaluationOptions = {}, abortSignal?: AbortSignal): GithubToolName[] {\n warnEvaluationFailed(model, 'using the repo-explorer tools', error, abortSignal)\n return [...PRESET_TOOLS['repo-explorer']]\n}\n\n/**\n * {@link evaluateTools}, falling back to the read-only `repo-explorer` tools (and logging\n * `EVALUATION_FAILED`) when the decision call fails.\n */\nexport async function selectTools(\n messages: readonly ModelMessage[],\n options: GithubEvaluationOptions = {},\n abortSignal?: AbortSignal,\n): Promise<GithubToolName[]> {\n return evaluateTools(messages, options, abortSignal).catch(error => fallbackTools(error, options, abortSignal))\n}\n\n/**\n * {@link evaluatePresets}, falling back to read-only `repo-explorer` (and logging\n * `EVALUATION_FAILED`) when the evaluation call fails.\n */\nexport async function selectPresets(\n messages: readonly ModelMessage[],\n options: GithubEvaluationOptions = {},\n abortSignal?: AbortSignal,\n): Promise<RoutablePreset[]> {\n return evaluatePresets(messages, options, abortSignal).catch(error => fallbackPresets(error, options, abortSignal))\n}\n\nexport function latestUserText(messages: readonly ModelMessage[]): string {\n return conversationState(messages, messageText).request\n}\n\n/** The `request` and `repliedTo` the evaluation model sees for these messages. */\nexport function evaluationRequest(messages: readonly ModelMessage[]) {\n return conversationState(messages, messageText)\n}\n\nfunction messageText(message: ModelMessage): string {\n if (typeof message.content === 'string') return message.content\n return message.content.flatMap(part => part.type === 'text' ? [part.text] : []).join('\\n')\n}\n"],"mappings":";;;AAAA,MAAM,mBAAmB;AACzB,MAAM,qBAAqB;AAC3B,MAAM,yBAAyB;AAC/B,MAAM,uBAAuB;AAE7B,SAAS,aAAa,MAAc,WAA2B;CAC7D,IAAI,KAAK,UAAU,WAAW,OAAO;CACrC,OAAO,GAAG,KAAK,MAAM,GAAG,SAAS,EAAE,kBAAkB,KAAK,SAAS,UAAU;AAC/E;AAEA,SAAS,oBAAkD,OAAiB;CAC1E,OAAO,MAAM,KAAI,UAAS;EACxB,GAAG;EACH,OAAO,KAAK,QAAQ,aAAa,KAAK,OAAO,gBAAgB,IAAI,KAAK;CACxE,EAAE;AACJ;AAEA,SAAS,aAA2C,OAAwB;CAC1E,IAAI,CAAC,OAAO,OAAO;EAAE;EAAO,cAAc;CAAE;CAC5C,MAAM,YAAY,oBAAoB,KAAK;CAC3C,IAAI,UAAU,UAAU,sBAAsB,OAAO;EAAE,OAAO;EAAW,cAAc;CAAE;CACzF,OAAO;EACL,OAAO,UAAU,MAAM,GAAG,oBAAoB;EAC9C,cAAc,UAAU,SAAS;CACnC;AACF;AAyDA,SAAgB,kCAAkC,EAAE,UAAgC;CAClF,MAAM,SAAS;CACf,OAAO;EACL,MAAM;EACN,OAAO;GACL,GAAG;GACH,OAAO,oBAAoB,OAAO,KAAK;EACzC;CACF;AACF;AAEA,SAAgB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MA,SAAgB,gBAAgB,OAAgB,EAAE,QAAQ,6BAAsD,CAAC,GAAG,aAA6C;CAC/J,qBAAqB,OAAO,kCAAkC,OAAO,WAAW;CAChF,OAAO,CAAC,eAAe;AACzB;;;;;AAMA,SAAgB,cAAc,OAAgB,EAAE,QAAQ,6BAAsD,CAAC,GAAG,aAA6C;CAC7J,qBAAqB,OAAO,iCAAiC,OAAO,WAAW;CAC/E,OAAO,CAAC,GAAG,aAAa,gBAAgB;AAC1C;;;;;AAMA,eAAsB,YACpB,UACA,UAAmC,CAAC,GACpC,aAC2B;CAC3B,OAAO,cAAc,UAAU,SAAS,WAAW,CAAC,CAAC,OAAM,UAAS,cAAc,OAAO,SAAS,WAAW,CAAC;AAChH;;;;;AAMA,eAAsB,cACpB,UACA,UAAmC,CAAC,GACpC,aAC2B;CAC3B,OAAO,gBAAgB,UAAU,SAAS,WAAW,CAAC,CAAC,OAAM,UAAS,gBAAgB,OAAO,SAAS,WAAW,CAAC;AACpH;AAEA,SAAgB,eAAe,UAA2C;CACxE,OAAO,kBAAkB,UAAU,WAAW,CAAC,CAAC;AAClD;;AAGA,SAAgB,kBAAkB,UAAmC;CACnE,OAAO,kBAAkB,UAAU,WAAW;AAChD;AAEA,SAAS,YAAY,SAA+B;CAClD,IAAI,OAAO,QAAQ,YAAY,UAAU,OAAO,QAAQ;CACxD,OAAO,QAAQ,QAAQ,SAAQ,SAAQ,KAAK,SAAS,SAAS,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI;AAC3F"}
|
|
1
|
+
{"version":3,"file":"evaluation-DJHINyAu.mjs","names":["exports"],"sources":["../src/core/model-output.ts","../src/core/evaluation.ts"],"sourcesContent":["const MAX_PATCH_LENGTH = 4000\nconst MAX_CONTENT_LENGTH = 20000\nconst MAX_MODEL_TREE_ENTRIES = 200\nconst MAX_MODEL_DIFF_FILES = 80\n\nfunction truncateText(text: string, maxLength: number): string {\n if (text.length <= maxLength) return text\n return `${text.slice(0, maxLength)}\\n\\n[truncated: ${text.length - maxLength} more characters]`\n}\n\nfunction truncatePatchFields<T extends { patch?: string }>(files: T[]): T[] {\n return files.map(file => ({\n ...file,\n patch: file.patch ? truncateText(file.patch, MAX_PATCH_LENGTH) : file.patch,\n }))\n}\n\nfunction capDiffFiles<T extends { patch?: string }>(files: T[] | undefined) {\n if (!files) return { files, filesOmitted: 0 }\n const truncated = truncatePatchFields(files)\n if (truncated.length <= MAX_MODEL_DIFF_FILES) return { files: truncated, filesOmitted: 0 }\n return {\n files: truncated.slice(0, MAX_MODEL_DIFF_FILES),\n filesOmitted: truncated.length - MAX_MODEL_DIFF_FILES,\n }\n}\n\ntype ToModelOutputOptions = {\n toolCallId: string\n input: unknown\n output: unknown\n}\n\ntype ListPullRequestFile = {\n filename: string\n status: string\n additions: number\n deletions: number\n changes: number\n patch?: string\n}\n\ntype ListPullRequestFilesOutput = {\n items: ListPullRequestFile[]\n hasMore: boolean\n page: number\n perPage: number\n nextPage?: number\n}\n\ntype GetCommitOutput = {\n sha: string\n message: string\n author?: string\n authorLogin?: string\n date?: string\n url: string\n stats: { additions: number, deletions: number, total: number } | null\n files?: Array<{\n filename: string\n status: string\n additions: number\n deletions: number\n patch?: string\n }>\n}\n\ntype GetFileContentOutput =\n | { type: 'directory', entries: Array<{ name: string, type: string, path: string }> }\n | { type: string, path: string }\n | {\n type: 'file'\n path: string\n sha: string\n size: number\n content: string\n totalLines?: number\n startLine?: number\n endLine?: number\n truncated?: boolean\n }\n\nexport function listPullRequestFilesToModelOutput({ output }: ToModelOutputOptions) {\n const result = output as ListPullRequestFilesOutput\n return {\n type: 'json' as const,\n value: {\n ...result,\n items: truncatePatchFields(result.items),\n },\n }\n}\n\nexport function getCommitToModelOutput({ output }: ToModelOutputOptions) {\n const commit = output as GetCommitOutput\n const { files, filesOmitted } = capDiffFiles(commit.files)\n return {\n type: 'json' as const,\n value: {\n ...commit,\n files,\n ...filesOmitted > 0 ? { filesOmitted } : {},\n },\n }\n}\n\ntype CompareCommitsOutput = {\n status: string\n aheadBy: number\n behindBy: number\n totalCommits: number\n url: string\n commits: Array<{ sha: string, message: string, author?: string, authorLogin?: string }>\n files?: Array<{\n filename: string\n status: string\n additions: number\n deletions: number\n patch?: string\n }>\n}\n\nexport function compareCommitsToModelOutput({ output }: ToModelOutputOptions) {\n const comparison = output as CompareCommitsOutput\n const { files, filesOmitted } = capDiffFiles(comparison.files)\n return {\n type: 'json' as const,\n value: {\n ...comparison,\n files,\n ...filesOmitted > 0 ? { filesOmitted } : {},\n },\n }\n}\n\nexport function getFileContentToModelOutput({ output }: ToModelOutputOptions) {\n const result = output as GetFileContentOutput\n if (result.type === 'directory' && 'entries' in result && result.entries.length > MAX_MODEL_TREE_ENTRIES) {\n return {\n type: 'json' as const,\n value: {\n ...result,\n truncated: true,\n entries: result.entries.slice(0, MAX_MODEL_TREE_ENTRIES),\n entriesOmitted: result.entries.length - MAX_MODEL_TREE_ENTRIES,\n },\n }\n }\n if ('content' in result && result.content.length > MAX_CONTENT_LENGTH) {\n return {\n type: 'json' as const,\n value: {\n ...result,\n content: truncateText(result.content, MAX_CONTENT_LENGTH),\n },\n }\n }\n return { type: 'json' as const, value: result }\n}\n\ntype GetRepositoryTreeOutput = {\n sha: string\n truncated: boolean\n path?: string\n entries: Array<{ path?: string, type?: string, size?: number, sha?: string }>\n}\n\nexport function getRepositoryTreeToModelOutput({ output }: ToModelOutputOptions) {\n const result = output as GetRepositoryTreeOutput\n if (result.entries.length <= MAX_MODEL_TREE_ENTRIES) {\n return { type: 'json' as const, value: result }\n }\n return {\n type: 'json' as const,\n value: {\n ...result,\n truncated: true,\n entries: result.entries.slice(0, MAX_MODEL_TREE_ENTRIES),\n entriesOmitted: result.entries.length - MAX_MODEL_TREE_ENTRIES,\n },\n }\n}\n\ntype GetPullRequestContextOutput = {\n pullRequest: {\n number: number\n title: string\n body: string | null\n state: string\n url: string\n author?: string\n branch: string\n headSha: string\n base: string\n draft?: boolean\n merged: boolean\n mergeable: boolean | null\n additions: number\n deletions: number\n changedFiles: number\n createdAt: string\n updatedAt: string\n mergedAt: string | null\n }\n files?: ListPullRequestFile[]\n filesHasMore?: boolean\n reviews?: Array<{\n id: number\n state: string\n body: string\n author?: string\n url: string\n submittedAt?: string | null\n }>\n checks?: {\n checkRuns: {\n totalCount: number\n checkRuns: Array<{\n id: number\n name: string\n status: string\n conclusion: string | null\n url: string | null\n startedAt: string | null\n completedAt: string | null\n }>\n }\n combinedStatus: {\n state: string\n totalCount: number\n statuses: Array<{\n context: string\n state: string\n description: string | null\n url: string | null\n }>\n }\n }\n}\n\nexport function getPullRequestContextToModelOutput({ output }: ToModelOutputOptions) {\n const result = output as GetPullRequestContextOutput\n const { files, filesOmitted } = capDiffFiles(result.files)\n return {\n type: 'json' as const,\n value: {\n ...result,\n files,\n ...filesOmitted > 0 ? { filesOmitted } : {},\n },\n }\n}\n","import * as ai from 'ai'\nimport type { Experimental_EvaluationModel, JSONValue, ModelMessage } from 'ai'\nimport { GITHUB_TOOL_CATALOG } from './catalog'\nimport { githubToolsErrors } from './errors'\nimport { CORE_READ_TOOLS, PRESET_TOOLS } from './presets'\nimport { ALL_GITHUB_TOOL_NAMES, type GithubToolName } from './tool-names'\nimport { DEFAULT_EVALUATION_MODEL, RISK_QUESTION, INTENT_QUESTION, PRESET_PURPOSES, conversationState, rankPresets, requiresApproval, type RoutablePreset } from './evaluation-policy'\nexport { DEFAULT_EVALUATION_MODEL, AUTO_APPROVAL_TOOLS } from './evaluation-policy'\nimport type { GithubWriteToolName } from './write-tools'\n\n/**\n * Tuning for `requireApproval: 'auto'` and `preset: 'auto'`. Every field is optional.\n */\nexport type GithubEvaluationOptions = {\n /**\n * Decision model for AI SDK `experimental_decide`: an AI Gateway ID or a model instance.\n * @default 'typesafe-ai/jev-1.14.0'\n */\n model?: Experimental_EvaluationModel\n /**\n * Provider options passed to every decision call, for example AI Gateway settings such as\n * `{ gateway: { zeroDataRetention: true } }`.\n */\n providerOptions?: Record<string, Record<string, JSONValue>>\n /**\n * Highest risk an `'auto'` tool call can have and still run without approval, on a 0–2 scale\n * (0 negligible, 1 visible but reversible, 2 hard to undo).\n * @default 1\n */\n maxRisk?: number\n /**\n * Lowest probability that the latest user message asked for the call, for it to run without approval.\n * @default 0.6\n */\n minIntent?: number\n /**\n * Lowest probability for `preset: 'auto'` to select a preset. When no preset reaches it,\n * read-only `repo-explorer` is used.\n * @default 0.7\n */\n minPresetProbability?: number\n /**\n * Most presets `preset: 'auto'` combines in one call, keeping the most likely ones.\n * @default 2\n */\n maxPresets?: number\n /**\n * What `preset: 'auto'` picks. `'tools'` asks the decision model about each tool and lists only\n * the likely ones plus the core read tools (`CORE_READ_TOOLS`), so the model sees far fewer tool\n * definitions. The rest stays reachable: eve defers it, and `createGithubAgent` adds a\n * `callGithubTool` tool. `'presets'` lists the tools of up to `maxPresets` presets and, on\n * `createGithubAgent`, uses their system prompts.\n * @default 'tools'\n */\n selection?: 'presets' | 'tools'\n /**\n * How long a `preset: 'auto'` decision lasts. `'session'` decides once, on the conversation's\n * first request, so the listed tools, and the provider's cached prompt prefix they start, stay\n * the same for the rest of the conversation; later needs go through deferred tools (eve) or\n * `callGithubTool` (`createGithubAgent`, which doesn't support it with `selection: 'presets'`).\n * `'turn'` decides again for each new request, which changes the tool list and makes the\n * provider write the whole conversation to its prompt cache again.\n * @default 'session', except `'turn'` for presets on `createGithubAgent`\n */\n scope?: 'turn' | 'session'\n /**\n * Keeps `createGithubAgent`'s `preset: 'auto'` decisions across processes, such as serverless\n * instances, under keys derived from the request and the routing settings (decision model,\n * thresholds and caps), so agents configured differently don't share decisions. Without it, a decision\n * lives in this process's memory, and another process decides again: that costs a decision\n * call, and a different pick changes the tool list and invalidates the provider's prompt cache.\n * The eve extension keeps decisions in the session and ignores this option.\n */\n store?: {\n get: (key: string) => Promise<readonly string[] | undefined>\n set: (key: string, value: readonly string[]) => Promise<void>\n }\n /**\n * Lowest probability for `selection: 'tools'` to list a tool beyond the core read tools.\n * @default 0.5\n */\n minToolProbability?: number\n /**\n * Most tools `selection: 'tools'` lists beyond the core read tools, keeping the most likely ones.\n * @default 8\n */\n maxTools?: number\n}\n\n/**\n * Throws `EVALUATION_UNAVAILABLE` when the installed `ai` has neither `experimental_decide`\n * nor `experimental_evaluate`. Call it where `'auto'` is configured, so a too-old `ai` fails\n * at setup instead of mid-conversation.\n */\nexport function assertEvaluationAvailable() {\n loadDecide()\n}\n\n// `experimental_decide` replaced `experimental_evaluate` in ai 7.0.128; the old name stays an alias.\nfunction loadDecide(): typeof ai.experimental_decide {\n const exports: Partial<Pick<typeof ai, 'experimental_decide' | 'experimental_evaluate'>> = ai\n const decide = exports.experimental_decide ?? exports.experimental_evaluate\n if (!decide) throw githubToolsErrors.EVALUATION_UNAVAILABLE()\n return decide\n}\n\n// `decide` throws when the model refuses any question; the error names the refused questions.\nfunction refusedQuestions(error: unknown): readonly string[] | undefined {\n const exports: Partial<Pick<typeof ai, 'Experimental_DecisionRefusalError'>> = ai\n return exports.Experimental_DecisionRefusalError?.isInstance(error) ? error.questionIds : undefined\n}\n\nfunction warnEvaluationFailed(model: Experimental_EvaluationModel, fallback: string, error: unknown, abortSignal?: AbortSignal) {\n abortSignal?.throwIfAborted()\n const cause = error instanceof Error ? error : new Error(String(error))\n console.warn('[github-tools]', githubToolsErrors.EVALUATION_FAILED({\n model: typeof model === 'string' ? model : model.modelId,\n fallback,\n detail: cause.message,\n cause,\n }))\n}\n\n/** Whether a person should approve a GitHub write, and why, as a short sentence for the approval request. */\nexport type AutoApprovalDecision = { ask: boolean, reason: string }\n\nconst RISK_LABELS = RISK_QUESTION.criteria.map(criterion => criterion.slice(0, criterion.indexOf(':')))\n\n/**\n * Asks the decision model how risky a GitHub write is and whether the user asked for it, and\n * explains the outcome: `ask` is true when a person should approve the call. A failed or refused\n * decision asks, since it gives no evidence that the call is safe.\n */\nexport async function autoApprovalDecision(\n toolName: GithubWriteToolName,\n input: unknown,\n messages: readonly ModelMessage[],\n { model = DEFAULT_EVALUATION_MODEL, maxRisk = 1, minIntent = 0.6, providerOptions }: GithubEvaluationOptions = {},\n abortSignal?: AbortSignal,\n): Promise<AutoApprovalDecision> {\n const decide = loadDecide()\n let refused = false\n const result = await decide({\n model,\n providerOptions,\n state: {\n ...conversationState(messages, messageText),\n toolCall: {\n tool: toolName,\n description: GITHUB_TOOL_CATALOG[toolName].description,\n input: input as JSONValue,\n },\n },\n questions: {\n risk: { type: 'score', ...RISK_QUESTION },\n intent: { type: 'boolean', ...INTENT_QUESTION },\n },\n abortSignal,\n }).catch((error: unknown) => {\n // A refusal is an answer, not an outage: it gives no evidence the call is safe, so a person decides.\n refused = Boolean(refusedQuestions(error))\n if (!refused) warnEvaluationFailed(model, `asking approval for ${toolName}`, error, abortSignal)\n return undefined\n })\n if (!result) return { ask: true, reason: refused ? 'The decision model declined to rate this call.' : 'The decision model was unavailable.' }\n const risk = result.answers.risk.score\n const intent = result.answers.intent.probability\n // Jev scores risk on a continuous 0–2 scale, so the label is the nearest rubric level.\n const verdict = `${RISK_LABELS[Math.round(risk)]} (risk ${Number(risk.toFixed(1))} of 2), ${Math.round(intent * 100)}% likely you asked for it`\n return requiresApproval(risk, intent, { maxRisk, minIntent })\n ? { ask: true, reason: `${verdict}.` }\n : { ask: false, reason: `Approved automatically: ${verdict.charAt(0).toLowerCase()}${verdict.slice(1)}.` }\n}\n\n/** Whether a GitHub write needs a person's approval; see {@link autoApprovalDecision}. */\nexport async function needsAutoApproval(\n toolName: GithubWriteToolName,\n input: unknown,\n messages: readonly ModelMessage[],\n options: GithubEvaluationOptions = {},\n abortSignal?: AbortSignal,\n): Promise<boolean> {\n return (await autoApprovalDecision(toolName, input, messages, options, abortSignal)).ask\n}\n\n/**\n * Presets the latest user message needs, from one evaluation call with an independent\n * yes/no question per preset. Returns up to `maxPresets` presets at or above\n * `minPresetProbability`, most likely first, and read-only `repo-explorer` when none qualifies.\n * `repo-explorer` is only combined with no other preset. Rejects when the evaluation call fails;\n * {@link selectPresets} falls back instead. Never returns `maintainer`, so the full catalog is never exposed.\n */\nexport async function evaluatePresets(\n messages: readonly ModelMessage[],\n options: GithubEvaluationOptions = {},\n abortSignal?: AbortSignal,\n): Promise<RoutablePreset[]> {\n const { minPresetProbability = 0.7, maxPresets = 2 } = options\n const presets = Object.keys(PRESET_PURPOSES) as RoutablePreset[]\n const probabilities = await decideEach(messages, presets, preset => ({\n instructions: 'Does handling this GitHub request need the tools of this preset?',\n criteria: { true: { purpose: PRESET_PURPOSES[preset], tools: [...PRESET_TOOLS[preset]] } },\n }), options, abortSignal)\n return rankPresets(probabilities, { minPresetProbability, maxPresets })\n}\n\n/**\n * Tools the latest user message needs, from one decision call with a yes/no question per tool:\n * the core read tools, plus up to `maxTools` others at or above `minToolProbability`, most likely\n * first. Rejects when the decision call fails; {@link selectTools} falls back instead.\n */\nexport async function evaluateTools(\n messages: readonly ModelMessage[],\n options: GithubEvaluationOptions = {},\n abortSignal?: AbortSignal,\n): Promise<GithubToolName[]> {\n const { minToolProbability = 0.5, maxTools = 8 } = options\n const core: readonly GithubToolName[] = CORE_READ_TOOLS\n const candidates = ALL_GITHUB_TOOL_NAMES.filter(name => !core.includes(name))\n const probabilities = await decideEach(messages, candidates, name => ({\n instructions: 'Does handling this GitHub request need this tool?',\n criteria: { true: { tool: name, description: GITHUB_TOOL_CATALOG[name].description } },\n }), options, abortSignal)\n const likely = candidates\n .filter(name => probabilities[name] >= minToolProbability)\n .toSorted((a, b) => probabilities[b] - probabilities[a])\n .slice(0, maxTools)\n return [...core, ...likely]\n}\n\ntype BooleanQuestion = { instructions: string, criteria: { true: Record<string, JSONValue> } }\n\n// One boolean question per key against the conversation. A refused question counts as a no:\n// ask once more without it instead of losing every answer.\nasync function decideEach<K extends string>(\n messages: readonly ModelMessage[],\n keys: readonly K[],\n question: (key: K) => BooleanQuestion,\n { model = DEFAULT_EVALUATION_MODEL, providerOptions }: GithubEvaluationOptions,\n abortSignal?: AbortSignal,\n): Promise<Record<K, number>> {\n const decide = loadDecide()\n const state = conversationState(messages, messageText)\n const ask = (asked: readonly K[]) => decide({\n model,\n providerOptions,\n state,\n questions: Object.fromEntries(asked.map(key => [key, { type: 'boolean' as const, ...question(key) }])),\n abortSignal,\n })\n const probabilities = Object.fromEntries(keys.map(key => [key, 0])) as Record<K, number>\n const { answers } = await ask(keys).catch((error: unknown) => {\n const refused = refusedQuestions(error)\n const remaining = keys.filter(key => !refused?.includes(key))\n if (!refused || remaining.length === 0) throw error\n return ask(remaining)\n })\n for (const [key, answer] of Object.entries(answers)) probabilities[key as K] = answer.probability\n return probabilities\n}\n\n/**\n * Logs `EVALUATION_FAILED` for a failed {@link evaluatePresets} call and returns the read-only\n * `repo-explorer` fallback. Rethrows when `abortSignal` is aborted.\n */\nexport function fallbackPresets(error: unknown, { model = DEFAULT_EVALUATION_MODEL }: GithubEvaluationOptions = {}, abortSignal?: AbortSignal): RoutablePreset[] {\n warnEvaluationFailed(model, 'using the repo-explorer preset', error, abortSignal)\n return ['repo-explorer']\n}\n\n/**\n * Logs `EVALUATION_FAILED` for a failed {@link evaluateTools} call and returns the read-only\n * `repo-explorer` tools. Rethrows when `abortSignal` is aborted.\n */\nexport function fallbackTools(error: unknown, { model = DEFAULT_EVALUATION_MODEL }: GithubEvaluationOptions = {}, abortSignal?: AbortSignal): GithubToolName[] {\n warnEvaluationFailed(model, 'using the repo-explorer tools', error, abortSignal)\n return [...PRESET_TOOLS['repo-explorer']]\n}\n\n/**\n * {@link evaluateTools}, falling back to the read-only `repo-explorer` tools (and logging\n * `EVALUATION_FAILED`) when the decision call fails.\n */\nexport async function selectTools(\n messages: readonly ModelMessage[],\n options: GithubEvaluationOptions = {},\n abortSignal?: AbortSignal,\n): Promise<GithubToolName[]> {\n return evaluateTools(messages, options, abortSignal).catch(error => fallbackTools(error, options, abortSignal))\n}\n\n/**\n * {@link evaluatePresets}, falling back to read-only `repo-explorer` (and logging\n * `EVALUATION_FAILED`) when the evaluation call fails.\n */\nexport async function selectPresets(\n messages: readonly ModelMessage[],\n options: GithubEvaluationOptions = {},\n abortSignal?: AbortSignal,\n): Promise<RoutablePreset[]> {\n return evaluatePresets(messages, options, abortSignal).catch(error => fallbackPresets(error, options, abortSignal))\n}\n\nexport function latestUserText(messages: readonly ModelMessage[]): string {\n return conversationState(messages, messageText).request\n}\n\n/** The `request` and `repliedTo` the evaluation model sees for these messages. */\nexport function evaluationRequest(messages: readonly ModelMessage[]) {\n return conversationState(messages, messageText)\n}\n\nfunction messageText(message: ModelMessage): string {\n if (typeof message.content === 'string') return message.content\n return message.content.flatMap(part => part.type === 'text' ? [part.text] : []).join('\\n')\n}\n"],"mappings":";;;AAAA,MAAM,mBAAmB;AACzB,MAAM,qBAAqB;AAC3B,MAAM,yBAAyB;AAC/B,MAAM,uBAAuB;AAE7B,SAAS,aAAa,MAAc,WAA2B;CAC7D,IAAI,KAAK,UAAU,WAAW,OAAO;CACrC,OAAO,GAAG,KAAK,MAAM,GAAG,SAAS,EAAE,kBAAkB,KAAK,SAAS,UAAU;AAC/E;AAEA,SAAS,oBAAkD,OAAiB;CAC1E,OAAO,MAAM,KAAI,UAAS;EACxB,GAAG;EACH,OAAO,KAAK,QAAQ,aAAa,KAAK,OAAO,gBAAgB,IAAI,KAAK;CACxE,EAAE;AACJ;AAEA,SAAS,aAA2C,OAAwB;CAC1E,IAAI,CAAC,OAAO,OAAO;EAAE;EAAO,cAAc;CAAE;CAC5C,MAAM,YAAY,oBAAoB,KAAK;CAC3C,IAAI,UAAU,UAAU,sBAAsB,OAAO;EAAE,OAAO;EAAW,cAAc;CAAE;CACzF,OAAO;EACL,OAAO,UAAU,MAAM,GAAG,oBAAoB;EAC9C,cAAc,UAAU,SAAS;CACnC;AACF;AAyDA,SAAgB,kCAAkC,EAAE,UAAgC;CAClF,MAAM,SAAS;CACf,OAAO;EACL,MAAM;EACN,OAAO;GACL,GAAG;GACH,OAAO,oBAAoB,OAAO,KAAK;EACzC;CACF;AACF;AAEA,SAAgB,uBAAuB,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,gBAAgB,OAAgB,EAAE,QAAQ,6BAAsD,CAAC,GAAG,aAA6C;CAC/J,qBAAqB,OAAO,kCAAkC,OAAO,WAAW;CAChF,OAAO,CAAC,eAAe;AACzB;;;;;AAMA,SAAgB,cAAc,OAAgB,EAAE,QAAQ,6BAAsD,CAAC,GAAG,aAA6C;CAC7J,qBAAqB,OAAO,iCAAiC,OAAO,WAAW;CAC/E,OAAO,CAAC,GAAG,aAAa,gBAAgB;AAC1C;;;;;AAMA,eAAsB,YACpB,UACA,UAAmC,CAAC,GACpC,aAC2B;CAC3B,OAAO,cAAc,UAAU,SAAS,WAAW,CAAC,CAAC,OAAM,UAAS,cAAc,OAAO,SAAS,WAAW,CAAC;AAChH;;;;;AAMA,eAAsB,cACpB,UACA,UAAmC,CAAC,GACpC,aAC2B;CAC3B,OAAO,gBAAgB,UAAU,SAAS,WAAW,CAAC,CAAC,OAAM,UAAS,gBAAgB,OAAO,SAAS,WAAW,CAAC;AACpH;AAEA,SAAgB,eAAe,UAA2C;CACxE,OAAO,kBAAkB,UAAU,WAAW,CAAC,CAAC;AAClD;;AAGA,SAAgB,kBAAkB,UAAmC;CACnE,OAAO,kBAAkB,UAAU,WAAW;AAChD;AAEA,SAAS,YAAY,SAA+B;CAClD,IAAI,OAAO,QAAQ,YAAY,UAAU,OAAO,QAAQ;CACxD,OAAO,QAAQ,QAAQ,SAAQ,SAAQ,KAAK,SAAS,SAAS,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI;AAC3F"}
|
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as EveToolFactoryOptions, n as EveApprovalValue, r as EveGithubToolsOptions, t as EveApprovalConfig } from "./types-
|
|
3
|
-
import "./index-
|
|
1
|
+
import { G as GithubWriteToolName, I as GithubGuardrails, N as GithubTokenInput, R as CombinedPresetToolNames, V as PresetToolName, W as GithubToolName, c as CommitIdentity, s as GithubToolsContext, t as GithubDryRunApproval, z as GithubToolPreset } from "./dry-run-DXckOam2.mjs";
|
|
2
|
+
import { i as EveToolFactoryOptions, n as EveApprovalValue, r as EveGithubToolsOptions, t as EveApprovalConfig } from "./types-C7O2lwwz.mjs";
|
|
3
|
+
import "./index-CzzrtCVj.mjs";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { ToolDefinition, ToolModelOutput } from "eve/tools";
|
|
6
6
|
import { Approval, ApprovalPolicy } from "eve/tools/approval";
|
|
7
7
|
//#region src/eve/registry.d.ts
|
|
8
|
+
type ToolBuildContext = {
|
|
9
|
+
token: GithubTokenInput;
|
|
10
|
+
context?: GithubToolsContext;
|
|
11
|
+
author?: CommitIdentity;
|
|
12
|
+
committer?: CommitIdentity;
|
|
13
|
+
coAuthors?: CommitIdentity[];
|
|
14
|
+
guardrails?: GithubGuardrails;
|
|
15
|
+
dryRun?: boolean;
|
|
16
|
+
dryRunApproval?: GithubDryRunApproval;
|
|
17
|
+
};
|
|
8
18
|
/** Whether a GitHub tool has a built-in eve `toModelOutput` projection. */
|
|
9
19
|
declare function hasGithubEveToolModelOutput(name: GithubToolName): boolean;
|
|
10
20
|
/**
|
|
@@ -44,7 +54,7 @@ declare function listResolvedEveToolNames(options: Pick<EveGithubToolsOptions, '
|
|
|
44
54
|
* Prefer this when registering tools outside the SDK package so durable transforms can hoist inline execute.
|
|
45
55
|
*/
|
|
46
56
|
declare function listEveToolDescriptors(options?: EveGithubToolsOptions): {
|
|
47
|
-
name: "getRepository" | "listBranches" | "getFileContent" | "getRepositoryTree" | "createBranch" | "deleteBranch" | "forkRepository" | "createRepository" | "createOrUpdateFile" | "getBranchRules" | "editFiles" | "listPullRequests" | "getPullRequest" | "createPullRequest" | "mergePullRequest" | "enablePullRequestAutoMerge" | "disablePullRequestAutoMerge" | "updatePullRequest" | "addPullRequestComment" | "updatePullRequestComment" | "deletePullRequestComment" | "listPullRequestFiles" | "listPullRequestReviews" | "createPullRequestReview" | "listPullRequestReviewThreads" | "replyToReviewComment" | "resolveReviewThread" | "requestReviewers" | "getPullRequestContext" | "getIssueContext" | "listIssues" | "getIssue" | "listIssueComments" | "createIssue" | "addIssueComment" | "updateIssueComment" | "deleteIssueComment" | "closeIssue" | "updateIssue" | "listLabels" | "addLabels" | "removeLabel" | "createLabel" | "updateLabel" | "deleteLabel" | "addAssignees" | "removeAssignees" | "listIssueReactions" | "addIssueReaction" | "listCommentReactions" | "addCommentReaction" | "listDiscussions" | "getDiscussion" | "addDiscussionComment" | "listNotifications" | "markNotificationRead" | "searchCode" | "searchRepositories" | "searchIssues" | "listCommits" | "getCommit" | "getBlame" | "compareCommits" | "listGists" | "getGist" | "listGistComments" | "createGist" | "updateGist" | "deleteGist" | "createGistComment" | "listWorkflows" | "listWorkflowRuns" | "getWorkflowRun" | "listWorkflowJobs" | "getWorkflowJobLogs" | "triggerWorkflow" | "cancelWorkflowRun" | "rerunWorkflowRun" | "listCheckRuns" | "getCombinedStatus" | "getCiFailureContext" | "listReleases" | "getLatestRelease" | "getRelease" | "getReleaseContext" | "createRelease" | "updateRelease" | "deleteRelease" | "listCodeScanningAlerts" | "listDependabotAlerts" | "listSecretScanningAlerts";
|
|
57
|
+
name: "getRepository" | "listBranches" | "getFileContent" | "getRepositoryTree" | "createBranch" | "deleteBranch" | "forkRepository" | "createRepository" | "createOrUpdateFile" | "getBranchRules" | "getCollaboratorPermission" | "editFiles" | "listPullRequests" | "getPullRequest" | "createPullRequest" | "mergePullRequest" | "enablePullRequestAutoMerge" | "disablePullRequestAutoMerge" | "updatePullRequest" | "updatePullRequestBranch" | "addPullRequestComment" | "updatePullRequestComment" | "deletePullRequestComment" | "listPullRequestFiles" | "listPullRequestReviews" | "createPullRequestReview" | "listPullRequestReviewThreads" | "replyToReviewComment" | "resolveReviewThread" | "requestReviewers" | "getPullRequestContext" | "getIssueContext" | "listIssues" | "getIssue" | "listIssueComments" | "createIssue" | "addIssueComment" | "updateIssueComment" | "deleteIssueComment" | "closeIssue" | "updateIssue" | "listLabels" | "addLabels" | "removeLabel" | "createLabel" | "updateLabel" | "deleteLabel" | "addAssignees" | "removeAssignees" | "listMilestones" | "listSubIssues" | "addSubIssue" | "listIssueReactions" | "addIssueReaction" | "listCommentReactions" | "addCommentReaction" | "listDiscussions" | "getDiscussion" | "addDiscussionComment" | "listNotifications" | "markNotificationRead" | "searchCode" | "searchRepositories" | "searchIssues" | "listCommits" | "getCommit" | "getBlame" | "compareCommits" | "listGists" | "getGist" | "listGistComments" | "createGist" | "updateGist" | "deleteGist" | "createGistComment" | "listWorkflows" | "listWorkflowRuns" | "getWorkflowRun" | "listWorkflowJobs" | "getWorkflowJobLogs" | "triggerWorkflow" | "cancelWorkflowRun" | "rerunWorkflowRun" | "listCheckRuns" | "getCombinedStatus" | "createCommitStatus" | "getCiFailureContext" | "listReleases" | "getLatestRelease" | "getRelease" | "getReleaseContext" | "createRelease" | "updateRelease" | "deleteRelease" | "listCodeScanningAlerts" | "listDependabotAlerts" | "listSecretScanningAlerts";
|
|
48
58
|
description: string;
|
|
49
59
|
inputSchema: import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
|
|
50
60
|
writeTool: GithubWriteToolName | undefined;
|
|
@@ -72,6 +82,10 @@ declare function resolveEveApproval(toolName: GithubWriteToolName, config: EveAp
|
|
|
72
82
|
*/
|
|
73
83
|
declare function resolveEveToolApproval(toolName: GithubWriteToolName, config: EveApprovalConfig | undefined, override?: EveApprovalValue): Approval | undefined;
|
|
74
84
|
//#endregion
|
|
85
|
+
//#region src/eve/steps.d.ts
|
|
86
|
+
/** Why `guardrails` block a call once `context` defaults are applied, or `undefined` when they allow it. */
|
|
87
|
+
declare function githubGuardrailViolation(name: GithubToolName, input: Record<string, unknown>, { context, guardrails }: Pick<ToolBuildContext, 'context' | 'guardrails'>): string | undefined;
|
|
88
|
+
//#endregion
|
|
75
89
|
//#region src/eve/load-eve.d.ts
|
|
76
90
|
/**
|
|
77
91
|
* @deprecated Never thrown since eve moved to static ESM imports — a missing
|
|
@@ -81,5 +95,5 @@ declare function resolveEveToolApproval(toolName: GithubWriteToolName, config: E
|
|
|
81
95
|
*/
|
|
82
96
|
declare const MISSING_EVE_MESSAGE = "The \"eve\" package is required to use @github-tools/sdk/eve. Install it with: pnpm add eve";
|
|
83
97
|
//#endregion
|
|
84
|
-
export {
|
|
85
|
-
//# sourceMappingURL=eve-runtime-
|
|
98
|
+
export { resolveEveApproval as a, buildEveToolMap as c, listEveToolDescriptors as d, listResolvedEveToolNames as f, mapEveApprovalValue as i, createEveGithubToolsDynamic as l, hasGithubEveToolModelOutput as m, githubGuardrailViolation as n, resolveEveToolApproval as o, formatGithubEveToolOutput as p, isEveApprovalDisabled as r, buildEveToolDefinition as s, MISSING_EVE_MESSAGE as t, executeGithubEveTool as u };
|
|
99
|
+
//# sourceMappingURL=eve-runtime-B_CJE9JV.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eve-runtime-B_CJE9JV.d.mts","names":[],"sources":["../src/eve/registry.ts","../src/eve/build.ts","../src/eve/approval.ts","../src/eve/steps.ts","../src/eve/load-eve.ts"],"mappings":";;;;;;;KAuBY;EACV,OAAO;EACP,UAAU;EACV,SAAS;EACT,YAAY;EACZ,YAAY;EACZ,aAAa;EACb;EACA,iBAAiB;;;iBA6CH,4BAA4B,MAAM;;;;;;;iBAUlC,0BAA0B,MAAM,gBAAgB,kBAAkB;;;KC7E7E,eAAe,yBAAyB;EAA0B,SAAS;;KAC3E,aAAa,QAAQ,OAAO,gBAAgB;iBA8CjC,uBACd,MAAM,gBACN,UAAS,eACR;iBAmCa,gBAAgB,UAAS,wBAA6B;iBAsCtD,4BAA4B,UAAS,4CAA0B,oCAAA,uCAAA;iBAQ/D,yBAAyB;EAAY;EAAoB;EAAqB;IAAwB;iBACtG,yBAAyB,UAAU,kBAAkB;EAAW,QAAQ;EAAG;EAAqB;IAAwB,eAAe;iBACvI,yBAAyB,mBAAmB,oBAAoB;EAAW,QAAQ;EAAG;EAAqB;IAAwB,wBAAwB;iBAC3J,yBAAyB,SAAS,KAAK,2DAA2D;;;;;iBAUlG,uBAAuB,UAAS;;;;aAAA;;;;;;;iBA6B1B,qBACpB,MAAM,gBACN,OAAO,yBACP,UAAS,wBAA0B;;;;;;;;iBC/KrB,sBAAsB,OAAO;iBAI7B,oBAAoB,OAAO,mBAAmB;iBAY9C,mBACd,UAAU,qBACV,QAAQ,gCACP;;;;;;iBAgBa,uBACd,UAAU,qBACV,QAAQ,+BACR,WAAW,mBACV;;;;iBC3Ba,yBACd,MAAM,gBACN,OAAO,2BACL,SAAS,cAAc,KAAK;;;;;;;;;cCRnB"}
|