command-code 1.93.4 → 1.93.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # command-code
2
2
 
3
+ ## 1.93.6
4
+
5
+ ### Patch Changes
6
+
7
+ - feat: add `/autocompact` to set the auto-compaction point per model or for all models (Full window, 512K/256K/128K, or a custom count like `/autocompact 400k`).
8
+ - feat: `cmd acp` reports each turn's own tokens in `usage` (session total in `_meta.sessionUsage`) and adds the usage-limit window and `resetsAt` to run errors.
9
+
10
+ ## 1.93.5
11
+
12
+ ### Patch Changes
13
+
14
+ - fix: Make CLI tables responsive on narrow terminals.
15
+ - fix: copy now works over SSH, mosh, tmux, screen and containers (OSC 52 and `tmux load-buffer -w`)
16
+ - feat: Add a Deny-and-steer option to permission prompts to tell Command Code what to do instead.
17
+ - fix: denying one tool call no longer throws away the others in the same batch: the calls you approved still run, then the turn ends.
18
+ - fix: Unauthenticated users need to run `cmd login`.
19
+
3
20
  ## 1.93.4
4
21
 
5
22
  ### Patch Changes
@@ -46,6 +46,7 @@ Every built-in command, grouped by area. Aliases are shown in parentheses on the
46
46
  | --------------- | -------------------------------------------- |
47
47
  | `/compact` | Compact the conversation history |
48
48
  | `/compact-mode` | Select a compact mode to compact sessions |
49
+ | `/autocompact` | Choose when auto-compaction kicks in, per model |
49
50
  | `/context` | Show context window usage and breakdown |
50
51
  | `/memory` | Manage Command Code memory |
51
52
  | `/init` | Initialize AGENTS.md for this project |
@@ -49,7 +49,7 @@ The model catalog — every id `/model`, `--model`, `model:effort` shorthand, an
49
49
  | `Qwen/Qwen3.6-Max-Preview` | Qwen 3.6 Max Preview | — | — | $1.3/$7.8 · cache $0.26 (write $1.63) | Go and above | vibe coding & efficient agent execution |
50
50
  | `Qwen/Qwen3.6-Plus` | Qwen 3.6 Plus | — | — | $0.5/$3 · cache $0.1 | Go and above | agentic coding & reasoning |
51
51
  | `meituan/LongCat-2.0` | LongCat 2.0 | 1.05M | — | $0.3/$1.2 · cache $0.006 | Go and above | trillion-parameter agentic coding with 1M context |
52
- | `stepfun/Step-5-Preview` | Step 5 Preview | 1M | low, medium, high | $1/$2.7 · cache $0.05 | Go and above | 600B sparse-MoE agentic coding with 1M context |
52
+ | `stepfun/Step-5` | Step 5 | 1M | low, medium, high, xhigh, max | $1/$2.7 · cache $0.1 | GOAT and above | flagship agentic coding with 1M context |
53
53
  | `stepfun/Step-3.7-Flash` | Step 3.7 Flash | 256K | — | $0.2/$1.15 · cache $0.04 | Go and above | multimodal sparse-MoE reasoning |
54
54
  | `stepfun/Step-3.5-Flash` | Step 3.5 Flash | 262K | — | $0.09/$0.3 · cache $0.02 | Go and above | fast sparse-MoE agentic reasoning |
55
55
  | `tencent/hy3-paid` | Tencent Hy3 | 262K | — | $0.14/$0.58 · cache $0.035 | Go and above | sparse-MoE reasoning & agentic tool use |
@@ -257,12 +257,22 @@ The `agent` tool is always allowed and never prompts. A sub-agent runs the **sam
257
257
 
258
258
  ## What happens at a prompt
259
259
 
260
- Every prompt offers three choices: allow once, allow **and remember**, or deny with feedback. The remembered scope matches the subject:
260
+ Every prompt offers three choices: allow once, allow **and remember**, or *"No, or tell Command Code what to do instead…"*. The remembered scope matches the subject:
261
261
 
262
262
  - **File ops** - *"Yes, allow all edits this session"* turns on accept edits for the session (same as shift+tab).
263
263
  - **Shell** - *"Yes, don't ask again for `git` commands in this project"* persists a `Shell(git:*)` allow rule to project settings. For a compound command, one rule per non-read-only base. Bases that run arbitrary code (`bash`, `python`, `curl`, …) persist the exact command, not a prefix.
264
264
  - **MCP / other** - *"Yes, don't ask again for `mcp__server__tool` in this project"* persists the tool name to project settings.
265
265
 
