@energy8platform/golem 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +18 -0
  2. package/dist/editor.css +3 -4
  3. package/dist/editor.js +177 -75
  4. package/dist/lib/cli.js +302 -126
  5. package/dist/lib/cli.js.map +4 -4
  6. package/dist/lib/e8/agent.d.ts +35 -0
  7. package/dist/lib/e8/host.d.ts +22 -0
  8. package/dist/lib/e8/node.d.ts +66 -0
  9. package/dist/lib/e8/runtime.d.ts +10 -0
  10. package/dist/lib/e8/schema.d.ts +3 -0
  11. package/dist/lib/e8/types.d.ts +80 -0
  12. package/dist/lib/e8-agent.js +6781 -0
  13. package/dist/lib/e8-agent.js.map +7 -0
  14. package/dist/lib/e8-client.js +116 -0
  15. package/dist/lib/e8-host.js +6929 -0
  16. package/dist/lib/e8-host.js.map +7 -0
  17. package/dist/lib/e8-runtime.js +2024 -0
  18. package/dist/lib/e8-runtime.js.map +7 -0
  19. package/dist/lib/e8-schema.js +7 -0
  20. package/dist/lib/e8-schema.js.map +7 -0
  21. package/dist/lib/editor/api.d.ts +1 -0
  22. package/dist/lib/editor/embed.d.ts +9 -0
  23. package/dist/lib/editor/server.d.ts +23 -1
  24. package/dist/lib/editor/store.d.ts +107 -0
  25. package/dist/lib/editor/timeline.d.ts +15 -0
  26. package/dist/lib/editor-entry.d.ts +1 -1
  27. package/dist/lib/editor-entry.js +303 -126
  28. package/dist/lib/editor-entry.js.map +4 -4
  29. package/dist/lib/harness.js +69 -14
  30. package/dist/lib/interactive-editor.js.map +1 -1
  31. package/dist/lib/rig-anim.d.ts +2 -0
  32. package/dist/lib/rig-control-qa.d.ts +27 -0
  33. package/dist/lib/rig-format.d.ts +989 -0
  34. package/dist/lib/rig-import-layers.d.ts +2 -0
  35. package/dist/lib/rig-version.d.ts +12 -0
  36. package/dist/lib/runtime.js +69 -14
  37. package/dist/lib/runtime.js.map +3 -3
  38. package/dist/lib/spine-import.d.ts +4 -0
  39. package/dist/lib/tool-schema.d.ts +3 -0
  40. package/dist/lib/tools.d.ts +2 -0
  41. package/dist/lib/tools.js +257 -73
  42. package/dist/lib/tools.js.map +4 -4
  43. package/editor.html +2 -2
  44. package/package.json +38 -3
  45. package/skills/e8-golem/SKILL.md +71 -0
  46. package/skills/golem-symbol-animation/SKILL.md +87 -0
  47. package/skills/golem-symbol-animation/agents/openai.yaml +4 -0
  48. package/skills/golem-symbol-animation/references/facial-controls.md +48 -0
  49. package/skills/golem-symbol-animation/references/game-engine-integration.md +133 -0
  50. package/skills/golem-symbol-animation/references/golem-authoring.md +138 -0
  51. package/skills/golem-symbol-animation/references/interactive-editor.md +17 -0
  52. package/skills/golem-symbol-animation/references/motion-craft.md +113 -0
  53. package/skills/golem-symbol-animation/references/packed-delivery.md +88 -0
  54. package/skills/golem-symbol-animation/references/quantitative-qa.md +106 -0
  55. package/skills/golem-symbol-animation/references/spine-rive-study.md +87 -0
  56. package/skills/golem-symbol-animation/scripts/atlas_parts.py +87 -0
  57. package/skills/golem-symbol-animation/scripts/check_package.py +71 -0
  58. package/skills/golem-symbol-animation/scripts/image_gates.py +143 -0
  59. package/skills/golem-symbol-cutting/SKILL.md +70 -0
  60. package/skills/golem-symbol-cutting/agents/openai.yaml +4 -0
  61. package/skills/golem-symbol-cutting/assets/h1/h1.atlas.png +0 -0
  62. package/skills/golem-symbol-cutting/assets/h1/h1.png +0 -0
  63. package/skills/golem-symbol-cutting/references/cutting-workflow.md +92 -0
  64. package/skills/golem-symbol-cutting/references/facial-layers.md +44 -0
  65. package/skills/golem-symbol-cutting/references/generation-workflow.md +109 -0
  66. package/skills/golem-symbol-cutting/references/golem-handoff.md +62 -0
  67. package/skills/golem-symbol-cutting/references/h1-example.md +46 -0
  68. package/skills/golem-symbol-cutting/references/hybrid-workflow.md +119 -0
  69. package/skills/golem-symbol-cutting/references/registration-and-motion.md +89 -0
  70. package/skills/golem-symbol-cutting/references/spine-rive-construction.md +73 -0
  71. package/skills/golem-symbol-cutting/scripts/atlas_parts.py +87 -0
  72. package/skills/golem-symbol-cutting/scripts/hybrid_parts.py +279 -0
@@ -49524,7 +49524,9 @@ ${parts.join("\n")}
49524
49524
  /** curve lengths for constant-speed positioning */
49525
49525
  lengths: external_exports.array(external_exports.number()).default([]),
49526
49526
  closed: external_exports.boolean().default(false),
49527
- constantSpeed: external_exports.boolean().default(true)
49527
+ constantSpeed: external_exports.boolean().default(true),
49528
+ /** Spine-style active clipping span in the posed draw order; end slot is inclusive. */
49529
+ clipping: external_exports.object({ end: Id.optional() }).optional()
49528
49530
  });
49529
49531
  var Attachment = external_exports.discriminatedUnion("type", [RegionAttachment, MeshAttachment, PathAttachment]);
49530
49532
  var IkConstraint = external_exports.object({
@@ -49588,7 +49590,9 @@ ${parts.join("\n")}
49588
49590
  t: external_exports.number().nonnegative(),
49589
49591
  v: KeyValue,
49590
49592
  /** easing INTO the next key */
49591
- ease: Ease.default("ease_in_out")
49593
+ ease: Ease.default("ease_in_out"),
49594
+ /** Optional independent easing for numeric-array components (for example Spine RGBA curves). */
49595
+ componentEase: external_exports.array(Ease).min(1).optional()
49592
49596
  });
49593
49597
  var Interpolation = { interpolation: external_exports.enum(["segment", "pchip"]).optional() };
49594
49598
  var Track = external_exports.discriminatedUnion("target", [
@@ -49775,6 +49779,10 @@ ${parts.join("\n")}
49775
49779
  else if (a2.slot !== s2.id) errs.push(`slot "${s2.id}": attachment "${s2.attachment}" belongs to slot "${a2.slot}"`);
49776
49780
  }
49777
49781
  }
49782
+ for (const a2 of doc.attachments) if (a2.type === "path" && a2.clipping) {
49783
+ if (!a2.closed) errs.push(`attachment "${a2.id}": clipping path must be closed`);
49784
+ if (a2.clipping.end && !slots.has(a2.clipping.end)) errs.push(`attachment "${a2.id}": unknown clipping end slot "${a2.clipping.end}"`);
49785
+ }
49778
49786
  const vertexCount = (a2) => {
49779
49787
  if (a2.type === "region") return 4;
49780
49788
  if (a2.type === "mesh") return a2.uvs.length / 2;
@@ -49858,6 +49866,7 @@ ${parts.join("\n")}
49858
49866
  const att = t2.target === "deform" ? attachments.get(t2.id) : void 0;
49859
49867
  let prev = -1;
49860
49868
  for (const k2 of t2.keys) {
49869
+ if (k2.componentEase && (!Array.isArray(k2.v) || !k2.v.every((v2) => typeof v2 === "number") || k2.componentEase.length !== k2.v.length)) errs.push(`animation "${a2.id}" ${tid}: componentEase must match the numeric-array value length`);
49861
49870
  if (k2.t <= prev && prev >= 0) errs.push(`animation "${a2.id}" ${tid}: keys not strictly increasing`);
49862
49871
  if (k2.t > a2.duration) errs.push(`animation "${a2.id}" ${tid}: key at ${k2.t}s exceeds duration`);
49863
49872
  if (t2.target === "control") {
@@ -50022,8 +50031,8 @@ ${parts.join("\n")}
50022
50031
  }
50023
50032
  if (Array.isArray(a2.v) && Array.isArray(b2.v) && typeof a2.v[0] === "number") {
50024
50033
  if (track.interpolation === "pchip") return a2.v.map((_, j2) => smoothValue(track, i2, t2, j2, loop));
50025
- const u2 = ease(a2.ease)((t2 - a2.t) / (b2.t - a2.t)), av = a2.v, bv = b2.v;
50026
- return av.map((v2, k2) => v2 + ((bv[k2] ?? v2) - v2) * u2);
50034
+ const phase = (t2 - a2.t) / (b2.t - a2.t), av = a2.v, bv = b2.v;
50035
+ return av.map((v2, k2) => v2 + ((bv[k2] ?? v2) - v2) * ease(a2.componentEase?.[k2] ?? a2.ease)(phase));
50027
50036
  }
50028
50037
  return a2.v;
50029
50038
  }
@@ -50111,6 +50120,13 @@ ${parts.join("\n")}
50111
50120
  if (!parent) return local;
50112
50121
  if (bone.inherit === "normal") return mul(parent, local);
50113
50122
  const [tx, ty] = apply(parent, s2.x, s2.y);
50123
+ if (bone.inherit === "noScale" || bone.inherit === "noScaleOrReflection") {
50124
+ const r2 = s2.rotation * DEG2, x2 = parent.a * Math.cos(r2) + parent.c * Math.sin(r2), y2 = parent.b * Math.cos(r2) + parent.d * Math.sin(r2);
50125
+ const length2 = Math.hypot(x2, y2), a2 = length2 > 1e-5 ? x2 / length2 : x2, b2 = length2 > 1e-5 ? y2 / length2 : y2;
50126
+ const sign = bone.inherit === "noScale" && parent.a * parent.d - parent.b * parent.c < 0 ? -1 : 1;
50127
+ const basis2 = { a: a2, b: b2, c: -b2 * sign, d: a2 * sign, tx: 0, ty: 0 };
50128
+ return { ...mul(basis2, affineOf(0, 0, 0, s2.scaleX, s2.scaleY, s2.shearX, s2.shearY)), tx, ty };
50129
+ }
50114
50130
  return { ...mul(inheritedParentLinear(bone, parent), { ...local, tx: 0, ty: 0 }), tx, ty };
50115
50131
  }
50116
50132
  var orderCache = /* @__PURE__ */ new WeakMap();
@@ -50143,11 +50159,11 @@ ${parts.join("\n")}
50143
50159
  shearY: num(pose, pk("bone", id, "shearY"), r2.shearY)
50144
50160
  };
50145
50161
  };
