logisheets-logician 1.16.0 → 1.16.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 (2) hide show
  1. package/dist/index.node.js +88 -168
  2. package/package.json +3 -3
@@ -78,7 +78,7 @@ function createCoreCraftInteractions() {
78
78
  };
79
79
  }
80
80
 
81
- // ../web/dist/src/bindings/bind_form_schema.js
81
+ // ../web/dist/pure.node.js
82
82
  var BindFormSchemaBuilder = class {
83
83
  _refName;
84
84
  _sheetIdx;
@@ -126,25 +126,16 @@ var BindFormSchemaBuilder = class {
126
126
  return this;
127
127
  }
128
128
  build() {
129
- if (this._refName === void 0)
130
- throw new Error("missing refName");
131
- if (this._sheetIdx === void 0)
132
- throw new Error("missing sheetIdx");
133
- if (this._blockId === void 0)
134
- throw new Error("missing blockId");
135
- if (this._fieldFrom === void 0)
136
- throw new Error("missing fieldFrom");
137
- if (this._keyIdx === void 0)
138
- throw new Error("missing keyIdx");
139
- if (this._fields === void 0)
140
- throw new Error("missing fields");
141
- if (this._row === void 0)
142
- throw new Error("missing row");
129
+ if (this._refName === void 0) throw new Error("missing refName");
130
+ if (this._sheetIdx === void 0) throw new Error("missing sheetIdx");
131
+ if (this._blockId === void 0) throw new Error("missing blockId");
132
+ if (this._fieldFrom === void 0) throw new Error("missing fieldFrom");
133
+ if (this._keyIdx === void 0) throw new Error("missing keyIdx");
134
+ if (this._fields === void 0) throw new Error("missing fields");
135
+ if (this._row === void 0) throw new Error("missing row");
143
136
  return { refName: this._refName, sheetIdx: this._sheetIdx, blockId: this._blockId, fieldFrom: this._fieldFrom, keyIdx: this._keyIdx, fields: this._fields, row: this._row, headerIdx: this._headerIdx, uniqueTogether: this._uniqueTogether };
144
137
  }
145
138
  };
146
-
147
- // ../web/dist/src/bindings/block_input.js
148
139
  var BlockInputBuilder = class {
149
140
  _sheetIdx;
150
141
  _blockId;
@@ -172,21 +163,14 @@ var BlockInputBuilder = class {
172
163
  return this;
173
164
  }
174
165
  build() {
175
- if (this._sheetIdx === void 0)
176
- throw new Error("missing sheetIdx");
177
- if (this._blockId === void 0)
178
- throw new Error("missing blockId");
179
- if (this._row === void 0)
180
- throw new Error("missing row");
181
- if (this._col === void 0)
182
- throw new Error("missing col");
183
- if (this._input === void 0)
184
- throw new Error("missing input");
166
+ if (this._sheetIdx === void 0) throw new Error("missing sheetIdx");
167
+ if (this._blockId === void 0) throw new Error("missing blockId");
168
+ if (this._row === void 0) throw new Error("missing row");
169
+ if (this._col === void 0) throw new Error("missing col");
170
+ if (this._input === void 0) throw new Error("missing input");
185
171
  return { sheetIdx: this._sheetIdx, blockId: this._blockId, row: this._row, col: this._col, input: this._input };
186
172
  }
187
173
  };
188
-
189
- // ../web/dist/src/bindings/convert_block.js
190
174
  var ConvertBlockBuilder = class {
191
175
  _sheetIdx;
192
176
  _id;
@@ -219,23 +203,15 @@ var ConvertBlockBuilder = class {
219
203
  return this;
220
204
  }
221
205
  build() {
222
- if (this._sheetIdx === void 0)
223
- throw new Error("missing sheetIdx");
224
- if (this._id === void 0)
225
- throw new Error("missing id");
226
- if (this._masterRow === void 0)
227
- throw new Error("missing masterRow");
228
- if (this._masterCol === void 0)
229
- throw new Error("missing masterCol");
230
- if (this._rowCnt === void 0)
231
- throw new Error("missing rowCnt");
232
- if (this._colCnt === void 0)
233
- throw new Error("missing colCnt");
206
+ if (this._sheetIdx === void 0) throw new Error("missing sheetIdx");
207
+ if (this._id === void 0) throw new Error("missing id");
208
+ if (this._masterRow === void 0) throw new Error("missing masterRow");
209
+ if (this._masterCol === void 0) throw new Error("missing masterCol");
210
+ if (this._rowCnt === void 0) throw new Error("missing rowCnt");
211
+ if (this._colCnt === void 0) throw new Error("missing colCnt");
234
212
  return { sheetIdx: this._sheetIdx, id: this._id, masterRow: this._masterRow, masterCol: this._masterCol, rowCnt: this._rowCnt, colCnt: this._colCnt };
235
213
  }
236
214
  };
