@github-tools/sdk 1.20.0 → 1.22.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.
Files changed (66) hide show
  1. package/README.md +50 -17
  2. package/dist/{approval-policy--kByBqhT.mjs → approval-policy-C2rcAY77.mjs} +3 -4
  3. package/dist/{approval-policy--kByBqhT.mjs.map → approval-policy-C2rcAY77.mjs.map} +1 -1
  4. package/dist/connect/eve.d.mts +2 -4
  5. package/dist/connect/eve.d.mts.map +1 -1
  6. package/dist/connect/eve.mjs +3 -4
  7. package/dist/connect/eve.mjs.map +1 -1
  8. package/dist/connect.d.mts +5 -11
  9. package/dist/connect.d.mts.map +1 -1
  10. package/dist/connect.mjs +3 -4
  11. package/dist/{cores-FLzAv2tu.mjs → cores-CMUr_SEv.mjs} +21 -4
  12. package/dist/cores-CMUr_SEv.mjs.map +1 -0
  13. package/dist/{tool-types-OFyE3z0C.d.mts → dry-run-BAbes7Mv.d.mts} +168 -40
  14. package/dist/dry-run-BAbes7Mv.d.mts.map +1 -0
  15. package/dist/{evaluation-BtoHbxuQ.mjs → evaluation-DskA4Lzk.mjs} +4 -6
  16. package/dist/{evaluation-BtoHbxuQ.mjs.map → evaluation-DskA4Lzk.mjs.map} +1 -1
  17. package/dist/eve-runtime-Bmdw1C-K.d.mts +127 -0
  18. package/dist/eve-runtime-Bmdw1C-K.d.mts.map +1 -0
  19. package/dist/{eve-runtime-C-0doyHq.mjs → eve-runtime-DM9yjOsG.mjs} +193 -22
  20. package/dist/eve-runtime-DM9yjOsG.mjs.map +1 -0
  21. package/dist/eve-runtime.d.mts +5 -5
  22. package/dist/eve-runtime.mjs +4 -4
  23. package/dist/eve.d.mts +103 -63
  24. package/dist/eve.d.mts.map +1 -1
  25. package/dist/eve.mjs +104 -63
  26. package/dist/eve.mjs.map +1 -1
  27. package/dist/{index-C3wlz660.d.mts → index-DgCZi9Ns.d.mts} +52 -56
  28. package/dist/index-DgCZi9Ns.d.mts.map +1 -0
  29. package/dist/index.d.mts +3 -3
  30. package/dist/index.mjs +4 -4
  31. package/dist/{interrupts-BSDPwdJ2.d.mts → interrupts-MwQ_v_PF.d.mts} +1 -3
  32. package/dist/interrupts-MwQ_v_PF.d.mts.map +1 -0
  33. package/dist/rolldown-runtime-D8jQpDG7.mjs +12 -0
  34. package/dist/{src-DyiAVHKl.mjs → src-Djn_FFj1.mjs} +183 -55
  35. package/dist/src-Djn_FFj1.mjs.map +1 -0
  36. package/dist/tanstack/interrupts.d.mts +1 -1
  37. package/dist/tanstack/interrupts.mjs +1 -2
  38. package/dist/tanstack.d.mts +534 -208
  39. package/dist/tanstack.d.mts.map +1 -1
  40. package/dist/tanstack.mjs +37 -21
  41. package/dist/tanstack.mjs.map +1 -1
  42. package/dist/{token-DIwB-wtp.mjs → token-HpJhSRkl.mjs} +7 -10
  43. package/dist/token-HpJhSRkl.mjs.map +1 -0
  44. package/dist/{types-CJqhvQwi.d.mts → types-8KtcPTao.d.mts} +3 -7
  45. package/dist/types-8KtcPTao.d.mts.map +1 -0
  46. package/dist/{types-ITYfXMtY.d.mts → types-C-BIKmas.d.mts} +14 -4
  47. package/dist/types-C-BIKmas.d.mts.map +1 -0
  48. package/dist/workflow.d.mts +9 -4
  49. package/dist/workflow.d.mts.map +1 -1
  50. package/dist/workflow.mjs +7 -6
  51. package/dist/workflow.mjs.map +1 -1
  52. package/dist/{write-tools-DnGZw-RD.mjs → write-tools-BR29EOoM.mjs} +483 -113
  53. package/dist/write-tools-BR29EOoM.mjs.map +1 -0
  54. package/package.json +1 -1
  55. package/dist/cores-FLzAv2tu.mjs.map +0 -1
  56. package/dist/eve-runtime-C-0doyHq.mjs.map +0 -1
  57. package/dist/eve-runtime-CflZNuXD.d.mts +0 -85
  58. package/dist/eve-runtime-CflZNuXD.d.mts.map +0 -1
  59. package/dist/index-C3wlz660.d.mts.map +0 -1
  60. package/dist/interrupts-BSDPwdJ2.d.mts.map +0 -1
  61. package/dist/src-DyiAVHKl.mjs.map +0 -1
  62. package/dist/token-DIwB-wtp.mjs.map +0 -1
  63. package/dist/tool-types-OFyE3z0C.d.mts.map +0 -1
  64. package/dist/types-CJqhvQwi.d.mts.map +0 -1
  65. package/dist/types-ITYfXMtY.d.mts.map +0 -1
  66. package/dist/write-tools-DnGZw-RD.mjs.map +0 -1
