@github-tools/sdk 1.12.0 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +22 -17
  2. package/dist/connect/eve.d.mts +2 -3
  3. package/dist/connect/eve.d.mts.map +1 -1
  4. package/dist/connect/eve.mjs +1 -1
  5. package/dist/connect.d.mts +8 -86
  6. package/dist/connect.d.mts.map +1 -1
  7. package/dist/connect.mjs +2 -2
  8. package/dist/eve-runtime-BdolQrBF.mjs +275 -0
  9. package/dist/eve-runtime-BdolQrBF.mjs.map +1 -0
  10. package/dist/{eve-runtime-BmoVTbEU.d.mts → eve-runtime-D1v4C0UP.d.mts} +14 -6
  11. package/dist/eve-runtime-D1v4C0UP.d.mts.map +1 -0
  12. package/dist/eve-runtime.d.mts +4 -3
  13. package/dist/eve-runtime.mjs +2 -2
  14. package/dist/eve.d.mts +4 -4
  15. package/dist/eve.d.mts.map +1 -1
  16. package/dist/eve.mjs +2 -2
  17. package/dist/index-PqQNoVuw.d.mts +287 -0
  18. package/dist/index-PqQNoVuw.d.mts.map +1 -0
  19. package/dist/index.d.mts +3 -2
  20. package/dist/index.mjs +3 -3
  21. package/dist/{src-D45Onmsn.mjs → src-D9WxaIVj.mjs} +83 -4
  22. package/dist/src-D9WxaIVj.mjs.map +1 -0
  23. package/dist/{token-BIn80-XU.mjs → token-Dt6qs_kf.mjs} +9 -168
  24. package/dist/token-Dt6qs_kf.mjs.map +1 -0
  25. package/dist/tool-types-DbZpOYFG.d.mts +3312 -0
  26. package/dist/tool-types-DbZpOYFG.d.mts.map +1 -0
  27. package/dist/{types-CiNZNOXa.d.mts → types-BAEqBfM5.d.mts} +3 -3
  28. package/dist/{types-CiNZNOXa.d.mts.map → types-BAEqBfM5.d.mts.map} +1 -1
  29. package/dist/{types-CoTpsxxp.d.mts → types-CCoH12WC.d.mts} +4 -3
  30. package/dist/types-CCoH12WC.d.mts.map +1 -0
  31. package/dist/workflow.d.mts +2 -1
  32. package/dist/workflow.d.mts.map +1 -1
  33. package/dist/workflow.mjs +2 -2
  34. package/dist/{write-tools-CnJE0Vvu.mjs → write-tools-Ct0ZV87Z.mjs} +1296 -306
  35. package/dist/write-tools-Ct0ZV87Z.mjs.map +1 -0
  36. package/package.json +3 -3
  37. package/dist/eve-runtime-3asyv7YM.mjs +0 -771
  38. package/dist/eve-runtime-3asyv7YM.mjs.map +0 -1
  39. package/dist/eve-runtime-BmoVTbEU.d.mts.map +0 -1
  40. package/dist/index-CGeFo38P.d.mts +0 -783
  41. package/dist/index-CGeFo38P.d.mts.map +0 -1
  42. package/dist/src-D45Onmsn.mjs.map +0 -1
  43. package/dist/token-BIn80-XU.mjs.map +0 -1
  44. package/dist/types-CoTpsxxp.d.mts.map +0 -1
  45. 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
- 79 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.
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 79 tools |
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
 
@@ -188,7 +188,7 @@ Core properties (`execute`, `inputSchema`, `outputSchema`) cannot be overridden.
188
188
 
189
189
  ## Rate-limit metadata
190
190
 
191
- Object-shaped tool results include a `rateLimit` field from the last GitHub response. Array-shaped results are unchanged. The field is stripped before the model sees the output; hooks, channels, and UIs still receive it.
191
+ Object-shaped tool results include a `rateLimit` field from the last GitHub response. REST list tools now return objects, so they carry it too. The field is stripped before the model sees the output; hooks, channels, and UIs still receive it.
192
192
 
