chore(gui): mission work logs — cordis design finalization, tool-card wire archive, incident records chore: missions chore: missions chore(gui): mission ledger — batch-2 answers, parallel dispatch state, jsdom coverage re-scope chore(gui): ledger — night-mode standing orders (self-commit small, no push, 5-min refresh) chore(gui): ledger — jsdom batches 2-4 landed (233 green), coverage probe next chore(gui): ledger — web-ui coverage probe 65%, four-tier fill plan approved chore(gui): ledger — cordis-impl B1 state after third API drop, decisions on file chore(gui): ledger — 01:32 patrol snapshot (jsdom tier-1 landed, coverage-fixer probed) chore(gui): ledger — 01:37 patrol (peer src trio landed, coverage-fixer still silent) chore(gui): ledger — 01:42 patrol (jsdom tier-2 landed, peer committed x2, coverage-fixer 2nd probe) chore(gui): ledger — coverage diagnosis complete (6-file gap list), web-ui at 91.4% chore(gui): ledger — 01:46 patrol (B1 done, jsdom tier-3 landed, coverage fix batch running) chore(gui): ledger — 01:51 patrol (jsdom tails x2 landed, B2 underway) chore(gui): ledger — 01:56 patrol (gateway.ts 337 lines, checkpoint T-7min) chore(gui): ledger — hold/pending split ruling, coverage-fixer externalize-or-restart ultimatum chore(gui): ledger — 02:01 patrol (B2 done, jsdom final arms, coverage ultimatum pending) chore(gui): ledger — 02:03 checkpoint executed (fixer2 respawn, four lanes released, three owners cold-started) chore(gui): ledger — all six lanes acked, type isolation first live proof (client closure clean) chore(gui): ledger — 02:08 patrol (all seven lanes active, wire carrier assembled) docs(gui): respond-design task checkpoint — apiproxy wire-layer recon done chore(gui): ledger — P0-2 contributor AGENTS.md landed (dd28a5019) docs(gui): respond-design checkpoint 2 — host-side recon (stub respond, frame types, approval seam, ACP answerer precedent) docs(gui): OOP debt inventory — seven territories, 2 real debts (createApiProxy, createFixtureApi), rest ruled keep-as-is docs(gui): disambiguation note on the archived i18n design task chore(gui): ledger — 02:12 patrol (exclude removed, mixed-knife incident under reconciliation) chore(gui): ledger — 02:15 wave (jsdom mission closed, OOP audit done, B3 isolation proof, mixed-knife resolved) chore(gui): ledger — 02:17 patrol (attribution reversal filed, arch-session probed) chore(gui): ledger — 02:22 patrol (B4 done, B5+B6 merged batch, arch-session deadline set) docs(gui): respond-design checkpoint 3 — client-side recon (pending map, PendingCard onRespond stub, AbstractApiClient.respond ready, bootHost missing approval mounts) docs(gui): peer carrier territory review — 2 fixes (SSE cancel leak, route-reservation guard), 1 ruling ask (RPC-log visibility), compliance ledger chore(gui): ledger — 02:27 (arch-shell respawn, territory review verdicts routed, ask-deny finding flagged) docs(gui): P1-5 respond design page complete — pending registry, wire answerer, client state machine, first-wins arbitration chore(gui): ledger — 02:31 patrol (respond design complete, B5 wire smoke green, shell knife 1 underway) docs(gui): respond design — add §0 status warning (web host ask defaults to deny), mount-behavior delta, no-timeout ruling with Config discipline chore(gui): ledger — 02:42 patrol (respond line closed pending review, B7 last piece underway) docs(gui): respond design contract review — direction pass, 2 doc fixes (settle-order contradiction, answering-state race), A/B/C compliance ledger docs(gui): respond design — contract review fixes (R1 verify-before-delete arbitration, R2 answering+resolved-frame transition, ask dual-source wording, rejected-is-ok-value note) chore(gui): ledger — 02:46 patrol (respond line final, two user decisions distilled, arch-shell deadline) docs(gui): respond review addendum — contract-gap ruling: approve plan A (ApprovalRequest.id), wire unchanged, drop plan B backscan chore(gui): ledger — cordis B7 summit: real-browser 10/10 green, user acceptance criterion proven docs(gui): respond design — contract gap #4 approved as plan A (ApprovalRequest.id), backscan fallback retired, blade 0 prepended docs(gui): respond design — final polish (owner-approval vs user-go-ahead wording, implementation handoff notes) chore(gui): ledger — 02:51 (shell-exec third respawn with operational script, respond line 4-knife final) chore(gui): ledger — 02:53 wave (respond five-knife true final, B7 closed 12/12, client.ts green) chore(gui): ledger — 02:56 patrol (cordis closeout bounced pending R1/R2/N1, shell-exec first sign of life) chore(gui): ledger — 03:01 patrol (R1/R2/N1 remediation in flight across four files) chore(gui): ledger — cordis line officially closed and archived, verified on disk (24 knives, 12/12, reviews closed) chore(gui): ledger — 03:06 patrol (shell-exec final window, lowered first-knife bar) chore(gui): ledger — 03:11 patrol (shell line iced-broken: three registries on disk) chore(gui): ledger — 03:15 patrol (quiet window, both active lanes within threshold) chore(gui): ledger — 03:20 patrol (shell five files up, api-proxy plan reported) chore(gui): ledger — 03:25 patrol (shell migration in flight with history-preserving moves, webserver green) chore(gui): ledger — 03:30 patrol (shell knife-1 in verification, api-proxy patching) chore(gui): ledger — shell knife 1 accepted (694cecc53), knife 2 released chore(gui): ledger — 03:40 patrol (knife 2 pre-move stage, cold-list spec appears) chore(gui): ledger — 03:45 patrol (rpclog moves staged, api-proxy two specs in flight) chore(gui): ledger — 03:54 patrol (knife-2 code done, coverage full-run final check) docs(gui): coverage-fixer task ledger — fixer2 takeover, per-file fix log, isolated reportsDirectory pitfall chore(gui): ledger — coverage lane closed and accepted (a19f069a5), the PR #443 CI fix knife chore(gui): ledger — 04:04 patrol (knife-2 calibration, sole active lane) chore(gui): ledger — shell knife 2 accepted (f8fb77b95), knife 3 released as final night task chore(gui): ledger — 04:19 patrol (knife-3 past half: callback chain through, ToolCallDetail up) chore(gui): ledger — night closeout summary: seven lanes closed, wake-up decision sheet chore: missions chore: missions chore: missions chore(gui): mission-local browser/probe verify scripts under missions/scripts/ The six acceptance/probe scripts move here as mission-side working material (headers and relative imports adjusted for the new location): carrier-errors, rpclog-panel, session, session-real, webserver-backpressure, webserver-hardening. chore(gui): verify-relocate mission log chore(gui): verify-relocate mission log — R1 guard addendum chore(gui): gates-continue mission log — CI-equivalent sequence all green chore(gui): VS Code 扩展体系双边设计调研报告 chore(gui): 调研追加 4.5 节——git 扩展数据面与 scope 绑定 docs(gui): web plugin system RFC — walkthrough + design notes docs(gui): RFC — restore existing SSE/POST as the v1 transport; envelope rides on it (D16) docs(gui): RFC — envelope demoted to chan-dispatch, scope out of envelope, rpc-log cut, peer deferred, scope tree is native cordis (D17-D21) docs(gui): RFC — hooks re-derived from component needs: useWatch/useAction only, useService removed; sessionHub cut, projections user-space, router rename, loader-only root (D22-D25) docs(gui): RFC — drop stale fork vocabulary (vendored cordis has Fiber only; scope = mintScope pattern), hook idempotence contract (D26-D27) docs(gui): RFC — session precision seam: plugins read scope key (host paradigm), React gets it from tree position via SlotOutlet (D28) docs(gui): RFC — domain hooks owned by plugins over framework primitives; useConversation paradigm carried over (D29) docs(gui): RFC — ctx services are the inter-plugin API (cordis proper); declarations are wire-only; get(id) returns scoped ctx (D30) docs(gui): RFC — full ctx.conversation walkthrough: root-singleton scope-sensitive service, caller-ctx scope key, get(key) as scoped ctx (D31) docs(gui): RFC — no client-side agents collection: session state machine already expresses the duality; agent resolution stays host authority (D32) docs(gui): RFC — v1 stays session-precision, no agent-level isolation; incarnation/agent-axis designs archived in ledger (D33) docs(gui): RFC walkthrough — full rewrite to final state (D16-D33 consolidated), end-to-end chain restored docs(gui): RFC — apiproxy demoted to generic channel routing; domain RPCs dissolve into owner plugins (D34) docs(gui): RFC — TS-interface-first wire contract (zod internal), conversation owns the dialogue frame with pluggable views (D35) docs(gui): RFC — page skeleton (sidebar+conversation), projects as plugin not service, nested slots via owner registries (D36) docs(gui): RFC — SlotMap declaration-merging slot model: single register API, inject-as-ownership, FC-typed registration, typed outlets (D37) docs(gui): RFC — slot props whitelist: identity, display params, materialized snapshot slices, stable UI callbacks (D38) docs(gui): RFC — end-to-end data flow: three transforms, equality protocol table, immer placement; i18n/theme kept standard (D39-D40) docs(gui): RFC — full external-injection model: props carry values + stable injected hooks; shared/client/react example rewritten (D41-D43) docs(gui): RFC final trio — modules.md (agent implementation spec), architecture.md (human walkthrough), plugins.md (business plugin inventory) docs(gui): RFC — props three-source merge (scope-standard useSession auto-injected); keyed key vs list id disambiguated (D44) docs(gui): RFC — inject comment says what it is (the React-facing props bundle); SessionHandle rename; snapshot-production story unified on buildSnapshot docs(gui): RFC architecture — full React component tree walkthrough: props three sources, slot vs plain children, hook taxonomy per node docs(gui): RFC — module map finalized (ui-slots/web-react/connection/runtime/ui-*/web); slots onChange replaced by cordis events; toolcall dimension; detail sidebar default-collapsed with toolName-keyed routing docs(gui): RFC plugins — openDetail relay chain: toolcard calls chat-view injected action, chat-view relays to conversation sidebar chore(gui): progress ledger — full archive rewrite: RFC outcome digest, open gaps, dispatch plan, cold-start entry docs(gui): RFC grill pass 1 — SlotScope axis (root/session) on declares, Gate dependency inversion, inject handle by scope, W5 acceptance list, gantt relay chain fixed docs(gui): figma analysis — sidebar/projects/sessions 区域交互视觉理解报告 docs(gui): figma 解析报告 — details 面板/多视图 tabs/未来功能区盘点 + slot 需求清单 docs(gui): figma 对话主区解析报告 — 消息流/tool calls 变体/审批接管输入框/Header tabs/视觉 token docs(gui): plugins.md rewritten from figma analysis — three-column layout, full slot reservation table, selection channel, composer-takeover approvals, phased scope docs(gui): layout dynamics ruled (drag+collapse both rails, details yields first, composer swap-panel, same-component transition); toolviews promoted to named scope-aware registry docs(gui): P-I scope locked (details minimal, dual theme, chat-view, custom toolview sample); teammate dispatch plan — 6 owners by package, dependency-driven waves, contract arbitration docs(gui): P-I api-contracts (full inter-package API spec) + dispatch plan (T0 skeleton knife, 7-dev roster, task briefs, milestones) docs(gui): api-contracts v2 — scope tree in P-I, bundle loader + per-plugin CSS isolation in P-I, agent-scoped toolviews live, zustand engine, renames (SessionProvider/ObservableSnapshot/SessionBinding), router owns all shell view-state docs(gui): services roster + progressive loading (no blocking loadAll), SlotsService as real cordis Service, renderSlot/renderSuspenseSlot duo, ui-traj teammate docs(gui): loading-chain gaps ruled — dev=rebundle no HMR, ui-primitives package, externals on globals (no import map), host injects __DSH_BOOT__ into HTML (zero round-trip) docs(gui): api-contracts v3 + dispatch v2 final — 12 packages, services merged in, progressive loader, global externals, __DSH_BOOT__ injection, 8-dev roster with convo split and ui-traj docs(gui): v3 amendments — router renamed ctx.layout, ui-trajectory has no service (pure consumer sample), wait-for-settled loading (no Suspense in P-I, ledger 6b) chore(gui): progress — pre-compact final state: v3 revision chain, 8-dev roster, T0 procedure, doc authority order docs(gui): authority banners — modules/architecture get v3 term-mapping headers, walkthrough marked as archived process doc docs(gui): cssdesign token set is THE theme source (--dsw-* variables, data-ds-dark-theme switch); recorded in contracts + progress docs(gui): architecture.md full v3 rewrite — loading chain, 12-package map, service roster, slot/inject/toolviews, data flow, component tree, perf model, all current docs(gui): contracts — UI plugins are dual-entry host plugins (node half serves client asset via ctx.webPlugins; __DSH_BOOT__ derives from it; client-closure gate back in scope) docs(gui): contracts — closure-factory bundles with DI require (no globals), package.json dshWeb declarative discovery (no serve ritual), create-then-send empty state with project picker, ancestry() for breadcrumb, unload stubbed until HMR, props.renderSlot confirmed docs(gui): dshClient declaration (inject/platform/immediately, exports./client), closure-DI require loading — synced across contracts/dispatch/modules/architecture/walkthrough chore(gui): progress — record final loading-chain rulings (dshClient declaration, closure-DI require, startSession) before compact docs(gui): architecture.md — developer-facing whole-web architecture on master baseline 6b16a67cb: what exists, what is new, no process narrative docs(gui): architecture.md — self-contained whole-web architecture: absorbs still-valid substance from the branch RFCs (host layering, four-quadrant RPC, object layer, testing tiers) under the new plugin system as the override chore(gui): progress — final pre-compact snapshot: contracts digest, apiproxy purity ruling, T0 procedure with first-action list docs(gui): api-contracts v3 §3.1 — apiproxy purity principle with three-way existing-code verdicts docs(gui): api-contracts v3 — immediately reinterpreted as static-infra group (8-package dshClient scope, boot manifest reconciliation) docs(gui): api-contracts v3 — immediately corrected to early-load dynamic group (prod shell must not rebundle); loader shell-held; bundles register their export surface into module table docs(gui): architecture — align with immediately=early-load dynamic group ruling; loader shell-held; module-table registration of loaded bundles docs(gui): T0 checklist — 12-package skeleton table, 4-cut sequence, mv/attic/rewire rules (pre-drafted, awaiting go) docs(gui): t0-checklist — pin figma-flows findings (missing font-family base vars, three alias vars behind upstream) docs(gui): dispatch v2.1 — drop cordis-web salvage wording, two-wave staffing, loader/immediately boundary updates docs(gui): progress + t0-checklist ledger — T0 landed, staffing status, execution accounting docs(gui): api-contracts v3 — arbitration round 1: renderBody deps, RootBindingProvider, flush default sync, prune current, loader subpath, config-source P-I bar docs(gui): v3 §3.2 connection 导出清单附录(rt-core 对账)+ rt-core 实现计划档案 docs(gui): progress — T1 milestone, arbitration round 1 ledger, fw-react timeout escalation docs(gui): progress rolling update — per-line battlefield state at 00:2x, mailbox-vs-contract lesson, small-batch discipline reinforced docs(gui): fw-react notes — v3 §2 complete, seven knives, T1/T2 follow-ups docs(fw-slots): archive — four packages landed, open tails logged docs(gui): progress — framework layer complete (web-react five, fw-slots four packages), T2 gated on rt-core runtime knife only docs: api-contracts docs: style-spec docs docs(gui): tsconfig convergence ruling — no host.json, root resumes host-aggregate duty, typecheck = root + client aggregates docs(gui): missions 根三份 07-18 世代档案加「已被取代」头注——指向 web-plugin-rfc 现行权威并注明新旧对应 missions docs(gui): progress rewritten for post-closeout state — wave ledger, architecture finale, teammate roster with handover notes, pending-user-command queue
7.9 KiB
7.9 KiB
OOP 债务清查(GUI 分支七属地,零改码纯清单)
- 时间:2026-07-21 02:10(arch-carrier)
- 口径:扫描当前 GUI 相关代码的闭包工厂 / plain-object 面 / 散函数组;判断标准——有状态生命周期或多方法共享内部状态 = 该 class 化;纯数据/纯函数/单入口闭包 = 不该,不为 OOP 而 OOP。架构红线见 missions/conventions.md 14(store 无业务对象 + OOP 对象层)。
- 范围:apps/cli、apps/web、packages/client/web-runtime、packages/client/web-ui、packages/host/apiproxy、packages/host/runtime、packages/host/webserver。
- 已是 class 的不列(清点确认合规):ConnectionController、SessionManager、Session、Notifier、PartialAccumulator、FoldAdapter、AbstractApiClient、InProcessApiClient、WebApiClient、FixtureApiClient、FxInbox、FrameQueue。
清单
该 class 化(2 处)
| # | 文件:行 | 现形态 | 判断依据 | 建议时机 |
|---|---|---|---|---|
| 1 | packages/host/runtime/src/api-proxy.ts:221 createApiProxy |
闭包工厂:206 行工厂体返回 plain-object ApiProxy;闭包态 resumes 去重表(:224)、agentOptions;内嵌 assertServable/agentFor(:233/:240);mux 流内再挂 openCalls 表(:367) |
有状态生命周期(resume 去重、per-stream call 表)+ 多方法共享闭包态,且 respond 落地还要加 pending registry(:421 TODO)——状态只会更多 | 已排期:R7 台账绑 respond 实施窗口(progress.md P1-5「审批 respond + 顺势 createApiProxy 升 class」)。升级时:paginate/viewFor/backscanArgs/summarize* 保持纯函数;FrameQueue 保持独立类;SessionNotFound、resumes、未来 pending registry 收进 class |
| 2 | packages/client/web-runtime/src/fixture.ts:236 createFixtureApi |
大型闭包工厂(~240 行工厂体):闭包态 sessions/logs/nextTurn/nextRpc/replays/muxConns/hostConns/streamBreakers/timing 标志(:237-301);timing hooks 经 globalThis 后门外挂(:329) |
状态最重的一处:十余项可变闭包态被 list/create/history/prompt/cancel/两条流/timing hooks 共享,完全符合「该」标准 | 绑既有计划,不单开窗口:fixture.ts:480 注释已锁定去向——迁移同构管道(InProcessApiClient over toFetchHandler(fixtureImpl))时重组;届时把工厂重写为 FixtureHost class(fake 域状态 + timing hooks 成员化,去 globalThis 后门),FixtureApiClient 子类整体删除。fixture 非产品面,优先级低于 #1 |
不该 class 化(判断留档,防止后续「顺手 OOP」扩大化)
| # | 文件:行 | 现形态 | 不改依据 |
|---|---|---|---|
| 3 | packages/host/apiproxy/src/fetch/handler.ts:145 toFetchHandler |
闭包工厂返回 {fetch} |
无闭包态(仅捕获 api 引用),纯适配器;UNARY_ROUTES/sseResponse/handleUnary 均纯函数或常量表 |
| 4 | packages/host/webserver/src/index.ts:49 startWebServer |
闭包工厂返回 plain-object RunningWebServer;闭包态仅 closing 幂等档 |
生命周期只有 listen→close 两拍、单一 close 方法,class 化零收益;将来若加连接管理/重启再议 |
| 5 | packages/client/web-runtime/src/rpc-log.ts:34 createEnvelopeIngest |
闭包工厂:nextId+inflightMethods 相关性状态 |
单入口(只返回一个 listener 函数),闭包即实例;per-instance 隔离(audit C4)闭包已保证 |
| 6 | packages/client/web-runtime/src/intents.ts:5 模块级 let api + bindIntents/散函数 intent 组 |
模块单例 + 命令函数面 | intent 即命令面,设计如此(选中态不进 store、导航归容器);web-cordis 迁移时并入 ctx 体系(events.ts 已预置 WEB_EVENTS 词表),现在 class 化是反向工程 |
| 7 | packages/client/web-runtime/src/boot.ts:25,33 bootWebRuntime + 模块级 prevHandle |
装配函数 + HMR 防重入档 | 一次性装配(挑 api→接 tap→绑 intent→起 controller);prevHandle(audit C8)在 cordis 迁移后由 ctx dispose 自然取代 |
| 8 | packages/client/web-runtime/src/session/manager.ts:255-275 模块单例 instance + initSessionManager/getSessionManager |
模块级单例存取器 | 文件头已裁定「module-level Manager singleton is legitimate」;fail-loud 存取符合门禁口径 |
| 9 | packages/client/web-runtime/src/store.ts:38 zustand vanilla 单例 |
plain store(rpcLog/ui/connection 三 slice) | 正是红线 14 的合规形态:纯呈现 slice、无业务对象;不动 |
| 10 | packages/client/web-runtime/src/session/lineage.ts:24、conversation.ts、partial.ts:82、api.ts:31,41 |
纯函数 + 纯类型层 | flattenLineage/toAssistantBlocks/resultOf/transportError 全部无状态纯函数;ConversationNode 族是快照数据契约(红线 16 的 props 面),plain object 是设计而非债 |
| 11 | packages/host/apiproxy/src/api/*(rpc.ts、sessions.ts、events.ts、*.schema.ts、rpc-map.ts) |
类型契约 + zod schema + 常量表 | 契约层零运行时状态;RpcId() 品牌构造是既定精工(brand 惯例) |
| 12 | packages/host/runtime/src/boot.ts:83 bootHost、start.ts:52 startHost |
装配函数返回 plain-object handle;disposing ??= 幂等档 |
一次性组合(装插件→拼 ApiProxy→拼 handler),无持续内部状态;handle 形状(api/handler/ctx/dispose)是跨 shell 契约,class 化不增义。#1 升 class 后 startHost 仍是工厂,不连坐 |
| 13 | packages/host/webserver/src/index.ts:87 bridge、static.ts:28 serveStatic |
per-request 散函数 | 每请求一次性执行,无跨调用状态 |
| 14 | apps/cli/src/bin.ts、web.ts:13 runWeb、headless.ts:68 runHeadless;apps/web/src/main.ts |
进程入口散函数(runWeb 内 exiting/shutdown 闭包) |
进程级一次性脚本,闭包幂等档足够;shell 按约不承载装配逻辑 |
| 15 | packages/client/web-ui/src/components/**(全部组件)+ hooks/* |
纯 props 组件 + 逻辑层 hooks | 红线 16:组件是耗材,展示面无 OOP 诉求;hooks(useConversation/useSessionList)是对象层→React 的既定桥形态 |
| 16 | packages/client/web-ui/src/components/conversation/toolCardRegistry.ts:20 模块级 Map registry |
plain 模块注册表(get/register 两函数共享一张 Map) | 文件头已锁定去向:future cordis tool-ui registry 的挂载点(toolcard-wire 设计 deferred 行 1);迁移时换成 ctx.effect 注册表,现在 class 化白做一遍 |
| 17 | packages/client/web-ui/src/utils/theme.ts 散函数组 |
resolveInitialTheme/applyTheme/toggleTheme | 状态在 DOM 属性 + localStorage,模块自身无状态;Settings 页面落地时随迁 |
改造优先序建议
- 专门窗口(已排期,照旧执行):#1
createApiProxy升 class——唯一的产品面真债,绑 respond 实施窗口(P1-5),pending registry 一起进 class,一次到位。 - 绑既有计划顺势做(不单独排期):
- #2
createFixtureApi→ fixture 同构管道迁移刀(fixture.ts:480 既定去向)里重组为 class,顺带消 globalThis timing 后门; - #6/#7/#16(intents 模块态、boot prevHandle、toolCardRegistry)→ web-cordis 迁移窗口自然消解,迁移前不动。
- #2
- 不值得改(防扩大化定论):#3-#5、#8-#15、#17——纯函数/纯契约/单入口闭包/一次性装配/纯 props 组件,全部维持现形态;后续若有人提「顺手 class 化」,以本表依据挡回。
总结:七属地 OOP 纪律整体良好——对象层(Session/SessionManager/ConnectionController/Notifier/FoldAdapter/PartialAccumulator)和载体层(AbstractApiClient 族)已全部 class 化,store 保持纯呈现 slice。真债只有 2 处且均已有归宿:产品面 1 处(createApiProxy,已排期),fixture 面 1 处(绑迁移计划)。