@@ -1,9 +1,9 @@
1
- import { $ as listIssueReactionsDescription, $i as createOrUpdateFileDescription, $n as enablePullRequestAutoMergeDescription, $r as deleteIssueCommentDescription, $t as getWorkflowJobLogsDescription, A as listDependabotAlertsInputSchema, Aa as githubToolsErrors, Ai as updateLabelInputSchema, An as getReleaseInputSchema, Ar as updatePullRequestCommentInputSchema, At as addDiscussionCommentInputSchema, B as searchRepositoriesCore, Bi as listCommitsCore, Bn as createPullRequestCore, Br as addLabelsCore, Bt as getIssueContextCore, C as GITHUB_TOOL_CATALOG, Ca as getRepositoryTreeDescription, Ci as updateIssueCommentDescription, Cn as deleteReleaseDescription, Cr as requestReviewersDescription, Ct as listGistsDescription, D as listCodeScanningAlertsInputSchema, Da as listBranchesInputSchema, Di as updateIssueInputSchema, Dn as getLatestReleaseInputSchema, Dr as resolveReviewThreadInputSchema, Dt as updateGistInputSchema, E as listCodeScanningAlertsDescription, Ea as listBranchesDescription, Ei as updateIssueDescription, En as getLatestReleaseDescription, Er as resolveReviewThreadDescription, Et as updateGistDescription, F as searchCodeDescription, Fi as getBlameDescription, Fn as updateReleaseDescription, Fr as addAssigneesDescription, Ft as listDiscussionsDescription, G as addCommentReactionInputSchema, Gi as getCombinedStatusInputSchema, Gn as createPullRequestReviewInputSchema, Gr as closeIssueInputSchema, Gt as getPullRequestContextInputSchema, H as searchRepositoriesInputSchema, Hi as listCommitsInputSchema, Hn as createPullRequestInputSchema, Hr as addLabelsInputSchema, Ht as getIssueContextInputSchema, I as searchCodeInputSchema, Ii as getBlameInputSchema, In as updateReleaseInputSchema, Ir as addAssigneesInputSchema, It as listDiscussionsInputSchema, J as addIssueReactionInputSchema, Ji as listCheckRunsInputSchema, Jn as deletePullRequestCommentInputSchema, Jr as createIssueInputSchema, Jt as getReleaseContextInputSchema, K as addIssueReactionCore, Ki as listCheckRunsCore, Kn as deletePullRequestCommentCore, Kr as createIssueCore, Kt as getReleaseContextCore, L as searchIssuesCore, Li as getCommitCore, Ln as addPullRequestCommentCore, Lr as addIssueCommentCore, Lt as getCiFailureContextCore, M as listSecretScanningAlertsDescription, Ma as stripRateLimit, Mi as compareCommitsDescription, Mn as listReleasesDescription, Mr as updatePullRequestDescription, Mt as getDiscussionDescription, N as listSecretScanningAlertsInputSchema, Ni as compareCommitsInputSchema, Nn as listReleasesInputSchema, Nr as updatePullRequestInputSchema, Nt as getDiscussionInputSchema, O as listDependabotAlertsCore, Oi as updateLabelCore, On as getReleaseCore, Or as updatePullRequestCommentCore, Ot as addDiscussionCommentCore, P as searchCodeCore, Pi as getBlameCore, Pn as updateReleaseCore, Pr as addAssigneesCore, Pt as listDiscussionsCore, Q as listIssueReactionsCore, Qi as createOrUpdateFileCore, Qn as enablePullRequestAutoMergeCore, Qr as deleteIssueCommentCore, Qt as getWorkflowJobLogsCore, R as searchIssuesDescription, Ri as getCommitDescription, Rn as addPullRequestCommentDescription, Rr as addIssueCommentDescription, Rt as getCiFailureContextDescription, S as ALL_GITHUB_TOOL_NAMES, Sa as getRepositoryTreeCore, Si as updateIssueCommentCore, Sn as deleteReleaseCore, Sr as requestReviewersCore, St as listGistsCore, T as listCodeScanningAlertsCore, Ta as listBranchesCore, Ti as updateIssueCore, Tn as getLatestReleaseCore, Tr as resolveReviewThreadCore, Tt as updateGistCore, U as addCommentReactionCore, Ui as getCombinedStatusCore, Un as createPullRequestReviewCore, Ur as closeIssueCore, Ut as getPullRequestContextCore, V as searchRepositoriesDescription, Vi as listCommitsDescription, Vn as createPullRequestDescription, Vr as addLabelsDescription, Vt as getIssueContextDescription, W as addCommentReactionDescription, Wi as getCombinedStatusDescription, Wn as createPullRequestReviewDescription, Wr as closeIssueDescription, Wt as getPullRequestContextDescription, X as listCommentReactionsDescription, Xi as createBranchDescription, Xn as disablePullRequestAutoMergeDescription, Xr as createLabelDescription, Xt as cancelWorkflowRunDescription, Y as listCommentReactionsCore, Yi as createBranchCore, Yn as disablePullRequestAutoMergeCore, Yr as createLabelCore, Yt as cancelWorkflowRunCore, Z as listCommentReactionsInputSchema, Zi as createBranchInputSchema, Zn as disablePullRequestAutoMergeInputSchema, Zr as createLabelInputSchema, Zt as cancelWorkflowRunInputSchema, _a as getFileContentDescription, _i as removeAssigneesDescription, _n as triggerWorkflowDescription, _r as mergePullRequestDescription, _t as getGistDescription, aa as deleteBranchDescription, ai as getIssueDescription, an as listWorkflowJobsDescription, ar as listPullRequestFilesDescription, at as markNotificationReadDescription, b as githubTokenCall, ba as getRepositoryDescription, bi as removeLabelDescription, bn as createReleaseDescription, br as replyToReviewCommentDescription, bt as listGistCommentsDescription, c as DEFAULT_EVALUATION_MODEL, ca as editFilesDescription, ci as listIssueCommentsDescription, cn as listWorkflowRunsDescription, cr as listPullRequestReviewThreadsDescription, ct as createGistCommentDescription, da as forkRepositoryDescription, di as listIssuesDescription, dn as listWorkflowsDescription, dr as listPullRequestReviewsDescription, dt as createGistDescription, ea as createOrUpdateFileInputSchema, ei as deleteIssueCommentInputSchema, en as getWorkflowJobLogsInputSchema, er as enablePullRequestAutoMergeInputSchema, et as listIssueReactionsInputSchema, fa as forkRepositoryInputSchema, fi as listIssuesInputSchema, fn as listWorkflowsInputSchema, fr as listPullRequestReviewsInputSchema, ft as createGistInputSchema, ga as getFileContentCore, gi as removeAssigneesCore, gn as triggerWorkflowCore, gr as mergePullRequestCore, gt as getGistCore, ha as getBranchRulesInputSchema, hi as listLabelsInputSchema, hn as rerunWorkflowRunInputSchema, hr as listPullRequestsInputSchema, ht as deleteGistInputSchema, i as bindToolsContext, ia as deleteBranchCore, ii as getIssueCore, in as listWorkflowJobsCore, ir as listPullRequestFilesCore, it as markNotificationReadCore, j as listSecretScanningAlertsCore, ji as compareCommitsCore, jn as listReleasesCore, jr as updatePullRequestCore, jt as getDiscussionCore, k as listDependabotAlertsDescription, ki as updateLabelDescription, kn as getReleaseDescription, kr as updatePullRequestCommentDescription, kt as addDiscussionCommentDescription, la as editFilesInputSchema, li as listIssueCommentsInputSchema, ln as listWorkflowRunsInputSchema, lr as listPullRequestReviewThreadsInputSchema, lt as createGistCommentInputSchema, ma as getBranchRulesDescription, mi as listLabelsDescription, mn as rerunWorkflowRunDescription, mr as listPullRequestsDescription, mt as deleteGistDescription, n as resolveInstructions, na as createRepositoryDescription, ni as deleteLabelDescription, nn as getWorkflowRunDescription, nr as getPullRequestDescription, nt as listNotificationsDescription, oa as deleteBranchInputSchema, oi as getIssueInputSchema, on as listWorkflowJobsInputSchema, or as listPullRequestFilesInputSchema, ot as markNotificationReadInputSchema, pa as getBranchRulesCore, pi as listLabelsCore, pn as rerunWorkflowRunCore, pr as listPullRequestsCore, pt as deleteGistCore, q as addIssueReactionDescription, qi as listCheckRunsDescription, qn as deletePullRequestCommentDescription, qr as createIssueDescription, qt as getReleaseContextDescription, ra as createRepositoryInputSchema, ri as deleteLabelInputSchema, rn as getWorkflowRunInputSchema, rr as getPullRequestInputSchema, rt as listNotificationsInputSchema, sa as editFilesCore, si as listIssueCommentsCore, sn as listWorkflowRunsCore, sr as listPullRequestReviewThreadsCore, st as createGistCommentCore, ta as createRepositoryCore, ti as deleteLabelCore, tn as getWorkflowRunCore, tr as getPullRequestCore, tt as listNotificationsCore, ua as forkRepositoryCore, ui as listIssuesCore, un as listWorkflowsCore, ur as listPullRequestReviewsCore, ut as createGistCore, v as resolvePresetTools, va as getFileContentInputSchema, vi as removeAssigneesInputSchema, vn as triggerWorkflowInputSchema, vr as mergePullRequestInputSchema, vt as getGistInputSchema, w as isGithubWriteToolName, wa as getRepositoryTreeInputSchema, wi as updateIssueCommentInputSchema, wn as deleteReleaseInputSchema, wr as requestReviewersInputSchema, wt as listGistsInputSchema, x as resolveGithubToken, xa as getRepositoryInputSchema, xi as removeLabelInputSchema, xn as createReleaseInputSchema, xr as replyToReviewCommentInputSchema, xt as listGistCommentsInputSchema, y as createGithubTokenResolver, ya as getRepositoryCore, yi as removeLabelCore, yn as createReleaseCore, yr as replyToReviewCommentCore, yt as listGistCommentsCore, z as searchIssuesInputSchema, zi as getCommitInputSchema, zn as addPullRequestCommentInputSchema, zr as addIssueCommentInputSchema, zt as getCiFailureContextInputSchema } from "./write-tools-DnGZw-RD.mjs";
2
- import { _ as listPullRequestFilesToModelOutput, a as evaluationRequest, f as compareCommitsToModelOutput, g as getRepositoryTreeToModelOutput, h as getPullRequestContextToModelOutput, i as evaluateTools, m as getFileContentToModelOutput, n as autoApprovalDecision, o as fallbackPresets, p as getCommitToModelOutput, r as evaluatePresets, s as fallbackTools, t as assertEvaluationAvailable } from "./evaluation-BtoHbxuQ.mjs";
3
- import { t as resolveApprovalMode } from "./approval-policy--kByBqhT.mjs";
1
+ import { $ as listCommentReactionsInputSchema, $a as stripRateLimit, $i as getCommitDescription, $n as disablePullRequestAutoMergeInputSchema, $r as closeIssueDescription, $t as cancelWorkflowRunInputSchema, A as listDependabotAlertsCore, Aa as forkRepositoryInputSchema, Ai as listSubIssuesInputSchema, An as getReleaseCore, Ar as updatePullRequestBranchCore, At as addDiscussionCommentCore, B as searchIssuesDescription, Ba as getRepositoryCore, Bi as updateIssueCore, Bn as addPullRequestCommentDescription, Br as addAssigneesCore, Bt as getCiFailureContextDescription, C as withGithubGuardrails, Ca as deleteBranchDescription, Ci as listLabelsDescription, Cn as createReleaseInputSchema, Cr as replyToReviewCommentInputSchema, Ct as listGistCommentsInputSchema, D as listCodeScanningAlertsCore, Da as editFilesInputSchema, Di as listMilestonesInputSchema, Dn as getLatestReleaseCore, Dr as resolveReviewThreadCore, Dt as updateGistCore, E as isGithubWriteToolName, Ea as editFilesDescription, Ei as listMilestonesDescription, En as deleteReleaseInputSchema, Er as requestReviewersInputSchema, Et as listGistsInputSchema, F as listSecretScanningAlertsInputSchema, Fa as getCollaboratorPermissionDescription, Fi as removeLabelDescription, Fn as listReleasesInputSchema, Fr as updatePullRequestCommentInputSchema, Ft as getDiscussionInputSchema, G as addCommentReactionCore, Ga as getRepositoryTreeInputSchema, Gi as updateLabelInputSchema, Gn as createPullRequestReviewCore, Gr as addIssueCommentInputSchema, Gt as getPullRequestContextCore, H as searchRepositoriesCore, Ha as getRepositoryInputSchema, Hi as updateIssueInputSchema, Hn as createPullRequestCore, Hr as addAssigneesInputSchema, Ht as getIssueContextCore, I as searchCodeCore, Ia as getCollaboratorPermissionInputSchema, Ii as removeLabelInputSchema, In as updateReleaseCore, Ir as updatePullRequestCore, It as listDiscussionsCore, J as addIssueReactionCore, Ja as listBranchesInputSchema, Ji as compareCommitsInputSchema, Jn as deletePullRequestCommentCore, Jr as addLabelsInputSchema, Jt as getReleaseContextCore, K as addCommentReactionDescription, Ka as listBranchesCore, Ki as compareCommitsCore, Kn as createPullRequestReviewDescription, Kr as addLabelsCore, Kt as getPullRequestContextDescription, L as searchCodeDescription, La as getFileContentCore, Li as updateIssueCommentCore, Ln as updateReleaseDescription, Lr as updatePullRequestDescription, Lt as listDiscussionsDescription, M as listDependabotAlertsInputSchema, Ma as getBranchRulesDescription, Mi as removeAssigneesDescription, Mn as getReleaseInputSchema, Mr as updatePullRequestBranchInputSchema, Mt as addDiscussionCommentInputSchema, N as listSecretScanningAlertsCore, Na as getBranchRulesInputSchema, Ni as removeAssigneesInputSchema, Nn as listReleasesCore, Nr as updatePullRequestCommentCore, Nt as getDiscussionCore, O as listCodeScanningAlertsDescription, Oa as forkRepositoryCore, Oi as listSubIssuesCore, On as getLatestReleaseDescription, Or as resolveReviewThreadDescription, Ot as updateGistDescription, P as listSecretScanningAlertsDescription, Pa as getCollaboratorPermissionCore, Pi as removeLabelCore, Pn as listReleasesDescription, Pr as updatePullRequestCommentDescription, Pt as getDiscussionDescription, Q as listCommentReactionsDescription, Qi as getCommitCore, Qn as disablePullRequestAutoMergeDescription, Qr as closeIssueCore, Qt as cancelWorkflowRunDescription, R as searchCodeInputSchema, Ra as getFileContentDescription, Ri as updateIssueCommentDescription, Rn as updateReleaseInputSchema, Rr as updatePullRequestInputSchema, Rt as listDiscussionsInputSchema, S as resolveGithubToken, Sa as deleteBranchCore, Si as listLabelsCore, Sn as createReleaseDescription, Sr as replyToReviewCommentDescription, St as listGistCommentsDescription, T as GITHUB_TOOL_CATALOG, Ta as editFilesCore, Ti as listMilestonesCore, Tn as deleteReleaseDescription, Tr as requestReviewersDescription, Tt as listGistsDescription, U as searchRepositoriesDescription, Ua as getRepositoryTreeCore, Ui as updateLabelCore, Un as createPullRequestDescription, Ur as addIssueCommentCore, Ut as getIssueContextDescription, V as searchIssuesInputSchema, Va as getRepositoryDescription, Vi as updateIssueDescription, Vn as addPullRequestCommentInputSchema, Vr as addAssigneesDescription, Vt as getCiFailureContextInputSchema, W as searchRepositoriesInputSchema, Wa as getRepositoryTreeDescription, Wi as updateLabelDescription, Wn as createPullRequestInputSchema, Wr as addIssueCommentDescription, Wt as getIssueContextInputSchema, X as addIssueReactionInputSchema, Xi as getBlameDescription, Xn as deletePullRequestCommentInputSchema, Xr as addSubIssueDescription, Xt as getReleaseContextInputSchema, Y as addIssueReactionDescription, Yi as getBlameCore, Yn as deletePullRequestCommentDescription, Yr as addSubIssueCore, Yt as getReleaseContextDescription, Z as listCommentReactionsCore, Za as githubToolsErrors, Zi as getBlameInputSchema, Zn as disablePullRequestAutoMergeCore, Zr as addSubIssueInputSchema, Zt as cancelWorkflowRunCore, _a as createOrUpdateFileDescription, _i as listIssueCommentsDescription, _n as rerunWorkflowRunInputSchema, _r as listPullRequestsInputSchema, _t as deleteGistInputSchema, a as bindToolsContext, aa as createCommitStatusDescription, ai as createLabelDescription, an as getWorkflowRunInputSchema, ar as getPullRequestInputSchema, at as listNotificationsInputSchema, ba as createRepositoryDescription, bi as listIssuesDescription, bn as triggerWorkflowInputSchema, br as mergePullRequestInputSchema, bt as getGistInputSchema, ca as getCombinedStatusDescription, ci as deleteIssueCommentDescription, cn as listWorkflowJobsInputSchema, cr as listPullRequestFilesInputSchema, ct as markNotificationReadInputSchema, da as listCheckRunsDescription, di as deleteLabelDescription, dn as listWorkflowRunsInputSchema, dr as listPullRequestReviewThreadsInputSchema, dt as createGistCommentInputSchema, ea as getCommitInputSchema, ei as closeIssueInputSchema, en as getWorkflowJobLogsCore, er as enablePullRequestAutoMergeCore, et as listIssueReactionsCore, fa as listCheckRunsInputSchema, fi as deleteLabelInputSchema, fn as listWorkflowsCore, fr as listPullRequestReviewsCore, ft as createGistCore, ga as createOrUpdateFileCore, gi as listIssueCommentsCore, gn as rerunWorkflowRunDescription, gr as listPullRequestsDescription, gt as deleteGistDescription, ha as createBranchInputSchema, hi as getIssueInputSchema, hn as rerunWorkflowRunCore, hr as listPullRequestsCore, ht as deleteGistCore, i as dryRunWrite, ia as createCommitStatusCore, ii as createLabelCore, in as getWorkflowRunDescription, ir as getPullRequestDescription, it as listNotificationsDescription, j as listDependabotAlertsDescription, ja as getBranchRulesCore, ji as removeAssigneesCore, jn as getReleaseDescription, jr as updatePullRequestBranchDescription, jt as addDiscussionCommentDescription, k as listCodeScanningAlertsInputSchema, ka as forkRepositoryDescription, ki as listSubIssuesDescription, kn as getLatestReleaseInputSchema, kr as resolveReviewThreadInputSchema, kt as updateGistInputSchema, l as DEFAULT_EVALUATION_MODEL, la as getCombinedStatusInputSchema, li as deleteIssueCommentInputSchema, ln as listWorkflowRunsCore, lr as listPullRequestReviewThreadsCore, lt as createGistCommentCore, ma as createBranchDescription, mi as getIssueDescription, mn as listWorkflowsInputSchema, mr as listPullRequestReviewsInputSchema, mt as createGistInputSchema, n as resolveInstructions, na as listCommitsDescription, ni as createIssueDescription, nn as getWorkflowJobLogsInputSchema, nr as enablePullRequestAutoMergeInputSchema, nt as listIssueReactionsInputSchema, oa as createCommitStatusInputSchema, oi as createLabelInputSchema, on as listWorkflowJobsCore, or as listPullRequestFilesCore, ot as markNotificationReadCore, pa as createBranchCore, pi as getIssueCore, pn as listWorkflowsDescription, pr as listPullRequestReviewsDescription, pt as createGistDescription, q as addCommentReactionInputSchema, qa as listBranchesDescription, qi as compareCommitsDescription, qn as createPullRequestReviewInputSchema, qr as addLabelsDescription, qt as getPullRequestContextInputSchema, ra as listCommitsInputSchema, ri as createIssueInputSchema, rn as getWorkflowRunCore, rr as getPullRequestCore, rt as listNotificationsCore, sa as getCombinedStatusCore, si as deleteIssueCommentCore, sn as listWorkflowJobsDescription, sr as listPullRequestFilesDescription, st as markNotificationReadDescription, ta as listCommitsCore, ti as createIssueCore, tn as getWorkflowJobLogsDescription, tr as enablePullRequestAutoMergeDescription, tt as listIssueReactionsDescription, ua as listCheckRunsCore, ui as deleteLabelCore, un as listWorkflowRunsDescription, ur as listPullRequestReviewThreadsDescription, ut as createGistCommentDescription, va as createOrUpdateFileInputSchema, vi as listIssueCommentsInputSchema, vn as triggerWorkflowCore, vr as mergePullRequestCore, vt as getGistCore, w as ALL_GITHUB_TOOL_NAMES, wa as deleteBranchInputSchema, wi as listLabelsInputSchema, wn as deleteReleaseCore, wr as requestReviewersCore, wt as listGistsCore, x as githubTokenCall, xa as createRepositoryInputSchema, xi as listIssuesInputSchema, xn as createReleaseCore, xr as replyToReviewCommentCore, xt as listGistCommentsCore, y as resolvePresetTools, ya as createRepositoryCore, yi as listIssuesCore, yn as triggerWorkflowDescription, yr as mergePullRequestDescription, yt as getGistDescription, z as searchIssuesCore, za as getFileContentInputSchema, zi as updateIssueCommentInputSchema, zn as addPullRequestCommentCore, zr as guardrailViolation, zt as getCiFailureContextCore } from "./write-tools-BR29EOoM.mjs";
2
+ import { _ as listPullRequestFilesToModelOutput, a as evaluationRequest, f as compareCommitsToModelOutput, g as getRepositoryTreeToModelOutput, h as getPullRequestContextToModelOutput, i as evaluateTools, m as getFileContentToModelOutput, n as autoApprovalDecision, o as fallbackPresets, p as getCommitToModelOutput, r as evaluatePresets, s as fallbackTools, t as assertEvaluationAvailable } from "./evaluation-DskA4Lzk.mjs";
3
+ import { t as resolveApprovalMode } from "./approval-policy-C2rcAY77.mjs";
4
4
  import { ToolLoopAgent, asSchema, tool } from "ai";
