Skip to content

Commit f4d97e4

Browse files
authored
refactor(api)!: prune internals and unify built-in grep
Address verified review findings in this layer while keeping the public API stack independently reviewable. Signed-off-by: OwenKephart <owen.kephart@vercel.com>
1 parent b4c9923 commit f4d97e4

100 files changed

Lines changed: 619 additions & 1512 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eve": minor
3+
---
4+
5+
Remove loader-only guards, event framing exports, deprecated code-extension GitHub/computer-use aliases, and legacy audience auth fields. Built-in and code-extension grep now share bounded modes and workspace containment; import named callback/config types from their authoring entries, and move PR-watch imports from `eve/extensions/code/prwatch` to internal `eve/internal/code/prwatch`, passing `{ connector, org }` as `readPullRequestWatchSnapshot`'s second argument.

‎docs/code-extension.mdx‎

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Configure `github` to broker GitHub access through Connect instead. The extensio
9898
| `github.org` | With `github` | Organization whose repositories the `gh` tool can access |
9999
| `github.broker` | With `github` | `broker(sandbox, rules)` callback that installs, then removes, the GitHub credential rules |
100100
| `github.authorize` | No | `authorize({ auth, repository, token })` callback that allows or denies each `gh` tool invocation |
101-
| `github.attribution` | No | `attribution(ctx)` callback that returns the `{ name, email }` co-author for this turn |
101+
| `github.attribution` | No | `attribution(ctx)` returns the current turn's `{ name, email }` co-author, or `null` |
102102

103103
The `gh` tool requests a token scoped to exactly one repository in `github.org` for each invocation. The sandbox process receives a placeholder `GH_TOKEN`, and the firewall exchanges it on matching GitHub requests. Your `github.broker` callback receives the header-transform rules for the command, then `null` to remove the lease. The callback must preserve your other network rules. GitHub authentication has no command-delivery option.
104104

