@github-tools/sdk 1.12.0 → 1.13.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 +17 -12
- package/dist/connect/eve.d.mts +2 -3
- package/dist/connect/eve.d.mts.map +1 -1
- package/dist/connect/eve.mjs +1 -1
- package/dist/connect.d.mts +8 -86
- package/dist/connect.d.mts.map +1 -1
- package/dist/connect.mjs +2 -2
- package/dist/eve-runtime-BkzmgsI2.mjs +274 -0
- package/dist/eve-runtime-BkzmgsI2.mjs.map +1 -0
- package/dist/{eve-runtime-BmoVTbEU.d.mts → eve-runtime-C5HaKmOP.d.mts} +14 -6
- package/dist/eve-runtime-C5HaKmOP.d.mts.map +1 -0
- package/dist/eve-runtime.d.mts +4 -3
- package/dist/eve-runtime.mjs +2 -2
- package/dist/eve.d.mts +4 -4
- package/dist/eve.d.mts.map +1 -1
- package/dist/eve.mjs +2 -2
- package/dist/index-BjRUOM2Z.d.mts +287 -0
- package/dist/index-BjRUOM2Z.d.mts.map +1 -0
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +3 -3
- package/dist/{src-D45Onmsn.mjs → src-DPcwVTf-.mjs} +80 -3
- package/dist/src-DPcwVTf-.mjs.map +1 -0
- package/dist/{token-BIn80-XU.mjs → token-qesvchbI.mjs} +9 -168
- package/dist/token-qesvchbI.mjs.map +1 -0
- package/dist/tool-types-K8i--5D9.d.mts +3255 -0
- package/dist/tool-types-K8i--5D9.d.mts.map +1 -0
- package/dist/{types-CiNZNOXa.d.mts → types-6aWpzNzg.d.mts} +3 -3
- package/dist/{types-CiNZNOXa.d.mts.map → types-6aWpzNzg.d.mts.map} +1 -1
- package/dist/{types-CoTpsxxp.d.mts → types-BVSe0Zey.d.mts} +4 -3
- package/dist/types-BVSe0Zey.d.mts.map +1 -0
- package/dist/workflow.d.mts +2 -1
- package/dist/workflow.d.mts.map +1 -1
- package/dist/workflow.mjs +2 -2
- package/dist/{write-tools-CnJE0Vvu.mjs → write-tools-BEcL5Fv6.mjs} +1056 -184
- package/dist/write-tools-BEcL5Fv6.mjs.map +1 -0
- package/package.json +3 -3
- package/dist/eve-runtime-3asyv7YM.mjs +0 -771
- package/dist/eve-runtime-3asyv7YM.mjs.map +0 -1
- package/dist/eve-runtime-BmoVTbEU.d.mts.map +0 -1
- package/dist/index-CGeFo38P.d.mts +0 -783
- package/dist/index-CGeFo38P.d.mts.map +0 -1
- package/dist/src-D45Onmsn.mjs.map +0 -1
- package/dist/token-BIn80-XU.mjs.map +0 -1
- package/dist/types-CoTpsxxp.d.mts.map +0 -1
- package/dist/write-tools-CnJE0Vvu.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ They all reach the GitHub API, but none of them were built as an agent's tool la
|
|
|
33
33
|
| Production agents that must survive restarts and timeouts | [Durable Agents](#durable-agents-vercel-workflow-sdk) |
|
|
34
34
|
| A GitHub, Slack, or Discord bot | [Chat SDK docs](https://github-tools.com/frameworks/chat-sdk) |
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
84 tools cover repositories, branches, pull requests, issues, reactions, discussions, notifications, commits, releases, checks and statuses, search, gists, and workflows. See the full [Tools Catalog](https://github-tools.com/api/tools-catalog). Write operations support granular approval control out of the box.
|
|
37
37
|
|
|
38
38
|
## Installation
|
|
39
39
|
|
|
@@ -102,16 +102,16 @@ createGithubTools({ token, preset: ['code-review', 'issue-triage'] })
|
|
|
102
102
|
|
|
103
103
|
| Preset | Tools included |
|
|
104
104
|
|---|---|
|
|
105
|
-
| `code-review` | `getPullRequest`, `listPullRequests`, `listPullRequestFiles`, `listPullRequestReviews`, `getPullRequestContext`, `getFileContent`, `listCommits`, `getCommit`, `getBlame`, `compareCommits`, `getRepository`, `listBranches`, `searchCode`, `listCheckRuns`, `getCombinedStatus`, `updatePullRequest`, `addPullRequestComment`, `updatePullRequestComment`, `deletePullRequestComment`, `createPullRequestReview`, `requestReviewers` |
|
|
105
|
+
| `code-review` | `getPullRequest`, `listPullRequests`, `listPullRequestFiles`, `listPullRequestReviews`, `listPullRequestReviewThreads`, `getPullRequestContext`, `getFileContent`, `listCommits`, `getCommit`, `getBlame`, `compareCommits`, `getRepository`, `listBranches`, `searchCode`, `listCheckRuns`, `getCombinedStatus`, `updatePullRequest`, `addPullRequestComment`, `updatePullRequestComment`, `deletePullRequestComment`, `createPullRequestReview`, `replyToReviewComment`, `resolveReviewThread`, `requestReviewers` |
|
|
106
106
|
| `issue-triage` | `listIssues`, `getIssueContext`, `listIssueComments`, `createIssue`, `addIssueComment`, `updateIssueComment`, `deleteIssueComment`, `closeIssue`, `updateIssue`, `addLabels`, `removeLabel`, `createLabel`, `updateLabel`, `deleteLabel`, `addAssignees`, `removeAssignees`, `listIssueReactions`, `addIssueReaction`, `listCommentReactions`, `addCommentReaction`, `getRepository`, `searchRepositories`, `searchCode`, `searchIssues` |
|
|
107
107
|
| `repo-explorer` | All read-only tools including discussions, gists, workflows, checks/statuses, and releases (no write operations) |
|
|
108
|
-
| `ci-ops` | `listWorkflows`, `listWorkflowRuns`, `getWorkflowRun`, `listWorkflowJobs`, `listCheckRuns`, `getCombinedStatus`, `getCiFailureContext`, `triggerWorkflow`, `cancelWorkflowRun`, `rerunWorkflowRun`, `getRepository`, `listBranches`, `listCommits`, `getCommit` |
|
|
109
|
-
| `security-audit` | Read-only exploration (`getFileContent`, `getRepositoryTree`, `searchCode`, `listCommits`, `getCommit`, `getBlame`, `compareCommits`), PR and CI visibility, plus `createIssue`, `addIssueComment`, `addLabels` to report findings (no destructive writes) |
|
|
108
|
+
| `ci-ops` | `listWorkflows`, `listWorkflowRuns`, `getWorkflowRun`, `listWorkflowJobs`, `getWorkflowJobLogs`, `listCheckRuns`, `getCombinedStatus`, `getCiFailureContext`, `triggerWorkflow`, `cancelWorkflowRun`, `rerunWorkflowRun`, `getRepository`, `listBranches`, `listCommits`, `getCommit` |
|
|
109
|
+
| `security-audit` | Read-only exploration (`getFileContent`, `getRepositoryTree`, `searchCode`, `listCommits`, `getCommit`, `getBlame`, `compareCommits`), PR and CI visibility (including `getWorkflowJobLogs`), plus `createIssue`, `addIssueComment`, `addLabels` to report findings (no destructive writes) |
|
|
110
110
|
| `release-manager` | `listReleases`, `getLatestRelease`, `getRelease`, `getReleaseContext`, `createRelease`, `updateRelease`, `deleteRelease`, `compareCommits`, `listCommits`, `getCommit`, `listWorkflowRuns`, `getWorkflowRun`, `listPullRequests`, `getPullRequest`, `getRepository`, `listBranches` |
|
|
111
111
|
| `discussion-moderator` | `listDiscussions`, `getDiscussion`, `addDiscussionComment`, `getRepository`, `searchIssues`, `getIssueContext`, `addIssueComment` |
|
|
112
112
|
| `notification-inbox` | `listNotifications`, `markNotificationRead`, `getIssue`, `getPullRequest`, `getRepository` (requires a Notifications PAT) |
|
|
113
|
-
| `pr-author` | `getRepository`, `listBranches`, `getFileContent`, `createBranch`, `createOrUpdateFile`, `createPullRequest`, `updatePullRequest`, `getPullRequest`, `listPullRequestFiles`, `compareCommits`, `getCommit` |
|
|
114
|
-
| `maintainer` | All
|
|
113
|
+
| `pr-author` | `getRepository`, `listBranches`, `getFileContent`, `createBranch`, `deleteBranch`, `createOrUpdateFile`, `createPullRequest`, `updatePullRequest`, `getPullRequest`, `listPullRequestFiles`, `listPullRequestReviewThreads`, `replyToReviewComment`, `resolveReviewThread`, `compareCommits`, `getCommit` |
|
|
114
|
+
| `maintainer` | All 84 tools |
|
|
115
115
|
|
|
116
116
|
Start with the smallest preset that fits. Use `maintainer` or omit `preset` when you need the full catalog. Full breakdown: [Tools Catalog](https://github-tools.com/api/tools-catalog).
|
|
117
117
|
|
|
@@ -158,7 +158,7 @@ createGithubTools({
|
|
|
158
158
|
})
|
|
159
159
|
```
|
|
160
160
|
|
|
161
|
-
Write tools: `createBranch`, `forkRepository`, `createRepository`, `createOrUpdateFile`, `createPullRequest`, `mergePullRequest`, `updatePullRequest`, `addPullRequestComment`, `updatePullRequestComment`, `deletePullRequestComment`, `createPullRequestReview`, `requestReviewers`, `createIssue`, `addIssueComment`, `updateIssueComment`, `deleteIssueComment`, `closeIssue`, `updateIssue`, `addLabels`, `removeLabel`, `createLabel`, `updateLabel`, `deleteLabel`, `addAssignees`, `removeAssignees`, `addIssueReaction`, `addCommentReaction`, `addDiscussionComment`, `markNotificationRead`, `createGist`, `updateGist`, `deleteGist`, `createGistComment`, `triggerWorkflow`, `cancelWorkflowRun`, `rerunWorkflowRun`, `createRelease`, `updateRelease`, `deleteRelease`.
|
|
161
|
+
Write tools: `createBranch`, `deleteBranch`, `forkRepository`, `createRepository`, `createOrUpdateFile`, `createPullRequest`, `mergePullRequest`, `updatePullRequest`, `addPullRequestComment`, `updatePullRequestComment`, `deletePullRequestComment`, `createPullRequestReview`, `replyToReviewComment`, `resolveReviewThread`, `requestReviewers`, `createIssue`, `addIssueComment`, `updateIssueComment`, `deleteIssueComment`, `closeIssue`, `updateIssue`, `addLabels`, `removeLabel`, `createLabel`, `updateLabel`, `deleteLabel`, `addAssignees`, `removeAssignees`, `addIssueReaction`, `addCommentReaction`, `addDiscussionComment`, `markNotificationRead`, `createGist`, `updateGist`, `deleteGist`, `createGistComment`, `triggerWorkflow`, `cancelWorkflowRun`, `rerunWorkflowRun`, `createRelease`, `updateRelease`, `deleteRelease`.
|
|
162
162
|
|
|
163
163
|
All other tools are read-only and never require approval.
|
|
164
164
|
|
|
@@ -445,7 +445,7 @@ eve replays completed steps but re-runs steps interrupted mid-execution. Write t
|
|
|
445
445
|
| `addIssueReaction`, `addCommentReaction` | Natural: GitHub returns the existing reaction when the user already reacted with the same content |
|
|
446
446
|
| `markNotificationRead` | Natural when the thread is already read |
|
|
447
447
|
| `updateIssue`, `updatePullRequest`, `updateRelease`, `updateIssueComment`, `updatePullRequestComment` | **Not** idempotent: each call applies a new revision |
|
|
448
|
-
| `deleteIssueComment`, `deletePullRequestComment`, `deleteRelease` | **Not** idempotent: deleting an already-deleted resource
|
|
448
|
+
| `deleteIssueComment`, `deletePullRequestComment`, `deleteRelease`, `deleteBranch` | **Not** idempotent: deleting an already-deleted resource fails on GitHub |
|
|
449
449
|
| `addIssueComment`, `addDiscussionComment`, `createIssue`, `mergePullRequest`, `createRelease`, … | **Not** idempotent: each call creates new side effects |
|
|
450
450
|
|
|
451
451
|
Gate non-idempotent writes behind `always()` or `once()` where replay safety matters.
|
|
@@ -482,6 +482,7 @@ List tools (`listCommits`, `listPullRequests`, `listIssues`, `listWorkflowRuns`,
|
|
|
482
482
|
| `getFileContent` | Read a file or directory listing (prefer `startLine`/`endLine` or `maxLines` for large files) |
|
|
483
483
|
| `getRepositoryTree` | List the file and directory structure at a given ref |
|
|
484
484
|
| `createBranch` | Create a new branch from an existing branch or commit SHA |
|
|
485
|
+
| `deleteBranch` | Permanently delete a branch |
|
|
485
486
|
| `forkRepository` | Fork a repository to a user or organization |
|
|
486
487
|
| `createRepository` | Create a new repository for a user or organization |
|
|
487
488
|
| `createOrUpdateFile` | Create or update a file and commit it |
|
|
@@ -494,6 +495,7 @@ List tools (`listCommits`, `listPullRequests`, `listIssues`, `listWorkflowRuns`,
|
|
|
494
495
|
| `getPullRequest` | Get a PR's full details (diff stats, body, merge status; body truncated by default) |
|
|
495
496
|
| `listPullRequestFiles` | List files changed in a PR (patches omitted by default; set `includePatch` / `filenames` for diffs) |
|
|
496
497
|
| `listPullRequestReviews` | List reviews on a PR (approvals, change requests, comments) |
|
|
498
|
+
| `listPullRequestReviewThreads` | List review threads with comments, resolution state, and reply/resolve IDs (unresolved only by default) |
|
|
497
499
|
| `getPullRequestContext` | Fetch PR details plus files, reviews, and optional CI checks in one call |
|
|
498
500
|
| `createPullRequest` | Open a new PR |
|
|
499
501
|
| `mergePullRequest` | Merge a PR (merge, squash, or rebase) |
|
|
@@ -502,6 +504,8 @@ List tools (`listCommits`, `listPullRequests`, `listIssues`, `listWorkflowRuns`,
|
|
|
502
504
|
| `updatePullRequestComment` | Edit the body of a PR comment |
|
|
503
505
|
| `deletePullRequestComment` | Permanently delete a PR comment |
|
|
504
506
|
| `createPullRequestReview` | Submit a formal review (approve, request changes, or comment) with inline comments |
|
|
507
|
+
| `replyToReviewComment` | Reply to a review comment in its thread |
|
|
508
|
+
| `resolveReviewThread` | Mark a review thread as resolved |
|
|
505
509
|
| `requestReviewers` | Request reviews from users or teams on a PR |
|
|
506
510
|
|
|
507
511
|
### Issues
|
|
@@ -573,6 +577,7 @@ Pull request conversations share the issue numbering, so the issue-level tools w
|
|
|
573
577
|
| `listWorkflowRuns` | List workflow runs filtered by workflow, branch, status, or event |
|
|
574
578
|
| `getWorkflowRun` | Get a workflow run's status, timing, and trigger info |
|
|
575
579
|
| `listWorkflowJobs` | List jobs in a workflow run with step-level status |
|
|
580
|
+
| `getWorkflowJobLogs` | Read a job's log output (last 200 lines by default, timestamps stripped) |
|
|
576
581
|
| `triggerWorkflow` | Trigger a workflow via workflow_dispatch event |
|
|
577
582
|
| `cancelWorkflowRun` | Cancel an in-progress workflow run |
|
|
578
583
|
| `rerunWorkflowRun` | Re-run a workflow run, optionally only failed jobs |
|
|
@@ -626,10 +631,10 @@ Create one at **GitHub → Settings → Developer settings → Personal access t
|
|
|
626
631
|
|---|---|---|
|
|
627
632
|
| **Metadata** | Read-only | Always required (auto-included) |
|
|
628
633
|
| **Contents** | Read-only | `getRepository`, `listBranches`, `getFileContent`, `getRepositoryTree`, `listCommits`, `getCommit`, `getBlame`, `compareCommits`, `listReleases`, `getLatestRelease`, `getRelease`, `getReleaseContext` |
|
|
629
|
-
| **Contents** | Read and write | `createBranch`, `createOrUpdateFile`, `createRelease`, `updateRelease`, `deleteRelease` |
|
|
634
|
+
| **Contents** | Read and write | `createBranch`, `deleteBranch`, `createOrUpdateFile`, `createRelease`, `updateRelease`, `deleteRelease` |
|
|
630
635
|
| **Administration** | Read and write | `forkRepository`, `createRepository` |
|
|
631
|
-
| **Pull requests** | Read-only | `listPullRequests`, `getPullRequest`, `listPullRequestFiles`, `listPullRequestReviews`, `getPullRequestContext` |
|
|
632
|
-
| **Pull requests** | Read and write | `createPullRequest`, `mergePullRequest`, `updatePullRequest`, `addPullRequestComment`, `updatePullRequestComment`, `deletePullRequestComment`, `createPullRequestReview`, `requestReviewers` |
|
|
636
|
+
| **Pull requests** | Read-only | `listPullRequests`, `getPullRequest`, `listPullRequestFiles`, `listPullRequestReviews`, `listPullRequestReviewThreads`, `getPullRequestContext` |
|
|
637
|
+
| **Pull requests** | Read and write | `createPullRequest`, `mergePullRequest`, `updatePullRequest`, `addPullRequestComment`, `updatePullRequestComment`, `deletePullRequestComment`, `createPullRequestReview`, `replyToReviewComment`, `resolveReviewThread`, `requestReviewers` |
|
|
633
638
|
| **Issues** | Read-only | `listIssues`, `getIssue`, `getIssueContext`, `listIssueComments`, `listLabels`, `listIssueReactions`, `listCommentReactions` |
|
|
634
639
|
| **Issues** | Read and write | `createIssue`, `addIssueComment`, `updateIssueComment`, `deleteIssueComment`, `closeIssue`, `updateIssue`, `addLabels`, `removeLabel`, `createLabel`, `updateLabel`, `deleteLabel`, `addAssignees`, `removeAssignees`, `addIssueReaction`, `addCommentReaction` |
|
|
635
640
|
| **Discussions** | Read-only | `listDiscussions`, `getDiscussion` |
|
|
@@ -637,7 +642,7 @@ Create one at **GitHub → Settings → Developer settings → Personal access t
|
|
|
637
642
|
| **Gists** | Read-only | `listGists`, `getGist`, `listGistComments` |
|
|
638
643
|
| **Gists** | Read and write | `createGist`, `updateGist`, `deleteGist`, `createGistComment` |
|
|
639
644
|
| **Notifications** (account) | Read and write | `listNotifications`, `markNotificationRead` |
|
|
640
|
-
| **Actions** | Read-only | `listWorkflows`, `listWorkflowRuns`, `getWorkflowRun`, `listWorkflowJobs`, `getCiFailureContext` |
|
|
645
|
+
| **Actions** | Read-only | `listWorkflows`, `listWorkflowRuns`, `getWorkflowRun`, `listWorkflowJobs`, `getWorkflowJobLogs`, `getCiFailureContext` |
|
|
641
646
|
| **Actions** | Read and write | `triggerWorkflow`, `cancelWorkflowRun`, `rerunWorkflowRun` |
|
|
642
647
|
| **Checks** | Read-only | `listCheckRuns`, `getCiFailureContext` |
|
|
643
648
|
| **Commit statuses** | Read-only | `getCombinedStatus`, `getCiFailureContext` |
|
package/dist/connect/eve.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as GithubConnectorInput, t as ConnectGithubEveToolsOptions } from "../types-CiNZNOXa.mjs";
|
|
1
|
+
import { a as GithubConnectorInput, t as ConnectGithubEveToolsOptions } from "../types-6aWpzNzg.mjs";
|
|
3
2
|
//#region src/connect/eve.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Register eve GitHub tools backed by a Vercel Connect connector.
|
|
@@ -24,7 +23,7 @@ import { a as GithubConnectorInput, t as ConnectGithubEveToolsOptions } from "..
|
|
|
24
23
|
* `build.externalDependencies: ['@vercel/connect']` in `agent.ts`. Prefer the
|
|
25
24
|
* eve extension (pre-built) so that workaround is unnecessary.
|
|
26
25
|
*/
|
|
27
|
-
declare function connectGithubTools(connector: GithubConnectorInput, options?: ConnectGithubEveToolsOptions): import("eve/tools").DynamicSentinel<Partial<Record<
|
|
26
|
+
declare function connectGithubTools(connector: GithubConnectorInput, options?: ConnectGithubEveToolsOptions): import("eve/tools").DynamicSentinel<Partial<Record<"getPullRequest" | "listPullRequests" | "listPullRequestFiles" | "listPullRequestReviews" | "listPullRequestReviewThreads" | "getPullRequestContext" | "getFileContent" | "listCommits" | "getCommit" | "getBlame" | "compareCommits" | "getRepository" | "listBranches" | "searchCode" | "listCheckRuns" | "getCombinedStatus" | "updatePullRequest" | "addPullRequestComment" | "updatePullRequestComment" | "deletePullRequestComment" | "createPullRequestReview" | "replyToReviewComment" | "resolveReviewThread" | "requestReviewers" | "listIssues" | "getIssueContext" | "listIssueComments" | "createIssue" | "addIssueComment" | "updateIssueComment" | "deleteIssueComment" | "closeIssue" | "updateIssue" | "addLabels" | "removeLabel" | "createLabel" | "updateLabel" | "deleteLabel" | "addAssignees" | "removeAssignees" | "listIssueReactions" | "addIssueReaction" | "listCommentReactions" | "addCommentReaction" | "searchRepositories" | "searchIssues" | "listWorkflows" | "listWorkflowRuns" | "getWorkflowRun" | "listWorkflowJobs" | "getWorkflowJobLogs" | "getCiFailureContext" | "triggerWorkflow" | "cancelWorkflowRun" | "rerunWorkflowRun" | "getRepositoryTree" | "getIssue" | "listDiscussions" | "getDiscussion" | "listLabels" | "listGists" | "getGist" | "listGistComments" | "listReleases" | "getLatestRelease" | "getRelease" | "getReleaseContext" | "createRelease" | "updateRelease" | "deleteRelease" | "addDiscussionComment" | "listNotifications" | "markNotificationRead" | "createBranch" | "deleteBranch" | "createOrUpdateFile" | "createPullRequest" | "forkRepository" | "createRepository" | "mergePullRequest" | "createGist" | "updateGist" | "deleteGist" | "createGistComment", import("eve/tools").ToolDefinition<unknown, unknown>>>>;
|
|
28
27
|
//#endregion
|
|
29
28
|
export { connectGithubTools };
|
|
30
29
|
//# sourceMappingURL=eve.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eve.d.mts","names":[],"sources":["../../src/connect/eve.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"eve.d.mts","names":[],"sources":["../../src/connect/eve.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;iBA4BgB,mBACd,WAAW,sBACX,UAAS,mDAAiC,gBAAA,QAAA,qqDAAA"}
|
package/dist/connect/eve.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createGithubTools } from "../eve.mjs";
|
|
2
|
-
import { t as connectGithubToken } from "../token-
|
|
2
|
+
import { t as connectGithubToken } from "../token-qesvchbI.mjs";
|
|
3
3
|
//#region src/connect/eve.ts
|
|
4
4
|
/**
|
|
5
5
|
* Register eve GitHub tools backed by a Vercel Connect connector.
|
package/dist/connect.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
1
|
+
import { a as GithubConnectorInput, i as GithubConnectParams, n as ConnectGithubTokenOptions, o as resolveGithubConnector, r as ConnectGithubToolsOptions, t as ConnectGithubEveToolsOptions } from "./types-6aWpzNzg.mjs";
|
|
2
|
+
import { a as GithubTokenInput, d as GithubToolPreset, h as GithubToolName, t as AllGithubTools } from "./tool-types-K8i--5D9.mjs";
|
|
3
|
+
import "./index-BjRUOM2Z.mjs";
|
|
3
4
|
import "@vercel/connect";
|
|
4
5
|
//#region src/connect/scopes.d.ts
|
|
5
6
|
/**
|
|
@@ -36,90 +37,11 @@ declare const PRESET_CONNECT_SCOPES: {
|
|
|
36
37
|
readonly maintainer: readonly ["contents:read", "contents:write", "metadata:read", "pull_requests:read", "pull_requests:write", "issues:read", "issues:write", "discussions:read", "discussions:write", "actions:read", "actions:write", "checks:read", "statuses:read", "administration:read", "administration:write"];
|
|
37
38
|
};
|
|
38
39
|
/**
|
|
39
|
-
* Per-tool Connect scopes
|
|
40
|
-
* notification tools (installation tokens cannot
|
|
40
|
+
* Per-tool Connect scopes, derived from `GITHUB_TOOL_CATALOG`. Empty arrays are
|
|
41
|
+
* intentional for gist and notification tools (installation tokens cannot
|
|
42
|
+
* satisfy those APIs).
|
|
41
43
|
*/
|
|
42
|
-
declare const TOOL_CONNECT_SCOPES:
|
|
43
|
-
readonly getRepository: readonly ["contents:read", "metadata:read"];
|
|
44
|
-
readonly listBranches: readonly ["contents:read", "metadata:read"];
|
|
45
|
-
readonly getFileContent: readonly ["contents:read", "metadata:read"];
|
|
46
|
-
readonly getRepositoryTree: readonly ["contents:read", "metadata:read"];
|
|
47
|
-
readonly createBranch: readonly ["contents:read", "contents:write", "metadata:read"];
|
|
48
|
-
readonly forkRepository: readonly ["contents:read", "metadata:read"];
|
|
49
|
-
readonly createRepository: readonly ["metadata:read", "administration:read", "administration:write"];
|
|
50
|
-
readonly createOrUpdateFile: readonly ["contents:read", "contents:write", "metadata:read"];
|
|
51
|
-
readonly listPullRequests: readonly ["contents:read", "metadata:read", "pull_requests:read"];
|
|
52
|
-
readonly getPullRequest: readonly ["contents:read", "metadata:read", "pull_requests:read"];
|
|
53
|
-
readonly createPullRequest: readonly ["contents:read", "metadata:read", "pull_requests:read", "pull_requests:write"];
|
|
54
|
-
readonly mergePullRequest: readonly ["contents:read", "metadata:read", "pull_requests:read", "pull_requests:write"];
|
|
55
|
-
readonly updatePullRequest: readonly ["contents:read", "metadata:read", "pull_requests:read", "pull_requests:write"];
|
|
56
|
-
readonly addPullRequestComment: readonly ["contents:read", "metadata:read", "pull_requests:read", "pull_requests:write"];
|
|
57
|
-
readonly updatePullRequestComment: readonly ["contents:read", "metadata:read", "pull_requests:read", "pull_requests:write"];
|
|
58
|
-
readonly deletePullRequestComment: readonly ["contents:read", "metadata:read", "pull_requests:read", "pull_requests:write"];
|
|
59
|
-
readonly listPullRequestFiles: readonly ["contents:read", "metadata:read", "pull_requests:read"];
|
|
60
|
-
readonly listPullRequestReviews: readonly ["contents:read", "metadata:read", "pull_requests:read"];
|
|
61
|
-
readonly createPullRequestReview: readonly ["contents:read", "metadata:read", "pull_requests:read", "pull_requests:write"];
|
|
62
|
-
readonly requestReviewers: readonly ["contents:read", "metadata:read", "pull_requests:read", "pull_requests:write"];
|
|
63
|
-
readonly getPullRequestContext: readonly ["contents:read", "metadata:read", "pull_requests:read", "checks:read", "statuses:read"];
|
|
64
|
-
readonly listIssues: readonly ["contents:read", "metadata:read", "issues:read"];
|
|
65
|
-
readonly getIssue: readonly ["contents:read", "metadata:read", "issues:read"];
|
|
66
|
-
readonly getIssueContext: readonly ["contents:read", "metadata:read", "issues:read"];
|
|
67
|
-
readonly listIssueComments: readonly ["contents:read", "metadata:read", "issues:read"];
|
|
68
|
-
readonly createIssue: readonly ["contents:read", "metadata:read", "issues:read", "issues:write"];
|
|
69
|
-
readonly addIssueComment: readonly ["contents:read", "metadata:read", "issues:read", "issues:write"];
|
|
70
|
-
readonly updateIssueComment: readonly ["contents:read", "metadata:read", "issues:read", "issues:write"];
|
|
71
|
-
readonly deleteIssueComment: readonly ["contents:read", "metadata:read", "issues:read", "issues:write"];
|
|
72
|
-
readonly closeIssue: readonly ["contents:read", "metadata:read", "issues:read", "issues:write"];
|
|
73
|
-
readonly updateIssue: readonly ["contents:read", "metadata:read", "issues:read", "issues:write"];
|
|
74
|
-
readonly listLabels: readonly ["contents:read", "metadata:read", "issues:read"];
|
|
75
|
-
readonly addLabels: readonly ["contents:read", "metadata:read", "issues:read", "issues:write"];
|
|
76
|
-
readonly removeLabel: readonly ["contents:read", "metadata:read", "issues:read", "issues:write"];
|
|
77
|
-
readonly createLabel: readonly ["contents:read", "metadata:read", "issues:read", "issues:write"];
|
|
78
|
-
readonly updateLabel: readonly ["contents:read", "metadata:read", "issues:read", "issues:write"];
|
|
79
|
-
readonly deleteLabel: readonly ["contents:read", "metadata:read", "issues:read", "issues:write"];
|
|
80
|
-
readonly addAssignees: readonly ["contents:read", "metadata:read", "issues:read", "issues:write"];
|
|
81
|
-
readonly removeAssignees: readonly ["contents:read", "metadata:read", "issues:read", "issues:write"];
|
|
82
|
-
readonly searchCode: readonly ["contents:read", "metadata:read"];
|
|
83
|
-
readonly searchRepositories: readonly ["metadata:read"];
|
|
84
|
-
readonly searchIssues: readonly ["metadata:read", "issues:read", "pull_requests:read"];
|
|
85
|
-
readonly listCommits: readonly ["contents:read", "metadata:read"];
|
|
86
|
-
readonly getCommit: readonly ["contents:read", "metadata:read"];
|
|
87
|
-
readonly getBlame: readonly ["contents:read", "metadata:read"];
|
|
88
|
-
readonly compareCommits: readonly ["contents:read", "metadata:read"];
|
|
89
|
-
readonly listGists: readonly [];
|
|
90
|
-
readonly getGist: readonly [];
|
|
91
|
-
readonly listGistComments: readonly [];
|
|
92
|
-
readonly createGist: readonly [];
|
|
93
|
-
readonly updateGist: readonly [];
|
|
94
|
-
readonly deleteGist: readonly [];
|
|
95
|
-
readonly createGistComment: readonly [];
|
|
96
|
-
readonly listWorkflows: readonly ["contents:read", "metadata:read", "actions:read"];
|
|
97
|
-
readonly listWorkflowRuns: readonly ["contents:read", "metadata:read", "actions:read"];
|
|
98
|
-
readonly getWorkflowRun: readonly ["contents:read", "metadata:read", "actions:read"];
|
|
99
|
-
readonly listWorkflowJobs: readonly ["contents:read", "metadata:read", "actions:read"];
|
|
100
|
-
readonly triggerWorkflow: readonly ["contents:read", "metadata:read", "actions:read", "actions:write"];
|
|
101
|
-
readonly cancelWorkflowRun: readonly ["contents:read", "metadata:read", "actions:read", "actions:write"];
|
|
102
|
-
readonly rerunWorkflowRun: readonly ["contents:read", "metadata:read", "actions:read", "actions:write"];
|
|
103
|
-
readonly listCheckRuns: readonly ["contents:read", "metadata:read", "checks:read", "statuses:read"];
|
|
104
|
-
readonly getCombinedStatus: readonly ["contents:read", "metadata:read", "checks:read", "statuses:read"];
|
|
105
|
-
readonly getCiFailureContext: readonly ["contents:read", "metadata:read", "actions:read", "checks:read", "statuses:read"];
|
|
106
|
-
readonly listDiscussions: readonly ["contents:read", "metadata:read", "discussions:read"];
|
|
107
|
-
readonly getDiscussion: readonly ["contents:read", "metadata:read", "discussions:read"];
|
|
108
|
-
readonly addDiscussionComment: readonly ["contents:read", "metadata:read", "discussions:read", "discussions:write"];
|
|
109
|
-
readonly listNotifications: readonly [];
|
|
110
|
-
readonly markNotificationRead: readonly [];
|
|
111
|
-
readonly listIssueReactions: readonly ["contents:read", "metadata:read", "issues:read"];
|
|
112
|
-
readonly addIssueReaction: readonly ["contents:read", "metadata:read", "issues:read", "issues:write"];
|
|
113
|
-
readonly listCommentReactions: readonly ["contents:read", "metadata:read", "issues:read"];
|
|
114
|
-
readonly addCommentReaction: readonly ["contents:read", "metadata:read", "issues:read", "issues:write"];
|
|
115
|
-
readonly listReleases: readonly ["contents:read", "metadata:read"];
|
|
116
|
-
readonly getLatestRelease: readonly ["contents:read", "metadata:read"];
|
|
117
|
-
readonly getRelease: readonly ["contents:read", "metadata:read"];
|
|
118
|
-
readonly getReleaseContext: readonly ["contents:read", "metadata:read"];
|
|
119
|
-
readonly createRelease: readonly ["contents:read", "contents:write", "metadata:read"];
|
|
120
|
-
readonly updateRelease: readonly ["contents:read", "contents:write", "metadata:read"];
|
|
121
|
-
readonly deleteRelease: readonly ["contents:read", "contents:write", "metadata:read"];
|
|
122
|
-
};
|
|
44
|
+
declare const TOOL_CONNECT_SCOPES: Record<"getPullRequest" | "listPullRequests" | "listPullRequestFiles" | "listPullRequestReviews" | "listPullRequestReviewThreads" | "getPullRequestContext" | "getFileContent" | "listCommits" | "getCommit" | "getBlame" | "compareCommits" | "getRepository" | "listBranches" | "searchCode" | "listCheckRuns" | "getCombinedStatus" | "updatePullRequest" | "addPullRequestComment" | "updatePullRequestComment" | "deletePullRequestComment" | "createPullRequestReview" | "replyToReviewComment" | "resolveReviewThread" | "requestReviewers" | "listIssues" | "getIssueContext" | "listIssueComments" | "createIssue" | "addIssueComment" | "updateIssueComment" | "deleteIssueComment" | "closeIssue" | "updateIssue" | "addLabels" | "removeLabel" | "createLabel" | "updateLabel" | "deleteLabel" | "addAssignees" | "removeAssignees" | "listIssueReactions" | "addIssueReaction" | "listCommentReactions" | "addCommentReaction" | "searchRepositories" | "searchIssues" | "listWorkflows" | "listWorkflowRuns" | "getWorkflowRun" | "listWorkflowJobs" | "getWorkflowJobLogs" | "getCiFailureContext" | "triggerWorkflow" | "cancelWorkflowRun" | "rerunWorkflowRun" | "getRepositoryTree" | "getIssue" | "listDiscussions" | "getDiscussion" | "listLabels" | "listGists" | "getGist" | "listGistComments" | "listReleases" | "getLatestRelease" | "getRelease" | "getReleaseContext" | "createRelease" | "updateRelease" | "deleteRelease" | "addDiscussionComment" | "listNotifications" | "markNotificationRead" | "createBranch" | "deleteBranch" | "createOrUpdateFile" | "createPullRequest" | "forkRepository" | "createRepository" | "mergePullRequest" | "createGist" | "updateGist" | "deleteGist" | "createGistComment", readonly string[]>;
|
|
123
45
|
/**
|
|
124
46
|
* Returns Vercel Connect scopes for a preset or combined presets.
|
|
125
47
|
* Without a preset, returns the union of all preset scopes (full tool set).
|
|
@@ -165,7 +87,7 @@ declare function connectGithubToken(connector: GithubConnectorInput, options?: C
|
|
|
165
87
|
* `connector` may be a static name or a resolver function — e.g. to pick a
|
|
166
88
|
* different connector per environment (production vs. preview) or tenant.
|
|
167
89
|
*/
|
|
168
|
-
declare function connectGithubTools(connector: GithubConnectorInput, options?: ConnectGithubToolsOptions): AllGithubTools | Pick<AllGithubTools,
|
|
90
|
+
declare function connectGithubTools(connector: GithubConnectorInput, options?: ConnectGithubToolsOptions): AllGithubTools | Pick<AllGithubTools, "getPullRequest" | "listPullRequests" | "listPullRequestFiles" | "listPullRequestReviews" | "listPullRequestReviewThreads" | "getPullRequestContext" | "getFileContent" | "listCommits" | "getCommit" | "getBlame" | "compareCommits" | "getRepository" | "listBranches" | "searchCode" | "listCheckRuns" | "getCombinedStatus" | "updatePullRequest" | "addPullRequestComment" | "updatePullRequestComment" | "deletePullRequestComment" | "createPullRequestReview" | "replyToReviewComment" | "resolveReviewThread" | "requestReviewers" | "listIssues" | "getIssueContext" | "listIssueComments" | "createIssue" | "addIssueComment" | "updateIssueComment" | "deleteIssueComment" | "closeIssue" | "updateIssue" | "addLabels" | "removeLabel" | "createLabel" | "updateLabel" | "deleteLabel" | "addAssignees" | "removeAssignees" | "listIssueReactions" | "addIssueReaction" | "listCommentReactions" | "addCommentReaction" | "searchRepositories" | "searchIssues" | "listWorkflows" | "listWorkflowRuns" | "getWorkflowRun" | "listWorkflowJobs" | "getWorkflowJobLogs" | "getCiFailureContext" | "triggerWorkflow" | "cancelWorkflowRun" | "rerunWorkflowRun" | "getRepositoryTree" | "getIssue" | "listDiscussions" | "getDiscussion" | "listLabels" | "listGists" | "getGist" | "listGistComments" | "listReleases" | "getLatestRelease" | "getRelease" | "getReleaseContext" | "createRelease" | "updateRelease" | "deleteRelease" | "addDiscussionComment" | "listNotifications" | "markNotificationRead" | "createBranch" | "deleteBranch" | "createOrUpdateFile" | "createPullRequest" | "forkRepository" | "createRepository" | "mergePullRequest" | "createGist" | "updateGist" | "deleteGist" | "createGistComment">;
|
|
169
91
|
//#endregion
|
|
170
92
|
export { type ConnectGithubEveToolsOptions, type ConnectGithubTokenOptions, type ConnectGithubToolsOptions, type ConnectScopeSelection, type GithubConnectParams, type GithubConnectorInput, PRESET_CONNECT_SCOPES, TOOL_CONNECT_SCOPES, connectGithubScopesForPreset, connectGithubScopesForSelection, connectGithubScopesForTools, connectGithubToken, connectGithubTools, resolveGithubConnector };
|
|
171
93
|
//# sourceMappingURL=connect.d.mts.map
|
package/dist/connect.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.d.mts","names":[],"sources":["../src/connect/scopes.ts","../src/connect/token.ts","../src/connect/tools.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"connect.d.mts","names":[],"sources":["../src/connect/scopes.ts","../src/connect/token.ts","../src/connect/tools.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;cAyBa;;;;;;;;;;;;;;;;;cAwHA,qBAAmB;;;;;iBAgBhB,6BACd,SAAS,mBAAmB;;;;;iBAcd,4BAA4B,gBAAgB;KAUhD;EACV,SAAS,mBAAmB;EAC5B,mBAAmB;EACnB,mBAAmB;;;;;;;;;;iBA6BL,gCAAgC,YAAW;;;;;;;;;;;;iBC3M3C,mBACd,WAAW,sBACX,UAAS,4BACR;;;;;;;;;;iBCNa,mBACd,WAAW,sBACX,UAAS,4BAAA,iBAA8B,KAAA"}
|
package/dist/connect.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as createGithubTools } from "./src-
|
|
2
|
-
import { a as connectGithubScopesForSelection, i as connectGithubScopesForPreset, n as PRESET_CONNECT_SCOPES, o as connectGithubScopesForTools, r as TOOL_CONNECT_SCOPES, s as resolveGithubConnector, t as connectGithubToken } from "./token-
|
|
1
|
+
import { t as createGithubTools } from "./src-DPcwVTf-.mjs";
|
|
2
|
+
import { a as connectGithubScopesForSelection, i as connectGithubScopesForPreset, n as PRESET_CONNECT_SCOPES, o as connectGithubScopesForTools, r as TOOL_CONNECT_SCOPES, s as resolveGithubConnector, t as connectGithubToken } from "./token-qesvchbI.mjs";
|
|
3
3
|
//#region src/connect/tools.ts
|
|
4
4
|
/**
|
|
5
5
|
* Create GitHub tools backed by a Vercel Connect connector.
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { Ci as compareCommitsToModelOutput, Di as listPullRequestFilesToModelOutput, Ei as getPullRequestContextToModelOutput, Si as resolveGithubToken, Ti as getFileContentToModelOutput, a as isGithubWriteToolName, d as softenContextSchema, i as GITHUB_TOOL_CATALOG, na as stripRateLimit, r as ALL_GITHUB_TOOL_NAMES, s as resolvePresetTools, u as mergeContextArgs, wi as getCommitToModelOutput, xi as createGithubTokenResolver } from "./write-tools-BEcL5Fv6.mjs";
|
|
2
|
+
import * as eveTools from "eve/tools";
|
|
3
|
+
import * as eveApproval from "eve/tools/approval";
|
|
4
|
+
//#region src/eve/load-eve.ts
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Never thrown since eve moved to static ESM imports — a missing
|
|
7
|
+
* `eve` package now fails at module resolution with the bundler/runtime's own
|
|
8
|
+
* error. Kept only for backward compatibility of the public export; do not
|
|
9
|
+
* match on it. Will be removed in the next major.
|
|
10
|
+
*/
|
|
11
|
+
const MISSING_EVE_MESSAGE = "The \"eve\" package is required to use @github-tools/sdk/eve. Install it with: pnpm add eve";
|
|
12
|
+
function getEveTools() {
|
|
13
|
+
return eveTools;
|
|
14
|
+
}
|
|
15
|
+
function getEveApprovalHelpers() {
|
|
16
|
+
return eveApproval;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/eve/approval.ts
|
|
20
|
+
/**
|
|
21
|
+
* `false` / `'never'` should omit the tool `approval` field entirely.
|
|
22
|
+
* eve treats a missing `approval` like `never()`; attaching `never()` is
|
|
23
|
+
* redundant and has caused approval UI noise on some channels.
|
|
24
|
+
*/
|
|
25
|
+
function isEveApprovalDisabled(value) {
|
|
26
|
+
return value === false || value === "never";
|
|
27
|
+
}
|
|
28
|
+
function mapEveApprovalValue(value) {
|
|
29
|
+
if (typeof value === "function") return value;
|
|
30
|
+
if (typeof value === "object") return value.request;
|
|
31
|
+
const { always, never, once } = getEveApprovalHelpers();
|
|
32
|
+
if (value === true || value === "always") return always();
|
|
33
|
+
if (value === false || value === "never") return never();
|
|
34
|
+
return once();
|
|
35
|
+
}
|
|
36
|
+
function resolveEveApproval(toolName, config) {
|
|
37
|
+
if (config === void 0) return getEveApprovalHelpers().always();
|
|
38
|
+
if (config === true) return getEveApprovalHelpers().always();
|
|
39
|
+
if (config === false) return getEveApprovalHelpers().never();
|
|
40
|
+
const value = config[toolName];
|
|
41
|
+
if (value === void 0) return getEveApprovalHelpers().always();
|
|
42
|
+
return mapEveApprovalValue(value);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Approval to attach on a write tool, or `undefined` to omit the field.
|
|
46
|
+
* Prefer this when building `defineTool` values so `false` / `'never'` do not
|
|
47
|
+
* attach a redundant `never()` handler.
|
|
48
|
+
*/
|
|
49
|
+
function resolveEveToolApproval(toolName, config, override) {
|
|
50
|
+
const value = override !== void 0 ? override : typeof config === "object" && config !== null ? config[toolName] : config;
|
|
51
|
+
if (value === void 0) return getEveApprovalHelpers().always();
|
|
52
|
+
if (isEveApprovalDisabled(value)) return void 0;
|
|
53
|
+
if (typeof value === "function" || typeof value === "object") return value;
|
|
54
|
+
return mapEveApprovalValue(value);
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/eve/registry.ts
|
|
58
|
+
function withToken(core, ctx, extra) {
|
|
59
|
+
return async (input) => core({
|
|
60
|
+
token: await resolveGithubToken(ctx.token),
|
|
61
|
+
...extra,
|
|
62
|
+
...mergeContextArgs(input, ctx.context ?? {})
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function modelOutputAdapter(fn) {
|
|
66
|
+
return (output) => fn({
|
|
67
|
+
toolCallId: "",
|
|
68
|
+
input: {},
|
|
69
|
+
output
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
const GITHUB_EVE_TOOL_MODEL_OUTPUT = {
|
|
73
|
+
getFileContent: modelOutputAdapter(getFileContentToModelOutput),
|
|
74
|
+
listPullRequestFiles: modelOutputAdapter(listPullRequestFilesToModelOutput),
|
|
75
|
+
getPullRequestContext: modelOutputAdapter(getPullRequestContextToModelOutput),
|
|
76
|
+
getCommit: modelOutputAdapter(getCommitToModelOutput),
|
|
77
|
+
compareCommits: modelOutputAdapter(compareCommitsToModelOutput)
|
|
78
|
+
};
|
|
79
|
+
const EVE_TOOL_MODEL_OUTPUTS = GITHUB_EVE_TOOL_MODEL_OUTPUT;
|
|
80
|
+
/** Whether a GitHub tool has a built-in eve `toModelOutput` projection. */
|
|
81
|
+
function hasGithubEveToolModelOutput(name) {
|
|
82
|
+
return Object.hasOwn(GITHUB_EVE_TOOL_MODEL_OUTPUT, name);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Apply the built-in eve `toModelOutput` projection for a tool.
|
|
86
|
+
* Strips `rateLimit` so it never reaches the model. Tools without a dedicated
|
|
87
|
+
* formatter get `{ type: 'json', value }` of the remaining payload.
|
|
88
|
+
* Used by `@github-tools/eve-extension` so the callback only closes over a serializable tool name.
|
|
89
|
+
*/
|
|
90
|
+
function formatGithubEveToolOutput(name, output) {
|
|
91
|
+
const stripped = stripRateLimit(output);
|
|
92
|
+
if (isErrorPayload(stripped)) return {
|
|
93
|
+
type: "json",
|
|
94
|
+
value: stripped
|
|
95
|
+
};
|
|
96
|
+
const format = GITHUB_EVE_TOOL_MODEL_OUTPUT[name];
|
|
97
|
+
if (!format) return {
|
|
98
|
+
type: "json",
|
|
99
|
+
value: stripped
|
|
100
|
+
};
|
|
101
|
+
return format(stripped);
|
|
102
|
+
}
|
|
103
|
+
function isErrorPayload(output) {
|
|
104
|
+
return output != null && typeof output === "object" && !Array.isArray(output) && typeof output.error === "string";
|
|
105
|
+
}
|
|
106
|
+
function createToolRegistry(ctx) {
|
|
107
|
+
const commitExtras = {
|
|
108
|
+
createOrUpdateFile: {
|
|
109
|
+
author: ctx.author,
|
|
110
|
+
committer: ctx.committer,
|
|
111
|
+
coAuthors: ctx.coAuthors
|
|
112
|
+
},
|
|
113
|
+
mergePullRequest: { coAuthors: ctx.coAuthors }
|
|
114
|
+
};
|
|
115
|
+
const entries = ALL_GITHUB_TOOL_NAMES.map((name) => {
|
|
116
|
+
const descriptor = GITHUB_TOOL_CATALOG[name];
|
|
117
|
+
const core = descriptor.core;
|
|
118
|
+
const toModelOutput = EVE_TOOL_MODEL_OUTPUTS[name];
|
|
119
|
+
return {
|
|
120
|
+
name,
|
|
121
|
+
...isGithubWriteToolName(name) && { writeTool: name },
|
|
122
|
+
description: descriptor.description,
|
|
123
|
+
inputSchema: descriptor.inputSchema,
|
|
124
|
+
execute: withToken(core, ctx, commitExtras[name]),
|
|
125
|
+
...toModelOutput && { toModelOutput }
|
|
126
|
+
};
|
|
127
|
+
});
|
|
128
|
+
if (!ctx.context) return entries;
|
|
129
|
+
return entries.map((entry) => ({
|
|
130
|
+
...entry,
|
|
131
|
+
inputSchema: softenContextSchema(entry.inputSchema, ctx.context)
|
|
132
|
+
}));
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region src/eve/steps.ts
|
|
136
|
+
async function executeGithubToolStep(name, input, ctx) {
|
|
137
|
+
"use step";
|
|
138
|
+
const entry = createToolRegistry(ctx).find((tool) => tool.name === name);
|
|
139
|
+
if (!entry) throw new Error(`Unknown GitHub tool: ${name}`);
|
|
140
|
+
return entry.execute(input);
|
|
141
|
+
}
|
|
142
|
+
async function runGithubToolStep(name, input, ctx) {
|
|
143
|
+
try {
|
|
144
|
+
const token = await resolveGithubToken(ctx.token);
|
|
145
|
+
return await executeGithubToolStep(name, input, {
|
|
146
|
+
...ctx,
|
|
147
|
+
token
|
|
148
|
+
});
|
|
149
|
+
} catch (error) {
|
|
150
|
+
return { error: error instanceof Error ? error.message : String(error) };
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region src/eve/build.ts
|
|
155
|
+
function resolveAllowedToolNames(options) {
|
|
156
|
+
const presetAllowed = options.preset ? resolvePresetTools(options.preset) : null;
|
|
157
|
+
const includeAllowed = options.include ? new Set(options.include) : null;
|
|
158
|
+
const excluded = options.exclude ? new Set(options.exclude) : null;
|
|
159
|
+
const allowed = presetAllowed && includeAllowed ? /* @__PURE__ */ new Set([...presetAllowed, ...includeAllowed]) : presetAllowed ?? includeAllowed;
|
|
160
|
+
return (name) => (!allowed || allowed.has(name)) && !excluded?.has(name);
|
|
161
|
+
}
|
|
162
|
+
function applyOverrides(tool, name, overrides) {
|
|
163
|
+
const override = overrides?.[name];
|
|
164
|
+
if (!override) return tool;
|
|
165
|
+
const next = {
|
|
166
|
+
...tool,
|
|
167
|
+
...override.description !== void 0 && { description: override.description },
|
|
168
|
+
...override.toModelOutput !== void 0 && { toModelOutput: override.toModelOutput },
|
|
169
|
+
...override.outputSchema !== void 0 && { outputSchema: override.outputSchema }
|
|
170
|
+
};
|
|
171
|
+
if (override.approval === void 0) return next;
|
|
172
|
+
if (isEveApprovalDisabled(override.approval)) {
|
|
173
|
+
const rest = { ...next };
|
|
174
|
+
delete rest.approval;
|
|
175
|
+
return rest;
|
|
176
|
+
}
|
|
177
|
+
const approval = typeof override.approval === "function" || typeof override.approval === "object" ? override.approval : mapEveApprovalValue(override.approval);
|
|
178
|
+
return {
|
|
179
|
+
...next,
|
|
180
|
+
approval
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
function buildEveToolDefinition(name, options = {}) {
|
|
184
|
+
const { defineTool } = getEveTools();
|
|
185
|
+
const ctx = {
|
|
186
|
+
token: createGithubTokenResolver(options.token),
|
|
187
|
+
context: options.context,
|
|
188
|
+
author: options.author,
|
|
189
|
+
committer: options.committer,
|
|
190
|
+
coAuthors: options.coAuthors
|
|
191
|
+
};
|
|
192
|
+
const entry = createToolRegistry(ctx).find((tool) => tool.name === name);
|
|
193
|
+
if (!entry) throw new Error(`Unknown GitHub tool: ${name}`);
|
|
194
|
+
const approval = entry.writeTool ? resolveEveToolApproval(entry.writeTool, options.requireApproval) : void 0;
|
|
195
|
+
return applyOverrides(defineTool({
|
|
196
|
+
description: entry.description,
|
|
197
|
+
inputSchema: entry.inputSchema,
|
|
198
|
+
...approval && { approval },
|
|
199
|
+
toModelOutput: (output) => formatGithubEveToolOutput(name, output),
|
|
200
|
+
execute: async (input) => runGithubToolStep(name, input, ctx)
|
|
201
|
+
}), name, options.overrides);
|
|
202
|
+
}
|
|
203
|
+
function buildEveToolMap(options = {}) {
|
|
204
|
+
const { defineTool } = getEveTools();
|
|
205
|
+
const ctx = {
|
|
206
|
+
token: createGithubTokenResolver(options.token),
|
|
207
|
+
context: options.context,
|
|
208
|
+
author: options.author,
|
|
209
|
+
committer: options.committer,
|
|
210
|
+
coAuthors: options.coAuthors
|
|
211
|
+
};
|
|
212
|
+
const isAllowed = resolveAllowedToolNames(options);
|
|
213
|
+
const registry = createToolRegistry(ctx);
|
|
214
|
+
const tools = {};
|
|
215
|
+
for (const entry of registry) {
|
|
216
|
+
if (!isAllowed(entry.name)) continue;
|
|
217
|
+
const approval = entry.writeTool ? resolveEveToolApproval(entry.writeTool, options.requireApproval) : void 0;
|
|
218
|
+
const definition = {
|
|
219
|
+
description: entry.description,
|
|
220
|
+
inputSchema: entry.inputSchema,
|
|
221
|
+
...approval && { approval },
|
|
222
|
+
toModelOutput: (output) => formatGithubEveToolOutput(entry.name, output),
|
|
223
|
+
execute: async (input) => runGithubToolStep(entry.name, input, ctx)
|
|
224
|
+
};
|
|
225
|
+
tools[entry.name] = applyOverrides(defineTool(definition), entry.name, options.overrides);
|
|
226
|
+
}
|
|
227
|
+
return tools;
|
|
228
|
+
}
|
|
229
|
+
function createEveGithubToolsDynamic(options = {}) {
|
|
230
|
+
const { defineDynamic } = getEveTools();
|
|
231
|
+
return defineDynamic({ events: { "step.started": async () => buildEveToolMap(options) } });
|
|
232
|
+
}
|
|
233
|
+
function listResolvedEveToolNames(options = {}) {
|
|
234
|
+
const isAllowed = resolveAllowedToolNames(options);
|
|
235
|
+
return ALL_GITHUB_TOOL_NAMES.filter(isAllowed);
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Tool descriptors (no `execute`) for authored eve `defineTool` loops.
|
|
239
|
+
* Prefer this when registering tools outside the SDK package so durable transforms can hoist inline execute.
|
|
240
|
+
*/
|
|
241
|
+
function listEveToolDescriptors(options = {}) {
|
|
242
|
+
const ctx = {
|
|
243
|
+
token: createGithubTokenResolver(options.token),
|
|
244
|
+
context: options.context,
|
|
245
|
+
author: options.author,
|
|
246
|
+
committer: options.committer,
|
|
247
|
+
coAuthors: options.coAuthors
|
|
248
|
+
};
|
|
249
|
+
const isAllowed = resolveAllowedToolNames(options);
|
|
250
|
+
return createToolRegistry(ctx).filter((entry) => isAllowed(entry.name)).map((entry) => ({
|
|
251
|
+
name: entry.name,
|
|
252
|
+
description: entry.description,
|
|
253
|
+
inputSchema: entry.inputSchema,
|
|
254
|
+
writeTool: entry.writeTool,
|
|
255
|
+
toModelOutput: entry.toModelOutput
|
|
256
|
+
}));
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Execute a GitHub tool by name with the given eve options (token/context/attribution).
|
|
260
|
+
* Used by `@github-tools/eve-extension` so `execute` only closes over a serializable tool name.
|
|
261
|
+
*/
|
|
262
|
+
async function executeGithubEveTool(name, input, options = {}) {
|
|
263
|
+
return runGithubToolStep(name, input, {
|
|
264
|
+
token: createGithubTokenResolver(options.token),
|
|
265
|
+
context: options.context,
|
|
266
|
+
author: options.author,
|
|
267
|
+
committer: options.committer,
|
|
268
|
+
coAuthors: options.coAuthors
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
//#endregion
|
|
272
|
+
export { listEveToolDescriptors as a, hasGithubEveToolModelOutput as c, resolveEveApproval as d, resolveEveToolApproval as f, executeGithubEveTool as i, isEveApprovalDisabled as l, buildEveToolMap as n, listResolvedEveToolNames as o, MISSING_EVE_MESSAGE as p, createEveGithubToolsDynamic as r, formatGithubEveToolOutput as s, buildEveToolDefinition as t, mapEveApprovalValue as u };
|
|
273
|
+
|
|
274
|
+
//# sourceMappingURL=eve-runtime-BkzmgsI2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eve-runtime-BkzmgsI2.mjs","names":[],"sources":["../src/eve/load-eve.ts","../src/eve/approval.ts","../src/eve/registry.ts","../src/eve/steps.ts","../src/eve/build.ts"],"sourcesContent":["import * as eveTools from 'eve/tools'\nimport * as eveApproval from 'eve/tools/approval'\n\n/**\n * Static ESM imports so bundlers (eve/Nitro/Vercel) can resolve `eve` when it is\n * compiled into the output rather than left as `node_modules/eve` at runtime.\n * Runtime `createRequire(\"eve/tools\")` fails in those targets.\n */\nexport type EveToolsModule = typeof import('eve/tools')\nexport type EveApprovalModule = typeof import('eve/tools/approval')\n\n/**\n * @deprecated Never thrown since eve moved to static ESM imports — a missing\n * `eve` package now fails at module resolution with the bundler/runtime's own\n * error. Kept only for backward compatibility of the public export; do not\n * match on it. Will be removed in the next major.\n */\nexport const MISSING_EVE_MESSAGE =\n 'The \"eve\" package is required to use @github-tools/sdk/eve. Install it with: pnpm add eve'\n\nexport function getEveTools(): EveToolsModule {\n return eveTools\n}\n\nexport function getEveApprovalHelpers(): EveApprovalModule {\n return eveApproval\n}\n","import type { Approval, ApprovalPolicy } from 'eve/tools/approval'\nimport type { GithubWriteToolName } from '../core/write-tools'\nimport { getEveApprovalHelpers } from './load-eve'\nimport type { EveApprovalConfig, EveApprovalValue } from './types'\n\n/**\n * `false` / `'never'` should omit the tool `approval` field entirely.\n * eve treats a missing `approval` like `never()`; attaching `never()` is\n * redundant and has caused approval UI noise on some channels.\n */\nexport function isEveApprovalDisabled(value: EveApprovalValue | undefined): boolean {\n return value === false || value === 'never'\n}\n\nexport function mapEveApprovalValue(value: EveApprovalValue): ApprovalPolicy {\n if (typeof value === 'function') return value\n // Object-shaped eve `ApprovalConfiguration` — the request-time policy lives on `request`.\n if (typeof value === 'object') return value.request\n\n const { always, never, once } = getEveApprovalHelpers()\n\n if (value === true || value === 'always') return always()\n if (value === false || value === 'never') return never()\n return once()\n}\n\nexport function resolveEveApproval(\n toolName: GithubWriteToolName,\n config: EveApprovalConfig | undefined,\n): ApprovalPolicy {\n if (config === undefined) return getEveApprovalHelpers().always()\n if (config === true) return getEveApprovalHelpers().always()\n if (config === false) return getEveApprovalHelpers().never()\n\n const value = config[toolName]\n if (value === undefined) return getEveApprovalHelpers().always()\n\n return mapEveApprovalValue(value)\n}\n\n/**\n * Approval to attach on a write tool, or `undefined` to omit the field.\n * Prefer this when building `defineTool` values so `false` / `'never'` do not\n * attach a redundant `never()` handler.\n */\nexport function resolveEveToolApproval(\n toolName: GithubWriteToolName,\n config: EveApprovalConfig | undefined,\n override?: EveApprovalValue,\n): Approval | undefined {\n const value = override !== undefined\n ? override\n : typeof config === 'object' && config !== null\n ? config[toolName]\n : config\n\n if (value === undefined) return getEveApprovalHelpers().always()\n if (isEveApprovalDisabled(value)) return undefined\n // Pass policies and `ApprovalConfiguration` objects through unchanged so a\n // response-time authorizer (`response`) survives onto `defineTool`.\n if (typeof value === 'function' || typeof value === 'object') return value\n return mapEveApprovalValue(value)\n}\n","import type { ToolModelOutput } from 'eve/tools'\nimport type { z } from 'zod'\nimport type { CommitIdentity } from '../types'\nimport { GITHUB_TOOL_CATALOG, isGithubWriteToolName } from '../core/catalog'\nimport { mergeContextArgs, softenContextSchema, type GithubToolsContext } from '../core/context'\nimport {\n compareCommitsToModelOutput,\n getCommitToModelOutput,\n getFileContentToModelOutput,\n getPullRequestContextToModelOutput,\n listPullRequestFilesToModelOutput,\n} from '../core/model-output'\nimport { stripRateLimit } from '../core/rate-limit'\nimport { resolveGithubToken, type GithubTokenInput } from '../core/token'\nimport type { GithubWriteToolName } from '../core/write-tools'\nimport { ALL_GITHUB_TOOL_NAMES, type GithubToolName } from '../core/tool-names'\nexport type { GithubToolName } from '../core/tool-names'\nexport { ALL_GITHUB_TOOL_NAMES } from '../core/tool-names'\n\nexport type ToolBuildContext = {\n token: GithubTokenInput\n context?: GithubToolsContext\n author?: CommitIdentity\n committer?: CommitIdentity\n coAuthors?: CommitIdentity[]\n}\n\ntype ToolRegistryEntry = {\n name: GithubToolName\n writeTool?: GithubWriteToolName\n description: string\n inputSchema: z.ZodType\n execute: (args: Record<string, unknown>) => Promise<unknown>\n toModelOutput?: (output: unknown) => ToolModelOutput\n}\n\nfunction withToken<T extends Record<string, unknown>>(\n core: (args: T & { token: string }) => Promise<unknown>,\n ctx: ToolBuildContext,\n extra?: Record<string, unknown>,\n) {\n return async (input: Record<string, unknown>) =>\n core({\n token: await resolveGithubToken(ctx.token),\n ...extra,\n ...mergeContextArgs(input, ctx.context ?? {}),\n } as T & { token: string })\n}\n\nfunction modelOutputAdapter(\n fn: (options: { toolCallId: string, input: unknown, output: unknown }) => { type: 'json' | 'text', value: unknown },\n) {\n return (output: unknown) => fn({ toolCallId: '', input: {}, output }) as ToolModelOutput\n}\n\nconst GITHUB_EVE_TOOL_MODEL_OUTPUT = {\n getFileContent: modelOutputAdapter(getFileContentToModelOutput),\n listPullRequestFiles: modelOutputAdapter(listPullRequestFilesToModelOutput),\n getPullRequestContext: modelOutputAdapter(getPullRequestContextToModelOutput),\n getCommit: modelOutputAdapter(getCommitToModelOutput),\n compareCommits: modelOutputAdapter(compareCommitsToModelOutput),\n} satisfies Partial<Record<GithubToolName, (output: unknown) => ToolModelOutput>>\n\nconst EVE_TOOL_MODEL_OUTPUTS: Partial<Record<GithubToolName, (output: unknown) => ToolModelOutput>> = GITHUB_EVE_TOOL_MODEL_OUTPUT\n\n/** Whether a GitHub tool has a built-in eve `toModelOutput` projection. */\nexport function hasGithubEveToolModelOutput(name: GithubToolName): boolean {\n return Object.hasOwn(GITHUB_EVE_TOOL_MODEL_OUTPUT, name)\n}\n\n/**\n * Apply the built-in eve `toModelOutput` projection for a tool.\n * Strips `rateLimit` so it never reaches the model. Tools without a dedicated\n * formatter get `{ type: 'json', value }` of the remaining payload.\n * Used by `@github-tools/eve-extension` so the callback only closes over a serializable tool name.\n */\nexport function formatGithubEveToolOutput(name: GithubToolName, output: unknown): ToolModelOutput {\n const stripped = stripRateLimit(output)\n // `runGithubToolStep` returns `{ error }` when execute throws. The per-tool\n // formatters assume the success shape (e.g. `listPullRequestFilesToModelOutput`\n // calls `.map` on the payload), so dispatching an error payload would throw a\n // second time inside model-output formatting and re-break the tool loop.\n if (isErrorPayload(stripped)) {\n return { type: 'json', value: stripped }\n }\n const format = GITHUB_EVE_TOOL_MODEL_OUTPUT[name as keyof typeof GITHUB_EVE_TOOL_MODEL_OUTPUT]\n if (!format) {\n return { type: 'json', value: stripped }\n }\n return format(stripped)\n}\n\nfunction isErrorPayload(output: unknown): output is { error: string } {\n return (\n output != null\n && typeof output === 'object'\n && !Array.isArray(output)\n && typeof (output as { error?: unknown }).error === 'string'\n )\n}\n\nexport function createToolRegistry(ctx: ToolBuildContext): ToolRegistryEntry[] {\n // Commit-identity options are session-level, not model inputs, so they ride\n // alongside the token instead of living in the tool's input schema.\n const commitExtras: Partial<Record<GithubToolName, Record<string, unknown>>> = {\n createOrUpdateFile: { author: ctx.author, committer: ctx.committer, coAuthors: ctx.coAuthors },\n mergePullRequest: { coAuthors: ctx.coAuthors },\n }\n\n const entries = ALL_GITHUB_TOOL_NAMES.map((name): ToolRegistryEntry => {\n const descriptor = GITHUB_TOOL_CATALOG[name]\n // Argument types vary per tool; `withToken` re-narrows at the dispatch boundary.\n const core = descriptor.core as (args: Record<string, unknown> & { token: string }) => Promise<unknown>\n const toModelOutput = EVE_TOOL_MODEL_OUTPUTS[name]\n return {\n name,\n ...(isGithubWriteToolName(name) && { writeTool: name }),\n description: descriptor.description,\n inputSchema: descriptor.inputSchema,\n execute: withToken(core, ctx, commitExtras[name]),\n ...(toModelOutput && { toModelOutput }),\n }\n })\n\n if (!ctx.context) return entries\n\n return entries.map(entry => ({\n ...entry,\n inputSchema: softenContextSchema(entry.inputSchema, ctx.context!),\n }))\n}\n","import { resolveGithubToken } from '../core/token'\nimport { createToolRegistry, type GithubToolName, type ToolBuildContext } from './registry'\n\nasync function executeGithubToolStep(\n name: GithubToolName,\n input: Record<string, unknown>,\n ctx: ToolBuildContext,\n) {\n 'use step'\n const entry = createToolRegistry(ctx).find(tool => tool.name === name)\n if (!entry) {\n throw new Error(`Unknown GitHub tool: ${name}`)\n }\n return entry.execute(input)\n}\n\nexport async function runGithubToolStep(\n name: GithubToolName,\n input: Record<string, unknown>,\n ctx: ToolBuildContext,\n) {\n try {\n // Resolve the token before entering the step so only a serializable string crosses the boundary.\n const token = await resolveGithubToken(ctx.token)\n return await executeGithubToolStep(name, input, { ...ctx, token })\n } catch (error) {\n // Eve's tool-loop logs thrown execute errors but does not always append a\n // tool_result. Returning a payload keeps the Anthropic tool_use/tool_result pairing intact.\n return { error: error instanceof Error ? error.message : String(error) }\n }\n}\n","import type { ToolDefinition } from 'eve/tools'\nimport { resolvePresetTools, type CombinedPresetToolNames, type GithubToolPreset, type PresetToolName } from '../core/presets'\nimport { createGithubTokenResolver } from '../core/token'\nimport { isEveApprovalDisabled, mapEveApprovalValue, resolveEveToolApproval } from './approval'\nimport { getEveTools } from './load-eve'\nimport { ALL_GITHUB_TOOL_NAMES, createToolRegistry, formatGithubEveToolOutput, hasGithubEveToolModelOutput, type GithubToolName, type ToolBuildContext } from './registry'\nimport { runGithubToolStep } from './steps'\nimport type { EveGithubToolsOptions, EveToolFactoryOptions, EveToolOverrides } from './types'\n\ntype BuildOptions = EveGithubToolsOptions | (EveToolFactoryOptions & { preset?: EveGithubToolsOptions['preset'] })\ntype EveToolMap = Partial<Record<GithubToolName, ToolDefinition>>\n\nfunction resolveAllowedToolNames(\n options: Pick<EveGithubToolsOptions, 'preset' | 'include' | 'exclude'>,\n): (name: GithubToolName) => boolean {\n const presetAllowed = options.preset ? resolvePresetTools(options.preset) : null\n const includeAllowed = options.include ? new Set(options.include) : null\n const excluded = options.exclude ? new Set(options.exclude) : null\n\n // `preset` and `include` compose as a union (add tools a preset is missing);\n // `exclude` always subtracts from that combined set afterward.\n const allowed = presetAllowed && includeAllowed\n ? new Set([...presetAllowed, ...includeAllowed])\n : presetAllowed ?? includeAllowed\n\n return name => (!allowed || allowed.has(name)) && !excluded?.has(name)\n}\n\nfunction applyOverrides<T extends ToolDefinition>(\n tool: T,\n name: GithubToolName,\n overrides?: EveToolOverrides,\n): T {\n const override = overrides?.[name]\n if (!override) return tool\n\n const next: T = {\n ...tool,\n ...override.description !== undefined && { description: override.description },\n ...override.toModelOutput !== undefined && { toModelOutput: override.toModelOutput },\n ...override.outputSchema !== undefined && { outputSchema: override.outputSchema },\n }\n\n if (override.approval === undefined) return next\n if (isEveApprovalDisabled(override.approval)) {\n const rest = { ...next }\n delete (rest as { approval?: unknown }).approval\n return rest\n }\n // Preserve policies and `ApprovalConfiguration` objects as-is; only literals need mapping.\n const approval = typeof override.approval === 'function' || typeof override.approval === 'object'\n ? override.approval\n : mapEveApprovalValue(override.approval)\n return { ...next, approval }\n}\n\nexport function buildEveToolDefinition(\n name: GithubToolName,\n options: BuildOptions = {},\n): ToolDefinition {\n const { defineTool } = getEveTools()\n const ctx: ToolBuildContext = {\n token: createGithubTokenResolver(options.token),\n context: options.context,\n author: options.author,\n committer: options.committer,\n coAuthors: options.coAuthors,\n }\n\n const entry = createToolRegistry(ctx).find(tool => tool.name === name)\n if (!entry) {\n throw new Error(`Unknown GitHub tool: ${name}`)\n }\n\n const approval = entry.writeTool\n ? resolveEveToolApproval(entry.writeTool, options.requireApproval)\n : undefined\n\n // Annotated so defineTool resolves to its ToolDefinition overload — inference\n // from the bare literal picks the background-tool overload on eve 0.45+.\n const definition: ToolDefinition = {\n description: entry.description,\n inputSchema: entry.inputSchema,\n ...(approval && { approval }),\n toModelOutput: (output: unknown) => formatGithubEveToolOutput(name, output),\n execute: async (input) => runGithubToolStep(name, input as Record<string, unknown>, ctx),\n }\n\n return applyOverrides(defineTool(definition), name, options.overrides)\n}\n\nexport function buildEveToolMap(options: EveGithubToolsOptions = {}): EveToolMap {\n const { defineTool } = getEveTools()\n const ctx: ToolBuildContext = {\n token: createGithubTokenResolver(options.token),\n context: options.context,\n author: options.author,\n committer: options.committer,\n coAuthors: options.coAuthors,\n }\n\n const isAllowed = resolveAllowedToolNames(options)\n const registry = createToolRegistry(ctx)\n const tools = {} as EveToolMap\n\n for (const entry of registry) {\n if (!isAllowed(entry.name)) continue\n\n const approval = entry.writeTool\n ? resolveEveToolApproval(entry.writeTool, options.requireApproval)\n : undefined\n\n const definition: ToolDefinition = {\n description: entry.description,\n inputSchema: entry.inputSchema,\n ...(approval && { approval }),\n toModelOutput: (output: unknown) => formatGithubEveToolOutput(entry.name, output),\n execute: async (input) => runGithubToolStep(entry.name, input as Record<string, unknown>, ctx),\n }\n\n tools[entry.name] = applyOverrides(defineTool(definition), entry.name, options.overrides)\n }\n\n return tools\n}\n\nexport function createEveGithubToolsDynamic(options: EveGithubToolsOptions = {}) {\n const { defineDynamic } = getEveTools()\n\n // TODO(eve-auth): resolve token from ctx.getToken('github') when eve-managed auth lands.\n // Deferred — eve does not yet expose managed GitHub tokens on the session context.\n return defineDynamic({\n events: {\n 'step.started': async () => buildEveToolMap(options),\n },\n })\n}\n\nexport function listResolvedEveToolNames(options?: { preset?: undefined, include?: undefined, exclude?: undefined }): GithubToolName[]\nexport function listResolvedEveToolNames<P extends GithubToolPreset>(options: { preset: P, include?: undefined, exclude?: undefined }): PresetToolName<P>[]\nexport function listResolvedEveToolNames<P extends readonly GithubToolPreset[]>(options: { preset: P, include?: undefined, exclude?: undefined }): CombinedPresetToolNames<P>[]\nexport function listResolvedEveToolNames(options: Pick<EveGithubToolsOptions, 'preset' | 'include' | 'exclude'>): GithubToolName[]\nexport function listResolvedEveToolNames(options: Pick<EveGithubToolsOptions, 'preset' | 'include' | 'exclude'> = {}): GithubToolName[] {\n const isAllowed = resolveAllowedToolNames(options)\n return ALL_GITHUB_TOOL_NAMES.filter(isAllowed)\n}\n\n/**\n * Tool descriptors (no `execute`) for authored eve `defineTool` loops.\n * Prefer this when registering tools outside the SDK package so durable transforms can hoist inline execute.\n */\nexport function listEveToolDescriptors(options: EveGithubToolsOptions = {}) {\n const ctx: ToolBuildContext = {\n token: createGithubTokenResolver(options.token),\n context: options.context,\n author: options.author,\n committer: options.committer,\n coAuthors: options.coAuthors,\n }\n\n const isAllowed = resolveAllowedToolNames(options)\n return createToolRegistry(ctx)\n .filter(entry => isAllowed(entry.name))\n .map(entry => ({\n name: entry.name,\n description: entry.description,\n inputSchema: entry.inputSchema,\n writeTool: entry.writeTool,\n toModelOutput: entry.toModelOutput,\n }))\n}\n\nexport { formatGithubEveToolOutput, hasGithubEveToolModelOutput }\n\n/**\n * Execute a GitHub tool by name with the given eve options (token/context/attribution).\n * Used by `@github-tools/eve-extension` so `execute` only closes over a serializable tool name.\n */\nexport async function executeGithubEveTool(\n name: GithubToolName,\n input: Record<string, unknown>,\n options: EveGithubToolsOptions = {},\n) {\n const ctx: ToolBuildContext = {\n token: createGithubTokenResolver(options.token),\n context: options.context,\n author: options.author,\n committer: options.committer,\n coAuthors: options.coAuthors,\n }\n return runGithubToolStep(name, input, ctx)\n}\n"],"mappings":";;;;;;;;;;AAiBA,MAAa,sBACX;AAEF,SAAgB,cAA8B;CAC5C,OAAO;AACT;AAEA,SAAgB,wBAA2C;CACzD,OAAO;AACT;;;;;;;;AChBA,SAAgB,sBAAsB,OAA8C;CAClF,OAAO,UAAU,SAAS,UAAU;AACtC;AAEA,SAAgB,oBAAoB,OAAyC;CAC3E,IAAI,OAAO,UAAU,YAAY,OAAO;CAExC,IAAI,OAAO,UAAU,UAAU,OAAO,MAAM;CAE5C,MAAM,EAAE,QAAQ,OAAO,SAAS,sBAAsB;CAEtD,IAAI,UAAU,QAAQ,UAAU,UAAU,OAAO,OAAO;CACxD,IAAI,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