zames_pro 2.82.137 → 2.82.139

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.
Files changed (62) hide show
  1. package/CHANGELOG.md +153 -0
  2. package/README.md +86 -63
  3. package/dist/agent-loop.js +3 -6
  4. package/dist/answer-parse.js +10 -16
  5. package/dist/attach-refs.js +3 -3
  6. package/dist/attachments.js +7 -8
  7. package/dist/backlog.js +2 -5
  8. package/dist/banner.js +4 -5
  9. package/dist/browser-chats.js +4 -4
  10. package/dist/browser-dom.js +16 -15
  11. package/dist/browser-login.js +9 -5
  12. package/dist/browser-pure.js +5 -5
  13. package/dist/browser.js +10 -20
  14. package/dist/changelog.js +14 -20
  15. package/dist/checkpoint.js +6 -10
  16. package/dist/cli-args.js +4 -6
  17. package/dist/code-blocks.js +3 -6
  18. package/dist/commands.js +5 -9
  19. package/dist/config-command.js +6 -4
  20. package/dist/config-commands.js +2 -3
  21. package/dist/config-live.js +7 -13
  22. package/dist/config-menu.js +5 -4
  23. package/dist/config.js +5 -8
  24. package/dist/deepseek-ui.js +7 -7
  25. package/dist/diagnostics.js +5 -7
  26. package/dist/diff.js +8 -10
  27. package/dist/extraTools.js +3 -3
  28. package/dist/fsutil.js +0 -4
  29. package/dist/gitTools.js +5 -4
  30. package/dist/glm-browser.js +2 -10
  31. package/dist/glm-chats.js +0 -1
  32. package/dist/glm-net-capture.js +1 -1
  33. package/dist/glm-ui.js +2 -2
  34. package/dist/goal.js +1 -4
  35. package/dist/i18n/common.js +2 -2
  36. package/dist/i18n.js +1 -2
  37. package/dist/index.js +0 -11
  38. package/dist/input/suggest.js +4 -7
  39. package/dist/input.js +3 -8
  40. package/dist/markdown.js +0 -1
  41. package/dist/mcp.js +2 -5
  42. package/dist/net-capture.js +1 -1
  43. package/dist/path-token.js +7 -14
  44. package/dist/prompt.js +4 -3
  45. package/dist/qwen-browser.js +1 -8
  46. package/dist/qwen-chats.js +0 -1
  47. package/dist/qwen-net-capture.js +4 -7
  48. package/dist/qwen-ui.js +0 -3
  49. package/dist/run-task.js +4 -4
  50. package/dist/self-review.js +0 -5
  51. package/dist/send-runtime.js +6 -10
  52. package/dist/send-telemetry.js +5 -7
  53. package/dist/send-throttle.js +4 -5
  54. package/dist/sessions.js +6 -7
  55. package/dist/spinner.js +3 -4
  56. package/dist/statusline.js +5 -9
  57. package/dist/system-prompt.js +1 -1
  58. package/dist/tui/widgets.js +0 -1
  59. package/llms-full.txt +44 -32
  60. package/llms.txt +1 -1
  61. package/package.json +1 -1
  62. package/scripts/postinstall.mjs +5 -0
