@github-tools/sdk 1.6.0 → 1.8.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 (39) hide show
  1. package/README.md +150 -10
  2. package/dist/connect/eve.d.mts +17 -0
  3. package/dist/connect/eve.d.mts.map +1 -0
  4. package/dist/connect/eve.mjs +27 -0
  5. package/dist/connect/eve.mjs.map +1 -0
  6. package/dist/connect.d.mts +46 -0
  7. package/dist/connect.d.mts.map +1 -0
  8. package/dist/connect.mjs +22 -0
  9. package/dist/connect.mjs.map +1 -0
  10. package/dist/eve-B-LChKzS.mjs +526 -0
  11. package/dist/eve-B-LChKzS.mjs.map +1 -0
  12. package/dist/eve.d.mts +125 -0
  13. package/dist/eve.d.mts.map +1 -0
  14. package/dist/eve.mjs +3 -0
  15. package/dist/index-SZCaP-y9.d.mts +220 -0
  16. package/dist/index-SZCaP-y9.d.mts.map +1 -0
  17. package/dist/index.d.mts +3 -2
  18. package/dist/index.mjs +3 -2
  19. package/dist/src-CfzZfU82.mjs +812 -0
  20. package/dist/src-CfzZfU82.mjs.map +1 -0
  21. package/dist/token-CW8lQBND.mjs +100 -0
  22. package/dist/token-CW8lQBND.mjs.map +1 -0
  23. package/dist/tool-types-C0kszIwd.d.mts +249 -0
  24. package/dist/tool-types-C0kszIwd.d.mts.map +1 -0
  25. package/dist/types-BTanS_dq.d.mts +49 -0
  26. package/dist/types-BTanS_dq.d.mts.map +1 -0
  27. package/dist/types-DOeq0Iia.d.mts +27 -0
  28. package/dist/types-DOeq0Iia.d.mts.map +1 -0
  29. package/dist/workflow.d.mts +53 -730
  30. package/dist/workflow.d.mts.map +1 -1
  31. package/dist/workflow.mjs +14 -74
  32. package/dist/workflow.mjs.map +1 -1
  33. package/dist/write-tools-Dx9LfYlU.mjs +1840 -0
  34. package/dist/write-tools-Dx9LfYlU.mjs.map +1 -0
  35. package/package.json +40 -8
  36. package/dist/index-ikP-LT-3.d.mts +0 -1634
  37. package/dist/index-ikP-LT-3.d.mts.map +0 -1
  38. package/dist/src--pAdGYqY.mjs +0 -1961
  39. package/dist/src--pAdGYqY.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"src-CfzZfU82.mjs","names":[],"sources":["../src/tools/repository.ts","../src/tools/pull-requests.ts","../src/tools/issues.ts","../src/tools/search.ts","../src/tools/commits.ts","../src/tools/gists.ts","../src/tools/workflows.ts","../src/core/approval.ts","../src/agents.ts","../src/index.ts"],"sourcesContent":["import { tool } from 'ai'\nimport {\n getRepositoryInputSchema,\n getRepositoryDescription,\n getRepositoryCore,\n listBranchesInputSchema,\n listBranchesDescription,\n listBranchesCore,\n getFileContentInputSchema,\n getFileContentDescription,\n getFileContentCore,\n createBranchInputSchema,\n createBranchDescription,\n createBranchCore,\n forkRepositoryInputSchema,\n forkRepositoryDescription,\n forkRepositoryCore,\n createRepositoryInputSchema,\n createRepositoryDescription,\n createRepositoryCore,\n createOrUpdateFileInputSchema,\n createOrUpdateFileDescription,\n createOrUpdateFileCore,\n composeCommitMessage,\n} from '../core/repository'\nimport { getFileContentToModelOutput } from '../core/model-output'\nimport { resolveGithubToken, type GithubTokenInput } from '../core/token'\nimport type { CommitToolOptions, ToolOptions, GithubTool } from '../types'\n\nexport { composeCommitMessage }\n\nasync function getRepositoryStep(args: Parameters<typeof getRepositoryCore>[0]) {\n \"use step\"\n return getRepositoryCore(args)\n}\n\n/** Get information about a GitHub repository including description, stars, forks, language, and default branch. */\nexport const getRepository = (token: GithubTokenInput): GithubTool =>\n tool({\n description: getRepositoryDescription,\n inputSchema: getRepositoryInputSchema,\n execute: async args => getRepositoryStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function listBranchesStep(args: Parameters<typeof listBranchesCore>[0]) {\n \"use step\"\n return listBranchesCore(args)\n}\n\n/** List branches in a GitHub repository. */\nexport const listBranches = (token: GithubTokenInput): GithubTool =>\n tool({\n description: listBranchesDescription,\n inputSchema: listBranchesInputSchema,\n execute: async args => listBranchesStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function getFileContentStep(args: Parameters<typeof getFileContentCore>[0]) {\n \"use step\"\n return getFileContentCore(args)\n}\n\n/** Get the content of a file from a GitHub repository. */\nexport const getFileContent = (token: GithubTokenInput): GithubTool =>\n tool({\n description: getFileContentDescription,\n inputSchema: getFileContentInputSchema,\n toModelOutput: getFileContentToModelOutput,\n execute: async args => getFileContentStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function createBranchStep(args: Parameters<typeof createBranchCore>[0]) {\n \"use step\"\n return createBranchCore(args)\n}\n\n/** Create a new branch in a GitHub repository from an existing branch or commit SHA. Requires approval by default. */\nexport const createBranch = (token: GithubTokenInput, { needsApproval = true }: ToolOptions = {}): GithubTool =>\n tool({\n description: createBranchDescription,\n needsApproval,\n inputSchema: createBranchInputSchema,\n execute: async args => createBranchStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function forkRepositoryStep(args: Parameters<typeof forkRepositoryCore>[0]) {\n \"use step\"\n return forkRepositoryCore(args)\n}\n\n/** Fork a GitHub repository to the authenticated user account or a specified organization. Requires approval by default. */\nexport const forkRepository = (token: GithubTokenInput, { needsApproval = true }: ToolOptions = {}): GithubTool =>\n tool({\n description: forkRepositoryDescription,\n needsApproval,\n inputSchema: forkRepositoryInputSchema,\n execute: async args => forkRepositoryStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function createRepositoryStep(args: Parameters<typeof createRepositoryCore>[0]) {\n \"use step\"\n return createRepositoryCore(args)\n}\n\n/** Create a new GitHub repository for the authenticated user or a specified organization. Requires approval by default. */\nexport const createRepository = (token: GithubTokenInput, { needsApproval = true }: ToolOptions = {}): GithubTool =>\n tool({\n description: createRepositoryDescription,\n needsApproval,\n inputSchema: createRepositoryInputSchema,\n execute: async args => createRepositoryStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function createOrUpdateFileStep(args: Parameters<typeof createOrUpdateFileCore>[0]) {\n \"use step\"\n return createOrUpdateFileCore(args)\n}\n\n/** Create or update a file in a GitHub repository. Provide the SHA when updating an existing file. Requires approval by default. */\nexport const createOrUpdateFile = (\n token: GithubTokenInput,\n { needsApproval = true, author, committer, coAuthors }: CommitToolOptions = {},\n): GithubTool =>\n tool({\n description: createOrUpdateFileDescription,\n needsApproval,\n inputSchema: createOrUpdateFileInputSchema,\n execute: async args => createOrUpdateFileStep({ token: await resolveGithubToken(token), author, committer, coAuthors, ...args }),\n })\n","import { tool } from 'ai'\nimport {\n listPullRequestsInputSchema,\n listPullRequestsDescription,\n listPullRequestsCore,\n getPullRequestInputSchema,\n getPullRequestDescription,\n getPullRequestCore,\n createPullRequestInputSchema,\n createPullRequestDescription,\n createPullRequestCore,\n mergePullRequestInputSchema,\n mergePullRequestDescription,\n mergePullRequestCore,\n addPullRequestCommentInputSchema,\n addPullRequestCommentDescription,\n addPullRequestCommentCore,\n listPullRequestFilesInputSchema,\n listPullRequestFilesDescription,\n listPullRequestFilesCore,\n listPullRequestReviewsInputSchema,\n listPullRequestReviewsDescription,\n listPullRequestReviewsCore,\n createPullRequestReviewInputSchema,\n createPullRequestReviewDescription,\n createPullRequestReviewCore,\n} from '../core/pull-requests'\nimport { listPullRequestFilesToModelOutput } from '../core/model-output'\nimport { resolveGithubToken, type GithubTokenInput } from '../core/token'\nimport type { CommitIdentity, ToolOptions, GithubTool } from '../types'\n\nexport type MergeToolOptions = ToolOptions & {\n coAuthors?: CommitIdentity[]\n}\n\nasync function listPullRequestsStep(args: Parameters<typeof listPullRequestsCore>[0]) {\n \"use step\"\n return listPullRequestsCore(args)\n}\n\n/** List pull requests for a GitHub repository. */\nexport const listPullRequests = (token: GithubTokenInput): GithubTool =>\n tool({\n description: listPullRequestsDescription,\n inputSchema: listPullRequestsInputSchema,\n execute: async args => listPullRequestsStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function getPullRequestStep(args: Parameters<typeof getPullRequestCore>[0]) {\n \"use step\"\n return getPullRequestCore(args)\n}\n\n/** Get detailed information about a specific pull request. */\nexport const getPullRequest = (token: GithubTokenInput): GithubTool =>\n tool({\n description: getPullRequestDescription,\n inputSchema: getPullRequestInputSchema,\n execute: async args => getPullRequestStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function createPullRequestStep(args: Parameters<typeof createPullRequestCore>[0]) {\n \"use step\"\n return createPullRequestCore(args)\n}\n\n/** Create a new pull request in a GitHub repository. Requires approval by default. */\nexport const createPullRequest = (token: GithubTokenInput, { needsApproval = true }: ToolOptions = {}): GithubTool =>\n tool({\n description: createPullRequestDescription,\n needsApproval,\n inputSchema: createPullRequestInputSchema,\n execute: async args => createPullRequestStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function mergePullRequestStep(args: Parameters<typeof mergePullRequestCore>[0]) {\n \"use step\"\n return mergePullRequestCore(args)\n}\n\n/** Merge a pull request. Requires approval by default. */\nexport const mergePullRequest = (token: GithubTokenInput, { needsApproval = true, coAuthors }: MergeToolOptions = {}): GithubTool =>\n tool({\n description: mergePullRequestDescription,\n needsApproval,\n inputSchema: mergePullRequestInputSchema,\n execute: async args => mergePullRequestStep({ token: await resolveGithubToken(token), coAuthors, ...args }),\n })\n\nasync function addPullRequestCommentStep(args: Parameters<typeof addPullRequestCommentCore>[0]) {\n \"use step\"\n return addPullRequestCommentCore(args)\n}\n\n/** Add a comment to a pull request. Requires approval by default. */\nexport const addPullRequestComment = (token: GithubTokenInput, { needsApproval = true }: ToolOptions = {}): GithubTool =>\n tool({\n description: addPullRequestCommentDescription,\n needsApproval,\n inputSchema: addPullRequestCommentInputSchema,\n execute: async args => addPullRequestCommentStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function listPullRequestFilesStep(args: Parameters<typeof listPullRequestFilesCore>[0]) {\n \"use step\"\n return listPullRequestFilesCore(args)\n}\n\n/** List files changed in a pull request, including diff status and patch content. */\nexport const listPullRequestFiles = (token: GithubTokenInput): GithubTool =>\n tool({\n description: listPullRequestFilesDescription,\n inputSchema: listPullRequestFilesInputSchema,\n toModelOutput: listPullRequestFilesToModelOutput,\n execute: async args => listPullRequestFilesStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function listPullRequestReviewsStep(args: Parameters<typeof listPullRequestReviewsCore>[0]) {\n \"use step\"\n return listPullRequestReviewsCore(args)\n}\n\n/** List reviews on a pull request (approvals, change requests, and comments). */\nexport const listPullRequestReviews = (token: GithubTokenInput): GithubTool =>\n tool({\n description: listPullRequestReviewsDescription,\n inputSchema: listPullRequestReviewsInputSchema,\n execute: async args => listPullRequestReviewsStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function createPullRequestReviewStep(args: Parameters<typeof createPullRequestReviewCore>[0]) {\n \"use step\"\n return createPullRequestReviewCore(args)\n}\n\n/** Submit a pull request review with optional inline comments. Requires approval by default. */\nexport const createPullRequestReview = (token: GithubTokenInput, { needsApproval = true }: ToolOptions = {}): GithubTool =>\n tool({\n description: createPullRequestReviewDescription,\n needsApproval,\n inputSchema: createPullRequestReviewInputSchema,\n execute: async args => createPullRequestReviewStep({ token: await resolveGithubToken(token), ...args }),\n })\n","import { tool } from 'ai'\nimport {\n listIssuesInputSchema,\n listIssuesDescription,\n listIssuesCore,\n getIssueInputSchema,\n getIssueDescription,\n getIssueCore,\n createIssueInputSchema,\n createIssueDescription,\n createIssueCore,\n addIssueCommentInputSchema,\n addIssueCommentDescription,\n addIssueCommentCore,\n closeIssueInputSchema,\n closeIssueDescription,\n closeIssueCore,\n listLabelsInputSchema,\n listLabelsDescription,\n listLabelsCore,\n addLabelsInputSchema,\n addLabelsDescription,\n addLabelsCore,\n removeLabelInputSchema,\n removeLabelDescription,\n removeLabelCore,\n} from '../core/issues'\nimport { resolveGithubToken, type GithubTokenInput } from '../core/token'\nimport type { ToolOptions, GithubTool } from '../types'\n\nasync function listIssuesStep(args: Parameters<typeof listIssuesCore>[0]) {\n \"use step\"\n return listIssuesCore(args)\n}\n\n/** List issues for a GitHub repository (excludes pull requests). */\nexport const listIssues = (token: GithubTokenInput): GithubTool =>\n tool({\n description: listIssuesDescription,\n inputSchema: listIssuesInputSchema,\n execute: async args => listIssuesStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function getIssueStep(args: Parameters<typeof getIssueCore>[0]) {\n \"use step\"\n return getIssueCore(args)\n}\n\n/** Get detailed information about a specific issue. */\nexport const getIssue = (token: GithubTokenInput): GithubTool =>\n tool({\n description: getIssueDescription,\n inputSchema: getIssueInputSchema,\n execute: async args => getIssueStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function createIssueStep(args: Parameters<typeof createIssueCore>[0]) {\n \"use step\"\n return createIssueCore(args)\n}\n\n/** Create a new issue in a GitHub repository. Requires approval by default. */\nexport const createIssue = (token: GithubTokenInput, { needsApproval = true }: ToolOptions = {}): GithubTool =>\n tool({\n description: createIssueDescription,\n needsApproval,\n inputSchema: createIssueInputSchema,\n execute: async args => createIssueStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function addIssueCommentStep(args: Parameters<typeof addIssueCommentCore>[0]) {\n \"use step\"\n return addIssueCommentCore(args)\n}\n\n/** Add a comment to a GitHub issue. Requires approval by default. */\nexport const addIssueComment = (token: GithubTokenInput, { needsApproval = true }: ToolOptions = {}): GithubTool =>\n tool({\n description: addIssueCommentDescription,\n needsApproval,\n inputSchema: addIssueCommentInputSchema,\n execute: async args => addIssueCommentStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function closeIssueStep(args: Parameters<typeof closeIssueCore>[0]) {\n \"use step\"\n return closeIssueCore(args)\n}\n\n/** Close an open GitHub issue. Requires approval by default. */\nexport const closeIssue = (token: GithubTokenInput, { needsApproval = true }: ToolOptions = {}): GithubTool =>\n tool({\n description: closeIssueDescription,\n needsApproval,\n inputSchema: closeIssueInputSchema,\n execute: async args => closeIssueStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function listLabelsStep(args: Parameters<typeof listLabelsCore>[0]) {\n \"use step\"\n return listLabelsCore(args)\n}\n\n/** List labels available in a GitHub repository. */\nexport const listLabels = (token: GithubTokenInput): GithubTool =>\n tool({\n description: listLabelsDescription,\n inputSchema: listLabelsInputSchema,\n execute: async args => listLabelsStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function addLabelsStep(args: Parameters<typeof addLabelsCore>[0]) {\n \"use step\"\n return addLabelsCore(args)\n}\n\n/** Add labels to an issue or pull request. Requires approval by default. */\nexport const addLabels = (token: GithubTokenInput, { needsApproval = true }: ToolOptions = {}): GithubTool =>\n tool({\n description: addLabelsDescription,\n needsApproval,\n inputSchema: addLabelsInputSchema,\n execute: async args => addLabelsStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function removeLabelStep(args: Parameters<typeof removeLabelCore>[0]) {\n \"use step\"\n return removeLabelCore(args)\n}\n\n/** Remove a label from an issue or pull request. Requires approval by default. */\nexport const removeLabel = (token: GithubTokenInput, { needsApproval = true }: ToolOptions = {}): GithubTool =>\n tool({\n description: removeLabelDescription,\n needsApproval,\n inputSchema: removeLabelInputSchema,\n execute: async args => removeLabelStep({ token: await resolveGithubToken(token), ...args }),\n })\n","import { tool } from 'ai'\nimport { resolveGithubToken, type GithubTokenInput } from '../core/token'\nimport type { GithubTool } from '../types'\nimport {\n searchCodeInputSchema,\n searchCodeDescription,\n searchCodeCore,\n searchRepositoriesInputSchema,\n searchRepositoriesDescription,\n searchRepositoriesCore,\n} from '../core/search'\n\nasync function searchCodeStep(args: Parameters<typeof searchCodeCore>[0]) {\n \"use step\"\n return searchCodeCore(args)\n}\n\n/** Search for code in GitHub repositories. Use qualifiers like \"repo:owner/name\" to scope the search. */\nexport const searchCode = (token: GithubTokenInput): GithubTool =>\n tool({\n description: searchCodeDescription,\n inputSchema: searchCodeInputSchema,\n execute: async args => searchCodeStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function searchRepositoriesStep(args: Parameters<typeof searchRepositoriesCore>[0]) {\n \"use step\"\n return searchRepositoriesCore(args)\n}\n\n/** Search for GitHub repositories by keyword, topic, language, or other qualifiers. */\nexport const searchRepositories = (token: GithubTokenInput): GithubTool =>\n tool({\n description: searchRepositoriesDescription,\n inputSchema: searchRepositoriesInputSchema,\n execute: async args => searchRepositoriesStep({ token: await resolveGithubToken(token), ...args }),\n })\n","import { tool } from 'ai'\nimport { resolveGithubToken, type GithubTokenInput } from '../core/token'\nimport type { GithubTool } from '../types'\nimport {\n listCommitsInputSchema,\n listCommitsDescription,\n listCommitsCore,\n getCommitInputSchema,\n getCommitDescription,\n getCommitCore,\n getBlameInputSchema,\n getBlameDescription,\n getBlameCore,\n} from '../core/commits'\nimport { getCommitToModelOutput } from '../core/model-output'\n\nasync function listCommitsStep(args: Parameters<typeof listCommitsCore>[0]) {\n \"use step\"\n return listCommitsCore(args)\n}\n\n/** List commits for a GitHub repository. Filter by file path to see commits that touched a file. */\nexport const listCommits = (token: GithubTokenInput): GithubTool =>\n tool({\n description: listCommitsDescription,\n inputSchema: listCommitsInputSchema,\n execute: async args => listCommitsStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function getCommitStep(args: Parameters<typeof getCommitCore>[0]) {\n \"use step\"\n return getCommitCore(args)\n}\n\n/** Get detailed information about a specific commit, including files changed with additions and deletions. */\nexport const getCommit = (token: GithubTokenInput): GithubTool =>\n tool({\n description: getCommitDescription,\n inputSchema: getCommitInputSchema,\n toModelOutput: getCommitToModelOutput,\n execute: async args => getCommitStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function getBlameStep(args: Parameters<typeof getBlameCore>[0]) {\n \"use step\"\n return getBlameCore(args)\n}\n\n/** Line-level git blame for a file at a commit-like ref (branch, tag, or SHA). */\nexport const getBlame = (token: GithubTokenInput): GithubTool =>\n tool({\n description: getBlameDescription,\n inputSchema: getBlameInputSchema,\n execute: async args => getBlameStep({ token: await resolveGithubToken(token), ...args }),\n })\n","import { tool } from 'ai'\nimport {\n listGistsInputSchema,\n listGistsDescription,\n listGistsCore,\n getGistInputSchema,\n getGistDescription,\n getGistCore,\n listGistCommentsInputSchema,\n listGistCommentsDescription,\n listGistCommentsCore,\n createGistInputSchema,\n createGistDescription,\n createGistCore,\n updateGistInputSchema,\n updateGistDescription,\n updateGistCore,\n deleteGistInputSchema,\n deleteGistDescription,\n deleteGistCore,\n createGistCommentInputSchema,\n createGistCommentDescription,\n createGistCommentCore,\n} from '../core/gists'\nimport { resolveGithubToken, type GithubTokenInput } from '../core/token'\nimport type { ToolOptions, GithubTool } from '../types'\n\nasync function listGistsStep(args: Parameters<typeof listGistsCore>[0]) {\n \"use step\"\n return listGistsCore(args)\n}\n\n/** List gists for the authenticated user or a specific user. */\nexport const listGists = (token: GithubTokenInput): GithubTool =>\n tool({\n description: listGistsDescription,\n inputSchema: listGistsInputSchema,\n execute: async args => listGistsStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function getGistStep(args: Parameters<typeof getGistCore>[0]) {\n \"use step\"\n return getGistCore(args)\n}\n\n/** Get a gist by ID, including file contents. */\nexport const getGist = (token: GithubTokenInput): GithubTool =>\n tool({\n description: getGistDescription,\n inputSchema: getGistInputSchema,\n execute: async args => getGistStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function listGistCommentsStep(args: Parameters<typeof listGistCommentsCore>[0]) {\n \"use step\"\n return listGistCommentsCore(args)\n}\n\n/** List comments on a gist. */\nexport const listGistComments = (token: GithubTokenInput): GithubTool =>\n tool({\n description: listGistCommentsDescription,\n inputSchema: listGistCommentsInputSchema,\n execute: async args => listGistCommentsStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function createGistStep(args: Parameters<typeof createGistCore>[0]) {\n \"use step\"\n return createGistCore(args)\n}\n\n/** Create a new gist with one or more files. Requires approval by default. */\nexport const createGist = (token: GithubTokenInput, { needsApproval = true }: ToolOptions = {}): GithubTool =>\n tool({\n description: createGistDescription,\n needsApproval,\n inputSchema: createGistInputSchema,\n execute: async args => createGistStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function updateGistStep(args: Parameters<typeof updateGistCore>[0]) {\n \"use step\"\n return updateGistCore(args)\n}\n\n/** Update an existing gist. Requires approval by default. */\nexport const updateGist = (token: GithubTokenInput, { needsApproval = true }: ToolOptions = {}): GithubTool =>\n tool({\n description: updateGistDescription,\n needsApproval,\n inputSchema: updateGistInputSchema,\n execute: async args => updateGistStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function deleteGistStep(args: Parameters<typeof deleteGistCore>[0]) {\n \"use step\"\n return deleteGistCore(args)\n}\n\n/** Delete a gist permanently. Requires approval by default. */\nexport const deleteGist = (token: GithubTokenInput, { needsApproval = true }: ToolOptions = {}): GithubTool =>\n tool({\n description: deleteGistDescription,\n needsApproval,\n inputSchema: deleteGistInputSchema,\n execute: async args => deleteGistStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function createGistCommentStep(args: Parameters<typeof createGistCommentCore>[0]) {\n \"use step\"\n return createGistCommentCore(args)\n}\n\n/** Add a comment to a gist. Requires approval by default. */\nexport const createGistComment = (token: GithubTokenInput, { needsApproval = true }: ToolOptions = {}): GithubTool =>\n tool({\n description: createGistCommentDescription,\n needsApproval,\n inputSchema: createGistCommentInputSchema,\n execute: async args => createGistCommentStep({ token: await resolveGithubToken(token), ...args }),\n })\n","import { tool } from 'ai'\nimport {\n listWorkflowsInputSchema,\n listWorkflowsDescription,\n listWorkflowsCore,\n listWorkflowRunsInputSchema,\n listWorkflowRunsDescription,\n listWorkflowRunsCore,\n getWorkflowRunInputSchema,\n getWorkflowRunDescription,\n getWorkflowRunCore,\n listWorkflowJobsInputSchema,\n listWorkflowJobsDescription,\n listWorkflowJobsCore,\n triggerWorkflowInputSchema,\n triggerWorkflowDescription,\n triggerWorkflowCore,\n cancelWorkflowRunInputSchema,\n cancelWorkflowRunDescription,\n cancelWorkflowRunCore,\n rerunWorkflowRunInputSchema,\n rerunWorkflowRunDescription,\n rerunWorkflowRunCore,\n} from '../core/workflows'\nimport { resolveGithubToken, type GithubTokenInput } from '../core/token'\nimport type { ToolOptions, GithubTool } from '../types'\n\nasync function listWorkflowsStep(args: Parameters<typeof listWorkflowsCore>[0]) {\n \"use step\"\n return listWorkflowsCore(args)\n}\n\n/** List GitHub Actions workflows in a repository. */\nexport const listWorkflows = (token: GithubTokenInput): GithubTool =>\n tool({\n description: listWorkflowsDescription,\n inputSchema: listWorkflowsInputSchema,\n execute: async args => listWorkflowsStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function listWorkflowRunsStep(args: Parameters<typeof listWorkflowRunsCore>[0]) {\n \"use step\"\n return listWorkflowRunsCore(args)\n}\n\n/** List workflow runs for a repository, optionally filtered by workflow, branch, status, or event. */\nexport const listWorkflowRuns = (token: GithubTokenInput): GithubTool =>\n tool({\n description: listWorkflowRunsDescription,\n inputSchema: listWorkflowRunsInputSchema,\n execute: async args => listWorkflowRunsStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function getWorkflowRunStep(args: Parameters<typeof getWorkflowRunCore>[0]) {\n \"use step\"\n return getWorkflowRunCore(args)\n}\n\n/** Get details of a specific workflow run including status, timing, and trigger info. */\nexport const getWorkflowRun = (token: GithubTokenInput): GithubTool =>\n tool({\n description: getWorkflowRunDescription,\n inputSchema: getWorkflowRunInputSchema,\n execute: async args => getWorkflowRunStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function listWorkflowJobsStep(args: Parameters<typeof listWorkflowJobsCore>[0]) {\n \"use step\"\n return listWorkflowJobsCore(args)\n}\n\n/** List jobs for a workflow run, including step-level status and timing. */\nexport const listWorkflowJobs = (token: GithubTokenInput): GithubTool =>\n tool({\n description: listWorkflowJobsDescription,\n inputSchema: listWorkflowJobsInputSchema,\n execute: async args => listWorkflowJobsStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function triggerWorkflowStep(args: Parameters<typeof triggerWorkflowCore>[0]) {\n \"use step\"\n return triggerWorkflowCore(args)\n}\n\n/** Trigger a workflow via workflow_dispatch event. Requires approval by default. */\nexport const triggerWorkflow = (token: GithubTokenInput, { needsApproval = true }: ToolOptions = {}): GithubTool =>\n tool({\n description: triggerWorkflowDescription,\n needsApproval,\n inputSchema: triggerWorkflowInputSchema,\n execute: async args => triggerWorkflowStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function cancelWorkflowRunStep(args: Parameters<typeof cancelWorkflowRunCore>[0]) {\n \"use step\"\n return cancelWorkflowRunCore(args)\n}\n\n/** Cancel an in-progress workflow run. Requires approval by default. */\nexport const cancelWorkflowRun = (token: GithubTokenInput, { needsApproval = true }: ToolOptions = {}): GithubTool =>\n tool({\n description: cancelWorkflowRunDescription,\n needsApproval,\n inputSchema: cancelWorkflowRunInputSchema,\n execute: async args => cancelWorkflowRunStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function rerunWorkflowRunStep(args: Parameters<typeof rerunWorkflowRunCore>[0]) {\n \"use step\"\n return rerunWorkflowRunCore(args)\n}\n\n/** Re-run a workflow run, optionally only the failed jobs. Requires approval by default. */\nexport const rerunWorkflowRun = (token: GithubTokenInput, { needsApproval = true }: ToolOptions = {}): GithubTool =>\n tool({\n description: rerunWorkflowRunDescription,\n needsApproval,\n inputSchema: rerunWorkflowRunInputSchema,\n execute: async args => rerunWorkflowRunStep({ token: await resolveGithubToken(token), ...args }),\n })\n","import type { GithubWriteToolName } from './write-tools'\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 * - object — per-tool override 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 Granular per write tool\n * ```ts\n * createGithubTools({\n * token,\n * requireApproval: {\n * mergePullRequest: true,\n * createOrUpdateFile: true,\n * addPullRequestComment: false,\n * },\n * })\n * ```\n */\nexport type ApprovalConfig = boolean | Partial<Record<GithubWriteToolName, boolean>>\n\n/**\n * Resolve whether a write tool requires approval for the AI SDK.\n *\n * @param toolName - The write tool to check.\n * @param config - Global or per-tool approval config.\n * @returns `true` when approval is required; defaults to `true` for unspecified write tools in object mode.\n */\nexport function resolveAiSdkApproval(toolName: GithubWriteToolName, config: ApprovalConfig): boolean {\n if (typeof config === 'boolean') return config\n return config[toolName] ?? true\n}\n","import { ToolLoopAgent } from 'ai'\nimport type { ToolLoopAgentSettings, ToolSet } from 'ai'\nimport { createGithubTools } from './index'\nimport type { AllGithubTools, GithubToolsBaseOptions } from './core/tool-types'\nimport type { CombinedPresetToolNames, GithubToolPreset, PresetToolName } from './core/presets'\nimport type { GithubToolName } from './core/tool-names'\n\nconst SHARED_RULES = `When a tool execution is denied by the user, do not retry it. Briefly acknowledge the decision and move on.`\n\nconst DEFAULT_INSTRUCTIONS = `You are a helpful GitHub assistant. You can read and explore repositories, issues, pull requests, commits, code, gists, and workflows. You can also create issues, pull requests, comments, gists, trigger workflows, and update files when asked.\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- Read the PR description and changed files carefully\n- To trace why a specific line exists or who last touched it, use getBlame on the file path and ref (branch or merge commit), then follow up with getCommit if you need the full patch\n- Check for bugs, logic errors, and edge cases\n- Suggest improvements when you spot issues\n- Be constructive — explain why something is a problem and how to fix it\n- Use listPullRequestFiles to see exactly which files changed before diving into details\n- Use createPullRequestReview to submit a formal review with inline comments on specific lines\n- Post your review as PR comments when asked\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- Read issue descriptions carefully to understand the problem\n- Identify duplicates when possible\n- Help categorize and prioritize issues\n- Respond to users with clear, helpful information\n- Use listLabels to see available labels, then addLabels and removeLabel to categorize issues\n- Create new issues when asked, with clear titles and descriptions\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- Check workflow run status and report failures clearly\n- Inspect job steps to identify exactly where a run failed\n- Re-run failed workflows when asked\n- Trigger workflow dispatches with the correct inputs and branch\n- Be careful with cancel and re-run operations — confirm the target run\n- Summarize run history and trends when asked\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 code structure and organization\n- Use getBlame when the user asks about history or ownership of specific lines in a file\n- Summarize recent activity (commits, PRs, issues)\n- Find specific files, functions, or patterns in code\n- Explain how different parts of the codebase work together\n- You have read-only access — you cannot make changes\n\n${SHARED_RULES}`,\n\n 'maintainer': `You are a repository maintainer assistant. You have full access to manage repositories, issues, pull requests, gists, and workflows.\n\nWhen maintaining repos:\n- Be careful with write operations — review before acting\n- Create well-structured issues and PRs with clear descriptions\n- Use merge strategies appropriate for the repository\n- Keep commit messages clean and descriptive\n- When closing issues, provide a clear reason\n\n${SHARED_RULES}`\n}\n\nexport function resolveInstructions(options: {\n preset?: GithubToolPreset | GithubToolPreset[]\n instructions?: string\n additionalInstructions?: string\n}): string {\n const defaultPrompt = options.preset && !Array.isArray(options.preset)\n ? PRESET_INSTRUCTIONS[options.preset]\n : DEFAULT_INSTRUCTIONS\n\n if (options.instructions) return options.instructions\n if (options.additionalInstructions) return `${defaultPrompt}\\n\\n${options.additionalInstructions}`\n return defaultPrompt\n}\n\ntype AgentOptions = Omit<ToolLoopAgentSettings<ToolSet>, 'model' | 'tools' | 'instructions'>\n\nexport type CreateGithubAgentOptions = AgentOptions & GithubToolsBaseOptions & {\n model: ToolLoopAgentSettings<ToolSet>['model']\n /**\n * Restrict tools and system prompt to a predefined preset.\n *\n * Selects a subset of tools and, when a single preset is passed,\n * sets a matching system prompt. Combine presets with an array to merge tool sets.\n *\n * @see {@link GithubToolPreset} for available presets and included tools.\n */\n preset?: GithubToolPreset | GithubToolPreset[]\n /**\n * Fully replace the default system prompt.\n * When set, `preset` system prompts and `additionalInstructions` are ignored.\n */\n instructions?: string\n /**\n * Append text to the preset-specific (or default) system prompt.\n * Ignored when `instructions` is set.\n */\n additionalInstructions?: string\n}\n\nexport function createGithubAgent(options: CreateGithubAgentOptions & { preset?: undefined }): ToolLoopAgent<never, AllGithubTools>\nexport function createGithubAgent<P extends GithubToolPreset>(\n options: CreateGithubAgentOptions & { preset: P },\n): ToolLoopAgent<never, Pick<AllGithubTools, PresetToolName<P>>>\nexport function createGithubAgent<P extends readonly GithubToolPreset[]>(\n options: CreateGithubAgentOptions & { preset: P },\n): ToolLoopAgent<never, Pick<AllGithubTools, CombinedPresetToolNames<P>>>\n\n/**\n * Create a pre-configured GitHub agent powered by the AI SDK's `ToolLoopAgent`.\n *\n * Returns a `ToolLoopAgent` instance with `.generate()` and `.stream()` methods.\n *\n * @example\n * ```ts\n * import { createGithubAgent } from '@github-tools/sdk'\n *\n * const agent = createGithubAgent({\n * model: 'anthropic/claude-sonnet-4.6',\n * token: process.env.GITHUB_TOKEN!,\n * preset: 'code-review',\n * })\n *\n * const result = await agent.generate({ prompt: 'Review PR #42 on vercel/ai' })\n * ```\n */\nexport function createGithubAgent({\n token,\n preset,\n requireApproval,\n instructions,\n additionalInstructions,\n author,\n committer,\n coAuthors,\n ...agentOptions\n}: CreateGithubAgentOptions): ToolLoopAgent<never, AllGithubTools | Pick<AllGithubTools, GithubToolName>> {\n const tools = createGithubTools({ token, requireApproval, preset, author, committer, coAuthors })\n\n return new ToolLoopAgent({\n ...agentOptions,\n tools,\n instructions: resolveInstructions({ preset, instructions, additionalInstructions }),\n } as ToolLoopAgentSettings<never, typeof tools>) as ToolLoopAgent<never, typeof tools>\n}\n","import type { ToolSet } from 'ai'\nimport { getRepository, listBranches, getFileContent, createBranch, forkRepository, createRepository, createOrUpdateFile } from './tools/repository'\nimport { listPullRequests, getPullRequest, createPullRequest, mergePullRequest, addPullRequestComment, listPullRequestFiles, listPullRequestReviews, createPullRequestReview } from './tools/pull-requests'\nimport { listIssues, getIssue, createIssue, addIssueComment, closeIssue, listLabels, addLabels, removeLabel } from './tools/issues'\nimport { searchCode, searchRepositories } from './tools/search'\nimport { listCommits, getCommit, getBlame } from './tools/commits'\nimport { listGists, getGist, listGistComments, createGist, updateGist, deleteGist, createGistComment } from './tools/gists'\nimport { listWorkflows, listWorkflowRuns, getWorkflowRun, listWorkflowJobs, triggerWorkflow, cancelWorkflowRun, rerunWorkflowRun } from './tools/workflows'\nimport { resolveAiSdkApproval } from './core/approval'\nimport { resolvePresetTools, type CombinedPresetToolNames, type GithubToolPreset, type PresetToolName } from './core/presets'\nimport { type GithubToolName } from './core/tool-names'\nimport { type AllGithubTools, type GithubToolsBaseOptions } from './core/tool-types'\nimport { createGithubTokenResolver } from './core/token'\nimport type { GithubWriteToolName } from './core/write-tools'\n\nexport type { GithubWriteToolName } from './core/write-tools'\nexport type { ApprovalConfig } from './core/approval'\nexport type { GithubToolPreset, PresetToolName, CombinedPresetToolNames } from './core/presets'\nexport type { GithubToolName } from './core/tool-names'\nexport type { AllGithubTools, GithubToolsForPreset, PickGithubTools } from './core/tool-types'\nexport { PRESET_TOOLS } from './core/presets'\nexport { GITHUB_TOOL_NAMES } from './core/tool-names'\nexport { GITHUB_WRITE_TOOLS } from './core/write-tools'\n\nexport type GithubToolsOptions = GithubToolsBaseOptions & {\n /**\n * Restrict the returned tools to a predefined preset.\n * Omit to get all tools.\n *\n * @see {@link GithubToolPreset} for available presets and included tools.\n *\n * @example\n * ```ts\n * // Only code-review tools\n * createGithubTools({ token, preset: 'code-review' })\n *\n * // Combine presets\n * createGithubTools({ token, preset: ['code-review', 'issue-triage'] })\n * ```\n */\n preset?: GithubToolPreset | GithubToolPreset[]\n}\n\nexport function createGithubTools(options?: GithubToolsBaseOptions & { preset?: undefined }): AllGithubTools\nexport function createGithubTools<P extends GithubToolPreset>(\n options: GithubToolsBaseOptions & { preset: P },\n): Pick<AllGithubTools, PresetToolName<P>>\nexport function createGithubTools<P extends readonly GithubToolPreset[]>(\n options: GithubToolsBaseOptions & { preset: P },\n): Pick<AllGithubTools, CombinedPresetToolNames<P>>\nexport function createGithubTools(options?: GithubToolsOptions): AllGithubTools | Pick<AllGithubTools, GithubToolName>\n/**\n * Create a set of GitHub tools for the Vercel AI SDK.\n *\n * Write operations require user approval by default.\n * Control this globally or per-tool via `requireApproval`.\n * Use `preset` to get only the tools you need.\n *\n * @example\n * ```ts\n * // All tools (default)\n * createGithubTools({ token })\n *\n * // Code-review agent — only PR & commit tools\n * createGithubTools({ token, preset: 'code-review' })\n *\n * // Combine presets\n * createGithubTools({ token, preset: ['code-review', 'issue-triage'] })\n *\n * // Granular approval\n * createGithubTools({\n * token,\n * preset: 'maintainer',\n * requireApproval: {\n * mergePullRequest: true,\n * createOrUpdateFile: true,\n * addPullRequestComment: false,\n * }\n * })\n * ```\n */\nexport function createGithubTools({\n token,\n requireApproval = true,\n preset,\n overrides,\n author,\n committer,\n coAuthors,\n}: GithubToolsOptions = {}): AllGithubTools | Pick<AllGithubTools, GithubToolName> {\n const resolveToken = createGithubTokenResolver(token)\n const approval = (name: GithubWriteToolName) => ({ needsApproval: resolveAiSdkApproval(name, requireApproval) })\n const allowed = preset ? resolvePresetTools(preset) : null\n\n const allTools = {\n getRepository: getRepository(resolveToken),\n listBranches: listBranches(resolveToken),\n getFileContent: getFileContent(resolveToken),\n listPullRequests: listPullRequests(resolveToken),\n getPullRequest: getPullRequest(resolveToken),\n listIssues: listIssues(resolveToken),\n getIssue: getIssue(resolveToken),\n searchCode: searchCode(resolveToken),\n searchRepositories: searchRepositories(resolveToken),\n listCommits: listCommits(resolveToken),\n getCommit: getCommit(resolveToken),\n getBlame: getBlame(resolveToken),\n createBranch: createBranch(resolveToken, approval('createBranch')),\n forkRepository: forkRepository(resolveToken, approval('forkRepository')),\n createRepository: createRepository(resolveToken, approval('createRepository')),\n createOrUpdateFile: createOrUpdateFile(resolveToken, { ...approval('createOrUpdateFile'), author, committer, coAuthors }),\n createPullRequest: createPullRequest(resolveToken, approval('createPullRequest')),\n mergePullRequest: mergePullRequest(resolveToken, { ...approval('mergePullRequest'), coAuthors }),\n addPullRequestComment: addPullRequestComment(resolveToken, approval('addPullRequestComment')),\n listPullRequestFiles: listPullRequestFiles(resolveToken),\n listPullRequestReviews: listPullRequestReviews(resolveToken),\n createPullRequestReview: createPullRequestReview(resolveToken, approval('createPullRequestReview')),\n createIssue: createIssue(resolveToken, approval('createIssue')),\n addIssueComment: addIssueComment(resolveToken, approval('addIssueComment')),\n closeIssue: closeIssue(resolveToken, approval('closeIssue')),\n listLabels: listLabels(resolveToken),\n addLabels: addLabels(resolveToken, approval('addLabels')),\n removeLabel: removeLabel(resolveToken, approval('removeLabel')),\n listGists: listGists(resolveToken),\n getGist: getGist(resolveToken),\n listGistComments: listGistComments(resolveToken),\n createGist: createGist(resolveToken, approval('createGist')),\n updateGist: updateGist(resolveToken, approval('updateGist')),\n deleteGist: deleteGist(resolveToken, approval('deleteGist')),\n createGistComment: createGistComment(resolveToken, approval('createGistComment')),\n listWorkflows: listWorkflows(resolveToken),\n listWorkflowRuns: listWorkflowRuns(resolveToken),\n getWorkflowRun: getWorkflowRun(resolveToken),\n listWorkflowJobs: listWorkflowJobs(resolveToken),\n triggerWorkflow: triggerWorkflow(resolveToken, approval('triggerWorkflow')),\n cancelWorkflowRun: cancelWorkflowRun(resolveToken, approval('cancelWorkflowRun')),\n rerunWorkflowRun: rerunWorkflowRun(resolveToken, approval('rerunWorkflowRun')),\n } satisfies AllGithubTools\n\n if (overrides) {\n for (const [name, toolOverrides] of Object.entries(overrides)) {\n if (name in allTools && toolOverrides) {\n const key = name as keyof typeof allTools\n Object.assign(allTools, { [key]: { ...allTools[key], ...toolOverrides } })\n }\n }\n }\n\n if (!allowed) return allTools\n\n return Object.fromEntries(\n Object.entries(allTools).filter(([name]) => allowed.has(name as GithubToolName))\n ) as Pick<typeof allTools, GithubToolName>\n}\n\nexport type GithubTools = AllGithubTools & ToolSet\n\n// Re-export individual tool factories for cherry-picking\nexport { createOctokit } from './client'\nexport { getRepository, listBranches, getFileContent, createBranch, forkRepository, createRepository, createOrUpdateFile } from './tools/repository'\nexport { listPullRequests, getPullRequest, createPullRequest, mergePullRequest, addPullRequestComment, listPullRequestFiles, listPullRequestReviews, createPullRequestReview } from './tools/pull-requests'\nexport { listIssues, getIssue, createIssue, addIssueComment, closeIssue, listLabels, addLabels, removeLabel } from './tools/issues'\nexport { searchCode, searchRepositories } from './tools/search'\nexport { listCommits, getCommit, getBlame } from './tools/commits'\nexport { listGists, getGist, listGistComments, createGist, updateGist, deleteGist, createGistComment } from './tools/gists'\nexport { listWorkflows, listWorkflowRuns, getWorkflowRun, listWorkflowJobs, triggerWorkflow, cancelWorkflowRun, rerunWorkflowRun } from './tools/workflows'\nexport type { CommitIdentity, CommitToolOptions, GithubTool, Octokit, ToolOptions, ToolOverrides } from './types'\nexport type { GithubTokenInput } from './core/token'\nexport { resolveGithubToken } from './core/token'\nexport { createGithubAgent } from './agents'\nexport type { CreateGithubAgentOptions } from './agents'\n"],"mappings":";;;AA+BA,eAAe,kBAAkB,MAA+C;AAC9E;AACA,QAAO,kBAAkB,KAAK;;;AAIhC,MAAa,iBAAiB,UAC5B,KAAK;CACH,aAAa;CACb,aAAa;CACb,SAAS,OAAM,SAAQ,kBAAkB;EAAE,OAAO,MAAM,mBAAmB,MAAM;EAAE,GAAG;EAAM,CAAC;CAC9F,CAAC;AAEJ,eAAe,iBAAiB,MAA8C;AAC5E;AACA,QAAO,iBAAiB,KAAK;;;AAI/B,MAAa,gBAAgB,UAC3B,KAAK;CACH,aAAa;CACb,aAAa;CACb,SAAS,OAAM,SAAQ,iBAAiB;EAAE,OAAO,MAAM,mBAAmB,MAAM;EAAE,GAAG;EAAM,CAAC;CAC7F,CAAC;AAEJ,eAAe,mBAAmB,MAAgD;AAChF;AACA,QAAO,mBAAmB,KAAK;;;AAIjC,MAAa,kBAAkB,UAC7B,KAAK;CACH,aAAa;CACb,aAAa;CACb,eAAe;CACf,SAAS,OAAM,SAAQ,mBAAmB;EAAE,OAAO,MA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,CAAC;;;AAKhF,KAAI,CAAC,QAAS,QAAO;AAErB,QAAO,OAAO,YACZ,OAAO,QAAQ,SAAS,CAAC,QAAQ,CAAC,UAAU,QAAQ,IAAI,KAAuB,CAAC,CACjF"}
