@github-tools/sdk 1.17.0 → 1.19.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 (56) hide show
  1. package/README.md +33 -6
  2. package/dist/connect/eve.d.mts +2 -2
  3. package/dist/connect/eve.d.mts.map +1 -1
  4. package/dist/connect/eve.mjs +1 -1
  5. package/dist/connect.d.mts +3 -3
  6. package/dist/connect.mjs +2 -2
  7. package/dist/cores-BeLZwcde.mjs +269 -0
  8. package/dist/cores-BeLZwcde.mjs.map +1 -0
  9. package/dist/evaluation-f-2QwBid.mjs +210 -0
  10. package/dist/evaluation-f-2QwBid.mjs.map +1 -0
  11. package/dist/{eve-runtime-DwPFaBlj.d.mts → eve-runtime-DRh2QJI7.d.mts} +5 -5
  12. package/dist/eve-runtime-DRh2QJI7.d.mts.map +1 -0
  13. package/dist/{eve-runtime-NBFRz1SB.mjs → eve-runtime-YTxfrWP-.mjs} +6 -4
  14. package/dist/eve-runtime-YTxfrWP-.mjs.map +1 -0
  15. package/dist/eve-runtime.d.mts +4 -4
  16. package/dist/eve-runtime.mjs +3 -2
  17. package/dist/eve.d.mts +4 -4
  18. package/dist/eve.d.mts.map +1 -1
  19. package/dist/eve.mjs +2 -2
  20. package/dist/{index-DglfkoWk.d.mts → index-DkZvveZP.d.mts} +304 -3
  21. package/dist/index-DkZvveZP.d.mts.map +1 -0
  22. package/dist/index.d.mts +2 -2
  23. package/dist/index.mjs +2 -2
  24. package/dist/instructions-BuypoY0x.mjs +148 -0
  25. package/dist/instructions-BuypoY0x.mjs.map +1 -0
  26. package/dist/interrupts-C_lUXMdd.d.mts +60 -0
  27. package/dist/interrupts-C_lUXMdd.d.mts.map +1 -0
  28. package/dist/{src-SH7fl4eI.mjs → src-Bx5p1Unc.mjs} +5 -143
  29. package/dist/{src-SH7fl4eI.mjs.map → src-Bx5p1Unc.mjs.map} +1 -1
  30. package/dist/tanstack/interrupts.d.mts +2 -0
  31. package/dist/tanstack/interrupts.mjs +17 -0
  32. package/dist/tanstack/interrupts.mjs.map +1 -0
  33. package/dist/tanstack.d.mts +4971 -0
  34. package/dist/tanstack.d.mts.map +1 -0
  35. package/dist/tanstack.mjs +465 -0
  36. package/dist/tanstack.mjs.map +1 -0
  37. package/dist/{token-C4lAap1Y.mjs → token-Bh8nPj66.mjs} +4 -3
  38. package/dist/{token-C4lAap1Y.mjs.map → token-Bh8nPj66.mjs.map} +1 -1
  39. package/dist/tool-types-CrC80SIL.d.mts +1573 -0
  40. package/dist/tool-types-CrC80SIL.d.mts.map +1 -0
  41. package/dist/{types-6nsCJ0Pu.d.mts → types-BmwOpI5-.d.mts} +3 -3
  42. package/dist/{types-6nsCJ0Pu.d.mts.map → types-BmwOpI5-.d.mts.map} +1 -1
  43. package/dist/{types-vuvgvlL-.d.mts → types-CPAsEMzx.d.mts} +2 -2
  44. package/dist/{types-vuvgvlL-.d.mts.map → types-CPAsEMzx.d.mts.map} +1 -1
  45. package/dist/workflow.d.mts +2 -2
  46. package/dist/workflow.mjs +3 -2
  47. package/dist/workflow.mjs.map +1 -1
  48. package/dist/{write-tools-BidBkLtv.mjs → write-tools-BaoTUCg7.mjs} +27 -464
  49. package/dist/write-tools-BaoTUCg7.mjs.map +1 -0
  50. package/package.json +34 -18
  51. package/dist/eve-runtime-DwPFaBlj.d.mts.map +0 -1
  52. package/dist/eve-runtime-NBFRz1SB.mjs.map +0 -1
  53. package/dist/index-DglfkoWk.d.mts.map +0 -1
  54. package/dist/tool-types-DcfQIOAY.d.mts +0 -4261
  55. package/dist/tool-types-DcfQIOAY.d.mts.map +0 -1
  56. package/dist/write-tools-BidBkLtv.mjs.map +0 -1
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { c as DEFAULT_EVALUATION_MODEL, ca as createOctokit, f as PRESET_TOOLS, g as resolveGithubToken, n as GITHUB_TOOL_NAMES, s as AUTO_APPROVAL_TOOLS, t as GITHUB_WRITE_TOOLS, ua as githubToolsErrors } from "./write-tools-BidBkLtv.mjs";
2
- import { $ as deleteIssueComment, A as updateGist, At as getFileContent, B as addDiscussionComment, C as triggerWorkflow, Ct as updatePullRequest, D as getGist, Dt as createRepository, E as deleteGist, Et as createOrUpdateFile, F as searchCode, G as listCommentReactions, H as listDiscussions, I as searchIssues, J as addIssueComment, K as listIssueReactions, L as searchRepositories, M as getBlame, Mt as getRepositoryTree, N as getCommit, Nt as listBranches, O as listGistComments, Ot as deleteBranch, P as listCommits, Q as createLabel, R as listNotifications, S as rerunWorkflowRun, St as resolveReviewThread, T as createGistComment, Tt as createBranch, U as addCommentReaction, V as getDiscussion, W as addIssueReaction, X as closeIssue, Y as addLabels, Z as createIssue, _ as getWorkflowJobLogs, _t as listPullRequestReviews, a as getIssueContext, at as removeAssignees, b as listWorkflowRuns, bt as replyToReviewComment, c as createRelease, ct as updateIssueComment, d as getRelease, dt as createPullRequest, et as deleteLabel, f as listReleases, ft as createPullRequestReview, g as cancelWorkflowRun, gt as listPullRequestReviewThreads, h as listCheckRuns, ht as listPullRequestFiles, i as getCiFailureContext, it as listLabels, j as compareCommits, jt as getRepository, k as listGists, kt as forkRepository, l as deleteRelease, lt as updateLabel, m as getCombinedStatus, mt as getPullRequest, n as createGithubAgent, nt as listIssueComments, o as getPullRequestContext, ot as removeLabel, p as updateRelease, pt as deletePullRequestComment, q as addAssignees, rt as listIssues, s as getReleaseContext, st as updateIssue, t as createGithubTools, tt as getIssue, u as getLatestRelease, ut as addPullRequestComment, v as getWorkflowRun, vt as listPullRequests, w as createGist, wt as updatePullRequestComment, x as listWorkflows, xt as requestReviewers, y as listWorkflowJobs, yt as mergePullRequest, z as markNotificationRead } from "./src-SH7fl4eI.mjs";
1
+ import { c as DEFAULT_EVALUATION_MODEL, ia as createOctokit, m as PRESET_TOOLS, n as GITHUB_TOOL_NAMES, oa as githubToolsErrors, s as AUTO_APPROVAL_TOOLS, t as GITHUB_WRITE_TOOLS, v as resolveGithubToken } from "./write-tools-BaoTUCg7.mjs";
2
+ import { $ as deleteLabel, A as compareCommits, At as getRepository, B as getDiscussion, C as createGist, Ct as updatePullRequestComment, D as listGistComments, Dt as deleteBranch, E as getGist, Et as createRepository, F as searchIssues, G as listIssueReactions, H as addCommentReaction, I as searchRepositories, J as addLabels, K as addAssignees, L as listNotifications, M as getCommit, Mt as listBranches, N as listCommits, O as listGists, Ot as forkRepository, P as searchCode, Q as deleteIssueComment, R as markNotificationRead, S as triggerWorkflow, St as updatePullRequest, T as deleteGist, Tt as createOrUpdateFile, U as addIssueReaction, V as listDiscussions, W as listCommentReactions, X as createIssue, Y as closeIssue, Z as createLabel, _ as getWorkflowRun, _t as listPullRequests, a as getPullRequestContext, at as removeLabel, b as listWorkflows, bt as requestReviewers, c as deleteRelease, ct as updateLabel, d as listReleases, dt as createPullRequestReview, et as getIssue, f as updateRelease, ft as deletePullRequestComment, g as getWorkflowJobLogs, gt as listPullRequestReviews, h as cancelWorkflowRun, ht as listPullRequestReviewThreads, i as getIssueContext, it as removeAssignees, j as getBlame, jt as getRepositoryTree, k as updateGist, kt as getFileContent, l as getLatestRelease, lt as addPullRequestComment, m as listCheckRuns, mt as listPullRequestFiles, n as createGithubAgent, nt as listIssues, o as getReleaseContext, ot as updateIssue, p as getCombinedStatus, pt as getPullRequest, q as addIssueComment, r as getCiFailureContext, rt as listLabels, s as createRelease, st as updateIssueComment, t as createGithubTools, tt as listIssueComments, u as getRelease, ut as createPullRequest, v as listWorkflowJobs, vt as mergePullRequest, w as createGistComment, wt as createBranch, x as rerunWorkflowRun, xt as resolveReviewThread, y as listWorkflowRuns, yt as replyToReviewComment, z as addDiscussionComment } from "./src-Bx5p1Unc.mjs";
3
3
  export { AUTO_APPROVAL_TOOLS, DEFAULT_EVALUATION_MODEL, GITHUB_TOOL_NAMES, GITHUB_WRITE_TOOLS, PRESET_TOOLS, addAssignees, addCommentReaction, addDiscussionComment, addIssueComment, addIssueReaction, addLabels, addPullRequestComment, cancelWorkflowRun, closeIssue, compareCommits, createBranch, createGist, createGistComment, createGithubAgent, createGithubTools, createIssue, createLabel, createOctokit, createOrUpdateFile, createPullRequest, createPullRequestReview, createRelease, createRepository, deleteBranch, deleteGist, deleteIssueComment, deleteLabel, deletePullRequestComment, deleteRelease, forkRepository, getBlame, getCiFailureContext, getCombinedStatus, getCommit, getDiscussion, getFileContent, getGist, getIssue, getIssueContext, getLatestRelease, getPullRequest, getPullRequestContext, getRelease, getReleaseContext, getRepository, getRepositoryTree, getWorkflowJobLogs, getWorkflowRun, githubToolsErrors, listBranches, listCheckRuns, listCommentReactions, listCommits, listDiscussions, listGistComments, listGists, listIssueComments, listIssueReactions, listIssues, listLabels, listNotifications, listPullRequestFiles, listPullRequestReviewThreads, listPullRequestReviews, listPullRequests, listReleases, listWorkflowJobs, listWorkflowRuns, listWorkflows, markNotificationRead, mergePullRequest, removeAssignees, removeLabel, replyToReviewComment, requestReviewers, rerunWorkflowRun, resolveGithubToken, resolveReviewThread, searchCode, searchIssues, searchRepositories, triggerWorkflow, updateGist, updateIssue, updateIssueComment, updateLabel, updatePullRequest, updatePullRequestComment, updateRelease };
