Commit Graph

5131 Commits

Author SHA1 Message Date
Tianyi Cui
00388f2d82 Merge branch 'code-mode-ui/shiki' into code-mode-ui/trajectory-spans 2026-07-26 14:41:41 +08:00
Tianyi Cui
28b617dd73 test(ui-primitives): cover the fence pre-routing arms; drop the unreachable array probe
CI coverage flagged MarkdownText's pre route: the array-element probe
(raw[0]) and the mixed-content fallbacks were unreachable — the markdown
pipeline hands pre one code element whose children are one string (or
none, for an empty fence). Simplify to the string check, annotate the
isValidElement guard as representation-change armor, and pin both live
arms: the empty fence keeps the stock <pre>, a language-less fence renders
the plain CodeBlock arm.
2026-07-26 14:41:23 +08:00
Tianyi Cui
909f5221f6 Merge branch 'code-mode-ui/shiki' into code-mode-ui/trajectory-spans 2026-07-26 14:33:07 +08:00
Tianyi Cui
c428400b13 Merge branch 'code-mode-ui/dispatch-spill' into code-mode-ui/shiki 2026-07-26 14:32:54 +08:00
Tianyi Cui
3b63bcbeec test: cover the dispatch-log seam's contained-failure and decline arms
CI's full-tree coverage flagged three untaken paths this PR introduced:
- shapeDispatchLog's catch (a throwing tools/code-dispatch-log listener
  must be contained — the settle event logs the unshaped content);
- the spill listener's flatten-decline arm (non-text sub-result content
  passes through unchanged);
- the generated scope-key extractor row for tools/code-dispatch-log
  (registered in the scope invariant matrix like the other tools events).
2026-07-26 14:32:22 +08:00
Tianyi Cui
835156b038 fix(ui-trajectory): timing provenance on sub-span lanes; assembled snapshot for both views
Responding to ds-review-bot on #664:

- SubSpanLane gains a 'timing' discriminant (measured | running | unknown).
  A settle-only replay entry (callTime null, start outside the window) was
  previously indistinguishable from a measured 0 ms span; it now renders
  hollow with a 'duration unknown' hover title, and durationMs stays null
  for anything unmeasured. Pairs with the client-runtime fix that stopped
  fabricating callTime = settle time (826c3696a on the live-parallel PR).

- The built-client Code Mode fixture snapshot now switches to the
  Trajectory and Waterfall tabs and pins the assembled rendering: three
  Sub cells with real +0.8s durations and three measured lanes with their
  hover titles — product-visible coverage through the real bundle graph,
  not just package-level jsdom fixtures.

Agent Note (both languages) updated for the timing contract; pairing
re-recorded.
2026-07-26 14:20:59 +08:00
Tianyi Cui
c5e1f53d7e Merge branch 'code-mode-ui/shiki' into code-mode-ui/trajectory-spans 2026-07-26 14:07:15 +08:00
Tianyi Cui
954cb8d486 Merge branch 'code-mode-ui/dispatch-spill' into code-mode-ui/shiki 2026-07-26 14:07:05 +08:00
Tianyi Cui
aaf4d44c4f Merge branch 'code-mode-ui/live-parallel' into code-mode-ui/dispatch-spill 2026-07-26 14:06:54 +08:00
Tianyi Cui
3e1a22eb2b fix(client-runtime): settle-only dispatch windows carry null callTime
Responding to ds-review-bot on #664 (root cause lives here): when a history
window carries a tool/code-dispatch settle without its paired start, the
runtime fabricated callTime = settle time, so downstream duration views
presented a measured 0 ms. Match the native tool-result contract instead —
callTime: null = unknown — and pin it; the trajectory cell already renders
null as the em dash, and the waterfall gains explicit unknown handling in
its own PR.
2026-07-26 14:04:29 +08:00
Tianyi Cui
15bc33c9e6 Merge branch 'code-mode-ui/shiki' into code-mode-ui/trajectory-spans 2026-07-26 13:48:28 +08:00
Tianyi Cui
28797ae8c6 Merge branch 'code-mode-ui/dispatch-spill' into code-mode-ui/shiki 2026-07-26 13:47:37 +08:00
Tianyi Cui
ded5d01c6c docs: regenerate catalogs and register CodeDispatchLog type-equiv on this tree
The static CI gates run per-branch on the merged tree: the cordis
catalog/api, config-catalog, and type-equiv manifest updates for the
tools/code-dispatch-log waterfall and CodeDispatchLog payload previously
landed only on the shiki branch (09734f23b); this branch's own tree needs
the same regenerated outputs and manifest entries.
2026-07-26 13:40:02 +08:00
Tianyi Cui
73c7e3c276 Merge branch 'code-mode-ui/live-parallel' into code-mode-ui/dispatch-spill 2026-07-26 13:25:12 +08:00
Tianyi Cui
06556237f4 fix(tools): close scheduler coverage gaps; regen persistence catalog
The coverage gate flagged three untaken paths in the bridge scheduler:
- the exclusive-head inFlight re-check was dead (the shared guard above
  already returns for an exclusive head with any in-flight sibling) — removed;