package/CHANGELOG.md CHANGED
@@ -7,6 +7,159 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.82.139] - 2026-10-25
11
+
12
+ ### Changed
13
+
14
+ - docs(test/security-sandbox): drop the backlog priority label
15
+ - docs(test): remove the last backlog ids (I2, U2/U3)
16
+ - docs(test/extra-tools): drop a backlog id from a section header
17
+ - docs(test/cancel-ask): stop quoting a stale watchdog deadline
18
+ - docs(test/send-runtime-block-lift): fix a header that contradicted its own fix
19
+ - docs(test/tui-hints-locale): wrap two over-long comment lines
20
+ - docs(test/tui-hints-locale): wrap the over-long note
21
+ - docs(test): translate leftover Russian comments
22
+ - docs(test/readme-built): say why a second readme is forbidden
23
+ - docs(test/readme-built): say why a second readme is forbidden
24
+ - docs(test/agent-loop): state why the first send is not an agent turn
25
+ - docs(test/statusline-cap): untangle the settle-vs-exit note
26
+ - docs(test/i18n-unused): drop the shouting prefix
27
+ - docs(test/legacy-paste-marker): drop a time-relative word
28
+ - docs(test): replace first-person narration with the subject
29
+ - docs(test/continue-button): drop the first-person narration
30
+ - docs(test/auto-compact): drop a pointer to the fixture value
31
+ - docs(test/run-task): drop the refactor history from the header
32
+ - docs(test/attach-flow-shared): keep only the why of the fake clock
33
+ - docs(test/send-telemetry-nan-block): drop a case that lives in another test
34
+ - docs(test/wsl): state the real reason instead of the CI setup
35
+ - docs(test/agent-loop-robust): name the retry budget constant
36
+ - docs(test/diff-large-file): stop quoting a removed source comment
37
+ - docs(test/auth-login): trim a comment that restated its asserts
38
+ - docs(agents): remove the last backlog ids from the root instructions
39
+ - docs(scripts): remove backlog ids from scenario comments
40
+ - docs(test/generation-incomplete): stop quoting a stale watchdog value
41
+ - docs(test/cancel-ask): drop the runner version from the keep-alive note
42
+ - docs(test/cli-flags): name the skip-list constant
43
+ - docs(test/continue-button): name the real continue constant
44
+ - docs(test/finished-answer-plain-json): name the real constants
45
+ - docs(test/tool-name-resolution): drop the meta clause
46
+ - docs(test/mcp-truncate-surrogate): finish the meta-narration cleanup
47
+ - docs(test): drop meta-narration from test comments
48
+ - docs(test/log-window): state the bug instead of narrating the test
49
+ - docs(readme): mention /rewind next to /undo
50
+ - docs(llms): regenerate llms-full.txt after the readme fixes
51
+ - docs(readme): clarify the per-provider context window sentence
52
+ - docs(readme): the Qwen send pause is 4 s, not 1 s
53
+ - docs(readme): the context percentage is per provider, not always 1M
54
+ - docs(readme): complete the CLI options block
55
+ - docs(readme): list BashOutput and AskUser among the tools
56
+ - docs(readme): make the slash-command list match SLASH_COMMANDS
57
+ - docs(scripts): fix a typo in the build-readme usage line
58
+ - docs(test/agent-loop-robust): fix a section header that contradicted the code
59
+ - docs(test/i18n-unused): tighten the vacuously-green note
60
+ - docs(test/attach-flow): drop a what-comment
61
+ - docs(test/browser-login): drop a duplicated probe walkthrough
62
+ - docs(scripts): document the postinstall contract
63
+ - docs(test/agent-facing-english): point at the split i18n catalog
64
+ - docs(test): remove backlog ids missed by the first sweep
65
+ - docs(developing): refresh module sizes and drop backlog ids
66
+ - docs(agents): drop backlog ids from the module map
67
+ - docs(agents): the providers are three, with three profiles
68
+ - docs(contributing): fix the provider list and the dev-mode description
69
+ - docs(citation): sync the version and keep CITATION.cff updated on release
70
+ - docs(readme): mention GLM in the provider section
71
+ - docs(readme): fix three default/config facts (mouseScroll, telemetry, config write target)
72
+ - docs(readme): state the real Node.js requirement (>= 22)
73
+ - docs(design-notes): replace a backlog id with the actual reason
74
+ - docs(scripts): translate a Russian header and drop backlog ids
75
+ - docs(test/xml): prune and fix stale comments
76
+ - docs(test/subagent): prune stale comments
77
+ - docs(test/ssrf): prune stale comments
78
+ - docs(test/skill): prune and fix stale comments
79
+ - docs(test/mcp): prune stale comments and translate a leftover Russian note
80
+ - docs(test/i18n): repair a corrupted word and prune stale comments
81
+ - docs(test/glm): prune and fix stale comments
82
+ - docs(test/editor): drop remaining backlog ids
83
+ - docs(test/editor): prune and fix stale comments
84
+ - docs(test/context): prune and fix stale comments
85
+ - docs(test/config): prune and fix stale comments
86
+ - docs(test/cli): prune and fix stale comments
87
+ - docs(test/browser): prune and fix stale comments
88
+ - docs(test/backlog): prune and fix stale comments
89
+ - docs(test/answer-parse): prune and fix stale comments
90
+ - docs(test/agent-loop): prune and fix stale comments
91
+ - docs: add a text-audit protocol for an unattended loop run
92
+
93
+ ## [2.82.138] - 2026-10-25
94
+
95
+ ### Changed
96
+
97
+ - docs(types): fix a stale provider count
98
+ - docs(tui/widgets): prune a section divider
99
+ - docs(tui): prune section dividers
100
+ - docs(system-prompt): drop a backlog-id reference
101
+ - docs(statusline): prune and fix stale comments
102
+ - docs(status-command): prune and fix stale comments
103
+ - docs(spinner): prune and fix stale comments
104
+ - docs(shell): prune and fix stale comments
105
+ - docs(sessions): prune and fix stale comments
106
+ - docs(send-throttle): prune and fix stale comments
107
+ - docs(send-telemetry): prune and fix stale comments
108
+ - docs(send-runtime): prune and fix stale comments
109
+ - docs(self-review): prune section dividers
110
+ - docs(run-task): prune and fix stale comments
111
+ - docs(qwen-ui): prune and fix stale comments
112
+ - docs(qwen-net-capture): prune and fix stale comments
113
+ - docs(qwen-chats): prune and fix stale comments
114
+ - docs(qwen-browser): prune section dividers
115
+ - docs(prompt): prune and fix stale comments
116
+ - docs(permissions): prune and fix stale comments
117
+ - docs(path-token): prune and fix stale comments
118
+ - docs(net-capture): prune and fix stale comments
119
+ - docs(mcp): prune and fix stale comments
120
+ - docs(markdown): prune and fix stale comments
121
+ - docs(limits-command): prune and fix stale comments
122
+ - docs(input/suggest): prune and fix stale comments
123
+ - docs(input/layout): drop a backlog-id reference
124
+ - docs(input): prune backlog ids and section dividers
125
+ - docs(index): prune section dividers
126
+ - docs(i18n): prune and fix stale comments
127
+ - docs(i18n): drop backlog-id references from common.ts comments
128
+ - docs(goal): prune and fix stale comments
129
+ - docs(glm-ui): prune and fix stale comments
130
+ - docs(glm-net-capture): prune and fix stale comments
131
+ - docs(glm-chats): prune and fix stale comments
132
+ - docs(glm-browser): prune and fix stale comments
133
+ - docs(glm-browser): prune and fix stale comments
134
+ - docs(gitTools): prune and fix stale comments
135
+ - docs(fsutil): prune and fix stale comments
136
+ - docs(extraTools): prune and fix stale comments
137
+ - docs(diff): prune and fix stale comments
138
+ - docs(diagnostics): prune and fix stale comments
139
+ - docs(deepseek-ui): prune and fix stale comments
140
+ - docs(config): prune and fix stale comments
141
+ - docs(config-menu): prune and fix stale comments
142
+ - docs(config-live): prune and fix stale comments
143
+ - docs(config-commands): prune and fix stale comments
144
+ - docs(config-command): prune and fix stale comments
145
+ - docs(commands): prune and fix stale comments
146
+ - docs(code-blocks): prune and fix stale comments
147
+ - docs(cli-args): prune and fix stale comments
148
+ - docs(checkpoint): prune and fix stale comments
149
+ - docs(changelog): prune and fix stale comments
150
+ - docs(browser): prune and fix stale comments
151
+ - docs(browser-pure): prune and fix stale comments
152
+ - docs(browser-login): prune and fix stale comments
153
+ - docs(browser-dom): prune and fix stale comments
154
+ - docs(browser-chats): prune and fix stale comments
155
+ - docs(banner): prune and fix stale comments
156
+ - docs(backlog): prune and fix stale comments
157
+ - docs(attachments): prune and fix stale comments
158
+ - docs(attach-refs): prune and fix stale comments
159
+ - docs(attach-flow): prune and fix stale comments
160
+ - docs(answer-parse): prune and fix stale comments
161
+ - docs(agent-loop): prune and fix stale comments
162
+
10
163
  ## [2.82.137] - 2026-10-24