237
-
238
- // ../web/dist/src/bindings/create_block.js
239
215
  var CreateBlockBuilder = class {
240
216
  _sheetIdx;
241
217
  _id;
@@ -298,23 +274,15 @@ var CreateBlockBuilder = class {
298
274
  return this;
299
275
  }
300
276
  build() {
301
- if (this._sheetIdx === void 0)
302
- throw new Error("missing sheetIdx");
303
- if (this._id === void 0)
304
- throw new Error("missing id");
305
- if (this._masterRow === void 0)
306
- throw new Error("missing masterRow");
307
- if (this._masterCol === void 0)
308
- throw new Error("missing masterCol");
309
- if (this._rowCnt === void 0)
310
- throw new Error("missing rowCnt");
311
- if (this._colCnt === void 0)
312
- throw new Error("missing colCnt");
277
+ if (this._sheetIdx === void 0) throw new Error("missing sheetIdx");
278
+ if (this._id === void 0) throw new Error("missing id");
279
+ if (this._masterRow === void 0) throw new Error("missing masterRow");
280
+ if (this._masterCol === void 0) throw new Error("missing masterCol");
281
+ if (this._rowCnt === void 0) throw new Error("missing rowCnt");
282
+ if (this._colCnt === void 0) throw new Error("missing colCnt");
313
283
  return { sheetIdx: this._sheetIdx, id: this._id, masterRow: this._masterRow, masterCol: this._masterCol, rowCnt: this._rowCnt, colCnt: this._colCnt, owner: this._owner, modifyPolicy: this._modifyPolicy, permissions: this._permissions, description: this._description, analyzes: this._analyzes, pivot: this._pivot };
314
284
  }
315
285
  };
316
-
317
- // ../web/dist/src/bindings/create_sheet.js
318
286
  var CreateSheetBuilder = class {
319
287
  _idx;
320
288
  _newName;
@@ -327,15 +295,11 @@ var CreateSheetBuilder = class {
327
295
  return this;
328
296
  }
329
297
  build() {
330
- if (this._idx === void 0)
331
- throw new Error("missing idx");
332
- if (this._newName === void 0)
333
- throw new Error("missing newName");
298
+ if (this._idx === void 0) throw new Error("missing idx");
299
+ if (this._newName === void 0) throw new Error("missing newName");
334
300
  return { idx: this._idx, newName: this._newName };
335
301
  }
336
302
  };
337
-
338
- // ../web/dist/src/bindings/delete_rows.js
339
303
  var DeleteRowsBuilder = class {
340
304
  _sheetIdx;
341
305
  _start;
@@ -353,17 +317,12 @@ var DeleteRowsBuilder = class {
353
317
  return this;
354
318
  }
355
319
  build() {
356
- if (this._sheetIdx === void 0)
357
- throw new Error("missing sheetIdx");
358
- if (this._start === void 0)
359
- throw new Error("missing start");
360
- if (this._count === void 0)
361
- throw new Error("missing count");
320
+ if (this._sheetIdx === void 0) throw new Error("missing sheetIdx");
321
+ if (this._start === void 0) throw new Error("missing start");
322
+ if (this._count === void 0) throw new Error("missing count");
362
323
  return { sheetIdx: this._sheetIdx, start: this._start, count: this._count };
363
324
  }
364
325
  };
365
-
366
- // ../web/dist/src/bindings/delete_rows_in_block.js
367
326
  var DeleteRowsInBlockBuilder = class {
368
327
  _sheetIdx;
369
328
  _blockId;
@@ -386,19 +345,13 @@ var DeleteRowsInBlockBuilder = class {
386
345
  return this;
387
346
  }
388
347
  build() {
389
- if (this._sheetIdx === void 0)
390
- throw new Error("missing sheetIdx");
391
- if (this._blockId === void 0)
392
- throw new Error("missing blockId");
393
- if (this._start === void 0)
394
- throw new Error("missing start");
395
- if (this._cnt === void 0)
396
- throw new Error("missing cnt");
348
+ if (this._sheetIdx === void 0) throw new Error("missing sheetIdx");
349
+ if (this._blockId === void 0) throw new Error("missing blockId");
350
+ if (this._start === void 0) throw new Error("missing start");
351
+ if (this._cnt === void 0) throw new Error("missing cnt");
397
352
  return { sheetIdx: this._sheetIdx, blockId: this._blockId, start: this._start, cnt: this._cnt };
398
353
  }
399
354
  };
