feat(coding): nest Conversations under Agents

This commit is contained in:
2026-08-25 16:34:11 +08:00
parent c4ca16fa19
commit 45d933732a
5 changed files with 238 additions and 64 deletions

View File

@@ -0,0 +1,100 @@
# Task: Nest Conversations under the selected Agent
## Identity
- Task ID: 20260825-agent-conversation-tree-4d8a2c71
- Mode: Feature
- Branch: codex/20260825-agent-conversation-tree-4d8a2c71-agent-conversation-tree
- Worktree: D:\Datas\OthersProjects\makelore-agent-conversation-tree-4d8a2c71
- Base commit: c4ca16fa198a1e5a90bd1b72bf0cee22f6ee1baa
- Owner: codex-root
- Status: Done
## Scope
- Change the Makelore Code sidebar so the selected Agent is the visible parent of its Conversations instead of rendering separate sibling `伙伴` and `对话` sections.
- Preserve the existing `agentId` ownership/filtering, Conversation selection, lazy first-Conversation creation, unread/running indicators, and new-Conversation action.
- Add focused Renderer coverage and an Electron E2E assertion for the hierarchy; do not change project metadata, Host APIs, Pi runtime, or user data.
## Intent And Constraints
- Render each Agent as a collapsible parent row. Only the selected Agent expands, and its Conversation list is placed immediately beneath it with a clear `${agent.name} 的对话` label.
- Keep all existing interactive hit areas at least 40px and retain the product's single light visual system, exact-property press transitions, and current button semantics.
- Do not add a compatibility layer, new state model, animation dependency, or Agent/Conversation migration. The persisted relationship is already correct.
- The user requested direct implementation without subagents.
## Project Context Loaded
Task context:
- Task ID: `20260825-agent-conversation-tree-4d8a2c71`
- Mode: feature
- Branch: `codex/20260825-agent-conversation-tree-4d8a2c71-agent-conversation-tree`
- Worktree: `D:\Datas\OthersProjects\makelore-agent-conversation-tree-4d8a2c71`
- Base commit: `c4ca16fa198a1e5a90bd1b72bf0cee22f6ee1baa`
- Other active local tasks: eleven non-ready owners were inspected through their task records.
- Overlap or semantic-conflict assessment: the only adjacent task is the older undefined `partner-create-model-parity` diagnosis. This task does not change partner/model semantics or its files; the old Main OpenCode integration and all Canvas/Robot/Learning tasks are unrelated. No semantic conflict blocks this UI-only change.
Read:
- `.project-docs/05-agent-entry/memory-index.md`
- `.project-docs/05-agent-entry/read-before-planning.md`
- `.project-docs/05-agent-entry/planning-gate.md`
- `.project-docs/00-brief/project-positioning.md`
- `.project-docs/00-brief/success-criteria.md`
- `.project-docs/30-worklog/current-state.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`
- Diagnosis record `20260825-conversation-agent-binding-8a4c2e71` and PI-120/PI-130 implementation records.
Relevant understanding:
- Project goal: keep Makelore Code local and project-scoped, with Renderer access through typed facades and Main ownership of runtime and secrets.
- Current integrated focus: the live cumulative source is the Pi hard-cut product; shared canonical memory still contains stale OpenCode-era module descriptions.
- Active task scope: improve only the Agent → Conversation visual hierarchy in `CodingChatPanel`.
- Active constraints: no runtime/API/storage changes; preserve all target isolation and selection behavior.
- Decisions affecting this task: Conversation metadata is Agent-owned through mandatory `agentId`; only the selected Agent's unarchived Conversations are rendered.
- Evidence, reflections, or commitments affecting this task: installed `testgame` has two Conversations both uniquely owned by `ccc`; no orphaned metadata exists. No shared commitment changes this UI work.
- Files or modules likely involved: `src/pages/Chat/CodingChatPanel.tsx`, `tests/unit/coding-chat-panel.test.tsx`, and `tests/e2e/pi-coding-first-chat.spec.ts`.
- Unknowns, stale docs, or conflicts: canonical project positioning is a placeholder and module map is OpenCode-stale; current source plus Pi task records are authoritative. No unresolved behavior conflict remains.
Gate result:
- Passed.
## Plan
1. Add a focused failing Renderer test that requires the selected Agent to expose an expanded child Conversation group and hides another Agent's Conversations.
2. Move the existing Conversation header/list/create/loading block inside the selected Agent's rendered group, using a parent surface plus an indented child rail without changing selection or creation logic.
3. Add a small production-seam E2E assertion for the visible Agent-owned group, then run focused tests, typecheck, lint, `build:vite`, and the applicable Electron E2E.
4. Update this task record with actual outcome and verification, run the documentation gate, and commit only task-owned changes.
## Outcome
- Replaced the sibling `伙伴` / `对话` sidebar sections with one `伙伴与对话` hierarchy.
- Each Agent is now an accessible expandable parent row. The selected Agent uses a concentric selected surface, expanded chevron, `aria-expanded`, and an immediately nested child group labelled `${agent.name} 的对话`.
- Moved the existing Conversation rows, create action, first-Conversation loading indicator, unread marker, and run spinner into the selected Agent's child group without changing any state, API, storage, or runtime behavior.
- Kept unselected Agents collapsed, so a Conversation cannot visually appear at project level or under another Agent.
- Updated `README.md` to describe the nested Agent-owned Conversation list.
## Verification
- Red phase: the new hierarchy regression failed against the prior sibling layout while the other 15 `coding-chat-panel` tests passed.
- `corepack pnpm exec vitest run tests/unit/coding-chat-panel.test.tsx --maxWorkers=1`: passed, 1 file / 16 tests.
- `corepack pnpm run typecheck`: passed.
- `corepack pnpm run lint:check`: passed with 0 errors and 5 pre-existing warnings outside the changed files.
- `corepack pnpm run build:vite`: passed; existing dynamic-import and chunk-size warnings remain.
- `corepack pnpm test`: passed; functional stage 179 files / 1523 passed / 2 skipped, isolated pressure stage 1 file / 1 passed.
- `corepack pnpm exec playwright test tests/e2e/pi-coding-first-chat.spec.ts`: passed, 2/2. The production Renderer seam asserts the expanded `Builder` parent, nested `Builder 的对话` group, first Conversation, and second-Conversation selection inside that group.
## Follow-ups
- A rebuilt installer is not part of this UI source task; package from this commit only when the user requests a new installer.
## Promotion Candidates
- None recorded.