@taloswork/ose-shared 0.1.12 → 0.1.14

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 (71) hide show
  1. package/package.json +3 -3
  2. package/skills/document/SKILL.md +33 -45
  3. package/skills/document/bin/deck-build.cjs +10482 -272
  4. package/skills/document/bin/deck-chart.cjs +21 -12
  5. package/skills/document/bin/deck-plan.cjs +11654 -42
  6. package/skills/document/bin/deck-qa.cjs +107 -23
  7. package/skills/document/bin/deck-scenario.cjs +20 -3
  8. package/skills/document/bin/deck-styles.cjs +1604 -0
  9. package/skills/document/bin/doc-convert.cjs +200 -260
  10. package/skills/document/bin/doc-fill.cjs +140 -19
  11. package/skills/document/bin/doc-gen.cjs +1909 -282
  12. package/skills/document/bin/doc-scan.cjs +6 -1
  13. package/skills/document/bin/doc-text.cjs +6 -1
  14. package/skills/document/bin/doc-validate.cjs +139 -54
  15. package/skills/document/bin/docx-defaults.cjs +9907 -0
  16. package/skills/document/bin/html2pptx.cjs +35960 -31973
  17. package/skills/document/bin/pdf-form.cjs +14 -1
  18. package/skills/document/bin/pdf-images.cjs +6 -1
  19. package/skills/document/bin/pdf-ops.cjs +14 -1
  20. package/skills/document/bin/pdf-render.cjs +6 -1
  21. package/skills/document/bin/pdf-tables.cjs +6 -1
  22. package/skills/document/bin/pptx-notes.cjs +10038 -0
  23. package/skills/document/bin/pptx-tokenize.cjs +19 -4
  24. package/skills/document/bin/template-skin.cjs +10915 -0
  25. package/skills/document/bin-reference.md +15 -10
  26. package/skills/document/catalog.json +33 -32
  27. package/skills/document/content-pipeline.md +79 -44
  28. package/skills/document/deck-design.md +55 -32
  29. package/skills/document/generated-visuals.md +99 -0
  30. package/skills/document/layouts/MAINTAINERS.md +33 -0
  31. package/skills/document/layouts/README.md +20 -20
  32. package/skills/document/layouts/big-stat.tpl +1 -1
  33. package/skills/document/layouts/capacity.json +1 -1
  34. package/skills/document/layouts/cards-3.tpl +1 -1
  35. package/skills/document/layouts/chart-full.tpl +1 -1
  36. package/skills/document/layouts/chart-kpi.tpl +1 -1
  37. package/skills/document/layouts/comparison.tpl +1 -1
  38. package/skills/document/layouts/data-table.tpl +1 -1
  39. package/skills/document/layouts/funnel.tpl +1 -1
  40. package/skills/document/layouts/gantt.tpl +1 -1
  41. package/skills/document/layouts/hub-flow.tpl +4 -0
  42. package/skills/document/layouts/icon-row.tpl +1 -1
  43. package/skills/document/layouts/image-grid.tpl +1 -1
  44. package/skills/document/layouts/matrix-2x2.tpl +1 -1
  45. package/skills/document/layouts/mock-qa.tpl +4 -0
  46. package/skills/document/layouts/profiles.json +2 -2
  47. package/skills/document/layouts/pyramid.tpl +1 -1
  48. package/skills/document/layouts/radar.tpl +1 -1
  49. package/skills/document/layouts/ring-progress.tpl +1 -1
  50. package/skills/document/layouts/slots.json +1 -1
  51. package/skills/document/layouts/steps-vertical.tpl +1 -1
  52. package/skills/document/layouts/steps.tpl +1 -1
  53. package/skills/document/layouts/three-kpi.tpl +1 -1
  54. package/skills/document/layouts/timeline.tpl +1 -1
  55. package/skills/document/layouts/toc-panel.tpl +1 -1
  56. package/skills/document/layouts/two-kpi.tpl +2 -2
  57. package/skills/document/layouts/versus.tpl +1 -1
  58. package/skills/document/packs/README.md +1 -1
  59. package/skills/document/pdf.md +13 -0
  60. package/skills/document/rewrite.md +23 -8
  61. package/skills/document/scenarios.json +19 -2
  62. package/skills/document/scenarios.schema.json +1 -0
  63. package/skills/document/styles/_backdrops/rimlight.html +3 -2
  64. package/skills/document/styles/_contract-defaults.css +6 -1
  65. package/skills/document/styles/_samples/_groups/biz-premium.webp +0 -0
  66. package/skills/document/styles/_samples/mckinsey.webp +0 -0
  67. package/skills/document/styles/mckinsey/backdrop.html +7 -5
  68. package/skills/grill-me/SKILL.md +6 -0
  69. package/skills/grill-me/agents/openai.yaml +5 -0
  70. package/skills/grilling/SKILL.md +28 -0
  71. package/skills/grilling/agents/openai.yaml +3 -0