@@ -0,0 +1,148 @@
1
+ import { i as formatContextInstructions, s as AUTO_APPROVAL_TOOLS } from "./write-tools-BaoTUCg7.mjs";
2
+ //#region src/core/approval-policy.ts
3
+ const autoApprovalTools = new Set(AUTO_APPROVAL_TOOLS);
4
+ /**
5
+ * Resolve a write tool's approval mode from global or per-tool config.
6
+ *
7
+ * @returns `'auto'` only for tools that opt into evaluation; defaults to `true` for unspecified tools in object mode.
8
+ */
9
+ function resolveApprovalMode(toolName, config) {
10
+ if (config === "auto") return autoApprovalTools.has(toolName) ? "auto" : true;
11
+ if (typeof config === "boolean") return config;
12
+ return config[toolName] ?? true;
13
+ }
14
+ //#endregion
15
+ //#region src/core/instructions.ts
16
+ const SHARED_RULES = `When a tool execution is denied by the user, do not retry it. Briefly acknowledge the decision and move on.
17
+ Call independent read tools in the same step when you already know the arguments — never serialize reads that could run in parallel.
18
+ Bodies default to detail summary; patches default to includePatch false; prefer getFileContent with startLine/endLine or maxLines for large files.
19
+ Paged lists return { items, hasMore, page, nextPage }. When hasMore, call with nextPage or raise maxPages — never the same page. Prefer path/author/since/until on listCommits instead of walking history. Prefer a path prefix on getRepositoryTree over recursive true.`;
20
+ const DEFAULT_INSTRUCTIONS = `You are a helpful GitHub assistant. You can read and explore repositories, issues, pull requests, discussions, commits, code, gists, and workflows. You can also create issues, pull requests, comments, gists, reactions, trigger workflows, and update files when asked.
21
+
22
+ Prefer getPullRequestContext, getIssueContext, getReleaseContext, or getCiFailureContext for multi-part reads instead of chaining separate tools.
23
+
24
+ ${SHARED_RULES}`;
25
+ const PRESET_INSTRUCTIONS = {
26
+ "code-review": `You are a code review assistant. Your job is to review pull requests thoroughly and provide constructive feedback.
27
+
28
+ When reviewing a PR:
29
+ - Start with getPullRequestContext (set includeChecks true when CI matters)
30
+ - Then listPullRequestFiles with includePatch true and filenames for only the files you need — in the same step as any getFileContent / getBlame calls when possible
31
+ - Use getBlame then getCommit(includePatch true) only when line history matters
32
+ - Check for bugs, logic errors, and edge cases; be constructive
33
+ - Use createPullRequestReview for formal reviews when asked
34
+ - Use listPullRequestReviewThreads (unresolved by default) to see open feedback; replyToReviewComment to answer in a thread and resolveReviewThread once it is addressed
35
+ - Use updatePullRequest to change title, body, base branch, or draft status; addPullRequestComment / updatePullRequestComment / deletePullRequestComment to manage comments
36
+
37
+ ${SHARED_RULES}`,
38
+ "issue-triage": `You are an issue triage assistant. Your job is to help manage and organize GitHub issues.
39
+
40
+ When triaging issues:
41
+ - Call getIssueContext exactly once (full body + labelNames + recent comments). In that same step, call listIssues or searchIssues if you need duplicate checks
42
+ - Never re-call getIssueContext for the same issue
43
+ - Use listIssueComments to paginate beyond the comments returned by getIssueContext
44
+ - Pick labels from labelNames; use addLabels / removeLabel to apply them. Use createLabel / updateLabel / deleteLabel when the repository taxonomy itself needs changing
45
+ - Create issues with clear titles and descriptions when asked
46
+ - Use updateIssue to edit title, body, labels, milestone, or assignees, and to reopen a closed issue (state: 'open') — there is no separate reopen tool
47
+ - Use updateIssueComment / deleteIssueComment to correct or remove existing comments
48
+ - Acknowledge a report or a comment with addIssueReaction / addCommentReaction instead of posting a comment that says nothing new
49
+
50
+ ${SHARED_RULES}`,
51
+ "ci-ops": `You are a CI/CD operations assistant. Your job is to help monitor and manage GitHub Actions workflows.
52
+
53
+ When working with workflows:
54
+ - Prefer getCiFailureContext first when diagnosing a failing ref
55
+ - Read the failing job's output with getWorkflowJobLogs (the default 200-line tail is usually enough; raise maxLines only when the error is higher up)
56
+ - Use listCheckRuns / getCombinedStatus for narrower follow-ups
57
+ - Inspect job steps to find the failing step; confirm before cancel/re-run
58
+ - Trigger workflow_dispatch with the correct inputs and branch when asked
59
+
60
+ ${SHARED_RULES}`,
61
+ "security-audit": `You are a security audit assistant. Your job is to review repositories for security risks and report findings clearly — you never make destructive changes.
62
+
63
+ When auditing a repository:
64
+ - Use searchCode for secrets and unsafe patterns; getBlame / listCommits to trace introductions
65
+ - Use searchIssues to check for prior reports of the same vulnerability before filing a duplicate
66
+ - Prefer getCiFailureContext or getPullRequestContext for CI / PR context
67
+ - Use compareCommits to scope changes (includePatch only when you need diffs)
68
+ - Report findings as issues with reproduction, impact, and severity
69
+ - Read-only plus createIssue / addIssueComment / addLabels — never assume you can fix code directly
70
+
71
+ ${SHARED_RULES}`,
72
+ "repo-explorer": `You are a repository explorer. Your job is to help users understand codebases and find information across GitHub repositories.
73
+
74
+ When exploring repos:
75
+ - Answer questions about structure and organization; find files and patterns with searchCode / getFileContent
76
+ - Use searchIssues to find issues or pull requests by qualifier across a repository or organization
77
+ - Use listDiscussions / getDiscussion for questions answered in the repository's discussions rather than its issues
78
+ - Prefer getPullRequestContext or getCiFailureContext when summarizing a PR or failing CI
79
+ - Use getBlame for line ownership; summarize recent commits / PRs / issues when asked
80
+ - Read-only — you cannot make changes
81
+
82
+ ${SHARED_RULES}`,
83
+ "release-manager": `You are a release management assistant. Your job is to help prepare and publish GitHub releases.
84
+
85
+ When preparing a release:
86
+ - Prefer getReleaseContext first (current/latest release, previous release, tag compare)
87
+ - Use compareCommits / listCommits for more changelog detail; getCiFailureContext before cutting
88
+ - createRelease with generateReleaseNotes when there is no manual changelog
89
+ - Double-check the target branch or SHA — releases and tags are hard to undo
90
+ - Use updateRelease to fix notes or toggle draft/prerelease after publishing; deleteRelease only when explicitly asked — it does not delete the underlying tag
91
+
92
+ ${SHARED_RULES}`,
93
+ "discussion-moderator": `You are a discussion moderator. Your job is to answer and guide repository Discussions clearly and on-topic.
94
+
95
+ When working in discussions:
96
+ - Use listDiscussions / getDiscussion to load the thread before replying
97
+ - Prefer addDiscussionComment for answers that belong in Discussions
98
+ - Use searchIssues / getIssueContext when the question overlaps an existing issue; addIssueComment only when the follow-up belongs on that issue
99
+ - Keep replies concise and point to docs or code when helpful
100
+
101
+ ${SHARED_RULES}`,
102
+ "notification-inbox": `You are a notification inbox assistant. Your job is to help triage GitHub notification threads for the authenticated user.
103
+
104
+ When clearing the inbox:
105
+ - Use listNotifications to see unread threads (set all true only when asked)
106
+ - Open the related getIssue or getPullRequest when you need context before acting
107
+ - Use markNotificationRead once a thread is handled or is noise
108
+ - These tools need a user PAT with Notifications access — say so if calls fail for that reason
109
+
110
+ ${SHARED_RULES}`,
111
+ "pr-author": `You are a pull request authoring assistant. Your job is to prepare branches, edit files, and open focused PRs.
112
+
113
+ When opening a PR:
114
+ - Inspect the repo with getRepository / listBranches / getFileContent before editing
115
+ - createBranch from a sensible base, then createOrUpdateFile for the change set
116
+ - createPullRequest with a clear title and body; updatePullRequest if the draft or description needs a fix
117
+ - Use listPullRequestFiles / compareCommits / getCommit to verify what will land
118
+ - Address review feedback: listPullRequestReviewThreads for open threads, replyToReviewComment to answer, resolveReviewThread once fixed
119
+ - Use deleteBranch to clean up a merged or abandoned branch when asked
120
+ - Stay scoped to authoring — you do not review, merge, or manage issues
121
+
122
+ ${SHARED_RULES}`,
123
+ "maintainer": `You are a repository maintainer assistant. You have full access to manage repositories, issues, pull requests, discussions, notifications, gists, and workflows.
124
+
125
+ When maintaining repos:
126
+ - Prefer getPullRequestContext or getCiFailureContext for multi-part reads
127
+ - Be careful with writes — review before acting
128
+ - Keep issues, PRs, and commits clear and well-structured
129
+ - Use listNotifications to find what needs attention, then markNotificationRead once a thread is handled
130
+ - Acknowledge a thread with addIssueReaction / addCommentReaction instead of a comment that adds nothing
131
+ - Answer questions in discussions with addDiscussionComment
132
+
133
+ ${SHARED_RULES}`
134
+ };
135
+ function resolveInstructions(options) {
136
+ const defaultPrompt = options.preset && !Array.isArray(options.preset) ? PRESET_INSTRUCTIONS[options.preset] : DEFAULT_INSTRUCTIONS;
137
+ let prompt;
138
+ if (options.instructions) prompt = options.instructions;
139
+ else if (options.additionalInstructions) prompt = `${defaultPrompt}\n\n${options.additionalInstructions}`;
140
+ else prompt = defaultPrompt;
141
+ const contextBlock = options.context ? formatContextInstructions(options.context) : "";
142
+ if (contextBlock) return `${prompt}\n\n${contextBlock}`;
143
+ return prompt;
144
+ }
145
+ //#endregion
146
+ export { resolveApprovalMode as n, resolveInstructions as t };
147
+
148
+ //# sourceMappingURL=instructions-BuypoY0x.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instructions-BuypoY0x.mjs","names":[],"sources":["../src/core/approval-policy.ts","../src/core/instructions.ts"],"sourcesContent":["import { AUTO_APPROVAL_TOOLS } from './evaluation-policy'\nimport type { GithubWriteToolName } from './write-tools'\n\n/**\n * Approval for a single write tool.\n *\n * - `true` — always ask the user\n * - `false` — never ask\n * - `'auto'` — ask only when an evaluation model (Jev by default) rates the call risky\n * or not asked for by the latest user message. AI SDK evaluation needs `ai` 7.0.105 or later.\n */\nexport type ToolApprovalMode = boolean | 'auto'\n\n/**\n * Whether write operations require user approval.\n *\n * - `true` — all write tools need approval (default)\n * - `false` — no approval needed for any write tool\n * - `'auto'` — low-risk write tools ({@link AUTO_APPROVAL_TOOLS}) are evaluated per call;\n * every other write tool needs approval\n * - object — per-tool {@link ToolApprovalMode} via {@link GithubWriteToolName}; unspecified write tools default to `true`\n *\n * @example Global disable\n * ```ts\n * createGithubTools({ token, requireApproval: false })\n * ```\n *\n * @example Auto approval for low-risk writes\n * ```ts\n * createGithubTools({ token, requireApproval: 'auto' })\n * ```\n *\n * @example Granular per write tool\n * ```ts\n * createGithubTools({\n * token,\n * requireApproval: {\n * mergePullRequest: true,\n * createOrUpdateFile: true,\n * addPullRequestComment: 'auto',\n * },\n * })\n * ```\n */\nexport type ApprovalConfig = ToolApprovalMode | Partial<Record<GithubWriteToolName, ToolApprovalMode>>\n\n/** {@link ApprovalConfig} without `'auto'`, for runtimes that cannot run the evaluation model. */\nexport type StaticApprovalConfig = boolean | Partial<Record<GithubWriteToolName, boolean>>\n\nconst autoApprovalTools: ReadonlySet<string> = new Set(AUTO_APPROVAL_TOOLS)\n\n/**\n * Resolve a write tool's approval mode from global or per-tool config.\n *\n * @returns `'auto'` only for tools that opt into evaluation; defaults to `true` for unspecified tools in object mode.\n */\nexport function resolveApprovalMode(toolName: GithubWriteToolName, config: ApprovalConfig): ToolApprovalMode {\n if (config === 'auto') return autoApprovalTools.has(toolName) ? 'auto' : true\n if (typeof config === 'boolean') return config\n return config[toolName] ?? true\n}\n","import type { GithubToolPreset } from './presets'\nimport { formatContextInstructions, type GithubToolsContext } from './context'\n\nconst SHARED_RULES = `When a tool execution is denied by the user, do not retry it. Briefly acknowledge the decision and move on.\nCall independent read tools in the same step when you already know the arguments — never serialize reads that could run in parallel.\nBodies default to detail summary; patches default to includePatch false; prefer getFileContent with startLine/endLine or maxLines for large files.\nPaged lists return { items, hasMore, page, nextPage }. When hasMore, call with nextPage or raise maxPages — never the same page. Prefer path/author/since/until on listCommits instead of walking history. Prefer a path prefix on getRepositoryTree over recursive true.`\n\nconst DEFAULT_INSTRUCTIONS = `You are a helpful GitHub assistant. You can read and explore repositories, issues, pull requests, discussions, commits, code, gists, and workflows. You can also create issues, pull requests, comments, gists, reactions, trigger workflows, and update files when asked.\n\nPrefer getPullRequestContext, getIssueContext, getReleaseContext, or getCiFailureContext for multi-part reads instead of chaining separate tools.\n\n${SHARED_RULES}`\n\nconst PRESET_INSTRUCTIONS: Record<GithubToolPreset, string> = {\n 'code-review': `You are a code review assistant. Your job is to review pull requests thoroughly and provide constructive feedback.\n\nWhen reviewing a PR:\n- Start with getPullRequestContext (set includeChecks true when CI matters)\n- Then listPullRequestFiles with includePatch true and filenames for only the files you need — in the same step as any getFileContent / getBlame calls when possible\n- Use getBlame then getCommit(includePatch true) only when line history matters\n- Check for bugs, logic errors, and edge cases; be constructive\n- Use createPullRequestReview for formal reviews when asked\n- Use listPullRequestReviewThreads (unresolved by default) to see open feedback; replyToReviewComment to answer in a thread and resolveReviewThread once it is addressed\n- Use updatePullRequest to change title, body, base branch, or draft status; addPullRequestComment / updatePullRequestComment / deletePullRequestComment to manage comments\n\n${SHARED_RULES}`,\n\n 'issue-triage': `You are an issue triage assistant. Your job is to help manage and organize GitHub issues.\n\nWhen triaging issues:\n- Call getIssueContext exactly once (full body + labelNames + recent comments). In that same step, call listIssues or searchIssues if you need duplicate checks\n- Never re-call getIssueContext for the same issue\n- Use listIssueComments to paginate beyond the comments returned by getIssueContext\n- Pick labels from labelNames; use addLabels / removeLabel to apply them. Use createLabel / updateLabel / deleteLabel when the repository taxonomy itself needs changing\n- Create issues with clear titles and descriptions when asked\n- Use updateIssue to edit title, body, labels, milestone, or assignees, and to reopen a closed issue (state: 'open') — there is no separate reopen tool\n- Use updateIssueComment / deleteIssueComment to correct or remove existing comments\n- Acknowledge a report or a comment with addIssueReaction / addCommentReaction instead of posting a comment that says nothing new\n\n${SHARED_RULES}`,\n\n 'ci-ops': `You are a CI/CD operations assistant. Your job is to help monitor and manage GitHub Actions workflows.\n\nWhen working with workflows:\n- Prefer getCiFailureContext first when diagnosing a failing ref\n- Read the failing job's output with getWorkflowJobLogs (the default 200-line tail is usually enough; raise maxLines only when the error is higher up)\n- Use listCheckRuns / getCombinedStatus for narrower follow-ups\n- Inspect job steps to find the failing step; confirm before cancel/re-run\n- Trigger workflow_dispatch with the correct inputs and branch when asked\n\n${SHARED_RULES}`,\n\n 'security-audit': `You are a security audit assistant. Your job is to review repositories for security risks and report findings clearly — you never make destructive changes.\n\nWhen auditing a repository:\n- Use searchCode for secrets and unsafe patterns; getBlame / listCommits to trace introductions\n- Use searchIssues to check for prior reports of the same vulnerability before filing a duplicate\n- Prefer getCiFailureContext or getPullRequestContext for CI / PR context\n- Use compareCommits to scope changes (includePatch only when you need diffs)\n- Report findings as issues with reproduction, impact, and severity\n- Read-only plus createIssue / addIssueComment / addLabels — never assume you can fix code directly\n\n${SHARED_RULES}`,\n\n 'repo-explorer': `You are a repository explorer. Your job is to help users understand codebases and find information across GitHub repositories.\n\nWhen exploring repos:\n- Answer questions about structure and organization; find files and patterns with searchCode / getFileContent\n- Use searchIssues to find issues or pull requests by qualifier across a repository or organization\n- Use listDiscussions / getDiscussion for questions answered in the repository's discussions rather than its issues\n- Prefer getPullRequestContext or getCiFailureContext when summarizing a PR or failing CI\n- Use getBlame for line ownership; summarize recent commits / PRs / issues when asked\n- Read-only — you cannot make changes\n\n${SHARED_RULES}`,\n\n 'release-manager': `You are a release management assistant. Your job is to help prepare and publish GitHub releases.\n\nWhen preparing a release:\n- Prefer getReleaseContext first (current/latest release, previous release, tag compare)\n- Use compareCommits / listCommits for more changelog detail; getCiFailureContext before cutting\n- createRelease with generateReleaseNotes when there is no manual changelog\n- Double-check the target branch or SHA — releases and tags are hard to undo\n- Use updateRelease to fix notes or toggle draft/prerelease after publishing; deleteRelease only when explicitly asked — it does not delete the underlying tag\n\n${SHARED_RULES}`,\n\n 'discussion-moderator': `You are a discussion moderator. Your job is to answer and guide repository Discussions clearly and on-topic.\n\nWhen working in discussions:\n- Use listDiscussions / getDiscussion to load the thread before replying\n- Prefer addDiscussionComment for answers that belong in Discussions\n- Use searchIssues / getIssueContext when the question overlaps an existing issue; addIssueComment only when the follow-up belongs on that issue\n- Keep replies concise and point to docs or code when helpful\n\n${SHARED_RULES}`,\n\n 'notification-inbox': `You are a notification inbox assistant. Your job is to help triage GitHub notification threads for the authenticated user.\n\nWhen clearing the inbox:\n- Use listNotifications to see unread threads (set all true only when asked)\n- Open the related getIssue or getPullRequest when you need context before acting\n- Use markNotificationRead once a thread is handled or is noise\n- These tools need a user PAT with Notifications access — say so if calls fail for that reason\n\n${SHARED_RULES}`,\n\n 'pr-author': `You are a pull request authoring assistant. Your job is to prepare branches, edit files, and open focused PRs.\n\nWhen opening a PR:\n- Inspect the repo with getRepository / listBranches / getFileContent before editing\n- createBranch from a sensible base, then createOrUpdateFile for the change set\n- createPullRequest with a clear title and body; updatePullRequest if the draft or description needs a fix\n- Use listPullRequestFiles / compareCommits / getCommit to verify what will land\n- Address review feedback: listPullRequestReviewThreads for open threads, replyToReviewComment to answer, resolveReviewThread once fixed\n- Use deleteBranch to clean up a merged or abandoned branch when asked\n- Stay scoped to authoring — you do not review, merge, or manage issues\n\n${SHARED_RULES}`,\n\n 'maintainer': `You are a repository maintainer assistant. You have full access to manage repositories, issues, pull requests, discussions, notifications, gists, and workflows.\n\nWhen maintaining repos:\n- Prefer getPullRequestContext or getCiFailureContext for multi-part reads\n- Be careful with writes — review before acting\n- Keep issues, PRs, and commits clear and well-structured\n- Use listNotifications to find what needs attention, then markNotificationRead once a thread is handled\n- Acknowledge a thread with addIssueReaction / addCommentReaction instead of a comment that adds nothing\n- Answer questions in discussions with addDiscussionComment\n\n${SHARED_RULES}`\n}\n\nexport function resolveInstructions(options: {\n preset?: GithubToolPreset | GithubToolPreset[]\n instructions?: string\n additionalInstructions?: string\n context?: GithubToolsContext\n}): string {\n const defaultPrompt = options.preset && !Array.isArray(options.preset)\n ? PRESET_INSTRUCTIONS[options.preset]\n : DEFAULT_INSTRUCTIONS\n\n let prompt: string\n if (options.instructions) prompt = options.instructions\n else if (options.additionalInstructions) prompt = `${defaultPrompt}\\n\\n${options.additionalInstructions}`\n else prompt = defaultPrompt\n\n const contextBlock = options.context ? formatContextInstructions(options.context) : ''\n if (contextBlock) return `${prompt}\\n\\n${contextBlock}`\n return prompt\n}\n"],"mappings":";;AAiDA,MAAM,oBAAyC,IAAI,IAAI,mBAAmB;;;;;;AAO1E,SAAgB,oBAAoB,UAA+B,QAA0C;CAC3G,IAAI,WAAW,QAAQ,OAAO,kBAAkB,IAAI,QAAQ,IAAI,SAAS;CACzE,IAAI,OAAO,WAAW,WAAW,OAAO;CACxC,OAAO,OAAO,aAAa;AAC7B;;;ACzDA,MAAM,eAAe;;;;AAKrB,MAAM,uBAAuB;;;;EAI3B;AAEF,MAAM,sBAAwD;CAC5D,eAAe;;;;;;;;;;;EAWf;CAEA,gBAAgB;;;;;;;;;;;;EAYhB;CAEA,UAAU;;;;;;;;;EASV;CAEA,kBAAkB;;;;;;;;;;EAUlB;CAEA,iBAAiB;;;;;;;;;;EAUjB;CAEA,mBAAmB;;;;;;;;;EASnB;CAEA,wBAAwB;;;;;;;;EAQxB;CAEA,sBAAsB;;;;;;;;EAQtB;CAEA,aAAa;;;;;;;;;;;EAWb;CAEA,cAAc;;;;;;;;;;EAUd;AACF;AAEA,SAAgB,oBAAoB,SAKzB;CACT,MAAM,gBAAgB,QAAQ,UAAU,CAAC,MAAM,QAAQ,QAAQ,MAAM,IACjE,oBAAoB,QAAQ,UAC5B;CAEJ,IAAI;CACJ,IAAI,QAAQ,cAAc,SAAS,QAAQ;MACtC,IAAI,QAAQ,wBAAwB,SAAS,GAAG,cAAc,MAAM,QAAQ;MAC5E,SAAS;CAEd,MAAM,eAAe,QAAQ,UAAU,0BAA0B,QAAQ,OAAO,IAAI;CACpF,IAAI,cAAc,OAAO,GAAG,OAAO,MAAM;CACzC,OAAO;AACT"}
@@ -0,0 +1,60 @@
1
+ import { z } from "zod";
2
+ //#region src/tanstack/interrupts.d.ts
3
+ /** Register on the server and client when using GitHub automatic approval. */
4
+ declare const githubToolApproval: Omit<import("@tanstack/ai").InterruptDefinition<"github-tools.approval", z.ZodObject<{
5
+ toolCallId: z.ZodString;
6
+ toolName: z.ZodString;
7
+ input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
8
+ }, z.core.$strip>, z.ZodObject<{
9
+ approved: z.ZodBoolean;
10
+ }, z.core.$strip>, {
11
+ toolCallId: string;
12
+ toolName: string;
13
+ input: Record<string, unknown>;
14
+ }, {
15
+ toolCallId: string;
16
+ toolName: string;
17
+ input: Record<string, unknown>;
18
+ }>, "interrupt"> & {
19
+ interrupt: <TInput>(input: TInput & (TInput extends {
20
+ key: string;
21
+ reason: string;
22
+ message: string;
23
+ expiresAt?: string;
24
+ } & {
25
+ payload?: {
26
+ toolCallId: string;
27
+ toolName: string;
28
+ input: Record<string, unknown>;
29
+ } | undefined;
30
+ } ? Exclude<keyof TInput, "key" | "reason" | "message" | "expiresAt" | "payload"> extends never ? unknown : { [K in Exclude<keyof TInput, "key" | "reason" | "message" | "expiresAt" | "payload">]: never; } : never)) => {
31
+ readonly definition: import("@tanstack/ai").InterruptDefinition<"github-tools.approval", z.ZodObject<{
32
+ toolCallId: z.ZodString;
33
+ toolName: z.ZodString;
34
+ input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
35
+ }, z.core.$strip>, z.ZodObject<{
36
+ approved: z.ZodBoolean;
37
+ }, z.core.$strip>, {
38
+ toolCallId: string;
39
+ toolName: string;
40
+ input: Record<string, unknown>;
41
+ }, {
42
+ toolCallId: string;
43
+ toolName: string;
44
+ input: Record<string, unknown>;
45
+ }>;
46
+ readonly key: string;
47
+ readonly reason: string;
48
+ readonly message: string;
49
+ readonly expiresAt?: string;
50
+ } & {
51
+ readonly payload: {
52
+ toolCallId: string;
53
+ toolName: string;
54
+ input: Record<string, unknown>;
55
+ } | undefined;
56
+ };
57
+ };
58
+ //#endregion
59
+ export { githubToolApproval as t };
60
+ //# sourceMappingURL=interrupts-C_lUXMdd.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interrupts-C_lUXMdd.d.mts","names":[],"sources":["../src/tanstack/interrupts.ts"],"mappings":";;;cAIa,oBAAkB,4BAAA,6CAAA,EAAA"}
@@ -1,4 +1,6 @@
1
- import { $ as deleteGistCore, $i as getRepositoryCore, $n as replyToReviewCommentCore, $r as removeLabelCore, $t as rerunWorkflowRunCore, A as addCommentReactionDescription, Ai as getCommitToModelOutput, An as createPullRequestReviewDescription, Ar as createLabelDescription, At as getPullRequestContextDescription, B as listIssueReactionsInputSchema, Bi as createOrUpdateFileInputSchema, Bn as listPullRequestFilesInputSchema, Br as getIssueInputSchema, Bt as getWorkflowJobLogsInputSchema, C as searchIssuesCore, Ci as getCombinedStatusCore, Cn as addPullRequestCommentCore, Cr as closeIssueCore, Ct as getCiFailureContextCore, D as searchRepositoriesDescription, Di as listCheckRunsDescription, Dn as createPullRequestDescription, Dr as createIssueDescription, Dt as getIssueContextDescription, E as searchRepositoriesCore, Ei as listCheckRunsCore, En as createPullRequestCore, Er as createIssueCore, Et as getIssueContextCore, F as listCommentReactionsCore, Fi as createBranchCore, Fn as getPullRequestCore, Fr as deleteLabelCore, Ft as cancelWorkflowRunCore, G as markNotificationReadDescription, Gi as deleteBranchDescription, Gn as listPullRequestReviewsDescription, Gr as listIssuesDescription, Gt as listWorkflowJobsDescription, H as listNotificationsDescription, Hi as createRepositoryDescription, Hn as listPullRequestReviewThreadsDescription, Hr as listIssueCommentsDescription, Ht as getWorkflowRunDescription, I as listCommentReactionsDescription, Ii as createBranchDescription, In as getPullRequestDescription, Ir as deleteLabelDescription, It as cancelWorkflowRunDescription, J as createGistCommentDescription, Ji as forkRepositoryDescription, Jn as listPullRequestsDescription, Jr as listLabelsDescription, Jt as listWorkflowRunsDescription, K as markNotificationReadInputSchema, Ki as deleteBranchInputSchema, Kn as listPullRequestReviewsInputSchema, Kr as listIssuesInputSchema, Kt as listWorkflowJobsInputSchema, L as listCommentReactionsInputSchema, Li as createBranchInputSchema, Ln as getPullRequestInputSchema, Lr as deleteLabelInputSchema, Lt as cancelWorkflowRunInputSchema, M as addIssueReactionCore, Mi as getPullRequestContextToModelOutput, Mn as deletePullRequestCommentCore, Mr as deleteIssueCommentCore, Mt as getReleaseContextCore, N as addIssueReactionDescription, Ni as getRepositoryTreeToModelOutput, Nn as deletePullRequestCommentDescription, Nr as deleteIssueCommentDescription, Nt as getReleaseContextDescription, O as searchRepositoriesInputSchema, Oi as listCheckRunsInputSchema, On as createPullRequestInputSchema, Or as createIssueInputSchema, Ot as getIssueContextInputSchema, P as addIssueReactionInputSchema, Pi as listPullRequestFilesToModelOutput, Pn as deletePullRequestCommentInputSchema, Pr as deleteIssueCommentInputSchema, Pt as getReleaseContextInputSchema, Q as createGistInputSchema, Qi as getFileContentInputSchema, Qn as mergePullRequestInputSchema, Qr as removeAssigneesInputSchema, Qt as listWorkflowsInputSchema, R as listIssueReactionsCore, Ri as createOrUpdateFileCore, Rn as listPullRequestFilesCore, Rr as getIssueCore, Rt as getWorkflowJobLogsCore, S as searchCodeInputSchema, Si as listCommitsInputSchema, Sn as updateReleaseInputSchema, Sr as addLabelsInputSchema, St as listDiscussionsInputSchema, T as searchIssuesInputSchema, Ti as getCombinedStatusInputSchema, Tn as addPullRequestCommentInputSchema, Tr as closeIssueInputSchema, Tt as getCiFailureContextInputSchema, U as listNotificationsInputSchema, Ui as createRepositoryInputSchema, Un as listPullRequestReviewThreadsInputSchema, Ur as listIssueCommentsInputSchema, Ut as getWorkflowRunInputSchema, V as listNotificationsCore, Vi as createRepositoryCore, Vn as listPullRequestReviewThreadsCore, Vr as listIssueCommentsCore, Vt as getWorkflowRunCore, W as markNotificationReadCore, Wi as deleteBranchCore, Wn as listPullRequestReviewsCore, Wr as listIssuesCore, Wt as listWorkflowJobsCore, X as createGistCore, Xi as getFileContentCore, Xn as mergePullRequestCore, Xr as removeAssigneesCore, Xt as listWorkflowsCore, Y as createGistCommentInputSchema, Yi as forkRepositoryInputSchema, Yn as listPullRequestsInputSchema, Yr as listLabelsInputSchema, Yt as listWorkflowRunsInputSchema, Z as createGistDescription, Zi as getFileContentDescription, Zn as mergePullRequestDescription, Zr as removeAssigneesDescription, Zt as listWorkflowsDescription, _i as getCommitCore, _n as listReleasesCore, _r as addIssueCommentCore, _t as getDiscussionCore, aa as listBranchesCore, ai as updateIssueCore, an as createReleaseCore, ar as resolveReviewThreadCore, at as listGistCommentsCore, b as searchCodeCore, bi as listCommitsCore, bn as updateReleaseCore, br as addLabelsCore, bt as listDiscussionsCore, ci as updateLabelCore, cn as deleteReleaseCore, cr as updatePullRequestCommentCore, ct as listGistsCore, d as selectPresets, di as compareCommitsCore, dn as getLatestReleaseCore, dr as updatePullRequestCore, dt as updateGistCore, ea as getRepositoryDescription, ei as removeLabelDescription, en as rerunWorkflowRunDescription, er as replyToReviewCommentDescription, et as deleteGistDescription, fa as stripRateLimit, fi as compareCommitsDescription, fn as getLatestReleaseDescription, fr as updatePullRequestDescription, ft as updateGistDescription, g as resolveGithubToken, gi as getBlameInputSchema, gn as getReleaseInputSchema, gr as addAssigneesInputSchema, gt as addDiscussionCommentInputSchema, h as githubTokenCall, hi as getBlameDescription, hn as getReleaseDescription, hr as addAssigneesDescription, ht as addDiscussionCommentDescription, i as formatContextInstructions, ia as getRepositoryTreeInputSchema, ii as updateIssueCommentInputSchema, in as triggerWorkflowInputSchema, ir as requestReviewersInputSchema, it as getGistInputSchema, j as addCommentReactionInputSchema, ji as getFileContentToModelOutput, jn as createPullRequestReviewInputSchema, jr as createLabelInputSchema, jt as getPullRequestContextInputSchema, k as addCommentReactionCore, ki as compareCommitsToModelOutput, kn as createPullRequestReviewCore, kr as createLabelCore, kt as getPullRequestContextCore, li as updateLabelDescription, ln as deleteReleaseDescription, lr as updatePullRequestCommentDescription, lt as listGistsDescription, m as createGithubTokenResolver, mi as getBlameCore, mn as getReleaseCore, mr as addAssigneesCore, mt as addDiscussionCommentCore, na as getRepositoryTreeCore, ni as updateIssueCommentCore, nn as triggerWorkflowCore, nr as requestReviewersCore, nt as getGistCore, oa as listBranchesDescription, oi as updateIssueDescription, on as createReleaseDescription, or as resolveReviewThreadDescription, ot as listGistCommentsDescription, p as resolvePresetTools, pi as compareCommitsInputSchema, pn as getLatestReleaseInputSchema, pr as updatePullRequestInputSchema, pt as updateGistInputSchema, q as createGistCommentCore, qi as forkRepositoryCore, qn as listPullRequestsCore, qr as listLabelsCore, qt as listWorkflowRunsCore, r as bindToolsContext, ra as getRepositoryTreeDescription, ri as updateIssueCommentDescription, rn as triggerWorkflowDescription, rr as requestReviewersDescription, rt as getGistDescription, s as AUTO_APPROVAL_TOOLS, sa as listBranchesInputSchema, si as updateIssueInputSchema, sn as createReleaseInputSchema, sr as resolveReviewThreadInputSchema, st as listGistCommentsInputSchema, ta as getRepositoryInputSchema, ti as removeLabelInputSchema, tn as rerunWorkflowRunInputSchema, tr as replyToReviewCommentInputSchema, tt as deleteGistInputSchema, u as needsAutoApproval, ui as updateLabelInputSchema, un as deleteReleaseInputSchema, ur as updatePullRequestCommentInputSchema, ut as listGistsInputSchema, vi as getCommitDescription, vn as listReleasesDescription, vr as addIssueCommentDescription, vt as getDiscussionDescription, w as searchIssuesDescription, wi as getCombinedStatusDescription, wn as addPullRequestCommentDescription, wr as closeIssueDescription, wt as getCiFailureContextDescription, x as searchCodeDescription, xi as listCommitsDescription, xn as updateReleaseDescription, xr as addLabelsDescription, xt as listDiscussionsDescription, yi as getCommitInputSchema, yn as listReleasesInputSchema, yr as addIssueCommentInputSchema, yt as getDiscussionInputSchema, z as listIssueReactionsDescription, zi as createOrUpdateFileDescription, zn as listPullRequestFilesDescription, zr as getIssueDescription, zt as getWorkflowJobLogsDescription } from "./write-tools-BidBkLtv.mjs";
1
+ import { $ as createGistDescription, $i as getRepositoryTreeDescription, $n as mergePullRequestDescription, $r as removeAssigneesDescription, $t as listWorkflowsDescription, A as searchRepositoriesInputSchema, Ai as listCheckRunsInputSchema, An as createPullRequestInputSchema, Ar as createIssueInputSchema, At as getIssueContextInputSchema, B as listIssueReactionsCore, Bi as deleteBranchCore, Bn as listPullRequestFilesCore, Br as getIssueCore, Bt as getWorkflowJobLogsCore, C as searchCodeDescription, Ci as listCommitsDescription, Cn as updateReleaseDescription, Cr as addLabelsDescription, Ct as listDiscussionsDescription, D as searchIssuesInputSchema, Di as getCombinedStatusInputSchema, Dn as addPullRequestCommentInputSchema, Dr as closeIssueInputSchema, Dt as getCiFailureContextInputSchema, E as searchIssuesDescription, Ei as getCombinedStatusDescription, En as addPullRequestCommentDescription, Er as closeIssueDescription, Et as getCiFailureContextDescription, F as addIssueReactionDescription, Fi as createOrUpdateFileDescription, Fn as deletePullRequestCommentDescription, Fr as deleteIssueCommentDescription, Ft as getReleaseContextDescription, G as listNotificationsInputSchema, Gi as forkRepositoryInputSchema, Gn as listPullRequestReviewThreadsInputSchema, Gr as listIssueCommentsInputSchema, Gt as getWorkflowRunInputSchema, H as listIssueReactionsInputSchema, Hi as deleteBranchInputSchema, Hn as listPullRequestFilesInputSchema, Hr as getIssueInputSchema, Ht as getWorkflowJobLogsInputSchema, I as addIssueReactionInputSchema, Ii as createOrUpdateFileInputSchema, In as deletePullRequestCommentInputSchema, Ir as deleteIssueCommentInputSchema, It as getReleaseContextInputSchema, J as markNotificationReadInputSchema, Ji as getFileContentInputSchema, Jn as listPullRequestReviewsInputSchema, Jr as listIssuesInputSchema, Jt as listWorkflowJobsInputSchema, K as markNotificationReadCore, Ki as getFileContentCore, Kn as listPullRequestReviewsCore, Kr as listIssuesCore, Kt as listWorkflowJobsCore, L as listCommentReactionsCore, Li as createRepositoryCore, Ln as getPullRequestCore, Lr as deleteLabelCore, Lt as cancelWorkflowRunCore, M as addCommentReactionDescription, Mi as createBranchDescription, Mn as createPullRequestReviewDescription, Mr as createLabelDescription, Mt as getPullRequestContextDescription, N as addCommentReactionInputSchema, Ni as createBranchInputSchema, Nn as createPullRequestReviewInputSchema, Nr as createLabelInputSchema, Nt as getPullRequestContextInputSchema, O as searchRepositoriesCore, Oi as listCheckRunsCore, On as createPullRequestCore, Or as createIssueCore, Ot as getIssueContextCore, P as addIssueReactionCore, Pi as createOrUpdateFileCore, Pn as deletePullRequestCommentCore, Pr as deleteIssueCommentCore, Pt as getReleaseContextCore, Q as createGistCore, Qi as getRepositoryTreeCore, Qn as mergePullRequestCore, Qr as removeAssigneesCore, Qt as listWorkflowsCore, R as listCommentReactionsDescription, Ri as createRepositoryDescription, Rn as getPullRequestDescription, Rr as deleteLabelDescription, Rt as cancelWorkflowRunDescription, S as searchCodeCore, Si as listCommitsCore, Sn as updateReleaseCore, Sr as addLabelsCore, St as listDiscussionsCore, T as searchIssuesCore, Ti as getCombinedStatusCore, Tn as addPullRequestCommentCore, Tr as closeIssueCore, Tt as getCiFailureContextCore, U as listNotificationsCore, Ui as forkRepositoryCore, Un as listPullRequestReviewThreadsCore, Ur as listIssueCommentsCore, Ut as getWorkflowRunCore, V as listIssueReactionsDescription, Vi as deleteBranchDescription, Vn as listPullRequestFilesDescription, Vr as getIssueDescription, Vt as getWorkflowJobLogsDescription, W as listNotificationsDescription, Wi as forkRepositoryDescription, Wn as listPullRequestReviewThreadsDescription, Wr as listIssueCommentsDescription, Wt as getWorkflowRunDescription, X as createGistCommentDescription, Xi as getRepositoryDescription, Xn as listPullRequestsDescription, Xr as listLabelsDescription, Xt as listWorkflowRunsDescription, Y as createGistCommentCore, Yi as getRepositoryCore, Yn as listPullRequestsCore, Yr as listLabelsCore, Yt as listWorkflowRunsCore, Z as createGistCommentInputSchema, Zi as getRepositoryInputSchema, Zn as listPullRequestsInputSchema, Zr as listLabelsInputSchema, Zt as listWorkflowRunsInputSchema, _ as githubTokenCall, _i as getBlameDescription, _n as getReleaseDescription, _r as addAssigneesDescription, _t as addDiscussionCommentDescription, ai as updateIssueCommentDescription, an as triggerWorkflowDescription, ar as requestReviewersDescription, at as getGistDescription, bi as getCommitDescription, bn as listReleasesDescription, br as addIssueCommentDescription, bt as getDiscussionDescription, ca as stripRateLimit, ci as updateIssueDescription, cn as createReleaseDescription, cr as resolveReviewThreadDescription, ct as listGistCommentsDescription, di as updateLabelDescription, dn as deleteReleaseDescription, dr as updatePullRequestCommentDescription, dt as listGistsDescription, ea as getRepositoryTreeInputSchema, ei as removeAssigneesInputSchema, en as listWorkflowsInputSchema, er as mergePullRequestInputSchema, et as createGistInputSchema, fi as updateLabelInputSchema, fn as deleteReleaseInputSchema, fr as updatePullRequestCommentInputSchema, ft as listGistsInputSchema, g as createGithubTokenResolver, gi as getBlameCore, gn as getReleaseCore, gr as addAssigneesCore, gt as addDiscussionCommentCore, h as resolvePresetTools, hi as compareCommitsInputSchema, hn as getLatestReleaseInputSchema, hr as updatePullRequestInputSchema, ht as updateGistInputSchema, ii as updateIssueCommentCore, in as triggerWorkflowCore, ir as requestReviewersCore, it as getGistCore, j as addCommentReactionCore, ji as createBranchCore, jn as createPullRequestReviewCore, jr as createLabelCore, jt as getPullRequestContextCore, k as searchRepositoriesDescription, ki as listCheckRunsDescription, kn as createPullRequestDescription, kr as createIssueDescription, kt as getIssueContextDescription, li as updateIssueInputSchema, ln as createReleaseInputSchema, lr as resolveReviewThreadInputSchema, lt as listGistCommentsInputSchema, mi as compareCommitsDescription, mn as getLatestReleaseDescription, mr as updatePullRequestDescription, mt as updateGistDescription, na as listBranchesDescription, ni as removeLabelDescription, nn as rerunWorkflowRunDescription, nr as replyToReviewCommentDescription, nt as deleteGistDescription, oi as updateIssueCommentInputSchema, on as triggerWorkflowInputSchema, or as requestReviewersInputSchema, ot as getGistInputSchema, pi as compareCommitsCore, pn as getLatestReleaseCore, pr as updatePullRequestCore, pt as updateGistCore, q as markNotificationReadDescription, qi as getFileContentDescription, qn as listPullRequestReviewsDescription, qr as listIssuesDescription, qt as listWorkflowJobsDescription, r as bindToolsContext, ra as listBranchesInputSchema, ri as removeLabelInputSchema, rn as rerunWorkflowRunInputSchema, rr as replyToReviewCommentInputSchema, rt as deleteGistInputSchema, si as updateIssueCore, sn as createReleaseCore, sr as resolveReviewThreadCore, st as listGistCommentsCore, ta as listBranchesCore, ti as removeLabelCore, tn as rerunWorkflowRunCore, tr as replyToReviewCommentCore, tt as deleteGistCore, ui as updateLabelCore, un as deleteReleaseCore, ur as updatePullRequestCommentCore, ut as listGistsCore, v as resolveGithubToken, vi as getBlameInputSchema, vn as getReleaseInputSchema, vr as addAssigneesInputSchema, vt as addDiscussionCommentInputSchema, w as searchCodeInputSchema, wi as listCommitsInputSchema, wn as updateReleaseInputSchema, wr as addLabelsInputSchema, wt as listDiscussionsInputSchema, xi as getCommitInputSchema, xn as listReleasesInputSchema, xr as addIssueCommentInputSchema, xt as getDiscussionInputSchema, yi as getCommitCore, yn as listReleasesCore, yr as addIssueCommentCore, yt as getDiscussionCore, z as listCommentReactionsInputSchema, zi as createRepositoryInputSchema, zn as getPullRequestInputSchema, zr as deleteLabelInputSchema, zt as cancelWorkflowRunInputSchema } from "./write-tools-BaoTUCg7.mjs";
2
+ import { a as getCommitToModelOutput, c as getRepositoryTreeToModelOutput, i as compareCommitsToModelOutput, l as listPullRequestFilesToModelOutput, n as needsAutoApproval, o as getFileContentToModelOutput, r as selectPresets, s as getPullRequestContextToModelOutput } from "./evaluation-f-2QwBid.mjs";
3
+ import { n as resolveApprovalMode, t as resolveInstructions } from "./instructions-BuypoY0x.mjs";
2
4
  import { ToolLoopAgent, tool } from "ai";