5
5
  import { z } from "zod";
6
- //#region src/tools/repository.ts
6
+ // src/tools/repository.ts
7
7
  async function getRepositoryStep(args) {
8
8
  "use step";
9
9
  return getRepositoryCore(args);
@@ -161,8 +161,20 @@ const getBranchRules = (token) => tool({
161
161
  ...args
162
162
  })
163
163
  });
164
- //#endregion
165
- //#region src/tools/pull-requests.ts
164
+ async function getCollaboratorPermissionStep(args) {
165
+ "use step";
166
+ return getCollaboratorPermissionCore(args);
167
+ }
168
+ /** Get a user's permission and role on a repository. */
169
+ const getCollaboratorPermission = (token) => tool({
170
+ description: getCollaboratorPermissionDescription,
171
+ inputSchema: getCollaboratorPermissionInputSchema,
172
+ execute: async (args) => getCollaboratorPermissionStep({
173
+ token: await resolveGithubToken(token, githubTokenCall("getCollaboratorPermission", args)),
174
+ ...args
175
+ })
176
+ });
177
+ // src/tools/pull-requests.ts
166
178
  async function listPullRequestsStep(args) {
167
179
  "use step";
168
180
  return listPullRequestsCore(args);
@@ -208,14 +220,15 @@ async function mergePullRequestStep(args) {
208
220
  return mergePullRequestCore(args);
209
221
  }
210
222
  /** Merge a pull request. Requires approval by default. */
211
- const mergePullRequest = (token, { needsApproval = true, coAuthors } = {}) => tool({
223
+ const mergePullRequest = (token, { needsApproval = true, coAuthors, branches } = {}) => tool({
212
224
  description: mergePullRequestDescription,
213
225
  needsApproval,
214
226
  inputSchema: mergePullRequestInputSchema,
215
227
  execute: async (args) => mergePullRequestStep({
216
228
  token: await resolveGithubToken(token, githubTokenCall("mergePullRequest", args)),
217
229
  coAuthors,
218
- ...args
230
+ ...args,
231
+ branches
219
232
  })
220
233
  });
221
234
  async function updatePullRequestStep(args) {
@@ -375,14 +388,15 @@ async function enablePullRequestAutoMergeStep(args) {
375
388
  return enablePullRequestAutoMergeCore(args);
376
389
  }
377
390
  /** Merge a pull request automatically once its required checks and reviews pass. Requires approval by default. */
378
- const enablePullRequestAutoMerge = (token, { needsApproval = true, coAuthors } = {}) => tool({
391
+ const enablePullRequestAutoMerge = (token, { needsApproval = true, coAuthors, branches } = {}) => tool({
379
392
  description: enablePullRequestAutoMergeDescription,
380
393
  needsApproval,
381
394
  inputSchema: enablePullRequestAutoMergeInputSchema,
382
395
  execute: async (args) => enablePullRequestAutoMergeStep({
383
396
  token: await resolveGithubToken(token, githubTokenCall("enablePullRequestAutoMerge", args)),
384
397
  coAuthors,
385
- ...args
398
+ ...args,
399
+ branches
386
400
  })
387
401
  });
388
402
  async function disablePullRequestAutoMergeStep(args) {
@@ -399,8 +413,22 @@ const disablePullRequestAutoMerge = (token, { needsApproval = true } = {}) => to
399
413
  ...args
400
414
  })
401
415
  });
402
- //#endregion
403
- //#region src/tools/issues.ts
416
+ async function updatePullRequestBranchStep(args) {
417
+ "use step";
418
+ return updatePullRequestBranchCore(args);
419
+ }
420
+ /** Merge a pull request's base branch into its head branch. Requires approval by default. */
421
+ const updatePullRequestBranch = (token, { needsApproval = true, guardrails } = {}) => tool({
422
+ description: updatePullRequestBranchDescription,
423
+ needsApproval,
424
+ inputSchema: updatePullRequestBranchInputSchema,
425
+ execute: async (args) => updatePullRequestBranchStep({
426
+ token: await resolveGithubToken(token, githubTokenCall("updatePullRequestBranch", args)),
427
+ ...args,
428
+ guardrails
429
+ })
430
+ });
431
+ // src/tools/issues.ts
404
432
  async function listIssuesStep(args) {
405
433
  "use step";
406
434
  return listIssuesCore(args);
@@ -635,8 +663,47 @@ const removeAssignees = (token, { needsApproval = true } = {}) => tool({
635
663
  ...args
636
664
  })
637
665
  });
638
- //#endregion
639
- //#region src/tools/reactions.ts
666
+ async function listMilestonesStep(args) {
667
+ "use step";
668
+ return listMilestonesCore(args);
669
+ }
670
+ /** List milestones in a GitHub repository with their due dates and issue counts. */
671
+ const listMilestones = (token) => tool({
672
+ description: listMilestonesDescription,
673
+ inputSchema: listMilestonesInputSchema,
674
+ execute: async (args) => listMilestonesStep({
675
+ token: await resolveGithubToken(token, githubTokenCall("listMilestones", args)),
676
+ ...args
677
+ })
678
+ });
679
+ async function listSubIssuesStep(args) {
680
+ "use step";
681
+ return listSubIssuesCore(args);
682
+ }
683
+ /** List the sub-issues of an issue. */
684
+ const listSubIssues = (token) => tool({
685
+ description: listSubIssuesDescription,
686
+ inputSchema: listSubIssuesInputSchema,
687
+ execute: async (args) => listSubIssuesStep({
688
+ token: await resolveGithubToken(token, githubTokenCall("listSubIssues", args)),
689
+ ...args
690
+ })
691
+ });
692
+ async function addSubIssueStep(args) {
693
+ "use step";
694
+ return addSubIssueCore(args);
695
+ }
696
+ /** Add an existing issue as a sub-issue of another issue. Requires approval by default. */
697
+ const addSubIssue = (token, { needsApproval = true } = {}) => tool({
698
+ description: addSubIssueDescription,
699
+ needsApproval,
700
+ inputSchema: addSubIssueInputSchema,
701
+ execute: async (args) => addSubIssueStep({
702
+ token: await resolveGithubToken(token, githubTokenCall("addSubIssue", args)),
703
+ ...args
704
+ })
705
+ });
706
+ // src/tools/reactions.ts
640
707
  async function listIssueReactionsStep(args) {
641
708
  "use step";
642
709
  return listIssueReactionsCore(args);
@@ -691,8 +758,7 @@ const addCommentReaction = (token, { needsApproval = true } = {}) => tool({
691
758
  ...args
692
759
  })
693
760
  });
694
- //#endregion
695
- //#region src/tools/discussions.ts
761
+ // src/tools/discussions.ts
696
762
  async function listDiscussionsStep(args) {
697
763
  "use step";
698
764
  return listDiscussionsCore(args);
@@ -733,8 +799,7 @@ const addDiscussionComment = (token, { needsApproval = true } = {}) => tool({
733
799
  ...args
734
800
  })
735
801
  });
