@lotics/cli 0.157.0 → 0.163.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.
package/AGENTS.md CHANGED
@@ -79,13 +79,13 @@ whether something exists, read `lotics --help` § COMMANDS — the whole section
79
79
  `set_app_*` tools. A manifest alias with no server binding only fails at the app's first call, so
80
80
  deploy warns about the mismatch.
81
81
 
82
- **The five `lotics.*` keys look alike and point in three different directions.** Before editing one,
82
+ **The four `lotics.*` keys look alike and point in three different directions.** Before editing one,
83
83
  know which you are touching — this is the single most expensive thing to get wrong in a manifest:
84
84
 
85
85
  | `lotics.<key>` | Owned by | Your edit reaches the app via |
86
86
  |---|---|---|
87
87
  | `queries`, `capabilities` | the manifest | `app deploy` — re-synced on every one (an absent `capabilities` block turns them all OFF) |
88
- | `knowledge`, `config` | the manifest | `opctl app publish` / `app release` — package authoring only |
88
+ | `knowledge` | the manifest | nothing, until the app is published as a starter — it declares which docs ship with it |
89
89
  | `workflows` | the workflow row's verified contract | `app workflow set`, which type-checks the BODY against your declaration and refuses a schema the body cannot satisfy |
90
90
  | `agents` | the app row | **nothing.** It is a mirror: `app codegen` re-silvers it from the app, and an agent is changed with `set_app_agent` |
91
91
 
@@ -52728,14 +52728,14 @@ ${e.toString()}`);
52728
52728
  }
52729
52729
  function readCfbStreams(bytes) {
52730
52730
  const dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
52731
- const u162 = (o) => dv.getUint16(o, true);
52732
- const u32 = (o) => dv.getUint32(o, true);
52733
- const sectorSize = 1 << u162(30);
52734
- const miniSectorSize = 1 << u162(32);
52735
- const firstDirSector = u32(48);
52736
- const miniCutoff = u32(56);
52737
- const firstMiniFatSector = u32(60);
52738
- const firstDifatSector = u32(68);
52731
+ const u163 = (o) => dv.getUint16(o, true);
52732
+ const u322 = (o) => dv.getUint32(o, true);
52733
+ const sectorSize = 1 << u163(30);
52734
+ const miniSectorSize = 1 << u163(32);
52735
+ const firstDirSector = u322(48);
52736
+ const miniCutoff = u322(56);
52737
+ const firstMiniFatSector = u322(60);
52738
+ const firstDifatSector = u322(68);
52739
52739
  if (sectorSize < 512 || sectorSize > 1 << 20) {
52740
52740
  throw new Error("Unsupported OLE2 file: invalid sector size");
52741
52741
  }
@@ -52743,7 +52743,7 @@ ${e.toString()}`);
52743
52743
  const maxSectors = Math.ceil(bytes.length / sectorSize) + 1;
52744
52744
  const difat = [];
52745
52745
  for (let i3 = 0; i3 < 109; i3++) {
52746
- const v = u32(76 + i3 * 4);
52746
+ const v = u322(76 + i3 * 4);
52747
52747
  if (v !== FREESECT) difat.push(v);
52748
52748
  }
52749
52749
  let ds = firstDifatSector;
@@ -52753,10 +52753,10 @@ ${e.toString()}`);
52753
52753
  seenDifat.add(ds);
52754
52754
  const base2 = sectorOffset(ds);
52755
52755
  for (let i3 = 0; i3 < entriesPerSector - 1; i3++) {
52756
- const v = u32(base2 + i3 * 4);
52756
+ const v = u322(base2 + i3 * 4);
52757
52757
  if (v !== FREESECT) difat.push(v);
52758
52758
  }
52759
- ds = u32(base2 + (entriesPerSector - 1) * 4);
52759
+ ds = u322(base2 + (entriesPerSector - 1) * 4);
52760
52760
  }
52761
52761
  const fat = [];
52762
52762
  for (const fatSector of difat) {
@@ -52764,7 +52764,7 @@ ${e.toString()}`);
52764
52764
  if (fatSector >= maxSectors) continue;
52765
52765
  const base2 = sectorOffset(fatSector);