193
193
  ```ts
194
194
  import type { GithubRateLimit } from '@github-tools/sdk'
@@ -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 returns 404 from GitHub |
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.
@@ -471,17 +471,18 @@ New agents should use the [eve extension](#eve-extension) above; see [`examples/
471
471
 
472
472
  ## Available Tools
473
473
 
474
- List tools (`listCommits`, `listPullRequests`, `listIssues`, `listWorkflowRuns`, `listCheckRuns`, `listReleases`) accept an optional `maxPages` alongside `perPage`. Set it to sequentially fetch and combine up to that many pages in one call, stopping early once a page comes back short.
474
+ List tools return `{ items, hasMore, page, perPage, nextPage? }` (or add those fields next to `checkRuns` / `runs` / …). When `hasMore`, call with `nextPage` or set `maxPages` to combine sequential pages in one call — do not repeat the same page. Filter `listCommits` with `path` / `author` / `since` / `until`. `getRepositoryTree` accepts a `path` prefix.
475
475
 
476
476
  ### Repository
477
477
 
478
478
  | Tool | Description |
479
479
  |---|---|
480
480
  | `getRepository` | Get repository metadata (stars, language, default branch, …) |
481
- | `listBranches` | List branches |
481
+ | `listBranches` | List branches (`hasMore` / `nextPage` when there are more) |
482
482
  | `getFileContent` | Read a file or directory listing (prefer `startLine`/`endLine` or `maxLines` for large files) |
483
- | `getRepositoryTree` | List the file and directory structure at a given ref |
483
+ | `getRepositoryTree` | List the file and directory structure at a given ref (prefer a `path` prefix over `recursive: true`) |
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 |
@@ -601,7 +606,7 @@ Pull request conversations share the issue numbering, so the issue-level tools w
601
606
 
602
607
  | Tool | Description |
603
608
  |---|---|
604
- | `listCommits` | List commits, optionally filtered by file path, author, or date range |
609
+ | `listCommits` | List commits, optionally filtered by file path, author, or date range. When `hasMore`, pass `nextPage` |
605
610
  | `getCommit` | Get a commit's full details including changed files and diffs |
606
611
  | `getBlame` | Line-level git blame for a file (GitHub GraphQL) |
607
612
  | `compareCommits` | Compare two branches, tags, or commits: ahead/behind counts, commits in between, and files that differ |
