@github-tools/eve-extension 0.9.0 → 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.81 and mounts on eve 0.81 or later. `@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`, `approval.request`, and `approval.prompt` 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
 
@@ -1,11 +1,6 @@
1
1
  {
2
2
  "kind": "eve-extension",
3
- "formatVersion": 2,
4
- "builtWithEve": "0.81.1",
5
- "requires": {
6
- "extension": 1,
7
- "tool": 93,
8
- "dynamicTool": 87,
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;;AAwLjH,wBA+CE"}
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 [];
@@ -110,30 +98,16 @@ function runGithubEveApprovalPrompt(name, input) {
110
98
  const target = owner && repo ? ` on ${owner}/${repo}${number ? `#${number}` : ""}` : "";
111
99
  return `${action[0].toUpperCase()}${action.slice(1)}${target}?`;
112
100
  }
113
- function buildGithubEveInputSchema({ name }) {
114
- const descriptor = listEveToolDescriptors({
115
- ...buildSessionOptions(),
116
- preset: void 0,
117
- include: [name],
118
- exclude: void 0
119
- })[0];
120
- if (!descriptor) throw new Error(`GitHub tool descriptor "${name}" is not available`);
121
- return descriptor.inputSchema;
122
- }
123
- function buildGithubEveOutputSchema({ name }) {
124
- const outputSchema = buildSessionOptions().overrides?.[name]?.outputSchema;
125
- if (!outputSchema) throw new Error(`GitHub tool output schema override "${name}" is not available`);
126
- return outputSchema;
127
- }
128
- var github_default = defineDynamic({ events: { "step.started": async (_event, ctx) => {
101
+ var github_default = defineDynamic(async (ctx) => {
129
102
  const sessionOptions = buildSessionOptions();
130
103
  const { preset, evaluation } = extension_default.config;
131
- const messages = withoutPendingApprovals(ctx.messages);
104
+ const history = await ctx.messages();
105
+ const messages = withoutPendingApprovals(history);
132
106
  const request = latestUserText(messages);
133
107
  const descriptors = listEveToolDescriptors(preset === "auto" ? {
134
108
  ...sessionOptions,
135
- preset: await routePresets(ctx.session.id, messages, evaluation),
136
- 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)]
137
111
  } : sessionOptions);
138
112
  const tools = {};
139
113
  const toolOverrides = sessionOptions.overrides;
@@ -142,22 +116,16 @@ var github_default = defineDynamic({ events: { "step.started": async (_event, ct
142
116
  const override = toolOverrides?.[name];
143
117
  tools[name] = defineTool({
144
118
  description: override?.description ?? entry.description,
145
- inputSchema: defineDurableSchema({
146
- closure: { name },
147
- schema: buildGithubEveInputSchema
148
- }),
119
+ inputSchema: entry.inputSchema,
149
120
  approval: {
150
121
  request: (approvalCtx) => runGithubEveApproval(name, request, approvalCtx),
151
122
  prompt: ({ input }) => runGithubEveApprovalPrompt(name, input)
152
123
  },
153
124
  toModelOutput: (output) => runGithubEveToModelOutput(name, output),
154
- ...override?.outputSchema !== void 0 && { outputSchema: defineDurableSchema({
155
- closure: { name },
156
- schema: buildGithubEveOutputSchema
157
- }) },
158
- 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)
159
127
  });
160
128
  }
161
129
  return tools;
162
- } } });
130
+ });
163
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.9.0",
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.81.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
  }