266
+ ### Deny and steer
267
+
268
+ The last row is a text field. Move onto it (arrow keys, `j`/`k`, or its number) and:
269
+
270
+ - **Enter with nothing typed** is a plain No: the call is denied and the turn stops so you can reply.
271
+ - **Type what to do instead, then Enter**: the call is denied, your text goes to the agent as that call's result, and it keeps working in the same turn. Any other calls it had planned alongside the denied one are skipped without asking.
272
+ - **Esc** is a plain No.
273
+
274
+ On the text row every key is text. Safety-forced prompts (a destructive command, a sensitive file) show only Yes and the text row. Denials are never remembered.
275
+
266
276
  ### Command explanations on demand
267
277
 
268
278
  The shell prompt can explain the command: press **ctrl+e** (**ctrl+y** in VS Code-family terminals, where the IDE grabs ctrl+e) and a background model call summarizes it inline. Governed by the `on-demand-tool-descriptions` setting (**on by default**): explanations only when asked. Turn it off (via `/config`) to generate every one upfront.
@@ -271,7 +281,7 @@ The shell prompt can explain the command: press **ctrl+e** (**ctrl+y** in VS Cod
271
281
 
272
282
  ## Safety behaviors
273
283
 
274
- Some prompts are forced by a safety check, not a mode or rule. They offer only one-time **Yes**/**No**, plus a banner naming the check. Session and project choices are hidden on purpose - destructive-command, sensitive-path, outside-workspace, and explicit `ask` approvals are never cached, so the next risky call asks again. To stop a recurring one, add a content-specific allow rule (e.g. `Edit(.commandcode/settings.json)`).
284
+ Some prompts are forced by a safety check, not a mode or rule. They offer only one-time **Yes** and the *"No, or tell Command Code what to do instead…"* row, plus a banner naming the check. Session and project choices are hidden on purpose - destructive-command, sensitive-path, outside-workspace, and explicit `ask` approvals are never cached, so the next risky call asks again. To stop a recurring one, add a content-specific allow rule (e.g. `Edit(.commandcode/settings.json)`).
275
285
 
276
286
  ### The root/home removal circuit breaker
277
287
 
@@ -40,6 +40,7 @@
40
40
  - /connect: Connect to AI providers. Command Code, BYOK providers and API keys
41
41
  - /compact: Compact the conversation history
42
42
  - /compact-mode: Select a compact mode to compact sessions
43
+ - /autocompact [400k|full|reset]: Choose when auto-compaction kicks in, per model or for all models (a token ceiling, capped at 90% of each window)
43
44
  - /config: Search and change settings, including which model runs each built-in task
44
45
  - /context: Show context window usage and breakdown
45
46
  - /ide: Connect IDE to share your open file and selected lines
@@ -326,7 +327,7 @@ Valid model ids (the /model catalog — use these EXACT ids):
326
327
  - Qwen/Qwen3.6-Max-Preview
327
328
  - Qwen/Qwen3.6-Plus
328
329
  - meituan/LongCat-2.0
329
- - stepfun/Step-5-Preview
330
+ - stepfun/Step-5
330
331
  - stepfun/Step-3.7-Flash
331
332
  - stepfun/Step-3.5-Flash
332
333
  - tencent/hy3-paid
@@ -310,7 +310,7 @@ With no path, the file is written as `command-code-session-<first 8 chars of id>
310
310
  /copy
311
311
  ```
312
312
 
313
- `/copy` copies the last assistant reply to the clipboard. Best-effort: in headless/SSH terminals without clipboard access, the feed line tells you it couldn't.
313
+ `/copy` copies the last assistant reply to the clipboard. Over SSH, mosh, tmux, screen or a container it sends the reply to your terminal's clipboard (OSC 52, or `tmux load-buffer -w`) and says it was sent, not copied, since terminals never confirm it; if nothing pastes, the line says what to turn on (for example `tmux set -g set-clipboard on`).
314
314
 
315
315
  ---
316
316
 
@@ -10,6 +10,7 @@ The executable registry is authoritative. Run `cmd config list --scope effective
10
10
  | `permissions.defaultMode` | user | enum | `default`, `plan`, `auto-accept`, `dont-ask` | Default permission mode for tool usage. A long-lived host may also apply the change to its current session. "bypass" cannot be set here. |
11
11
  | `theme` | user | enum | `dark`, `light`, `auto` | Terminal color theme (same setting as /theme). Auto automatically detects your terminal background and uses light or dark to match. |
12
12
  | `compact-mode` | user | enum | `default`, `fast` | Auto-compact aggressiveness when context fills up (same setting as /compact-mode). |
13
+ | `auto-compact` | user | enum | `full`, `512k`, `256k`, `128k`, or any token count from 128k to 10m (e.g. 400k) | Where auto-compaction summarizes, on every model: a token ceiling, capped at 90% of each model's window. Per-model choices from /autocompact win over it. Saved to ~/.commandcode/settings.json. |
13
14
  | `tree-filter-mode` | user | enum | `default`, `no-tools`, `user-only`, `labeled-only`, `all` | Default filter when opening /tree. |
14
15
  | `reduced-motion` | user | boolean | `true`, `false` | Turn on to stop the working status text from shimmering and keep the launch-day intro from playing. Off unless you turn it on. |
15
16
  | `on-demand-tool-descriptions` | user | boolean | `true`, `false` | Explain shell commands on permission prompts only when you press ctrl+e (default). Turn off to generate every explanation upfront. |
@@ -108,7 +108,7 @@ Details:
108
108
  - `cmd.clock.every(ms, fn)` / `after(ms, fn)` - timers owned by the mod: cancelled by their `Disposable`, and all of them when the mod reloads. They never hold the process open, and a throwing callback becomes `mod_error` while the timer keeps its schedule.
109
109
  - `cmd.model.complete({prompt})` - one text completion on the session's model client, with no transcript and no tools, billed and attributed like the session. It always resolves: `{isAnswered: true, text, model}` or `{isAnswered: false, reason: 'unavailable' | 'error' | 'aborted'}` (unavailable before a session binds).
110
110
  - `cmd.prompt.submit(text)` - submit a prompt as if typed: in the TUI it starts a turn once the session is idle and queues behind a running one. Headless, it rides the follow-up queue.
111
- - `cmd.ui.copy(text)` - write text to the system clipboard with the same helper `/copy` uses. See [Clipboard and sound](./ui.md#clipboard-and-sound).
111
+ - `cmd.ui.copy(text)` - copy text to the user's clipboard with the same helper `/copy` uses (the terminal over SSH; `isConfirmed: false` then). See [Clipboard and sound](./ui.md#clipboard-and-sound).
112
112
  - `cmd.audio.play({file})` / `cmd.audio.bell()` - play a sound file shipped with the mod, or ring the terminal bell. See [Clipboard and sound](./ui.md#clipboard-and-sound).
113
113
 
114
114
  ## `ModHooks`: hooks that change behavior
@@ -50,7 +50,7 @@ run({state, userInput?, config})
50
50
  working += tool-results user message
51
51
  working := setModState(...) for every afterToolCall `modState`
52
52
  contribution across the batch (BEFORE onTurnEnd runs)
53
- any deny ────────────────────────► pendingStop: permission_denied
53
+ any plain human deny ────────────► pendingStop: permission_denied
54
54
  any terminate ───────────────────► pendingStop: terminate
55
55
  else poll getSteeringMessages → append (source 'steering')
56
56
  ◆ onTurnEnd (each mod; receives THIS turn's usage; returns new state)
@@ -75,8 +75,13 @@ phase 1 - permissions (always sequential):
75
75
  permissions.generateDescription (5s timeout → null)
76
76
  permissions.check({toolName, input, description, permissionMode})
77
77
  throw ⇒ deny (fail closed)
78
- deny → tool_denied; batch aborted: every call gets a tool_result,
79
- run stops with permission_denied AFTER the turn commits
78
+ deny → tool_denied; the call gets its denial as its tool_result
79
+ plain human deny: the approved calls still run unless the batch also
80
+ has a denial with instructions. The run stops with permission_denied
81
+ after the turn commits
82
+ human deny with instructions: skip sibling calls and continue with the
83
+ user's instructions unless a plain human deny ends the run
84
+ policy deny (rule, mode gate): the turn continues so the model can fix it
80
85
  phase 2 - execution (sequential, or parallel when config.toolExecution='parallel'):
81
86
  ◆ beforeToolCall (each mod, in order; `input` rewrites CHAIN mod→mod;
82
87
  execution uses the LAST mod's input; a mod may also set `terminate`)
@@ -254,7 +259,7 @@ One sync sink, fan out with `createEventBus`. Payloads are snapshots - never liv
254
259
  | `message_end` | response complete | full assistant content |
255
260
  | `model_request_start/end` | bracket the inference call | `model`; end adds `usage`, raw-preferred `stopReason` |
256
261
  | `tool_queued` | per call, before permission checks | `input` - the ORIGINAL input, never the rewritten one |
257
- | `tool_denied` | permission denied | - (batch then aborts) |
262
+ | `tool_denied` | permission denied for one call | `toolCallId`, `toolName` |
258
263
  | `tool_hook_blocked` | a mod's beforeToolCall blocked | `hookOutput` - **terminal for that call**: no tool_running/completed/errored follows |
259
264
  | `tool_running` | execution begins (after beforeToolCall) | `description` from permissions.generateDescription |
260
265
  | `tool_update` | streaming tool progress | `partial` content |
@@ -13,10 +13,10 @@ Everything a mod can put on screen rides `cmd.ui`, `cmd.addRenderer`, and `cmd.s
13
13
 
14
14
  ## Clipboard and sound
15
15
 
16
- - `cmd.ui.copy(text)` - write `text` to the system clipboard through the same helper `/copy` uses. It never throws: `{isCopied: true}`, or `{isCopied: false, reason}` where `reason` is `headless` (no interactive host), `no-clipboard` (the machine's clipboard is unreachable, for example over SSH without X11), or `error`.
16
+ - `cmd.ui.copy(text)` - copy `text` to the user's clipboard through the same helper `/copy` uses: the system clipboard locally, and the terminal (OSC 52, or `tmux load-buffer -w` inside tmux) over SSH, in a container, or when the system clipboard is unreachable. It never throws: `{isCopied: true, isConfirmed}`, or `{isCopied: false, reason}`. `isConfirmed` is `false` when the text only went to the terminal: terminals never answer, so it may not have landed. `reason` is `headless` (no interactive host), `no-clipboard` (no clipboard and no terminal that takes it, or only a tmux paste buffer), `too-large` (more than about 750 KB of text, over the 1 MiB of base64 tmux accepts), or `error`.
17
17
  - `cmd.audio.play({file, timeoutMs?})` - play a sound file with the platform player: `afplay` on macOS, `paplay` then `aplay` on Linux, PowerShell `Media.SoundPlayer` on Windows. A relative `file` resolves against the directory of the mod's own file, so ship the sound next to it; an absolute path works too. It runs through the runtime shell and is killed after `timeoutMs` (default 10s). It never throws: `{isPlayed: true}`, or `{isPlayed: false, reason}` where `reason` is `headless`, `not-found`, `no-player`, `timeout`, or `error`.
18
18
  - `cmd.audio.bell()` - ring the terminal bell. Returns `{isPlayed: true}`, or `{isPlayed: false, reason: 'headless'}`.
19
- - Where they work today. In the desktop app, copy, bell, and play all answer `headless` for now. Over SSH without a display, copy answers `no-clipboard`. On Windows, and on Linux with only ALSA (`aplay`, no PulseAudio or PipeWire), play handles WAV files only. Ship a `.wav` if the mod should sound everywhere.
19
+ - Where they work today. In the desktop app, copy, bell, and play all answer `headless` for now. Over SSH or in a container, copy goes through the terminal and answers `isConfirmed: false`. On Windows, and on Linux with only ALSA (`aplay`, no PulseAudio or PipeWire), play handles WAV files only. Ship a `.wav` if the mod should sound everywhere.
20
20
  - Bad arguments never throw either. A `file` that is not a string answers `error`. A `timeoutMs` that is not a positive whole number falls back to the 10s default. A hot reload stops any sound the old code started.
21
21
 
22
22
  Sound is a side effect, so do not `await` it in a hook unless the turn should wait for it:
@@ -33,7 +33,7 @@ cmd.addCommand({
33
33
  handler: async ({exec, ui}) => {
34
34
  const {stdout} = await exec({command: 'git', args: ['branch', '--show-current']});
35
35
  const copied = await ui.copy(stdout.trim());
36
- return {message: copied.isCopied ? 'Copied.' : `Not copied: ${copied.reason}`};
36
+ return {message: copied.isCopied ? (copied.isConfirmed ? 'Copied.' : 'Sent to the terminal clipboard.') : `Not copied: ${copied.reason}`};
37
37
  },
38
38
  });
39
39
  ```
@@ -247,7 +247,7 @@ More mods support coming soon.
247
247
  | `sendUserMessage` | real user turn (queued while busy) | falls back to `queueMessage` | falls back to `queueMessage` |
248
248
  | `prompt.submit` | starts a turn when idle, queues when busy | follow-up queue | follow-up queue |
249
249
  | `shutdown` | exits after the turn settles | no-op | no-op |
250
- | `ui.copy` | system clipboard | `{isCopied: false, reason: 'headless'}` | `{isCopied: false, reason: 'headless'}` |
250
+ | `ui.copy` | system clipboard, or the terminal (OSC 52, tmux) over SSH | `{isCopied: false, reason: 'headless'}` | `{isCopied: false, reason: 'headless'}` |
251
251
  | `audio.play` / `audio.bell` | platform player / terminal bell | no sound, `reason: 'headless'` | no sound, `reason: 'headless'` |
252
252
 
253
253
  **TUI only for now.** `cmd.ui.override`, `cmd.ui.setTitle`, `cmd.ui.copy`, `cmd.audio`, `cmd.addShortcut`, `cmd.shutdown`, pane focus, and typing into `input` or picking in `select` elements are handled by the interactive TUI only. The desktop app draws an `input` or `select` element as plain text it cannot focus, and a `markdown` element as styled lines.