52766
52766
  for (let i3 = 0; i3 < entriesPerSector && fat.length < maxSectors; i3++) {
52767
- fat.push(u32(base2 + i3 * 4));
52767
+ fat.push(u322(base2 + i3 * 4));
52768
52768
  }
52769
52769
  }
52770
52770
  const readChain = (src, start, size, ss, offOf, chain) => {
@@ -66301,6 +66301,221 @@ ${e.toString()}`);
66301
66301
  return val && typeof val === "object" ? val : {};
66302
66302
  }
66303
66303
 
66304
+ // ../xlsx/src/biff8_styles.ts
66305
+ var DEFAULT_PALETTE = [
66306
+ "#000000",
66307
+ "#FFFFFF",
66308
+ "#FF0000",
66309
+ "#00FF00",
66310
+ "#0000FF",
66311
+ "#FFFF00",
66312
+ "#FF00FF",
66313
+ "#00FFFF",
66314
+ "#000000",
66315
+ "#FFFFFF",
66316
+ "#FF0000",
66317
+ "#00FF00",
66318
+ "#0000FF",
66319
+ "#FFFF00",
66320
+ "#FF00FF",
66321
+ "#00FFFF",
66322
+ "#800000",
66323
+ "#008000",
66324
+ "#000080",
66325
+ "#808000",
66326
+ "#800080",
66327
+ "#008080",
66328
+ "#C0C0C0",
66329
+ "#808080",
66330
+ "#9999FF",
66331
+ "#993366",
66332
+ "#FFFFCC",
66333
+ "#CCFFFF",
66334
+ "#660066",
66335
+ "#FF8080",
66336
+ "#0066CC",
66337
+ "#CCCCFF",
66338
+ "#000080",
66339
+ "#FF00FF",
66340
+ "#FFFF00",
66341
+ "#00FFFF",
66342
+ "#800080",
66343
+ "#800000",
66344
+ "#008080",
66345
+ "#0000FF",
66346
+ "#00CCFF",
66347
+ "#CCFFFF",
66348
+ "#CCFFCC",
66349
+ "#FFFF99",
66350
+ "#99CCFF",
66351
+ "#FF99CC",
66352
+ "#CC99FF",
66353
+ "#FFCC99",
66354
+ "#3366FF",
66355
+ "#33CCCC",
66356
+ "#99CC00",
66357
+ "#FFCC00",
66358
+ "#FF9900",
66359
+ "#FF6600",
66360
+ "#666699",
66361
+ "#969696",
66362
+ "#003366",
66363
+ "#339966",
66364
+ "#003300",
66365
+ "#333300",
66366
+ "#993300",
66367
+ "#993366",
66368
+ "#333399",
66369
+ "#333333"
66370
+ ];
66371
+ var AUTOMATIC = /* @__PURE__ */ new Set([64, 65, 32767]);
66372
+ var u162 = (b, o) => b[o] | b[o + 1] << 8;
66373
+ var u32 = (b, o) => (u162(b, o) | u162(b, o + 2) << 16) >>> 0;
66374
+ function parsePalette(body) {
66375
+ const palette = [...DEFAULT_PALETTE];
66376
+ const count = u162(body, 0);
66377
+ for (let i3 = 0; i3 < count && 2 + i3 * 4 + 3 < body.length; i3++) {
66378
+ const o = 2 + i3 * 4;
66379
+ const hex = (n) => n.toString(16).padStart(2, "0").toUpperCase();
66380
+ palette[8 + i3] = `#${hex(body[o])}${hex(body[o + 1])}${hex(body[o + 2])}`;
66381
+ }
66382
+ return palette;
66383
+ }
66384
+ function defaultPalette() {
66385
+ return [...DEFAULT_PALETTE];
66386
+ }
66387
+ function parseFont2(body) {
66388
+ const grbit = u162(body, 2);
66389
+ const uls = body[10];
66390
+ const sss = u162(body, 8);
66391
+ let name2 = "";
66392
+ if (body.length > 15) {
66393
+ const cch = body[14];
66394
+ const high = (body[15] & 1) !== 0;
66395
+ for (let i3 = 0; i3 < cch; i3++) {
66396
+ const o = 16 + (high ? i3 * 2 : i3);
66397
+ if (o >= body.length) break;
66398
+ name2 += String.fromCharCode(high ? body[o] | body[o + 1] << 8 : body[o]);
66399
+ }
66400
+ }
66401
+ return {
66402
+ size: u162(body, 0) / 20,
66403
+ bold: u162(body, 6) >= 600,
66404
+ italic: (grbit & 2) !== 0,
66405
+ strike: (grbit & 8) !== 0,
66406
+ underline: uls === 1 || uls === 33 ? "single" : uls === 2 || uls === 34 ? "double" : void 0,
66407
+ vertAlign: sss === 1 ? "superscript" : sss === 2 ? "subscript" : void 0,
66408
+ colorIndex: u162(body, 4),
66409
+ name: name2
66410
+ };
66411
+ }
66412
+ function parseXf2(body) {
66413
+ const alignByte = body[6] ?? 0;
66414
+ const indentByte = body[8] ?? 0;
66415
+ const b1 = u32(body, 10);
66416
+ const b22 = u32(body, 14);
66417
+ const fill = u162(body, 18);
66418
+ const HORIZ = [
66419
+ void 0,
66420
+ "left",
66421
+ "center",
66422
+ "right",
66423
+ void 0,
66424
+ void 0,
66425
+ "center"
66426
+ ];
66427
+ const VERT = ["top", "middle", "bottom", "middle", "middle"];
66428
+ const rot = body[7] ?? 0;
66429
+ return {
66430
+ fontIndex: u162(body, 0),
66431
+ horizontal: HORIZ[alignByte & 7],
66432
+ vertical: VERT[alignByte >> 4 & 7],
66433
+ wrap: (alignByte & 8) !== 0,
66434
+ shrink: (indentByte & 16) !== 0,
66435
+ indent: indentByte & 15,
66436
+ // 0–90 means degrees; 91–180 means −1…−90; 255 is stacked/vertical text.
66437
+ rotation: rot === 255 ? 255 : rot <= 90 ? rot : -(rot - 90),
66438
+ borders: {
66439
+ left: b1 & 15,
66440
+ right: b1 >> 4 & 15,
66441
+ top: b1 >> 8 & 15,
66442
+ bottom: b1 >> 12 & 15,
66443
+ leftColor: b1 >> 16 & 127,
66444
+ rightColor: b1 >> 23 & 127,
66445
+ topColor: b22 & 127,
66446
+ bottomColor: b22 >> 7 & 127
66447
+ },
66448
+ fillPattern: b22 >>> 26 & 63,
66449
+ fillFore: fill & 127,
66450
+ fillBack: fill >> 7 & 127
66451
+ };
66452
+ }
66453
+ var BORDER_STYLES = [
66454
+ "none",
66455
+ "thin",
66456
+ "medium",
66457
+ "dashed",
66458
+ "dotted",
66459
+ "thick",
66460
+ "double",
66461
+ "hair",
66462
+ "mediumDashed",
66463
+ "dashDot",
66464
+ "mediumDashDot",
66465
+ "dashDotDot",
66466
+ "mediumDashDotDot",
66467
+ "slantDashDot"
66468
+ ];
66469
+ var BORDER_WIDTH = { thick: 3, medium: 2, mediumDashed: 2, mediumDashDot: 2, mediumDashDotDot: 2, double: 3, hair: 1 };
66470
+ function colorOf(index, palette) {
66471
+ if (AUTOMATIC.has(index)) return void 0;
66472
+ return palette[index];
66473
+ }
66474
+ function borderOf(style, colorIndex, palette) {
66475
+ if (style === 0) return void 0;
66476
+ const name2 = BORDER_STYLES[style] ?? "thin";
66477
+ return { width: BORDER_WIDTH[name2] ?? 1, style: name2, color: colorOf(colorIndex, palette) ?? "#000000" };
66478
+ }
66479
+ function toCellStyle(xf, fonts, palette) {
66480
+ const style = {};
66481
+ const font = fonts[xf.fontIndex];
66482
+ if (font) {
66483
+ if (font.bold) style.fontBold = true;
66484
+ if (font.italic) style.fontItalic = true;
66485
+ if (font.strike) style.fontStrike = true;
66486
+ if (font.underline) style.fontUnderline = font.underline;
66487
+ if (font.vertAlign) style.fontVertAlign = font.vertAlign;
66488
+ if (font.size > 0) style.fontSize = font.size;
66489
+ if (font.name) style.fontName = font.name;
66490
+ const color = colorOf(font.colorIndex, palette);
66491
+ if (color) style.fontColor = color;
66492
+ }
66493
+ if (xf.horizontal) style.horizontalAlign = xf.horizontal;
66494
+ if (xf.vertical) style.verticalAlign = xf.vertical;
66495
+ if (xf.wrap) style.wrapText = true;
66496
+ if (xf.shrink) style.shrinkToFit = true;
66497
+ if (xf.indent > 0) style.indent = xf.indent;
66498
+ if (xf.rotation === 255) style.textRotation = "vertical";
66499
+ else if (xf.rotation !== 0) style.textRotation = xf.rotation;
66500
+ const left = borderOf(xf.borders.left, xf.borders.leftColor, palette);
66501
+ const right = borderOf(xf.borders.right, xf.borders.rightColor, palette);
66502
+ const top = borderOf(xf.borders.top, xf.borders.topColor, palette);
66503
+ const bottom = borderOf(xf.borders.bottom, xf.borders.bottomColor, palette);
66504
+ if (left) style.borderLeft = left;
66505
+ if (right) style.borderRight = right;
66506
+ if (top) style.borderTop = top;
66507
+ if (bottom) style.borderBottom = bottom;
66508
+ if (xf.fillPattern === 1) {
66509
+ const bg = colorOf(xf.fillFore, palette);
66510
+ if (bg) style.backgroundColor = bg;
66511
+ } else if (xf.fillPattern > 1) {
66512
+ const bg = colorOf(xf.fillBack, palette);
66513
+ if (bg) style.backgroundColor = bg;
66514
+ style.patternType = "gray125";
66515
+ }
66516
+ return style;
66517
+ }
66518
+
66304
66519
  // ../xlsx/src/biff8_reader.ts
