feat(coding): complete PI conversation UI

This commit is contained in:
2026-08-24 08:59:16 +08:00
parent 2613d6530b
commit 863f005203
21 changed files with 2040 additions and 137 deletions

View File

@@ -0,0 +1,126 @@
# Task: Implement PI-130 feature-complete Coding UI
## Identity
- Task ID: 20260824-pi-feature-ui-9d4e7a31
- Mode: Feature
- Branch: codex/20260824-pi-feature-ui-9d4e7a31-pi-feature-ui
- Worktree: D:\Datas\OthersProjects\makelore-pi-feature-ui-9d4e7a31
- Base commit: 2613d6530b2b19d43f85398af47fccf6cc483116
- Owner: codex-root
- Status: Ready for Integration
## Scope
- Implement PI-130's feature-complete Coding UI on top of the PI-080/090/105/120 Host API and Conversation runtime contracts.
- Add conversation-scoped model and thinking controls, prompt/steer/follow-up queue controls, abort/compact/recover actions, and queue/run/context status.
- Render pending interactions, retry/compaction state, nested subagent graphs, tool details, changes, files, browser attachments, skills, commands, and diagnostics without reviving removed OpenCode product surfaces.
- Add conversation title/archive/unread/fork management. The fork action must be labelled `从这里创建新对话分支` and must not imply file rollback.
- Add focused Renderer/store tests and Electron E2E coverage for retained and explicitly removed UI behavior.
- Keep PI-140 source/dependency removal and PI-150 macOS verification outside this task.
## Intent And Constraints
- The planner task `codex://threads/01a0202d-abd3-7851-b7e7-6ca8ccdbb702` remains the authority for PI ordering, ticket acceptance, and final state transitions; this worktree is the PI-130 executor.
- Renderer backend access must remain behind `src/lib/host-api.ts` or `src/lib/api-client.ts`; Electron Main continues to own runtime, credentials, providers, synchronization, and system integration.
- Conversation model/thinking state is independent from partner defaults and isolated across simultaneously streaming Conversations.
- Queue release follows `agent_settled`, not `agent_end`; retry/compaction and interaction states must expose waiting, cancellation, stale, and failure outcomes without leaking raw compaction details.
- Do not add share/unshare, todo, global runtime, revert/unrevert, direct IPC, direct local-runtime HTTP, dark theme, compatibility wrappers, or incidental Agent/OpenCode template refactors.
- Real Provider validation remains explicitly waived with accepted concurrency, credential-isolation, and protocol-compatibility risk; `realTurnVerified` stays false and must never be reported as Pass.
- macOS x64/arm64 verification remains deferred to mandatory PI-150 and must never be reported as Pass in PI-130.
- Preserve unrelated user work and do not write to the main or planner worktrees.
## Project Context Loaded
Task context:
- Task ID: `20260824-pi-feature-ui-9d4e7a31`
- Mode: `feature`
- Branch: `codex/20260824-pi-feature-ui-9d4e7a31-pi-feature-ui`
- Worktree: `D:\Datas\OthersProjects\makelore-pi-feature-ui-9d4e7a31`
- Base commit: `2613d6530b2b19d43f85398af47fccf6cc483116`
- Other active local tasks: provider/model parity, Codex compaction review, generic client error tracing, Canvas E2E design, account lifecycle exploration, museum/media reviews, main model-switch integration, design delta/freeze audits, and this task.
- Overlap or semantic-conflict assessment: the only adjacent peer is provider/model parity and it declares no claimed files or concrete scope. The main integration task owns the main worktree only. Other peers are unrelated or read-only. Unknown-scope peers remain a coordination risk, but no declared semantic conflict changes this plan; all writes remain isolated in this task worktree.
Read:
- `.project-docs/05-agent-entry/read-before-planning.md`
- `.project-docs/05-agent-entry/planning-gate.md`
- this active task record
- `.project-docs/05-agent-entry/memory-index.md`
- `.project-docs/30-worklog/current-state.md`
- `.project-docs/00-brief/project-positioning.md`
- `.project-docs/00-brief/success-criteria.md`
- `.project-docs/10-decisions/decision-index.md`
- `.project-docs/20-architecture/system-overview.md`
- `.project-docs/20-architecture/module-map.md`
- `.project-docs/20-architecture/data-flow.md`
- `.project-docs/40-domain/business-rules.md`
- `.project-docs/40-domain/glossary.md`
- `.project-docs/50-evidence/evidence-index.md`
- `.project-docs/60-reflection/reflection-index.md`
- `.project-docs/80-commitments/commitments.md`
- `.project-docs/90-maintenance/stale-items.md`
- `.project-docs/30-worklog/tasks/20260823-pi-chat-timeline-c8f31a62.md`
- planner-owned PI runtime cutover spec, tickets, and coordination task record.
Relevant understanding:
- Project goal: ship Makelore Code as a local, project-scoped, vendor-neutral Conversation product backed by Electron Main-owned runtime and Host APIs.
- Current integrated focus: PI-120 completed the first-chat timeline/composer shell; PI-130 is the only planner-approved Ready Frontier.
- Active task scope: complete the Coding UI capability surface and its focused verification without doing PI-140 source removal or PI-150 platform closure.
- Active constraints: Main owns runtime/providers/secrets; Renderer uses approved facades; no legacy share/todo/global-runtime/revert product surface; no direct IPC/HTTP; single light visual system.
- Decisions affecting this task: Conversation-scoped model/thinking, queue release on `agent_settled`, stable interaction and `subagent.v1` contracts, tool results nested in timeline entries, compacted summaries without raw-detail leakage, and branch wording without rollback semantics.
- Evidence, reflections, or commitments affecting this task: Real Provider verification is explicitly waived with accepted concurrency/credential/protocol risk; macOS verification is deferred and neither may be represented as Pass.
- Files or modules likely involved: `src/pages/Chat/Coding*`, `src/stores/coding-*`, `src/lib/coding-*`, shared Coding contracts, focused unit tests, and `tests/e2e/pi-coding-first-chat.spec.ts`.
- Unknowns, stale docs, or conflicts: several active peer records still have undefined scope; project positioning is a placeholder; no conflict was found between integrated architecture, the planner ticket, and the user request.
Gate result:
- Passed.
## Plan
1. Extend vendor-neutral Renderer facades and stores for conversation metadata, runtime controls, interactions, diagnostics, model/thinking, compact/recover, and fork.
2. Add focused UI modules for conversation controls, queue modes, interaction responses, timeline retry/compaction/tool/subagent details, and conversation management.
3. Add the project tools inspector for changes, file preview/search, browser attachments, skills, and commands while preserving the Main-owned boundaries.
4. Add focused unit/store/UI tests and Electron E2E assertions for both retained capabilities and removed legacy entry points.
5. Run typecheck, relevant tests, lint, production Vite build, and scoped Electron E2E; record explicit Real Provider/macOS verification exceptions.
6. Complete the Task Documentation Gate, commit the executor branch, request planner review, and close PI-130 only after planner acceptance.
## Outcome
- Added vendor-neutral Renderer facades for abort, Conversation model/thinking, compact, recover, fork, interactions, diagnostics, and Conversation metadata mutation.
- Added Conversation-scoped model/thinking controls, run/retry/context status, compact/recover/abort actions, title/archive/unread/fork management, and active/hidden Conversation indicators.
- Added prompt/steer/follow-up composer modes with queue position and wait state. Direct prompts remain idle-only; steer/follow-up remain running-only; pending interactions and uncertain requests block conflicting sends.
- Added select/confirm/input/editor interaction cards with cancellation, stale-response feedback, and Conversation-scoped refresh.
- Extended the timeline with explicit thinking state, tool-detail renderers, inline tool results, browser attachment previews, safe compaction retry/settled language, and `subagent.v1` single/parallel/chain graphs with error/abort/skipped states.
- Added a Coding tools sheet for Conversation changes, project file find/content preview, browser attachments, skills, commands, and runtime diagnostics. Commands can be inserted into the selected Conversation draft.
- Replaced rollback-like branch language with `从这里创建新对话分支`; no file rollback behavior or implication was added.
- Kept share/unshare, todo, global runtime, revert/unrevert, direct IPC, direct runtime HTTP, and legacy OpenCode imports out of the new Coding UI.
- Windowed streaming thinking DOM output to the latest 16 KB while streaming, restoring the complete text when settled; this keeps the existing REN-008 100 KB pressure budget passing without changing the protocol or test threshold.
- Updated `README.md` to describe the now-shipped Coding UI state and retained the explicit unverified shared Provider/runtime concurrency boundary.
## Verification
- `pnpm run typecheck` — Pass.
- `pnpm run lint:check` — Pass with 0 errors and 6 pre-existing warnings outside PI-130-owned files.
- Focused PI-130 Vitest coverage — Pass, including facade routes, queue modes/positions, interactions, Conversation controls, metadata isolation, nested subagents, compaction retry, inline tool output, fork wording, and removed UI entries.
- `pnpm test` — Pass: 219 files; 2328 tests passed; 2 skipped.
- `pnpm run build:vite` — Pass as part of the scoped Electron E2E command; only existing Vite chunk/dynamic-import warnings were reported.
- `pnpm run test:e2e -- tests/e2e/pi-coding-first-chat.spec.ts` — Pass: 2/2, covering first-Conversation editability, two Conversation isolation, queue, interaction, model, abort, subagent, files/changes/commands tools, and removed share/revert/todo/global-runtime entries.
- `git diff --check` — Pass.
- New Coding UI boundary scan for `/api/opencode`, direct IPC/loopback access, share/unshare, todo, global runtime, and rollback UI — Pass.
- Real Provider validation — `Explicitly Waived / Accepted Risk`; concurrency, credential isolation, and protocol compatibility remain accepted risks. `realTurnVerified=false`; not Pass.
- macOS x64/arm64 validation — Deferred to mandatory PI-150; not Pass.
## Follow-ups
- PI-140 remains responsible for deleting the old OpenCode Renderer/Main/Preload sources, routes, dependencies, and packaged legacy runtime surface after PI-130 integration.
- PI-150 remains responsible for mandatory macOS x64/arm64 verification and final release closure.
- Planner review must decide the PI-130 Done transition and the next Ready Frontier; this executor does not change planner-owned ticket state directly.
## Promotion Candidates
- Target canonical document: planner-owned `20260822-pi-runtime-spec-b6e2c9a4__pi-runtime-cutover-tickets.md` and planner coordination task.
Proposal: after planner review of the executor commit, mark PI-130 Done and evaluate PI-140 as the next Ready Frontier.
Evidence: the executor commit from this task plus the verification results above.
Future impact: enables old OpenCode product-source removal without leaving retained capabilities absent from the new Coding UI.
Semantic conflicts: Real Provider remains explicitly waived and macOS remains deferred; neither may be promoted to Pass. No conflict with the hard-cut architecture or PI-140 ownership was found.
Human confirmation required: yes, planner acceptance is required for the PI state transition.