@womp/spark-agent 3.0.3 → 4.0.1

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 (78) hide show
  1. package/README.md +59 -33
  2. package/dist/agent-run-cli.d.ts +2 -0
  3. package/dist/agent-run-cli.js +30 -0
  4. package/dist/agent-run-input.d.ts +11 -0
  5. package/dist/agent-run-input.js +59 -0
  6. package/dist/agent-run.d.ts +81 -0
  7. package/dist/agent-run.js +234 -0
  8. package/dist/agent-tools.js +3 -2
  9. package/dist/agent.d.ts +0 -2
  10. package/dist/agent.js +4 -36
  11. package/dist/capabilities/account.js +15 -15
  12. package/dist/capabilities/asset-imports.js +50 -50
  13. package/dist/capabilities/assets.js +10 -10
  14. package/dist/capabilities/flow.js +15 -15
  15. package/dist/capabilities/geometry.js +13 -14
  16. package/dist/capabilities/knowledge.js +4 -4
  17. package/dist/capabilities/openscad-instructions.d.ts +1 -1
  18. package/dist/capabilities/openscad-instructions.js +80 -80
  19. package/dist/capabilities/openscad.js +2 -2
  20. package/dist/capabilities/scene.d.ts +11 -3
  21. package/dist/capabilities/scene.js +93 -27
  22. package/dist/capabilities.d.ts +1 -2
  23. package/dist/capabilities.js +0 -1
  24. package/dist/client.d.ts +5 -0
  25. package/dist/client.js +22 -0
  26. package/dist/coordinates.d.ts +0 -7
  27. package/dist/coordinates.js +8 -47
  28. package/dist/generated/scene-declarations.d.ts +1 -1
  29. package/dist/generated/scene-declarations.js +1 -1
  30. package/dist/geometry/schemas/flowir-dialect.json +2 -2
  31. package/dist/index.d.ts +0 -1
  32. package/dist/index.js +0 -1
  33. package/dist/models.d.ts +7 -0
  34. package/dist/models.js +10 -0
  35. package/dist/prompt.d.ts +1 -1
  36. package/dist/prompt.js +53 -1
  37. package/dist/request-limits.d.ts +1 -0
  38. package/dist/request-limits.js +1 -0
  39. package/dist/run-metrics.d.ts +15 -0
  40. package/dist/run-metrics.js +30 -0
  41. package/dist/runtime.d.ts +3 -5
  42. package/dist/scene-metadata.js +1 -1
  43. package/dist/sdk-scene-host.d.ts +11 -13
  44. package/dist/sdk-scene-host.js +1 -0
  45. package/dist/sdk-scene-screenshot.d.ts +4 -6
  46. package/dist/sdk-scene-screenshot.js +14 -15
  47. package/dist/server/artifacts.js +1 -5
  48. package/dist/server/executor.d.ts +0 -1
  49. package/dist/server/executor.js +0 -1
  50. package/dist/server/express.js +17 -5
  51. package/dist/server/scene-actions.d.ts +2 -0
  52. package/dist/server/scene-actions.js +20 -0
  53. package/dist/server/service.d.ts +2 -0
  54. package/dist/server/service.js +10 -0
  55. package/dist/server/sqlite-store.d.ts +3 -1
  56. package/dist/server/sqlite-store.js +26 -3
  57. package/dist/server/standalone.d.ts +2 -0
  58. package/dist/server/standalone.js +54 -3
  59. package/dist/server/store.d.ts +3 -1
  60. package/dist/server/store.js +21 -1
  61. package/dist/server/types.d.ts +5 -0
  62. package/dist/simple-bench-cli.d.ts +2 -0
  63. package/dist/simple-bench-cli.js +64 -0
  64. package/dist/simple-bench-prompts.d.ts +28 -0
  65. package/dist/simple-bench-prompts.js +11 -0
  66. package/dist/simple-bench.d.ts +15 -0
  67. package/dist/simple-bench.js +175 -0
  68. package/dist/types.d.ts +4 -13
  69. package/dist/ui.d.ts +3 -8
  70. package/dist/womp-scene-api.d.ts +14 -3
  71. package/dist/womp-scene-api.js +98 -75
  72. package/package.json +7 -3
  73. package/dist/capabilities/health.d.ts +0 -9
  74. package/dist/capabilities/health.js +0 -27
  75. package/dist/context.d.ts +0 -15
  76. package/dist/context.js +0 -266
  77. package/dist/generated/health-declarations.d.ts +0 -1
  78. package/dist/generated/health-declarations.js +0 -3
