Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

Default new agents to zai/glm-5.2 (#1949)

Casey Gowrie20a52017c729
diff --git a/.changeset/default-model-glm-5-2.md b/.changeset/default-model-glm-5-2.md
new file mode 100644
index 000000000..492b92e5b
--- /dev/null
+++ b/.changeset/default-model-glm-5-2.md
@@ -0,0 +1,5 @@
+---
+"eve": patch
+---
+
+Update eve's default agent model to `zai/glm-5.2`. New agents created with `eve init`, config-less agents, and the setup model picker now use GLM 5.2 instead of Claude Sonnet 5.
diff --git a/README.md b/README.md
index cfffd857f..4d25f8d80 100644
--- a/README.md
+++ b/README.md
@@ -47,6 +47,12 @@ npx eve@latest init my-agent
This creates a new `my-agent` directory, installs its dependencies, initializes Git, and starts
the interactive terminal UI.
+To start with another AI Gateway model, pass its model ID:
+
+```bash
+npx eve@latest init my-agent --model openai/gpt-5.6-terra
+```
+
To add eve to an existing project, pass a path:
```bash
@@ -87,7 +93,7 @@ Choose the model in `agent/agent.ts`:
import { defineAgent } from "eve";
export default defineAgent({
- model: "anthropic/claude-sonnet-5",
+ model: "zai/glm-5.2",
});
```
diff --git a/apps/fixtures/weather-agent/agent/agent.ts b/apps/fixtures/weather-agent/agent/agent.ts
index f1fa5e0ad..60d31064c 100644
--- a/apps/fixtures/weather-agent/agent/agent.ts
+++ b/apps/fixtures/weather-agent/agent/agent.ts
@@ -1,7 +1,7 @@
import { defineAgent } from "eve";
export default defineAgent({
- model: "anthropic/claude-sonnet-5",
+ model: "zai/glm-5.2",
modelOptions: {
providerOptions: {
openai: {
diff --git a/docs/agent-config.md b/docs/agent-config.md
index a5d86f9be..64902da2d 100644
--- a/docs/agent-config.md
+++ b/docs/agent-config.md
@@ -22,7 +22,10 @@ project root with `eve set --model anthropic/claude-opus-4.8` or from the local
dev TUI with `/model anthropic/claude-opus-4.8`.
The root `agent.ts` can be omitted when no runtime config is needed. In that case, eve defaults
-to `anthropic/claude-sonnet-5`. When `agent.ts` is present, `model` is required.
+to `zai/glm-5.2`. GLM 5.2 does not support image input; choose a
+vision-capable model or [route image inputs to Gemini
+Flash](./guides/dynamic-capabilities#route-image-inputs-to-a-vision-model).
+When `agent.ts` is present, `model` is required.
`model` accepts a gateway model id string, which routes through the [Vercel AI Gateway](https://vercel.com/docs/ai-gateway). To call a provider directly and configure the model in code, pass a provider-authored `LanguageModel`.
diff --git a/docs/channels/custom.mdx b/docs/channels/custom.mdx
index fb50a3812..fa8b644e6 100644
--- a/docs/channels/custom.mdx
+++ b/docs/channels/custom.mdx
@@ -388,7 +388,7 @@ defineChannel({
The `URL` object survives the queue boundary as a string and is reconstituted inside the workflow step. The staging pipeline calls `fetchFile` with the URL serialized as a string (the URL's `href`), which is why the example matches on `url.startsWith(...)`. Return bytes to stage the file to the sandbox, or `null` to let the URL pass through to the model provider.
-The framework handles staging bytes to the sandbox, enforcing upload policy, hydrating files for the model call, and reconstituting `URL` objects after queue serialization.
+The framework handles staging bytes to the sandbox, enforcing upload policy, hydrating files for the model call, and reconstituting `URL` objects after queue serialization. See [Inbound attachments](../sandbox#inbound-attachments) for the shared storage, size, and provider-input behavior.
## What to read next
diff --git a/docs/getting-started.mdx b/docs/getting-started.mdx
index abf0d6560..90a3ab7cd 100644
--- a/docs/getting-started.mdx
+++ b/docs/getting-started.mdx
@@ -29,7 +29,7 @@ The command creates the project, installs dependencies, and initializes Git. If
Pass an AI Gateway model ID or reasoning effort when you do not want the defaults:
```bash
-npx eve@latest init my-agent --model openai/gpt-5.5 --reasoning high
+npx eve@latest init my-agent --model openai/gpt-5.6-terra --reasoning high
```
To add eve to a project that already has a `package.json`, run this command from its root before you create any `agent/` files:
diff --git a/docs/guides/client/messages.mdx b/docs/guides/client/messages.mdx
index 079b8f067..a78eab7d9 100644
--- a/docs/guides/client/messages.mdx
+++ b/docs/guides/client/messages.mdx
@@ -96,7 +96,9 @@ await response.result();
The stream confirms the turn with `message.received`. Its `data.message` remains the flattened
summary for compatibility, and `data.parts` contains structured text and file metadata for clients
-that render attachments. File parts never include raw bytes or internal sandbox paths.
+that render attachments. File parts never include raw bytes or internal sandbox paths. See [Inbound
+attachments](../../sandbox#inbound-attachments) for how eve stages byte-backed files in the session
+sandbox and prepares them for each model call.
## Answer human input requests
diff --git a/docs/guides/dynamic-capabilities.md b/docs/guides/dynamic-capabilities.md
index a0ed62103..d89569173 100644
--- a/docs/guides/dynamic-capabilities.md
+++ b/docs/guides/dynamic-capabilities.md
@@ -21,6 +21,44 @@ resolver first selects a model, eve normalizes the selection and resolves any
omitted context-window metadata from the AI Gateway catalog. Dynamic tools,
skills, instructions, and subagents may return `null` to omit a capability.
+### Route image inputs to a vision model
+
+Use `step.started` when model choice depends on the current messages. This
+keeps GLM for text and switches to Gemini Flash when user history contains an
+image:
+
+```ts title="agent/agent.ts"
+import { defineAgent, defineDynamic } from "eve";
+
+export default defineAgent({
+ model: defineDynamic({
+ events: {
+ "step.started": (_event, ctx) => {
+ const hasImage = ctx.messages.some(
+ (message) =>
+ message.role === "user" &&
+ Array.isArray(message.content) &&
+ message.content.some(
+ (part) =>
+ part.type === "image" ||
+ (part.type === "file" &&
+ (part.mediaType === "image" || part.mediaType.startsWith("image/"))),
+ ),
+ );
+
+ return hasImage ? "google/gemini-3.5-flash" : "zai/glm-5.2";
+ },
+ },
+ }),
+});
+```
+
+eve stages byte-backed `file` parts under `/workspace/attachments` before
+`step.started`, but keeps their media type in `ctx.messages`. When an image
+reaches the provider, vision models can process it and non-vision models reject
+it. eve does not reroute automatically. See [Inbound
+attachments](../sandbox#inbound-attachments).
+
## Dynamic subagents
Wrap a declared subagent's own `agent.ts` in `defineDynamic` when its
diff --git a/docs/reference/cli.md b/docs/reference/cli.md
index 2ab5c48f1..270b00fae 100644
--- a/docs/reference/cli.md
+++ b/docs/reference/cli.md
@@ -48,11 +48,11 @@ Creates a new agent app or adds an agent to an existing app. Always installs dep
After scaffolding, a human terminal usually continues into `eve dev`. If a coding-agent REPL is on `PATH`, the handoff menu can open it instead or exit without starting either process. Coding-agent launches print the next steps instead of opening the TUI, so the session does not get stuck. Fresh projects use the parent workspace's package manager when there is one; otherwise they use the manager that launched `eve init`.
-| Flag | Type | Default | Description |
-| ---------------------- | ------ | --------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
-| `--model <model>` | string | `anthropic/claude-sonnet-5` | Set the root agent's AI Gateway model ID. |
-| `--reasoning <effort>` | enum | provider default | Set reasoning to `none`, `minimal`, `low`, `medium`, `high`, or `xhigh`. `provider-default` leaves the field unauthored. |
-| `--channel-web-nextjs` | flag | off | Add the Web Chat app (Next.js). Not for existing projects — run `eve add channel/web` there instead. |
+| Flag | Type | Default | Description |
+| ---------------------- | ------ | ---------------- | ------------------------------------------------------------------------------------------------------------------------ |
+| `--model <model>` | string | `zai/glm-5.2` | Set the root agent's AI Gateway model ID. |
+| `--reasoning <effort>` | enum | provider default | Set reasoning to `none`, `minimal`, `low`, `medium`, `high`, or `xhigh`. `provider-default` leaves the field unauthored. |
+| `--channel-web-nextjs` | flag | off | Add the Web Chat app (Next.js). Not for existing projects — run `eve add channel/web` there instead. |
## `eve extension`
diff --git a/docs/sandbox.mdx b/docs/sandbox.mdx
index ba55c808a..b2dea6521 100644
--- a/docs/sandbox.mdx
+++ b/docs/sandbox.mdx
@@ -70,6 +70,14 @@ A `SandboxProcess` exposes `stdout`/`stderr` byte streams, `wait()` (resolves wi
The option types (`SandboxSpawnOptions`, `SandboxReadBinaryFileOptions`, `SandboxWriteBinaryFileOptions`, and so on) are named exports from `eve/sandbox`, alongside `SandboxProcess`.
+## Inbound attachments
+
+Before the first model step, eve writes byte-backed AI SDK `file` parts under
+`/workspace/attachments` and stores a sandbox reference in session history.
+For provider calls, images up to 3 MiB and PDFs up to 20 MiB are restored as
+bytes; other files become text references to their sandbox paths. Unresolved
+remote URLs and legacy AI SDK `image` parts are not staged.
+
## Seeding `/workspace`
Mount authored files into the sandbox at session start by placing them under `agent/sandbox/workspace/`. This requires the folder layout (`agent/sandbox/sandbox.ts`), not the top-level shorthand:
diff --git a/e2e/matrix.json b/e2e/matrix.json
index 7c95cbbda..1893da756 100644
--- a/e2e/matrix.json
+++ b/e2e/matrix.json
@@ -2,7 +2,8 @@
"$comment": "Registry for the e2e CI matrices. `models` drives the model suite (e2e-local): the first entry is the default every fixture runs on; fixtures with `\"e2e\": { \"modelMatrix\": \"full\" }` in package.json run on all of them. The short model name is the stable Actions check identifier, so updating a model version does not rename required checks. `worlds` drives the world suites: each entry backs one `world_matrix_<name>` output consumed by the matching `e2e-<name>.yml`, and `package` (when set) is exported to the job as EVE_E2E_WORKFLOW_WORLD. See e2e/README.md.",
"models": [
{ "name": "openai-sol", "id": "openai/gpt-5.6-sol" },
- { "name": "anthropic-opus", "id": "anthropic/claude-opus-5" }
+ { "name": "anthropic-opus", "id": "anthropic/claude-opus-5" },
+ { "name": "zai-glm", "id": "zai/glm-5.2" }
],
"worlds": [{ "name": "vercel" }, { "name": "postgres", "package": "@workflow/world-postgres" }]
}
diff --git a/packages/eve/src/setup/boxes/select-model.test.ts b/packages/eve/src/setup/boxes/select-model.test.ts
index a587ed9fe..651e91333 100644
--- a/packages/eve/src/setup/boxes/select-model.test.ts
+++ b/packages/eve/src/setup/boxes/select-model.test.ts
@@ -55,12 +55,12 @@ const CATALOG: GatewayCatalogModel[] = [
tags: ["web-search"],
},
{
- id: "anthropic/claude-sonnet-5",
- name: "Claude Sonnet 5",
+ id: "zai/glm-5.2",
+ name: "GLM 5.2",
type: "language",
- owned_by: "anthropic",
+ owned_by: "zai",
released: 100,
- tags: ["web-search"],
+ tags: ["reasoning"],
},
// Filtered out: not a language model.
{ id: "openai/dall-e-3", name: "DALL-E 3", type: "image", owned_by: "openai" },
@@ -110,13 +110,14 @@ describe("modelOptionsFromCatalog", () => {
const options = modelOptionsFromCatalog(CATALOG);
expect(options.map((option) => option.value)).toEqual([
- "anthropic/claude-sonnet-5",
+ "zai/glm-5.2",
"zai/glm-4.6",
"openai/gpt-5-mini",
]);
expect(options.filter((option) => option.featured).map((o) => o.value)).toEqual([
- "anthropic/claude-sonnet-5",
+ "zai/glm-5.2",
]);
+ expect(options[0]?.hint).toBe("Z.AI");
});
it("falls back to the static shortlist without a catalog or matches", () => {
@@ -148,7 +149,7 @@ describe("selectModel box", () => {
let captured: SingleSelectOptions<PrompterValue> | undefined;
const { prompter } = createSelectPrompter((opts) => {
captured = opts;
- return "anthropic/claude-sonnet-5";
+ return "zai/glm-5.2";
});
const box = selectModel({ asker: interactiveAsker(prompter), deps: catalogDeps() });
@@ -156,16 +157,16 @@ describe("selectModel box", () => {
expect(result.kind).toBe("done");
if (result.kind !== "done") return;
- expect(result.state.modelId).toBe("anthropic/claude-sonnet-5");
+ expect(result.state.modelId).toBe("zai/glm-5.2");
expect(captured?.search).toBe(true);
// The featured default remains first; the rest are newest release first.
expect(captured?.options.map((option) => option.value)).toEqual([
- "anthropic/claude-sonnet-5",
+ "zai/glm-5.2",
"zai/glm-4.6",
"openai/gpt-5-mini",
]);
// Cursor defaults to the top catalog entry when no default is configured.
- expect(captured?.initialValue).toBe("anthropic/claude-sonnet-5");
+ expect(captured?.initialValue).toBe("zai/glm-5.2");
});
it("orders the curated shortlist first, marks it featured, and pre-selects the default", async () => {
@@ -174,8 +175,7 @@ describe("selectModel box", () => {
captured = opts;
return DEFAULT_AGENT_MODEL_ID;
});
- // "Claude Opus 4.8" sorts above "Claude Sonnet 5" alphabetically, but the
- // curated order (Sonnet first) wins over the alphabetical tiebreak.
+ // The curated order keeps the default ahead of the newer Opus entry.
const catalog: GatewayCatalogModel[] = [
{
id: "anthropic/claude-opus-4.8",
@@ -194,7 +194,7 @@ describe("selectModel box", () => {
expect(result.kind).toBe("done");
if (result.kind !== "done") return;
expect(captured?.options.map((option) => option.value)).toEqual([
- "anthropic/claude-sonnet-5",
+ "zai/glm-5.2",
"anthropic/claude-opus-4.8",
"zai/glm-4.6",
"openai/gpt-5-mini",
@@ -202,7 +202,7 @@ describe("selectModel box", () => {
// Only the curated entries are featured: the picker's default view shows
// them alone, and scrolling or search surfaces the rest of the catalog.
expect(captured?.options.filter((option) => option.featured).map((o) => o.value)).toEqual([
- "anthropic/claude-sonnet-5",
+ "zai/glm-5.2",
"anthropic/claude-opus-4.8",
]);
expect(captured?.initialValue).toBe(DEFAULT_AGENT_MODEL_ID);
diff --git a/packages/eve/src/setup/boxes/select-model.ts b/packages/eve/src/setup/boxes/select-model.ts
index 5d5d37cee..c5db72867 100644
--- a/packages/eve/src/setup/boxes/select-model.ts
+++ b/packages/eve/src/setup/boxes/select-model.ts
@@ -55,7 +55,7 @@ const FEATURED_MODEL_IDS: readonly string[] = [
];
const FALLBACK_MODELS: SelectOption<string>[] = [
- modelOption(DEFAULT_AGENT_MODEL_ID, "Claude Sonnet 5", "Anthropic"),
+ modelOption(DEFAULT_AGENT_MODEL_ID, "GLM 5.2", "Z.AI"),
modelOption("anthropic/claude-opus-4.8", "Claude Opus 4.8", "Anthropic"),
modelOption("openai/gpt-5.5", "GPT-5.5", "OpenAI"),
modelOption("google/gemini-3.5", "Gemini 3.5", "Google", false),
@@ -64,6 +64,7 @@ const FALLBACK_MODELS: SelectOption<string>[] = [
// Brand capitalizations first-letter uppercasing cannot produce.
const PROVIDER_BRANDS: Record<string, string> = {
openai: "OpenAI",
+ zai: "Z.AI",
xai: "xAI",
deepseek: "DeepSeek",
moonshotai: "Moonshot AI",
@@ -110,12 +111,12 @@ function featuredPriority(id: string): number {
}
/**
- * Builds picker options from a fetched catalog (filtered to language models
- * with the `web-search` tag), with the curated shortlist first in its own
- * order and the rest sorted newest release first. Catalog entries on the
- * shortlist are marked `featured`, so a searchable picker opens on just them
- * and scrolling or filtering reaches the rest. Falls back to a static
- * shortlist when the catalog is missing or yields nothing.
+ * Builds picker options from a fetched catalog, keeping the default model and
+ * filtering the rest to language models with the `web-search` tag. The curated
+ * shortlist comes first in its own order, followed by the rest newest-first.
+ * Catalog entries on the shortlist are marked `featured`, so a searchable
+ * picker opens on just them and scrolling or filtering reaches the rest. Falls
+ * back to a static shortlist when the catalog is missing or yields nothing.
*/
export function modelOptionsFromCatalog(
catalog: readonly GatewayCatalogModel[] | undefined,
@@ -123,7 +124,11 @@ export function modelOptionsFromCatalog(
if (catalog === undefined) return FALLBACK_MODELS;
const models = catalog
- .filter((m) => m.type === "language" && (m.tags ?? []).includes(WEB_SEARCH_TAG))
+ .filter(
+ (m) =>
+ m.type === "language" &&
+ (m.id === DEFAULT_AGENT_MODEL_ID || (m.tags ?? []).includes(WEB_SEARCH_TAG)),
+ )
.map((m) => {
const provider = m.id.split("/")[0] ?? "";
return {
diff --git a/packages/eve/src/setup/flows/model.test.ts b/packages/eve/src/setup/flows/model.test.ts
index df4b90939..8d5c01c91 100644
--- a/packages/eve/src/setup/flows/model.test.ts
+++ b/packages/eve/src/setup/flows/model.test.ts
@@ -21,6 +21,13 @@ import {
const APP_ROOT = "/app/my-agent";
const CATALOG: GatewayCatalogModel[] = [
+ {
+ id: "zai/glm-5.2",
+ name: "GLM 5.2",
+ type: "language",
+ owned_by: "zai",
+ tags: ["reasoning"],
+ },
{
id: "anthropic/claude-sonnet-5",
name: "Claude Sonnet 5",
@@ -251,7 +258,8 @@ describe("runModelFlow", () => {
expect(captured?.model).toEqual({
kind: "pick",
options: expect.arrayContaining([
- expect.objectContaining({ value: "anthropic/claude-sonnet-5", featured: true }),
+ expect.objectContaining({ value: "zai/glm-5.2", featured: true }),
+ expect.objectContaining({ value: "anthropic/claude-sonnet-5" }),
expect.objectContaining({ value: "test/no-frills" }),
]),
current: "anthropic/claude-sonnet-5",
diff --git a/packages/eve/src/shared/default-agent-model.ts b/packages/eve/src/shared/default-agent-model.ts
index f008f7bc8..d10eb3dcc 100644
--- a/packages/eve/src/shared/default-agent-model.ts
+++ b/packages/eve/src/shared/default-agent-model.ts
@@ -2,4 +2,4 @@
* Model used when an agent does not declare one, baked in by `eve init`, and
* pre-selected in the setup model picker.
*/
-export const DEFAULT_AGENT_MODEL_ID = "anthropic/claude-sonnet-5";
+export const DEFAULT_AGENT_MODEL_ID = "zai/glm-5.2";
diff --git a/packages/eve/test/scenarios/compile-agent.scenario.test.ts b/packages/eve/test/scenarios/compile-agent.scenario.test.ts
index a7f77df73..20a387ed6 100644
--- a/packages/eve/test/scenarios/compile-agent.scenario.test.ts
+++ b/packages/eve/test/scenarios/compile-agent.scenario.test.ts
@@ -46,7 +46,7 @@ const ROOT_TYPE_DEFINITIONS = fileURLToPath(
const TSC_BIN_PATH = fileURLToPath(
new URL("../../../../node_modules/typescript/bin/tsc", import.meta.url),
);
-const DEFAULT_AGENT_MODEL_ID = "anthropic/claude-sonnet-5";
+const DEFAULT_AGENT_MODEL_ID = "zai/glm-5.2";
describe("compiler artifacts", () => {
it("uses the framework default model when agent.ts is omitted", async () => {
diff --git a/packages/eve/test/setup/mock-ai-gateway.ts b/packages/eve/test/setup/mock-ai-gateway.ts
index 3a84c512c..348b71618 100644
--- a/packages/eve/test/setup/mock-ai-gateway.ts
+++ b/packages/eve/test/setup/mock-ai-gateway.ts
@@ -68,6 +68,7 @@ function collectGatewayModelIds(rootPaths: readonly string[]): ReadonlySet<strin
const ids = new Set<string>([
"anthropic/claude-opus-4.7",
"anthropic/claude-sonnet-5",
+ "zai/glm-5.2",
"openai/gpt-5.4",
"openai/gpt-5.4-mini",
]);