tianshu-mcp 0.3.4 → 0.4.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.
Files changed (37) hide show
  1. package/CHANGELOG.en.md +578 -510
  2. package/CHANGELOG.md +496 -447
  3. package/README.en.md +415 -351
  4. package/README.md +415 -350
  5. package/dist/agents/builtin.js +6 -3
  6. package/dist/agents/codex/discovery.js +15 -17
  7. package/dist/agents/codex/instance.js +99 -33
  8. package/dist/agents/codex/launcher.js +7 -0
  9. package/dist/agents/codex/registry.js +47 -18
  10. package/dist/agents/codex/run.js +59 -11
  11. package/dist/agents/registry.js +17 -15
  12. package/dist/agents/traework/cdp/client.js +28 -1
  13. package/dist/agents/traework/launcher.js +11 -10
  14. package/dist/agents/traework/run.js +12 -11
  15. package/dist/agents/traework/ui/composer.js +2 -1
  16. package/dist/agents/traework/ui/model.js +3 -1
  17. package/dist/agents/traework/ui/session.js +11 -8
  18. package/dist/agents/zcode/dialog.js +52 -23
  19. package/dist/agents/zcode/discovery.js +37 -55
  20. package/dist/agents/zcode/instance.js +66 -35
  21. package/dist/agents/zcode/project.js +10 -1
  22. package/dist/agents/zcode/run.js +30 -2
  23. package/dist/agents/zcode/selectors.js +6 -0
  24. package/dist/config/schema.js +10 -0
  25. package/dist/loop/fix-loop.js +1 -0
  26. package/dist/mcp/handlers.js +56 -14
  27. package/dist/tasks/task-store.js +4 -18
  28. package/dist/util/path.js +85 -3
  29. package/dist/util/ttl-cache.js +35 -0
  30. package/dist/verify/acceptance.js +135 -32
  31. package/dist/verify/code-analysis.js +99 -72
  32. package/dist/verify/exec.js +6 -1
  33. package/dist/verify/git-baseline.js +41 -16
  34. package/dist/verify/report.js +5 -1
  35. package/dist/verify/runner.js +46 -25
  36. package/dist/version.generated.js +1 -1
  37. package/package.json +1 -1
