@selvajs/selva 4.21.0-beta.7 → 4.21.0-beta.9

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 (126) hide show
  1. package/build/adapter-node.js +1 -1
  2. package/build/client/_app/immutable/assets/0.CqqJCiiV.css +2 -0
  3. package/build/client/_app/immutable/assets/0.CqqJCiiV.css.br +0 -0
  4. package/build/client/_app/immutable/assets/0.CqqJCiiV.css.gz +0 -0
  5. package/build/client/_app/immutable/chunks/{BepzH9eI.js → DptnDNFA.js} +60 -55
  6. package/build/client/_app/immutable/chunks/DptnDNFA.js.br +0 -0
  7. package/build/client/_app/immutable/chunks/{BepzH9eI.js.gz → DptnDNFA.js.gz} +0 -0
  8. package/build/client/_app/immutable/chunks/DvJo0Zn0.js +1 -0
  9. package/build/client/_app/immutable/chunks/DvJo0Zn0.js.br +1 -0
  10. package/build/client/_app/immutable/chunks/DvJo0Zn0.js.gz +0 -0
  11. package/build/client/_app/immutable/entry/{app.Cmuegtgc.js → app.GRcSFliG.js} +2 -2
  12. package/build/client/_app/immutable/entry/app.GRcSFliG.js.br +0 -0
  13. package/build/client/_app/immutable/entry/app.GRcSFliG.js.gz +0 -0
  14. package/build/client/_app/immutable/nodes/15._hpTnSzc.js +36 -0
  15. package/build/client/_app/immutable/nodes/15._hpTnSzc.js.br +0 -0
  16. package/build/client/_app/immutable/nodes/15._hpTnSzc.js.gz +0 -0
  17. package/build/client/_app/immutable/nodes/21.DpKe0-GH.js +1 -0
  18. package/build/client/_app/immutable/nodes/21.DpKe0-GH.js.br +0 -0
  19. package/build/client/_app/immutable/nodes/21.DpKe0-GH.js.gz +0 -0
  20. package/build/client/_app/immutable/nodes/{25.D6EkgNRa.js → 25.BacveQsm.js} +1 -1
  21. package/build/client/_app/immutable/nodes/25.BacveQsm.js.br +0 -0
  22. package/build/client/_app/immutable/nodes/25.BacveQsm.js.gz +0 -0
  23. package/build/client/_app/version.json +1 -1
  24. package/build/client/_app/version.json.br +0 -0
  25. package/build/client/_app/version.json.gz +0 -0
  26. package/build/server/.vite/manifest.json +16 -27
  27. package/build/server/_app/immutable/assets/_layout.CqqJCiiV.css +2 -0
  28. package/build/server/chunks/api-errors.js +18 -3
  29. package/build/server/chunks/api-errors.js.map +1 -1
  30. package/build/server/chunks/boot.server.js +1 -1
  31. package/build/server/chunks/bootHealth.server.js +23 -23
  32. package/build/server/chunks/bootHealth.server.js.map +1 -1
  33. package/build/server/chunks/computeRateLimit.server.js +1 -1
  34. package/build/server/chunks/delete-with-blobs.js +1 -1
  35. package/build/server/chunks/engine.server.js +50 -3
  36. package/build/server/chunks/engine.server.js.map +1 -1
  37. package/build/server/chunks/grasshopper.js +1 -1
  38. package/build/server/chunks/handlers.js +4 -4
  39. package/build/server/chunks/handlers.js.map +1 -1
  40. package/build/server/chunks/http2.js +1 -1
  41. package/build/server/chunks/instance.js +3 -3
  42. package/build/server/chunks/internal.js +1 -1
  43. package/build/server/chunks/{abort-Bfrdupaj.js → keepalive-vtcjhAV3.js} +6 -3
  44. package/build/server/chunks/keepalive-vtcjhAV3.js.map +1 -0
  45. package/build/server/chunks/package.js +2 -1
  46. package/build/server/chunks/package.js.map +1 -1
  47. package/build/server/chunks/permissions.server.js +1 -1
  48. package/build/server/chunks/providers.server.js +142 -18
  49. package/build/server/chunks/providers.server.js.map +1 -1
  50. package/build/server/chunks/resolve-server.js +1 -1
  51. package/build/server/chunks/schema-extraction.js +75 -8
  52. package/build/server/chunks/schema-extraction.js.map +1 -1
  53. package/build/server/chunks/server-config-write.js +6 -6
  54. package/build/server/chunks/server-config-write.js.map +1 -1
  55. package/build/server/chunks/serverStats.server.js +1 -1
  56. package/build/server/chunks/solve.server.js +4 -5
  57. package/build/server/chunks/solve.server.js.map +1 -1
  58. package/build/server/chunks/sveltekit.js +3 -4
  59. package/build/server/chunks/sveltekit.js.map +1 -1
  60. package/build/server/chunks/update-outcome.js +11 -0
  61. package/build/server/chunks/update-outcome.js.map +1 -1
  62. package/build/server/chunks/updateCheck.server.js +23 -11
  63. package/build/server/chunks/updateCheck.server.js.map +1 -1
  64. package/build/server/entries/endpoints/api/admin/compute/_server.ts.js +1 -1
  65. package/build/server/entries/endpoints/api/admin/compute/actions/_server.ts.js +1 -1
  66. package/build/server/entries/endpoints/api/admin/compute/status/_server.ts.js +1 -1
  67. package/build/server/entries/endpoints/api/admin/system/health/_server.ts.js +3 -2
  68. package/build/server/entries/endpoints/api/admin/system/health/_server.ts.js.map +1 -1
  69. package/build/server/entries/endpoints/api/admin/system/update/_server.ts.js +32 -1
  70. package/build/server/entries/endpoints/api/admin/system/update/_server.ts.js.map +1 -1
  71. package/build/server/entries/endpoints/api/admin/users/_id_/_server.ts.js +1 -1
  72. package/build/server/entries/endpoints/api/admin/users/_id_/disable/_server.ts.js +1 -1
  73. package/build/server/entries/endpoints/api/admin/users/_server.ts.js +1 -1
  74. package/build/server/entries/endpoints/api/files/_...path_/_server.ts.js +1 -1
  75. package/build/server/entries/endpoints/api/v1/compute/_server.ts.js +10 -5
  76. package/build/server/entries/endpoints/api/v1/compute/_server.ts.js.map +1 -1
  77. package/build/server/entries/endpoints/api/v1/compute/schema/_server.ts.js +2 -2
  78. package/build/server/entries/endpoints/api/v1/definitions/_guid_/solve/_server.ts.js +3 -3
  79. package/build/server/entries/endpoints/mcp/_server.ts.js +38 -9
  80. package/build/server/entries/endpoints/mcp/_server.ts.js.map +1 -1
  81. package/build/server/entries/hooks.server.js +1 -1
  82. package/build/server/entries/pages/admin/compute/_page.server.ts.js +1 -2
  83. package/build/server/entries/pages/admin/compute/_page.server.ts.js.map +1 -1
  84. package/build/server/entries/pages/admin/system/_page.server.ts.js +8 -3
  85. package/build/server/entries/pages/admin/system/_page.server.ts.js.map +1 -1
  86. package/build/server/entries/pages/admin/system/_page.svelte.js +18 -2
  87. package/build/server/entries/pages/admin/system/_page.svelte.js.map +1 -1
  88. package/build/server/entries/pages/library/_guid_/_page.server.ts.js +198 -99
  89. package/build/server/entries/pages/library/_guid_/_page.server.ts.js.map +1 -1
  90. package/build/server/entries/pages/library/_guid_/_page.svelte.js +462 -30
  91. package/build/server/entries/pages/library/_guid_/_page.svelte.js.map +1 -1
  92. package/build/server/entries/pages/projects/_page.svelte.js +2 -0
  93. package/build/server/entries/pages/projects/_page.svelte.js.map +1 -1
  94. package/build/server/manifest-full.js +1 -1
  95. package/build/server/manifest.js +1 -1
  96. package/build/server/nodes/0.js +2 -2
  97. package/build/server/nodes/15.js +1 -1
  98. package/build/server/nodes/21.js +1 -1
  99. package/build/server/nodes/25.js +1 -1
  100. package/build/server/server.js +1 -1
  101. package/package.json +14 -11
  102. package/templates/.env.example +5 -3
  103. package/build/client/_app/immutable/assets/0.2jDm0bqh.css +0 -2
  104. package/build/client/_app/immutable/assets/0.2jDm0bqh.css.br +0 -0
  105. package/build/client/_app/immutable/assets/0.2jDm0bqh.css.gz +0 -0
  106. package/build/client/_app/immutable/chunks/BepzH9eI.js.br +0 -0
  107. package/build/client/_app/immutable/chunks/BmoT9ksD.js +0 -1
  108. package/build/client/_app/immutable/chunks/BmoT9ksD.js.br +0 -1
  109. package/build/client/_app/immutable/chunks/BmoT9ksD.js.gz +0 -0
  110. package/build/client/_app/immutable/entry/app.Cmuegtgc.js.br +0 -0
  111. package/build/client/_app/immutable/entry/app.Cmuegtgc.js.gz +0 -0
  112. package/build/client/_app/immutable/nodes/15.BXIV1QfS.js +0 -32
  113. package/build/client/_app/immutable/nodes/15.BXIV1QfS.js.br +0 -0
  114. package/build/client/_app/immutable/nodes/15.BXIV1QfS.js.gz +0 -0
  115. package/build/client/_app/immutable/nodes/21.DvC40Ypm.js +0 -1
  116. package/build/client/_app/immutable/nodes/21.DvC40Ypm.js.br +0 -0
  117. package/build/client/_app/immutable/nodes/21.DvC40Ypm.js.gz +0 -0
  118. package/build/client/_app/immutable/nodes/25.D6EkgNRa.js.br +0 -0
  119. package/build/client/_app/immutable/nodes/25.D6EkgNRa.js.gz +0 -0
  120. package/build/server/_app/immutable/assets/_layout.2jDm0bqh.css +0 -2
  121. package/build/server/chunks/abort-Bfrdupaj.js.map +0 -1
  122. package/build/server/chunks/computeLimits.js +0 -33
  123. package/build/server/chunks/computeLimits.js.map +0 -1
  124. /package/build/client/_app/immutable/nodes/{0.CYdyv5To.js → 0.Ds0zeDAg.js} +0 -0
  125. /package/build/client/_app/immutable/nodes/{0.CYdyv5To.js.br → 0.Ds0zeDAg.js.br} +0 -0
  126. /package/build/client/_app/immutable/nodes/{0.CYdyv5To.js.gz → 0.Ds0zeDAg.js.gz} +0 -0