736
- //#endregion
737
- //#region src/tools/notifications.ts
802
+ // src/tools/notifications.ts
738
803
  async function listNotificationsStep(args) {
739
804
  "use step";
740
805
  return listNotificationsCore(args);
@@ -762,8 +827,7 @@ const markNotificationRead = (token, { needsApproval = true } = {}) => tool({
762
827
  ...args
763
828
  })
764
829
  });
765
- //#endregion
766
- //#region src/tools/search.ts
830
+ // src/tools/search.ts
767
831
  async function searchCodeStep(args) {
768
832
  "use step";
769
833
  return searchCodeCore(args);
@@ -803,8 +867,7 @@ const searchIssues = (token) => tool({
803
867
  ...args
804
868
  })
805
869
  });
806
- //#endregion
807
- //#region src/tools/commits.ts
870
+ // src/tools/commits.ts
808
871
  async function listCommitsStep(args) {
809
872
  "use step";
810
873
  return listCommitsCore(args);
@@ -859,8 +922,7 @@ const compareCommits = (token) => tool({
859
922
  ...args
860
923
  })
861
924
  });
862
- //#endregion
863
- //#region src/tools/gists.ts
925
+ // src/tools/gists.ts
864
926
  async function listGistsStep(args) {
865
927
  "use step";
866
928
  return listGistsCore(args);
@@ -956,8 +1018,7 @@ const createGistComment = (token, { needsApproval = true } = {}) => tool({
956
1018
  ...args
957
1019
  })
958
1020
  });