11
164
 
12
165
  ### Changed
package/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
  <a href="https://www.npmjs.com/package/zames_pro"><img src="https://img.shields.io/npm/dm/zames_pro.svg" alt="npm downloads"></a>
14
14
  <a href="https://github.com/Viqto0r/zames_pro/actions/workflows/test.yml"><img src="https://github.com/Viqto0r/zames_pro/actions/workflows/test.yml/badge.svg" alt="tests"></a>
15
15
  <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
16
- <a href="package.json"><img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg" alt="Node.js"></a>
16
+ <a href="package.json"><img src="https://img.shields.io/badge/node-%3E%3D22-brightgreen.svg" alt="Node.js"></a>
17
17
  <a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-strict-3178c6.svg" alt="TypeScript"></a>
18
18
  <a href="CONTRIBUTING.md"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs welcome"></a>
19
19
  </p>
@@ -96,8 +96,8 @@ Key pieces:
96
96
  - **A persistent per-provider profile** (`~/.zames/profile` for DeepSeek,
97
97
  `~/.zames/qwen-profile` for Qwen) keeps you signed in; the headless
98
98
  User-Agent is patched so the site's CDN does not 403 the login.
99
- - **A send throttle** (15 s on DeepSeek, ~1 s on Qwen, which tolerates rapid
100
- sends; GLM uses an adaptive pause that starts at 0) keeps the web chat's rate
99
+ - **A send throttle** (15 s on DeepSeek, 4 s on Qwen, which tolerates a faster
100
+ pace; GLM uses an adaptive pause that starts at 0) keeps the web chat's rate
101
101
  limit happy during long tool-heavy runs.
102
102
  - **The agent is sandboxed** to the directory it was started in — no tool can
103
103
  read or write above it.
@@ -115,7 +115,8 @@ Key pieces:
115
115
 
116
116
  - **Tools like Claude Code / Codex** — `Read`, `Write`, `Edit`, `Bash`,
117
117
  `Glob`, `Grep`, plus `MultiEdit`, `ApplyPatch`, `LS`, `TodoWrite`, git and web
118
- tools. Every edit is backed by `/undo`.
118
+ tools. Every edit is backed by `/undo`, and `/rewind` restores the whole
119
+ working tree from a checkpoint.
119
120
  - **Runs while you keep typing** — queue messages during a task; they run right
120
121
  after it, in the same chat (like typing during generation on the web).
121
122
  - **Plan mode** — `/plan` (or `--plan`) drops all mutating tools, so the agent
@@ -148,7 +149,7 @@ Key pieces:
148
149
 
149
150
  ## Requirements
150
151
 
151
- - Node.js >= 20
152
+ - Node.js >= 22
152
153
  - An account on the chat you want to use — **DeepSeek** (`chat.deepseek.com`,
153
154
  the default), **Qwen** (`chat.qwen.ai`) or **GLM** (`chat.z.ai`). Qwen also
154
155
  works in guest mode for a few messages. On first launch zames asks for your login in the terminal
@@ -194,8 +195,8 @@ Credentials and toggles can also be edited from `/config`
194
195
 
195
196
  ## Switching providers (DeepSeek / Qwen / GLM)
196
197
 
197
- zames can drive either **DeepSeek** (`chat.deepseek.com`, the default) or
198
- **Qwen** (`chat.qwen.ai`):
198
+ zames can drive **DeepSeek** (`chat.deepseek.com`, the default), **Qwen**
199
+ (`chat.qwen.ai`) or **GLM** (`chat.z.ai`):
199
200
 
