@selvajs/selva 4.21.0-beta.25 → 4.21.0-beta.26

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 (67) hide show
  1. package/build/adapter-node.js +1 -1
  2. package/build/client/_app/immutable/assets/0.Ct4dsf2W.css +2 -0
  3. package/build/client/_app/immutable/assets/0.Ct4dsf2W.css.br +0 -0
  4. package/build/client/_app/immutable/assets/0.Ct4dsf2W.css.gz +0 -0
  5. package/build/client/_app/immutable/chunks/BUxAHI7i.js +1 -0
  6. package/build/client/_app/immutable/chunks/BUxAHI7i.js.br +1 -0
  7. package/build/client/_app/immutable/chunks/BUxAHI7i.js.gz +0 -0
  8. package/build/client/_app/immutable/chunks/C4PDTpD1.js +6085 -0
  9. package/build/client/_app/immutable/chunks/C4PDTpD1.js.br +0 -0
  10. package/build/client/_app/immutable/chunks/C4PDTpD1.js.gz +0 -0
  11. package/build/client/_app/immutable/entry/{app.UvCzfP6E.js → app.Bqmne5hV.js} +2 -2
  12. package/build/client/_app/immutable/entry/app.Bqmne5hV.js.br +0 -0
  13. package/build/client/_app/immutable/entry/app.Bqmne5hV.js.gz +0 -0
  14. package/build/client/_app/immutable/nodes/21.Dv262ba8.js +1 -0
  15. package/build/client/_app/immutable/nodes/21.Dv262ba8.js.br +1 -0
  16. package/build/client/_app/immutable/nodes/21.Dv262ba8.js.gz +0 -0
  17. package/build/client/_app/version.json +1 -1
  18. package/build/client/_app/version.json.br +0 -0
  19. package/build/client/_app/version.json.gz +0 -0
  20. package/build/server/.vite/manifest.json +11 -10
  21. package/build/server/_app/immutable/assets/_layout.Ct4dsf2W.css +2 -0
  22. package/build/server/chunks/capture.js +1 -1
  23. package/build/server/chunks/compute-profile-D3g1Tuyd.js +92 -0
  24. package/build/server/chunks/compute-profile-D3g1Tuyd.js.map +1 -0
  25. package/build/server/chunks/grasshopper.js +6 -1
  26. package/build/server/chunks/grasshopper.js.map +1 -1
  27. package/build/server/chunks/instance.js +3 -3
  28. package/build/server/chunks/internal.js +1 -1
  29. package/build/server/chunks/package.js +1 -1
  30. package/build/server/chunks/package.js.map +1 -1
  31. package/build/server/chunks/server.js +134 -17
  32. package/build/server/chunks/server.js.map +1 -1
  33. package/build/server/chunks/solve.js +1 -1
  34. package/build/server/chunks/solve.server.js +8 -3
  35. package/build/server/chunks/solve.server.js.map +1 -1
  36. package/build/server/entries/endpoints/api/v1/compute/_server.ts.js +1 -1
  37. package/build/server/entries/endpoints/api/v1/definitions/_guid_/solve/_server.ts.js +5 -2
  38. package/build/server/entries/endpoints/api/v1/definitions/_guid_/solve/_server.ts.js.map +1 -1
  39. package/build/server/entries/endpoints/api/v1/solves/_solveId_/_server.ts.js +1 -1
  40. package/build/server/entries/pages/library/_guid_/_page.svelte.js +122 -30
  41. package/build/server/entries/pages/library/_guid_/_page.svelte.js.map +1 -1
  42. package/build/server/manifest-full.js +1 -1
  43. package/build/server/manifest.js +1 -1
  44. package/build/server/nodes/0.js +2 -2
  45. package/build/server/nodes/21.js +1 -1
  46. package/build/server/server.js +1 -1
  47. package/package.json +9 -9
  48. package/build/client/_app/immutable/assets/0.DOeouCe4.css +0 -2
  49. package/build/client/_app/immutable/assets/0.DOeouCe4.css.br +0 -0
  50. package/build/client/_app/immutable/assets/0.DOeouCe4.css.gz +0 -0
  51. package/build/client/_app/immutable/chunks/A_2RYLH9.js +0 -1
  52. package/build/client/_app/immutable/chunks/A_2RYLH9.js.br +0 -1
  53. package/build/client/_app/immutable/chunks/A_2RYLH9.js.gz +0 -0
  54. package/build/client/_app/immutable/chunks/BMp0Pt9F.js +0 -6085
  55. package/build/client/_app/immutable/chunks/BMp0Pt9F.js.br +0 -0
  56. package/build/client/_app/immutable/chunks/BMp0Pt9F.js.gz +0 -0
  57. package/build/client/_app/immutable/entry/app.UvCzfP6E.js.br +0 -0
  58. package/build/client/_app/immutable/entry/app.UvCzfP6E.js.gz +0 -0
  59. package/build/client/_app/immutable/nodes/21.BAYqxLPV.js +0 -1
  60. package/build/client/_app/immutable/nodes/21.BAYqxLPV.js.br +0 -1
  61. package/build/client/_app/immutable/nodes/21.BAYqxLPV.js.gz +0 -0
  62. package/build/server/_app/immutable/assets/_layout.DOeouCe4.css +0 -2
  63. package/build/server/chunks/async-solve-Doflh4BJ.js +0 -27
  64. package/build/server/chunks/async-solve-Doflh4BJ.js.map +0 -1
  65. /package/build/client/_app/immutable/nodes/{0.BQ4J6cqX.js → 0.BsaBi01M.js} +0 -0
  66. /package/build/client/_app/immutable/nodes/{0.BQ4J6cqX.js.br → 0.BsaBi01M.js.br} +0 -0
  67. /package/build/client/_app/immutable/nodes/{0.BQ4J6cqX.js.gz → 0.BsaBi01M.js.gz} +0 -0