@@ -0,0 +1,100 @@
1
+ import { getToken } from "@vercel/connect";
2
+ //#region src/connect/scopes.ts
3
+ /**
4
+ * Vercel Connect scope strings mapped to each {@link GithubToolPreset}.
5
+ *
6
+ * Scopes mirror GitHub App permissions (`contents`, `pull_requests`, `issues`,
7
+ * `actions`, `administration`, `metadata`) and must cover every read/write
8
+ * family a preset's tools touch, not just its primary domain.
9
+ *
10
+ * Gist tools in `repo-explorer` and `maintainer` are intentionally left
11
+ * unscoped: the Gists API only accepts GitHub App *user* access tokens, never
12
+ * installation tokens, and Connect always mints `subject: { type: 'app' }`
13
+ * installation tokens. Gist calls made with a Connect-derived token 403
14
+ * regardless of requested scopes — use a fine-grained PAT with the "Gists"
15
+ * account permission for those tools instead.
16
+ */
17
+ const PRESET_CONNECT_SCOPES = {
18
+ "repo-explorer": [
19
+ "contents:read",
20
+ "metadata:read",
21
+ "pull_requests:read",
22
+ "issues:read",
23
+ "actions:read"
24
+ ],
25
+ "code-review": [
26
+ "contents:read",
27
+ "metadata:read",
28
+ "pull_requests:read",
29
+ "pull_requests:write"
30
+ ],
31
+ "issue-triage": [
32
+ "contents:read",
33
+ "metadata:read",
34
+ "issues:read",
35
+ "issues:write"
36
+ ],
37
+ "ci-ops": [
38
+ "contents:read",
39
+ "metadata:read",
40
+ "actions:read",
41
+ "actions:write"
42
+ ],
43
+ "maintainer": [
44
+ "contents:read",
45
+ "contents:write",
46
+ "metadata:read",
47
+ "pull_requests:read",
48
+ "pull_requests:write",
49
+ "issues:read",
50
+ "issues:write",
51
+ "actions:read",
52
+ "actions:write",
53
+ "administration:read",
54
+ "administration:write"
55
+ ]
56
+ };
57
+ /** Default scopes when no preset is specified — union of all preset scopes. */
58
+ const ALL_CONNECT_SCOPES = [...new Set(Object.values(PRESET_CONNECT_SCOPES).flat())];
59
+ /**
60
+ * Returns Vercel Connect scopes for a preset or combined presets.
61
+ * Without a preset, returns the union of all preset scopes (full tool set).
62
+ */
63
+ function connectGithubScopesForPreset(preset) {
64
+ if (!preset) return [...ALL_CONNECT_SCOPES];
65
+ return [...new Set((Array.isArray(preset) ? preset : [preset]).flatMap((p) => PRESET_CONNECT_SCOPES[p]))];
66
+ }
67
+ //#endregion
68
+ //#region src/connect/params.ts
69
+ function resolveGithubConnectTokenParams(options = {}) {
70
+ const { preset, params } = options;
71
+ return buildConnectTokenParams(params?.scopes ?? connectGithubScopesForPreset(preset), params);
72
+ }
73
+ function buildConnectTokenParams(scopes, params) {
74
+ const { repositories, ...rest } = params ?? {};
75
+ const authorizationDetails = rest.authorizationDetails ?? (repositories?.length ? [{
76
+ type: "github_app_installation",
77
+ repositories
78
+ }] : void 0);
79
+ return {
80
+ subject: { type: "app" },
81
+ ...rest,
82
+ scopes,
83
+ ...authorizationDetails && { authorizationDetails }
84
+ };
85
+ }
86
+ //#endregion
87
+ //#region src/connect/token.ts
88
+ /**
89
+ * Returns a lazy GitHub token provider backed by a Vercel Connect connector.
90
+ * Scopes are derived from `preset` unless overridden in `params.scopes`.
91
+ */
92
+ function connectGithubToken(connector, options = {}) {
93
+ const { connectOptions } = options;
94
+ const tokenParams = resolveGithubConnectTokenParams(options);
95
+ return () => getToken(connector, tokenParams, connectOptions);
96
+ }
97
+ //#endregion
98
+ export { PRESET_CONNECT_SCOPES as n, connectGithubScopesForPreset as r, connectGithubToken as t };
99
+
100
+ //# sourceMappingURL=token-CW8lQBND.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-CW8lQBND.mjs","names":[],"sources":["../src/connect/scopes.ts","../src/connect/params.ts","../src/connect/token.ts"],"sourcesContent":["import type { GithubToolPreset } from '../core/presets'\n\n/**\n * Vercel Connect scope strings mapped to each {@link GithubToolPreset}.\n *\n * Scopes mirror GitHub App permissions (`contents`, `pull_requests`, `issues`,\n * `actions`, `administration`, `metadata`) and must cover every read/write\n * family a preset's tools touch, not just its primary domain.\n *\n * Gist tools in `repo-explorer` and `maintainer` are intentionally left\n * unscoped: the Gists API only accepts GitHub App *user* access tokens, never\n * installation tokens, and Connect always mints `subject: { type: 'app' }`\n * installation tokens. Gist calls made with a Connect-derived token 403\n * regardless of requested scopes — use a fine-grained PAT with the \"Gists\"\n * account permission for those tools instead.\n */\nexport const PRESET_CONNECT_SCOPES = {\n 'repo-explorer': [\n 'contents:read',\n 'metadata:read',\n 'pull_requests:read',\n 'issues:read',\n 'actions:read',\n ],\n 'code-review': [\n 'contents:read',\n 'metadata:read',\n 'pull_requests:read',\n 'pull_requests:write',\n ],\n 'issue-triage': [\n 'contents:read',\n 'metadata:read',\n 'issues:read',\n 'issues:write',\n ],\n 'ci-ops': [\n 'contents:read',\n 'metadata:read',\n 'actions:read',\n 'actions:write',\n ],\n 'maintainer': [\n 'contents:read',\n 'contents:write',\n 'metadata:read',\n 'pull_requests:read',\n 'pull_requests:write',\n 'issues:read',\n 'issues:write',\n 'actions:read',\n 'actions:write',\n 'administration:read',\n 'administration:write',\n ],\n} as const satisfies Record<GithubToolPreset, readonly string[]>\n\n/** Default scopes when no preset is specified — union of all preset scopes. */\nconst ALL_CONNECT_SCOPES = [\n ...new Set(Object.values(PRESET_CONNECT_SCOPES).flat()),\n] as string[]\n\n/**\n * Returns Vercel Connect scopes for a preset or combined presets.\n * Without a preset, returns the union of all preset scopes (full tool set).\n */\nexport function connectGithubScopesForPreset(\n preset?: GithubToolPreset | GithubToolPreset[],\n): string[] {\n if (!preset) return [...ALL_CONNECT_SCOPES]\n\n const presets = Array.isArray(preset) ? preset : [preset]\n return [\n ...new Set(presets.flatMap(p => PRESET_CONNECT_SCOPES[p])),\n ]\n}\n","import type { ConnectTokenParams } from '@vercel/connect'\nimport { connectGithubScopesForPreset } from './scopes'\nimport type { ConnectGithubTokenOptions, GithubConnectParams } from './types'\n\nexport function resolveGithubConnectTokenParams(\n options: ConnectGithubTokenOptions = {},\n): ConnectTokenParams {\n const { preset, params } = options\n const scopes = params?.scopes ?? connectGithubScopesForPreset(preset)\n return buildConnectTokenParams(scopes, params)\n}\n\nfunction buildConnectTokenParams(\n scopes: string[],\n params?: GithubConnectParams,\n): ConnectTokenParams {\n const { repositories, ...rest } = params ?? {}\n\n const authorizationDetails = rest.authorizationDetails\n ?? (repositories?.length\n ? [{ type: 'github_app_installation' as const, repositories }]\n : undefined)\n\n return {\n subject: { type: 'app' },\n ...rest,\n scopes,\n ...(authorizationDetails && { authorizationDetails }),\n }\n}\n","import { getToken, type ConnectOptions } from '@vercel/connect'\nimport type { GithubTokenInput } from '../core/token'\nimport { resolveGithubConnectTokenParams } from './params'\nimport type { ConnectGithubTokenOptions } from './types'\n\n/**\n * Returns a lazy GitHub token provider backed by a Vercel Connect connector.\n * Scopes are derived from `preset` unless overridden in `params.scopes`.\n */\nexport function connectGithubToken(\n connector: string,\n options: ConnectGithubTokenOptions = {},\n): GithubTokenInput {\n const { connectOptions } = options\n const tokenParams = resolveGithubConnectTokenParams(options)\n\n return () => getToken(connector, tokenParams, connectOptions)\n}\n\nexport type { ConnectOptions }\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,MAAa,wBAAwB;CACnC,iBAAiB;EACf;EACA;EACA;EACA;EACA;EACD;CACD,eAAe;EACb;EACA;EACA;EACA;EACD;CACD,gBAAgB;EACd;EACA;EACA;EACA;EACD;CACD,UAAU;EACR;EACA;EACA;EACA;EACD;CACD,cAAc;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD;CACF;;AAGD,MAAM,qBAAqB,CACzB,GAAG,IAAI,IAAI,OAAO,OAAO,sBAAsB,CAAC,MAAM,CAAC,CACxD;;;;;AAMD,SAAgB,6BACd,QACU;AACV,KAAI,CAAC,OAAQ,QAAO,CAAC,GAAG,mBAAmB;AAG3C,QAAO,CACL,GAAG,IAAI,KAFO,MAAM,QAAQ,OAAO,GAAG,SAAS,CAAC,OAAO,EAEpC,SAAQ,MAAK,sBAAsB,GAAG,CAAC,CAC3D;;;;ACtEH,SAAgB,gCACd,UAAqC,EAAE,EACnB;CACpB,MAAM,EAAE,QAAQ,WAAW;AAE3B,QAAO,wBADQ,QAAQ,UAAU,6BAA6B,OAAO,EAC9B,OAAO;;AAGhD,SAAS,wBACP,QACA,QACoB;CACpB,MAAM,EAAE,cAAc,GAAG,SAAS,UAAU,EAAE;CAE9C,MAAM,uBAAuB,KAAK,yBAC5B,cAAc,SACd,CAAC;EAAE,MAAM;EAAoC;EAAc,CAAC,GAC5D,KAAA;AAEN,QAAO;EACL,SAAS,EAAE,MAAM,OAAO;EACxB,GAAG;EACH;EACA,GAAI,wBAAwB,EAAE,sBAAsB;EACrD;;;;;;;;ACnBH,SAAgB,mBACd,WACA,UAAqC,EAAE,EACrB;CAClB,MAAM,EAAE,mBAAmB;CAC3B,MAAM,cAAc,gCAAgC,QAAQ;AAE5D,cAAa,SAAS,WAAW,aAAa,eAAe"}
@@ -0,0 +1,249 @@
1
+ import { Tool } from "ai";
2
+ import { Octokit as Octokit$1 } from "octokit";
3
+
4
+ //#region src/core/tool-names.d.ts
5
+ /**
6
+ * All GitHub tool names available via {@link createGithubTools}.
7
+ * Each key maps to its own string literal for IDE autocomplete and hover docs.
8
+ */
9
+ declare const GITHUB_TOOL_NAMES: {
10
+ /** Get information about a GitHub repository including description, stars, forks, language, and default branch. */readonly getRepository: "getRepository"; /** List branches in a GitHub repository. */
11
+ readonly listBranches: "listBranches"; /** Get the content of a file from a GitHub repository. */
12
+ readonly getFileContent: "getFileContent"; /** Create a new branch in a GitHub repository from an existing branch or commit SHA. Requires approval by default. */
13
+ readonly createBranch: "createBranch"; /** Fork a GitHub repository to the authenticated user account or a specified organization. Requires approval by default. */
14
+ readonly forkRepository: "forkRepository"; /** Create a new GitHub repository for the authenticated user or a specified organization. Requires approval by default. */
15
+ readonly createRepository: "createRepository"; /** Create or update a file in a GitHub repository. Provide the SHA when updating an existing file. Requires approval by default. */
16
+ readonly createOrUpdateFile: "createOrUpdateFile"; /** List pull requests for a GitHub repository. */
17
+ readonly listPullRequests: "listPullRequests"; /** Get detailed information about a specific pull request. */
18
+ readonly getPullRequest: "getPullRequest"; /** Create a new pull request in a GitHub repository. Requires approval by default. */
19
+ readonly createPullRequest: "createPullRequest"; /** Merge a pull request. Requires approval by default. */
20
+ readonly mergePullRequest: "mergePullRequest"; /** Add a comment to a pull request. Requires approval by default. */
21
+ readonly addPullRequestComment: "addPullRequestComment"; /** List files changed in a pull request, including diff status and patch content. */
22
+ readonly listPullRequestFiles: "listPullRequestFiles"; /** List reviews on a pull request (approvals, change requests, and comments). */
23
+ readonly listPullRequestReviews: "listPullRequestReviews"; /** Submit a pull request review — approve, request changes, or comment with optional inline comments on specific lines. Requires approval by default. */
24
+ readonly createPullRequestReview: "createPullRequestReview"; /** List issues for a GitHub repository (excludes pull requests). */
25
+ readonly listIssues: "listIssues"; /** Get detailed information about a specific issue. */
26
+ readonly getIssue: "getIssue"; /** Create a new issue in a GitHub repository. Requires approval by default. */
27
+ readonly createIssue: "createIssue"; /** Add a comment to a GitHub issue. Requires approval by default. */
28
+ readonly addIssueComment: "addIssueComment"; /** Close an open GitHub issue. Requires approval by default. */
29
+ readonly closeIssue: "closeIssue"; /** List labels available in a GitHub repository. */
30
+ readonly listLabels: "listLabels"; /** Add labels to an issue or pull request. Requires approval by default. */
31
+ readonly addLabels: "addLabels"; /** Remove a label from an issue or pull request. Requires approval by default. */
32
+ readonly removeLabel: "removeLabel"; /** Search for code in GitHub repositories. Use qualifiers like "repo:owner/name" to scope the search. */
33
+ readonly searchCode: "searchCode"; /** Search for GitHub repositories by keyword, topic, language, or other qualifiers. */
34
+ readonly searchRepositories: "searchRepositories"; /** List commits for a GitHub repository. Filter by file path to see commits that touched a file. For line-by-line attribution at a given ref, use getBlame instead. */
35
+ readonly listCommits: "listCommits"; /** Get detailed information about a specific commit, including the list of files changed with additions and deletions. */
36
+ readonly getCommit: "getCommit"; /** Line-level git blame for a file at a commit-like ref (branch, tag, or SHA). Returns contiguous ranges mapping lines to the commits that last modified them. */
37
+ readonly getBlame: "getBlame"; /** List gists for the authenticated user or a specific user. */
38
+ readonly listGists: "listGists"; /** Get a gist by ID, including file contents. */
39
+ readonly getGist: "getGist"; /** List comments on a gist. */
40
+ readonly listGistComments: "listGistComments"; /** Create a new gist with one or more files. Requires approval by default. */
41
+ readonly createGist: "createGist"; /** Update an existing gist — edit description, update files, or remove files. Requires approval by default. */
42
+ readonly updateGist: "updateGist"; /** Delete a gist permanently. Requires approval by default. */
43
+ readonly deleteGist: "deleteGist"; /** Add a comment to a gist. Requires approval by default. */
44
+ readonly createGistComment: "createGistComment"; /** List GitHub Actions workflows in a repository. */
45
+ readonly listWorkflows: "listWorkflows"; /** List workflow runs for a repository, optionally filtered by workflow, branch, status, or event. */
46
+ readonly listWorkflowRuns: "listWorkflowRuns"; /** Get details of a specific workflow run including status, timing, and trigger info. */
47
+ readonly getWorkflowRun: "getWorkflowRun"; /** List jobs for a workflow run, including step-level status and timing. */
48
+ readonly listWorkflowJobs: "listWorkflowJobs"; /** Trigger a workflow via workflow_dispatch event. Requires approval by default. */
49
+ readonly triggerWorkflow: "triggerWorkflow"; /** Cancel an in-progress workflow run. Requires approval by default. */
50
+ readonly cancelWorkflowRun: "cancelWorkflowRun"; /** Re-run a workflow run, optionally only the failed jobs. Requires approval by default. */
51
+ readonly rerunWorkflowRun: "rerunWorkflowRun";
52
+ };
53
+ type GithubToolName = typeof GITHUB_TOOL_NAMES[keyof typeof GITHUB_TOOL_NAMES];
54
+ //#endregion
55
+ //#region src/core/presets.d.ts
56
+ /**
57
+ * Predefined tool presets for common use cases.
58
+ * Pass to {@link createGithubTools}, {@link createGithubAgent}, or {@link createDurableGithubAgent}.
59
+ * Presets can be combined by passing an array.
60
+ */
61
+ declare const PRESET_TOOLS: {
62
+ /**
63
+ * **Code review** — review pull requests and submit feedback.
64
+ *
65
+ * Tools: `getPullRequest`, `listPullRequests`, `listPullRequestFiles`, `listPullRequestReviews`,
66
+ * `getFileContent`, `listCommits`, `getCommit`, `getBlame`, `getRepository`, `listBranches`,
67
+ * `searchCode`, `addPullRequestComment`, `createPullRequestReview`.
68
+ *
69
+ * Agent prompt: optimized for thorough PR review with inline feedback.
70
+ */
71
+ readonly 'code-review': readonly ["getPullRequest", "listPullRequests", "listPullRequestFiles", "listPullRequestReviews", "getFileContent", "listCommits", "getCommit", "getBlame", "getRepository", "listBranches", "searchCode", "addPullRequestComment", "createPullRequestReview"];
72
+ /**
73
+ * **Issue triage** — manage and organize GitHub issues.
74
+ *
75
+ * Tools: `listIssues`, `getIssue`, `createIssue`, `addIssueComment`, `closeIssue`,
76
+ * `listLabels`, `addLabels`, `removeLabel`, `getRepository`, `searchRepositories`, `searchCode`.
77
+ *
78
+ * Agent prompt: optimized for categorizing, labeling, and responding to issues.
79
+ */
80
+ readonly 'issue-triage': readonly ["listIssues", "getIssue", "createIssue", "addIssueComment", "closeIssue", "listLabels", "addLabels", "removeLabel", "getRepository", "searchRepositories", "searchCode"];
81
+ /**
82
+ * **CI operations** — monitor and manage GitHub Actions workflows.
83
+ *
84
+ * Tools: `getRepository`, `listBranches`, `listCommits`, `getCommit`,
85
+ * `listWorkflows`, `listWorkflowRuns`, `getWorkflowRun`, `listWorkflowJobs`,
86
+ * `triggerWorkflow`, `cancelWorkflowRun`, `rerunWorkflowRun`.
87
+ *
88
+ * Agent prompt: optimized for diagnosing CI failures and managing workflow runs.
89
+ */
90
+ readonly 'ci-ops': readonly ["getRepository", "listBranches", "listCommits", "getCommit", "listWorkflows", "listWorkflowRuns", "getWorkflowRun", "listWorkflowJobs", "triggerWorkflow", "cancelWorkflowRun", "rerunWorkflowRun"];
91
+ /**
92
+ * **Repository explorer** — read-only access to browse codebases.
93
+ *
94
+ * Tools: all read-only tools including repos, branches, PRs, issues, commits, blame,
95
+ * search, gists, and workflows. No write operations.
96
+ *
97
+ * Agent prompt: optimized for answering questions about code structure and history.
98
+ */
99
+ readonly 'repo-explorer': readonly ["getRepository", "listBranches", "getFileContent", "listPullRequests", "getPullRequest", "listPullRequestFiles", "listPullRequestReviews", "listIssues", "getIssue", "listLabels", "listCommits", "getCommit", "getBlame", "searchCode", "searchRepositories", "listGists", "getGist", "listGistComments", "listWorkflows", "listWorkflowRuns", "getWorkflowRun", "listWorkflowJobs"];
100
+ /**
101
+ * **Maintainer** — full repository maintenance with all read and write tools.
102
+ *
103
+ * Tools: all 42 tools (same as omitting `preset`).
104
+ *
105
+ * Agent prompt: optimized for day-to-day repo maintenance with careful write operations.
106
+ */
107
+ readonly maintainer: readonly ["getRepository", "listBranches", "getFileContent", "createBranch", "forkRepository", "createRepository", "createOrUpdateFile", "listPullRequests", "getPullRequest", "listPullRequestFiles", "listPullRequestReviews", "createPullRequest", "mergePullRequest", "addPullRequestComment", "createPullRequestReview", "listIssues", "getIssue", "createIssue", "addIssueComment", "closeIssue", "listLabels", "addLabels", "removeLabel", "listCommits", "getCommit", "getBlame", "searchCode", "searchRepositories", "listGists", "getGist", "listGistComments", "createGist", "updateGist", "deleteGist", "createGistComment", "listWorkflows", "listWorkflowRuns", "getWorkflowRun", "listWorkflowJobs", "triggerWorkflow", "cancelWorkflowRun", "rerunWorkflowRun"];
108
+ };
109
+ type GithubToolPreset = keyof typeof PRESET_TOOLS;
110
+ /** Tool names included in a single preset. */
111
+ type PresetToolName<P extends GithubToolPreset> = Extract<(typeof PRESET_TOOLS)[P][number], GithubToolName>;
112
+ /** Tool names included when combining multiple presets. */
113
+ type CombinedPresetToolNames<P extends readonly GithubToolPreset[]> = PresetToolName<P[number]>;
114
+ //#endregion
115
+ //#region src/core/write-tools.d.ts
116
+ /**
117
+ * Write tools that mutate GitHub state. All require user approval by default
118
+ * unless overridden via {@link ApprovalConfig}.
119
+ */
120
+ declare const GITHUB_WRITE_TOOLS: {
121
+ /** Create a new branch in a GitHub repository from an existing branch or commit SHA. Requires approval by default. */readonly createBranch: "createBranch"; /** Fork a GitHub repository to the authenticated user account or a specified organization. Requires approval by default. */
122
+ readonly forkRepository: "forkRepository"; /** Create a new GitHub repository for the authenticated user or a specified organization. Requires approval by default. */
123
+ readonly createRepository: "createRepository"; /** Create or update a file in a GitHub repository. Requires approval by default. */
124
+ readonly createOrUpdateFile: "createOrUpdateFile"; /** Create a new pull request in a GitHub repository. Requires approval by default. */
125
+ readonly createPullRequest: "createPullRequest"; /** Merge a pull request. Requires approval by default. */
126
+ readonly mergePullRequest: "mergePullRequest"; /** Add a comment to a pull request. Requires approval by default. */
127
+ readonly addPullRequestComment: "addPullRequestComment"; /** Submit a pull request review with optional inline comments. Requires approval by default. */
128
+ readonly createPullRequestReview: "createPullRequestReview"; /** Create a new issue in a GitHub repository. Requires approval by default. */
129
+ readonly createIssue: "createIssue"; /** Add a comment to a GitHub issue. Requires approval by default. */
130
+ readonly addIssueComment: "addIssueComment"; /** Close an open GitHub issue. Requires approval by default. */
131
+ readonly closeIssue: "closeIssue"; /** Add labels to an issue or pull request. Requires approval by default. */
132
+ readonly addLabels: "addLabels"; /** Remove a label from an issue or pull request. Requires approval by default. */
133
+ readonly removeLabel: "removeLabel"; /** Create a new gist with one or more files. Requires approval by default. */
134
+ readonly createGist: "createGist"; /** Update an existing gist. Requires approval by default. */
135
+ readonly updateGist: "updateGist"; /** Delete a gist permanently. Requires approval by default. */
136
+ readonly deleteGist: "deleteGist"; /** Add a comment to a gist. Requires approval by default. */
137
+ readonly createGistComment: "createGistComment"; /** Trigger a workflow via workflow_dispatch event. Requires approval by default. */
138
+ readonly triggerWorkflow: "triggerWorkflow"; /** Cancel an in-progress workflow run. Requires approval by default. */
139
+ readonly cancelWorkflowRun: "cancelWorkflowRun"; /** Re-run a workflow run, optionally only the failed jobs. Requires approval by default. */
140
+ readonly rerunWorkflowRun: "rerunWorkflowRun";
141
+ };
142
+ type GithubWriteToolName = typeof GITHUB_WRITE_TOOLS[keyof typeof GITHUB_WRITE_TOOLS];
143
+ //#endregion
144
+ //#region src/core/approval.d.ts
145
+ /**
146
+ * Whether write operations require user approval.
147
+ *
148
+ * - `true` — all write tools need approval (default)
149
+ * - `false` — no approval needed for any write tool
150
+ * - object — per-tool override via {@link GithubWriteToolName}; unspecified write tools default to `true`
151
+ *
152
+ * @example Global disable
153
+ * ```ts
154
+ * createGithubTools({ token, requireApproval: false })
155
+ * ```
156
+ *
157
+ * @example Granular per write tool
158
+ * ```ts
159
+ * createGithubTools({
160
+ * token,
161
+ * requireApproval: {
162
+ * mergePullRequest: true,
163
+ * createOrUpdateFile: true,
164
+ * addPullRequestComment: false,
165
+ * },
166
+ * })
167
+ * ```
168
+ */
169
+ type ApprovalConfig = boolean | Partial<Record<GithubWriteToolName, boolean>>;
170
+ //#endregion
171
+ //#region src/core/token.d.ts
172
+ type GithubTokenInput = string | (() => Promise<string>);
173
+ /** Resolves a {@link GithubTokenInput} to a token string. */
174
+ declare function resolveGithubToken(token?: GithubTokenInput): Promise<string>;
175
+ //#endregion
176
+ //#region src/types.d.ts
177
+ type GithubTool = Tool<any, any>;
178
+ type ToolOptions = {
179
+ needsApproval?: boolean;
180
+ };
181
+ /**
182
+ * Identity for a commit author or committer on GitHub.
183
+ *
184
+ * - **Author** — the person who originally wrote the code patch.
185
+ * - **Committer** — the person who applied the commit to the repository.
186
+ */
187
+ type CommitIdentity = {
188
+ name: string;
189
+ email: string;
190
+ };
191
+ /**
192
+ * Options for commit-creating tools (`createOrUpdateFile`, `mergePullRequest`).
193
+ */
194
+ type CommitToolOptions = ToolOptions & {
195
+ /**
196
+ * The author of the commit — the person who wrote the code patch.
197
+ * Falls back to the authenticated user when omitted.
198
+ */
199
+ author?: CommitIdentity;
200
+ /**
201
+ * The committer of the commit — the person who applied the commit.
202
+ * Falls back to the authenticated user when omitted.
203
+ */
204
+ committer?: CommitIdentity;
205
+ /**
206
+ * Co-authors to attribute on commits.
207
+ * Added as "Co-authored-by" trailers to commit messages.
208
+ */
209
+ coAuthors?: CommitIdentity[];
210
+ };
211
+ /**
212
+ * Per-tool overrides for customizing tool behavior without changing the underlying implementation.
213
+ *
214
+ * Overridable properties: `description`, `title`, `needsApproval`, `strict`, `providerOptions`,
215
+ * `toModelOutput`, and input lifecycle callbacks (`onInputStart`, `onInputDelta`, `onInputAvailable`).
216
+ *
217
+ * `execute`, `inputSchema`, and `outputSchema` cannot be overridden.
218
+ *
219
+ * @example
220
+ * ```ts
221
+ * createGithubTools({
222
+ * overrides: {
223
+ * mergePullRequest: { needsApproval: true, title: 'Merge PR' },
224
+ * listIssues: { description: 'List open bugs' },
225
+ * },
226
+ * })
227
+ * ```
228
+ */
229
+ type ToolOverrides = Partial<Pick<Tool, 'description' | 'needsApproval' | 'onInputAvailable' | 'onInputDelta' | 'onInputStart' | 'providerOptions' | 'strict' | 'title' | 'toModelOutput'>>;
230
+ //#endregion
231
+ //#region src/core/tool-types.d.ts
232
+ /** Full tool set returned when no `preset` is specified. */
233
+ type AllGithubTools = Record<GithubToolName, GithubTool>;
234
+ /** Base options shared by all {@link createGithubTools} overloads. */
235
+ type GithubToolsBaseOptions = {
236
+ /** GitHub token string or async provider. Falls back to `process.env.GITHUB_TOKEN` when omitted. */token?: GithubTokenInput; /** Control whether write operations require user approval. @see {@link ApprovalConfig} */
237
+ requireApproval?: ApprovalConfig; /** Per-tool overrides for description, title, needsApproval, and related AI SDK tool fields. */
238
+ overrides?: Partial<Record<GithubToolName, ToolOverrides>>; /** Default author for commit-creating tools. Falls back to the authenticated user when omitted. */
239
+ author?: CommitIdentity; /** Default committer for commit-creating tools. Falls back to the authenticated user when omitted. */
240
+ committer?: CommitIdentity; /** Co-authors to attribute on all commits created by tools. */
241
+ coAuthors?: CommitIdentity[];
242
+ };
243
+ /** Tool set shape for a given preset option (single, combined, or all tools). */
244
+ type GithubToolsForPreset<P extends GithubToolPreset | readonly GithubToolPreset[] | undefined> = P extends GithubToolPreset ? Pick<AllGithubTools, PresetToolName<P> & GithubToolName> : P extends readonly GithubToolPreset[] ? Pick<AllGithubTools, CombinedPresetToolNames<P> & GithubToolName> : AllGithubTools;
245
+ /** Pick a subset of GitHub tools by tool name. */
246
+ type PickGithubTools<T extends GithubToolName> = Pick<AllGithubTools, T>;
247
+ //#endregion
248
+ export { GithubToolPreset as _, CommitIdentity as a, GITHUB_TOOL_NAMES as b, Octokit$1 as c, GithubTokenInput as d, resolveGithubToken as f, CombinedPresetToolNames as g, GithubWriteToolName as h, PickGithubTools as i, ToolOptions as l, GITHUB_WRITE_TOOLS as m, GithubToolsBaseOptions as n, CommitToolOptions as o, ApprovalConfig as p, GithubToolsForPreset as r, GithubTool as s, AllGithubTools as t, ToolOverrides as u, PRESET_TOOLS as v, GithubToolName as x, PresetToolName as y };
249
+ //# sourceMappingURL=tool-types-C0kszIwd.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-types-C0kszIwd.d.mts","names":[],"sources":["../src/core/tool-names.ts","../src/core/presets.ts","../src/core/write-tools.ts","../src/core/approval.ts","../src/core/token.ts","../src/types.ts","../src/core/tool-types.ts"],"mappings":";;;;;;;;cAIa,iBAAA;EAqFH,4JAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;qCAEgB;EAAA,mDAAU;EAAA;;iCCN1B;EAAA,iCAAA;EAAA;;;qCAEE;EAAA;mDAA4C;EAAA,yCAG9B;EAAA,+CAAW;EAAA,2CAAkD;EAAA,+CAA9B;EAAA,6CAAO;EAAA,iDAA3B;EAAA;;KDCzB,cAAA,UAAwB,iBAAA,cAA+B,iBAAA;;;;;;AAvFnE;;cCGa,YAAA;EDkFH;;;;;;;;;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KCFE,gBAAA,gBAAgC,YAAA;;KAGhC,cAAA,WAAyB,gBAAA,IAAoB,OAAA,SAAgB,YAAA,EAAc,CAAA,WAAY,cAAA;;KAGvF,uBAAA,oBAA2C,gBAAA,MAAsB,cAAA,CAAe,CAAA;;;;;;;cCzF/E,kBAAA;EFqFH,6JAAA;EAAA;;;;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0kszIwd.mjs";
2
+ import { z } from "zod";
3
+ import { Approval, ToolModelOutput } from "eve/tools";
4
+
5
+ //#region src/eve/types.d.ts
6
+ /**
7
+ * Approval value for eve tools.
8
+ * - `true` / `'always'` → require approval on every call
9
+ * - `false` / `'never'` → skip approval
10
+ * - `'once'` → require approval only the first time per session
11
+ * - predicate → input-dependent gate (eve `Approval` shape)
12
+ * - eve helpers (`always()`, `once()`, `never()`) → passthrough
13
+ */
14
+ type EveApprovalValue = boolean | 'always' | 'once' | 'never' | Approval;
15
+ type EveApprovalConfig = boolean | Partial<Record<GithubWriteToolName, EveApprovalValue>>;
16
+ type EveToolOverrides = Partial<Record<GithubToolName, {
17
+ description?: string;
18
+ approval?: EveApprovalValue;
19
+ toModelOutput?: (output: unknown) => ToolModelOutput | Promise<ToolModelOutput>;
20
+ outputSchema?: z.ZodType | Record<string, unknown>;
21
+ }>>;
22
+ type EveGithubToolsOptions = {
23
+ /** GitHub token string or async provider. Defaults to `process.env.GITHUB_TOKEN`. */token?: GithubTokenInput;
24
+ /**
25
+ * Restrict tools to a predefined preset.
26
+ *
27
+ * @see {@link GithubToolPreset} for available presets and included tools.
28
+ */
29
+ preset?: GithubToolPreset | GithubToolPreset[];
30
+ /**
31
+ * Control whether write operations require user approval before execution.
32
+ *
33
+ * @see {@link EveApprovalConfig} for global and per-tool options.
34
+ */
35
+ requireApproval?: EveApprovalConfig;
36
+ /**
37
+ * Per-tool overrides for description, approval, output shaping, and output schema.
38
+ *
39
+ * @see {@link GithubToolName} for valid tool keys.
40
+ */
41
+ overrides?: EveToolOverrides; /** Default author for commit-creating tools. Falls back to the authenticated user when omitted. */
42
+ author?: CommitIdentity; /** Default committer for commit-creating tools. Falls back to the authenticated user when omitted. */
43
+ committer?: CommitIdentity; /** Co-authors to attribute on all commits created by tools. */
44
+ coAuthors?: CommitIdentity[];
45
+ };
46
+ type EveToolFactoryOptions = Omit<EveGithubToolsOptions, 'preset'>;
47
+ //#endregion
48
+ export { EveToolOverrides as a, EveToolFactoryOptions as i, EveApprovalValue as n, EveGithubToolsOptions as r, EveApprovalConfig as t };
49
+ //# sourceMappingURL=types-BTanS_dq.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-BTanS_dq.d.mts","names":[],"sources":["../src/eve/types.ts"],"mappings":";;;;;;;;AAuBA;;;;;KAPY,gBAAA,2CAKR,QAAA;AAAA,KAEQ,iBAAA,aAER,OAAA,CAAQ,MAAA,CAAO,mBAAA,EAAqB,gBAAA;AAAA,KAE5B,gBAAA,GAAmB,OAAA,CAAQ,MAAA,CAAO,cAAA;EAC5C,WAAA;EACA,QAAA,GAAW,gBAAA;EACX,aAAA,IAAiB,MAAA,cAAoB,eAAA,GAAkB,OAAA,CAAQ,eAAA;EAC/D,YAAA,GAAe,CAAA,CAAE,OAAA,GAAU,MAAA;AAAA;AAAA,KAGjB,qBAAA;EAT4C,qFAWtD,KAAA,GAAQ,gBAAA;EATkB;;;;;EAe1B,MAAA,GAAS,gBAAA,GAAmB,gBAAA;EAZ2B;;;;;EAkBvD,eAAA,GAAkB,iBAAA;EArBkB;;;;;EA2BpC,SAAA,GAAY,gBAAA,EAzBD;EA2BX,MAAA,GAAS,cAAA,EA1BQ;EA4BjB,SAAA,GAAY,cAAA,EA5B2C;EA8BvD,SAAA,GAAY,cAAA;AAAA;AAAA,KAGF,qBAAA,GAAwB,IAAA,CAAK,qBAAA"}
@@ -0,0 +1,27 @@
1
+ import { _ as GithubToolPreset, n as GithubToolsBaseOptions } from "./tool-types-C0kszIwd.mjs";
2
+ import { r as EveGithubToolsOptions } from "./types-BTanS_dq.mjs";
3
+ import { ConnectOptions, ConnectTokenParams } from "@vercel/connect";
4
+
5
+ //#region src/connect/types.d.ts
6
+ /**
7
+ * Token parameters for Vercel Connect GitHub connectors.
8
+ * `subject` is pinned to `{ type: 'app' }` by the SDK — same as `connectGitHubAdapter`.
9
+ */
10
+ type GithubConnectParams = Omit<ConnectTokenParams, 'subject'> & {
11
+ /** Restrict the token to specific repositories via GitHub authorization details. */repositories?: string[];
12
+ };
13
+ type ConnectGithubToolsOptions = GithubToolsBaseOptions & {
14
+ preset?: GithubToolPreset | GithubToolPreset[];
15
+ connect?: GithubConnectParams;
16
+ };
17
+ type ConnectGithubEveToolsOptions = Omit<EveGithubToolsOptions, 'token'> & {
18
+ connect?: GithubConnectParams;
19
+ };
20
+ type ConnectGithubTokenOptions = {
21
+ preset?: GithubToolPreset | GithubToolPreset[];
22
+ params?: GithubConnectParams;
23
+ connectOptions?: ConnectOptions;
24
+ };
25
+ //#endregion
26
+ export { GithubConnectParams as i, ConnectGithubTokenOptions as n, ConnectGithubToolsOptions as r, ConnectGithubEveToolsOptions as t };
27
+ //# sourceMappingURL=types-DOeq0Iia.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-DOeq0Iia.d.mts","names":[],"sources":["../src/connect/types.ts"],"mappings":";;;;;;AASA;;;KAAY,mBAAA,GAAsB,IAAA,CAAK,kBAAA;EAAL,oFAEhC,YAAA;AAAA;AAAA,KAGU,yBAAA,GAA4B,sBAAA;EACtC,MAAA,GAAS,gBAAA,GAAmB,gBAAA;EAC5B,OAAA,GAAU,mBAAA;AAAA;AAAA,KAGA,4BAAA,GAA+B,IAAA,CAAK,qBAAA;EAC9C,OAAA,GAAU,mBAAA;AAAA;AAAA,KAGA,yBAAA;EACV,MAAA,GAAS,gBAAA,GAAmB,gBAAA;EAC5B,MAAA,GAAS,mBAAA;EACT,cAAA,GAAiB,cAAA;AAAA"}