- the commit-cursor undefined-dispatched break was structurally unreachable
  once entries join commitQueue only after start() ran synchronously —
  reordered the pump so the invariant holds by construction, annotated;
- the finish (final-result) commit arm and the pump re-entry guard gain a
  covering test (throwing tools/pre-execute listener) and a defensive
  annotation respectively; mid-run unregistration test renamed to match its
  actual post-result settlement path.

Also covers the direct-construction maxParallelSubCalls default (index.ts)
and commits the regenerated persistence catalog for the new dispatch pair.
2026-07-26 13:24:34 +08:00
Tianyi Cui
3f66cdc9d5 Merge branch 'code-mode-ui/shiki' into code-mode-ui/trajectory-spans 2026-07-26 12:30:36 +08:00
Tianyi Cui
202ef2fc89 Merge branch 'code-mode-ui/dispatch-spill' into code-mode-ui/shiki 2026-07-26 12:30:26 +08:00
Tianyi Cui
a84acca298 Merge branch 'code-mode-ui/live-parallel' into code-mode-ui/dispatch-spill 2026-07-26 12:30:14 +08:00
Tianyi Cui
6333b51f2f Merge branch 'code-mode-ui/web-ui-v1' into code-mode-ui/live-parallel 2026-07-26 12:30:03 +08:00
Tianyi Cui
9bf0318690 Merge branch 'code-mode-ui/host-foundation' into code-mode-ui/web-ui-v1 2026-07-26 12:29:56 +08:00
Tianyi Cui
9785f0e2a0 fix: actually compact the cordis-dynamic fixture's request/header line
The previous hygiene fix re-serialized with json.dumps defaults (spaced
separators), leaving the line byte-identical; explicit compact
separators make the header-scrub guard pass.
2026-07-26 12:29:16 +08:00
Tianyi Cui
2b6bcee96e Merge branch 'code-mode-ui/shiki' into code-mode-ui/trajectory-spans 2026-07-26 12:12:42 +08:00
Tianyi Cui
2675ab49ef test(snapshots): refresh cordis-inspect-jsdoc for the regenerated api catalog
This branch's gen-cordis-api regen (the static-gate fix) changed the
registry JSDoc the scenario pins.
2026-07-26 12:12:22 +08:00
Tianyi Cui
9d5b54529d test(snapshots): refresh cordis-inspect-jsdoc against the stack's registry JSDoc
The scenario pins the registry's own API JSDoc, which grew the
shapeDispatchLog/CodeDispatchLog contracts on this stack.
2026-07-26 12:04:07 +08:00
Tianyi Cui
fbf2045b32 Merge branch 'code-mode-ui/shiki' into code-mode-ui/trajectory-spans 2026-07-26 11:52:13 +08:00
Tianyi Cui
de305024ae Merge branch 'code-mode-ui/dispatch-spill' into code-mode-ui/shiki 2026-07-26 11:52:06 +08:00
Tianyi Cui
5780577dc8 Merge branch 'code-mode-ui/live-parallel' into code-mode-ui/dispatch-spill 2026-07-26 11:52:00 +08:00
Tianyi Cui
fc2d65fa20 test(snapshots): refresh code/both-mode fixtures against the replay model pins
The re-records for the SDK-prompt change had harvested live v4-pro
headers while every replay overlay pins v4-flash, so keyless replay
diverged on provenance; keyless refresh reconciles the affected
scenarios (dispatch-start pairs preserved).
2026-07-26 11:51:32 +08:00
Tianyi Cui
33df5d060a Merge branch 'code-mode-ui/shiki' into code-mode-ui/trajectory-spans 2026-07-26 10:57:20 +08:00
Tianyi Cui
d5bf00b300 docs: regenerate catalogs and register CodeDispatchLog type-equiv on the stacked tree
The static CI gates run per-branch on the merged tree: regen the cordis
catalog/api, config, persistence, and doc-graph outputs that PR3/PR4's
source changes shifted, and add the CodeDispatchLog manifest entries for
the tools.md pair's new type-equiv block.
2026-07-26 10:56:57 +08:00
Tianyi Cui
e715d6cc59 feat(web): Code Mode sub-calls in the trajectory and waterfall views
Trajectory: the layout fold interleaves one subtool cell per sub-dispatch
after its parent Tool cell (assistant-block calls, orphan results, and
running calls alike), indexes sequential across the interleave; settled
durations come from the start/settle pair, running sub-calls show the
em dash. New Sub tag (business tint) + 28px indent.