@@ -129,22 +129,34 @@ export default git({
129129
});
130130
```
131131

132-
Commits made by the `gh` tool are authored by the GitHub App. To credit the person a turn works for, return them from `github.attribution`. The callback receives the tool's context, so it can read the verified caller from `ctx.session.auth.current` or resolve their linked accounts with `ctx.getToken`. The `gh` tool then ends every `gh-signed-commit` message, and every `gh pr create` body passed with `--body` or `--body-file`, with `Co-authored-by: <name> <email>`. Return `null` to publish without a co-author. `Co-authored-by` lines the agent writes itself are kept, and the trailer joins their block so they still count. Pull requests created without a body flag, such as with `--fill` or `--template`, and other paths, such as `gh api`, are not attributed.
132+
### Credit the person behind a turn
133133

134-
```ts
135-
git({
134+
Commits made by the `gh` tool are authored by the GitHub App. Return a verified user mapping from
135+
`github.attribution` to add that person's `Co-authored-by` trailer to `gh-signed-commit` messages
136+
and `gh pr create` bodies passed through `--body` or `--body-file`. The callback receives the tool
137+
context, including `ctx.session.auth.current` and `ctx.getToken`. Return `null` to omit attribution.
138+
Existing co-author trailers are preserved; commands without a body flag and direct `gh api` calls
139+
are not attributed.
140+
141+
For example, resolve the author through your application's authenticated user mapping:
142+
143+
```ts title="agent/extensions/git.ts"
144+
import git from "eve/extensions/git";
145+
import { brokerGitHubLease, coAuthorFor } from "../lib/github";
146+
147+
export default git({
136148
github: {
137-
connector: "github",
149+
connector: "github/my-agent",
138150
org: "acme",
139-
broker,
151+
broker: brokerGitHubLease,
140152
attribution: (ctx) => coAuthorFor(ctx.session.auth.current),
141153
},
142154
});
143155
```
144156

145157
### Migrate from `code({ github })`
146158

147-
`code({ github })` is deprecated. While it is set, the code extension still contributes `code__gh`, its GitHub instructions, and the signed-commit `code__pr` skill. Without it, the code extension contributes no GitHub tool, instructions, or pull request skill. Move the `github` option to `git({ github })`, and import `gh` and the GitHub sandbox helpers from `eve/extensions/git/tools` and `eve/extensions/git/sandbox`.
159+
`code({ github })` is rejected. Move the `github` option to `git({ github })`, and import `gh` and the GitHub sandbox helpers from `eve/extensions/git/tools` and `eve/extensions/git/sandbox`.
148160

149161
## Prepare the sandbox
150162

‎docs/concepts/built-in-tools.md‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,8 @@ Remove the file to remove the tool. `disableTool()` is unnecessary because `glob
400400

401401
### `grep`
402402

403-
`grep` searches sandbox file contents with a regular expression. Add it:
403+
`grep` searches files inside the sandbox workspace. It is also the implementation of the code
404+
extension's `code__grep` tool. Add it:
404405

405406
```sh
406407
eve add tool/grep
@@ -424,6 +425,16 @@ export default defineTool({
424425

425426
Remove the file to remove the tool. `disableTool()` is unnecessary because `grep` is not added by default.
426427

428+
Inputs are `pattern`, optional `path`, `glob`, `ignoreCase`, `literal`, `context`, `limit`, and
429+
`outputMode`. `files_with_matches` is the default and lists paths; `content` returns matching
430+
lines and `count` returns per-file totals. Identifier-like patterns use literal matching unless
431+
`literal: false` is explicit. The default limit is 50 rows, capped at 200, with additional byte
432+
and line bounds. Relative paths resolve inside the workspace; parent traversal and symlinks
433+
outside it are rejected. Ripgrep respects `.gitignore`; the POSIX fallback does not.
434+
435+
Results contain `content`, `matchCount`, `outputMode`, `path`, and `truncated`. Use
436+
`outputMode: "content"` when migrating a caller that previously expected matching lines.
437+
427438
### `no_reply`
428439

429440
`no_reply` ends the turn without a reply. Use it when a scheduled check finds nothing to report, or when an action the agent already took is the whole answer. The model calls it with an optional `{ reason }`, which stays in the session history and traces and is never sent. The turn completes without a final message, so channels and schedule sends post nothing, and later turns see that the agent chose to stay quiet. Add it:

‎docs/reference/typescript-api.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ Tool definitions accept `availableInSubagents: false` to restrict the tool to to
145145
| `eve/instrumentation/otel` | `otel`, `otelIntegration`, `localTraces`, `agentRuns`, OpenTelemetry policy types |
146146
| `eve/local-dev` | `getLocalDevCapability`, `LocalDevCapability` |
147147
| [`eve/models`](../guides/decide) | Automatic model selection with `auto` |
148-
| `eve/models/openai` | `openai`, `chatgpt`, deprecated `experimental_chatgpt` |
148+
| `eve/models/openai` | `openai`, `chatgpt` |
149149
| `eve/models/anthropic` | `anthropic` |
150150
| [`eve/ai`](../guides/decide#decide-inside-a-tool) | Standalone `decide` |
151151
| `eve/evals` | `defineEval`, `defineEvalConfig`, `mockModel`, eval types |
@@ -182,7 +182,7 @@ export default defineAgent({
182182
});
183183
```
184184

185-
Pass another bare OpenAI model slug to override the default. `experimental_chatgpt()` remains as a deprecated alias.
185+
Pass another bare OpenAI model slug to override the default. The retired `experimental_chatgpt` alias is not exported.
186186

187187
`chatgpt()` uses stateless requests (`store: false`). eve retains reasoning summaries and encrypted reasoning in session history and replays them after tool calls and on later turns. You do not need to configure `reasoning.encrypted_content` explicitly.
188188

‎e2e/fixtures/agent-tools-sandbox/evals/sandbox/file-tools.eval.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default defineEval({
1414
await t.send(
1515
[
1616
`Use the write_file tool to create the file ${FILE_TOOLS_PATH} with exactly this content: ${FILE_TOOLS_TOKEN}`,
17-
`Then use the grep tool to search for ${FILE_TOOLS_TOKEN} under /workspace.`,
17+
`Then use the grep tool to search for ${FILE_TOOLS_TOKEN} under /workspace with outputMode content.`,
1818
"Reply with the matching line verbatim.",
1919
].join("\n"),
2020
);

‎packages/eve-code/AGENTS.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ Before writing code, read the installed eve package docs for extensions, hooks,
77
## Boundaries
88

99
- Connector UIDs enter through extension config. The authentication hook resolves Vercel app tokens before each turn.
10-
- GitHub instructions, the `pr` skill, and the `gh` tool belong to `@eve/git` (`eve/extensions/git`). The deprecated `github` config keeps `code__gh`, `code__pr`, and the GitHub instructions through `extension/lib/github-compat.ts`, which imports `eve/extensions/git/sandbox`; add no other GitHub or pull request content here.
10+
- GitHub instructions, the `pr` skill, and the `gh` tool belong to `@eve/git` (`eve/extensions/git`). The removed `github` config is rejected; do not add GitHub or pull request contributions here.
1111
- Consumers with non-Connect credentials may call `authenticateGitHub` or `authenticateVercel` directly from their sandbox lifecycle.
1212
- Broker credentials without placing them in model-authored URLs or arguments.
1313
- Use real `git`, `gh`, and `vc` CLIs rather than bespoke repository lifecycle tools.
1414
- Keep `apply_patch` as the only extension-owned file editing primitive.
1515
- Keep shared implementation under `extension/lib/`; filesystem paths define contribution names.
16-
- Computer use lives in `@eve/computer-use` (`eve/computer-use`). Keep the deprecated computer-use re-exports in `extension/lib/sandbox.ts` until they are removed; do not add computer-use code here.
16+
- Computer use lives in `@eve/computer-use` (`eve/computer-use`). Import its public helpers directly; do not add computer-use code or re-exports here.
1717

1818
## Build and publish
1919

‎packages/eve-code/README.md‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ It ships inside the `eve` package. This private `@eve/code` workspace package is
66

77
- `eve/extensions/code`: the extension
88
- `eve/extensions/code/sandbox`: sandbox bootstrap and credential helpers
9-
- `eve/extensions/code/tools`: `apply_patch` and `grep` (`gh` is a deprecated re-export)
10-
- `eve/extensions/code/prwatch`: PR-watch primitives for consumer-owned workflow tools
9+
- `eve/extensions/code/tools`: `apply_patch` and `grep`
1110

1211
## Mount
1312

@@ -21,9 +20,9 @@ export default code({
2120
});
2221
```
2322

24-
Both connectors are optional; `code({})` mounts without either. The Vercel connector requests an app-subject token. Firewall delivery is the default and keeps tokens outside sandbox processes; without a consumer `broker`, it requires a sandbox provider that exposes `setNetworkPolicy()` and fails otherwise. Use `delivery: "command"` on the Vercel connector for providers without mutable network policy. A top-level `broker(sandbox, rules)` callback lets the consumer merge Vercel credential rules into its own network policy.
23+
The Vercel connector is optional; `code({})` mounts without it. The Vercel connector requests an app-subject token. Firewall delivery is the default and keeps tokens outside sandbox processes; without a consumer `broker`, it requires a sandbox provider that exposes `setNetworkPolicy()` and fails otherwise. Use `delivery: "command"` on the Vercel connector for providers without mutable network policy. A top-level `broker(sandbox, rules)` callback lets the consumer merge Vercel credential rules into its own network policy.
2524

26-
The `github` option is deprecated; configure it on `eve/extensions/git` instead. While it is set here, this extension still contributes `code__gh`, its GitHub instructions, and the signed-commit `code__pr` skill. Without it, this extension contributes no GitHub tool, instructions, or pull request skill.
25+
The retired `github` option is rejected. Configure `eve/extensions/git` for GitHub tools, instructions, and the pull request skill.
2726

2827
The read-only worker subagent defaults to `openai/gpt-5.6-terra-fast` with `xhigh` reasoning. Set `worker: { model, reasoning, openaiReasoningEffort? }` to choose another model; `openaiReasoningEffort` is passed to OpenAI models as `reasoningEffort`.
2928

@@ -48,7 +47,7 @@ export default defineSandbox(() => environment.open());
4847

4948
eve derives the prepared environment generation from the sandbox file and environment options, not from imported helpers, so upgrading eve alone does not rebuild an existing prepared artifact.
5049

51-
Computer use lives in `eve/computer-use`. Mount it next to this extension when the sandbox has a desktop. `installComputerUse`, `startComputerUse`, and `COMPUTER_USE_REVALIDATION_KEY` are still re-exported from `eve/extensions/code/sandbox`, and `computer_use` from `eve/extensions/code/tools`, but both are deprecated.
50+
Computer use lives in its own extension. Import its tools and sandbox helpers directly; the deprecated code re-exports are removed.
5251

5352
Preparation ensures `gh`, installs wrappers for `gh`, `vc`, and `gh-signed-commit`, and installs TypeScript diagnostics. With `eve/extensions/git` configured for `github`, repositories requiring verified signatures use `gh-signed-commit` through its `gh` tool.
5453

‎packages/eve-code/extension/extension.ts‎

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,51 +2,33 @@ import { defineExtension } from "eve/extension";
22
import type { SandboxSession } from "eve/sandbox";
33
import { z } from "zod";
44

5-
import type { GitHubConfig } from "eve/extensions/git/sandbox";
6-
75
export type CredentialPolicyBroker = (
86
sandbox: SandboxSession,
97
rules: Record<string, Record<string, string>>,
108
) => Promise<void>;
119

12-
export type { GitHubLeaseRule } from "eve/extensions/git/sandbox";
13-
14-
export type GitHubLeaseBroker = GitHubConfig["broker"];
15-
export type GitHubAttribution = NonNullable<GitHubConfig["attribution"]>;
16-
1710
const fn = <T>() => z.custom<T>((value) => typeof value === "function");
1811
const delivery = z.enum(["firewall", "command"]).default("firewall");
1912
const reasoning = z.enum(["provider-default", "none", "minimal", "low", "medium", "high", "xhigh"]);
2013
const openaiReasoningEffort = z.enum(["none", "minimal", "low", "medium", "high", "xhigh", "max"]);
2114

2215
export default defineExtension({
23-
config: z.object({
24-
/**
25-
* @deprecated Mount `eve/extensions/git` with this `github` config instead.
26-
* While set, this extension still contributes the authenticated `gh` tool,
27-
* its instructions, and the signed-commit `pr` skill.
28-
*/
29-
github: z
30-
.object({
31-
connector: z.string().min(1),
32-
org: z.string().min(1),
33-
broker: fn<GitHubLeaseBroker>(),
34-
attribution: fn<GitHubAttribution>().optional(),
35-
})
36-
.optional(),
37-
vercel: z
38-
.object({
39-
connector: z.string().min(1),
40-
delivery,
41-
})
42-
.optional(),
43-
broker: fn<CredentialPolicyBroker>().optional(),
44-
worker: z
45-
.object({
46-
model: z.string().min(1),
47-
reasoning,
48-
openaiReasoningEffort: openaiReasoningEffort.optional(),
49-
})
50-
.optional(),
51-
}),
16+
config: z
17+
.object({
18+
vercel: z
19+
.object({
20+
connector: z.string().min(1),
21+
delivery,
22+
})
23+
.optional(),
24+
broker: fn<CredentialPolicyBroker>().optional(),
25+
worker: z
26+
.object({
27+
model: z.string().min(1),
28+
reasoning,
29+
openaiReasoningEffort: openaiReasoningEffort.optional(),
30+
})
31+
.optional(),
32+
})
33+
.strict(),
5234
});

‎packages/eve-code/extension/instructions/github.ts‎

Lines changed: 0 additions & 14 deletions
This file was deleted.

‎packages/eve-code/extension/lib/github-compat.ts‎

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)