← Back to Pull requests

feat(cli): notify and chat commands for hybrid sessions (5/6) #342

Closed
unknown closed this pull request without merging on Nov 06, 2026 02:18 UTC
View on GitHub
unknown unknown commented on Nov 05, 2026 19:33 UTC
Author

Part 5 of add-agent-shell-control (stacked on #341). Covers tasks §3 (attention API and notify) and §4 (chat commands). The workspace commands (§5) were split out into a sixth PR because of their size; tasks §0 is updated.

Changes

Attention from scripts

  • POST /api/sessions/{id}/attention with body {kind, message?}. kind is notify, done, error or question.

  • - The attention source is the new cli. It replaces whatever attention is latched, regardless of source layering.
    - After that, the usual rules clear it: user input, the program's next status report, or DELETE.
    - On a hybrid session's chat side, it lasts until the agent reports a new state.
    - message is at most 200 characters and lives only in memory.
  • DELETE /api/sessions/{id}/attention clears attention from any source, the same way user input does, and syncs to every device.

  • The push body becomes the message, gated by include_title like the title. The in-page toast shows the message as its detail line.

  • webmux notify [--kind] [--session] [MESSAGE...] and notify --clear.
  • Chat commands

  • Commands: chat send (--attach, --mode steer, --wait, --auto-wait-requests, --timeout), chat watch, chat status, chat cancel, chat answer, chat switch, chat ls, chat resume, chat forget, chat set, chat permission, and chat queue ls|rm|edit|send-now|clear|resume.

  • Contract additions so a script can follow its own turn:

  • - ChatPromptResult now carries turnId and promptId.
    - turn.start now carries queueItemId for the queued prompt it sends.
  • send --wait now ends with exit 1 when its queued prompt is removed before it is sent.

  • chat switch answers a pending choice:

  • - --force forces the switch;
    - otherwise it cancels the switch and exits 1, so the switch is never left waiting for a choice.
  • Spec adjustments, recorded in the spec deltas:

  • - chat answer uses --content JSON and --decline instead of --json BODY, because --json is the output switch on every command.
    - Queue subcommands put the verb before the session: chat queue ls SESSION.
  • Env.Interactive drives confirmations. chat forget asks first on a terminal and needs --yes otherwise.
  • Fixes merged forward from #341

  • rm now ends a running session before removing it. The server answers 409 for a running session.

  • send --key now waits for each key to be acknowledged.
  • Docs

  • New guide topic /llms/chat.md; sessions.md, launch.md and recipes updated; the generated command reference regenerated.

  • Usage page, protocol docs (http-sessions, http-hybrid, http-push) and spec deltas updated.
  • User stories

  • New: US-S13 (notify), US-S14 (driving chat), US-S15 (switch and history).

  • Updated: US-C06 and US-C12 (toast detail line and push body), plus the index, coverage table and verification log.
  • Screenshots

    The toast while browsing, using isolated demo data:

  • Before: what a script could do previously, an OSC 9 notification, which shows only the generic detail.

  • After: webmux notify --kind done "…".
  • Both captures come from this branch's binary; the OSC 9 rendering is unchanged.

    | | Before | After |
    |---|---|---|
    | Desktop light | ![](https://raw.githubusercontent.com/mzdluo123/webmux/ccr-462bcb9e-6uyk04-pr5/docs/images/webmux-notify/notify-toast-desktop-light-before.png) | ![](https://raw.githubusercontent.com/mzdluo123/webmux/ccr-462bcb9e-6uyk04-pr5/docs/images/webmux-notify/notify-toast-desktop-light-after.png) |
    | Desktop dark | ![](https://raw.githubusercontent.com/mzdluo123/webmux/ccr-462bcb9e-6uyk04-pr5/docs/images/webmux-notify/notify-toast-desktop-dark-before.png) | ![](https://raw.githubusercontent.com/mzdluo123/webmux/ccr-462bcb9e-6uyk04-pr5/docs/images/webmux-notify/notify-toast-desktop-dark-after.png) |
    | Mobile light | ![](https://raw.githubusercontent.com/mzdluo123/webmux/ccr-462bcb9e-6uyk04-pr5/docs/images/webmux-notify/notify-toast-mobile-light-before.png) | ![](https://raw.githubusercontent.com/mzdluo123/webmux/ccr-462bcb9e-6uyk04-pr5/docs/images/webmux-notify/notify-toast-mobile-light-after.png) |

    Verification

  • make check passes: format, docs guard, Oxlint, archtest, go vet, and golangci-lint with 0 issues.

  • go test -race on session, push, hybrid, sessioncmd, agentguide, archtest, wire, contract and cmd/webmux.

  • - The cmd/webmux end-to-end tests use a real server and the fake ACP agent, and cover notify, every chat command, switching both ways, and resume/forget.
  • go test ./internal/api passes except repository-commits, which differs only on the local git 2.43 date format and is green in CI.

  • Windows cross-compile and darwin vet pass.

  • Frontend: wire-contract and toast unit tests, check:arch, and attention.spec.ts E2E including the new notify toast test.

  • Not verified: the busy-TUI choice path of chat switch (reviewed only) and macOS.
  • ---
    _Generated by Claude Code_

    Diff: 626 lines (+469 / -157) across 7 files Reviewer: mzdluo123 Review duration: 404m
    All Vouch review confidence checks passed
    Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 626 lines diff across 7 files
    0.50
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.385
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #342"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 50.3% (MEDIUM) · Higher = larger blast radius
    50.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.9% · Safe to merge
    19.9%