@bilig/headless 0.8.2 → 0.9.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.
- package/README.md +104 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@bilig/headless)
|
|
4
4
|
[](https://github.com/proompteng/bilig)
|
|
5
|
+
[](https://github.com/proompteng/bilig/stargazers)
|
|
5
6
|
[](../../LICENSE)
|
|
6
7
|
|
|
7
8
|
`@bilig/headless` is the production-targeted WorkPaper workbook facade for
|
|
@@ -25,9 +26,12 @@ Current release posture:
|
|
|
25
26
|
- Full local CI passed after the latest headless hardening work, including unit,
|
|
26
27
|
contract, fuzz, browser, clean-diff, release-budget, runtime-publish, and
|
|
27
28
|
WorkPaper competitive benchmark gates.
|
|
28
|
-
- The checked-in competitive artifact generated on `2026-05-
|
|
29
|
+
- The checked-in competitive artifact generated on `2026-05-06T14:54:57.091Z`
|
|
29
30
|
shows `46/46` comparable WorkPaper mean wins against HyperFormula-style
|
|
30
31
|
workloads: `38/38` public and `8/8` holdout.
|
|
32
|
+
- The public benchmark evidence note explains the measured workload families,
|
|
33
|
+
engine metadata, exclusions, and the current p95 nuance:
|
|
34
|
+
[`docs/headless-workpaper-benchmark-evidence.md`](../../docs/headless-workpaper-benchmark-evidence.md).
|
|
31
35
|
- Recently fixed and hardened P1 risks are covered by regression tests:
|
|
32
36
|
- `updateConfig()` now applies `useColumnIndex` correctly when a rebuild-only
|
|
33
37
|
config key changes in the same update.
|
|
@@ -42,6 +46,14 @@ Supported scope:
|
|
|
42
46
|
- The contract is the WorkPaper/headless API exported by this package.
|
|
43
47
|
- Excel-file ingestion belongs to import/export pipelines before data reaches
|
|
44
48
|
`WorkPaper`; this package executes the validated WorkPaper workbook model.
|
|
49
|
+
- XLSX cached-result parity investigations are covered by the repository
|
|
50
|
+
verifier, not by the published package surface. Use
|
|
51
|
+
`pnpm workpaper:xlsx-corpus:check -- <xlsx-file-or-directory>` for external
|
|
52
|
+
corpora, and `pnpm workpaper:xlsx-corpus:fixtures:check` for the checked-in
|
|
53
|
+
issue #8 reduction corpus. The verifier compares deterministic cached formula
|
|
54
|
+
results and skips volatile or environment-dependent formulas such as `NOW()`
|
|
55
|
+
and `CELL("filename")`; unsupported deterministic formulas remain visible as
|
|
56
|
+
mismatches instead of being silently accepted.
|
|
45
57
|
- Custom function plugins and callback hooks are runtime registrations. Persist
|
|
46
58
|
workbook data with the helpers below, then register custom behavior in
|
|
47
59
|
application code before restore.
|
|
@@ -66,6 +78,8 @@ Repository:
|
|
|
66
78
|
- npm: <https://www.npmjs.com/package/@bilig/headless>
|
|
67
79
|
- runnable example:
|
|
68
80
|
[`examples/headless-workpaper`](../../examples/headless-workpaper)
|
|
81
|
+
- public adoption kit:
|
|
82
|
+
[`docs/public-adoption-kit.md`](../../docs/public-adoption-kit.md)
|
|
69
83
|
|
|
70
84
|
Inside this monorepo:
|
|
71
85
|
|
|
@@ -144,6 +158,10 @@ npm start
|
|
|
144
158
|
Repository CI also runs the same example against packed local runtime packages
|
|
145
159
|
through `pnpm workpaper:smoke:external`.
|
|
146
160
|
|
|
161
|
+
For a concise evaluator-facing summary with copy-paste npm commands, proof
|
|
162
|
+
links, shareable copy, and overclaim guardrails, use the root
|
|
163
|
+
[`Public Adoption Kit`](../../docs/public-adoption-kit.md).
|
|
164
|
+
|
|
147
165
|
## Core Concepts
|
|
148
166
|
|
|
149
167
|
- `WorkPaper` is the top-level workbook object. Create it with
|
|
@@ -200,6 +218,39 @@ const changes = workbook.batch(() => {
|
|
|
200
218
|
})
|
|
201
219
|
```
|
|
202
220
|
|
|
221
|
+
Create and read named expressions:
|
|
222
|
+
|
|
223
|
+
```ts
|
|
224
|
+
import { WorkPaper, type WorkPaperCellAddress } from '@bilig/headless'
|
|
225
|
+
|
|
226
|
+
const workbook = WorkPaper.buildFromSheets({
|
|
227
|
+
Plan: [
|
|
228
|
+
['Metric', 'Value'],
|
|
229
|
+
['Base revenue', 100],
|
|
230
|
+
['Target revenue', null],
|
|
231
|
+
],
|
|
232
|
+
})
|
|
233
|
+
|
|
234
|
+
const sheet = workbook.getSheetId('Plan')
|
|
235
|
+
if (sheet === undefined) {
|
|
236
|
+
throw new Error('Plan sheet was not created')
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const at = (row: number, col: number): WorkPaperCellAddress => ({
|
|
240
|
+
sheet,
|
|
241
|
+
row,
|
|
242
|
+
col,
|
|
243
|
+
})
|
|
244
|
+
|
|
245
|
+
workbook.addNamedExpression('GrowthRate', 0.15)
|
|
246
|
+
workbook.setCellContents(at(2, 1), '=B2*(1+GrowthRate)')
|
|
247
|
+
|
|
248
|
+
console.log(workbook.getNamedExpressionValue('GrowthRate')) // CellValue for 0.15
|
|
249
|
+
console.log(workbook.getNamedExpressionFormula('GrowthRate')) // undefined for a scalar name
|
|
250
|
+
console.log(workbook.getCellValue(at(2, 1))) // CellValue for 115
|
|
251
|
+
console.log(workbook.getNamedExpressionValue('MissingName')) // undefined
|
|
252
|
+
```
|
|
253
|
+
|
|
203
254
|
Move cells inside configured bounds:
|
|
204
255
|
|
|
205
256
|
```ts
|
|
@@ -233,6 +284,39 @@ const saved = serializeWorkPaperDocument(exportWorkPaperDocument(workbook, { inc
|
|
|
233
284
|
const restored = createWorkPaperFromDocument(parseWorkPaperDocument(saved))
|
|
234
285
|
```
|
|
235
286
|
|
|
287
|
+
Validate a persisted document before restore:
|
|
288
|
+
|
|
289
|
+
```ts
|
|
290
|
+
import {
|
|
291
|
+
WorkPaper,
|
|
292
|
+
createWorkPaperFromDocument,
|
|
293
|
+
exportWorkPaperDocument,
|
|
294
|
+
isPersistedWorkPaperDocument,
|
|
295
|
+
parseWorkPaperDocument,
|
|
296
|
+
serializeWorkPaperDocument,
|
|
297
|
+
} from '@bilig/headless'
|
|
298
|
+
|
|
299
|
+
const workbook = WorkPaper.buildFromSheets({
|
|
300
|
+
Sheet1: [[10, '=A1*2']],
|
|
301
|
+
})
|
|
302
|
+
|
|
303
|
+
const document = exportWorkPaperDocument(workbook, { includeConfig: true })
|
|
304
|
+
const serialized = serializeWorkPaperDocument(document)
|
|
305
|
+
|
|
306
|
+
const parsed = parseWorkPaperDocument(serialized)
|
|
307
|
+
if (!isPersistedWorkPaperDocument(parsed)) {
|
|
308
|
+
throw new Error('Persisted WorkPaper document failed validation')
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
const restored = createWorkPaperFromDocument(parsed)
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
`parseWorkPaperDocument()` validates JSON and throws on invalid payloads.
|
|
315
|
+
`isPersistedWorkPaperDocument()` is useful when a service already has an
|
|
316
|
+
unknown parsed object. Custom function implementations, callback hooks, and
|
|
317
|
+
other process state are not persisted; register those in application code before
|
|
318
|
+
restoring the workbook.
|
|
319
|
+
|
|
236
320
|
## Persistence Contract
|
|
237
321
|
|
|
238
322
|
`@bilig/headless` persists:
|
|
@@ -278,6 +362,21 @@ pnpm workpaper:bench:competitive:check
|
|
|
278
362
|
Do not change benchmark definitions, scoring, sampling, or workload sizes to hide
|
|
279
363
|
losses.
|
|
280
364
|
|
|
365
|
+
For XLSX compatibility investigations with cached formula results, run the
|
|
366
|
+
corpus verifier against real workbook files:
|
|
367
|
+
|
|
368
|
+
```sh
|
|
369
|
+
pnpm workpaper:xlsx-corpus:check -- /path/to/xlsx-corpus
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
The verifier reads `.xlsx`, `.xlsm`, and `.xls` files, builds a WorkPaper model
|
|
373
|
+
with `useColumnIndex: true`, and compares formula cells against cached workbook
|
|
374
|
+
results. It reports `totalFiles`, `failedTimeouts`, `comparableFormulaCells`,
|
|
375
|
+
`matchingFormulaCells`, `mismatchedFormulaCells`, `matchRate`, skipped formulas,
|
|
376
|
+
and actionable mismatch samples. Missing cached results and volatile or
|
|
377
|
+
environment-dependent formulas such as `NOW()` and `CELL()` are counted as
|
|
378
|
+
skipped instead of silently treated as parity evidence.
|
|
379
|
+
|
|
281
380
|
## Compatibility Notes
|
|
282
381
|
|
|
283
382
|
- The facade follows HyperFormula-style public workbook workflows, but it is not
|
|
@@ -290,6 +389,10 @@ losses.
|
|
|
290
389
|
- Stable compatibility adapters are available through `graph`, `rangeMapping`,
|
|
291
390
|
`arrayMapping`, `sheetMapping`, `addressMapping`, `dependencyGraph`,
|
|
292
391
|
`evaluator`, `columnSearch`, and `lazilyTransformingAstService`.
|
|
392
|
+
- Cached XLSX result parity is a testable corpus property, not a blanket
|
|
393
|
+
package guarantee. Use `pnpm workpaper:xlsx-corpus:check -- <corpus>` for
|
|
394
|
+
supplied workbook corpora, and keep unsupported or volatile workbook functions
|
|
395
|
+
documented in the resulting report.
|
|
293
396
|
|
|
294
397
|
## For Coding Agents
|
|
295
398
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bilig/headless",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Headless spreadsheet engine and WorkPaper workbook facade for Node services, coding agents, and HyperFormula-style workflows.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"build": "rm -rf dist tsconfig.tsbuildinfo && tsc -p tsconfig.json"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@bilig/core": "0.
|
|
53
|
-
"@bilig/formula": "0.
|
|
54
|
-
"@bilig/protocol": "0.
|
|
52
|
+
"@bilig/core": "0.9.1",
|
|
53
|
+
"@bilig/formula": "0.9.1",
|
|
54
|
+
"@bilig/protocol": "0.9.1"
|
|
55
55
|
},
|
|
56
56
|
"engines": {
|
|
57
57
|
"node": ">=24.0.0"
|