package/CHANGELOG.en.md CHANGED
@@ -1,24 +1,90 @@
1
- # Changelog
2
-
3
- All notable changes to `tianshu-mcp` are documented here. The format follows
4
- [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project adheres to
5
- [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
-
7
- Chinese version: [CHANGELOG.md](CHANGELOG.md)
8
-
9
- ---
10
-
11
- ## [Unreleased]
12
-
13
- ### Planned
14
-
15
- - More external AI-Agent adapters (a new agent = one profile + an optional adapter file).
16
- - TraeWork executable discovery and native-dialog driving on macOS (currently fail-closed).
17
- - Optional project-level skill seeding (by default nothing is written into target repos).
18
- - macOS hardware verification for the Codex GUI adapter (built-in status remains `research`).
19
- - Best-effort stop of a GUI-side pending session (via a temporary CDP connection) when cancelling
20
- a task in the `needs_user` state.
21
-
1
+ # Changelog
2
+
3
+ All notable changes to `tianshu-mcp` are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project adheres to
5
+ [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ Chinese version: [CHANGELOG.md](CHANGELOG.md)
8
+
9
+ ---
10
+
11
+ ## [Unreleased]
12
+
13
+ ### Planned
14
+
15
+ - More external AI-Agent adapters (a new agent = one profile + an optional adapter file).
16
+ - TraeWork executable discovery and native-dialog driving on macOS (currently fail-closed).
17
+ - Optional project-level skill seeding (by default nothing is written into target repos).
18
+ - Cancel/rework/new-project matrices for the Codex and ZCode GUI drivers on macOS (both remain `research` on darwin).
19
+ - Best-effort stop of a GUI-side pending session (via a temporary CDP connection) when cancelling
20
+ a task in the `needs_user` state.
21
+
22
+ ---
23
+
24
+ ## [0.4.0] — 2026-09-13
25
+
26
+ ### Added
27
+
28
+ - `projectPath` safety gate: `run_task`/`verify_task` validate at submission (absolute path +
29
+ existing directory + realpath symlink resolution), reject the home directory itself and
30
+ system/root directories (including macOS `/private/*` realpath forms); the submission receipt
31
+ notes symlink resolution; dirty git repos get an uncommitted-changes coexistence warning.
32
+ - ZCode GUI driver supports macOS: adapts to the main process rewriting its title (relaxed port
33
+ attribution + bounded scan of the configured port range when argv hides the debug port) and
34
+ detached+unref instance persistence; the folder-panel driver is rewritten for the macOS window
35
+ form (NSOpenPanel as a standalone window + AX value write into the go-to field, immune to IME
36
+ interception). Machine-verified closed loop on 2026-09-13 (macOS arm64, ZCode 3.11.2: bind →
37
+ readback → send → run evidence → acceptance PASS → succeeded); macOS stays `research` until
38
+ the cancel/rework/new-project matrix is covered.
39
+ - Codex GUI driver supports macOS: spawns the ChatGPT.app bundle executable directly
40
+ (per-platform `activation` default spawn/msix-com) with detached+unref instance persistence;
41
+ POSIX process enumeration and SIGTERM stop; default discovery dirs on darwin; project
42
+ registration writes the shared state file (`~/.codex/.codex-global-state.json`) on darwin too;
43
+ the observation loop reconnects CDP across transient renderer hangs / target replacement
44
+ (only 5 consecutive failures count as disconnected). Machine-verified closed loop on
45
+ 2026-09-13 (macOS arm64: discover → register → bind → send → run evidence → acceptance PASS
46
+ → succeeded); macOS stays `research` until the cancel/rework matrix is covered.
47
+
48
+ ### Fixed
49
+
50
+ - zcode macOS new-task inert-button fallback: `conversation-new-task` can hit an inert home-screen
51
+ icon (click does nothing); when the project trigger misses, the flow now falls back to the
52
+ sidebar `[data-testid=task-new-button]` and retries.
53
+ - `normalizeProjectPath` resolves symlinks: macOS `/tmp`→`/private/tmp` used to fail project
54
+ path matching and degrade into a name match, falsely reporting `project_ambiguous`;
55
+ falls back to lexical normalization when realpath fails.
56
+ - zcode macOS panel failures no longer misreport `needsPermission`: the execFile message embeds
57
+ the full script text (containing the `ACCESSIBILITY_PERMISSION_REQUIRED` literal), so every
58
+ failure looked like a permission problem — the check now reads the stderr execution-error line.
59
+ - `get_profiles` now lists user-defined profiles from the data-directory `agent-profiles.json`
60
+ (previously hidden until first resolve, even though `run_task` could already use them — inconsistent discovery feedback).
61
+ - zcode-flow test stubs now cover `listDialogs`, removing a flake where real osascript/PowerShell
62
+ calls blew the `taskTimeoutMs` wall-clock budget under full-suite load.
63
+ - CDP `connect()` failure paths now dispose of the WebSocket themselves (no longer relying on
64
+ callers to disconnect); the `send()` timeout timer is unref'd.
65
+
66
+ ### Performance
67
+
68
+ - All `execFileSync`/`spawnSync` calls across GUI instance probing, discovery and registration
69
+ are now async; ready-wait loops reuse a per-tick process snapshot with a 1.5s TTL cache —
70
+ eliminating event-loop freezes during Windows polling (up to 30s per call).
71
+ - Acceptance command checks run with bounded parallelism: new `verifyConcurrency` (**⚠ default
72
+ changed from serial to 2**, range 1–4; project-level `.tianshu-mcp/acceptance.json` overrides,
73
+ 1 = fully serial — set 1 explicitly for checks that write build outputs, run with `--fix`, or
74
+ share cache directories); logs are concatenated in declaration order with unchanged format;
75
+ cancellation interrupts both in-flight and pending checks.
76
+ - Git baseline hashing is single-pass with bounded async concurrency (untracked cap 5000);
77
+ code analysis reads each file at most once, sniffing only a prefix of large files.
78
+ - `get_profiles` and task snapshot reads now use `Promise.all`.
79
+ - Test suite 267s → 51s: traework UI-layer sleeps are injectable (production defaults unchanged);
80
+ vitest split into parallel unit / serial integration projects.
81
+ - `tsconfig.build.json` no longer emits declarations — 70 `.d.ts` files dropped (140 → 71 files).
82
+
83
+ ### Documentation
84
+
85
+ - README (both languages) gains "macOS headless path: codex-cli (user profile)" — including the
86
+ revoked-certificate warning for ≤0.130.0 and a complete profile example.
87
+
22
88
  ---
23
89
 
24
90
  ## [0.3.4] — 2026-09-13
@@ -28,7 +94,7 @@ Chinese version: [CHANGELOG.md](CHANGELOG.md)
28
94
  - Add initialization recovery with shared deadlines, configurable budgets and a resumable `setup_recovery` state. Reconcile native side effects after timeouts and terminate helper processes on cancellation.
29
95
  - Handle split model labels, hidden outgoing animation text, residual project menus trapping focus and send buttons that are not yet ready.
30
96
  - Add real DOM and recovery/cancellation regressions. Windows hardware verifies cold first import, imported-project reuse and same-task recovery with actual artifacts and 2/2 acceptance checks.
31
- - Release/tarball only; no npm publication. macOS has no real-device verification for this patch and the ZCode profile remains `research`.
97
+ - Published as a GitHub Release/tarball and to npm (`latest`). macOS has no real-device verification for this patch and the ZCode profile remains `research`.
32
98
 
33
99
  See [release notes](docs/release-v0.3.4.en.md) and [validation evidence](docs/zcode-issue-8-10-validation.en.md).
34
100
 
@@ -53,492 +119,494 @@ Fixes issues #4 / #7 by adapting the ZCode GUI driver to the 3.11.2 model-menu a
53
119
  ---
54
120
 
55
121
  ## [0.3.2] — 2026-09-12
56
-
57
- Fixes for issues #5 / #6: **the MCP task model was disconnected from the state of the turn inside
58
- the Codex GUI**. The former is the completion-detection deadlock that kept reporting `running`
59
- while Codex waited for user confirmation; the latter is `cancel_task` only aborting the MCP-side
60
- wait loop, never stopping the in-GUI run, with a misleading description. Both share the same root
61
- cause and are resolved together.
62
-
63
- ### Fixed
64
-
65
- - **Waiting-for-user detection (issue #5)**:
66
- - `judgeCodexPoll` gains a stall fallback: while the stop button stays visible and the
67
- conversation hash is unchanged for `gui.stallTimeoutMs` (default 5 minutes), the task
68
- transitions to `needs_user` (`needsUserKind=user_confirmation`) instead of deadlocking in
69
- `running` until the overall timeout; the stall timer resets as soon as content changes again.
70
- - New configurable UI detection `gui.selectors.userGate` (e.g. the embedded-checkout page or
71
- approval cards): when configured and matched, transitions to `needs_user` immediately.
72
- Unset by default (disabled) — no unverified selectors are built in.
73
- - Tightened the `stopButton` selector: removed the `aria-label*="取消"` over-match (the Cancel
74
- button on waiting-for-user screens used to be mistaken for a running signal).
75
- - **Recovery path (issue #5 fallout)**: `continue_task` now supports codex —
76
- - `user_confirmation`: after the user completes the action in the Codex window, resume by
77
- re-attaching as an observer of the in-GUI run (no message is sent); if the turn already
78
- finished before resuming, the task is still judged `succeeded` correctly;
79
- - `login_required`: after login, re-checks the environment and re-dispatches the task brief
80
- (fresh session + project binding + full initial prompt);
81
- - zcode recovery behaviour is unchanged; other agents are rejected explicitly.
82
- - **Cancel actually stops the GUI (issue #6)**:
83
- - `cancel_task` no longer succeeds on request alone for GUI agents: it first best-effort clicks
84
- the in-app stop button over CDP, then waits (bounded by `gui.cancelWaitMs`, default 15s) for
85
- the GUI to become idle before settling `cancelled`; if the stop could not be confirmed the
86
- terminal message states "GUI 内运行未确认停止…" (the in-GUI run may still be going);
87
- - process-tree termination for CLI agents is unchanged;
88
- - cancelling from `needs_user` now notes that a pending session may remain in the GUI
89
- (no CDP connection exists at that point — documented limitation).
90
- - **Re-dispatch anti-overlap guard (issue #6 chain risk)**: when dispatching, if the managed
91
- instance still has an unstopped run, MCP first tries to stop it; if it cannot, the dispatch
92
- fails hard with `instance_busy`, preventing old and new turns from overlapping inside the same
93
- app (observed in the wild when re-dispatching right after a cancel).
94
- - The startup log no longer hardcodes the tool count as `8`; it reports the actual registry size
95
- (`TOOL_DEFS.length`, currently 9).
96
-
97
- ### Changed
98
-
99
- - Tool descriptions match actual semantics: `cancel_task` distinguishes CLI (kill process tree)
100
- from GUI (best-effort stop click + bounded wait); `continue_task` no longer claims to be
101
- ZCode-only.
102
- - `GuiProfile` gains two configurable options, `stallTimeoutMs` (default 300000) and
103
- `cancelWaitMs` (default 15000), both overridable via agent-profiles.json.
104
- - Skill docs (SKILL.md §4/§5, usage-examples.md §7) document the codex `user_confirmation` /
105
- `login_required` recovery flows, GUI cancel semantics and the new options.
106
-
107
- ---
108
-
109
- ## [0.3.1] — 2026-09-12
110
-
111
- Post-v0.3.0 housekeeping for docs and release automation: **no source-level behavior changes**.
112
- The focus is a full rewrite of the self-installed skill docs plus GitHub/Gitee release-body
113
- composition and link fixes.
114
-
115
- ### Changed
116
-
117
- - **Skill docs (`skills/tianshu-mcp/`) fully rewritten to match the actual v0.3.0 tool surface**:
118
- - Corrected the `codex` description from "headless CLI" to the ChatGPT desktop GUI adapter
119
- (MSIX + COM activation + CDP); documents the required `model`, optional `reasoningLevel` /
120
- `planDoc` / `designSystem`, and that `mode` is not supported;
121
- - Documented the `run_task` `context` parameter and the send-time validation of path references
122
- inside task/context; corrected the `autoFixRounds` default precedence
123
- (call argument > codex 5 / zcode 2 > server default 0);
124
- - Added usage for `list_tasks`, `query_task(tailLines)`, `get_task_report(round)` and
125
- `verify_task` (`extraChecks` / `checksMode` / `baselineRef`) plus the four-level acceptance
126
- command precedence;
127
- - Documented the four `needs_user` kinds and meta fields such as `needsUserKind` /
128
- `pendingQuestion` / `errorType` / `reportRound` / `verificationSource`;
129
- - Added `continue_task` to the approval list; replaced emoji status markers with plain text
130
- (PASS / warning) in the usage examples.
131
- - **Release automation fixes (exposed by the v0.3.0 tag)**:
132
- - The release body is now composed bilingually from `docs/release-v<version>.md` and `.en.md`,
133
- with in-document relative links rewritten to tag-absolute links; a missing doc fails the
134
- workflow loudly instead of producing a shell-only body;
135
- - `Full Changelog` resolves the previous tag via `git describe` into a `compare/<prev>...<tag>`
136
- link instead of degrading to a commits link;
137
- - The body's `CI` link resolves the CI run for the same SHA instead of pointing at the Release run;
138
- - Gitee releases are automated in `release.yml`: `scripts/gitee-release.mjs` idempotently
139
- creates/updates the mirrored release (requires the `GITEE_TOKEN` secret; skipped loudly when unset).
140
- - `.gitignore` now ignores npm pack artifacts and local temporary verification directories.
141
- - Added the missing `[0.1.10]` / `[0.2.0]` / `[0.3.0]` / `[0.3.1]` compare links at the bottom of
142
- this file and its Chinese counterpart.
143
-
144
- ---
145
-
146
- ## [0.3.0] — 2026-09-12
147
-
148
- The Codex desktop app now runs through a **GUI driver**: a new `codex-gui` adapter uses MSIX COM activation
149
- plus CDP to drive the ChatGPT desktop app through the full loop (locate install → launch GUI → bind/create
150
- project → pick model and reasoning level → send instructions → run detection → verify → auto-repair).
151
-
152
- ### BREAKING CHANGES
153
-
154
- - **`agentId=codex` now executes via the desktop GUI instead of the headless CLI**: a new `driver=gui` +
155
- `adapter=codex-gui` + `activation=msix-com`, with the previous **`codex exec` headless path removed**.
156
- After upgrading, `run_task(agentId="codex")` launches and drives the Codex desktop window rather than a
157
- headless child process. To keep headless execution, add a separate `driver=spawn` profile
158
- (`argsTemplate: ["exec", "<prompt:arg>", "--skip-git-repo-check", "--sandbox", "workspace-write"]`) as
159
- documented in `docs/agent-profiles.en.md`.
160
- - This path requires the Codex desktop app (MSIX store package) to be installed; CLI-only environments are
161
- no longer directly supported.
162
-
163
- ### Added
164
-
165
- - `codex-gui` adapter (`src/agents/codex/**`): Appx-first install discovery (scan fallback taking the newest
166
- version), MSIX COM activation with a dedicated `user-data-dir` and dynamic debug port, plus CDP attach and
167
- target convergence (excluding the overlay secondary window).
168
- - Task parameters: `reasoningLevel` (low/medium/high, bilingual), `planDoc`, `designSystem`.
169
- - Model and reasoning level: models are `menuitemradio` candidates while **reasoning strength is a slider**
170
- (0–4: 轻度/中/高/极高/极高), set precisely with arrow keys and read back for verification; level
171
- comparison is exact to avoid matching "高" against "极高".
172
- - **Automatic project registration**: a target directory not yet registered on the Codex side is written
173
- directly into Codex project state (idempotent, backup-before-write, atomic write, only while the
174
- MCP-managed instance is stopped), so it takes the stable bound-project path instead of the brittle native
175
- folder dialog; on failure it falls back to UI creation.
176
- - Verification and repair: reuses the existing AcceptanceEngine (defaults derived from `package.json`, with
177
- weak-verification labelling); on failure the MCP generates an in-project
178
- `.zcode/plans/codex-fix-r<N>.md` (one per round, never overwritten) and cites it in the repair instruction,
179
- up to 5 rounds by default (`defaultAutoFixRounds`).
180
- - Run detection: the stop button is the authoritative running signal, and text stability counts as completion
181
- evidence only after it; without a running signal it fails open to `idle_timeout` while keeping the instance
182
- (never a false completion).
183
- - `scripts/probe-codex.mjs` hardware diagnostic script; 67 Codex unit tests plus integration coverage of the
184
- verify-fail → generated plan → repair-pass loop.
185
- - Docs: `docs/codex-gui-cdp.en.md`, `docs/codex-windows-smoke.en.md` (including the round-2 real business task
186
- acceptance) and their Chinese counterparts.
187
-
188
- ### Changed
189
-
190
- - `GuiProfile` gains `activation` / `userDataDir` / `appxPackageName` / `permissionMode` / `fixPlanDir`;
191
- existing `spawn` profiles are unaffected.
192
- - `ExecutableDiscovery` gains `appxPackageName` / `installRelativeExe` / `scanRoots` / `scanPattern`.
193
-
194
- ### Fixed (exposed by hardware testing)
195
-
196
- - The model trigger mis-matched the sibling permission chip (4 chips share `aria-haspopup`; only the model chip
197
- lacks `aria-label`).
198
- - Reasoning strength was clicked like a menu item and could never be set (it is actually a slider).
199
- - Menus/popovers only open on **trusted** mouse events (DOM `.click()` is ignored).
200
- - A transient empty model read during toolbar re-render after binding was treated as a "model mismatch".
201
- - Model/reasoning trigger selectors now exclude the top menu bar and the mode switcher.
202
- - Cold-start readiness budget widened to 150s (registration stops the instance first; cold start measured ~85s).
203
- - CI: fixed a `normalizeDir` assertion that depended on the host platform, which failed on ubuntu/macos.
204
- - Fixed integration tests polluting real Codex project state by not injecting `ensureRegistered`.
205
-
206
- ### Verification
207
-
208
- - Windows 10 x64 hardware: full loop for a registered project, and the verify-fail → generated plan →
209
- repair-pass loop; an unregistered project completed the full loop after automatic registration.
210
- - Real business task: drove Codex to build a "Fruit Ninja" mini-game in HTML+CSS+JS (`GPT-5.6 Sol` with
211
- reasoning strength "高"); the artifacts passed acceptance and were verified playable in a headless browser
212
- (score rises, lives decrement, Game Over and restart work, no JS exceptions).
213
- - macOS unverified: the built-in Codex GUI status is `research` and is excluded from readiness.
214
-
215
- ---
216
-
217
- ## [0.2.0] — 2026-09-11
218
-
219
- ### Added
220
-
221
- - Dedicated `zcode-gui` Electron CDP adapter with data-driven Windows/macOS discovery, dynamic ports, product/process checks, and a global serial lock.
222
- - Exact ZCode project binding, guarded native folder pickers, `provider/model`, Full Access read-back, and idempotent sending.
223
- - Paused `needs_user` state and approval-gated `continue_task` for original-session answers and environment rechecks after instance, login, or permission handling.
224
- - Multi-signal liveness, progress events, UI preservation, default auto-verification, and two same-session repair rounds. Repair plans stay in MCP task storage.
225
- - `scripts/probe-zcode.mjs`, fake-CDP/state/path/model tests, and bilingual documentation.
226
-
227
- ### Safety and compatibility
228
-
229
- - GUI profiles support an explicit `adapter`; legacy `driver="gui"` profiles retain TraeWork behavior.
230
- - The built-in ZCode profile remains `research` until both real platform loops pass.
231
- - No private `app-server`, credential access, automatic user-instance termination, or fixed screen coordinates.
232
-
233
- ### Fixed and verified
234
-
235
- - Fixed ZCode read-back for dynamic model labels, transient renderer load/reload, delayed new-session registration, and stale session-ID contamination.
236
- - `AskUserQuestion` continuation now selects and submits an exact accessible option in the original session; zero or ambiguous matches fail closed.
237
- - Windows 10 x64 passed three hardware loops: real file development, same-session repair after a controlled failure, and `continue_task` after a model question. macOS hardware evidence remains pending.
238
-
239
- ---
240
-
241
- ## [0.1.10] — 2026-09-10
242
-
243
- ### Fixed
244
-
245
- - **Fixed stdio log pollution (issue #1)**: the unified logger previously sent only ERROR to
246
- `console.error` while INFO/WARN/DEBUG went to `console.log`, sharing stdout with MCP JSON-RPC
247
- messages and breaking handshakes or tool calls in strict stdio clients. All levels passing the
248
- threshold now go to stderr, leaving stdout for valid MCP messages only.
249
- - Log file appending, timestamps, level tags and the `<data dir>/logs/server.log` path are unchanged;
250
- a startup failure is still reported on stderr.
251
-
252
- ### Added
253
-
254
- - New `scripts/check-stdio.mjs` strict stdio smoke: a real child process validates the complete
255
- stdout/stderr byte stream, allowing only newline-delimited, schema-valid MCP JSON-RPC messages on
256
- stdout; empty lines, non-JSON lines, parser errors, or trailing fragments at exit fail the run.
257
- It covers six scenarios: first start, second start with matching skills, `--no-skill-install`,
258
- a corrupt `config.json`, logs during a stub task, and clean EOF shutdown.
259
- - New `npm run check:stdio` and `npm run check:stdio:src` scripts.
260
-
261
- ### Tests
262
-
263
- - New `test/unit/log.test.ts`: real-child-process checks for the four log levels' channels, default
264
- INFO filtering, threshold-filtered file logging, and UTF-8 content (4/6 failed before the fix; see
265
- `docs/m2-evidence/issue1-old-impl-log-test-failure.txt`).
266
- - CI's three-platform matrix now includes Node 24; the build step runs the strict stdio check instead
267
- of an EOF-exit-only smoke.
268
- - CI `pack-check` and Release install the freshly built tarball into a clean consumer directory, read
269
- the installed bin dynamically, and reuse the same strict stdio check; Release adds `lint` and the
270
- installed-package protocol gate, failing before a draft is created.
271
- - ESLint enables `no-console` (allowing `error` only) for `src/**/*.ts` to prevent new direct stdout writes.
272
-
273
- ---
274
-
275
- ## [0.1.9] — 2026-09-09
276
-
277
- ### Fixed
278
-
279
- - Fixed premature TraeWork completion while the model was still thinking but the DOM stayed unchanged for about 36 seconds.
280
- The stop button and loading task tail are now authoritative running signals and override completion marks; stable rounds now
281
- start an idle timer, which defaults to ten minutes before returning `idle`.
282
- - Fixed permanently pending `Runtime.evaluate` calls after a CDP WebSocket disconnect. Close/error rejects all pending requests,
283
- each CDP command has a 15-second default timeout, and task cancellation is observed within about one second.
284
- - Only `completion_mark` / `ask_user` release an instance launched by this module. Idle, timeout, cancellation, and CDP loss retain
285
- it, with `agentEndReason` / `keptInstance` exposed in task metadata.
286
- - Fixed a shutdown race where an orchestrator still collecting its baseline could remain `queued` and be mislabeled as a user
287
- cancellation. User cancellation is now determined only from structured cancellation intent.
288
-
289
- ### Added
290
-
291
- - Polling emits a progress event visible through `query_task` every 30 seconds by default.
292
- - Added `gui.idleTimeoutMs`, `gui.cdpSendTimeoutMs`, `gui.progressIntervalMs`, and five overrideable liveness selectors.
293
-
294
- ### Testing
295
-
296
- - Added liveness truth-table, CDP timeout/disconnect convergence, selector-expression, and fake-CDP instance-retention regressions.
297
- - Windows/macOS/Linux × Node 20/22 and tarball gates remain covered.
298
-
299
- ---
300
-
301
- ## [0.1.8] — 2026-09-08
302
-
303
- ### Fixed
304
-
305
- - **Atomic-write concurrency defect** (the real cause of intermittent CI failures): the temp filename in
306
- `writeJsonAtomic`/`writeTextAtomic` was `<target>.<pid>.tmp`, so concurrent writes to the same target in one
307
- process shared one temp file - the first to finish renames it away and the next throws `ENOENT`; on Windows a
308
- concurrent rename can also throw `EPERM`. Symptom: `rework_task` intermittently returned an `undefined` meta
309
- (hit on CI windows/Node 20). Fixed by a random temp suffix plus backoff-retry on transient rename errors.
310
-
311
- ### Testing
312
-
313
- - New `test/unit/atomic-write.test.ts` (3 cases: concurrent JSON/text writes all succeed, no leftover temp files).
314
-
315
- ---
316
-
317
- ## [0.1.7] — 2026-09-08
318
-
319
- ### Fixed
320
-
321
- - **Project-folder binding still failed** (v0.1.6 did not fully resolve it; field report: the native dialog
322
- appeared but the edit box was empty and confirm was clicked anyway):
323
- - **Root cause**: the MCP passes a `normPath()`-normalized path (lowercase drive + forward slashes, e.g.
324
- `d:/Trae项目/AI游戏/象棋`), which the **native Windows picker rejects** — measured: read-back matched, yet the dialog
325
- stayed open after confirm. Fix: convert via the new `toNativeWindowsPath()` to `D:\a\b`.
326
- - `WM_GETTEXT` **read-back verification** after writing; on mismatch re-locate and retry (up to 3 times);
327
- if it still mismatches, **never click confirm** and fail loudly.
328
- - The hwnd detected after the footer click is **passed into the write script**; after clicking, success
329
- requires that hwnd to be gone.
330
- - **Auto-close stale dialogs** (left over from a previous failure) before binding.
331
- - Confirm button now also requires its rect to be in the lower half of the dialog.
332
- - The dialog script's full trace (HWND/READBACK) is written to the task log.
333
-
334
- ### Testing
335
-
336
- - Total tests **172 → 181** (unit incl. path normalization and atomic-write concurrency; integration incl. stale-dialog cleanup).
337
- - Machine-verified: a new Chinese project `D:\Trae项目\AI游戏\象棋` (absent from the dropdown)
338
- passed end-to-end through the native dialog; `五子棋` and the ASCII project `ts-bind-test` regressed green.
339
-
340
- ---
341
-
342
- ## [0.1.6] — 2026-09-08
343
-
344
- ### Fixed
345
-
346
- - **Project-folder binding got stuck / reported "waiting for native dialog timed out"** (field report; the adapter was not broken):
347
- - `clickDropdownFooter` used to trust `element.click()`'s return value, but the native popup may never
348
- appear → it now **confirms the dialog actually appeared**, otherwise it logs a dropdown DOM snapshot and fails loudly.
349
- - Dialog detection polled from Node every 800 ms while PowerShell cold start is ~4.5–6 s, so a 15 s budget
350
- allowed only ~2 probes → now it polls **inside a single PowerShell call** (400 ms interval) with a 30 s budget.
351
- - **CJK paths were corrupted** (measured: `D:\Trae项目\ts-bind-test` became `D:Traes-bind-test`):
352
- SendKeys/clipboard are mangled by the console code page → the path is now written via Win32
353
- **`WM_SETTEXT`**, which is fully reliable for CJK.
354
- - **The confirm click hit a file-list row**: `AutomationId="1"` is not unique (rows also use 0/1/2…) →
355
- now located by **AutomationId=1 AND ControlType=Pane**, then clicked by bounding rect.
356
- - PowerShell output was garbled for Chinese → the script now emits **ASCII-only** and Node maps it back
357
- via `localizeDialogMessage()`.
358
-
359
- ### Added
360
-
361
- - **Non-Work binding fallback**: when binding fails in Code/Design, the driver **falls back to Work once**,
362
- switches back to the target mode, and re-verifies the project is still bound; only if both attempts fail
363
- does it report an error including the reason from each mode.
364
- - Machine-verified: for a project **absent from the dropdown** (`D:\Trae项目\ts-bind-test`),
365
- `run_task(agentId=traework, mode=Code)` passed end-to-end — native dialog wrote the path → confirm clicked →
366
- project entered TraeWork's list (`solo-lite.local-project-folders` 22→23) → task sent → auto-verification `succeeded`.
367
-
368
- ### Changed
369
-
370
- - `docs/traework-cdp.md` / `.en.md`: 7 new pitfall entries; added the "dropdown entries ≠ project map" fact and the fallback note.
371
-
372
- ### Testing
373
-
374
- - Total tests **167 → 172** (new dialog message-mapping/platform-branch unit tests + Code→Work fallback integration test).
375
-
376
- ---
377
-
378
- ## [0.1.5] — 2026-09-08
379
-
380
- ### Added
381
-
382
- - **TraeWork panel mode switching**: `run_task` gained a `mode` parameter supporting `Work` / `Code` / `Design`.
383
- - Resolution order: explicit `mode` parameter > task-text detection > keep `Work`.
384
- - Text detection handles mixed Chinese/English phrasing ("switch to Code mode", "use design mode", "工作模式", "代码模式", "设计模式", …).
385
- - New `gui.modeSwitch` profile switch (default `true`).
386
- - New pure functions `detectModeFromText` / `resolveMode` (unit-tested).
387
- - **Dedicated SVG assets**: `assets/tianshu-mcp-icon.svg` (app icon), `assets/tianshu-mcp-banner.svg` (wide banner).
388
- - New `scripts/probe-traework.mjs mode <Work|Code|Design>` subcommand (real-machine diagnostics/verification).
389
- - New bilingual release notes `docs/release-v0.1.5.md` / `.en.md`.
390
-
391
- ### Changed
392
-
393
- - **TraeWork execution order**: measurement showed the three modes **each keep an independent project binding** —
394
- switching modes replaces the input bar's project with whatever that mode last used.
395
- Order is now: ensure instance → wait for UI → new session → switch to target mode → bind project inside that mode → switch model → send.
396
- - After binding, both mode and project are re-verified; any mismatch **fails loudly** (never silently develops in the wrong mode).
397
- - meta block now exposes `model` / `mode` for Tianshu to read back.
398
- - `package.json`: `license` changed from `MIT` to `Apache-2.0` (matching the repository `LICENSE` file);
399
- added `repository` / `homepage` / `bugs`; `files` now includes `assets`.
400
- - README.md / README.en.md fully rewritten: stack badges, SVG banner (above the icon), language isolation
401
- (the Chinese README references Chinese docs only; the English README references English docs only).
402
-
403
- ### Fixed
404
-
405
- - **Rework feedback race** (pre-existing; intermittent under load): the terminal snapshot is written first, so a caller's
406
- immediate `rework_task(feedback)` could be erased by the previous run's `delete meta.reworkFeedback`, leaving the rework
407
- round without feedback. Now the feedback is consumed and cleared atomically when `startTask` begins.
408
- Added regression test `test/integration/rework-feedback-race.test.ts`.
409
- - **`projectBasename` cross-platform**: it used `path.basename` (which does not split backslashes on POSIX), failing
410
- Linux/macOS CI; now it splits explicitly on both `\` and `/`.
411
-
412
- ### Testing
413
-
414
- - Total tests **153 → 167** (14 new mode-related cases).
415
- - Real-machine end-to-end: `mode=Work` / `mode=Code` / `mode=Design` all completed
416
- "switch mode → bind project → send → create file → auto-verification passed".
417
-
418
- ---
419
-
420
- ## [0.1.4] — 2026-09-08
421
-
422
- ### Added
423
-
424
- - TraeWork GUI driver over CDP: `traework` moved from `unsupported` to `driver=gui` / `status=ready`.
425
- - Capabilities: launch/reuse instance → new session → bind project folder (dropdown first, restricted computer-use
426
- native dialog as fallback) → optional model selection → read-back-verified send → poll to completion →
427
- auto-verify → repair-plan file + same-session rework on failure.
428
- - Safety: reuse the user's instance by default, never kill a process tree, verify the command line before terminating;
429
- computer-use is limited to TraeWork's folder picker.
430
- - `AgentAdapter` gained an optional `run()` execution surface; the orchestrator branches on `adapter.run`
431
- (CLI agents still use spawn).
432
- - Profile gained `driver` (`spawn` / `gui`) and a `gui` section; `run_task` gained a `model` parameter.
433
- - New `src/agents/traework/**` (CDP client, selector table, launcher, session/input/model/reply modules, restricted computer-use).
434
- - On verification failure a repair-plan file `rework-<taskId>-r<N>.md` is generated (task dir + project `.tianshu-mcp`)
435
- and its filename is referenced in the rework message.
436
-
437
- ### Changed
438
-
439
- - `docs/adapter-matrix.md` T1 conclusion corrected from `unsupported` to "integrated (driver=gui)".
440
- - formatter now passes cancel-source fields (`abortSource`, …) through to `query_task`'s meta block.
441
-
442
- ### Fixed
443
-
444
- - Unified timeout terminal state: normal timeouts now also land `failed(timeout)` plus exactly one `timeout_killed` event, in fixed order.
445
- - Stabilized the `shutdown` test polling.
446
-
447
- ### Testing
448
-
449
- - Total tests **72 → 153** (new TraeWork unit/integration cases).
450
- - Real-machine end-to-end: `run_task(agentId=traework, model=GLM-5.3, autoVerify=true)` drove TraeWork to create a file and passed acceptance.
451
-
452
- ---
453
-
454
- ## [0.1.3] — 2026-09-08
455
-
456
- ### Fixed
457
-
458
- - **S1** No-reason cancel was mis-recorded as `interrupted`: added independent `cancelRequestedAt` / `abortSource` fields;
459
- cancel intent no longer depends on the optional `reason` (5 regression tests).
460
- - **S2** Unified timeout terminal state (shared with 0.1.4).
461
- - **S3** Tracked pre-dirty net-diff attribution: pre-existing dirty files are excluded by content hash when unchanged;
462
- unchanged staged/unstaged files are no longer reported as agent changes (4 regressions).
463
- - **S4** `verify_task(taskId)` persists real-task metadata (`reportRound` / `verificationSource` /
464
- `latestVerificationVerdict`, keeping `agentId`); single-source MCP version (`sync-version` injection).
465
- - **S5** `projects.json` official Zod schema + last-known-good for `config`/`profiles`/`projects` + content-sha256
466
- hot-reload invalidation (fixed corrupt JSON being treated as missing and reset).
467
-
468
- ### Changed
469
-
470
- - **S6** CI/Release `npm ci` retry corrected (stop on success / 3 attempts / attempt counter);
471
- Vitest v3 upgrade (0 audit vulnerabilities); plain-text status markers (emoji scan test).
472
-
473
- ### Testing
474
-
475
- - Total tests **53 → 72**.
476
-
477
- ---
478
-
479
- ## [0.1.2] — 2026-09-08
480
-
481
- ### Changed
482
-
483
- - Build no longer ships source maps (no `.map`, tarball ≈ 69.9 KB).
484
-
485
- ### Testing
486
-
487
- - Total tests **53**.
488
-
489
- ---
490
-
491
- ## [0.1.1] — 2026-09-07
492
-
493
- ### Added
494
-
495
- - **Release after the R1–R5 fixes**:
496
- - **R1** Cancel/interrupt state persistence (`cancel_requested → cancelled`, `cancelReason`/`finishedAt`/`errorType`
497
- persisted, restart-recoverable, idempotent, bounded shutdown).
498
- - **R2** Call-level `taskTimeoutMs` precedence fix + cross-platform process-tree termination
499
- (POSIX process-group SIGTERM→SIGKILL, Windows `taskkill /T /F`).
500
- - **R3** Git baseline participates in diff (boundary at `baseline.head`; agent commits do not lose changes;
501
- dirty-worktree hash attribution).
502
- - **R4** Verification tool parameters and report-round semantics (`round=0` valid, manual verify does not overwrite
503
- reports, `extraChecks` append + `checksMode=replace`, `optional` does not affect verdict, `baselineRef` validated).
504
- - **R5** Removed hardcoded agent paths (`{LOCALAPPDATA}` placeholders + platform-standard candidates);
505
- mtime hot reload for `config`/`profile`/`projects`.
506
- - **R6** Cross-platform CI matrix (Windows/macOS/Linux × Node 20/22) and Release version consistency
507
- (tag/input = `package.json` = tarball), plus tarball content checks.
508
- - **R7** npm published `tianshu-mcp@0.1.1` + `npx -y` raise with 8 tools connected.
509
- - **R8** Bilingual docs synced (including 4 English topic docs).
510
-
511
- ---
512
-
513
- ## [0.1.0] — 2026-09-07
514
-
515
- ### Added
516
-
517
- - First usable release: **M1 core engine + stub-agent end-to-end**.
518
- - 8 MCP tools: `run_task` / `query_task` / `list_tasks` / `get_task_report` / `cancel_task` / `verify_task` /
519
- `rework_task` / `get_profiles`.
520
- - `TaskManager` state machine / per-project serial queue / global concurrency gate / cancel (kill tree) / event-stream persistence.
521
- - Acceptance engine: git baseline & diff, default check-set derivation, command runner, code analysis,
522
- `report.md` / `report.json`.
523
- - fix-loop auto rework + `needs_attention`; skill self-install.
524
- - Stub-agent 3 playbooks (good / fix-on-first / never) integration tests + protocol tests — **53/53 green**.
525
-
526
- ---
527
-
528
- [Unreleased]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.3.3...HEAD
122
+
123
+ Fixes for issues #5 / #6: **the MCP task model was disconnected from the state of the turn inside
124
+ the Codex GUI**. The former is the completion-detection deadlock that kept reporting `running`
125
+ while Codex waited for user confirmation; the latter is `cancel_task` only aborting the MCP-side
126
+ wait loop, never stopping the in-GUI run, with a misleading description. Both share the same root
127
+ cause and are resolved together.
128
+
129
+ ### Fixed
130
+
131
+ - **Waiting-for-user detection (issue #5)**:
132
+ - `judgeCodexPoll` gains a stall fallback: while the stop button stays visible and the
133
+ conversation hash is unchanged for `gui.stallTimeoutMs` (default 5 minutes), the task
134
+ transitions to `needs_user` (`needsUserKind=user_confirmation`) instead of deadlocking in
135
+ `running` until the overall timeout; the stall timer resets as soon as content changes again.
136
+ - New configurable UI detection `gui.selectors.userGate` (e.g. the embedded-checkout page or
137
+ approval cards): when configured and matched, transitions to `needs_user` immediately.
138
+ Unset by default (disabled) — no unverified selectors are built in.
139
+ - Tightened the `stopButton` selector: removed the `aria-label*="取消"` over-match (the Cancel
140
+ button on waiting-for-user screens used to be mistaken for a running signal).
141
+ - **Recovery path (issue #5 fallout)**: `continue_task` now supports codex —
142
+ - `user_confirmation`: after the user completes the action in the Codex window, resume by
143
+ re-attaching as an observer of the in-GUI run (no message is sent); if the turn already
144
+ finished before resuming, the task is still judged `succeeded` correctly;
145
+ - `login_required`: after login, re-checks the environment and re-dispatches the task brief
146
+ (fresh session + project binding + full initial prompt);
147
+ - zcode recovery behaviour is unchanged; other agents are rejected explicitly.
148
+ - **Cancel actually stops the GUI (issue #6)**:
149
+ - `cancel_task` no longer succeeds on request alone for GUI agents: it first best-effort clicks
150
+ the in-app stop button over CDP, then waits (bounded by `gui.cancelWaitMs`, default 15s) for
151
+ the GUI to become idle before settling `cancelled`; if the stop could not be confirmed the
152
+ terminal message states "GUI 内运行未确认停止…" (the in-GUI run may still be going);
153
+ - process-tree termination for CLI agents is unchanged;
154
+ - cancelling from `needs_user` now notes that a pending session may remain in the GUI
155
+ (no CDP connection exists at that point — documented limitation).
156
+ - **Re-dispatch anti-overlap guard (issue #6 chain risk)**: when dispatching, if the managed
157
+ instance still has an unstopped run, MCP first tries to stop it; if it cannot, the dispatch
158
+ fails hard with `instance_busy`, preventing old and new turns from overlapping inside the same
159
+ app (observed in the wild when re-dispatching right after a cancel).
160
+ - The startup log no longer hardcodes the tool count as `8`; it reports the actual registry size
161
+ (`TOOL_DEFS.length`, currently 9).
162
+
163
+ ### Changed
164
+
165
+ - Tool descriptions match actual semantics: `cancel_task` distinguishes CLI (kill process tree)
166
+ from GUI (best-effort stop click + bounded wait); `continue_task` no longer claims to be
167
+ ZCode-only.
168
+ - `GuiProfile` gains two configurable options, `stallTimeoutMs` (default 300000) and
169
+ `cancelWaitMs` (default 15000), both overridable via agent-profiles.json.
170
+ - Skill docs (SKILL.md §4/§5, usage-examples.md §7) document the codex `user_confirmation` /
171
+ `login_required` recovery flows, GUI cancel semantics and the new options.
172
+
173
+ ---
174
+
175
+ ## [0.3.1] — 2026-09-12
176
+
177
+ Post-v0.3.0 housekeeping for docs and release automation: **no source-level behavior changes**.
178
+ The focus is a full rewrite of the self-installed skill docs plus GitHub/Gitee release-body
179
+ composition and link fixes.
180
+
181
+ ### Changed
182
+
183
+ - **Skill docs (`skills/tianshu-mcp/`) fully rewritten to match the actual v0.3.0 tool surface**:
184
+ - Corrected the `codex` description from "headless CLI" to the ChatGPT desktop GUI adapter
185
+ (MSIX + COM activation + CDP); documents the required `model`, optional `reasoningLevel` /
186
+ `planDoc` / `designSystem`, and that `mode` is not supported;
187
+ - Documented the `run_task` `context` parameter and the send-time validation of path references
188
+ inside task/context; corrected the `autoFixRounds` default precedence
189
+ (call argument > codex 5 / zcode 2 > server default 0);
190
+ - Added usage for `list_tasks`, `query_task(tailLines)`, `get_task_report(round)` and
191
+ `verify_task` (`extraChecks` / `checksMode` / `baselineRef`) plus the four-level acceptance
192
+ command precedence;
193
+ - Documented the four `needs_user` kinds and meta fields such as `needsUserKind` /
194
+ `pendingQuestion` / `errorType` / `reportRound` / `verificationSource`;
195
+ - Added `continue_task` to the approval list; replaced emoji status markers with plain text
196
+ (PASS / warning) in the usage examples.
197
+ - **Release automation fixes (exposed by the v0.3.0 tag)**:
198
+ - The release body is now composed bilingually from `docs/release-v<version>.md` and `.en.md`,
199
+ with in-document relative links rewritten to tag-absolute links; a missing doc fails the
200
+ workflow loudly instead of producing a shell-only body;
201
+ - `Full Changelog` resolves the previous tag via `git describe` into a `compare/<prev>...<tag>`
202
+ link instead of degrading to a commits link;
203
+ - The body's `CI` link resolves the CI run for the same SHA instead of pointing at the Release run;
204
+ - Gitee releases are automated in `release.yml`: `scripts/gitee-release.mjs` idempotently
205
+ creates/updates the mirrored release (requires the `GITEE_TOKEN` secret; skipped loudly when unset).
206
+ - `.gitignore` now ignores npm pack artifacts and local temporary verification directories.
207
+ - Added the missing `[0.1.10]` / `[0.2.0]` / `[0.3.0]` / `[0.3.1]` compare links at the bottom of
208
+ this file and its Chinese counterpart.
209
+
210
+ ---
211
+
212
+ ## [0.3.0] — 2026-09-12
213
+
214
+ The Codex desktop app now runs through a **GUI driver**: a new `codex-gui` adapter uses MSIX COM activation
215
+ plus CDP to drive the ChatGPT desktop app through the full loop (locate install → launch GUI → bind/create
216
+ project → pick model and reasoning level → send instructions → run detection → verify → auto-repair).
217
+
218
+ ### BREAKING CHANGES
219
+
220
+ - **`agentId=codex` now executes via the desktop GUI instead of the headless CLI**: a new `driver=gui` +
221
+ `adapter=codex-gui` + `activation=msix-com`, with the previous **`codex exec` headless path removed**.
222
+ After upgrading, `run_task(agentId="codex")` launches and drives the Codex desktop window rather than a
223
+ headless child process. To keep headless execution, add a separate `driver=spawn` profile
224
+ (`argsTemplate: ["exec", "<prompt:arg>", "--skip-git-repo-check", "--sandbox", "workspace-write"]`) as
225
+ documented in `docs/agent-profiles.en.md`.
226
+ - This path requires the Codex desktop app (MSIX store package) to be installed; CLI-only environments are
227
+ no longer directly supported.
228
+
229
+ ### Added
230
+
231
+ - `codex-gui` adapter (`src/agents/codex/**`): Appx-first install discovery (scan fallback taking the newest
232
+ version), MSIX COM activation with a dedicated `user-data-dir` and dynamic debug port, plus CDP attach and
233
+ target convergence (excluding the overlay secondary window).
234
+ - Task parameters: `reasoningLevel` (low/medium/high, bilingual), `planDoc`, `designSystem`.
235
+ - Model and reasoning level: models are `menuitemradio` candidates while **reasoning strength is a slider**
236
+ (0–4: 轻度/中/高/极高/极高), set precisely with arrow keys and read back for verification; level
237
+ comparison is exact to avoid matching "高" against "极高".
238
+ - **Automatic project registration**: a target directory not yet registered on the Codex side is written
239
+ directly into Codex project state (idempotent, backup-before-write, atomic write, only while the
240
+ MCP-managed instance is stopped), so it takes the stable bound-project path instead of the brittle native
241
+ folder dialog; on failure it falls back to UI creation.
242
+ - Verification and repair: reuses the existing AcceptanceEngine (defaults derived from `package.json`, with
243
+ weak-verification labelling); on failure the MCP generates an in-project
244
+ `.zcode/plans/codex-fix-r<N>.md` (one per round, never overwritten) and cites it in the repair instruction,
245
+ up to 5 rounds by default (`defaultAutoFixRounds`).
246
+ - Run detection: the stop button is the authoritative running signal, and text stability counts as completion
247
+ evidence only after it; without a running signal it fails open to `idle_timeout` while keeping the instance
248
+ (never a false completion).
249
+ - `scripts/probe-codex.mjs` hardware diagnostic script; 67 Codex unit tests plus integration coverage of the
250
+ verify-fail → generated plan → repair-pass loop.
251
+ - Docs: `docs/codex-gui-cdp.en.md`, `docs/codex-windows-smoke.en.md` (including the round-2 real business task
252
+ acceptance) and their Chinese counterparts.
253
+
254
+ ### Changed
255
+
256
+ - `GuiProfile` gains `activation` / `userDataDir` / `appxPackageName` / `permissionMode` / `fixPlanDir`;
257
+ existing `spawn` profiles are unaffected.
258
+ - `ExecutableDiscovery` gains `appxPackageName` / `installRelativeExe` / `scanRoots` / `scanPattern`.
259
+
260
+ ### Fixed (exposed by hardware testing)
261
+
262
+ - The model trigger mis-matched the sibling permission chip (4 chips share `aria-haspopup`; only the model chip
263
+ lacks `aria-label`).
264
+ - Reasoning strength was clicked like a menu item and could never be set (it is actually a slider).
265
+ - Menus/popovers only open on **trusted** mouse events (DOM `.click()` is ignored).
266
+ - A transient empty model read during toolbar re-render after binding was treated as a "model mismatch".
267
+ - Model/reasoning trigger selectors now exclude the top menu bar and the mode switcher.
268
+ - Cold-start readiness budget widened to 150s (registration stops the instance first; cold start measured ~85s).
269
+ - CI: fixed a `normalizeDir` assertion that depended on the host platform, which failed on ubuntu/macos.
270
+ - Fixed integration tests polluting real Codex project state by not injecting `ensureRegistered`.
271
+
272
+ ### Verification
273
+
274
+ - Windows 10 x64 hardware: full loop for a registered project, and the verify-fail → generated plan →
275
+ repair-pass loop; an unregistered project completed the full loop after automatic registration.
276
+ - Real business task: drove Codex to build a "Fruit Ninja" mini-game in HTML+CSS+JS (`GPT-5.6 Sol` with
277
+ reasoning strength "高"); the artifacts passed acceptance and were verified playable in a headless browser
278
+ (score rises, lives decrement, Game Over and restart work, no JS exceptions).
279
+ - macOS unverified: the built-in Codex GUI status is `research` and is excluded from readiness.
280
+
281
+ ---
282
+
283
+ ## [0.2.0] — 2026-09-11
284
+
285
+ ### Added
286
+
287
+ - Dedicated `zcode-gui` Electron CDP adapter with data-driven Windows/macOS discovery, dynamic ports, product/process checks, and a global serial lock.
288
+ - Exact ZCode project binding, guarded native folder pickers, `provider/model`, Full Access read-back, and idempotent sending.
289
+ - Paused `needs_user` state and approval-gated `continue_task` for original-session answers and environment rechecks after instance, login, or permission handling.
290
+ - Multi-signal liveness, progress events, UI preservation, default auto-verification, and two same-session repair rounds. Repair plans stay in MCP task storage.
291
+ - `scripts/probe-zcode.mjs`, fake-CDP/state/path/model tests, and bilingual documentation.
292
+
293
+ ### Safety and compatibility
294
+
295
+ - GUI profiles support an explicit `adapter`; legacy `driver="gui"` profiles retain TraeWork behavior.
296
+ - The built-in ZCode profile remains `research` until both real platform loops pass.
297
+ - No private `app-server`, credential access, automatic user-instance termination, or fixed screen coordinates.
298
+
299
+ ### Fixed and verified
300
+
301
+ - Fixed ZCode read-back for dynamic model labels, transient renderer load/reload, delayed new-session registration, and stale session-ID contamination.
302
+ - `AskUserQuestion` continuation now selects and submits an exact accessible option in the original session; zero or ambiguous matches fail closed.
303
+ - Windows 10 x64 passed three hardware loops: real file development, same-session repair after a controlled failure, and `continue_task` after a model question. macOS hardware evidence remains pending.
304
+
305
+ ---
306
+
307
+ ## [0.1.10] — 2026-09-10
308
+
309
+ ### Fixed
310
+
311
+ - **Fixed stdio log pollution (issue #1)**: the unified logger previously sent only ERROR to
312
+ `console.error` while INFO/WARN/DEBUG went to `console.log`, sharing stdout with MCP JSON-RPC
313
+ messages and breaking handshakes or tool calls in strict stdio clients. All levels passing the
314
+ threshold now go to stderr, leaving stdout for valid MCP messages only.
315
+ - Log file appending, timestamps, level tags and the `<data dir>/logs/server.log` path are unchanged;
316
+ a startup failure is still reported on stderr.
317
+
318
+ ### Added
319
+
320
+ - New `scripts/check-stdio.mjs` strict stdio smoke: a real child process validates the complete
321
+ stdout/stderr byte stream, allowing only newline-delimited, schema-valid MCP JSON-RPC messages on
322
+ stdout; empty lines, non-JSON lines, parser errors, or trailing fragments at exit fail the run.
323
+ It covers six scenarios: first start, second start with matching skills, `--no-skill-install`,
324
+ a corrupt `config.json`, logs during a stub task, and clean EOF shutdown.
325
+ - New `npm run check:stdio` and `npm run check:stdio:src` scripts.
326
+
327
+ ### Tests
328
+
329
+ - New `test/unit/log.test.ts`: real-child-process checks for the four log levels' channels, default
330
+ INFO filtering, threshold-filtered file logging, and UTF-8 content (4/6 failed before the fix; see
331
+ `docs/m2-evidence/issue1-old-impl-log-test-failure.txt`).
332
+ - CI's three-platform matrix now includes Node 24; the build step runs the strict stdio check instead
333
+ of an EOF-exit-only smoke.
334
+ - CI `pack-check` and Release install the freshly built tarball into a clean consumer directory, read
335
+ the installed bin dynamically, and reuse the same strict stdio check; Release adds `lint` and the
336
+ installed-package protocol gate, failing before a draft is created.
337
+ - ESLint enables `no-console` (allowing `error` only) for `src/**/*.ts` to prevent new direct stdout writes.
338
+
339
+ ---
340
+
341
+ ## [0.1.9] — 2026-09-09
342
+
343
+ ### Fixed
344
+
345
+ - Fixed premature TraeWork completion while the model was still thinking but the DOM stayed unchanged for about 36 seconds.
346
+ The stop button and loading task tail are now authoritative running signals and override completion marks; stable rounds now
347
+ start an idle timer, which defaults to ten minutes before returning `idle`.
348
+ - Fixed permanently pending `Runtime.evaluate` calls after a CDP WebSocket disconnect. Close/error rejects all pending requests,
349
+ each CDP command has a 15-second default timeout, and task cancellation is observed within about one second.
350
+ - Only `completion_mark` / `ask_user` release an instance launched by this module. Idle, timeout, cancellation, and CDP loss retain
351
+ it, with `agentEndReason` / `keptInstance` exposed in task metadata.
352
+ - Fixed a shutdown race where an orchestrator still collecting its baseline could remain `queued` and be mislabeled as a user
353
+ cancellation. User cancellation is now determined only from structured cancellation intent.
354
+
355
+ ### Added
356
+
357
+ - Polling emits a progress event visible through `query_task` every 30 seconds by default.
358
+ - Added `gui.idleTimeoutMs`, `gui.cdpSendTimeoutMs`, `gui.progressIntervalMs`, and five overrideable liveness selectors.
359
+
360
+ ### Testing
361
+
362
+ - Added liveness truth-table, CDP timeout/disconnect convergence, selector-expression, and fake-CDP instance-retention regressions.
363
+ - Windows/macOS/Linux × Node 20/22 and tarball gates remain covered.
364
+
365
+ ---
366
+
367
+ ## [0.1.8] — 2026-09-08
368
+
369
+ ### Fixed
370
+
371
+ - **Atomic-write concurrency defect** (the real cause of intermittent CI failures): the temp filename in
372
+ `writeJsonAtomic`/`writeTextAtomic` was `<target>.<pid>.tmp`, so concurrent writes to the same target in one
373
+ process shared one temp file - the first to finish renames it away and the next throws `ENOENT`; on Windows a
374
+ concurrent rename can also throw `EPERM`. Symptom: `rework_task` intermittently returned an `undefined` meta
375
+ (hit on CI windows/Node 20). Fixed by a random temp suffix plus backoff-retry on transient rename errors.
376
+
377
+ ### Testing
378
+
379
+ - New `test/unit/atomic-write.test.ts` (3 cases: concurrent JSON/text writes all succeed, no leftover temp files).
380
+
381
+ ---
382
+
383
+ ## [0.1.7] — 2026-09-08
384
+
385
+ ### Fixed
386
+
387
+ - **Project-folder binding still failed** (v0.1.6 did not fully resolve it; field report: the native dialog
388
+ appeared but the edit box was empty and confirm was clicked anyway):
389
+ - **Root cause**: the MCP passes a `normPath()`-normalized path (lowercase drive + forward slashes, e.g.
390
+ `d:/Trae项目/AI游戏/象棋`), which the **native Windows picker rejects** — measured: read-back matched, yet the dialog
391
+ stayed open after confirm. Fix: convert via the new `toNativeWindowsPath()` to `D:\a\b`.
392
+ - `WM_GETTEXT` **read-back verification** after writing; on mismatch re-locate and retry (up to 3 times);
393
+ if it still mismatches, **never click confirm** and fail loudly.
394
+ - The hwnd detected after the footer click is **passed into the write script**; after clicking, success
395
+ requires that hwnd to be gone.
396
+ - **Auto-close stale dialogs** (left over from a previous failure) before binding.
397
+ - Confirm button now also requires its rect to be in the lower half of the dialog.
398
+ - The dialog script's full trace (HWND/READBACK) is written to the task log.
399
+
400
+ ### Testing
401
+
402
+ - Total tests **172 → 181** (unit incl. path normalization and atomic-write concurrency; integration incl. stale-dialog cleanup).
403
+ - Machine-verified: a new Chinese project `D:\Trae项目\AI游戏\象棋` (absent from the dropdown)
404
+ passed end-to-end through the native dialog; `五子棋` and the ASCII project `ts-bind-test` regressed green.
405
+
406
+ ---
407
+
408
+ ## [0.1.6] — 2026-09-08
409
+
410
+ ### Fixed
411
+
412
+ - **Project-folder binding got stuck / reported "waiting for native dialog timed out"** (field report; the adapter was not broken):
413
+ - `clickDropdownFooter` used to trust `element.click()`'s return value, but the native popup may never
414
+ appear → it now **confirms the dialog actually appeared**, otherwise it logs a dropdown DOM snapshot and fails loudly.
415
+ - Dialog detection polled from Node every 800 ms while PowerShell cold start is ~4.5–6 s, so a 15 s budget
416
+ allowed only ~2 probes → now it polls **inside a single PowerShell call** (400 ms interval) with a 30 s budget.
417
+ - **CJK paths were corrupted** (measured: `D:\Trae项目\ts-bind-test` became `D:Traes-bind-test`):
418
+ SendKeys/clipboard are mangled by the console code page → the path is now written via Win32
419
+ **`WM_SETTEXT`**, which is fully reliable for CJK.
420
+ - **The confirm click hit a file-list row**: `AutomationId="1"` is not unique (rows also use 0/1/2…) →
421
+ now located by **AutomationId=1 AND ControlType=Pane**, then clicked by bounding rect.
422
+ - PowerShell output was garbled for Chinese → the script now emits **ASCII-only** and Node maps it back
423
+ via `localizeDialogMessage()`.
424
+
425
+ ### Added
426
+
427
+ - **Non-Work binding fallback**: when binding fails in Code/Design, the driver **falls back to Work once**,
428
+ switches back to the target mode, and re-verifies the project is still bound; only if both attempts fail
429
+ does it report an error including the reason from each mode.
430
+ - Machine-verified: for a project **absent from the dropdown** (`D:\Trae项目\ts-bind-test`),
431
+ `run_task(agentId=traework, mode=Code)` passed end-to-end — native dialog wrote the path → confirm clicked →
432
+ project entered TraeWork's list (`solo-lite.local-project-folders` 22→23) → task sent → auto-verification `succeeded`.
433
+
434
+ ### Changed
435
+
436
+ - `docs/traework-cdp.md` / `.en.md`: 7 new pitfall entries; added the "dropdown entries ≠ project map" fact and the fallback note.
437
+
438
+ ### Testing
439
+
440
+ - Total tests **167 → 172** (new dialog message-mapping/platform-branch unit tests + Code→Work fallback integration test).
441
+
442
+ ---
443
+
444
+ ## [0.1.5] — 2026-09-08
445
+
446
+ ### Added
447
+
448
+ - **TraeWork panel mode switching**: `run_task` gained a `mode` parameter supporting `Work` / `Code` / `Design`.
449
+ - Resolution order: explicit `mode` parameter > task-text detection > keep `Work`.
450
+ - Text detection handles mixed Chinese/English phrasing ("switch to Code mode", "use design mode", "工作模式", "代码模式", "设计模式", …).
451
+ - New `gui.modeSwitch` profile switch (default `true`).
452
+ - New pure functions `detectModeFromText` / `resolveMode` (unit-tested).
453
+ - **Dedicated SVG assets**: `assets/tianshu-mcp-icon.svg` (app icon), `assets/tianshu-mcp-banner.svg` (wide banner).
454
+ - New `scripts/probe-traework.mjs mode <Work|Code|Design>` subcommand (real-machine diagnostics/verification).
455
+ - New bilingual release notes `docs/release-v0.1.5.md` / `.en.md`.
456
+
457
+ ### Changed
458
+
459
+ - **TraeWork execution order**: measurement showed the three modes **each keep an independent project binding** —
460
+ switching modes replaces the input bar's project with whatever that mode last used.
461
+ Order is now: ensure instance → wait for UI → new session → switch to target mode → bind project inside that mode → switch model → send.
462
+ - After binding, both mode and project are re-verified; any mismatch **fails loudly** (never silently develops in the wrong mode).
463
+ - meta block now exposes `model` / `mode` for Tianshu to read back.
464
+ - `package.json`: `license` changed from `MIT` to `Apache-2.0` (matching the repository `LICENSE` file);
465
+ added `repository` / `homepage` / `bugs`; `files` now includes `assets`.
466
+ - README.md / README.en.md fully rewritten: stack badges, SVG banner (above the icon), language isolation
467
+ (the Chinese README references Chinese docs only; the English README references English docs only).
468
+
469
+ ### Fixed
470
+
471
+ - **Rework feedback race** (pre-existing; intermittent under load): the terminal snapshot is written first, so a caller's
472
+ immediate `rework_task(feedback)` could be erased by the previous run's `delete meta.reworkFeedback`, leaving the rework
473
+ round without feedback. Now the feedback is consumed and cleared atomically when `startTask` begins.
474
+ Added regression test `test/integration/rework-feedback-race.test.ts`.
475
+ - **`projectBasename` cross-platform**: it used `path.basename` (which does not split backslashes on POSIX), failing
476
+ Linux/macOS CI; now it splits explicitly on both `\` and `/`.
477
+
478
+ ### Testing
479
+
480
+ - Total tests **153 → 167** (14 new mode-related cases).
481
+ - Real-machine end-to-end: `mode=Work` / `mode=Code` / `mode=Design` all completed
482
+ "switch mode → bind project → send → create file → auto-verification passed".
483
+
484
+ ---
485
+
486
+ ## [0.1.4] — 2026-09-08
487
+
488
+ ### Added
489
+
490
+ - TraeWork GUI driver over CDP: `traework` moved from `unsupported` to `driver=gui` / `status=ready`.
491
+ - Capabilities: launch/reuse instance → new session → bind project folder (dropdown first, restricted computer-use
492
+ native dialog as fallback) → optional model selection → read-back-verified send → poll to completion →
493
+ auto-verify → repair-plan file + same-session rework on failure.
494
+ - Safety: reuse the user's instance by default, never kill a process tree, verify the command line before terminating;
495
+ computer-use is limited to TraeWork's folder picker.
496
+ - `AgentAdapter` gained an optional `run()` execution surface; the orchestrator branches on `adapter.run`
497
+ (CLI agents still use spawn).
498
+ - Profile gained `driver` (`spawn` / `gui`) and a `gui` section; `run_task` gained a `model` parameter.
499
+ - New `src/agents/traework/**` (CDP client, selector table, launcher, session/input/model/reply modules, restricted computer-use).
500
+ - On verification failure a repair-plan file `rework-<taskId>-r<N>.md` is generated (task dir + project `.tianshu-mcp`)
501
+ and its filename is referenced in the rework message.
502
+
503
+ ### Changed
504
+
505
+ - `docs/adapter-matrix.md` T1 conclusion corrected from `unsupported` to "integrated (driver=gui)".
506
+ - formatter now passes cancel-source fields (`abortSource`, …) through to `query_task`'s meta block.
507
+
508
+ ### Fixed
509
+
510
+ - Unified timeout terminal state: normal timeouts now also land `failed(timeout)` plus exactly one `timeout_killed` event, in fixed order.
511
+ - Stabilized the `shutdown` test polling.
512
+
513
+ ### Testing
514
+
515
+ - Total tests **72 → 153** (new TraeWork unit/integration cases).
516
+ - Real-machine end-to-end: `run_task(agentId=traework, model=GLM-5.3, autoVerify=true)` drove TraeWork to create a file and passed acceptance.
517
+
518
+ ---
519
+
520
+ ## [0.1.3] — 2026-09-08
521
+
522
+ ### Fixed
523
+
524
+ - **S1** No-reason cancel was mis-recorded as `interrupted`: added independent `cancelRequestedAt` / `abortSource` fields;
525
+ cancel intent no longer depends on the optional `reason` (5 regression tests).
526
+ - **S2** Unified timeout terminal state (shared with 0.1.4).
527
+ - **S3** Tracked pre-dirty net-diff attribution: pre-existing dirty files are excluded by content hash when unchanged;
528
+ unchanged staged/unstaged files are no longer reported as agent changes (4 regressions).
529
+ - **S4** `verify_task(taskId)` persists real-task metadata (`reportRound` / `verificationSource` /
530
+ `latestVerificationVerdict`, keeping `agentId`); single-source MCP version (`sync-version` injection).
531
+ - **S5** `projects.json` official Zod schema + last-known-good for `config`/`profiles`/`projects` + content-sha256
532
+ hot-reload invalidation (fixed corrupt JSON being treated as missing and reset).
533
+
534
+ ### Changed
535
+
536
+ - **S6** CI/Release `npm ci` retry corrected (stop on success / 3 attempts / attempt counter);
537
+ Vitest v3 upgrade (0 audit vulnerabilities); plain-text status markers (emoji scan test).
538
+
539
+ ### Testing
540
+
541
+ - Total tests **53 → 72**.
542
+
543
+ ---
544
+
545
+ ## [0.1.2] — 2026-09-08
546
+
547
+ ### Changed
548
+
549
+ - Build no longer ships source maps (no `.map`, tarball ≈ 69.9 KB).
550
+
551
+ ### Testing
552
+
553
+ - Total tests **53**.
554
+
555
+ ---
556
+
557
+ ## [0.1.1] — 2026-09-07
558
+
559
+ ### Added
560
+
561
+ - **Release after the R1–R5 fixes**:
562
+ - **R1** Cancel/interrupt state persistence (`cancel_requested → cancelled`, `cancelReason`/`finishedAt`/`errorType`
563
+ persisted, restart-recoverable, idempotent, bounded shutdown).
564
+ - **R2** Call-level `taskTimeoutMs` precedence fix + cross-platform process-tree termination
565
+ (POSIX process-group SIGTERM→SIGKILL, Windows `taskkill /T /F`).
566
+ - **R3** Git baseline participates in diff (boundary at `baseline.head`; agent commits do not lose changes;
567
+ dirty-worktree hash attribution).
568
+ - **R4** Verification tool parameters and report-round semantics (`round=0` valid, manual verify does not overwrite
569
+ reports, `extraChecks` append + `checksMode=replace`, `optional` does not affect verdict, `baselineRef` validated).
570
+ - **R5** Removed hardcoded agent paths (`{LOCALAPPDATA}` placeholders + platform-standard candidates);
571
+ mtime hot reload for `config`/`profile`/`projects`.
572
+ - **R6** Cross-platform CI matrix (Windows/macOS/Linux × Node 20/22) and Release version consistency
573
+ (tag/input = `package.json` = tarball), plus tarball content checks.
574
+ - **R7** npm published `tianshu-mcp@0.1.1` + `npx -y` raise with 8 tools connected.
575
+ - **R8** Bilingual docs synced (including 4 English topic docs).
576
+
577
+ ---
578
+
579
+ ## [0.1.0] — 2026-09-07
580
+
581
+ ### Added
582
+
583
+ - First usable release: **M1 core engine + stub-agent end-to-end**.
584
+ - 8 MCP tools: `run_task` / `query_task` / `list_tasks` / `get_task_report` / `cancel_task` / `verify_task` /
585
+ `rework_task` / `get_profiles`.
586
+ - `TaskManager` state machine / per-project serial queue / global concurrency gate / cancel (kill tree) / event-stream persistence.
587
+ - Acceptance engine: git baseline & diff, default check-set derivation, command runner, code analysis,
588
+ `report.md` / `report.json`.
589
+ - fix-loop auto rework + `needs_attention`; skill self-install.
590
+ - Stub-agent 3 playbooks (good / fix-on-first / never) integration tests + protocol tests — **53/53 green**.
591
+
592
+ ---
593
+
594
+ [Unreleased]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.4.0...HEAD
595
+ [0.4.0]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.3.4...v0.4.0
596
+ [0.3.4]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.3.3...v0.3.4
529
597
  [0.3.3]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.3.2...v0.3.3
530
- [0.3.2]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.3.1...v0.3.2
531
- [0.3.1]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.3.0...v0.3.1
532
- [0.3.0]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.2.0...v0.3.0
533
- [0.2.0]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.10...v0.2.0
534
- [0.1.10]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.9...v0.1.10
535
- [0.1.9]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.8...v0.1.9
536
- [0.1.8]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.7...v0.1.8
537
- [0.1.7]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.6...v0.1.7
538
- [0.1.6]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.5...v0.1.6
539
- [0.1.5]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.4...v0.1.5
540
- [0.1.4]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.3...v0.1.4
541
- [0.1.3]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.2...v0.1.3
542
- [0.1.2]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.1...v0.1.2
543
- [0.1.1]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.0...v0.1.1
544
- [0.1.0]: https://github.com/lanlan0811/tianshu-mcp/releases/tag/v0.1.0
598
+ [0.3.2]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.3.1...v0.3.2
599
+ [0.3.1]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.3.0...v0.3.1
600
+ [0.3.0]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.2.0...v0.3.0
601
+ [0.2.0]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.10...v0.2.0
602
+ [0.1.10]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.9...v0.1.10
603
+ [0.1.9]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.8...v0.1.9
604
+ [0.1.8]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.7...v0.1.8
605
+ [0.1.7]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.6...v0.1.7
606
+ [0.1.6]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.5...v0.1.6
607
+ [0.1.5]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.4...v0.1.5
608
+ [0.1.4]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.3...v0.1.4
609
+ [0.1.3]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.2...v0.1.3
610
+ [0.1.2]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.1...v0.1.2
611
+ [0.1.1]: https://github.com/lanlan0811/tianshu-mcp/compare/v0.1.0...v0.1.1
612
+ [0.1.0]: https://github.com/lanlan0811/tianshu-mcp/releases/tag/v0.1.0