3
5
  //#region src/tools/repository.ts
4
6
  async function getRepositoryStep(args) {
@@ -1171,17 +1173,6 @@ const getCiFailureContext = (token) => tool({
1171
1173
  });
1172
1174
  //#endregion
1173
1175
  //#region src/core/approval.ts
1174
- const autoApprovalTools = new Set(AUTO_APPROVAL_TOOLS);
1175
- /**
1176
- * Resolve a write tool's approval mode from global or per-tool config.
1177
- *
1178
- * @returns `'auto'` only for tools that opt into evaluation; defaults to `true` for unspecified tools in object mode.
1179
- */
1180
- function resolveApprovalMode(toolName, config) {
1181
- if (config === "auto") return autoApprovalTools.has(toolName) ? "auto" : true;
1182
- if (typeof config === "boolean") return config;
1183
- return config[toolName] ?? true;
1184
- }
1185
1176
  /**
1186
1177
  * Resolve the AI SDK `needsApproval` value for a write tool.
1187
1178
  * `'auto'` becomes a function that evaluates each call with {@link needsAutoApproval}.
@@ -1193,135 +1184,6 @@ function resolveAiSdkApproval(toolName, config, evaluation) {
1193
1184
  }
1194
1185
  //#endregion
1195
1186
  //#region src/agents.ts
1196
- const SHARED_RULES = `When a tool execution is denied by the user, do not retry it. Briefly acknowledge the decision and move on.
1197
- Call independent read tools in the same step when you already know the arguments — never serialize reads that could run in parallel.
1198
- Bodies default to detail summary; patches default to includePatch false; prefer getFileContent with startLine/endLine or maxLines for large files.
1199
- Paged lists return { items, hasMore, page, nextPage }. When hasMore, call with nextPage or raise maxPages — never the same page. Prefer path/author/since/until on listCommits instead of walking history. Prefer a path prefix on getRepositoryTree over recursive true.`;
1200
- const DEFAULT_INSTRUCTIONS = `You are a helpful GitHub assistant. You can read and explore repositories, issues, pull requests, discussions, commits, code, gists, and workflows. You can also create issues, pull requests, comments, gists, reactions, trigger workflows, and update files when asked.
1201
-
1202
- Prefer getPullRequestContext, getIssueContext, getReleaseContext, or getCiFailureContext for multi-part reads instead of chaining separate tools.
1203
-
1204
- ${SHARED_RULES}`;
1205
- const PRESET_INSTRUCTIONS = {
1206
- "code-review": `You are a code review assistant. Your job is to review pull requests thoroughly and provide constructive feedback.
1207
-
1208
- When reviewing a PR:
1209
- - Start with getPullRequestContext (set includeChecks true when CI matters)
1210
- - Then listPullRequestFiles with includePatch true and filenames for only the files you need — in the same step as any getFileContent / getBlame calls when possible
1211
- - Use getBlame then getCommit(includePatch true) only when line history matters
1212
- - Check for bugs, logic errors, and edge cases; be constructive
1213
- - Use createPullRequestReview for formal reviews when asked
1214
- - Use listPullRequestReviewThreads (unresolved by default) to see open feedback; replyToReviewComment to answer in a thread and resolveReviewThread once it is addressed
1215
- - Use updatePullRequest to change title, body, base branch, or draft status; addPullRequestComment / updatePullRequestComment / deletePullRequestComment to manage comments
1216
-
1217
- ${SHARED_RULES}`,
1218
- "issue-triage": `You are an issue triage assistant. Your job is to help manage and organize GitHub issues.
1219
-
1220
- When triaging issues:
1221
- - Call getIssueContext exactly once (full body + labelNames + recent comments). In that same step, call listIssues or searchIssues if you need duplicate checks
1222
- - Never re-call getIssueContext for the same issue
1223
- - Use listIssueComments to paginate beyond the comments returned by getIssueContext
1224
- - Pick labels from labelNames; use addLabels / removeLabel to apply them. Use createLabel / updateLabel / deleteLabel when the repository taxonomy itself needs changing
1225
- - Create issues with clear titles and descriptions when asked
1226
- - Use updateIssue to edit title, body, labels, milestone, or assignees, and to reopen a closed issue (state: 'open') — there is no separate reopen tool
1227
- - Use updateIssueComment / deleteIssueComment to correct or remove existing comments
1228
- - Acknowledge a report or a comment with addIssueReaction / addCommentReaction instead of posting a comment that says nothing new
1229
-
1230
- ${SHARED_RULES}`,
1231
- "ci-ops": `You are a CI/CD operations assistant. Your job is to help monitor and manage GitHub Actions workflows.
1232
-
1233
- When working with workflows:
1234
- - Prefer getCiFailureContext first when diagnosing a failing ref
1235
- - Read the failing job's output with getWorkflowJobLogs (the default 200-line tail is usually enough; raise maxLines only when the error is higher up)
1236
- - Use listCheckRuns / getCombinedStatus for narrower follow-ups
1237
- - Inspect job steps to find the failing step; confirm before cancel/re-run
1238
- - Trigger workflow_dispatch with the correct inputs and branch when asked
1239
-
1240
- ${SHARED_RULES}`,
1241
- "security-audit": `You are a security audit assistant. Your job is to review repositories for security risks and report findings clearly — you never make destructive changes.
1242
-
1243
- When auditing a repository:
1244
- - Use searchCode for secrets and unsafe patterns; getBlame / listCommits to trace introductions
1245
- - Use searchIssues to check for prior reports of the same vulnerability before filing a duplicate
1246
- - Prefer getCiFailureContext or getPullRequestContext for CI / PR context
1247
- - Use compareCommits to scope changes (includePatch only when you need diffs)
1248
- - Report findings as issues with reproduction, impact, and severity
1249
- - Read-only plus createIssue / addIssueComment / addLabels — never assume you can fix code directly
1250
-
1251
- ${SHARED_RULES}`,
1252
- "repo-explorer": `You are a repository explorer. Your job is to help users understand codebases and find information across GitHub repositories.
1253
-
1254
- When exploring repos:
1255
- - Answer questions about structure and organization; find files and patterns with searchCode / getFileContent
1256
- - Use searchIssues to find issues or pull requests by qualifier across a repository or organization
1257
- - Use listDiscussions / getDiscussion for questions answered in the repository's discussions rather than its issues
1258
- - Prefer getPullRequestContext or getCiFailureContext when summarizing a PR or failing CI
1259
- - Use getBlame for line ownership; summarize recent commits / PRs / issues when asked
1260
- - Read-only — you cannot make changes
1261
-
1262
- ${SHARED_RULES}`,
1263
- "release-manager": `You are a release management assistant. Your job is to help prepare and publish GitHub releases.
1264
-
1265
- When preparing a release:
1266
- - Prefer getReleaseContext first (current/latest release, previous release, tag compare)
1267
- - Use compareCommits / listCommits for more changelog detail; getCiFailureContext before cutting
1268
- - createRelease with generateReleaseNotes when there is no manual changelog
1269
- - Double-check the target branch or SHA — releases and tags are hard to undo
1270
- - Use updateRelease to fix notes or toggle draft/prerelease after publishing; deleteRelease only when explicitly asked — it does not delete the underlying tag
1271
-
1272
- ${SHARED_RULES}`,
1273
- "discussion-moderator": `You are a discussion moderator. Your job is to answer and guide repository Discussions clearly and on-topic.
1274
-
1275
- When working in discussions:
1276
- - Use listDiscussions / getDiscussion to load the thread before replying
1277
- - Prefer addDiscussionComment for answers that belong in Discussions
1278
- - Use searchIssues / getIssueContext when the question overlaps an existing issue; addIssueComment only when the follow-up belongs on that issue
1279
- - Keep replies concise and point to docs or code when helpful
1280
-
1281
- ${SHARED_RULES}`,
1282
- "notification-inbox": `You are a notification inbox assistant. Your job is to help triage GitHub notification threads for the authenticated user.
1283
-
1284
- When clearing the inbox:
1285
- - Use listNotifications to see unread threads (set all true only when asked)
1286
- - Open the related getIssue or getPullRequest when you need context before acting
1287
- - Use markNotificationRead once a thread is handled or is noise
1288
- - These tools need a user PAT with Notifications access — say so if calls fail for that reason
1289
-
1290
- ${SHARED_RULES}`,
1291
- "pr-author": `You are a pull request authoring assistant. Your job is to prepare branches, edit files, and open focused PRs.
1292
-
1293
- When opening a PR:
1294
- - Inspect the repo with getRepository / listBranches / getFileContent before editing
1295
- - createBranch from a sensible base, then createOrUpdateFile for the change set
1296
- - createPullRequest with a clear title and body; updatePullRequest if the draft or description needs a fix
1297
- - Use listPullRequestFiles / compareCommits / getCommit to verify what will land
1298
- - Address review feedback: listPullRequestReviewThreads for open threads, replyToReviewComment to answer, resolveReviewThread once fixed
1299
- - Use deleteBranch to clean up a merged or abandoned branch when asked
1300
- - Stay scoped to authoring — you do not review, merge, or manage issues
1301
-
1302
- ${SHARED_RULES}`,
1303
- "maintainer": `You are a repository maintainer assistant. You have full access to manage repositories, issues, pull requests, discussions, notifications, gists, and workflows.
1304
-
1305
- When maintaining repos:
1306
- - Prefer getPullRequestContext or getCiFailureContext for multi-part reads
1307
- - Be careful with writes — review before acting
1308
- - Keep issues, PRs, and commits clear and well-structured
1309
- - Use listNotifications to find what needs attention, then markNotificationRead once a thread is handled
1310
- - Acknowledge a thread with addIssueReaction / addCommentReaction instead of a comment that adds nothing
1311
- - Answer questions in discussions with addDiscussionComment
1312
-
1313
- ${SHARED_RULES}`
1314
- };
1315
- function resolveInstructions(options) {
1316
- const defaultPrompt = options.preset && !Array.isArray(options.preset) ? PRESET_INSTRUCTIONS[options.preset] : DEFAULT_INSTRUCTIONS;
1317
- let prompt;
1318
- if (options.instructions) prompt = options.instructions;
1319
- else if (options.additionalInstructions) prompt = `${defaultPrompt}\n\n${options.additionalInstructions}`;
1320
- else prompt = defaultPrompt;
1321
- const contextBlock = options.context ? formatContextInstructions(options.context) : "";
1322
- if (contextBlock) return `${prompt}\n\n${contextBlock}`;
1323
- return prompt;
1324
- }
1325
1187
  /**
1326
1188
  * Create a pre-configured GitHub agent powered by the AI SDK's `ToolLoopAgent`.
1327
1189
  *
@@ -1558,6 +1420,6 @@ function withStrippedRateLimit(tool) {
1558
1420
  };
1559
1421
  }
1560
1422
  //#endregion
1561
- export { deleteIssueComment as $, updateGist as A, getFileContent as At, addDiscussionComment as B, triggerWorkflow as C, updatePullRequest as Ct, getGist as D, createRepository as Dt, deleteGist as E, createOrUpdateFile as Et, searchCode as F, listCommentReactions as G, listDiscussions as H, searchIssues as I, addIssueComment as J, listIssueReactions as K, searchRepositories as L, getBlame as M, getRepositoryTree as Mt, getCommit as N, listBranches as Nt, listGistComments as O, deleteBranch as Ot, listCommits as P, createLabel as Q, listNotifications as R, rerunWorkflowRun as S, resolveReviewThread as St, createGistComment as T, createBranch as Tt, addCommentReaction as U, getDiscussion as V, addIssueReaction as W, closeIssue as X, addLabels as Y, createIssue as Z, getWorkflowJobLogs as _, listPullRequestReviews as _t, getIssueContext as a, removeAssignees as at, listWorkflowRuns as b, replyToReviewComment as bt, createRelease as c, updateIssueComment as ct, getRelease as d, createPullRequest as dt, deleteLabel as et, listReleases as f, createPullRequestReview as ft, cancelWorkflowRun as g, listPullRequestReviewThreads as gt, listCheckRuns as h, listPullRequestFiles as ht, getCiFailureContext as i, listLabels as it, compareCommits as j, getRepository as jt, listGists as k, forkRepository as kt, deleteRelease as l, updateLabel as lt, getCombinedStatus as m, getPullRequest as mt, createGithubAgent as n, listIssueComments as nt, getPullRequestContext as o, removeLabel as ot, updateRelease as p, deletePullRequestComment as pt, addAssignees as q, resolveInstructions as r, listIssues as rt, getReleaseContext as s, updateIssue as st, createGithubTools as t, getIssue as tt, getLatestRelease as u, addPullRequestComment as ut, getWorkflowRun as v, listPullRequests as vt, createGist as w, updatePullRequestComment as wt, listWorkflows as x, requestReviewers as xt, listWorkflowJobs as y, mergePullRequest as yt, markNotificationRead as z };
1423
+ export { deleteLabel as $, compareCommits as A, getRepository as At, getDiscussion as B, createGist as C, updatePullRequestComment as Ct, listGistComments as D, deleteBranch as Dt, getGist as E, createRepository as Et, searchIssues as F, listIssueReactions as G, addCommentReaction as H, searchRepositories as I, addLabels as J, addAssignees as K, listNotifications as L, getCommit as M, listBranches as Mt, listCommits as N, listGists as O, forkRepository as Ot, searchCode as P, deleteIssueComment as Q, markNotificationRead as R, triggerWorkflow as S, updatePullRequest as St, deleteGist as T, createOrUpdateFile as Tt, addIssueReaction as U, listDiscussions as V, listCommentReactions as W, createIssue as X, closeIssue as Y, createLabel as Z, getWorkflowRun as _, listPullRequests as _t, getPullRequestContext as a, removeLabel as at, listWorkflows as b, requestReviewers as bt, deleteRelease as c, updateLabel as ct, listReleases as d, createPullRequestReview as dt, getIssue as et, updateRelease as f, deletePullRequestComment as ft, getWorkflowJobLogs as g, listPullRequestReviews as gt, cancelWorkflowRun as h, listPullRequestReviewThreads as ht, getIssueContext as i, removeAssignees as it, getBlame as j, getRepositoryTree as jt, updateGist as k, getFileContent as kt, getLatestRelease as l, addPullRequestComment as lt, listCheckRuns as m, listPullRequestFiles as mt, createGithubAgent as n, listIssues as nt, getReleaseContext as o, updateIssue as ot, getCombinedStatus as p, getPullRequest as pt, addIssueComment as q, getCiFailureContext as r, listLabels as rt, createRelease as s, updateIssueComment as st, createGithubTools as t, listIssueComments as tt, getRelease as u, createPullRequest as ut, listWorkflowJobs as v, mergePullRequest as vt, createGistComment as w, createBranch as wt, rerunWorkflowRun as x, resolveReviewThread as xt, listWorkflowRuns as y, replyToReviewComment as yt, addDiscussionComment as z };
1562
1424
 
1563
- //# sourceMappingURL=src-SH7fl4eI.mjs.map
1425
+ //# sourceMappingURL=src-Bx5p1Unc.mjs.map