@field/cascade 0.11.0 → 0.12.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.
Files changed (216) hide show
  1. package/AGENTS.md +7 -4
  2. package/ARCHITECTURE.md +5 -4
  3. package/CHANGELOG.md +195 -0
  4. package/README.md +1 -1
  5. package/dist/assets/AgentPanel-1JugFjE4.css +1 -0
  6. package/dist/assets/AgentPanel-BDL5MddA.js +5 -0
  7. package/dist/assets/{CodeEditor-4O7FQ__R.js → CodeEditor-C-xYG-Wn.js} +120 -120
  8. package/dist/assets/CodePanel-CtXd50m6.js +2 -0
  9. package/dist/assets/CookInfoPanel-B3NMhKJF.css +1 -0
  10. package/dist/assets/CookInfoPanel-DG4_TRsX.js +2 -0
  11. package/dist/assets/CustomNodeDialog-CHfZUs-r.js +1 -0
  12. package/dist/assets/DefinitionNode-CaRTXQ_b.js +1 -0
  13. package/dist/assets/DefinitionPanel-C3CxZY9r.js +1 -0
  14. package/dist/assets/DefinitionPanel-VNLnAiQD.css +1 -0
  15. package/dist/assets/OpenGraphDialog-BLdr6k_q.js +1 -0
  16. package/dist/assets/ProjectSettings-ZnvmIAir.js +2 -0
  17. package/dist/assets/{SettingsDialog-Bz8JxISH.js → SettingsDialog-CBX3Wa87.js} +1 -1
  18. package/dist/assets/TimelinePanel-CDeR0arY.css +1 -0
  19. package/dist/assets/TimelinePanel-CWgnFH1e.js +1 -0
  20. package/dist/assets/{VersionHistoryDialog-D5Z0nJ5-.js → VersionHistoryDialog-BOSoW1R-.js} +1 -1
  21. package/dist/assets/assert-BO2_erPD.js +1 -0
  22. package/dist/assets/assert-hvykGCnP.js +1 -0
  23. package/dist/assets/builder-BmBKcDix.js +1 -0
  24. package/dist/assets/camera-DFF7YA3F.js +1 -0
  25. package/dist/assets/checks-DAvyO9Gf.js +1 -0
  26. package/dist/assets/contactSheet-N1NcaWxw.js +2 -0
  27. package/dist/assets/{core-Yqi0Ni61.js → core-DB-MkGjj.js} +3 -4
  28. package/dist/assets/coreTypes-DtnDATZ7.js +1 -0
  29. package/dist/assets/{cssMode-CxUzc4vp.js → cssMode-DPVckSOc.js} +1 -1
  30. package/dist/assets/definitions-B227e7f_.js +1 -0
  31. package/dist/assets/definitions-D0WOUJd7.js +1 -0
  32. package/dist/assets/{editor.api-BNFb25CX.js → editor.api-Dkutg_Z1.js} +1 -1
  33. package/dist/assets/expressions-X-Z-GrgW.js +5 -0
  34. package/dist/assets/file-DAL6IfjV.js +1 -0
  35. package/dist/assets/filters-D3k1LRMa.js +1 -0
  36. package/dist/assets/{freemarker2-0ZDnWxeM.js → freemarker2-CLiLKk3B.js} +1 -1
  37. package/dist/assets/generators-BhDxRAFC.js +1 -0
  38. package/dist/assets/geo-BsMImJIJ.js +1 -0
  39. package/dist/assets/geo-C4YngDob.js +2 -0
  40. package/dist/assets/{handlebars-Cy18MoaD.js → handlebars-CcD3aMeL.js} +1 -1
  41. package/dist/assets/{html-B-2Dx7nq.js → html-DvZWGfqb.js} +1 -1
  42. package/dist/assets/{htmlMode-DUAc9B_d.js → htmlMode-DUD3VaoN.js} +1 -1
  43. package/dist/assets/image-0SfH-snh.js +1 -0
  44. package/dist/assets/image-Ck-RdGU4.js +2 -0
  45. package/dist/assets/index-BWnrmIB9.js +137 -0
  46. package/dist/assets/index-DIaxEONI.css +1 -0
  47. package/dist/assets/io-BGmt2g0D.js +1 -0
  48. package/dist/assets/{javascript-DeQsDqP5.js → javascript-Cap2ahgh.js} +1 -1
  49. package/dist/assets/{jsonMode-BiFwJVSk.js → jsonMode-B0uLjp9C.js} +1 -1
  50. package/dist/assets/{liquid-BLoHH68a.js → liquid-CnxwhfLn.js} +1 -1
  51. package/dist/assets/{lspLanguageFeatures-CNFgm1Kv.js → lspLanguageFeatures-Dn9hlKX6.js} +1 -1
  52. package/dist/assets/math-GeULS-sk.js +1 -0
  53. package/dist/assets/{mdx-CFXQVNfs.js → mdx-BV3jbrVa.js} +1 -1
  54. package/dist/assets/pop-KMF_qloi.js +1 -0
  55. package/dist/assets/preload-helper-Czpn1I53.js +1 -0
  56. package/dist/assets/{python-Cf7S7p2E.js → python-CGyFk4XK.js} +1 -1
  57. package/dist/assets/{razor-CMHBcG-g.js → razor-CQfzX3-N.js} +1 -1
  58. package/dist/assets/remap-5SjXQU-q.js +1 -0
  59. package/dist/assets/renderMarkdown-ork0Oir7.js +67 -0
  60. package/dist/assets/studioImages-CAyH-0Pl.js +1 -0
  61. package/dist/assets/text-ZpX7qNkx.js +2 -0
  62. package/dist/assets/time-P_OiBhcf.js +1 -0
  63. package/dist/assets/{tsMode-BEih0GDj.js → tsMode-BOeXzO9H.js} +1 -1
  64. package/dist/assets/{typescript-COEKYD_a.js → typescript-J1SnE_Tu.js} +1 -1
  65. package/dist/assets/{workers-BNhAhMNn.js → workers-CYwwTiVF.js} +1 -1
  66. package/dist/assets/{xml-CPiMpnPl.js → xml-DnPRNzK9.js} +1 -1
  67. package/dist/assets/{yaml-Bgp1ITLR.js → yaml-BmmYBNa9.js} +1 -1
  68. package/dist/cli/DefinitionNode-P7AA4TAU.js +15 -0
  69. package/dist/cli/{Graph-ZJJTRQTM.js → Graph-OB6EWSGL.js} +12 -12
  70. package/dist/cli/assert-GROGQNCQ.js +25 -0
  71. package/dist/cli/checks-3WB44XBL.js +189 -0
  72. package/dist/cli/{chunk-RQZ4SX5R.js → chunk-2JEU3MGB.js} +2 -2
  73. package/dist/cli/{chunk-WKURDVYP.js → chunk-3RXL5GHB.js} +28 -331
  74. package/dist/cli/chunk-53LGFPWX.js +138 -0
  75. package/dist/cli/chunk-5ORUQ6ES.js +267 -0
  76. package/dist/cli/chunk-73S4JZXK.js +336 -0
  77. package/dist/cli/{chunk-YAT5Y25U.js → chunk-7QE2ZNSN.js} +3 -3
  78. package/dist/cli/{chunk-SGJAET2L.js → chunk-BPODRH52.js} +8 -4
  79. package/dist/cli/{chunk-XWDSKG7N.js → chunk-BZ63XQ3I.js} +2 -2
  80. package/dist/cli/{chunk-FCDXJ6EK.js → chunk-CTPLRSWF.js} +2 -13
  81. package/dist/cli/chunk-EU4ZFZ7Y.js +122 -0
  82. package/dist/cli/{chunk-WIH4TEIS.js → chunk-EZRWJ4G2.js} +1 -1
  83. package/dist/cli/{chunk-BIJO5OFS.js → chunk-FWMSGKEH.js} +1 -1
  84. package/dist/cli/{chunk-POMMNKZZ.js → chunk-G23A2BZZ.js} +38 -5
  85. package/dist/cli/{chunk-35D343DC.js → chunk-GRIN2DDP.js} +19 -1
  86. package/dist/cli/chunk-JVOCK5W4.js +83 -0
  87. package/dist/cli/chunk-KBGUO27Q.js +15 -0
  88. package/dist/cli/{chunk-GFS6W3C5.js → chunk-L6B6FUQP.js} +54 -32
  89. package/dist/cli/chunk-LTXWBXOM.js +438 -0
  90. package/dist/cli/chunk-MI5JLQYA.js +220 -0
  91. package/dist/cli/{chunk-EUIAC3U3.js → chunk-MP653A5O.js} +884 -124
  92. package/dist/cli/{chunk-A4OAMOZH.js → chunk-NJFMDXHR.js} +13 -3
  93. package/dist/cli/{chunk-3JTJHF7V.js → chunk-OM6BEME6.js} +4 -4
  94. package/dist/cli/{chunk-DUIUFVU2.js → chunk-ST6LROUG.js} +49 -23
  95. package/dist/cli/{chunk-RLCAJBVR.js → chunk-TJW67QSI.js} +8 -7
  96. package/dist/cli/chunk-WGKPJZDY.js +364 -0
  97. package/dist/cli/{chunk-D6BUOHUG.js → chunk-X4WKAOQP.js} +4 -4
  98. package/dist/cli/{chunk-VVGSLVSF.js → chunk-X566FWBV.js} +6 -1
  99. package/dist/cli/chunk-YH637PDL.js +317 -0
  100. package/dist/cli/chunk-ZSCUZE6I.js +112 -0
  101. package/dist/cli/{cliCommands-UQSFGEHF.js → cliCommands-JJN5Z3ZC.js} +23 -17
  102. package/dist/cli/{commands-Q23M26QM.js → commands-PHYFYA3F.js} +129 -47
  103. package/dist/cli/contactSheet-2PQVRUFW.js +11 -0
  104. package/dist/cli/{definitions-HF2FTHYU.js → definitions-BPOPW52L.js} +7 -7
  105. package/dist/cli/{doctorCommand-B7BPQMN6.js → doctorCommand-ORWQRNYP.js} +36 -6
  106. package/dist/cli/{edit-JHCPTQFT.js → edit-S5KEQ5RA.js} +3 -3
  107. package/dist/cli/editorCommands-NFR32JOY.js +41 -0
  108. package/dist/cli/{encode-HAUZTYPT.js → encode-ICPEPMH5.js} +2 -2
  109. package/dist/cli/file-3HTQHPYQ.js +41 -0
  110. package/dist/cli/filters-6ODFWYK4.js +379 -0
  111. package/dist/cli/generators-YU7GB4MD.js +210 -0
  112. package/dist/cli/{geo-4RNK3QVN.js → geo-6ZPGKZRU.js} +7 -7
  113. package/dist/cli/{graphCommands-6BMAKGQE.js → graphCommands-EOUOBOIJ.js} +4 -4
  114. package/dist/cli/{graphFile-VPSQ6OF7.js → graphFile-YTGJB5F5.js} +25 -19
  115. package/dist/cli/{headlessCanvas-5XLDZT7M.js → headlessCanvas-ENRHC7GS.js} +3 -2
  116. package/dist/cli/{helpCommand-3VRE3KVO.js → helpCommand-PULH6ZYB.js} +9 -7
  117. package/dist/cli/image-TXELZZK5.js +55 -0
  118. package/dist/cli/index.js +14 -14
  119. package/dist/cli/{math-ZRMLKU2D.js → math-RSYRQ3C6.js} +5 -5
  120. package/dist/cli/{mcp-ZLEEMYGF.js → mcp-JVZFQOEX.js} +4 -4
  121. package/dist/cli/{parity-KINARCP2.js → parity-X6DEH2DV.js} +42 -36
  122. package/dist/cli/{pop-USDFXB7H.js → pop-B7SIIYKN.js} +5 -5
  123. package/dist/cli/project-VYGIA7JX.js +12 -0
  124. package/dist/cli/{projectDefinition-DMTZN2NE.js → projectDefinition-F3D7UIHJ.js} +8 -8
  125. package/dist/cli/{projectRuntime-Z5PJOH47.js → projectRuntime-2Q4JKEH3.js} +19 -12
  126. package/dist/cli/registerStandardNodes-BXJCB6E4.js +744 -0
  127. package/dist/cli/{render-YURAPPUI.js → render-PT4MWI6U.js} +24 -22
  128. package/dist/cli/{runCommand-PI764LEG.js → runCommand-HNPQVZMS.js} +3 -3
  129. package/dist/cli/runner-5XPXVW7J.js +43 -0
  130. package/dist/cli/runtime/image.ts +27 -2
  131. package/dist/cli/runtime/io.ts +78 -0
  132. package/dist/cli/share-MHF6TNRK.js +166 -0
  133. package/dist/cli/stageCache-TY2BFZJR.js +15 -0
  134. package/dist/cli/{stageRunner-KUNIMQKJ.js → stageRunner-KY2EJP7X.js} +2 -2
  135. package/dist/cli/text-MB3EKR4H.js +126 -0
  136. package/dist/cli/{verbs-RCE3K4VQ.js → verbs-PI2JH5FI.js} +2 -2
  137. package/dist/cli/webBuild-WPPMGGW7.js +44 -0
  138. package/dist/contracts/capabilities.d.ts +18 -1
  139. package/dist/contracts/color.d.ts +8 -0
  140. package/dist/contracts/color.js +23 -0
  141. package/dist/contracts/definition.d.ts +10 -0
  142. package/dist/contracts/schema.d.ts +1 -1
  143. package/dist/contracts/schema.js +1 -0
  144. package/dist/contracts/validate.js +11 -1
  145. package/dist/contracts/values.d.ts +24 -0
  146. package/dist/image.d.ts +15 -0
  147. package/dist/image.js +36 -2
  148. package/dist/index.html +8 -2
  149. package/dist/io.d.ts +29 -0
  150. package/dist/io.js +40 -0
  151. package/dist/player/app.js +3 -2
  152. package/dist/player/editor.js +3 -2
  153. package/dist/player/editorEngine.js +3 -2
  154. package/dist/runtime/builtins/assert/checks.d.ts +18 -0
  155. package/dist/runtime/builtins/assert/checks.js +207 -0
  156. package/dist/runtime/builtins/assert/definitions.d.ts +130 -0
  157. package/dist/runtime/builtins/assert/definitions.js +54 -0
  158. package/dist/runtime/builtins/assert/index.d.ts +152 -0
  159. package/dist/runtime/builtins/assert/index.js +36 -0
  160. package/dist/runtime/builtins/image/contactSheet.d.ts +3 -165
  161. package/dist/runtime/builtins/image/contactSheet.js +0 -49
  162. package/dist/runtime/builtins/image/definitions.d.ts +950 -0
  163. package/dist/runtime/builtins/image/definitions.js +343 -0
  164. package/dist/runtime/builtins/image/file.d.ts +8 -0
  165. package/dist/runtime/builtins/image/file.js +37 -0
  166. package/dist/runtime/builtins/image/filters.d.ts +8 -0
  167. package/dist/runtime/builtins/image/filters.js +394 -0
  168. package/dist/runtime/builtins/image/generators.d.ts +7 -0
  169. package/dist/runtime/builtins/image/generators.js +144 -0
  170. package/dist/runtime/builtins/image/index.d.ts +947 -4
  171. package/dist/runtime/builtins/image/index.js +41 -6
  172. package/dist/runtime/builtins/image/io.d.ts +100 -0
  173. package/dist/runtime/builtins/image/io.js +142 -0
  174. package/dist/runtime/builtins/image/planar.d.ts +55 -0
  175. package/dist/runtime/builtins/image/planar.js +274 -0
  176. package/dist/runtime/builtins/image/simplex.d.ts +22 -0
  177. package/dist/runtime/builtins/image/simplex.js +92 -0
  178. package/dist/runtime/builtins/image/text.d.ts +4 -0
  179. package/dist/runtime/builtins/image/text.js +141 -0
  180. package/dist/runtime/builtins/index.d.ts +3 -0
  181. package/dist/runtime/builtins/index.js +7 -0
  182. package/dist/runtime/gpu.d.ts +25 -0
  183. package/dist/runtime/gpu.js +40 -0
  184. package/dist/runtime/runtime.d.ts +2 -0
  185. package/dist/runtime/runtime.js +268 -44
  186. package/dist/runtime/types.d.ts +30 -0
  187. package/doc/CLI_REFERENCE.md +21 -3
  188. package/doc/EDITOR_EXPORT.md +26 -0
  189. package/doc/MCP.md +2 -1
  190. package/doc/NODE_REFERENCE.md +286 -14
  191. package/doc/PROJECT_AUTHORING.md +98 -3
  192. package/package.json +4 -1
  193. package/dist/assets/CodePanel-BU-autmq.js +0 -2
  194. package/dist/assets/CustomNodeDialog-BRpDfOV5.js +0 -1
  195. package/dist/assets/OpenGraphDialog-BwbRlC0X.js +0 -1
  196. package/dist/assets/ProjectSettings-DLOXLxcA.js +0 -2
  197. package/dist/assets/definitions-GreEMXLV.js +0 -1
  198. package/dist/assets/geo-u0n_jOsD.js +0 -1
  199. package/dist/assets/image-cAa-Nu9O.js +0 -2062
  200. package/dist/assets/index-5ZtDAuy2.js +0 -220
  201. package/dist/assets/index-7vae6YFC.css +0 -1
  202. package/dist/assets/math-DioIQOPJ.js +0 -1
  203. package/dist/assets/pop-DC_TQG9t.js +0 -1
  204. package/dist/cli/chunk-36P5K3SD.js +0 -631
  205. package/dist/cli/chunk-4UDFYF5G.js +0 -132
  206. package/dist/cli/chunk-53NMBJAO.js +0 -35
  207. package/dist/cli/chunk-MIIEFUGG.js +0 -623
  208. package/dist/cli/chunk-QBBKRNGY.js +0 -90
  209. package/dist/cli/chunk-WPUDGEFY.js +0 -20
  210. package/dist/cli/editorCommands-UIF5YLUZ.js +0 -33
  211. package/dist/cli/project-K3QIPGBB.js +0 -12
  212. package/dist/cli/registerStandardNodes-S2VLMF6J.js +0 -3081
  213. package/dist/cli/runner-RA6UKEPD.js +0 -37
  214. package/dist/cli/webBuild-GT4PZT5D.js +0 -37
  215. package/dist/runtime/builtins/headless.d.ts +0 -19
  216. package/dist/runtime/builtins/headless.js +0 -25