66305
66520
  var DEFAULT_MAX_ROWS = 1e4;
66306
66521
  var REC = {
@@ -66322,7 +66537,12 @@ ${e.toString()}`);
66322
66537
  MULBLANK: 190,
66323
66538
  LABELSST: 253,
66324
66539
  SST: 252,
66325
- BOF: 2057
66540
+ BOF: 2057,
66541
+ DEFCOLWIDTH: 85,
66542
+ COLINFO: 125,
66543
+ FONT: 49,
66544
+ PALETTE: 146,
66545
+ ROW: 520
66326
66546
  };
66327
66547
  function* iterRecords(stream, from2, to) {
66328
66548
  const dv = new DataView(stream.buffer, stream.byteOffset, stream.byteLength);
@@ -66340,6 +66560,9 @@ ${e.toString()}`);
66340
66560
  const sstChunks = [];
66341
66561
  const formats = /* @__PURE__ */ new Map();
66342
66562
  const xfFormatIds = [];
66563
+ const xfRecords = [];
66564
+ const fonts = [];
66565
+ let palette = null;
66343
66566
  const boundsheets = [];
66344
66567
  let date1904 = false;
66345
66568
  let sawSst = false;
@@ -66383,8 +66606,17 @@ ${e.toString()}`);
66383
66606
  }
66384
66607
  case REC.XF: {
66385
66608
  xfFormatIds.push(readU16(r.body, 2));
66609
+ xfRecords.push(r.body.slice());
66610
+ break;
66611
+ }
66612
+ case REC.FONT: {
66613
+ fonts.push(parseFont2(r.body));
66614
+ if (fonts.length === 4) fonts.push(fonts[3]);
66386
66615
  break;
66387
66616
  }
66617
+ case REC.PALETTE:
66618
+ palette = parsePalette(r.body);
66619
+ break;
66388
66620
  case REC.BOUNDSHEET: {
66389
66621
  const pos = dv.getUint32(r.offset + 4, true);
66390
66622
  boundsheets.push({ name: readUnicodeShort(r.body, 6, 1), pos });
@@ -66396,7 +66628,9 @@ ${e.toString()}`);
66396
66628
  }