@@ -1,6 +1,7 @@
1
+ import { xyzRotationFromMatrix, MAX_BLEND_RADIUS_MM, MAX_MIRROR_BLEND_RADIUS_MM } from "@womp/kakapo-sdk";
1
2
  import { metadataObject, readMaterialMetadata, removeMaterialMetadata, shiftCurvePointMetadata, writeMaterialMetadata, } from "./scene-metadata.js";
2
3
  import { createSceneEnvironment } from "./scene-environment.js";
3
- import { convertRotationBasis, sceneUnitMultiplier, fromEngineDimensions, fromEngineBlend, fromEngineMirrorRotation, fromEnginePosition, toEngineBlend, toEngineDimensions, toEngineMirrorGoop, toEngineMirrorRotation, toEnginePosition, } from "./coordinates.js";
4
+ import { convertRotationBasis, sceneUnitMultiplier, fromEngineDimensions, fromEngineMirrorRotation, fromEnginePosition, toEngineDimensions, toEngineMirrorRotation, toEnginePosition, } from "./coordinates.js";
4
5
  export const NodeType = {
5
6
  Primitive: 0,
6
7
  Union: 1,
@@ -143,12 +144,25 @@ function convertAABB(box, unitMultiplier) {
143
144
  },
144
145
  };
145
146
  }
147
+ /** Align local +Z toward target. Both points are in the same parent-local coordinates. */
146
148
  function lookAt(origin, target) {
147
- const forward = normalize({
149
+ if (![origin.x, origin.y, origin.z, target.x, target.y, target.z].every(Number.isFinite)) {
150
+ throw new Error("lookAt requires finite points in the same parent coordinate system.");
151
+ }
152
+ if (Math.hypot(target.x - origin.x, target.y - origin.y, target.z - origin.z) === 0) {
153
+ throw new Error("lookAt requires distinct origin and target points.");
154
+ }
155
+ return alignAxis({
148
156
  x: target.x - origin.x,
149
157
  y: target.y - origin.y,
150
158
  z: target.z - origin.z,
151
- });
159
+ }, "z");
160
+ }
161
+ /** XYZ degrees aligning the selected positive local axis to a parent-local direction. */
162
+ function alignAxis(direction, axis) {
163
+ if (!["x", "y", "z"].includes(axis))
164
+ throw new Error("Alignment axis must be x, y, or z.");
165
+ const forward = normalize(direction);
152
166
  let up = { x: 0, y: 1, z: 0 };
153
167
  let right = cross(up, forward);
154
168
  if (Math.hypot(right.x, right.y, right.z) < 1e-6) {
@@ -157,17 +171,19 @@ function lookAt(origin, target) {
157
171
  }
158
172
  right = normalize(right);
159
173
  const correctedUp = cross(forward, right);
160
- return {
161
- x: (Math.asin(clamp(correctedUp.z, -1, 1)) * 180) / Math.PI,
162
- y: (Math.atan2(-right.z, forward.z) * 180) / Math.PI,
163
- z: (Math.atan2(-correctedUp.x, correctedUp.y) * 180) / Math.PI,
164
- };
174
+ const [x, y, z] = axis === "x" ? [forward, right, correctedUp]
175
+ : axis === "y" ? [right, forward, scale(correctedUp, -1)] : [right, correctedUp, forward];
176
+ return xyzRotationFromMatrix([
177
+ [x.x, y.x, z.x],
178
+ [x.y, y.y, z.y],
179
+ [x.z, y.z, z.z],
180
+ ]);
165
181
  }
166
182
  function normalize(value) {
167
183
  const length = Math.hypot(value.x, value.y, value.z);
168
- return length < 1e-10
169
- ? { x: 0, y: 0, z: 0 }
170
- : { x: value.x / length, y: value.y / length, z: value.z / length };
184
+ if (!Number.isFinite(length) || length === 0)
185
+ throw new Error("Cannot orient a zero-length or non-finite direction.");
186
+ return { x: value.x / length, y: value.y / length, z: value.z / length };
171
187
  }
172
188
  function cross(left, right) {
173
189
  return {
@@ -286,12 +302,6 @@ export function createWompSceneApi(context) {
286
302
  rotation: { ...plane.rotation },
287
303
  ...(plane.customRotation ? { customRotation: { ...plane.customRotation } } : {}),
288
304
  }));
289
- const curvePoints = (id) => requireCurve(id).points.map((point) => ({
290
- ...point,
291
- position: { ...point.position },
292
- rotation: { ...point.rotation },
293
- scale: { ...point.scale },
294
- }));
295
305
  const requirePoint = (curveId, pointIndex) => {
296
306
  const index = Math.round(finite(pointIndex, "pointIndex"));
297
307
  const count = requireCurve(curveId).points.length;
@@ -338,7 +348,18 @@ export function createWompSceneApi(context) {
338
348
  },
339
349
  }]);
