glm-acp-agent 1.6.1 → 1.8.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
 
@@ -24,13 +24,14 @@ Built-in web tools use Coding Plan-compatible MCP endpoints, not the general `/a
24
24
 
25
25
  ## Features
26
26
 
27
- - **Full ACP compliance** – implements `initialize`, `authenticate`, `session/new`, `session/set_mode`, `session/prompt`, `session/cancel`, `session/close`, `session/list`, `session/load`, `session/fork`, `session/resume`, and `session/set_model`
27
+ - **Full ACP compliance** – implements `initialize`, `authenticate`, `session/new`, `session/set_mode`, `session/prompt`, `session/cancel`, `session/close`, `session/list`, `session/load`, `session/fork`, `session/resume`, and `session/set_model`, and pushes `session_info_update`, `config_option_update`, `current_mode_update`, and `available_commands_update` notifications
28
28
  - **Streaming** – assistant text and reasoning tokens are forwarded as incremental ACP chunks
29
29
  - **Tool calling** – agentic loop with a configurable cap of GLM function-calling turns (default 20; see `ACP_GLM_MAX_TURNS` / `--max-turns`)
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
+ - **Slash commands** – commands and skills found under the session's `.claude/` directory are advertised to the client with `available_commands_update`, so `/` autocomplete is populated (see [Slash commands](#slash-commands))
34
+ - **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
35
  - **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
36
  - **Seven built-in tools** (see below)
36
37
  - **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
@@ -90,6 +91,36 @@ Reads, listings, and MCP tool calls are always silent across all modes.
90
91
 
91
92
  ---
92
93
 
94
+ ## Slash commands
95
+
96
+ After `session/new`, `session/load`, `session/fork`, and `session/resume`, the agent
97
+ sends an ACP [`available_commands_update`](https://agentclientprotocol.com/protocol/v2/slash-commands)
98
+ notification. Clients such as Zed and Paseo use it to populate their `/` autocomplete.
99
+ Each notification is a full snapshot that replaces the previous list.
100
+
101
+ The snapshot is built from the same on-disk layout Claude Code uses, read from the
102
+ session's working directory and from `~/.claude` for user-level definitions:
103
+
104
+ | Path | Command name |
105
+ |---|---|
106
+ | `<cwd>/.claude/commands/commit.md` | `/commit` |
107
+ | `<cwd>/.claude/commands/review/pr.md` | `/review:pr` |
108
+ | `<cwd>/.claude/skills/audit/SKILL.md` | `/audit` |
109
+
110
+ Project definitions shadow user-level ones with the same name. The `description`
111
+ and `argument-hint` keys of a file's YAML frontmatter become the menu entry's
112
+ description and input hint; without a `description`, the first heading (then the
113
+ first line) of the body is used instead.
114
+
115
+ Advertised names are sent **without** a leading slash — the client prepends it for
116
+ display and invokes the command by sending `/name …` as ordinary prompt text. When
117
+ that text names an advertised command, the agent injects the definition's body into
118
+ the user message, substituting `$ARGUMENTS` where the file asks for it and otherwise
119
+ appending the typed arguments. Unknown `/foo` is left untouched and reaches the model
120
+ as prose, so typing a slash by accident never fails the turn.
121
+
122
+ ---
123
+
93
124
  ## Prerequisites
94
125
 
95
126
  - **Node.js** 20 or later (native `fetch` and Web Streams required)
@@ -171,17 +202,18 @@ The agent advertises only the models on the current Z.AI Coding Plan allowlist:
171
202
 
172
203
  | Model | Notes |
173
204
  |-------|-------|
174
- | `glm-5.3` | **Default.** Newest 1M-context coding model; thinking mode always on |
205
+ | `glm-5.3` | **Default.** Newest 1M-context coding model; thinking mode always on; text-only (images go through Vision MCP) |
206
+ | `glm-5.3-flash` | Native-vision 1M-context model; cheaper Coding Plan quota |
175
207
  | `glm-5-turbo` | Faster Coding Plan reasoning model; 128K context |
176
208
  | `glm-4.7` | 200K-context reasoning model |
177
209
 
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").
210
+ 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
211
 
180
212
  `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
