@github-tools/sdk 1.11.1 → 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.
Files changed (46) hide show
  1. package/README.md +31 -14
  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-BkzmgsI2.mjs +274 -0
  9. package/dist/eve-runtime-BkzmgsI2.mjs.map +1 -0
  10. package/dist/eve-runtime-C5HaKmOP.d.mts +85 -0
  11. package/dist/eve-runtime-C5HaKmOP.d.mts.map +1 -0
  12. package/dist/eve-runtime.d.mts +5 -4
  13. package/dist/eve-runtime.mjs +3 -3
  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-BjRUOM2Z.d.mts +287 -0
  18. package/dist/index-BjRUOM2Z.d.mts.map +1 -0
  19. package/dist/index.d.mts +3 -2
  20. package/dist/index.mjs +3 -3
  21. package/dist/{src-jQWS2Txw.mjs → src-DPcwVTf-.mjs} +98 -4
  22. package/dist/src-DPcwVTf-.mjs.map +1 -0
  23. package/dist/{token-1uPUq_g-.mjs → token-qesvchbI.mjs} +23 -169
  24. package/dist/token-qesvchbI.mjs.map +1 -0
  25. package/dist/tool-types-K8i--5D9.d.mts +3255 -0
  26. package/dist/tool-types-K8i--5D9.d.mts.map +1 -0
  27. package/dist/{types-BD5YvGxm.d.mts → types-6aWpzNzg.d.mts} +3 -3
  28. package/dist/{types-BD5YvGxm.d.mts.map → types-6aWpzNzg.d.mts.map} +1 -1
  29. package/dist/{types-BDO-Mmn6.d.mts → types-BVSe0Zey.d.mts} +4 -3
  30. package/dist/types-BVSe0Zey.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-Dk32V9Hl.mjs → write-tools-BEcL5Fv6.mjs} +2626 -1513
  35. package/dist/write-tools-BEcL5Fv6.mjs.map +1 -0
  36. package/package.json +5 -5
  37. package/dist/eve-runtime-Cb0LVEvS.d.mts +0 -66
  38. package/dist/eve-runtime-Cb0LVEvS.d.mts.map +0 -1
  39. package/dist/eve-runtime-DInXr4h5.mjs +0 -734
  40. package/dist/eve-runtime-DInXr4h5.mjs.map +0 -1
  41. package/dist/index-BNeMjmgp.d.mts +0 -770
  42. package/dist/index-BNeMjmgp.d.mts.map +0 -1
  43. package/dist/src-jQWS2Txw.mjs.map +0 -1
  44. package/dist/token-1uPUq_g-.mjs.map +0 -1
  45. package/dist/types-BDO-Mmn6.d.mts.map +0 -1
  46. package/dist/write-tools-Dk32V9Hl.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
 
@@ -186,6 +186,18 @@ Supported override properties:
186
186
 
187
187
  Core properties (`execute`, `inputSchema`, `outputSchema`) cannot be overridden.
188
188
 
189
+ ## Rate-limit metadata
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.
192
+
193
+ ```ts
194
+ import type { GithubRateLimit } from '@github-tools/sdk'
195
+
196
+ result.rateLimit?.remaining
197
+ ```
198
+
199
+ `resource` is `core`, `search`, or `graphql`. On HTTP 403/429 the thrown error message also includes remaining/reset.
200
+
189
201
  ## Commit Attribution
190
202
 
191
203
  Control how commits are attributed when using `createOrUpdateFile` or `mergePullRequest`:
@@ -368,7 +380,7 @@ export default githubExtension({
368
380
 
369
381
  No `build.externalDependencies` workaround is needed here. Unlike the deprecated direct import below, the extension is pre-built via `eve extension build` and loaded through eve's extension mechanism rather than inlined from a workspace-linked source import.
370
382
 
371
- See [`packages/github-tools-eve-extension`](../github-tools-eve-extension) and [`examples/eve-extension-agent`](../../examples/eve-extension-agent) for the full package README and a runnable agent.
383
+ See [`packages/github-tools-eve-extension`](../github-tools-eve-extension) and [`examples/eve`](../../examples/eve) for the full package README and a runnable agent.
372
384
 
373
385
  ### eve, direct import (deprecated)
374
386
 
@@ -433,7 +445,7 @@ eve replays completed steps but re-runs steps interrupted mid-execution. Write t
433
445
  | `addIssueReaction`, `addCommentReaction` | Natural: GitHub returns the existing reaction when the user already reacted with the same content |
434
446
  | `markNotificationRead` | Natural when the thread is already read |
435
447
  | `updateIssue`, `updatePullRequest`, `updateRelease`, `updateIssueComment`, `updatePullRequestComment` | **Not** idempotent: each call applies a new revision |
436
- | `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 |
437
449
  | `addIssueComment`, `addDiscussionComment`, `createIssue`, `mergePullRequest`, `createRelease`, … | **Not** idempotent: each call creates new side effects |
438
450
 
439
451
  Gate non-idempotent writes behind `always()` or `once()` where replay safety matters.
@@ -455,7 +467,7 @@ Add `build: { externalDependencies: ['@vercel/connect'] }` to `agent.ts`. See [V
455
467
 
456
468
  > `eve` is an optional peer dependency, install it only when using the `/eve` subpath.
457
469
 
458
- See [`examples/eve-agent`](../../examples/eve-agent) for a minimal agent.
470
+ New agents should use the [eve extension](#eve-extension) above; see [`examples/eve`](../../examples/eve).
459
471
 
460
472
  ## Available Tools
461
473
 
@@ -470,6 +482,7 @@ List tools (`listCommits`, `listPullRequests`, `listIssues`, `listWorkflowRuns`,
470
482
  | `getFileContent` | Read a file or directory listing (prefer `startLine`/`endLine` or `maxLines` for large files) |
471
483
  | `getRepositoryTree` | List the file and directory structure at a given ref |
472
484
  | `createBranch` | Create a new branch from an existing branch or commit SHA |
485
+ | `deleteBranch` | Permanently delete a branch |
473
486
  | `forkRepository` | Fork a repository to a user or organization |
474
487
  | `createRepository` | Create a new repository for a user or organization |
475
488
  | `createOrUpdateFile` | Create or update a file and commit it |
@@ -482,6 +495,7 @@ List tools (`listCommits`, `listPullRequests`, `listIssues`, `listWorkflowRuns`,
482
495
  | `getPullRequest` | Get a PR's full details (diff stats, body, merge status; body truncated by default) |
483
496
  | `listPullRequestFiles` | List files changed in a PR (patches omitted by default; set `includePatch` / `filenames` for diffs) |
484
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) |
485
499
  | `getPullRequestContext` | Fetch PR details plus files, reviews, and optional CI checks in one call |
486
500
  | `createPullRequest` | Open a new PR |
487
501
  | `mergePullRequest` | Merge a PR (merge, squash, or rebase) |
@@ -490,6 +504,8 @@ List tools (`listCommits`, `listPullRequests`, `listIssues`, `listWorkflowRuns`,
490
504
  | `updatePullRequestComment` | Edit the body of a PR comment |
491
505
  | `deletePullRequestComment` | Permanently delete a PR comment |
492
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 |
493
509
  | `requestReviewers` | Request reviews from users or teams on a PR |
494
510
 
495
511
  ### Issues
@@ -561,6 +577,7 @@ Pull request conversations share the issue numbering, so the issue-level tools w
561
577
  | `listWorkflowRuns` | List workflow runs filtered by workflow, branch, status, or event |
562
578
  | `getWorkflowRun` | Get a workflow run's status, timing, and trigger info |
563
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) |
564
581
  | `triggerWorkflow` | Trigger a workflow via workflow_dispatch event |
565
582
  | `cancelWorkflowRun` | Cancel an in-progress workflow run |
566
583
  | `rerunWorkflowRun` | Re-run a workflow run, optionally only failed jobs |
@@ -614,10 +631,10 @@ Create one at **GitHub → Settings → Developer settings → Personal access t
614
631
  |---|---|---|
615
632
  | **Metadata** | Read-only | Always required (auto-included) |
616
633
  | **Contents** | Read-only | `getRepository`, `listBranches`, `getFileContent`, `getRepositoryTree`, `listCommits`, `getCommit`, `getBlame`, `compareCommits`, `listReleases`, `getLatestRelease`, `getRelease`, `getReleaseContext` |
617
- | **Contents** | Read and write | `createBranch`, `createOrUpdateFile`, `createRelease`, `updateRelease`, `deleteRelease` |
634
+ | **Contents** | Read and write | `createBranch`, `deleteBranch`, `createOrUpdateFile`, `createRelease`, `updateRelease`, `deleteRelease` |
618
635
  | **Administration** | Read and write | `forkRepository`, `createRepository` |
619
- | **Pull requests** | Read-only | `listPullRequests`, `getPullRequest`, `listPullRequestFiles`, `listPullRequestReviews`, `getPullRequestContext` |
620
- | **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` |
621
638
  | **Issues** | Read-only | `listIssues`, `getIssue`, `getIssueContext`, `listIssueComments`, `listLabels`, `listIssueReactions`, `listCommentReactions` |
622
639
  | **Issues** | Read and write | `createIssue`, `addIssueComment`, `updateIssueComment`, `deleteIssueComment`, `closeIssue`, `updateIssue`, `addLabels`, `removeLabel`, `createLabel`, `updateLabel`, `deleteLabel`, `addAssignees`, `removeAssignees`, `addIssueReaction`, `addCommentReaction` |
623
640
  | **Discussions** | Read-only | `listDiscussions`, `getDiscussion` |
@@ -625,7 +642,7 @@ Create one at **GitHub → Settings → Developer settings → Personal access t
625
642
  | **Gists** | Read-only | `listGists`, `getGist`, `listGistComments` |
626
643
  | **Gists** | Read and write | `createGist`, `updateGist`, `deleteGist`, `createGistComment` |
627
644
  | **Notifications** (account) | Read and write | `listNotifications`, `markNotificationRead` |
628
- | **Actions** | Read-only | `listWorkflows`, `listWorkflowRuns`, `getWorkflowRun`, `listWorkflowJobs`, `getCiFailureContext` |
645
+ | **Actions** | Read-only | `listWorkflows`, `listWorkflowRuns`, `getWorkflowRun`, `listWorkflowJobs`, `getWorkflowJobLogs`, `getCiFailureContext` |
629
646
  | **Actions** | Read and write | `triggerWorkflow`, `cancelWorkflowRun`, `rerunWorkflowRun` |
630
647
  | **Checks** | Read-only | `listCheckRuns`, `getCiFailureContext` |
631
648
  | **Commit statuses** | Read-only | `getCombinedStatus`, `getCiFailureContext` |
@@ -1,5 +1,4 @@
1
- import { $t as GithubToolName } from "../index-BNeMjmgp.mjs";
2
- import { a as GithubConnectorInput, t as ConnectGithubEveToolsOptions } from "../types-BD5YvGxm.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<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-1uPUq_g-.mjs";
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.
@@ -1,5 +1,6 @@
1
- import { $t as GithubToolName, It as GithubTokenInput, Mt as AllGithubTools, Yt as GithubToolPreset } from "./index-BNeMjmgp.mjs";
2
- import { a as GithubConnectorInput, i as GithubConnectParams, n as ConnectGithubTokenOptions, o as resolveGithubConnector, r as ConnectGithubToolsOptions, t as ConnectGithubEveToolsOptions } from "./types-BD5YvGxm.mjs";
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. 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-jQWS2Txw.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-1uPUq_g-.mjs";
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