200
201
  ```bash
201
202
  /provider qwen # switch to Qwen (persisted) — applied live, no restart
@@ -209,9 +210,10 @@ zames can drive either **DeepSeek** (`chat.deepseek.com`, the default) or
209
210
  Notes:
210
211
 
211
212
  - The switch is **live**: zames closes the current backend and opens the other
212
- one in place, so no restart is needed. The two backends use **separate
213
+ one in place, so no restart is needed. The backends use **separate
213
214
  persistent profiles** (`~/.zames/profile` for DeepSeek, `~/.zames/qwen-profile`
214
- for Qwen), so switching never signs the other one out.
215
+ for Qwen, `~/.zames/glm-profile` for GLM), so switching never signs the other
216
+ one out.
215
217
  - A chat id belongs to ONE backend, so the new provider opens a **fresh chat**.
216
218
  If the previous chat had messages they are summarized and posted as a
217
219
  handoff with the next task; an empty chat is switched silently.
@@ -230,10 +232,10 @@ Notes:
230
232
  solved programmatically). zames therefore launches GLM headed by default and
231
233
  prints a note about it; `--headless` still forces headless (sends will hit
232
234
  the captcha). `--headed` is accepted everywhere.
233
- - **Send telemetry**: every send is recorded in
235
+ - **Send telemetry** (off by default): when enabled, every send is recorded in
234
236
  `~/.zames/logs/sends-<provider>.jsonl` (timing, mode flags, the outcome and
235
- the server error — never the prompt or the answer). Turn it off with
236
- `/config set browser.sendTelemetry false`. `/limits` shows the recent sends
237
+ the server error — never the prompt or the answer). Turn it on with
238
+ `/config set browser.sendTelemetry true`. `/limits` shows the recent sends
237
239
  and the current pause. GLM additionally uses an **adaptive pause**: it starts
238
240
  at 0 and backs off from a REAL rate limit.
239
241
  - **Warning**: automating a web chat may violate the service's terms of use and
@@ -295,11 +297,11 @@ The prompt is a small line editor with persistent history:
295
297
  Full-screen mode adds dialog navigation, so a long answer can be read and
296
298
  selected without leaving the terminal:
297
299
 
298
- - `ui.mouseScroll=false` (default) — the terminal owns the mouse: normal text
299
- selection works and the wheel is inert (it never scrolls the input history —
300
- history is arrow keys only).
301
- - `ui.mouseScroll=true` — the app consumes the wheel and scrolls the dialog;
302
- selecting text then needs `Shift`+click (the TUI convention).
300
+ - `ui.mouseScroll=true` (default) — the app consumes the wheel and scrolls the
301
+ dialog; selecting text then needs `Shift`+click (the TUI convention). The
302
+ wheel never scrolls the input history — history is arrow keys only.
303
+ - `ui.mouseScroll=false` — the terminal owns the mouse again: normal text
304
+ selection works and the wheel is inert.
303
305
  - `PgUp` / `PgDn` — move up/down the dialog half a screen.
304
306
  - `Home` / `End` — jump to the very top / bottom of the dialog (only while the
305
307
  input line is empty; with text typed they move the caret as usual).
@@ -336,8 +338,11 @@ instead of staying silent.
336
338
  zames --task <task text>
337
339
  zames --chat <id>
338
340
  zames --new-chat
341
+ zames --resume-last
339
342
  zames --resend-prompt
340
343
  zames --dir <path>
344
+ zames --provider <deepseek|qwen|glm>
345
+ zames --max-iter <n>
341
346
  zames --headless
342
347
  zames --headed
343
348
  zames --plan
@@ -368,15 +373,19 @@ zames --task "..." --output-format jsonl \
368
373
 
369
374
  The agent has the same style of tools as Claude Code / Codex CLI:
370
375
 
371
- - **File tools** — `Read`, `Write`, `Edit`, `Bash`, `Glob`, `Grep`. `Read`
372
- returns raw content by default; pass `numbered=true` to get `cat -n`-style
373
- line numbers (for reference only — do not paste them into `Edit`).
376
+ - **File tools** — `Read`, `Write`, `Edit`, `Bash`, `BashOutput`, `Glob`,
377
+ `Grep`. `Read` returns raw content by default; pass `numbered=true` to get
378
+ `cat -n`-style line numbers (for reference only — do not paste them into
379
+ `Edit`). `Bash` takes `run_in_background`; `BashOutput` then polls or kills
380
+ that process.
374
381
  - **Extra tools** — `LS` (list a directory), `MultiEdit` (several edits to one
375
382
  file applied atomically), `TodoWrite` (session task checklist), `ApplyPatch`
376
383
  (multi-file patch in Codex's V4A format: `*** Begin Patch` … `*** End Patch`).
377
384
  - **Git** — `GitStatus`, `GitDiff`, `GitLog`, `GitShow`, `GitBranchList`,
378
385
  `GitAdd`, `GitCommit`, `GitPush`.
379
386
  - **Web** — `WebFetch`, `WebSearch`.
387
+ - **Operator** — `AskUser` (a modal question with options; skipped in plan
388
+ mode so a plan is never interrupted).
380
389
  - **Service** — `respond` (final answer to the operator, ends the task).
381
390
 
382
391
  All file tools stay inside the working directory (sandbox). `Write`/`Edit` and
@@ -384,11 +393,12 @@ All file tools stay inside the working directory (sandbox). `Write`/`Edit` and
384
393
 
385
394
  ## Slash commands
386
395
 
387
- Type / in the prompt for hints (Tab completes). Besides the session and
388
- config commands (/new, /chats, /resume, /cd, /status, /config,
389
- /undo, /transcript, /mcp, /skills, /memory, /init, /reload,
390
- /debug-dom, /help, /exit) there are a few that mirror Claude Code /
391
- Codex CLI:
396
+ Type / in the prompt for hints (Tab completes) — that list is always complete,
397
+ `/help <command>` describes any single one. Besides the session and config
398
+ commands (/new or /clear, /sessions, /chats, /resume-id, /last, /chat, /cd,
399
+ /pwd, /status, /config, /undo, /undo-list, /rewind, /rewind-list, /transcript,
400
+ /tasks, /mcp, /skills, /memory, /remember, /init, /reload, /debug-dom, /help,
401
+ /exit) there are a few that mirror Claude Code / Codex CLI:
392
402
 
393
403
  - /diff [--staged] — show the working-tree git diff (--staged for the index).
394
404
  - /diffstat — a one-line change summary (`git diff --stat`).
@@ -450,11 +460,12 @@ tests`). /cron "<min> <hour> <dom> <month> <dow>" <task> — run on a schedule.
450
460
  current task.
