142 lines
8.8 KiB
Markdown
142 lines
8.8 KiB
Markdown
---
|
|
phase: 03-unified-runtime-workspace
|
|
plan: 01
|
|
type: execute
|
|
wave: 1
|
|
depends_on: []
|
|
files_modified:
|
|
- tauri-app/src/features/runtime/types.ts
|
|
- tauri-app/src/features/runtime/runtime-utils.ts
|
|
- tauri-app/src/features/runtime/useRuntimeManager.ts
|
|
- tauri-app/src/features/runtime/components/RuntimeSurface.test.tsx
|
|
autonomous: true
|
|
requirements: [WORK-01, DIAG-01]
|
|
must_haves:
|
|
truths:
|
|
- The runtime manager exposes one authoritative workspace summary that combines readiness, endpoint or mode, active model, lifecycle state, and saved-versus-draft context.
|
|
- Runtime diagnostics are derived from backend-owned snapshot fields instead of duplicated UI heuristics.
|
|
- The consolidated workspace contract preserves Phase 1 draft safety and Phase 2 lifecycle semantics while making the health story explicit.
|
|
artifacts:
|
|
- path: tauri-app/src/features/runtime/useRuntimeManager.ts
|
|
provides: manager-owned runtime workspace summary, health guidance, and action-state data for all runtime surfaces
|
|
- path: tauri-app/src/features/runtime/runtime-utils.ts
|
|
provides: pure helpers that turn snapshot, draft, and lifecycle state into stable workspace labels and diagnostics
|
|
- path: tauri-app/src/features/runtime/types.ts
|
|
provides: typed workspace summary and diagnostic shapes shared across the unified runtime workspace
|
|
- path: tauri-app/src/features/runtime/components/RuntimeSurface.test.tsx
|
|
provides: regression coverage for the new workspace contract before UI composition begins
|
|
key_links:
|
|
- from: tauri-app/src/features/runtime/useRuntimeManager.ts
|
|
to: tauri-app/src/features/runtime/runtime-utils.ts
|
|
via: manager-owned derivation of runtime health summary and operator guidance
|
|
pattern: workspaceSummary|health|guidance
|
|
- from: tauri-app/src/features/runtime/useRuntimeManager.ts
|
|
to: tauri-app/src/features/runtime/types.ts
|
|
via: shared runtime workspace summary and diagnostic interfaces
|
|
pattern: RuntimeWorkspace|RuntimeHealth
|
|
---
|
|
|
|
<objective>
|
|
Define the manager-owned runtime workspace contract before Phase 3 changes any major UI composition.
|
|
|
|
Purpose: move the authoritative runtime story out of individual components and into shared runtime feature state so the eventual workspace renders one consistent view of status, actions, settings, and diagnostics.
|
|
Output: typed workspace-summary data, reusable health helpers, and regression coverage proving the manager can describe the full runtime workspace from existing snapshot, draft, and lifecycle state.
|
|
</objective>
|
|
|
|
<execution_context>
|
|
@$HOME/.config/opencode/get-shit-done/workflows/execute-plan.md
|
|
@$HOME/.config/opencode/get-shit-done/templates/summary.md
|
|
</execution_context>
|
|
|
|
<context>
|
|
@.planning/PROJECT.md
|
|
@.planning/ROADMAP.md
|
|
@.planning/STATE.md
|
|
@.planning/REQUIREMENTS.md
|
|
@.planning/phases/03-unified-runtime-workspace/03-RESEARCH.md
|
|
@.planning/phases/02-lifecycle-command-safety/02-03-SUMMARY.md
|
|
@tauri-app/src/features/runtime/types.ts
|
|
@tauri-app/src/features/runtime/runtime-utils.ts
|
|
@tauri-app/src/features/runtime/useRuntimeManager.ts
|
|
@tauri-app/src/features/runtime/components/RuntimeSurface.test.tsx
|
|
@tauri-app/src-tauri/src/runtime/types.rs
|
|
@tauri-app/src-tauri/src/runtime/state.rs
|
|
</context>
|
|
|
|
<tasks>
|
|
|
|
<task type="auto" tdd="true">
|
|
<name>Task 1: Add shared runtime workspace summary and health-diagnostic types</name>
|
|
<files>tauri-app/src/features/runtime/types.ts, tauri-app/src/features/runtime/runtime-utils.ts</files>
|
|
<read_first>
|
|
- tauri-app/src/features/runtime/types.ts
|
|
- tauri-app/src/features/runtime/runtime-utils.ts
|
|
- tauri-app/src/features/runtime/useRuntimeManager.ts
|
|
- tauri-app/src-tauri/src/runtime/types.rs
|
|
- tauri-app/src-tauri/src/runtime/state.rs
|
|
- .planning/phases/03-unified-runtime-workspace/03-RESEARCH.md
|
|
</read_first>
|
|
<behavior>
|
|
- Test 1: a ready local snapshot resolves to a workspace summary with explicit readiness, endpoint, active model, and action guidance fields.
|
|
- Test 2: a degraded local snapshot with `last_error.code === "health_check_failed"` resolves to a warning-style health summary that includes the backend error message.
|
|
- Test 3: a remote snapshot resolves to remote-mode endpoint and provider context without inventing local-runtime actions.
|
|
</behavior>
|
|
<action>Add explicit workspace summary types to `tauri-app/src/features/runtime/types.ts` using concrete names `RuntimeWorkspaceSummary`, `RuntimeWorkspaceHealth`, and `RuntimeWorkspaceSectionValue`. In `tauri-app/src/features/runtime/runtime-utils.ts`, add pure helpers named `getRuntimeWorkspaceSummary` and `getRuntimeHealthSummary` that derive exact fields for `statusLabel`, `modeLabel`, `endpointLabel`, `modelLabel`, `health.headline`, `health.detail`, and `health.tone` from `status`, `ready`, `process_running`, `resolved_url`, `config.connection_mode`, `config.model_path`, `binary_path`, `last_error`, `active_command`, and `last_command_result`. Reuse the existing restart-impact field list and lifecycle labels instead of creating parallel heuristics.</action>
|
|
<acceptance_criteria>
|
|
- `tauri-app/src/features/runtime/types.ts` exports `RuntimeWorkspaceSummary` and `RuntimeWorkspaceHealth`.
|
|
- `tauri-app/src/features/runtime/runtime-utils.ts` contains `export function getRuntimeWorkspaceSummary(`.
|
|
- `tauri-app/src/features/runtime/runtime-utils.ts` contains `export function getRuntimeHealthSummary(`.
|
|
- `tauri-app/src/features/runtime/runtime-utils.ts` references `resolved_url`, `model_path`, and `last_error` when building workspace diagnostics.
|
|
</acceptance_criteria>
|
|
<verify>
|
|
<automated>npm test -- RuntimeSurface</automated>
|
|
</verify>
|
|
<done>The runtime feature has one typed diagnostic contract that all consolidated UI sections can consume.</done>
|
|
</task>
|
|
|
|
<task type="auto" tdd="true">
|
|
<name>Task 2: Expose the unified workspace contract from the runtime manager</name>
|
|
<files>tauri-app/src/features/runtime/useRuntimeManager.ts, tauri-app/src/features/runtime/components/RuntimeSurface.test.tsx</files>
|
|
<read_first>
|
|
- tauri-app/src/features/runtime/useRuntimeManager.ts
|
|
- tauri-app/src/features/runtime/components/RuntimeSurface.test.tsx
|
|
- tauri-app/src/features/runtime/runtime-utils.ts
|
|
- tauri-app/src/features/runtime/types.ts
|
|
- .planning/phases/02-lifecycle-command-safety/02-03-SUMMARY.md
|
|
- .planning/phases/03-unified-runtime-workspace/03-RESEARCH.md
|
|
</read_first>
|
|
<behavior>
|
|
- Test 1: the manager exposes `workspaceSummary` while preserving dirty draft values during polling.
|
|
- Test 2: the manager exposes degraded health detail and lifecycle result detail at the same time when a local runtime is unhealthy after a command completes.
|
|
- Test 3: the manager exposes saved-versus-draft context that a consolidated workspace can render without reading raw config objects in multiple components.
|
|
</behavior>
|
|
<action>Refactor `tauri-app/src/features/runtime/useRuntimeManager.ts` so its public return value includes concrete fields named `workspaceSummary`, `workspaceHealth`, and `workspacePrimaryAction` derived from the new helpers in `runtime-utils.ts`. Keep existing fields such as `snapshot`, `savedBaseline`, `draftConfig`, `draftDirty`, `draftFields`, `activeLifecycleCommand`, `lastLifecycleResult`, and `applyImpact` intact for brownfield compatibility, but make the new workspace contract the canonical source for endpoint, mode, model, readiness, and failure guidance. Update `RuntimeSurface.test.tsx` so the manager harness asserts the new fields directly with stable IDs or text expectations rather than inferring everything from component copy.</action>
|
|
<acceptance_criteria>
|
|
- `tauri-app/src/features/runtime/useRuntimeManager.ts` returns `workspaceSummary`.
|
|
- `tauri-app/src/features/runtime/useRuntimeManager.ts` returns `workspaceHealth`.
|
|
- `tauri-app/src/features/runtime/components/RuntimeSurface.test.tsx` contains `workspaceSummary` or `workspaceHealth` assertions.
|
|
- `tauri-app/src/features/runtime/useRuntimeManager.ts` still preserves dirty draft state through `reconcileDraftState(`.
|
|
</acceptance_criteria>
|
|
<verify>
|
|
<automated>npm test -- RuntimeSurface</automated>
|
|
</verify>
|
|
<done>The runtime manager becomes the authoritative source for the unified runtime workspace before any layout consolidation starts.</done>
|
|
</task>
|
|
|
|
</tasks>
|
|
|
|
<verification>
|
|
- `npm test -- RuntimeSurface`
|
|
- `npm run build`
|
|
</verification>
|
|
|
|
<success_criteria>
|
|
- The runtime manager exposes one shared workspace summary for status, diagnostics, and action context.
|
|
- Diagnostics come from backend-owned snapshot fields instead of duplicated component logic.
|
|
- Draft safety and lifecycle safety remain intact while Phase 3 introduces the new workspace contract.
|
|
</success_criteria>
|
|
|
|
<output>
|
|
After completion, create `.planning/phases/03-unified-runtime-workspace/03-01-SUMMARY.md`
|
|
</output>
|