66397
66629
  const sst = parseSst(sstChunks, sstUnique);
66398
66630
  const xfFormats = xfFormatIds.map((id) => formats.get(id) ?? builtinFormat(id));
66399
- return { sst, date1904, xfFormats, boundsheets };
66631
+ const pal = palette ?? defaultPalette();
66632
+ const xfStyles = xfRecords.map((body) => toCellStyle(parseXf2(body), fonts, pal));
66633
+ return { sst, date1904, xfFormats, xfStyles, boundsheets };
66400
66634
  }
66401
66635
  function parseSst(chunks, count) {
66402
66636
  const out = [];
@@ -66481,26 +66715,55 @@ ${e.toString()}`);
66481
66715
  break;
66482
66716
  }
66483
66717
  }
66718
+ const colDefs = /* @__PURE__ */ new Map();
66719
+ const rowHeights = /* @__PURE__ */ new Map();
66720
+ const hiddenRows = /* @__PURE__ */ new Set();
66484
66721
  for (const r of iterRecords(stream, start, end)) {
66485
66722
  switch (r.type) {
66723
+ case REC.DEFCOLWIDTH: {
66724
+ sheet.defaultColWidth = readU16(r.body, 0);
66725
+ break;
66726
+ }
66727
+ case REC.COLINFO: {
66728
+ const first2 = readU16(r.body, 0), last2 = readU16(r.body, 2);
66729
+ const width = readU16(r.body, 4) / 256;
66730
+ const grbit = readU16(r.body, 8);
66731
+ const hidden = (grbit & 1) !== 0;
66732
+ const outline = grbit >> 8 & 7;
66733
+ for (let c = first2; c <= last2 && c <= 255; c++) {
66734
+ colDefs.set(c, { index: c + 1, width, hidden, customWidth: true });
66735
+ if (outline > 0) sheet.colOutlineLevels.set(c + 1, outline);
66736
+ }
66737
+ break;
66738
+ }
66739
+ case REC.ROW: {
66740
+ const row = readU16(r.body, 0);
66741
+ const grbit = readU16(r.body, 12);
66742
+ const height = (readU16(r.body, 6) & 32767) / 20;
66743
+ if (height > 0) rowHeights.set(row, height);
66744
+ if ((grbit & 32) !== 0) hiddenRows.add(row);
66745
+ const outline = grbit & 7;
66746
+ if (outline > 0) sheet.rowOutlineLevels.set(row + 1, outline);
66747
+ break;
66748
+ }
66486
66749
  case REC.LABELSST: {
66487
- const row = readU16(r.body, 0), col = readU16(r.body, 2), isst = readU32(r.body, 6);
66488
- put(row, col, textCell(col, g.sst[isst] ?? ""));
66750
+ const row = readU16(r.body, 0), col = readU16(r.body, 2), xf = readU16(r.body, 4), isst = readU32(r.body, 6);
66751
+ put(row, col, textCell(col, g.sst[isst] ?? "", g.xfStyles[xf]));
66489
66752
  break;
66490
66753
  }
66491
66754
  case REC.LABEL: {
66492
- const row = readU16(r.body, 0), col = readU16(r.body, 2);
66493
- put(row, col, textCell(col, readUnicodeShort(r.body, 6, 2)));
66755
+ const row = readU16(r.body, 0), col = readU16(r.body, 2), xf = readU16(r.body, 4);
66756
+ put(row, col, textCell(col, readUnicodeShort(r.body, 6, 2), g.xfStyles[xf]));
66494
66757
  break;
66495
66758
  }
66496
66759
  case REC.NUMBER: {
66497
66760
  const row = readU16(r.body, 0), col = readU16(r.body, 2), xf = readU16(r.body, 4);
66498
- put(row, col, numberCell(col, readF64(r.body, 6), g.xfFormats[xf]));
66761
+ put(row, col, numberCell(col, readF64(r.body, 6), g.xfFormats[xf], g.xfStyles[xf]));
66499
66762
  break;
66500
66763
  }
66501
66764
  case REC.RK: {
66502
66765
  const row = readU16(r.body, 0), col = readU16(r.body, 2), xf = readU16(r.body, 4);
66503
- put(row, col, numberCell(col, decodeRk(readU32(r.body, 6)), g.xfFormats[xf]));
66766
+ put(row, col, numberCell(col, decodeRk(readU32(r.body, 6)), g.xfFormats[xf], g.xfStyles[xf]));
66504
66767
  break;
66505
66768
  }
66506
66769
  case REC.MULRK: {
@@ -66509,13 +66772,13 @@ ${e.toString()}`);
66509
66772
  for (let i3 = 0; i3 < n; i3++) {
66510
66773
  const xf = readU16(r.body, 4 + i3 * 6);
66511
66774
  const rk = readU32(r.body, 6 + i3 * 6);
66512
- put(row, first2 + i3, numberCell(first2 + i3, decodeRk(rk), g.xfFormats[xf]));
66775
+ put(row, first2 + i3, numberCell(first2 + i3, decodeRk(rk), g.xfFormats[xf], g.xfStyles[xf]));
66513
66776
  }
