Skip to content

docs(examples): add usage examples for the WebSocket API#54

Open
FenjuFu wants to merge 3 commits into
mainfrom
docs/usage-examples
Open

docs(examples): add usage examples for the WebSocket API#54
FenjuFu wants to merge 3 commits into
mainfrom
docs/usage-examples

Conversation

@FenjuFu

@FenjuFu FenjuFu commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

What

Adds docs/examples.md - a practical "first conversation" guide for the WebSocket API - and links it from the documentation section of both READMEs.

Contents:

  1. Start the engine - make run, default endpoint ws://localhost:8081/v1/ws
  2. wscat smoke test - what the handshake looks like (session.event kind=opened), one user.message, what the card.* stream means
  3. Minimal Node.js client - streaming text accumulation per (card_id, channel, index), the bare ping/pong keep-alive, auto-approving permission prompts, detecting turn completion via card.close on the turn card
  4. Interrupting - session.interrupt with the observed trace_id
  5. Prompt kinds table - valid decision values and reply payload shapes for permission / question / plan_review / step_decision
  6. Reconnecting - session.resume with last_seq, and the prompt re-send / request_id dedup contract

Why

The protocol spec (docs/protocols/websocket.md) is thorough but is a wire contract, not a tutorial - there was no copy-paste path from "cloned the repo" to "saw streaming output". Usage examples are also the most-requested doc type from new integrators.

Verification

All frames, field names, decision values and defaults were taken from docs/protocols/websocket.md (v2 card model) and configs/config.yaml - notably the endpoint is /v1/ws per the spec, not the /ws currently shown in the README's protocol summary (that section also still says v1.4; happy to refresh it in a follow-up if wanted).

Docs-only change.

FenjuFu added 3 commits July 23, 2026 10:12
Adds docs/examples.md with a wscat smoke test, a minimal Node.js client for
the v2 card-model protocol (streaming, keep-alive, prompt handling, interrupt,
resume), and links it from both READMEs' documentation sections.
Adds docs/examples.md with a wscat smoke test, a minimal Node.js client for
the v2 card-model protocol (streaming, keep-alive, prompt handling, interrupt,
resume), and links it from both READMEs' documentation sections.
Adds docs/examples.md with a wscat smoke test, a minimal Node.js client for
the v2 card-model protocol (streaming, keep-alive, prompt handling, interrupt,
resume), and links it from both READMEs' documentation sections.
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant