Files
makelore/.project-docs/30-worklog/tasks/20260922-coding-teacher-client-4b901ae7.md

58 lines
6.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Task: Implement project conversations and cloud coding teacher
## Identity
- Task ID: 20260922-coding-teacher-client-4b901ae7
- Mode: Feature
- Branch: codex/20260922-coding-teacher-client-4b901ae7-coding-teacher-client
- Worktree: D:\Datas\OthersProjects\.codex-worktrees\makelore\20260922-coding-teacher-client-4b901ae7
- Base commit: 2f82b9f79cf72873d75c17a48853292323aa5df5
- Owner: codex
- Status: Ready for Integration
## Scope
- Implement the approved project-owned conversation navigation, automatic default coding Agent, Main-owned cloud teacher side chat and Operations draft preview deep link; own related shared/Main/Renderer modules, focused tests and README.
## Intent And Constraints
- Concurrent Task Gate Passed using the loaded maintain-project-docs bundled scripts. Owner/task/mode/absolute worktree/branch/base match. Primary main has unrelated untracked records and was not adopted.
- Planning Gate Passed. Read entry, memory index, own record, positioning/current-state, decisions, architecture/domain/success criteria, evidence/reflection/commitments/stale context. Positioning remains a template; README, accepted ADRs and executable code establish the product boundary. Read 122 peer records; 17 incomplete scopes remain unknown, with no concrete blocking dependency. Conversation controls and native model capabilities are already integrated in the verified base.
- User approved the server task detailed-design proposal and implementation. Preserve historical Agent IDs and Pi bindings; teacher is independent instruction-only chat with no tools, using current account model gateway. No subagents, deployment, actual paid model calls or canonical project-memory writes.
- Related server task: 20260922-coding-teacher-design-96daf1e0 at D:/Datas/PythonProjects/.codex-worktrees/works-square-server/20260922-coding-teacher-design-96daf1e0.
## Outcome
- 新项目直接创建一个内部默认编程智能体,配置保存 defaultAgentId;可用全局默认模型复制到新项目,否则保持 required。旧项目优先选择已存默认/置顶/首个可用 Agent,保留所有原 ID、提示词、Skills 与 Pi 会话绑定;不重新启用停用或归档 Agent。
- 删除手动 Agent 创建弹窗及中间 Agent 会话侧栏。项目下统一列出该项目全部会话,保留改名、归档/恢复、运行状态和未读。打开项目不自动建会话;首次发送和显式新建才创建。慢 Snapshot 不阻塞发送,切换项目按用户请求顺序持久化并丢弃旧读取,首发草稿与附件归属原会话。
- 项目设置直接编辑默认编程配置;会话菜单保留历史绑定配置入口。停用 Agent 的会话通过 durable active-branch reader 查看历史,不启动 worker。
- Main 新增老师云配置客户端、文本上下文组装、直接模型网关调用、账号/项目/来源会话隔离的 JSON 话题存储、请求串行与去重、取消、重启中断、来源删除清理、Host API/SSE 和后台任务 lease。老师无 Pi worker、无工具、不读 thinking/tool 参数或其他来源上下文。
- 话题固定发布版本,每次新问题检查在线启停。先落盘 requestId 再调用模型;同 ID 相同输入读取原结果,不同输入冲突。关闭面板或 SSE 不停止模型,退出账号中止;发送失败保留输入,写盘失败提示复制/重试保存。
- 主标题栏“问老师”打开右侧独立面板,支持显式文本引用、历史话题、停止回复、复制和追加主草稿;不自动发送主会话。多行主草稿展开至最多 6 行,便于查看带回内容。
- 支持精确 draft_revision 的 niancode 深链接、冷启动待处理链接与运营试聊页,要求当前账号 admin;示例上下文不读取学生项目。
- README 同步当前项目、默认 Agent、会话与老师行为。未改动其他任务目录或 canonical memory。
## Verification
- `pnpm exec vitest run tests/unit/coding --exclude tests/unit/coding-chat-pressure.test.tsx --maxWorkers=4`:368 passed;之后新增 durable 分支历史和真实本地 HTTP/SSE 用例,老师专项共 15 passed,老师/工作区切换专项 23 passed。老师 UI 专项 3 passed。
- 桌面 Playwright:归档/恢复、首发 <500 ms 可编辑且无需等待 Snapshot、Windows 标题栏、老师提问/带回草稿四个场景全部通过;多行草稿显示调整后老师场景再次通过。测试使用隔离 Electron profile 与受控 Host/模型响应,无真实付费调用。
- 目视检查桌面截图:项目直接显示会话,无中间智能体列;右侧老师聊天与主输入分离,标题栏按钮没有侵入 Windows 窗口控件。
- `pnpm run typecheck` 与本次变动 TypeScript/TSX 的 ESLint 通过。`pnpm run build:vite` 成功,包含 Renderer/Main/Preload/utility worker。
- 补充 `tsc -p tsconfig.node.json --noEmit --composite false` 仍有 66 项既有 Main 诊断。用独立临时目录从精确基线 git archive 提取源码并复用同一依赖验证,基线 67 项;触及的 createConversation 参数签名修正消除一项,其余现有诊断未扩展到老师模块。此项不宣称全绿。
- 检查起点以来改动、task-aware 文档 drift 和暂存 diff;只提交本人源码、测试、README 与任务记录,不提交 dist、test-results 或 node_modules。
- 未做真实外部模型协议/余额扣费、生产发布与跨设备历史同步;当前老师数据保存在本机。
## Follow-ups
- 配套合入 server 任务 20260922-coding-teacher-design-96daf1e0,迁移并发布/启用运营配置后开展真实模型计费验收。代码在两仓独立 worktree,本轮没有合入主分支或部署。
- 当前 Main 扩展类型检查基线问题保留为独立维护事项,不能把本次产品构建与 Renderer typecheck 通过解释为整个 Main 严格检查通过。
## Promotion Candidates
- Target: 项目/对话 ADR、20-architecture 与业务规则。
- Proposal: 项目直接拥有会话导航;defaultAgentId 仅表示内部默认执行配置,历史绑定不变。教师定义由 WS 运营维护,Main 使用独立无工具文字聊天与当前来源上下文。
- Evidence: 用户明确批准的新设计、配套 detailed-design、上述默认配置/历史/服务/界面测试及 4 项桌面 E2E。
- Future impact: 创建项目与会话路径缩短,同时保留历史 Pi 恢复、插件资源和原生模型控制合同。
- Semantic conflicts: 替换旧手动 Agent 创建、Agent 下会话分组与空 Agent 首开自动建会话;不改变个人云智能体、绘画或硬件模块。
- Human confirmation: 用户已批准行为变更及实施;canonical promotion 由后续集成任务完成。