400
-
401
- // ../web/dist/src/bindings/ephemeral_cell_input.js
402
355
  var EphemeralCellInputBuilder = class {
403
356
  _sheetIdx;
404
357
  _id;
@@ -416,17 +369,12 @@ var EphemeralCellInputBuilder = class {
416
369
  return this;
417
370
  }
418
371
  build() {
419
- if (this._sheetIdx === void 0)
420
- throw new Error("missing sheetIdx");
421
- if (this._id === void 0)
422
- throw new Error("missing id");
423
- if (this._content === void 0)
424
- throw new Error("missing content");
372
+ if (this._sheetIdx === void 0) throw new Error("missing sheetIdx");
373
+ if (this._id === void 0) throw new Error("missing id");
374
+ if (this._content === void 0) throw new Error("missing content");
425
375
  return { sheetIdx: this._sheetIdx, id: this._id, content: this._content };
426
376
  }
427
377
  };
428
-
429
- // ../web/dist/src/bindings/ephemeral_cell_remove.js
430
378
  var EphemeralCellRemoveBuilder = class {
431
379
  _sheetIdx;
432
380
  _id;
@@ -439,15 +387,11 @@ var EphemeralCellRemoveBuilder = class {
439
387
  return this;
440
388
  }
441
389
  build() {
442
- if (this._sheetIdx === void 0)
443
- throw new Error("missing sheetIdx");
444
- if (this._id === void 0)
445
- throw new Error("missing id");
390
+ if (this._sheetIdx === void 0) throw new Error("missing sheetIdx");
391
+ if (this._id === void 0) throw new Error("missing id");
446
392
  return { sheetIdx: this._sheetIdx, id: this._id };
447
393
  }
448
394
  };
449
-
450
- // ../web/dist/src/bindings/insert_rows.js
451
395
  var InsertRowsBuilder = class {
452
396
  _sheetIdx;
453
397
  _start;
@@ -465,17 +409,12 @@ var InsertRowsBuilder = class {
465
409
  return this;
466
410
  }
467
411
  build() {
468
- if (this._sheetIdx === void 0)
469
- throw new Error("missing sheetIdx");
470
- if (this._start === void 0)
471
- throw new Error("missing start");
472
- if (this._count === void 0)
473
- throw new Error("missing count");
412
+ if (this._sheetIdx === void 0) throw new Error("missing sheetIdx");
413
+ if (this._start === void 0) throw new Error("missing start");
414
+ if (this._count === void 0) throw new Error("missing count");
474
415
  return { sheetIdx: this._sheetIdx, start: this._start, count: this._count };
475
416
  }
476
417
  };
477
-
478
- // ../web/dist/src/bindings/insert_rows_in_block.js
479
418
  var InsertRowsInBlockBuilder = class {
480
419
  _sheetIdx;
481
420
  _blockId;
@@ -498,19 +437,13 @@ var InsertRowsInBlockBuilder = class {
498
437
  return this;
499
438
  }
500
439
  build() {
501
- if (this._sheetIdx === void 0)
502
- throw new Error("missing sheetIdx");
503
- if (this._blockId === void 0)
504
- throw new Error("missing blockId");
505
- if (this._start === void 0)
506
- throw new Error("missing start");
507
- if (this._cnt === void 0)
508
- throw new Error("missing cnt");
440
+ if (this._sheetIdx === void 0) throw new Error("missing sheetIdx");
441
+ if (this._blockId === void 0) throw new Error("missing blockId");
442
+ if (this._start === void 0) throw new Error("missing start");
443
+ if (this._cnt === void 0) throw new Error("missing cnt");
509
444
  return { sheetIdx: this._sheetIdx, blockId: this._blockId, start: this._start, cnt: this._cnt };
510
445
  }
511
446
  };
512
-
513
- // ../web/dist/src/bindings/move_block_line.js
514
447
  var MoveBlockLineBuilder = class {
515
448
  _sheetIdx;
516
449
  _blockId;
@@ -538,21 +471,14 @@ var MoveBlockLineBuilder = class {
538
471
  return this;
539
472
  }
540
473
  build() {
541
- if (this._sheetIdx === void 0)
542
- throw new Error("missing sheetIdx");
543
- if (this._blockId === void 0)
544
- throw new Error("missing blockId");
545
- if (this._from === void 0)
546
- throw new Error("missing from");
547
- if (this._to === void 0)
548
- throw new Error("missing to");
549
- if (this._isRow === void 0)
550
- throw new Error("missing isRow");
474
+ if (this._sheetIdx === void 0) throw new Error("missing sheetIdx");
475
+ if (this._blockId === void 0) throw new Error("missing blockId");
476
+ if (this._from === void 0) throw new Error("missing from");
477
+ if (this._to === void 0) throw new Error("missing to");
478
+ if (this._isRow === void 0) throw new Error("missing isRow");
551
479
  return { sheetIdx: this._sheetIdx, blockId: this._blockId, from: this._from, to: this._to, isRow: this._isRow };
552
480
  }
553
481
  };
