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
fix(webv2): mint UUIDs without crypto.randomUUID in insecure contexts
Lincoln Stein3a1d9c4542fc
diff --git a/invokeai/frontend/webv2/package.json b/invokeai/frontend/webv2/package.jsonindex f6585d52cd..0452b608fc 100644--- a/invokeai/frontend/webv2/package.json+++ b/invokeai/frontend/webv2/package.json@@ -7,7 +7,7 @@"#architecture/source-analysis": "./src/architecture/tsSourceAnalysis.ts"},"scripts": {- "architecture:check": "vitest run --config vitest.config.mts src/architecture/dependencyPolicy.test.ts src/architecture/workbenchOwnership.test.ts src/architecture/architectureWorkflow.test.ts src/architecture/canvasSeamOwnership.test.ts src/architecture/tsSourceAnalysis.test.ts && node scripts/write-workbench-ownership-inventory.mjs && node scripts/write-contract-caller-matrix.mjs && node scripts/write-canvas-import-matrix.mjs",+ "architecture:check": "vitest run --config vitest.config.mts src/architecture/dependencyPolicy.test.ts src/architecture/workbenchOwnership.test.ts src/architecture/architectureWorkflow.test.ts src/architecture/canvasSeamOwnership.test.ts src/architecture/tsSourceAnalysis.test.ts src/architecture/secureContextApis.test.ts && node scripts/write-workbench-ownership-inventory.mjs && node scripts/write-contract-caller-matrix.mjs && node scripts/write-canvas-import-matrix.mjs","build": "pnpm run lint && vite build","check:architecture": "pnpm run lint && pnpm run test:all && pnpm run test:performance:architecture && pnpm run test:project-files:browser","check:release": "pnpm run check:architecture && pnpm run test:accessibility:browser",diff --git a/invokeai/frontend/webv2/performance/architecture-baseline.json b/invokeai/frontend/webv2/performance/architecture-baseline.jsonindex b76b527042..a2b7b886d3 100644--- a/invokeai/frontend/webv2/performance/architecture-baseline.json+++ b/invokeai/frontend/webv2/performance/architecture-baseline.json@@ -2,17 +2,17 @@"build": {"launchpad": {"baseline": {- "brotliBytes": 848403,+ "brotliBytes": 848736,"cssRawBytes": 2159,"fontRawBytes": 219480,- "gzipBytes": 847579,+ "gzipBytes": 847916,"imageRawBytes": 156376,- "initialRawBytes": 1982245,+ "initialRawBytes": 1982717,"largestAssetRawBytes": 746121,"otherAssetRawBytes": 0,- "ownedRawBytes": 73859,- "requestCount": 42,- "scriptRequestCount": 26,+ "ownedRawBytes": 73898,+ "requestCount": 43,+ "scriptRequestCount": 27,"sourceOwners": ["package:@ark-ui/react","package:@chakra-ui/react",@@ -173,6 +173,7 @@"source:src/features/nodes/ui/NodesPage.tsx","source:src/platform/browser/downloadBlob.ts","source:src/platform/browser/knownBrowserIssues.ts",+ "source:src/platform/browser/randomUuid.ts","source:src/platform/core/concurrency.ts","source:src/platform/i18n/client.ts","source:src/platform/i18n/languages.ts",@@ -296,17 +297,17 @@]},"limits": {- "brotliBytes": 856888,+ "brotliBytes": 857224,"cssRawBytes": 2181,"fontRawBytes": 221675,- "gzipBytes": 856055,+ "gzipBytes": 856396,"imageRawBytes": 157940,- "initialRawBytes": 2002068,+ "initialRawBytes": 2002545,"largestAssetRawBytes": 753583,"otherAssetRawBytes": 0,- "ownedRawBytes": 73859,- "requestCount": 42,- "scriptRequestCount": 26+ "ownedRawBytes": 73898,+ "requestCount": 43,+ "scriptRequestCount": 27},"owner": "app","remediationTicket": "set-performance-budgets",@@ -314,17 +315,17 @@},"editor": {"baseline": {- "brotliBytes": 1146538,+ "brotliBytes": 1146936,"cssRawBytes": 2159,"fontRawBytes": 219480,- "gzipBytes": 1141296,+ "gzipBytes": 1141728,"imageRawBytes": 156376,- "initialRawBytes": 2888015,+ "initialRawBytes": 2888767,"largestAssetRawBytes": 746121,"otherAssetRawBytes": 0,- "ownedRawBytes": 132798,- "requestCount": 103,- "scriptRequestCount": 87,+ "ownedRawBytes": 132886,+ "requestCount": 104,+ "scriptRequestCount": 88,"sourceOwners": ["package:@ark-ui/react","package:@chakra-ui/react",@@ -639,6 +640,7 @@"source:src/features/workflow/widget.ts","source:src/platform/browser/downloadBlob.ts","source:src/platform/browser/knownBrowserIssues.ts",+ "source:src/platform/browser/randomUuid.ts","source:src/platform/browser/webLocks.ts","source:src/platform/core/concurrency.ts","source:src/platform/core/json.ts",@@ -967,17 +969,17 @@]},"limits": {- "brotliBytes": 1158004,+ "brotliBytes": 1158406,"cssRawBytes": 2181,"fontRawBytes": 221675,- "gzipBytes": 1152709,+ "gzipBytes": 1153146,"imageRawBytes": 157940,- "initialRawBytes": 2916896,+ "initialRawBytes": 2917655,"largestAssetRawBytes": 753583,"otherAssetRawBytes": 0,- "ownedRawBytes": 132798,- "requestCount": 103,- "scriptRequestCount": 87+ "ownedRawBytes": 132886,+ "requestCount": 104,+ "scriptRequestCount": 88},"owner": "workbench","remediationTicket": "deepen-widget-registry-loading",diff --git a/invokeai/frontend/webv2/performance/browser-baseline.json b/invokeai/frontend/webv2/performance/browser-baseline.jsonindex 7e4a52e0f0..e6de7fbeba 100644--- a/invokeai/frontend/webv2/performance/browser-baseline.json+++ b/invokeai/frontend/webv2/performance/browser-baseline.json@@ -1,5 +1,5 @@{- "browserExecutable": "/home/toast/.cache/ms-playwright/chromium-1234/chrome-linux64/chrome",+ "browserExecutable": "/home/lstein/.cache/ms-playwright/chromium-1234/chrome-linux64/chrome","capturedAt": "2026-09-05","routes": [{@@ -25,13 +25,13 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 119.39999999850988,+ "domContentLoadedMedianMs": 94.10000002384186,"id": "launchpad","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,"layoutSwitchMedianMs": 0,- "loadMedianMs": 119.5,- "longestTaskMaxMs": 70,+ "loadMedianMs": 94.20000004768372,+ "longestTaskMaxMs": 55,"owner": "app","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:launchpad",@@ -41,24 +41,24 @@"fontRawBytes": 23664,"imageRawBytes": 0,"largestAssetRawBytes": 746121,- "otherRawBytes": 169527,- "requestCount": 37,- "scriptRawBytes": 1662375,- "scriptRequestCount": 33,- "totalRawBytes": 1857725+ "otherRawBytes": 169609,+ "requestCount": 38,+ "scriptRawBytes": 1662847,+ "scriptRequestCount": 34,+ "totalRawBytes": 1858279},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 0,"largestAssetRawBytes": 753583,- "otherRawBytes": 171223,- "requestCount": 37,- "scriptRawBytes": 1678999,- "scriptRequestCount": 33,- "totalRawBytes": 1876303+ "otherRawBytes": 171306,+ "requestCount": 38,+ "scriptRawBytes": 1679476,+ "scriptRequestCount": 34,+ "totalRawBytes": 1876862},- "routeReadyMedianMs": 268.3999999985099,+ "routeReadyMedianMs": 214.89999997615814,"scriptSourceOwnerSet": "launchpad-static","stateProfile": "empty"},@@ -85,13 +85,13 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 122.60000000149012,+ "domContentLoadedMedianMs": 96,"id": "launchpad","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,"layoutSwitchMedianMs": 0,- "loadMedianMs": 122.70000000298023,- "longestTaskMaxMs": 73,+ "loadMedianMs": 96.10000002384186,+ "longestTaskMaxMs": 56,"owner": "app","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:launchpad",@@ -101,24 +101,24 @@"fontRawBytes": 23664,"imageRawBytes": 0,"largestAssetRawBytes": 746121,- "otherRawBytes": 169527,- "requestCount": 37,- "scriptRawBytes": 1662375,- "scriptRequestCount": 33,- "totalRawBytes": 1857725+ "otherRawBytes": 169609,+ "requestCount": 38,+ "scriptRawBytes": 1662847,+ "scriptRequestCount": 34,+ "totalRawBytes": 1858279},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 0,"largestAssetRawBytes": 753583,- "otherRawBytes": 171223,- "requestCount": 37,- "scriptRawBytes": 1678999,- "scriptRequestCount": 33,- "totalRawBytes": 1876303+ "otherRawBytes": 171306,+ "requestCount": 38,+ "scriptRawBytes": 1679476,+ "scriptRequestCount": 34,+ "totalRawBytes": 1876862},- "routeReadyMedianMs": 282.70000000298023,+ "routeReadyMedianMs": 229,"scriptSourceOwnerSet": "launchpad-static","stateProfile": "representative"},@@ -145,15 +145,15 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 117.89999999850988,+ "domContentLoadedMedianMs": 93.30000007152557,"id": "editor-minimal","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,"layoutSwitchMedianMs": 0,- "loadMedianMs": 118,- "longestTaskMaxMs": 125,+ "loadMedianMs": 93.39999997615814,+ "longestTaskMaxMs": 105,"owner": "workbench",- "projectSwitchMedianMs": 38.30000000447035,+ "projectSwitchMedianMs": 29.799999952316284,"readyMark": "invokeai:ready:widget:center:preview","remediationTicket": "deepen-widget-registry-loading","resourceBaseline": {@@ -161,24 +161,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746121,- "otherRawBytes": 169527,- "requestCount": 121,- "scriptRawBytes": 3436667,- "scriptRequestCount": 116,- "totalRawBytes": 3788393+ "otherRawBytes": 169609,+ "requestCount": 122,+ "scriptRawBytes": 3437481,+ "scriptRequestCount": 117,+ "totalRawBytes": 3789289},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753583,- "otherRawBytes": 171223,- "requestCount": 121,- "scriptRawBytes": 3471034,- "scriptRequestCount": 116,- "totalRawBytes": 3826277+ "otherRawBytes": 171306,+ "requestCount": 122,+ "scriptRawBytes": 3471856,+ "scriptRequestCount": 117,+ "totalRawBytes": 3827182},- "routeReadyMedianMs": 434.29999999701977,+ "routeReadyMedianMs": 352.10000002384186,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "empty"},@@ -205,15 +205,15 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 121.39999999850988,+ "domContentLoadedMedianMs": 95.20000004768372,"id": "editor-minimal","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,"layoutSwitchMedianMs": 0,- "loadMedianMs": 121.39999999850988,- "longestTaskMaxMs": 132,+ "loadMedianMs": 95.30000007152557,+ "longestTaskMaxMs": 106,"owner": "workbench",- "projectSwitchMedianMs": 44.600000001490116,+ "projectSwitchMedianMs": 35,"readyMark": "invokeai:ready:widget:center:preview","remediationTicket": "deepen-widget-registry-loading","resourceBaseline": {@@ -221,24 +221,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746121,- "otherRawBytes": 169527,- "requestCount": 121,- "scriptRawBytes": 3436667,- "scriptRequestCount": 116,- "totalRawBytes": 3788393+ "otherRawBytes": 169609,+ "requestCount": 122,+ "scriptRawBytes": 3437481,+ "scriptRequestCount": 117,+ "totalRawBytes": 3789289},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753583,- "otherRawBytes": 171223,- "requestCount": 121,- "scriptRawBytes": 3471034,- "scriptRequestCount": 116,- "totalRawBytes": 3826277+ "otherRawBytes": 171306,+ "requestCount": 122,+ "scriptRawBytes": 3471856,+ "scriptRequestCount": 117,+ "totalRawBytes": 3827182},- "routeReadyMedianMs": 439.69999999552965,+ "routeReadyMedianMs": 354.60000002384186,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "representative"},@@ -250,9 +250,9 @@"largestAssetRawBytes": 314585,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 481922,+ "scriptRawBytes": 481950,"scriptRequestCount": 7,- "totalRawBytes": 481922+ "totalRawBytes": 481950},"activatedResourceLimits": {"cssRawBytes": 0,@@ -261,17 +261,17 @@"largestAssetRawBytes": 317731,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 486742,+ "scriptRawBytes": 486770,"scriptRequestCount": 7,- "totalRawBytes": 486742+ "totalRawBytes": 486770},- "domContentLoadedMedianMs": 119.20000000298023,+ "domContentLoadedMedianMs": 95.5,"id": "editor-canvas",- "layoutAckMedianMs": 2.7000000029802322,- "layoutReturnSwitchMedianMs": 56.399999998509884,- "layoutSwitchMedianMs": 94.20000000298023,- "loadMedianMs": 119.30000000447035,- "longestTaskMaxMs": 154,+ "layoutAckMedianMs": 2.100000023841858,+ "layoutReturnSwitchMedianMs": 48.60000002384186,+ "layoutSwitchMedianMs": 77.80000007152557,+ "loadMedianMs": 95.70000004768372,+ "longestTaskMaxMs": 113,"owner": "canvas","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:canvas",@@ -281,24 +281,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746121,- "otherRawBytes": 169527,- "requestCount": 128,- "scriptRawBytes": 3918589,- "scriptRequestCount": 123,- "totalRawBytes": 4270315+ "otherRawBytes": 169609,+ "requestCount": 129,+ "scriptRawBytes": 3919431,+ "scriptRequestCount": 124,+ "totalRawBytes": 4271239},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753583,- "otherRawBytes": 171223,- "requestCount": 128,- "scriptRawBytes": 3957775,- "scriptRequestCount": 123,- "totalRawBytes": 4313019+ "otherRawBytes": 171306,+ "requestCount": 129,+ "scriptRawBytes": 3958626,+ "scriptRequestCount": 124,+ "totalRawBytes": 4313952},- "routeReadyMedianMs": 1137.7000000029802,+ "routeReadyMedianMs": 1025,"scriptSourceOwnerSet": "editor-canvas-static","stateProfile": "empty"},@@ -310,9 +310,9 @@"largestAssetRawBytes": 314585,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 481922,+ "scriptRawBytes": 481950,"scriptRequestCount": 7,- "totalRawBytes": 481922+ "totalRawBytes": 481950},"activatedResourceLimits": {"cssRawBytes": 0,@@ -321,17 +321,17 @@"largestAssetRawBytes": 317731,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 486742,+ "scriptRawBytes": 486770,"scriptRequestCount": 7,- "totalRawBytes": 486742+ "totalRawBytes": 486770},- "domContentLoadedMedianMs": 121.69999999552965,+ "domContentLoadedMedianMs": 96.29999995231628,"id": "editor-canvas",- "layoutAckMedianMs": 3.3000000044703484,- "layoutReturnSwitchMedianMs": 46.29999999701977,- "layoutSwitchMedianMs": 88.5,- "loadMedianMs": 121.79999999701977,- "longestTaskMaxMs": 193,+ "layoutAckMedianMs": 3.399999976158142,+ "layoutReturnSwitchMedianMs": 45.700000047683716,+ "layoutSwitchMedianMs": 77.39999997615814,+ "loadMedianMs": 96.5,+ "longestTaskMaxMs": 152,"owner": "canvas","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:canvas",@@ -341,24 +341,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746121,- "otherRawBytes": 169527,- "requestCount": 128,- "scriptRawBytes": 3918589,- "scriptRequestCount": 123,- "totalRawBytes": 4270315+ "otherRawBytes": 169609,+ "requestCount": 129,+ "scriptRawBytes": 3919431,+ "scriptRequestCount": 124,+ "totalRawBytes": 4271239},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753583,- "otherRawBytes": 171223,- "requestCount": 128,- "scriptRawBytes": 3957775,- "scriptRequestCount": 123,- "totalRawBytes": 4313019+ "otherRawBytes": 171306,+ "requestCount": 129,+ "scriptRawBytes": 3958626,+ "scriptRequestCount": 124,+ "totalRawBytes": 4313952},- "routeReadyMedianMs": 1137.6999999955297,+ "routeReadyMedianMs": 1048.5,"scriptSourceOwnerSet": "editor-canvas-static","stateProfile": "representative"},@@ -370,9 +370,9 @@"largestAssetRawBytes": 173980,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 364370,+ "scriptRawBytes": 364400,"scriptRequestCount": 6,- "totalRawBytes": 379783+ "totalRawBytes": 379813},"activatedResourceLimits": {"cssRawBytes": 15568,@@ -381,17 +381,17 @@"largestAssetRawBytes": 175720,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 368014,+ "scriptRawBytes": 368044,"scriptRequestCount": 6,- "totalRawBytes": 383581+ "totalRawBytes": 383612},- "domContentLoadedMedianMs": 119.5,+ "domContentLoadedMedianMs": 93.60000002384186,"id": "editor-workflow",- "layoutAckMedianMs": 2.600000001490116,- "layoutReturnSwitchMedianMs": 32.70000000298023,- "layoutSwitchMedianMs": 94.60000000149012,- "loadMedianMs": 119.59999999403954,- "longestTaskMaxMs": 142,+ "layoutAckMedianMs": 2.100000023841858,+ "layoutReturnSwitchMedianMs": 29.299999952316284,+ "layoutSwitchMedianMs": 75.5,+ "loadMedianMs": 93.70000004768372,+ "longestTaskMaxMs": 104,"owner": "workflow","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:workflow",@@ -401,24 +401,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746121,- "otherRawBytes": 169527,- "requestCount": 128,- "scriptRawBytes": 3801037,- "scriptRequestCount": 122,- "totalRawBytes": 4168176+ "otherRawBytes": 169609,+ "requestCount": 129,+ "scriptRawBytes": 3801881,+ "scriptRequestCount": 123,+ "totalRawBytes": 4169102},"resourceLimits": {"cssRawBytes": 17748,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753583,- "otherRawBytes": 171223,- "requestCount": 128,- "scriptRawBytes": 3839048,- "scriptRequestCount": 122,- "totalRawBytes": 4209858+ "otherRawBytes": 171306,+ "requestCount": 129,+ "scriptRawBytes": 3839900,+ "scriptRequestCount": 123,+ "totalRawBytes": 4210794},- "routeReadyMedianMs": 1152,+ "routeReadyMedianMs": 1032.8999999761581,"scriptSourceOwnerSet": "editor-workflow-static","stateProfile": "empty"},@@ -430,9 +430,9 @@"largestAssetRawBytes": 173980,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 364370,+ "scriptRawBytes": 364400,"scriptRequestCount": 6,- "totalRawBytes": 379783+ "totalRawBytes": 379813},"activatedResourceLimits": {"cssRawBytes": 15568,@@ -441,17 +441,17 @@"largestAssetRawBytes": 175720,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 368014,+ "scriptRawBytes": 368044,"scriptRequestCount": 6,- "totalRawBytes": 383581+ "totalRawBytes": 383612},- "domContentLoadedMedianMs": 120.79999999701977,+ "domContentLoadedMedianMs": 96,"id": "editor-workflow",- "layoutAckMedianMs": 3.5,- "layoutReturnSwitchMedianMs": 40.5,- "layoutSwitchMedianMs": 126.10000000149012,- "loadMedianMs": 120.89999999850988,- "longestTaskMaxMs": 375,+ "layoutAckMedianMs": 3.299999952316284,+ "layoutReturnSwitchMedianMs": 35.299999952316284,+ "layoutSwitchMedianMs": 110.10000002384186,+ "loadMedianMs": 96.09999990463257,+ "longestTaskMaxMs": 277,"owner": "workflow","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:workflow",@@ -461,24 +461,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746121,- "otherRawBytes": 169527,- "requestCount": 128,- "scriptRawBytes": 3801037,- "scriptRequestCount": 122,- "totalRawBytes": 4168176+ "otherRawBytes": 169609,+ "requestCount": 129,+ "scriptRawBytes": 3801881,+ "scriptRequestCount": 123,+ "totalRawBytes": 4169102},"resourceLimits": {"cssRawBytes": 17748,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753583,- "otherRawBytes": 171223,- "requestCount": 128,- "scriptRawBytes": 3839048,- "scriptRequestCount": 122,- "totalRawBytes": 4209858+ "otherRawBytes": 171306,+ "requestCount": 129,+ "scriptRawBytes": 3839900,+ "scriptRequestCount": 123,+ "totalRawBytes": 4210794},- "routeReadyMedianMs": 1177.6000000014901,+ "routeReadyMedianMs": 1084.5,"scriptSourceOwnerSet": "editor-workflow-static","stateProfile": "representative"},@@ -505,13 +505,13 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 120.89999999850988,+ "domContentLoadedMedianMs": 93,"id": "editor-gallery","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,- "layoutSwitchMedianMs": 23.5,- "loadMedianMs": 121.10000000149012,- "longestTaskMaxMs": 126,+ "layoutSwitchMedianMs": 20.700000047683716,+ "loadMedianMs": 93.10000002384186,+ "longestTaskMaxMs": 105,"owner": "gallery","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:gallery",@@ -521,24 +521,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746121,- "otherRawBytes": 169527,- "requestCount": 121,- "scriptRawBytes": 3436667,- "scriptRequestCount": 116,- "totalRawBytes": 3788393+ "otherRawBytes": 169609,+ "requestCount": 122,+ "scriptRawBytes": 3437481,+ "scriptRequestCount": 117,+ "totalRawBytes": 3789289},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753583,- "otherRawBytes": 171223,- "requestCount": 121,- "scriptRawBytes": 3471034,- "scriptRequestCount": 116,- "totalRawBytes": 3826277+ "otherRawBytes": 171306,+ "requestCount": 122,+ "scriptRawBytes": 3471856,+ "scriptRequestCount": 117,+ "totalRawBytes": 3827182},- "routeReadyMedianMs": 1325,+ "routeReadyMedianMs": 1232.6000000238419,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "empty"},@@ -565,13 +565,13 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 115,+ "domContentLoadedMedianMs": 98.70000004768372,"id": "editor-gallery","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,- "layoutSwitchMedianMs": 30.80000000447035,- "loadMedianMs": 115.10000000149012,- "longestTaskMaxMs": 114,+ "layoutSwitchMedianMs": 26.700000047683716,+ "loadMedianMs": 98.80000007152557,+ "longestTaskMaxMs": 101,"owner": "gallery","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:gallery",@@ -581,24 +581,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746121,- "otherRawBytes": 169527,- "requestCount": 121,- "scriptRawBytes": 3436667,- "scriptRequestCount": 116,- "totalRawBytes": 3788393+ "otherRawBytes": 169609,+ "requestCount": 122,+ "scriptRawBytes": 3437481,+ "scriptRequestCount": 117,+ "totalRawBytes": 3789289},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753583,- "otherRawBytes": 171223,- "requestCount": 121,- "scriptRawBytes": 3471034,- "scriptRequestCount": 116,- "totalRawBytes": 3826277+ "otherRawBytes": 171306,+ "requestCount": 122,+ "scriptRawBytes": 3471856,+ "scriptRequestCount": 117,+ "totalRawBytes": 3827182},- "routeReadyMedianMs": 1330.2000000029802,+ "routeReadyMedianMs": 1265.8000000715256,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "representative"}@@ -803,6 +803,7 @@"source:src/features/queue/ui/launchpad/QueueStatusBand.tsx","source:src/platform/browser/downloadBlob.ts","source:src/platform/browser/knownBrowserIssues.ts",+ "source:src/platform/browser/randomUuid.ts","source:src/platform/core/concurrency.ts","source:src/platform/i18n/client.ts","source:src/platform/i18n/languages.ts",@@ -1384,6 +1385,7 @@"source:src/features/workflow/widget.ts","source:src/platform/browser/downloadBlob.ts","source:src/platform/browser/knownBrowserIssues.ts",+ "source:src/platform/browser/randomUuid.ts","source:src/platform/browser/webLocks.ts","source:src/platform/core/concurrency.ts","source:src/platform/core/json.ts",@@ -2371,6 +2373,7 @@"source:src/features/workflow/widget.ts","source:src/platform/browser/downloadBlob.ts","source:src/platform/browser/knownBrowserIssues.ts",+ "source:src/platform/browser/randomUuid.ts","source:src/platform/browser/webLocks.ts","source:src/platform/core/concurrency.ts","source:src/platform/core/json.ts",@@ -3570,6 +3573,7 @@"source:src/features/workflow/widget.ts","source:src/platform/browser/downloadBlob.ts","source:src/platform/browser/knownBrowserIssues.ts",+ "source:src/platform/browser/randomUuid.ts","source:src/platform/browser/webLocks.ts","source:src/platform/core/concurrency.ts","source:src/platform/core/json.ts",diff --git a/invokeai/frontend/webv2/src/app/GenerationUiAdapter.tsx b/invokeai/frontend/webv2/src/app/GenerationUiAdapter.tsxindex c1756f9468..c252f88b26 100644--- a/invokeai/frontend/webv2/src/app/GenerationUiAdapter.tsx+++ b/invokeai/frontend/webv2/src/app/GenerationUiAdapter.tsx@@ -15,6 +15,7 @@ import {extractGenerationMeta,getResultImageName,} from '@features/queue/contracts';+import { createUuid } from '@platform/browser/randomUuid';import { useMountEffect } from '@platform/react/useMountEffect';import { useQuery, useQueryClient } from '@tanstack/react-query';import {@@ -233,7 +234,7 @@ export const GenerationUiAdapterProvider = ({ children }: { children: ReactNode});},save: (label, weights, multiplier) => {- const preset = { id: crypto.randomUUID(), label, multiplier, weights };+ const preset = { id: createUuid(), label, multiplier, weights };void patchWorkbenchPreferences({krea2RebalancePresets: [...getWorkbenchPreferences().krea2RebalancePresets, preset],@@ -263,7 +264,7 @@ export const GenerationUiAdapterProvider = ({ children }: { children: ReactNode});},save: (label, values) => {- const preset = { id: crypto.randomUUID(), label, values };+ const preset = { id: createUuid(), label, values };void patchWorkbenchPreferences({generatePresets: [...getWorkbenchPreferences().generatePresets, preset],diff --git a/invokeai/frontend/webv2/src/architecture/secureContextApis.test.ts b/invokeai/frontend/webv2/src/architecture/secureContextApis.test.tsnew file mode 100644index 0000000000..e9c2470f03--- /dev/null+++ b/invokeai/frontend/webv2/src/architecture/secureContextApis.test.ts@@ -0,0 +1,28 @@+import { describe, expect, it } from 'vitest';++/**+ * `crypto.randomUUID` is undefined outside secure contexts, and the app is+ * routinely opened over plain HTTP from another device on the LAN. Every id+ * mint goes through `@platform/browser/randomUuid`, which falls back to+ * `getRandomValues`; a direct call anywhere else reintroduces a startup crash+ * that only shows up on a phone or tablet.+ */+const sources = import.meta.glob('../**/*.{ts,tsx}', {+ eager: true,+ import: 'default',+ query: '?raw',+}) as Record<string, string>;++const HELPER_PATH = '../platform/browser/randomUuid.ts';+const isTestFile = (path: string): boolean => /\.(test|spec|stories)\.tsx?$/.test(path);++describe('secure-context web APIs', () => {+ it('routes every production UUID mint through the randomUuid helper', () => {+ const offenders = Object.entries(sources)+ .filter(([path]) => path !== HELPER_PATH && !isTestFile(path))+ .filter(([, text]) => /\brandomUUID\b/.test(text))+ .map(([path]) => path.replace(/^\.\.\//, ''));++ expect(offenders).toEqual([]);+ });+});diff --git a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsxindex 460b124dd7..42b691d4ba 100644--- a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx+++ b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/PositivePromptActions.tsx@@ -25,6 +25,7 @@ import {} from '@features/generation/ui/promptFields/promptTriggerOptions';import { SystemPromptsField } from '@features/generation/ui/promptFields/SystemPromptsField';import { useSystemPrompts } from '@features/generation/ui/promptFields/useSystemPrompts';+import { createUuid } from '@platform/browser/randomUuid';import { useMountEffect } from '@platform/react/useMountEffect';import { getApiErrorMessage } from '@platform/transport/http';import { Button, IconButton, PopoverContent, Scrollable, Tooltip } from '@platform/ui';@@ -435,7 +436,7 @@ const ExpandPromptButton = ({return;}- const nextTaskId = crypto.randomUUID();+ const nextTaskId = createUuid();setTaskId(nextTaskId);setIsLoading(true);@@ -608,7 +609,7 @@ const ImageToPromptButton = ({return;}- const nextTaskId = crypto.randomUUID();+ const nextTaskId = createUuid();setTaskId(nextTaskId);setIsLoading(true);diff --git a/invokeai/frontend/webv2/src/features/queue/runtime/utilityGraph.ts b/invokeai/frontend/webv2/src/features/queue/runtime/utilityGraph.tsindex 31ddb66630..e4e3a37407 100644--- a/invokeai/frontend/webv2/src/features/queue/runtime/utilityGraph.ts+++ b/invokeai/frontend/webv2/src/features/queue/runtime/utilityGraph.ts@@ -32,6 +32,7 @@ import type { SocketHub } from '@platform/transport/socketHub';import { buildUtilityQueueItemOrigin } from '@features/queue/data/events';import { cancelQueueItems, getQueueItem } from '@features/queue/data/serverApi';import { enqueueUtility } from '@features/queue/data/submissionApi';+import { createUuid } from '@platform/browser/randomUuid';import { ApiError } from '@platform/transport/http';/** The default time a utility graph may run before it is abandoned. */@@ -133,7 +134,7 @@ export interface RunUtilityGraphOptions {timeoutMs?: number;/** Cancels the await and best-effort cancels accepted backend items. */signal?: AbortSignal;- /** Injectable id source (defaults to `crypto.randomUUID`). */+ /** Injectable id source (defaults to `createUuid`). */createId?: () => string;/** Injectable completed-item reconciliation seam. */reconcileCompletedOutput?: UtilityCompletedOutputReconciler;@@ -232,7 +233,7 @@ export const runUtilityGraph = (options: RunUtilityGraphOptions): Promise<Utilit: DEFAULT_UTILITY_RECONCILE_RETRY_POLICY.delayMs;let origin: string;try {- const utilityId = (options.createId ?? (() => crypto.randomUUID()))();+ const utilityId = (options.createId ?? createUuid)();origin = buildUtilityQueueItemOrigin(utilityId);} catch (cause) {const detail = cause instanceof Error ? cause.message : String(cause);diff --git a/invokeai/frontend/webv2/src/platform/browser/randomUuid.test.ts b/invokeai/frontend/webv2/src/platform/browser/randomUuid.test.tsnew file mode 100644index 0000000000..6e2a6e053f--- /dev/null+++ b/invokeai/frontend/webv2/src/platform/browser/randomUuid.test.ts@@ -0,0 +1,70 @@+import { createUuid, createUuidWith, type UuidCryptoSource } from '@platform/browser/randomUuid';+import { describe, expect, it, vi } from 'vitest';++const UUID_V4 = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;++/** A `Crypto` as seen from an insecure context: random bytes, no `randomUUID`. */+const insecureContextCrypto = (+ fill: (bytes: Uint8Array) => void = (bytes) => crypto.getRandomValues(bytes as Uint8Array<ArrayBuffer>)+) => {+ const source: UuidCryptoSource = {+ getRandomValues: ((array: ArrayBufferView) => {+ fill(new Uint8Array(array.buffer, array.byteOffset, array.byteLength));+ return array;+ }) as Crypto['getRandomValues'],+ };+ return source;+};++describe('createUuidWith', () => {+ it('delegates to the native generator when the context provides one', () => {+ const randomUUID = vi.fn(+ (): `${string}-${string}-${string}-${string}-${string}` => '11111111-2222-4333-8444-555555555555'+ );++ expect(createUuidWith({ getRandomValues: crypto.getRandomValues.bind(crypto), randomUUID })).toBe(+ '11111111-2222-4333-8444-555555555555'+ );+ expect(randomUUID).toHaveBeenCalledOnce();+ });++ it('builds a well-formed version 4 UUID without the native generator', () => {+ const source = insecureContextCrypto();+ const seen = new Set<string>();++ for (let index = 0; index < 200; index += 1) {+ const uuid = createUuidWith(source);+ expect(uuid).toMatch(UUID_V4);+ seen.add(uuid);+ }++ expect(seen.size).toBe(200);+ });++ it('forces the version and variant bits regardless of the random bytes', () => {+ const allOnes = createUuidWith(insecureContextCrypto((bytes) => bytes.fill(0xff)));+ const allZeros = createUuidWith(insecureContextCrypto((bytes) => bytes.fill(0x00)));++ expect(allOnes).toBe('ffffffff-ffff-4fff-bfff-ffffffffffff');+ expect(allZeros).toBe('00000000-0000-4000-8000-000000000000');+ });+});++describe('createUuid', () => {+ it('produces a version 4 UUID from the ambient crypto object', () => {+ expect(createUuid()).toMatch(UUID_V4);+ });++ it('survives an ambient crypto object that lacks randomUUID', () => {+ const original = globalThis.crypto;+ vi.stubGlobal(+ 'crypto',+ insecureContextCrypto((bytes) => original.getRandomValues(bytes as Uint8Array<ArrayBuffer>))+ );+ try {+ expect(createUuid()).toMatch(UUID_V4);+ } finally {+ vi.unstubAllGlobals();+ }+ });+});diff --git a/invokeai/frontend/webv2/src/platform/browser/randomUuid.ts b/invokeai/frontend/webv2/src/platform/browser/randomUuid.tsnew file mode 100644index 0000000000..c2433111ea--- /dev/null+++ b/invokeai/frontend/webv2/src/platform/browser/randomUuid.ts@@ -0,0 +1,38 @@+/**+ * Generate an RFC 4122 version 4 UUID.+ *+ * `crypto.randomUUID` is exposed only in secure contexts — HTTPS, or `localhost`+ * over plain HTTP. The app is routinely opened from another device on the LAN+ * (an iPad pointed at a workstation, say), and there the property is simply+ * undefined, so a bare `crypto.randomUUID()` throws. The durable persistence+ * layer mints a writer token during startup, which turned that into a crash+ * before first paint.+ *+ * `crypto.getRandomValues` carries no secure-context restriction, so when the+ * native generator is missing the UUID is assembled from sixteen random bytes+ * with the version and variant bits set by hand. Every call site that needs a+ * fresh id goes through here; `crypto.randomUUID` must not be called directly.+ */++/** The subset of `Crypto` the generator relies on, so tests can swap it. */+export type UuidCryptoSource = Pick<Crypto, 'getRandomValues'> & Partial<Pick<Crypto, 'randomUUID'>>;++const toHex = (byte: number): string => byte.toString(16).padStart(2, '0');++export const createUuidWith = (source: UuidCryptoSource): string => {+ if (typeof source.randomUUID === 'function') {+ return source.randomUUID();+ }++ const bytes = new Uint8Array(16);+ source.getRandomValues(bytes);+ // Version 4: the top nibble of byte 6 is 0b0100.+ bytes[6] = (bytes[6]! & 0x0f) | 0x40;+ // RFC 4122 variant: the top two bits of byte 8 are 0b10.+ bytes[8] = (bytes[8]! & 0x3f) | 0x80;++ const hex = Array.from(bytes, toHex).join('');+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;+};++export const createUuid = (): string => createUuidWith(globalThis.crypto);diff --git a/invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts b/invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.tsindex 5b31e68fae..4b656cbf40 100644--- a/invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts+++ b/invokeai/frontend/webv2/src/workbench/projects/durableSyncedPersistence.ts@@ -1,6 +1,7 @@import type { HydratedWorkbenchSnapshot } from '@workbench/persistenceContracts';import type { Project, ProjectLoadResult, RefusedWorkbenchProject, WorkbenchState } from '@workbench/projectContracts';+import { createUuid } from '@platform/browser/randomUuid';import { assertAccountScopeCurrent, type AccountScope } from '@platform/state/accountLifecycle';import {getProjectCanvasSchemaRequirement,@@ -459,7 +460,7 @@ export const createDurableSyncedWorkbenchPersistence = (journal.close();}};- const writerToken = dependencies.writerToken ?? crypto.randomUUID();+ const writerToken = dependencies.writerToken ?? createUuid();const saveAsNew = dependencies.saveDraftAsNew ?? saveDraftAsNew;const deleteDatabase = dependencies.deleteDatabase ?? deleteWorkbenchDatabase;const databaseDeleteTimeoutMs = dependencies.databaseDeleteTimeoutMs ?? 5_000;@@ -644,8 +645,7 @@ export const createDurableSyncedWorkbenchPersistence = (const isolateUnopenableDraft = (projectId: string, editorSessionId: string): string => {const preferred = `${editorSessionId}:writer:${writerToken}`;- const isolated =- draftEditorSessionIds.get(projectId) === preferred ? `${preferred}:${crypto.randomUUID()}` : preferred;+ const isolated = draftEditorSessionIds.get(projectId) === preferred ? `${preferred}:${createUuid()}` : preferred;draftEditorSessionIds.set(projectId, isolated);return isolated;};diff --git a/invokeai/frontend/webv2/src/workbench/projects/editorSession.ts b/invokeai/frontend/webv2/src/workbench/projects/editorSession.tsindex 42793a153c..7d05b82602 100644--- a/invokeai/frontend/webv2/src/workbench/projects/editorSession.ts+++ b/invokeai/frontend/webv2/src/workbench/projects/editorSession.ts@@ -1,3 +1,4 @@+import { createUuid } from '@platform/browser/randomUuid';import { acquireExclusiveLock, type ExclusiveLockResult } from '@platform/browser/webLocks';export const EDITOR_SESSION_STORAGE_KEY = 'invokeai:v7:webv2:editor-session';@@ -18,7 +19,7 @@ type AcquireLock = (name: string) => Promise<ExclusiveLockResult>;export const createEditorSessionProvider = (storage: SessionStoragePort,acquireLock: AcquireLock = acquireExclusiveLock,- createId: () => string = () => crypto.randomUUID()+ createId: () => string = createUuid): (() => Promise<EditorSession>) => {let sessionPromise: Promise<EditorSession> | null = null;let currentSession: EditorSession | null = null;diff --git a/invokeai/frontend/webv2/src/workbench/projects/ids.ts b/invokeai/frontend/webv2/src/workbench/projects/ids.tsindex 9c8705d074..0fb44f0844 100644--- a/invokeai/frontend/webv2/src/workbench/projects/ids.ts+++ b/invokeai/frontend/webv2/src/workbench/projects/ids.ts@@ -1,4 +1,6 @@-export const createProjectId = (): string => `project-${globalThis.crypto.randomUUID()}`;+import { createUuid } from '@platform/browser/randomUuid';++export const createProjectId = (): string => `project-${createUuid()}`;export const createDeterministicProjectId = async (scope: string): Promise<string> => {const digest = new Uint8Array(await globalThis.crypto.subtle.digest('SHA-256', new TextEncoder().encode(scope)));diff --git a/invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts b/invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.tsindex 4a544f2c4e..054531bb10 100644--- a/invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts+++ b/invokeai/frontend/webv2/src/workbench/projects/indexedDbDraftStore.ts@@ -1,5 +1,7 @@import type { AccountScope } from '@platform/state/accountLifecycle';+import { createUuid } from '@platform/browser/randomUuid';+import { acquireAccountOwnedWorkbenchDatabase } from './accountOwnedWorkbenchDatabase';import {clampProjectDraftLimit,@@ -538,9 +540,7 @@ export const createIndexedDbProjectDraftStore = (state: 'fenced',updatedAt: Date.now(),writerToken:- typeof storedWriterToken === 'string' && storedWriterToken.length > 0- ? storedWriterToken- : crypto.randomUUID(),+ typeof storedWriterToken === 'string' && storedWriterToken.length > 0 ? storedWriterToken : createUuid(),});await transaction.done;return { kind: 'deleted' };diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/RunLayerWorkflowDialog.tsx b/invokeai/frontend/webv2/src/workbench/widgets/layers/RunLayerWorkflowDialog.tsxindex 8b07468e13..4d06871100 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/RunLayerWorkflowDialog.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/RunLayerWorkflowDialog.tsx@@ -19,6 +19,7 @@ import {type WorkflowImageBinding,} from '@features/workflow/graph';import { useInvocationTemplatesSnapshot, type InvocationTemplatesSnapshot } from '@features/workflow/react';+import { createUuid } from '@platform/browser/randomUuid';import { captureAccountScope, isAccountScopeCurrent } from '@platform/state/accountLifecycle';import { socketHub } from '@platform/transport/socketHub';import { Button, CloseButton, Field, Select } from '@platform/ui';@@ -364,7 +365,7 @@ export const RunLayerWorkflowDialog = ({canvas.appendStagingCandidate({ candidate, projectId: targetProjectId }),buildGraph: buildLayerWorkflowGraph,commitGenerated: (options) => engine.layers.commitGeneratedImageResult(options),- createRequestId: () => crypto.randomUUID(),+ createRequestId: createUuid,exportLayer: (targetLayerId) => engine.exports.exportBakedLayerBlob(targetLayerId, { includeDisabled: true }),getImage: galleryImages.resolve,isGuardCurrent: (guard) => engine.exports.isLayerExportGuardCurrent(guard),