10 KiB
10 KiB
Task: Implement PI-090 product tools and change tracker
Identity
- Task ID: 20260823-pi-product-tools-a9c4e7d2
- Mode: Feature
- Branch: codex/20260823-pi-product-tools-a9c4e7d2-pi-product-tools
- Worktree: D:\Datas\OthersProjects\makelore-pi-product-tools-a9c4e7d2
- Base commit:
77cdee7e73 - Owner: codex
- Status: Ready for Integration
Scope
- Implement
PI-090 — Product tools and Conversation change trackerfrom the【架构】opencode2piSpec/ticket graph on cumulative PI-080 baseline77cdee7e73feff8f3941afcfd280e6dedd83b73b. - Own the product-side Pi tools for browser, game-asset browse/review, versioned task state, relative changed-file reporting, selected skills and command catalog, plus a Main-owned Git/status/diff Conversation tracker.
- Reuse the existing Main Agent Browser seam and migrate retained game-asset and skill semantics out of OpenCode-specific ownership without wiring the PI-105 Host routes or PI-130 Renderer UI.
Intent And Constraints
- Browser commands must call the existing Main-owned browser module directly;
they must not launch
@playwright/mcp, discover MCP servers, or introduce a second browser protocol. Screenshot results use bounded attachment identity, never repeated base64 projection to Renderer. - Product tool details are versioned and strictly normalized.
task_stateis not an old todo endpoint,changed_fileaccepts only project-relative paths, and changes never come from parsing Pi message text. - Record run-start Git head/status/diff baselines, refresh precise touched paths after write/edit, and perform one project-level refresh after bash/settle. Untracked preview is bounded and contains no absolute path. Do not add file hashes, checkpoints, rollback semantics, or a generic VCS framework.
- Selected skills and commands come only from the explicit bundled registry and
project Agent selection; project/user
.pidiscovery and OpenCode plugin types remain excluded. - Keep the extension/bridge Main-private and authenticated by the existing worker token + conversation/generation/run identity. Child tool exposure must stay within PI-080's explicit role/tool policy.
- Real external Provider validation remains Explicitly Waived / Accepted
Risk with
realTurnVerified=false; macOS x64/arm64 remains deferred to mandatory PI-150 validation. Neither is a Pass. - Do not create subagents. Keep all writes in this isolated worktree and leave canonical project memory to the later integration ticket.
Plan
- Inspect and lock the smallest interfaces across the Pi extension bridge, existing Agent Browser module, retained game-asset logic, explicit skill resources, and Git/project seams.
- Add the versioned product tools and bridge adapters, reuse the Main browser module, and rehome retained game-asset behavior without MCP or OpenCode plugin dependencies.
- Add the selected skill/command registry and Conversation change tracker with relative paths, bounded previews, touched-path refresh and bash/project refresh semantics.
- Add focused real/fake bundle, bridge, browser/game, registry and git/no-git/dirty/untracked/bash tracker tests plus the applicable packaged smoke.
- Run focused Pi tests, typecheck, lint, full unit, Vite build and project-doc gates; commit the exact owned scope and request planner review.
Outcome
- Added the versioned
makelore-runtime-v3.mjsparent extension surface foragent_browser,game_asset_browser,game_asset_review,task_state,changed_file, andruntime_context. Product calls cross the existing loopback worker-token bridge with conversation/generation/run validation; child workers do not register or invoke these parent product tools. - Added
PiProductToolsand direct Main-domain adapters. Agent Browser callsAgentBrowserModulewithout MCP and convertsPage.captureScreenshotresults into product attachment IDs. Game asset browse/review behavior now lives under vendor-neutralelectron/coding-projectsownership while the current OpenCode Host route temporarily consumes the same module. - Added strict v1 typed details for browser, game assets, task state, changed files, and runtime context. Live projection and cold session hydration accept only normalized known versions and replace unknown raw details with bounded generic text.
- Added
ConversationChangeTracker: each run captures Git HEAD plus dirty status/diff/untracked baseline; write/edit reports refresh exact relative paths, bash requests a settled project-wide refresh, and no-Git projects use only explicitly touched paths. Diffs and untracked previews are bounded, absolute paths are rejected, and no hashes/checkpoints/rollback mechanism were introduced. - Added an explicit bundled Skill registry and Makelore/Pi/selected-Skill command catalog projection. Only packaged Skill IDs and safe metadata are exposed; project/user auto-discovery remains disabled.
- Extended the real Pi and staged production-closure smoke to require all parent product tools while retaining the exact read-only child tool set.
- Closed the planner's first review findings: dirty baselines now use one Git
status plus lightweight file metadata instead of per-file Git diffs before
prompt acceptance; a missing Git executable degrades to no-Git tracking;
write/edit hooks from parent and coding child use a dedicated internal
changes.touchedACK bridge; full diff/preview data stays Main-only; and untracked reads plus previews are both limited to 8 KiB while size/mtime detect equal-length changes beyond that window. - Closed the follow-up review finding by making per-candidate Git diff failure,
non-zero exit, or output-limit rejection non-fatal: the Main snapshot keeps
the changed relative path and status while omitting only the unavailable
diff. The regression uses the same
Git output is too largefailure shape. - Final planner review of
f9e2119passed with zero Standards findings and zero Spec findings. Independent reproduction with a real 9 MiB tracked-file diff confirmed that an output-limit failure preserves{ path, status }while omitting only the unavailable diff. PI-090 is Done; the exact Ready Frontier is{PI-100, PI-105}, with PI-105 recommended next. - The packaged smoke now has two halves: a staged production-closure Pi process check and a controlled Electron-Node authenticated bridge check that actually executes browser status/screenshot attachment and game asset browse/review, rather than checking registrations only.
- No Renderer or
/api/codingroute was added; PI-105/PI-130 remain the owners of Host API and UI consumption.README.mdtherefore still describes the unchanged current product cutover state and did not require an update here.
Verification
corepack pnpm run typecheck: passed.corepack pnpm run lint:check: passed with the same six repository warnings and no errors (ExecutionGraphCard.tsx,Home/index.tsx, andMakelore/index.tsx; none are in this task's changed scope).- Final focused PI-090/Pi projection/bridge/game/resource suite: 12 files, 71 tests passed. The planner's five minimal failure shapes are also covered by the final 4-file 20-test tracker/bridge/runtime subset.
- Final planner verification: focused 4-file/20-test subset, typecheck, scoped ESLint, documentation drift, and diff checks all passed; the worktree was clean at the reviewed implementation commit.
- Final serial full suite
(
corepack pnpm vitest run --maxWorkers=1 --no-file-parallelism): 203 files, 2226 tests passed, 2 skipped. Two preceding parallel full-suite runs each hit the repository's known Windows temporary-filerename EPERMin the unchanged Conversation store atomic write; the same file passed 1/1 in isolation before the serial full suite passed. corepack pnpm run build:vite: passed for Renderer, Electron Main, Preload, and release utility outputs; existing chunk-size/dynamic-import warnings remain non-blocking.corepack pnpm run test:electron:windows: 2 files, 6 tests passed, including authenticated product-tool execution under Electron Node.corepack pnpm run test:pi-subagent:packaged: staged runtime 4/4 plus controlled Electron product-tool bridge 3/3 passed. It verifies browser status/screenshot attachment persistence, game browse/review execution, parent tool registration and the unchanged staged read-only child boundary.- Real external Provider turns remain Explicitly Waived / Accepted Risk;
realTurnVerified=false. macOS x64/arm64 validation remains deferred to the mandatory PI-150 gate. Neither item is recorded as passed.
Follow-ups
- PI-100/PI-105 must construct/configure
PiProductToolsin the production Main composition, expose Conversation changes, attachment reads, Skills and command DTOs through/api/coding, and keep the new attachment store behind Main-owned routes. - PI-130 must consume typed product-tool details and Conversation change snapshots without inferring changes from message text; fork copy must not imply filesystem rollback.
- PI-140 may delete the remaining OpenCode-specific consumer/MCP artifacts only after cutover; the vendor-neutral game asset and Skill sources remain.
- PI-150 must run mandatory macOS x64/arm64 validation. Real external Provider concurrency, credential isolation and protocol compatibility remain the explicitly accepted unverified risk until a separately authorized test.
Promotion Candidates
- Target canonical documents:
.project-docs/30-worklog/current-state.mdand the accepted PI cutover implementation status maintained by the planner. Proposal: after the implementation commit is reviewed and integrated, mark PI-090 complete and make PI-105/PI-130 eligible on the cumulative chain. Evidence: the implementation commit from this task plus the verification matrix above. Future impact: Host API/UI tickets may consume the typed product-tool, Skill-command and Conversation-change contracts instead of OpenCode Session diff/todo/MCP behavior. Semantic conflicts: none known. Human confirmation required: no for recording the merged implementation fact; normal planner review and integration ownership still apply.