554
-
555
- // ../web/dist/src/bindings/upsert_field_formulas.js
556
482
  var UpsertFieldFormulasBuilder = class {
557
483
  _sheetIdx;
558
484
  _blockId;
@@ -580,56 +506,42 @@ var UpsertFieldFormulasBuilder = class {
580
506
  return this;
581
507
  }
582
508
  build() {
583
- if (this._sheetIdx === void 0)
584
- throw new Error("missing sheetIdx");
585
- if (this._blockId === void 0)
586
- throw new Error("missing blockId");
587
- if (this._fieldFormulas === void 0)
588
- throw new Error("missing fieldFormulas");
589
- if (this._validationFormulas === void 0)
590
- throw new Error("missing validationFormulas");
591
- if (this._editabilityFormulas === void 0)
592
- throw new Error("missing editabilityFormulas");
509
+ if (this._sheetIdx === void 0) throw new Error("missing sheetIdx");
510
+ if (this._blockId === void 0) throw new Error("missing blockId");
511
+ if (this._fieldFormulas === void 0) throw new Error("missing fieldFormulas");
512
+ if (this._validationFormulas === void 0) throw new Error("missing validationFormulas");
513
+ if (this._editabilityFormulas === void 0) throw new Error("missing editabilityFormulas");
593
514
  return { sheetIdx: this._sheetIdx, blockId: this._blockId, fieldFormulas: this._fieldFormulas, validationFormulas: this._validationFormulas, editabilityFormulas: this._editabilityFormulas };
594
515
  }
595
516
  };
596
-
597
- // ../web/dist/src/types.js
598
517
  function getFirstCell(v) {
599
518
  const r = getSelectedCellRange(v);
600
- if (r)
601
- return { y: r.startRow, x: r.startCol };
519
+ if (r) return { y: r.startRow, x: r.startCol };
602
520
  const l = getSelectedLines(v);
603
- if (l?.type === "row")
604
- return { y: l.start, x: 0 };
605
- if (l?.type === "col")
606
- return { y: 0, x: l.start };
521
+ if (l?.type === "row") return { y: l.start, x: 0 };
522
+ if (l?.type === "col") return { y: 0, x: l.start };
607
523
  throw Error("should not happend");
608
524
  }
609
525
  function getSelectedCellRange(v) {
610
- if (v.data?.ty === "cellRange")
611
- return v.data.d;
526
+ if (v.data?.ty === "cellRange") return v.data.d;
612
527
  return void 0;
613
528
  }
614
529
  function getSelectedLines(v) {
615
- if (v.data?.ty === "line")
616
- return v.data.d;
530
+ if (v.data?.ty === "line") return v.data.d;
617
531
  return void 0;
618
532
  }
619
-
620
- // ../web/dist/src/api/utils.js
621
533
  function isErrorMessage(v) {
622
- if (typeof v !== "object" || v === null)
623
- return false;
534
+ if (typeof v !== "object" || v === null) return false;
624
535
  return "msg" in v && "ty" in v;
625
536
  }
626
-
627
- // ../web/dist/src/api/craft-calc.js
628
537
  var ENGINE_RESERVED_END = 4294967296;
629
538
  var CRAFT_RANGE_SIZE = 1 << 20;
630
539
  var nextCraftBase = ENGINE_RESERVED_END;
