返回 CodeWhale
POST_0_9_1_SEAMS.md
根目录 / docs / design / POST_0_9_1_SEAMS.md
1 # Post-0.9.1: thin TUI over core + stream consolidation
2
3 **Status:** seams landed in v0.9.1; full split deferred.
4
5 ## What shipped in 0.9.1 (seams only)
6
7 New visual / capability systems stay in focused modules (do not grow the
8 monoliths without necessity):
9
10 | System | Module |
11 |--------|--------|
12 | Ambient ocean life | `tui/ambient_life.rs` |
13 | Hot tail | `tui/hot_tail.rs` |
14 | Hover aura | `tui/hover_hit.rs` + `tui/hover_layer.rs` |
15 | Git status cache | `tui/git_status.rs` |
16 | Worktree manager UI | `tui/worktree_manager.rs` |
17 | Phase rail | `tui/phase_strip.rs` |
18 | Stream entry seam | `client/stream_entry.rs` |
19
20 Business logic must not land in `tui/ui.rs` / `tui/app.rs` / `tui/widgets/mod.rs` unless it
21 is pure view wiring.
22
23 ## StreamFn consolidation (landed post-0.9.1)
24
25 `client/stream_entry.rs` is the shared open-path seam, and all three
26 streaming adapters open through it:
27
28 - HTTP policy (`DualWithH1Fallback` / `Http1Only`, env pin via
29 `CODEWHALE_FORCE_HTTP1`)
30 - dual/H1-twin client selection (`client_for_policy`)
31 - bounded response-header wait (`stream_open_timeout`, env override
32 `CODEWHALE_STREAM_OPEN_TIMEOUT_SECS`)
33 - one shared open function (`open_sse_response`): only a proven transient
34 connection failure before dispatch can select the HTTP/1.1 twin; a header
35 stall or interrupted response remains unknown and cannot reissue inference
36 - typed H1 retry classification (`is_stream_open_transport_failure`)
37 - idle-timeout message format (`idle_timeout_message`, with
38 bytes/age/last-chunk diagnostics)
39
40 Wire-protocol request construction and stream decoding remain at the
41 adapter edge (`chat.rs`, `anthropic.rs`, `responses.rs`): each adapter
42 builds its own endpoint URL, headers, auth, and body inside the attempt
43 closure it hands to `open_sse_response`. The shared streaming retry loop
44 (`send_retry_loop`) wraps stream opening; rate-limit backoff stays outside each
45 response-header timer. It permits only ordinary rate limits or proven transient
46 pre-dispatch connection failures. Both inference clients disable automatic redirects and reqwest
47 protocol retries. Read-only catalog GETs select their bounded retry policy at
48 their actual method owner.
49
50 Remaining follow-up: collapsing further toward a piagent-style single
51 StreamFn (shared decode loop) is still deferred.
52
53 ## Thin TUI over core (north star)
54
55 `tui/ui.rs` / `tui/app.rs` / `tui/widgets/mod.rs` remain large. Post-0.9.1 priority:
56
57 1. Extract tool / git / github / session / workflow / MCP routing out of the TUI
58 crate into a core/data layer (kimi-code `agent-core` / piagent package shape).
59 2. Keep the TUI a projection of state + input routing.
60 3. Prefer new modules over adding to the three monoliths.
61
62 ## Reserved vocabulary: "Operation" (not shipped, not a rename)
63
64 **Workflow keeps its name.** `/workflow`, `codewhale workflow`, the `workflow`
65 tool, the `[workflow]` config table, `*.workflow.js` sources, and the public
66 vocabulary below are unchanged in v0.9.2, and no `/operation` or
67 `codewhale operation` alias ships.
68
69 The public vocabulary stays:
70
71 - **Fleet** = who does the work.
72 - **Workflow** = what order the work follows.
73 - **Lane** = one running Workflow.
74 - **Runtime** = where and how a Lane executes.
75 - **Operate** = the current mode (unchanged).
76
77 "Operation" is **reserved for a future, distinct concept** — a continuous
78 objective or organization-level control loop that coordinates *multiple Fleets
79 and multiple Workflows over time*. It is a layer above a Workflow, not another
80 name for one. Nothing implements this today; do not advertise it, add config
81 keys for it, or introduce it as a synonym for Workflow. If it is ever built, it
82 must earn the noun by being that coordinating layer.
83
84 ## Optional deferred
85
86 - Full live global model subscriptions (refresh on every open + `r` / Ctrl+R is
87 the practical path; continuous live feed if unstable stays deferred).
88 - YOLO mode is gone from product UI; `mode_yolo` remains only as legacy theme
89 palette data.
90
90 lines MARKDOWN