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.

refactor(generation): curate the public interface to six entry modules

joshistoast7610aa466b99
diff --git a/invokeai/frontend/webv2/performance/architecture-baseline.json b/invokeai/frontend/webv2/performance/architecture-baseline.json
index b4f9294716..772bd25303 100644
--- a/invokeai/frontend/webv2/performance/architecture-baseline.json
+++ b/invokeai/frontend/webv2/performance/architecture-baseline.json
@@ -13,13 +13,14 @@
"initialChunkNames": [
"Tooltip",
"WorkflowUiContext",
- "baseGenerationPolicies",
"chakra",
"externalStore",
"graph",
"http",
+ "identity",
"imageUrls",
"index",
+ "promptHistory",
"react",
"rolldown-runtime",
"selectors",
@@ -43,31 +44,32 @@
"baselineBrotliBytes": 889327,
"initialChunkNames": [
"GalleryUiContext",
- "GenerationUiContext",
"QueueUiContext",
"Tooltip",
"WorkbenchApp",
"WorkbenchWidgetRegistryContext",
"WorkflowUiContext",
- "baseGenerationPolicies",
"bboxGrid",
"canvasCompositing",
"canvasStrength",
"chakra",
"contracts",
"draftRegistry",
- "drafts",
"externalStore",
"galleryStateView",
- "generateDraftRegistry",
+ "generateFormViewModel",
"graph",
"http",
+ "identity",
"imageUrls",
"index",
+ "promptHistory",
+ "promptHistoryNavigation",
"queueMenuActions",
"react",
"react",
"react",
+ "react",
"rolldown-runtime",
"selectors",
"settings",
diff --git a/invokeai/frontend/webv2/scripts/write-contract-caller-matrix.mjs b/invokeai/frontend/webv2/scripts/write-contract-caller-matrix.mjs
index c552c3e3f5..5a8f131ee9 100644
--- a/invokeai/frontend/webv2/scripts/write-contract-caller-matrix.mjs
+++ b/invokeai/frontend/webv2/scripts/write-contract-caller-matrix.mjs
@@ -35,22 +35,12 @@ const hubs = [
'features/models/index.ts',
'features/models/react.ts',
'features/nodes/index.ts',
- 'features/generation/batch.ts',
- 'features/generation/canvas.ts',
+ 'features/generation/components.ts',
'features/generation/contracts.ts',
- 'features/generation/draft-values.ts',
- 'features/generation/drafts.ts',
- 'features/generation/form.ts',
'features/generation/graph.ts',
- 'features/generation/hotkeys.ts',
'features/generation/index.ts',
- 'features/generation/prompt.ts',
- 'features/generation/prompt-ui.ts',
'features/generation/react.ts',
- 'features/generation/reference-ui.ts',
'features/generation/settings.ts',
- 'features/generation/settings-ui.ts',
- 'features/generation/utility.ts',
'features/generation/widget.ts',
'features/workflow/contracts.ts',
'features/workflow/graph.ts',
diff --git a/invokeai/frontend/webv2/src/app/UpscaleUiAdapter.tsx b/invokeai/frontend/webv2/src/app/UpscaleUiAdapter.tsx
index 7cfa236b3b..1bf091334b 100644
--- a/invokeai/frontend/webv2/src/app/UpscaleUiAdapter.tsx
+++ b/invokeai/frontend/webv2/src/app/UpscaleUiAdapter.tsx
@@ -1,7 +1,7 @@
import type { UpscaleUiAdapter } from '@features/upscale';
import type { ReactNode } from 'react';
-import { areProjectPromptDraftsEqual, getPromptDraftFromValues } from '@features/generation/utility';
+import { areProjectPromptDraftsEqual, getPromptDraftFromValues } from '@features/generation/settings';
import { UpscaleUiProvider } from '@features/upscale';
import { getProjectWidgetValues } from '@workbench/widgetState';
import { useActiveProjectSelector, useWorkbenchCommands } from '@workbench/WorkbenchContext';
diff --git a/invokeai/frontend/webv2/src/app/WorkflowUiAdapter.tsx b/invokeai/frontend/webv2/src/app/WorkflowUiAdapter.tsx
index 123fb0b114..248e5a2008 100644
--- a/invokeai/frontend/webv2/src/app/WorkflowUiAdapter.tsx
+++ b/invokeai/frontend/webv2/src/app/WorkflowUiAdapter.tsx
@@ -1,7 +1,7 @@
import type { WorkflowModelSelectProps, WorkflowUiAdapter } from '@features/workflow/react';
import type { ComponentType, ReactNode } from 'react';
-import { flushGenerateDrafts } from '@features/generation/drafts';
+import { flushGenerateDrafts } from '@features/generation/react';
import { useAuthSession } from '@features/identity';
import { ensureModelsLoaded, useModelsSelector } from '@features/models';
import { nodeExecutionStore } from '@features/nodes';
diff --git a/invokeai/frontend/webv2/src/architecture/featureInterfaces.ts b/invokeai/frontend/webv2/src/architecture/featureInterfaces.ts
index cff0071ac4..ae515744d5 100644
--- a/invokeai/frontend/webv2/src/architecture/featureInterfaces.ts
+++ b/invokeai/frontend/webv2/src/architecture/featureInterfaces.ts
@@ -6,24 +6,7 @@
*/
export const FEATURE_PUBLIC_INTERFACES: Readonly<Record<string, readonly string[]>> = {
gallery: ['contracts', 'queries', 'react', 'utility', 'widget'],
- generation: [
- 'batch',
- 'canvas',
- 'contracts',
- 'draft-values',
- 'drafts',
- 'form',
- 'graph',
- 'hotkeys',
- 'prompt',
- 'prompt-ui',
- 'react',
- 'reference-ui',
- 'settings',
- 'settings-ui',
- 'utility',
- 'widget',
- ],
+ generation: ['components', 'contracts', 'graph', 'react', 'settings', 'widget'],
identity: [],
models: ['react'],
nodes: [],
diff --git a/invokeai/frontend/webv2/src/features/generation/batch.ts b/invokeai/frontend/webv2/src/features/generation/batch.ts
deleted file mode 100644
index de43c75d8b..0000000000
--- a/invokeai/frontend/webv2/src/features/generation/batch.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from './core/batch';
diff --git a/invokeai/frontend/webv2/src/features/generation/canvas.ts b/invokeai/frontend/webv2/src/features/generation/canvas.ts
deleted file mode 100644
index 0b781e9168..0000000000
--- a/invokeai/frontend/webv2/src/features/generation/canvas.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-export * from './core/canvas/addControlLayers';
-export * from './core/canvas/addRegionalGuidance';
-export * from './core/canvas/canvasMode';
-export * from './core/canvas/compileCanvasGraph';
-export * from './core/canvas/controlValidation';
-export type * from './core/canvas/types';
diff --git a/invokeai/frontend/webv2/src/features/generation/components.ts b/invokeai/frontend/webv2/src/features/generation/components.ts
new file mode 100644
index 0000000000..d21a3d1310
--- /dev/null
+++ b/invokeai/frontend/webv2/src/features/generation/components.ts
@@ -0,0 +1,11 @@
+/**
+ * Generation's reusable UI components: prompt fields, reference-image controls,
+ * and the settings section shell shared with other widgets.
+ * Curated, caller-driven export list — add a symbol only when a consumer needs it.
+ */
+export { NegativePromptField } from './ui/promptFields/NegativePromptField';
+export { PositivePromptField } from './ui/promptFields/PositivePromptField';
+export { PromptTextarea } from './ui/promptFields/PromptTextarea';
+export { PROMPT_ATTENTION_TARGET_PROPS } from './ui/promptFields/promptAttentionHotkeys';
+export { FluxReduxControls } from './ui/reference-images/ReferenceImageControls';
+export { GenerateCollapsibleSection as GenerationSettingsSection } from './ui/shared/GenerateCollapsibleSection';
diff --git a/invokeai/frontend/webv2/src/features/generation/draft-values.ts b/invokeai/frontend/webv2/src/features/generation/draft-values.ts
deleted file mode 100644
index 52dcde6ca6..0000000000
--- a/invokeai/frontend/webv2/src/features/generation/draft-values.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { useDebouncedDraftValue } from './ui/useDebouncedDraftValue';
diff --git a/invokeai/frontend/webv2/src/features/generation/drafts.ts b/invokeai/frontend/webv2/src/features/generation/drafts.ts
deleted file mode 100644
index 4f046f605d..0000000000
--- a/invokeai/frontend/webv2/src/features/generation/drafts.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { flushGenerateDrafts, useRegisterGenerateDraftFlusher } from './ui/generateDraftRegistry';
diff --git a/invokeai/frontend/webv2/src/features/generation/form.ts b/invokeai/frontend/webv2/src/features/generation/form.ts
deleted file mode 100644
index 649489a358..0000000000
--- a/invokeai/frontend/webv2/src/features/generation/form.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export {
- createGenerateFormValuesSelector,
- getGenerateFormCommitPatch,
- getSettingsWithLatestPromptFields,
-} from './ui/generateFormViewModel';
diff --git a/invokeai/frontend/webv2/src/features/generation/graph.ts b/invokeai/frontend/webv2/src/features/generation/graph.ts
index 97351ddbc8..968c38b82f 100644
--- a/invokeai/frontend/webv2/src/features/generation/graph.ts
+++ b/invokeai/frontend/webv2/src/features/generation/graph.ts
@@ -1,2 +1,22 @@
-export * from './core/graph';
-export * from './core/graphBuilder';
+/**
+ * Generation's graph-compilation surface: generate/canvas graph compilers and
+ * the graph-builder primitives shared with other invocation sources.
+ * Curated, caller-driven export list — add a symbol only when a consumer needs it.
+ */
+export { addLoraCollectionLoader, compileGenerateGraph, resolveGenerateSeed } from './core/graph';
+export { addEdge, addNode, getActiveCompatibleLoras, toGraphContract, toModelIdentifier } from './core/graphBuilder';
+export { compileCanvasGraph } from './core/canvas/compileCanvasGraph';
+export { detectCanvasMode } from './core/canvas/canvasMode';
+export {
+ type ControlAdapterKind,
+ getControlValidationReason,
+ isControlKindSupportedForBase,
+} from './core/canvas/controlValidation';
+export {
+ getRegionalGuidanceRejectionReason,
+ isRegionalGuidanceSupportedForBase,
+ type RegionalGuidanceInput,
+ type RegionalReferenceImageInput,
+} from './core/canvas/addRegionalGuidance';
+export type { ControlLayerGraphInput } from './core/canvas/addControlLayers';
+export type { CanvasCompileMode } from './core/canvas/types';
diff --git a/invokeai/frontend/webv2/src/features/generation/hotkeys.ts b/invokeai/frontend/webv2/src/features/generation/hotkeys.ts
deleted file mode 100644
index ebc76c5953..0000000000
--- a/invokeai/frontend/webv2/src/features/generation/hotkeys.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export { adjustFocusedPromptAttention } from './ui/promptFields/promptAttentionHotkeys';
-export { focusPositivePrompt } from './ui/promptFields/promptFocus';
-export { promptHistoryNavigation } from './ui/promptFields/promptHistoryNavigation';
diff --git a/invokeai/frontend/webv2/src/features/generation/prompt-ui.ts b/invokeai/frontend/webv2/src/features/generation/prompt-ui.ts
deleted file mode 100644
index 21e75a5e44..0000000000
--- a/invokeai/frontend/webv2/src/features/generation/prompt-ui.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export { NegativePromptField } from './ui/promptFields/NegativePromptField';
-export { PositivePromptField } from './ui/promptFields/PositivePromptField';
-export { PromptTextarea } from './ui/promptFields/PromptTextarea';
-export { PROMPT_ATTENTION_TARGET_PROPS } from './ui/promptFields/promptAttentionHotkeys';
diff --git a/invokeai/frontend/webv2/src/features/generation/prompt.ts b/invokeai/frontend/webv2/src/features/generation/prompt.ts
deleted file mode 100644
index 06ecd3fcc8..0000000000
--- a/invokeai/frontend/webv2/src/features/generation/prompt.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export * from './core/prompt/ast';
-export * from './core/prompt/attention';
-export * from './core/prompt/highlight';
-export * from './core/promptHistory';
-export * from './core/promptUtilities';
diff --git a/invokeai/frontend/webv2/src/features/generation/react.ts b/invokeai/frontend/webv2/src/features/generation/react.ts
index aa8ded7a19..c51d6ce0e5 100644
--- a/invokeai/frontend/webv2/src/features/generation/react.ts
+++ b/invokeai/frontend/webv2/src/features/generation/react.ts
@@ -1,7 +1,12 @@
-export {
- GenerationModelSelect,
- GenerationUiProvider,
- useGenerationUi,
- type GenerationModelSelectProps,
- type GenerationUiAdapter,
-} from './ui/GenerationUiContext';
+/**
+ * Generation's React integration surface: the UI port provider, draft
+ * registry/flushing, form view-model selectors, and prompt hotkey handlers.
+ * Curated, caller-driven export list — add a symbol only when a consumer needs it.
+ */
+export { GenerationUiProvider, type GenerationUiAdapter } from './ui/GenerationUiContext';
+export { flushGenerateDrafts, useRegisterGenerateDraftFlusher } from './ui/generateDraftRegistry';
+export { useDebouncedDraftValue } from './ui/useDebouncedDraftValue';
+export { createGenerateFormValuesSelector } from './ui/generateFormViewModel';
+export { adjustFocusedPromptAttention } from './ui/promptFields/promptAttentionHotkeys';
+export { focusPositivePrompt } from './ui/promptFields/promptFocus';
+export { promptHistoryNavigation } from './ui/promptFields/promptHistoryNavigation';
diff --git a/invokeai/frontend/webv2/src/features/generation/reference-ui.ts b/invokeai/frontend/webv2/src/features/generation/reference-ui.ts
deleted file mode 100644
index 4ab921db38..0000000000
--- a/invokeai/frontend/webv2/src/features/generation/reference-ui.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { FluxReduxControls } from './ui/reference-images/ReferenceImageControls';
diff --git a/invokeai/frontend/webv2/src/features/generation/settings-ui.ts b/invokeai/frontend/webv2/src/features/generation/settings-ui.ts
deleted file mode 100644
index cb0d5c7bf5..0000000000
--- a/invokeai/frontend/webv2/src/features/generation/settings-ui.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export {
- GenerateCollapsibleSection,
- GenerateCollapsibleSection as GenerationSettingsSection,
-} from './ui/shared/GenerateCollapsibleSection';
diff --git a/invokeai/frontend/webv2/src/features/generation/settings.ts b/invokeai/frontend/webv2/src/features/generation/settings.ts
index c64e22c46b..3a45a2f073 100644
--- a/invokeai/frontend/webv2/src/features/generation/settings.ts
+++ b/invokeai/frontend/webv2/src/features/generation/settings.ts
@@ -1,3 +1,64 @@
-export * from './core/baseGenerationPolicies';
-export * from './core/componentCompatibility';
-export * from './core/settings';
+/**
+ * Generation's React-free values/policy surface: settings normalization, base
+ * policies, batch limits, prompt history, prompt drafts, and reference images.
+ * Curated, caller-driven export list — add a symbol only when a consumer needs it.
+ */
+export {
+ calculateNewSize,
+ clampDimension,
+ cloneGenerateWidgetValues,
+ DEFAULT_NEGATIVE_PROMPT_HEIGHT_PX,
+ DEFAULT_POSITIVE_PROMPT_HEIGHT_PX,
+ deriveAspectRatioId,
+ getDefaultLoraWeight,
+ getModelDefaultVae,
+ hasModelDefaultVae,
+ isLoraCompatibleWithModel,
+ isLoraModelConfig,
+ isMainModelConfig,
+ isModelIdentifierConfig,
+ isVaeModelConfig,
+ MAX_NEGATIVE_PROMPT_HEIGHT_PX,
+ MAX_POSITIVE_PROMPT_HEIGHT_PX,
+ MIN_NEGATIVE_PROMPT_HEIGHT_PX,
+ MIN_POSITIVE_PROMPT_HEIGHT_PX,
+ normalizeGenerateSettings,
+ normalizeGenerateWidgetValues,
+ normalizeReferenceImages,
+ SEED_MAX,
+ syncGenerateWidgetValuesWithModels,
+} from './core/settings';
+export {
+ coerceSchedulerForGraph,
+ createReferenceImageId,
+ getCompatibleReferenceImages,
+ getDefaultGenerateSettings,
+ getDefaultReferenceImageConfig,
+ getGenerationDimensions,
+ getGenerationModelAvailabilityReasons,
+ getGenerationUiPolicy,
+ getGenerationValidationReasons,
+ getMaxReferenceImages,
+ getSettingsWithModelDefaults,
+ isKnownScheduler,
+ isReferenceImageSupported,
+ isSupportedGenerateModel,
+ SCHEDULER_OPTIONS,
+} from './core/baseGenerationPolicies';
+export { isVaeCompatibleWithGenerateModel } from './core/componentCompatibility';
+export { MIN_BATCH_COUNT, sanitizeBatchCount } from './core/batch';
+export {
+ addPromptHistoryItem,
+ getPromptHistoryItemFromGenerateSettings,
+ MAX_PROMPT_HISTORY,
+ removePromptHistoryItem,
+} from './core/promptHistory';
+export {
+ applyProjectPromptDraft,
+ areProjectPromptDraftsEqual,
+ getPromptDraftFromValues,
+ migrateProjectPromptDraft,
+ type ProjectPromptDraft,
+ type ProjectPromptDraftPatch,
+} from './core/projectPromptDraft';
+export { generatedImageToReferenceImage, getEffectiveReferenceImage } from './core/referenceImage';
diff --git a/invokeai/frontend/webv2/src/features/generation/utility.ts b/invokeai/frontend/webv2/src/features/generation/utility.ts
deleted file mode 100644
index 8521e9d0fb..0000000000
--- a/invokeai/frontend/webv2/src/features/generation/utility.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export * from './core/projectPromptDraft';
-export * from './core/referenceImage';
diff --git a/invokeai/frontend/webv2/src/features/upscale/core/settings.ts b/invokeai/frontend/webv2/src/features/upscale/core/settings.ts
index 95b6577cce..7a129d7f63 100644
--- a/invokeai/frontend/webv2/src/features/upscale/core/settings.ts
+++ b/invokeai/frontend/webv2/src/features/upscale/core/settings.ts
@@ -7,9 +7,9 @@ import type {
} from '@features/generation/contracts';
import type { ModelConfig } from '@features/models';
-import { sanitizeBatchCount } from '@features/generation/batch';
import {
DEFAULT_NEGATIVE_PROMPT_HEIGHT_PX,
+ sanitizeBatchCount,
DEFAULT_POSITIVE_PROMPT_HEIGHT_PX,
isLoraCompatibleWithModel,
isLoraModelConfig,
diff --git a/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleUiContext.tsx b/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleUiContext.tsx
index c177e6328a..632c77ae87 100644
--- a/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleUiContext.tsx
+++ b/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleUiContext.tsx
@@ -1,4 +1,4 @@
-import type { ProjectPromptDraft, ProjectPromptDraftPatch } from '@features/generation/utility';
+import type { ProjectPromptDraft, ProjectPromptDraftPatch } from '@features/generation/settings';
import type { UpscaleWidgetValues } from '@features/upscale/core/types';
import type { ReactNode } from 'react';
diff --git a/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx b/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx
index c99c94c34a..127062f934 100644
--- a/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx
+++ b/invokeai/frontend/webv2/src/features/upscale/ui/UpscaleWidgetView.tsx
@@ -1,6 +1,6 @@
/* oxlint-disable react-perf/jsx-no-new-object-as-prop, react-perf/jsx-no-new-function-as-prop, react-perf/jsx-no-new-array-as-prop */
import type { GenerateLora, MainModelConfig, PromptHistoryItem, VaePrecision } from '@features/generation/contracts';
-import type { ProjectPromptDraft, ProjectPromptDraftPatch } from '@features/generation/utility';
+import type { ProjectPromptDraft, ProjectPromptDraftPatch } from '@features/generation/settings';
import type { ModelConfig } from '@features/models';
import type { UpscaleWidgetValues } from '@features/upscale/core/types';
import type { ChangeEvent } from 'react';
@@ -24,8 +24,8 @@ import {
} from '@chakra-ui/react';
import { useDndMonitor, useDroppable } from '@dnd-kit/core';
import { galleryImages, galleryTransfers } from '@features/gallery';
-import { isGalleryImageDragData } from '@features/gallery/utility';
-import { NegativePromptField, PositivePromptField } from '@features/generation/prompt-ui';
+import { galleryImageUrls, isGalleryImageDragData } from '@features/gallery/utility';
+import { GenerationSettingsSection, NegativePromptField, PositivePromptField } from '@features/generation/components';
import {
SCHEDULER_OPTIONS,
getDefaultLoraWeight,
@@ -35,7 +35,6 @@ import {
isVaeModelConfig,
SEED_MAX,
} from '@features/generation/settings';
-import { GenerateCollapsibleSection } from '@features/generation/settings-ui';
import { ensureModelsLoaded, useModelsSelector } from '@features/models';
import { ModelSelect } from '@features/models/react';
import {
@@ -443,7 +442,7 @@ const UpscaleImageField = ({
outline="1px solid rgba(0, 0, 0, 0.1)"
outlineOffset="-1px"
rounded="sm"
- src={galleryImages.thumbnailUrl(inputImage.image_name)}
+ src={galleryImageUrls.thumbnail(inputImage.image_name)}
_dark={{ outlineColor: 'rgba(255, 255, 255, 0.1)' }}
/>
</Box>
@@ -610,7 +609,7 @@ export const UpscaleWidgetView = () => {
values={values}
/>
- <GenerateCollapsibleSection label={t('widgets.upscale.sourceAndTreatment')} defaultOpen>
+ <GenerationSettingsSection label={t('widgets.upscale.sourceAndTreatment')} defaultOpen>
<Stack gap="3" p="2">
<UpscaleImageField inputImage={values.inputImage} onChange={(inputImage) => patch({ inputImage })} />
<UpscaleOutputPreflight values={values} />
@@ -688,9 +687,9 @@ export const UpscaleWidgetView = () => {
onChange={(structure) => patch({ structure })}
/>
</Stack>
- </GenerateCollapsibleSection>
+ </GenerationSettingsSection>
- <GenerateCollapsibleSection badges={t('widgets.upscale.shared')} label={t('widgets.upscale.detailGuidance')}>
+ <GenerationSettingsSection badges={t('widgets.upscale.shared')} label={t('widgets.upscale.detailGuidance')}>
<UpscalePromptFields
promptDraft={selection.promptDraft}
projectId={selection.projectId}
@@ -699,9 +698,9 @@ export const UpscaleWidgetView = () => {
onPatchPromptDraft={patchPromptDraft}
onPatchValues={patch}
/>
- </GenerateCollapsibleSection>
+ </GenerationSettingsSection>
- <GenerateCollapsibleSection label={t('widgets.upscale.generation')}>
+ <GenerationSettingsSection label={t('widgets.upscale.generation')}>
<Stack gap="3" p="2">
<Field
error={values.model ? undefined : t('widgets.upscale.mainModelRequired')}
@@ -860,9 +859,9 @@ export const UpscaleWidgetView = () => {
</HStack>
))}
</Stack>
- </GenerateCollapsibleSection>
+ </GenerationSettingsSection>
- <GenerateCollapsibleSection label={t('widgets.upscale.advanced')}>
+ <GenerationSettingsSection label={t('widgets.upscale.advanced')}>
<Stack gap="3" p="2">
<Field
error={values.tileControlnetModel ? undefined : t('widgets.upscale.tileControlNetRequired')}
@@ -948,7 +947,7 @@ export const UpscaleWidgetView = () => {
</Field>
) : null}
</Stack>
- </GenerateCollapsibleSection>
+ </GenerationSettingsSection>
</Stack>
);
};
diff --git a/invokeai/frontend/webv2/src/workbench/WorkbenchSessionController.tsx b/invokeai/frontend/webv2/src/workbench/WorkbenchSessionController.tsx
index 86c16365b7..bfac410a45 100644
--- a/invokeai/frontend/webv2/src/workbench/WorkbenchSessionController.tsx
+++ b/invokeai/frontend/webv2/src/workbench/WorkbenchSessionController.tsx
@@ -1,4 +1,4 @@
-import { flushGenerateDrafts } from '@features/generation/drafts';
+import { flushGenerateDrafts } from '@features/generation/react';
import { useMountEffect } from '@platform/react/useMountEffect';
import { areArraysEqual } from '@platform/state/selectors';
import { useNavigate } from '@tanstack/react-router';
diff --git a/invokeai/frontend/webv2/src/workbench/hotkeys/firstPartyCommands.ts b/invokeai/frontend/webv2/src/workbench/hotkeys/firstPartyCommands.ts
index de6adf247d..7159418a43 100644
--- a/invokeai/frontend/webv2/src/workbench/hotkeys/firstPartyCommands.ts
+++ b/invokeai/frontend/webv2/src/workbench/hotkeys/firstPartyCommands.ts
@@ -1,11 +1,11 @@
import type { ImageRecallKind } from '@workbench/image-actions/imageRecall';
-import { flushGenerateDrafts } from '@features/generation/drafts';
import {
adjustFocusedPromptAttention,
+ flushGenerateDrafts,
focusPositivePrompt,
promptHistoryNavigation,
-} from '@features/generation/hotkeys';
+} from '@features/generation/react';
import { ensureModelsLoaded, getModelsSnapshot } from '@features/models';
import { queueCommands } from '@features/queue';
import { useInvocationTemplatesSelector } from '@features/workflow/react';
diff --git a/invokeai/frontend/webv2/src/workbench/image-actions/executeImageRecall.ts b/invokeai/frontend/webv2/src/workbench/image-actions/executeImageRecall.ts
index 9553dec8d8..bcd68ea3fc 100644
--- a/invokeai/frontend/webv2/src/workbench/image-actions/executeImageRecall.ts
+++ b/invokeai/frontend/webv2/src/workbench/image-actions/executeImageRecall.ts
@@ -6,11 +6,11 @@ import type { WorkbenchCommands } from '@workbench/workbenchStore';
import { galleryImages } from '@features/gallery';
import {
getDefaultGenerateSettings,
+ getEffectiveReferenceImage,
isSupportedGenerateModel,
isVaeModelConfig,
normalizeGenerateWidgetValues,
} from '@features/generation/settings';
-import { getEffectiveReferenceImage } from '@features/generation/utility';
import {
buildImageRecallSettings,
diff --git a/invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts b/invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts
index a68522ad3e..b0e4b76306 100644
--- a/invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts
+++ b/invokeai/frontend/webv2/src/workbench/image-actions/useImageActions.ts
@@ -9,13 +9,13 @@ import {
} from '@features/gallery';
import {
createReferenceImageId,
+ generatedImageToReferenceImage,
getDefaultReferenceImageConfig,
getMaxReferenceImages,
isVaeModelConfig,
isReferenceImageSupported,
isSupportedGenerateModel,
} from '@features/generation/settings';
-import { generatedImageToReferenceImage } from '@features/generation/utility';
import { ensureModelsLoaded, useModelsSelector } from '@features/models';
import { useMountEffect } from '@platform/react/useMountEffect';
import {
diff --git a/invokeai/frontend/webv2/src/workbench/projects/components/OpenProjectDialog.tsx b/invokeai/frontend/webv2/src/workbench/projects/components/OpenProjectDialog.tsx
index 6ebce8a2f5..4cee8c998d 100644
--- a/invokeai/frontend/webv2/src/workbench/projects/components/OpenProjectDialog.tsx
+++ b/invokeai/frontend/webv2/src/workbench/projects/components/OpenProjectDialog.tsx
@@ -1,5 +1,5 @@
import { Dialog, Icon, Portal, Spinner, Stack, Text } from '@chakra-ui/react';
-import { flushGenerateDrafts } from '@features/generation/drafts';
+import { flushGenerateDrafts } from '@features/generation/react';
import { useMountEffect } from '@platform/react/useMountEffect';
import { areArraysEqual } from '@platform/state/selectors';
import { Button, CloseButton, Row, Scrollable } from '@platform/ui';
diff --git a/invokeai/frontend/webv2/src/workbench/projects/components/ProjectTabs.tsx b/invokeai/frontend/webv2/src/workbench/projects/components/ProjectTabs.tsx
index 2c611249f1..bdacc7ce1f 100644
--- a/invokeai/frontend/webv2/src/workbench/projects/components/ProjectTabs.tsx
+++ b/invokeai/frontend/webv2/src/workbench/projects/components/ProjectTabs.tsx
@@ -2,7 +2,7 @@ import type { WidgetRegion } from '@workbench/layoutContracts';
import type { Project } from '@workbench/projectContracts';
import { Flex, Icon, Menu, Portal, ScrollArea, Separator } from '@chakra-ui/react';
-import { flushGenerateDrafts } from '@features/generation/drafts';
+import { flushGenerateDrafts } from '@features/generation/react';
import { useModelLoads } from '@features/models';
import { getProjectQueueIndicatorState, type QueueItem } from '@features/queue/contracts';
import { useQueueItemProgress } from '@features/queue/react';
diff --git a/invokeai/frontend/webv2/src/workbench/projects/useProjectActions.ts b/invokeai/frontend/webv2/src/workbench/projects/useProjectActions.ts
index 0268febc30..35a7db2c29 100644
--- a/invokeai/frontend/webv2/src/workbench/projects/useProjectActions.ts
+++ b/invokeai/frontend/webv2/src/workbench/projects/useProjectActions.ts
@@ -1,6 +1,6 @@
import type { Project } from '@workbench/projectContracts';
-import { flushGenerateDrafts } from '@features/generation/drafts';
+import { flushGenerateDrafts } from '@features/generation/react';
import { useNavigate } from '@tanstack/react-router';
import { useNotify } from '@workbench/useNotify';
import {
diff --git a/invokeai/frontend/webv2/src/workbench/queue-integration/QueueItemActions.tsx b/invokeai/frontend/webv2/src/workbench/queue-integration/QueueItemActions.tsx
index 89d9dd7994..d6e5a813da 100644
--- a/invokeai/frontend/webv2/src/workbench/queue-integration/QueueItemActions.tsx
+++ b/invokeai/frontend/webv2/src/workbench/queue-integration/QueueItemActions.tsx
@@ -1,7 +1,7 @@
import type { QueueItemReadModel } from '@features/queue/contracts';
import { Dialog, Icon, Portal } from '@chakra-ui/react';
-import { createGenerateFormValuesSelector } from '@features/generation/form';
+import { createGenerateFormValuesSelector } from '@features/generation/react';
import { isSupportedGenerateModel } from '@features/generation/settings';
import { ensureModelsLoaded, useModelsSelector } from '@features/models';
import { extractGenerationMeta } from '@features/queue/contracts';
diff --git a/invokeai/frontend/webv2/src/workbench/shell/topbar/BatchCountField.tsx b/invokeai/frontend/webv2/src/workbench/shell/topbar/BatchCountField.tsx
index f924eb6339..f26643e9cb 100644
--- a/invokeai/frontend/webv2/src/workbench/shell/topbar/BatchCountField.tsx
+++ b/invokeai/frontend/webv2/src/workbench/shell/topbar/BatchCountField.tsx
@@ -1,5 +1,5 @@
import { NumberInput } from '@chakra-ui/react';
-import { MIN_BATCH_COUNT, sanitizeBatchCount } from '@features/generation/batch';
+import { MIN_BATCH_COUNT, sanitizeBatchCount } from '@features/generation/settings';
import { useActiveProjectSelector, useWorkbenchCommands } from '@workbench/WorkbenchContext';
import { useCallback } from 'react';
diff --git a/invokeai/frontend/webv2/src/workbench/shell/topbar/InvokeControl.tsx b/invokeai/frontend/webv2/src/workbench/shell/topbar/InvokeControl.tsx
index aa93a6a908..c462f28733 100644
--- a/invokeai/frontend/webv2/src/workbench/shell/topbar/InvokeControl.tsx
+++ b/invokeai/frontend/webv2/src/workbench/shell/topbar/InvokeControl.tsx
@@ -1,8 +1,8 @@
import type { InvocationRoute, InvocationSourceId, ResultDestination } from '@workbench/invocationContracts';
import { Flex, Group, HStack, Icon, Menu, Portal, Separator, Stack, Text, VStack } from '@chakra-ui/react';
-import { sanitizeBatchCount } from '@features/generation/batch';
-import { flushGenerateDrafts } from '@features/generation/drafts';
+import { flushGenerateDrafts } from '@features/generation/react';
+import { sanitizeBatchCount } from '@features/generation/settings';
import { ensureModelsLoaded, useModelsSelector } from '@features/models';
import { useInvocationTemplatesSelector } from '@features/workflow/react';
import { useMountEffect } from '@platform/react/useMountEffect';
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/GenerateCanvasCompositingSection.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/GenerateCanvasCompositingSection.tsx
index e2ceff3e87..82f4775f2a 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/GenerateCanvasCompositingSection.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/GenerateCanvasCompositingSection.tsx
@@ -15,7 +15,7 @@ import type { NumberInput as ChakraNumberInput, SelectValueChangeDetails } from
import type { CanvasCoherenceMode, CanvasInfillMethod } from '@workbench/widgets/canvas/invoke/canvasCompositing';
import { createListCollection, NumberInput, Stack } from '@chakra-ui/react';
-import { GenerationSettingsSection } from '@features/generation/settings-ui';
+import { GenerationSettingsSection } from '@features/generation/components';
import { Field, Select } from '@platform/ui';
import {
CANVAS_COHERENCE_EDGE_SIZE_MAX,
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/invoke/prepareCanvasInvocation.ts b/invokeai/frontend/webv2/src/workbench/widgets/canvas/invoke/prepareCanvasInvocation.ts
index 06590e5398..8e90dafa95 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/invoke/prepareCanvasInvocation.ts
+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/invoke/prepareCanvasInvocation.ts
@@ -51,8 +51,8 @@ import {
type ControlLayerGraphInput,
type RegionalGuidanceInput,
type RegionalReferenceImageInput,
-} from '@features/generation/canvas';
-import { resolveGenerateSeed } from '@features/generation/graph';
+ resolveGenerateSeed,
+} from '@features/generation/graph';
import { normalizeGenerateWidgetValues, syncGenerateWidgetValuesWithModels } from '@features/generation/settings';
import { getCanvasEngine, getCanvasOperations } from '@workbench/canvas-operations/api';
import {
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/ControlLayerSettings.tsx b/invokeai/frontend/webv2/src/workbench/widgets/layers/ControlLayerSettings.tsx
index 2dd911f18f..9ebe18e460 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/ControlLayerSettings.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/ControlLayerSettings.tsx
@@ -16,7 +16,7 @@ import {
getControlValidationReason,
isControlKindSupportedForBase,
type ControlAdapterKind,
-} from '@features/generation/canvas';
+} from '@features/generation/graph';
import { useModelsSelector } from '@features/models';
import { Field, Select, Slider } from '@platform/ui';
import { getCanvasOperations, resolveDefaultFilterForModel } from '@workbench/canvas-operations/api';
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/LayersPanelHeader.tsx b/invokeai/frontend/webv2/src/workbench/widgets/layers/LayersPanelHeader.tsx
index db0bc48445..347a533ce6 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/LayersPanelHeader.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/LayersPanelHeader.tsx
@@ -9,8 +9,7 @@ import type { CanvasEngineHandle } from '@workbench/widgets/canvas/useCanvasEngi
import type { Dispatch } from 'react';
import { Box, createListCollection, Flex, HStack, NumberInput, Stack } from '@chakra-ui/react';
-import { useDebouncedDraftValue } from '@features/generation/draft-values';
-import { useRegisterGenerateDraftFlusher } from '@features/generation/drafts';
+import { useDebouncedDraftValue, useRegisterGenerateDraftFlusher } from '@features/generation/react';
import { ColorPicker, Field, Select, Slider } from '@platform/ui';
import { useCanvasProjectMutationDispatch } from '@workbench/useCanvasProjectMutationDispatch';
import { useCanvasDocumentEditingLocked } from '@workbench/widgets/canvas/engineStoreHooks';
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/RegionalGuidanceSettings.tsx b/invokeai/frontend/webv2/src/workbench/widgets/layers/RegionalGuidanceSettings.tsx
index fb586419b3..6f6e937209 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/RegionalGuidanceSettings.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/RegionalGuidanceSettings.tsx
@@ -15,8 +15,7 @@ import { Box, createListCollection, HStack, IconButton, Input, Stack, Switch, Te
import { useDndMonitor, useDroppable } from '@dnd-kit/core';
import { galleryImages, galleryTransfers } from '@features/gallery';
import { isGalleryImageDragData } from '@features/gallery/utility';
-import { PROMPT_ATTENTION_TARGET_PROPS, PromptTextarea } from '@features/generation/prompt-ui';
-import { FluxReduxControls } from '@features/generation/reference-ui';
+import { FluxReduxControls, PROMPT_ATTENTION_TARGET_PROPS, PromptTextarea } from '@features/generation/components';
import { useModelsSelector } from '@features/models';
import { Button, ColorPicker, Field, Select, Slider } from '@platform/ui';
import { useCanvasProjectMutationDispatch } from '@workbench/useCanvasProjectMutationDispatch';
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/controlModelOptions.ts b/invokeai/frontend/webv2/src/workbench/widgets/layers/controlModelOptions.ts
index fb78fe7fa9..6a0700b174 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/controlModelOptions.ts
+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/controlModelOptions.ts
@@ -1,4 +1,4 @@
-import type { ControlAdapterKind } from '@features/generation/canvas';
+import type { ControlAdapterKind } from '@features/generation/graph';
import type { ModelConfig } from '@features/models';
export const getCompatibleControlModels = (
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx
index cf2f8c1c67..0d30729b73 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx
@@ -17,7 +17,7 @@ import {
getGallerySettings,
} from '@features/gallery/contracts';
import { galleryBoardsOptions, galleryImagesOptions } from '@features/gallery/queries';
-import { createGenerateFormValuesSelector } from '@features/generation/form';
+import { createGenerateFormValuesSelector } from '@features/generation/react';
import { useProgressImage, useRevealHold, type LatestProgressImageSnapshot } from '@features/queue/react';
import {
imageUrlToStreamingSource,
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/project/ProjectWidgetView.tsx b/invokeai/frontend/webv2/src/workbench/widgets/project/ProjectWidgetView.tsx
index 775cb2770b..f6889bc100 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/project/ProjectWidgetView.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/project/ProjectWidgetView.tsx
@@ -1,7 +1,7 @@
import type { Project } from '@workbench/projectContracts';
import { HStack, Icon, Input, Stack, Text } from '@chakra-ui/react';
-import { flushGenerateDrafts } from '@features/generation/drafts';
+import { flushGenerateDrafts } from '@features/generation/react';
import { Button, IconButton, ConfirmDialog, Field, FieldLabel, Panel } from '@platform/ui';
import { useProjectSyncSelector } from '@workbench/projects/syncStore';
import { useProjectActions } from '@workbench/projects/useProjectActions';
diff --git a/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts b/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts
index 6d66a34b9d..0007fd4d42 100644
--- a/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts
+++ b/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts
@@ -10,7 +10,7 @@ import type {
import type { GraphContract } from '@workbench/graphContracts';
import type { Project, WorkbenchState } from '@workbench/projectContracts';
-import { MAX_PROMPT_HISTORY } from '@features/generation/prompt';
+import { MAX_PROMPT_HISTORY } from '@features/generation/settings';
import { describe, expect, it } from 'vitest';
import type { CanvasProjectMutation } from './canvasProjectMutations';
diff --git a/invokeai/frontend/webv2/src/workbench/workbenchState.ts b/invokeai/frontend/webv2/src/workbench/workbenchState.ts
index 90dd81586c..6e455c06b7 100644
--- a/invokeai/frontend/webv2/src/workbench/workbenchState.ts
+++ b/invokeai/frontend/webv2/src/workbench/workbenchState.ts
@@ -47,26 +47,22 @@ import { createNewCanvasStateV2, migrateCanvasStateToV2 } from './canvasMigratio
import { applyCanvasProjectMutation, type CanvasProjectMutation } from './canvasProjectMutations';
import { getProjectWidgetValues } from './widgetState';
export { nextLayerName } from './canvasProjectMutations';
-import { sanitizeBatchCount } from '@features/generation/batch';
import { compileGenerateGraph, resolveGenerateSeed } from '@features/generation/graph';
import {
addPromptHistoryItem,
- getPromptHistoryItemFromGenerateSettings,
- removePromptHistoryItem,
-} from '@features/generation/prompt';
-import {
+ applyProjectPromptDraft,
cloneGenerateWidgetValues,
getGenerationModelAvailabilityReasons,
+ getPromptDraftFromValues,
+ getPromptHistoryItemFromGenerateSettings,
+ migrateProjectPromptDraft,
normalizeGenerateSettings,
normalizeGenerateWidgetValues,
+ type ProjectPromptDraftPatch,
+ removePromptHistoryItem,
+ sanitizeBatchCount,
syncGenerateWidgetValuesWithModels,
} from '@features/generation/settings';
-import {
- applyProjectPromptDraft,
- getPromptDraftFromValues,
- migrateProjectPromptDraft,
- type ProjectPromptDraftPatch,
-} from '@features/generation/utility';
import {
clearDeletedUpscaleInput,
cloneUpscaleWidgetValues,