631
540
  var CraftCalc = class _CraftCalc {
632
- _workbook;
541
+ constructor(_workbook, base) {
542
+ this._workbook = _workbook;
543
+ this._base = base;
544
+ }
633
545
  // Host scratch sheet hosting all ephemeral calc cells. Sheet 0 is
634
546
  // always present in any workbook this API targets. BLOCKREF and
635
547
  // other ref-name lookups don't care which sheet hosts the cell.
@@ -641,10 +553,6 @@ var CraftCalc = class _CraftCalc {
641
553
  // can flush them all. `_oneShotEngineId()` lazily lands here too the
642
554
  // first time calcOnce runs.
643
555
  _live = /* @__PURE__ */ new Set();
644
- constructor(_workbook, base) {
645
- this._workbook = _workbook;
646
- this._base = base;
647
- }
648
556
  /**
649
557
  * Evaluate `formula` once and return the result. Internally uses the
650
558
  * craft's reserved one-shot slot; consecutive calls overwrite each
@@ -686,7 +594,9 @@ var CraftCalc = class _CraftCalc {
686
594
  ]
687
595
  });
688
596
  if (isErrorMessage(infos))
689
- throw new Error(`getCalc(${localId}) failed: ${JSON.stringify(infos)}`);
597
+ throw new Error(
598
+ `getCalc(${localId}) failed: ${JSON.stringify(infos)}`
599
+ );
690
600
  return infos[0].value;
691
601
  }
692
602
  /**
@@ -703,8 +613,7 @@ var CraftCalc = class _CraftCalc {
703
613
  * transaction. Call on craft unmount.
704
614
  */
705
615
  async dropAll() {
706
- if (this._live.size === 0)
707
- return;
616
+ if (this._live.size === 0) return;
708
617
  const payloads = Array.from(this._live).map((engineId) => ({
709
618
  type: "ephemeralCellRemove",
710
619
  value: new EphemeralCellRemoveBuilder().sheetIdx(_CraftCalc.HOST_SHEET_IDX).id(engineId).build()
@@ -722,20 +631,25 @@ var CraftCalc = class _CraftCalc {
722
631
  }
723
632
  _userEngineId(localId) {
724
633
  if (!Number.isInteger(localId) || localId < 0)
725
- throw new Error(`localId must be a non-negative integer: ${localId}`);
634
+ throw new Error(
635
+ `localId must be a non-negative integer: ${localId}`
636
+ );
726
637
  const offset = localId + 1;
727
638
  if (offset >= CRAFT_RANGE_SIZE)
728
- throw new Error(`localId ${localId} exceeds craft range size ${CRAFT_RANGE_SIZE}`);
639
+ throw new Error(
640
+ `localId ${localId} exceeds craft range size ${CRAFT_RANGE_SIZE}`
641
+ );
729
642
  return this._base + offset;
730
643
  }
731
644
  async _resolveSheetId() {
732
- if (this._sheetId !== void 0)
733
- return this._sheetId;
645
+ if (this._sheetId !== void 0) return this._sheetId;
734
646
  const r = await this._workbook.getSheetId({
735
647
  sheetIdx: _CraftCalc.HOST_SHEET_IDX
736
648
  });
737
649
  if (isErrorMessage(r))
738
- throw new Error(`CraftCalc: getSheetId(0) failed: ${JSON.stringify(r)}`);
650
+ throw new Error(
651
+ `CraftCalc: getSheetId(0) failed: ${JSON.stringify(r)}`
652
+ );
739
653
  this._sheetId = r;
740
654
  return r;
741
655
  }
@@ -772,7 +686,11 @@ var CraftCalc = class _CraftCalc {
772
686
  }
773
687
  });
774
688
  if (isErrorMessage(writeResult))
775
- throw new Error(`CraftCalc: formula evaluation failed: ${JSON.stringify(writeResult)}`);
689
+ throw new Error(
690
+ `CraftCalc: formula evaluation failed: ${JSON.stringify(
691
+ writeResult
692
+ )}`
693
+ );
776
694
  const sheetId = await this._resolveSheetId();
777
695
  const infos = await this._workbook.batchGetCellInfoById({
778
696
  ids: [
@@ -783,7 +701,9 @@ var CraftCalc = class _CraftCalc {
783
701
  ]
784
702
  });
785
703
  if (isErrorMessage(infos))
786
- throw new Error(`CraftCalc: read-back failed: ${JSON.stringify(infos)}`);
704
+ throw new Error(
705
+ `CraftCalc: read-back failed: ${JSON.stringify(infos)}`
706
+ );
787
707
  return infos[0].value;
788
708
  }
789
709
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "logisheets-logician",
3
- "version": "1.16.0",
3
+ "version": "1.16.1",
4
4
  "description": "AI agent tools for LogiSheets — platform-agnostic LLM tool definitions, prompts, and skills for operating a real spreadsheet engine. Powers Watson (the in-app assistant) and logisheets-mcp; reusable in any agent host.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -21,8 +21,8 @@
21
21
  "test": "vitest run"
22
22
  },
23
23
  "dependencies": {
24
- "logisheets-core": "^1.16.0",
25
- "logisheets-web": "^1.16.0"
24
+ "logisheets-core": "^1.16.1",
25
+ "logisheets-web": "^1.16.1"
26
26
  },
27
27
  "devDependencies": {
28
28
  "esbuild": "^0.21.0",