qwen-code/packages
wenshao ca996ecb54 feat(cli): wire POST /session/:id/prompt + /cancel for qwen serve (#3803)
Stage 1 follow-up after the bridge scaffold. Adds the two routes a client
needs to actually run a turn against the daemon.

Bridge:
  - `sendPrompt(sessionId, req)` looks up the session, FIFO-queues the
    call against the per-session prompt queue, and forwards through the
    SDK `ClientSideConnection.prompt`. Concurrent calls observe ACP's
    "one active prompt per session" invariant — second waits for first.
  - A failed prompt does NOT poison the queue; the tail catches and
    keeps draining so the next caller still runs (the original caller
    still sees its own rejection).
  - `cancelSession(sessionId, req?)` bypasses the queue and forwards
    the ACP notification immediately. ACP semantics: the agent winds
    down the *currently active* prompt; queued work is unaffected.
  - Both methods throw `SessionNotFoundError` (a typed Error subclass)
    when the id is unknown so route handlers can map cleanly to 404
    without brittle message matching.
  - Both methods overwrite the `sessionId` field in the request body
    with the routing id — a stale or spoofed body would otherwise be
    dispatched to the wrong agent process.

Routes:
  - `POST /session/:id/prompt` → 200 with PromptResponse, 400 on
    missing/non-array prompt, 404 on unknown session, 500 on agent
    error.
  - `POST /session/:id/cancel` → 204 always (cancel is a notification),
    404 on unknown session.

Tests (14 new — 7 bridge + 7 route, 0 regressions in the 4981 baseline):
  - sendPrompt: success forwards & returns response · routing-id
    overrides body sessionId · concurrent prompts FIFO-serialize
    (verified via per-prompt start/end ordering with a release latch) ·
    failed prompt doesn't block subsequent prompts · 404 for unknown id.
  - cancelSession: forwards with routing id · 404 for unknown id.
  - Routes: 200/400/404/500 paths for prompt; 204 with body or empty +
    404 for cancel.

Verified end-to-end against a real `qwen --acp` child:
  - POST /session/:id/prompt with `[{type:'text',text:'hi'}]` → 200
    `{"stopReason":"end_turn"}` in ~3.4s.
  - POST /session/:id/cancel → 204.
  - POST /session/does-not-exist/prompt → 404 with the unknown id
    surfaced in the body.
2026-05-07 11:10:58 +08:00
..
channels feat(weixin): add image sending support via CDN upload (#3781) 2026-05-06 01:49:26 +08:00
cli feat(cli): wire POST /session/:id/prompt + /cancel for qwen serve (#3803) 2026-05-07 11:10:58 +08:00
core fix(core): shrink file diff session records (#3872) 2026-05-06 20:48:24 +08:00
sdk-java fix(sdk-java): pass custom env to CLI process (#3543) 2026-04-24 10:37:52 +08:00
sdk-python fix(sdk-python): standardize TAG_PREFIX to include v suffix (#3832) 2026-05-06 11:14:02 +08:00
sdk-typescript refactor: extract shared release helper utilities (#3834) 2026-05-05 10:15:17 +08:00
vscode-ide-companion fix(core): address post-merge monitor tool and UI routing issues (#3792) 2026-05-04 21:19:41 +08:00
web-templates chore(release): v0.15.6 (#3766) 2026-04-30 15:59:35 +08:00
webui fix(core): address post-merge monitor tool and UI routing issues (#3792) 2026-05-04 21:19:41 +08:00
zed-extension