50146
- function updateSubtree(skel, root) {
50162
+ function updateSubtree(skel, root, includeRoot = true) {
50147
50163
  const doc = skel.doc;
50148
50164
  const kids = /* @__PURE__ */ new Map();
50149
50165
  for (const b2 of doc.bones) if (b2.parent) (kids.get(b2.parent) ?? kids.set(b2.parent, []).get(b2.parent)).push(b2);
50150
- const stack = [root];
50166
+ const stack = includeRoot ? [root] : (kids.get(root) ?? []).map((b2) => b2.id);
50151
50167
  while (stack.length) {
50152
50168
  const id = stack.pop(), b2 = boneOf(doc, id), st = skel.bones.get(id);
50153
50169
  st.world = boneWorldOf(b2, st, b2.parent ? skel.bones.get(b2.parent).world : void 0);
@@ -50181,6 +50197,23 @@ ${parts.join("\n")}
50181
50197
  }
50182
50198
  return skel;
50183
50199
  }
50200
+ function slotClips(skel) {
50201
+ const keyed = skel.pose.get(pk("drawOrder", "order", "order"));
50202
+ const order = Array.isArray(keyed) ? keyed : [...skel.doc.slots].sort((a2, b2) => a2.z - b2.z).map((s2) => s2.id);
50203
+ const masks = /* @__PURE__ */ new Map();
50204
+ let active;
50205
+ for (const id of order) {
50206
+ const att = skel.attachment.get(id);
50207
+ if (!active && att?.type === "path" && att.clipping) {
50208
+ active = att;
50209
+ continue;
50210
+ }
50211
+ if (active) masks.set(id, active.id);
50212
+ if (active?.clipping?.end === id) active = void 0;
50213
+ }
50214
+ for (const s2 of skel.doc.slots) if (s2.clip) masks.set(s2.id, s2.clip);
50215
+ return masks;
50216
+ }
50184
50217
  var cnum = (skel, kind, id, prop, rest) => num(skel.pose, pk(kind, id, prop), typeof rest === "boolean" ? rest ? 1 : 0 : rest);
50185
50218
  var IDENTITY = { a: 1, b: 0, c: 0, d: 1, tx: 0, ty: 0 };
50186
50219
  var wrapRad = (r2) => r2 > Math.PI ? r2 - 2 * Math.PI : r2 < -Math.PI ? r2 + 2 * Math.PI : r2;
@@ -50390,7 +50423,8 @@ ${parts.join("\n")}
50390
50423
  if (!mixRotate && !mixX && !mixY && !mixScaleX && !mixScaleY && !mixShearY) return;
50391
50424
  c2 = { ...c2, ...Object.fromEntries(["x", "y", "rotation", "scaleX", "scaleY", "shearY"].map((p2) => [p2, cnum(skel, "transform", c2.id, p2, c2[p2])])) };
50392
50425
  const target = skel.bones.get(c2.target), tw = target.world;
50393
- const offsetRotation = c2.rotation * DEG2, offsetShearY = c2.shearY * DEG2;
50426
+ const handedness = tw.a * tw.d - tw.b * tw.c < 0 ? -1 : 1;
50427
+ const offsetRotation = c2.rotation * DEG2 * (c2.local ? 1 : handedness), offsetShearY = c2.shearY * DEG2 * (c2.local ? 1 : handedness);
50394
50428
  for (const id of c2.bones) {
50395
50429
  const b2 = boneOf(skel.doc, id), st = skel.bones.get(id);
50396
50430
  if (c2.local) {
@@ -50552,6 +50586,7 @@ ${parts.join("\n")}
50552
50586
  const position = cnum(skel, "path", c2.id, "position", c2.position), spacing = cnum(skel, "path", c2.id, "spacing", c2.spacing);
50553
50587
  const tangents = c2.rotateMode === "tangent", scale = c2.rotateMode === "chainScale";
50554
50588
  const bones = c2.bones.map((id) => ({ b: boneOf(skel.doc, id), st: skel.bones.get(id) }));
50589
+ const inputWorlds = bones.map(({ st }) => ({ ...st.world }));
50555
50590
  const spacesCount = tangents ? bones.length : bones.length + 1;
50556
50591
  const spaces = new Array(spacesCount).fill(0), worldLengths = [];
50557
50592
  let sum = 0;
@@ -50586,9 +50621,10 @@ ${parts.join("\n")}
50586
50621
  if (tw.a * tw.d - tw.b * tw.c < 0) offsetRotation = -offsetRotation;
50587
50622
  }
50588
50623
  let boneX = samples[0].x, boneY = samples[0].y;
50624
+ const solvedWorlds = /* @__PURE__ */ new Map();
50589
50625
  for (let i2 = 0; i2 < bones.length; i2++) {
50590
50626
  const { b: b2, st } = bones[i2];
50591
- let w2 = { ...st.world };
50627
+ let w2 = { ...inputWorlds[i2] };
50592
50628
  w2.tx += (boneX - w2.tx) * mixX;
50593
50629
  w2.ty += (boneY - w2.ty) * mixY;
50594
50630
  const next = samples[i2 + 1] ?? { x: 0, y: 0, angle: 0 };
@@ -50618,7 +50654,11 @@ ${parts.join("\n")}
50618
50654
  const cos = Math.cos(r2), sin = Math.sin(r2);
50619
50655
  w2 = { a: cos * a2 - sin * bb, b: sin * a2 + cos * bb, c: cos * cc - sin * d2, d: sin * cc + cos * d2, tx: w2.tx, ty: w2.ty };
50620
50656
  }
50621
- setEffectiveWorld(skel, b2, st, w2);
50657
+ solvedWorlds.set(b2.id, w2);
50658
+ }
50659
+ for (const b2 of boneOrder(skel.doc)) {
50660
+ const world = solvedWorlds.get(b2.id);
50661
+ if (world) setEffectiveWorld(skel, b2, skel.bones.get(b2.id), world);
50622
50662
  }
50623
50663
  }
