@jokerized/decksmith 0.9.7 → 0.9.8

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/dist/cli.js CHANGED
@@ -23530,9 +23530,9 @@ function literalFindings(storyboard, source, opts = {}) {
23530
23530
  prevKey = { id: beat2.id, key };
23531
23531
  });
23532
23532
  const tables = beats.filter((b) => b.literal?.kind === "table");
23533
- if (tables.length > 1)
23533
+ for (const t2 of tables.slice(1))
23534
23534
  out.push(
23535
- `The plan draws ${tables.length} tables (${tables.map((b) => b.id).join(", ")}). A table reads like a report: keep at most one, and draw the others as what they list \u2014 results as \`place\` (margin or plane), what was and was not evaluated as \`place\` sets, experiments not run as \`place\` combos, earlier approaches as \`prior-work\`, reported costs as \`place\` length \u2014 or leave \`literal\` null where nothing is honest.`
23535
+ `${t2.id} draws a table, and so does ${tables[0]?.id}. A table reads like a report: keep at most one, and draw this one as what it lists \u2014 results as \`place\` (margin or plane), what was and was not evaluated as \`place\` sets, experiments not run as \`place\` combos, earlier approaches as \`prior-work\`, reported costs as \`place\` length \u2014 or leave \`literal\` null where nothing is honest.`
23536
23536
  );
23537
23537
  const byVectors = /* @__PURE__ */ new Map();
23538
23538
  for (const b of beats) {
@@ -23541,20 +23541,20 @@ function literalFindings(storyboard, source, opts = {}) {
23541
23541
  const key = JSON.stringify(l.vectors.map((v) => v.values));
23542
23542
  byVectors.set(key, [...byVectors.get(key) ?? [], b.id]);
23543
23543
  }
23544
- for (const ids of byVectors.values())
23545
- if (ids.length > 1)
23544
+ for (const [first, ...rest] of byVectors.values())
23545
+ for (const id2 of rest)
23546
23546
  out.push(
23547
- `${ids.join(" and ")} run operate on the same vectors, so the deck shows one chart twice. Give the second beat's chain to the first (one longer chain), or draw the second another way.`
23547
+ `${id2} runs operate on the same vectors as ${first}, so the deck shows one chart twice. Give its chain to ${first} (one longer chain), or draw ${id2} another way.`
23548
23548
  );
23549
23549
  const forms = /* @__PURE__ */ new Map();
23550
23550
  for (const b of beats) {
23551
23551
  const f = b.literal && wordForm(b.literal);
23552
23552
  if (f) forms.set(f, [...forms.get(f) ?? [], b.id]);
23553
23553
  }
23554
- for (const [f, ids] of forms)
23555
- if (ids.length > 1)
23554
+ for (const [f, [first, ...rest]] of forms)
23555
+ for (const id2 of rest)
23556
23556
  out.push(
23557
- `The plan draws \`${f}\` ${ids.length} times (${ids.join(", ")}). It draws no picture, so a second one is the same slide again: keep it on one beat, and draw the others another way or with \`literal\` null.`
23557
+ `${id2} draws \`${f}\`, as ${first} already does. It draws no picture, so a second one is the same slide again: draw ${id2} another way, or with \`literal\` null.`
23558
23558
  );
23559
23559
  return out;
23560
23560
  }
@@ -25008,13 +25008,39 @@ function operateVariants(v) {
25008
25008
  return [only(OPERATE_CHAIN, OPERATE_TERMS), only(OPERATE_TERMS)];
25009
25009
  }