@@ -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` |
@@ -1,5 +1,4 @@
1
- import { en as GithubToolName } from "../index-CGeFo38P.mjs";
2
- import { a as GithubConnectorInput, t as ConnectGithubEveToolsOptions } from "../types-CiNZNOXa.mjs";
1
+ import { a as GithubConnectorInput, t as ConnectGithubEveToolsOptions } from "../types-BAEqBfM5.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<GithubToolName, import("eve/tools").ToolDefinition<unknown, unknown>>>>;
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":";;;;;;;;;;;;;;;;;;;;;;;;;;iBA4BgB,mBACd,WAAW,sBACX,UAAS,mDAAiC,gBAAA,QAAA,OAAjC,oCAAiC"}
1
+ {"version":3,"file":"eve.d.mts","names":[],"sources":["../../src/connect/eve.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;iBA4BgB,mBACd,WAAW,sBACX,UAAS,mDAAiC,gBAAA,QAAA,qqDAAA"}
@@ -1,5 +1,5 @@
1
1
  import { createGithubTools } from "../eve.mjs";
2
- import { t as connectGithubToken } from "../token-BIn80-XU.mjs";
2
+ import { t as connectGithubToken } from "../token-Dt6qs_kf.mjs";
3
3
  //#region src/connect/eve.ts
4
4
  /**
5
5
  * Register eve GitHub tools backed by a Vercel Connect connector.
@@ -1,5 +1,6 @@
1
- import { Lt as GithubTokenInput, Nt as AllGithubTools, Xt as GithubToolPreset, en as GithubToolName } from "./index-CGeFo38P.mjs";
2
- import { a as GithubConnectorInput, i as GithubConnectParams, n as ConnectGithubTokenOptions, o as resolveGithubConnector, r as ConnectGithubToolsOptions, t as ConnectGithubEveToolsOptions } from "./types-CiNZNOXa.mjs";
1
+ import { a as GithubConnectorInput, i as GithubConnectParams, n as ConnectGithubTokenOptions, o as resolveGithubConnector, r as ConnectGithubToolsOptions, t as ConnectGithubEveToolsOptions } from "./types-BAEqBfM5.mjs";
2
+ import { a as GithubTokenInput, d as GithubToolPreset, h as GithubToolName, t as AllGithubTools } from "./tool-types-DbZpOYFG.mjs";
3
+ import "./eve-runtime-D1v4C0UP.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. Empty arrays are intentional for gist and
40
- * notification tools (installation tokens cannot satisfy those APIs).
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, GithubToolName>;
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
@@ -1 +1 @@
1
- {"version":3,"file":"connect.d.mts","names":[],"sources":["../src/connect/scopes.ts","../src/connect/token.ts","../src/connect/tools.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;cAwBa;;;;;;;;;;;;;;;;cA0IA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqGG,6BACd,SAAS,mBAAmB;;;;;iBAcd,4BAA4B,gBAAgB;KAUhD;EACV,SAAS,mBAAmB;EAC5B,mBAAmB;EACnB,mBAAmB;;;;;;;;;;iBA6BL,gCAAgC,YAAW;;;;;;;;;;;;iBCjT3C,mBACd,WAAW,sBACX,UAAS,4BACR;;;;;;;;;;iBCNa,mBACd,WAAW,sBACX,UAAS,4BAAA,iBAA8B,KAAA,gBAAA"}
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-D45Onmsn.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-BIn80-XU.mjs";
1
+ import { t as createGithubTools } from "./src-D9WxaIVj.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-Dt6qs_kf.mjs";
3
3
  //#region src/connect/tools.ts
4
4
  /**
5
5
  * Create GitHub tools backed by a Vercel Connect connector.
@@ -0,0 +1,275 @@
1
+ import { Ci as compareCommitsToModelOutput, Di as getRepositoryTreeToModelOutput, Ei as getPullRequestContextToModelOutput, Oi as listPullRequestFilesToModelOutput, Si as resolveGithubToken, Ti as getFileContentToModelOutput, a as isGithubWriteToolName, d as softenContextSchema, i as GITHUB_TOOL_CATALOG, r as ALL_GITHUB_TOOL_NAMES, ra as stripRateLimit, s as resolvePresetTools, u as mergeContextArgs, wi as getCommitToModelOutput, xi as createGithubTokenResolver } from "./write-tools-Ct0ZV87Z.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
+ getRepositoryTree: modelOutputAdapter(getRepositoryTreeToModelOutput),
75
+ listPullRequestFiles: modelOutputAdapter(listPullRequestFilesToModelOutput),
76
+ getPullRequestContext: modelOutputAdapter(getPullRequestContextToModelOutput),
77
+ getCommit: modelOutputAdapter(getCommitToModelOutput),
78
+ compareCommits: modelOutputAdapter(compareCommitsToModelOutput)
79
+ };
80
+ const EVE_TOOL_MODEL_OUTPUTS = GITHUB_EVE_TOOL_MODEL_OUTPUT;
81
+ /** Whether a GitHub tool has a built-in eve `toModelOutput` projection. */
82
+ function hasGithubEveToolModelOutput(name) {
83
+ return Object.hasOwn(GITHUB_EVE_TOOL_MODEL_OUTPUT, name);
84
+ }
85
+ /**
86
+ * Apply the built-in eve `toModelOutput` projection for a tool.
87
+ * Strips `rateLimit` so it never reaches the model. Tools without a dedicated
88
+ * formatter get `{ type: 'json', value }` of the remaining payload.
89
+ * Used by `@github-tools/eve-extension` so the callback only closes over a serializable tool name.
90
+ */
91
+ function formatGithubEveToolOutput(name, output) {
92
+ const stripped = stripRateLimit(output);
93
+ if (isErrorPayload(stripped)) return {
94
+ type: "json",
95
+ value: stripped
96
+ };
97
+ const format = GITHUB_EVE_TOOL_MODEL_OUTPUT[name];
98
+ if (!format) return {
99
+ type: "json",
100
+ value: stripped
101
+ };
102
+ return format(stripped);
103
+ }
104
+ function isErrorPayload(output) {
105
+ return output != null && typeof output === "object" && !Array.isArray(output) && typeof output.error === "string";
106
+ }
107
+ function createToolRegistry(ctx) {
108
+ const commitExtras = {
109
+ createOrUpdateFile: {
110
+ author: ctx.author,
111
+ committer: ctx.committer,
112
+ coAuthors: ctx.coAuthors
113
+ },
114
+ mergePullRequest: { coAuthors: ctx.coAuthors }
115
+ };
116
+ const entries = ALL_GITHUB_TOOL_NAMES.map((name) => {
117
+ const descriptor = GITHUB_TOOL_CATALOG[name];
118
+ const core = descriptor.core;
119
+ const toModelOutput = EVE_TOOL_MODEL_OUTPUTS[name];
120
+ return {
121
+ name,
122
+ ...isGithubWriteToolName(name) && { writeTool: name },
123
+ description: descriptor.description,
124
+ inputSchema: descriptor.inputSchema,
125
+ execute: withToken(core, ctx, commitExtras[name]),
126
+ ...toModelOutput && { toModelOutput }
127
+ };
128
+ });
129
+ if (!ctx.context) return entries;
130
+ return entries.map((entry) => ({
131
+ ...entry,
132
+ inputSchema: softenContextSchema(entry.inputSchema, ctx.context)
133
+ }));
134
+ }
135
+ //#endregion
136
+ //#region src/eve/steps.ts
137
+ async function executeGithubToolStep(name, input, ctx) {
138
+ "use step";
139
+ const entry = createToolRegistry(ctx).find((tool) => tool.name === name);
140
+ if (!entry) throw new Error(`Unknown GitHub tool: ${name}`);
141
+ return entry.execute(input);
142
+ }
143
+ async function runGithubToolStep(name, input, ctx) {
144
+ try {
145
+ const token = await resolveGithubToken(ctx.token);
146
+ return await executeGithubToolStep(name, input, {
147
+ ...ctx,
148
+ token
149
+ });
150
+ } catch (error) {
151
+ return { error: error instanceof Error ? error.message : String(error) };
152
+ }
153
+ }
154
+ //#endregion
155
+ //#region src/eve/build.ts
156
+ function resolveAllowedToolNames(options) {
157
+ const presetAllowed = options.preset ? resolvePresetTools(options.preset) : null;
158
+ const includeAllowed = options.include ? new Set(options.include) : null;
159
+ const excluded = options.exclude ? new Set(options.exclude) : null;
160
+ const allowed = presetAllowed && includeAllowed ? /* @__PURE__ */ new Set([...presetAllowed, ...includeAllowed]) : presetAllowed ?? includeAllowed;
161
+ return (name) => (!allowed || allowed.has(name)) && !excluded?.has(name);
162
+ }
163
+ function applyOverrides(tool, name, overrides) {
164
+ const override = overrides?.[name];
165
+ if (!override) return tool;
166
+ const next = {
167
+ ...tool,
168
+ ...override.description !== void 0 && { description: override.description },
169
+ ...override.toModelOutput !== void 0 && { toModelOutput: override.toModelOutput },
170
+ ...override.outputSchema !== void 0 && { outputSchema: override.outputSchema }
171
+ };
172
+ if (override.approval === void 0) return next;
173
+ if (isEveApprovalDisabled(override.approval)) {
174
+ const rest = { ...next };
175
+ delete rest.approval;
176
+ return rest;
177
+ }
178
+ const approval = typeof override.approval === "function" || typeof override.approval === "object" ? override.approval : mapEveApprovalValue(override.approval);
179
+ return {
180
+ ...next,
181
+ approval
182
+ };
183
+ }
184
+ function buildEveToolDefinition(name, options = {}) {
185
+ const { defineTool } = getEveTools();
186
+ const ctx = {
187
+ token: createGithubTokenResolver(options.token),
188
+ context: options.context,
189
+ author: options.author,
190
+ committer: options.committer,
191
+ coAuthors: options.coAuthors
192
+ };
193
+ const entry = createToolRegistry(ctx).find((tool) => tool.name === name);
194
+ if (!entry) throw new Error(`Unknown GitHub tool: ${name}`);
195
+ const approval = entry.writeTool ? resolveEveToolApproval(entry.writeTool, options.requireApproval) : void 0;
196
+ return applyOverrides(defineTool({
197
+ description: entry.description,
198
+ inputSchema: entry.inputSchema,
199
+ ...approval && { approval },
200
+ toModelOutput: (output) => formatGithubEveToolOutput(name, output),
201
+ execute: async (input) => runGithubToolStep(name, input, ctx)
202
+ }), name, options.overrides);
203
+ }
204
+ function buildEveToolMap(options = {}) {
205
+ const { defineTool } = getEveTools();
206
+ const ctx = {
207
+ token: createGithubTokenResolver(options.token),
208
+ context: options.context,
209
+ author: options.author,
210
+ committer: options.committer,
211
+ coAuthors: options.coAuthors
212
+ };
213
+ const isAllowed = resolveAllowedToolNames(options);
214
+ const registry = createToolRegistry(ctx);
215
+ const tools = {};
216
+ for (const entry of registry) {
217
+ if (!isAllowed(entry.name)) continue;
218
+ const approval = entry.writeTool ? resolveEveToolApproval(entry.writeTool, options.requireApproval) : void 0;
219
+ const definition = {
220
+ description: entry.description,
221
+ inputSchema: entry.inputSchema,
222
+ ...approval && { approval },
223
+ toModelOutput: (output) => formatGithubEveToolOutput(entry.name, output),
224
+ execute: async (input) => runGithubToolStep(entry.name, input, ctx)
225
+ };
226
+ tools[entry.name] = applyOverrides(defineTool(definition), entry.name, options.overrides);
227
+ }
228
+ return tools;
229
+ }
230
+ function createEveGithubToolsDynamic(options = {}) {
231
+ const { defineDynamic } = getEveTools();
232
+ return defineDynamic({ events: { "step.started": async () => buildEveToolMap(options) } });
233
+ }
234
+ function listResolvedEveToolNames(options = {}) {
235
+ const isAllowed = resolveAllowedToolNames(options);
236
+ return ALL_GITHUB_TOOL_NAMES.filter(isAllowed);
237
+ }
238
+ /**
239
+ * Tool descriptors (no `execute`) for authored eve `defineTool` loops.
240
+ * Prefer this when registering tools outside the SDK package so durable transforms can hoist inline execute.
241
+ */
242
+ function listEveToolDescriptors(options = {}) {
243
+ const ctx = {
244
+ token: createGithubTokenResolver(options.token),
245
+ context: options.context,
246
+ author: options.author,
247
+ committer: options.committer,
248
+ coAuthors: options.coAuthors
249
+ };
250
+ const isAllowed = resolveAllowedToolNames(options);
251
+ return createToolRegistry(ctx).filter((entry) => isAllowed(entry.name)).map((entry) => ({
252
+ name: entry.name,
253
+ description: entry.description,
254
+ inputSchema: entry.inputSchema,
255
+ writeTool: entry.writeTool,
256
+ toModelOutput: entry.toModelOutput
257
+ }));
258
+ }
259
+ /**
260
+ * Execute a GitHub tool by name with the given eve options (token/context/attribution).
261
+ * Used by `@github-tools/eve-extension` so `execute` only closes over a serializable tool name.
262
+ */
263
+ async function executeGithubEveTool(name, input, options = {}) {
264
+ return runGithubToolStep(name, input, {
265
+ token: createGithubTokenResolver(options.token),
266
+ context: options.context,
267
+ author: options.author,
268
+ committer: options.committer,
269
+ coAuthors: options.coAuthors
270
+ });
271
+ }
272
+ //#endregion
273
+ 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 };
274
+
275
+ //# sourceMappingURL=eve-runtime-BdolQrBF.mjs.map