66514
66777
  break;
66515
66778
  }
66516
66779
  case REC.FORMULA: {
66517
66780
  const row = readU16(r.body, 0), col = readU16(r.body, 2), xf = readU16(r.body, 4);
66518
- const cell = formulaCell(col, r.body, g.xfFormats[xf]);
66781
+ const cell = formulaCell(col, r.body, g.xfFormats[xf], g.xfStyles[xf]);
66519
66782
  if (cell) put(row, col, cell);
66520
66783
  break;
66521
66784
  }
@@ -66529,17 +66792,23 @@ ${e.toString()}`);
66529
66792
  const r = grid.get(ri);
66530
66793
  if (!r) continue;
66531
66794
  const cells = [...r.values()].sort((a, b) => a.column - b.column);
66532
- rows.push({ index: ri + 1, height: sheet.defaultRowHeight, cells, hidden: false });
66795
+ rows.push({
66796
+ index: ri + 1,
66797
+ height: rowHeights.get(ri) ?? sheet.defaultRowHeight,
66798
+ cells,
66799
+ hidden: hiddenRows.has(ri)
66800
+ });
66533
66801
  }
66534
66802
  sheet.rows = rows;
66803
+ sheet.columns = [...colDefs.values()].sort((a, b) => a.index - b.index);
66535
66804
  sheet.totalRowCount = maxRow + 1;
66536
66805
  sheet.truncated = truncated;
66537
66806
  return sheet;
66538
66807
  }
66539
- function textCell(column, text) {
66540
- return { column: column + 1, value: text, typedValue: text, content: { type: "plain", text }, style: {} };
66808
+ function textCell(column, text, style = {}) {
66809
+ return { column: column + 1, value: text, typedValue: text, content: { type: "plain", text }, style };
66541
66810
  }
66542
- function numberCell(column, num3, numFmt) {
66811
+ function numberCell(column, num3, numFmt, style = {}) {
66543
66812
  const value2 = Number.isFinite(num3) ? String(num3) : "";
66544
66813
  return {
66545
66814
  column: column + 1,
@@ -66548,19 +66817,19 @@ ${e.toString()}`);
66548
66817
  typedValue: num3,
66549
66818
  numFmtCode: numFmt && numFmt !== "General" ? numFmt : void 0,
66550
66819
  content: { type: "plain", text: value2 },
66551
- style: {}
66820
+ style
66552
66821
  };
66553
66822
  }
66554
- function formulaCell(column, body, numFmt) {
66823
+ function formulaCell(column, body, numFmt, style = {}) {
66555
66824
  if (readU16(body, 12) === 65535) {
66556
66825
  const kind = body[6];
66557
66826
  if (kind === 1) {
66558
66827
  const b = body[8] !== 0;
66559
- return { column: column + 1, value: b ? "TRUE" : "FALSE", typedValue: b, content: { type: "plain", text: b ? "TRUE" : "FALSE" }, style: {} };
66828
+ return { column: column + 1, value: b ? "TRUE" : "FALSE", typedValue: b, content: { type: "plain", text: b ? "TRUE" : "FALSE" }, style };
66560
66829
  }
66561
66830
  return null;
66562
66831
  }
66563
- return numberCell(column, readF64(body, 6), numFmt);
66832
+ return numberCell(column, readF64(body, 6), numFmt, style);
66564
66833
  }
66565
66834
  function decodeRk(rk) {
66566
66835
  const div100 = (rk & 1) !== 0;