diff --git a/.project-docs/30-worklog/tasks/20261008-merge-work-preview-4b72e9c1.md b/.project-docs/30-worklog/tasks/20261008-merge-work-preview-4b72e9c1.md new file mode 100644 index 00000000..382fa454 --- /dev/null +++ b/.project-docs/30-worklog/tasks/20261008-merge-work-preview-4b72e9c1.md @@ -0,0 +1,72 @@ +# Task: Update trial and merge first-open work preview fix + +## Identity + +- Task ID: 20261008-merge-work-preview-4b72e9c1 +- Mode: Feature +- Branch: codex/20261008-merge-work-preview-4b72e9c1-merge-work-preview +- Worktree: /Users/chillishark/Makelore 麦洛/.codex-worktrees/makelore/20261008-merge-work-preview-4b72e9c1 +- Base commit: d12d214d7f33d6233187f66f592d00ee58ec02f7 +- Owner: codex +- Status: Ready for Integration + +## Scope + +- Update the independent temporary app to source d12d214, fast-forward main, push origin/main, and clean this change's source and merge worktrees while retaining branches/commits. + +## Intent And Constraints + +- User explicitly authorized all four actions and cleanup. Preserve the installed app, its profile and drafts, other task worktrees, and existing global integration lock. +- Previous trial root was deleted externally; rebuild an independent trial in a stable user-local folder. Copy only project metadata and ordinary settings; no auth/Chromium database/lock copying. New trial requires normal login. + +## Project Context Loaded + +Task context: +- Identity fields above verified against official start/status; feature mode, base d12d214. +- Integration-mode start was rejected by the old classroom-integration lock; it rolled back ownership but left its newly created clean worktree. Official feature claim succeeded on that clean checkout (managed=false). No canonical document changes are planned. +- 28 peer owner records inspected read-only through registered paths; no new conflicting work. Source is ready and clean; primary main is clean. + +Read: +- Entry/read-before-planning, memory-index, own task and completed source task. +- Previously loaded positioning/current-state/decisions/architecture/domain/success/evidence/reflection/commitments remain byte-identical from fe1a377 to d12d214; reused that verified context. +- README/AGENTS and relevant temporary-app startup, profile, authentication and runtime boundaries reviewed. + +Relevant understanding: +- Goal: student creation app with Main-owned browser; this patch only pauses static welcome rendering on Work and restores it on chat. +- Source product/testing exactly as already verified: 103 unit cases (one unchanged async case passed on file retry), 18 browser cases, one Electron scenario, typecheck/lint/build. +- Fresh fetch: main and origin/main still fe1a377; source d12d214 directly descends from it, allowing conflict-free FF. +- Current running PID6483 is installed Makelore, not trial. Old trial directory no longer exists. Isolated new profile/ports allow trial without restarting installed app; login cannot be copied to unpackaged trial. +- Unknown: live account/game validation awaits user login; no model request will be sent for update validation. +- Cleanup covers only this source and merge checkout. Explicit user cleanup authorizes normal release/non-force removal for the worktree left unmanaged by the failed official start; branches/commits retained. The managed source uses official retire. + +Gate result: Passed. + +## Plan + +1. Stage the verified complete source/build and an independent Electron bundle outside disposable Git worktrees; open a fresh isolated trial and verify runtime/assets/UI. +2. Record the runtime outcome, commit this handoff record, fast-forward clean main and push; verify remote SHA. +3. Retire the managed source and clean the task-created merge checkout after checking no runtime dependency; retain both branches/commits. + +## Outcome + +- Source d12d214 is included in this handoff branch with no additional product/test edits. Clean main/origin-main at fe1a377 can fast-forward; the following publish step promotes this record together with the verified source. +- Rebuilt and opened the independent trial at `/Users/chillishark/Library/Application Support/Makelore Trials/work-preview-d12d214`. Source/archive and built Renderer/Main/Preload are independent of both disposable task worktrees; only dependencies link to primary repository node_modules. +- Trial PID38637, Host API port60966, debugger port60967, dedicated bundle ID and user-data. Normal authentication preserved (E2E skip-setup not enabled); trial is at the login screen and requires the user to sign in again. Project metadata/settings copied as stable validated JSON snapshots; no auth, passwords or Chromium database copied. Installed PID6483 remains running unchanged. +- Reopen using `打开临时应用.command` in the trial folder; `launch.json` records source/build/PID/ports, and the launcher reuses the running instance or allocates free ports on restart. +- User-approved cleanup covers only 20261008-work-first-open-8ac7e621 and this merge checkout, after successful remote verification. Both branches and their committed records remain retained; trial runtime files are outside their paths. Managed source uses official retire. The task-created merge checkout left by failed integration start uses official release then non-force Git removal because it was subsequently claimed as unmanaged; no registry flags or foreign lock are changed. + +## Verification + +- Fresh origin fetch: main=origin/main=fe1a377, d12d214 directly descends from it. Source/merge product, tests and README byte-identical; source verification remains applicable without redundant rebuilding. +- Source checks: typecheck/scoped lint/build, 103 unit cases (one unchanged async assertion required successful 17-case file retry), 18 browser layout cases, one real Electron fixture scenario; independent review passed. +- Staged trial dist (131 files) and dist-electron (8 files) match the verified source build byte-for-byte (SHA-256). Running page loads `assets/index-BhQqvIkX.js` from the independent trial path; normal Login button visible at `#/login`. +- Trial screenshot `/tmp/makelore-work-preview-trial-login.png`; launch metadata under the independent trial root. No model request or user project mutation performed for live smoke; real logged-in game acceptance awaits user sign-in. +- Task-aware drift check and git diff --check passed. Remote SHA and final cleanup eligibility are checked immediately during promotion/retirement; final receipts are reported to the user and captured in trial launch metadata. + +## Follow-ups + +- Sign in to the new trial to use account features. Installed-app session and its in-memory drafts remain available in the original process. + +## Promotion Candidates + +- Carry source task's welcome-visibility proposal for canonical integration later. Canonical files remain unchanged because the existing classroom integration owner retains the repository integration lock; this does not block the user-authorized code merge, push, or bounded cleanup. diff --git a/.project-docs/30-worklog/tasks/20261008-work-first-open-8ac7e621.md b/.project-docs/30-worklog/tasks/20261008-work-first-open-8ac7e621.md new file mode 100644 index 00000000..ea44e73a --- /dev/null +++ b/.project-docs/30-worklog/tasks/20261008-work-first-open-8ac7e621.md @@ -0,0 +1,74 @@ +# Task: Investigate and fix the first-open work preview layout + +## Identity + +- Task ID: 20261008-work-first-open-8ac7e621 +- Mode: Feature +- Branch: codex/20261008-work-first-open-8ac7e621-work-first-open +- Worktree: /Users/chillishark/Makelore 麦洛/.codex-worktrees/makelore/20261008-work-first-open-8ac7e621 +- Base commit: fe1a3775c5f785adaa6372bd7ea3102c79331656 +- Owner: codex +- Status: Ready for Integration + +## Scope + +- Fix the first-open Work preview being pushed below the entire teacher welcome group. Renderer visibility only; preserve native-preview overlay clearance for real messages and hover introductions. + +## Intent And Constraints + +- User confirmed: temporarily hide welcome introductions on Work, restore on Operation Chat. Do not persist dismissal or change the three-operation-round introduction lifecycle, unread receipts, consultation entry, or preview startup. +- No running-app update, main merge, push, or cleanup requested for this change. + +## Project Context Loaded + +Task context: +- Task ID / mode / branch / worktree / base: exactly as Identity above; official start and status ownership verification passed. +- Other local tasks: 27 peer owner records inspected by read-only reviewer through their registered paths; no active conflicting layout work. +- Related completed scopes: teacher-group-intro, hover intro, preview toolbar, empty-work preview. Preserve grouped dismissal and real unread messages. + +Read: +- Agent entry/read-before-planning, memory-index, planning-gate; this task record. +- Project positioning, current-state, decision-index, system-overview, business-rules, success-criteria (task-relevant sections). +- ADR-2026-09-22-coding-teacher; evidence-index, reflection-index, commitments; AGENTS.md and README.md. + +Relevant understanding: +- Project goal: student creation workspace with Main-owned native Work preview and cloud-defined teachers. +- Integrated baseline: fe1a377, clean main. URL toolbar beside workspace tabs; native pixels avoid teacher DOM overlays. +- Root cause: bubbleRef points to the whole welcome group; usePreviewClearance offsets the whole panel below its bottom, wasting most of the first-open viewport. +- Constraints: only gate welcome rendering with the current tab; keep hook/persistence, real invitations, hover descriptions, and backend contracts unchanged. +- Canonical ADR still describes per-teacher introduction dismissal, superseded by the grouped implementation and README; this change preserves current grouped behavior. +- Evidence: user screenshots and static code; isolated browser measurements and regressions to follow. No applicable unresolved external commitment. +- Modules: TeacherCompanion, CodingChatPanel, related unit/browser/Electron fixtures and README. + +Gate result: Passed. + +## Plan + +1. Add a presentation-only welcome visibility prop and derive it from the Work tab. +2. Cover hide/restore without consuming welcome state, real messages remaining visible, first-open preview geometry, and actual workspace integration. +3. Run focused unit/browser/Electron checks, typecheck, lint and production build; record evidence and hand off a committed feature branch. + +## Outcome + +- Added presentation-only `showWelcomes` to TeacherCompanion, controlled by `!agentBrowserOpen`. Both grouped introductions and the legacy static welcome are unmounted on Work, and return on Operation Chat if not already consumed by existing lifecycle rules. +- Real invitations/unread markers and hover descriptions remain visible with existing native-preview clearance. No persistent dismissal, model call, storage change, or preview startup change is triggered by this flag. +- Updated README, lifecycle unit regressions, four-size browser layout scenarios, and the existing actual Electron workspace test. +- Baseline reproduced in isolation: group height 440px; native preview was pushed down 391px, from top 107px to 498px. At 1280x800, height dropped from 639px to 248px; at 1440x900, from 739px to 348px. Fixed screenshots restore top 107px and full 639/739px height. +- Independent read-only review found no blocking issue, stale margin, ResizeObserver leak, or new first-open bounds race. + +## Verification + +- Typecheck, scoped ESLint, and production build:vite passed using pinned pnpm 10.33.4. Logs: `/tmp/makelore-first-work-{typecheck,lint,build}.log`. +- Focused units: 103 cases across teacher-companion, coding-chat-panel, and agent-browser-panel. Initial parallel run passed 102 and hit an existing asynchronous presentation assertion in unchanged agent-browser-panel; that file passed all 17 alone on retry. All changed-component tests passed initially. Logs: `/tmp/makelore-first-work-units.log`, `/tmp/makelore-first-work-browser-units-retry.log`. +- Browser layout suite: 18/18 passed, including 375/768/1280/1440px hide/restore, repeat visits, explicit dismissal, real messages, and hover clearance. Screenshots visually inspected; no horizontal overflow. `/tmp/work-first-open-browser-8ac7e621/run.log` and `results/`. +- Electron production-build fixture: 1/1 passed, proving actual workspace tab wiring, full-height preview, hover recovery, welcome restoration, teacher entry and retained drafts. `/tmp/makelore-first-work-electron.log`, `/tmp/makelore-first-work-electron-results/`. +- Baseline geometry and before/after images: `/tmp/work-first-open-repro-8ac7e621/`. +- Tests use isolated fixtures; installed app and user project/data were not changed. No installed-app update or native game-content acceptance claimed. + +## Follow-ups + +- Running-app update and main integration remain separate user-requested steps; feature branch is ready for handoff. + +## Promotion Candidates + +- Target: teacher ADR and system-overview. Proposal: static welcome introductions are paused on Work and restored on Operation Chat without consuming introduction or unread state; actual messages and hover descriptions retain native clearance. Evidence: user explicitly selected this behavior, focused lifecycle/browser/Electron regressions. Future impact: prevents reintroducing full-panel welcome clearance on first Work entry. Conflict: older ADR intro dismissal wording is stale relative to grouped implementation; leave it read-only in this feature. Further human confirmation for this visibility behavior is not required. diff --git a/README.md b/README.md index 52bba669..aeef282b 100644 --- a/README.md +++ b/README.md @@ -177,7 +177,7 @@ Pi 正式包必须继续运行 `pnpm run verify:artifact:pi`、`pnpm run smoke:p - 鼠标悬停或键盘聚焦顶部智能体入口时,以奶油色圆角卡片显示该智能体的发布介绍;离开、Escape 或点击入口后收起,没有介绍则不显示空卡片。咨询栏不再显示重复的头像、名称标题条,也不显示介绍及新话题、展开、关闭三个图标;老师身份保留在顶部入口及消息署名中。智能体生成的追加问题以淡蓝、奶油黄、淡紫卡片依次承载,正文 14px、行高 1.7,使用更紧凑的内边距和圆角,保留整卡点击发送与忙碌时禁用。回复下方不再显示重复的输入引导或省略早期消息条数;输入框提示为“和老师聊聊”。再次点击当前入口或在咨询栏按 Escape 可收起,切换其他入口仍直接打开对应讨论;拖动边缘调宽保留,已下发智能体仅保留只读旧记录入口。悬浮介绍不会创建话题、调用模型或确认未读消息,作品原生预览同时避让介绍卡和真实主动气泡。 - 主动发言采用紧贴小头像的短气泡;只有存在真实主动消息或运营欢迎语时才显示这组浮层,收起消息时头像和气泡一起消失,顶部入口仍保留。长消息在气泡中最多显示三行,点击接回原智能体对话查看全文。不提供“智能体偶尔来看看”开关或本地模拟巡看控制,既有自动跟进与真实消息接收逻辑保留。作品原生预览对整组气泡和头像测量避让,避免图片被原生页面遮住。 - 新的单会话入口停止旧版前端定时跟进派发;项目主动观察由独立功能衔接,不能重新创建可见话题。未下发目录的旧版入口仍保留原跟进合同:前端每 5 分钟请求一次智能体跟进;窗口隐藏、来源归档、主对话正在执行、智能体正在回复或学生正在智能体栏写草稿时延后。Main 再检查在线启停、来源归属、项目级冷却和已完成文本指纹,未变上下文按下述十五分钟冷却处理。跟进沿用运营模型、已发布 Skills 与当前智能体话题,生成符合所选配置的具体建议或引导;以主动智能体发言持久化,不伪造学生消息。模型调用沿用智能体计费规则。 -- 进入项目时,每位已下发智能体各显示一个浅色自我介绍气泡,外层透明,不显示公共底板、标题或整组关闭入口;整张气泡可点击,每张气泡保留关闭按钮,关闭任意一张会收起整组介绍,优先使用云端介绍,缺省使用发布欢迎语;不调用模型、不声称已检查项目。所有气泡进入项目即作为一组显示,不点击时保留到操作 Agent 第 3 轮完整回复结束后自动收起,也可整组关闭;按账号、项目保存统一计数及整组已介绍状态,刷新与操作对话切换延续进度。旧历史、老师咨询、工具调用、重试中间状态、失败/中止和其他项目不计入,新增智能体加入仍在展示的整组,不会单独重开已收起的介绍。点击气泡或头像进入对应咨询,同时记住整组已介绍;关闭咨询、刷新或重新进入项目后整组仍收起,悬停头像仍可查看完整介绍。旧版任一老师已介绍时兼容为整组已介绍,否则延续已有操作轮次;旧记录仅兼容读取,不清空历史。没有下发目录的旧入口保留原欢迎语展示兼容。真实的未读主动建议优先替换欢迎语,打开咨询不会自动将这些消息标为已读。主动发言在头像旁直接显示气泡,不抢焦点、不盖住作品;作品区按气泡与原生预览的实际交叠范围避让,已有工具栏高度计入计算,气泡位于独立智能体栏时不额外留白,窗口/分栏尺寸变化和收起气泡时实时归还空间;“和智能体聊聊”接回同一段咨询,“等会儿聊”收起并保留历史。已有未处理气泡时不堆叠新邀请;咨询已展开时仍显示真实未读主动消息气泡,直到学生主动点击查看或收起,期间的其他回复不会吞掉未读邀请。五分钟检查计时在刷新和项目切换后保留;智能体咨询里的新讨论也算进展,即使操作对话没有变化也会继续跟进;上下文完全未变时放缓到十五分钟一次,不永久停止。事件连接丢失时,每十五秒只读同步未完成回复,收到结果后停止轮询,不重复调用模型。失败如实提示,不以本地文案替代模型回复。已接受请求恢复使用原身份,退出账号和来源删除仍沿用 Main 中止边界。 +- 进入项目时,每位已下发智能体各显示一个浅色自我介绍气泡,外层透明,不显示公共底板、标题或整组关闭入口;整张气泡可点击,每张气泡保留关闭按钮,关闭任意一张会收起整组介绍,优先使用云端介绍,缺省使用发布欢迎语;不调用模型、不声称已检查项目。所有气泡进入项目即作为一组显示;切到“作品”时暂时隐藏欢迎介绍,让作品使用完整预览空间,切回“操作对话”后恢复尚未收起的介绍,不标记已介绍或已读;真实主动消息和头像悬停介绍仍按原有方式显示并避让。不点击时保留到操作 Agent 第 3 轮完整回复结束后自动收起,也可整组关闭;按账号、项目保存统一计数及整组已介绍状态,刷新与操作对话切换延续进度。旧历史、老师咨询、工具调用、重试中间状态、失败/中止和其他项目不计入,新增智能体加入仍在展示的整组,不会单独重开已收起的介绍。点击气泡或头像进入对应咨询,同时记住整组已介绍;关闭咨询、刷新或重新进入项目后整组仍收起,悬停头像仍可查看完整介绍。旧版任一老师已介绍时兼容为整组已介绍,否则延续已有操作轮次;旧记录仅兼容读取,不清空历史。没有下发目录的旧入口保留原欢迎语展示兼容。真实的未读主动建议优先替换欢迎语,打开咨询不会自动将这些消息标为已读。主动发言在头像旁直接显示气泡,不抢焦点、不盖住作品;作品区按气泡与原生预览的实际交叠范围避让,已有工具栏高度计入计算,气泡位于独立智能体栏时不额外留白,窗口/分栏尺寸变化和收起气泡时实时归还空间;“和智能体聊聊”接回同一段咨询,“等会儿聊”收起并保留历史。已有未处理气泡时不堆叠新邀请;咨询已展开时仍显示真实未读主动消息气泡,直到学生主动点击查看或收起,期间的其他回复不会吞掉未读邀请。五分钟检查计时在刷新和项目切换后保留;智能体咨询里的新讨论也算进展,即使操作对话没有变化也会继续跟进;上下文完全未变时放缓到十五分钟一次,不永久停止。事件连接丢失时,每十五秒只读同步未完成回复,收到结果后停止轮询,不重复调用模型。失败如实提示,不以本地文案替代模型回复。已接受请求恢复使用原身份,退出账号和来源删除仍沿用 Main 中止边界。 - 智能体支持自由提问;输入框为空时,上方显示老师已发布的快捷提示,输入文字后收起,清空后重现,发送按钮保持原位。只有学生点击才调用模型,程序说明学生主动求助且尚未提出具体问题,智能体结合可用上下文按云端配置回应。点击快捷回复会主动开始讨论;回复下方不再附加固定的二次求助链接;失败或中断后,可点暖黄色小按钮“帮我整体看🧠”重试。这些快捷求助保留已有输入草稿,网络结果不确定时复用请求身份,已确认终态的请求不重复执行;解析失败可重新求助,不用固定问题伪装模型结果。服务端下发的推荐问题只填入草稿,由用户确认发送。界面不提供独立示范页面、“记一下”、共识或自动待办,智能体的回复下不再展示“我去试一试”和“复制”按钮,学生通过已有的操作对话/作品入口继续创作。 - 老师咨询展示流式思考过程、老师正文和可点击的快捷回复卡片,学生也可在“和老师聊聊”输入框自由输入。点击卡片原样发送该回复,保留当前输入草稿;旧话题的数据不会恢复想法板、结构图、流程图或对照表及其操作。 - 客户端只提供入口事实、可用上下文和界面协议。讨论切入点、教学方式、是否提问、正文长度、前缀和表达风格由所选智能体的云端配置决定;不在快捷求助、引导开口或后台检查时附加教学策略。当前新回复允许 0–3 条快捷回复,没有时用空数组,不要求凑满。 diff --git a/src/pages/Chat/CodingChatPanel.tsx b/src/pages/Chat/CodingChatPanel.tsx index e0e0080a..0a18b669 100644 --- a/src/pages/Chat/CodingChatPanel.tsx +++ b/src/pages/Chat/CodingChatPanel.tsx @@ -794,7 +794,7 @@ export function CodingChatPanel({ onToggleConsultation={() => setConsultationOpen((current) => !current)} projectName={activeProject?.name} consultationOpen={consultationOpen} - teacherEntry={activeProject ? : undefined} + teacherEntry={activeProject ? : undefined} />
diff --git a/src/pages/Chat/TeacherCompanion.tsx b/src/pages/Chat/TeacherCompanion.tsx index 30b9ccba..af594a70 100644 --- a/src/pages/Chat/TeacherCompanion.tsx +++ b/src/pages/Chat/TeacherCompanion.tsx @@ -6,13 +6,15 @@ import { TeacherIntroduction } from './TeacherIntroduction'; import type { useTeacherCompanion } from './use-teacher-companion'; type Companion = ReturnType; -export function TeacherCompanion({ companion, open, onOpen, onToggle, bubbleRef, introductionRef }: { +export function TeacherCompanion({ companion, open, onOpen, onToggle, bubbleRef, introductionRef, showWelcomes = true }: { companion: Companion; open: boolean; onOpen(agentId?: string): void; onToggle?(agentId?: string): void; bubbleRef?: Ref; introductionRef?: Ref; + /** Temporarily hide introductions without consuming their persisted state. */ + showWelcomes?: boolean; }) { const { definition, invitation, welcome, welcomes, loading, enabled, checking, error } = companion; const [introductionId, setIntroductionId] = useState(null); @@ -60,7 +62,7 @@ export function TeacherCompanion({ companion, open, onOpen, onToggle, bubbleRef,