959
- //#endregion
960
- //#region src/tools/workflows.ts
1021
+ // src/tools/workflows.ts
961
1022
  async function listWorkflowsStep(args) {
962
1023
  "use step";
963
1024
  return listWorkflowsCore(args);
@@ -1065,8 +1126,7 @@ const rerunWorkflowRun = (token, { needsApproval = true } = {}) => tool({
1065
1126
  ...args
1066
1127
  })
1067
1128
  });
1068
- //#endregion
1069
- //#region src/tools/checks.ts
1129
+ // src/tools/checks.ts
1070
1130
  async function listCheckRunsStep(args) {
1071
1131
  "use step";
1072
1132
  return listCheckRunsCore(args);
@@ -1093,8 +1153,21 @@ const getCombinedStatus = (token) => tool({
1093
1153
  ...args
1094
1154
  })
1095
1155
  });
1096
- //#endregion
1097
- //#region src/tools/security.ts
1156
+ async function createCommitStatusStep(args) {
1157
+ "use step";
1158
+ return createCommitStatusCore(args);
1159
+ }
1160
+ /** Report a result on a commit as a commit status. Requires approval by default. */
1161
+ const createCommitStatus = (token, { needsApproval = true } = {}) => tool({
1162
+ description: createCommitStatusDescription,
1163
+ needsApproval,
1164
+ inputSchema: createCommitStatusInputSchema,
1165
+ execute: async (args) => createCommitStatusStep({
1166
+ token: await resolveGithubToken(token, githubTokenCall("createCommitStatus", args)),
1167
+ ...args
1168
+ })
1169
+ });
1170
+ // src/tools/security.ts
1098
1171
  async function listCodeScanningAlertsStep(args) {
1099
1172
  "use step";
1100
1173
  return listCodeScanningAlertsCore(args);
@@ -1134,8 +1207,7 @@ const listSecretScanningAlerts = (token) => tool({
1134
1207
  ...args
1135
1208
  })
1136
1209
  });