25010
25010
  function schemaFor(prefs, source) {
25011
- return splitOperate(
25012
- hideFromPlanner(
25013
- forStructuredOutput(z3.toJSONSchema(storyboardSchema, { io: "input" })),
25014
- plannerInvisible(prefs, source)
25011
+ return shareLiteral(
25012
+ splitOperate(
25013
+ hideFromPlanner(
25014
+ forStructuredOutput(z3.toJSONSchema(storyboardSchema, { io: "input" })),
25015
+ plannerInvisible(prefs, source)
25016
+ )
25015
25017
  )
25016
25018
  );
25017
25019
  }
25020
+ function shareLiteral(schema) {
25021
+ const root = schema;
25022
+ const variants = root.properties.beats.items.anyOf;
25023
+ const literal = variants[0]?.properties.literal;
25024
+ if (!literal) return schema;
25025
+ const one2 = JSON.stringify(literal);
25026
+ if (!variants.every((v) => JSON.stringify(v.properties.literal) === one2))
25027
+ throw new Error("schemaFor: the beat variants carry different `literal` schemas.");
25028
+ const ref = { $ref: "#/$defs/literal" };
25029
+ return {
25030
+ ...root,
25031
+ $defs: { literal },
25032
+ properties: {
25033
+ ...root.properties,
25034
+ beats: {
25035
+ ...root.properties.beats,
25036
+ items: {
25037
+ ...root.properties.beats.items,
25038
+ anyOf: variants.map((v) => ({ ...v, properties: { ...v.properties, literal: ref } }))
25039
+ }
25040
+ }
25041
+ }
25042
+ };
25043
+ }
25018
25044
  var SCHEMA = schemaFor(prefsSchema.parse({}));
25019
25045
  async function codexPlanner(source, opts = {}) {
25020
25046
  const prefs = opts.prefs ?? prefsSchema.parse({});
package/dist/index.js CHANGED
@@ -25877,9 +25877,9 @@ function literalFindings(storyboard, source, opts = {}) {
25877
25877
  prevKey = { id: beat2.id, key };
25878
25878
  });
25879
25879
  const tables = beats.filter((b) => b.literal?.kind === "table");
25880
- if (tables.length > 1)
25880
+ for (const t2 of tables.slice(1))
25881
25881
  out.push(
25882
- `The plan draws ${tables.length} tables (${tables.map((b) => b.id).join(", ")}). A table reads like a report: keep at most one, and draw the others as what they list \u2014 results as \`place\` (margin or plane), what was and was not evaluated as \`place\` sets, experiments not run as \`place\` combos, earlier approaches as \`prior-work\`, reported costs as \`place\` length \u2014 or leave \`literal\` null where nothing is honest.`
25882
+ `${t2.id} draws a table, and so does ${tables[0]?.id}. A table reads like a report: keep at most one, and draw this one as what it lists \u2014 results as \`place\` (margin or plane), what was and was not evaluated as \`place\` sets, experiments not run as \`place\` combos, earlier approaches as \`prior-work\`, reported costs as \`place\` length \u2014 or leave \`literal\` null where nothing is honest.`
25883
25883
  );
25884
25884
  const byVectors = /* @__PURE__ */ new Map();
25885
25885
  for (const b of beats) {
@@ -25888,20 +25888,20 @@ function literalFindings(storyboard, source, opts = {}) {
25888
25888
  const key = JSON.stringify(l.vectors.map((v) => v.values));
25889
25889
  byVectors.set(key, [...byVectors.get(key) ?? [], b.id]);
25890
25890
  }
25891
- for (const ids of byVectors.values())
25892
- if (ids.length > 1)
25891
+ for (const [first, ...rest] of byVectors.values())
25892
+ for (const id2 of rest)
25893
25893
  out.push(
25894
- `${ids.join(" and ")} run operate on the same vectors, so the deck shows one chart twice. Give the second beat's chain to the first (one longer chain), or draw the second another way.`
25894
+ `${id2} runs operate on the same vectors as ${first}, so the deck shows one chart twice. Give its chain to ${first} (one longer chain), or draw ${id2} another way.`
25895
25895
  );
25896
25896
  const forms = /* @__PURE__ */ new Map();
25897
25897
  for (const b of beats) {
25898
25898
  const f = b.literal && wordForm(b.literal);
25899
25899
  if (f) forms.set(f, [...forms.get(f) ?? [], b.id]);
25900
25900
  }
25901
- for (const [f, ids] of forms)
25902
- if (ids.length > 1)
25901
+ for (const [f, [first, ...rest]] of forms)
25902
+ for (const id2 of rest)
25903
25903
  out.push(
25904
- `The plan draws \`${f}\` ${ids.length} times (${ids.join(", ")}). It draws no picture, so a second one is the same slide again: keep it on one beat, and draw the others another way or with \`literal\` null.`
25904
+ `${id2} draws \`${f}\`, as ${first} already does. It draws no picture, so a second one is the same slide again: draw ${id2} another way, or with \`literal\` null.`
25905
25905
  );
25906
25906
  return out;
25907
25907
  }
@@ -27355,13 +27355,39 @@ function operateVariants(v) {
27355
27355
  return [only(OPERATE_CHAIN, OPERATE_TERMS), only(OPERATE_TERMS)];
27356
27356
  }
27357
27357
  function schemaFor(prefs, source) {
27358
- return splitOperate(
27359
- hideFromPlanner(
27360
- forStructuredOutput(z3.toJSONSchema(storyboardSchema, { io: "input" })),
27361
- plannerInvisible(prefs, source)
27358
+ return shareLiteral(
27359
+ splitOperate(
27360
+ hideFromPlanner(
27361
+ forStructuredOutput(z3.toJSONSchema(storyboardSchema, { io: "input" })),
27362
+ plannerInvisible(prefs, source)
27363
+ )
27362
27364
  )
27363
27365
  );
27364
27366
  }
27367
+ function shareLiteral(schema) {
27368
+ const root = schema;
27369
+ const variants = root.properties.beats.items.anyOf;
27370
+ const literal = variants[0]?.properties.literal;
27371
+ if (!literal) return schema;
27372
+ const one2 = JSON.stringify(literal);
27373
+ if (!variants.every((v) => JSON.stringify(v.properties.literal) === one2))
27374
+ throw new Error("schemaFor: the beat variants carry different `literal` schemas.");
27375
+ const ref = { $ref: "#/$defs/literal" };
27376
+ return {
27377
+ ...root,
27378
+ $defs: { literal },
27379
+ properties: {
27380
+ ...root.properties,
27381
+ beats: {
27382
+ ...root.properties.beats,
27383
+ items: {
27384
+ ...root.properties.beats.items,
27385
+ anyOf: variants.map((v) => ({ ...v, properties: { ...v.properties, literal: ref } }))
27386
+ }
27387
+ }
27388
+ }
27389
+ };
27390
+ }
27365
27391
  var SCHEMA = schemaFor(prefsSchema.parse({}));
27366
27392
  async function codexPlanner(source, opts = {}) {
27367
27393
  const prefs = opts.prefs ?? prefsSchema.parse({});
package/dist/mcp.js CHANGED
@@ -24389,9 +24389,9 @@ function literalFindings(storyboard, source, opts = {}) {
24389
24389
  prevKey = { id: beat.id, key };
24390
24390
  });
24391
24391
  const tables = beats.filter((b) => b.literal?.kind === "table");
24392
- if (tables.length > 1)
24392
+ for (const t2 of tables.slice(1))
24393
24393
  out.push(
24394
- `The plan draws ${tables.length} tables (${tables.map((b) => b.id).join(", ")}). A table reads like a report: keep at most one, and draw the others as what they list \u2014 results as \`place\` (margin or plane), what was and was not evaluated as \`place\` sets, experiments not run as \`place\` combos, earlier approaches as \`prior-work\`, reported costs as \`place\` length \u2014 or leave \`literal\` null where nothing is honest.`
24394
+ `${t2.id} draws a table, and so does ${tables[0]?.id}. A table reads like a report: keep at most one, and draw this one as what it lists \u2014 results as \`place\` (margin or plane), what was and was not evaluated as \`place\` sets, experiments not run as \`place\` combos, earlier approaches as \`prior-work\`, reported costs as \`place\` length \u2014 or leave \`literal\` null where nothing is honest.`
24395
24395
  );
24396
24396
  const byVectors = /* @__PURE__ */ new Map();
24397
24397
  for (const b of beats) {
@@ -24400,20 +24400,20 @@ function literalFindings(storyboard, source, opts = {}) {
24400
24400
  const key = JSON.stringify(l.vectors.map((v) => v.values));
24401
24401
  byVectors.set(key, [...byVectors.get(key) ?? [], b.id]);
24402
24402
  }
24403
- for (const ids of byVectors.values())
24404
- if (ids.length > 1)
24403
+ for (const [first, ...rest] of byVectors.values())
24404
+ for (const id2 of rest)
24405
24405
  out.push(
24406
- `${ids.join(" and ")} run operate on the same vectors, so the deck shows one chart twice. Give the second beat's chain to the first (one longer chain), or draw the second another way.`
24406
+ `${id2} runs operate on the same vectors as ${first}, so the deck shows one chart twice. Give its chain to ${first} (one longer chain), or draw ${id2} another way.`
24407
24407
  );
24408
24408
  const forms = /* @__PURE__ */ new Map();
24409
24409
  for (const b of beats) {
24410
24410
  const f = b.literal && wordForm(b.literal);
24411
24411
  if (f) forms.set(f, [...forms.get(f) ?? [], b.id]);
24412
24412
  }
24413
- for (const [f, ids] of forms)
24414
- if (ids.length > 1)
24413
+ for (const [f, [first, ...rest]] of forms)
24414
+ for (const id2 of rest)
24415
24415
  out.push(
24416
- `The plan draws \`${f}\` ${ids.length} times (${ids.join(", ")}). It draws no picture, so a second one is the same slide again: keep it on one beat, and draw the others another way or with \`literal\` null.`
24416
+ `${id2} draws \`${f}\`, as ${first} already does. It draws no picture, so a second one is the same slide again: draw ${id2} another way, or with \`literal\` null.`
24417
24417
  );
24418
24418
  return out;
24419
24419
  }
@@ -25825,13 +25825,39 @@ function operateVariants(v) {
25825
25825
  return [only(OPERATE_CHAIN, OPERATE_TERMS), only(OPERATE_TERMS)];
25826
25826
  }
25827
25827
  function schemaFor(prefs, source) {
25828
- return splitOperate(
25829
- hideFromPlanner(
25830
- forStructuredOutput(z3.toJSONSchema(storyboardSchema, { io: "input" })),
25831
- plannerInvisible(prefs, source)
25828
+ return shareLiteral(
25829
+ splitOperate(
25830
+ hideFromPlanner(
25831
+ forStructuredOutput(z3.toJSONSchema(storyboardSchema, { io: "input" })),
25832
+ plannerInvisible(prefs, source)
25833
+ )
25832
25834
  )
25833
25835
  );
25834
25836
  }
25837
+ function shareLiteral(schema2) {
25838
+ const root2 = schema2;
25839
+ const variants = root2.properties.beats.items.anyOf;
25840
+ const literal = variants[0]?.properties.literal;
25841
+ if (!literal) return schema2;
25842
+ const one2 = JSON.stringify(literal);
25843
+ if (!variants.every((v) => JSON.stringify(v.properties.literal) === one2))
25844
+ throw new Error("schemaFor: the beat variants carry different `literal` schemas.");
25845
+ const ref = { $ref: "#/$defs/literal" };
25846
+ return {
25847
+ ...root2,
25848
+ $defs: { literal },
25849
+ properties: {
25850
+ ...root2.properties,
25851
+ beats: {
25852
+ ...root2.properties.beats,
25853
+ items: {
25854
+ ...root2.properties.beats.items,
25855
+ anyOf: variants.map((v) => ({ ...v, properties: { ...v.properties, literal: ref } }))
25856
+ }
25857
+ }
25858
+ }
25859
+ };
25860
+ }
25835
25861
  var SCHEMA = schemaFor(prefsSchema.parse({}));
25836
25862
  async function codexPlanner(source, opts = {}) {
25837
25863
  const prefs = opts.prefs ?? prefsSchema.parse({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jokerized/decksmith",
3
- "version": "0.9.7",
3
+ "version": "0.9.8",
4
4
  "description": "Turn a source document into an animated explanation deck.",
5
5
  "type": "module",
6
6
  "license": "MIT",