451
461
 
452
462
  The token context is also shown live: the status line above the input has the
453
- spinner/text on the left and the context on the right (e.g. `125k · 13%`,
454
- percent of a 1M context). It is COLORED by fill level: green below 50%,
455
- yellow 50-80%, red above 80%. It comes from the provider's own token
456
- counter (DeepSeek's `accumulated_token_usage`, Qwen's `input_tokens`, GLM's
457
- `prompt_tokens`) and is
463
+ spinner/text on the left and the context on the right (e.g. `125k · 13%`). The
464
+ percentage is of the ACTIVE provider's window — 1M for DeepSeek, a per-model
465
+ value for Qwen and GLM (`qwen.contextLimit` / `glm.contextLimit`) — and it is
466
+ COLORED by fill level: green below 50%, yellow 50-80%, red above 80%.
467
+ It comes from the provider's own token counter (DeepSeek's
468
+ `accumulated_token_usage`, Qwen's `input_tokens`, GLM's `prompt_tokens`) and is
458
469
  hidden until the first answer delivers it.
459
470
 
460
471
  ## Project context, skills and memory
@@ -587,8 +598,9 @@ Examples:
587
598
  /config lang en
588
599
  ```
589
600
 
590
- Changes are written to the project `.zamesrc.json` and applied right away
591
- (where possible without a restart).
601
+ Changes are written to the HOME config (`~/.zames/config.json`), NOT to the
602
+ project `.zamesrc.json` — a personal toggle must not leak into git — and applied
603
+ right away (where possible without a restart).
592
604
 
593
605
  ### Language
594
606
 
@@ -645,7 +657,7 @@ signed-in browser profile.
645
657
  **How do I install a terminal AI coding agent?**
646
658
 
647
659
  ```bash
648
- npm install -g zames_pro # Node.js >= 20; Chromium is fetched automatically
660
+ npm install -g zames_pro # Node.js >= 22; Chromium is fetched automatically
649
661
  cd your-project
650
662
  zames
