@github-tools/eve-extension 0.8.1 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -19,7 +19,7 @@ This is **the recommended way** to add GitHub tools to an eve agent. The legacy
19
19
  pnpm add @github-tools/eve-extension
20
20
  ```
21
21
 
22
- `eve` is a required peer dependency, declared as `*`: the consuming agent provides the runtime copy and eve checks the extension's generated capability metadata rather than an npm range. This release is built against eve 0.64. `@vercel/connect` is optional (install it only when using `connector`):
22
+ `eve` is a required peer dependency, declared as `*`: the consuming agent provides the runtime copy and eve checks the extension's generated capability metadata rather than an npm range. This release is built against eve 1.0.0-rc.1 and mounts on eve 1.0.0-rc.1 or later. `@vercel/connect` is optional (install it only when using `connector`):
23
23
 
24
24
  ```sh
25
25
  pnpm add eve
@@ -43,7 +43,7 @@ export default githubExtension({
43
43
 
44
44
  > `code-review` pairs cleanly with a Connect `connector`. `maintainer` and `repo-explorer` include gist tools, and GitHub only grants gist access to user access tokens, never the installation tokens Connect mints, so gist calls 403 over Connect. Write tools already require approval via `always()` by default, so a plain `{ someTool: true }` is a no-op, use a predicate (as above) when you actually want to narrow or loosen the default.
45
45
 
46
- Tools are registered with **inline** `execute`, `toModelOutput`, and `approval` as direct `defineTool` properties so they survive multi-turn durable eve Workflow replay (see [#51](https://github.com/vercel-labs/github-tools/issues/51), [#99](https://github.com/vercel-labs/github-tools/issues/99)). Input schemas and optional output-schema overrides use `defineDurableSchema`; every durable closure contains only the tool name and reconstructs the live schema from extension configuration. A spread or call-expression callback has no durable descriptor, and eve rejects a dynamic tool whose callback is missing one. `toModelOutput` strips `rateLimit` from the model-facing payload; the execute result still carries it for hooks and channels. Do not use the deprecated `@github-tools/sdk/connect/eve` one-liner for durable Slack/multi-turn agents.
46
+ The tool file is a `defineDynamic` function that eve runs before every model call, so tools, approval policies, and schema overrides are rebuilt from the extension config in every process, including after Workflow replay and redeploys. With `preset: 'auto'`, the routed presets are kept for the turn with `ctx.memo`. `toModelOutput` strips `rateLimit` from the model-facing payload; the execute result still carries it for hooks and channels. Do not use the deprecated `@github-tools/sdk/connect/eve` one-liner for durable Slack/multi-turn agents.
47
47
 
48
48
  `connector` also accepts a `() => string | Promise<string>` resolver, so the same config can pick a connector dynamically (e.g. by environment):
49
49
 
@@ -56,6 +56,8 @@ export default githubExtension({
56
56
 
57
57
  A GitHub App installed on several accounts needs no configuration: each token is minted for the installation that owns the call's target `owner/repo`, after `context` defaults. Tools without a repository target use the connector's default installation. Set `installationId`, `authorizationDetails` or `repositories` in `connect` to pin one installation. If the App is not installed on the target account, the tool returns `CONNECT_INSTALLATION_REQUIRED` naming that account.
58
58
 
59
+ Approval requests name the action and its target instead of eve's default `Approve <tool>?`, for example `Merge pull request on vercel-labs/github-tools#176?`, with `owner`, `repo`, and the PR, issue, or discussion number falling back to `context`.
60
+
59
61
  Tools are exposed to the model as `<namespace>__<toolName>`, where `<namespace>` comes from the mount file's name: `agent/extensions/github.ts` yields `github__listPullRequests`, `github__createIssue`, and so on.
60
62
 
61
63
  To hand-pick an exact set of tools instead of a preset, pass `include`:
@@ -1,11 +1,6 @@
1
1
  {
2
2
  "kind": "eve-extension",
3
- "formatVersion": 2,
4
- "builtWithEve": "0.72.1",
5
- "requires": {
6
- "extension": 1,
7
- "tool": 76,
8
- "dynamicTool": 72,
9
- "config": 1
10
- }
3
+ "formatVersion": 3,
4
+ "builtWithEve": "1.0.0-rc.1",
5
+ "contractMajor": 0
11
6
  }
@@ -1,4 +1,3 @@
1
- import { type ToolDefinition } from 'eve/tools';
2
- declare const _default: import("eve").DynamicSentinel<Record<string, ToolDefinition<unknown, unknown>>>;
1
+ declare const _default: import("eve").DynamicSentinel<import("eve/tools").DynamicToolResult, import("eve").DynamicContext>;
3
2
  export default _default;
4
3
  //# sourceMappingURL=github.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../../extension/tools/github.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAoE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAA;;AA0KjH,wBA4CE"}
1
+ {"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../../extension/tools/github.ts"],"names":[],"mappings":";AAyKA,wBAkCE"}
@@ -7,7 +7,7 @@ __eveCreateRequire(import.meta.url);
7
7
  import extension_default from "../extension.mjs";
8
8
  import { AUTO_APPROVAL_TOOLS, GITHUB_TOOL_NAMES, GITHUB_WRITE_TOOLS, executeGithubEveTool, formatGithubEveToolOutput, githubToolsErrors, isEveApprovalDisabled, latestUserText, listEveToolDescriptors, mapEveApprovalValue, needsAutoApproval, selectPresets } from "@github-tools/sdk/eve-runtime";
9
9
  import { connectGithubToken } from "@github-tools/sdk/connect";
10
- import { defineDurableSchema, defineDynamic, defineTool } from "eve/tools";
10
+ import { defineDynamic, defineTool } from "eve/tools";
11
11
  function buildSessionOptions(ctx) {
12
12
  const { token, connector, connect, preset, include, exclude, overrides, context, author, committer, coAuthors } = extension_default.config;
13
13
  const includeNames = include;
@@ -47,18 +47,6 @@ const PENDING_APPROVALS_LABEL = "[Pending approvals]";
47
47
  function withoutPendingApprovals(messages) {
48
48
  return messages.filter((m) => m.role !== "user" || !latestUserText([m]).startsWith(PENDING_APPROVALS_LABEL));
49
49
  }
50
- const routedPresets = new Map();
51
- function routePresets(sessionId, messages, evaluation) {
52
- const key = `${sessionId}:${messages.filter((m) => m.role === "user").length}`;
53
- let presets = routedPresets.get(key);
54
- if (!presets) {
55
- presets = selectPresets(messages, evaluation);
56
- presets.catch(() => routedPresets.delete(key));
57
- routedPresets.set(key, presets);
58
- if (routedPresets.size > 1e3) routedPresets.delete(routedPresets.keys().next().value);
59
- }
60
- return presets;
61
- }
62
50
  function calledGithubTools(messages) {
63
51
  return messages.flatMap((message) => message.role === "assistant" && Array.isArray(message.content) ? message.content.flatMap((part) => {
64
52
  if (part.type !== "tool-call") return [];
@@ -100,30 +88,26 @@ async function runGithubEveApproval(name, request, ctx) {
100
88
  if (isEveApprovalDisabled(value)) return "not-applicable";
101
89
  return mapEveApprovalValue(value)(ctx);
102
90
  }
103
- function buildGithubEveInputSchema({ name }) {
104
- const descriptor = listEveToolDescriptors({
105
- ...buildSessionOptions(),
106
- preset: void 0,
107
- include: [name],
108
- exclude: void 0
109
- })[0];
110
- if (!descriptor) throw new Error(`GitHub tool descriptor "${name}" is not available`);
111
- return descriptor.inputSchema;
112
- }
113
- function buildGithubEveOutputSchema({ name }) {
114
- const outputSchema = buildSessionOptions().overrides?.[name]?.outputSchema;
115
- if (!outputSchema) throw new Error(`GitHub tool output schema override "${name}" is not available`);
116
- return outputSchema;
91
+ function runGithubEveApprovalPrompt(name, input) {
92
+ const { owner, repo, pullNumber, issueNumber, discussionNumber } = {
93
+ ...extension_default.config.context,
94
+ ...input
95
+ };
96
+ const action = name.replace(/[A-Z]/g, (letter) => ` ${letter.toLowerCase()}`);
97
+ const number = pullNumber ?? issueNumber ?? discussionNumber;
98
+ const target = owner && repo ? ` on ${owner}/${repo}${number ? `#${number}` : ""}` : "";
99
+ return `${action[0].toUpperCase()}${action.slice(1)}${target}?`;
117
100
  }
118
- var github_default = defineDynamic({ events: { "step.started": async (_event, ctx) => {
101
+ var github_default = defineDynamic(async (ctx) => {
119
102
  const sessionOptions = buildSessionOptions();
120
103
  const { preset, evaluation } = extension_default.config;
121
- const messages = withoutPendingApprovals(ctx.messages);
104
+ const history = await ctx.messages();
105
+ const messages = withoutPendingApprovals(history);
122
106
  const request = latestUserText(messages);
123
107
  const descriptors = listEveToolDescriptors(preset === "auto" ? {
124
108
  ...sessionOptions,
125
- preset: await routePresets(ctx.session.id, messages, evaluation),
126
- include: [...sessionOptions.include ?? [], ...calledGithubTools(ctx.messages)]
109
+ preset: await ctx.memo(["presets", ctx.turn?.id ?? null], () => selectPresets(messages, evaluation)),
110
+ include: [...sessionOptions.include ?? [], ...calledGithubTools(history)]
127
111
  } : sessionOptions);
128
112
  const tools = {};
129
113
  const toolOverrides = sessionOptions.overrides;
@@ -132,19 +116,16 @@ var github_default = defineDynamic({ events: { "step.started": async (_event, ct
132
116
  const override = toolOverrides?.[name];
133
117
  tools[name] = defineTool({
134
118
  description: override?.description ?? entry.description,
135
- inputSchema: defineDurableSchema({
136
- closure: { name },
137
- schema: buildGithubEveInputSchema
138
- }),
139
- approval: (approvalCtx) => runGithubEveApproval(name, request, approvalCtx),
119
+ inputSchema: entry.inputSchema,
120
+ approval: {
121
+ request: (approvalCtx) => runGithubEveApproval(name, request, approvalCtx),
122
+ prompt: ({ input }) => runGithubEveApprovalPrompt(name, input)
123
+ },
140
124
  toModelOutput: (output) => runGithubEveToModelOutput(name, output),
141
- ...override?.outputSchema !== void 0 && { outputSchema: defineDurableSchema({
142
- closure: { name },
143
- schema: buildGithubEveOutputSchema
144
- }) },
145
- execute: async (input, ctx) => runGithubEveTool(name, input, ctx)
125
+ ...override?.outputSchema !== void 0 && { outputSchema: override.outputSchema },
126
+ execute: async (input, toolCtx) => runGithubEveTool(name, input, toolCtx)
146
127
  });
147
128
  }
148
129
  return tools;
149
- } } });
130
+ });
150
131
  export { github_default as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@github-tools/eve-extension",
3
- "version": "0.8.1",
3
+ "version": "0.10.0",
4
4
  "description": "GitHub tools for eve, distributed as a mountable eve extension (https://eve.dev/docs/extensions)",
5
5
  "author": "HugoRCD <hugo.richard@vercel.com>",
6
6
  "repository": {
@@ -46,7 +46,7 @@
46
46
  "license": "MIT",
47
47
  "dependencies": {
48
48
  "zod": "^4.5.4",
49
- "@github-tools/sdk": "1.18.0"
49
+ "@github-tools/sdk": "1.19.0"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "@vercel/connect": ">=0.3.2",
@@ -59,9 +59,9 @@
59
59
  },
60
60
  "devDependencies": {
61
61
  "@types/node": "^26.5.0",
62
- "@vercel/connect": "^2.0.4",
62
+ "@vercel/connect": "^2.7.0",
63
63
  "eslint": "^10.10.0",
64
- "eve": "0.72.1",
64
+ "eve": "1.0.0-rc.1",
65
65
  "typescript": "^6.0.3",
66
66
  "typescript-eslint": "^8.70.0"
67
67
  },
@@ -72,7 +72,6 @@
72
72
  "build": "eve extension build",
73
73
  "lint": "eslint .",
74
74
  "lint:fix": "eslint . --fix",
75
- "typecheck": "tsc --noEmit",
76
- "test": "node --test --experimental-strip-types ./test/durable-define-tool.test.ts"
75
+ "typecheck": "tsc --noEmit"
77
76
  }
78
77
  }