@@ -9790,9 +9790,9 @@ var require_load = __commonJS({
9790
9790
  var require_lib3 = __commonJS({
9791
9791
  "node_modules/jszip/lib/index.js"(exports2, module2) {
9792
9792
  "use strict";
9793
- function JSZip5() {
9794
- if (!(this instanceof JSZip5)) {
9795
- return new JSZip5();
9793
+ function JSZip7() {
9794
+ if (!(this instanceof JSZip7)) {
9795
+ return new JSZip7();
9796
9796
  }
9797
9797
  if (arguments.length) {
9798
9798
  throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");
@@ -9801,7 +9801,7 @@ var require_lib3 = __commonJS({
9801
9801
  this.comment = null;
9802
9802
  this.root = "";
9803
9803
  this.clone = function() {
9804
- var newObj = new JSZip5();
9804
+ var newObj = new JSZip7();
9805
9805
  for (var i in this) {
9806
9806
  if (typeof this[i] !== "function") {
9807
9807
  newObj[i] = this[i];
@@ -9810,16 +9810,16 @@ var require_lib3 = __commonJS({
9810
9810
  return newObj;
9811
9811
  };
9812
9812
  }
9813
- JSZip5.prototype = require_object();
9814
- JSZip5.prototype.loadAsync = require_load();
9815
- JSZip5.support = require_support();
9816
- JSZip5.defaults = require_defaults();
9817
- JSZip5.version = "3.10.1";
9818
- JSZip5.loadAsync = function(content, options) {
9819
- return new JSZip5().loadAsync(content, options);
9813
+ JSZip7.prototype = require_object();
9814
+ JSZip7.prototype.loadAsync = require_load();
9815
+ JSZip7.support = require_support();
9816
+ JSZip7.defaults = require_defaults();
9817
+ JSZip7.version = "3.10.1";
9818
+ JSZip7.loadAsync = function(content, options) {
9819
+ return new JSZip7().loadAsync(content, options);
9820
9820
  };
9821
- JSZip5.external = require_external();
9822
- module2.exports = JSZip5;
9821
+ JSZip7.external = require_external();
9822
+ module2.exports = JSZip7;
9823
9823
  }
9824
9824
  });
9825
9825
 
@@ -9850,6 +9850,7 @@ __export(pdf_extract_exports, {
9850
9850
  extractPdfText: () => extractPdfText,
9851
9851
  extractPdfTextLines: () => extractPdfTextLines,
9852
9852
  pdfNeedsPassword: () => pdfNeedsPassword,
9853
+ pngPixels: () => pngPixels,
9853
9854
  renderPdfPages: () => renderPdfPages,
9854
9855
  scanPdfSignals: () => scanPdfSignals,
9855
9856
  textMathHint: () => textMathHint,
@@ -9859,7 +9860,12 @@ function loadMupdf() {
9859
9860
  if (!_mupdf) {
9860
9861
  const deps = process.env.TALOS_SKILL_DEPS;
9861
9862
  const spec = deps ? (0, import_node_url.pathToFileURL)((0, import_node_path.join)(deps, "mupdf", "dist", "mupdf.js")).href : "mupdf";
9862
- _mupdf = import(spec);
9863
+ const loading = import(spec);
9864
+ _mupdf = loading;
9865
+ loading.catch(() => {
9866
+ if (_mupdf === loading)
9867
+ _mupdf = null;
9868
+ });
9863
9869
  }
9864
9870
  return _mupdf;
9865
9871
  }
@@ -10143,6 +10149,13 @@ async function renderPdfPages(bytes, pages, scale = 2, maxEdge) {
10143
10149
  }
10144
10150
  return out;
10145
10151
  }
10152
+ async function pngPixels(png) {
10153
+ const mupdf = await loadMupdf();
10154
+ const pix = new mupdf.Image(png).toPixmap();
10155
+ const width = pix.getWidth(), height = pix.getHeight();
10156
+ const channels = pix.getStride() / width;
10157
+ return { width, height, channels, data: pix.getPixels() };
10158
+ }
10146
10159
  async function extractPdfImages(bytes, pages) {
10147
10160
  const { doc } = await openDoc(bytes);
10148
10161
  const total = doc.countPages();
@@ -28124,6 +28137,14 @@ function decodePng(bytes) {
28124
28137
  }
28125
28138
  }
28126
28139
 
28140
+ // packages/core/dist/document/readable-type.js
28141
+ var MIN_FONT_PT = 10;
28142
+ var LABEL_MAX_CHARS = 24;
28143
+ var MIN_LABEL_FONT_PT = 8;
28144
+ function readableFloorPt(text) {
28145
+ return [...text.trim()].length <= LABEL_MAX_CHARS ? MIN_LABEL_FONT_PT : MIN_FONT_PT;
28146
+ }
28147
+
28127
28148
  // packages/core/dist/document/text-slack.js
28128
28149
  var SLACK_CJK_RE = /[\u3000-\u303F\u3400-\u9FFF\uF900-\uFAFF\uFF00-\uFFEF]/;
28129
28150
  var PCT = { single: { cjk: 0.22, latin: 0.16 }, multi: { cjk: 0.1, latin: 0.06 } };
@@ -28319,9 +28340,7 @@ function lintSlideXml(slideXml, slideNumber, masterBg, expectedLang = detectDeck
28319
28340
  var EMU_PER_INCH = 914400;
28320
28341
  var DEFAULT_CANVAS = { w: 12192e3, h: 6858e3 };
28321
28342
  var OFFCANVAS_TOL = EMU_PER_INCH / 10;
28322
- var MIN_FONT_HUNDREDTHS = 1e3;
28323
- var LABEL_MAX_CHARS = 24;
28324
- var MIN_LABEL_FONT_HUNDREDTHS = 800;
28343
+ var MIN_FONT_HUNDREDTHS = MIN_FONT_PT * 100;
28325
28344
  var CHART_TEXT_RE = new RegExp(`<p:cNvPr\\b[^>]*\\bname="${CHART_TEXT_NAME}\\b`);
28326
28345
  var OVERLAP_RATIO = 0.3;
28327
28346
  function firstBox(block) {
@@ -28423,7 +28442,7 @@ function lintSlideGeometry(slideXml, slideNumber, canvas = DEFAULT_CANVAS) {
28423
28442
  continue;
28424
28443
  const text = unescXml(raw).trim();
28425
28444
  const sz = /<a:rPr\b[^>]*\bsz="(\d+)"/.exec(run)?.[1];
28426
- const floor = [...text].length <= LABEL_MAX_CHARS ? MIN_LABEL_FONT_HUNDREDTHS : MIN_FONT_HUNDREDTHS;
28445
+ const floor = readableFloorPt(text) * 100;
28427
28446
  if (sz && +sz < floor && (!smallest || +sz < smallest.sz)) {
28428
28447
  smallest = { sz: +sz, text, floor };
28429
28448
  }
@@ -28859,8 +28878,43 @@ init_pdf_extract();
28859
28878
  var import_node_path3 = require("node:path");
28860
28879
 
28861
28880
  // packages/core/dist/document/doc-validate.js
28862
- var import_jszip3 = __toESM(require_lib3(), 1);
28881
+ var import_jszip5 = __toESM(require_lib3(), 1);
28863
28882
  var import_pdf_lib2 = __toESM(require_cjs(), 1);
28883
+
28884
+ // packages/core/dist/document/pptx-notes.js
28885
+ var import_jszip3 = __toESM(require_lib3(), 1);
28886
+ var REL_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
28887
+ var NOTES_SLIDE_REL = `${REL_NS}/notesSlide`;
28888
+ var NOTES_MASTER_REL = `${REL_NS}/notesMaster`;
28889
+ var SLIDE_REL = `${REL_NS}/slide`;
28890
+ async function notesKeynoteIssues(zip) {
28891
+ const out = [];
28892
+ for (const p of Object.keys(zip.files).filter((p2) => /^ppt\/notesSlides\/notesSlide\d+\.xml$/.test(p2)).sort()) {
28893
+ const xml = await zip.file(p).async("string");
28894
+ if (!/<p:clrMapOvr\b/.test(xml))
28895
+ out.push(p);
28896
+ }
28897
+ return out;
28898
+ }
28899
+ async function unlistedNotesMaster(zip) {
28900
+ const relsFile = zip.file("ppt/_rels/presentation.xml.rels");
28901
+ const presFile = zip.file("ppt/presentation.xml");
28902
+ if (!relsFile || !presFile)
28903
+ return null;
28904
+ const rel = new RegExp(`<Relationship\\b[^>]*Type="${NOTES_MASTER_REL}"[^>]*>`).exec(await relsFile.async("string"))?.[0];
28905
+ const rid = rel ? /\bId="([^"]+)"/.exec(rel)?.[1] : void 0;
28906
+ if (!rid)
28907
+ return null;
28908
+ return /<p:notesMasterId\b/.test(await presFile.async("string")) ? null : rid;
28909
+ }
28910
+
28911
+ // packages/core/dist/document/docx-defaults.js
28912
+ var import_jszip4 = __toESM(require_lib3(), 1);
28913
+ function hasDefaultParagraphStyle(stylesXml) {
28914
+ return [...stylesXml.matchAll(/<w:style\b[^>]*>/g)].some(([tag]) => /\bw:type="paragraph"/.test(tag) && /\bw:default="(1|true|on)"/.test(tag));
28915
+ }
28916
+
28917
+ // packages/core/dist/document/doc-validate.js
28864
28918
  function looksLikePdf(bytes) {
28865
28919
  const head = Buffer.from(bytes.subarray(0, 1024)).toString("latin1");
28866
28920
  return head.includes("%PDF-");
@@ -29040,7 +29094,7 @@ async function validateOoxml(bytes) {
29040
29094
  const result = (kind) => ({ ok: errors.length === 0, kind, errors, warnings });
29041
29095
  let zip;
29042
29096
  try {
29043
- zip = await import_jszip3.default.loadAsync(Buffer.from(bytes));
29097
+ zip = await import_jszip5.default.loadAsync(Buffer.from(bytes));
29044
29098
  } catch (e) {
29045
29099
  errors.push({ code: "zip-unreadable", message: `not a readable OOXML zip: ${e.message}` });
29046
29100
  return result("unknown");
@@ -29108,6 +29162,30 @@ async function validateOoxml(bytes) {
29108
29162
  }
29109
29163
  }
29110
29164
  }
29165
+ if (root.kind === "pptx") {
29166
+ const bad = await notesKeynoteIssues(zip);
29167
+ if (bad.length) {
29168
+ errors.push({
29169
+ code: "notes-keynote",
29170
+ part: bad[0],
29171
+ message: `${bad.length} notes slide(s) lack <p:clrMapOvr> (${bad.slice(0, 3).join(", ")}${bad.length > 3 ? ", \u2026" : ""}) \u2014 Keynote refuses the whole file ("\u6587\u4EF6\u683C\u5F0F\u65E0\u6548"). Repair with \`pptx-notes <in.pptx> {} <out.pptx>\`; write notes with pptx-notes, never by hand`
29172
+ });
29173
+ }
29174
+ }
29175
+ if (root.kind === "pptx" && await unlistedNotesMaster(zip)) {
29176
+ errors.push({
29177
+ code: "notes-keynote",
29178
+ part: "ppt/presentation.xml",
29179
+ message: 'the notes master is not listed in <p:notesMasterIdLst> (python-pptx leaves it out) \u2014 Keynote refuses the whole file ("\u6587\u4EF6\u683C\u5F0F\u65E0\u6548"). Repair with `pptx-notes <in.pptx> {} <out.pptx>`'
29180
+ });
29181
+ }
29182
+ if (root.kind === "docx" && has("word/styles.xml") && !hasDefaultParagraphStyle(await text("word/styles.xml"))) {
29183
+ errors.push({
29184
+ code: "docx-default-style",
29185
+ part: "word/styles.xml",
29186
+ message: 'no default paragraph style (w:default="1", usually "Normal") \u2014 Word fills the gap, but Pages lays every unstyled paragraph out like the one before it (a centred title turns the whole body huge and centred). Repair with `docx-defaults <in.docx> <out.docx>`; docx from doc-gen already has it'
29187
+ });
29188
+ }
29111
29189
  return result(root.kind);
29112
29190
  }
29113
29191
 
@@ -29115,13 +29193,18 @@ async function validateOoxml(bytes) {
29115
29193
  var import_node_path2 = require("node:path");
29116
29194
  var import_node_url2 = require("node:url");
29117
29195
  var import_promises = require("node:fs/promises");
29118
- var import_jszip4 = __toESM(require_lib3(), 1);
29196
+ var import_jszip6 = __toESM(require_lib3(), 1);
29119
29197
  var _xmllint = null;
29120
29198
  function loadXmllint() {
29121
29199
  if (!_xmllint) {
29122
29200
  const deps = process.env.TALOS_SKILL_DEPS;
29123
29201
  const spec = deps ? (0, import_node_url2.pathToFileURL)((0, import_node_path2.join)(deps, "xmllint-wasm", "index-node.js")).href : "xmllint-wasm";
29124
- _xmllint = import(spec);
29202
+ const loading = import(spec);
29203
+ _xmllint = loading;
29204
+ loading.catch(() => {
29205
+ if (_xmllint === loading)
29206
+ _xmllint = null;
29207
+ });
29125
29208
  }
29126
29209
  return _xmllint;
29127
29210
  }
@@ -29171,7 +29254,7 @@ function errText(e) {
29171
29254
  }
29172
29255
  async function validateOoxmlStrict(bytes, schemaDir) {
29173
29256
  const [{ validateXML }, schemas] = await Promise.all([loadXmllint(), loadSchemaSet(schemaDir)]);
29174
- const zip = await import_jszip4.default.loadAsync(Buffer.from(bytes));
29257
+ const zip = await import_jszip6.default.loadAsync(Buffer.from(bytes));
29175
29258
  const checked = [];
29176
29259
  const skipped = [];
29177
29260
  const errors = [];
@@ -29319,6 +29402,7 @@ async function main() {
29319
29402
  const requireOffice = args.includes("--require-office");
29320
29403
  const usage = "usage: deck-qa <file.pptx> [--json] [--rendered <office.pdf> | --final [--cache-dir <dir>] [--require-office]]";
29321
29404
  if (!file) die(usage, 64);
29405
+ if (/\.html?$/i.test(file)) die("deck-qa checks the exported .pptx, not the HTML. While authoring: `html2pptx deck.html --preview-dir <dir> --style <id>` (previews to look at); the lint runs on every export \u2014 `html2pptx deck.html out.pptx --style <id>` prints it as `qa`. Sign off once with `deck-qa out.pptx --final`.", 64);
29322
29406
  if (!/\.pptx$/i.test(file)) die("deck-qa only lints .pptx decks", 64);
29323
29407
  if (rendered && !/\.pdf$/i.test(rendered)) die("--rendered takes the .pdf doc-convert wrote for this deck", 64);
29324
29408
  if (final && rendered) die("--final renders the deck itself; drop --rendered", 64);
@@ -13,8 +13,8 @@ var SCENARIO_MATRIX = {
13
13
  "\u6545\u4E8B\u9A71\u52A8"
14
14
  ],
15
15
  "density": [
16
- "\u7A00\u758F",
17
- "\u5927\u6570\u5B57"
16
+ "\u4E2D",
17
+ "\u5927\u6570\u5B57+\u4E00\u53E5\u89E3\u91CA"
18
18
  ],
19
19
  "requiredSections": [
20
20
  {
@@ -490,6 +490,11 @@ var SCENARIO_MATRIX = {
490
490
  {
491
491
  "id": "\u5DE5\u4F5C\u6C47\u62A5",
492
492
  "subtitle": "\u5468\u6708\u5B63\u62A5",
493
+ "aliases": [
494
+ "\u5468\u62A5",
495
+ "\u6708\u62A5",
496
+ "\u5B63\u62A5"
497
+ ],
493
498
  "tone": [
494
499
  "\u5BA2\u89C2",
495
500
  "\u7B80\u6D01",
@@ -612,6 +617,9 @@ var SCENARIO_MATRIX = {
612
617
  },
613
618
  {
614
619
  "id": "\u9879\u76EE\u7ACB\u9879/\u8BC4\u5BA1",
620
+ "aliases": [
621
+ "\u7ACB\u9879"
622
+ ],
615
623
  "tone": [
616
624
  "\u4E25\u8C28",
617
625
  "\u8BF4\u670D"
@@ -681,6 +689,9 @@ var SCENARIO_MATRIX = {
681
689
  },
682
690
  {
683
691
  "id": "\u5E74\u5EA6\u603B\u7ED3/\u5E74\u4F1A",
692
+ "aliases": [
693
+ "\u5E74\u7EC8\u603B\u7ED3"
694
+ ],
684
695
  "tone": [
685
696
  "\u632F\u594B",
686
697
  "\u4EEA\u5F0F\u611F"
@@ -884,6 +895,9 @@ var SCENARIO_MATRIX = {
884
895
  },
885
896
  {
886
897
  "id": "\u653F\u52A1/\u515A\u653F\u6C47\u62A5",
898
+ "aliases": [
899
+ "\u653F\u52A1\u6C47\u62A5"
900
+ ],
887
901
  "tone": [
888
902
  "\u4E25\u8083",
889
903
  "\u89C4\u8303"
@@ -944,6 +958,9 @@ var SCENARIO_MATRIX = {
944
958
  },
945
959
  {
946
960
  "id": "\u516C\u53F8/\u4EA7\u54C1\u4ECB\u7ECD",
961
+ "aliases": [
962
+ "\u516C\u53F8\u4ECB\u7ECD"
963
+ ],
947
964
  "tone": [
948
965
  "\u54C1\u724C",
949
966
  "\u81EA\u4FE1",
@@ -1305,7 +1322,7 @@ function findScenario(m, text2) {
1305
1322
  return exact;
1306
1323
  let best;
1307
1324
  for (const row2 of m.scenarios) {
1308
- const aliases = [...row2.id.split("/"), ...(row2.subtitle ?? "").split(/[\s/]+/)];
1325
+ const aliases = [...row2.id.split("/"), ...(row2.subtitle ?? "").split(/[\s/]+/), ...row2.aliases ?? []];
1309
1326
  for (const alias of aliases) {
1310
1327
  const a = alias.trim().toLowerCase();
1311
1328
  if (a.length < 2 || !hay.includes(a))