651
663
  ```
@@ -777,9 +789,9 @@ zames не вызывает API модели. Он запускает headless C
777
789
  `~/.zames/qwen-profile` у Qwen, `~/.zames/glm-profile` у GLM) держит вас
778
790
  залогиненным; User-Agent
779
791
  headless-браузера подменяется, чтобы CDN сайта не отдавал 403 на вход.
780
- - **Троттлинг отправки** (15 с у DeepSeek, ~1 с у Qwen, который спокойно
781
- переносит частые отправки; у GLM — адаптивная пауза с нуля) щадит рейт-лимит
782
- веб-чата во время долгих прогонов с инструментами.
792
+ - **Троттлинг отправки** (15 с у DeepSeek, 4 с у Qwen, который спокойно
793
+ переносит более частый темп; у GLM — адаптивная пауза с нуля) щадит
794
+ рейт-лимит веб-чата во время долгих прогонов с инструментами.
783
795
  - **Агент запесочен** в директорию запуска — ни один инструмент не может
784
796
  читать или писать выше неё.
785
797
 
@@ -796,7 +808,8 @@ zames не вызывает API модели. Он запускает headless C
796
808
 
797
809
  - **Инструменты как в Claude Code / Codex** — `Read`, `Write`, `Edit`, `Bash`,
798
810
  `Glob`, `Grep`, плюс `MultiEdit`, `ApplyPatch`, `LS`, `TodoWrite`, git- и
799
- веб-инструменты. Каждая правка подкреплена `/undo`.
811
+ веб-инструменты. Каждая правка подкреплена `/undo`, а `/rewind` возвращает
812
+ всё рабочее дерево к чекпойнту.
800
813
  - **Работает, пока вы печатаете** — сообщения, набранные во время задачи,
801
814
  встают в очередь и уходят сразу после неё, в тот же чат (как набор текста
802
815
  во время генерации на сайте).
@@ -832,7 +845,7 @@ zames не вызывает API модели. Он запускает headless C
832
845
 
833
846
  ## Требования
834
847
 
835
- - Node.js >= 20
848
+ - Node.js >= 22
836
849
  - Аккаунт в нужном чате — **DeepSeek** (`chat.deepseek.com`, по умолчанию),
837
850
  **Qwen** (`chat.qwen.ai`) или **GLM** (`chat.z.ai`). Qwen также работает в
838
851
  гостевом режиме на несколько сообщений. При первом запуске zames спросит логин в терминале (и сохранит его
@@ -911,10 +924,10 @@ zames умеет работать с **DeepSeek** (`chat.deepseek.com`, по у
911
924
  программно её не пройти). Поэтому zames запускает GLM с окном по умолчанию и
912
925
  пишет об этом при старте; `--headless` по-прежнему форсирует headless
913
926
  (отправки будут упираться в капчу). `--headed` работает везде.
914
- - **Телеметрия отправок**: каждая отправка пишется в
915
- `~/.zames/logs/sends-<provider>.jsonl` (тайминги, флаги режимов, исход и
916
- ошибка сервера — без промптов и ответов). Отключается через
917
- `/config set browser.sendTelemetry false`. Команда `/limits` показывает
927
+ - **Телеметрия отправок** (по умолчанию выключена): когда включена, каждая
928
+ отправка пишется в `~/.zames/logs/sends-<provider>.jsonl` (тайминги, флаги
929
+ режимов, исход и ошибка сервера — без промптов и ответов). Включается через
930
+ `/config set browser.sendTelemetry true`. Команда `/limits` показывает
918
931
  последние отправки и текущую паузу. У GLM вдобавок **адаптивная пауза**: она
919
932
  начинается с 0 и растёт только после НАСТОЯЩЕГО лимита.
920
933
  - **Предупреждение**: автоматизация веб-чата может нарушать условия
@@ -978,11 +991,11 @@ zames
978
991
  В полноэкранном режиме добавляется навигация по диалогу, чтобы длинный ответ
979
992
  можно было прочитать и выделить не покидая терминал:
980
993
 
981
- - `ui.mouseScroll=false` (по умолчанию) — терминал владеет мышью: обычное
982
- выделение текста работает, колесо инертно (и никогда не листает историю
983
- ввода — история только стрелками).
984
- - `ui.mouseScroll=true` — приложение перехватывает колесо и скроллит диалог;
985
- выделение текста тогда — `Shift`+клик (стандарт TUI).
994
+ - `ui.mouseScroll=true` (по умолчанию) — приложение перехватывает колесо и
995
+ скроллит диалог; выделение текста тогда — `Shift`+клик (стандарт TUI). Колесо
996
+ никогда не листает историю ввода — история только стрелками.
997
+ - `ui.mouseScroll=false` — мышью снова владеет терминал: обычное выделение
998
+ текста работает, колесо инертно.
986
999
  - `PgUp` / `PgDn` — вверх/вниз по диалогу на пол-экрана.
987
1000
  - `Home` / `End` — прыжок в самый верх / низ диалога (только когда строка ввода
988
1001
  пуста; при набранном тексте они двигают курсор, как обычно).
@@ -1020,8 +1033,11 @@ base64-блок с узнаваемой сигнатурой изображен
1020
1033
  zames --task <текст задачи>
1021
1034
  zames --chat <id>
1022
1035
  zames --new-chat
1036
+ zames --resume-last
1023
1037
  zames --resend-prompt
1024
1038
  zames --dir <path>
1039
+ zames --provider <deepseek|qwen|glm>
1040
+ zames --max-iter <n>
1025
1041
  zames --headless
1026
1042
  zames --headed
1027
1043
  zames --plan
@@ -1052,16 +1068,19 @@ zames --task "..." --output-format jsonl \
1052
1068
 
1053
1069
  У агента тот же стиль инструментов, что в Claude Code / Codex CLI:
1054
1070
 
1055
- - **Файловые** — `Read`, `Write`, `Edit`, `Bash`, `Glob`, `Grep`. `Read` по
1056
- умолчанию отдаёт сырое содержимое; передайте `numbered=true`, чтобы получить
1057
- нумерацию строк в стиле `cat -n` (только для справки — не вставляйте её в
1058
- `Edit`).
1071
+ - **Файловые** — `Read`, `Write`, `Edit`, `Bash`, `BashOutput`, `Glob`,
1072
+ `Grep`. `Read` по умолчанию отдаёт сырое содержимое; передайте
1073
+ `numbered=true`, чтобы получить нумерацию строк в стиле `cat -n` (только для
1074
+ справки — не вставляйте её в `Edit`). `Bash` принимает `run_in_background`,
1075
+ а `BashOutput` затем опрашивает или убивает этот процесс.
1059
1076
  - **Дополнительные** — `LS` (список директории), `MultiEdit` (несколько правок
1060
1077
  одного файла атомарно), `TodoWrite` (чек-лист задач сессии), `ApplyPatch`
1061
1078
  (мультифайловый патч в формате V4A от Codex: `*** Begin Patch` … `*** End Patch`).
1062
1079
  - **Git** — `GitStatus`, `GitDiff`, `GitLog`, `GitShow`, `GitBranchList`,
1063
1080
  `GitAdd`, `GitCommit`, `GitPush`.
1064
1081
  - **Web** — `WebFetch`, `WebSearch`.
1082
+ - **Оператор** — `AskUser` (модальный вопрос с вариантами; в режиме плана не
1083
+ предлагается, чтобы не прерывать план).
1065
1084
  - **Служебный** — `respond` (финальный ответ оператору, завершает задачу).
1066
1085
 
1067
1086
  Все файловые инструменты остаются внутри рабочей директории (песочница).
@@ -1070,10 +1089,12 @@ zames --task "..." --output-format jsonl \
1070
1089
 
1071
1090
  ## Слэш-команды
1072
1091
 
1073
- Введите / в промпте для подсказок (Tab дополняет). Кроме команд сессии и
1074
- конфига (/new, /chats, /resume, /cd, /status, /config, /undo, /transcript,
1075
- /mcp, /skills, /memory, /init, /reload, /debug-dom, /help, /exit) есть
1076
- несколько в духе Claude Code / Codex CLI:
1092
+ Введите / в промпте для подсказок (Tab дополняет) — этот список всегда полный,
1093
+ а `/help <команда>` описывает любую одну из них. Кроме команд сессии и конфига
1094
+ (/new или /clear, /sessions, /chats, /resume-id, /last, /chat, /cd, /pwd,
1095
+ /status, /config, /undo, /undo-list, /rewind, /rewind-list, /transcript,
1096
+ /tasks, /mcp, /skills, /memory, /remember, /init, /reload, /debug-dom, /help,
1097
+ /exit) есть несколько в духе Claude Code / Codex CLI:
1077
1098
 
1078
1099
  - /diff [--staged] — показать git-диф рабочего дерева (--staged для индекса).
1079
1100
  - /diffstat — сводка изменений одной строкой (`git diff --stat`).
@@ -1136,11 +1157,12 @@ zames --task "..." --output-format jsonl \
1136
1157
  текущей задачи.
1137
1158
 
1138
1159
  Контекст в токенах показывается и вживую: в строке статуса над вводом слева
1139
- спиннер/текст, справа — контекст (например, `125k · 13%`, процент от 1M
1140
- контекста). Он ОКРАШЕН по уровню заполнения: зелёный ниже 50%, жёлтый 50-80%,
1141
- красный выше 80%. Значение приходит из счётчика токенов провайдера (у DeepSeek —
1142
- `accumulated_token_usage`, у Qwen — `input_tokens`, у GLM — `prompt_tokens`) и
1143
- скрыто до первого ответа.
1160
+ спиннер/текст, справа — контекст (например, `125k · 13%`). Процент считается от
1161
+ окна АКТИВНОГО провайдера — 1M у DeepSeek, у Qwen и GLM — своё значение на
1162
+ модель (`qwen.contextLimit` / `glm.contextLimit`). Он ОКРАШЕН по уровню
1163
+ заполнения: зелёный ниже 50%, жёлтый 50-80%, красный выше 80%. Значение
1164
+ приходит из счётчика токенов провайдера (у DeepSeek — `accumulated_token_usage`,
1165
+ у Qwen — `input_tokens`, у GLM — `prompt_tokens`) и скрыто до первого ответа.
1144
1166
 
1145
1167
  ## Контекст проекта, навыки и память
1146
1168
 
@@ -1272,8 +1294,9 @@ enum переключаются на месте; числа и строки от
1272
1294
  /config lang en
1273
1295
  ```
