@nodaro/shared 3.31.0 → 3.32.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 +17 -0
- package/dist/chunk-2NIQO2J3.cjs +54 -0
- package/dist/chunk-2NIQO2J3.cjs.map +1 -0
- package/dist/chunk-2OJIVO7R.cjs +32 -0
- package/dist/chunk-2OJIVO7R.cjs.map +1 -0
- package/dist/chunk-2RF4Z7KG.cjs +803 -0
- package/dist/chunk-2RF4Z7KG.cjs.map +1 -0
- package/dist/chunk-3CUFITU7.js +1905 -0
- package/dist/chunk-3CUFITU7.js.map +1 -0
- package/dist/chunk-3RYKIUAE.js +86 -0
- package/dist/chunk-3RYKIUAE.js.map +1 -0
- package/dist/chunk-44I73CQS.cjs +194 -0
- package/dist/chunk-44I73CQS.cjs.map +1 -0
- package/dist/chunk-5AUSSJIM.cjs +3372 -0
- package/dist/chunk-5AUSSJIM.cjs.map +1 -0
- package/dist/chunk-5PC6JBGJ.cjs +1419 -0
- package/dist/chunk-5PC6JBGJ.cjs.map +1 -0
- package/dist/chunk-5RU2HCW2.js +30 -0
- package/dist/chunk-5RU2HCW2.js.map +1 -0
- package/dist/chunk-5THUHJ3E.js +46 -0
- package/dist/chunk-5THUHJ3E.js.map +1 -0
- package/dist/chunk-5U7VLG43.js +141 -0
- package/dist/chunk-5U7VLG43.js.map +1 -0
- package/dist/chunk-6DAWSVX2.cjs +103 -0
- package/dist/chunk-6DAWSVX2.cjs.map +1 -0
- package/dist/chunk-6DKDOWBL.js +1567 -0
- package/dist/chunk-6DKDOWBL.js.map +1 -0
- package/dist/chunk-6IJOPRZP.cjs +197 -0
- package/dist/chunk-6IJOPRZP.cjs.map +1 -0
- package/dist/chunk-7G7G42KS.js +86 -0
- package/dist/chunk-7G7G42KS.js.map +1 -0
- package/dist/chunk-AINCI23X.js +2171 -0
- package/dist/chunk-AINCI23X.js.map +1 -0
- package/dist/chunk-AROWPFO2.js +773 -0
- package/dist/chunk-AROWPFO2.js.map +1 -0
- package/dist/chunk-AVQK77G6.cjs +2000 -0
- package/dist/chunk-AVQK77G6.cjs.map +1 -0
- package/dist/chunk-C57NEO3X.js +3327 -0
- package/dist/chunk-C57NEO3X.js.map +1 -0
- package/dist/chunk-CK3GK34R.js +1381 -0
- package/dist/chunk-CK3GK34R.js.map +1 -0
- package/dist/chunk-E2TGXG6X.cjs +1770 -0
- package/dist/chunk-E2TGXG6X.cjs.map +1 -0
- package/dist/chunk-EK362Q45.cjs +38 -0
- package/dist/chunk-EK362Q45.cjs.map +1 -0
- package/dist/chunk-FBV5DF6D.js +95 -0
- package/dist/chunk-FBV5DF6D.js.map +1 -0
- package/dist/chunk-FG4E7MTG.cjs +4 -0
- package/dist/chunk-FG4E7MTG.cjs.map +1 -0
- package/dist/chunk-G6IIVKMO.js +26 -0
- package/dist/chunk-G6IIVKMO.js.map +1 -0
- package/dist/chunk-HGC5JNVA.cjs +1503 -0
- package/dist/chunk-HGC5JNVA.cjs.map +1 -0
- package/dist/chunk-HSHCCBIV.js +255 -0
- package/dist/chunk-HSHCCBIV.js.map +1 -0
- package/dist/chunk-IEBZHTPE.js +254 -0
- package/dist/chunk-IEBZHTPE.js.map +1 -0
- package/dist/chunk-ISJDAFKS.js +1604 -0
- package/dist/chunk-ISJDAFKS.js.map +1 -0
- package/dist/chunk-J6KHW2E5.cjs +1963 -0
- package/dist/chunk-J6KHW2E5.cjs.map +1 -0
- package/dist/chunk-J7BMO73N.cjs +114 -0
- package/dist/chunk-J7BMO73N.cjs.map +1 -0
- package/dist/chunk-JL4C5VJ7.cjs +488 -0
- package/dist/chunk-JL4C5VJ7.cjs.map +1 -0
- package/dist/chunk-JSGIEF6Z.cjs +1087 -0
- package/dist/chunk-JSGIEF6Z.cjs.map +1 -0
- package/dist/chunk-JSNV5O2F.cjs +34 -0
- package/dist/chunk-JSNV5O2F.cjs.map +1 -0
- package/dist/chunk-JWA5SGCS.js +203 -0
- package/dist/chunk-JWA5SGCS.js.map +1 -0
- package/dist/chunk-JX5YZ4DH.cjs +430 -0
- package/dist/chunk-JX5YZ4DH.cjs.map +1 -0
- package/dist/chunk-KHCBJ7KD.js +42 -0
- package/dist/chunk-KHCBJ7KD.js.map +1 -0
- package/dist/chunk-KU6S7IYV.cjs +210 -0
- package/dist/chunk-KU6S7IYV.cjs.map +1 -0
- package/dist/chunk-LKAIXWK3.js +181 -0
- package/dist/chunk-LKAIXWK3.js.map +1 -0
- package/dist/chunk-LPW3XNC2.js +471 -0
- package/dist/chunk-LPW3XNC2.js.map +1 -0
- package/dist/chunk-M36G6SRP.js +447 -0
- package/dist/chunk-M36G6SRP.js.map +1 -0
- package/dist/chunk-MRXGWL42.cjs +4 -0
- package/dist/chunk-MRXGWL42.cjs.map +1 -0
- package/dist/chunk-NB72XWXQ.cjs +54 -0
- package/dist/chunk-NB72XWXQ.cjs.map +1 -0
- package/dist/chunk-NEJ2PV4C.cjs +211 -0
- package/dist/chunk-NEJ2PV4C.cjs.map +1 -0
- package/dist/chunk-NT6IJH4L.cjs +273 -0
- package/dist/chunk-NT6IJH4L.cjs.map +1 -0
- package/dist/chunk-O5MP52U2.cjs +526 -0
- package/dist/chunk-O5MP52U2.cjs.map +1 -0
- package/dist/chunk-O7PUQLJ3.cjs +818 -0
- package/dist/chunk-O7PUQLJ3.cjs.map +1 -0
- package/dist/chunk-PQHS255G.js +1369 -0
- package/dist/chunk-PQHS255G.js.map +1 -0
- package/dist/chunk-PRYE7AZQ.cjs +1227 -0
- package/dist/chunk-PRYE7AZQ.cjs.map +1 -0
- package/dist/chunk-Q4CDQ2KO.js +21 -0
- package/dist/chunk-Q4CDQ2KO.js.map +1 -0
- package/dist/chunk-QELDJGDK.cjs +1714 -0
- package/dist/chunk-QELDJGDK.cjs.map +1 -0
- package/dist/chunk-QJRP44ZO.js +769 -0
- package/dist/chunk-QJRP44ZO.js.map +1 -0
- package/dist/chunk-QNGNOU4Z.js +29 -0
- package/dist/chunk-QNGNOU4Z.js.map +1 -0
- package/dist/chunk-RJL7RCEM.cjs +159 -0
- package/dist/chunk-RJL7RCEM.cjs.map +1 -0
- package/dist/chunk-RN3RMBJZ.js +1164 -0
- package/dist/chunk-RN3RMBJZ.js.map +1 -0
- package/dist/chunk-S5DMKUWK.cjs +1273 -0
- package/dist/chunk-S5DMKUWK.cjs.map +1 -0
- package/dist/chunk-SES6GDBQ.cjs +624 -0
- package/dist/chunk-SES6GDBQ.cjs.map +1 -0
- package/dist/chunk-TNPDV7I4.cjs +2346 -0
- package/dist/chunk-TNPDV7I4.cjs.map +1 -0
- package/dist/chunk-TZBIY5C3.js +187 -0
- package/dist/chunk-TZBIY5C3.js.map +1 -0
- package/dist/chunk-TZE673G6.js +3 -0
- package/dist/chunk-TZE673G6.js.map +1 -0
- package/dist/chunk-ULXI7A6Q.cjs +1047 -0
- package/dist/chunk-ULXI7A6Q.cjs.map +1 -0
- package/dist/chunk-VIWSWVAW.js +1782 -0
- package/dist/chunk-VIWSWVAW.js.map +1 -0
- package/dist/chunk-VWGNPMJZ.cjs +19 -0
- package/dist/chunk-VWGNPMJZ.cjs.map +1 -0
- package/dist/chunk-WDIBOWAA.js +1054 -0
- package/dist/chunk-WDIBOWAA.js.map +1 -0
- package/dist/chunk-WNG7HRVA.cjs +25 -0
- package/dist/chunk-WNG7HRVA.cjs.map +1 -0
- package/dist/chunk-WNVQ3SMB.cjs +96 -0
- package/dist/chunk-WNVQ3SMB.cjs.map +1 -0
- package/dist/chunk-WRSWH7US.cjs +285 -0
- package/dist/chunk-WRSWH7US.cjs.map +1 -0
- package/dist/chunk-XAMC4S53.js +17 -0
- package/dist/chunk-XAMC4S53.js.map +1 -0
- package/dist/chunk-XNISPHTZ.js +1039 -0
- package/dist/chunk-XNISPHTZ.js.map +1 -0
- package/dist/chunk-Y2PM3FFL.js +3 -0
- package/dist/chunk-Y2PM3FFL.js.map +1 -0
- package/dist/chunk-YBPBK5KI.js +1030 -0
- package/dist/chunk-YBPBK5KI.js.map +1 -0
- package/dist/chunk-YHRG7UOC.js +31 -0
- package/dist/chunk-YHRG7UOC.js.map +1 -0
- package/dist/chunk-YWNYGYI7.cjs +31 -0
- package/dist/chunk-YWNYGYI7.cjs.map +1 -0
- package/dist/chunk-YYV35XOS.js +122 -0
- package/dist/chunk-YYV35XOS.js.map +1 -0
- package/dist/chunk-Z2OL5AJD.cjs +133 -0
- package/dist/chunk-Z2OL5AJD.cjs.map +1 -0
- package/dist/chunk-Z4AZW6FY.js +920 -0
- package/dist/chunk-Z4AZW6FY.js.map +1 -0
- package/dist/chunk-ZDFHA2EC.js +572 -0
- package/dist/chunk-ZDFHA2EC.js.map +1 -0
- package/dist/chunk-ZNZDQAXN.js +175 -0
- package/dist/chunk-ZNZDQAXN.js.map +1 -0
- package/dist/chunk-ZRL2UFTH.cjs +1073 -0
- package/dist/chunk-ZRL2UFTH.cjs.map +1 -0
- package/dist/chunk-ZT77RY6R.js +404 -0
- package/dist/chunk-ZT77RY6R.js.map +1 -0
- package/dist/entries/apps.cjs +155 -0
- package/dist/entries/apps.cjs.map +1 -0
- package/dist/entries/apps.d.cts +283 -0
- package/dist/entries/apps.d.ts +283 -0
- package/dist/entries/apps.js +10 -0
- package/dist/entries/apps.js.map +1 -0
- package/dist/entries/captions.cjs +124 -0
- package/dist/entries/captions.cjs.map +1 -0
- package/dist/entries/captions.d.cts +354 -0
- package/dist/entries/captions.d.ts +354 -0
- package/dist/entries/captions.js +3 -0
- package/dist/entries/captions.js.map +1 -0
- package/dist/entries/catalogs.cjs +165 -0
- package/dist/entries/catalogs.cjs.map +1 -0
- package/dist/entries/catalogs.d.cts +385 -0
- package/dist/entries/catalogs.d.ts +385 -0
- package/dist/entries/catalogs.js +4 -0
- package/dist/entries/catalogs.js.map +1 -0
- package/dist/entries/credits.cjs +592 -0
- package/dist/entries/credits.cjs.map +1 -0
- package/dist/entries/credits.d.cts +1429 -0
- package/dist/entries/credits.d.ts +1429 -0
- package/dist/entries/credits.js +11 -0
- package/dist/entries/credits.js.map +1 -0
- package/dist/entries/edl.cjs +409 -0
- package/dist/entries/edl.cjs.map +1 -0
- package/dist/entries/edl.d.cts +1199 -0
- package/dist/entries/edl.d.ts +1199 -0
- package/dist/entries/edl.js +4 -0
- package/dist/entries/edl.js.map +1 -0
- package/dist/entries/entities.cjs +530 -0
- package/dist/entries/entities.cjs.map +1 -0
- package/dist/entries/entities.d.cts +1371 -0
- package/dist/entries/entities.d.ts +1371 -0
- package/dist/entries/entities.js +5 -0
- package/dist/entries/entities.js.map +1 -0
- package/dist/entries/i18n.cjs +48 -0
- package/dist/entries/i18n.cjs.map +1 -0
- package/dist/entries/i18n.d.cts +69 -0
- package/dist/entries/i18n.d.ts +69 -0
- package/dist/entries/i18n.js +3 -0
- package/dist/entries/i18n.js.map +1 -0
- package/dist/entries/llm-models.cjs +177 -0
- package/dist/entries/llm-models.cjs.map +1 -0
- package/dist/entries/llm-models.d.cts +435 -0
- package/dist/entries/llm-models.d.ts +435 -0
- package/dist/entries/llm-models.js +4 -0
- package/dist/entries/llm-models.js.map +1 -0
- package/dist/entries/media.cjs +335 -0
- package/dist/entries/media.cjs.map +1 -0
- package/dist/entries/media.d.cts +518 -0
- package/dist/entries/media.d.ts +518 -0
- package/dist/entries/media.js +6 -0
- package/dist/entries/media.js.map +1 -0
- package/dist/entries/model-catalog.cjs +247 -0
- package/dist/entries/model-catalog.cjs.map +1 -0
- package/dist/entries/model-catalog.d.cts +202 -0
- package/dist/entries/model-catalog.d.ts +202 -0
- package/dist/entries/model-catalog.js +6 -0
- package/dist/entries/model-catalog.js.map +1 -0
- package/dist/entries/models.cjs +833 -0
- package/dist/entries/models.cjs.map +1 -0
- package/dist/entries/models.d.cts +287 -0
- package/dist/entries/models.d.ts +287 -0
- package/dist/entries/models.js +8 -0
- package/dist/entries/models.js.map +1 -0
- package/dist/entries/nodes.cjs +789 -0
- package/dist/entries/nodes.cjs.map +1 -0
- package/dist/entries/nodes.d.cts +1600 -0
- package/dist/entries/nodes.d.ts +1600 -0
- package/dist/entries/nodes.js +16 -0
- package/dist/entries/nodes.js.map +1 -0
- package/dist/entries/organizations.cjs +80 -0
- package/dist/entries/organizations.cjs.map +1 -0
- package/dist/entries/organizations.d.cts +466 -0
- package/dist/entries/organizations.d.ts +466 -0
- package/dist/entries/organizations.js +3 -0
- package/dist/entries/organizations.js.map +1 -0
- package/dist/entries/pipeline.cjs +594 -0
- package/dist/entries/pipeline.cjs.map +1 -0
- package/dist/entries/pipeline.d.cts +2617 -0
- package/dist/entries/pipeline.d.ts +2617 -0
- package/dist/entries/pipeline.js +5 -0
- package/dist/entries/pipeline.js.map +1 -0
- package/dist/entries/scene3d.cjs +704 -0
- package/dist/entries/scene3d.cjs.map +1 -0
- package/dist/entries/scene3d.d.cts +4284 -0
- package/dist/entries/scene3d.d.ts +4284 -0
- package/dist/entries/scene3d.js +3 -0
- package/dist/entries/scene3d.js.map +1 -0
- package/dist/entries/social.cjs +714 -0
- package/dist/entries/social.cjs.map +1 -0
- package/dist/entries/social.d.cts +1366 -0
- package/dist/entries/social.d.ts +1366 -0
- package/dist/entries/social.js +5 -0
- package/dist/entries/social.js.map +1 -0
- package/dist/entries/types.cjs +13 -0
- package/dist/entries/types.cjs.map +1 -0
- package/dist/entries/types.d.cts +162 -0
- package/dist/entries/types.d.ts +162 -0
- package/dist/entries/types.js +4 -0
- package/dist/entries/types.js.map +1 -0
- package/dist/entries/ugc.cjs +279 -0
- package/dist/entries/ugc.cjs.map +1 -0
- package/dist/entries/ugc.d.cts +575 -0
- package/dist/entries/ugc.d.ts +575 -0
- package/dist/entries/ugc.js +6 -0
- package/dist/entries/ugc.js.map +1 -0
- package/dist/entries/video.cjs +549 -0
- package/dist/entries/video.cjs.map +1 -0
- package/dist/entries/video.d.cts +1791 -0
- package/dist/entries/video.d.ts +1791 -0
- package/dist/entries/video.js +8 -0
- package/dist/entries/video.js.map +1 -0
- package/dist/entries/workflow.cjs +574 -0
- package/dist/entries/workflow.cjs.map +1 -0
- package/dist/entries/workflow.d.cts +1733 -0
- package/dist/entries/workflow.d.ts +1733 -0
- package/dist/entries/workflow.js +5 -0
- package/dist/entries/workflow.js.map +1 -0
- package/dist/fan-out-meta-Bu6VyXcZ.d.cts +19 -0
- package/dist/fan-out-meta-Bu6VyXcZ.d.ts +19 -0
- package/dist/gemini-omni-voices-zeRXxSbZ.d.cts +174 -0
- package/dist/gemini-omni-voices-zeRXxSbZ.d.ts +174 -0
- package/dist/image-overlay-layers-CyBfRhxJ.d.cts +208 -0
- package/dist/image-overlay-layers-CyBfRhxJ.d.ts +208 -0
- package/dist/index.cjs +7731 -27084
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -24198
- package/dist/index.d.ts +32 -24198
- package/dist/index.js +40 -25220
- package/dist/index.js.map +1 -1
- package/dist/model-catalog-flJYaa-g.d.cts +561 -0
- package/dist/model-catalog-flJYaa-g.d.ts +561 -0
- package/dist/presentation-types-0ENOCjoj.d.cts +61 -0
- package/dist/presentation-types-0ENOCjoj.d.ts +61 -0
- package/dist/presentation-utils-BIqiCzSA.d.cts +90 -0
- package/dist/presentation-utils-BdiObtwq.d.ts +90 -0
- package/dist/scene-node-types-DjenYFLO.d.cts +1949 -0
- package/dist/scene-node-types-DjenYFLO.d.ts +1949 -0
- package/dist/supported-fonts-CRoF1gOy.d.cts +16 -0
- package/dist/supported-fonts-CRoF1gOy.d.ts +16 -0
- package/dist/types-BRlFPEru.d.cts +511 -0
- package/dist/types-BRlFPEru.d.ts +511 -0
- package/dist/types-DffyGSy5.d.cts +67 -0
- package/dist/types-DffyGSy5.d.ts +67 -0
- package/package.json +102 -1
- package/src/__tests__/add-captions-plan.test.ts +6 -2
- package/src/__tests__/caption-edge-dash.test.ts +23 -0
- package/src/__tests__/fixtures/root-exports.baseline.json +4625 -0
- package/src/__tests__/input-field-extra-keys.test.ts +1 -0
- package/src/__tests__/no-internal-imports.test.ts +1 -1
- package/src/__tests__/node-aspect-ratio.test.ts +25 -0
- package/src/__tests__/node-runtime-keys.test.ts +9 -0
- package/src/__tests__/package-entries.test.ts +50 -0
- package/src/__tests__/pitch-tempo-pricing.test.ts +21 -0
- package/src/__tests__/preview-gate-use-case.test.ts +151 -0
- package/src/__tests__/run-continuation.test.ts +7 -1
- package/src/__tests__/site-capture-node.test.ts +58 -0
- package/src/__tests__/ugc-lane-wires.test.ts +228 -0
- package/src/__tests__/ugc-node-wires.test.ts +9 -3
- package/src/__tests__/ugc-run-state.test.ts +5 -4
- package/src/__tests__/video-analysis-catalog-sync.test.ts +1 -1
- package/src/__tests__/video-analysis-pricing.test.ts +6 -6
- package/src/__tests__/voice-changer-pro-quote.test.ts +79 -0
- package/src/add-captions-plan.ts +9 -3
- package/src/caption-edge-dash.ts +33 -0
- package/src/credit-estimators/index.ts +22 -1
- package/src/credit-estimators/pitch-tempo.ts +15 -1
- package/src/credit-estimators/speech.ts +72 -4
- package/src/credit-estimators/unit-quote.ts +52 -0
- package/src/credit-estimators/video-sfx.ts +15 -0
- package/src/credit-estimators/voice-changer-pro-quote.ts +138 -0
- package/src/entity-image-handle.ts +2 -0
- package/src/entries/apps.ts +63 -0
- package/src/entries/captions.ts +34 -0
- package/src/entries/catalogs.ts +65 -0
- package/src/entries/credits.ts +104 -0
- package/src/entries/edl.ts +42 -0
- package/src/entries/entities.ts +144 -0
- package/src/entries/i18n.ts +31 -0
- package/src/entries/llm-models.ts +63 -0
- package/src/entries/media.ts +36 -0
- package/src/entries/model-catalog.ts +89 -0
- package/src/entries/models.ts +266 -0
- package/src/entries/nodes.ts +245 -0
- package/src/entries/organizations.ts +9 -0
- package/src/entries/pipeline.ts +43 -0
- package/src/entries/scene3d.ts +27 -0
- package/src/entries/social.ts +297 -0
- package/src/entries/types.ts +26 -0
- package/src/entries/ugc.ts +14 -0
- package/src/entries/video.ts +59 -0
- package/src/entries/workflow.ts +172 -0
- package/src/fan-out-rows.ts +2 -0
- package/src/index.ts +25 -1845
- package/src/json-kinds.ts +4 -0
- package/src/model-catalog.ts +36 -34
- package/src/node-mappable-fields.ts +1 -0
- package/src/node-run-routes.ts +2 -0
- package/src/node-runtime-keys.ts +8 -0
- package/src/normalize-node-params.ts +30 -0
- package/src/presentation-utils.ts +5 -0
- package/src/preview-gate.ts +92 -14
- package/src/producer-types.ts +16 -2
- package/src/run-continuation.ts +21 -0
- package/src/site-capture-node.ts +82 -0
- package/src/ugc-lane-wires.ts +246 -0
- package/src/ugc-node-wires.ts +37 -7
- package/src/ugc-run-state.ts +5 -3
- package/src/video-analysis-pricing.ts +31 -29
|
@@ -0,0 +1,1733 @@
|
|
|
1
|
+
import { o as GenericNode, G as GenericEdge } from '../types-BRlFPEru.cjs';
|
|
2
|
+
import { O as OutputType } from '../presentation-utils-BIqiCzSA.cjs';
|
|
3
|
+
import { z, ZodType } from 'zod';
|
|
4
|
+
import '../presentation-types-0ENOCjoj.cjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Utilities for detecting and filtering expanded loop clones.
|
|
8
|
+
* Shared between frontend (store, persistence, execution) and backend (orchestrator).
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** Matches node IDs like `node_7_iter_0`, `node_7_iter_1`, etc. */
|
|
12
|
+
declare const ITER_CLONE_PATTERN: RegExp;
|
|
13
|
+
/** Returns true if the node is an expanded loop clone (by flag or ID pattern). */
|
|
14
|
+
declare function isExpandedClone(node: GenericNode): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Filter out expanded clone nodes and edges that reference them.
|
|
17
|
+
* Unhides original nodes that were hidden during loop expansion.
|
|
18
|
+
* Optionally filters sub-workflow nodes (prefix `__sub_`).
|
|
19
|
+
*/
|
|
20
|
+
declare function filterCloneNodes<N extends GenericNode, E extends GenericEdge>(nodes: N[], edges: E[], options?: {
|
|
21
|
+
filterSubWorkflow?: boolean;
|
|
22
|
+
}): {
|
|
23
|
+
nodes: N[];
|
|
24
|
+
edges: E[];
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
type AggregateableType = "text" | "image" | "video" | "audio";
|
|
28
|
+
declare const AGGREGATEABLE_TYPES: readonly ["text", "image", "video", "audio"];
|
|
29
|
+
interface Member {
|
|
30
|
+
nodeId: string;
|
|
31
|
+
type: AggregateableType;
|
|
32
|
+
value: string;
|
|
33
|
+
}
|
|
34
|
+
interface AggregationBuckets {
|
|
35
|
+
text: string[];
|
|
36
|
+
image: string[];
|
|
37
|
+
video: string[];
|
|
38
|
+
audio: string[];
|
|
39
|
+
}
|
|
40
|
+
declare function aggregateByType(members: Member[]): AggregationBuckets;
|
|
41
|
+
declare function presentTypes(buckets: AggregationBuckets): AggregateableType[];
|
|
42
|
+
declare function isAggregateableType(t: OutputType | undefined): t is AggregateableType;
|
|
43
|
+
declare const GROUP_HANDLE_PREFIX: "out-";
|
|
44
|
+
declare const COLLECT_IN_HANDLE: "in";
|
|
45
|
+
declare function groupHandleId(t: AggregateableType): string;
|
|
46
|
+
declare function parseGroupHandle(h: string | null | undefined): AggregateableType | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Build a parent → children-ids map from a flat node array in a single pass.
|
|
49
|
+
* Used by both engines' `buildExecutionLevels` to derive the implicit
|
|
50
|
+
* child → group dependency edges in O(N+G) instead of O(N×G).
|
|
51
|
+
*/
|
|
52
|
+
declare function buildChildrenByParent<N extends {
|
|
53
|
+
id: string;
|
|
54
|
+
parentId?: string;
|
|
55
|
+
}>(nodes: ReadonlyArray<N>): Map<string, string[]>;
|
|
56
|
+
declare function isCollectInEdge(e: {
|
|
57
|
+
targetHandle?: string | null;
|
|
58
|
+
}): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* The source-pip lanes an aggregate node (Group / Collect) must EXPOSE.
|
|
61
|
+
*
|
|
62
|
+
* Bucket contents alone are not enough: buckets are computed from upstream
|
|
63
|
+
* RESULTS, so before anything ran the node rendered zero source handles — a
|
|
64
|
+
* pre-authored edge out of the node (MCP-written JSON, import, paste) pointed
|
|
65
|
+
* at a handle that did not exist and React Flow silently hid it ("connected
|
|
66
|
+
* in the panel, invisible on canvas"), and there was no pip to drag outward
|
|
67
|
+
* from. A lane therefore exists when ANY of these hold:
|
|
68
|
+
* (a) a wired member / input of that aggregateable type exists (pre-run),
|
|
69
|
+
* (b) the bucket for that type has values (post-run),
|
|
70
|
+
* (c) an existing outgoing edge references the lane's handle — so an edge
|
|
71
|
+
* can never point at a missing handle, whatever state authored it
|
|
72
|
+
* (also covers results being cleared after wiring downstream).
|
|
73
|
+
* Ordered by AGGREGATEABLE_TYPES so the handle layout is stable.
|
|
74
|
+
*/
|
|
75
|
+
declare function computeAggregateLanes(nodeId: string, wiredTypes: Iterable<AggregateableType>, buckets: AggregationBuckets, edges: ReadonlyArray<{
|
|
76
|
+
source: string;
|
|
77
|
+
sourceHandle?: string | null;
|
|
78
|
+
}>): AggregateableType[];
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Non-linear progress calculation using quadratic ease-out curve.
|
|
82
|
+
* Returns 0–99 during execution, never reaching 100 (that's set on completion).
|
|
83
|
+
*
|
|
84
|
+
* Formula: progress = 99 * (1 - (1 - t)^exponent)
|
|
85
|
+
* where t = clamp(elapsedMs / estimatedMs, 0, 1)
|
|
86
|
+
*/
|
|
87
|
+
declare function calculateProgress(elapsedMs: number, estimatedMs: number, exponent?: number): number;
|
|
88
|
+
/** Category-based fallback durations (ms) when no historical data exists. */
|
|
89
|
+
declare const CATEGORY_DURATION_DEFAULTS: Record<string, number>;
|
|
90
|
+
/**
|
|
91
|
+
* Compute weighted progress segments for a multi-node flow.
|
|
92
|
+
* Each node gets a proportional slice of 0–99% based on its estimated duration.
|
|
93
|
+
*
|
|
94
|
+
* Returns array of { nodeId, startPct, endPct, estimatedMs } in execution order.
|
|
95
|
+
*/
|
|
96
|
+
interface ProgressSegment {
|
|
97
|
+
nodeId: string;
|
|
98
|
+
startPct: number;
|
|
99
|
+
endPct: number;
|
|
100
|
+
estimatedMs: number;
|
|
101
|
+
}
|
|
102
|
+
declare function buildProgressSegments(nodeEstimates: {
|
|
103
|
+
nodeId: string;
|
|
104
|
+
estimatedMs: number;
|
|
105
|
+
}[]): ProgressSegment[];
|
|
106
|
+
/**
|
|
107
|
+
* Calculate combined progress for a multi-node flow given current node states.
|
|
108
|
+
*/
|
|
109
|
+
declare function calculateCombinedProgress(segments: ProgressSegment[], nodeStatuses: Record<string, {
|
|
110
|
+
status: "pending" | "running" | "completed" | "failed" | "skipped";
|
|
111
|
+
startedAt?: string;
|
|
112
|
+
}>, now?: number): number;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Shared BFS utility for computing reachable node IDs along a route.
|
|
116
|
+
* Used by both frontend (RunTargetSelector stale guard) and backend
|
|
117
|
+
* (presentation.ts, app-runner.ts, sub-workflow-handler.ts).
|
|
118
|
+
*/
|
|
119
|
+
interface MinimalNode {
|
|
120
|
+
id: string;
|
|
121
|
+
type?: string;
|
|
122
|
+
data: Record<string, unknown>;
|
|
123
|
+
}
|
|
124
|
+
interface MinimalEdge {
|
|
125
|
+
source: string;
|
|
126
|
+
target: string;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Compute the set of node IDs reachable along a route.
|
|
130
|
+
* 1. Finds the sub-workflow-input node with matching routeId
|
|
131
|
+
* 2. Finds the sub-workflow-output node with matching routeId
|
|
132
|
+
* 3. BFS forward from input, BFS backward from output, intersect
|
|
133
|
+
* Returns empty set if input or output node not found (stale routeId).
|
|
134
|
+
*/
|
|
135
|
+
declare function getRouteReachableNodeIds(nodes: readonly MinimalNode[], edges: readonly MinimalEdge[], routeId: string): Set<string>;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Evaluate a dot-notation path against a JSON value.
|
|
139
|
+
*
|
|
140
|
+
* Auto-iterates arrays at any depth: if the current value is an array,
|
|
141
|
+
* the evaluator iterates and applies the remaining path to each element,
|
|
142
|
+
* flattening results. This lets simple paths like "caption" work on a
|
|
143
|
+
* top-level array and "pages.markdown" work on a nested array without
|
|
144
|
+
* any wildcard syntax.
|
|
145
|
+
*
|
|
146
|
+
* Returns an array of values. Missing properties are skipped (empty for
|
|
147
|
+
* that branch). Null/undefined leaf values are included — callers coerce.
|
|
148
|
+
* Empty path returns `[value]` (a single-element array wrapping the
|
|
149
|
+
* value) when the value is scalar/object, or the array elements flat
|
|
150
|
+
* when the root is an array.
|
|
151
|
+
*/
|
|
152
|
+
declare function evaluateJsonPath(value: unknown, path: string): unknown[];
|
|
153
|
+
/**
|
|
154
|
+
* Coerce an array of unknown values (typically from evaluateJsonPath) to
|
|
155
|
+
* strings, skipping null/undefined. Primitives are stringified; objects
|
|
156
|
+
* are JSON-encoded.
|
|
157
|
+
*/
|
|
158
|
+
declare function stringifyPathResults(raw: unknown[]): string[];
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* R2-key + result-id suffix for multi-variant jobs. Provider returns multiple
|
|
162
|
+
* URLs from a single task (Grok = up to 6 images, Suno = 2 tracks); each
|
|
163
|
+
* variant gets a deterministic suffix-keyed ID so primary stays at the original
|
|
164
|
+
* jobId for backwards compat and extras land under `${jobId}-v1`, `${jobId}-v2`, …
|
|
165
|
+
*
|
|
166
|
+
* Used by:
|
|
167
|
+
* - backend `uploadImageVariantsMaybeWatermark` (R2 key)
|
|
168
|
+
* - backend Suno `uploadAllSunoTracks` (R2 key)
|
|
169
|
+
* - frontend `poll-job.ts handleJobCompleted` (GeneratedResult.jobId)
|
|
170
|
+
* - frontend `run-handlers.ts` orchestrator poll loop (GeneratedResult.jobId)
|
|
171
|
+
*
|
|
172
|
+
* Changing the suffix scheme requires updating every caller, hence the shared helper.
|
|
173
|
+
*/
|
|
174
|
+
declare function variantJobId(baseJobId: string, index: number): string;
|
|
175
|
+
|
|
176
|
+
type FilterOperator = "equals" | "not_equals" | "contains" | "not_contains" | "starts_with" | "ends_with" | "greater_than" | "less_than" | "is_empty" | "is_not_empty" | "matches_regex" | "in_list";
|
|
177
|
+
interface JsonFilter {
|
|
178
|
+
id: string;
|
|
179
|
+
field: string;
|
|
180
|
+
operator: FilterOperator;
|
|
181
|
+
value: string | string[];
|
|
182
|
+
}
|
|
183
|
+
type JsonEvalResult = {
|
|
184
|
+
ok: true;
|
|
185
|
+
value: unknown;
|
|
186
|
+
} | {
|
|
187
|
+
ok: false;
|
|
188
|
+
error: string;
|
|
189
|
+
};
|
|
190
|
+
declare function buildExpressionFromVisual(config: {
|
|
191
|
+
inputPath?: string;
|
|
192
|
+
filters?: JsonFilter[];
|
|
193
|
+
projections?: string[];
|
|
194
|
+
}): string;
|
|
195
|
+
declare function jsonResultToList(value: unknown): string[];
|
|
196
|
+
declare function evaluateJsonExpression(input: unknown, expression: string): JsonEvalResult;
|
|
197
|
+
|
|
198
|
+
/** Pure condition evaluator shared by filter-list and router (conditional mode). */
|
|
199
|
+
type FilterListOperator = ">" | "<" | ">=" | "<=" | "=" | "!=" | "contains" | "not_contains" | "starts_with" | "ends_with" | "regex" | "exists" | "not_exists";
|
|
200
|
+
interface FilterListCondition {
|
|
201
|
+
id?: string;
|
|
202
|
+
field?: string;
|
|
203
|
+
operator: FilterListOperator;
|
|
204
|
+
value?: string;
|
|
205
|
+
valueType?: "static" | "variable";
|
|
206
|
+
/** UI-only hint on the config panel — irrelevant to evaluation. */
|
|
207
|
+
mode?: "dropdown" | "custom";
|
|
208
|
+
}
|
|
209
|
+
/** AND/OR condition bundle used by the router's conditional mode. When a
|
|
210
|
+
* group matches, every routeId is added to activeRoutes. Multiple groups
|
|
211
|
+
* union (deduped). */
|
|
212
|
+
interface RouterConditionGroup {
|
|
213
|
+
id?: string;
|
|
214
|
+
conditions?: FilterListCondition[];
|
|
215
|
+
conditionLogic?: "AND" | "OR";
|
|
216
|
+
routeIds?: string[];
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Options for `evaluateCondition` / `evaluateConditionGroup`.
|
|
220
|
+
*/
|
|
221
|
+
interface EvaluateConditionOptions {
|
|
222
|
+
/** When `false`, text operators (`contains`, `not_contains`, `starts_with`,
|
|
223
|
+
* `ends_with`, `=`, `!=`) compare case-insensitively using case-folded
|
|
224
|
+
* string equality.
|
|
225
|
+
*
|
|
226
|
+
* Note: `=` and `!=` lose their default numeric-coercion semantics under
|
|
227
|
+
* `caseSensitive: false`. Under the default (case-sensitive), `1 == "1.0"`
|
|
228
|
+
* via `valuesEqual`; under `caseSensitive: false`, comparison is pure
|
|
229
|
+
* case-folded string equality, so `"1" !== "1.0"`.
|
|
230
|
+
*
|
|
231
|
+
* Default (when undefined): `true` (case-sensitive) — preserves existing
|
|
232
|
+
* behavior for all callers.
|
|
233
|
+
*
|
|
234
|
+
* Non-text operators (`>`, `<`, `>=`, `<=`, `exists`, `not_exists`,
|
|
235
|
+
* `regex`) are unaffected by this flag. */
|
|
236
|
+
caseSensitive?: boolean;
|
|
237
|
+
/** Label→output map for `{Node Label}` refs inside condition values.
|
|
238
|
+
* Populated from a filter-list / router node's `"variables"` target
|
|
239
|
+
* handle. Resolved via `resolveNodeRefs` — unknown labels preserve
|
|
240
|
+
* the original `{...}` text, so JSON-literal values stay intact. */
|
|
241
|
+
variables?: ReadonlyMap<string, string>;
|
|
242
|
+
}
|
|
243
|
+
declare function tryParseJson(item: unknown): unknown;
|
|
244
|
+
/** Resolve a relative-window token like `last_N_hours:3` to an ISO timestamp
|
|
245
|
+
* N units before `Date.now()`. Returns undefined for malformed tokens. */
|
|
246
|
+
declare function resolveRelativeWindowToken(key: string): string | undefined;
|
|
247
|
+
declare function resolveConditionValue(raw: string, valueType: string | undefined, triggerData?: Record<string, unknown>, variables?: ReadonlyMap<string, string>): string;
|
|
248
|
+
declare function evaluateCondition(parsedItem: unknown, rawItem: string, condition: FilterListCondition, triggerData?: Record<string, unknown>, options?: EvaluateConditionOptions): boolean;
|
|
249
|
+
/** Evaluate a single AND/OR-joined group against one item. Empty condition
|
|
250
|
+
* list evaluates to `true` — typical when the user has just added a group
|
|
251
|
+
* and hasn't configured any conditions yet. */
|
|
252
|
+
declare function evaluateConditionGroup(parsedItem: unknown, rawItem: string, conditions: readonly FilterListCondition[], logic: "AND" | "OR", triggerData?: Record<string, unknown>, options?: EvaluateConditionOptions): boolean;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Edge range utilities for resolving 1-based index expressions
|
|
256
|
+
* and applying range/step slicing to output lists.
|
|
257
|
+
*
|
|
258
|
+
* Used by both frontend DAG executor and backend orchestrator
|
|
259
|
+
* to support edge-level range, step, and item selection.
|
|
260
|
+
*/
|
|
261
|
+
/** Selector tab on an edge — "range" (from/to/step) or "list" (expression). */
|
|
262
|
+
type SelectorMode = "range" | "list";
|
|
263
|
+
/** Per-edge output mode controlling how upstream results reach downstream. */
|
|
264
|
+
type OutputMode = "last" | "each" | "all" | "item";
|
|
265
|
+
/** Edge-data fields consumed by selectListItems / isDefaultSelectorConfig. */
|
|
266
|
+
type SelectorFields = {
|
|
267
|
+
selectorMode?: SelectorMode;
|
|
268
|
+
listExpression?: string;
|
|
269
|
+
rangeFrom?: string;
|
|
270
|
+
rangeTo?: string;
|
|
271
|
+
rangeStep?: number;
|
|
272
|
+
};
|
|
273
|
+
/** Full selector mode set — extends the edge-selector modes with new operators. */
|
|
274
|
+
type FullSelectorMode = "item" | "range" | "list" | "random" | "modulo" | "predicate" | "named-key";
|
|
275
|
+
/** Operator set for predicate mode — reused from filter-list. */
|
|
276
|
+
type SelectorPredicateOp = ">" | "<" | ">=" | "<=" | "=" | "!=" | "contains" | "not_contains" | "starts_with" | "ends_with" | "regex" | "exists" | "not_exists";
|
|
277
|
+
/** Config consumed by `runSelector` and `resolveSelectorRefs`. */
|
|
278
|
+
type SelectorConfig = {
|
|
279
|
+
mode: FullSelectorMode;
|
|
280
|
+
itemIndex?: string;
|
|
281
|
+
rangeFrom?: string;
|
|
282
|
+
rangeTo?: string;
|
|
283
|
+
rangeStep?: number;
|
|
284
|
+
listExpression?: string;
|
|
285
|
+
seed?: string;
|
|
286
|
+
randomCount?: number;
|
|
287
|
+
moduloDivisor?: string;
|
|
288
|
+
predicateField?: string;
|
|
289
|
+
predicateOp?: SelectorPredicateOp;
|
|
290
|
+
predicateValue?: string;
|
|
291
|
+
predicateMatch?: "first" | "all";
|
|
292
|
+
predicateCaseSensitive?: boolean;
|
|
293
|
+
namedKeyField?: string;
|
|
294
|
+
namedKeyValue?: string;
|
|
295
|
+
};
|
|
296
|
+
/** Result of a selector run. `picked ∪ rest = items`, `picked ∩ rest = ∅`. */
|
|
297
|
+
type SelectorResult = {
|
|
298
|
+
picked: string[];
|
|
299
|
+
rest: string[];
|
|
300
|
+
};
|
|
301
|
+
/**
|
|
302
|
+
* Resolves a 1-based index expression to a 0-based array index.
|
|
303
|
+
*
|
|
304
|
+
* Supported expressions:
|
|
305
|
+
* - "1", "2", ... — absolute 1-based index
|
|
306
|
+
* - "last" — last element
|
|
307
|
+
* - "last-1", "last-2", ... — relative from end
|
|
308
|
+
*
|
|
309
|
+
* Out-of-bounds values are clamped. Malformed input falls back to `defaultExpr`.
|
|
310
|
+
*/
|
|
311
|
+
declare function resolveIndex(expr: string, listLength: number, defaultExpr?: string): number;
|
|
312
|
+
/**
|
|
313
|
+
* Applies range and step slicing to a list of strings.
|
|
314
|
+
*
|
|
315
|
+
* `from` and `to` are 1-based index expressions (see `resolveIndex`).
|
|
316
|
+
* `step` controls iteration direction and stride:
|
|
317
|
+
* - positive step: forward iteration (from must be <= to)
|
|
318
|
+
* - negative step: reverse iteration (from must be >= to)
|
|
319
|
+
* - step 0 is treated as step 1
|
|
320
|
+
*
|
|
321
|
+
* Returns empty array if direction mismatches (e.g., from < to with negative step).
|
|
322
|
+
*/
|
|
323
|
+
declare function applyRange(list: string[], from?: string, to?: string, step?: number): string[];
|
|
324
|
+
/**
|
|
325
|
+
* Migrates legacy `item:N` (0-based) outputMode to structured format.
|
|
326
|
+
*
|
|
327
|
+
* Legacy: `{ outputMode: "item:0" }` — 0-based index baked into mode string
|
|
328
|
+
* New: `{ outputMode: "item", itemIndex: "1" }` — 1-based expression
|
|
329
|
+
*
|
|
330
|
+
* Returns the data unchanged if not a legacy item mode.
|
|
331
|
+
*/
|
|
332
|
+
declare function migrateEdgeOutputMode(data: Record<string, unknown> | undefined): Record<string, unknown> | undefined;
|
|
333
|
+
/**
|
|
334
|
+
* Builds the edge range label shown as a pill on the edge.
|
|
335
|
+
* Examples:
|
|
336
|
+
* - "2..last-1 +2" — range with step 2
|
|
337
|
+
* - "last..1 -1" — reversed
|
|
338
|
+
* - "3" — item mode, index 3
|
|
339
|
+
* - undefined — "last" mode has no label
|
|
340
|
+
*/
|
|
341
|
+
declare function buildRangeLabel(mode: string, rangeFrom?: string, rangeTo?: string, rangeStep?: number, itemIndex?: string, selectorMode?: SelectorMode, listExpression?: string): string | undefined;
|
|
342
|
+
/**
|
|
343
|
+
* Validates a list expression without resolving indices.
|
|
344
|
+
* Used for live UI validation in the List tab input.
|
|
345
|
+
*
|
|
346
|
+
* Returns { ok: true } for empty/whitespace input — matches the
|
|
347
|
+
* "empty = all items" runtime semantics.
|
|
348
|
+
*/
|
|
349
|
+
declare function parseListExpression(expr: string): {
|
|
350
|
+
ok: true;
|
|
351
|
+
} | {
|
|
352
|
+
ok: false;
|
|
353
|
+
error: string;
|
|
354
|
+
};
|
|
355
|
+
/**
|
|
356
|
+
* Parses a list expression and returns 0-based indices into the list,
|
|
357
|
+
* in user-specified order. Preserves duplicates.
|
|
358
|
+
*
|
|
359
|
+
* Supported syntax:
|
|
360
|
+
* <expr> := <term> ("," <term>)*
|
|
361
|
+
* <term> := <index> | <index> ".." <index> (":" <step>)?
|
|
362
|
+
* <index> := <number> | "last" | "last-" <number>
|
|
363
|
+
* <step> := integer (0 coerced to 1)
|
|
364
|
+
*
|
|
365
|
+
* Clamps out-of-bounds indices. Malformed input logs a warning and
|
|
366
|
+
* returns [0..listLength-1] (matches applyRange leniency).
|
|
367
|
+
*/
|
|
368
|
+
declare function resolveListExpression(expr: string, listLength: number): number[];
|
|
369
|
+
/**
|
|
370
|
+
* Dispatches to either applyRange() or resolveListExpression() based on
|
|
371
|
+
* edgeData.selectorMode. Returns a new string[] containing the selected
|
|
372
|
+
* subset of items — or `items` unchanged when the edge has no filter.
|
|
373
|
+
*/
|
|
374
|
+
declare function selectListItems(items: string[], edgeData: SelectorFields | undefined): string[];
|
|
375
|
+
/**
|
|
376
|
+
* Returns true when edge data carries no active filter — empty/whitespace list
|
|
377
|
+
* expression in list mode, or defaults (1..last, step 1) in range mode.
|
|
378
|
+
* Callers can skip filtering entirely when this returns true.
|
|
379
|
+
*/
|
|
380
|
+
declare function isDefaultSelectorConfig(edgeData: SelectorFields | undefined): boolean;
|
|
381
|
+
declare function describeEdgeBehavior(edgeData: {
|
|
382
|
+
outputMode?: string;
|
|
383
|
+
selectorMode?: SelectorMode;
|
|
384
|
+
listExpression?: string;
|
|
385
|
+
rangeFrom?: string;
|
|
386
|
+
rangeTo?: string;
|
|
387
|
+
rangeStep?: number;
|
|
388
|
+
itemIndex?: string;
|
|
389
|
+
} | undefined): string;
|
|
390
|
+
/**
|
|
391
|
+
* Run the selector against `items`. Returns the picked subset plus the
|
|
392
|
+
* complement (`rest`). For modes that pick by index, `rest` is computed by
|
|
393
|
+
* index exclusion (not value) so duplicate items are handled correctly.
|
|
394
|
+
*/
|
|
395
|
+
declare function runSelector(items: string[], config: SelectorConfig): SelectorResult;
|
|
396
|
+
/**
|
|
397
|
+
* Returns the indices that `applyRange` would pick. Extracted so `runSelector`
|
|
398
|
+
* range mode can compute the exact picked-index set (`items.indexOf(value)`
|
|
399
|
+
* would return the wrong duplicate when the list contains repeated values).
|
|
400
|
+
*/
|
|
401
|
+
declare function applyRangeIndices(length: number, from?: string, to?: string, step?: number): number[];
|
|
402
|
+
/**
|
|
403
|
+
* Pick `count` items uniformly at random without replacement.
|
|
404
|
+
* If `seed` is non-empty, the PRNG is seeded deterministically.
|
|
405
|
+
* Otherwise `Math.random` is used (fresh randomness per call).
|
|
406
|
+
*/
|
|
407
|
+
declare function selectRandom(items: string[], count: number, seed?: string): SelectorResult;
|
|
408
|
+
/**
|
|
409
|
+
* Pick a single item at `divisor % items.length`. Non-numeric `divisor`
|
|
410
|
+
* falls back to index 0. Caller is responsible for resolving any
|
|
411
|
+
* `{NodeLabel}` template refs in `divisor` BEFORE calling this — see
|
|
412
|
+
* `resolveSelectorRefs`.
|
|
413
|
+
*/
|
|
414
|
+
declare function selectByModulo(items: string[], divisor: string | undefined): SelectorResult;
|
|
415
|
+
/**
|
|
416
|
+
* Pick items whose parsed JSON satisfies the predicate. `match: "first"`
|
|
417
|
+
* (default) stops at the first hit; `"all"` collects every hit.
|
|
418
|
+
*
|
|
419
|
+
* Reuses the filter-list condition evaluator so operator semantics
|
|
420
|
+
* (numeric coercion on `=`/`!=`, locale-aware ordering, case-sensitive
|
|
421
|
+
* text ops) stay identical to the Filter List node.
|
|
422
|
+
*/
|
|
423
|
+
declare function selectByPredicate(items: string[], config: SelectorConfig): SelectorResult;
|
|
424
|
+
/**
|
|
425
|
+
* Shortcut for `predicate(op="=", match="first")` — pick the first item
|
|
426
|
+
* whose `field` strictly equals `value`. Implemented as a thin wrapper
|
|
427
|
+
* so the UI can offer a 2-field form ("look up by name") instead of the
|
|
428
|
+
* full 4-field predicate form.
|
|
429
|
+
*/
|
|
430
|
+
declare function selectByNamedKey(items: string[], field: string | undefined, value: string | undefined): SelectorResult;
|
|
431
|
+
/**
|
|
432
|
+
* Returns a new SelectorConfig with `{NodeLabel}` refs and `{{trigger.*}}` /
|
|
433
|
+
* `{{now}}` / `{{last_N_*:N}}` template tokens resolved in the four
|
|
434
|
+
* template-aware fields: moduloDivisor, predicateValue, namedKeyValue, seed.
|
|
435
|
+
* All other fields are passed through unchanged. Callers must build
|
|
436
|
+
* `variables` via `buildConditionVariables` (or equivalent) BEFORE calling.
|
|
437
|
+
*
|
|
438
|
+
* Other selector fields (itemIndex, range/list expressions, randomCount, etc.)
|
|
439
|
+
* are treated as literals — they have their own selector-lib syntax and are
|
|
440
|
+
* not resolved against the variable space.
|
|
441
|
+
*
|
|
442
|
+
* Token resolution matches `resolveConditionValue` exactly (both reuse
|
|
443
|
+
* `substituteTriggerTokens`) so the selector's `{{trigger.foo}}` semantics
|
|
444
|
+
* stay in lockstep with filter-list / router conditions.
|
|
445
|
+
*
|
|
446
|
+
* Pure: returns a new object; the input config is not mutated.
|
|
447
|
+
*/
|
|
448
|
+
declare function resolveSelectorRefs(config: SelectorConfig, triggerData: Record<string, unknown> | undefined, variables: ReadonlyMap<string, string>): SelectorConfig;
|
|
449
|
+
|
|
450
|
+
/** AI generation node types that support repeat-N execution.
|
|
451
|
+
* Excludes deterministic nodes, FFmpeg, social, render, and utility nodes. */
|
|
452
|
+
declare const REPEATABLE_NODE_TYPES: Set<string>;
|
|
453
|
+
/** Sentinel value used as list item for repeat-only execution (no list fan-out input).
|
|
454
|
+
* executeNodeForList skips the overridePrompt/overrideMediaUrl when it sees this. */
|
|
455
|
+
declare const REPEAT_PLACEHOLDER = "__repeat__";
|
|
456
|
+
/** Sentinel prefix for per-iteration provider override.
|
|
457
|
+
* An item like `__provider:nano-banana__` tells executeNodeForList to clone the
|
|
458
|
+
* node with `data.provider = "nano-banana"` for that iteration and otherwise
|
|
459
|
+
* behave like REPEAT_PLACEHOLDER (no prompt/media override). */
|
|
460
|
+
declare const PROVIDER_PLACEHOLDER_PREFIX = "__provider:";
|
|
461
|
+
declare function encodeProviderItem(provider: string): string;
|
|
462
|
+
declare function decodeProviderItem(item: string): string | undefined;
|
|
463
|
+
/** Read repeatCount from node data, clamped to 1-20. Returns 1 if unset/invalid. */
|
|
464
|
+
declare function getEffectiveRepeatCount(nodeData: Record<string, unknown>): number;
|
|
465
|
+
/**
|
|
466
|
+
* Expand list items by repeatCount, or create synthetic repeat / provider items.
|
|
467
|
+
*
|
|
468
|
+
* Resolution order:
|
|
469
|
+
* 1. If an upstream list exists, the list drives expansion (repeatCount multiplies).
|
|
470
|
+
* 2. Else if `data.providers` has 2+ entries, emit `providers.length × repeatCount`
|
|
471
|
+
* items — each provider runs `repeatCount` times consecutively.
|
|
472
|
+
* 3. Else if repeatCount > 1, emit `repeatCount` synthetic items.
|
|
473
|
+
* 4. Otherwise return null — single execution, no fan-out.
|
|
474
|
+
*/
|
|
475
|
+
declare function expandItemsWithRepeat(listItems: string[] | undefined, nodeType: string, nodeData: Record<string, unknown>): string[] | null;
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* The text LANES the input resolvers route somewhere OTHER than the prompt slot
|
|
479
|
+
* (`negative` → negativePrompt, `system-prompt` → systemPrompt, an avatar's
|
|
480
|
+
* `script`, an editor's `transcript`, …). A list that drives a fan-out through
|
|
481
|
+
* one of these must NOT also be written into the prompt: the per-row resolution
|
|
482
|
+
* already delivered it where it belongs.
|
|
483
|
+
*
|
|
484
|
+
* Keyed by handle, scoped by node type, because the routers are: `transcript`
|
|
485
|
+
* is the caption track of Add Captions but the very text Forced Alignment
|
|
486
|
+
* aligns. `"*"` = every node type (the router branch is unconditional).
|
|
487
|
+
*
|
|
488
|
+
* DERIVED, not remembered: each engine has a totality test
|
|
489
|
+
* (`fanout-text-handle-totality`) that routes a text source into EVERY input
|
|
490
|
+
* handle of EVERY node type through the real resolver and fails the build on any
|
|
491
|
+
* pair where this table and the router disagree — in either direction. An
|
|
492
|
+
* unlisted lane keeps the old behavior (the item is the prompt), so a miss can
|
|
493
|
+
* only ever reproduce the old bug on that one lane, never a new one.
|
|
494
|
+
*/
|
|
495
|
+
declare const NON_PROMPT_TEXT_LANES: Readonly<Record<string, "*" | readonly string[]>>;
|
|
496
|
+
/** Does a TEXT list wired to `targetHandle` of a `nodeType` node feed its prompt slot? */
|
|
497
|
+
declare function fanOutTextFeedsPrompt(nodeType: string | null | undefined, targetHandle: string | null | undefined): boolean;
|
|
498
|
+
/**
|
|
499
|
+
* Drop the empty entries of a row-aligned list, remembering the row every kept
|
|
500
|
+
* value came from. The items are what drives a fan-out (nothing runs for an
|
|
501
|
+
* empty cell); the rows are what keeps the OTHER wires on the same row.
|
|
502
|
+
*/
|
|
503
|
+
declare function compactWithRows(aligned: readonly string[]): {
|
|
504
|
+
items: string[];
|
|
505
|
+
rowIndices: number[];
|
|
506
|
+
};
|
|
507
|
+
/** What a wire reads off a list with holes when it reads ONE value (`pickHeldRow`). */
|
|
508
|
+
type HeldRowPick =
|
|
509
|
+
/** This read is not one the holes change: the engine's own rule stands. */
|
|
510
|
+
{
|
|
511
|
+
readonly kind: "unaffected";
|
|
512
|
+
}
|
|
513
|
+
/** The wire carries this value. */
|
|
514
|
+
| {
|
|
515
|
+
readonly kind: "value";
|
|
516
|
+
readonly value: string;
|
|
517
|
+
}
|
|
518
|
+
/** The wire carries nothing (no scalar fallback). */
|
|
519
|
+
| {
|
|
520
|
+
readonly kind: "none";
|
|
521
|
+
};
|
|
522
|
+
/**
|
|
523
|
+
* One value off a ROW-ALIGNED list whose empty rows mean "nothing here" (an
|
|
524
|
+
* Edit Plan's clips as a person's review leaves them: the plan's rows, "" at
|
|
525
|
+
* every dropped clip), for a wire that does not iterate it.
|
|
526
|
+
*
|
|
527
|
+
* Without this, both engines fall back to the source's scalar output (the
|
|
528
|
+
* FIRST kept row of the whole list) whenever the wire's own pick is empty, so
|
|
529
|
+
* a wire could carry a row it never selected:
|
|
530
|
+
* - an Each wire with a range / list selector, outside its fan-out (the
|
|
531
|
+
* selection holds one kept row, or none, so nothing fans out): the first
|
|
532
|
+
* kept row OF THE SELECTION, or nothing when it holds none;
|
|
533
|
+
* - an item pick (`item` / `item:N`), in a fan-out or not: the picked row, or
|
|
534
|
+
* nothing when it is empty.
|
|
535
|
+
* Every other read is `unaffected`: a default Each wire (its scalar IS the
|
|
536
|
+
* first kept row), Selected (`last`), Bundle (`all`), an Each wire inside its
|
|
537
|
+
* fan-out (the iteration reads its own row, and an empty row runs nothing),
|
|
538
|
+
* and an empty list. Both engines call this, so they cannot disagree.
|
|
539
|
+
*/
|
|
540
|
+
declare function pickHeldRow(rows: readonly string[], edge: (SelectorFields & {
|
|
541
|
+
outputMode?: string;
|
|
542
|
+
itemIndex?: string;
|
|
543
|
+
}) | undefined, iterating: boolean): HeldRowPick;
|
|
544
|
+
/**
|
|
545
|
+
* One column of a manual List table, row-aligned: a row is dropped only when
|
|
546
|
+
* EVERY cell of it is blank (the trailing empty row the editor keeps), and an
|
|
547
|
+
* empty cell of a row that has content stays in place as "".
|
|
548
|
+
*/
|
|
549
|
+
declare function liveRowColumn(rows: ReadonlyArray<ReadonlyArray<string | undefined>>, colIndex: number): string[];
|
|
550
|
+
/** One list wire that could drive a fan-out. */
|
|
551
|
+
interface FanOutCandidate {
|
|
552
|
+
/** Target handle of the consumer-side wire. */
|
|
553
|
+
targetHandle: string | null | undefined;
|
|
554
|
+
/** The wire's values in row order — may hold "" for an empty row. */
|
|
555
|
+
aligned: readonly string[];
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Turn the lists that reach a node into ONE fan-out, so that nothing depends on
|
|
559
|
+
* the order the wires were drawn in. `candidates` are the "each" lists that hold
|
|
560
|
+
* more than one value, in wire order.
|
|
561
|
+
*
|
|
562
|
+
* The PRIMARY is the list that holds the most values (the first of them when
|
|
563
|
+
* several tie): it sets the row space. Both engines get it from here, so the
|
|
564
|
+
* orchestrator and the in-browser executor cannot disagree on how many times a
|
|
565
|
+
* node runs. Lists with the SAME number of rows share that row space — two
|
|
566
|
+
* columns of one table, two Extract Field lists cut from one array — and are
|
|
567
|
+
* settled together:
|
|
568
|
+
*
|
|
569
|
+
* - the DRIVER (its item becomes the per-row override) is a text list that
|
|
570
|
+
* feeds the prompt, when there is one: that item is what must win over the
|
|
571
|
+
* typed prompt, and a list wired to `negative` must never supply it;
|
|
572
|
+
* - a ROW runs when ANY of those lists has a value in it. A row is never
|
|
573
|
+
* dropped because one column is empty there — that column just contributes
|
|
574
|
+
* nothing for the row — and a row with no value anywhere does not run.
|
|
575
|
+
*
|
|
576
|
+
* A list with a different number of rows is not part of this: it keeps
|
|
577
|
+
* wrapping around per iteration, as it always has.
|
|
578
|
+
*/
|
|
579
|
+
declare function resolveListFanOut<C extends FanOutCandidate>(candidates: readonly C[], nodeType: string | null | undefined): ListFanOut | undefined;
|
|
580
|
+
/**
|
|
581
|
+
* Is this fan-out item a media URL (as opposed to text)? The ONE guess both
|
|
582
|
+
* engines make when a list item has to be applied as an override — kept here so
|
|
583
|
+
* the backend worker and the in-browser executor cannot disagree on it.
|
|
584
|
+
*/
|
|
585
|
+
declare function isFanOutUrlItem(item: string): boolean;
|
|
586
|
+
/** Does a fan-out item that looks like a link stay TEXT on this lane (the item, not a media input)? */
|
|
587
|
+
declare function fanOutUrlItemIsText(nodeType: string | null | undefined, targetHandle: string | null | undefined): boolean;
|
|
588
|
+
/** What a fan-out source resolved to. */
|
|
589
|
+
interface ListFanOut {
|
|
590
|
+
/** The driving list's value for every row that runs — "" where the driver has
|
|
591
|
+
* none for a row another list keeps alive (nothing is overridden there). */
|
|
592
|
+
items: string[];
|
|
593
|
+
/** `rowIndices[k]` = the row `items[k]` came from, in the driver's row space. */
|
|
594
|
+
rowIndices: number[];
|
|
595
|
+
/** Target handle of the consumer-side wire that drives the fan-out. */
|
|
596
|
+
targetHandle: string | null | undefined;
|
|
597
|
+
}
|
|
598
|
+
/** The iterations a node will run, in order. */
|
|
599
|
+
interface FanOutPlan {
|
|
600
|
+
/** One entry per iteration (list items, repeat / provider sentinels). */
|
|
601
|
+
items: string[];
|
|
602
|
+
/** Row each iteration reads its inputs from; undefined when nothing is list-driven. */
|
|
603
|
+
rows: Array<number | undefined>;
|
|
604
|
+
/** Handle the driving list is wired to; undefined when nothing is list-driven. */
|
|
605
|
+
targetHandle: string | null | undefined;
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Expand a fan-out into its iterations (list x Repeat xN, providers, repeats —
|
|
609
|
+
* `expandItemsWithRepeat` stays the single rule for that) and pin every
|
|
610
|
+
* iteration to the ROW its item came from. Repeat xN runs a row N times: the
|
|
611
|
+
* copies share the row, they do not walk on to the next one.
|
|
612
|
+
*/
|
|
613
|
+
declare function planFanOut(fanOut: ListFanOut | undefined, nodeType: string, nodeData: Record<string, unknown>): FanOutPlan | null;
|
|
614
|
+
/**
|
|
615
|
+
* Extract Field, List output, over a root ARRAY: one entry per element, "" where
|
|
616
|
+
* the element has no value — so two Extract Field lists cut from the same array
|
|
617
|
+
* stay row-aligned. Returns undefined when rows cannot be defined (the root is
|
|
618
|
+
* not an array, an element fans into several values, or no element carries the
|
|
619
|
+
* field at all) — the caller then keeps the plain "values that exist" list.
|
|
620
|
+
*/
|
|
621
|
+
declare function alignedFieldList(value: unknown, path: string): string[] | undefined;
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Like Promise.allSettled but limits how many tasks run concurrently.
|
|
625
|
+
* Uses a worker-pool pattern so a new task starts as soon as a slot frees up.
|
|
626
|
+
* When `cancelledRef` is provided and becomes truthy, remaining un-started
|
|
627
|
+
* tasks are skipped (already-running tasks continue to completion/rejection).
|
|
628
|
+
*/
|
|
629
|
+
declare function settledWithLimit<T>(tasks: (() => Promise<T>)[], limit: number, cancelledRef?: {
|
|
630
|
+
cancelled: boolean;
|
|
631
|
+
}): Promise<PromiseSettledResult<T>[]>;
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* Sentinel value persisted by the "None" delimiter option in the UI. Distinct
|
|
635
|
+
* from `undefined` (which means "default to newline") so we can tell the
|
|
636
|
+
* difference between "user actively chose not to split" and "field never set".
|
|
637
|
+
*/
|
|
638
|
+
declare const NO_SPLIT_DELIMITER: "__none__";
|
|
639
|
+
/**
|
|
640
|
+
* Split text using a loop node's column delimiter.
|
|
641
|
+
*
|
|
642
|
+
* Uses the first text-type column's `splitDelimiter` to determine
|
|
643
|
+
* how to split upstream text. Falls back to newline when no delimiter
|
|
644
|
+
* is configured. The "first text column wins" heuristic is intentional:
|
|
645
|
+
* connected mode pipes a single text stream into the loop, so we use
|
|
646
|
+
* the primary text column's delimiter as the split strategy.
|
|
647
|
+
*
|
|
648
|
+
* `splitDelimiter === NO_SPLIT_DELIMITER` ("__none__") returns the input as
|
|
649
|
+
* a single-item array — the user explicitly opted out of splitting.
|
|
650
|
+
*/
|
|
651
|
+
declare function splitByLoopDelimiter(text: string, columns: ReadonlyArray<{
|
|
652
|
+
type?: string;
|
|
653
|
+
splitDelimiter?: string;
|
|
654
|
+
}> | undefined): string[];
|
|
655
|
+
/**
|
|
656
|
+
* Split pasted (or manually-triggered) text into rows, inserting below
|
|
657
|
+
* the source row. Returns the new rows array and truncation metadata.
|
|
658
|
+
*
|
|
659
|
+
* Pure function — callers handle persisting the result and showing toasts.
|
|
660
|
+
*/
|
|
661
|
+
declare function spliceDelimitedRows(rows: readonly (readonly string[])[], rowIndex: number, colIndex: number, pastedText: string, delimiter: string, columnCount: number, maxItems: number): {
|
|
662
|
+
newRows: string[][];
|
|
663
|
+
truncated: boolean;
|
|
664
|
+
totalProduced: number;
|
|
665
|
+
};
|
|
666
|
+
|
|
667
|
+
/** Delimiter the Generate Text templates instruct the LLM to emit between blocks. */
|
|
668
|
+
declare const GENERATE_TEXT_DELIMITER = "===NEXT===";
|
|
669
|
+
/**
|
|
670
|
+
* Split a Generate Text result into fan-out items. Used by BOTH the frontend
|
|
671
|
+
* extractNodeOutput and the backend output-extractor so single-node and DAG
|
|
672
|
+
* execution produce identical `items`.
|
|
673
|
+
*/
|
|
674
|
+
declare function splitGeneratedItems(text: string | null | undefined): string[];
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* Shared separator presets for the Combine Text and Split Text nodes.
|
|
678
|
+
* Single source of truth for both the frontend DAG executor and backend orchestrator.
|
|
679
|
+
*/
|
|
680
|
+
declare const SEPARATOR_PRESETS: readonly ["newline", "double-newline", "comma", "space", "stars", "custom"];
|
|
681
|
+
type SeparatorPreset = (typeof SEPARATOR_PRESETS)[number];
|
|
682
|
+
/** Human-readable label for the node badge. */
|
|
683
|
+
declare const SEPARATOR_DISPLAY: Record<string, string>;
|
|
684
|
+
interface ResolveSeparatorOptions {
|
|
685
|
+
/** Use combine-text spacing — e.g. ", " for comma instead of "," */
|
|
686
|
+
combineSpacing?: boolean;
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Resolve a separator value to its actual string.
|
|
690
|
+
* - Enum preset → mapped value (e.g. "newline" → "\n")
|
|
691
|
+
* - "custom" → customSeparator field
|
|
692
|
+
* - Anything else → literal string (back-compat with legacy values like "===NEXT===")
|
|
693
|
+
*/
|
|
694
|
+
declare function resolveSeparator(raw: string | undefined, customSeparator: string | undefined, opts?: ResolveSeparatorOptions): string;
|
|
695
|
+
|
|
696
|
+
/** Pure sort helper shared by the frontend DAG executor and the backend
|
|
697
|
+
* orchestrator. Contract: reorder stringified list items (as produced by
|
|
698
|
+
* `collectUpstreamListItems` peers) by an optional dot-path field, with
|
|
699
|
+
* Auto/Text/Number/Date comparison and asc/desc direction. Items whose
|
|
700
|
+
* key is missing, empty, or uncoerceable under the chosen type are always
|
|
701
|
+
* appended last — regardless of direction. */
|
|
702
|
+
type SortType = "auto" | "text" | "number" | "date";
|
|
703
|
+
type SortDirection = "asc" | "desc";
|
|
704
|
+
interface SortListOptions {
|
|
705
|
+
field: string;
|
|
706
|
+
sortType: SortType;
|
|
707
|
+
direction: SortDirection;
|
|
708
|
+
}
|
|
709
|
+
declare function sortListItems(items: readonly string[], opts: SortListOptions): string[];
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* The node types the server projects onto `workflow_triggers` rows when a
|
|
713
|
+
* workflow is saved (backend `lib/workflow-trigger-sync.ts`), and that the
|
|
714
|
+
* editor therefore asks the server to re-project after its own saves. One
|
|
715
|
+
* vocabulary for both sides: a projected type added here reaches the
|
|
716
|
+
* editor's "does this save need a sync?" question by construction.
|
|
717
|
+
*/
|
|
718
|
+
declare const SCHEDULE_TRIGGER_NODE_TYPE = "schedule-trigger";
|
|
719
|
+
declare const WEBHOOK_TRIGGER_NODE_TYPE = "webhook-trigger";
|
|
720
|
+
declare const TELEGRAM_TRIGGER_NODE_TYPE = "telegram-trigger";
|
|
721
|
+
/** Fires on a message that reaches a Telegram account the owner connected (Cloud). */
|
|
722
|
+
declare const TELEGRAM_ACCOUNT_TRIGGER_NODE_TYPE = "telegram-account-trigger";
|
|
723
|
+
declare const PROJECTED_TRIGGER_NODE_TYPES: ReadonlySet<string>;
|
|
724
|
+
declare function isProjectedTriggerNodeType(type: unknown): type is string;
|
|
725
|
+
|
|
726
|
+
/**
|
|
727
|
+
* Every way one node FEEDS another — the ONE definition the server's run
|
|
728
|
+
* scope (`triggerRunScope`) and the editor's "is this trigger wired?" read
|
|
729
|
+
* from, so the card can never say "the branch" while the server runs the
|
|
730
|
+
* whole workflow, or the other way round:
|
|
731
|
+
*
|
|
732
|
+
* - a drawn edge whose two ends are both on the graph (a delta that deleted a
|
|
733
|
+
* node leaves its edges behind; those feed nothing);
|
|
734
|
+
* - Group membership: a node inside a Group feeds the group (`parentId`),
|
|
735
|
+
* the way the engine orders a group after its members;
|
|
736
|
+
* - a field mapping: `data.fieldMappings[field].sourceNodeId` feeds the node
|
|
737
|
+
* that carries the mapping, even after the edge it was made from is gone.
|
|
738
|
+
*/
|
|
739
|
+
interface FeedNode {
|
|
740
|
+
readonly id: string;
|
|
741
|
+
readonly parentId?: string | null;
|
|
742
|
+
readonly data?: unknown;
|
|
743
|
+
}
|
|
744
|
+
interface FeedEdge {
|
|
745
|
+
readonly source: string;
|
|
746
|
+
readonly target: string;
|
|
747
|
+
}
|
|
748
|
+
interface FeedMaps {
|
|
749
|
+
/** node id → the ids it feeds */
|
|
750
|
+
readonly children: ReadonlyMap<string, ReadonlyArray<string>>;
|
|
751
|
+
/** node id → the ids that feed it */
|
|
752
|
+
readonly parents: ReadonlyMap<string, ReadonlyArray<string>>;
|
|
753
|
+
}
|
|
754
|
+
declare function buildFeedMaps(nodes: ReadonlyArray<FeedNode>, edges: ReadonlyArray<FeedEdge>): FeedMaps;
|
|
755
|
+
/** Does this node feed anything? A trigger that does not runs the whole workflow. */
|
|
756
|
+
declare function nodeFeedsAnything(nodes: ReadonlyArray<FeedNode>, edges: ReadonlyArray<FeedEdge>, nodeId: string): boolean;
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* Schedule Trigger rules — the ONE model both sides read.
|
|
760
|
+
*
|
|
761
|
+
* A schedule is a list of rules; the workflow runs whenever any rule says
|
|
762
|
+
* "this minute". The editor previews a schedule (headline, today's timeline,
|
|
763
|
+
* the next runs, runs per day) and the server decides whether to fire — from
|
|
764
|
+
* the same functions here, so what the panel shows is what the cron does.
|
|
765
|
+
*
|
|
766
|
+
* Kinds, with the fields each reads (everything else on the rule is ignored):
|
|
767
|
+
* - `minutes` — `every` (1–59): at minute 0, N, 2N… of every hour (cron `*\/N`).
|
|
768
|
+
* - `hours` — `every` (1–23) at `minute`: at hour 0, N, 2N… of every day.
|
|
769
|
+
* - `days` — `every` (1–31) at `hour:minute`: every Nth calendar day.
|
|
770
|
+
* - `weeks` — `every` (1–52) on `weekdays` at `hour:minute`: every Nth week.
|
|
771
|
+
* - `months` — `every` (1–12) on `dayOfMonth` at `hour:minute`: every Nth month
|
|
772
|
+
* (a day the month lacks — 31 in April — runs on its last day).
|
|
773
|
+
* - `cron` — a 5-field cron expression, for the person who wants one.
|
|
774
|
+
*
|
|
775
|
+
* "Every Nth day / week / month" counts from a fixed origin (the Unix epoch,
|
|
776
|
+
* in the schedule's timezone; weeks start on Monday) rather than from the
|
|
777
|
+
* moment the rule was saved — so the preview and the server agree, a re-save
|
|
778
|
+
* never shifts the phase, and two people reading the rule get the same days.
|
|
779
|
+
*
|
|
780
|
+
* Time is read in the schedule's timezone (an IANA name; missing or unknown
|
|
781
|
+
* → UTC — callers validate with `isValidTimezone` and refuse the unknown
|
|
782
|
+
* ones, so that fallback is only ever a defence). Resolution is one minute:
|
|
783
|
+
* the cron ticks once a minute and asks "does this minute match?" — there is
|
|
784
|
+
* no sub-minute scheduling.
|
|
785
|
+
*
|
|
786
|
+
* Daylight-saving: a wall-clock minute that does not exist on the day the
|
|
787
|
+
* clocks jump forward is skipped that day. On the day they fall back, a rule
|
|
788
|
+
* that names a time of day (`hours` / `days` / `weeks` / `months` / `cron`)
|
|
789
|
+
* runs once — the second pass is the same wall-clock minute
|
|
790
|
+
* (`localMinuteKey`) as the fire just before it, and both the server and the
|
|
791
|
+
* preview drop it — while a `minutes` rule keeps its cadence through the
|
|
792
|
+
* repeated hour, because real time keeps passing.
|
|
793
|
+
*/
|
|
794
|
+
declare const SCHEDULE_RULE_KINDS: readonly ["minutes", "hours", "days", "weeks", "months", "cron"];
|
|
795
|
+
type ScheduleRuleKind = (typeof SCHEDULE_RULE_KINDS)[number];
|
|
796
|
+
interface ScheduleRule {
|
|
797
|
+
readonly id: string;
|
|
798
|
+
readonly kind: ScheduleRuleKind;
|
|
799
|
+
/** Every N units (see `SCHEDULE_EVERY_LIMITS`). */
|
|
800
|
+
readonly every?: number;
|
|
801
|
+
/** 0–23, in the schedule's timezone. Read by days / weeks / months. */
|
|
802
|
+
readonly hour?: number;
|
|
803
|
+
/** 0–59. Read by every kind but `minutes` and `cron`. */
|
|
804
|
+
readonly minute?: number;
|
|
805
|
+
/** 0 = Sunday … 6 = Saturday (the cron / JavaScript convention). Read by `weeks`. */
|
|
806
|
+
readonly weekdays?: ReadonlyArray<number>;
|
|
807
|
+
/** 1–31. Read by `months`. */
|
|
808
|
+
readonly dayOfMonth?: number;
|
|
809
|
+
/** A 5-field cron expression. Read by `cron`. */
|
|
810
|
+
readonly cron?: string;
|
|
811
|
+
}
|
|
812
|
+
interface ScheduleSpec {
|
|
813
|
+
readonly rules: ReadonlyArray<ScheduleRule>;
|
|
814
|
+
/** IANA timezone; missing or unknown means UTC. */
|
|
815
|
+
readonly timezone?: string;
|
|
816
|
+
/** Stop after this many runs; missing means unlimited. */
|
|
817
|
+
readonly maxExecutions?: number;
|
|
818
|
+
}
|
|
819
|
+
/** `every` limits per kind — the panel's range hints and the normaliser's clamps. */
|
|
820
|
+
declare const SCHEDULE_EVERY_LIMITS: Readonly<Record<Exclude<ScheduleRuleKind, "cron">, readonly [number, number]>>;
|
|
821
|
+
/** A 5-field cron expression — the only shape the matcher understands. */
|
|
822
|
+
declare function isCronExpression(value: unknown): value is string;
|
|
823
|
+
/**
|
|
824
|
+
* One rule as the user typed it → one rule the engine can run, or `null` when
|
|
825
|
+
* there is nothing to run (unknown kind, a cron rule with no expression, a
|
|
826
|
+
* weeks rule with no weekday). Out-of-range numbers are clamped, never
|
|
827
|
+
* refused: a half-typed "0" must not silently disable a schedule.
|
|
828
|
+
*/
|
|
829
|
+
declare function normalizeScheduleRule(raw: unknown, fallbackId?: string): ScheduleRule | null;
|
|
830
|
+
/** Every usable rule, in order; unusable ones dropped. */
|
|
831
|
+
declare function normalizeScheduleRules(raw: unknown): ScheduleRule[];
|
|
832
|
+
/**
|
|
833
|
+
* The schedule an OLD node carried — `interval` ("5m" / "1h" / "1d" or one of
|
|
834
|
+
* the editor's cron presets) and/or `cron` — as rules. Seconds cannot be
|
|
835
|
+
* scheduled (the cron ticks once a minute) and become "every minute".
|
|
836
|
+
*/
|
|
837
|
+
declare function legacyScheduleToRules(data: {
|
|
838
|
+
interval?: unknown;
|
|
839
|
+
cron?: unknown;
|
|
840
|
+
cronExpression?: unknown;
|
|
841
|
+
}): ScheduleRule[];
|
|
842
|
+
interface LocalTime {
|
|
843
|
+
readonly year: number;
|
|
844
|
+
/** 1–12 */
|
|
845
|
+
readonly month: number;
|
|
846
|
+
/** 1–31 */
|
|
847
|
+
readonly day: number;
|
|
848
|
+
readonly hour: number;
|
|
849
|
+
readonly minute: number;
|
|
850
|
+
/** 0 = Sunday … 6 = Saturday */
|
|
851
|
+
readonly weekday: number;
|
|
852
|
+
/** Calendar days since 1970-01-01, in the schedule's timezone. */
|
|
853
|
+
readonly epochDay: number;
|
|
854
|
+
}
|
|
855
|
+
/** A timezone this runtime can read the clock in (an IANA name such as `Asia/Jerusalem`). */
|
|
856
|
+
declare function isValidTimezone(value: unknown): value is string;
|
|
857
|
+
/** One wall-clock minute, as a key: the same key twice means the clocks fell back. */
|
|
858
|
+
declare function localMinuteKey(local: LocalTime): string;
|
|
859
|
+
/** The wall-clock time in the schedule's timezone (UTC when it is missing or unknown). */
|
|
860
|
+
declare function localTimeIn(date: Date, timezone?: string): LocalTime;
|
|
861
|
+
/** How far the timezone's wall clock is ahead of UTC at this instant, in minutes. */
|
|
862
|
+
declare function timezoneOffsetMinutes(date: Date, timezone?: string): number;
|
|
863
|
+
/** Standard 5-field cron field: `*`, `N`, `a-b`, `a,b`, `*\/N`, `a-b/N`, `a/N`. */
|
|
864
|
+
declare function matchesCronField(field: string, value: number, min: number, max: number): boolean;
|
|
865
|
+
/** Does this wall-clock minute match the cron expression? */
|
|
866
|
+
declare function matchesCron(expression: string, local: LocalTime): boolean;
|
|
867
|
+
/** Does this wall-clock minute match the rule? */
|
|
868
|
+
declare function ruleMatches(rule: ScheduleRule, local: LocalTime): boolean;
|
|
869
|
+
/** Does the schedule run at this instant (any rule, this minute)? */
|
|
870
|
+
declare function scheduleMatchesAt(spec: ScheduleSpec, at: Date): boolean;
|
|
871
|
+
/**
|
|
872
|
+
* Every minute in [from, until] at which the schedule runs, oldest first, at
|
|
873
|
+
* most `cap`. Scans minute by minute with the timezone offset re-read once per
|
|
874
|
+
* quarter hour, so a 62-day horizon costs ~90k cheap checks and ~6k clock
|
|
875
|
+
* reads. A wall-clock minute the clocks fall back onto is listed once.
|
|
876
|
+
*/
|
|
877
|
+
declare function scheduleOccurrences(spec: ScheduleSpec, from: Date, until: Date, cap: number): Date[];
|
|
878
|
+
/**
|
|
879
|
+
* How far ahead a preview must look to find the schedule's next run: two
|
|
880
|
+
* periods of its slowest rule (a quarterly rule needs half a year, a yearly
|
|
881
|
+
* one two), never less than two months and never more than ~two years.
|
|
882
|
+
*/
|
|
883
|
+
declare function previewHorizonMs(rules: ReadonlyArray<ScheduleRule>): number;
|
|
884
|
+
/**
|
|
885
|
+
* The next `count` runs strictly after `from` (the minute `from` is in does
|
|
886
|
+
* not count, the very next one does), looking `horizonMs` ahead — by default
|
|
887
|
+
* as far as the rules need (`previewHorizonMs`).
|
|
888
|
+
*/
|
|
889
|
+
declare function nextScheduleRuns(spec: ScheduleSpec, from: Date, count: number, horizonMs?: number): Date[];
|
|
890
|
+
|
|
891
|
+
/**
|
|
892
|
+
* Build a label→output map for `{Node Label}` refs inside condition values
|
|
893
|
+
* on filter-list and router nodes.
|
|
894
|
+
*
|
|
895
|
+
* Only considers edges whose `targetHandle === VARIABLES_HANDLE_ID` — the
|
|
896
|
+
* dedicated condition-variables input handle. Data-flow edges (targetHandle
|
|
897
|
+
* `"in"`, column handles, etc.) are ignored, so variable sources never
|
|
898
|
+
* influence the filtered/routed list.
|
|
899
|
+
*
|
|
900
|
+
* Duplicate labels are suffixed `Same`, `Same (2)`, `Same (3)` — matches
|
|
901
|
+
* the convention in `buildNodeRefMap` (frontend) / `buildNodeRefsMap`
|
|
902
|
+
* (backend) for text-prompt refs.
|
|
903
|
+
*/
|
|
904
|
+
declare const VARIABLES_HANDLE_ID = "variables";
|
|
905
|
+
type EdgeShape$1 = {
|
|
906
|
+
source: string;
|
|
907
|
+
target: string;
|
|
908
|
+
sourceHandle?: string | null;
|
|
909
|
+
targetHandle?: string | null;
|
|
910
|
+
};
|
|
911
|
+
type NodeShape$1 = {
|
|
912
|
+
id: string;
|
|
913
|
+
type?: string;
|
|
914
|
+
data: Record<string, unknown>;
|
|
915
|
+
};
|
|
916
|
+
declare function buildConditionVariables<E extends EdgeShape$1, N extends NodeShape$1>(targetNodeId: string, edges: ReadonlyArray<E>, nodes: ReadonlyArray<N>, extractOutput: (node: N) => string | undefined): Map<string, string>;
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* Helpers for reading a node's accumulated `generatedResults` array.
|
|
920
|
+
*
|
|
921
|
+
* Used by both frontend DAG executor (`node-input-resolver.ts`) and backend
|
|
922
|
+
* orchestrator (`output-extractor.ts`) so they agree on when a node has
|
|
923
|
+
* upstream-consumable output.
|
|
924
|
+
*/
|
|
925
|
+
/**
|
|
926
|
+
* Extract all output values from a node's accumulated generatedResults.
|
|
927
|
+
* Returns the full flat list (any length). Returns undefined only when empty.
|
|
928
|
+
*/
|
|
929
|
+
declare function extractAllGeneratedResults(data: Record<string, unknown>): string[] | undefined;
|
|
930
|
+
/**
|
|
931
|
+
* Extract a JSON array (e.g. web-scrape `generatedJson`) as a list of strings.
|
|
932
|
+
* Each array element is stringified; already-string elements pass through.
|
|
933
|
+
*/
|
|
934
|
+
declare function extractGeneratedJsonAsList(data: Record<string, unknown>): string[] | undefined;
|
|
935
|
+
/**
|
|
936
|
+
* If a collected item list has a single entry whose contents parse to a
|
|
937
|
+
* non-empty JSON array, spread the array's elements into separate items.
|
|
938
|
+
* Mirrors the `output.json` spread in the orchestrator so a list node with
|
|
939
|
+
* one row holding a JSON array feeds filter-list / deduplicate / sort-list /
|
|
940
|
+
* merge-lists per-element instead of as one giant stringified blob.
|
|
941
|
+
*/
|
|
942
|
+
declare function spreadJsonArrayIfSingleton(items: string[]): string[];
|
|
943
|
+
|
|
944
|
+
/** A live wire into a field's handle: which node, and which of its outputs. */
|
|
945
|
+
interface FieldEdgeSource {
|
|
946
|
+
readonly sourceNodeId: string;
|
|
947
|
+
readonly sourceHandle?: string | null;
|
|
948
|
+
}
|
|
949
|
+
/**
|
|
950
|
+
* Resolve fieldMappings + {} injection for all text fields on a node.
|
|
951
|
+
*
|
|
952
|
+
* Three resolution mechanisms, in precedence order per field:
|
|
953
|
+
* 1. edge source: a live edge into the field's handle → use that node's
|
|
954
|
+
* output. Prefix-agnostic — the caller decides which edges map to which
|
|
955
|
+
* field (e.g. FE/BE wrappers match `field-<key>` handles). Wins over both
|
|
956
|
+
* fieldMappings and {} injection.
|
|
957
|
+
* 2. fieldMappings: field mapped to source node → use that node's output
|
|
958
|
+
* 3. {} injection: manual field contains {} → replace with upstreamText
|
|
959
|
+
*
|
|
960
|
+
* Does NOT inject upstream into empty unmapped fields — that stays in
|
|
961
|
+
* per-node execution code (e.g., d.prompt || inputs.prompt).
|
|
962
|
+
*
|
|
963
|
+
* The `getSourceOutput` callback abstracts how source node output is
|
|
964
|
+
* extracted — frontend reads from live React Flow state, backend reads
|
|
965
|
+
* from NodeExecutionState.output. Same pattern as ancestor-refs.ts.
|
|
966
|
+
*
|
|
967
|
+
* `edgeSourceForField` is optional: when omitted, behaviour is identical to
|
|
968
|
+
* the prior fieldMappings-only resolver (existing callers stay valid). When
|
|
969
|
+
* it names the wire's source HANDLE too, the value is that handle's output —
|
|
970
|
+
* a Router's route, a trigger's named output — not the source's primary one.
|
|
971
|
+
*/
|
|
972
|
+
declare function resolveFieldMappings(data: Record<string, unknown>, upstreamText: string | undefined, mappableFieldNames: ReadonlyArray<string>, getSourceOutput: (sourceNodeId: string, sourceHandle?: string | null) => string | undefined, edgeSourceForField?: (field: string) => FieldEdgeSource | string | undefined): Record<string, unknown>;
|
|
973
|
+
interface LocationFieldEntry {
|
|
974
|
+
/** Stable key — `sourceImageUrl` or `<bucket>[<index>]`. */
|
|
975
|
+
key: string;
|
|
976
|
+
/** Human-readable label — `Main image` or `<bucket> / <variant.name>`. */
|
|
977
|
+
label: string;
|
|
978
|
+
/** R2 URL of the image. */
|
|
979
|
+
url: string;
|
|
980
|
+
}
|
|
981
|
+
/**
|
|
982
|
+
* Flatten a location's anchor image and every variant bucket into a single
|
|
983
|
+
* ordered list of `{ key, label, url }` entries. Used by picker UIs and
|
|
984
|
+
* ref-resolvers that need a stable, position-keyed view of every image
|
|
985
|
+
* attached to a location.
|
|
986
|
+
*
|
|
987
|
+
* Bucket iteration order is fixed (see `LOCATION_BUCKETS`) so frontend and
|
|
988
|
+
* backend produce identical lists from the same fixture. Missing buckets and
|
|
989
|
+
* non-array values are treated as empty — the helper never throws.
|
|
990
|
+
*
|
|
991
|
+
* Mirrors the future character/object variants of this helper; same shape
|
|
992
|
+
* (`key`, `label`, `url`) so callers can be polymorphic over entity kind.
|
|
993
|
+
*/
|
|
994
|
+
declare function resolveLocationFields(loc: Record<string, unknown>): LocationFieldEntry[];
|
|
995
|
+
|
|
996
|
+
/**
|
|
997
|
+
* Node reference pattern and resolution for {Node Label} template syntax.
|
|
998
|
+
* Shared between frontend and backend.
|
|
999
|
+
*/
|
|
1000
|
+
/** Matches {Node Label} references in text. */
|
|
1001
|
+
declare const NODE_REF_PATTERN: RegExp;
|
|
1002
|
+
/** Reserved template variable names that should NOT be resolved as node refs */
|
|
1003
|
+
declare const RESERVED_TEMPLATE_VARS: Set<string>;
|
|
1004
|
+
/**
|
|
1005
|
+
* Split a `{...}` token body into its node name and optional fallback. Splits on the FIRST `||`
|
|
1006
|
+
* (a fallback may itself contain `||`); both sides are trimmed. `fallback` is null when there is
|
|
1007
|
+
* no `||`, preserving the legacy "leave the literal token" behavior.
|
|
1008
|
+
* "person || man" -> { name: "person", fallback: "man" }
|
|
1009
|
+
* "person || " -> { name: "person", fallback: "" } (resolves to empty when absent)
|
|
1010
|
+
* "person" -> { name: "person", fallback: null } (literal {person} when absent)
|
|
1011
|
+
*/
|
|
1012
|
+
declare function parseNodeRef(raw: string): {
|
|
1013
|
+
name: string;
|
|
1014
|
+
fallback: string | null;
|
|
1015
|
+
};
|
|
1016
|
+
/**
|
|
1017
|
+
* Canonical form of a node-name variable: trimmed + lowercased. Node-name
|
|
1018
|
+
* variables are CASE-INSENSITIVE with lowercase as canonical, so nodes labeled
|
|
1019
|
+
* `TEXt`, `TEXT`, `text` all feed the one `{text}` variable and `{TEXT}` /
|
|
1020
|
+
* `{Text}` / `{text}` in a prompt all resolve to it.
|
|
1021
|
+
*
|
|
1022
|
+
* Reserved template vars (RESERVED_TEMPLATE_VARS, e.g. `userPrompt`) are matched
|
|
1023
|
+
* case-sensitively on the ORIGINAL token BEFORE canonicalization, so `{userPrompt}`
|
|
1024
|
+
* stays a reserved token rather than becoming a `userprompt` node ref.
|
|
1025
|
+
*/
|
|
1026
|
+
declare function canonicalVarName(label: string): string;
|
|
1027
|
+
/**
|
|
1028
|
+
* The distinct `{label}` names referenced across the given texts. Mirrors the
|
|
1029
|
+
* canvas-side `referencedRefs`: strips the `|| fallback`, and ignores empty
|
|
1030
|
+
* tokens, image-ref tokens (`{image:N}`), and RESERVED_TEMPLATE_VARS. Used to
|
|
1031
|
+
* SUPPRESS auto-injection of a connected node the author already placed
|
|
1032
|
+
* explicitly via `{label}` (so it isn't injected twice). `matchAll` over the
|
|
1033
|
+
* global pattern does not mutate its lastIndex, so sharing the constant is safe.
|
|
1034
|
+
*
|
|
1035
|
+
* Deliberately NOT `REF_TOKEN_NAMESPACE_PREFIXES`: widening this changes
|
|
1036
|
+
* run-time auto-injection on BOTH engines (follow-up ticket), not just the
|
|
1037
|
+
* editor.
|
|
1038
|
+
*/
|
|
1039
|
+
declare function extractReferencedLabels(...texts: ReadonlyArray<string | undefined | null>): Set<string>;
|
|
1040
|
+
/** Handle → combine-order category for same-label `{label}` merging. Lower wins
|
|
1041
|
+
* first: prompt (0) → elements (1) → look family (2). Other handles are -1
|
|
1042
|
+
* (not combinable — they keep the per-engine last-wins/suffix behavior). */
|
|
1043
|
+
declare const REF_HANDLE_CATEGORY: Readonly<Record<string, number>>;
|
|
1044
|
+
/** Combine-order category for a direct-parent edge's `targetHandle`; -1 when the
|
|
1045
|
+
* handle isn't one of the combinable prompt/elements/look handles. */
|
|
1046
|
+
declare function refHandleCategory(targetHandle: string | null | undefined): number;
|
|
1047
|
+
/**
|
|
1048
|
+
* Reference-handle id → resolved-input key. The SINGLE SOURCE OF TRUTH for which
|
|
1049
|
+
* `targetHandle` ids carry image / video / audio reference inputs. Shared by the
|
|
1050
|
+
* backend input-resolver (routes the wired URL into the matching
|
|
1051
|
+
* `referenceImageUrls` / `referenceVideoUrls` / `referenceAudioUrls` slot) AND
|
|
1052
|
+
* the positional `{image:N}` / `{video:N}` / `{audio:N}` body-token COUNTS in the
|
|
1053
|
+
* FE preview (`video-prompt-assembly.ts`), FE run (`execute-node.ts`), and BE
|
|
1054
|
+
* payload-builder.
|
|
1055
|
+
*
|
|
1056
|
+
* Two handle families map to the same keys:
|
|
1057
|
+
* - Legacy / i2v single-name ids (`references` / `reference-videos` /
|
|
1058
|
+
* `reference-audio`) — kept for un-migrated workflows.
|
|
1059
|
+
* - Canonical typed-handle ids the modern Generate Video node exposes
|
|
1060
|
+
* (`imageReferences` / `videoReferences` / `audioReferences`) — share the
|
|
1061
|
+
* resolved-input keys with the legacy ids so consumer code never forks.
|
|
1062
|
+
*/
|
|
1063
|
+
declare const REFERENCE_HANDLE_MAP: Record<string, "referenceImageUrls" | "referenceVideoUrls" | "referenceAudioUrls">;
|
|
1064
|
+
/** The three reference modalities a reference handle can carry. */
|
|
1065
|
+
type ReferenceModality = "image" | "video" | "audio";
|
|
1066
|
+
/**
|
|
1067
|
+
* The reference MODALITY a `targetHandle` carries, or null when the handle is
|
|
1068
|
+
* not a reference handle. Resolves BOTH the legacy single-name ids and the
|
|
1069
|
+
* canonical Generate Video ids (via REFERENCE_HANDLE_MAP), so positional
|
|
1070
|
+
* `{image:N}` / `{video:N}` / `{audio:N}` token counts cover every handle alias
|
|
1071
|
+
* — without this, the generate-video `imageReferences` handle was silently
|
|
1072
|
+
* uncounted and `{image:N}` tokens dropped to bare labels on the only creatable
|
|
1073
|
+
* video node.
|
|
1074
|
+
*/
|
|
1075
|
+
declare function referenceModalityForHandle(targetHandle: string | null | undefined): ReferenceModality | null;
|
|
1076
|
+
/**
|
|
1077
|
+
* Frame target handles (start / end keyframes). An image wired into one of these
|
|
1078
|
+
* is a KEYFRAME, not an `{image:N}` reference: the backend appends frames at the
|
|
1079
|
+
* TAIL of `reference_image_urls` (`resolveSeedance2Inputs`), never numbered. The
|
|
1080
|
+
* editor MUST therefore exclude them from `{image:N}` numbering so editor token N
|
|
1081
|
+
* equals the worker reference slot N.
|
|
1082
|
+
*
|
|
1083
|
+
* The SINGLE source of truth for "is this a frame handle," shared by the
|
|
1084
|
+
* config-panel autocomplete (`video-configs.tsx`) AND the inline/modal builder
|
|
1085
|
+
* (`connected-references.ts`) — without ONE definition those two surfaces drifted
|
|
1086
|
+
* and the inline editor numbered the frame as `{image:1}` (the C1 bug). Frames
|
|
1087
|
+
* are deliberately NOT in `REFERENCE_HANDLE_MAP`: they carry no reference
|
|
1088
|
+
* modality, so `referenceModalityForHandle` already returns `null` for them on
|
|
1089
|
+
* the count side — this set is the exclusion lever for the EDITOR-numbering side.
|
|
1090
|
+
*/
|
|
1091
|
+
declare const FRAME_TARGET_HANDLES: ReadonlySet<string>;
|
|
1092
|
+
/**
|
|
1093
|
+
* Minimal structural edge shape {@link countRefModalityEdges} reads — only the
|
|
1094
|
+
* two fields the count needs. Both the FE `WorkflowEdge` (xyflow `Edge`, whose
|
|
1095
|
+
* `target` is a non-null string) and the BE `SimpleEdge` satisfy it.
|
|
1096
|
+
*/
|
|
1097
|
+
interface RefModalityEdge {
|
|
1098
|
+
target?: string | null;
|
|
1099
|
+
targetHandle?: string | null;
|
|
1100
|
+
}
|
|
1101
|
+
/**
|
|
1102
|
+
* Count the reference-handle edges of a given reference MODALITY wired into a
|
|
1103
|
+
* node — the ONE positional `{image:N}` / `{video:N}` / `{audio:N}` counter
|
|
1104
|
+
* shared by the FE preview (`video-prompt-assembly.ts`), the FE run
|
|
1105
|
+
* (`execute-node.ts`), and the BE orchestrator (`payload-builder.ts`). Counting
|
|
1106
|
+
* via `referenceModalityForHandle` (not a single handle string) covers BOTH the
|
|
1107
|
+
* legacy single-name ids (`references` / `reference-videos` / `reference-audio`)
|
|
1108
|
+
* AND the canonical Generate Video ids (`imageReferences` / `videoReferences` /
|
|
1109
|
+
* `audioReferences`), so editor token N maps 1:1 to the worker
|
|
1110
|
+
* `referenceImageUrls` / `referenceVideoUrls` / `referenceAudioUrls` slot N on
|
|
1111
|
+
* every handle alias. This is the EDGE count (not the resolved/list-expanded URL
|
|
1112
|
+
* count) so all three paths stay byte-identical; the edge-vs-resolved divergence
|
|
1113
|
+
* for a reference edge that fans out to >1 URL (a List producer) is a shared,
|
|
1114
|
+
* documented v1 limitation.
|
|
1115
|
+
*/
|
|
1116
|
+
declare function countRefModalityEdges(edges: ReadonlyArray<RefModalityEdge>, nodeId: string, modality: ReferenceModality): number;
|
|
1117
|
+
/** A candidate contribution to the `{label}` map: the node's label, its resolved
|
|
1118
|
+
* output, and its direct-parent handle category (-1 = not combinable / deeper). */
|
|
1119
|
+
interface RefCandidate {
|
|
1120
|
+
label: string;
|
|
1121
|
+
output: string;
|
|
1122
|
+
category: number;
|
|
1123
|
+
}
|
|
1124
|
+
/**
|
|
1125
|
+
* Same-label COMBINE: when ≥2 direct-parent candidates (category ≥ 0) share a
|
|
1126
|
+
* label, `{label}` resolves to their values joined by ", " ordered prompt →
|
|
1127
|
+
* elements → look, and within a category by candidate (edge) order. Returns a
|
|
1128
|
+
* Map of ONLY the combined labels; the caller fills the rest with its own
|
|
1129
|
+
* (FE suffix / BE last-wins) logic, skipping any label present here. Shared so
|
|
1130
|
+
* the frontend executor and backend orchestrator never drift.
|
|
1131
|
+
*/
|
|
1132
|
+
declare function combineSameLabelRefs(candidates: ReadonlyArray<RefCandidate>): Map<string, string>;
|
|
1133
|
+
/**
|
|
1134
|
+
* Resolve {Node Label} references in text by replacing them with actual node outputs.
|
|
1135
|
+
* Skips reserved template variables used by applyTemplate().
|
|
1136
|
+
* Iterates until stable to handle nested refs (e.g. {List} → {Animal1} → "dog").
|
|
1137
|
+
*/
|
|
1138
|
+
declare function resolveNodeRefs(text: string, labelToOutput: ReadonlyMap<string, string>): string;
|
|
1139
|
+
/**
|
|
1140
|
+
* Token namespaces that are NOT node-label references. `{image:1:face}` is the
|
|
1141
|
+
* unified-reference grammar, `{slot:x}` is recast's, `{video:N}`/`{audio:N}`
|
|
1142
|
+
* are reference handles, and `{ref:<id>}` is the id-addressed reference form —
|
|
1143
|
+
* all five are substituted by their own resolvers (`resolveReferenceTokens`,
|
|
1144
|
+
* `resolveRefIdTokens`, the recast slot pass), not by resolveNodeRefs. Before
|
|
1145
|
+
* this list existed, only `image:` was excluded, so `{video:1}` classified as a
|
|
1146
|
+
* MISSING node ref.
|
|
1147
|
+
*
|
|
1148
|
+
* Compared against the LOWERCASED token name: `REFERENCE_TOKEN_RE` is `/gi` and
|
|
1149
|
+
* `REF_ID_TOKEN_RE` spells `[rR][eE][fF]`, so `{Image:1}` / `{Ref:x}` really do
|
|
1150
|
+
* resolve downstream and must never read as a missing node ref.
|
|
1151
|
+
*/
|
|
1152
|
+
declare const REF_TOKEN_NAMESPACE_PREFIXES: readonly string[];
|
|
1153
|
+
type RefTokenKind = "wired" | "reserved" | "missing" | "skip" | "unknown";
|
|
1154
|
+
/**
|
|
1155
|
+
* Classify a parsed `{...}` token name against the resolvable label set.
|
|
1156
|
+
* `resolvable === null` means the caller has no ref data at all — such tokens
|
|
1157
|
+
* classify `unknown` and must render like wired, so "no data" never
|
|
1158
|
+
* masquerades as "nothing wired".
|
|
1159
|
+
*
|
|
1160
|
+
* Single source of truth for the editor decoration, the missing-refs chip
|
|
1161
|
+
* (frontend/src/lib/prompt-ref-scan.ts delegates here) and the execution
|
|
1162
|
+
* engine's dispatch guard.
|
|
1163
|
+
*/
|
|
1164
|
+
declare function classifyRefToken(name: string, resolvable: ReadonlySet<string> | null): RefTokenKind;
|
|
1165
|
+
/**
|
|
1166
|
+
* The `{Label}` tokens in `text` that `resolveNodeRefs` would leave LITERAL and
|
|
1167
|
+
* that no upstream node can explain — i.e. exactly what would reach a provider
|
|
1168
|
+
* as the characters `{Label}`. Evidence for why this matters: `{Describe Image}`
|
|
1169
|
+
* ×2 (gpt-image-2) and `{gravity flip}` / `{rewind}` (seedance-2-5) in the
|
|
1170
|
+
* 2026-09-01 app-reports export.
|
|
1171
|
+
*
|
|
1172
|
+
* `resolvable` — labels with a value in the ref map (canonical/lowercase).
|
|
1173
|
+
* `known` — canonical labels of the nodes the caller considers to EXIST
|
|
1174
|
+
* (no state requirement; the backend passes every node in the
|
|
1175
|
+
* run's graph).
|
|
1176
|
+
*
|
|
1177
|
+
* A token whose label is in `known` but not `resolvable` PASSES: the node
|
|
1178
|
+
* exists and simply produced nothing, which is the caller's to substitute (the
|
|
1179
|
+
* backend resolves it to empty text), not this function's to refuse. A token
|
|
1180
|
+
* with an explicit `|| fallback` passes too — the fallback is substituted.
|
|
1181
|
+
* Returns original-cased names, de-duplicated by canonical form, for the
|
|
1182
|
+
* user-facing message.
|
|
1183
|
+
*/
|
|
1184
|
+
declare function unresolvedRefTokens(text: string, opts: {
|
|
1185
|
+
resolvable: ReadonlySet<string>;
|
|
1186
|
+
known: ReadonlySet<string>;
|
|
1187
|
+
}): string[];
|
|
1188
|
+
|
|
1189
|
+
/**
|
|
1190
|
+
* Follow a list node's `in` edge chain to its effective upstream source.
|
|
1191
|
+
*
|
|
1192
|
+
* When a `list` node has no manual rows but an incoming connection, the UI
|
|
1193
|
+
* renders its upstream's items (see list-node.tsx's `connectedItems ??
|
|
1194
|
+
* staticItems`). Without this helper, downstream readers would see an empty
|
|
1195
|
+
* list because `extractSourceNodeOutput` for `list` only reads `data.rows`.
|
|
1196
|
+
*
|
|
1197
|
+
* Shared between the frontend DAG executor (`node-input-resolver.ts`) and
|
|
1198
|
+
* the backend orchestrator (`inline-executor.ts`) so both paths resolve
|
|
1199
|
+
* list-connected-mode identically.
|
|
1200
|
+
*/
|
|
1201
|
+
type EdgeShape = {
|
|
1202
|
+
source: string;
|
|
1203
|
+
target: string;
|
|
1204
|
+
sourceHandle?: string | null;
|
|
1205
|
+
targetHandle?: string | null;
|
|
1206
|
+
};
|
|
1207
|
+
type NodeShape = {
|
|
1208
|
+
id: string;
|
|
1209
|
+
type?: string;
|
|
1210
|
+
data: Record<string, unknown>;
|
|
1211
|
+
};
|
|
1212
|
+
declare function resolveSourceThroughConnectedList<E extends EdgeShape, N extends NodeShape>(edge: E, nodes: ReadonlyArray<N>, edges: ReadonlyArray<E>): E;
|
|
1213
|
+
|
|
1214
|
+
/**
|
|
1215
|
+
* Element-wise merge across upstream lists with modulo-wrap.
|
|
1216
|
+
*
|
|
1217
|
+
* Used by the `merge-lists` node's "zip" mode. Each output position i takes
|
|
1218
|
+
* `lists[j][i % lists[j].length]` from every input; JSON objects are spread
|
|
1219
|
+
* into a single object (later sources override earlier ones on key conflicts),
|
|
1220
|
+
* non-object items are stringified and concatenated.
|
|
1221
|
+
*
|
|
1222
|
+
* Length semantics mirror the DAG's existing fan-out behavior: the result
|
|
1223
|
+
* length equals `max(len)` across non-empty inputs. Shorter inputs cycle.
|
|
1224
|
+
* This means a single-item upstream (e.g. a JSON-process node emitting one
|
|
1225
|
+
* object, or a list with one row) is automatically injected into every
|
|
1226
|
+
* element of a longer list.
|
|
1227
|
+
*/
|
|
1228
|
+
declare function zipMergeLists(lists: ReadonlyArray<ReadonlyArray<string>>): string[];
|
|
1229
|
+
|
|
1230
|
+
/** A named media variant (expression, pose, angle, etc.) produced during entity generation. */
|
|
1231
|
+
interface AssetVariant {
|
|
1232
|
+
name: string;
|
|
1233
|
+
url: string;
|
|
1234
|
+
}
|
|
1235
|
+
/** A mood-board / scrap photo attached to a location ({@link WorkflowExportLocation.referencePhotos}). */
|
|
1236
|
+
interface ReferencePhoto {
|
|
1237
|
+
kind: string;
|
|
1238
|
+
url: string;
|
|
1239
|
+
}
|
|
1240
|
+
interface WorkflowExportCharacter {
|
|
1241
|
+
id: string;
|
|
1242
|
+
nodeId: string;
|
|
1243
|
+
name: string;
|
|
1244
|
+
description?: string | null;
|
|
1245
|
+
gender?: string | null;
|
|
1246
|
+
style?: string | null;
|
|
1247
|
+
baseOutfit?: string | null;
|
|
1248
|
+
sourceImageUrl?: string | null;
|
|
1249
|
+
expressions?: AssetVariant[];
|
|
1250
|
+
poses?: AssetVariant[];
|
|
1251
|
+
lightingVariations?: AssetVariant[];
|
|
1252
|
+
}
|
|
1253
|
+
interface WorkflowExportObject {
|
|
1254
|
+
id: string;
|
|
1255
|
+
nodeId: string;
|
|
1256
|
+
name: string;
|
|
1257
|
+
description?: string | null;
|
|
1258
|
+
style?: string | null;
|
|
1259
|
+
sourceImageUrl?: string | null;
|
|
1260
|
+
angles?: AssetVariant[];
|
|
1261
|
+
materials?: AssetVariant[];
|
|
1262
|
+
variations?: AssetVariant[];
|
|
1263
|
+
}
|
|
1264
|
+
/** Animal/Creature entity export shape. Structural clone of {@link WorkflowExportObject}
|
|
1265
|
+
* with the object→creature DELTA MAP: adds free-text `species`, and the `materials`
|
|
1266
|
+
* asset slot becomes `poses`. */
|
|
1267
|
+
interface WorkflowExportCreature {
|
|
1268
|
+
id: string;
|
|
1269
|
+
nodeId: string;
|
|
1270
|
+
name: string;
|
|
1271
|
+
description?: string | null;
|
|
1272
|
+
species?: string | null;
|
|
1273
|
+
style?: string | null;
|
|
1274
|
+
sourceImageUrl?: string | null;
|
|
1275
|
+
angles?: AssetVariant[];
|
|
1276
|
+
poses?: AssetVariant[];
|
|
1277
|
+
variations?: AssetVariant[];
|
|
1278
|
+
}
|
|
1279
|
+
interface WorkflowExportLocation {
|
|
1280
|
+
id: string;
|
|
1281
|
+
nodeId: string;
|
|
1282
|
+
name: string;
|
|
1283
|
+
description?: string | null;
|
|
1284
|
+
style?: string | null;
|
|
1285
|
+
sourceImageUrl?: string | null;
|
|
1286
|
+
timeOfDay?: AssetVariant[];
|
|
1287
|
+
weather?: AssetVariant[];
|
|
1288
|
+
angles?: AssetVariant[];
|
|
1289
|
+
lighting?: AssetVariant[];
|
|
1290
|
+
seasons?: AssetVariant[];
|
|
1291
|
+
atmosphereMotions?: AssetVariant[];
|
|
1292
|
+
referencePhotos?: ReferencePhoto[];
|
|
1293
|
+
canonicalDescription?: string | null;
|
|
1294
|
+
styleLock?: boolean | null;
|
|
1295
|
+
}
|
|
1296
|
+
/** A media URL referenced from a node's data, located by node + field path. */
|
|
1297
|
+
interface WorkflowMediaRef {
|
|
1298
|
+
nodeId: string;
|
|
1299
|
+
nodeLabel?: string;
|
|
1300
|
+
/** Dot/bracket path inside `node.data`, e.g. `imageUrl` or `referenceImageUrls[1]`. */
|
|
1301
|
+
field: string;
|
|
1302
|
+
url: string;
|
|
1303
|
+
}
|
|
1304
|
+
/**
|
|
1305
|
+
* Export-time portability analysis (#866). A bundle exported from a private
|
|
1306
|
+
* host carries media URLs only that host can serve (`http://localhost:3000/
|
|
1307
|
+
* storage/…`, a LAN address, a `.internal` name); imported anywhere else, the
|
|
1308
|
+
* nodes fail at Run time with an opaque provider fetch error. The exporter
|
|
1309
|
+
* lists those URLs here so the person exporting is told BEFORE sharing, and
|
|
1310
|
+
* an importer can explain what will not load. Absent when every media URL is
|
|
1311
|
+
* publicly routable.
|
|
1312
|
+
*/
|
|
1313
|
+
interface WorkflowPortability {
|
|
1314
|
+
unreachableMedia: WorkflowMediaRef[];
|
|
1315
|
+
}
|
|
1316
|
+
/** The four entity kinds a bundle's `assets` can carry. */
|
|
1317
|
+
type WorkflowAssetKind = "character" | "object" | "creature" | "location";
|
|
1318
|
+
/**
|
|
1319
|
+
* A bundled entity the import declined to re-create (#1088). The workflow
|
|
1320
|
+
* still lands — the film is the thing the importer asked for — so this is how
|
|
1321
|
+
* they hear that an `@` chip arrived unbound.
|
|
1322
|
+
*/
|
|
1323
|
+
interface WorkflowImportSkippedAsset {
|
|
1324
|
+
kind: WorkflowAssetKind;
|
|
1325
|
+
/** The entity's id IN THE BUNDLE (the exporter's row id). */
|
|
1326
|
+
id: string;
|
|
1327
|
+
name: string;
|
|
1328
|
+
reason: string;
|
|
1329
|
+
}
|
|
1330
|
+
/**
|
|
1331
|
+
* What the importer did about the bundle's media (#866). Publicly reachable
|
|
1332
|
+
* media that is not already on the importing instance's own storage is
|
|
1333
|
+
* copied there (`rehosted`) so the workflow runs from local copies; media on
|
|
1334
|
+
* a host the importer cannot reach is left as-is and listed (`unreachable`);
|
|
1335
|
+
* anything declined for another reason (too large, not a media type, over
|
|
1336
|
+
* the per-import cap, upload failed) is listed with the reason (`skipped`).
|
|
1337
|
+
*
|
|
1338
|
+
* The bundle's ENTITY images (`assets`) ride the same walk (#1088) — with one
|
|
1339
|
+
* rule of their own: they are copied even when they already sit on this
|
|
1340
|
+
* instance, because they are the EXPORTER's bytes and the two accounts'
|
|
1341
|
+
* lifecycles are uncorrelated (their delete, their quarantine sweep, their
|
|
1342
|
+
* retention reaper). Only bytes the importer already owns are left alone.
|
|
1343
|
+
*/
|
|
1344
|
+
interface WorkflowImportReport {
|
|
1345
|
+
rehosted: number;
|
|
1346
|
+
unreachable: WorkflowMediaRef[];
|
|
1347
|
+
skipped: Array<WorkflowMediaRef & {
|
|
1348
|
+
reason: string;
|
|
1349
|
+
}>;
|
|
1350
|
+
/**
|
|
1351
|
+
* Bundled entity id (the EXPORTER's) → the row created under the importer,
|
|
1352
|
+
* for every entity the import re-created. Present whenever the bundle
|
|
1353
|
+
* carried `assets`. A client that holds chips outside the graph — a
|
|
1354
|
+
* timeline, a copy-a-shared-production path that never posts to
|
|
1355
|
+
* `/v1/workflows/import` — re-points them with this; the server has already
|
|
1356
|
+
* re-pointed every `references[]` entry inside the nodes it stored.
|
|
1357
|
+
*/
|
|
1358
|
+
assetIdMap?: Record<string, string>;
|
|
1359
|
+
/** Entities the import declined to create (storage quota). The workflow
|
|
1360
|
+
* still landed; chips bound to these arrive unresolvable. */
|
|
1361
|
+
assetsSkipped?: WorkflowImportSkippedAsset[];
|
|
1362
|
+
/** Anything else the importer should know, e.g. copies were made but the
|
|
1363
|
+
* workflow could not be updated to use them. */
|
|
1364
|
+
notes?: string[];
|
|
1365
|
+
}
|
|
1366
|
+
interface WorkflowExport {
|
|
1367
|
+
version: 1;
|
|
1368
|
+
exportedAt: string;
|
|
1369
|
+
name: string;
|
|
1370
|
+
nodes: GenericNode[];
|
|
1371
|
+
edges: GenericEdge[];
|
|
1372
|
+
settings?: Record<string, unknown>;
|
|
1373
|
+
assets?: {
|
|
1374
|
+
characters: WorkflowExportCharacter[];
|
|
1375
|
+
objects: WorkflowExportObject[];
|
|
1376
|
+
creatures?: WorkflowExportCreature[];
|
|
1377
|
+
locations: WorkflowExportLocation[];
|
|
1378
|
+
};
|
|
1379
|
+
/** Present only when the bundle references media another instance cannot fetch. */
|
|
1380
|
+
portability?: WorkflowPortability;
|
|
1381
|
+
}
|
|
1382
|
+
/** Clear owner-bound references (credential / connection ids). Returns new node objects; inputs are not mutated. */
|
|
1383
|
+
declare function stripUnownedRefs(nodes: GenericNode[]): GenericNode[];
|
|
1384
|
+
/** Strip generated/transient content from nodes for template export. Returns new node objects; inputs are not mutated. */
|
|
1385
|
+
declare function stripExportContent(nodes: GenericNode[]): GenericNode[];
|
|
1386
|
+
|
|
1387
|
+
interface SubWorkflowPort {
|
|
1388
|
+
readonly id: string;
|
|
1389
|
+
readonly name: string;
|
|
1390
|
+
readonly mediaType: "text" | "image" | "video" | "audio" | "any";
|
|
1391
|
+
}
|
|
1392
|
+
interface BoundaryNode {
|
|
1393
|
+
readonly id: string;
|
|
1394
|
+
readonly type: string;
|
|
1395
|
+
readonly data: {
|
|
1396
|
+
readonly routeId?: string;
|
|
1397
|
+
readonly ports?: readonly SubWorkflowPort[];
|
|
1398
|
+
};
|
|
1399
|
+
}
|
|
1400
|
+
type ValidationError = {
|
|
1401
|
+
code: "missing_output_for_route";
|
|
1402
|
+
routeId: string;
|
|
1403
|
+
inputNodeId: string;
|
|
1404
|
+
} | {
|
|
1405
|
+
code: "missing_input_for_route";
|
|
1406
|
+
routeId: string;
|
|
1407
|
+
outputNodeId: string;
|
|
1408
|
+
} | {
|
|
1409
|
+
code: "route_has_no_output_ports";
|
|
1410
|
+
routeId: string;
|
|
1411
|
+
outputNodeId: string;
|
|
1412
|
+
} | {
|
|
1413
|
+
code: "duplicate_route_id";
|
|
1414
|
+
routeId: string;
|
|
1415
|
+
nodeIds: readonly string[];
|
|
1416
|
+
};
|
|
1417
|
+
type ValidationResult = {
|
|
1418
|
+
ok: true;
|
|
1419
|
+
} | {
|
|
1420
|
+
ok: false;
|
|
1421
|
+
errors: readonly ValidationError[];
|
|
1422
|
+
};
|
|
1423
|
+
declare function validateSubWorkflowRoutes(nodes: readonly BoundaryNode[]): ValidationResult;
|
|
1424
|
+
|
|
1425
|
+
type ReduceStrategy<TConfig = unknown> = {
|
|
1426
|
+
readonly id: string;
|
|
1427
|
+
readonly label: string;
|
|
1428
|
+
readonly description: string;
|
|
1429
|
+
readonly configSchema: ZodType<TConfig, any>;
|
|
1430
|
+
readonly defaultConfig: TConfig;
|
|
1431
|
+
readonly outputType: OutputType;
|
|
1432
|
+
readonly creditCostKey: string;
|
|
1433
|
+
/**
|
|
1434
|
+
* The strategy calls an LLM (its judge model). Everything that treats
|
|
1435
|
+
* "an LLM strategy" specially — the connected-install cloud proxy, the
|
|
1436
|
+
* tiered credit id — reads this rather than matching on the id, so a new
|
|
1437
|
+
* LLM strategy is covered by declaring it here.
|
|
1438
|
+
*/
|
|
1439
|
+
readonly usesLlm?: boolean;
|
|
1440
|
+
};
|
|
1441
|
+
/**
|
|
1442
|
+
* Result-meta shape returned by every reduce strategy. Shared between the
|
|
1443
|
+
* backend route, the SDK client, and the frontend node so all three layers
|
|
1444
|
+
* agree on field names. `selectedIndex` + `reasoning` are set by the
|
|
1445
|
+
* `pick-best-llm` and `vote` strategies (the former also fills `reasoning`);
|
|
1446
|
+
* `summary` is always populated.
|
|
1447
|
+
*/
|
|
1448
|
+
type ReduceMeta = {
|
|
1449
|
+
readonly selectedIndex?: number;
|
|
1450
|
+
readonly reasoning?: string;
|
|
1451
|
+
readonly summary: string;
|
|
1452
|
+
};
|
|
1453
|
+
declare const REDUCE_STRATEGIES: readonly [{
|
|
1454
|
+
readonly id: "pick-best-llm";
|
|
1455
|
+
readonly label: "AI picks the best";
|
|
1456
|
+
readonly description: "AI compares every candidate against your criteria and picks one.";
|
|
1457
|
+
readonly configSchema: z.ZodObject<{
|
|
1458
|
+
criteria: z.ZodDefault<z.ZodString>;
|
|
1459
|
+
inputKind: z.ZodDefault<z.ZodEnum<{
|
|
1460
|
+
text: "text";
|
|
1461
|
+
"image-url": "image-url";
|
|
1462
|
+
}>>;
|
|
1463
|
+
llmModel: z.ZodOptional<z.ZodString>;
|
|
1464
|
+
}, z.core.$strip>;
|
|
1465
|
+
readonly defaultConfig: {
|
|
1466
|
+
readonly criteria: "Pick the highest-quality result.";
|
|
1467
|
+
readonly inputKind: "text";
|
|
1468
|
+
};
|
|
1469
|
+
readonly outputType: OutputType;
|
|
1470
|
+
readonly creditCostKey: "reduce:pick-best-llm";
|
|
1471
|
+
readonly usesLlm: true;
|
|
1472
|
+
}, {
|
|
1473
|
+
readonly id: "concat";
|
|
1474
|
+
readonly label: "Join into one text";
|
|
1475
|
+
readonly description: "Puts every candidate into a single text, one after another, with a separator between them.";
|
|
1476
|
+
readonly configSchema: z.ZodObject<{
|
|
1477
|
+
separator: z.ZodDefault<z.ZodString>;
|
|
1478
|
+
}, z.core.$strip>;
|
|
1479
|
+
readonly defaultConfig: {
|
|
1480
|
+
readonly separator: "\n\n";
|
|
1481
|
+
};
|
|
1482
|
+
readonly outputType: OutputType;
|
|
1483
|
+
readonly creditCostKey: "reduce:concat";
|
|
1484
|
+
}, {
|
|
1485
|
+
readonly id: "first-non-empty";
|
|
1486
|
+
readonly label: "First that has content";
|
|
1487
|
+
readonly description: "Takes the first candidate that is not empty and ignores the rest.";
|
|
1488
|
+
readonly configSchema: z.ZodObject<{}, z.core.$strip>;
|
|
1489
|
+
readonly defaultConfig: {};
|
|
1490
|
+
readonly outputType: OutputType;
|
|
1491
|
+
readonly creditCostKey: "reduce:first-non-empty";
|
|
1492
|
+
}, {
|
|
1493
|
+
readonly id: "count";
|
|
1494
|
+
readonly label: "Count them";
|
|
1495
|
+
readonly description: "Outputs how many candidates arrived.";
|
|
1496
|
+
readonly configSchema: z.ZodObject<{}, z.core.$strip>;
|
|
1497
|
+
readonly defaultConfig: {};
|
|
1498
|
+
readonly outputType: OutputType;
|
|
1499
|
+
readonly creditCostKey: "reduce:count";
|
|
1500
|
+
}, {
|
|
1501
|
+
readonly id: "vote";
|
|
1502
|
+
readonly label: "Most common answer";
|
|
1503
|
+
readonly description: "Picks the candidate that appears most often (ties go to the first).";
|
|
1504
|
+
readonly configSchema: z.ZodObject<{
|
|
1505
|
+
caseSensitive: z.ZodDefault<z.ZodBoolean>;
|
|
1506
|
+
}, z.core.$strip>;
|
|
1507
|
+
readonly defaultConfig: {
|
|
1508
|
+
readonly caseSensitive: false;
|
|
1509
|
+
};
|
|
1510
|
+
readonly outputType: OutputType;
|
|
1511
|
+
readonly creditCostKey: "reduce:vote";
|
|
1512
|
+
}, {
|
|
1513
|
+
readonly id: "merge-json";
|
|
1514
|
+
readonly label: "Merge JSON objects";
|
|
1515
|
+
readonly description: "Reads every candidate as JSON and merges them into one object.";
|
|
1516
|
+
readonly configSchema: z.ZodObject<{
|
|
1517
|
+
strategy: z.ZodDefault<z.ZodEnum<{
|
|
1518
|
+
deep: "deep";
|
|
1519
|
+
shallow: "shallow";
|
|
1520
|
+
}>>;
|
|
1521
|
+
}, z.core.$strip>;
|
|
1522
|
+
readonly defaultConfig: {
|
|
1523
|
+
readonly strategy: "deep";
|
|
1524
|
+
};
|
|
1525
|
+
readonly outputType: OutputType;
|
|
1526
|
+
readonly creditCostKey: "reduce:merge-json";
|
|
1527
|
+
}];
|
|
1528
|
+
declare const REDUCE_STRATEGY_IDS: readonly ReduceStrategyId[];
|
|
1529
|
+
type ReduceStrategyId = typeof REDUCE_STRATEGIES[number]["id"];
|
|
1530
|
+
declare function getStrategy(id: ReduceStrategyId): ReduceStrategy;
|
|
1531
|
+
|
|
1532
|
+
/**
|
|
1533
|
+
* Which hosts a server-side fetch must never be pointed at: loopback, private,
|
|
1534
|
+
* link-local, cloud-metadata, multicast and reserved addresses. Pure and
|
|
1535
|
+
* dependency-free, so the server's SSRF gates (`safeFetch`, `safeUrlSchema`) and
|
|
1536
|
+
* the app runner's link card judge a host with the SAME rule — a link the card
|
|
1537
|
+
* accepts is not one the server then refuses for its address.
|
|
1538
|
+
*
|
|
1539
|
+
* Literal hosts only. A name that RESOLVES to a private address is caught where
|
|
1540
|
+
* the connection is made (`safeFetch` re-validates the resolved IP); nothing
|
|
1541
|
+
* here does DNS.
|
|
1542
|
+
*/
|
|
1543
|
+
/**
|
|
1544
|
+
* True if the IP belongs to a range we refuse to connect to from server-side
|
|
1545
|
+
* fetches. Covers IPv4 loopback/private/link-local/cloud-metadata/multicast
|
|
1546
|
+
* and the equivalent IPv6 classes (including IPv4-mapped IPv6 embeddings).
|
|
1547
|
+
*/
|
|
1548
|
+
declare function isPrivateOrReservedIP(ip: string): boolean;
|
|
1549
|
+
/**
|
|
1550
|
+
* True when a URL hostname (as `new URL(...).hostname` gives it, IPv6 still in
|
|
1551
|
+
* brackets) names this machine or a private/reserved IP literal. WHATWG parsing
|
|
1552
|
+
* has already folded decimal, octal and hex IPv4 spellings (`2130706433`,
|
|
1553
|
+
* `0x7f.1`) into dotted form, so those are caught as IP literals.
|
|
1554
|
+
*/
|
|
1555
|
+
declare function isLocalOrPrivateHostname(hostname: string): boolean;
|
|
1556
|
+
|
|
1557
|
+
/**
|
|
1558
|
+
* Field names on a node's `data` that hold runtime / result / transient execution
|
|
1559
|
+
* state (job ids, progress, generated outputs, fan-out bookkeeping). These are NEVER
|
|
1560
|
+
* part of a node's reusable configuration.
|
|
1561
|
+
*
|
|
1562
|
+
* Single source of truth, consumed by:
|
|
1563
|
+
* - the workflow store's undo logic (execution-only updates skip undo capture, so job
|
|
1564
|
+
* polling does not pollute undo history or flip `isDirty`)
|
|
1565
|
+
* - the node-preset extractor (presets must never capture runtime state)
|
|
1566
|
+
* - the backend defensive strip on preset writes
|
|
1567
|
+
*
|
|
1568
|
+
* When adding a new runtime/result field to a node's data, add its key here — or, when it is a
|
|
1569
|
+
* generic name only one node type writes as a result, to that type's row of
|
|
1570
|
+
* NODE_TYPE_EXECUTION_DATA_KEYS (read through `isExecutionDataKey` / `executionDataKeysOf`).
|
|
1571
|
+
*/
|
|
1572
|
+
declare const EXECUTION_DATA_KEYS: ReadonlySet<string>;
|
|
1573
|
+
/**
|
|
1574
|
+
* Run results a node type writes under a GENERIC name — `quote`, `durationSec`,
|
|
1575
|
+
* `candidates` — that are execution data on THAT type only. Another node may
|
|
1576
|
+
* keep a setting under the same name; filing these globally would misfile it
|
|
1577
|
+
* (out of undo, presets, templates and the copilot's view). Same lifecycle as
|
|
1578
|
+
* the global results: persisted, and a run writing them is never an undo step.
|
|
1579
|
+
*
|
|
1580
|
+
* UGC video (Nodaro Cloud): the outputs a node hands on (`ugcOutputs`), UGC
|
|
1581
|
+
* Creator's options of a draw and their note, UGC Clips' quote, and UGC Clip's
|
|
1582
|
+
* warnings, length and Re-render marks (`rerenderPending`: the clips pressed for
|
|
1583
|
+
* Re-render that no run has rendered yet — run bookkeeping; the press itself,
|
|
1584
|
+
* `rerender`, is a choice).
|
|
1585
|
+
*/
|
|
1586
|
+
declare const NODE_TYPE_EXECUTION_DATA_KEYS: Readonly<Record<string, readonly string[]>>;
|
|
1587
|
+
/** Is `key` execution data (run state or a run's result) on a node of `type`: global, or that type's own? */
|
|
1588
|
+
declare function isExecutionDataKey(key: string, type: string | null | undefined): boolean;
|
|
1589
|
+
/** Every execution-data key on a node of `type`, as one set: the global ones, plus the type's own. */
|
|
1590
|
+
declare function executionDataKeysOf(type: string | null | undefined): ReadonlySet<string>;
|
|
1591
|
+
/**
|
|
1592
|
+
* The PURE RUN-STATE subset of EXECUTION_DATA_KEYS: per-tick values (status
|
|
1593
|
+
* flips, job ids, progress counters, fan-out bookkeeping) that must NEITHER
|
|
1594
|
+
* mark the workflow dirty NOR be persisted in the save payload. Everything
|
|
1595
|
+
* else in EXECUTION_DATA_KEYS is a RESULT the user expects to survive reload
|
|
1596
|
+
* (generated URLs/results, errorMessage, LoRA outputs, collect snapshots).
|
|
1597
|
+
*
|
|
1598
|
+
* Why this split exists: writing these keys used to set `isDirty`, so job
|
|
1599
|
+
* polling phantom-dirtied passive tabs → spurious autosaves → false
|
|
1600
|
+
* "changed in another tab" banners → the remote-ahead latch froze autosave
|
|
1601
|
+
* (the "not saved for a long time" report). Consumed by the workflow
|
|
1602
|
+
* store's dirty decision and the save-payload sanitizer below.
|
|
1603
|
+
*
|
|
1604
|
+
* Invariant (guarded by node-runtime-keys.test.ts): subset of
|
|
1605
|
+
* EXECUTION_DATA_KEYS — anything transient is also undo-exempt.
|
|
1606
|
+
*/
|
|
1607
|
+
declare const TRANSIENT_RUNTIME_KEYS: ReadonlySet<string>;
|
|
1608
|
+
/**
|
|
1609
|
+
* Pure save-payload sanitizer: returns new node objects with the transient
|
|
1610
|
+
* run-state keys removed from `data`. Nodes without transient keys (or
|
|
1611
|
+
* without `data`) are returned by reference — cheap for the common case.
|
|
1612
|
+
*/
|
|
1613
|
+
declare function stripTransientRuntimeData<T extends {
|
|
1614
|
+
data?: Record<string, unknown> | undefined;
|
|
1615
|
+
}>(nodes: readonly T[]): T[];
|
|
1616
|
+
|
|
1617
|
+
/**
|
|
1618
|
+
* The wire contract for one node's entry in an execution's `nodeStates` map —
|
|
1619
|
+
* the shape the orchestrator persists on `workflow_executions.node_states`,
|
|
1620
|
+
* emits on the SSE execution stream, and every client reads back.
|
|
1621
|
+
*
|
|
1622
|
+
* Why this lives here rather than in the backend
|
|
1623
|
+
* ----------------------------------------------
|
|
1624
|
+
* The shape had THREE independent declarations — the orchestrator's rich
|
|
1625
|
+
* `NodeExecutionState` (workflow-engine/types.ts), the SDK's loose one
|
|
1626
|
+
* (`packages/client/src/resources/executions.ts`) and the editor's local copy
|
|
1627
|
+
* (`workflow-editor/run-handlers.ts`) — and nothing tied them together. The
|
|
1628
|
+
* field that made that expensive is `output`: it used to be an unstated
|
|
1629
|
+
* convention that only a COMPLETED node carries one, so every consumer read it
|
|
1630
|
+
* exclusively under `status === "completed"` and a failed node's retained
|
|
1631
|
+
* result had nowhere to travel.
|
|
1632
|
+
*
|
|
1633
|
+
* This module states the rule once. The backend keeps its richer `NodeOutput`
|
|
1634
|
+
* typing (its `NodeExecutionState` must stay ASSIGNABLE to the wire shape — a
|
|
1635
|
+
* type-level test pins that); the SDK and the editor extend/import it.
|
|
1636
|
+
*/
|
|
1637
|
+
/**
|
|
1638
|
+
* The status a node reports inside an execution.
|
|
1639
|
+
*
|
|
1640
|
+
* `cancelled` is deliberately absent: a cancelled child job is mapped onto
|
|
1641
|
+
* `skipped` by the reconcile lane (see `lib/reconcile/node-states.ts`), and a
|
|
1642
|
+
* HELD job keeps `status: "running"` with the `awaitingReview` sidecar rather
|
|
1643
|
+
* than adding a member here.
|
|
1644
|
+
*/
|
|
1645
|
+
type NodeExecutionStatus = "pending" | "running" | "completed" | "failed" | "skipped";
|
|
1646
|
+
/**
|
|
1647
|
+
* Why a node was skipped at run time, when the run itself decided it (never
|
|
1648
|
+
* for a node the person froze with Skip, which is a saved-data seed):
|
|
1649
|
+
* - `empty_input` — a text-requiring node whose wired text came from a node
|
|
1650
|
+
* that, in this run, produced nothing (a feed that found no new posts). A
|
|
1651
|
+
* completed run with one such skip reads as "nothing new"
|
|
1652
|
+
* (execution-outcome.ts).
|
|
1653
|
+
* A router-gated node carries no reason, as before.
|
|
1654
|
+
*/
|
|
1655
|
+
type NodeSkipReason = "empty_input";
|
|
1656
|
+
/**
|
|
1657
|
+
* The statuses whose node state MAY carry `output`.
|
|
1658
|
+
*
|
|
1659
|
+
* `completed` is the obvious one. `failed` is here because a run can refuse
|
|
1660
|
+
* its result and still RETAIN what it produced — the 3D-scene authoring lanes
|
|
1661
|
+
* publish a real, renderable revision and then fail the job on the visual
|
|
1662
|
+
* reviewer's verdict (`SCENE_QUALITY_FAILED`), so the scene and the refusal are
|
|
1663
|
+
* both true at once. That output was billed; dropping it because the status is
|
|
1664
|
+
* not `"completed"` is what this set exists to stop.
|
|
1665
|
+
*
|
|
1666
|
+
* `pending` / `running` / `skipped` never carry one: nothing has settled, or
|
|
1667
|
+
* the node was gated out.
|
|
1668
|
+
*/
|
|
1669
|
+
declare const OUTPUT_BEARING_NODE_STATUSES: ReadonlySet<NodeExecutionStatus>;
|
|
1670
|
+
/** Whether a node in this status may carry `output`. */
|
|
1671
|
+
declare function nodeStateMayCarryOutput(status: string | undefined): boolean;
|
|
1672
|
+
/**
|
|
1673
|
+
* One node's execution state, as it travels on the wire.
|
|
1674
|
+
*
|
|
1675
|
+
* Additive by construction — an older client ignores fields it does not know,
|
|
1676
|
+
* which is why `output` on a failed node is safe to start sending.
|
|
1677
|
+
*
|
|
1678
|
+
* `TOutput` lets a declaration that knows its own richer output shape (the
|
|
1679
|
+
* orchestrator's `NodeOutput`, the editor's) stay ASSIGNABLE to this contract
|
|
1680
|
+
* instead of restating it; the default is what an external client sees.
|
|
1681
|
+
*/
|
|
1682
|
+
interface NodeExecutionStateWire<TOutput = Record<string, unknown>> {
|
|
1683
|
+
status: NodeExecutionStatus | (string & {});
|
|
1684
|
+
nodeType?: string;
|
|
1685
|
+
jobId?: string | null;
|
|
1686
|
+
/** Every job id of a fan-out node (one per list / loop iteration). */
|
|
1687
|
+
jobIds?: string[];
|
|
1688
|
+
creditsUsed?: number;
|
|
1689
|
+
error?: string | null;
|
|
1690
|
+
/** Stable code for a refusal a client may branch on — never on the text. */
|
|
1691
|
+
errorCode?: string;
|
|
1692
|
+
/**
|
|
1693
|
+
* What the node produced.
|
|
1694
|
+
*
|
|
1695
|
+
* Present for a `completed` node, and for a `failed` node whose run RETAINED
|
|
1696
|
+
* a structured result (see {@link OUTPUT_BEARING_NODE_STATUSES}). A consumer
|
|
1697
|
+
* that reads it must therefore gate on the FIELD, not on the status, and
|
|
1698
|
+
* must not treat its presence as success.
|
|
1699
|
+
*/
|
|
1700
|
+
output?: TOutput;
|
|
1701
|
+
startedAt?: string | null;
|
|
1702
|
+
completedAt?: string | null;
|
|
1703
|
+
/** The node's job is parked in `pending_review`; `status` stays "running". */
|
|
1704
|
+
awaitingReview?: boolean;
|
|
1705
|
+
progress?: number;
|
|
1706
|
+
/** Present on a `skipped` node the RUN skipped (see {@link NodeSkipReason}); absent on a router-gated one. */
|
|
1707
|
+
skipReason?: NodeSkipReason | (string & {});
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
/**
|
|
1711
|
+
* How a COMPLETED run ended, derived on read from its node states — never a
|
|
1712
|
+
* column: the orchestrator, the boot sweep and the reconcile cron all write
|
|
1713
|
+
* `completed`, and a column only one of them set would read "succeeded" for
|
|
1714
|
+
* the runs the others closed. Every surface that shows a run (the editor's
|
|
1715
|
+
* run bar and Executions tab, a published app, Present, the REST / SDK
|
|
1716
|
+
* execution shapes, MCP `get_app_run` / `diagnose_run`) asks this one rule.
|
|
1717
|
+
*/
|
|
1718
|
+
type ExecutionOutcome = "succeeded" | "nothing_new";
|
|
1719
|
+
interface SkipStateLike {
|
|
1720
|
+
readonly status?: unknown;
|
|
1721
|
+
readonly skipReason?: unknown;
|
|
1722
|
+
}
|
|
1723
|
+
/** The nodes a run skipped for want of input: nothing upstream produced any text in this run. */
|
|
1724
|
+
declare function countEmptyInputSkips(nodeStates: Readonly<Record<string, SkipStateLike>> | null | undefined): number;
|
|
1725
|
+
/**
|
|
1726
|
+
* `nothing_new` when a completed run skipped at least one node for want of
|
|
1727
|
+
* input (a feed that found no new posts, a writer with nothing to write);
|
|
1728
|
+
* `succeeded` for any other completed run; undefined for a run that has not
|
|
1729
|
+
* completed — a failed or cancelled run has no outcome, it has a status.
|
|
1730
|
+
*/
|
|
1731
|
+
declare function executionOutcome(status: unknown, nodeStates: Readonly<Record<string, SkipStateLike>> | null | undefined): ExecutionOutcome | undefined;
|
|
1732
|
+
|
|
1733
|
+
export { AGGREGATEABLE_TYPES, type AggregateableType, type AggregationBuckets, CATEGORY_DURATION_DEFAULTS, COLLECT_IN_HANDLE, EXECUTION_DATA_KEYS, type EvaluateConditionOptions, type ExecutionOutcome, FRAME_TARGET_HANDLES, type FanOutCandidate, type FanOutPlan, type FeedEdge, type FeedMaps, type FeedNode, type FieldEdgeSource, type FilterListCondition, type FilterListOperator, type FilterOperator, type FullSelectorMode, GENERATE_TEXT_DELIMITER, GROUP_HANDLE_PREFIX, type HeldRowPick, ITER_CLONE_PATTERN, type JsonEvalResult, type JsonFilter, type ListFanOut, type LocalTime, type Member, type MinimalEdge, type MinimalNode, NODE_REF_PATTERN, NODE_TYPE_EXECUTION_DATA_KEYS, NON_PROMPT_TEXT_LANES, NO_SPLIT_DELIMITER, type NodeExecutionStateWire, type NodeExecutionStatus, type NodeSkipReason, OUTPUT_BEARING_NODE_STATUSES, type OutputMode, PROJECTED_TRIGGER_NODE_TYPES, PROVIDER_PLACEHOLDER_PREFIX, type ProgressSegment, REDUCE_STRATEGIES, REDUCE_STRATEGY_IDS, REFERENCE_HANDLE_MAP, REF_HANDLE_CATEGORY, REF_TOKEN_NAMESPACE_PREFIXES, REPEATABLE_NODE_TYPES, REPEAT_PLACEHOLDER, RESERVED_TEMPLATE_VARS, type ReduceMeta, type ReduceStrategy, type ReduceStrategyId, type RefCandidate, type RefModalityEdge, type RefTokenKind, type ReferenceModality, type ResolveSeparatorOptions, type RouterConditionGroup, SCHEDULE_EVERY_LIMITS, SCHEDULE_RULE_KINDS, SCHEDULE_TRIGGER_NODE_TYPE, SEPARATOR_DISPLAY, SEPARATOR_PRESETS, type ScheduleRule, type ScheduleRuleKind, type ScheduleSpec, type SelectorConfig, type SelectorFields, type SelectorMode, type SelectorPredicateOp, type SelectorResult, type SeparatorPreset, type SortDirection, type SortListOptions, type SortType, TELEGRAM_ACCOUNT_TRIGGER_NODE_TYPE, TELEGRAM_TRIGGER_NODE_TYPE, TRANSIENT_RUNTIME_KEYS, VARIABLES_HANDLE_ID, WEBHOOK_TRIGGER_NODE_TYPE, type WorkflowAssetKind, type WorkflowExport, type WorkflowExportCharacter, type WorkflowExportCreature, type WorkflowExportLocation, type WorkflowExportObject, type WorkflowImportReport, type WorkflowImportSkippedAsset, type WorkflowMediaRef, type WorkflowPortability, aggregateByType, alignedFieldList, applyRange, applyRangeIndices, buildChildrenByParent, buildConditionVariables, buildExpressionFromVisual, buildFeedMaps, buildProgressSegments, buildRangeLabel, calculateCombinedProgress, calculateProgress, canonicalVarName, classifyRefToken, combineSameLabelRefs, compactWithRows, computeAggregateLanes, countEmptyInputSkips, countRefModalityEdges, decodeProviderItem, describeEdgeBehavior, encodeProviderItem, evaluateCondition, evaluateConditionGroup, evaluateJsonExpression, evaluateJsonPath, executionDataKeysOf, executionOutcome, expandItemsWithRepeat, extractAllGeneratedResults, extractGeneratedJsonAsList, extractReferencedLabels, fanOutTextFeedsPrompt, fanOutUrlItemIsText, filterCloneNodes, getEffectiveRepeatCount, getRouteReachableNodeIds, getStrategy, groupHandleId, isAggregateableType, isCollectInEdge, isCronExpression, isDefaultSelectorConfig, isExecutionDataKey, isExpandedClone, isFanOutUrlItem, isLocalOrPrivateHostname, isPrivateOrReservedIP, isProjectedTriggerNodeType, isValidTimezone, jsonResultToList, legacyScheduleToRules, liveRowColumn, localMinuteKey, localTimeIn, matchesCron, matchesCronField, migrateEdgeOutputMode, nextScheduleRuns, nodeFeedsAnything, nodeStateMayCarryOutput, normalizeScheduleRule, normalizeScheduleRules, parseGroupHandle, parseListExpression, parseNodeRef, pickHeldRow, planFanOut, presentTypes, previewHorizonMs, refHandleCategory, referenceModalityForHandle, resolveConditionValue, resolveFieldMappings, resolveIndex, resolveListExpression, resolveListFanOut, resolveLocationFields, resolveNodeRefs, resolveRelativeWindowToken, resolveSelectorRefs, resolveSeparator, resolveSourceThroughConnectedList, ruleMatches, runSelector, scheduleMatchesAt, scheduleOccurrences, selectByModulo, selectByNamedKey, selectByPredicate, selectListItems, selectRandom, settledWithLimit, sortListItems, spliceDelimitedRows, splitByLoopDelimiter, splitGeneratedItems, spreadJsonArrayIfSingleton, stringifyPathResults, stripExportContent, stripTransientRuntimeData, stripUnownedRefs, timezoneOffsetMinutes, tryParseJson, unresolvedRefTokens, validateSubWorkflowRoutes, variantJobId, zipMergeLists };
|