@@ -16,7 +16,7 @@ import {
16
16
  CORE_TYPES,
17
17
  canConnectTypes,
18
18
  normalizeCascadeType
19
- } from "./chunk-BIJO5OFS.js";
19
+ } from "./chunk-FWMSGKEH.js";
20
20
 
21
21
  // src/utils/nodeTypeUtils.ts
22
22
  var nodeClassRegistries = /* @__PURE__ */ new Map();
@@ -136,16 +136,6 @@ function normalizeColor(input) {
136
136
  }
137
137
  return { r: 0, g: 0, b: 0, a: 1 };
138
138
  }
139
- function colorToCss(color) {
140
- const r = Math.round(color.r * 255);
141
- const g = Math.round(color.g * 255);
142
- const b = Math.round(color.b * 255);
143
- const a = color.a !== void 0 ? color.a : 1;
144
- if (a < 1) {
145
- return `rgba(${r},${g},${b},${a})`;
146
- }
147
- return `rgb(${r},${g},${b})`;
148
- }
149
139
  function isColorValue(value) {
150
140
  if (typeof value === "string") {
151
141
  return value.startsWith("#") || value.startsWith("rgb(");
@@ -2197,7 +2187,6 @@ export {
2197
2187
  isStandardLibraryNode,
2198
2188
  getNodeClass,
2199
2189
  normalizeColor,
2200
- colorToCss,
2201
2190
  isColorValue,
2202
2191
  CORE_TYPES2 as CORE_TYPES,
2203
2192
  isCoreType,
@@ -2205,4 +2194,4 @@ export {
2205
2194
  canConnect,
2206
2195
  Node
2207
2196
  };
2208
- //# sourceMappingURL=chunk-FCDXJ6EK.js.map
2197
+ //# sourceMappingURL=chunk-CTPLRSWF.js.map
@@ -0,0 +1,122 @@
1
+ import {
2
+ readProjectManifest
3
+ } from "./chunk-2JEU3MGB.js";
4
+
5
+ // server/src/compile.ts
6
+ import * as esbuild from "esbuild";
7
+ import fs from "fs";
8
+ import path from "path";
9
+ import { fileURLToPath } from "url";
10
+ var __dirname_compile = path.dirname(fileURLToPath(import.meta.url));
11
+ function cascadeRuntimePlugin(project) {
12
+ return {
13
+ name: "cascade-runtime",
14
+ setup(build2) {
15
+ build2.onResolve({ filter: /^cascade\/(?:io|image|shell|net|config|stage)$/ }, (args) => ({
16
+ path: args.path,
17
+ namespace: "cascade-runtime"
18
+ }));
19
+ build2.onResolve({ filter: /^(?:@cascade|cascade)\/contracts$/ }, () => {
20
+ const candidates = [
21
+ path.join(__dirname_compile, "..", "contracts", "index.js"),
22
+ path.join(__dirname_compile, "..", "..", "packages", "contracts", "dist", "index.js")
23
+ ];
24
+ const found = candidates.find((c) => fs.existsSync(c));
25
+ if (!found) {
26
+ return { errors: [{ text: `@cascade/contracts not found (looked in ${candidates.join(", ")})` }] };
27
+ }
28
+ return { path: found };
29
+ });
30
+ build2.onLoad({ filter: /.*/, namespace: "cascade-runtime" }, (args) => {
31
+ if (args.path === "cascade/config") {
32
+ return { contents: configRuntimeSource(readProjectManifest(project.root).settings), loader: "ts" };
33
+ }
34
+ const candidates = [
35
+ path.join(__dirname_compile, "runtime", `${args.path.slice("cascade/".length)}.ts`),
36
+ path.join(__dirname_compile, "..", "src", "runtime", `${args.path.slice("cascade/".length)}.ts`)
37
+ ];
38
+ const found = candidates.find((c) => fs.existsSync(c));
39
+ if (!found) {
40
+ return { errors: [{ text: `${args.path} runtime not found (looked in ${candidates.join(", ")})` }] };
41
+ }
42
+ return { contents: fs.readFileSync(found, "utf-8"), loader: "ts", resolveDir: path.dirname(found) };
43
+ });
44
+ }
45
+ };
46
+ }
47
+ function commonOptions(project) {
48
+ return {
49
+ bundle: true,
50
+ format: "esm",
51
+ platform: "browser",
52
+ target: "es2022",
53
+ write: false,
54
+ logLevel: "silent",
55
+ plugins: [cascadeRuntimePlugin(project)]
56
+ };
57
+ }
58
+ async function compileProjectModule(project, moduleName) {
59
+ try {
60
+ await project.moduleRunsOn(moduleName);
61
+ return await compileEntry(project, project.resolve(`nodes/${moduleName}/index.ts`));
62
+ } catch (err) {
63
+ return { ok: false, code: "", errors: [errorMessage(err)] };
64
+ }
65
+ }
66
+ async function compileProjectPanel(project, panelName) {
67
+ try {
68
+ return await compileEntry(project, await project.resolvePanelEntry(panelName));
69
+ } catch (err) {
70
+ return { ok: false, code: "", errors: [errorMessage(err)] };
71
+ }
72
+ }
73
+ async function compileEmbedded(project, code) {
74
+ try {
75
+ const result = await esbuild.build({
76
+ ...commonOptions(project),
77
+ stdin: {
78
+ contents: code,
79
+ loader: "ts",
80
+ resolveDir: project.root,
81
+ sourcefile: "embedded.ts"
82
+ }
83
+ });
84
+ return toResult(result);
85
+ } catch (err) {
86
+ return { ok: false, code: "", errors: [errorMessage(err)] };
87
+ }
88
+ }
89
+ function toResult(result) {
90
+ const errors = result.errors.map((e) => e.text);
91
+ const code = result.outputFiles?.[0]?.text ?? "";
92
+ return { ok: errors.length === 0, code, errors };
93
+ }
94
+ async function compileEntry(project, entryPath) {
95
+ return toResult(await esbuild.build({ ...commonOptions(project), entryPoints: [entryPath] }));
96
+ }
97
+ function configRuntimeSource(settings) {
98
+ return `function deepFreeze(value) { if (value && typeof value === 'object') { for (const item of Object.values(value)) deepFreeze(item); Object.freeze(value); } return value; }
99
+ const values = deepFreeze(${JSON.stringify(settings)});
100
+ function value(name) { return Object.prototype.hasOwnProperty.call(values, name) ? values[name] : undefined; }
101
+ export const config = Object.freeze({
102
+ get(name, fallback) { return value(name) ?? fallback; },
103
+ string(name, fallback = '') { const item = value(name); return typeof item === 'string' ? item : fallback; },
104
+ number(name, fallback = 0) { const item = value(name); return typeof item === 'number' && Number.isFinite(item) ? item : fallback; },
105
+ boolean(name, fallback = false) { const item = value(name); return typeof item === 'boolean' ? item : fallback; },
106
+ has(name) { return value(name) !== undefined; }
107
+ });`;
108
+ }
109
+ function errorMessage(err) {
110
+ if (err && typeof err === "object" && "errors" in err) {
111
+ const errors = err.errors;
112
+ if (errors?.length) return errors.map((e) => e.text).join("\n");
113
+ }
114
+ return err instanceof Error ? err.message : String(err);
115
+ }
116
+
117
+ export {
118
+ compileProjectModule,
119
+ compileProjectPanel,
120
+ compileEmbedded
121
+ };
122
+ //# sourceMappingURL=chunk-EU4ZFZ7Y.js.map
@@ -101,4 +101,4 @@ export {
101
101
  canvasAvailable,
102
102
  installHeadlessCanvas
103
103
  };
104
- //# sourceMappingURL=chunk-WIH4TEIS.js.map
104
+ //# sourceMappingURL=chunk-EZRWJ4G2.js.map
@@ -68,4 +68,4 @@ export {
68
68
  normalizeCascadeType,
69
69
  canConnectTypes
70
70
  };
71
- //# sourceMappingURL=chunk-BIJO5OFS.js.map
71
+ //# sourceMappingURL=chunk-FWMSGKEH.js.map
@@ -118,6 +118,34 @@ var VERBS = [
118
118
  call: { kind: "cli", argv: (args, resolve) => ["export", resolve(args.graph), ...args.out ? ["--out", resolve(args.out)] : ["--plan"]] }
119
119
  }]
120
120
  },
121
+ {
122
+ ...editorVerb,
123
+ name: "share",
124
+ json: "keep",
125
+ usage: "<graph-file | site-directory> [--name <slug>] [--scope <team>] [--protected]",
126
+ summary: "Export and deploy to Vercel as cascade-<slug>; print the link and record it in shares.json",
127
+ mcp: [{
128
+ name: "share",
129
+ description: "Share a graph's editor, or a static directory with an index.html, as one link (cascade share): export, deploy to the Vercel project cascade-<name> and return `url`, recorded in the project's shares.json. Public unless `protected`.",
130
+ inputSchema: object({
131
+ graph: { type: "string", description: "The .cascade file or site directory, relative to the project directory" },
132
+ name: { type: "string", description: "Slug; the Vercel project is cascade-<name> (default: the editor id or directory name)" },
133
+ scope: { type: "string", description: "Vercel team (default field-io)" },
134
+ protected: { type: "boolean", description: "Require Vercel Authentication instead of a public link" }
135
+ }, ["graph"]),
136
+ call: {
137
+ kind: "cli",
138
+ argv: (args, resolve) => [
139
+ "share",
140
+ resolve(args.graph),
141
+ ...args.name ? ["--name", String(args.name)] : [],
142
+ ...args.scope ? ["--scope", String(args.scope)] : [],
143
+ ...args.protected ? ["--protected"] : []
144
+ ],
145
+ timeoutMs: () => 10 * 6e4
146
+ }
147
+ }]
148
+ },
121
149
  { ...editorVerb, name: "publish", usage: "<graph-file> <node>.<prop> [--label ...]", summary: "Publish a node prop as an editor parameter" },
122
150
  { ...editorVerb, name: "freeze", usage: "<graph-file> <node> --fields <a,b>", summary: "Snapshot chosen fields of a live data source for export" },
123
151
  { ...editorVerb, name: "scene", usage: "<graph-file> <scene.json> --out <new-graph-file>", summary: "Apply a scene file to a copy of the graph" },
@@ -434,11 +462,11 @@ var VERBS = [
434
462
  {
435
463
  ...lockVerb,
436
464
  name: "ladder",
437
- usage: "<graph-file> <node> --name <name> --vary <node.prop>=<a,b,c> | --seeds <a,b,c>",
438
- summary: "Cook 3-5 variants, write a labelled contact sheet and ladders/<id>.json",
465
+ usage: "<graph-file> <node> --name <name> --vary <node.prop>=<a,b,c> | --seeds <a,b,c> [--cairn <vault dir>]",
466
+ summary: "Cook 3-5 variants, write a labelled contact sheet and ladders/<id>.json; --cairn makes a tap-to-pick card",
439
467
  mcp: [{
440
468
  name: "ladder",
441
- description: "Cook `node` once per variant (cascade ladder) and return the contact sheet, each variant image and the record ladders/<id>.json. `vary` maps node.prop to a list of values (zipped; one value applies to all); `seeds` varies the graph seed. Three to five variants is the usual.",
469
+ description: 'Cook `node` once per variant (cascade ladder) and return the contact sheet, each variant image and the record ladders/<id>.json. `vary` maps node.prop to a list of values (zipped; one value applies to all); `seeds` varies the graph seed. Three to five variants is the usual. `cairn` is a directory in the Substrate vault (the space\'s _attachments/ladders/<id>): each variant is copied there and `data.cairnChoice` is a cairn:choice fence to post as is (at most 8 variants); a tap comes back as "Picked: <label> (pick:<id>:<n>)", then call `pick` with ladder <id> and variant <n>.',
442
470
  inputSchema: object({
443
471
  graph,
444
472
  node: { type: "string" },
@@ -447,7 +475,9 @@ var VERBS = [
447
475
  seeds: { type: "array", items: { type: "integer" } },
448
476
  columns: { type: "integer" },
449
477
  note: { type: "string" },
450
- live: { type: "boolean" }
478
+ live: { type: "boolean" },
479
+ cairn: { type: "string", description: "Absolute vault directory for the variant images; returns data.cairnChoice" },
480
+ vault: { type: "string", description: "Absolute vault root the cairnChoice image paths are relative to (default: nearest .obsidian or .git above `cairn`)" }
451
481
  }, ["graph", "node", "name"]),
452
482
  call: {
453
483
  kind: "cli",
@@ -457,6 +487,9 @@ var VERBS = [
457
487
  args.node,
458
488
  "--name",
459
489
  args.name,
490
+ // Outside the project by design (the vault), so passed as given: absolute.
491
+ ...args.cairn ? ["--cairn", String(args.cairn)] : [],
492
+ ...args.vault ? ["--vault", String(args.vault)] : [],
460
493
  ...Object.entries(args.vary ?? {}).flatMap(([key, values]) => [
461
494
  "--vary",
462
495
  `${key}=${(Array.isArray(values) ? values : [values]).map((value) => JSON.stringify(value)).join(",")}`
@@ -669,4 +702,4 @@ export {
669
702
  graphCommandsHelp,
670
703
  mainHelp
671
704
  };
672
- //# sourceMappingURL=chunk-POMMNKZZ.js.map
705
+ //# sourceMappingURL=chunk-G23A2BZZ.js.map
@@ -100,6 +100,23 @@ var Color = Object.freeze({
100
100
  opaque(color) {
101
101
  return [clamp(color[0]), clamp(color[1]), clamp(color[2]), 1];
102
102
  },
103
+ /**
104
+ * A colour saved in an older shape, as the one colour: `{ r, g, b, a? }`
105
+ * (the class-based image nodes stored that until 2026-11-07) or three
106
+ * components, with alpha 1. Components above 1 are read as 0–255, the way
107
+ * those nodes read them. Anything else comes back unchanged, so a reader can
108
+ * apply this to every stored `color` value and validate the result.
109
+ */
110
+ upgrade(value) {
111
+ const legacy = value !== null && typeof value === "object" && !Array.isArray(value) && "r" in value && "g" in value && "b" in value ? value : Array.isArray(value) && value.length === 3 ? { r: value[0], g: value[1], b: value[2] } : null;
112
+ if (!legacy) return value;
113
+ const parts = [legacy.r, legacy.g, legacy.b, legacy.a ?? 1];
114
+ if (!parts.every((part) => typeof part === "number" && Number.isFinite(part))) return value;
115
+ const numbers = parts;
116
+ const unit2 = numbers.slice(0, 3).every((part) => part <= 1);
117
+ const read = (part) => unit2 ? part : part / 255;
118
+ return [read(numbers[0]), read(numbers[1]), read(numbers[2]), legacy.a === void 0 ? 1 : read(numbers[3])];
119
+ },
103
120
  /**
104
121
  * Four unit components from anything indexable, clamping and defaulting a
105
122
  * missing alpha to 1. The reader for a `Cd` attribute's flat array, and the
@@ -1438,10 +1455,11 @@ var registrationsById = new Map(
1438
1455
  );
1439
1456
 
1440
1457
  export {
1458
+ Color,
1441
1459
  LIGHT_DEFAULTS,
1442
1460
  isLight,
1443
1461
  isScene,
1444
1462
  geoNodeDefinitions,
1445
1463
  geoNodeRegistrations
1446
1464
  };
1447
- //# sourceMappingURL=chunk-35D343DC.js.map
1465
+ //# sourceMappingURL=chunk-GRIN2DDP.js.map
@@ -0,0 +1,83 @@
1
+ // packages/runtime/src/builtins/assert/definitions.ts
2
+ var rangeDefinition = {
3
+ apiVersion: 1,
4
+ runsOn: "portable",
5
+ label: "Assert Range",
6
+ description: "Fails the run unless value is a finite number in [min, max]; passes value through",
7
+ icon: "ShieldCheck",
8
+ inputs: { value: { kind: "data", type: "float", default: 0 } },
9
+ outputs: { value: { kind: "data", type: "float" } },
10
+ props: {
11
+ min: { type: "float", default: 0 },
12
+ max: { type: "float", default: 1 },
13
+ message: { type: "string", default: "" }
14
+ }
15
+ };
16
+ var equalsDefinition = {
17
+ apiVersion: 1,
18
+ runsOn: "portable",
19
+ label: "Assert Equals",
20
+ description: "Fails the run unless value equals expected (JSON-equal; numbers within tolerance); passes value through",
21
+ icon: "ShieldCheck",
22
+ inputs: { value: { kind: "data", type: "any", default: null } },
23
+ outputs: { value: { kind: "data", type: "any" } },
24
+ props: {
25
+ expected: { type: "any", default: null },
26
+ tolerance: { type: "float", default: 0, min: 0 },
27
+ message: { type: "string", default: "" }
28
+ }
29
+ };
30
+ var trueDefinition = {
31
+ apiVersion: 1,
32
+ runsOn: "portable",
33
+ label: "Assert True",
34
+ description: "Fails the run unless value is true (wire a condition, or give the prop an expression); passes value through",
35
+ icon: "ShieldCheck",
36
+ inputs: { value: { kind: "data", type: "bool", default: false } },
37
+ outputs: { value: { kind: "data", type: "bool" } },
38
+ props: { message: { type: "string", default: "" } }
39
+ };
40
+ var notBlankDefinition = {
41
+ apiVersion: 1,
42
+ runsOn: "portable",
43
+ label: "Assert Not Blank",
44
+ description: "Fails the run when an image (PNG or PPM) is one flat colour or fully transparent; passes the image through",
45
+ icon: "ShieldCheck",
46
+ capabilities: ["assets"],
47
+ inputs: { image: { kind: "data", type: "image" } },
48
+ outputs: { image: { kind: "data", type: "image" } },
49
+ props: {
50
+ tolerance: { type: "int", default: 0, min: 0, max: 255, step: 1 },
51
+ message: { type: "string", default: "" }
52
+ }
53
+ };
54
+
55
+ // packages/runtime/src/builtins/assert/index.ts
56
+ var ASSERT_NAMESPACE = "cascade.assert.";
57
+ function lazy(name, definition, load) {
58
+ return { kind: "definition-v1", moduleId: `${ASSERT_NAMESPACE}${name}`, definition, loadExecute: load };
59
+ }
60
+ var rangeRegistration = lazy("Range", rangeDefinition, async () => (await import("./checks-3WB44XBL.js")).executeRange);
61
+ var equalsRegistration = lazy("Equals", equalsDefinition, async () => (await import("./checks-3WB44XBL.js")).executeEquals);
62
+ var trueRegistration = lazy("True", trueDefinition, async () => (await import("./checks-3WB44XBL.js")).executeTrue);
63
+ var notBlankRegistration = lazy("NotBlank", notBlankDefinition, async () => (await import("./checks-3WB44XBL.js")).executeNotBlank);
64
+ var assertNodeRegistrations = Object.freeze([
65
+ equalsRegistration,
66
+ notBlankRegistration,
67
+ rangeRegistration,
68
+ trueRegistration
69
+ ]);
70
+
71
+ export {
72
+ rangeDefinition,
73
+ equalsDefinition,
74
+ trueDefinition,
75
+ notBlankDefinition,
76
+ ASSERT_NAMESPACE,
77
+ rangeRegistration,
78
+ equalsRegistration,
79
+ trueRegistration,
80
+ notBlankRegistration,
81
+ assertNodeRegistrations
82
+ };
83
+ //# sourceMappingURL=chunk-JVOCK5W4.js.map
@@ -0,0 +1,15 @@
1
+ // server/src/runtime/io.ts
2
+ var IO_BRIDGE_KEY = "__cascadeIoBridge";
3
+ function installIoBridge(bridge) {
4
+ const globals = globalThis;
5
+ const previous = globals[IO_BRIDGE_KEY];
6
+ globals[IO_BRIDGE_KEY] = bridge ?? void 0;
7
+ return () => {
8
+ globals[IO_BRIDGE_KEY] = previous;
9
+ };
10
+ }
11
+
12
+ export {
13
+ installIoBridge
14
+ };
15
+ //# sourceMappingURL=chunk-KBGUO27Q.js.map
@@ -67,37 +67,6 @@ function editDistance(a, b) {
67
67
  return previous[b.length];
68
68
  }
69
69
 
70
- // packages/runtime/src/seed.ts
71
- var DEFAULT_GRAPH_SEED = 0;
72
- function graphSeed(document) {
73
- const value = document?.seed;
74
- return typeof value === "number" && Number.isInteger(value) ? value >>> 0 : DEFAULT_GRAPH_SEED;
75
- }
76
- function nodeSeed(seedOfGraph, nodeId) {
77
- const text = `${seedOfGraph >>> 0}:${nodeId}`;
78
- let hash = 2166136261;
79
- for (let index = 0; index < text.length; index++) {
80
- hash ^= text.charCodeAt(index);
81
- hash = Math.imul(hash, 16777619);
82
- }
83
- hash ^= hash >>> 16;
84
- hash = Math.imul(hash, 2246822507);
85
- hash ^= hash >>> 13;
86
- hash = Math.imul(hash, 3266489909);
87
- hash ^= hash >>> 16;
88
- return hash >>> 0;
89
- }
90
- function seededRandom(seed) {
91
- let state = seed >>> 0;
92
- return () => {
93
- state = state + 1831565813 >>> 0;
94
- let value = state;
95
- value = Math.imul(value ^ value >>> 15, value | 1);
96
- value ^= value + Math.imul(value ^ value >>> 7, value | 61);
97
- return ((value ^ value >>> 14) >>> 0) / 4294967296;
98
- };
99
- }
100
-
101
70
  // packages/runtime/src/gpu.ts
102
71
  var HOST_SCOPE = "\0host";
103
72
  var MISSING_DEVICE = "The gpu capability was used before its device was ready \u2014 the host must await ensure() before a cook.";
@@ -274,6 +243,26 @@ function createGpuHost(options) {
274
243
  }
275
244
  return host;
276
245
  }
246
+ async function requestDeviceWithAdapterLimits(adapter) {
247
+ const requiredLimits = readGpuLimits(adapter.limits);
248
+ try {
249
+ return await adapter.requestDevice({ requiredLimits });
250
+ } catch {
251
+ return adapter.requestDevice();
252
+ }
253
+ }
254
+ function gpuLimitShortfall(label, required, gpu) {
255
+ if (!required) return null;
256
+ const short = [];
257
+ for (const [name, wanted] of Object.entries(required)) {
258
+ const have = gpu.limits[name];
259
+ const fits = have !== void 0 && (name.startsWith("min") ? have <= wanted : have >= wanted);
260
+ if (!fits) short.push(`${name} ${wanted} (this GPU: ${have ?? "not reported"})`);
261
+ }
262
+ if (!short.length) return null;
263
+ const adapter = gpu.adapterInfo.description || gpu.adapterInfo.device || gpu.adapterInfo.vendor || "this adapter";
264
+ return `${label} needs GPU limits ${adapter} does not allow: ${short.join(", ")}.`;
265
+ }
277
266
  function readGpuLimits(source) {
278
267
  if (!source || typeof source !== "object") return {};
279
268
  const names = new Set(Object.keys(source));
@@ -290,6 +279,37 @@ function readGpuLimits(source) {
290
279
  return limits;
291
280
  }
292
281
 
282
+ // packages/runtime/src/seed.ts
283
+ var DEFAULT_GRAPH_SEED = 0;
284
+ function graphSeed(document) {
285
+ const value = document?.seed;
286
+ return typeof value === "number" && Number.isInteger(value) ? value >>> 0 : DEFAULT_GRAPH_SEED;
287
+ }
288
+ function nodeSeed(seedOfGraph, nodeId) {
289
+ const text = `${seedOfGraph >>> 0}:${nodeId}`;
290
+ let hash = 2166136261;
291
+ for (let index = 0; index < text.length; index++) {
292
+ hash ^= text.charCodeAt(index);
293
+ hash = Math.imul(hash, 16777619);
294
+ }
295
+ hash ^= hash >>> 16;
296
+ hash = Math.imul(hash, 2246822507);
297
+ hash ^= hash >>> 13;
298
+ hash = Math.imul(hash, 3266489909);
299
+ hash ^= hash >>> 16;
300
+ return hash >>> 0;
301
+ }
302
+ function seededRandom(seed) {
303
+ let state = seed >>> 0;
304
+ return () => {
305
+ state = state + 1831565813 >>> 0;
306
+ let value = state;
307
+ value = Math.imul(value ^ value >>> 15, value | 1);
308
+ value ^= value + Math.imul(value ^ value >>> 7, value | 61);
309
+ return ((value ^ value >>> 14) >>> 0) / 4294967296;
310
+ };
311
+ }
312
+
293
313
  export {
294
314
  bundleFieldType,
295
315
  bundleSchemasCompatible,
@@ -300,9 +320,11 @@ export {
300
320
  bundleValueProblem,
301
321
  isGpuHost,
302
322
  createGpuHost,
323
+ requestDeviceWithAdapterLimits,
324
+ gpuLimitShortfall,
303
325
  DEFAULT_GRAPH_SEED,
304
326
  graphSeed,
305
327
  nodeSeed,
306
328
  seededRandom
307
329
  };
308
- //# sourceMappingURL=chunk-GFS6W3C5.js.map
330
+ //# sourceMappingURL=chunk-L6B6FUQP.js.map