1274
1296
 
1275
- Изменения пишутся в проектный `.zamesrc.json` и применяются сразу (где это
1276
- возможно без перезапуска).
1297
+ Изменения пишутся в домашний конфиг (`~/.zames/config.json`), а НЕ в проектный
1298
+ `.zamesrc.json` — личный переключатель не должен попадать в git, — и применяются
1299
+ сразу (где это возможно без перезапуска).
1277
1300
 
1278
1301
  ### Язык
1279
1302
 
@@ -1332,7 +1355,7 @@ reasoning-модель при включённом «Deep thinking»). В Qwen
1332
1355
  **Как установить терминальный AI coding-агент?**
1333
1356
 
1334
1357
  ```bash
1335
- npm install -g zames_pro # Node.js >= 20; Chromium скачается автоматически
1358
+ npm install -g zames_pro # Node.js >= 22; Chromium скачается автоматически
1336
1359
  cd your-project
1337
1360
  zames
1338
1361
  ```
@@ -233,14 +233,10 @@ export async function runAgentLoop({ browser, tools, task, workdir, maxIteration
233
233
  // call but was not recognized (e.g. a DSML/XML form the strict parser
234
234
  // missed), the tool did NOT run and the echo is the only copy of the
235
235
  // call — it must be executed, not discarded as stale.
236
- // const ranToolLastTurn follows the previous turn's actual effect.
237
236
  let lastTurnRanTool = false;
238
237
  let justRanTool = false;
239
238
  let watchdogRetries = 0;
240
239
  const MAX_WATCHDOG_RETRIES = 3;
241
- // Retry budget for a browser.ask() TIMEOUT (not for content): the send did
242
- // not come back in time. This is separate from unparsedRetries because a
243
- // timeout is an infrastructure failure, not a model protocol violation.
244
240
  // Loop detection: the model sometimes repeats the SAME tool call with the
245
241
  // SAME arguments (e.g. Read the same file) turn after turn. There was no
246
242
  // explicit detector for that — the stale-answer guard only catches a
@@ -263,6 +259,9 @@ export async function runAgentLoop({ browser, tools, task, workdir, maxIteration
263
259
  // Set when the argument-error series hits the cap; appended to the message
264
260
  // AFTER the tool results are formatted (they rebuild `message`).
265
261
  let argErrNudge = '';
262
+ // Retry budget for a browser.ask() TIMEOUT (not for content): the send did
263
+ // not come back in time. Separate from unparsedRetries because a timeout is
264
+ // an infrastructure failure, not a model protocol violation.
266
265
  let afterToolRetries = 0;
267
266
  // toolsRanInTask: how many tools actually ran in THIS task. The protocol
268
267
  // guard uses it to tell "started, then slipped into chat mode" (a reasoning
@@ -1065,8 +1064,6 @@ export async function runAgentLoop({ browser, tools, task, workdir, maxIteration
1065
1064
  const poll = setInterval(syncToolAbort, 100);
1066
1065
  if (typeof poll.unref === 'function')
1067
1066
  poll.unref();
1068
- // Time the tool: the transcript carries durationMs so /cost can
1069
- // show where the time goes (frequent Read→Edit cycles vs slow Bash).
1070
1067
  const toolStart = Date.now();
1071
1068
  try {
1072
1069
  result = await tool.fn(call.args, { signal: toolAbort.signal });
@@ -1,12 +1,9 @@
1
1
  import { parseXmlToolCalls } from './xml-toolcall.js';
2
2
  import { normText } from './browser-pure.js';
3
- // Pure, state-free helpers extracted from agent-loop.ts : the
4
- // tool-call PARSER (JSON / permissive / XML-DSML repair) and the small answer
5
- // heuristics. None of them touch the browser or the loop state, so this
6
- // module is safe to import on its own. agent-loop.ts imports the ones the
7
- // loop needs and RE-EXPORTS the public ones, so the existing API (tests import
8
- // parseToolCall / responseLooksLikeToolCall / truncateToolResult from './agent-loop.js')
9
- // is unchanged.
3
+ // Pure, state-free helpers split out of agent-loop.ts: the tool-call PARSER
4
+ // (JSON / permissive / XML-DSML repair) and the small answer heuristics. None
5
+ // of them touch the browser or the loop state, so the module is safe to import
6
+ // on its own; tests and agent-loop.ts import the functions from here directly.
10
7
  // Cap a tool result for the model, but make the truncation EXPLICIT: a bare
11
8
  // slice() silently hid the tail and the model had no idea it was looking at a
12
9
  // partial output (it would act on a half-read file/log).
@@ -537,11 +534,9 @@ function parseToolCallPermissive(text) {
537
534
  const tool = toolMatch[1];
538
535
  // The model occasionally puts the argument keys INLINE with "tool" —
539
536
  // {"tool": "Bash", "command": "..."} — with no "args" wrapper at all.
540
- // The strict parser rejects it (no obj.args), and the permissive parser
541
- // used to bail out too (indexOf('"args"') === -1). Such a call was
542
- // reported as malformed and re-asked up to MAX_MALFORMED_RETRIES times;
543
- // after the budget ran out the run stopped with the model's text as the
544
- // final answer. Flatten the inline keys into args when "args" is absent.
537
+ // The strict parser rejects such a call (no obj.args); flatten the inline
538
+ // keys into args instead of letting the loop re-ask until it gives up and
539
+ // stops with the model's text as the final answer.
545
540
  if (text.indexOf('"args"') === -1) {
546
541
  const braceIdx = text.indexOf('{');
547
542
  if (braceIdx === -1)
@@ -730,16 +725,15 @@ function repairToolCallPreamble(text) {
730
725
  const m = t.match(/(?:^|[^A-Za-z0-9_])(?:\*\*)?(tool)(?:\*\*)?["'`\u2018\u2019\u201c\u201d]*\s*:/);
731
726
  if (!m || m.index === undefined)
732
727
  return null;
733
- // We look for the start from the first quote/bracket around the key, otherwise from the word tool.
734
728
  let start = m.index;
735
729
  const brace = t.indexOf('{', Math.max(0, start - 1));
736
730
  if (brace !== -1 && brace < start)
737
731
  start = brace;
738
732
  let frag = t.slice(start);
739
- // If the fragment does not start with `{` — we add it.
733
+ // The head lost its opening `{`, so rebuild one around the key below.
740
734
  if (!frag.startsWith('{')) {
741
- // The key may have lost its opening quote: tool": → "tool".
742
- // We trim the leading junk up to the word tool and normalize the key quotes.
735
+ // The key lost its opening quote (`tool":`), so drop the junk before it
736
+ // and re-add the quote.
743
737
  frag = frag.replace(/^[^A-Za-z0-9_]*/, '');
744
738
  frag = frag.replace(/^(?:\*\*)?(["'`\u2018\u2019\u201c\u201d]*)(tool)(?:\*\*)?["'`\u2018\u2019\u201c\u201d]*\s*:/, '"$2":');
745
739
  frag = '{' + frag;
@@ -2,7 +2,7 @@ import fs from 'fs/promises';
2
2
  import path from 'path';
3
3
  import { looksLikeFilePath, isImageName } from './attachments.js';
4
4
  import { extractAtFileRefs } from './path-token.js';
5
- // Path resolution and `@file` reference inlining .
5
+ // Path resolution and `@file` reference inlining.
6
6
  // Extracted from src/index.ts so the logic is unit-testable without the whole
7
7
  // CLI. This module touches only the filesystem (no browser/terminal).
8
8
  const NL = String.fromCharCode(10);
@@ -81,12 +81,12 @@ async function isInside(workdir, target) {
81
81
  const rel = path.relative(root, real);
82
82
  return !rel.startsWith('..') && !path.isAbsolute(rel);
83
83
  }
84
- // Per-file and total caps for `@path` inlining . A reference should SAVE
84
+ // Per-file and total caps for `@path` inlining. A reference should SAVE
85
85
  // round-trips, not flood the context: a huge file is truncated with a note
86
86
  // telling the agent to read the rest itself.
87
87
  export const AT_REF_FILE_CAP = 60 * 1024;
88
88
  export const AT_REF_TOTAL_CAP = 200 * 1024;
89
- // Inline `@path` references found in a task text . Returns the augmented
89
+ // Inline `@path` references found in a task text. Returns the augmented
90
90
  // text plus the list of files actually inlined (for the operator notice).
91
91
  // Unknown/unreadable references are left in place untouched -- they may be
92
92
  // part of the prose; we never fail the task over a missing file.