@civitai/app-sdk 0.78.0 → 0.80.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -539,10 +539,81 @@ exists to run. Only pass a `src` you control. React callers want
539
539
  `useNestedDocument()` from
540
540
  [`@civitai/blocks-react`](../civitai-blocks-react/README.md).
541
541
 
542
+ ### Can this workflow file run inline? (`checkComfyGraph`)
543
+
544
+ Almost no posted ComfyUI workflow can run as an inline `customComfy` graph:
545
+ they are saved in the editor's UI format, most use custom node packs, and
546
+ their loaders name models by local filename. `checkComfyGraph` answers from
547
+ the file alone, offline, so an app can disable "Run" and say why before any
548
+ Buzz is spent:
549
+
550
+ ```ts
551
+ import { checkComfyGraph } from '@civitai/app-sdk/blocks';
552
+ import type { BlockResourceFileEntry } from '@civitai/app-sdk/blocks';
553
+
554
+ function runLabel(entry: BlockResourceFileEntry): string {
555
+ const check = checkComfyGraph(entry);
556
+ if (check.runnable) return 'Run';
557
+ const reason = check.reasons[0]!;
558
+ switch (reason.code) {
559
+ case 'not-api-format':
560
+ return 'Re-export this workflow with "Save (API Format)"';
561
+ case 'custom-nodes':
562
+ return `Needs custom nodes: ${reason.packs.join(', ') || reason.classes.join(', ')}`;
563
+ case 'model-filenames':
564
+ return `Models are named by file, not AIR: ${reason.inputs.map((i) => i.value).join(', ')}`;
565
+ case 'too-many-nodes':
566
+ return `Over ${reason.max} nodes`;
567
+ case 'too-large':
568
+ return `Over ${reason.max} bytes`;
569
+ }
570
+ }
571
+ ```
572
+
573
+ The reason codes are a closed set, in this order:
574
+
575
+ | `code` | Fires when | Extra fields |
576
+ |---|---|---|
577
+ | `not-api-format` | the entry is not ComfyUI API format (`format` is `ui` or `unknown`, or the graph does not have API shape). The next three are then not checked. | `format` |
578
+ | `custom-nodes` | a node class is outside the core list (API graphs, and the node lists of UI graphs and their subgraphs) | `classes`, `packs` (from `properties.cnr_id`, UI graphs only) |
579
+ | `model-filenames` | a loader input (`*_name`, e.g. `ckpt_name`, `unet_name`, `lora_name`, `vae_name`, `clip_name`, `control_net_name`; plus `model_file`, `text_encoder`; plus `name` on `ModelPatchLoader` and `existing_lora` on `TrainLoraNode`) holds a model filename (`.safetensors`, `.ckpt`, `.pt`, `.pth`, `.bin`, `.gguf`, …) rather than an AIR (`urn:air:…`) | `inputs` (`nodeId`, `classType`, `input`, `value`) |
580
+ | `too-many-nodes` | more than `BLOCK_INLINE_COMFY_MAX_NODES` (300) nodes | `nodes`, `max` |
581
+ | `too-large` | the graph as sent (each node reduced to `class_type` + `inputs`) serializes to more than `BLOCK_INLINE_COMFY_MAX_GRAPH_BYTES` (262144) | `bytes`, `max` |
582
+
583
+ The core-node list is generated by `scripts/gen-comfy-core-nodes.mjs` from one
584
+ pinned ComfyUI commit (recorded in the generated file's header), never edited
585
+ by hand: the node classes `nodes.py` registers in `NODE_CLASS_MAPPINGS`, plus
586
+ the classes each `comfy_extras` module it loads actually registers (through
587
+ `get_node_list` or `NODE_CLASS_MAPPINGS`; a class that is only defined, or
588
+ commented out of that list, is not included). Partner API nodes are not in it.
589
+
590
+ 🔴 **The pin is a ComfyUI commit, not the worker's ComfyUI version.** The list
591
+ can name classes newer than the ComfyUI the generation worker runs, so a graph
592
+ that uses one gets `runnable: true` here and can still fail on the worker. The editor-only classes `Note`, `MarkdownNote`, `Reroute` and
593
+ `PrimitiveNode` are allowed in a UI graph, and never appear in an API one.
594
+
595
+ `runnable: true` means no known blocker was found, not that the job will
596
+ succeed: the worker image decides which nodes exist, and the host still runs its
597
+ AIR-containment, entitlement and moderation gates on the body you submit.
598
+
599
+ Before you submit, two host limits this check does not cover:
600
+ - **Strip per-node extras.** The host's node schema is strict: a node carrying
601
+ anything besides `class_type` and `inputs` (an export's `_meta`, for
602
+ instance) is rejected. `too-large` already measures the graph without them.
603
+ - **The request body is capped at 256 KB of UTF-8, for the whole request.** The
604
+ estimate and submit routes refuse a larger body with a 413, and the body
605
+ holds `resources`, `prompt` and the rest as well as the graph. So a graph just
606
+ under `BLOCK_INLINE_COMFY_MAX_GRAPH_BYTES` can still be refused.
607
+
608
+ 🔴 **A Comfy estimate is a ceiling, never a price.** Estimating a `customComfy`
609
+ body returns your `maxBuzz` as `cost.total`, and billing settles to the real GPU
610
+ time after the run. Show it as "up to N Buzz".
611
+
542
612
  ### Version compatibility
543
613
 
544
614
  | `@civitai/app-sdk` | adds (blocks surface) |
545
615
  |---|---|
616
+ | `0.80.0` | `checkComfyGraph` — pre-spend check that a workflow file can run as an inline `customComfy` graph; `BLOCK_INLINE_COMFY_MAX_NODES` / `BLOCK_INLINE_COMFY_MAX_GRAPH_BYTES` |
546
617
  | `0.57.0` | `fetchNestedDocument` / `NestedDocumentError` — the `srcdoc` escape hatch for embedding your own bundled documents |
547
618
  | `0.27.0` | `@civitai/app-sdk/safe-storage` — opaque-origin `localStorage`/`sessionStorage` shim, auto-installed by the `blocks` subpath |
548
619
  | `0.24.0` | `QUERY_APP_WORKFLOWS` / `CANCEL_APP_WORKFLOW` messages + the `AppWorkflow` type (app generator subqueue, PR #3164) |
@@ -0,0 +1,10 @@
1
+ /** The ComfyUI commit {@link COMFY_CORE_NODE_CLASSES} was generated from. */
2
+ export declare const COMFY_CORE_NODES_COMMIT = "fe298e4e20f1ff26d30e8639267bbd0b57811390";
3
+ /**
4
+ * Node classes built into ComfyUI at {@link COMFY_CORE_NODES_COMMIT}, sorted.
5
+ * A graph using only these (plus the frontend-only set) needs no custom-node pack.
6
+ */
7
+ export declare const COMFY_CORE_NODE_CLASSES: readonly string[];
8
+ /** ComfyUI's `folder_paths.supported_pt_extensions` at {@link COMFY_CORE_NODES_COMMIT}, lowercase, sorted. */
9
+ export declare const COMFY_MODEL_FILE_EXTENSIONS: readonly string[];
10
+ //# sourceMappingURL=comfyCoreNodes.generated.d.ts.map
@@ -0,0 +1,706 @@
1
+ // GENERATED by scripts/gen-comfy-core-nodes.mjs. Do not edit by hand.
2
+ // ComfyUI commit: fe298e4e20f1ff26d30e8639267bbd0b57811390
3
+ // Source: https://github.com/comfyanonymous/ComfyUI.git
4
+ // 685 classes: nodes.py NODE_CLASS_MAPPINGS plus the node ids the 145
5
+ // comfy_extras modules nodes.py loads register. Partner API nodes (comfy_api_nodes/)
6
+ // are excluded.
7
+ //
8
+ // The pin is the ComfyUI commit the list was generated from, NOT the ComfyUI
9
+ // version the generation worker runs: the list can name classes newer than the
10
+ // worker, so a graph that passes checkComfyGraph can still fail on it.
11
+ /** The ComfyUI commit {@link COMFY_CORE_NODE_CLASSES} was generated from. */
12
+ export const COMFY_CORE_NODES_COMMIT = 'fe298e4e20f1ff26d30e8639267bbd0b57811390';
13
+ /**
14
+ * Node classes built into ComfyUI at {@link COMFY_CORE_NODES_COMMIT}, sorted.
15
+ * A graph using only these (plus the frontend-only set) needs no custom-node pack.
16
+ */
17
+ export const COMFY_CORE_NODE_CLASSES = [
18
+ "APG",
19
+ "ARVideoI2V",
20
+ "AddLayer",
21
+ "AddNoise",
22
+ "AddTextPrefix",
23
+ "AddTextSuffix",
24
+ "AdjustBrightness",
25
+ "AdjustContrast",
26
+ "AlignYourStepsScheduler",
27
+ "AnimaLLLiteApply",
28
+ "ApplyTextureToMesh",
29
+ "AudioAdjustVolume",
30
+ "AudioConcat",
31
+ "AudioEncoderEncode",
32
+ "AudioEncoderLoader",
33
+ "AudioEqualizer3Band",
34
+ "AudioMerge",
35
+ "BakeAmbientOcclusion",
36
+ "BakeNormalMapFromMesh",
37
+ "BakeTextureFromVoxel",
38
+ "BasicGuider",
39
+ "BasicScheduler",
40
+ "BatchImagesNode",
41
+ "BatchLatentsNode",
42
+ "BatchMasksNode",
43
+ "BerniniConditioning",
44
+ "BetaSamplingScheduler",
45
+ "BlockSparseAttention",
46
+ "BranchNode",
47
+ "BuildJsonPromptIdeogram",
48
+ "BuildPoseFile",
49
+ "CFGGuider",
50
+ "CFGNorm",
51
+ "CFGOverride",
52
+ "CFGZeroStar",
53
+ "CLIPAttentionMultiply",
54
+ "CLIPLoader",
55
+ "CLIPMergeAdd",
56
+ "CLIPMergeSimple",
57
+ "CLIPMergeSubtract",
58
+ "CLIPSave",
59
+ "CLIPSetLastLayer",
60
+ "CLIPTextEncode",
61
+ "CLIPTextEncodeControlnet",
62
+ "CLIPTextEncodeFlux",
63
+ "CLIPTextEncodeHiDream",
64
+ "CLIPTextEncodeHunyuanDiT",
65
+ "CLIPTextEncodeKandinsky5",
66
+ "CLIPTextEncodeLumina2",
67
+ "CLIPTextEncodePixArtAlpha",
68
+ "CLIPTextEncodeSD3",
69
+ "CLIPTextEncodeSDXL",
70
+ "CLIPTextEncodeSDXLRefiner",
71
+ "CLIPVisionEncode",
72
+ "CLIPVisionLoader",
73
+ "CameraAngle",
74
+ "Canny",
75
+ "CaseConverter",
76
+ "CenterCropImages",
77
+ "CheckpointLoader",
78
+ "CheckpointLoaderSimple",
79
+ "CheckpointSave",
80
+ "ChromaRadianceOptions",
81
+ "ColorToRGBInt",
82
+ "ColorTransfer",
83
+ "CombineHooks2",
84
+ "CombineHooks4",
85
+ "CombineHooks8",
86
+ "ComfyAndNode",
87
+ "ComfyMathExpression",
88
+ "ComfyNotNode",
89
+ "ComfyNumberConvert",
90
+ "ComfyOrNode",
91
+ "ComfySwitchNode",
92
+ "ConcatenateVideo",
93
+ "ConditioningAverage",
94
+ "ConditioningCombine",
95
+ "ConditioningConcat",
96
+ "ConditioningLoader",
97
+ "ConditioningMultiply",
98
+ "ConditioningSetArea",
99
+ "ConditioningSetAreaPercentage",
100
+ "ConditioningSetAreaPercentageVideo",
101
+ "ConditioningSetAreaStrength",
102
+ "ConditioningSetDefaultCombine",
103
+ "ConditioningSetMask",
104
+ "ConditioningSetProperties",
105
+ "ConditioningSetPropertiesAndCombine",
106
+ "ConditioningSetTimestepRange",
107
+ "ConditioningStableAudio",
108
+ "ConditioningTimestepsRange",
109
+ "ConditioningZeroOut",
110
+ "ContextWindowsManual",
111
+ "ControlNetApply",
112
+ "ControlNetApplyAdvanced",
113
+ "ControlNetApplySD3",
114
+ "ControlNetInpaintingAliMamaApply",
115
+ "ControlNetLoader",
116
+ "ConvertArrayToString",
117
+ "ConvertDictionaryToString",
118
+ "CosmosImageToVideoLatent",
119
+ "CosmosPredict2ImageToVideoLatent",
120
+ "CreateBoundingBoxes",
121
+ "CreateCameraInfo",
122
+ "CreateHookKeyframe",
123
+ "CreateHookKeyframesFromFloats",
124
+ "CreateHookKeyframesInterpolated",
125
+ "CreateHookLora",
126
+ "CreateHookLoraModelOnly",
127
+ "CreateHookModelAsLora",
128
+ "CreateHookModelAsLoraModelOnly",
129
+ "CreateList",
130
+ "CreateVideo",
131
+ "CropByBBoxes",
132
+ "CropMask",
133
+ "CurveEditor",
134
+ "CustomCombo",
135
+ "DA3GeometryToMesh",
136
+ "DA3Inference",
137
+ "DA3Render",
138
+ "DecimateMesh",
139
+ "DiffControlNetLoader",
140
+ "DifferentialDiffusion",
141
+ "DiffusersLoader",
142
+ "DisableNoise",
143
+ "DrawBBoxes",
144
+ "DualCFGGuider",
145
+ "DualCLIPLoader",
146
+ "DualModelGuider",
147
+ "EasyCache",
148
+ "EmptyARVideoLatent",
149
+ "EmptyAceStep1.5LatentAudio",
150
+ "EmptyAceStepLatentAudio",
151
+ "EmptyAudio",
152
+ "EmptyChromaRadianceLatentImage",
153
+ "EmptyCosmosLatentVideo",
154
+ "EmptyFlux2LatentImage",
155
+ "EmptyHiDreamO1LatentImage",
156
+ "EmptyHunyuanImageLatent",
157
+ "EmptyHunyuanLatentVideo",
158
+ "EmptyHunyuanVideo15Latent",
159
+ "EmptyImage",
160
+ "EmptyLTXVLatentVideo",
161
+ "EmptyLatentAudio",
162
+ "EmptyLatentHunyuan3Dv2",
163
+ "EmptyLatentImage",
164
+ "EmptyMiniMaxH3LatentAV",
165
+ "EmptyMiniMaxMusic3LatentAudio",
166
+ "EmptyMochiLatentVideo",
167
+ "EmptyQwenImageLayeredLatentImage",
168
+ "EmptySD3LatentImage",
169
+ "EmptyTrellis2LatentStructure",
170
+ "EmptyYuE2LatentAudio",
171
+ "EndLoop",
172
+ "Epsilon Scaling",
173
+ "ExponentialScheduler",
174
+ "ExtendIntermediateSigmas",
175
+ "FeatherMask",
176
+ "File3DToSplat",
177
+ "FillHoles",
178
+ "FlipSigmas",
179
+ "Flux2Scheduler",
180
+ "Flux3LayoutPrompt",
181
+ "FluxDisableGuidance",
182
+ "FluxGuidance",
183
+ "FluxKVCache",
184
+ "FluxKontextImageScale",
185
+ "FluxKontextMultiReferenceLatentMethod",
186
+ "FrameInterpolate",
187
+ "FrameInterpolationModelLoader",
188
+ "FreSca",
189
+ "FreeU",
190
+ "FreeU_V2",
191
+ "GITSScheduler",
192
+ "GLIGENLoader",
193
+ "GLIGENTextBoxApply",
194
+ "GLSLShader",
195
+ "GenerateTracks",
196
+ "Get3DComponents",
197
+ "GetAudioLatentSize",
198
+ "GetICLoRAParameters",
199
+ "GetImageSize",
200
+ "GetItemFromList",
201
+ "GetLatentSize",
202
+ "GetMeshInfo",
203
+ "GetSplatCount",
204
+ "GetVideoComponents",
205
+ "GrowMask",
206
+ "HiDreamO1PatchSeamSmoothing",
207
+ "HiDreamO1ReferenceImages",
208
+ "Hunyuan3Dv2Conditioning",
209
+ "Hunyuan3Dv2ConditioningMultiView",
210
+ "HunyuanImageToVideo",
211
+ "HunyuanRefinerLatent",
212
+ "HunyuanVideo15ImageToVideo",
213
+ "HunyuanVideo15LatentUpscaleWithModel",
214
+ "HunyuanVideo15SuperResolution",
215
+ "HyperTile",
216
+ "HypernetworkLoader",
217
+ "Ideogram4Scheduler",
218
+ "ImageAddNoise",
219
+ "ImageBatch",
220
+ "ImageBlend",
221
+ "ImageBlur",
222
+ "ImageColorSpace",
223
+ "ImageColorToMask",
224
+ "ImageCompare",
225
+ "ImageCompositeMasked",
226
+ "ImageCompositor",
227
+ "ImageCrop",
228
+ "ImageCropToMask",
229
+ "ImageCropV2",
230
+ "ImageDeduplication",
231
+ "ImageFlip",
232
+ "ImageFromBatch",
233
+ "ImageGrid",
234
+ "ImageHistogram",
235
+ "ImageInvert",
236
+ "ImageMergeTileList",
237
+ "ImageOnlyCheckpointLoader",
238
+ "ImageOnlyCheckpointSave",
239
+ "ImagePadForOutpaint",
240
+ "ImageQuantize",
241
+ "ImageRGBToYUV",
242
+ "ImageRotate",
243
+ "ImageSDRToHDR",
244
+ "ImageScale",
245
+ "ImageScaleBy",
246
+ "ImageScaleToMaxDimension",
247
+ "ImageScaleToTotalPixels",
248
+ "ImageSharpen",
249
+ "ImageStitch",
250
+ "ImageToMask",
251
+ "ImageUpscaleWithModel",
252
+ "ImageYUVToRGB",
253
+ "InpaintModelConditioning",
254
+ "InstructPixToPixConditioning",
255
+ "InvertMask",
256
+ "JoinAudioChannels",
257
+ "JoinImageWithAlpha",
258
+ "JsonExtractString",
259
+ "KSampler",
260
+ "KSamplerAdvanced",
261
+ "KSamplerSelect",
262
+ "Kandinsky5ImageToVideo",
263
+ "KarrasScheduler",
264
+ "LTXAVTextEncoderLoader",
265
+ "LTXVAddGeneratedKeyframes",
266
+ "LTXVAddGuide",
267
+ "LTXVAddLatentGuide",
268
+ "LTXVAudioVAEDecode",
269
+ "LTXVAudioVAEEncode",
270
+ "LTXVAudioVAELoader",
271
+ "LTXVConcatAVLatent",
272
+ "LTXVConditioning",
273
+ "LTXVContextWindows",
274
+ "LTXVCropGuides",
275
+ "LTXVDualCFGGuider",
276
+ "LTXVDurationPredictor",
277
+ "LTXVEmptyLatentAudio",
278
+ "LTXVFreezeLatent",
279
+ "LTXVGeneratedKeyframesToGuides",
280
+ "LTXVImgToVideo",
281
+ "LTXVImgToVideoInplace",
282
+ "LTXVLatentUpsampler",
283
+ "LTXVModalityGuidance",
284
+ "LTXVPreprocess",
285
+ "LTXVReferenceAudio",
286
+ "LTXVScheduler",
287
+ "LTXVSeparateAVLatent",
288
+ "LTXVSeparateGeneratedKeyframes",
289
+ "LTXVSpatioTemporalGuidance",
290
+ "LaplaceScheduler",
291
+ "LatentAdd",
292
+ "LatentApplyOperation",
293
+ "LatentApplyOperationCFG",
294
+ "LatentBatch",
295
+ "LatentBatchSeedBehavior",
296
+ "LatentBlend",
297
+ "LatentComposite",
298
+ "LatentCompositeMasked",
299
+ "LatentConcat",
300
+ "LatentCrop",
301
+ "LatentCut",
302
+ "LatentCutToBatch",
303
+ "LatentFlip",
304
+ "LatentFromBatch",
305
+ "LatentInterpolate",
306
+ "LatentMultiply",
307
+ "LatentOperationBlend",
308
+ "LatentOperationSharpen",
309
+ "LatentOperationTonemapReinhard",
310
+ "LatentRotate",
311
+ "LatentSubtract",
312
+ "LatentUpscale",
313
+ "LatentUpscaleBy",
314
+ "LatentUpscaleModelLoader",
315
+ "LayersFromBoundingBoxes",
316
+ "LazyCache",
317
+ "Load3D",
318
+ "Load3DAdvanced",
319
+ "LoadAudio",
320
+ "LoadBackgroundRemovalModel",
321
+ "LoadDA3Model",
322
+ "LoadImage",
323
+ "LoadImageDataSetFromFolder",
324
+ "LoadImageMask",
325
+ "LoadImageOutput",
326
+ "LoadImageTextDataSetFromFolder",
327
+ "LoadLatent",
328
+ "LoadLoraModel",
329
+ "LoadLoraTextEncoder",
330
+ "LoadMediaPipeFaceLandmarker",
331
+ "LoadMoGeModel",
332
+ "LoadTrainingDataset",
333
+ "LoadVideo",
334
+ "LoadVideoDataSetFromFolder",
335
+ "LoadVideoTextDataSetFromFolder",
336
+ "LoopIteration",
337
+ "LoopProgress",
338
+ "LoopResult",
339
+ "LoraLoader",
340
+ "LoraLoaderBypass",
341
+ "LoraLoaderBypassModelOnly",
342
+ "LoraLoaderModelOnly",
343
+ "LoraModelLoader",
344
+ "LoraSave",
345
+ "LossGraphNode",
346
+ "LotusConditioning",
347
+ "MOSSImageControl",
348
+ "MOSSImageLayoutPrompt",
349
+ "Mahiro",
350
+ "MakeTrainingDataset",
351
+ "ManualSigmas",
352
+ "MarigoldV2PostProcess",
353
+ "MaskComposite",
354
+ "MaskPreview",
355
+ "MaskToImage",
356
+ "MediaPipeFaceLandmarker",
357
+ "MediaPipeFaceMask",
358
+ "MediaPipeFaceMeshVisualize",
359
+ "MergeImageLists",
360
+ "MergeMeshes",
361
+ "MergeSplat",
362
+ "MergeTextLists",
363
+ "MeshSmoothNormals",
364
+ "MeshTextureToImage",
365
+ "MeshToFile3D",
366
+ "MiniMaxH3AddGuide",
367
+ "MiniMaxH3FunControlNetApply",
368
+ "MiniMaxH3ImageToVideo",
369
+ "MiniMaxH3ReferenceToVideo",
370
+ "MiniMaxH3SigmaShift",
371
+ "MiniMaxMusic3TextEncode",
372
+ "MoGeGeometryToFOV",
373
+ "MoGeInference",
374
+ "MoGePanoramaInference",
375
+ "MoGePointMapToMesh",
376
+ "MoGeRender",
377
+ "ModelAttentionBackend",
378
+ "ModelComputeDtype",
379
+ "ModelMergeAdd",
380
+ "ModelMergeAuraflow",
381
+ "ModelMergeBlocks",
382
+ "ModelMergeCosmos14B",
383
+ "ModelMergeCosmos7B",
384
+ "ModelMergeCosmosPredict2_14B",
385
+ "ModelMergeCosmosPredict2_2B",
386
+ "ModelMergeFlux1",
387
+ "ModelMergeKrea2",
388
+ "ModelMergeLTXV",
389
+ "ModelMergeMOSSImage",
390
+ "ModelMergeMochiPreview",
391
+ "ModelMergeQwenImage",
392
+ "ModelMergeSD1",
393
+ "ModelMergeSD2",
394
+ "ModelMergeSD35_Large",
395
+ "ModelMergeSD3_2B",
396
+ "ModelMergeSDXL",
397
+ "ModelMergeSimple",
398
+ "ModelMergeSubtract",
399
+ "ModelMergeWAN2_1",
400
+ "ModelNoiseScale",
401
+ "ModelPatchLoader",
402
+ "ModelSamplingAuraFlow",
403
+ "ModelSamplingContinuousEDM",
404
+ "ModelSamplingContinuousV",
405
+ "ModelSamplingDiscrete",
406
+ "ModelSamplingFlux",
407
+ "ModelSamplingLTXV",
408
+ "ModelSamplingSD3",
409
+ "ModelSamplingStableCascade",
410
+ "ModelSave",
411
+ "Morphology",
412
+ "MultiGPU_WorkUnits",
413
+ "NAGuidance",
414
+ "NormalizeImages",
415
+ "NormalizeVideoLatentStart",
416
+ "OpticalFlowLoader",
417
+ "OptimalStepsScheduler",
418
+ "PadImageNode",
419
+ "PaintMesh",
420
+ "Painter",
421
+ "PairConditioningCombine",
422
+ "PairConditioningSetDefaultCombine",
423
+ "PairConditioningSetProperties",
424
+ "PairConditioningSetPropertiesAndCombine",
425
+ "PatchModelAddDownscale",
426
+ "PerpNeg",
427
+ "PerpNegGuider",
428
+ "PerturbedAttentionGuidance",
429
+ "PhotoMakerEncode",
430
+ "PhotoMakerLoader",
431
+ "PiDConditioning",
432
+ "Pixal3DConditioning",
433
+ "Pixal3DMultiViewConditioning",
434
+ "PolyexponentialScheduler",
435
+ "PorterDuffImageComposite",
436
+ "Preview3D",
437
+ "Preview3DAdvanced",
438
+ "PreviewAny",
439
+ "PreviewAudio",
440
+ "PreviewGaussianSplat",
441
+ "PreviewImage",
442
+ "PreviewPointCloud",
443
+ "PrimitiveBoolean",
444
+ "PrimitiveBoundingBox",
445
+ "PrimitiveFloat",
446
+ "PrimitiveInt",
447
+ "PrimitiveString",
448
+ "PrimitiveStringMultiline",
449
+ "QuadrupleCLIPLoader",
450
+ "QwenImage21Cache",
451
+ "QwenImageDiffsynthControlnet",
452
+ "RTDETR_detect",
453
+ "RandomCropImages",
454
+ "RandomNoise",
455
+ "RebatchImages",
456
+ "RebatchLatents",
457
+ "RecordAudio",
458
+ "ReferenceLatent",
459
+ "ReferenceMultiLatent",
460
+ "ReferenceTimbreAudio",
461
+ "RegexExtract",
462
+ "RegexMatch",
463
+ "RegexReplace",
464
+ "RemeshMesh",
465
+ "RemoveBackground",
466
+ "RenderMesh",
467
+ "RenderSplat",
468
+ "RenderUVAtlas",
469
+ "RenormCFG",
470
+ "RepeatImageBatch",
471
+ "RepeatLatentBatch",
472
+ "ReplaceText",
473
+ "ReplaceVideoLatentFrames",
474
+ "RescaleCFG",
475
+ "ResizeAndPadImage",
476
+ "ResizeImageMaskNode",
477
+ "ResizeImagesByLongerEdge",
478
+ "ResizeImagesByShorterEdge",
479
+ "ResolutionBucket",
480
+ "ResolutionSelector",
481
+ "RotateMesh",
482
+ "SAM3DBody_FaceExpression",
483
+ "SAM3DBody_Loader",
484
+ "SAM3DBody_Predict",
485
+ "SAM3DBody_Render",
486
+ "SAM3DBody_Smooth",
487
+ "SAM3_Detect",
488
+ "SAM3_TrackPreview",
489
+ "SAM3_TrackToMask",
490
+ "SAM3_VideoTrack",
491
+ "SCAIL2ColoredMask",
492
+ "SDPoseDrawKeypoints",
493
+ "SDPoseFaceBBoxes",
494
+ "SDPoseKeypointExtractor",
495
+ "SDTurboScheduler",
496
+ "SD_4XUpscale_Conditioning",
497
+ "SUPIRApply",
498
+ "SV3D_Conditioning",
499
+ "SVD_img2vid_Conditioning",
500
+ "SamplerARVideo",
501
+ "SamplerCustom",
502
+ "SamplerCustomAdvanced",
503
+ "SamplerDPMAdaptative",
504
+ "SamplerDPMPP_2M_SDE",
505
+ "SamplerDPMPP_2S_Ancestral",
506
+ "SamplerDPMPP_3M_SDE",
507
+ "SamplerDPMPP_SDE",
508
+ "SamplerER_SDE",
509
+ "SamplerEulerAncestral",
510
+ "SamplerEulerAncestralCFGPP",
511
+ "SamplerEulerCFGpp",
512
+ "SamplerLCM",
513
+ "SamplerLCMUpscale",
514
+ "SamplerLMS",
515
+ "SamplerSASolver",
516
+ "SamplerSEEDS2",
517
+ "SamplingPercentToSigma",
518
+ "Save3DAdvanced",
519
+ "SaveAnimatedPNG",
520
+ "SaveAnimatedWEBP",
521
+ "SaveAudio",
522
+ "SaveAudioAdvanced",
523
+ "SaveAudioMP3",
524
+ "SaveAudioOpus",
525
+ "SaveConditioning",
526
+ "SaveGLB",
527
+ "SaveGaussianSplat",
528
+ "SaveImage",
529
+ "SaveImageAdvanced",
530
+ "SaveImageDataSetToFolder",
531
+ "SaveImageTextDataSetToFolder",
532
+ "SaveLatent",
533
+ "SaveLoRA",
534
+ "SavePointCloud",
535
+ "SaveSVGNode",
536
+ "SaveText",
537
+ "SaveTrainingDataset",
538
+ "SaveVideo",
539
+ "SaveWEBM",
540
+ "ScaleROPE",
541
+ "SeedNode",
542
+ "SeedVR2Conditioning",
543
+ "SeedVR2PostProcessing",
544
+ "SeedVR2Preprocess",
545
+ "SeedVR2TemporalChunk",
546
+ "SeedVR2TemporalMerge",
547
+ "SelectCLIPDevice",
548
+ "SelectModelDevice",
549
+ "SelectVAEDevice",
550
+ "SelfAttentionGuidance",
551
+ "SenseNovaSamplingOptions",
552
+ "SetClipHooks",
553
+ "SetFirstSigma",
554
+ "SetHookKeyframes",
555
+ "SetLatentNoiseMask",
556
+ "SetUnionControlNetType",
557
+ "SheetSage2AudioToABC",
558
+ "ShuffleDataset",
559
+ "ShuffleImageTextDataset",
560
+ "ShuffleVideoDataset",
561
+ "ShuffleVideoTextDataset",
562
+ "SkipLayerGuidanceDiT",
563
+ "SkipLayerGuidanceDiTSimple",
564
+ "SkipLayerGuidanceSD3",
565
+ "SolidMask",
566
+ "SplatToFile3D",
567
+ "SplatToMesh",
568
+ "SplitAudioChannels",
569
+ "SplitImageToTileList",
570
+ "SplitImageWithAlpha",
571
+ "SplitSigmas",
572
+ "SplitSigmasDenoise",
573
+ "StableCascade_EmptyLatentImage",
574
+ "StableCascade_StageB_Conditioning",
575
+ "StableCascade_StageC_VAEEncode",
576
+ "StableCascade_SuperResolutionControlnet",
577
+ "StableZero123_Conditioning",
578
+ "StableZero123_Conditioning_Batched",
579
+ "StartLoop",
580
+ "StringCompare",
581
+ "StringConcatenate",
582
+ "StringContains",
583
+ "StringFormat",
584
+ "StringLength",
585
+ "StringReplace",
586
+ "StringSubstring",
587
+ "StringTrim",
588
+ "StripWhitespace",
589
+ "StyleModelApply",
590
+ "StyleModelLoader",
591
+ "T5TokenizerOptions",
592
+ "TCFG",
593
+ "TemporalScoreRescaling",
594
+ "TextEncodeAceStepAudio",
595
+ "TextEncodeAceStepAudio1.5",
596
+ "TextEncodeBooguEdit",
597
+ "TextEncodeFibo2",
598
+ "TextEncodeHunyuanVideo_ImageToVideo",
599
+ "TextEncodeJoyImageEdit",
600
+ "TextEncodeMOSSImageEdit",
601
+ "TextEncodeMageFlowEdit",
602
+ "TextEncodeMingImageEdit",
603
+ "TextEncodeQwenImage21",
604
+ "TextEncodeQwenImageEdit",
605
+ "TextEncodeQwenImageEditPlus",
606
+ "TextEncodeZImageOmni",
607
+ "TextGenerate",
608
+ "TextGenerateLTX2Prompt",
609
+ "TextOverlay",
610
+ "TextToLowercase",
611
+ "TextToUppercase",
612
+ "ThresholdMask",
613
+ "TomePatchModel",
614
+ "TorchCompileModel",
615
+ "TrainLoraNode",
616
+ "TransformSplat",
617
+ "Trellis2Conditioning",
618
+ "Trellis2ShapeStage",
619
+ "Trellis2TextureStage",
620
+ "Trellis2UpsampleStage",
621
+ "TrimAudioDuration",
622
+ "TrimVideoLatent",
623
+ "TripleCLIPLoader",
624
+ "TripoSplatConditioning",
625
+ "TripoSplatPreprocessImage",
626
+ "TripoSplatSamplingPreview",
627
+ "TruncateText",
628
+ "UNETLoader",
629
+ "UNetCrossAttentionMultiply",
630
+ "UNetSelfAttentionMultiply",
631
+ "UNetTemporalAttentionMultiply",
632
+ "USOStyleReference",
633
+ "UnwrapMesh",
634
+ "UpscaleModelLoader",
635
+ "VAEDecode",
636
+ "VAEDecodeAudio",
637
+ "VAEDecodeAudioTiled",
638
+ "VAEDecodeHunyuan3D",
639
+ "VAEDecodeTiled",
640
+ "VAEDecodeTripoSplat",
641
+ "VAEEncode",
642
+ "VAEEncodeAudio",
643
+ "VAEEncodeForInpaint",
644
+ "VAEEncodeTiled",
645
+ "VAELoader",
646
+ "VAESave",
647
+ "VOIDInpaintConditioning",
648
+ "VOIDQuadmaskPreprocess",
649
+ "VOIDSampler",
650
+ "VOIDWarpedNoise",
651
+ "VOIDWarpedNoiseSource",
652
+ "VPScheduler",
653
+ "VaeDecodeShapeTrellis",
654
+ "VaeDecodeStructureTrellis2",
655
+ "VaeDecodeTextureTrellis",
656
+ "Video Slice",
657
+ "VideoCrop",
658
+ "VideoFrameSample",
659
+ "VideoLinearCFGGuidance",
660
+ "VideoRandomTemporalCrop",
661
+ "VideoTemporalCrop",
662
+ "VideoTriangleCFGGuidance",
663
+ "VideoTrim",
664
+ "VoxelToMesh",
665
+ "VoxelToMeshBasic",
666
+ "Wan22FunControlToVideo",
667
+ "Wan22ImageToVideoLatent",
668
+ "WanAnimate2Cache",
669
+ "WanAnimate2ToVideo",
670
+ "WanAnimateToVideo",
671
+ "WanCameraEmbedding",
672
+ "WanCameraImageToVideo",
673
+ "WanContextWindowsManual",
674
+ "WanDancerEncodeAudio",
675
+ "WanDancerPadKeyframes",
676
+ "WanDancerPadKeyframesList",
677
+ "WanDancerVideo",
678
+ "WanFirstLastFrameToVideo",
679
+ "WanFunControlToVideo",
680
+ "WanFunInpaintToVideo",
681
+ "WanHuMoImageToVideo",
682
+ "WanImageToVideo",
683
+ "WanInfiniteTalkToVideo",
684
+ "WanMoveConcatTrack",
685
+ "WanMoveTrackToVideo",
686
+ "WanMoveTracksFromCoords",
687
+ "WanMoveVisualizeTracks",
688
+ "WanPhantomSubjectToVideo",
689
+ "WanSCAILToVideo",
690
+ "WanSoundImageToVideo",
691
+ "WanSoundImageToVideoExtend",
692
+ "WanTrackToVideo",
693
+ "WanUni3CControlnetApply",
694
+ "WanVaceToVideo",
695
+ "WebcamCapture",
696
+ "WeldVertices",
697
+ "YuE2GenerateABC",
698
+ "YuE2GenerateMusic",
699
+ "ZImageFunControlnet",
700
+ "unCLIPCheckpointLoader",
701
+ "unCLIPConditioning",
702
+ "wanBlockSwap",
703
+ ];
704
+ /** ComfyUI's `folder_paths.supported_pt_extensions` at {@link COMFY_CORE_NODES_COMMIT}, lowercase, sorted. */
705
+ export const COMFY_MODEL_FILE_EXTENSIONS = [".bin", ".ckpt", ".pkl", ".pt", ".pt2", ".pth", ".safetensors", ".sft"];
706
+ //# sourceMappingURL=comfyCoreNodes.generated.js.map
@@ -0,0 +1,89 @@
1
+ import { type BlockResourceFileEntry, type BlockResourceFileEntryFormat } from './types.js';
2
+ /**
3
+ * Node classes that exist only in the ComfyUI editor and are dropped when a
4
+ * graph is exported to API format. Allowed in a UI graph's node list; an
5
+ * API-format graph never contains them, and a `class_type` naming one is not a
6
+ * class the ComfyUI server can run, so in an API graph it counts as custom.
7
+ */
8
+ export declare const COMFY_FRONTEND_ONLY_NODE_CLASSES: readonly string[];
9
+ /** A loader input that holds a model filename where the worker needs an AIR. */
10
+ export interface ComfyModelFilenameInput {
11
+ /** The node's key in the API graph. */
12
+ nodeId: string;
13
+ classType: string;
14
+ /** The input name, e.g. `'ckpt_name'`. */
15
+ input: string;
16
+ /** The filename it holds, e.g. `'sd_xl_base_1.0.safetensors'`. */
17
+ value: string;
18
+ }
19
+ /**
20
+ * Why a graph cannot run inline. A CLOSED set: switch on `code`.
21
+ *
22
+ * - `not-api-format` — the entry is a UI (editor) graph or an unknown JSON, not
23
+ * ComfyUI's API format. Only API format can be submitted, and the SDK does
24
+ * not convert. When this fires, `model-filenames`, `too-many-nodes` and
25
+ * `too-large` are not checked (they are defined on the API graph).
26
+ * - `custom-nodes` — node classes outside the core list pinned in
27
+ * `comfyCoreNodes.generated.ts`, sorted and de-duplicated. `packs` lists the
28
+ * `properties.cnr_id` pack ids those nodes carry, when the file has them
29
+ * (UI graphs do; API graphs carry none, so `packs` is empty there). Checked
30
+ * on API and UI graphs. Custom node packs are disabled on the inline path.
31
+ * - `model-filenames` — loader inputs that hold a model filename (ending in a
32
+ * model-file extension) instead of an AIR (`urn:air:…`). The worker
33
+ * downloads only declared AIRs, so a filename cannot load.
34
+ * - `too-many-nodes` — more than {@link BLOCK_INLINE_COMFY_MAX_NODES} nodes.
35
+ * - `too-large` — the graph as it would be sent (each node reduced to
36
+ * `class_type` + `inputs`) is longer than
37
+ * {@link BLOCK_INLINE_COMFY_MAX_GRAPH_BYTES} when serialized.
38
+ */
39
+ export type ComfyGraphRefusal = {
40
+ code: 'not-api-format';
41
+ format: BlockResourceFileEntryFormat;
42
+ } | {
43
+ code: 'custom-nodes';
44
+ classes: string[];
45
+ packs: string[];
46
+ } | {
47
+ code: 'model-filenames';
48
+ inputs: ComfyModelFilenameInput[];
49
+ } | {
50
+ code: 'too-many-nodes';
51
+ nodes: number;
52
+ max: number;
53
+ } | {
54
+ code: 'too-large';
55
+ bytes: number;
56
+ max: number;
57
+ };
58
+ /**
59
+ * The verdict of {@link checkComfyGraph}. `reasons` is never empty and is in
60
+ * the order the codes are listed on {@link ComfyGraphRefusal}.
61
+ *
62
+ * Runnable or not, a Comfy estimate is a ceiling (your `maxBuzz`), never a price.
63
+ */
64
+ export type ComfyGraphCheck = {
65
+ runnable: true;
66
+ } | {
67
+ runnable: false;
68
+ reasons: ComfyGraphRefusal[];
69
+ };
70
+ /**
71
+ * Check whether a parsed workflow file entry (what `useResourceFile` returns per
72
+ * entry) can run as an inline `customComfy` graph, before any spend.
73
+ *
74
+ * Pure and synchronous: it reads `format` and `graph` and nothing else, and
75
+ * never mutates them. `runnable: true` means no known blocker was found, not
76
+ * that the job will succeed. A Comfy estimate is a ceiling, never a price.
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * const check = checkComfyGraph(entry);
81
+ * if (!check.runnable) {
82
+ * for (const reason of check.reasons) {
83
+ * if (reason.code === 'custom-nodes') console.warn('needs packs', reason.packs);
84
+ * }
85
+ * }
86
+ * ```
87
+ */
88
+ export declare function checkComfyGraph(entry: Pick<BlockResourceFileEntry, 'format' | 'graph'>): ComfyGraphCheck;
89
+ //# sourceMappingURL=comfyGraph.d.ts.map
@@ -0,0 +1,182 @@
1
+ /**
2
+ * `checkComfyGraph` — can this workflow file run as an inline `customComfy`
3
+ * graph? A pure, offline check an app runs on a {@link BlockResourceFileEntry}
4
+ * before it offers "Run", so a graph that is certain to fail is refused before
5
+ * any Buzz is spent rather than after.
6
+ *
7
+ * It answers from the file alone. `runnable: true` means none of the known
8
+ * blockers below is present — not that the job will succeed: the worker image
9
+ * still decides which nodes exist, and the host still runs its own gates (AIR
10
+ * containment, entitlement, moderation) on the body you submit. The core-node
11
+ * list is pinned to a ComfyUI commit, not to the worker's ComfyUI version, so it
12
+ * can name classes newer than the worker has.
13
+ *
14
+ * 🔴 A Comfy estimate is a CEILING, never a price. `estimate` on a
15
+ * `customComfy` body returns the `maxBuzz` you declared as `cost.total`, and
16
+ * billing settles to the real GPU time afterwards. Show it as "up to N Buzz".
17
+ */
18
+ import { COMFY_CORE_NODE_CLASSES, COMFY_MODEL_FILE_EXTENSIONS, } from './comfyCoreNodes.generated.js';
19
+ import { BLOCK_INLINE_COMFY_MAX_GRAPH_BYTES, BLOCK_INLINE_COMFY_MAX_NODES, } from './types.js';
20
+ /**
21
+ * Node classes that exist only in the ComfyUI editor and are dropped when a
22
+ * graph is exported to API format. Allowed in a UI graph's node list; an
23
+ * API-format graph never contains them, and a `class_type` naming one is not a
24
+ * class the ComfyUI server can run, so in an API graph it counts as custom.
25
+ */
26
+ export const COMFY_FRONTEND_ONLY_NODE_CLASSES = [
27
+ 'MarkdownNote',
28
+ 'Note',
29
+ 'PrimitiveNode',
30
+ 'Reroute',
31
+ ];
32
+ /** The pack id ComfyUI writes into `properties.cnr_id` for its own nodes. */
33
+ const CORE_PACK_ID = 'comfy-core';
34
+ /**
35
+ * Model-file extensions: ComfyUI's own list at the pinned commit, plus `.gguf`
36
+ * (quantised weights, loaded by the GGUF loader packs).
37
+ */
38
+ const MODEL_FILE_EXTENSIONS = [...COMFY_MODEL_FILE_EXTENSIONS, '.gguf'];
39
+ /**
40
+ * An input that names a model: `*_name` with an optional number (`ckpt_name`,
41
+ * `unet_name`, `lora_name`, `vae_name`, `clip_name`, `clip_name2`,
42
+ * `control_net_name`, `style_model_name`, `model_name`, …), plus the two core
43
+ * loader inputs that do not follow that pattern, plus two whose names are too
44
+ * generic to match on any class and so count only on the class that loads by them.
45
+ */
46
+ const MODEL_INPUT_NAME = /_name\d*$/;
47
+ const MODEL_INPUT_NAMES_EXTRA = ['model_file', 'text_encoder'];
48
+ const MODEL_INPUT_NAMES_BY_CLASS = {
49
+ ModelPatchLoader: ['name'],
50
+ TrainLoraNode: ['existing_lora'],
51
+ };
52
+ const CORE = new Set(COMFY_CORE_NODE_CLASSES);
53
+ const FRONTEND_ONLY = new Set(COMFY_FRONTEND_ONLY_NODE_CLASSES);
54
+ function isObj(v) {
55
+ return typeof v === 'object' && v !== null && !Array.isArray(v);
56
+ }
57
+ /** The host's own API-format test (`detectGraphFormat` in civitai). */
58
+ function isApiGraph(graph) {
59
+ if (!isObj(graph))
60
+ return false;
61
+ const values = Object.values(graph);
62
+ return values.length > 0 && values.every((v) => isObj(v) && 'class_type' in v && 'inputs' in v);
63
+ }
64
+ function isAir(value) {
65
+ return /^urn:air:/i.test(value.trim());
66
+ }
67
+ function isModelFilename(value) {
68
+ if (isAir(value))
69
+ return false;
70
+ const v = value.trim().toLowerCase();
71
+ return MODEL_FILE_EXTENSIONS.some((ext) => v.endsWith(ext));
72
+ }
73
+ function isModelInput(classType, name) {
74
+ return (MODEL_INPUT_NAME.test(name) ||
75
+ MODEL_INPUT_NAMES_EXTRA.includes(name) ||
76
+ (Object.hasOwn(MODEL_INPUT_NAMES_BY_CLASS, classType) &&
77
+ MODEL_INPUT_NAMES_BY_CLASS[classType].includes(name)));
78
+ }
79
+ function customNodes(classes, packs) {
80
+ if (classes.size === 0)
81
+ return null;
82
+ packs.delete(CORE_PACK_ID);
83
+ return { code: 'custom-nodes', classes: [...classes].sort(), packs: [...packs].sort() };
84
+ }
85
+ /** UI graph: the node lists of the graph and of every subgraph definition. */
86
+ function uiCustomNodes(graph) {
87
+ if (!isObj(graph))
88
+ return null;
89
+ const lists = [graph.nodes];
90
+ const subgraphIds = new Set();
91
+ const defs = graph.definitions;
92
+ if (isObj(defs) && Array.isArray(defs.subgraphs)) {
93
+ for (const sg of defs.subgraphs) {
94
+ if (!isObj(sg))
95
+ continue;
96
+ if (typeof sg.id === 'string')
97
+ subgraphIds.add(sg.id);
98
+ lists.push(sg.nodes);
99
+ }
100
+ }
101
+ const classes = new Set();
102
+ const packs = new Set();
103
+ for (const list of lists) {
104
+ if (!Array.isArray(list))
105
+ continue;
106
+ for (const node of list) {
107
+ if (!isObj(node) || typeof node.type !== 'string')
108
+ continue;
109
+ const type = node.type;
110
+ // A subgraph instance's `type` is its definition's id; its nodes are walked above.
111
+ if (CORE.has(type) || FRONTEND_ONLY.has(type) || subgraphIds.has(type))
112
+ continue;
113
+ classes.add(type);
114
+ const props = node.properties;
115
+ if (isObj(props) && typeof props.cnr_id === 'string' && props.cnr_id !== '') {
116
+ packs.add(props.cnr_id);
117
+ }
118
+ }
119
+ }
120
+ return customNodes(classes, packs);
121
+ }
122
+ /**
123
+ * Check whether a parsed workflow file entry (what `useResourceFile` returns per
124
+ * entry) can run as an inline `customComfy` graph, before any spend.
125
+ *
126
+ * Pure and synchronous: it reads `format` and `graph` and nothing else, and
127
+ * never mutates them. `runnable: true` means no known blocker was found, not
128
+ * that the job will succeed. A Comfy estimate is a ceiling, never a price.
129
+ *
130
+ * @example
131
+ * ```ts
132
+ * const check = checkComfyGraph(entry);
133
+ * if (!check.runnable) {
134
+ * for (const reason of check.reasons) {
135
+ * if (reason.code === 'custom-nodes') console.warn('needs packs', reason.packs);
136
+ * }
137
+ * }
138
+ * ```
139
+ */
140
+ export function checkComfyGraph(entry) {
141
+ const { graph } = entry;
142
+ const reasons = [];
143
+ if (entry.format !== 'api' || !isApiGraph(graph)) {
144
+ reasons.push({ code: 'not-api-format', format: entry.format === 'api' ? 'unknown' : entry.format });
145
+ const custom = entry.format === 'ui' ? uiCustomNodes(graph) : null;
146
+ if (custom)
147
+ reasons.push(custom);
148
+ return { runnable: false, reasons };
149
+ }
150
+ const ids = Object.keys(graph);
151
+ const classes = new Set();
152
+ const filenames = [];
153
+ const wire = {};
154
+ for (const nodeId of ids) {
155
+ const node = graph[nodeId];
156
+ wire[nodeId] = { class_type: node.class_type, inputs: node.inputs };
157
+ const classType = typeof node.class_type === 'string' ? node.class_type : String(node.class_type);
158
+ if (!CORE.has(classType))
159
+ classes.add(classType);
160
+ if (!isObj(node.inputs))
161
+ continue;
162
+ for (const [input, value] of Object.entries(node.inputs)) {
163
+ if (typeof value === 'string' && isModelInput(classType, input) && isModelFilename(value)) {
164
+ filenames.push({ nodeId, classType, input, value });
165
+ }
166
+ }
167
+ }
168
+ const custom = customNodes(classes, new Set());
169
+ if (custom)
170
+ reasons.push(custom);
171
+ if (filenames.length > 0)
172
+ reasons.push({ code: 'model-filenames', inputs: filenames });
173
+ if (ids.length > BLOCK_INLINE_COMFY_MAX_NODES) {
174
+ reasons.push({ code: 'too-many-nodes', nodes: ids.length, max: BLOCK_INLINE_COMFY_MAX_NODES });
175
+ }
176
+ const bytes = JSON.stringify(wire).length;
177
+ if (bytes > BLOCK_INLINE_COMFY_MAX_GRAPH_BYTES) {
178
+ reasons.push({ code: 'too-large', bytes, max: BLOCK_INLINE_COMFY_MAX_GRAPH_BYTES });
179
+ }
180
+ return reasons.length === 0 ? { runnable: true } : { runnable: false, reasons };
181
+ }
182
+ //# sourceMappingURL=comfyGraph.js.map
@@ -116,7 +116,19 @@ export { isModelSlotContext, isPageSlotContext } from './types.js';
116
116
  * in `types.ts` for which of the two it uses and why.
117
117
  */
118
118
  export { isSignedIn } from './types.js';
119
- export type { BlockContext, KnownSlotId, ModelSlotId, PageSlotContext, PageSlotId, UnknownSlotContext, BlockAnalyticsDeclaration, BlockAnalyticsEventDeclaration, BlockAnalyticsPropertyDeclaration, BlockManifest, BlockManifestGood, BlockManifestV1, BlockSettings, BlockStorageCollectionDeclaration, BlockStorageDeclaration, BlockStorageIndexes, BlockStorageIndexType, BlockStoragePrivateCollectionDeclaration, BlockStorageSharedCollectionDeclaration, BlockToken, ContentRating, ManifestBooleanField, ManifestIframe, ManifestNumberField, ManifestPage, ManifestPreview, ManifestSettingField, ManifestSettings, ManifestStringField, ManifestTarget, ModelSlotContext, SettingScope, SettingWidget, Theme, ViewerInfo, BlockCheckpointInfo, BlockResourceInfo, BlockResourcePickerType, BlockSourceImage, BlockUploadedImageInfo, BlockGenerationSourceImageInfo, BlockImagePickerSource, BlockPickedImageInfo, BlockMediaKind, BlockMediaUploadInfo, BlockPendingImageInfo, BlockImageScanResult, BlockUploadPurpose, BlockNavigateScope, BlockTextToImageParams, BlockWorkflowSnapshot, BlockEstimateBatchAggregate, BlockModelSubstitution, ModelSubstitutionReason, KnownBlockWorkflowErrorCode, BlockStepToolCall, BlockTrainedEpoch, BlockPublishedModel, BuzzAccountType, ShowcaseImage, WorkflowBody, WorkflowBodyTextToImage, WorkflowBodyCustomComfy, WorkflowBodyCustomComfyRecipe, WorkflowBodyCustomComfyInline, InlineComfyNode, WorkflowBodyStep, WorkflowBodyPassThroughStep, WorkflowBodyWorkflow, WorkflowBodyWorkflowStep, WorkflowStepRef, WithWorkflowStepRefs, BlockWorkflowStepSnapshot, WorkflowStatus, BlockBuzzTransaction, BlockBuzzAccount, BlockDailyCompensationResource, BlockViewer, BlockWildcardPack, BlockWildcardPackErrorCode, AppWorkflow, AppWorkflowImage, BlockGatedImage, BlockCollectionFollowErrorCode, BlockCollectionFollowResult, BlockPostSource, BlockCreatePostRequest, BlockCreatePostResult, BlockCreatePostHostError, WorkflowBodyTraining, AiToolkitTrainingParams, AiToolkitTrainingParamsBase, AiToolkitPlainEcosystem, AiToolkitLrScheduler, AiToolkitOptimizerType, BlockTrainingQuote, BlockTrainingDatasetItem, BlockTrainingDataImage, BlockTrainingDataUploadResult, BlockRunTrainingHostError, BlockStepQuote, BlockModel3dOutput, BlockRunConfirmedStepHostError, } from './types.js';
119
+ export type { BlockContext, KnownSlotId, ModelSlotId, PageSlotContext, PageSlotId, UnknownSlotContext, BlockAnalyticsDeclaration, BlockAnalyticsEventDeclaration, BlockAnalyticsPropertyDeclaration, BlockManifest, BlockManifestGood, BlockManifestV1, BlockSettings, BlockStorageCollectionDeclaration, BlockStorageDeclaration, BlockStorageIndexes, BlockStorageIndexType, BlockStoragePrivateCollectionDeclaration, BlockStorageSharedCollectionDeclaration, BlockToken, ContentRating, ManifestBooleanField, ManifestIframe, ManifestNumberField, ManifestPage, ManifestPreview, ManifestSettingField, ManifestSettings, ManifestStringField, ManifestTarget, ModelSlotContext, SettingScope, SettingWidget, Theme, ViewerInfo, BlockCheckpointInfo, BlockResourceInfo, BlockResourcePickerType, BlockSourceImage, BlockUploadedImageInfo, BlockGenerationSourceImageInfo, BlockImagePickerSource, BlockPickedImageInfo, BlockMediaKind, BlockMediaUploadInfo, BlockPendingImageInfo, BlockImageScanResult, BlockUploadPurpose, BlockNavigateScope, BlockTextToImageParams, BlockWorkflowSnapshot, BlockEstimateBatchAggregate, BlockModelSubstitution, ModelSubstitutionReason, KnownBlockWorkflowErrorCode, BlockStepToolCall, BlockTrainedEpoch, BlockPublishedModel, BuzzAccountType, ShowcaseImage, WorkflowBody, WorkflowBodyTextToImage, WorkflowBodyCustomComfy, WorkflowBodyCustomComfyRecipe, WorkflowBodyCustomComfyInline, InlineComfyNode, WorkflowBodyStep, WorkflowBodyPassThroughStep, WorkflowBodyWorkflow, WorkflowBodyWorkflowStep, WorkflowStepRef, WithWorkflowStepRefs, BlockWorkflowStepSnapshot, WorkflowStatus, BlockBuzzTransaction, BlockBuzzAccount, BlockDailyCompensationResource, BlockViewer, BlockWildcardPack, BlockWildcardPackErrorCode, BlockResourceFile, BlockResourceFileEntry, BlockResourceFileEntryFormat, BlockResourceFileErrorCode, BlockResourceFileMeta, AppWorkflow, AppWorkflowImage, BlockGatedImage, BlockCollectionFollowErrorCode, BlockCollectionFollowResult, BlockPostSource, BlockCreatePostRequest, BlockCreatePostResult, BlockCreatePostHostError, WorkflowBodyTraining, AiToolkitTrainingParams, AiToolkitTrainingParamsBase, AiToolkitPlainEcosystem, AiToolkitLrScheduler, AiToolkitOptimizerType, BlockTrainingQuote, BlockTrainingDatasetItem, BlockTrainingDataImage, BlockTrainingDataUploadResult, BlockRunTrainingHostError, BlockStepQuote, BlockModel3dOutput, BlockRunConfirmedStepHostError, } from './types.js';
120
+ /**
121
+ * Host bounds for an inline `customComfy` graph, mirrored from civitai/civitai —
122
+ * see `WorkflowBodyCustomComfyInline.workflow`.
123
+ */
124
+ export { BLOCK_INLINE_COMFY_MAX_NODES, BLOCK_INLINE_COMFY_MAX_GRAPH_BYTES } from './types.js';
125
+ /**
126
+ * Pre-spend runnability check for a workflow file entry (`useResourceFile`),
127
+ * against a ComfyUI core-node list generated from one pinned ComfyUI commit.
128
+ * A Comfy estimate is a ceiling, never a price.
129
+ */
130
+ export { checkComfyGraph } from './comfyGraph.js';
131
+ export type { ComfyGraphCheck, ComfyGraphRefusal, ComfyModelFilenameInput } from './comfyGraph.js';
120
132
  /** Host bound for the App Blocks `kind: 'workflow'` body — see `WorkflowBodyWorkflow`. */
121
133
  export { BLOCK_WORKFLOW_MAX_STEPS, BLOCK_WORKFLOW_REPEAT_MAX_ITERATIONS } from './types.js';
122
134
  /**
@@ -114,6 +114,17 @@ export { isModelSlotContext, isPageSlotContext } from './types.js';
114
114
  * in `types.ts` for which of the two it uses and why.
115
115
  */
116
116
  export { isSignedIn } from './types.js';
117
+ /**
118
+ * Host bounds for an inline `customComfy` graph, mirrored from civitai/civitai —
119
+ * see `WorkflowBodyCustomComfyInline.workflow`.
120
+ */
121
+ export { BLOCK_INLINE_COMFY_MAX_NODES, BLOCK_INLINE_COMFY_MAX_GRAPH_BYTES } from './types.js';
122
+ /**
123
+ * Pre-spend runnability check for a workflow file entry (`useResourceFile`),
124
+ * against a ComfyUI core-node list generated from one pinned ComfyUI commit.
125
+ * A Comfy estimate is a ceiling, never a price.
126
+ */
127
+ export { checkComfyGraph } from './comfyGraph.js';
117
128
  /** Host bound for the App Blocks `kind: 'workflow'` body — see `WorkflowBodyWorkflow`. */
118
129
  export { BLOCK_WORKFLOW_MAX_STEPS, BLOCK_WORKFLOW_REPEAT_MAX_ITERATIONS } from './types.js';
119
130
  /**
@@ -8,7 +8,7 @@
8
8
  * Wire format: `window.postMessage({ type, payload }, targetOrigin)`.
9
9
  */
10
10
  import type { ColorDomain } from './browsingLevel.js';
11
- import type { BlockCheckpointInfo, BlockResourceInfo, BlockResourcePickerType, BlockUploadedImageInfo, BlockGenerationSourceImageInfo, BlockImagePickerSource, BlockPickedImageInfo, BlockMediaKind, BlockMediaUploadInfo, BlockPendingImageInfo, BlockImageScanResult, BlockUploadPurpose, BlockNavigateScope, BlockContext, BlockSettings, Theme, ViewerInfo, WorkflowBody, BlockWorkflowSnapshot, BlockEstimateBatchAggregate, BlockBuzzTransaction, BlockBuzzAccount, BlockDailyCompensationResource, BlockViewer, BlockWildcardPack, BlockWildcardPackErrorCode, AppWorkflow, BlockGatedImage, BlockCollectionFollowErrorCode, BlockCollectionFollowResult, BlockPostSource, BlockCreatePostResult, BlockTrainingDataUploadResult, WorkflowBodyTraining, WorkflowBodyPassThroughStep } from './types.js';
11
+ import type { BlockCheckpointInfo, BlockResourceInfo, BlockResourcePickerType, BlockUploadedImageInfo, BlockGenerationSourceImageInfo, BlockImagePickerSource, BlockPickedImageInfo, BlockMediaKind, BlockMediaUploadInfo, BlockPendingImageInfo, BlockImageScanResult, BlockUploadPurpose, BlockNavigateScope, BlockContext, BlockSettings, Theme, ViewerInfo, WorkflowBody, BlockWorkflowSnapshot, BlockEstimateBatchAggregate, BlockBuzzTransaction, BlockBuzzAccount, BlockDailyCompensationResource, BlockViewer, BlockWildcardPack, BlockWildcardPackErrorCode, BlockResourceFile, BlockResourceFileErrorCode, AppWorkflow, BlockGatedImage, BlockCollectionFollowErrorCode, BlockCollectionFollowResult, BlockPostSource, BlockCreatePostResult, BlockTrainingDataUploadResult, WorkflowBodyTraining, WorkflowBodyPassThroughStep } from './types.js';
12
12
  import type { BlockAppReaction, BlockEntityReactionErrorCode, BlockEntityReactionResult, BlockEntityReactionsResult, BlockReactionEntityType } from './reactions.js';
13
13
  /**
14
14
  * Filter params for `GET_BUZZ_TRANSACTIONS`. All optional; the host validates
@@ -484,6 +484,13 @@ export type ParentToBlockMessage = {
484
484
  pack?: BlockWildcardPack;
485
485
  error?: BlockWildcardPackErrorCode;
486
486
  };
487
+ } | {
488
+ type: 'RESOURCE_FILE_RESULT';
489
+ payload: {
490
+ requestId: string;
491
+ file?: BlockResourceFile;
492
+ error?: BlockResourceFileErrorCode;
493
+ };
487
494
  } | {
488
495
  type: 'APP_WORKFLOWS_RESULT';
489
496
  payload: {
@@ -854,6 +861,13 @@ export type BlockToParentMessage = {
854
861
  requestId: string;
855
862
  modelVersionId: number;
856
863
  };
864
+ } | {
865
+ type: 'GET_RESOURCE_FILE';
866
+ payload: {
867
+ requestId: string;
868
+ modelVersionId: number;
869
+ fileId?: number;
870
+ };
857
871
  } | {
858
872
  type: 'QUERY_APP_WORKFLOWS';
859
873
  payload: {
@@ -1216,7 +1230,7 @@ export type BlockToParentMessageType = BlockToParentMessage['type'];
1216
1230
  * it is a measurement, not an invariant, and civitai's own compile-time gate
1217
1231
  * (published SDK union ⊆ `keyof INVENTORY`) is what holds one direction of it.
1218
1232
  */
1219
- export declare const BLOCK_TO_PARENT_MESSAGE_TYPES: readonly ["BLOCK_HELLO", "BLOCK_READY", "BLOCK_ERROR", "BLOCK_MESSAGE_REJECTED", "REQUEST_TOKEN", "RESIZE_IFRAME", "SUBMIT_WORKFLOW", "ESTIMATE_WORKFLOW", "ESTIMATE_WORKFLOW_BATCH", "POLL_WORKFLOW", "CANCEL_WORKFLOW", "OPEN_BUZZ_PURCHASE", "GET_BUZZ_BALANCE", "GET_VIEWER", "GET_BUZZ_TRANSACTIONS", "GET_BUZZ_ACCOUNTS", "GET_DAILY_COMPENSATION", "GET_WILDCARD_PACK", "QUERY_APP_WORKFLOWS", "PUBLISH_GENERATION_OUTPUTS", "CREATE_POST_FROM_APP", "RUN_TRAINING", "RUN_CONFIRMED_STEP", "GET_IMAGES_BY_IDS", "CANCEL_APP_WORKFLOW", "OPEN_CHECKPOINT_PICKER", "OPEN_RESOURCE_PICKER", "OPEN_IMAGE_UPLOAD", "OPEN_IMAGE_PICKER", "OPEN_MEDIA_UPLOAD", "SET_USER_CHECKPOINT", "NAVIGATE", "REQUEST_SIGN_IN", "REQUEST_CONSENT", "TRACK_EVENT", "APP_STORAGE_GET", "APP_STORAGE_SET", "APP_STORAGE_DELETE", "APP_STORAGE_LIST", "APP_STORAGE_QUOTA", "SHARED_LIST", "SHARED_GET_COUNT", "SHARED_GET_COUNTS", "SHARED_APPEND", "SHARED_VOTE", "SHARED_UNVOTE", "SHARED_WITHDRAW", "SHARED_UPDATE", "SHARED_GET", "SHARED_REPORT", "SAVE_IMAGE", "SET_COLLECTION_FOLLOW", "SET_ENTITY_REACTION", "GET_ENTITY_REACTIONS"];
1233
+ export declare const BLOCK_TO_PARENT_MESSAGE_TYPES: readonly ["BLOCK_HELLO", "BLOCK_READY", "BLOCK_ERROR", "BLOCK_MESSAGE_REJECTED", "REQUEST_TOKEN", "RESIZE_IFRAME", "SUBMIT_WORKFLOW", "ESTIMATE_WORKFLOW", "ESTIMATE_WORKFLOW_BATCH", "POLL_WORKFLOW", "CANCEL_WORKFLOW", "OPEN_BUZZ_PURCHASE", "GET_BUZZ_BALANCE", "GET_VIEWER", "GET_BUZZ_TRANSACTIONS", "GET_BUZZ_ACCOUNTS", "GET_DAILY_COMPENSATION", "GET_WILDCARD_PACK", "GET_RESOURCE_FILE", "QUERY_APP_WORKFLOWS", "PUBLISH_GENERATION_OUTPUTS", "CREATE_POST_FROM_APP", "RUN_TRAINING", "RUN_CONFIRMED_STEP", "GET_IMAGES_BY_IDS", "CANCEL_APP_WORKFLOW", "OPEN_CHECKPOINT_PICKER", "OPEN_RESOURCE_PICKER", "OPEN_IMAGE_UPLOAD", "OPEN_IMAGE_PICKER", "OPEN_MEDIA_UPLOAD", "SET_USER_CHECKPOINT", "NAVIGATE", "REQUEST_SIGN_IN", "REQUEST_CONSENT", "TRACK_EVENT", "APP_STORAGE_GET", "APP_STORAGE_SET", "APP_STORAGE_DELETE", "APP_STORAGE_LIST", "APP_STORAGE_QUOTA", "SHARED_LIST", "SHARED_GET_COUNT", "SHARED_GET_COUNTS", "SHARED_APPEND", "SHARED_VOTE", "SHARED_UNVOTE", "SHARED_WITHDRAW", "SHARED_UPDATE", "SHARED_GET", "SHARED_REPORT", "SAVE_IMAGE", "SET_COLLECTION_FOLLOW", "SET_ENTITY_REACTION", "GET_ENTITY_REACTIONS"];
1220
1234
  /**
1221
1235
  * The bucket a message type falls into when the protocol does not declare it.
1222
1236
  *
@@ -67,6 +67,7 @@ export const BLOCK_TO_PARENT_MESSAGE_TYPES = [
67
67
  'GET_BUZZ_ACCOUNTS',
68
68
  'GET_DAILY_COMPENSATION',
69
69
  'GET_WILDCARD_PACK',
70
+ 'GET_RESOURCE_FILE',
70
71
  'QUERY_APP_WORKFLOWS',
71
72
  'PUBLISH_GENERATION_OUTPUTS',
72
73
  'CREATE_POST_FROM_APP',
@@ -1009,6 +1009,20 @@ export type WorkflowBodyCustomComfyRecipe = {
1009
1009
  accountType?: BuzzAccountType;
1010
1010
  };
1011
1011
  };
1012
+ /**
1013
+ * The most nodes an inline `customComfy` graph may carry. Mirrors civitai's
1014
+ * `INLINE_GRAPH_NODES_MAX` (`src/server/schema/blocks/workflow.schema.ts`); the
1015
+ * host refuses a larger graph before any spend.
1016
+ */
1017
+ export declare const BLOCK_INLINE_COMFY_MAX_NODES = 300;
1018
+ /**
1019
+ * The largest an inline `customComfy` graph may be, as `JSON.stringify(workflow)
1020
+ * .length`. Mirrors civitai's `INLINE_GRAPH_BYTES_MAX` (256 KiB, same file). The
1021
+ * host counts UTF-16 code units (its `jsonLengthWithin` default), which equals
1022
+ * bytes for an ASCII graph. The route also caps the WHOLE request body at
1023
+ * 256 KiB, so the real room for the graph is a little less than this.
1024
+ */
1025
+ export declare const BLOCK_INLINE_COMFY_MAX_GRAPH_BYTES = 262144;
1012
1026
  /**
1013
1027
  * One node of a ComfyUI `/prompt` graph, as it travels on the wire.
1014
1028
  *
@@ -3214,6 +3228,78 @@ export interface BlockWildcardPack {
3214
3228
  sfwOnly: boolean;
3215
3229
  };
3216
3230
  }
3231
+ /**
3232
+ * The CLOSED error set a `RESOURCE_FILE_RESULT` carries on failure
3233
+ * (civitai/civitai-app-starters#664). Like {@link BlockWildcardPackErrorCode} it
3234
+ * is a discriminated code, never free text. What each code covers is the host's
3235
+ * behaviour in civitai/civitai#6818 (`resource-file.service.ts`,
3236
+ * `resourceFileParse.ts`, `resourceFileHost.ts`):
3237
+ *
3238
+ * - `not-found` — every refusal of the resolve step except maturity: no such
3239
+ * version; not a `Workflows`/`ComfyWorkflows` version; no such file, or (for a
3240
+ * non-owner) the file is not `Public`; the site's download gate, evaluated
3241
+ * WITHOUT moderator rights, refuses it; an unpublished draft (the owner's own
3242
+ * included); an early-access or paid version for anyone but its owner (buyers
3243
+ * included); downloads disabled for anyone but the owner; and, for anyone but
3244
+ * the owner (moderators included), a POI model or a model or version whose
3245
+ * availability is not open (`Public` or `Unsearchable`), e.g. `Private`.
3246
+ * - `forbidden` — the version passes every gate above but is above the viewer's
3247
+ * maturity ceiling on this site (checked AFTER the download gate, so a version
3248
+ * the viewer cannot download never reveals its rating); or the app is running
3249
+ * in review preview, which refuses before resolving anything.
3250
+ * - `unauthorized` — the viewer is signed out.
3251
+ * - `too-large` — the file's advertised size, its `Content-Length` or the body
3252
+ * as it streams is over 32 MB; or no entry could be returned and at least one
3253
+ * was dropped by a size cap (4 MB per entry, 16 MB inflated in total) — so a
3254
+ * single `.json` over 4 MB is `too-large`.
3255
+ * - `parse-failed` — not a `.json` or `.zip`, a corrupt zip, or no JSON entry
3256
+ * that could be read and parsed. ALSO the host's catch-all: a network error, a
3257
+ * non-OK fetch, no answer within the host's 110 s deadline, a transient storage
3258
+ * failure in the resolve step, or any other server error. So it can be
3259
+ * transient, and one retry is reasonable. It is also the `dev:live` reply,
3260
+ * which cannot serve this bridge.
3261
+ * - `busy` — the tab already has 3 resource-file requests in flight; retry.
3262
+ * - `rate-limited` — the viewer's 30-a-minute budget is spent; retry later.
3263
+ */
3264
+ export type BlockResourceFileErrorCode = 'not-found' | 'forbidden' | 'unauthorized' | 'too-large' | 'parse-failed' | 'busy' | 'rate-limited';
3265
+ /**
3266
+ * How the host classified one parsed JSON entry: `api` when every top-level
3267
+ * value has `class_type` and `inputs` (the ComfyUI API format), `ui` when it has
3268
+ * a `nodes` array (the ComfyUI UI/editor format), otherwise `unknown`.
3269
+ */
3270
+ export type BlockResourceFileEntryFormat = 'ui' | 'api' | 'unknown';
3271
+ /** Which file the host served, and what it belongs to. */
3272
+ export interface BlockResourceFileMeta {
3273
+ modelId: number;
3274
+ modelVersionId: number;
3275
+ /** The file the host picked (or the `fileId` the request named). */
3276
+ fileId: number;
3277
+ fileName: string;
3278
+ modelName: string;
3279
+ versionName: string;
3280
+ creatorUsername: string | null;
3281
+ }
3282
+ /** One parsed JSON document out of the file. */
3283
+ export interface BlockResourceFileEntry {
3284
+ /** The entry's path inside the archive, or the file name for a plain `.json`. */
3285
+ path: string;
3286
+ format: BlockResourceFileEntryFormat;
3287
+ /** The parsed JSON, as-is. Check `format` before reading it as a graph. */
3288
+ graph: unknown;
3289
+ }
3290
+ /**
3291
+ * A resource file the host resolved, fetched, unzipped and parsed AS THE VIEWER
3292
+ * and returned on `RESOURCE_FILE_RESULT`. A plain `.json` file gives one entry;
3293
+ * a `.zip` gives one per `.json` entry (other entries, `__MACOSX/` and dot-files
3294
+ * are skipped and do not count), at most 20. `truncated` is true when a JSON
3295
+ * entry was dropped: past the 20, over the 4 MB per-entry or 16 MB total inflate
3296
+ * cap, unreadable, or not valid JSON.
3297
+ */
3298
+ export interface BlockResourceFile {
3299
+ meta: BlockResourceFileMeta;
3300
+ entries: BlockResourceFileEntry[];
3301
+ truncated: boolean;
3302
+ }
3217
3303
  /**
3218
3304
  * One result image on an {@link AppWorkflow}. Mirrors civitai/civitai's
3219
3305
  * `AppWorkflowImage` projection (`src/server/services/blocks/workflow.service.ts`,
@@ -114,6 +114,20 @@ export function isPageSlotContext(ctx) {
114
114
  export function isSignedIn(viewer) {
115
115
  return viewer !== null && viewer !== undefined;
116
116
  }
117
+ /**
118
+ * The most nodes an inline `customComfy` graph may carry. Mirrors civitai's
119
+ * `INLINE_GRAPH_NODES_MAX` (`src/server/schema/blocks/workflow.schema.ts`); the
120
+ * host refuses a larger graph before any spend.
121
+ */
122
+ export const BLOCK_INLINE_COMFY_MAX_NODES = 300;
123
+ /**
124
+ * The largest an inline `customComfy` graph may be, as `JSON.stringify(workflow)
125
+ * .length`. Mirrors civitai's `INLINE_GRAPH_BYTES_MAX` (256 KiB, same file). The
126
+ * host counts UTF-16 code units (its `jsonLengthWithin` default), which equals
127
+ * bytes for an ASCII graph. The route also caps the WHOLE request body at
128
+ * 256 KiB, so the real room for the graph is a little less than this.
129
+ */
130
+ export const BLOCK_INLINE_COMFY_MAX_GRAPH_BYTES = 262144;
117
131
  // ============================================================
118
132
  // Confirmed steps (a pass-through job above the per-call budget)
119
133
  // ============================================================
package/dist/index.d.ts CHANGED
@@ -25,11 +25,11 @@
25
25
  *
26
26
  * - **`./blocks`** — importing it RUNS `./safe-storage` for its side effect
27
27
  * (repairing `localStorage`/`sessionStorage` at an opaque origin). Folding
28
- * 197 symbols and that side effect into the root would make every OAuth app
28
+ * 208 symbols and that side effect into the root would make every OAuth app
29
29
  * that writes `import { exchangeCode } from '@civitai/app-sdk'` pay for the
30
30
  * Civitai-Apps contract it does not use. Blocks and OAuth apps are disjoint
31
31
  * audiences; see this package's README.
32
- * 🔴 That 197 is ASSERTED, not merely quoted — by
32
+ * 🔴 That 208 is ASSERTED, not merely quoted — by
33
33
  * `packages/civitai-app-sdk/test/export-surface.test.ts`, which pins
34
34
  * `surface.get('./blocks').size`. It said 119 here against a real 125 until
35
35
  * 2026-10-04, because the existing checks pin the root as an exact union and
package/dist/index.js CHANGED
@@ -25,11 +25,11 @@
25
25
  *
26
26
  * - **`./blocks`** — importing it RUNS `./safe-storage` for its side effect
27
27
  * (repairing `localStorage`/`sessionStorage` at an opaque origin). Folding
28
- * 197 symbols and that side effect into the root would make every OAuth app
28
+ * 208 symbols and that side effect into the root would make every OAuth app
29
29
  * that writes `import { exchangeCode } from '@civitai/app-sdk'` pay for the
30
30
  * Civitai-Apps contract it does not use. Blocks and OAuth apps are disjoint
31
31
  * audiences; see this package's README.
32
- * 🔴 That 197 is ASSERTED, not merely quoted — by
32
+ * 🔴 That 208 is ASSERTED, not merely quoted — by
33
33
  * `packages/civitai-app-sdk/test/export-surface.test.ts`, which pins
34
34
  * `surface.get('./blocks').size`. It said 119 here against a real 125 until
35
35
  * 2026-10-04, because the existing checks pin the root as an exact union and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@civitai/app-sdk",
3
- "version": "0.78.0",
3
+ "version": "0.80.0",
4
4
  "description": "OAuth + PKCE, encrypted-cookie sessions, scopes, and orchestrator helpers for building third-party Civitai apps.",
5
5
  "license": "MIT",
6
6
  "type": "module",