213
 
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.
214
+ 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
215
 
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).
216
+ 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
217
 
186
218
  #### Thought level (reasoning effort)
187
219
 
@@ -189,22 +221,23 @@ The agent advertises a `thought_level` [SessionConfigOption](https://agentclient
189
221
 
190
222
  | Model | Levels | Mapping to the Z.AI request |
191
223
  |-------|--------|-----------------------------|
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 |
224
+ | `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 |
225
+ | `glm-5.3-flash` | `Low` / `High` / `Max` | Same mapping; Z.AI only documents these three levels for Flash |
193
226
  | other thinking-capable models | `Off` / `On` | `Off` → `thinking: { type: "disabled" }`; `On` → `thinking: { type: "enabled" }` |
194
227
 
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.
228
+ **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
229
 
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.
230
+ `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
231
 
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).
232
+ 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
233
 
201
234
  `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
235
 
203
236
  ### Vision MCP
204
237
 
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.
238
+ 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
239
 
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.
240
+ 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
241
 
209
242
  Prerequisites:
210
243
 
@@ -384,6 +417,7 @@ src/
384
417
  ├── protocol/
385
418
  │ ├── connection.ts # Sets up the ACP stdio connection
386
419
  │ ├── agent.ts # GlmAcpAgent – ACP protocol implementation
420
+ │ ├── slash-commands.ts # Discovers .claude commands/skills; expands `/name`
387
421
  │ └── session-store.ts # On-disk persistence for load/fork/resume
388
422
  ├── tools/
389
423
  │ ├── definitions.ts # Tool JSON schemas (function-calling format)
@@ -393,6 +427,7 @@ src/
393
427
  ├── credentials.test.ts # Credential resolution and --setup persistence
394
428
  ├── executor.test.ts # Tests for ToolExecutor
395
429
  ├── glm-client.test.ts # Tests for streaming / tool-call assembly
430
+ ├── slash-commands.test.ts # Command discovery and `/name` expansion
396
431
  └── integration.test.ts # End-to-end tests over the real ACP ndjson transport
397
432
  ```
398
433
 
@@ -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;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B,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,EAA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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"}
@@ -58,6 +58,22 @@ export declare class GlmAcpAgent implements Agent {
58
58
  initialize(params: InitializeRequest): Promise<InitializeResponse>;
59
59
  authenticate(params: AuthenticateRequest): Promise<AuthenticateResponse>;
60
60
  newSession(params: NewSessionRequest): Promise<NewSessionResponse>;
61
+ /**
62
+ * Queue an `available_commands_update` snapshot for a session.
63
+ *
64
+ * The notification is the only channel ACP gives us for slash-command
65
+ * autocomplete — it is not part of any method's response — so every session
66
+ * entry point (create / load / fork / resume) has to send one.
67
+ *
68
+ * It is deliberately *deferred* rather than awaited inline: a client learns a
69
+ * session's id from the `session/new` / `session/fork` response, so a
70
+ * notification written ahead of that response arrives for a session the client
71
+ * has never heard of, and clients drop those. Sending on the next macrotask
72
+ * puts it behind the response the caller is about to return (and, on load,
73
+ * behind the replayed transcript), which is also when a client is ready to
74
+ * paint the menu. Each send replaces the previous list wholesale.
75
+ */
76
+ private scheduleAvailableCommands;
61
77
  unstable_setSessionModel(params: SetSessionModelRequest): Promise<SetSessionModelResponse>;
62
78
  /**
63
79
  * Switch a session to a new model id — shared by `session/set_model` and the
@@ -1 +1 @@
1
- {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/protocol/agent.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,KAAK,EACL,mBAAmB,EAEnB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAk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