@github-tools/sdk 1.8.2 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +184 -70
- package/dist/connect/eve.d.mts +11 -5
- package/dist/connect/eve.d.mts.map +1 -1
- package/dist/connect/eve.mjs +10 -2
- package/dist/connect/eve.mjs.map +1 -1
- package/dist/connect.d.mts +23 -11
- package/dist/connect.d.mts.map +1 -1
- package/dist/connect.mjs +6 -3
- package/dist/connect.mjs.map +1 -1
- package/dist/eve-DmiXBuli.mjs +864 -0
- package/dist/eve-DmiXBuli.mjs.map +1 -0
- package/dist/eve.d.mts +338 -90
- package/dist/eve.d.mts.map +1 -1
- package/dist/eve.mjs +3 -3
- package/dist/index-CtID5dUi.d.mts +606 -0
- package/dist/index-CtID5dUi.d.mts.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +3 -3
- package/dist/{src-CfzZfU82.mjs → src-D6vC3V8r.mjs} +293 -20
- package/dist/src-D6vC3V8r.mjs.map +1 -0
- package/dist/{token-CW8lQBND.mjs → token-sbepWIkd.mjs} +45 -7
- package/dist/token-sbepWIkd.mjs.map +1 -0
- package/dist/{types-B0mvQgJf.d.mts → types-BOnJ0Rou.d.mts} +28 -8
- package/dist/types-BOnJ0Rou.d.mts.map +1 -0
- package/dist/types-BVLof-5R.d.mts +39 -0
- package/dist/types-BVLof-5R.d.mts.map +1 -0
- package/dist/workflow.d.mts +7 -7
- package/dist/workflow.d.mts.map +1 -1
- package/dist/workflow.mjs +6 -4
- package/dist/workflow.mjs.map +1 -1
- package/dist/{write-tools-Dx9LfYlU.mjs → write-tools-cg_ialNd.mjs} +1009 -107
- package/dist/write-tools-cg_ialNd.mjs.map +1 -0
- package/package.json +13 -13
- package/dist/eve-UPaHEGVi.mjs +0 -512
- package/dist/eve-UPaHEGVi.mjs.map +0 -1
- package/dist/index-Cs1Kebmt.d.mts +0 -463
- package/dist/index-Cs1Kebmt.d.mts.map +0 -1
- package/dist/src-CfzZfU82.mjs.map +0 -1
- package/dist/token-CW8lQBND.mjs.map +0 -1
- package/dist/types-B0mvQgJf.d.mts.map +0 -1
- package/dist/types-DwHrGKWO.d.mts +0 -27
- package/dist/types-DwHrGKWO.d.mts.map +0 -1
- package/dist/write-tools-Dx9LfYlU.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"src-D6vC3V8r.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/tools/checks.ts","../src/tools/releases.ts","../src/tools/bundles.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 getRepositoryTreeInputSchema,\n getRepositoryTreeDescription,\n getRepositoryTreeCore,\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 getRepositoryTreeStep(args: Parameters<typeof getRepositoryTreeCore>[0]) {\n \"use step\"\n return getRepositoryTreeCore(args)\n}\n\n/** List the file and directory structure of a repository at a given ref. */\nexport const getRepositoryTree = (token: GithubTokenInput): GithubTool =>\n tool({\n description: getRepositoryTreeDescription,\n inputSchema: getRepositoryTreeInputSchema,\n execute: async args => getRepositoryTreeStep({ 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 requestReviewersInputSchema,\n requestReviewersDescription,\n requestReviewersCore,\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 with status and stats. Patches omitted by default. */\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\nasync function requestReviewersStep(args: Parameters<typeof requestReviewersCore>[0]) {\n \"use step\"\n return requestReviewersCore(args)\n}\n\n/** Request reviews from users or teams on a pull request. Requires approval by default. */\nexport const requestReviewers = (token: GithubTokenInput, { needsApproval = true }: ToolOptions = {}): GithubTool =>\n tool({\n description: requestReviewersDescription,\n needsApproval,\n inputSchema: requestReviewersInputSchema,\n execute: async args => requestReviewersStep({ 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 addAssigneesInputSchema,\n addAssigneesDescription,\n addAssigneesCore,\n removeAssigneesInputSchema,\n removeAssigneesDescription,\n removeAssigneesCore,\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\nasync function addAssigneesStep(args: Parameters<typeof addAssigneesCore>[0]) {\n \"use step\"\n return addAssigneesCore(args)\n}\n\n/** Assign users to an issue or pull request. Requires approval by default. */\nexport const addAssignees = (token: GithubTokenInput, { needsApproval = true }: ToolOptions = {}): GithubTool =>\n tool({\n description: addAssigneesDescription,\n needsApproval,\n inputSchema: addAssigneesInputSchema,\n execute: async args => addAssigneesStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function removeAssigneesStep(args: Parameters<typeof removeAssigneesCore>[0]) {\n \"use step\"\n return removeAssigneesCore(args)\n}\n\n/** Remove assignees from an issue or pull request. Requires approval by default. */\nexport const removeAssignees = (token: GithubTokenInput, { needsApproval = true }: ToolOptions = {}): GithubTool =>\n tool({\n description: removeAssigneesDescription,\n needsApproval,\n inputSchema: removeAssigneesInputSchema,\n execute: async args => removeAssigneesStep({ 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 compareCommitsInputSchema,\n compareCommitsDescription,\n compareCommitsCore,\n} from '../core/commits'\nimport { getCommitToModelOutput, compareCommitsToModelOutput } 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. Patches omitted by default. */\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\nasync function compareCommitsStep(args: Parameters<typeof compareCommitsCore>[0]) {\n \"use step\"\n return compareCommitsCore(args)\n}\n\n/** Compare two branches, tags, or commits. Patches omitted by default. */\nexport const compareCommits = (token: GithubTokenInput): GithubTool =>\n tool({\n description: compareCommitsDescription,\n inputSchema: compareCommitsInputSchema,\n toModelOutput: compareCommitsToModelOutput,\n execute: async args => compareCommitsStep({ 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 { tool } from 'ai'\nimport {\n listCheckRunsInputSchema,\n listCheckRunsDescription,\n listCheckRunsCore,\n getCombinedStatusInputSchema,\n getCombinedStatusDescription,\n getCombinedStatusCore,\n} from '../core/checks'\nimport { resolveGithubToken, type GithubTokenInput } from '../core/token'\nimport type { GithubTool } from '../types'\n\nasync function listCheckRunsStep(args: Parameters<typeof listCheckRunsCore>[0]) {\n \"use step\"\n return listCheckRunsCore(args)\n}\n\n/** List check runs (Checks API — GitHub Actions and other CI providers) for a commit, branch, or tag. */\nexport const listCheckRuns = (token: GithubTokenInput): GithubTool =>\n tool({\n description: listCheckRunsDescription,\n inputSchema: listCheckRunsInputSchema,\n execute: async args => listCheckRunsStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function getCombinedStatusStep(args: Parameters<typeof getCombinedStatusCore>[0]) {\n \"use step\"\n return getCombinedStatusCore(args)\n}\n\n/** Get the combined commit status (Statuses API — legacy CI integrations) for a commit, branch, or tag. */\nexport const getCombinedStatus = (token: GithubTokenInput): GithubTool =>\n tool({\n description: getCombinedStatusDescription,\n inputSchema: getCombinedStatusInputSchema,\n execute: async args => getCombinedStatusStep({ token: await resolveGithubToken(token), ...args }),\n })\n","import { tool } from 'ai'\nimport {\n listReleasesInputSchema,\n listReleasesDescription,\n listReleasesCore,\n getLatestReleaseInputSchema,\n getLatestReleaseDescription,\n getLatestReleaseCore,\n getReleaseInputSchema,\n getReleaseDescription,\n getReleaseCore,\n createReleaseInputSchema,\n createReleaseDescription,\n createReleaseCore,\n} from '../core/releases'\nimport { resolveGithubToken, type GithubTokenInput } from '../core/token'\nimport type { ToolOptions, GithubTool } from '../types'\n\nasync function listReleasesStep(args: Parameters<typeof listReleasesCore>[0]) {\n \"use step\"\n return listReleasesCore(args)\n}\n\n/** List releases for a GitHub repository, newest first (includes drafts and prereleases). */\nexport const listReleases = (token: GithubTokenInput): GithubTool =>\n tool({\n description: listReleasesDescription,\n inputSchema: listReleasesInputSchema,\n execute: async args => listReleasesStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function getLatestReleaseStep(args: Parameters<typeof getLatestReleaseCore>[0]) {\n \"use step\"\n return getLatestReleaseCore(args)\n}\n\n/** Get the latest published release for a GitHub repository (excludes drafts and prereleases). */\nexport const getLatestRelease = (token: GithubTokenInput): GithubTool =>\n tool({\n description: getLatestReleaseDescription,\n inputSchema: getLatestReleaseInputSchema,\n execute: async args => getLatestReleaseStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function getReleaseStep(args: Parameters<typeof getReleaseCore>[0]) {\n \"use step\"\n return getReleaseCore(args)\n}\n\n/** Get a specific release by ID, including its assets. */\nexport const getRelease = (token: GithubTokenInput): GithubTool =>\n tool({\n description: getReleaseDescription,\n inputSchema: getReleaseInputSchema,\n execute: async args => getReleaseStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function createReleaseStep(args: Parameters<typeof createReleaseCore>[0]) {\n \"use step\"\n return createReleaseCore(args)\n}\n\n/** Create a new release (and its tag if needed) in a GitHub repository. Requires approval by default. */\nexport const createRelease = (token: GithubTokenInput, { needsApproval = true }: ToolOptions = {}): GithubTool =>\n tool({\n description: createReleaseDescription,\n needsApproval,\n inputSchema: createReleaseInputSchema,\n execute: async args => createReleaseStep({ token: await resolveGithubToken(token), ...args }),\n })\n","import { tool } from 'ai'\nimport {\n getPullRequestContextInputSchema,\n getPullRequestContextDescription,\n getPullRequestContextCore,\n getIssueContextInputSchema,\n getIssueContextDescription,\n getIssueContextCore,\n getReleaseContextInputSchema,\n getReleaseContextDescription,\n getReleaseContextCore,\n getCiFailureContextInputSchema,\n getCiFailureContextDescription,\n getCiFailureContextCore,\n} from '../core/bundles'\nimport { getPullRequestContextToModelOutput } from '../core/model-output'\nimport { resolveGithubToken, type GithubTokenInput } from '../core/token'\nimport type { GithubTool } from '../types'\n\nasync function getPullRequestContextStep(args: Parameters<typeof getPullRequestContextCore>[0]) {\n \"use step\"\n return getPullRequestContextCore(args)\n}\n\n/** Fetch pull request details plus files, reviews, and optional CI checks in one call. */\nexport const getPullRequestContext = (token: GithubTokenInput): GithubTool =>\n tool({\n description: getPullRequestContextDescription,\n inputSchema: getPullRequestContextInputSchema,\n toModelOutput: getPullRequestContextToModelOutput,\n execute: async args => getPullRequestContextStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function getIssueContextStep(args: Parameters<typeof getIssueContextCore>[0]) {\n \"use step\"\n return getIssueContextCore(args)\n}\n\n/** Fetch an issue plus available labels and recent comments in one call. */\nexport const getIssueContext = (token: GithubTokenInput): GithubTool =>\n tool({\n description: getIssueContextDescription,\n inputSchema: getIssueContextInputSchema,\n execute: async args => getIssueContextStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function getReleaseContextStep(args: Parameters<typeof getReleaseContextCore>[0]) {\n \"use step\"\n return getReleaseContextCore(args)\n}\n\n/** Fetch a release plus the previous release and tag comparison in one call. */\nexport const getReleaseContext = (token: GithubTokenInput): GithubTool =>\n tool({\n description: getReleaseContextDescription,\n inputSchema: getReleaseContextInputSchema,\n execute: async args => getReleaseContextStep({ token: await resolveGithubToken(token), ...args }),\n })\n\nasync function getCiFailureContextStep(args: Parameters<typeof getCiFailureContextCore>[0]) {\n \"use step\"\n return getCiFailureContextCore(args)\n}\n\n/** Diagnose CI failures for a ref — combined status, failing checks, and failed workflow jobs. */\nexport const getCiFailureContext = (token: GithubTokenInput): GithubTool =>\n tool({\n description: getCiFailureContextDescription,\n inputSchema: getCiFailureContextInputSchema,\n execute: async args => getCiFailureContextStep({ 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'\nimport { formatContextInstructions, type GithubToolsContext } from './core/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.`\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\nPrefer getPullRequestContext, getIssueContext, getReleaseContext, or getCiFailureContext when you need a full picture in one step instead of chaining several read tools. Bodies are truncated by default (detail: summary) — set detail full only when you need the complete text. Diff patches are omitted by default — set includePatch true (optionally with filenames) only when you need specific diffs. Prefer getFileContent with startLine/endLine or maxLines for large files. Call independent read tools in parallel in the same step when you already know owner/repo/numbers.\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- Prefer getPullRequestContext as the first call (files + reviews in one step). Set includeChecks true when CI status matters\n- Diff patches are omitted by default — after the file list, call listPullRequestFiles with includePatch true and filenames for the files you need to inspect\n- Prefer getFileContent with startLine/endLine or maxLines when inspecting large files\n- Call independent reads in parallel in the same step when you already know owner/repo/pullNumber\n- Bodies are truncated by default (detail: summary) — set detail full only when needed\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 (includePatch true)\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 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- Prefer getIssueContext as the first call (issue + labels + recent comments in one step)\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 addLabels and removeLabel to categorize issues after you know available labels from getIssueContext\n- Create new issues when asked, with clear titles and descriptions\n- Set detail full only when the truncated body is not enough\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 as the first call when diagnosing a failing ref — it returns combined status, failing checks, and failed jobs/steps together\n- Use listCheckRuns and getCombinedStatus for narrower follow-ups\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 '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 to look for hardcoded secrets, unsafe patterns, or known-vulnerable code\n- Use getBlame and listCommits to trace when a risky pattern was introduced and by whom\n- Prefer getCiFailureContext or getPullRequestContext when you need CI / PR context in one step\n- Use listCheckRuns and getCombinedStatus to check the state of security scanning and CI checks on the branch or commit under review\n- Use compareCommits to scope exactly what changed between two refs before flagging new risk (includePatch only when you need diffs)\n- Report findings as issues with clear reproduction steps, impact, and severity, labeled appropriately\n- This preset can only read, create issues, comment, and label — never assume you can fix the 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 code structure and organization\n- Prefer getPullRequestContext or getCiFailureContext when summarizing a PR or failing CI in one step\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 '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 to load the current (or latest) release, the previous release, and the tag comparison in one step\n- Use compareCommits and listCommits to summarize what changed since the last release when you need more detail\n- Use listReleases and getLatestRelease to determine the next version and avoid duplicate tags\n- Prefer getCiFailureContext when confirming CI health on the target ref\n- Use listWorkflowRuns and getWorkflowRun to confirm CI is green on the target ref before releasing\n- Use triggerWorkflow to kick off release pipelines when the repository automates releases that way\n- Use createRelease with generateReleaseNotes when the repository doesn't maintain a manual changelog\n- Double-check the target branch or commit SHA before creating a release — releases and their tags are hard to undo cleanly\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- Prefer getPullRequestContext or getCiFailureContext for multi-part reads instead of chaining several tools\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 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\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 * `context` is still appended when provided.\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 * context: { owner: 'vercel', repo: 'ai', pullNumber: 42 },\n * })\n *\n * const result = await agent.generate({ prompt: 'Review this PR' })\n * ```\n */\nexport function createGithubAgent({\n token,\n preset,\n requireApproval,\n context,\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, context, author, committer, coAuthors })\n\n return new ToolLoopAgent({\n ...agentOptions,\n tools,\n instructions: resolveInstructions({ preset, instructions, additionalInstructions, context }),\n } as ToolLoopAgentSettings<never, typeof tools>) as ToolLoopAgent<never, typeof tools>\n}\n","import type { ToolSet } from 'ai'\nimport { getRepository, listBranches, getFileContent, getRepositoryTree, createBranch, forkRepository, createRepository, createOrUpdateFile } from './tools/repository'\nimport { listPullRequests, getPullRequest, createPullRequest, mergePullRequest, addPullRequestComment, listPullRequestFiles, listPullRequestReviews, createPullRequestReview, requestReviewers } from './tools/pull-requests'\nimport { listIssues, getIssue, createIssue, addIssueComment, closeIssue, listLabels, addLabels, removeLabel, addAssignees, removeAssignees } from './tools/issues'\nimport { searchCode, searchRepositories } from './tools/search'\nimport { listCommits, getCommit, getBlame, compareCommits } 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 { listCheckRuns, getCombinedStatus } from './tools/checks'\nimport { listReleases, getLatestRelease, getRelease, createRelease } from './tools/releases'\nimport { getPullRequestContext, getIssueContext, getReleaseContext, getCiFailureContext } from './tools/bundles'\nimport { resolveAiSdkApproval } from './core/approval'\nimport { bindToolsContext } from './core/context'\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 { GithubToolsContext } from './core/context'\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 * Pass `context` to default owner/repo/PR/issue/ref on tool inputs.\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 * // Scoped to a repo / PR\n * createGithubTools({\n * token,\n * preset: 'code-review',\n * context: { owner: 'vercel', repo: 'ai', pullNumber: 42 },\n * })\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 context,\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 getRepositoryTree: getRepositoryTree(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 compareCommits: compareCommits(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 requestReviewers: requestReviewers(resolveToken, approval('requestReviewers')),\n getPullRequestContext: getPullRequestContext(resolveToken),\n getIssueContext: getIssueContext(resolveToken),\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 addAssignees: addAssignees(resolveToken, approval('addAssignees')),\n removeAssignees: removeAssignees(resolveToken, approval('removeAssignees')),\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 listCheckRuns: listCheckRuns(resolveToken),\n getCombinedStatus: getCombinedStatus(resolveToken),\n getCiFailureContext: getCiFailureContext(resolveToken),\n listReleases: listReleases(resolveToken),\n getLatestRelease: getLatestRelease(resolveToken),\n getRelease: getRelease(resolveToken),\n getReleaseContext: getReleaseContext(resolveToken),\n createRelease: createRelease(resolveToken, approval('createRelease')),\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 const scoped = bindToolsContext(allTools, context)\n\n if (!allowed) return scoped\n\n return Object.fromEntries(\n Object.entries(scoped).filter(([name]) => allowed.has(name as GithubToolName))\n ) as Pick<typeof scoped, 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, getRepositoryTree, createBranch, forkRepository, createRepository, createOrUpdateFile } from './tools/repository'\nexport { listPullRequests, getPullRequest, createPullRequest, mergePullRequest, addPullRequestComment, listPullRequestFiles, listPullRequestReviews, createPullRequestReview, requestReviewers } from './tools/pull-requests'\nexport { listIssues, getIssue, createIssue, addIssueComment, closeIssue, listLabels, addLabels, removeLabel, addAssignees, removeAssignees } from './tools/issues'\nexport { searchCode, searchRepositories } from './tools/search'\nexport { listCommits, getCommit, getBlame, compareCommits } 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 { listCheckRuns, getCombinedStatus } from './tools/checks'\nexport { listReleases, getLatestRelease, getRelease, createRelease } from './tools/releases'\nexport { getPullRequestContext, getIssueContext, getReleaseContext, getCiFailureContext } from './tools/bundles'\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":";;;AAkCA,eAAe,kBAAkB,MAA+C;CAC9E;CACA,OAAO,kBAAkB,IAAI;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G,MAAM;IAAE,GAAG,SAAS;IAAM,GAAG;GAAc,EAAE,CAAC;EAC3E;;CAIJ,MAAM,SAAS,iBAAiB,UAAU,OAAO;CAEjD,IAAI,CAAC,SAAS,OAAO;CAErB,OAAO,OAAO,YACZ,OAAO,QAAQ,MAAM,CAAC,CAAC,QAAQ,CAAC,UAAU,QAAQ,IAAI,IAAsB,CAAC,CAC/E;AACF"}
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import { getToken } from "@vercel/connect";
|
|
2
|
+
//#region src/connect/connector.ts
|
|
3
|
+
/** Resolves a {@link GithubConnectorInput} to a connector name string. */
|
|
4
|
+
async function resolveGithubConnector(connector) {
|
|
5
|
+
return typeof connector === "function" ? await connector() : connector;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
2
8
|
//#region src/connect/scopes.ts
|
|
3
9
|
/**
|
|
4
10
|
* Vercel Connect scope strings mapped to each {@link GithubToolPreset}.
|
|
5
11
|
*
|
|
6
12
|
* Scopes mirror GitHub App permissions (`contents`, `pull_requests`, `issues`,
|
|
7
|
-
* `actions`, `administration`, `metadata`) and must cover
|
|
8
|
-
* family a preset's tools touch, not just its primary domain.
|
|
13
|
+
* `actions`, `checks`, `statuses`, `administration`, `metadata`) and must cover
|
|
14
|
+
* every read/write family a preset's tools touch, not just its primary domain.
|
|
15
|
+
* Release tools fall under the `contents` permission on GitHub Apps, so they
|
|
16
|
+
* need no scope of their own.
|
|
9
17
|
*
|
|
10
18
|
* Gist tools in `repo-explorer` and `maintainer` are intentionally left
|
|
11
19
|
* unscoped: the Gists API only accepts GitHub App *user* access tokens, never
|
|
@@ -20,13 +28,17 @@ const PRESET_CONNECT_SCOPES = {
|
|
|
20
28
|
"metadata:read",
|
|
21
29
|
"pull_requests:read",
|
|
22
30
|
"issues:read",
|
|
23
|
-
"actions:read"
|
|
31
|
+
"actions:read",
|
|
32
|
+
"checks:read",
|
|
33
|
+
"statuses:read"
|
|
24
34
|
],
|
|
25
35
|
"code-review": [
|
|
26
36
|
"contents:read",
|
|
27
37
|
"metadata:read",
|
|
28
38
|
"pull_requests:read",
|
|
29
|
-
"pull_requests:write"
|
|
39
|
+
"pull_requests:write",
|
|
40
|
+
"checks:read",
|
|
41
|
+
"statuses:read"
|
|
30
42
|
],
|
|
31
43
|
"issue-triage": [
|
|
32
44
|
"contents:read",
|
|
@@ -38,6 +50,26 @@ const PRESET_CONNECT_SCOPES = {
|
|
|
38
50
|
"contents:read",
|
|
39
51
|
"metadata:read",
|
|
40
52
|
"actions:read",
|
|
53
|
+
"actions:write",
|
|
54
|
+
"checks:read",
|
|
55
|
+
"statuses:read"
|
|
56
|
+
],
|
|
57
|
+
"security-audit": [
|
|
58
|
+
"contents:read",
|
|
59
|
+
"metadata:read",
|
|
60
|
+
"pull_requests:read",
|
|
61
|
+
"issues:read",
|
|
62
|
+
"issues:write",
|
|
63
|
+
"actions:read",
|
|
64
|
+
"checks:read",
|
|
65
|
+
"statuses:read"
|
|
66
|
+
],
|
|
67
|
+
"release-manager": [
|
|
68
|
+
"contents:read",
|
|
69
|
+
"contents:write",
|
|
70
|
+
"metadata:read",
|
|
71
|
+
"pull_requests:read",
|
|
72
|
+
"actions:read",
|
|
41
73
|
"actions:write"
|
|
42
74
|
],
|
|
43
75
|
"maintainer": [
|
|
@@ -50,6 +82,8 @@ const PRESET_CONNECT_SCOPES = {
|
|
|
50
82
|
"issues:write",
|
|
51
83
|
"actions:read",
|
|
52
84
|
"actions:write",
|
|
85
|
+
"checks:read",
|
|
86
|
+
"statuses:read",
|
|
53
87
|
"administration:read",
|
|
54
88
|
"administration:write"
|
|
55
89
|
]
|
|
@@ -88,13 +122,17 @@ function buildConnectTokenParams(scopes, params) {
|
|
|
88
122
|
/**
|
|
89
123
|
* Returns a lazy GitHub token provider backed by a Vercel Connect connector.
|
|
90
124
|
* Scopes are derived from `preset` unless overridden in `params.scopes`.
|
|
125
|
+
*
|
|
126
|
+
* `connector` may be a static name or a resolver function — e.g. to pick a
|
|
127
|
+
* different connector per environment (production vs. preview) or tenant.
|
|
128
|
+
* It's re-resolved on every call, alongside the token itself.
|
|
91
129
|
*/
|
|
92
130
|
function connectGithubToken(connector, options = {}) {
|
|
93
131
|
const { connectOptions } = options;
|
|
94
132
|
const tokenParams = resolveGithubConnectTokenParams(options);
|
|
95
|
-
return () => getToken(connector, tokenParams, connectOptions);
|
|
133
|
+
return async () => getToken(await resolveGithubConnector(connector), tokenParams, connectOptions);
|
|
96
134
|
}
|
|
97
135
|
//#endregion
|
|
98
|
-
export { PRESET_CONNECT_SCOPES as n, connectGithubScopesForPreset as r, connectGithubToken as t };
|
|
136
|
+
export { resolveGithubConnector as i, PRESET_CONNECT_SCOPES as n, connectGithubScopesForPreset as r, connectGithubToken as t };
|
|
99
137
|
|
|
100
|
-
//# sourceMappingURL=token-
|
|
138
|
+
//# sourceMappingURL=token-sbepWIkd.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-sbepWIkd.mjs","names":[],"sources":["../src/connect/connector.ts","../src/connect/scopes.ts","../src/connect/params.ts","../src/connect/token.ts"],"sourcesContent":["/**\n * A Vercel Connect connector name, or a resolver that returns one.\n *\n * Use a function to pick the connector dynamically — e.g. a different\n * connector per environment (`production` vs. `preview`) or per tenant.\n * It's resolved lazily, on every token request, alongside the token itself.\n */\nexport type GithubConnectorInput = string | (() => string | Promise<string>)\n\n/** Resolves a {@link GithubConnectorInput} to a connector name string. */\nexport async function resolveGithubConnector(connector: GithubConnectorInput): Promise<string> {\n return typeof connector === 'function' ? await connector() : connector\n}\n","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`, `checks`, `statuses`, `administration`, `metadata`) and must cover\n * every read/write family a preset's tools touch, not just its primary domain.\n * Release tools fall under the `contents` permission on GitHub Apps, so they\n * need no scope of their own.\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 'checks:read',\n 'statuses:read',\n ],\n 'code-review': [\n 'contents:read',\n 'metadata:read',\n 'pull_requests:read',\n 'pull_requests:write',\n 'checks:read',\n 'statuses:read',\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 'checks:read',\n 'statuses:read',\n ],\n 'security-audit': [\n 'contents:read',\n 'metadata:read',\n 'pull_requests:read',\n 'issues:read',\n 'issues:write',\n 'actions:read',\n 'checks:read',\n 'statuses:read',\n ],\n 'release-manager': [\n 'contents:read',\n 'contents:write',\n 'metadata:read',\n 'pull_requests: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 'checks:read',\n 'statuses:read',\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 { resolveGithubConnector, type GithubConnectorInput } from './connector'\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 *\n * `connector` may be a static name or a resolver function — e.g. to pick a\n * different connector per environment (production vs. preview) or tenant.\n * It's re-resolved on every call, alongside the token itself.\n */\nexport function connectGithubToken(\n connector: GithubConnectorInput,\n options: ConnectGithubTokenOptions = {},\n): GithubTokenInput {\n const { connectOptions } = options\n const tokenParams = resolveGithubConnectTokenParams(options)\n\n return async () => getToken(await resolveGithubConnector(connector), tokenParams, connectOptions)\n}\n\nexport type { ConnectOptions }\n"],"mappings":";;;AAUA,eAAsB,uBAAuB,WAAkD;CAC7F,OAAO,OAAO,cAAc,aAAa,MAAM,UAAU,IAAI;AAC/D;;;;;;;;;;;;;;;;;;;ACMA,MAAa,wBAAwB;CACnC,i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AS,MAAM,uBAAuB,SAAS,GAAG,aAAa,cAAc;AAClG"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Dt as GithubToolPreset, Tt as GithubWriteToolName, _t as CommitIdentity, gt as GithubToolsContext, jt as GithubToolName, mt as GithubTokenInput } from "./index-CtID5dUi.mjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { Approval, ToolModelOutput } from "eve/tools";
|
|
4
|
-
|
|
5
4
|
//#region src/eve/types.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* Approval value for eve tools.
|
|
@@ -20,13 +19,26 @@ type EveToolOverrides = Partial<Record<GithubToolName, {
|
|
|
20
19
|
outputSchema?: z.ZodType | Record<string, unknown>;
|
|
21
20
|
}>>;
|
|
22
21
|
type EveGithubToolsOptions = {
|
|
23
|
-
/** GitHub token string or async provider. Defaults to `process.env.GITHUB_TOKEN`. */
|
|
22
|
+
/** GitHub token string or async provider. Defaults to `process.env.GITHUB_TOKEN`. */
|
|
23
|
+
token?: GithubTokenInput;
|
|
24
24
|
/**
|
|
25
25
|
* Restrict tools to a predefined preset.
|
|
26
26
|
*
|
|
27
27
|
* @see {@link GithubToolPreset} for available presets and included tools.
|
|
28
28
|
*/
|
|
29
29
|
preset?: GithubToolPreset | GithubToolPreset[];
|
|
30
|
+
/**
|
|
31
|
+
* Hand-pick an exact set of tool names, either standalone (no `preset`) or
|
|
32
|
+
* additively on top of a `preset` — the effective set is the union of both.
|
|
33
|
+
* To remove specific tools from a `preset` (or from `include`), use `exclude`.
|
|
34
|
+
*/
|
|
35
|
+
include?: GithubToolName[];
|
|
36
|
+
/**
|
|
37
|
+
* Remove specific tool names from the resolved set, applied after `preset`
|
|
38
|
+
* and `include` are combined. Useful for taking a `preset` and dropping a
|
|
39
|
+
* couple of tools you don't want exposed.
|
|
40
|
+
*/
|
|
41
|
+
exclude?: GithubToolName[];
|
|
30
42
|
/**
|
|
31
43
|
* Control whether write operations require user approval before execution.
|
|
32
44
|
*
|
|
@@ -38,12 +50,20 @@ type EveGithubToolsOptions = {
|
|
|
38
50
|
*
|
|
39
51
|
* @see {@link GithubToolName} for valid tool keys.
|
|
40
52
|
*/
|
|
41
|
-
overrides?: EveToolOverrides;
|
|
42
|
-
|
|
43
|
-
|
|
53
|
+
overrides?: EveToolOverrides;
|
|
54
|
+
/** Default author for commit-creating tools. Falls back to the authenticated user when omitted. */
|
|
55
|
+
author?: CommitIdentity;
|
|
56
|
+
/** Default committer for commit-creating tools. Falls back to the authenticated user when omitted. */
|
|
57
|
+
committer?: CommitIdentity;
|
|
58
|
+
/** Co-authors to attribute on all commits created by tools. */
|
|
44
59
|
coAuthors?: CommitIdentity[];
|
|
60
|
+
/**
|
|
61
|
+
* Default owner / repo / PR / issue / ref values.
|
|
62
|
+
* Softens matching tool input fields and fills them when omitted.
|
|
63
|
+
*/
|
|
64
|
+
context?: GithubToolsContext;
|
|
45
65
|
};
|
|
46
|
-
type EveToolFactoryOptions = Omit<EveGithubToolsOptions, 'preset'>;
|
|
66
|
+
type EveToolFactoryOptions = Omit<EveGithubToolsOptions, 'preset' | 'include' | 'exclude'>;
|
|
47
67
|
//#endregion
|
|
48
68
|
export { EveToolOverrides as a, EveToolFactoryOptions as i, EveApprovalValue as n, EveGithubToolsOptions as r, EveApprovalConfig as t };
|
|
49
|
-
//# sourceMappingURL=types-
|
|
69
|
+
//# sourceMappingURL=types-BOnJ0Rou.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-BOnJ0Rou.d.mts","names":[],"sources":["../src/eve/types.ts"],"mappings":";;;;;;;;;;;;KAiBY,2DAKR;KAEQ,8BAER,QAAQ,OAAO,qBAAqB;KAE5B,mBAAmB,QAAQ,OAAO;EAC5C;EACA,WAAW;EACX,iBAAiB,oBAAoB,kBAAkB,QAAQ;EAC/D,eAAe,EAAE,UAAU;;KAGjB;;EAEV,QAAQ;;;;;;EAMR,SAAS,mBAAmB;;;;;;EAM5B,UAAU;;;;;;EAMV,UAAU;;;;;;EAMV,kBAAkB;;;;;;EAMlB,YAAY;;EAEZ,SAAS;;EAET,YAAY;;EAEZ,YAAY;;;;;EAKZ,UAAU;;KAGA,wBAAwB,KAAK"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Dt as GithubToolPreset, dt as GithubToolsBaseOptions } from "./index-CtID5dUi.mjs";
|
|
2
|
+
import { r as EveGithubToolsOptions } from "./types-BOnJ0Rou.mjs";
|
|
3
|
+
import { ConnectOptions, ConnectTokenParams } from "@vercel/connect";
|
|
4
|
+
//#region src/connect/connector.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* A Vercel Connect connector name, or a resolver that returns one.
|
|
7
|
+
*
|
|
8
|
+
* Use a function to pick the connector dynamically — e.g. a different
|
|
9
|
+
* connector per environment (`production` vs. `preview`) or per tenant.
|
|
10
|
+
* It's resolved lazily, on every token request, alongside the token itself.
|
|
11
|
+
*/
|
|
12
|
+
type GithubConnectorInput = string | (() => string | Promise<string>);
|
|
13
|
+
/** Resolves a {@link GithubConnectorInput} to a connector name string. */
|
|
14
|
+
declare function resolveGithubConnector(connector: GithubConnectorInput): Promise<string>;
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/connect/types.d.ts
|
|
17
|
+
/**
|
|
18
|
+
* Token parameters for Vercel Connect GitHub connectors.
|
|
19
|
+
* `subject` is pinned to `{ type: 'app' }` by the SDK — same as `connectGitHubAdapter`.
|
|
20
|
+
*/
|
|
21
|
+
type GithubConnectParams = Omit<ConnectTokenParams, 'subject'> & {
|
|
22
|
+
/** Restrict the token to specific repositories via GitHub authorization details. */
|
|
23
|
+
repositories?: string[];
|
|
24
|
+
};
|
|
25
|
+
type ConnectGithubToolsOptions = GithubToolsBaseOptions & {
|
|
26
|
+
preset?: GithubToolPreset | GithubToolPreset[];
|
|
27
|
+
connect?: GithubConnectParams;
|
|
28
|
+
};
|
|
29
|
+
type ConnectGithubEveToolsOptions = Omit<EveGithubToolsOptions, 'token'> & {
|
|
30
|
+
connect?: GithubConnectParams;
|
|
31
|
+
};
|
|
32
|
+
type ConnectGithubTokenOptions = {
|
|
33
|
+
preset?: GithubToolPreset | GithubToolPreset[];
|
|
34
|
+
params?: GithubConnectParams;
|
|
35
|
+
connectOptions?: ConnectOptions;
|
|
36
|
+
};
|
|
37
|
+
//#endregion
|
|
38
|
+
export { GithubConnectorInput as a, GithubConnectParams as i, ConnectGithubTokenOptions as n, resolveGithubConnector as o, ConnectGithubToolsOptions as r, ConnectGithubEveToolsOptions as t };
|
|
39
|
+
//# sourceMappingURL=types-BVLof-5R.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-BVLof-5R.d.mts","names":[],"sources":["../src/connect/connector.ts","../src/connect/types.ts"],"mappings":";;;;;;;;;;;KAOY,gDAAgD;;iBAGtC,uBAAuB,WAAW,uBAAuB;;;;;;;KCDnE,sBAAsB,KAAK;;EAErC;;KAGU,4BAA4B;EACtC,SAAS,mBAAmB;EAC5B,UAAU;;KAGA,+BAA+B,KAAK;EAC9C,UAAU;;KAGA;EACV,SAAS,mBAAmB;EAC5B,SAAS;EACT,iBAAiB"}
|
package/dist/workflow.d.mts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { At as GITHUB_TOOL_NAMES, Ct as ApprovalConfig, Dt as GithubToolPreset, Et as CombinedPresetToolNames, Ot as PRESET_TOOLS, St as ToolOverrides, Tt as GithubWriteToolName, _t as CommitIdentity, a as createGithubAgent, ft as GithubToolsForPreset, gt as GithubToolsContext, ht as resolveGithubToken, i as CreateGithubAgentOptions, jt as GithubToolName, kt as PresetToolName, mt as GithubTokenInput, n as GithubToolsOptions, pt as PickGithubTools, r as createGithubTools, t as GithubTools, ut as AllGithubTools, vt as CommitToolOptions, wt as GITHUB_WRITE_TOOLS } from "./index-CtID5dUi.mjs";
|
|
2
2
|
import { FinishReason, LanguageModel, LanguageModelResponseMetadata, LanguageModelUsage, ModelMessage, StepResult, StopCondition, ToolSet } from "ai";
|
|
3
3
|
import { WorkflowAgentOptions, WorkflowAgentStreamOptions, WorkflowAgentStreamResult } from "@ai-sdk/workflow";
|
|
4
4
|
import { Context } from "@ai-sdk/provider-utils";
|
|
5
|
-
|
|
6
5
|
//#region src/workflow.d.ts
|
|
7
6
|
/**
|
|
8
7
|
* Result of {@link DurableGithubAgent.generate}.
|
|
@@ -47,10 +46,7 @@ declare class DurableGithubAgent<TTools extends ToolSet = ToolSet> {
|
|
|
47
46
|
* function, because the Workflow runtime blocks direct I/O (HTTP calls)
|
|
48
47
|
* at the workflow scope level.
|
|
49
48
|
*/
|
|
50
|
-
generate({
|
|
51
|
-
prompt,
|
|
52
|
-
stopWhen
|
|
53
|
-
}: {
|
|
49
|
+
generate({ prompt, stopWhen }: {
|
|
54
50
|
prompt: string;
|
|
55
51
|
stopWhen?: StopCondition<TTools> | Array<StopCondition<TTools>>;
|
|
56
52
|
}): Promise<DurableGithubAgentGenerateResult<TTools>>;
|
|
@@ -93,6 +89,10 @@ type CreateDurableGithubAgentOptions = Omit<WorkflowAgentOptions, 'model' | 'too
|
|
|
93
89
|
* Ignored when `instructions` is set.
|
|
94
90
|
*/
|
|
95
91
|
additionalInstructions?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Default owner / repo / PR / issue / ref values for tools and the system prompt.
|
|
94
|
+
*/
|
|
95
|
+
context?: GithubToolsContext;
|
|
96
96
|
/**
|
|
97
97
|
* Default author for commit-creating tools.
|
|
98
98
|
* Falls back to the authenticated user when omitted.
|
|
@@ -149,5 +149,5 @@ declare function createDurableGithubAgent<P extends readonly GithubToolPreset[]>
|
|
|
149
149
|
preset: P;
|
|
150
150
|
}): DurableGithubAgent<Pick<AllGithubTools, CombinedPresetToolNames<P>>>;
|
|
151
151
|
//#endregion
|
|
152
|
-
export { type AllGithubTools, type ApprovalConfig, type CombinedPresetToolNames, type CommitIdentity, type CommitToolOptions, CreateDurableGithubAgentOptions, type CreateGithubAgentOptions, DurableGithubAgent, DurableGithubAgentGenerateResult, GITHUB_TOOL_NAMES, GITHUB_WRITE_TOOLS, type GithubTokenInput, type GithubToolName, type GithubToolPreset, type GithubTools, type GithubToolsForPreset, type GithubToolsOptions, type GithubWriteToolName, PRESET_TOOLS, type PickGithubTools, type PresetToolName, type ToolOverrides, createDurableGithubAgent, createGithubAgent, createGithubTools, resolveGithubToken };
|
|
152
|
+
export { type AllGithubTools, type ApprovalConfig, type CombinedPresetToolNames, type CommitIdentity, type CommitToolOptions, CreateDurableGithubAgentOptions, type CreateGithubAgentOptions, DurableGithubAgent, DurableGithubAgentGenerateResult, GITHUB_TOOL_NAMES, GITHUB_WRITE_TOOLS, type GithubTokenInput, type GithubToolName, type GithubToolPreset, type GithubTools, type GithubToolsContext, type GithubToolsForPreset, type GithubToolsOptions, type GithubWriteToolName, PRESET_TOOLS, type PickGithubTools, type PresetToolName, type ToolOverrides, createDurableGithubAgent, createGithubAgent, createGithubTools, resolveGithubToken };
|
|
153
153
|
//# sourceMappingURL=workflow.d.mts.map
|
package/dist/workflow.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.d.mts","names":[],"sources":["../src/workflow.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"workflow.d.mts","names":[],"sources":["../src/workflow.ts"],"mappings":";;;;;;;;UA+BiB,iCAAiC,eAAe,UAAU;EACzE;EACA,cAAc;EACd,OAAO;EACP,OAAO,WAAW;EAClB,UAAU;IAAkC,UAAU;;;;;;;;;;;;;cAa3C,mBAAmB,eAAe,UAAU;UAC/C;UACA;UACA;UACA;UACA;EAEI,YAAA,SAAS,qBAAqB;;MAStC,SAAS;;;;;EAQb,OAAO,qBAAqB,SAAS,QAAQ,gBAAgB,wBAC3D,SAAS,2BAA2B,cAAc,SAAS,QAAQ,kBAClE,QAAQ,0BAA0B,cAAc;;;;;;;;EAW7C,WAAW,QAAQ;IAAc;IAAgB,WAAW,cAAc,UAAU,MAAM,cAAc;MAAa,QAAQ,iCAAiC;;;;;;;;KA8B1J,kCACV,KAAK;EACH,gBAAgB;;;;;EAKhB,QAAQ;;;;;;;;;EASR,SAAS,mBAAmB;;;;;;EAM5B,kBAAkB;;;;;EAKlB;;;;;EAKA;;;;EAIA,UAAU;;;;;EAKV,SAAS;;;;;EAKT,YAAY;;;;;EAKZ,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiCA,yBACd,SAAS;EAAoC;IAC5C,mBAAmB;iBACN,yBAAyB,UAAU,kBACjD,SAAS;EAAoC,QAAQ;IACpD,mBAAmB,KAAK,gBAAgB,eAAe;iBAC1C,yBAAyB,mBAAmB,oBAC1D,SAAS;EAAoC,QAAQ;IACpD,mBAAmB,KAAK,gBAAgB,wBAAwB"}
|
package/dist/workflow.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as createGithubAgent, r as resolveInstructions, t as createGithubTools } from "./src-
|
|
1
|
+
import { Xn as resolveGithubToken, i as PRESET_TOOLS, r as GITHUB_TOOL_NAMES, t as GITHUB_WRITE_TOOLS } from "./write-tools-cg_ialNd.mjs";
|
|
2
|
+
import { n as createGithubAgent, r as resolveInstructions, t as createGithubTools } from "./src-D6vC3V8r.mjs";
|
|
3
3
|
import { WorkflowAgent } from "@ai-sdk/workflow";
|
|
4
4
|
//#region src/workflow.ts
|
|
5
5
|
/**
|
|
@@ -63,11 +63,12 @@ var DurableGithubAgent = class {
|
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
|
-
function createDurableGithubAgent({ model, token, preset, requireApproval, instructions, additionalInstructions, author, committer, coAuthors, ...agentOptions }) {
|
|
66
|
+
function createDurableGithubAgent({ model, token, preset, requireApproval, context, instructions, additionalInstructions, author, committer, coAuthors, ...agentOptions }) {
|
|
67
67
|
const tools = createGithubTools({
|
|
68
68
|
token,
|
|
69
69
|
requireApproval,
|
|
70
70
|
preset,
|
|
71
|
+
context,
|
|
71
72
|
author,
|
|
72
73
|
committer,
|
|
73
74
|
coAuthors
|
|
@@ -79,7 +80,8 @@ function createDurableGithubAgent({ model, token, preset, requireApproval, instr
|
|
|
79
80
|
instructions: resolveInstructions({
|
|
80
81
|
preset,
|
|
81
82
|
instructions,
|
|
82
|
-
additionalInstructions
|
|
83
|
+
additionalInstructions,
|
|
84
|
+
context
|
|
83
85
|
})
|
|
84
86
|
});
|
|
85
87
|
}
|
package/dist/workflow.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.mjs","names":[],"sources":["../src/workflow.ts"],"sourcesContent":["import { WorkflowAgent } from '@ai-sdk/workflow'\nimport type {\n WorkflowAgentOptions,\n WorkflowAgentStreamOptions,\n WorkflowAgentStreamResult,\n TelemetryOptions,\n} from '@ai-sdk/workflow'\nimport type {\n LanguageModel,\n ToolSet,\n StepResult,\n FinishReason,\n LanguageModelUsage,\n LanguageModelResponseMetadata,\n ModelMessage,\n StopCondition,\n} from 'ai'\nimport { createGithubTools } from './index'\nimport { resolveInstructions } from './agents'\nimport type { AllGithubTools } from './core/tool-types'\nimport type { CombinedPresetToolNames, GithubToolPreset, PresetToolName } from './core/presets'\nimport type { GithubToolName } from './core/tool-names'\nimport type { ApprovalConfig } from './index'\nimport type { CommitIdentity } from './types'\nimport type { GithubTokenInput } from './core/token'\nimport type { Context } from '@ai-sdk/provider-utils'\n\n/**\n * Result of {@link DurableGithubAgent.generate}.\n */\nexport interface DurableGithubAgentGenerateResult<TTools extends ToolSet = ToolSet> {\n text: string\n finishReason: FinishReason\n usage: LanguageModelUsage\n steps: StepResult<TTools>[]\n response: LanguageModelResponseMetadata & { messages: ModelMessage[] }\n}\n\n/**\n * A wrapper around {@link WorkflowAgent} that adds a non-streaming\n * `.generate()` method alongside the existing `.stream()`.\n *\n * - `.stream()` — delegates to `WorkflowAgent.stream()`. Each tool call is\n * an individually retriable workflow step. Supports `needsApproval` on tools.\n * - `.generate()` — uses `generateText` from the AI SDK for non-streaming\n * execution. Must be called from within a `\"use step\"` function in\n * workflow context (the Workflow runtime blocks raw I/O in workflow scope).\n */\nexport class DurableGithubAgent<TTools extends ToolSet = ToolSet> {\n private agent: WorkflowAgent<TTools>\n private _model: LanguageModel\n private _instructions?: string\n private _telemetry?: TelemetryOptions\n private _tools: TTools\n\n constructor(options: WorkflowAgentOptions<TTools>) {\n this.agent = new WorkflowAgent(options)\n this._model = options.model\n this._instructions = typeof options.instructions === 'string' ? options.instructions : undefined\n this._telemetry = options.telemetry\n this._tools = options.tools ?? {} as TTools\n }\n\n /** The tool set configured for this agent. */\n get tools(): TTools {\n return this.agent.tools\n }\n\n /**\n * Stream the agent's response. Delegates directly to `WorkflowAgent.stream()`.\n * Works in workflow context — each tool call is a durable step.\n */\n stream<TStreamTools extends TTools = TTools, OUTPUT = never, PARTIAL_OUTPUT = never>(\n options: WorkflowAgentStreamOptions<TStreamTools, Context, OUTPUT, PARTIAL_OUTPUT>,\n ): Promise<WorkflowAgentStreamResult<TStreamTools, OUTPUT>> {\n return this.agent.stream(options)\n }\n\n /**\n * Generate a non-streaming response using `generateText` from the AI SDK.\n *\n * In workflow context this **must** be called from within a `\"use step\"`\n * function, because the Workflow runtime blocks direct I/O (HTTP calls)\n * at the workflow scope level.\n */\n async generate({ prompt, stopWhen }: { prompt: string, stopWhen?: StopCondition<TTools> | Array<StopCondition<TTools>> }): Promise<DurableGithubAgentGenerateResult<TTools>> {\n const { generateText } = await import('ai')\n\n const system = this._instructions\n\n const result = await generateText({\n model: this._model,\n tools: this._tools,\n system,\n prompt,\n stopWhen,\n experimental_telemetry: this._telemetry as Parameters<typeof generateText>[0]['experimental_telemetry'],\n })\n\n return {\n text: result.text,\n finishReason: result.finishReason,\n usage: result.usage,\n steps: result.steps as StepResult<TTools>[],\n response: result.response,\n }\n }\n}\n\n/**\n * Options for creating a durable GitHub agent via {@link createDurableGithubAgent}.\n *\n * Extends all `WorkflowAgentOptions` (temperature, telemetry, callbacks, etc.)\n * and adds GitHub-specific fields (token, preset, approval config).\n */\nexport type CreateDurableGithubAgentOptions =\n Omit<WorkflowAgentOptions, 'model' | 'tools' | 'instructions'> & {\n model: string | LanguageModel\n /**\n * GitHub personal access token or async token provider.\n * Falls back to `process.env.GITHUB_TOKEN` when omitted.\n */\n token?: GithubTokenInput\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 * Control whether write operations require user approval before execution.\n *\n * @see {@link ApprovalConfig} for global and per-tool options.\n */\n requireApproval?: ApprovalConfig\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 * Default author for commit-creating tools.\n * Falls back to the authenticated user when omitted.\n */\n author?: CommitIdentity\n /**\n * Default committer for commit-creating tools.\n * Falls back to the authenticated user when omitted.\n */\n committer?: CommitIdentity\n /**\n * Co-authors to attribute on all commits.\n * Added as \"Co-authored-by\" trailers to commit messages.\n */\n coAuthors?: CommitIdentity[]\n }\n\n/**\n * Create a pre-configured durable GitHub agent powered by `WorkflowAgent`\n * from `@ai-sdk/workflow`.\n *\n * Returns a {@link DurableGithubAgent} with two interaction modes:\n *\n * - `.stream()` — works directly in workflow scope; each tool call is a durable step.\n * Write tools honor `requireApproval` via `needsApproval` and pause the workflow\n * until the user approves or denies.\n * - `.generate()` — uses `generateText` from the AI SDK; must be called from\n * within a `\"use step\"` function when running inside a workflow.\n *\n * @example Streaming (chat UI — works in workflow scope)\n * ```ts\n * import { createDurableGithubAgent } from '@github-tools/sdk/workflow'\n * import { getWritable } from 'workflow'\n * import type { ModelMessage, ModelCallStreamPart } from 'ai'\n *\n * async function chatWorkflow(messages: ModelMessage[], token: string) {\n * \"use workflow\"\n * const agent = createDurableGithubAgent({\n * model: 'anthropic/claude-sonnet-4.6',\n * token,\n * preset: 'code-review',\n * })\n * const writable = getWritable<ModelCallStreamPart>()\n * await agent.stream({ messages, writable })\n * }\n * ```\n */\nexport function createDurableGithubAgent(\n options: CreateDurableGithubAgentOptions & { preset?: undefined },\n): DurableGithubAgent<AllGithubTools>\nexport function createDurableGithubAgent<P extends GithubToolPreset>(\n options: CreateDurableGithubAgentOptions & { preset: P },\n): DurableGithubAgent<Pick<AllGithubTools, PresetToolName<P>>>\nexport function createDurableGithubAgent<P extends readonly GithubToolPreset[]>(\n options: CreateDurableGithubAgentOptions & { preset: P },\n): DurableGithubAgent<Pick<AllGithubTools, CombinedPresetToolNames<P>>>\nexport function createDurableGithubAgent({\n model,\n token,\n preset,\n requireApproval,\n instructions,\n additionalInstructions,\n author,\n committer,\n coAuthors,\n ...agentOptions\n}: CreateDurableGithubAgentOptions): DurableGithubAgent<AllGithubTools | Pick<AllGithubTools, GithubToolName>> {\n const tools = createGithubTools({ token, requireApproval, preset, author, committer, coAuthors })\n\n return new DurableGithubAgent({\n ...agentOptions,\n model,\n tools,\n instructions: resolveInstructions({ preset, instructions, additionalInstructions }),\n }) as DurableGithubAgent<typeof tools>\n}\n\nexport { createGithubTools, createGithubAgent } from './index'\nexport type { CommitIdentity, CommitToolOptions, GithubTools, GithubToolsOptions, GithubToolPreset, GithubToolName, GithubWriteToolName, ApprovalConfig, ToolOverrides, AllGithubTools, PresetToolName, CombinedPresetToolNames, GithubToolsForPreset, PickGithubTools, GithubTokenInput } from './index'\nexport { PRESET_TOOLS, GITHUB_TOOL_NAMES, GITHUB_WRITE_TOOLS, resolveGithubToken } from './index'\nexport type { CreateGithubAgentOptions } from './agents'\n"],"mappings":";;;;;;;;;;;;;;AAgDA,IAAa,qBAAb,MAAkE;CAChE;CACA;CACA;CACA;CACA;CAEA,YAAY,SAAuC;AACjD,OAAK,QAAQ,IAAI,cAAc,QAAQ;AACvC,OAAK,SAAS,QAAQ;AACtB,OAAK,gBAAgB,OAAO,QAAQ,iBAAiB,WAAW,QAAQ,eAAe,KAAA;AACvF,OAAK,aAAa,QAAQ;AAC1B,OAAK,SAAS,QAAQ,SAAS,EAAE;;;CAInC,IAAI,QAAgB;AAClB,SAAO,KAAK,MAAM;;;;;;CAOpB,OACE,SAC0D;AAC1D,SAAO,KAAK,MAAM,OAAO,QAAQ;;;;;;;;;CAUnC,MAAM,SAAS,EAAE,QAAQ,YAAoJ;EAC3K,MAAM,EAAE,iBAAiB,MAAM,OAAO;EAEtC,MAAM,SAAS,KAAK;EAEpB,MAAM,SAAS,MAAM,aAAa;GAChC,OAAO,KAAK;GACZ,OAAO,KAAK;GACZ;GACA;GACA;GACA,wBAAwB,KAAK;GAC9B,CAAC;AAEF,SAAO;GACL,MAAM,OAAO;GACb,cAAc,OAAO;GACrB,OAAO,OAAO;GACd,OAAO,OAAO;GACd,UAAU,OAAO;GAClB;;;AAmGL,SAAgB,yBAAyB,EACvC,OACA,OACA,QACA,iBACA,cACA,wBACA,QACA,WACA,WACA,GAAG,gBAC0G;CAC7G,MAAM,QAAQ,kBAAkB;EAAE;EAAO;EAAiB;EAAQ;EAAQ;EAAW;EAAW,CAAC;AAEjG,QAAO,IAAI,mBAAmB;EAC5B,GAAG;EACH;EACA;EACA,cAAc,oBAAoB;GAAE;GAAQ;GAAc;GAAwB,CAAC;EACpF,CAAC"}
|
|
1
|
+
{"version":3,"file":"workflow.mjs","names":[],"sources":["../src/workflow.ts"],"sourcesContent":["import { WorkflowAgent } from '@ai-sdk/workflow'\nimport type {\n WorkflowAgentOptions,\n WorkflowAgentStreamOptions,\n WorkflowAgentStreamResult,\n TelemetryOptions,\n} from '@ai-sdk/workflow'\nimport type {\n LanguageModel,\n ToolSet,\n StepResult,\n FinishReason,\n LanguageModelUsage,\n LanguageModelResponseMetadata,\n ModelMessage,\n StopCondition,\n} from 'ai'\nimport { createGithubTools } from './index'\nimport { resolveInstructions } from './agents'\nimport type { AllGithubTools } from './core/tool-types'\nimport type { CombinedPresetToolNames, GithubToolPreset, PresetToolName } from './core/presets'\nimport type { GithubToolName } from './core/tool-names'\nimport type { ApprovalConfig } from './index'\nimport type { CommitIdentity } from './types'\nimport type { GithubTokenInput } from './core/token'\nimport type { GithubToolsContext } from './core/context'\nimport type { Context } from '@ai-sdk/provider-utils'\n\n/**\n * Result of {@link DurableGithubAgent.generate}.\n */\nexport interface DurableGithubAgentGenerateResult<TTools extends ToolSet = ToolSet> {\n text: string\n finishReason: FinishReason\n usage: LanguageModelUsage\n steps: StepResult<TTools>[]\n response: LanguageModelResponseMetadata & { messages: ModelMessage[] }\n}\n\n/**\n * A wrapper around {@link WorkflowAgent} that adds a non-streaming\n * `.generate()` method alongside the existing `.stream()`.\n *\n * - `.stream()` — delegates to `WorkflowAgent.stream()`. Each tool call is\n * an individually retriable workflow step. Supports `needsApproval` on tools.\n * - `.generate()` — uses `generateText` from the AI SDK for non-streaming\n * execution. Must be called from within a `\"use step\"` function in\n * workflow context (the Workflow runtime blocks raw I/O in workflow scope).\n */\nexport class DurableGithubAgent<TTools extends ToolSet = ToolSet> {\n private agent: WorkflowAgent<TTools>\n private _model: LanguageModel\n private _instructions?: string\n private _telemetry?: TelemetryOptions\n private _tools: TTools\n\n constructor(options: WorkflowAgentOptions<TTools>) {\n this.agent = new WorkflowAgent(options)\n this._model = options.model\n this._instructions = typeof options.instructions === 'string' ? options.instructions : undefined\n this._telemetry = options.telemetry\n this._tools = options.tools ?? {} as TTools\n }\n\n /** The tool set configured for this agent. */\n get tools(): TTools {\n return this.agent.tools\n }\n\n /**\n * Stream the agent's response. Delegates directly to `WorkflowAgent.stream()`.\n * Works in workflow context — each tool call is a durable step.\n */\n stream<TStreamTools extends TTools = TTools, OUTPUT = never, PARTIAL_OUTPUT = never>(\n options: WorkflowAgentStreamOptions<TStreamTools, Context, OUTPUT, PARTIAL_OUTPUT>,\n ): Promise<WorkflowAgentStreamResult<TStreamTools, OUTPUT>> {\n return this.agent.stream(options)\n }\n\n /**\n * Generate a non-streaming response using `generateText` from the AI SDK.\n *\n * In workflow context this **must** be called from within a `\"use step\"`\n * function, because the Workflow runtime blocks direct I/O (HTTP calls)\n * at the workflow scope level.\n */\n async generate({ prompt, stopWhen }: { prompt: string, stopWhen?: StopCondition<TTools> | Array<StopCondition<TTools>> }): Promise<DurableGithubAgentGenerateResult<TTools>> {\n const { generateText } = await import('ai')\n\n const system = this._instructions\n\n const result = await generateText({\n model: this._model,\n tools: this._tools,\n system,\n prompt,\n stopWhen,\n experimental_telemetry: this._telemetry as Parameters<typeof generateText>[0]['experimental_telemetry'],\n })\n\n return {\n text: result.text,\n finishReason: result.finishReason,\n usage: result.usage,\n steps: result.steps as StepResult<TTools>[],\n response: result.response,\n }\n }\n}\n\n/**\n * Options for creating a durable GitHub agent via {@link createDurableGithubAgent}.\n *\n * Extends all `WorkflowAgentOptions` (temperature, telemetry, callbacks, etc.)\n * and adds GitHub-specific fields (token, preset, approval config).\n */\nexport type CreateDurableGithubAgentOptions =\n Omit<WorkflowAgentOptions, 'model' | 'tools' | 'instructions'> & {\n model: string | LanguageModel\n /**\n * GitHub personal access token or async token provider.\n * Falls back to `process.env.GITHUB_TOKEN` when omitted.\n */\n token?: GithubTokenInput\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 * Control whether write operations require user approval before execution.\n *\n * @see {@link ApprovalConfig} for global and per-tool options.\n */\n requireApproval?: ApprovalConfig\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 * Default owner / repo / PR / issue / ref values for tools and the system prompt.\n */\n context?: GithubToolsContext\n /**\n * Default author for commit-creating tools.\n * Falls back to the authenticated user when omitted.\n */\n author?: CommitIdentity\n /**\n * Default committer for commit-creating tools.\n * Falls back to the authenticated user when omitted.\n */\n committer?: CommitIdentity\n /**\n * Co-authors to attribute on all commits.\n * Added as \"Co-authored-by\" trailers to commit messages.\n */\n coAuthors?: CommitIdentity[]\n }\n\n/**\n * Create a pre-configured durable GitHub agent powered by `WorkflowAgent`\n * from `@ai-sdk/workflow`.\n *\n * Returns a {@link DurableGithubAgent} with two interaction modes:\n *\n * - `.stream()` — works directly in workflow scope; each tool call is a durable step.\n * Write tools honor `requireApproval` via `needsApproval` and pause the workflow\n * until the user approves or denies.\n * - `.generate()` — uses `generateText` from the AI SDK; must be called from\n * within a `\"use step\"` function when running inside a workflow.\n *\n * @example Streaming (chat UI — works in workflow scope)\n * ```ts\n * import { createDurableGithubAgent } from '@github-tools/sdk/workflow'\n * import { getWritable } from 'workflow'\n * import type { ModelMessage, ModelCallStreamPart } from 'ai'\n *\n * async function chatWorkflow(messages: ModelMessage[], token: string) {\n * \"use workflow\"\n * const agent = createDurableGithubAgent({\n * model: 'anthropic/claude-sonnet-4.6',\n * token,\n * preset: 'code-review',\n * })\n * const writable = getWritable<ModelCallStreamPart>()\n * await agent.stream({ messages, writable })\n * }\n * ```\n */\nexport function createDurableGithubAgent(\n options: CreateDurableGithubAgentOptions & { preset?: undefined },\n): DurableGithubAgent<AllGithubTools>\nexport function createDurableGithubAgent<P extends GithubToolPreset>(\n options: CreateDurableGithubAgentOptions & { preset: P },\n): DurableGithubAgent<Pick<AllGithubTools, PresetToolName<P>>>\nexport function createDurableGithubAgent<P extends readonly GithubToolPreset[]>(\n options: CreateDurableGithubAgentOptions & { preset: P },\n): DurableGithubAgent<Pick<AllGithubTools, CombinedPresetToolNames<P>>>\nexport function createDurableGithubAgent({\n model,\n token,\n preset,\n requireApproval,\n context,\n instructions,\n additionalInstructions,\n author,\n committer,\n coAuthors,\n ...agentOptions\n}: CreateDurableGithubAgentOptions): DurableGithubAgent<AllGithubTools | Pick<AllGithubTools, GithubToolName>> {\n const tools = createGithubTools({ token, requireApproval, preset, context, author, committer, coAuthors })\n\n return new DurableGithubAgent({\n ...agentOptions,\n model,\n tools,\n instructions: resolveInstructions({ preset, instructions, additionalInstructions, context }),\n }) as DurableGithubAgent<typeof tools>\n}\n\nexport { createGithubTools, createGithubAgent } from './index'\nexport type { CommitIdentity, CommitToolOptions, GithubTools, GithubToolsOptions, GithubToolPreset, GithubToolName, GithubWriteToolName, ApprovalConfig, ToolOverrides, AllGithubTools, PresetToolName, CombinedPresetToolNames, GithubToolsForPreset, PickGithubTools, GithubTokenInput, GithubToolsContext } from './index'\nexport { PRESET_TOOLS, GITHUB_TOOL_NAMES, GITHUB_WRITE_TOOLS, resolveGithubToken } from './index'\nexport type { CreateGithubAgentOptions } from './agents'\n"],"mappings":";;;;;;;;;;;;;;AAiDA,IAAa,qBAAb,MAAkE;CAChE;CACA;CACA;CACA;CACA;CAEA,YAAY,SAAuC;EACjD,KAAK,QAAQ,IAAI,cAAc,OAAO;EACtC,KAAK,SAAS,QAAQ;EACtB,KAAK,gBAAgB,OAAO,QAAQ,iBAAiB,WAAW,QAAQ,eAAe,KAAA;EACvF,KAAK,aAAa,QAAQ;EAC1B,KAAK,SAAS,QAAQ,SAAS,CAAC;CAClC;;CAGA,IAAI,QAAgB;EAClB,OAAO,KAAK,MAAM;CACpB;;;;;CAMA,OACE,SAC0D;EAC1D,OAAO,KAAK,MAAM,OAAO,OAAO;CAClC;;;;;;;;CASA,MAAM,SAAS,EAAE,QAAQ,YAAoJ;EAC3K,MAAM,EAAE,iBAAiB,MAAM,OAAO;EAEtC,MAAM,SAAS,KAAK;EAEpB,MAAM,SAAS,MAAM,aAAa;GAChC,OAAO,KAAK;GACZ,OAAO,KAAK;GACZ;GACA;GACA;GACA,wBAAwB,KAAK;EAC/B,CAAC;EAED,OAAO;GACL,MAAM,OAAO;GACb,cAAc,OAAO;GACrB,OAAO,OAAO;GACd,OAAO,OAAO;GACd,UAAU,OAAO;EACnB;CACF;AACF;AAqGA,SAAgB,yBAAyB,EACvC,OACA,OACA,QACA,iBACA,SACA,cACA,wBACA,QACA,WACA,WACA,GAAG,gBAC0G;CAC7G,MAAM,QAAQ,kBAAkB;EAAE;EAAO;EAAiB;EAAQ;EAAS;EAAQ;EAAW;CAAU,CAAC;CAEzG,OAAO,IAAI,mBAAmB;EAC5B,GAAG;EACH;EACA;EACA,cAAc,oBAAoB;GAAE;GAAQ;GAAc;GAAwB;EAAQ,CAAC;CAC7F,CAAC;AACH"}
|