glm-acp-agent 1.6.0 → 1.7.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
@@ -1,6 +1,6 @@
1
1
  # glm-acp-agent
2
2
 
3
- An [Agent Client Protocol (ACP)](https://agentclientprotocol.com) agent written in TypeScript that uses the **Z.AI / Zhipu AI GLM** model family (GLM-5.3, GLM-5 Turbo, GLM-4.7) as its reasoning core.
3
+ An [Agent Client Protocol (ACP)](https://agentclientprotocol.com) agent written in TypeScript that uses the **Z.AI / Zhipu AI GLM** model family (GLM-5.3, GLM-5.3 Flash, GLM-5 Turbo, GLM-4.7) as its reasoning core.
4
4
 
5
5
  The agent connects to any ACP-compatible IDE or client over **stdio**, streams responses back in real time, and can call a rich set of tools to interact with the user's file system, terminal, and the web.
6
6
 
@@ -30,9 +30,9 @@ Built-in web tools use Coding Plan-compatible MCP endpoints, not the general `/a
30
30
  - **Thinking mode** – GLM's `reasoning_content` tokens are surfaced as `agent_thought_chunk` blocks so the client can show the model's chain of thought
31
31
  - **Session permission modes** – supports `default`, `accept_edits`, and `bypass_permissions` via `session/set_mode`. Clients like DevFlow can use this to toggle between prompting for every edit, auto-approving edits while prompting for commands, or bypassing permissions entirely.
32
32
  - **Per-session model switching** – `session/set_model` lets clients change the active GLM model mid-conversation; `session/new` returns the curated `availableModels` list
33
- - **Image input via Coding Plan-native vision or Vision MCP** – `promptCapabilities.image` is advertised; the advertised coding models route pasted ACP image blocks through Z.AI Vision MCP (`@z_ai/mcp-server`), while `glm-5v-turbo` sessions — opt-in via `ACP_GLM_AVAILABLE_MODELS`, since it is no longer on the Coding Plan allowlist — send supported image parts directly to the model. Direct chat-image-only models (e.g. `glm-4v-plus`) are intentionally not used.
33
+ - **Image input via Coding Plan-native vision or Vision MCP** – `promptCapabilities.image` is advertised; `glm-5.3-flash` sends supported pasted ACP image blocks directly as native `image_url` content parts, while the other advertised coding models (including default `glm-5.3`) route them through Z.AI Vision MCP (`@z_ai/mcp-server`). `glm-5v-turbo` keeps the same native-vision path when re-added via `ACP_GLM_AVAILABLE_MODELS` — it is no longer on the Coding Plan allowlist. Direct chat-image-only models (e.g. `glm-4v-plus`) are intentionally not used.
34
34
  - **Session persistence** – conversations are written to `~/.local/state/glm-acp-agent/sessions/` and can be reloaded via `session/load`, branched via `session/fork`, or resumed without replay via `session/resume`
35
- - **Six built-in tools** (see below)
35
+ - **Seven built-in tools** (see below)
36
36
  - **Self-sufficient local tools** – file reads/writes, directory listings, and shell commands run in the agent process, so they do not depend on ACP client `fs` or `terminal` capabilities
37
37
  - **Configurable permissions** – `write_file` and `run_command` behavior depends on the active session mode (prompts by default)
38
38
  - **Protocol-correct stop reasons** – maps model and runtime conditions to ACP `end_turn`, `max_tokens`, `max_turn_requests`, `refusal`, and `cancelled`
@@ -171,17 +171,18 @@ The agent advertises only the models on the current Z.AI Coding Plan allowlist:
171
171
 
172
172
  | Model | Notes |
173
173
  |-------|-------|
174
- | `glm-5.3` | **Default.** Newest 1M-context coding model; thinking mode always on |
174
+ | `glm-5.3` | **Default.** Newest 1M-context coding model; thinking mode always on; text-only (images go through Vision MCP) |
175
+ | `glm-5.3-flash` | Native-vision 1M-context model; cheaper Coding Plan quota |
175
176
  | `glm-5-turbo` | Faster Coding Plan reasoning model; 128K context |
176
177
  | `glm-4.7` | 200K-context reasoning model |
177
178
 
178
- Only models the Coding Plan endpoint serves **under their own name** are advertised. Several ids that used to be listed are now aliases: a request for `glm-5.2` or `glm-5.1` comes back with `"model": "glm-5.3"`, and `glm-4.5-air` comes back as `glm-4.7`. They still work, but advertising them would report a model you are not actually talking to. `glm-5v-turbo` is no longer on the Coding Plan allowlist — selecting it fails with business code `1311` ("subscription plan does not yet include access").
179
+ Only models the Coding Plan endpoint serves **under their own name** are advertised. Several ids that used to be listed are now aliases: a request for `glm-5.2` or `glm-5.1` comes back with `"model": "glm-5.3"`, and `glm-4.5-air` comes back as `glm-4.7`. They still work, but advertising them would report a model you are not actually talking to. Z.AI's Coding Plan overview currently also claims `glm-5-turbo` and `glm-4.7` requests are routed to GLM-5.3-Flash; that has not been confirmed by a live probe here, so both ids stay in the picker. `glm-5v-turbo` is no longer on the Coding Plan allowlist — selecting it fails with business code `1311` ("subscription plan does not yet include access").
179
180
 
180
181
  `ACP_GLM_AVAILABLE_MODELS` lets you advertise any id you like, including the ones above. Custom ids sit outside the supported Coding Plan list — the endpoint rejects any model code Z.AI hasn't whitelisted (business code `1211`). The native-vision path is unchanged, so if your plan does include `glm-5v-turbo`, add it back with `ACP_GLM_AVAILABLE_MODELS` and image blocks still reach it as native `image_url` content parts.
181
182
 
182
- Vision-only chat models (`glm-4v-plus` etc.) are **not** advertised. Every built-in advertised model uses the [Vision MCP](#vision-mcp) path for image analysis; `glm-5v-turbo`, when re-added via the override above, is the one exception and keeps native `image_url` handling.
183
+ Vision-only chat models (`glm-4v-plus` etc.) are **not** advertised. `glm-5.3-flash` is the built-in native-vision Coding Plan model (`image_url` content parts). Default `glm-5.3`, `glm-5-turbo`, and `glm-4.7` still use the [Vision MCP](#vision-mcp) path. `glm-5v-turbo`, when re-added via the override above, keeps native `image_url` handling as an opt-in exception.
183
184
 
184
- When the model name matches `glm-4.5`, `glm-4.6`, `glm-4.7`, or the `glm-5` family, the agent enables Z.AI's `thinking: { type: "enabled" }` extension and forwards reasoning tokens to the client as `agent_thought_chunk` blocks. This includes `glm-5v-turbo`. `ACP_GLM_THINKING=false` asks for plain completions instead — but note it has no effect on GLM-5.3, which ignores every attempt to turn thinking off (see [Thought level](#thought-level-reasoning-effort) below).
185
+ When the model name matches `glm-4.5`, `glm-4.6`, `glm-4.7`, or the `glm-5` family, the agent enables Z.AI's `thinking: { type: "enabled" }` extension and forwards reasoning tokens to the client as `agent_thought_chunk` blocks. This includes `glm-5.3-flash` and `glm-5v-turbo`. `ACP_GLM_THINKING=false` asks for plain completions on models that still accept `thinking.type: "disabled"` (GLM-4.7, GLM-5 Turbo). On GLM-5.3 and GLM-5.3-Flash the flag is a no-op: those models reject `disabled`, so the agent leaves thinking enabled rather than sending it (see [Thought level](#thought-level-reasoning-effort) below).
185
186
 
186
187
  #### Thought level (reasoning effort)
187
188
 
@@ -189,22 +190,23 @@ The agent advertises a `thought_level` [SessionConfigOption](https://agentclient
189
190
 
190
191
  | Model | Levels | Mapping to the Z.AI request |
191
192
  |-------|--------|-----------------------------|
192
- | `glm-5.3` (and `glm-5.2` / `glm-5.1`, which route to it) | `Minimal` / `Low` / `Medium` / `High` / `X-High` / `Max` | `thinking: { type: "enabled" }` + `reasoning_effort` set to the matching value |
193
+ | `glm-5.3` (and `glm-5.2` / `glm-5.1`, which route to 5.3) | `Minimal` / `Low` / `Medium` / `High` / `X-High` / `Max` | `thinking: { type: "enabled" }` + `reasoning_effort` set to the matching value |
194
+ | `glm-5.3-flash` | `Low` / `High` / `Max` | Same mapping; Z.AI only documents these three levels for Flash |
193
195
  | other thinking-capable models | `Off` / `On` | `Off` → `thinking: { type: "disabled" }`; `On` → `thinking: { type: "enabled" }` |
194
196
 
195
- **GLM-5.3 has no `Off` level, because thinking cannot be turned off on it.** The endpoint accepts both `thinking: { type: "disabled" }` and `reasoning_effort: "none"` without error, but keeps emitting reasoning either way — so `ACP_GLM_THINKING=false` is a no-op on GLM-5.3. Use `glm-4.7` if you need non-reasoning completions.
197
+ **GLM-5.3 and GLM-5.3-Flash have no `Off` level, because thinking cannot be turned off on them.** Sending `thinking: { type: "disabled" }` now errors (it is no longer a silent no-op), so `ACP_GLM_THINKING=false` leaves thinking enabled rather than sending `disabled`. Use `glm-4.7` if you need non-reasoning completions — with the caveat that if Coding Plan really routes turbo/4.7 to Flash, a session that picks `glm-4.7` + thought level `Off` may 4xx.
196
198
 
197
- `reasoning_effort` only takes effect on the GLM-5.3 family; `glm-5-turbo` and `glm-4.7` accept the field without validating it and answer identically either way, so the agent omits it for them. New sessions default to `Max`, which is also Z.AI's default when the field is omitted, so out-of-the-box behaviour is unchanged. Switching models re-clamps the level (an effort-ladder selection reverts to `On` when you move to GLM-4.7, and an `Off` selection becomes `Max` when you move to GLM-5.3) and pushes a `config_option_update`. Clients that don't support config options simply ignore the advertised option and get the default behaviour.
199
+ `reasoning_effort` only takes effect on the GLM-5.3 family; `glm-5-turbo` and `glm-4.7` accept the field without validating it and answer identically either way, so the agent omits it for them. New sessions default to `Max`, which is also Z.AI's default when the field is omitted, so out-of-the-box behaviour is unchanged. Switching models re-clamps the level (an effort-ladder selection reverts to `On` when you move to GLM-4.7; an `Off` selection becomes `Max` on GLM-5.3 / Flash; switching from GLM-5.3 onto Flash maps `minimal`→`low`, `medium`→`high`, `xhigh`→`max`) and pushes a `config_option_update`. Clients that don't support config options simply ignore the advertised option and get the default behaviour.
198
200
 
199
- The endpoint validates `reasoning_effort` against `none | minimal | low | medium | high | xhigh | max`; the agent exposes every one of those values as a thought level except `none`, which GLM-5.3 ignores (see above).
201
+ The endpoint validates `reasoning_effort` against `none | minimal | low | medium | high | xhigh | max` on GLM-5.3. GLM-5.3-Flash's documented values are only `low | high | max`, so the agent advertises that shorter ladder for Flash. `none` is never offered on either model.
200
202
 
201
203
  `ACP_GLM_PROMPT_IMAGES=false` still hides the image-attachment capability at session startup. With that flag set, clients should not offer image attachments at all.
202
204
 
203
205
  ### Vision MCP
204
206
 
205
- For `glm-5v-turbo`, pasted ACP image blocks with `image/jpeg`, `image/jpg`, or `image/png` are sent directly to chat completions as `image_url` content parts. HTTPS image URLs are forwarded as URLs; inline base64 data is sent as a `data:<mime>;base64,...` URI. Unsupported image MIME types are rejected client-side with an inline `<image_unsupported_format>` annotation so the prompt can continue without a provider 4xx.
207
+ For `glm-5.3-flash` (built-in) and `glm-5v-turbo` (opt-in via `ACP_GLM_AVAILABLE_MODELS`), pasted ACP image blocks with `image/jpeg`, `image/jpg`, or `image/png` are sent directly to chat completions as `image_url` content parts. HTTPS image URLs are forwarded as URLs; inline base64 data is sent as a `data:<mime>;base64,...` URI. Unsupported image MIME types are rejected client-side with an inline `<image_unsupported_format>` annotation so the prompt can continue without a provider 4xx.
206
208
 
207
- For non-native models, pasted ACP image blocks are not sent to the chat-completions endpoint. Instead, the agent boots `@z_ai/mcp-server` over stdio (via `npx -y @z_ai/mcp-server@latest`) and calls its `image_analysis` tool. The text result is spliced into the user message as `<image_analysis index="N">…</image_analysis>` so the regular Coding Plan model can reason about it.
209
+ For non-native models (including default `glm-5.3`), pasted ACP image blocks are not sent to the chat-completions endpoint. Instead, the agent boots `@z_ai/mcp-server` over stdio (via `npx -y @z_ai/mcp-server@latest`) and calls its `image_analysis` tool. The text result is spliced into the user message as `<image_analysis index="N">…</image_analysis>` so the regular Coding Plan model can reason about it.
208
210
 
209
211
  Prerequisites:
210
212
 
@@ -6,10 +6,11 @@ import { type ToolDefinition } from "../tools/definitions.js";
6
6
  * SessionConfigOption. These map onto Z.AI's `thinking` / `reasoning_effort`
7
7
  * request parameters (see {@link buildThinkingParams}).
8
8
  *
9
- * GLM-5.3 (and GLM-5.2, which the Coding Plan endpoint serves with 5.3)
10
- * supports the full effort ladder: `minimal | low | medium | high | xhigh |
11
- * max`. Other thinking-capable models (5-turbo, 4.7, …) only distinguish
12
- * thinking on vs. off, so they use `none` and `on`.
9
+ * GLM-5.3 (and GLM-5.2 / GLM-5.1, which the Coding Plan endpoint serves with
10
+ * 5.3) supports the full effort ladder: `minimal | low | medium | high |
11
+ * xhigh | max`. GLM-5.3-Flash only honours `low | high | max`. Other
12
+ * thinking-capable models (5-turbo, 4.7, …) only distinguish thinking on vs.
13
+ * off, so they use `none` and `on`.
13
14
  */
14
15
  export type ThoughtLevel = "none" | "on" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
15
16
  /** Type guard: whether an arbitrary string is a known ThoughtLevel. */
@@ -20,13 +21,17 @@ export declare function isThoughtLevel(value: string): value is ThoughtLevel;
20
21
  * Only the GLM-5.3 family honours `reasoning_effort`; on `glm-5-turbo` and
21
22
  * `glm-4.7` the endpoint accepts the field without validating it and the
22
23
  * response depth does not change, so those models only get on/off.
24
+ * GLM-5.3-Flash is a 5.3-family model but only the three documented levels.
23
25
  */
24
26
  export declare function getThoughtLevels(model: string): ThoughtLevel[];
25
27
  /**
26
28
  * Resolve a stored ThoughtLevel to one that's valid for the given model.
27
29
  * Used when switching models or restoring a persisted session: if the old
28
30
  * level isn't in the new model's option list, fall back to the model's
29
- * default (max on 5.3, on for everything else — the last entry in the list).
31
+ * default (max on 5.3 / Flash, on for everything else — the last entry in
32
+ * the list). Switching from GLM-5.3 onto Flash maps the six-rung ladder
33
+ * onto Flash's three documented values rather than collapsing everything
34
+ * to max.
30
35
  */
31
36
  export declare function resolveThoughtLevel(model: string, level: ThoughtLevel): ThoughtLevel;
32
37
  /**
@@ -119,15 +124,16 @@ export declare class GlmClient {
119
124
  * - `minimal` … `max` → thinking enabled + reasoning_effort=<level>
120
125
  * (5.3 family only)
121
126
  *
122
- * Caveat: GLM-5.3 ignores every attempt to turn thinking off — it keeps
123
- * emitting `reasoning_content` for `thinking: { type: "disabled" }` and for
124
- * `reasoning_effort: "none"` alike. `none` is therefore not offered as a level
125
- * for those models (see {@link getThoughtLevels}), and the `ACP_GLM_THINKING=false`
126
- * override below is a no-op there even though the request is still sent.
127
+ * Caveat: GLM-5.3 and GLM-5.3-Flash reject `thinking: { type: "disabled" }`
128
+ * (it is no longer a silent no-op). `none` is therefore not offered as a
129
+ * level for those models (see {@link getThoughtLevels}), and
130
+ * `ACP_GLM_THINKING=false` leaves thinking enabled rather than sending
131
+ * `disabled`.
127
132
  *
128
- * The `ACP_GLM_THINKING` env override still wins: `false` forces thinking off,
129
- * `true` forces it on (ignoring a `none` level). When `effort` is unset the
130
- * model defaults are used, preserving the pre-thought-level behaviour.
133
+ * The `ACP_GLM_THINKING` env override still wins for models that accept it:
134
+ * `false` forces thinking off, `true` forces it on (ignoring a `none` level).
135
+ * When `effort` is unset the model defaults are used, preserving the
136
+ * pre-thought-level behaviour.
131
137
  */
132
138
  export declare function buildThinkingParams(model: string, effort?: ThoughtLevel): Record<string, unknown>;
133
139
  //# sourceMappingURL=glm-client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"glm-client.d.ts","sourceRoot":"","sources":["../../src/llm/glm-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAsB,MAAM,2BAA2B,CAAC;AAChG,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAIhF;;;;;;;;;GASG;AACH,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,IAAI,GACJ,SAAS,GACT,KAAK,GACL,QAAQ,GACR,MAAM,GACN,OAAO,GACP,KAAK,CAAC;AA6CV,uEAAuE;AACvE,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,YAAY,CAEnE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,EAAE,CAE9D;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,YAAY,CAGpF;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,0BAA0B,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,iCAAiC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE;QACT,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,oDAAoD;IACpD,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,kCAAkC;IAClC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,4BAA4B;IAC5B,UAAU,CAAC,EAAE,MAAM,CAA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oBAAoB,OAAO,CAAC;AA0BzC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,SAAS,EAAE,CAYhD;AAED,uEAAuE;AACvE,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;;;;;;GAOG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAS;;IAgB1B;;;;;;OAMG;IACI,UAAU,CACf,QAAQ,EAAE,UAAU,EAAE,EACtB,MAAM,CAAC,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,cAAc,CAAC,cAAc,CAAC;CA0IlC;AA+BD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,YAAY,GACpB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA0CzB"}
@@ -6,10 +6,9 @@ import { debug, error } from "./logger.js";
6
6
  * Levels shown for the models that honour `reasoning_effort` — the endpoint's
7
7
  * full validated ladder minus `none`.
8
8
  *
9
- * Deliberately has no `none`: probing the Coding Plan endpoint on 2026-08-15
10
- * showed GLM-5.3 keeps emitting `reasoning_content` whether you send
11
- * `thinking: { type: "disabled" }` or `reasoning_effort: "none"`, so an "Off"
12
- * option would advertise something the model does not do.
9
+ * Deliberately has no `none`: Z.AI docs say GLM-5.3 / GLM-5.3-Flash only
10
+ * accept `thinking.type: "enabled"` — sending `"disabled"` errors — so an
11
+ * "Off" option would advertise something the model cannot do.
13
12
  */
14
13
  const LEVELS_REASONING_EFFORT = [
15
14
  "minimal",
@@ -19,6 +18,12 @@ const LEVELS_REASONING_EFFORT = [
19
18
  "xhigh",
20
19
  "max",
21
20
  ];
21
+ /**
22
+ * GLM-5.3-Flash's advertised ladder. Z.AI's Chat Completions schema for
23
+ * vision models only accepts `low | high | max`; other values do not provide
24
+ * the requested effort.
25
+ */
26
+ const LEVELS_FLASH = ["low", "high", "max"];
22
27
  /** Levels shown for every other thinking-capable model. */
23
28
  const LEVELS_DEFAULT = ["none", "on"];
24
29
  /**
@@ -35,6 +40,9 @@ function isReasoningEffortModel(model) {
35
40
  const id = model.toLowerCase();
36
41
  return id.startsWith("glm-5.3") || id.startsWith("glm-5.2") || id.startsWith("glm-5.1");
37
42
  }
43
+ function isFlashModel(model) {
44
+ return model.toLowerCase() === "glm-5.3-flash";
45
+ }
38
46
  /** The complete set of thought levels the agent understands. */
39
47
  const ALL_THOUGHT_LEVELS = [
40
48
  "none",
@@ -51,19 +59,34 @@ export function isThoughtLevel(value) {
51
59
  * Only the GLM-5.3 family honours `reasoning_effort`; on `glm-5-turbo` and
52
60
  * `glm-4.7` the endpoint accepts the field without validating it and the
53
61
  * response depth does not change, so those models only get on/off.
62
+ * GLM-5.3-Flash is a 5.3-family model but only the three documented levels.
54
63
  */
55
64
  export function getThoughtLevels(model) {
65
+ if (isFlashModel(model))
66
+ return LEVELS_FLASH;
56
67
  return isReasoningEffortModel(model) ? LEVELS_REASONING_EFFORT : LEVELS_DEFAULT;
57
68
  }
58
69
  /**
59
70
  * Resolve a stored ThoughtLevel to one that's valid for the given model.
60
71
  * Used when switching models or restoring a persisted session: if the old
61
72
  * level isn't in the new model's option list, fall back to the model's
62
- * default (max on 5.3, on for everything else — the last entry in the list).
73
+ * default (max on 5.3 / Flash, on for everything else — the last entry in
74
+ * the list). Switching from GLM-5.3 onto Flash maps the six-rung ladder
75
+ * onto Flash's three documented values rather than collapsing everything
76
+ * to max.
63
77
  */
64
78
  export function resolveThoughtLevel(model, level) {
65
79
  const valid = getThoughtLevels(model);
66
- return valid.includes(level) ? level : valid[valid.length - 1];
80
+ if (valid.includes(level))
81
+ return level;
82
+ if (isFlashModel(model)) {
83
+ if (level === "minimal")
84
+ return "low";
85
+ if (level === "medium")
86
+ return "high";
87
+ return "max";
88
+ }
89
+ return valid[valid.length - 1];
67
90
  }
68
91
  /** Default base URL for the Z.AI / Zhipu OpenAI-compatible API (Coding endpoint). */
69
92
  const DEFAULT_BASE_URL = "https://api.z.ai/api/coding/paas/v4";
@@ -90,6 +113,11 @@ const BUILTIN_AVAILABLE_MODELS = [
90
113
  name: "GLM-5.3",
91
114
  description: "Newest 1M-context coding model with thinking mode",
92
115
  },
116
+ {
117
+ modelId: "glm-5.3-flash",
118
+ name: "GLM-5.3 Flash",
119
+ description: "Native-vision 1M-context model; cheaper Coding Plan quota",
120
+ },
93
121
  {
94
122
  modelId: "glm-5-turbo",
95
123
  name: "GLM-5 Turbo",
@@ -115,6 +143,7 @@ export const ERR_CONTEXT_OVERFLOW = 1261;
115
143
  */
116
144
  const MODEL_METADATA = {
117
145
  "glm-5.3": { contextWindow: 1_000_000 },
146
+ "glm-5.3-flash": { contextWindow: 1_000_000 },
118
147
  "glm-5-turbo": { contextWindow: 128_000 },
119
148
  "glm-4.7": { contextWindow: 200_000 },
120
149
  // Routed to glm-5.3 by the Coding Plan endpoint.
@@ -126,7 +155,7 @@ const MODEL_METADATA = {
126
155
  "glm-5v-turbo": { contextWindow: 200_000 },
127
156
  };
128
157
  /** Models that accept image content parts directly through chat completions. */
129
- const VISION_NATIVE_MODELS = new Set(["glm-5v-turbo"]);
158
+ const VISION_NATIVE_MODELS = new Set(["glm-5.3-flash", "glm-5v-turbo"]);
130
159
  export function isVisionNativeModel(modelId) {
131
160
  return VISION_NATIVE_MODELS.has(modelId.toLowerCase());
132
161
  }
@@ -332,29 +361,33 @@ function thinkingOverride() {
332
361
  * - `minimal` … `max` → thinking enabled + reasoning_effort=<level>
333
362
  * (5.3 family only)
334
363
  *
335
- * Caveat: GLM-5.3 ignores every attempt to turn thinking off — it keeps
336
- * emitting `reasoning_content` for `thinking: { type: "disabled" }` and for
337
- * `reasoning_effort: "none"` alike. `none` is therefore not offered as a level
338
- * for those models (see {@link getThoughtLevels}), and the `ACP_GLM_THINKING=false`
339
- * override below is a no-op there even though the request is still sent.
364
+ * Caveat: GLM-5.3 and GLM-5.3-Flash reject `thinking: { type: "disabled" }`
365
+ * (it is no longer a silent no-op). `none` is therefore not offered as a
366
+ * level for those models (see {@link getThoughtLevels}), and
367
+ * `ACP_GLM_THINKING=false` leaves thinking enabled rather than sending
368
+ * `disabled`.
340
369
  *
341
- * The `ACP_GLM_THINKING` env override still wins: `false` forces thinking off,
342
- * `true` forces it on (ignoring a `none` level). When `effort` is unset the
343
- * model defaults are used, preserving the pre-thought-level behaviour.
370
+ * The `ACP_GLM_THINKING` env override still wins for models that accept it:
371
+ * `false` forces thinking off, `true` forces it on (ignoring a `none` level).
372
+ * When `effort` is unset the model defaults are used, preserving the
373
+ * pre-thought-level behaviour.
344
374
  */
345
375
  export function buildThinkingParams(model, effort) {
346
376
  const params = {};
347
377
  const override = thinkingOverride();
348
378
  const modelCanThink = modelSupportsThinking(model);
349
- // Explicit env override to disable wins over everything.
350
- if (override === false) {
379
+ // GLM-5.3 / Flash (and aliases routed to them) error on thinking.type=disabled.
380
+ const thinkingLockedOn = isReasoningEffortModel(model);
381
+ // Explicit env override to disable wins, except on models that reject it.
382
+ if (override === false && !thinkingLockedOn) {
351
383
  if (modelCanThink)
352
384
  params["thinking"] = { type: "disabled" };
353
385
  return params;
354
386
  }
355
387
  const canThink = override === true || modelCanThink;
356
- // A `none` level disables thinking, unless the env override forces it on.
357
- if (effort === "none" && override !== true) {
388
+ // A `none` level disables thinking, unless the env override forces it on
389
+ // or the model rejects disabled.
390
+ if (effort === "none" && override !== true && !thinkingLockedOn) {
358
391
  if (canThink)
359
392
  params["thinking"] = { type: "disabled" };
360
393
  return params;
@@ -364,9 +397,13 @@ export function buildThinkingParams(model, effort) {
364
397
  params["thinking"] = { type: "enabled" };
365
398
  // reasoning_effort is only meaningful for the GLM-5.3 family — glm-5-turbo
366
399
  // and glm-4.7 accept it without validating it and answer identically either
367
- // way. The remaining levels ("on", and "none" when thinking is force-enabled
368
- // via the env override) carry no valid effort, so we omit the field.
369
- if (effort !== undefined && LEVELS_REASONING_EFFORT.includes(effort) && isReasoningEffortModel(model)) {
400
+ // way. Flash only honours low/high/max, so we send the advertised ladder
401
+ // rather than the full 5.3 set. The remaining levels ("on", and "none"
402
+ // when thinking is force-enabled via the env override) carry no valid
403
+ // effort, so we omit the field.
404
+ if (effort !== undefined &&
405
+ isReasoningEffortModel(model) &&
406
+ getThoughtLevels(model).includes(effort)) {
370
407
  params["reasoning_effort"] = effort;
371
408
  }
372
409
  return params;
@@ -1 +1 @@
1
- {"version":3,"file":"glm-client.js","sourceRoot":"","sources":["../../src/llm/glm-client.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B,OAAO,EAAE,gBAAgB,EAAuB,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAsB3C;;;;;;;;GAQG;AACH,MAAM,uBAAuB,GAAmB;IAC9C,SAAS;IACT,KAAK;IACL,QAAQ;IACR,MAAM;IACN,OAAO;IACP,KAAK;CACN,CAAC;AAEF,2DAA2D;AAC3D,MAAM,cAAc,GAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAEtD;;;;;;;;;GASG;AACH,SAAS,sBAAsB,CAAC,KAAa;IAC3C,MAAM,EAAE,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IAC/B,OAAO,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AAC1F,CAAC;AAED,gEAAgE;AAChE,MAAM,kBAAkB,GAA4B;IAClD,MAAM;IACN,IAAI;IACJ,GAAG,uBAAuB;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,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;QAC7D,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,QAAQ,GAAG,QAAQ,KAAK,IAAI,IAAI,aAAa,CAAC;IAEpD,yEAAyE;IACzE,iCAAiC;IACjC,IAAI,MAAM,KAAK,MAAM,IAAI,QAAQ,KAAK,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAChE,IAAI,QAAQ;YAAE,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;QACxD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,CAAC,QAAQ;QAAE,OAAO,MAAM,CAAC;IAE7B,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAEzC,2EAA2E;IAC3E,4EAA4E;IAC5E,yEAAyE;IACzE,uEAAuE;IACvE,sEAAsE;IACtE,gCAAgC;IAChC,IACE,MAAM,KAAK,SAAS;QACpB,sBAAsB,CAAC,KAAK,CAAC;QAC7B,gBAAgB,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EACxC,CAAC;QACD,MAAM,CAAC,kBAAkB,CAAC,GAAG,MAAM,CAAC;IACtC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -818,7 +818,7 @@ test("newSession advertises the model as a config option next to thought_level a
818
818
  // Default model is glm-5.3.
819
819
  assert.equal(model.currentValue, "glm-5.3");
820
820
  const options = model.options;
821
- assert.deepEqual(options.map((o) => o.value), ["glm-5.3", "glm-5-turbo", "glm-4.7"]);
821
+ assert.deepEqual(options.map((o) => o.value), ["glm-5.3", "glm-5.3-flash", "glm-5-turbo", "glm-4.7"]);
822
822
  // Names must match the models state so both surfaces read the same.
823
823
  assert.deepEqual(options.map((o) => o.name), result.models.availableModels.map((m) => m.name));
824
824
  });
@@ -1525,43 +1525,45 @@ test("prompt with image block runs Vision MCP preprocessing and feeds text into
1525
1525
  assert.match(capturedUser, /What is in this image\?/);
1526
1526
  assert.match(capturedUser, /<image_analysis index="1">[\s\S]*It is a kitten\.[\s\S]*<\/image_analysis>/);
1527
1527
  });
1528
- test("prompt with image block on vision-native model sends native image_url content", async () => {
1529
- const conn = createConnectionStub();
1530
- let capturedUser;
1531
- const glm = {
1532
- async *streamChat(messages, _signal, options) {
1533
- assert.equal(options?.model, "glm-5v-turbo");
1534
- const userMsg = [...messages].reverse().find((m) => m.role === "user");
1535
- capturedUser = userMsg?.content;
1536
- yield { text: "ok" };
1537
- yield { done: true, stopReason: "stop" };
1538
- },
1539
- };
1540
- const visionCalls = [];
1541
- const visionClient = {
1542
- async callTool(_name, args) {
1543
- visionCalls.push(args);
1544
- return { content: [{ type: "text", text: "should not be used" }] };
1545
- },
1546
- async dispose() { },
1547
- };
1548
- const agent = new GlmAcpAgent(conn, { glm, visionClient, sessionStore: null });
1549
- await agent.initialize({ protocolVersion: PROTOCOL_VERSION, clientCapabilities: {} });
1550
- const { sessionId } = await agent.newSession({ cwd: "/tmp", mcpServers: [] });
1551
- await agent.unstable_setSessionModel({ sessionId, modelId: "glm-5v-turbo" });
1552
- await agent.prompt({
1553
- sessionId,
1554
- prompt: [
1528
+ for (const visionModel of ["glm-5v-turbo", "glm-5.3-flash"]) {
1529
+ test(`prompt with image block on ${visionModel} sends native image_url content`, async () => {
1530
+ const conn = createConnectionStub();
1531
+ let capturedUser;
1532
+ const glm = {
1533
+ async *streamChat(messages, _signal, options) {
1534
+ assert.equal(options?.model, visionModel);
1535
+ const userMsg = [...messages].reverse().find((m) => m.role === "user");
1536
+ capturedUser = userMsg?.content;
1537
+ yield { text: "ok" };
1538
+ yield { done: true, stopReason: "stop" };
1539
+ },
1540
+ };
1541
+ const visionCalls = [];
1542
+ const visionClient = {
1543
+ async callTool(_name, args) {
1544
+ visionCalls.push(args);
1545
+ return { content: [{ type: "text", text: "should not be used" }] };
1546
+ },
1547
+ async dispose() { },
1548
+ };
1549
+ const agent = new GlmAcpAgent(conn, { glm, visionClient, sessionStore: null });
1550
+ await agent.initialize({ protocolVersion: PROTOCOL_VERSION, clientCapabilities: {} });
1551
+ const { sessionId } = await agent.newSession({ cwd: "/tmp", mcpServers: [] });
1552
+ await agent.unstable_setSessionModel({ sessionId, modelId: visionModel });
1553
+ await agent.prompt({
1554
+ sessionId,
1555
+ prompt: [
1556
+ { type: "text", text: "What is in this image?" },
1557
+ { type: "image", data: "", mimeType: "image/png", uri: "https://example.com/cat.png" },
1558
+ ],
1559
+ });
1560
+ assert.equal(visionCalls.length, 0);
1561
+ assert.deepEqual(capturedUser, [
1555
1562
  { type: "text", text: "What is in this image?" },
1556
- { type: "image", data: "", mimeType: "image/png", uri: "https://example.com/cat.png" },
1557
- ],
1563
+ { type: "image_url", image_url: { url: "https://example.com/cat.png" } },
1564
+ ]);
1558
1565
  });
1559
- assert.equal(visionCalls.length, 0);
1560
- assert.deepEqual(capturedUser, [
1561
- { type: "text", text: "What is in this image?" },
1562
- { type: "image_url", image_url: { url: "https://example.com/cat.png" } },
1563
- ]);
1564
- });
1566
+ }
1565
1567
  test("prompt with inline image data on vision-native model sends a data URI", async () => {
1566
1568
  const conn = createConnectionStub();
1567
1569
  let capturedUser;