1137
- //#endregion
1138
- //#region src/tools/releases.ts
1210
+ // src/tools/releases.ts
1139
1211
  async function listReleasesStep(args) {
1140
1212
  "use step";
1141
1213
  return listReleasesCore(args);
@@ -1217,8 +1289,7 @@ const deleteRelease = (token, { needsApproval = true } = {}) => tool({
1217
1289
  ...args
1218
1290
  })
1219
1291
  });
1220
- //#endregion
1221
- //#region src/tools/bundles.ts
1292
+ // src/tools/bundles.ts
1222
1293
  async function getPullRequestContextStep(args) {
1223
1294
  "use step";
1224
1295
  return getPullRequestContextCore(args);
@@ -1272,8 +1343,7 @@ const getCiFailureContext = (token) => tool({
1272
1343
  ...args
1273
1344
  })
1274
1345
  });
1275
- //#endregion
1276
- //#region src/core/approval.ts
1346
+ // src/core/approval.ts
1277
1347
  const MAX_CACHED_DECISIONS = 100;
1278
1348
  /**
1279
1349
  * Resolve the AI SDK `needsApproval` value for a write tool.
@@ -1324,8 +1394,7 @@ function resolveAiSdkToolApproval(toolName, config, evaluation) {
1324
1394
  };
1325
1395
  };
1326
1396
  }
1327
- //#endregion
1328
- //#region src/agents.ts
1397
+ // src/agents.ts
1329
1398
  const MAX_CACHED_ROUTES = 100;
1330
1399
  /** Name of the tool `preset: 'auto'` adds so the model can call GitHub tools that were not picked. */
1331
1400
  const CALL_GITHUB_TOOL = "callGithubTool";