@@ -2,7 +2,7 @@ import { a as isDynamicValueListWidget, c as isTextWidget, i as isDropdownWidget
2
2
  import { n as getInputItems, r as getLayoutItems, t as getGroups } from "../../../../chunks/traversal.js";
3
3
  import { n as keepHiddenPicks, r as withRowPick, t as buildFormModel } from "../../../../chunks/dynamic-value-list.js";
4
4
  import { _ as subFolderSegments, m as downloadFileDataByRoot, p as decodeBase64ToBinary$1, r as GrasshopperResponseProcessor } from "../../../../chunks/grasshopper.js";
5
- import { a as serverSourcedInputIds, i as raceAbort, r as KEEPALIVE_PREFERENCE, t as ASYNC_PREFERENCE } from "../../../../chunks/async-solve-Doflh4BJ.js";
5
+ import { a as raceAbort, d as isDisplayItemType$1, f as readFrame, i as KEEPALIVE_PREFERENCE, n as COMPUTE_PROFILE_HEADER, o as serverSourcedInputIds, s as BINARY_SOLVE_MEDIA_TYPE, t as ASYNC_PREFERENCE, u as isBlobRef } from "../../../../chunks/compute-profile-D3g1Tuyd.js";
6
6
  import { i as outcomeFromComputeMessages, n as decodeOutcome, r as finalizeResult, t as decodeDiagnostic } from "../../../../chunks/outcome-D28FgvFK.js";
7
7
  import { Ft as run, Lt as escape_html, Ot as attr, _ as setContext, a as derived, d as spread_props, f as stringify, h as getContext, i as bind_props, kt as clsx$1, l as props_id, n as attr_style, o as element$1, ot as snapshot, p as html, r as attributes, s as ensure_array_like, t as attr_class } from "../../../../chunks/server4.js";
8
8
  import { c as watch$1, s as Context, t as FOOTER_CONTEXT_KEY } from "../../../../chunks/footerContext.svelte.js";
@@ -11587,10 +11587,17 @@ function finishGeometry(geometry, members) {
11587
11587
  const tangents = creased.uvs ? grainTangents(creased.positions, creased.normals, creased.indices, creased.uvs) : null;
11588
11588
  return {
11589
11589
  ...creased,
11590
+ normals: packNormals(creased.normals),
11590
11591
  closed,
11591
11592
  tangents
11592
11593
  };
11593
11594
  }
11595
+ /** Self-contained: stringified into the assembly worker. */
11596
+ function packNormals(normals) {
11597
+ const packed = new Int16Array(normals.length);
11598
+ for (let i = 0; i < normals.length; i++) packed[i] = Math.round(normals[i] * 32767);
11599
+ return packed;
11600
+ }
11594
11601
  function assembleGeometries(input) {
11595
11602
  const { isFloat32, deltaEncoded, planarByteSplit, uint16Indices, origin, scale, uvs, colors, jobs } = input;
11596
11603
  const unzigzag = (zz) => zz >>> 1 ^ -(zz & 1);
@@ -11737,6 +11744,7 @@ function meshAssemblyWorkerSource() {
11737
11744
  `const isClosedSolid = ${isClosedSolid.toString()};`,
11738
11745
  `const splitCreases = ${splitCreases.toString()};`,
11739
11746
  `const grainTangents = ${grainTangents.toString()};`,
11747
+ `const packNormals = ${packNormals.toString()};`,
11740
11748
  `self.onmessage = (event) => {`,
11741
11749
  ` const { id, input } = event.data;`,
11742
11750
  ` try {`,
@@ -11748,7 +11756,7 @@ function meshAssemblyWorkerSource() {
11748
11756
  ` : isClosedSolid(g.positions, g.indices, windows.map((w) => w.indexCount));`,
11749
11757
  ` const c = splitCreases(g.positions, g.indices, g.uvs, g.colors);`,
11750
11758
  ` const tangents = c.uvs ? grainTangents(c.positions, c.normals, c.indices, c.uvs) : null;`,
11751
- ` return { ...c, closed, tangents };`,
11759
+ ` return { ...c, normals: packNormals(c.normals), closed, tangents };`,
11752
11760
  ` });`,
11753
11761
  ` const transfer = [];`,
11754
11762
  ` for (const g of geometries) {`,
@@ -12548,7 +12556,7 @@ function createMergedMesh(group, allVertices, allIndices, pickMaterial, allUvs =
12548
12556
  function geometryFrom(finished) {
12549
12557
  const geometry = new THREE.BufferGeometry();
12550
12558
  geometry.setAttribute("position", new THREE.BufferAttribute(finished.positions, 3));
12551
- geometry.setAttribute("normal", new THREE.BufferAttribute(finished.normals, 3));
12559
+ geometry.setAttribute("normal", new THREE.BufferAttribute(finished.normals, 3, true));
12552
12560
  geometry.setIndex(new THREE.BufferAttribute(finished.indices, 1));
12553
12561
  if (finished.uvs) geometry.setAttribute("uv", new THREE.BufferAttribute(finished.uvs, 2));
12554
12562
  if (finished.tangents) geometry.setAttribute("tangent", new THREE.BufferAttribute(finished.tangents, 4));
@@ -12772,7 +12780,7 @@ async function parseMeshBatchObject(batch, options, telemetry) {
12772
12780
  parseTime,
12773
12781
  decodeTime: performance.now() - decodeStart,
12774
12782
  perfStart,
12775
- blobBytes: debug ? approximateBase64DecodedBytes(batch.compressedData) : 0,
12783
+ blobBytes: !debug ? 0 : typeof batch.compressedData === "string" ? approximateBase64DecodedBytes(batch.compressedData) : batch.compressedData.byteLength,
12776
12784
  fallback: {
12777
12785
  materials: batch.materials,
12778
12786
  groups: batch.groups
@@ -13055,6 +13063,9 @@ var SCALE_FACTORS = {
13055
13063
  var DISPLAY_COMPONENT_TYPE = "Display";
13056
13064
  var DISPLAY_BATCH_TYPE = "DisplayBatch";
13057
13065
  /**
13066
+ * Must match `isDisplayItemType` in `@selvajs/solve/shared`, which picks the batches a binary
13067
+ * response carries as raw bytes.
13068
+ *
13058
13069
  * True when a wire `type` denotes a Display payload: one of its dot-separated tokens is exactly
13059
13070
  * `Display` or `DisplayBatch`. Matches the bare `Display` used by older servers and the namespaced
13060
13071
  * `Selva.GH.Features.Display.Services.DisplayBatch`, but not e.g. `System.DisplayText` — matching
@@ -13087,7 +13098,7 @@ async function getThreeObjectsFromComputeResponse(data, options) {
13087
13098
  handleError(error, objects);
13088
13099
  throw error;
13089
13100
  } finally {
13090
- if (debug) logProcessingTime(startTime);
13101
+ if (debug) logProcessingTime(startTime, objects);
13091
13102
  }
13092
13103
  }
13093
13104
  /**
@@ -13162,9 +13173,26 @@ function handleError(error, meshes) {
13162
13173
  function disposeMeshes(meshes) {
13163
13174
  for (const mesh of meshes) disposeObjectTree(mesh);
13164
13175
  }
13165
- function logProcessingTime(startTime) {
13176
+ /** Time plus what the result costs to hold: the same bytes again on the GPU once uploaded. */
13177
+ function logProcessingTime(startTime, objects) {
13166
13178
  const elapsed = performance.now() - startTime;
13167
- getLogger().info("Time to process meshes:", `${elapsed.toFixed(2)}ms`);
13179
+ let triangles = 0;
13180
+ let vertices = 0;
13181
+ let bytes = 0;
13182
+ const seen = /* @__PURE__ */ new Set();
13183
+ for (const root of objects) root.traverse((object) => {
13184
+ const geometry = object.geometry;
13185
+ if (!geometry?.isBufferGeometry || seen.has(geometry)) return;
13186
+ seen.add(geometry);
13187
+ const position = geometry.getAttribute("position");
13188
+ if (!position) return;
13189
+ vertices += position.count;
13190
+ if (object.isMesh) triangles += (geometry.index ? geometry.index.count : position.count) / 3;
13191
+ for (const attribute of Object.values(geometry.attributes)) bytes += attribute.array.byteLength;
13192
+ if (geometry.index) bytes += geometry.index.array.byteLength;
13193
+ });
13194
+ const mb = (bytes / 1048576).toFixed(1);
13195
+ getLogger().info(`Time to process meshes: ${elapsed.toFixed(2)}ms | ${triangles.toLocaleString("en")} triangles, ${vertices.toLocaleString("en")} vertices, ${mb} MB of geometry`);
13168
13196
  }
13169
13197
  // ../ui/src/lib/components/viewer/ViewerDock.svelte
13170
13198
  function ViewerDock($$renderer, $$props) {
@@ -15038,7 +15066,8 @@ function parseServerTiming(header) {
15038
15066
  *
15039
15067
  * `compute` is the whole call to Rhino.Compute. A server that reports its own timing splits it
15040
15068
  * into `solve` (of which `grasshopper` is the definition running), `decode`, `encode`, and
15041
- * `queue+link`: the rest, network plus the wait for a free worker. `prep` is what the app did
15069
+ * `queue+link`: the rest, network plus the wait for a free worker, which the fork's proxy reports
15070
+ * on its own. `prep` is what the app did
15042
15071
  * before the solve, slowest step first, steps under 1 ms left out.
15043
15072
  */
15044
15073
  function describeServerTiming(header) {
@@ -15048,7 +15077,7 @@ function describeServerTiming(header) {
15048
15077
  let compute = `compute ${ms(t.solve)}`;
15049
15078
  if (t.rhino_solve !== void 0) {
15050
15079
  const grasshopper = t.rhino_gh === void 0 ? "" : ` (grasshopper ${ms(t.rhino_gh)})`;
15051
- compute += `: solve ${ms(t.rhino_solve)}${grasshopper}, decode ${ms(t.rhino_decode)}, encode ${ms(t.rhino_encode)}, queue+link ${ms(t.compute_link)}`;
15080
+ compute += `: solve ${ms(t.rhino_solve)}${grasshopper}, decode ${ms(t.rhino_decode)}, encode ${ms(t.rhino_encode)}, queue+link ${ms(t.compute_link)}` + (t.rhino_wait === void 0 ? "" : ` (waiting for a free child ${ms(t.rhino_wait)})`);
15052
15081
  }
15053
15082
  const parts = [compute];
15054
15083
  const prep = Object.entries(t).filter(([name]) => name.startsWith("p_"));
@@ -15063,6 +15092,60 @@ function describeServerTiming(header) {
15063
15092
  return parts.join(" | ");
15064
15093
  }
15065
15094
  /**
15095
+ * The `X-Compute-Profile` header as one log line, slowest first. Null without one. Entries that
15096
+ * aren't `{ name, ms }` are dropped: a proxy can send anything, and a debug line must not fail a solve.
15097
+ */
15098
+ function describeComputeProfile(header) {
15099
+ if (!header) return null;
15100
+ let entries;
15101
+ try {
15102
+ entries = JSON.parse(header);
15103
+ } catch {
15104
+ return null;
15105
+ }
15106
+ if (!Array.isArray(entries)) return null;
15107
+ const valid = entries.filter((e) => typeof e === "object" && e !== null && typeof e.name === "string" && typeof e.ms === "number");
15108
+ if (valid.length === 0) return null;
15109
+ return valid.map((e) => typeof e.nick === "string" && e.nick && e.nick !== e.name ? `${e.name} "${e.nick}" ${e.ms}` : `${e.name} ${e.ms}`).join(", ");
15110
+ }
15111
+ /** Null where the browser can't gunzip the JSON section, so the client must not ask for binary. */
15112
+ var BINARY_ACCEPT_HEADER = typeof DecompressionStream === "undefined" ? null : `${BINARY_SOLVE_MEDIA_TYPE}, application/json;q=0.9`;
15113
+ function isBinarySolveResponse(res) {
15114
+ return (res.headers.get("Content-Type") ?? "").startsWith(BINARY_SOLVE_MEDIA_TYPE);
15115
+ }
15116
+ /**
15117
+ * The response JSON with each display item's `data` parsed into its batch object, its
15118
+ * `compressedData` the blob's bytes. The blobs are views over `bytes`, so they keep it alive.
15119
+ */
15120
+ async function decodeBinarySolveResponse(bytes) {
15121
+ const { flags, json, blobs } = readFrame(bytes);
15122
+ const jsonBytes = flags & 1 ? await gunzip(json) : json;
15123
+ const parsed = JSON.parse(new TextDecoder().decode(jsonBytes));
15124
+ const values = parsed?.values;
15125
+ if (!Array.isArray(values)) return parsed;
15126
+ for (const value of values) for (const tree of [value?.InnerTree, value?.innerTree]) {
15127
+ if (!tree || typeof tree !== "object") continue;
15128
+ for (const branch of Object.values(tree)) if (Array.isArray(branch)) for (const item of branch) attachBlob(item, blobs);
15129
+ }
15130
+ return parsed;
15131
+ }
15132
+ function attachBlob(item, blobs) {
15133
+ const display = item;
15134
+ if (typeof display?.type !== "string" || typeof display.data !== "string") return;
15135
+ if (!isDisplayItemType$1(display.type)) return;
15136
+ const batch = JSON.parse(display.data);
15137
+ if (isBlobRef(batch.compressedData)) {
15138
+ const blob = blobs[batch.compressedData.$blob];
15139
+ if (!blob) throw new Error("Malformed binary solve response: a batch names a missing blob");
15140
+ batch.compressedData = blob;
15141
+ }
15142
+ display.data = batch;
15143
+ }
15144
+ async function gunzip(bytes) {
15145
+ const stream = new Blob([bytes]).stream().pipeThrough(new DecompressionStream("gzip"));
15146
+ return new Uint8Array(await new Response(stream).arrayBuffer());
15147
+ }
15148
+ /**
15066
15149
  * A ready-made `SolveFn` that POSTs to a `/api/compute`-shaped endpoint (the wire contract
15067
15150
  * `SolveEngine` produces) and unpacks the result, with 429 cooldown, session-expiry detection,
15068
15151
  * a bad-response guard, and abort handling at every await.
@@ -15071,6 +15154,12 @@ function describeServerTiming(header) {
15071
15154
  * consumer supplies `meshes.extract` (typically `getThreeObjectsFromComputeResponse` from
15072
15155
  * `@selvajs/visualization/parse`).
15073
15156
  */
15157
+ /** Said once a page: the same Compute server stays silent on every solve. */
15158
+ var warnedNoRhinoTiming = false;
15159
+ function formatBytes(bytes) {
15160
+ if (bytes >= 1048576) return `${(bytes / 1048576).toFixed(1)} MB`;
15161
+ return `${(bytes / 1024).toFixed(0)} KB`;
15162
+ }
15074
15163
  /** Applied to a 429 that names no wait. */
15075
15164
  var DEFAULT_RETRY_AFTER_S = 5;
15076
15165
  /** A server's hint, not a lock: past this the client tries again anyway. */
@@ -15179,6 +15268,7 @@ function createComputeFetchSolveFn(opts) {
15179
15268
  method: "POST",
15180
15269
  headers: {
15181
15270
  "Content-Type": "application/json",
15271
+ ...opts.meshes && BINARY_ACCEPT_HEADER ? { Accept: BINARY_ACCEPT_HEADER } : {},
15182
15272
  ...auth,
15183
15273
  ...prefer ? { Prefer: prefer } : {}
15184
15274
  },
@@ -15242,10 +15332,11 @@ function createComputeFetchSolveFn(opts) {
15242
15332
  });
15243
15333
  }
15244
15334
  const ttfbMs = performance.now() - solveStart;
15335
+ const binary = isBinarySolveResponse(res);
15245
15336
  const downloadStart = performance.now();
15246
- let bodyText;
15337
+ let body;
15247
15338
  try {
15248
- bodyText = await res.text();
15339
+ body = binary ? new Uint8Array(await res.arrayBuffer()) : await res.text();
15249
15340
  } catch (err) {
15250
15341
  if (signal.aborted) {
15251
15342
  log("[Compute] solve aborted mid-download — empty result discarded");
@@ -15254,23 +15345,27 @@ function createComputeFetchSolveFn(opts) {
15254
15345
  throw new Error("The connection dropped while receiving the result. Please try again.", { cause: err });
15255
15346
  }
15256
15347
  const downloadMs = performance.now() - downloadStart;
15257
- const bodyChars = bodyText.length;
15348
+ const wireBytes = typeof body === "string" ? Number(res.headers.get("Content-Length")) || null : body.byteLength;
15258
15349
  const invalidResponse = (cause) => new Error("Received an invalid response from the server. Reload the page and try again.", { cause });
15350
+ const parseStart = performance.now();
15259
15351
  let parsed;
15260
15352
  try {
15261
- parsed = JSON.parse(bodyText);
15353
+ parsed = typeof body === "string" ? JSON.parse(body) : await decodeBinarySolveResponse(body);
15262
15354
  } catch (err) {
15263
15355
  throw invalidResponse(err);
15264
15356
  }
15357
+ const parseMs = performance.now() - parseStart;
15265
15358
  if (!isPlainObject(parsed)) throw invalidResponse();
15266
15359
  const solved = parsed;
15267
15360
  const processor = new GrasshopperResponseProcessor(solved);
15268
15361
  const outcome = decodeOutcome(solved.selva?.outcome) ?? outcomeFromComputeMessages(solved.errors ?? [], solved.warnings ?? []);
15269
15362
  const rejected = outcome.blocked || outcome.aborted;
15363
+ const meshesStart = performance.now();
15270
15364
  const meshes = opts.meshes && !rejected && !call.skipMeshes ? await opts.meshes.extract(processor.response, {
15271
15365
  debug,
15272
15366
  signal
15273
15367
  }) : [];
15368
+ const meshesMs = performance.now() - meshesStart;
15274
15369
  const resultOutputs = {};
15275
15370
  for (const o of rejected ? [] : outputs) {
15276
15371
  const byId = processor.getValue({ byId: o.id }, { parseValues: true });
@@ -15282,18 +15377,25 @@ function createComputeFetchSolveFn(opts) {
15282
15377
  const serverTiming = parseServerTiming(timingHeader);
15283
15378
  const serverTotal = serverTiming.total ?? 0;
15284
15379
  const networkMs = Math.max(0, ttfbMs - serverTotal);
15285
- const sizeMB = bodyChars / 1048576;
15286
- const size = sizeMB >= 1 ? `${sizeMB.toFixed(2)} MB` : `${(bodyChars / 1024).toFixed(0)} KB`;
15287
- const mbps = downloadMs > 0 ? (sizeMB / (downloadMs / 1e3)).toFixed(1) : "∞";
15288
15380
  const heapBytes = performance.memory?.usedJSHeapSize;
15289
- const heap = heapBytes !== void 0 ? ` | heap=${(heapBytes / 1048576).toFixed(0)} MB` : "";
15290
- log(`[Compute] req=${(payload.length / 1024).toFixed(0)}KB (values ${(valuesBytes / 1024).toFixed(0)}KB) | ttfb=${ttfbMs.toFixed(0)}ms (network≈${networkMs.toFixed(0)} + server ${serverTotal.toFixed(0)}) | download=${downloadMs.toFixed(0)}ms (${size} @ ${mbps} MB/s)${heap}`);
15381
+ const heap = heapBytes !== void 0 ? ` | heap=${formatBytes(heapBytes)}` : "";
15382
+ log(`[Compute] req=${formatBytes(payload.length)} (values ${formatBytes(valuesBytes)}) | ttfb=${ttfbMs.toFixed(0)}ms (network≈${networkMs.toFixed(0)} + server ${serverTotal.toFixed(0)})${heap}`);
15291
15383
  const breakdown = describeServerTiming(timingHeader);
15292
15384
  if (breakdown) log(`[Compute] └─ server: ${breakdown}`);
15385
+ const slowest = describeComputeProfile(res.headers.get(COMPUTE_PROFILE_HEADER));
15386
+ if (slowest) log(`[Compute] └─ slowest components (ms): ${slowest}`);
15293
15387
  if (serverTiming.selva_cache !== void 0) {
15294
15388
  const cacheMsg = serverTiming.selva_cache ? "HIT — served without calling compute" : serverTiming.rhino_cache ? "HIT — Rhino.Compute's result cache, solved nothing" : "miss — solved on Rhino.Compute";
15295
15389
  log(`[Compute] └─ cache: ${cacheMsg}`);
15296
15390
  }
15391
+ if (!serverTiming.selva_cache && (serverTiming.solve ?? 0) > 0 && serverTiming.rhino_solve === void 0 && !warnedNoRhinoTiming) {
15392
+ warnedNoRhinoTiming = true;
15393
+ log("[Compute] └─ note: Rhino.Compute sent no timing of its own, so `compute` above is Grasshopper, definition load and queue wait together. A recent VektorNode fork sends it, with the slowest components.");
15394
+ }
15395
+ const bodyBytes = typeof body === "string" ? new TextEncoder().encode(body).byteLength : body.byteLength;
15396
+ const wire = wireBytes === null ? `${formatBytes(bodyBytes)} ${binary ? "binary" : "json"}` : `${formatBytes(wireBytes)} ${binary ? "binary" : "json"} on the wire` + (binary ? "" : `, ${formatBytes(bodyBytes)} unpacked`);
15397
+ const rate = downloadMs > 0 ? `${formatBytes((wireBytes ?? bodyBytes) / (downloadMs / 1e3))}/s` : "∞";
15398
+ log(`[Compute] └─ client: download ${downloadMs.toFixed(0)}ms (${wire} @ ${rate}) | parse ${parseMs.toFixed(0)}ms | meshes ${meshesMs.toFixed(0)}ms (${meshes.length} objects)`);
15297
15399
  }
15298
15400
  return finalizeResult({
15299
15401
  outputs: resultOutputs,
@@ -15322,7 +15424,7 @@ function SolvingIndicator($$renderer, $$props) {
15322
15424
  /** The raw flag: times the solve, and acknowledges one too short to show. */
15323
15425
  /** `createSolvingIndicator(...).show`. */
15324
15426
  /** `createSolvingIndicator(...).slow`. */
15325
- /** Live progress for the card. Without it the card's bar is indeterminate. */
15427
+ /** Live progress: the card names the current step and its count. */
15326
15428
  /** Without it the card has no Abort button; Esc still works where the host handles it. */
15327
15429
  /**
15328
15430
  * The page can't repaint mid-solve (see `createSolvingIndicator`): the pill says Esc aborts
@@ -15333,10 +15435,6 @@ function SolvingIndicator($$renderer, $$props) {
15333
15435
  const t = derived(() => locale.messages);
15334
15436
  const progress = createLiveProgress(() => live ?? EMPTY_LIVE_SOLVE);
15335
15437
  const head = derived(() => progress.headline ?? progress.progress[0]);
15336
- const bar = derived(() => head()?.fraction === void 0 ? void 0 : progress.bars[head().source ?? ""] ?? {
15337
- width: head().fraction,
15338
- ms: 150
15339
- });
15340
15438
  let elapsed = 0;
15341
15439
  let finished = null;
15342
15440
  const mode = derived(() => show ? slow && !freezesDuringSolve ? "card" : "work" : "idle");
@@ -15346,7 +15444,7 @@ function SolvingIndicator($$renderer, $$props) {
15346
15444
  }));
15347
15445
  const fmt = (ms) => `${seconds().format(ms / 1e3)} s`;
15348
15446
  const announcement = derived(() => mode() === "work" || mode() === "card" ? t().solvingEllipsis : mode() === "done" ? t().solveDone : "");
15349
- $$renderer.push(`<div class="h-10 min-w-0 relative flex-1"><div role="status" aria-live="polite" aria-atomic="true" class="sr-only">${escape_html(announcement())}</div> <div${attr_class(`inset-x-0 bottom-0 backdrop-blur-md ease-out absolute z-10 overflow-hidden border border-border-strong transition-all duration-300 motion-reduce:transition-none ${mode() === "card" ? "h-24 shadow-md rounded-lg bg-card/75" : mode() === "idle" ? "h-10 shadow-sm rounded-md bg-card/90" : "h-10 shadow-md rounded-md bg-card/75"}`)} data-testid="solve-status"${attr("data-state", mode())}>`);
15447
+ $$renderer.push(`<div class="h-10 min-w-0 relative flex-1"><div role="status" aria-live="polite" aria-atomic="true" class="sr-only">${escape_html(announcement())}</div> <div${attr_class(`inset-x-0 bottom-0 backdrop-blur-md ease-out absolute z-10 overflow-hidden border border-border-strong transition-all duration-300 motion-reduce:transition-none ${mode() === "card" ? "h-20 shadow-md rounded-lg bg-card/75" : mode() === "idle" ? "h-10 shadow-sm rounded-md bg-card/90" : "h-10 shadow-md rounded-md bg-card/75"}`)} data-testid="solve-status"${attr("data-state", mode())}>`);
15350
15448
  if (mode() === "card") {
15351
15449
  $$renderer.push(`<!--[0--><div class="px-3 gap-2 flex h-full flex-col justify-center"><div class="gap-2 min-w-0 flex items-center">`);
15352
15450
  Loader_circle($$renderer, {
@@ -15356,12 +15454,6 @@ function SolvingIndicator($$renderer, $$props) {
15356
15454
  $$renderer.push(`<!----> <span class="text-sm font-medium min-w-0 flex-1 truncate">${escape_html(head()?.label ?? t().solving)}</span> `);
15357
15455
  if (head()?.done !== void 0 && head()?.total !== void 0) $$renderer.push(`<!--[0--><span class="text-xs shrink-0 text-muted-foreground tabular-nums">${escape_html(head().done)} / ${escape_html(head().total)}</span>`);
15358
15456
  else $$renderer.push("<!--[-1-->");
15359
- $$renderer.push(`<!--]--></div> <div class="h-1 overflow-hidden rounded-full bg-muted" role="progressbar"${attr("aria-label", head()?.label ?? t().solving)}${attr("aria-valuemin", 0)}${attr("aria-valuemax", 100)}${attr("aria-valuenow", bar() ? Math.round(bar().width * 100) : void 0)}>`);
15360
- if (bar()) $$renderer.push(`<!--[0--><div class="h-full w-(--bar-width) rounded-full bg-primary transition-all duration-(--bar-ms) ease-linear"${attr_style("", {
15361
- "--bar-width": `${stringify(bar().width * 100)}%`,
15362
- "--bar-ms": `${stringify(bar().ms)}ms`
15363
- })}></div>`);
15364
- else $$renderer.push(`<!--[-1--><div class="animate-pulse h-full w-1/3 rounded-full bg-primary/60"></div>`);
15365
15457
  $$renderer.push(`<!--]--></div> <div class="gap-2 flex items-center"><span class="text-xs text-muted-foreground tabular-nums">${escape_html(fmt(elapsed))}</span> `);
15366
15458
  if (onabort) {
15367
15459
  $$renderer.push("<!--[0-->");