Files
ForgeLM/.planning/phases/03-unified-runtime-workspace/03-01-PLAN.md
T

8.8 KiB

phase, plan, type, wave, depends_on, files_modified, autonomous, requirements, must_haves
phase plan type wave depends_on files_modified autonomous requirements must_haves
03-unified-runtime-workspace 01 execute 1
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
true
WORK-01
DIAG-01
truths artifacts key_links
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.
path provides
tauri-app/src/features/runtime/useRuntimeManager.ts manager-owned runtime workspace summary, health guidance, and action-state data for all runtime surfaces
path provides
tauri-app/src/features/runtime/runtime-utils.ts pure helpers that turn snapshot, draft, and lifecycle state into stable workspace labels and diagnostics
path provides
tauri-app/src/features/runtime/types.ts typed workspace summary and diagnostic shapes shared across the unified runtime workspace
path provides
tauri-app/src/features/runtime/components/RuntimeSurface.test.tsx regression coverage for the new workspace contract before UI composition begins
from to via pattern
tauri-app/src/features/runtime/useRuntimeManager.ts tauri-app/src/features/runtime/runtime-utils.ts manager-owned derivation of runtime health summary and operator guidance workspaceSummary|health|guidance
from to via pattern
tauri-app/src/features/runtime/useRuntimeManager.ts tauri-app/src/features/runtime/types.ts shared runtime workspace summary and diagnostic interfaces RuntimeWorkspace|RuntimeHealth
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.

<execution_context> @$HOME/.config/opencode/get-shit-done/workflows/execute-plan.md @$HOME/.config/opencode/get-shit-done/templates/summary.md </execution_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 Task 1: Add shared runtime workspace summary and health-diagnostic types tauri-app/src/features/runtime/types.ts, tauri-app/src/features/runtime/runtime-utils.ts - 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 - 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. 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. - `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. npm test -- RuntimeSurface The runtime feature has one typed diagnostic contract that all consolidated UI sections can consume. Task 2: Expose the unified workspace contract from the runtime manager tauri-app/src/features/runtime/useRuntimeManager.ts, tauri-app/src/features/runtime/components/RuntimeSurface.test.tsx - 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 - 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. 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. - `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(`. npm test -- RuntimeSurface The runtime manager becomes the authoritative source for the unified runtime workspace before any layout consolidation starts. - `npm test -- RuntimeSurface` - `npm run build`

<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>
After completion, create `.planning/phases/03-unified-runtime-workspace/03-01-SUMMARY.md`