feat: unify plugin workspace navigation

This commit is contained in:
2026-09-03 13:39:55 +08:00
parent 959e2faf03
commit 1b1f206dd8
27 changed files with 3097 additions and 1100 deletions

View File

@@ -0,0 +1,162 @@
# Task: Implement unified plugin workspace ML-PLUGIN-NAV-001
## Identity
- Task ID: 20260903-plugin-navigation-implementation-a4c7e291
- Mode: Feature
- Branch: codex/20260903-plugin-navigation-implementation-a4c7e291-plugin-navigation-implementation
- Worktree: C:\Users\7brot\.codex\worktrees\1721\makelore
- Base commit: 959e2faf03dfacb3c8e2035e44774436c752d4b0
- Owner: codex
- Status: Ready for Integration
## Scope
- Implement approved Spec `ML-PLUGIN-NAV-001` serially as PN-01 through PN-04:
a pure source-qualified Renderer projection, one `/plugins` workspace and detail
surface, a hard route/sidebar cutover with exact replace redirects, removal of the
three superseded page implementations, and focused/full/Electron verification.
- Own only the Spec-listed Renderer page/navigation/tests/artifact-marker/README
paths plus this task record. Preserve the existing Marketplace, Device Package,
Coding Plugin, Agent assignment, runtime admission, and billing authorities.
## Intent And Constraints
- Concurrent Task Gate passed for the exact identity/base/worktree above. The
superseded exact-overlap task `20260903-plugin-navigation-implementation-6b4d9e21`
was released from the registry after source-thread adjudication; its worktree,
branch, and record were not removed or modified by this task.
- Planning Gate passed after reading repository guidance, the complete Spec, startup
project memory, architecture/domain rules, relevant indexes, and the completed AI
Design peer record. That peer explicitly excludes plugin pages, navigation,
Sidebar, and router, so no semantic overlap remains.
- Confirmed public test seams are `buildPluginWorkspaceProjection`, the unified
Renderer page/local dispatcher/detail dialog, route/sidebar/module guards, and the
targeted Renderer-to-Main Electron flows. Work vertically red -> green at those
seams rather than mocking internal modules.
- Use `official:`, `local:`, and `retained:` identity without inferred cross-source
merging. Keep local installation conversation-only, native selected-model Web
Search out of the projection, system-included actions restricted, and local package
state explicitly device-global.
- Do not change Server, Electron Main/plugin contracts, the three existing stores,
Package Store/runtime/billing authority, app identity/global paths, or add a
persistent Zustand authority, compatibility layer, feature flag, or visible local
installation picker.
- Do not write or clean `D:\\Datas\\OthersProjects\\makelore`; do not push, create a
PR, deploy, publish, install a package, or merge `main`.
## Project Context Loaded
- Project goal: present official, acquired, local-device, project, and Agent Plugin
state through one understandable UI while preserving each existing authority.
- Current integrated focus: curated Marketplace Release A, system-included Data
Service, code-owned bundled Game Resource, conversation-only Device Packages, and
selected-model native Web Search are already integrated contracts.
- Decisions affecting this task: acquisition/device delivery/project enablement/Agent
assignment/runtime admission/billing remain independent; Device Packages are
device-global and child workers remain empty; Renderer access stays behind typed
Host API facades.
- Relevant evidence: the integrated Marketplace and Device Package suites establish
the current DTO/authority behavior; installed-client Device Package activation is a
separate release gate and is not claimed by this UI task.
- Likely modules: `src/pages/{PluginMarketplace,MyPlugins,ProjectPlugins,Plugins}`,
`src/App.tsx`, layout navigation/guards, `src/lib/ai-modules.ts`, their unit/E2E and
artifact marker tests, and `README.md`.
- Unknown to verify before implementation: whether the current public Renderer DTOs
express every Spec field without contract changes. A real interface conflict blocks
that range rather than authorizing a wrapper or compatibility path.
- Non-blocking stale context: canonical `module-map.md` still names the old three-page
UI and must be proposed for later Integration Gate promotion, not edited in feature
mode.
## Outcome
- `PN-01` added the pure `buildPluginWorkspaceProjection` interface, canonical
query parser/serializer, and a local command dispatcher. The projection keeps
`official:`, `local:`, and `retained:` identities separate; preserves
catalog/Library/project-only/local/retained entries under partial failures;
excludes only the native selected-model `makelore_web_search`; and derives the
Spec action matrix without writing a store.
- `PN-02` replaced the three page-specific views with one `/plugins` workspace and
one detail dialog. It independently loads Catalog, Library, Device Packages, and
current-project projection; exposes URL-backed scope/source/state/search/detail
state; keeps source errors local; dispatches every action to its existing owner;
embeds the existing Data Service settings surface; resets project-scoped
confirmation on project change; and provides dialog focus, Escape, focus-return,
status, alert, and destructive-scope semantics.
- `PN-03` reduced the Code sidebar to `sidebar-nav-plugins`, registered the
initialization-safe and non-provider-gated canonical route, added the three exact
replace redirects, and deleted the old Marketplace, My Plugins, and Project
Plugins implementations and their superseded page tests. No hidden fallback
implementation remains.
- `PN-04` updated the targeted Electron flows, product artifact markers, and
`README.md`. The E2E authenticated fixture now starts a fresh Renderer document
against a Main-owned session and `/api/auth/me` identity; this removed a measured
reload/localStorage setup race without changing product authentication code.
- Actual changed scope is limited to `src/pages/Plugins/**`, the listed route/layout
files, deletion of the three old page directories, focused unit/Electron tests,
`scripts/lib/pi-product-artifact.mjs`, `README.md`, and this task record. No
Server, Electron Main, Marketplace/Device/Coding store, Package Store, runtime,
billing, or persistence authority was changed; no fourth Zustand authority was
added.
## Verification
- `corepack pnpm run typecheck` — passed after the final E2E fixture edit.
- `corepack pnpm run lint:check` — passed with 0 errors. Five pre-existing warnings
remain in untouched files: one `react-hooks/exhaustive-deps` warning in
`src/pages/Home/index.tsx` and four `react-refresh/only-export-components`
warnings in `src/pages/Makelore/index.tsx`.
- `corepack pnpm test` — passed: 225 regular test files with 1821 passed and 2
skipped tests, followed by the isolated pressure file with 1 passed test.
- `corepack pnpm run build:vite` — passed for Renderer, Electron Main, Preload, and
utility worker. Existing warnings remain for stale Browserslist data,
static/dynamic imports, and the existing large Renderer chunk.
- `corepack pnpm run test:e2e -- tests/e2e/plugin-marketplace.spec.ts
tests/e2e/project-plugins.spec.ts --reporter=line` — passed after its production
build with all 4 targeted Renderer-to-Main flows.
- `corepack pnpm exec playwright test tests/e2e/plugin-marketplace.spec.ts -g
"keeps system, bundled, and local actions" --repeat-each=10 --workers=1
--reporter=line` — 10/10 passed after stabilizing the authenticated fixture.
- `corepack pnpm exec vitest run tests/unit/pi-product-artifact.test.ts
--maxWorkers=1` — passed: 15/15 artifact proof tests.
- Focused projection/query/controller/page/navigation/Main-layout suites passed;
the final page suite passed 5/5, including project-switch confirmation reset and
dialog initial-focus/Escape/focus-return behavior.
- Existing parent/child/worker lifecycle coverage passed in the full suite through
`coding-plugin-effective-resolver`, `pi-managed-worker-opener`,
`device-package-manager`, and `device-package-routes` tests.
- `check_doc_drift.py --task-id
20260903-plugin-navigation-implementation-a4c7e291` — passed the feature-task
ownership boundary check.
- `git diff --check` passed before Task Documentation Gate finalization.
- One full-suite run transiently failed the untouched Marketplace client temp
Package Store install case; its exact isolated rerun passed 1/1 and the subsequent
full suite passed as recorded above. An earlier targeted E2E run exposed the
test-only auth reload race; trace inspection showed no Library request and a
signed-out persisted fixture, after which the clean-document Main-session fixture
passed 10/10 and the formal targeted command passed 4/4.
## Follow-ups
- No implementation follow-up or product deviation is known. The canonical module
map promotion below remains intentionally deferred to an Integration Gate.
## Promotion Candidates
- Target: `.project-docs/20-architecture/module-map.md`.
- Proposal: replace the three legacy Renderer plugin pages with the pure unified
projection, `/plugins` workspace/detail surface, canonical query state, and exact
legacy redirects; keep Catalog, Library, official Package Store, Device Packages,
project enablement, Agent assignment, admission, and billing under their existing
owners.
- Evidence: approved Spec `ML-PLUGIN-NAV-001`, this task's single implementation
commit, pure projection/action tests, route/page tests, artifact proof, full unit
suite, production build, and 4/4 targeted Electron flows.
- Future impact: architecture readers will use `/plugins` and
`src/pages/Plugins/plugin-workspace-model.ts` as the Renderer aggregation seam and
will not extend the deleted page implementations.
- Semantic conflicts: none known; the concurrent AI Design task owns no plugin
navigation or plugin authority surface.
- Human confirmation: no new product-direction decision is required, but promotion
must still occur only in an exclusively owned Integration Gate.