@selvajs/selva 4.20.1-beta.4 → 4.20.1-beta.5
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/build/adapter-node.js +1 -1
- package/build/client/_app/version.json +1 -1
- package/build/client/_app/version.json.br +0 -0
- package/build/client/_app/version.json.gz +0 -0
- package/build/server/.vite/manifest.json +1 -0
- package/build/server/chunks/engine.server.js +2 -2
- package/build/server/chunks/engine.server.js.map +1 -1
- package/build/server/chunks/grasshopper.js +204 -160
- package/build/server/chunks/grasshopper.js.map +1 -1
- package/build/server/chunks/instance.js +3 -3
- package/build/server/chunks/internal.js +1 -1
- package/build/server/chunks/package.js +1 -1
- package/build/server/chunks/package.js.map +1 -1
- package/build/server/chunks/providers.server.js +55 -38
- package/build/server/chunks/providers.server.js.map +1 -1
- package/build/server/chunks/solve.server.js +27 -1
- package/build/server/chunks/solve.server.js.map +1 -1
- package/build/server/entries/pages/library/_guid_/_page.server.ts.js +2 -2
- package/build/server/entries/pages/library/_guid_/_page.server.ts.js.map +1 -1
- package/package.json +8 -8
|
@@ -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 = "
|
|
216
|
+
const global = "__sveltekit_1w4zbvb";
|
|
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 = "
|
|
1446
|
+
const global = "__sveltekit_1w4zbvb";
|
|
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("
|
|
1470
|
+
const properties = [`base: ${base_expression}`, `version: ${s("1794217168156")}`];
|
|
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", "
|
|
2366
|
+
response.headers.set("x-sveltekit-version", "1794217168156");
|
|
2367
2367
|
return response;
|
|
2368
2368
|
}
|
|
2369
2369
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.js","names":[],"sources":["../../../package.json"],"sourcesContent":["{\n\t\"name\": \"@selvajs/selva\",\n\t\"version\": \"4.20.1-beta.
|
|
1
|
+
{"version":3,"file":"package.js","names":[],"sources":["../../../package.json"],"sourcesContent":["{\n\t\"name\": \"@selvajs/selva\",\n\t\"version\": \"4.20.1-beta.5\",\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":""}
|
|
@@ -33909,6 +33909,40 @@ var unlimitedFetch = ((input, init) => (0, import_undici.fetch)(input, {
|
|
|
33909
33909
|
function fetchForDeadline(deadlineMs) {
|
|
33910
33910
|
return deadlineMs >= UNDICI_DEFAULT_LIMIT_MS ? unlimitedFetch : void 0;
|
|
33911
33911
|
}
|
|
33912
|
+
/**
|
|
33913
|
+
* False for a header carrying only the proxy's `affinity`, from a child that sends no timing:
|
|
33914
|
+
* read as zeros, it would put the whole solve on `compute_link`.
|
|
33915
|
+
*/
|
|
33916
|
+
function reportsTiming(rhino) {
|
|
33917
|
+
return rhino.cacheHit === true || rhino.decode !== void 0 || rhino.solve !== void 0 || rhino.encode !== void 0;
|
|
33918
|
+
}
|
|
33919
|
+
/**
|
|
33920
|
+
* `total` is the server's headers-to-out wall time, so browser `ttfb − total`
|
|
33921
|
+
* ≈ network+send latency. When the compute server reports its own timing
|
|
33922
|
+
* (VektorNode fork), `rhino_*` is time on the compute server and `compute_link`
|
|
33923
|
+
* is everything between it (network + queue wait). `rhino_cache` is 1 when the
|
|
33924
|
+
* compute server answered from its own result cache.
|
|
33925
|
+
*/
|
|
33926
|
+
function buildServerTiming(parts) {
|
|
33927
|
+
let header = `load;dur=${parts.defLoadMs.toFixed(1)}, tree;dur=${parts.treeBuildMs.toFixed(1)}, solve;dur=${parts.solveMs.toFixed(1)}, serialize;dur=${parts.serializeMs.toFixed(1)}, gzip;dur=${parts.gzipMs.toFixed(1)}, total;dur=${parts.serverTotalMs.toFixed(1)}`;
|
|
33928
|
+
const rhino = parts.rhino;
|
|
33929
|
+
if (rhino && reportsTiming(rhino)) {
|
|
33930
|
+
const decode = rhino.decode ?? 0;
|
|
33931
|
+
const solve = rhino.solve ?? 0;
|
|
33932
|
+
const encode = rhino.encode ?? 0;
|
|
33933
|
+
const computeLinkMs = Math.max(0, parts.solveMs - decode - solve - encode);
|
|
33934
|
+
header += `, rhino_decode;dur=${decode.toFixed(1)}, rhino_solve;dur=${solve.toFixed(1)}, rhino_encode;dur=${encode.toFixed(1)}, compute_link;dur=${computeLinkMs.toFixed(1)}, rhino_cache;dur=${rhino.cacheHit ? 1 : 0}`;
|
|
33935
|
+
if (rhino.gh !== void 0) header += `, rhino_gh;dur=${rhino.gh.toFixed(1)}`;
|
|
33936
|
+
if (rhino.recomputed) header += `, rhino_recomputed;desc="${rhino.recomputed.ran}/${rhino.recomputed.total}"`;
|
|
33937
|
+
}
|
|
33938
|
+
if (rhino?.affinity) header += `, rhino_affinity;desc=${rhino.affinity}`;
|
|
33939
|
+
for (const [label, ms] of parts.prepMarks) header += `, p_${label};dur=${ms.toFixed(1)}`;
|
|
33940
|
+
const settle = parts.settle;
|
|
33941
|
+
header += `, selva_cache;dur=${settle.fromCache ? 1 : 0}`;
|
|
33942
|
+
if (settle.definitionReuploaded !== void 0) header += `, def_reupload;dur=${settle.definitionReuploaded ? 1 : 0}`;
|
|
33943
|
+
if (parts.defBytes) header += `, def_bytes;desc=${parts.defBytes}`;
|
|
33944
|
+
return header;
|
|
33945
|
+
}
|
|
33912
33946
|
/** Rhino.Compute's own default `--timeout`, for a server that can't report its own. */
|
|
33913
33947
|
var DEFAULT_SOLVE_DEADLINE_MS = 1e5;
|
|
33914
33948
|
/**
|
|
@@ -33996,7 +34030,7 @@ function createClientCache(config) {
|
|
|
33996
34030
|
draining.delete(entry);
|
|
33997
34031
|
entry.scheduler.dispose();
|
|
33998
34032
|
}
|
|
33999
|
-
async function build(server
|
|
34033
|
+
async function build(server) {
|
|
34000
34034
|
const debugVerbose = config.debug === "verbose";
|
|
34001
34035
|
const longFetch = fetchForDeadline(MAX_SOLVE_DEADLINE_MS);
|
|
34002
34036
|
const clientConfig = {
|
|
@@ -34008,8 +34042,13 @@ function createClientCache(config) {
|
|
|
34008
34042
|
...longFetch && { fetch: longFetch }
|
|
34009
34043
|
};
|
|
34010
34044
|
if (config.debug) clientConfig.onServerTiming = (t) => {
|
|
34045
|
+
const routed = t.affinity ? ` | session ${t.affinity}` : "";
|
|
34011
34046
|
if (t.cacheHit) {
|
|
34012
|
-
debugLog(
|
|
34047
|
+
debugLog(`[Compute/rhino-cache] solve-cache (cachesolve): HIT (cached result, solve skipped)${routed}`);
|
|
34048
|
+
return;
|
|
34049
|
+
}
|
|
34050
|
+
if (!reportsTiming(t)) {
|
|
34051
|
+
debugLog(`[Compute/rhino-cache] no solve timing${routed}`);
|
|
34013
34052
|
return;
|
|
34014
34053
|
}
|
|
34015
34054
|
const decode = t.decode ?? 0;
|
|
@@ -34018,9 +34057,8 @@ function createClientCache(config) {
|
|
|
34018
34057
|
const defCache = decode <= 1 ? "HIT (definition reused, no re-upload/parse)" : "miss (full parse)";
|
|
34019
34058
|
const solveCache = config.cachesolve ? "miss (solved fresh)" : "off";
|
|
34020
34059
|
const ran = t.recomputed ? ` | ran ${t.recomputed.ran}/${t.recomputed.total} objects` : "";
|
|
34021
|
-
debugLog(`[Compute/rhino-cache] decode=${decode}ms solve=${solve}ms encode=${encode}ms | definition-cache: ${defCache} | solve-cache (cachesolve): ${solveCache}${ran}`);
|
|
34060
|
+
debugLog(`[Compute/rhino-cache] decode=${decode}ms solve=${solve}ms encode=${encode}ms | definition-cache: ${defCache} | solve-cache (cachesolve): ${solveCache}${ran}${routed}`);
|
|
34022
34061
|
};
|
|
34023
|
-
if (definitionGuid) clientConfig.headers = { "X-Selva-Definition": definitionGuid };
|
|
34024
34062
|
const client = await GrasshopperClient.create(clientConfig);
|
|
34025
34063
|
const probe = createConcurrencyProbe(client, debugLog);
|
|
34026
34064
|
const readReported = async () => await Promise.resolve(client.serverStats?.getLimits?.()).catch(() => null) ?? null;
|
|
@@ -34087,14 +34125,14 @@ function createClientCache(config) {
|
|
|
34087
34125
|
retire(entry);
|
|
34088
34126
|
}
|
|
34089
34127
|
const self = {
|
|
34090
|
-
async getClient(server
|
|
34128
|
+
async getClient(server) {
|
|
34091
34129
|
const key = server.id;
|
|
34092
34130
|
const existing = cache.get(key);
|
|
34093
34131
|
if (existing) {
|
|
34094
34132
|
cache.delete(key);
|
|
34095
34133
|
cache.set(key, existing);
|
|
34096
34134
|
if (!cacheEnabled || await deploymentChecks.get(existing)?.() !== false) return existing;
|
|
34097
|
-
return self.getClient(server
|
|
34135
|
+
return self.getClient(server);
|
|
34098
34136
|
}
|
|
34099
34137
|
const inFlight = pending.get(key);
|
|
34100
34138
|
if (inFlight) return inFlight.promise;
|
|
@@ -34111,7 +34149,7 @@ function createClientCache(config) {
|
|
|
34111
34149
|
const promise = (async () => {
|
|
34112
34150
|
let entry;
|
|
34113
34151
|
try {
|
|
34114
|
-
entry = await build(server
|
|
34152
|
+
entry = await build(server);
|
|
34115
34153
|
} catch (err) {
|
|
34116
34154
|
if (!token.stale) failed.set(key, {
|
|
34117
34155
|
error: err,
|
|
@@ -34432,32 +34470,6 @@ function createResponseEncoder(response, maxBytes) {
|
|
|
34432
34470
|
};
|
|
34433
34471
|
} };
|
|
34434
34472
|
}
|
|
34435
|
-
/**
|
|
34436
|
-
* `total` is the server's headers-to-out wall time, so browser `ttfb − total`
|
|
34437
|
-
* ≈ network+send latency. When the compute server reports its own timing
|
|
34438
|
-
* (VektorNode fork), `rhino_*` is time on the compute server and `compute_link`
|
|
34439
|
-
* is everything between it (network + queue wait). `rhino_cache` is 1 when the
|
|
34440
|
-
* compute server answered from its own result cache.
|
|
34441
|
-
*/
|
|
34442
|
-
function buildServerTiming(parts) {
|
|
34443
|
-
let header = `load;dur=${parts.defLoadMs.toFixed(1)}, tree;dur=${parts.treeBuildMs.toFixed(1)}, solve;dur=${parts.solveMs.toFixed(1)}, serialize;dur=${parts.serializeMs.toFixed(1)}, gzip;dur=${parts.gzipMs.toFixed(1)}, total;dur=${parts.serverTotalMs.toFixed(1)}`;
|
|
34444
|
-
const rhino = parts.rhino;
|
|
34445
|
-
if (rhino) {
|
|
34446
|
-
const decode = rhino.decode ?? 0;
|
|
34447
|
-
const solve = rhino.solve ?? 0;
|
|
34448
|
-
const encode = rhino.encode ?? 0;
|
|
34449
|
-
const computeLinkMs = Math.max(0, parts.solveMs - decode - solve - encode);
|
|
34450
|
-
header += `, rhino_decode;dur=${decode.toFixed(1)}, rhino_solve;dur=${solve.toFixed(1)}, rhino_encode;dur=${encode.toFixed(1)}, compute_link;dur=${computeLinkMs.toFixed(1)}, rhino_cache;dur=${rhino.cacheHit ? 1 : 0}`;
|
|
34451
|
-
if (rhino.gh !== void 0) header += `, rhino_gh;dur=${rhino.gh.toFixed(1)}`;
|
|
34452
|
-
if (rhino.recomputed) header += `, rhino_recomputed;desc="${rhino.recomputed.ran}/${rhino.recomputed.total}"`;
|
|
34453
|
-
}
|
|
34454
|
-
for (const [label, ms] of parts.prepMarks) header += `, p_${label};dur=${ms.toFixed(1)}`;
|
|
34455
|
-
const settle = parts.settle;
|
|
34456
|
-
header += `, selva_cache;dur=${settle.fromCache ? 1 : 0}`;
|
|
34457
|
-
if (settle.definitionReuploaded !== void 0) header += `, def_reupload;dur=${settle.definitionReuploaded ? 1 : 0}`;
|
|
34458
|
-
if (parts.defBytes) header += `, def_bytes;desc=${parts.defBytes}`;
|
|
34459
|
-
return header;
|
|
34460
|
-
}
|
|
34461
34473
|
function createSolveCacheSingleFlight(options = {}) {
|
|
34462
34474
|
const inflight = /* @__PURE__ */ new Map();
|
|
34463
34475
|
function free(key, flight) {
|
|
@@ -34543,8 +34555,9 @@ function buildSolveInputTree(inputs, values) {
|
|
|
34543
34555
|
}
|
|
34544
34556
|
/**
|
|
34545
34557
|
* Runs one solve against a warm scheduler and classifies how it ended: a solved response, or an
|
|
34546
|
-
* expected failure as a value instead of a throw.
|
|
34547
|
-
*
|
|
34558
|
+
* expected failure as a value instead of a throw. Single-flight shares this part, so its args come
|
|
34559
|
+
* from the caller that started the flight. Anything per caller must be in the coalesce key, or,
|
|
34560
|
+
* like `sessionId`, be harmless for the joiners to inherit.
|
|
34548
34561
|
*/
|
|
34549
34562
|
function shed(durationMs, reason, message) {
|
|
34550
34563
|
return {
|
|
@@ -34605,6 +34618,8 @@ async function runSolvePipeline(args) {
|
|
|
34605
34618
|
const detail = await args.client.scheduler.solveDetailed(args.definitionSource, args.inputTree, {
|
|
34606
34619
|
signal: args.signal,
|
|
34607
34620
|
selvaevents: args.selvaEvents,
|
|
34621
|
+
sessionId: args.sessionId,
|
|
34622
|
+
headers: args.headers,
|
|
34608
34623
|
onServerTiming: (t) => {
|
|
34609
34624
|
rhino = t;
|
|
34610
34625
|
}
|
|
@@ -34674,8 +34689,8 @@ var SolveEngine = class {
|
|
|
34674
34689
|
this.byteCache = createDefinitionByteCache(this.limits.computeDefinitionCacheBytes);
|
|
34675
34690
|
this.singleFlight = createSolveCacheSingleFlight({ onJoin: options.onSolveCoalesced });
|
|
34676
34691
|
}
|
|
34677
|
-
getClient(server
|
|
34678
|
-
return this.clientCache.getClient(server
|
|
34692
|
+
getClient(server) {
|
|
34693
|
+
return this.clientCache.getClient(server);
|
|
34679
34694
|
}
|
|
34680
34695
|
definitionRef(versionId, load) {
|
|
34681
34696
|
return this.byteCache.getOrLoad(versionId, load);
|
|
@@ -34714,7 +34729,7 @@ var SolveEngine = class {
|
|
|
34714
34729
|
};
|
|
34715
34730
|
let client;
|
|
34716
34731
|
try {
|
|
34717
|
-
client = await this.clientCache.getClient(args.server
|
|
34732
|
+
client = await this.clientCache.getClient(args.server);
|
|
34718
34733
|
} catch (error) {
|
|
34719
34734
|
if (args.signal.aborted) return {
|
|
34720
34735
|
kind: "client_abort",
|
|
@@ -34750,6 +34765,8 @@ var SolveEngine = class {
|
|
|
34750
34765
|
client,
|
|
34751
34766
|
responseMaxBytes: this.limits.computeResponseMaxBytes,
|
|
34752
34767
|
selvaEvents: args.selvaEvents,
|
|
34768
|
+
sessionId: args.sessionId,
|
|
34769
|
+
...args.definitionGuid && { headers: { "X-Selva-Definition": args.definitionGuid } },
|
|
34753
34770
|
signal
|
|
34754
34771
|
}), args.signal);
|
|
34755
34772
|
if (args.signal.aborted) return {
|