返回 CodeWhale
POST_0_9_1_SEAMS.md
根目录 / docs / 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 `ui.rs` / `app.rs` / `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`): a classified H2 header
34 stall on the dual client retries exactly once on the HTTP/1.1 twin;
35 an H1-pinned request never retries; nothing retries once response
36 headers (and therefore any stream body) exist
37 - H1 retry classification (`should_retry_with_h1`)
38 - idle-timeout message format (`idle_timeout_message`, with
39 bytes/age/last-chunk diagnostics)
40
41 Wire-protocol request construction and stream decoding remain at the
42 adapter edge (`chat.rs`, `anthropic.rs`, `responses.rs`): each adapter
43 builds its own endpoint URL, headers, auth, and body inside the attempt
44 closure it hands to `open_sse_response`. The pre-existing Responses
45 provider retry loop (rate limit / transient upstream, `send_with_retry`)
46 stays inside each open attempt, before any stream body exists.
47
48 Remaining follow-up: collapsing further toward a piagent-style single
49 StreamFn (shared decode loop) is still deferred.
50
51 ## Thin TUI over core (north star)
52
53 `ui.rs` / `app.rs` / `widgets/mod.rs` remain large. Post-0.9.1 priority:
54
55 1. Extract tool / git / github / session / workflow / MCP routing out of the TUI
56 crate into a core/data layer (kimi-code `agent-core` / piagent package shape).
57 2. Keep the TUI a projection of state + input routing.
58 3. Prefer new modules over adding to the three monoliths.
59
60 ## Reserved vocabulary: "Operation" (not shipped, not a rename)
61
62 **Workflow keeps its name.** `/workflow`, `codewhale workflow`, the `workflow`
63 tool, the `[workflow]` config table, `*.workflow.js` sources, and the public
64 vocabulary below are unchanged in v0.9.2, and no `/operation` or
65 `codewhale operation` alias ships.
66
67 The public vocabulary stays:
68
69 - **Fleet** = who does the work.
70 - **Workflow** = what order the work follows.
71 - **Lane** = one running Workflow.
72 - **Runtime** = where and how a Lane executes.
73 - **Operate** = the current mode (unchanged).
74
75 "Operation" is **reserved for a future, distinct concept** — a continuous
76 objective or organization-level control loop that coordinates *multiple Fleets
77 and multiple Workflows over time*. It is a layer above a Workflow, not another
78 name for one. Nothing implements this today; do not advertise it, add config
79 keys for it, or introduce it as a synonym for Workflow. If it is ever built, it
80 must earn the noun by being that coordinating layer.
81
82 ## Optional deferred
83
84 - Full live global model subscriptions (refresh on every open + `r` / Ctrl+R is
85 the practical path; continuous live feed if unstable stays deferred).
86 - YOLO mode is gone from product UI; `mode_yolo` remains only as legacy theme
87 palette data.
88
88 lines MARKDOWN