3 Commits
Author SHA1 Message Date
chencheng (云谦)andShaojin Wen 29fa7bbe06 chore(types): compile cleanly under the TypeScript 7 native compiler (#16463)
* fix(types): compile cleanly under the TypeScript 7 native compiler

tsgo (@typescript/native-preview) reported 48 errors across the
typecheck projects while tsc 5.8 reported none. This removes all of
them without changing what tsc emits, so a tsgo typecheck lane or a
later compiler switch can start from a clean tree.

- Drop `baseUrl` from five tsconfigs. TypeScript 7 removed it, and
  every `paths` target here is already relative to its tsconfig.
- Set `rootDir` where TypeScript 7 no longer infers it (web-shell
  declarations, sdk-typescript), and list node types explicitly for
  cua-driver now that @types are no longer included by default.
- Annotate Buffers built by Node's Buffer factories as
  `Buffer<ArrayBuffer>` (or widen to `Buffer` where a variable later
  receives stream chunks); the ES2024 lib no longer treats
  ArrayBufferLike as an ArrayBuffer, so these failed at fetch, Blob,
  and Response call sites. The two call sites that take caller- or
  interface-supplied bytes assert `BodyInit`, matching the existing
  XMLHttpRequest upload path.
- Remove three redundant `?? []` / `?? undefined` operands that the
  newer checker reports as unreachable.
- Declare `*.css` modules for the two integrations that import
  stylesheets, now that side-effect imports are checked.

* fix(types): include web-shell client declarations in the build config

The config's include listed only client/index.tsx, so client/vite-env.d.ts
and client/local-files/file-system-access.d.ts never entered the program.
Removing baseUrl unmasked 227 tsgo errors (and 222 under tsc 5.8) for the
CSS module and File System Access declarations they provide.

---------

Co-authored-by: Shaojin Wen <[email protected]>
2026-11-07 08:23:16 +00:00
chencheng (云谦) 1b1f4455d9 ci: build the PR tree once and shorten the required path (#16450)
* ci: build the PR tree once and shorten the required path

The no-AK integration gate, the four web-shell smoke shards and Lint & Static each rebuilt the tree test_build already uploads, and the build cache rarely helped: most runs logged "29 of 29 workspaces changed" because the arch-keyed cache was split across the mixed x64/ARM64 pool and a prefix restore returned the newest entry instead of the base commit's.

- test_build restores the build its base commit saved (ci-build-cache.mjs key --at), drops runner.arch from the key, and runs the serve fast-path closure and core subpath checks against the built tree.
- The no-AK integration gate unpacks that tree and runs as three shards; integration_no_ak_result keeps the required check name.
- The web-shell smoke unpacks the same tree instead of building; consumers recopy the opentui native assets for their host (host-assets).
- The standalone runtime regression moves from unit shard 1 to shard 4.
- A java_only profile skips the TypeScript lanes for changes confined to the Java packages; Lint & Static runs the scripts/tests suites that name them.
- Drafts skip the integration gate and the browser smoke; ready_for_review starts the full run.

* ci: check the settings schema in test_build, which has the core dist

Lint & Static only had core's dist because the serve fast-path check built
it; with that check moved, Generate settings schema failed to import it.

* ci: keep the standalone regression on unit shard 1

Moving it did not shorten shard 1: the regression runs in the side lane,
in parallel with the CLI and core suites, and shard 1's time is its CLI
slice (576 s against 147 s on shard 4 for the same 181 files). That
imbalance is left to duration-based sharding.
2026-11-06 03:30:11 -08:00
chencheng (云谦) a1d713e747 feat(cli): report interactive program status with OSC 7501 (#16407)
* feat(cli): report interactive program status with OSC 7501

Report a single root OSC 7501 record from the interactive UI so terminals
and agent inboxes can show whether Qwen Code is working, waiting on the
user, or finished, without parsing the screen.

- idle / working / blocked (permission, question, auth) / done / error,
  with app=qwen-code on every report
- done and error latch until the next turn; a cancelled turn returns to
  idle; done and error are kept on exit, everything else is cleared
- msg names the tool at most, never its arguments or model text
- TTY only, deduplicated, retried after a failed write; never wrapped for
  tmux passthrough
- cleared while an external editor owns the terminal, rewritten on return
  and on SIGCONT

Closes #13870

* fix(cli): latch the OSC 7501 turn outcome when the turn ends

The outcome was recomputed from a history index on every history change,
so an error added while idle (a failed slash command) flipped `done` to
`error`, and memory compaction reset it to `idle` or hid an error from
the turn. Decide it once when streaming state returns to Idle, bound the
turn by item id, and reset only when history is cleared.

Also count a blocked prompt and a stop-hook loop as failed turns, and pin
the msg-only report, release/restore and editor call sites with tests.

* fix(cli): reset the OSC 7501 outcome on /clear and cap msg by decoded size

/clear only masked the latched outcome: the tracker kept `done` or
`error`, so the next item added while idle brought it back, and exit
could keep a stale badge. Reset the tracker when history empties.

The msg limit checked only the encoded length, which lets a 2049-byte
message through as 2732 base64 characters. Cap the decoded text at 2048
bytes, which also bounds the encoded form.

Correct the design doc: a slash command runs as a turn and decides its
own outcome; it is not an idle history change.

* test(cli): assert the decoded msg is present before measuring it

decodeMsg returns string | null, which tsc --build rejects as a
Buffer.byteLength argument.

* fix(cli): ignore errors already pending when an OSC 7501 turn starts

A terminal API error stays in the pending area until the next submit
commits it, and a Goal submission skips that commit. The next Goal turn
then ended with the old error still pending and latched `error`, which
exit kept. Record the failure items pending at turn start and count only
new ones.

Also restore the program status before the raw-mode restore in
useLaunchEditor, which can throw; say control characters become spaces
in the msg encoder; and note in the design that the OpenTUI renderer
does not report status yet.
2026-11-06 17:34:40 +08:00