@@ -1,6 +1,6 @@
1
1
  import { k as ApiErrorCode } from "./access.js";
2
2
  import "./api.js";
3
- import { n as handleApiError, t as apiError } from "./api-errors.js";
3
+ import { r as handleApiError, t as apiError } from "./api-errors.js";
4
4
  import { json } from "@sveltejs/kit";
5
5
  // src/lib/server/api/http.ts
6
6
  /**
@@ -213,7 +213,7 @@ function server_data_serializer(event, state) {
213
213
  let promise_id = 1;
214
214
  let max_nodes = -1;
215
215
  const iterator = create_async_iterator();
216
- const global = "__sveltekit_3oxlh6";
216
+ const global = "__sveltekit_lovnq2";
217
217
  /** @param {number} index */
218
218
  function get_replacer(index) {
219
219
  /** @param {any} thing */
@@ -1443,7 +1443,7 @@ async function render_response({ branch, fetched, page_config, status, error = n
1443
1443
  "crossorigin"
1444
1444
  ]);
1445
1445
  }
1446
- const global = "__sveltekit_3oxlh6";
1446
+ const global = "__sveltekit_lovnq2";
1447
1447
  const { data, chunks } = data_serializer.get_data(csp);
1448
1448
  if (page_config.ssr && page_config.csr) body += `\n\t\t\t${fetched.map((item) => serialize_data(item, resolve_opts.filterSerializedResponseHeaders, !!(state.prerendering || state.prerender_default === true))).join("\n ")}`;
