Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

docs(webv2): document workbench phase contracts and oxc rules

joshistoast388d733df160
diff --git a/invokeai/frontend/webv2/OXC_RULE_COMPATIBILITY.md b/invokeai/frontend/webv2/OXC_RULE_COMPATIBILITY.md
new file mode 100644
index 0000000000..2af36ab0b9
--- /dev/null
+++ b/invokeai/frontend/webv2/OXC_RULE_COMPATIBILITY.md
@@ -0,0 +1,23 @@
+# OXC Rule Compatibility
+
+`webv2` uses `oxlint` and `oxfmt` instead of ESLint and Prettier.
+
+The config mirrors the existing Invoke web lint intent where OXC supports equivalent rules:
+
+- React and hooks checks: `react/jsx-no-bind`, `react/jsx-curly-brace-presence`, `react-hooks/*`.
+- TypeScript checks: `typescript/consistent-type-imports`, `typescript/no-empty-interface`, plus TypeScript compile checks through `tsc --noEmit`.
+- Import checks: `import/no-duplicates`, `import/no-cycle`.
+- General correctness/style checks: `curly`, `no-var`, `prefer-template`, `radix`, `eqeqeq`, `no-eval`, `no-extend-native`, `no-implied-eval`, `no-label-var`, `no-return-assign`, `no-sequences`, `no-template-curly-in-string`, `no-throw-literal`, `no-unmodified-loop-condition`, `no-console`, `no-promise-executor-return`, and `require-await`.
+- Formatting: `oxfmt` uses the same print width, tab width, semicolon, single quote, and trailing comma preferences as the existing web formatter. It uses `lf` line endings because `oxfmt` does not support Prettier's `auto` value.
+
+Known unsupported or intentionally deferred equivalents:
+
+- `brace-style`, `one-var`, and `react/jsx-no-bind`: oxlint 1.69.0 does not expose these ESLint/plugin rule names.
+- `simple-import-sort/*`: oxlint does not currently provide the same configurable import sorting behavior.
+- `unused-imports/no-unused-imports`: oxlint reports unused bindings, but it is not the same plugin rule.
+- `@typescript-eslint/ban-ts-comment`: no exact oxlint equivalent is configured yet.
+- `@typescript-eslint/no-import-type-side-effects`: no exact oxlint equivalent is configured yet.
+- `@typescript-eslint/consistent-type-assertions`: no exact oxlint equivalent is configured yet.
+- `path/no-relative-imports`: no exact oxlint equivalent is configured yet.
+- `no-restricted-syntax`, `no-restricted-properties`, `no-restricted-imports`: no exact oxlint config equivalent is configured yet.
+- `i18next/no-literal-string` and Storybook-specific overrides: not configured for the initial `webv2` shell.
diff --git a/invokeai/frontend/webv2/src/workbench/PHASE_2_STATE_CONTRACTS.md b/invokeai/frontend/webv2/src/workbench/PHASE_2_STATE_CONTRACTS.md
new file mode 100644
index 0000000000..4a5e9ef675
--- /dev/null
+++ b/invokeai/frontend/webv2/src/workbench/PHASE_2_STATE_CONTRACTS.md
@@ -0,0 +1,38 @@
+# Phase 2 State Contracts
+
+Phase 2 locks down ownership boundaries before feature migration.
+
+## Ownership
+
+- `WorkbenchState.account` owns global user/workbench preferences such as the active layout preset registry selection.
+- `WorkbenchState.autosave` owns persistence status only; it is excluded from the autosave comparison key to avoid save loops.
+- `Project.layout` owns the active project layout. Layout presets are copied into the project instead of referenced as live global state.
+- `Project.invocation` owns source, destination, and lock state for the global Invoke control.
+- `Project.projectGraph` owns the primary project graph.
+- `Project.widgetStates` owns widget-local state values.
+- `Project.widgetGraphs` owns graph-bearing widget graphs that can be selected as invocation sources.
+- `Project.canvas` owns canvas layers and staging-area state.
+- `Project.graphHistory` owns immutable graph snapshots.
+- `Project.undoRedo` owns undo/redo snapshots for project and widget state updates.
+- `Project.queue` owns immutable queue submission records for the active project.
+- `Project.events` owns internal timeline primitives. Conversation and Run Journal UI remain deferred.
+
+## Persistence
+
+`WorkbenchPersistenceService` defines the persistence boundary. The initial implementation uses `localStorage` for autosave, but feature code should depend on the service interface rather than direct storage calls.
+
+## Undo/Redo Policy
+
+Undoable project changes push a `ProjectUndoSnapshot` before mutation and clear redo history. Queue submissions are not undoable because they represent immutable external work requests.
+
+## Queue Snapshot Policy
+
+Clicking Invoke creates a `QueueItem` with a frozen-by-copy `QueueSubmissionSnapshot`:
+
+- resolved source and destination
+- selected graph copy
+- widget state copy
+- canvas state copy
+- submission timestamp
+
+Backend cancellation is represented per item through `QueueItem.cancellable`, allowing later API integration to expose cancellation only when supported.
diff --git a/invokeai/frontend/webv2/src/workbench/PHASE_3_WIDGET_REGISTRY.md b/invokeai/frontend/webv2/src/workbench/PHASE_3_WIDGET_REGISTRY.md
new file mode 100644
index 0000000000..ef5d549ed1
--- /dev/null
+++ b/invokeai/frontend/webv2/src/workbench/PHASE_3_WIDGET_REGISTRY.md
@@ -0,0 +1,43 @@
+# Phase 3 Widget Registry
+
+Phase 3 establishes the registration and graph-bearing surface contracts.
+
+## Widget Manifest
+
+`WidgetManifest` declares:
+
+- stable widget id and label
+- manifest version
+- allowed workbench regions
+- icon key
+- availability policy: enabled, disabled, or hidden
+- optional graph-bearing source metadata
+- registration/render failure behavior
+- third-party readiness metadata, with third-party enablement fixed to `false` for MVP
+
+## Registration Flow
+
+Each widget owns a directory under `src/workbench/widgets/<widget>/` with an `index.ts` that exports its manifest. If the widget renders UI, the manifest owns a single `view` component. `widgetRegistry.ts` imports those manifests into the first-party list, validates them, and returns `RegisteredWidget` records. Invalid manifests follow their failure policy and become disabled or hidden without taking down the workbench.
+
+Widget directories own their renderable surfaces. A widget that can render in a panel, center view, dialog, or popover provides one manifest view and receives the target region as a prop. Multi-surface widgets branch inside that one view instead of exporting one view per surface.
+
+## Regions
+
+Allowed regions are `left-panel`, `right-panel`, `center-view`, `dialog`, `popover`, and `status-bar`.
+
+The widget rails are derived from `getWidgetsForRegion()` instead of hardcoded local lists.
+
+## Graph-Bearing Surfaces
+
+`GraphBearingSurfaceContract` is resolved through `getGraphBearingSurface(widgetId, region)`.
+
+All graph-bearing surfaces expose the same actions through `GraphSurfaceActions`:
+
+- `Set Source`, disabled when already active
+- `View Graph`, opening a read-only `GraphPreviewDialog` shell
+
+The current first-party graph-bearing surfaces are Generate, Canvas, and Workflow.
+
+## Failure Isolation
+
+`WidgetFailureBoundary` isolates render failures at widget region boundaries and provides copyable error details. Registration failures are recorded in `WorkbenchState.widgetFailures` and also shown through the shell error surface.