Waterfall: deriveSubSpans folds the dispatch index into per-turn lanes
with REAL wall time — each parent's window is first start → last settle
and every lane's offset/width is its fraction of it, so parallel
sub-calls visibly overlap; running lanes extend to the window end at
reduced opacity. Lanes draw under the owning turn row.

Both views read codeDispatches through the standard snapshot hook; no
new wire data, replay renders identically to live. Specs pin interleave
order, durations, the running arms, window fractions, and the rendered
lane.
2026-07-26 10:48:33 +08:00
Tianyi Cui
104e83109f fix: address review — plain fences while streaming
ds-review-bot finding: a growing fence retokenized on every chunk
(quadratic main-thread work). MarkdownText gains a streaming flag —
the streaming partial renders fences through the plain arm and the
finalize swap highlights once; AssistantMarkdown threads its existing
flag. (The zh Agent Note pair the review also flagged landed earlier
on this branch.) New spec pins plain-while-streaming and
highlighted-after-finalize.
2026-07-26 10:43:52 +08:00
Tianyi Cui
173901033b Merge branch 'code-mode-ui/dispatch-spill' into code-mode-ui/shiki 2026-07-26 10:40:40 +08:00
Tianyi Cui
7b58346b3c fix: address review — log shaping off the program-facing path
ds-review-bot finding: awaiting shapeDispatchLog before resolving the
binding let a slow spill backend delay the program and occupy a
dispatch slot. The settle now resolves the program immediately; the
shaped append runs as tracked side work (logWork) drained at run
settlement, so every tool/code-dispatch event still lands inside the
open turn. New spec pins the contract: with a hung spill backend the
second dispatch starts and the program completes both calls, and both
settle events land once released.
2026-07-26 10:40:03 +08:00
Tianyi Cui
f02641e8e5 Merge branch 'code-mode-ui/live-parallel' into code-mode-ui/dispatch-spill
# Conflicts:
#	packages/core/tools/src/code-mode.ts
2026-07-26 10:38:50 +08:00
Tianyi Cui
a786911293 fix: address review — non-vacuous error assertion, package contracts
ds-review-bot findings: the browser e2e's error-state check now requires
at least one error sub-row (was >= 0); the runtime README documents the
codeDispatches snapshot contract and the ui-conversation README the code
variant + nested sub-row semantics.
2026-07-26 10:36:35 +08:00
Tianyi Cui
5bf4d573f7 fix: address review — staged scheduler, start-time reclassification, catalogs
ds-review-bot findings on the parallel bridge: sub-dispatches now run
through the registry's staged scheduler view (the loop's own seam) —
ordered prepare (pre-execute/guards) at submission-ordered start time,
only the dispatch/body stage overlapping, and a head-of-line commit
cursor running post-execute, context deferral, and the settle event in
submission order (new spec pins post order + context order under
out-of-order completion). Queued dispatches reclassify via
executionMode() immediately before starting, so a registry mutation
while queued flips them exclusive (native lazy-reclassification
semantics). Config and tool catalogs regenerated; the tool-catalog
metadata now names the start/settle pair and the scheduling contract.
2026-07-26 10:33:48 +08:00
Tianyi Cui
b25a60c0a6 Merge branch 'code-mode-ui/dispatch-spill' into code-mode-ui/shiki 2026-07-26 10:22:15 +08:00
Tianyi Cui
52f6de60d6 Merge branch 'code-mode-ui/live-parallel' into code-mode-ui/dispatch-spill 2026-07-26 10:21:50 +08:00
Tianyi Cui
86819ecbbb Merge branch 'code-mode-ui/web-ui-v1' into code-mode-ui/live-parallel
# Conflicts:
#	.agents/notes/implemented/feature/2026-06-15-code-mode.i18n.yaml
2026-07-26 10:21:01 +08:00
Tianyi Cui
e542a89db7 Merge branch 'code-mode-ui/host-foundation' into code-mode-ui/web-ui-v1 2026-07-26 10:20:06 +08:00
Tianyi Cui
63cd1b5834 docs(notes): refine the shiki note's Chinese pair 2026-07-26 10:19:43 +08:00
Tianyi Cui
99a9fa8509 fix: address review — python smoke caller, contract prose, fixture header hygiene
ds-review-bot findings: the packaged Python runtime smoke's scripted
run_code call gains the required description; the ToolDefinition JSDoc
and the Code Mode foundation note (both languages, pair re-recorded) now
state both required parameters; the cordis-dynamic-toolchain fixture's
request/header line is re-compacted so the header-scrub hygiene guard
passes (my earlier patch had re-spaced it). The TUI terminal fixture was
already regenerated from keyless replay in the previous commit.
2026-07-26 10:18:53 +08:00
Tianyi Cui
c57af8fa36 docs(notes): add Chinese pair for the shiki highlighting note 2026-07-26 10:06:36 +08:00
Tianyi Cui
bb3dc50a4b feat(web): shiki syntax highlighting for code surfaces
One highlighter for the client: a synchronous fine-grained shiki core
(JS regex engine, no WASM) in ui-primitives with an explicit grammar
allowlist (typescript, shellscript, json — aliases resolve, unknown
languages take a geometry-identical plain arm). The shared CodeBlock
component owns both arms; markdown fences, the run_code expanded
program body (typescript), and the details panel Input (json) all
route through it. Token colors live in a new ui-theme shiki.css sheet
as --shiki-* custom properties (light/dark blocks), wired through the
shell's base.css chain — tokens-only styling holds; shiki's generated
span tree is the sanctioned innerHTML path (static output, no user
HTML). jsdom specs pin token spans, aliases, both fallbacks, and the
fence route; the built-bundle snapshot asserts the highlighted program
under the code row.
2026-07-26 09:52:37 +08:00
Tianyi Cui
4987261d55 feat(spill): bound the durable copy of Code Mode sub-dispatch results
New tools/code-dispatch-log waterfall (run via registry.shapeDispatchLog,
contained — a throwing listener falls back to the unshaped content) lets
listeners reshape the tool/code-dispatch event's content before the
bridge appends it. dsh-spill-policy registers a second arm sharing the
model-facing arm's exact replacement pipeline (same maxInlineBytes cap,
preview + locator, within-cap invariant, best-effort fallbacks), with
artifacts labeled dispatch under the sub-call id. The program's value is
untouched; read sub-calls ARE bounded (a log copy is not model context,
and read produces the biggest logs). Resolves the tools README's
uncapped-dispatch-log Known Limitation.
2026-07-26 09:01:03 +08:00
Tianyi Cui
366419862f Merge branch 'code-mode-ui/web-ui-v1' into code-mode-ui/live-parallel
# Conflicts:
#	examples/acp-agent/tests/snapshots/both-mode-turn/session.jsonl
#	examples/acp-agent/tests/snapshots/code-mode-turn/session.jsonl
#	examples/acp-agent/tests/snapshots/code-mode-workspace-context/session.jsonl
#	examples/tui-agent/tests/snapshots/code-mode/terminal.expected.txt
2026-07-26 08:59:36 +08:00
Tianyi Cui
d0a45d9f2f Merge branch 'code-mode-ui/host-foundation' into code-mode-ui/web-ui-v1 2026-07-26 08:58:50 +08:00
Tianyi Cui
abfc7b7ed1 test(snapshots): reconcile scripted run_code fixtures with the required description
The scripted (non-recorded) fixtures' run_code calls predate the required
description parameter, so replay rejected them at validation before any
dispatch: patch the scripted programs' args (tool/call, message blocks,
and chunk deltas together) and refresh goldens keylessly. Also picks up
the v4-pro re-records of the code-mode scenario pair whose live model
drifted from the overlay pin, and drops tmp-path churn.
2026-07-26 08:58:04 +08:00
Tianyi Cui
8a79679489 feat(tools): live dispatch lifecycle + native-contract parallel sub-calls in Code Mode
The bridge replaces its serialization queue with a pool that reuses the
native concurrency contract: submissions classify through
registry.executionMode (fail-closed isConcurrencySafe), start strictly in
submission order, overlap up to the validated maxParallelSubCalls config
(default 10; 1 restores serial), and exclusive calls drain the pool, run
alone, and bar later calls. Each started sub-call logs a
tool/code-dispatch-start event at pool entry; the existing
tool/code-dispatch settles the pair (started ⇔ settles exactly once;
abandoned queued calls log neither). SDK prompt guidance now states the
true Promise.all contract — re-recorded across every code/both-mode
snapshot (plus the stale cordis-dynamic-toolchain fixture gaining the
required description arg).

Client: CodeSubCall widens to RunningToolCall | ToolResultNode — starts
land the running shape (rows wear the native running ring), settles
replace in place preserving start order, callTime pairs to the start
time. Fixture emits start/settle pairs; jsdom pins the running sub-row;
runtime specs pin in-place settlement and out-of-order completion.
2026-07-26 06:02:36 +08:00