50624
50664
  function measuredPathLength(points, closed, lengths, constantSpeed) {
@@ -50647,9 +50687,14 @@ ${parts.join("\n")}
50647
50687
  case "onlyTranslation":
50648
50688
  return { a: 1, b: 0, c: 0, d: 1, tx: 0, ty: 0 };
50649
50689
  case "noRotationOrReflection": {
50650
- const lenX = Math.hypot(parent.a, parent.b) || 1;
50690
+ const lenX = Math.hypot(parent.a, parent.b);
50651
50691
  const det = parent.a * parent.d - parent.b * parent.c;
50652
- return { a: lenX, b: 0, c: 0, d: Math.abs(det) / lenX, tx: 0, ty: 0 };
50692
+ if (lenX * lenX <= 1e-4) {
50693
+ const lenY = Math.hypot(parent.c, parent.d), ux3 = lenY ? parent.c / lenY : 0, uy3 = lenY ? parent.d / lenY : 0;
50694
+ return { a: lenY * ux3 * ux3, b: lenY * ux3 * uy3, c: lenY * ux3 * uy3, d: lenY * uy3 * uy3, tx: 0, ty: 0 };
50695
+ }
50696
+ const ux2 = parent.a / lenX, uy2 = parent.b / lenX, sy = Math.abs(det) / lenX;
50697
+ return { a: lenX * ux2 * ux2 + sy * uy2 * uy2, b: (lenX - sy) * ux2 * uy2, c: (lenX - sy) * ux2 * uy2, d: lenX * uy2 * uy2 + sy * ux2 * ux2, tx: 0, ty: 0 };
50653
50698
  }
50654
50699
  case "noScale":
50655
50700
  case "noScaleOrReflection": {
@@ -50675,7 +50720,16 @@ ${parts.join("\n")}
50675
50720
  st.scaleY = Math.hypot(lin.c, lin.d);
50676
50721
  st.shearX = 0;
50677
50722
  st.shearY = shortest(Math.atan2(lin.d, lin.c) / DEG2 - st.rotation - 90);
50678
- updateSubtree(skel, bone.id);
50723
+ if (parent && (bone.inherit === "noScale" || bone.inherit === "noScaleOrReflection")) {
50724
+ const direction = mul(invert({ ...parent, tx: 0, ty: 0 }), { ...world, tx: 0, ty: 0 });
50725
+ st.rotation = Math.atan2(direction.b, direction.a) / DEG2;
50726
+ st.scaleX = Math.hypot(world.a, world.b);
50727
+ st.scaleY = Math.hypot(world.c, world.d);
50728
+ const sign = bone.inherit === "noScale" && parent.a * parent.d - parent.b * parent.c < 0 ? -1 : 1;
50729
+ st.shearY = shortest((Math.atan2(world.d, world.c) - Math.atan2(world.b, world.a)) / DEG2 * sign - 90);
50730
+ }
50731
+ st.world = world;
50732
+ updateSubtree(skel, bone.id, false);
50679
50733
  }
50680
50734
  function attachmentWorldVertices(skel, slotId, att) {
50681
50735
  const deform = skel.pose.get(pk("deform", att.id, "vertices"));
@@ -51074,7 +51128,7 @@ ${parts.join("\n")}
51074
51128
  this.clipPoints.clear();
51075
51129
  const skel = this.skel = evaluate(this.doc, pose, this.beforePose);
51076
51130
  pose = skel.pose;
51077
- const clips = new Set(this.doc.slots.flatMap((s2) => s2.clip ? [s2.clip] : []));
51131
+ const masks = slotClips(skel), clips = new Set(masks.values());
51078
51132
  for (const [id, g2] of this.clipGraphics) if (!clips.has(id)) {
51079
51133
  g2.destroy();
51080
51134
  this.clipGraphics.delete(id);
@@ -51101,7 +51155,8 @@ ${parts.join("\n")}
51101
51155
  if (Array.isArray(orderV)) orderV.forEach((id, i2) => order.set(id, i2));
51102
51156
  for (const it of this.items) {
51103
51157
  const s2 = it.slot, shown = skel.attachment.get(s2.id);
51104
- it.node.mask = s2.clip ? this.clipGraphics.get(s2.clip) ?? null : null;
51158
+ const mask = masks.get(s2.id);
51159
+ it.node.mask = mask ? this.clipGraphics.get(mask) ?? null : null;
51105
51160
  if (shown !== it.att || this.hidden.has(s2.id)) {
51106
51161
  it.node.visible = false;
51107
51162
  continue;