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.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
refactor(workbench): make project history session-only
Josh Corbettea8314c31946
diff --git a/docs/src/content/docs/development/Front End/project-files.mdx b/docs/src/content/docs/development/Front End/project-files.mdxindex b8b7c2daa7..b02f12a1d6 100644--- a/docs/src/content/docs/development/Front End/project-files.mdx+++ b/docs/src/content/docs/development/Front End/project-files.mdx@@ -100,7 +100,7 @@ Exclusion is two things, not one. The collector skips those keys so their pixelsThe skip is by key on purpose, because the members got there differently. `selectedImage` and the name keys were already missed — `GalleryItem` spells its name field `name`, which no collector key matches — but that is an accident of naming that a rename would have undone. `compareImage` is a `GeneratedImageContract` carrying `imageName`, so it was genuinely being bundled until the exclusion became explicit.-**History is excluded.** The walker skips the `queue`, `graphHistory` and `events` roots, and the `snapshot`, `snapshots` and `recentImages` keys at any depth. Every queue entry embeds a full canvas snapshot and the gallery widget keeps up to sixty recent results, so bundling all of it would turn a working project into a multi-gigabyte archive. References into history survive in the document and resolve on any install that still has those images.+**History is excluded.** The walker skips the `queue`, `graphHistory` and `events` roots, and the `snapshot`, `snapshots` and `recentImages` keys at any depth. The root skip list also recognizes legacy documents, which may still contain the removed graph-history field. New project files strip graph history and session events; historical references are compatibility input and are never bundled as live project assets.## Loadingdiff --git a/invokeai/frontend/webv2/public/locales/en.json b/invokeai/frontend/webv2/public/locales/en.jsonindex c12e7d6e6d..d8b5179456 100644--- a/invokeai/frontend/webv2/public/locales/en.json+++ b/invokeai/frontend/webv2/public/locales/en.json@@ -2583,7 +2583,6 @@"detailsWithEllipsis": "Workflow details…","exportJson": "Export workflow JSON","form": "Form",- "graphHistorySnapshots": "Graph History Snapshots","importJsonWithEllipsis": "Import workflow JSON…","inspectorTabs": {"data": "Data",@@ -2611,7 +2610,6 @@"resizeNodeInspector": "Resize node inspector","runOutputsNotRecorded": "Run outputs are not recorded per node yet; results currently route to the Gallery or Canvas. This tab will show the node's outputs from its most recent run once run records land.","newWorkflowWithEllipsis": "New workflow…",- "saveGraphSnapshot": "Save graph snapshot","saveToLibrary": "Save to library","selectNodeToInspect": "Select a node in the Workflow editor to inspect it.","selectedNodeInspector": "Selected node inspector",diff --git a/invokeai/frontend/webv2/scripts/mock-backend-fixtures.mjs b/invokeai/frontend/webv2/scripts/mock-backend-fixtures.mjsindex 570748e55d..f06397959d 100644--- a/invokeai/frontend/webv2/scripts/mock-backend-fixtures.mjs+++ b/invokeai/frontend/webv2/scripts/mock-backend-fixtures.mjs@@ -633,8 +633,6 @@ const createProjectDocument = ({ index, layers = [], workflowNodes = [] }) => {},version: 3,},- events: [],- graphHistory: [],id,invocation: {destination: 'gallery',diff --git a/invokeai/frontend/webv2/src/app/WorkflowUiAdapter.tsx b/invokeai/frontend/webv2/src/app/WorkflowUiAdapter.tsxindex f275202535..9e5572984b 100644--- a/invokeai/frontend/webv2/src/app/WorkflowUiAdapter.tsx+++ b/invokeai/frontend/webv2/src/app/WorkflowUiAdapter.tsx@@ -140,7 +140,6 @@ export const WorkflowUiAdapterProvider = ({ children }: { children: ReactNode })source: store,select: (snapshot) => ({galleryValues: getProjectWidgetValues(snapshot.activeProject, 'gallery'),- graphHistory: snapshot.activeProject.graphHistory,id: snapshot.activeProject.id,isWorkflowRunning: hasPendingWorkflowQueueItem(snapshot.activeProject.queue.items),projectGraph: snapshot.activeProject.projectGraph,@@ -177,8 +176,6 @@ export const WorkflowUiAdapterProvider = ({ children }: { children: ReactNode })editGraph: commands.workflows.editGraph,redo: commands.workflows.redo,replace: commands.workflows.replace,- restoreSnapshot: commands.workflows.restoreSnapshot,- saveSnapshot: commands.workflows.saveSnapshot,undo: commands.workflows.undo,},getProjectGraph: () => queries.getSnapshot().activeProject.projectGraph,diff --git a/invokeai/frontend/webv2/src/architecture/workbenchOwnershipManifest.json b/invokeai/frontend/webv2/src/architecture/workbenchOwnershipManifest.jsonindex ed99525d38..5a1df785c4 100644--- a/invokeai/frontend/webv2/src/architecture/workbenchOwnershipManifest.json+++ b/invokeai/frontend/webv2/src/architecture/workbenchOwnershipManifest.json@@ -125,6 +125,7 @@"projectCanvasGate.ts": "workbench","projectContracts.ts": "workbench","projectEventContracts.ts": "workbench",+ "projectEvents.ts": "workbench","queueHistoryContracts.ts": "workbench","queueHistoryNormalization.ts": "workbench","useCanvasProjectMutationDispatch.ts": "workbench",diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowDialogHost.browser.test.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowDialogHost.browser.test.tsxindex 47e5b60e17..48180ce11c 100644--- a/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowDialogHost.browser.test.tsx+++ b/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowDialogHost.browser.test.tsx@@ -92,7 +92,6 @@ describe('WorkflowDialogHost library autosave under StrictMode', () => {const boundGraph = { ...createProjectGraph('workflow-1'), libraryWorkflowId: 'library-workflow-1' };const project = createMutablePort({galleryValues: {},- graphHistory: [],id: 'project-1',isWorkflowRunning: false,projectGraph: boundGraph,@@ -106,8 +105,6 @@ describe('WorkflowDialogHost library autosave under StrictMode', () => {editGraph: vi.fn(),redo: vi.fn(),replace: vi.fn(),- restoreSnapshot: vi.fn(),- saveSnapshot: vi.fn(),undo: vi.fn(),},getProjectGraph: () => project.port.getSnapshot().projectGraph,@@ -182,7 +179,6 @@ describe('WorkflowDialogHost library autosave under StrictMode', () => {const boundGraph = { ...createProjectGraph('workflow-1'), libraryWorkflowId: 'library-workflow-1' };const project = createMutablePort({galleryValues: {},- graphHistory: [],id: 'project-1',isWorkflowRunning: false,projectGraph: boundGraph,@@ -196,8 +192,6 @@ describe('WorkflowDialogHost library autosave under StrictMode', () => {editGraph: vi.fn(),redo: vi.fn(),replace: vi.fn(),- restoreSnapshot: vi.fn(),- saveSnapshot: vi.fn(),undo: vi.fn(),},getProjectGraph: () => project.port.getSnapshot().projectGraph,@@ -264,7 +258,6 @@ describe('WorkflowDialogHost library autosave under StrictMode', () => {const boundGraph = { ...createProjectGraph('workflow-1'), libraryWorkflowId: 'library-workflow-1' };const project = createMutablePort({galleryValues: {},- graphHistory: [],id: 'project-1',isWorkflowRunning: false,projectGraph: boundGraph,@@ -282,8 +275,6 @@ describe('WorkflowDialogHost library autosave under StrictMode', () => {editGraph: vi.fn(),redo: vi.fn(),replace: vi.fn(),- restoreSnapshot: vi.fn(),- saveSnapshot: vi.fn(),undo: vi.fn(),},getProjectGraph: () => project.port.getSnapshot().projectGraph,diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowUiContext.browser.test.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowUiContext.browser.test.tsxindex 56c09a1d6d..037d8ab625 100644--- a/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowUiContext.browser.test.tsx+++ b/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowUiContext.browser.test.tsx@@ -42,7 +42,6 @@ const createMutablePort = <Snapshot,>(initialSnapshot: Snapshot) => {const projectState = (id = 'project-1') => ({galleryValues: {},- graphHistory: [],id,isWorkflowRunning: false,projectGraph: { edges: [], nodes: [], version: 1 as const },diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowUiContext.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowUiContext.tsxindex 834153607a..e6b86627ca 100644--- a/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowUiContext.tsx+++ b/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowUiContext.tsx@@ -6,7 +6,6 @@ import { createContext, use, useCallback, useSyncExternalStore } from 'react';import type {WorkflowCommands,- WorkflowGraphHistoryEntry,WorkflowInvocationSourceId,WorkflowNodeExecutionState,WorkflowPerfSource,@@ -24,7 +23,6 @@ export interface WorkflowPreferences {export interface WorkflowProjectSnapshot {galleryValues: Record<string, unknown>;- graphHistory: readonly WorkflowGraphHistoryEntry[];id: string;isWorkflowRunning: boolean;projectGraph: ProjectGraphState;diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowWidgetChrome.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowWidgetChrome.tsxindex 6ce17c435a..f0a2a968bf 100644--- a/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowWidgetChrome.tsx+++ b/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowWidgetChrome.tsx@@ -1,6 +1,6 @@import type { InvocationTemplate, XYPosition } from '@features/workflow/contracts';-import { Box, HStack, Icon, Menu, Portal, Stack, Text } from '@chakra-ui/react';+import { Box, HStack, Icon, Menu, Text } from '@chakra-ui/react';import { updateLibraryWorkflow } from '@features/workflow/queries';import { useProjectGraphCommands } from '@features/workflow/ui/useProjectGraphCommands';import {@@ -24,16 +24,8 @@ import {} from '@platform/state/accountLifecycle';import { Button, IconButton, ConfirmDialog, Tooltip } from '@platform/ui';import { MiddleTruncate } from '@platform/ui/MiddleTruncate';-import {- CloudAlertIcon,- CloudCheckIcon,- CloudUploadIcon,- HistoryIcon,- LibraryIcon,- PlusIcon,- RefreshCwIcon,-} from 'lucide-react';-import { useCallback, useEffect, useId, useMemo, useRef, type ChangeEvent } from 'react';+import { CloudAlertIcon, CloudCheckIcon, CloudUploadIcon, LibraryIcon, PlusIcon, RefreshCwIcon } from 'lucide-react';+import { useCallback, useEffect, useRef, type ChangeEvent } from 'react';import { useTranslation } from 'react-i18next';import type { WorkflowWidgetLabelProps, WorkflowWidgetViewProps } from './contracts';@@ -64,7 +56,7 @@ import {/*** The workflow widget's frame chrome. The label renders the `Workflow / [name]`* title, where the name is the library trigger; quick actions (add node,- * library, history) are header icon buttons; everything else contributes to the+ * library, save status) are header icon buttons; everything else contributes to the* shared widget actions menu via the manifest's `headerMenu`. Dialogs live here* (always mounted) and are driven through `workflowUiStore`.*/@@ -125,7 +117,6 @@ export const WorkflowMenuItems = (_props: WorkflowWidgetViewProps) => {const { t } = useTranslation();const { getProjectGraph } = useWorkflowUi();const { widgets } = useWorkflowHostCommands();- const { saveSnapshot } = useProjectGraphCommands();const notify = useWorkflowNotifications();const openDetailsPanel = useCallback(() => {@@ -145,9 +136,6 @@ export const WorkflowMenuItems = (_props: WorkflowWidgetViewProps) => {<Menu.ItemGroupLabel color="fg.subtle" fontSize="2xs" textTransform="uppercase">{t('widgets.labels.workflow')}</Menu.ItemGroupLabel>- <Menu.Item value="snapshot" onClick={saveSnapshot}>- {t('widgets.workflow.saveGraphSnapshot')}- </Menu.Item><Menu.Item value="details" onClick={openDetailsPanel}>{t('widgets.workflow.detailsWithEllipsis')}</Menu.Item>@@ -169,22 +157,12 @@ export const WorkflowMenuItems = (_props: WorkflowWidgetViewProps) => {export const WorkflowHeaderActions = ({ region }: WorkflowWidgetViewProps) => {const { t } = useTranslation();- const graphHistory = useWorkflowProjectSelector((project) => project.graphHistory);const libraryWorkflowId = useWorkflowProjectSelector((project) => project.projectGraph.libraryWorkflowId);const syncStatus = workflowLibrarySyncStore.useSelector((snapshot) => snapshot.status);- const { restoreSnapshot } = useProjectGraphCommands();const { saveToLibrary } = useSaveWorkflowToLibrary();- const restorableHistory = graphHistory.filter((entry) => entry.document);- const historyTriggerId = useId();const openAddNode = useCallback(() => setAddNodeOpen(true), []);const openWorkflowLibrary = useCallback(() => setWorkflowLibraryOpen(true), []);const handleSaveToLibrary = useCallback(() => void saveToLibrary(), [saveToLibrary]);- const historyIds = useMemo(() => ({ trigger: historyTriggerId }), [historyTriggerId]);- const historyPositioning = useMemo(() => ({ placement: 'bottom-end' as const }), []);- const restoreHistoryEntry = useCallback(- (details: { value: string }) => restoreSnapshot(details.value),- [restoreSnapshot]- );return (<HStack gap="0.5">@@ -257,44 +235,6 @@ export const WorkflowHeaderActions = ({ region }: WorkflowWidgetViewProps) => {</IconButton></Tooltip>)}- <Menu.Root ids={historyIds} positioning={historyPositioning} onSelect={restoreHistoryEntry}>- <Tooltip content={t('widgets.workflow.graphHistorySnapshots')} ids={historyIds}>- <Menu.Trigger asChild>- <IconButton- aria-label={t('widgets.workflow.graphHistorySnapshots')}- color="fg.muted"- disabled={restorableHistory.length === 0}- size="2xs"- variant="ghost"- >- <Icon as={HistoryIcon} boxSize="3.5" />- </IconButton>- </Menu.Trigger>- </Tooltip>- <Portal>- <Menu.Positioner>- <Menu.Content maxH="18rem" minW="16rem" overflowY="auto">- <Menu.ItemGroup>- <Menu.ItemGroupLabel color="fg.subtle" fontSize="2xs" textTransform="uppercase">- {t('widgets.workflow.graphHistorySnapshots')}- </Menu.ItemGroupLabel>- {restorableHistory.map((entry) => (- <Menu.Item key={entry.id} value={entry.id}>- <Stack gap="0" minW="0">- <Menu.ItemText fontSize="xs">- <MiddleTruncate as="span" text={entry.label} />- </Menu.ItemText>- <Text color="fg.subtle" fontSize="2xs">- {new Date(entry.createdAt).toLocaleString()}- </Text>- </Stack>- </Menu.Item>- ))}- </Menu.ItemGroup>- </Menu.Content>- </Menu.Positioner>- </Portal>- </Menu.Root></HStack>);};@@ -549,7 +489,7 @@ export const WorkflowDialogHost = () => {<WorkflowLibraryDialog isOpen={isLibraryOpen} onOpenChange={setWorkflowLibraryOpen} /><PendingLibraryWorkflowLoader /><ConfirmDialog- body="Replace the project graph with an empty workflow? The current graph is saved to graph history first."+ body="Replace the project graph with an empty workflow? You can undo this change during this session. Save the current workflow to the library first if you need a permanent copy."confirmLabel="New workflow"isOpen={isNewWorkflowConfirmOpen}title="New workflow"diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/contracts.ts b/invokeai/frontend/webv2/src/features/workflow/ui/contracts.tsindex 17545d7886..4b11e8a898 100644--- a/invokeai/frontend/webv2/src/features/workflow/ui/contracts.ts+++ b/invokeai/frontend/webv2/src/features/workflow/ui/contracts.ts@@ -43,21 +43,11 @@ export interface WorkflowWidgetLabelProps {presentation?: 'compact' | 'expanded' | 'tooltip';}-export interface WorkflowGraphHistoryEntry {- id: string;- createdAt: string;- label: string;- retainedBytes?: number;- document?: ProjectGraphState;-}-export interface WorkflowCommands {bindLibraryWorkflow(libraryWorkflowId: string): void;editGraph(action: ProjectGraphAction): void;replace(document: ProjectGraphState, label: string): void;redo(): void;- restoreSnapshot(snapshotId: string): void;- saveSnapshot(): void;undo(): void;}diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewDialog.browser.test.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewDialog.browser.test.tsxindex 9e5ea169a5..b739ddabbc 100644--- a/invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewDialog.browser.test.tsx+++ b/invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewDialog.browser.test.tsx@@ -313,7 +313,6 @@ const preferencesSnapshot = {// reason `preferencesSnapshot` above is hoisted rather than built inline.const createProjectSnapshot = () => ({galleryValues: {},- graphHistory: [],id: 'project-1',isWorkflowRunning: false,projectGraph: { edges: [], nodes: [], version: 1 as const },@@ -330,8 +329,6 @@ const createWorkflowUiAdapter = (): WorkflowUiAdapter => {editGraph: vi.fn(),redo: vi.fn(),replace: vi.fn(),- restoreSnapshot: vi.fn(),- saveSnapshot: vi.fn(),undo: vi.fn(),},getProjectGraph: () => ({ edges: [], nodes: [], version: 1 as const }),diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/library/useSaveWorkflowToLibrary.browser.test.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/library/useSaveWorkflowToLibrary.browser.test.tsxindex 4387af19a8..fcd36bcaf6 100644--- a/invokeai/frontend/webv2/src/features/workflow/ui/library/useSaveWorkflowToLibrary.browser.test.tsx+++ b/invokeai/frontend/webv2/src/features/workflow/ui/library/useSaveWorkflowToLibrary.browser.test.tsx@@ -98,7 +98,6 @@ describe('useSaveWorkflowToLibrary bind-then-sync', () => {const initialGraph = createProjectGraph('workflow-1');const project = createMutablePort({galleryValues: {},- graphHistory: [],id: 'project-1',isWorkflowRunning: false,projectGraph: initialGraph,@@ -119,8 +118,6 @@ describe('useSaveWorkflowToLibrary bind-then-sync', () => {editGraph: vi.fn(),redo: vi.fn(),replace: vi.fn(),- restoreSnapshot: vi.fn(),- saveSnapshot: vi.fn(),undo: vi.fn(),},notifications: { error: vi.fn(), info: vi.fn(), success: vi.fn() },@@ -201,7 +198,6 @@ describe('useSaveWorkflowToLibrary saveDocumentAsNew', () => {const initialGraph = createProjectGraph('workflow-1');const project = createMutablePort({galleryValues: {},- graphHistory: [],id: 'project-1',isWorkflowRunning: false,projectGraph: initialGraph,@@ -217,8 +213,6 @@ describe('useSaveWorkflowToLibrary saveDocumentAsNew', () => {editGraph: vi.fn(),redo: vi.fn(),replace: vi.fn(),- restoreSnapshot: vi.fn(),- saveSnapshot: vi.fn(),undo: vi.fn(),},notifications: { error: vi.fn(), info: vi.fn(), success: vi.fn() },diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/linear/WorkflowLinearPanel.browser.test.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/linear/WorkflowLinearPanel.browser.test.tsxindex 5af3ad25bf..07dfbe91c8 100644--- a/invokeai/frontend/webv2/src/features/workflow/ui/linear/WorkflowLinearPanel.browser.test.tsx+++ b/invokeai/frontend/webv2/src/features/workflow/ui/linear/WorkflowLinearPanel.browser.test.tsx@@ -139,8 +139,6 @@ describe('Form builder drag and drop (dnd-kit)', () => {editGraph,redo: () => undefined,replace: () => undefined,- restoreSnapshot: () => undefined,- saveSnapshot: () => undefined,undo: () => undefined,},widgets: { open: () => undefined, patchValues: () => undefined },diff --git a/invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts b/invokeai/frontend/webv2/src/workbench/canvasProjectMutations.tsindex 887752c030..0609f700e4 100644--- a/invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts+++ b/invokeai/frontend/webv2/src/workbench/canvasProjectMutations.ts@@ -44,6 +44,7 @@ import {import { insertNodesAtAnchor } from '@workbench/canvas-engine/document/insertionAnchors';import { isOverlayStack, layerStackOf, reorderSiblings } from '@workbench/canvas-engine/document/layerStacks';import { repairSelectedLayerId } from '@workbench/canvas-engine/document/selectionRepair';+import { prependProjectEvent } from '@workbench/projectEvents';import { normalizeCanvasDocumentContract } from './canvasMigration';import {@@ -699,7 +700,7 @@ export const applyCanvasProjectMutation = (project: Project, mutation: CanvasPro? project.canvas.stagingArea: clearStagingArea(project.canvas.stagingArea),},- events: [mutation.event, ...project.events],+ events: prependProjectEvent(project.events, mutation.event),};}case 'rollbackStagedImageCommit': {diff --git a/invokeai/frontend/webv2/src/workbench/projectContracts.ts b/invokeai/frontend/webv2/src/workbench/projectContracts.tsindex 2547c6d052..aec6bc6cbd 100644--- a/invokeai/frontend/webv2/src/workbench/projectContracts.ts+++ b/invokeai/frontend/webv2/src/workbench/projectContracts.ts@@ -42,7 +42,6 @@ export interface Project {floatingWidgets?: Record<WidgetInstanceId, FloatingWidgetState>;widgetGraphs: Partial<Record<WidgetTypeId, GraphContract>>;canvas: CanvasStateContractV3;- graphHistory: GraphHistorySnapshot[];promptHistory: PromptHistoryItem[];undoRedo: UndoRedoHistory;queue: WorkbenchQueueState;@@ -115,21 +114,6 @@ export interface WorkbenchNotification {occurrenceCount?: number;}-/**- * One entry of the project's graph history. Queue submissions record the- * compiled `graph`; workflow snapshots (manual save, pre-replacement) record- * the editable `document`, which is what makes them restorable.- */-export interface GraphHistorySnapshot {- id: string;- createdAt: string;- label: string;- /** UTF-8 serialized bytes retained by this snapshot, populated during creation or hydration. */- retainedBytes?: number;- graph?: GraphContract;- document?: ProjectGraphState;-}-export interface PromptHistoryItem {positivePrompt: string;negativePrompt: string | null;diff --git a/invokeai/frontend/webv2/src/workbench/projectEventContracts.ts b/invokeai/frontend/webv2/src/workbench/projectEventContracts.tsindex d09998b3e7..883c3711f8 100644--- a/invokeai/frontend/webv2/src/workbench/projectEventContracts.ts+++ b/invokeai/frontend/webv2/src/workbench/projectEventContracts.ts@@ -14,8 +14,7 @@ export type ProjectEventType =| 'invocation-updated'| 'queue-submitted'| 'canvas-layer-accepted'- | 'graph-replaced'- | 'graph-snapshot-saved';+ | 'graph-replaced';export interface ProjectEvent {id: string;diff --git a/invokeai/frontend/webv2/src/workbench/projectEvents.test.ts b/invokeai/frontend/webv2/src/workbench/projectEvents.test.tsnew file mode 100644index 0000000000..cf313d11f7--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/projectEvents.test.ts@@ -0,0 +1,26 @@+import { describe, expect, it } from 'vitest';++import type { ProjectEvent } from './projectEventContracts';++import { prependProjectEvent, PROJECT_EVENT_LIMIT } from './projectEvents';++const event = (index: number): ProjectEvent => ({+ createdAt: `2026-09-04T00:00:${String(index).padStart(2, '0')}.000Z`,+ id: `event-${index}`,+ summary: `Event ${index}`,+ type: 'layout-updated',+});++describe('project events', () => {+ it('retains the newest bounded session events', () => {+ let events: ProjectEvent[] = [];++ for (let index = 0; index < PROJECT_EVENT_LIMIT + 25; index += 1) {+ events = prependProjectEvent(events, event(index));+ }++ expect(events).toHaveLength(PROJECT_EVENT_LIMIT);+ expect(events[0]?.id).toBe(`event-${PROJECT_EVENT_LIMIT + 24}`);+ expect(events.at(-1)?.id).toBe('event-25');+ });+});diff --git a/invokeai/frontend/webv2/src/workbench/projectEvents.ts b/invokeai/frontend/webv2/src/workbench/projectEvents.tsnew file mode 100644index 0000000000..8a1381ce56--- /dev/null+++ b/invokeai/frontend/webv2/src/workbench/projectEvents.ts@@ -0,0 +1,6 @@+import type { ProjectEvent } from './projectEventContracts';++export const PROJECT_EVENT_LIMIT = 200;++export const prependProjectEvent = (events: readonly ProjectEvent[], event: ProjectEvent): ProjectEvent[] =>+ [event, ...events].slice(0, PROJECT_EVENT_LIMIT);diff --git a/invokeai/frontend/webv2/src/workbench/projects/projectDocument.ts b/invokeai/frontend/webv2/src/workbench/projects/projectDocument.tsindex 8e37b0bd5e..84bd250467 100644--- a/invokeai/frontend/webv2/src/workbench/projects/projectDocument.ts+++ b/invokeai/frontend/webv2/src/workbench/projects/projectDocument.ts@@ -95,7 +95,12 @@ export const serializeProjectDocumentV2Json = (};export const serializeProjectDocument = (project: Project): Record<string, unknown> => {- const { undoRedo: _undoRedo, ...document } = stripSessionScopedGalleryState(project);+ const {+ events: _events,+ graphHistory: _graphHistory,+ undoRedo: _undoRedo,+ ...document+ } = stripSessionScopedGalleryState(project) as Project & { graphHistory?: unknown };return document;};diff --git a/invokeai/frontend/webv2/src/workbench/projects/projectSync.test.ts b/invokeai/frontend/webv2/src/workbench/projects/projectSync.test.tsindex 094618dd53..836d36da15 100644--- a/invokeai/frontend/webv2/src/workbench/projects/projectSync.test.ts+++ b/invokeai/frontend/webv2/src/workbench/projects/projectSync.test.ts@@ -45,7 +45,6 @@ describe('project document serialization', () => {});project.queue.items.push({} as never);project.events.push({} as never);- project.graphHistory.push({} as never);Object.assign(project, {futureField: 'must-not-leak',recoveredAt: '2026-01-01T00:00:00.000Z',@@ -77,7 +76,6 @@ describe('project document serialization', () => {expect(roundTripped.undoRedo).toEqual({ future: [], past: [] });expect(roundTripped.queue).toEqual({ items: [] });expect(roundTripped.events).toEqual([]);- expect(roundTripped.graphHistory).toEqual([]);expect(roundTripped.id).toBe(project.id);expect(roundTripped.widgetInstances).toEqual(project.widgetInstances);});@@ -91,6 +89,16 @@ describe('project document serialization', () => {expect(encoded.byteSize).toBe(new TextEncoder().encode(encoded.documentJson).byteLength);});+ it('excludes session events and legacy graph history from project files', () => {+ const project = getProject();+ Object.assign(project, { graphHistory: [{ id: 'legacy-snapshot' }] });++ const document = serializeProjectDocument(project);++ expect(document).not.toHaveProperty('events');+ expect(document).not.toHaveProperty('graphHistory');+ });+it('rejects documents that do not look like projects', () => {expect(deserializeProjectDocument({})).toEqual({ status: 'unavailable' });expect(deserializeProjectDocument({ id: 'x' })).toEqual({ status: 'unavailable' });diff --git a/invokeai/frontend/webv2/src/workbench/widgets/project/ProjectWidgetView.tsx b/invokeai/frontend/webv2/src/workbench/widgets/project/ProjectWidgetView.tsxindex 97653fc211..0f3c9a3688 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/project/ProjectWidgetView.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/project/ProjectWidgetView.tsx@@ -19,7 +19,6 @@ export const ProjectWidgetView = () => {const activeProject = useActiveProjectSelector((project) => ({events: project.events,- graphHistory: project.graphHistory,id: project.id,name: project.name,projectGraph: project.projectGraph,@@ -36,7 +35,7 @@ export const ProjectWidgetView = () => {);};-type ProjectPanelViewModel = Pick<Project, 'events' | 'graphHistory' | 'id' | 'name' | 'projectGraph' | 'queue'>;+type ProjectPanelViewModel = Pick<Project, 'events' | 'id' | 'name' | 'projectGraph' | 'queue'>;const NameSection = ({ project }: { project: ProjectPanelViewModel }) => {const { t } = useTranslation();diff --git a/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts b/invokeai/frontend/webv2/src/workbench/workbenchState.test.tsindex d65157773a..438d13d154 100644--- a/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts+++ b/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts@@ -30,14 +30,13 @@ import { createEmptyCanvasDocument } from './canvasMigration';import { getCanvasStagingCandidateFingerprint, getCanvasStagingSlots } from './canvasStagingView';import { layoutPresets } from './layoutPresets';import { resolveSavedLayoutPreset } from './layoutPresetSnapshots';+import { PROJECT_EVENT_LIMIT } from './projectEvents';import { DEFAULT_PROJECT_SETTINGS } from './settings/store';import { getProjectWidgetValues } from './widgetState';import {clampPanelSize,createDraftProject,getPanelCollapseThreshold,- GRAPH_HISTORY_BYTE_BUDGET,- normalizeGraphHistory,shouldSnapPanelShut,normalizeWorkbenchAccount,normalizeWorkbenchProject,@@ -862,6 +861,34 @@ describe('adopting a project from another realm', () => {const galleryValuesOf = (project: Project) =>Object.values(project.widgetInstances).find((instance) => instance.typeId === 'gallery')!.state.values;+ it('drops legacy graph history and session events at ingestion', () => {+ const project = createInitialWorkbenchState().projects[0]!;+ const legacyProject = {+ ...project,+ events: [{ createdAt: 'now', id: 'legacy-event', summary: 'legacy', type: 'project-created' }],+ graphHistory: [{ document: project.projectGraph, id: 'legacy-snapshot' }],+ } as unknown as Project;++ const normalized = normalizeWorkbenchProject(legacyProject);++ expect(normalized.events).toEqual([]);+ expect('graphHistory' in normalized).toBe(false);+ });++ it('preserves and caps session events during live normalization', () => {+ const project = createInitialWorkbenchState().projects[0]!;+ project.events = Array.from({ length: PROJECT_EVENT_LIMIT + 1 }, (_, index) => ({+ createdAt: 'now',+ id: `event-${index}`,+ summary: `Event ${index}`,+ type: 'project-created',+ }));++ const normalized = normalizeWorkbenchProject(project, { isArriving: false });++ expect(normalized.events).toEqual(project.events.slice(0, PROJECT_EVENT_LIMIT));+ });+it('drops a session-scoped search and the rank pages set against it', () => {// A project opened from the server — the Open dialog, a deep link, or a// conflict fork — arrives in a realm that never ran the session its values@@ -968,6 +995,7 @@ describe('adopting a project from another realm', () => {expect(fork.id).toBe(`${project.id}-copy`);expect(fork.name).toBe('Renamed while copying');+ expect(fork.events).toEqual(project.events);expect(values.galleryPage).toBe(7);expect(values.semanticImageQuery).toEqual({ clusterId, kind: 'cluster', label: 'beaches' });});@@ -2839,7 +2867,7 @@ describe('workbenchReducer Phase 5 generation flow', () => {expect(getActiveProject(state).invocation).toMatchObject({ destination: 'gallery', sourceId: 'workflow' });});- it('replaceProjectGraph snapshots the previous document into graph history', () => {+ it('replaceProjectGraph preserves the previous document in session undo', () => {let state = createInitialWorkbenchState();const originalGraphId = getActiveProject(state).projectGraph.id;@@ -2853,97 +2881,14 @@ describe('workbenchReducer Phase 5 generation flow', () => {expect(project.projectGraph.id).toBe('replacement-graph');expect(project.invocation).toMatchObject({ destination: 'gallery', sourceId: 'workflow' });- expect(project.graphHistory[0]?.document?.id).toBe(originalGraphId);- expect(project.graphHistory[0]?.retainedBytes).toBeGreaterThan(0);- expect(project.graphHistory[0]?.document).toBe(project.undoRedo.past.at(-1)?.project.projectGraph);+ expect(project.undoRedo.past.at(-1)?.project.projectGraph.id).toBe(originalGraphId);- state = workbenchReducer(state, {- snapshotId: project.graphHistory[0]?.id ?? '',- type: 'restoreProjectGraphSnapshot',- });+ state = workbenchReducer(state, { type: 'undoProjectChange' });expect(getActiveProject(state).projectGraph.id).toBe(originalGraphId);expect(getActiveProject(state).invocation).toMatchObject({ destination: 'gallery', sourceId: 'workflow' });});- it('keeps the newest graph-history entries within the count limit and recomputes retained bytes', () => {- const entries = Array.from({ length: 50 }, (_, index) => ({- createdAt: `2026-07-19T00:00:${String(index).padStart(2, '0')}.000Z`,- document: { edges: [], nodes: [], version: 1 as const },- id: `snapshot-${index}`,- label: `Snapshot ${index}`,- retainedBytes: 0,- }));- const normalized = normalizeGraphHistory(entries);-- expect(normalized).toHaveLength(40);- expect(normalized.map((entry) => entry.id)).toEqual(entries.slice(0, 40).map((entry) => entry.id));- expect(normalized.every((entry) => (entry.retainedBytes ?? 0) > 0)).toBe(true);- });-- it('measures loaded graph-history entries instead of trusting forged retained-byte metadata', () => {- const encode = vi.spyOn(TextEncoder.prototype, 'encode').mockImplementation((input) => {- const byteLength = String(input).includes('"id":"oversized"') ? GRAPH_HISTORY_BYTE_BUDGET + 1 : 128;-- return Object.defineProperty(new Uint8Array(0), 'byteLength', { value: byteLength });- });-- try {- const normalized = normalizeGraphHistory([- {- createdAt: '2026-07-19T00:00:00.000Z',- document: { edges: [], nodes: [], version: 1 as const },- id: 'oversized',- label: 'Forged low byte count',- retainedBytes: 0,- },- {- createdAt: '2026-07-19T00:00:01.000Z',- document: { edges: [], nodes: [], version: 1 as const },- id: 'within-budget',- label: 'Forged high byte count',- retainedBytes: GRAPH_HISTORY_BYTE_BUDGET + 1,- },- ]);-- expect(normalized).toHaveLength(1);- expect(normalized[0]).toMatchObject({ id: 'within-budget', retainedBytes: 128 });- } finally {- encode.mockRestore();- }- });-- it('admits newest graph-history entries without exceeding the cumulative byte budget', () => {- const halfBudgetPlusOne = Math.floor(GRAPH_HISTORY_BYTE_BUDGET / 2) + 1;- const encode = vi.spyOn(TextEncoder.prototype, 'encode').mockImplementation((input) => {- const byteLength = String(input).includes('"id":"small"') ? 128 : halfBudgetPlusOne;-- return Object.defineProperty(new Uint8Array(0), 'byteLength', { value: byteLength });- });-- try {- const createEntry = (id: string) => ({- createdAt: '2026-07-19T00:00:00.000Z',- document: { edges: [], nodes: [], version: 1 as const },- id,- label: id,- retainedBytes: 0,- });- const normalized = normalizeGraphHistory([- createEntry('newest-large'),- createEntry('older-large'),- createEntry('small'),- ]);-- expect(normalized.map((entry) => entry.id)).toEqual(['newest-large', 'small']);- expect(normalized.reduce((total, entry) => total + (entry.retainedBytes ?? 0), 0)).toBeLessThanOrEqual(- GRAPH_HISTORY_BYTE_BUDGET- );- } finally {- encode.mockRestore();- }- });-it('does not queue Upscale while its required settings are incomplete', () => {let state = createInitialWorkbenchState();diff --git a/invokeai/frontend/webv2/src/workbench/workbenchState.ts b/invokeai/frontend/webv2/src/workbench/workbenchState.tsindex 153ad44561..df22530f7f 100644--- a/invokeai/frontend/webv2/src/workbench/workbenchState.ts+++ b/invokeai/frontend/webv2/src/workbench/workbenchState.ts@@ -29,7 +29,6 @@ import type {WidgetRegionState,} from '@workbench/layoutContracts';import type {- GraphHistorySnapshot,Project,ProjectUndoSnapshot,PromptHistoryItem,@@ -71,6 +70,7 @@ import {type GeneratedImageContract,} from '@features/gallery/contracts';import { WIDGET_REGIONS } from '@workbench/layoutContracts';+import { prependProjectEvent, PROJECT_EVENT_LIMIT } from '@workbench/projectEvents';import type { WorkbenchQueueItem as QueueItem } from './queueHistoryContracts';@@ -287,8 +287,6 @@ type WorkbenchReducerAction =}| { type: 'applyProjectGraphAction'; action: ProjectGraphAction }| { type: 'replaceProjectGraph'; document: ProjectGraphState; label: string }- | { type: 'saveProjectGraphSnapshot' }- | { type: 'restoreProjectGraphSnapshot'; snapshotId: string }| { type: 'setProjectGraphLibraryBinding'; libraryWorkflowId: string }| { type: 'submitInvocationSnapshot'; backendSupportsCancellation: boolean; models?: readonly ModelConfig[] }| {@@ -419,7 +417,6 @@ type WorkbenchReducerAction =| { type: 'recordNotice'; kind: WorkbenchNotificationKind; title: string; message?: string };const HISTORY_LIMIT = 40;-export const GRAPH_HISTORY_BYTE_BUDGET = 64 * 1024 * 1024;const NOTIFICATION_LIMIT = 100;// Side panels host real widget UIs (gallery grid, generate form); below// ~350px their toolbars and grids collapse into unusable slivers, so that is@@ -1163,112 +1160,6 @@ const restoreUndoSnapshot = (project: Project, snapshot: ProjectUndoSnapshot): PwidgetRegions: cloneWidgetRegions(snapshot.widgetRegions),});-const UTF8_ENCODER = new TextEncoder();--const getGraphHistorySnapshotBytes = (snapshot: GraphHistorySnapshot): number => {- const { retainedBytes: _retainedBytes, ...serialized } = snapshot;- let retainedBytes = 0;-- // Include the metadata field itself in the serialized-size budget. Its digit- // count can change the answer, so converge on the stable JSON byte length.- for (;;) {- const nextRetainedBytes = UTF8_ENCODER.encode(JSON.stringify({ ...serialized, retainedBytes })).byteLength;- if (nextRetainedBytes === retainedBytes) {- return retainedBytes;- }- retainedBytes = nextRetainedBytes;- }-};--type MeasuredGraphHistorySnapshot = GraphHistorySnapshot & { retainedBytes: number };--const withRetainedBytes = (snapshot: GraphHistorySnapshot): MeasuredGraphHistorySnapshot => ({- ...snapshot,- retainedBytes: getGraphHistorySnapshotBytes(snapshot),-});--/** Trims state-owned snapshots without reserializing retained history. */-const trimMeasuredGraphHistory = (snapshots: readonly GraphHistorySnapshot[]): GraphHistorySnapshot[] => {- const history: GraphHistorySnapshot[] = [];- let retainedBytes = 0;-- for (const snapshot of snapshots) {- if (history.length >= HISTORY_LIMIT) {- break;- }-- const snapshotBytes = snapshot.retainedBytes;- if (typeof snapshotBytes !== 'number' || !Number.isFinite(snapshotBytes) || snapshotBytes < 0) {- continue;- }-- if (snapshotBytes > GRAPH_HISTORY_BYTE_BUDGET || retainedBytes + snapshotBytes > GRAPH_HISTORY_BYTE_BUDGET) {- continue;- }-- retainedBytes += snapshotBytes;- history.push(snapshot);- }-- return history;-};--export const normalizeGraphHistory = (value: unknown): GraphHistorySnapshot[] => {- if (!Array.isArray(value)) {- return [];- }-- const measuredHistory: MeasuredGraphHistorySnapshot[] = [];-- for (const item of value) {- if (!item || typeof item !== 'object') {- continue;- }-- const snapshot = item as GraphHistorySnapshot;- if (- typeof snapshot.id !== 'string' ||- typeof snapshot.createdAt !== 'string' ||- typeof snapshot.label !== 'string'- ) {- continue;- }-- // Persisted metadata is untrusted. Always derive the retained size from the- // actual snapshot so a forged low count cannot bypass the load-time budget- // and a stale high count cannot discard valid history.- measuredHistory.push(withRetainedBytes(snapshot));- }-- return trimMeasuredGraphHistory(measuredHistory);-};--const prependGraphHistory = (- history: readonly GraphHistorySnapshot[],- snapshot: MeasuredGraphHistorySnapshot-): GraphHistorySnapshot[] => trimMeasuredGraphHistory([snapshot, ...history]);--const createGraphHistorySnapshot = (label: string, graph: GraphContract): MeasuredGraphHistorySnapshot =>- withRetainedBytes({- createdAt: now(),- graph: cloneGraph(graph),- id: createId('graph-history'),- label,- });--/** A restorable history entry carrying the editable workflow document. */-const createDocumentHistorySnapshot = (- label: string,- document: ProjectGraphState,- cloneDocument = true-): MeasuredGraphHistorySnapshot =>- withRetainedBytes({- createdAt: now(),- document: cloneDocument ? cloneProjectGraph(document) : document,- id: createId('graph-history'),- label,- });-const pushUndo = (project: Project, label: string, projectGraph?: ProjectGraphState): Project => ({...project,undoRedo: {@@ -1776,10 +1667,11 @@ const assembleWorkbenchProject = (): Project => {const { isArriving = true } = options;const {+ graphHistory: _graphHistory,recoveredAt: _recoveredAt,recoveryOf: _recoveryOf,...persistentProject- } = project as Project & { recoveredAt?: unknown; recoveryOf?: unknown };+ } = project as Project & { graphHistory?: unknown; recoveredAt?: unknown; recoveryOf?: unknown };const legacyWidgetRegions = project.widgetRegions as| Partial<Record<WidgetRegion | 'left-panel' | 'right-panel' | 'status-bar', WidgetRegionState>>| undefined;@@ -1892,9 +1784,8 @@ const assembleWorkbenchProject = (return {...persistentProject,canvas,- events: Array.isArray(project.events) ? project.events : [],+ events: isArriving ? [] : project.events.slice(0, PROJECT_EVENT_LIMIT),floatingWidgets: placement.floatingWidgets,- graphHistory: normalizeGraphHistory((project as Partial<Project>).graphHistory),// Built-in preset ids were renamed for the three-preset model; a project// saved under an old id must still resolve to the arrangement it names,// otherwise every restored project reads as drifted from Compose.@@ -1946,7 +1837,6 @@ const createProject = (index: number, id: string, preset: LayoutPreset): Projecttype: 'project-created',},],- graphHistory: [],id,invocation: getInvocationAfterLayoutPreset(defaultInvocationRoute, preset),layout: { ...defaultLayoutPreset.snapshot.layout, panels: { ...defaultLayoutPreset.snapshot.layout.panels } },@@ -2335,15 +2225,12 @@ const updateActiveLayout = (return {...nextProject,- events: [- {- createdAt: now(),- id: createId('event'),- summary: 'Updated active layout',- type: 'layout-updated',- },- ...nextProject.events,- ],+ events: prependProjectEvent(nextProject.events, {+ createdAt: now(),+ id: createId('event'),+ summary: 'Updated active layout',+ type: 'layout-updated',+ }),layout: getLayout(project.layout),};});@@ -2420,15 +2307,12 @@ const updateActiveProjectLayoutPreset = (return {...nextLayoutProject,- events: [- {- createdAt: now(),- id: createId('event'),- summary: 'Updated active layout',- type: 'layout-updated',- },- ...nextProject.events,- ],+ events: prependProjectEvent(nextProject.events, {+ createdAt: now(),+ id: createId('event'),+ summary: 'Updated active layout',+ type: 'layout-updated',+ }),invocation: applyDefaultRoute? getInvocationAfterLayoutPreset(nextProject.invocation, preset): nextLayoutProject.invocation,@@ -2444,15 +2328,12 @@ const updateActiveInvocation = (return {...nextProject,- events: [- {- createdAt: now(),- id: createId('event'),- summary: 'Updated invocation source or destination',- type: 'invocation-updated',- },- ...nextProject.events,- ],+ events: prependProjectEvent(nextProject.events, {+ createdAt: now(),+ id: createId('event'),+ summary: 'Updated invocation source or destination',+ type: 'invocation-updated',+ }),invocation: getInvocation(project.invocation),};});@@ -3184,7 +3065,6 @@ const enqueueCompiledSnapshot = (([typeId, widgetState]) => [typeId, cloneQueueWidgetState(widgetState, typeId as WidgetTypeId)])) as WidgetStateMap;- const graphHistorySnapshot = createGraphHistorySnapshot(`Queue snapshot ${queueItemId}`, graph);const generateSettings =route.sourceId === 'generate' ? normalizeGenerateSettings(widgetStates.generate.values) : null;const upscaleSettings =@@ -3318,17 +3198,13 @@ const enqueueCompiledSnapshot = (return {...project,- events: [- {- createdAt: submittedAt,- id: createId('event'),- runId: queueItemId,- summary: `Submitted immutable ${route.sourceId} graph snapshot to ${route.destination}`,- type: 'queue-submitted',- },- ...project.events,- ],- graphHistory: prependGraphHistory(project.graphHistory, graphHistorySnapshot),+ events: prependProjectEvent(project.events, {+ createdAt: submittedAt,+ id: createId('event'),+ runId: queueItemId,+ summary: `Submitted immutable ${route.sourceId} graph snapshot to ${route.destination}`,+ type: 'queue-submitted',+ }),promptHistory: generateSettings? addPromptHistoryItem(project.promptHistory, getPromptHistoryItemFromGenerateSettings(generateSettings)): upscaleSettings@@ -4222,28 +4098,19 @@ export const __workbenchReducerInternal = (});}case 'replaceProjectGraph': {- let didRetainOutgoingGraph = true;const nextState = updateActiveProject(state, (project) => {- // One immutable clone is shared by undo and graph history; neither- // snapshot path mutates the document.const routedProject = applyAutoRouteForEdit(project, 'workflow', context);const outgoingGraph = cloneProjectGraph(project.projectGraph);const nextProject = pushUndo(routedProject, 'Replace project graph', outgoingGraph);- const historySnapshot = createDocumentHistorySnapshot(`Before: ${action.label}`, outgoingGraph, false);- didRetainOutgoingGraph = (historySnapshot.retainedBytes ?? 0) <= GRAPH_HISTORY_BYTE_BUDGET;return {...nextProject,- events: [- {- createdAt: now(),- id: createId('event'),- summary: `Replaced the project graph with "${action.document.name || 'Untitled Workflow'}" (${action.label})`,- type: 'graph-replaced',- },- ...nextProject.events,- ],- graphHistory: prependGraphHistory(nextProject.graphHistory, historySnapshot),+ events: prependProjectEvent(nextProject.events, {+ createdAt: now(),+ id: createId('event'),+ summary: `Replaced the project graph with "${action.document.name || 'Untitled Workflow'}" (${action.label})`,+ type: 'graph-replaced',+ }),projectGraph: cloneProjectGraph(action.document),};});@@ -4253,56 +4120,13 @@ export const __workbenchReducerInternal = (nextState,createNotification({kind: 'info',- message: didRetainOutgoingGraph- ? 'The previous project graph was saved to graph history.'- : 'The previous project graph exceeded the 64 MiB history budget, so its graph-history snapshot was skipped. Undo remains available for this session.',+ message:+ 'The previous graph is available through Undo for this session. Save workflows to the library for a permanent copy.',projectId: activeProject?.id,title: `Project graph replaced (${action.label})`,}));}- case 'saveProjectGraphSnapshot': {- return updateActiveProject(state, (project) => ({- ...project,- events: [- {- createdAt: now(),- id: createId('event'),- summary: `Saved a graph history snapshot of "${project.projectGraph.name || 'Untitled Workflow'}"`,- type: 'graph-snapshot-saved',- },- ...project.events,- ],- graphHistory: prependGraphHistory(- project.graphHistory,- createDocumentHistorySnapshot(- `Manual save: ${project.projectGraph.name || 'Untitled Workflow'}`,- project.projectGraph- )- ),- }));- }- case 'restoreProjectGraphSnapshot': {- return updateActiveProject(state, (project) => {- const snapshot = project.graphHistory.find((entry) => entry.id === action.snapshotId);-- if (!snapshot?.document) {- return project;- }-- const routedProject = applyAutoRouteForEdit(project, 'workflow', context);- const nextProject = pushUndo(routedProject, 'Restore graph history snapshot');-- return {- ...nextProject,- graphHistory: prependGraphHistory(- nextProject.graphHistory,- createDocumentHistorySnapshot('Before restore', project.projectGraph)- ),- projectGraph: cloneProjectGraph(normalizeProjectGraph(snapshot.document)),- };- });- }case 'setProjectGraphLibraryBinding': {return updateActiveProject(state, (project) => ({...project,@@ -4900,7 +4724,6 @@ export const __workbenchReducerInternal = (return {...restoredProject,events: project.events,- graphHistory: project.graphHistory,promptHistory: project.promptHistory,queue: project.queue,undoRedo: {@@ -4931,7 +4754,6 @@ export const __workbenchReducerInternal = (return {...restoredProject,events: project.events,- graphHistory: project.graphHistory,promptHistory: project.promptHistory,queue: project.queue,undoRedo: {diff --git a/invokeai/frontend/webv2/src/workbench/workbenchStateAutoRoute.test.ts b/invokeai/frontend/webv2/src/workbench/workbenchStateAutoRoute.test.tsindex 16cec9fba4..2e7bbb12b5 100644--- a/invokeai/frontend/webv2/src/workbench/workbenchStateAutoRoute.test.ts+++ b/invokeai/frontend/webv2/src/workbench/workbenchStateAutoRoute.test.ts@@ -65,8 +65,6 @@ describe('auto invocation route switching with the preference off', () => {},preferenceOff);- state = workbenchReducer(state, { type: 'saveProjectGraphSnapshot' }, preferenceOff);- const snapshotId = state.projects.find((project) => project.id === state.activeProjectId)?.graphHistory[0]?.id;const projectGraph = state.projects.find((project) => project.id === state.activeProjectId)?.projectGraph;expect(projectGraph).toBeDefined();@@ -80,11 +78,6 @@ describe('auto invocation route switching with the preference off', () => {},preferenceOff);- state = workbenchReducer(- state,- { snapshotId: snapshotId ?? '', type: 'restoreProjectGraphSnapshot' },- preferenceOff- );state = workbenchReducer(state,{diff --git a/invokeai/frontend/webv2/src/workbench/workbenchStore.ts b/invokeai/frontend/webv2/src/workbench/workbenchStore.tsindex 5fa846cdc5..617881f676 100644--- a/invokeai/frontend/webv2/src/workbench/workbenchStore.ts+++ b/invokeai/frontend/webv2/src/workbench/workbenchStore.ts@@ -447,8 +447,6 @@ const createCommands = ((document: ActionPayload<'replaceProjectGraph'>['document'], label: string) => ({ document, label })),redo: command('redoProjectChange'),- restoreSnapshot: command('restoreProjectGraphSnapshot', (snapshotId: string) => ({ snapshotId })),- saveSnapshot: command('saveProjectGraphSnapshot'),undo: command('undoProjectChange'),},};