@@ -1381,7 +1450,7 @@ function callGithubTool(tools) {
1381
1450
  * `requireApproval: 'auto'` puts the decision model's verdict on approval requests and records the
1382
1451
  * calls it lets through as automatic approvals. Calls through `callGithubTool` follow the named tool.
1383
1452
  */
1384
- function githubToolApproval({ tools, requireApproval, evaluation, overrides }) {
1453
+ function githubToolApproval({ tools, requireApproval, evaluation, overrides, guardrails, dryRun }) {
1385
1454
  const policies = /* @__PURE__ */ new Map();
1386
1455
  const policyFor = (name) => {
1387
1456
  let policy = policies.get(name);
@@ -1395,6 +1464,14 @@ function githubToolApproval({ tools, requireApproval, evaluation, overrides }) {
1395
1464
  }
1396
1465
  return policy;
1397
1466
  };
1467
+ const decide = (name, input, options) => {
1468
+ const reason = guardrailViolation(githubTokenCall(name, input), guardrails);
1469
+ if (reason) return {
1470
+ type: "denied",
1471
+ reason
1472
+ };
1473
+ return dryRun && isGithubWriteToolName(name) ? void 0 : policyFor(name)(input, options);
1474
+ };
1398
1475
  return async ({ toolCall, messages, tools: available, toolsContext }) => {
1399
1476
  if (toolCall.toolName !== "callGithubTool" && !Object.hasOwn(GITHUB_TOOL_CATALOG, toolCall.toolName)) {
1400
1477
  const needsApproval = available?.[toolCall.toolName]?.needsApproval;
@@ -1404,14 +1481,14 @@ function githubToolApproval({ tools, requireApproval, evaluation, overrides }) {
1404
1481
  context: toolsContext?.[toolCall.toolName]
1405
1482
  }) : needsApproval) ? "user-approval" : void 0;
1406
1483
  }
1407
- if (toolCall.toolName !== "callGithubTool") return policyFor(toolCall.toolName)(toolCall.input, {
1484
+ if (toolCall.toolName !== "callGithubTool") return decide(toolCall.toolName, toolCall.input, {
1408
1485
  toolCallId: toolCall.toolCallId,
1409
1486
  messages
1410
1487
  });
1411
1488
  const { name, input } = toolCall.input;
1412
1489
  if (input === void 0) return void 0;
1413
1490
  const parsed = await validateInput(tools, name, input);
1414
- return parsed.success ? policyFor(name)(parsed.value, {
1491
+ return parsed.success ? decide(name, parsed.value, {
1415
1492
  toolCallId: toolCall.toolCallId,
1416
1493
  messages
1417
1494
  }) : void 0;
@@ -1479,7 +1556,7 @@ function cachedRouting(kind, settings, route, fallback, store) {
1479
1556
  * const result = await agent.generate({ prompt: 'Review this PR' })
1480
1557
  * ```
1481
1558
  */
1482
- function createGithubAgent({ token, preset, requireApproval, evaluation, overrides, context, instructions, additionalInstructions, author, committer, coAuthors, ...agentOptions }) {
1559
+ function createGithubAgent({ token, preset, requireApproval, evaluation, overrides, context, instructions, additionalInstructions, author, committer, coAuthors, guardrails, dryRun, ...agentOptions }) {
1483
1560
  const staticPreset = preset === "auto" ? void 0 : preset;
1484
1561
  const tools = createGithubTools({
1485
1562
  token,
@@ -1490,7 +1567,9 @@ function createGithubAgent({ token, preset, requireApproval, evaluation, overrid
1490
1567
  context,
1491
1568
  author,
1492
1569
  committer,
1493
- coAuthors
1570
+ coAuthors,
1571
+ guardrails,
1572
+ dryRun
1494
1573
  });
1495
1574
  const byTool = preset === "auto" && evaluation?.selection !== "presets";
1496
1575
  const agentTools = byTool ? {
@@ -1502,7 +1581,9 @@ function createGithubAgent({ token, preset, requireApproval, evaluation, overrid
1502
1581
  tools,
1503
1582
  requireApproval,
1504
1583
  evaluation,
1505
- overrides
1584
+ overrides,
1585
+ guardrails,
1586
+ dryRun
1506
1587
  }),
1507
1588
  ...agentOptions,
1508
1589
  tools: agentTools,
@@ -1556,8 +1637,7 @@ function createGithubAgent({ token, preset, requireApproval, evaluation, overrid
1556
1637
  }
1557
1638
  return new ToolLoopAgent(settings);
1558
1639
  }
1559
- //#endregion
1560
- //#region src/index.ts
1640
+ // src/index.ts
1561
1641
  /**
1562
1642
  * Create a set of GitHub tools for the Vercel AI SDK.
1563
1643
  *
@@ -1597,11 +1677,21 @@ function createGithubAgent({ token, preset, requireApproval, evaluation, overrid
1597
1677
  * addPullRequestComment: false,
1598
1678
  * }
1599
1679
  * })
1680
+ *
1681
+ * // Try an agent on real repositories without changing them
1682
+ * createGithubTools({ token, dryRun: true })
1683
+ *
1684
+ * // Only act on one org, and only write to agent branches
1685
+ * createGithubTools({
1686
+ * token,
1687
+ * guardrails: { repositories: ['vercel-labs/*'], branches: ['agent/*'] },
1688
+ * })
1600
1689
  * ```
1601
1690
  */
1602
- function createGithubTools({ token, requireApproval = true, evaluation, preset, context, overrides, author, committer, coAuthors } = {}) {
1603
- const resolveToken = createGithubTokenResolver(token);
1604
- const approval = (name) => ({ needsApproval: resolveAiSdkApproval(name, requireApproval, evaluation) });
1691
+ function createGithubTools({ token, requireApproval = true, evaluation, preset, context, overrides, author, committer, coAuthors, guardrails, dryRun } = {}) {
1692
+ const resolveToken = withGithubGuardrails(token, guardrails);
1693
+ const approval = (name) => ({ needsApproval: guardedApproval(name, resolveAiSdkApproval(name, requireApproval, evaluation), guardrails) });
1694
+ const branches = guardrails?.branches;
1605
1695
  const allowed = preset ? resolvePresetTools(preset) : null;
1606
1696
  const allTools = {
1607
1697
  getRepository: getRepository(resolveToken),
@@ -1636,20 +1726,27 @@ function createGithubTools({ token, requireApproval = true, evaluation, preset,
1636
1726
  coAuthors
1637
1727
  }),
1638
1728
  getBranchRules: getBranchRules(resolveToken),
1729
+ getCollaboratorPermission: getCollaboratorPermission(resolveToken),
1639
1730
  listCodeScanningAlerts: listCodeScanningAlerts(resolveToken),
1640
1731
  listDependabotAlerts: listDependabotAlerts(resolveToken),
1641
1732
  listSecretScanningAlerts: listSecretScanningAlerts(resolveToken),
1642
1733
  createPullRequest: createPullRequest(resolveToken, approval("createPullRequest")),
1643
1734
  mergePullRequest: mergePullRequest(resolveToken, {
1644
1735
  ...approval("mergePullRequest"),
1645
- coAuthors
1736
+ coAuthors,
1737
+ branches
1646
1738
  }),
1647
1739
  enablePullRequestAutoMerge: enablePullRequestAutoMerge(resolveToken, {
1648
1740
  ...approval("enablePullRequestAutoMerge"),
1649
- coAuthors
1741
+ coAuthors,
1742
+ branches
1650
1743
  }),
1651
1744
  disablePullRequestAutoMerge: disablePullRequestAutoMerge(resolveToken, approval("disablePullRequestAutoMerge")),
1652
1745
  updatePullRequest: updatePullRequest(resolveToken, approval("updatePullRequest")),
1746
+ updatePullRequestBranch: updatePullRequestBranch(resolveToken, {
1747
+ ...approval("updatePullRequestBranch"),
1748
+ guardrails
1749
+ }),
1653
1750
  addPullRequestComment: addPullRequestComment(resolveToken, approval("addPullRequestComment")),
1654
1751
  updatePullRequestComment: updatePullRequestComment(resolveToken, approval("updatePullRequestComment")),
1655
1752
  deletePullRequestComment: deletePullRequestComment(resolveToken, approval("deletePullRequestComment")),
@@ -1677,6 +1774,9 @@ function createGithubTools({ token, requireApproval = true, evaluation, preset,
1677
1774
  deleteLabel: deleteLabel(resolveToken, approval("deleteLabel")),
1678
1775
  addAssignees: addAssignees(resolveToken, approval("addAssignees")),
1679
1776
  removeAssignees: removeAssignees(resolveToken, approval("removeAssignees")),
1777
+ listMilestones: listMilestones(resolveToken),
1778
+ listSubIssues: listSubIssues(resolveToken),
1779
+ addSubIssue: addSubIssue(resolveToken, approval("addSubIssue")),
1680
1780
  listIssueReactions: listIssueReactions(resolveToken),
1681
1781
  addIssueReaction: addIssueReaction(resolveToken, approval("addIssueReaction")),
1682
1782
  listCommentReactions: listCommentReactions(resolveToken),
@@ -1703,6 +1803,7 @@ function createGithubTools({ token, requireApproval = true, evaluation, preset,
1703
1803
  rerunWorkflowRun: rerunWorkflowRun(resolveToken, approval("rerunWorkflowRun")),
1704
1804
  listCheckRuns: listCheckRuns(resolveToken),
1705
1805
  getCombinedStatus: getCombinedStatus(resolveToken),
1806
+ createCommitStatus: createCommitStatus(resolveToken, approval("createCommitStatus")),
1706
1807
  getCiFailureContext: getCiFailureContext(resolveToken),
1707
1808
  listReleases: listReleases(resolveToken),
1708
1809
  getLatestRelease: getLatestRelease(resolveToken),
@@ -1721,10 +1822,38 @@ function createGithubTools({ token, requireApproval = true, evaluation, preset,
1721
1822
  } });
1722
1823
  }
1723
1824
  }
1724
- const scoped = bindToolsContext(Object.fromEntries(Object.entries(allTools).map(([name, tool]) => [name, withStrippedRateLimit(tool)])), context);
1825
+ const wouldApprove = async (name, input, options) => {
1826
+ const override = overrides?.[name]?.needsApproval;
1827
+ if (override !== void 0) return { required: (typeof override === "function" ? await override(input, {
1828
+ ...options,
1829
+ context: void 0
1830
+ }) : override) === true };
1831
+ const status = await resolveAiSdkToolApproval(name, requireApproval, evaluation)(input, options);
1832
+ if (status === void 0 || status === "user-approval") return { required: status === "user-approval" };
1833
+ return {
1834
+ required: status.type === "user-approval",
1835
+ reason: status.reason
1836
+ };
1837
+ };
1838
+ const withDryRun = (name, tool) => dryRun && isGithubWriteToolName(name) ? {
1839
+ ...tool,
1840
+ needsApproval: false,
1841
+ execute: async (args, { toolCallId, messages }) => dryRunWrite(name, args, guardrails, () => wouldApprove(name, args, {
1842
+ toolCallId,
1843
+ messages
1844
+ }))
1845
+ } : tool;
1846
+ const scoped = bindToolsContext(Object.fromEntries(Object.entries(allTools).map(([name, tool]) => [name, withStrippedRateLimit(withDryRun(name, tool))])), context);
1725
1847
  if (!allowed) return scoped;
1726
1848
  return Object.fromEntries(Object.entries(scoped).filter(([name]) => allowed.has(name)));
1727
1849
  }
1850
+ function guardedApproval(name, needsApproval, guardrails) {
1851
+ if (!guardrails) return needsApproval;
1852
+ return async (input, options) => {
1853
+ if (guardrailViolation(githubTokenCall(name, input), guardrails)) return false;
1854
+ return typeof needsApproval === "function" ? needsApproval(input, options) : needsApproval === true;
1855
+ };
1856
+ }
1728
1857
  function withStrippedRateLimit(tool) {
1729
1858
  const inner = tool.toModelOutput;
1730
1859
  return {
@@ -1742,7 +1871,6 @@ function withStrippedRateLimit(tool) {
1742
1871
  }
1743
1872
  };
1744
1873
  }
1745
- //#endregion
1746
- export { closeIssue as $, getGist as A, createBranch as At, searchRepositories as B, listBranches as Bt, listWorkflowRuns as C, listPullRequests as Ct, createGist as D, resolveReviewThread as Dt, triggerWorkflow as E, requestReviewers as Et, getBlame as F, forkRepository as Ft, listDiscussions as G, markNotificationRead as H, getCommit as I, getBranchRules as It, listCommentReactions as J, addCommentReaction as K, listCommits as L, getFileContent as Lt, listGists as M, createRepository as Mt, updateGist as N, deleteBranch as Nt, createGistComment as O, updatePullRequest as Ot, compareCommits as P, editFiles as Pt, addLabels as Q, searchCode as R, getRepository as Rt, listWorkflowJobs as S, listPullRequestReviews as St, rerunWorkflowRun as T, replyToReviewComment as Tt, addDiscussionComment as U, listNotifications as V, getDiscussion as W, addAssignees as X, listIssueReactions as Y, addIssueComment as Z, getCombinedStatus as _, disablePullRequestAutoMerge as _t, getIssueContext as a, listIssueComments as at, getWorkflowJobLogs as b, listPullRequestFiles as bt, createRelease as c, removeAssignees as ct, getRelease as d, updateIssueComment as dt, createIssue as et, listReleases as f, updateLabel as ft, listSecretScanningAlerts as g, deletePullRequestComment as gt, listDependabotAlerts as h, createPullRequestReview as ht, getCiFailureContext as i, getIssue as it, listGistComments as j, createOrUpdateFile as jt, deleteGist as k, updatePullRequestComment as kt, deleteRelease as l, removeLabel as lt, listCodeScanningAlerts as m, createPullRequest as mt, CALL_GITHUB_TOOL as n, deleteIssueComment as nt, getPullRequestContext as o, listIssues as ot, updateRelease as p, addPullRequestComment as pt, addIssueReaction as q, createGithubAgent as r, deleteLabel as rt, getReleaseContext as s, listLabels as st, createGithubTools as t, createLabel as tt, getLatestRelease as u, updateIssue as ut, listCheckRuns as v, enablePullRequestAutoMerge as vt, listWorkflows as w, mergePullRequest as wt, getWorkflowRun as x, listPullRequestReviewThreads as xt, cancelWorkflowRun as y, getPullRequest as yt, searchIssues as z, getRepositoryTree as zt };
1874
+ export { addLabels as $, deleteGist as A, requestReviewers as At, searchIssues as B, forkRepository as Bt, listWorkflowJobs as C, getPullRequest as Ct, triggerWorkflow as D, listPullRequests as Dt, rerunWorkflowRun as E, listPullRequestReviews as Et, compareCommits as F, createBranch as Ft, getDiscussion as G, getRepositoryTree as Gt, listNotifications as H, getCollaboratorPermission as Ht, getBlame as I, createOrUpdateFile as It, addIssueReaction as J, listDiscussions as K, listBranches as Kt, getCommit as L, createRepository as Lt, listGistComments as M, updatePullRequest as Mt, listGists as N, updatePullRequestBranch as Nt, createGist as O, mergePullRequest as Ot, updateGist as P, updatePullRequestComment as Pt, addIssueComment as Q, listCommits as R, deleteBranch as Rt, getWorkflowRun as S, enablePullRequestAutoMerge as St, listWorkflows as T, listPullRequestReviewThreads as Tt, markNotificationRead as U, getFileContent as Ut, searchRepositories as V, getBranchRules as Vt, addDiscussionComment as W, getRepository as Wt, listIssueReactions as X, listCommentReactions as Y, addAssignees as Z, createCommitStatus as _, addPullRequestComment as _t, getIssueContext as a, deleteLabel as at, cancelWorkflowRun as b, deletePullRequestComment as bt, createRelease as c, listIssues as ct, getRelease as d, listSubIssues as dt, addSubIssue as et, listReleases as f, removeAssignees as ft, listSecretScanningAlerts as g, updateLabel as gt, listDependabotAlerts as h, updateIssueComment as ht, getCiFailureContext as i, deleteIssueComment as it, getGist as j, resolveReviewThread as jt, createGistComment as k, replyToReviewComment as kt, deleteRelease as l, listLabels as lt, listCodeScanningAlerts as m, updateIssue as mt, CALL_GITHUB_TOOL as n, createIssue as nt, getPullRequestContext as o, getIssue as ot, updateRelease as p, removeLabel as pt, addCommentReaction as q, createGithubAgent as r, createLabel as rt, getReleaseContext as s, listIssueComments as st, createGithubTools as t, closeIssue as tt, getLatestRelease as u, listMilestones as ut, getCombinedStatus as v, createPullRequest as vt, listWorkflowRuns as w, listPullRequestFiles as wt, getWorkflowJobLogs as x, disablePullRequestAutoMerge as xt, listCheckRuns as y, createPullRequestReview as yt, searchCode as z, editFiles as zt };
1747
1875
 
1748
- //# sourceMappingURL=src-DyiAVHKl.mjs.map
1876
+ //# sourceMappingURL=src-Djn_FFj1.mjs.map