340
350
  };
341
- const applyPointInput = (curveId, index, input) => {
351
+ const addCurvePoint = (curveId, point, pointIndex) => {
352
+ const curve = requireCurve(curveId);
353
+ const count = curve.points.length;
354
+ if (count >= MAX_CURVE_POINTS)
355
+ throw new Error("A curve cannot exceed 100 points");
356
+ const index = pointIndex === undefined ? count : pointIndex;
357
+ if (!Number.isInteger(index) || index < 0 || index > count)
358
+ throw new Error(`Curve ${curveId}: index must be an integer from 0 through ${count}`);
359
+ const input = {
360
+ pos: { x: 0, y: 0, z: 0 }, size: { x: 1, y: 1, z: 1 },
361
+ materialId: curve.materialId ?? context.getDefaultMaterialId(), ...point,
362
+ };
342
363
  const patch = {};
343
364
  const parentScale = ancestorScale(curveId);
344
365
  if (input.pos) {
@@ -347,7 +368,9 @@ export function createWompSceneApi(context) {
347
368
  if (input.rot)
348
369
  patch.rotation = convertRotationBasis(vector(input.rot, "rot"));
349
370
  if (input.size) {
350
- patch.scale = scale(toEngineDimensions(vector(input.size, "size"), unitMultiplier), 1 / parentScale);
371
+ patch.scale = scale(toEngineDimensions(curve.primitive === "sphere"
372
+ ? normalizePrimitiveSize("sphere", vector(input.size, "size"))
373
+ : vector(input.size, "size"), unitMultiplier), 1 / parentScale);
351
374
  }
352
375
  if (input.fixed !== undefined)
353
376
  patch.fixed = Boolean(input.fixed);
@@ -358,10 +381,11 @@ export function createWompSceneApi(context) {
358
381
  context.requireMaterial(materialId);
359
382
  patch.materialId = materialId;
360
383
  }
361
- if (Object.keys(patch).length)
362
- setPoint(curveId, index, patch);
363
- if (input.name !== undefined)
364
- setPointName(curveId, index, input.name);
384
+ context.call("addCurvePoint", [curveId, patch, index], () => scene.addCurvePoint(curveId, patch, index));
385
+ shiftCurvePointMetadata(scene, curveId, index, 1);
386
+ if (point.name !== undefined)
387
+ setPointName(curveId, index, point.name);
388
+ return index;
365
389
  };
366
390
  const setNodeSize = (id, sizeValue) => {
367
391
  const node = requireEditableTransform(id);
@@ -374,8 +398,12 @@ export function createWompSceneApi(context) {
374
398
  update(id, { size: { x: converted.z, y: converted.y } });
375
399
  return;
376
400
  }
377
- if (!("z" in sizeValue))
378
- throw new Error("size.z must be a finite number");
401
+ if (!("z" in sizeValue)) {
402
+ if (node.kind !== "primitive" ||
403
+ !["cylinder", "cone", "torus", "pyramid"].includes(node.primitive))
404
+ throw new Error("size.z must be a finite number");
405
+ sizeValue = { ...sizeValue, z: sizeValue.x };
406
+ }
379
407
  const requestedSize = vector(sizeValue, "size");
380
408
  const size = node.kind === "primitive"
381
409
  ? normalizePrimitiveSize(node.primitive, requestedSize)
@@ -388,7 +416,7 @@ export function createWompSceneApi(context) {
388
416
  }
389
417
  const parentScale = ancestorScale(id);
390
418
  const converted = node.kind === "union"
391
- ? { ...node.transform.scale, x: size.x / parentScale }
419
+ ? { x: size.x / parentScale, y: size.x / parentScale, z: size.x / parentScale }
392
420
  : scale(toEngineDimensions(size, unitMultiplier), 1 / parentScale);
393
421
  context.call("setNodeScale", [id, converted], () => scene.setNodeScale(id, converted));
394
422
  };
@@ -404,21 +432,6 @@ export function createWompSceneApi(context) {
404
432
  }
405
433
  return converted;
406
434
  };
407
- const insertCurvePoint = (curveId, pointIndex, point = {}) => {
408
- const points = curvePoints(curveId);
409
- if (points.length >= MAX_CURVE_POINTS)
410
- throw new Error("A curve cannot exceed 100 points");
411
- const index = Math.round(finite(pointIndex, "pointIndex"));
412
- if (index < 0 || index > points.length)
413
- throw new Error("Curve insertion index is out of range");
414
- if (points.length === 0)
415
- throw new Error("Cannot add to an empty curve");
416
- const sourceIndex = Math.max(0, index - 1);
417
- context.call("cloneCurvePoint", [curveId, sourceIndex, index], () => scene.cloneCurvePoint(curveId, sourceIndex, index));
418
- shiftCurvePointMetadata(scene, curveId, index, 1);
419
- applyPointInput(curveId, index, point);
420
- return index;
421
- };
422
435
  const api = {
423
436
  ...createSceneEnvironment(scene, context.hdrs, context.print),
424
437
  listSuperMaterials: () => {
@@ -471,29 +484,12 @@ export function createWompSceneApi(context) {
471
484
  closed: false,
472
485
  primitive: "sphere",
473
486
  operation: "union",
474
- blend: toEngineBlend(0.36),
487
+ blend: 0,
475
488
  density: 80,
476
489
  roundness: 2,
477
490
  smoothing: 0.02,
478
491
  materialId: context.getDefaultMaterialId(),
479
- points: [
480
- {
481
- position: scale(toEnginePosition({ x: 0, y: 2, z: 0 }), 1 / parentScale),
482
- rotation: { x: 0, y: 0, z: 0 },
483
- scale: scale(toEngineDimensions({ x: 4, y: 4, z: 4 }), 1 / parentScale),
484
- materialId: context.getDefaultMaterialId(),
485
- fixed: false,
486
- round: 0,
487
- },
488
- {
489
- position: scale(toEnginePosition({ x: 6, y: 2, z: 0 }), 1 / parentScale),
490
- rotation: { x: 0, y: 0, z: 0 },
491
- scale: scale(toEngineDimensions({ x: 4, y: 4, z: 4 }), 1 / parentScale),
492
- materialId: context.getDefaultMaterialId(),
493
- fixed: false,
494
- round: 0,
495
- },
496
- ],
492
+ points: [],
497
493
  }
498
494
  : kind === "text"
499
495
  ? {
@@ -533,6 +529,27 @@ export function createWompSceneApi(context) {
533
529
  context.trackNode(clone.id);
534
530
  return clone.id;
535
531
  },
532
+ /** Deep clone; preserves sibling order and remaps internal references. Await before other edits. */
533
+ cloneSubtree: async (id, options = {}) => {
534
+ if (id === context.rootId)
535
+ throw new Error("The scene root cannot be cloned");
536
+ const check = (nodeId) => {
537
+ requireNode(nodeId);
538
+ for (const child of scene.getNodeChildren(nodeId))
539
+ check(child.id);
540
+ };
541
+ check(id);
542
+ if (options.parentId !== undefined)
543
+ requireNode(options.parentId);
544
+ const clone = await context.callAsync("cloneSubtree", [id, options], () => scene.cloneSubtree(id, options));
545
+ const track = (nodeId) => {
546
+ context.trackNode(nodeId);
547
+ for (const child of scene.getNodeChildren(nodeId))
548
+ track(child.id);
549
+ };
550
+ track(clone.id);
551
+ return clone.id;
552
+ },
536
553
  nodeList: () => scene
537
554
  .listNodes()
538
555
  .filter((node) => node.id !== context.rootId)
@@ -642,11 +659,13 @@ export function createWompSceneApi(context) {
642
659
  }
643
660
  context.call("setNodeOperation", [id, value], () => scene.setNodeOperation(id, value));
644
661
  },
662
+ /** Blend radius in millimetres before parent scaling, independent of project units. */
645
663
  nodeGetBlend: (id) => {
646
664
  const node = requireNode(id);
647
- return "blend" in node ? fromEngineBlend(node.blend) : 0;
665
+ return "blend" in node ? node.blend : 0;
648
666
  },
649
- nodeSetBlend: (id, blend) => update(id, { blend: toEngineBlend(finite(blend, "blend")) }),
667
+ /** Set blend radius in millimetres before parent scaling; clamps to 0–500. */
668
+ nodeSetBlend: (id, blend) => update(id, { blend: Math.min(MAX_BLEND_RADIUS_MM, Math.max(0, finite(blend, "Blend radius (mm)"))) }),
650
669
  nodeGetRound: (id) => {
651
670
  const node = requireNode(id);
652
671
  if (node.kind !== "primitive" && node.kind !== "text")
@@ -673,11 +692,11 @@ export function createWompSceneApi(context) {
673
692
  throw new Error("Resolution is only valid for Unions");
674
693
  return node.resolution;
675
694
  },
676
- nodeSetResolution: (id, resolution) => {
677
- const node = requireNode(id);
695
+ nodeSetUnionResolution: (unionId, resolution) => {
696
+ const node = requireNode(unionId);
678
697
  if (node.kind !== "union")
679
- throw new Error("Resolution is only valid for Unions");
680
- update(id, { resolution: clamp(finite(resolution, "resolution"), 0, 0.65) });
698
+ throw new Error(`Node ${unionId} (${node.kind}): resolution belongs to an Area/Union, not this node`);
699
+ update(unionId, { resolution: clamp(finite(resolution, "resolution"), 0.01, 0.65) });
681
700
  },
682
701
  nodeGetLightType: (id) => LIGHT_TYPES.indexOf(requireLight(id).lightType),
683
702
  nodeSetLightType: (id, lightType) => {
@@ -687,7 +706,12 @@ export function createWompSceneApi(context) {
687
706
  update(id, { lightType: value });
688
707
  },
689
708
  nodeGetPower: (id) => requireLight(id).power,
690
- nodeSetPower: (id, power) => update(id, { power: clamp(finite(power, "power"), 0, 100) }),
709
+ nodeSetPower: (id, power) => {
710
+ requireLight(id);
711
+ if (!Number.isFinite(power) || power < 0 || power > 100)
712
+ throw new Error(`Light ${id}: power must be a finite number from 0 through 100`);
713
+ update(id, { power });
714
+ },
691
715
  nodeGetText: (id) => requireText(id).text,
692
716
  nodeSetText: (id, text) => update(id, { text: String(text) }),
693
717
  nodeGetFont: (id) => requireText(id).fontFamily,
@@ -768,7 +792,7 @@ export function createWompSceneApi(context) {
768
792
  return {
769
793
  axis: axis ?? "custom",
770
794
  planePosition: axis ? position[axis] : 0,
771
- goop: fromEngineBlend(plane.value),
795
+ goop: plane.value,
772
796
  };
773
797
  },
774
798
  nodeSetMirror: (id, slot, axis, planePosition = 0, goop = 0) => {
@@ -790,7 +814,7 @@ export function createWompSceneApi(context) {
790
814
  mirrors[index] = {
791
815
  position: scale(toEnginePosition(publicPosition, unitMultiplier), 1 / ancestorScale(id)),
792
816
  rotation,
793
- value: toEngineMirrorGoop(finite(goop, "Mirror goop")),
817
+ value: Math.min(MAX_MIRROR_BLEND_RADIUS_MM, Math.max(0, finite(goop, "Mirror radius (mm)"))),
794
818
  hide: 0,
795
819
  hideMirrorPlane: true,
796
820
  constraint,
@@ -815,12 +839,8 @@ export function createWompSceneApi(context) {
815
839
  curvePointSetHandleIn: (curveId, pointIndex, value) => setPointHandle(curveId, pointIndex, "handleIn", value),
816
840
  curvePointSetHandleOut: (curveId, pointIndex, value) => setPointHandle(curveId, pointIndex, "handleOut", value),
817
841
  curvePointCount: (curveId) => requireCurve(curveId).points.length,
818
- curvePointAdd: (curveId, point = {}) => insertCurvePoint(curveId, requireCurve(curveId).points.length, point),
819
- curvePointInsert: insertCurvePoint,
842
+ curvePointAdd: addCurvePoint,
820
843
  curvePointRemove: (curveId, pointIndex) => {
821
- const points = curvePoints(curveId);
822
- if (points.length <= 1)
823
- throw new Error("A curve must keep at least one point");
824
844
  const index = requirePoint(curveId, pointIndex);
825
845
  context.call("deleteCurvePoint", [curveId, index], () => scene.deleteCurvePoint(curveId, index));
826
846
  shiftCurvePointMetadata(scene, curveId, index, -1);
@@ -840,7 +860,9 @@ export function createWompSceneApi(context) {
840
860
  curvePointSetRot: (curveId, pointIndex, rotation) => setPoint(curveId, pointIndex, { rotation: convertRotationBasis(vector(rotation, "rot")) }),
841
861
  curvePointGetSize: (curveId, pointIndex) => pointSize(curveId, requireCurve(curveId).points[requirePoint(curveId, pointIndex)]),
842
862
  curvePointSetSize: (curveId, pointIndex, sizeValue) => setPoint(curveId, pointIndex, {
843
- scale: scale(toEngineDimensions(vector(sizeValue, "size"), unitMultiplier), 1 / ancestorScale(curveId)),
863
+ scale: scale(toEngineDimensions(requireCurve(curveId).primitive === "sphere"
864
+ ? normalizePrimitiveSize("sphere", vector(sizeValue, "size"))
865
+ : vector(sizeValue, "size"), unitMultiplier), 1 / ancestorScale(curveId)),
844
866
  }),
845
867
  curvePointGetFixed: (curveId, pointIndex) => requireCurve(curveId).points[requirePoint(curveId, pointIndex)].fixed,
846
868
  curvePointSetFixed: (curveId, pointIndex, fixed) => setPoint(curveId, pointIndex, { fixed: Boolean(fixed) }),
@@ -969,6 +991,7 @@ export function createWompSceneApi(context) {
969
991
  }),
970
992
  aabbRadius: (box) => Math.hypot(box.max.x - box.min.x, box.max.y - box.min.y, box.max.z - box.min.z) / 2,
971
993
  lookAt,
994
+ alignAxis,
972
995
  };
973
996
  return api;
974
997
  }
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "@womp/spark-agent",
3
- "version": "3.0.3",
3
+ "version": "4.0.1",
4
4
  "description": "Portable skills-based AI agent with local and durable chat transports for Womp",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
8
  "bin": {
9
- "spark-agent": "dist/cli.js"
9
+ "spark-agent": "dist/cli.js",
10
+ "simple-bench": "dist/simple-bench-cli.js",
11
+ "agent-run": "dist/agent-run-cli.js"
10
12
  },
11
13
  "exports": {
12
14
  "./browser": {
@@ -92,6 +94,8 @@
92
94
  "lint": "yarn typecheck",
93
95
  "dev": "yarn build && concurrently --kill-others \"yarn dev:server\" \"yarn dev:web\"",
94
96
  "dev:server": "tsx src/cli.ts",
97
+ "simple-bench": "tsx src/simple-bench-cli.ts",
98
+ "agent-run": "tsx src/agent-run-cli.ts",
95
99
  "dev:demo-account": "yarn build && concurrently --kill-others \"yarn dev:server --profile demo-account\" \"yarn dev:web\"",
96
100
  "dev:web": "vite --config web/vite.config.ts",
97
101
  "start": "node dist/cli.js",
@@ -106,7 +110,7 @@
106
110
  "@ai-sdk/openai": "4.0.63",
107
111
  "@jitl/quickjs-wasmfile-release-sync": "0.32.0",
108
112
  "@womp/flowir": "0.3.0",
109
- "@womp/kakapo-sdk": "0.3.1",
113
+ "@womp/kakapo-sdk": "0.4.0",
110
114
  "ai": "7.0.95",
111
115
  "eventsource-parser": "^3.0.6",
112
116
  "express": "^5.2.1",
@@ -1,9 +0,0 @@
1
- import type { SparkCapability, SparkInvocationContext } from "../capabilities.js";
2
- import type { SceneHealth } from "../scene-health.js";
3
- export type WompHealthApi = {
4
- read(objectIds: number[]): Promise<SceneHealth>;
5
- };
6
- export interface SceneHealthHost {
7
- read(objectIds: number[], context: SparkInvocationContext): Promise<SceneHealth>;
8
- }
9
- export declare function createSceneHealthCapability(host: SceneHealthHost): SparkCapability<WompHealthApi>;
@@ -1,27 +0,0 @@
1
- import { z } from "zod";
2
- import { WOMP_HEALTH_DECLARATIONS } from "../generated/health-declarations.js";
3
- export function createSceneHealthCapability(host) {
4
- return {
5
- skills: [
6
- {
7
- name: "scene-health",
8
- version: "1",
9
- description: "Required before scene checks or procedural edits: engine limits, empty Areas, fresh geometry feedback, and bounded repairs.",
10
- instructions: `Before checking or editing a model, call womp.health.read([]) for current scene health. A health read is a snapshot and does not prove that the latest edit finished evaluating. Inspect scene edit receipts before claiming success.
11
- For confirmed primitive or depth overflow, repair the same target while preserving design, dimensions, active parameter overrides, and unrelated objects. At most two geometry repairs are allowed per target in one logical run. Unverified feedback must not trigger blind regeneration or a claim that the model passed. Empty Areas may be pending, intentionally empty, mesh-only, or failed. Overflow flags take precedence over possibly stale counts. max_total_depth is a scene hierarchy limit, not measured Boolean depth.`,
12
- declarations: WOMP_HEALTH_DECLARATIONS,
13
- examples: ["print(await womp.health.read([]));"],
14
- },
15
- ],
16
- createApi: (context) => ({
17
- read: (objectIds) => {
18
- const parsed = z
19
- .array(z.number().int().positive())
20
- .safeParse(objectIds);
21
- if (parsed.success === false)
22
- return Promise.reject(parsed.error);
23
- return host.read(parsed.data, context);
24
- },
25
- }),
26
- };
27
- }
package/dist/context.d.ts DELETED
@@ -1,15 +0,0 @@
1
- import type { ModelMessage } from "ai";
2
- /** Host input budget, not a claim about a provider's maximum context window. */
3
- export type SparkContextPolicy = {
4
- maxInputTokens: number;
5
- };
6
- export declare class SparkContextLimitError extends Error {
7
- constructor();
8
- }
9
- /** Heuristic, not provider tokenization. Encoded media bytes are not text tokens. */
10
- export declare function estimateSparkContextTokens(value: unknown): number;
11
- /**
12
- * Project model input only. Never mutate persisted messages, remove call/result
13
- * pairs, summarize user requests, or discard receipts, references, and failures.
14
- */
15
- export declare function prepareSparkContext(messages: ModelMessage[], system: string, policy: SparkContextPolicy): ModelMessage[];