1449
1449
  if (page_config.csr && client) {
@@ -1467,7 +1467,7 @@ async function render_response({ branch, fetched, page_config, status, error = n
1467
1467
  }
1468
1468
  }
1469
1469
  const blocks = [];
1470
- const properties = [`base: ${base_expression}`, `version: ${s("1794234143315")}`];
1470
+ const properties = [`base: ${base_expression}`, `version: ${s("1794555008584")}`];
1471
1471
  if (assets) properties.push(`assets: ${s(assets)}`);
1472
1472
  if (client.uses_env_dynamic_public) properties.push(`env: ${load_env_eagerly ? "null" : uneval$1(rendered_env)}`);
1473
1473
  if (chunks) {
@@ -2363,7 +2363,7 @@ function redirect_response(status, location) {
2363
2363
  * @param {Response} response
2364
2364
  */
2365
2365
  function with_version_header(response) {
2366
- response.headers.set("x-sveltekit-version", "1794234143315");
2366
+ response.headers.set("x-sveltekit-version", "1794555008584");
2367
2367
  return response;
2368
2368
  }
2369
2369
  /**
@@ -18,7 +18,7 @@ function getLayoutItems(schema) {
18
18
  function getInputItems(schema) {
19
19
  return getLayoutItems(schema).filter((i) => i.type === "input");
20
20
  }
21
- // ../solve/dist/abort-Bfrdupaj.js
21
+ // ../solve/dist/keepalive-vtcjhAV3.js
22
22
  /**
23
23
  * Inputs the schema marks `source.kind === 'server'`. No resolver fills them, so they solve with
24
24
  * their schema default: the client sends no value for them, and the server refuses one.
@@ -35,6 +35,9 @@ function raceAbort(promise, signal) {
35
35
  promise.then(resolve, reject).finally(() => signal.removeEventListener("abort", onAbort));
36
36
  });
37
37
  }
38
- export { getLayoutItems as a, getInputItems as i, serverSourcedInputIds as n, getGroups as r, raceAbort as t };
38
+ var KEEPALIVE_PREFERENCE = "selva-keepalive";
39
+ /** Under the 30 s many load balancers allow an idle upstream. */
40
+ var KEEPALIVE_INTERVAL_MS = 15e3;
41
+ export { getGroups as a, serverSourcedInputIds as i, KEEPALIVE_PREFERENCE as n, getInputItems as o, raceAbort as r, getLayoutItems as s, KEEPALIVE_INTERVAL_MS as t };
39
42
 
40
- //# sourceMappingURL=abort-Bfrdupaj.js.map
43
+ //# sourceMappingURL=keepalive-vtcjhAV3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keepalive-vtcjhAV3.js","names":[],"sources":["../../../../schemas/src/traversal.ts","../../../../solve/dist/keepalive-vtcjhAV3.js"],"sourcesContent":["// Schema layout traversal — the single place that knows how to walk a UISchema's\n// layout. The layout is a discriminated union ('tabbed' | 'flat'); without this module\n// every caller re-derives the `layout.type === 'tabbed' ? tabs.flatMap(...) : groups`\n// branch by hand. Add a new layout kind and you change this file, not a dozen others.\n//\n// Lives in @selvajs/schemas (next to the types it walks) so any package that depends on\n// the schema can traverse it without pulling in @selvajs/ui. Readers are defensive: a\n// missing layout or missing groups/items yields an empty result rather than throwing.\n\nimport type { UISchema, GroupConfig, LayoutItem, InputLayoutItem } from './generated/index.js';\n\n/**\n * Every group across the schema, in tab order, with tab boundaries flattened away.\n * Callers that need the tab structure (e.g. position-based panels) must walk `layout`\n * directly — this is intentionally a group-level view.\n */\nexport function getGroups(schema: UISchema): GroupConfig[] {\n\tif (!schema?.layout) return [];\n\tif (schema.layout.type === 'tabbed') {\n\t\treturn schema.layout.tabs?.flatMap((t) => t.groups ?? []) ?? [];\n\t}\n\tif (schema.layout.type === 'flat') {\n\t\treturn schema.layout.groups ?? [];\n\t}\n\treturn [];\n}\n\n/** Every layout item across every group — inputs, outputs, and linebreaks. */\nexport function getLayoutItems(schema: UISchema): LayoutItem[] {\n\treturn getGroups(schema).flatMap((g) => g.items ?? []);\n}\n\n/** Only the input items. `getExternalInputs` and preset save build on this. */\nexport function getInputItems(schema: UISchema): InputLayoutItem[] {\n\treturn getLayoutItems(schema).filter((i): i is InputLayoutItem => i.type === 'input');\n}\n","import { getInputItems } from \"@selvajs/schemas\";\n// src/shared/server-sourced.ts\n/**\n* Inputs the schema marks `source.kind === 'server'`. No resolver fills them, so they solve with\n* their schema default: the client sends no value for them, and the server refuses one.\n*/\nfunction serverSourcedInputIds(schema) {\n\treturn new Set(getInputItems(schema).filter((item) => item.source?.kind === \"server\").map((item) => item.paramId));\n}\n// src/shared/abort.ts\n/** `promise`'s outcome, or a rejection with `signal`'s reason if that fires first. */\nfunction raceAbort(promise, signal) {\n\treturn new Promise((resolve, reject) => {\n\t\tconst onAbort = () => reject(signal.reason);\n\t\tif (signal.aborted) onAbort();\n\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t\tpromise.then(resolve, reject).finally(() => signal.removeEventListener(\"abort\", onAbort));\n\t});\n}\n// src/shared/keepalive.ts\nconst KEEPALIVE_PREFERENCE = \"selva-keepalive\";\n/** Under the 30 s many load balancers allow an idle upstream. */\nconst KEEPALIVE_INTERVAL_MS = 15e3;\nexport { serverSourcedInputIds as i, KEEPALIVE_PREFERENCE as n, raceAbort as r, KEEPALIVE_INTERVAL_MS as t };\n\n//# sourceMappingURL=keepalive-vtcjhAV3.js.map"],"mappings":";;;;;;AAgBA,SAAgB,UAAU,QAAiC;CAC1D,IAAI,CAAC,QAAQ,QAAQ,OAAO,CAAC;CAC7B,IAAI,OAAO,OAAO,SAAS,UAC1B,OAAO,OAAO,OAAO,MAAM,SAAS,MAAM,EAAE,UAAU,CAAC,CAAC,KAAK,CAAC;CAE/D,IAAI,OAAO,OAAO,SAAS,QAC1B,OAAO,OAAO,OAAO,UAAU,CAAC;CAEjC,OAAO,CAAC;AACT;;AAGA,SAAgB,eAAe,QAAgC;CAC9D,OAAO,UAAU,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,SAAS,CAAC,CAAC;AACtD;;AAGA,SAAgB,cAAc,QAAqC;CAClE,OAAO,eAAe,MAAM,CAAC,CAAC,QAAQ,MAA4B,EAAE,SAAS,OAAO;AACrF;;;;;;AC7BA,SAAS,sBAAsB,QAAQ;CACtC,OAAO,IAAI,IAAI,cAAc,MAAM,CAAC,CAAC,QAAQ,SAAS,KAAK,QAAQ,SAAS,QAAQ,CAAC,CAAC,KAAK,SAAS,KAAK,OAAO,CAAC;AAClH;;AAGA,SAAS,UAAU,SAAS,QAAQ;CACnC,OAAO,IAAI,SAAS,SAAS,WAAW;EACvC,MAAM,gBAAgB,OAAO,OAAO,MAAM;EAC1C,IAAI,OAAO,SAAS,QAAQ;EAC5B,OAAO,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;EACxD,QAAQ,KAAK,SAAS,MAAM,CAAC,CAAC,cAAc,OAAO,oBAAoB,SAAS,OAAO,CAAC;CACzF,CAAC;AACF;AAEA,IAAM,uBAAuB;;AAE7B,IAAM,wBAAwB"}
@@ -1,6 +1,6 @@
1
1
  var package_default = {
2
2
  name: "@selvajs/selva",
3
- version: "4.21.0-beta.7",
3
+ version: "4.21.0-beta.9",
4
4
  description: "Selva — self-contained Grasshopper-driven web app. Install, configure via .env, deploy.",
5
5
  license: "MIT",
6
6
  author: "VektorNode",
@@ -24,6 +24,7 @@ var package_default = {
24
24
  main: "./build/index.js",
25
25
  files: ["build", "templates"],
26
26
  engines: { "node": ">=24.0.0" },
27
+ selva: { "dataFormat": 2 },
27
28
  scripts: {
28
29
  "dev": "vite dev",
29
30
  "dev:lan": "vite dev --host",
@@ -1 +1 @@
1
- {"version":3,"file":"package.js","names":[],"sources":["../../../package.json"],"sourcesContent":["{\n\t\"name\": \"@selvajs/selva\",\n\t\"version\": \"4.21.0-beta.7\",\n\t\"description\": \"Selva — self-contained Grasshopper-driven web app. Install, configure via .env, deploy.\",\n\t\"license\": \"MIT\",\n\t\"author\": \"VektorNode\",\n\t\"homepage\": \"https://selva.dev\",\n\t\"bugs\": \"https://github.com/VektorNode/selva/issues\",\n\t\"keywords\": [\n\t\t\"grasshopper\",\n\t\t\"rhino\",\n\t\t\"rhino-compute\",\n\t\t\"parametric-design\",\n\t\t\"web-app\",\n\t\t\"sveltekit\"\n\t],\n\t\"publishConfig\": {\n\t\t\"access\": \"public\"\n\t},\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"git+https://github.com/VektorNode/selva.git\",\n\t\t\"directory\": \"packages/selva\"\n\t},\n\t\"type\": \"module\",\n\t\"main\": \"./build/index.js\",\n\t\"files\": [\n\t\t\"build\",\n\t\t\"templates\"\n\t],\n\t\"engines\": {\n\t\t\"node\": \">=24.0.0\"\n\t},\n\t\"scripts\": {\n\t\t\"dev\": \"vite dev\",\n\t\t\"dev:lan\": \"vite dev --host\",\n\t\t\"build\": \"rimraf build && vite build && node ./scripts/generate-templates.js && node ./scripts/write-runtime-meta.js\",\n\t\t\"preview\": \"vite preview\",\n\t\t\"start\": \"node build/index.js\",\n\t\t\"clean\": \"rimraf build templates\",\n\t\t\"prepare\": \"svelte-kit sync || echo ''\",\n\t\t\"check\": \"svelte-kit sync && svelte-check --tsconfig ./tsconfig.json\",\n\t\t\"test\": \"vitest run\",\n\t\t\"test:watch\": \"vitest\",\n\t\t\"openapi:generate\": \"node scripts/generate-openapi.js\",\n\t\t\"test:e2e\": \"playwright test\",\n\t\t\"lint\": \"eslint .\",\n\t\t\"lint:types\": \"eslint . --config eslint.typed.config.js\",\n\t\t\"generate:cli-config\": \"node scripts/generate-cli-config.js\"\n\t},\n\t\"dependencies\": {\n\t\t\"@lucide/svelte\": \"catalog:\",\n\t\t\"@supabase/supabase-js\": \"catalog:\",\n\t\t\"@sveltejs/kit\": \"catalog:\",\n\t\t\"bits-ui\": \"catalog:\",\n\t\t\"clsx\": \"catalog:\",\n\t\t\"mode-watcher\": \"catalog:\",\n\t\t\"nodemailer\": \"catalog:\",\n\t\t\"pino\": \"^10.4.0\",\n\t\t\"rhino3dm\": \"catalog:\",\n\t\t\"sharp\": \"catalog:\",\n\t\t\"tailwind-merge\": \"catalog:\",\n\t\t\"tailwind-variants\": \"catalog:\",\n\t\t\"three\": \"catalog:\",\n\t\t\"zod\": \"catalog:\"\n\t},\n\t\"optionalDependencies\": {\n\t\t\"@sentry/node\": \"^11.10.0\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@playwright/test\": \"catalog:\",\n\t\t\"@selvajs/compute\": \"workspace:*\",\n\t\t\"@selvajs/config\": \"workspace:*\",\n\t\t\"@selvajs/header-auth-provider\": \"workspace:*\",\n\t\t\"@selvajs/local-provider\": \"workspace:*\",\n\t\t\"@selvajs/mcp\": \"workspace:*\",\n\t\t\"@selvajs/notifications\": \"workspace:*\",\n\t\t\"@selvajs/platform\": \"workspace:*\",\n\t\t\"@selvajs/schemas\": \"workspace:*\",\n\t\t\"@selvajs/server\": \"workspace:*\",\n\t\t\"@selvajs/solve\": \"workspace:*\",\n\t\t\"@selvajs/supabase-provider\": \"workspace:*\",\n\t\t\"@selvajs/ui\": \"workspace:*\",\n\t\t\"@selvajs/visualization\": \"workspace:*\",\n\t\t\"@sveltejs/adapter-node\": \"catalog:\",\n\t\t\"@types/nodemailer\": \"catalog:\",\n\t\t\"@types/three\": \"catalog:\",\n\t\t\"rimraf\": \"catalog:\",\n\t\t\"tw-animate-css\": \"catalog:\",\n\t\t\"vitest\": \"catalog:\"\n\t},\n\t\"imports\": {\n\t\t\"#lib/*\": \"./src/lib/*\"\n\t}\n}\n"],"mappings":""}
1
+ {"version":3,"file":"package.js","names":[],"sources":["../../../package.json"],"sourcesContent":["{\n\t\"name\": \"@selvajs/selva\",\n\t\"version\": \"4.21.0-beta.9\",\n\t\"description\": \"Selva — self-contained Grasshopper-driven web app. Install, configure via .env, deploy.\",\n\t\"license\": \"MIT\",\n\t\"author\": \"VektorNode\",\n\t\"homepage\": \"https://selva.dev\",\n\t\"bugs\": \"https://github.com/VektorNode/selva/issues\",\n\t\"keywords\": [\n\t\t\"grasshopper\",\n\t\t\"rhino\",\n\t\t\"rhino-compute\",\n\t\t\"parametric-design\",\n\t\t\"web-app\",\n\t\t\"sveltekit\"\n\t],\n\t\"publishConfig\": {\n\t\t\"access\": \"public\"\n\t},\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"git+https://github.com/VektorNode/selva.git\",\n\t\t\"directory\": \"packages/selva\"\n\t},\n\t\"type\": \"module\",\n\t\"main\": \"./build/index.js\",\n\t\"files\": [\n\t\t\"build\",\n\t\t\"templates\"\n\t],\n\t\"engines\": {\n\t\t\"node\": \">=24.0.0\"\n\t},\n\t\"selva\": {\n\t\t\"dataFormat\": 2\n\t},\n\t\"scripts\": {\n\t\t\"dev\": \"vite dev\",\n\t\t\"dev:lan\": \"vite dev --host\",\n\t\t\"build\": \"rimraf build && vite build && node ./scripts/generate-templates.js && node ./scripts/write-runtime-meta.js\",\n\t\t\"preview\": \"vite preview\",\n\t\t\"start\": \"node build/index.js\",\n\t\t\"clean\": \"rimraf build templates\",\n\t\t\"prepare\": \"svelte-kit sync || echo ''\",\n\t\t\"check\": \"svelte-kit sync && svelte-check --tsconfig ./tsconfig.json\",\n\t\t\"test\": \"vitest run\",\n\t\t\"test:watch\": \"vitest\",\n\t\t\"openapi:generate\": \"node scripts/generate-openapi.js\",\n\t\t\"test:e2e\": \"playwright test\",\n\t\t\"lint\": \"eslint .\",\n\t\t\"lint:types\": \"eslint . --config eslint.typed.config.js\",\n\t\t\"generate:cli-config\": \"node scripts/generate-cli-config.js\"\n\t},\n\t\"dependencies\": {\n\t\t\"@lucide/svelte\": \"catalog:\",\n\t\t\"@supabase/supabase-js\": \"catalog:\",\n\t\t\"@sveltejs/kit\": \"catalog:\",\n\t\t\"bits-ui\": \"catalog:\",\n\t\t\"clsx\": \"catalog:\",\n\t\t\"mode-watcher\": \"catalog:\",\n\t\t\"nodemailer\": \"catalog:\",\n\t\t\"pino\": \"^10.4.0\",\n\t\t\"rhino3dm\": \"catalog:\",\n\t\t\"sharp\": \"catalog:\",\n\t\t\"tailwind-merge\": \"catalog:\",\n\t\t\"tailwind-variants\": \"catalog:\",\n\t\t\"three\": \"catalog:\",\n\t\t\"zod\": \"catalog:\"\n\t},\n\t\"optionalDependencies\": {\n\t\t\"@sentry/node\": \"^11.10.0\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@playwright/test\": \"catalog:\",\n\t\t\"@selvajs/compute\": \"workspace:*\",\n\t\t\"@selvajs/config\": \"workspace:*\",\n\t\t\"@selvajs/header-auth-provider\": \"workspace:*\",\n\t\t\"@selvajs/local-provider\": \"workspace:*\",\n\t\t\"@selvajs/mcp\": \"workspace:*\",\n\t\t\"@selvajs/notifications\": \"workspace:*\",\n\t\t\"@selvajs/platform\": \"workspace:*\",\n\t\t\"@selvajs/schemas\": \"workspace:*\",\n\t\t\"@selvajs/server\": \"workspace:*\",\n\t\t\"@selvajs/solve\": \"workspace:*\",\n\t\t\"@selvajs/supabase-provider\": \"workspace:*\",\n\t\t\"@selvajs/ui\": \"workspace:*\",\n\t\t\"@selvajs/visualization\": \"workspace:*\",\n\t\t\"@sveltejs/adapter-node\": \"catalog:\",\n\t\t\"@types/nodemailer\": \"catalog:\",\n\t\t\"@types/three\": \"catalog:\",\n\t\t\"rimraf\": \"catalog:\",\n\t\t\"tw-animate-css\": \"catalog:\",\n\t\t\"vitest\": \"catalog:\"\n\t},\n\t\"imports\": {\n\t\t\"#lib/*\": \"./src/lib/*\"\n\t}\n}\n"],"mappings":""}
@@ -1,4 +1,4 @@
1
- import { U as actorFrom, g as getPermissionStore, u as getEventSink } from "./providers.server.js";
1
+ import { K as actorFrom, g as getPermissionStore, u as getEventSink } from "./providers.server.js";
2
2
  // src/lib/server/permissions.server.ts
3
3
  /**
4
4
  * Permission read/write seam over `IPlatformPermissionStore`. Reads happen
@@ -8,8 +8,8 @@ import { t as ALL_PLATFORM_PERMISSIONS } from "./types3.js";
8
8
  import { d as encodeOffsetCursor, l as clampPageLimit, u as decodeOffsetCursor } from "./visibility.js";
9
9
  import { n as readBool } from "./limits.js";
10
10
  import { a as createLogger, i as ConsoleLogger, n as renderThrown } from "./definitions.js";
11
- import { c as withSolveMode, h as isDefinitionRef, i as TreeBuilder, l as ComputeError, m as enableDebugLogging, n as GrasshopperClient, s as stableStringify, u as ErrorCodes } from "./grasshopper.js";
12
- import { i as getInputItems, n as serverSourcedInputIds, t as raceAbort } from "./abort-Bfrdupaj.js";
11
+ import { c as stableStringify, d as ErrorCodes, g as isDefinitionRef, h as enableDebugLogging, i as TreeBuilder, l as withSolveMode, n as GrasshopperClient, u as ComputeError } from "./grasshopper.js";
12
+ import { i as serverSourcedInputIds, n as KEEPALIVE_PREFERENCE, o as getInputItems, r as raceAbort, t as KEEPALIVE_INTERVAL_MS } from "./keepalive-vtcjhAV3.js";
13
13
  import { createRequire } from "node:module";
14
14
  import * as crypto from "node:crypto";
15
15
  import { createCipheriv, createDecipheriv, createHash, createHmac, createPrivateKey, randomBytes, randomUUID, sign, timingSafeEqual } from "node:crypto";
@@ -579,6 +579,14 @@ function isEncryptedSecret(value) {
579
579
  function isLegacyEnvelope(value) {
580
580
  return value.startsWith(PREFIX_V1) || value.startsWith(PREFIX_V2);
581
581
  }
582
+ /**
583
+ * An `enc:v<n>:` envelope this build cannot open: a newer Selva sealed it, and this
584
+ * one runs after a downgrade. It is ciphertext, so it must never be reported or
585
+ * used as a plaintext key.
586
+ */
587
+ function isUnknownEnvelope(value) {
588
+ return /^enc:v\d+:/.test(value) && !isEncryptedSecret(value);
589
+ }
582
590
  function bindingAad({ id, url }) {
583
591
  return Buffer.from(JSON.stringify([id, url]), "utf8");
584
592
  }
@@ -1657,21 +1665,43 @@ var LocalComputeServerStore = class LocalComputeServerStore {
1657
1665
  };
1658
1666
  }
1659
1667
  /**
1660
- * Tolerant per-row decrypt: a row that fails to authenticate under the
1661
- * current `SELVA_AT_REST_KEY` comes back with `apiKey: undefined` and a
1662
- * logged warning, rather than failing the whole read — the page keeps
1663
- * rendering, and a solve against that server fails later when
1664
- * Rhino.Compute rejects the missing key. `verifySecrets()` is the strict
1665
- * counterpart for boot time.
1668
+ * Tolerant per-row decrypt: a row whose key cannot be opened comes back with
1669
+ * `apiKey: undefined` and a logged warning, rather than failing the whole read.
1670
+ * The page keeps rendering, and a solve against that server fails later when
1671
+ * Rhino.Compute rejects the missing key. That covers ciphertext that does not
1672
+ * authenticate under the current `SELVA_AT_REST_KEY`, and an envelope from a
1673
+ * newer Selva. `verifySecrets()` is the strict counterpart for boot time.
1666
1674
  *
1667
- * Plaintext-on-disk still hard-fails: the store never writes plaintext
1668
- * (every write goes through `encryptApiKeys`), so seeing it means someone
1669
- * hand-edited the file with a real secret exposed — surface that loudly.
1675
+ * Plaintext is the exception. The store never writes it (every write goes
1676
+ * through `encryptApiKeys`), so seeing it means someone hand-edited the file
1677
+ * with a real secret exposed: a read that would use the key throws.
1678
+ * `plaintext: 'unreadable'` returns the row keyless instead, for the save
1679
+ * path: a throw there would block the save that replaces the key.
1670
1680
  */
1671
- decryptApiKeys(servers) {
1681
+ decryptApiKeys(servers, { plaintext = "throw" } = {}) {
1672
1682
  return servers.map((s) => {
1673
1683
  if (!s.apiKey) return s;
1674
- if (!isEncryptedSecret(s.apiKey)) throw new Error(`compute.config.json contains an unencrypted apiKey for server "${s.label}" (${s.id}). Re-enter the key via /admin/compute so it is stored encrypted.`);
1684
+ const fields = {
1685
+ component: "selva",
1686
+ serverLabel: s.label,
1687
+ serverId: s.id
1688
+ };
1689
+ if (isUnknownEnvelope(s.apiKey)) {
1690
+ this.logger.warn(`Could not read apiKey: it is sealed as ${s.apiKey.slice(0, 6)}, a format this Selva version does not know. A newer version wrote it. This server is returned without an apiKey and solves against it will fail. Upgrade Selva again, or re-enter the key via /admin/compute.`, fields);
1691
+ return {
1692
+ ...s,
1693
+ apiKey: void 0
1694
+ };
1695
+ }
1696
+ if (!isEncryptedSecret(s.apiKey)) {
1697
+ const message = `compute.config.json contains an unencrypted apiKey for server "${s.label}" (${s.id}). Re-enter the key via /admin/compute so it is stored encrypted.`;
1698
+ if (plaintext === "throw") throw new Error(message);
1699
+ this.logger.error(message, fields);
1700
+ return {
1701
+ ...s,
1702
+ apiKey: void 0
1703
+ };
1704
+ }
1675
1705
  try {
1676
1706
  return {
1677
1707
  ...s,
@@ -1679,9 +1709,7 @@ var LocalComputeServerStore = class LocalComputeServerStore {
1679
1709
  };
1680
1710
  } catch (cause) {
1681
1711
  this.logger.warn("Could not decrypt apiKey: the stored ciphertext does not match the current SELVA_AT_REST_KEY. This server is returned without an apiKey and solves against it will fail. Re-enter the key via /admin/compute, or restore the original SELVA_AT_REST_KEY.", {
1682
- component: "selva",
1683
- serverLabel: s.label,
1684
- serverId: s.id,
1712
+ ...fields,
1685
1713
  err: cause instanceof Error ? cause.stack ?? cause.message : String(cause)
1686
1714
  });
1687
1715
  return {
@@ -1706,6 +1734,14 @@ var LocalComputeServerStore = class LocalComputeServerStore {
1706
1734
  let legacyEnvelopes = 0;
1707
1735
  for (const s of all.servers) {
1708
1736
  if (!s.apiKey) continue;
1737
+ if (isUnknownEnvelope(s.apiKey)) {
1738
+ failures.push({
1739
+ serverId: s.id,
1740
+ serverLabel: s.label,
1741
+ reason: "unknown_envelope"
1742
+ });
1743
+ continue;
1744
+ }
1709
1745
  if (!isEncryptedSecret(s.apiKey)) {
1710
1746
  plaintextFound = true;
1711
1747
  failures.push({
@@ -1777,7 +1813,7 @@ var LocalComputeServerStore = class LocalComputeServerStore {
1777
1813
  async getConfig(_ctx, opts = {}) {
1778
1814
  const all = await this.readAll();
1779
1815
  const config = {
1780
- servers: (opts.includeApiKeys ? this.decryptApiKeys(all.servers) : all.servers.map((s) => ({
1816
+ servers: (opts.includeApiKeys ? this.decryptApiKeys(all.servers, { plaintext: "unreadable" }) : all.servers.map((s) => ({
1781
1817
  ...s,
1782
1818
  apiKey: void 0
1783
1819
  }))).map((s, i) => ({
@@ -4619,6 +4655,17 @@ var SupabaseComputeServerStore = class {
4619
4655
  */
4620
4656
  decryptRowApiKey(row) {
4621
4657
  if (!row.api_key) return row;
4658
+ if (isUnknownEnvelope(row.api_key)) {
4659
+ this.logger.warn(`Could not read api_key: it is sealed as ${row.api_key.slice(0, 6)}, a format this Selva version does not know. A newer version wrote it. This server is returned without an apiKey and solves against it will fail. Upgrade Selva again, or re-enter the key via /admin/compute`, {
4660
+ component: "selva",
4661
+ serverLabel: row.label,
4662
+ serverId: row.id
4663
+ });
4664
+ return {
4665
+ ...row,
4666
+ api_key: null
4667
+ };
4668
+ }
4622
4669
  if (!isEncryptedSecret(row.api_key)) {
4623
4670
  this.logger.warn("Compute server row has a plaintext api_key; re-save it via /admin/compute so it is stored encrypted", {
4624
4671
  component: "selva",
@@ -4672,6 +4719,14 @@ var SupabaseComputeServerStore = class {
4672
4719
  for (const row of data ?? []) {
4673
4720
  const { api_key: apiKey, id, label } = row;
4674
4721
  if (!apiKey) continue;
4722
+ if (isUnknownEnvelope(apiKey)) {
4723
+ failures.push({
4724
+ serverId: id,
4725
+ serverLabel: label,
4726
+ reason: "unknown_envelope"
4727
+ });
4728
+ continue;
4729
+ }
4675
4730
  if (!isEncryptedSecret(apiKey)) {
4676
4731
  plaintextFound = true;
4677
4732
  failures.push({
@@ -34193,6 +34248,14 @@ function createClientCache(config) {
34193
34248
  evictEntry(id);
34194
34249
  }
34195
34250
  },
34251
+ largestReportedRequestBytes() {
34252
+ let largest = null;
34253
+ for (const { limits } of cache.values()) {
34254
+ const reported = limits.maxRequestBytes;
34255
+ if (reported !== null && (largest === null || reported > largest)) largest = reported;
34256
+ }
34257
+ return largest;
34258
+ },
34196
34259
  solveCacheStats() {
34197
34260
  const total = {
34198
34261
  warmClients: cache.size,
@@ -34707,6 +34770,13 @@ var SolveEngine = class {
34707
34770
  this.clientCache.clearSolveCaches();
34708
34771
  }
34709
34772
  /**
34773
+ * The largest request body a warm client's server reports accepting
34774
+ * (`RHINO_COMPUTE_MAX_REQUEST_SIZE`). Null until a server that reports one has been reached.
34775
+ */
34776
+ largestReportedRequestBytes() {
34777
+ return this.clientCache.largestReportedRequestBytes();
34778
+ }
34779
+ /**
34710
34780
  * Drop every retained `.gh` byte entry. Safe at any time: entries key on an
34711
34781
  * immutable version id, so clearing costs a storage re-read and nothing else.
34712
34782
  */
@@ -34870,6 +34940,60 @@ var SolveEngine = class {
34870
34940
  };
34871
34941
  }
34872
34942
  };
34943
+ var SPACE = new Uint8Array([32]);
34944
+ /** True when the request asked for a keep-alive response (`Prefer: selva-keepalive`). */
34945
+ function wantsKeepalive(request) {
34946
+ const prefer = request.headers.get("Prefer");
34947
+ if (!prefer) return false;
34948
+ return prefer.split(",").some((token) => token.split(";")[0].trim().toLowerCase() === KEEPALIVE_PREFERENCE);
34949
+ }
34950
+ /**
34951
+ * Answers 200 at once and holds the connection with a space every `intervalMs` until `work`
34952
+ * settles, then sends its status, headers and body (wire format in `shared/keepalive.ts`).
34953
+ *
34954
+ * `work` must resolve to every outcome, errors included: once the 200 is out, a rejection can
34955
+ * only drop the connection.
34956
+ */
34957
+ function respondWithKeepalive(work, intervalMs = KEEPALIVE_INTERVAL_MS) {
34958
+ let timer;
34959
+ const body = new ReadableStream({
34960
+ start(controller) {
34961
+ controller.enqueue(SPACE);
34962
+ timer = setInterval(() => controller.enqueue(SPACE), intervalMs);
34963
+ work.then(async (response) => {
34964
+ clearInterval(timer);
34965
+ const meta = {
34966
+ status: response.status,
34967
+ headers: [...response.headers]
34968
+ };
34969
+ controller.enqueue(new TextEncoder().encode(`${JSON.stringify(meta)}\n`));
34970
+ if (response.body) {
34971
+ const reader = response.body.getReader();
34972
+ for (;;) {
34973
+ const { done, value } = await reader.read();
34974
+ if (done) break;
34975
+ controller.enqueue(value);
34976
+ }
34977
+ }
34978
+ controller.close();
34979
+ }).catch((err) => {
34980
+ clearInterval(timer);
34981
+ controller.error(err);
34982
+ });
34983
+ },
34984
+ cancel() {
34985
+ clearInterval(timer);
34986
+ }
34987
+ });
34988
+ return new Response(body, {
34989
+ status: 200,
34990
+ headers: {
34991
+ "Content-Type": "application/octet-stream",
34992
+ "Cache-Control": "no-store",
34993
+ "Preference-Applied": KEEPALIVE_PREFERENCE
34994
+ }
34995
+ });
34996
+ }
34873
34997
  // ../server/src/organizations/org-asset-service.ts
34874
34998
  /**
34875
34999
  * Orchestrates org-asset writes that span IStorageProvider + IOrgStore — one
@@ -35641,6 +35765,6 @@ if (!globalThis[ERROR_HOOKS_FLAG]) {
35641
35765
  getErrorReporter().capture(error, { tags: { origin: "uncaughtException" } });
35642
35766
  });
35643
35767
  }
35644
- export { deploymentSnapshot as A, classifyAssetPath as B, getUserProfileStore as C, computeDebugMode as D, RETIRED_KEYS as E, postedServerSourcedIds as F, definitionPaths as G, NoopEventSink as H, solveInputsFromSchema as I, diffSnapshots as K, LocalComputeServerStore as L, MAX_SOLVE_DEADLINE_MS as M, SolveEngine as N, deploymentManifest as O, acceptsGzip as P, isEncryptedSecret as R, getTenancy as S, providers as T, actorFrom as U, orgPaths as V, actorOf as W, getPlatformProjectGrantStore as _, getComputeServerConfigStore as a, getSolveMetricSink as b, getDefinitionService as c, getInviteStore as d, getLogger as f, getPermissionStore as g, getOrganizationProvider as h, getBranding as i, keyRotationStatus as j, deploymentReport as k, getErrorReporter as l, getOrgAssetService as m, getAuditQuery as n, getDataProvider as o, getNotificationProvider as p, getAuthProvider as r, getDefinitionMeta as s, flag as t, getEventSink as u, getProjectProvider as v, lazyLogger as w, getStorageProvider as x, getShareLinkStore as y, emptyProfile as z };
35768
+ export { deploymentSnapshot as A, LocalComputeServerStore as B, getUserProfileStore as C, computeDebugMode as D, RETIRED_KEYS as E, acceptsGzip as F, NoopEventSink as G, emptyProfile as H, postedServerSourcedIds as I, definitionPaths as J, actorFrom as K, respondWithKeepalive as L, DEFAULT_SOLVE_DEADLINE_MS as M, MAX_SOLVE_DEADLINE_MS as N, deploymentManifest as O, SolveEngine as P, solveInputsFromSchema as R, getTenancy as S, providers as T, classifyAssetPath as U, isEncryptedSecret as V, orgPaths as W, diffSnapshots as Y, getPlatformProjectGrantStore as _, getComputeServerConfigStore as a, getSolveMetricSink as b, getDefinitionService as c, getInviteStore as d, getLogger as f, getPermissionStore as g, getOrganizationProvider as h, getBranding as i, keyRotationStatus as j, deploymentReport as k, getErrorReporter as l, getOrgAssetService as m, getAuditQuery as n, getDataProvider as o, getNotificationProvider as p, actorOf as q, getAuthProvider as r, getDefinitionMeta as s, flag as t, getEventSink as u, getProjectProvider as v, lazyLogger as w, getStorageProvider as x, getShareLinkStore as y, wantsKeepalive as z };
35645
35769
 
35646
35770
  //# sourceMappingURL=providers.server.js.map