@bilig/workpaper 0.107.3 → 0.119.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
@@ -38,16 +38,16 @@ Do not claim success from a write call alone. The proof is computed readback plu
38
38
  ## Fast Commands
39
39
 
40
40
  ```sh
41
- npm exec --package @bilig/workpaper@0.107.3 -- bilig-agent-challenge
42
- npm exec --package @bilig/workpaper@0.107.3 -- bilig-mcp-challenge
43
- npm exec --package @bilig/workpaper@0.107.3 -- bilig-workpaper-mcp --workpaper ./pricing.workpaper.json --init-demo-workpaper --writable
44
- npm exec --package @bilig/workpaper@0.107.3 -- bilig-formula-clinic ./reduced.xlsx --cells "Summary!B7,Inputs!B2"
41
+ npm exec --package @bilig/workpaper@latest -- bilig-agent-challenge
42
+ npm exec --package @bilig/workpaper@latest -- bilig-mcp-challenge
43
+ npm exec --package @bilig/workpaper@latest -- bilig-workpaper-mcp --workpaper ./pricing.workpaper.json --init-demo-workpaper --writable
44
+ npm exec --package @bilig/workpaper@latest -- bilig-formula-clinic ./reduced.xlsx --cells "Summary!B7,Inputs!B2"
45
45
  ```
46
46
 
47
47
  Claude Desktop users can install the released MCPB bundle from:
48
48
 
49
- - https://github.com/proompteng/bilig/releases/download/libraries-v0.107.3/bilig-workpaper.mcpb
50
- - https://github.com/proompteng/bilig/releases/download/libraries-v0.107.3/bilig-workpaper.mcpb.sha256
49
+ - https://github.com/proompteng/bilig/releases/latest/download/bilig-workpaper.mcpb
50
+ - https://github.com/proompteng/bilig/releases/latest/download/bilig-workpaper.mcpb.sha256
51
51
 
52
52
  ## Direct TypeScript
53
53
 
package/README.md CHANGED
@@ -19,14 +19,29 @@ npm install @bilig/workpaper
19
19
 
20
20
  Pick the path that matches the workflow you are trying to unblock:
21
21
 
22
- | You need... | Run this first | Proof you should get |
23
- | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------- |
24
- | Formula workbook logic inside a Node service, route, queue, or test | `npm create @bilig/workpaper@latest pricing-workpaper` | Inputs are written, formulas recalculate, JSON persists, restore matches readback, and `verified: true` is printed. |
25
- | A coding agent or MCP client that needs spreadsheet operations | `npm create @bilig/workpaper@latest pricing-agent -- --agent` | The generated project includes an agent contract, MCP config, and `npm run agent:verify`. |
26
- | Directus Flow operation for persisted calculated fields | `cd examples/directus-workpaper-flow-operation && npm install && npm run smoke` | The operation returns a Directus `patch` plus before/after/restore WorkPaper proof with `verified: true`. |
27
- | n8n, Dify, or Flowise formula readback without spreadsheet UI automation | `npm exec --package @bilig/workpaper@latest -- bilig-n8n-formula-server --port 4321` | The workflow writes one input cell, reads dependent formula output, and returns a compact JSON proof. |
28
- | Open WebUI needs MCP spreadsheet tools | `npm exec --package @bilig/workpaper@latest -- bilig-mcp-challenge --json` | Open WebUI can call the hosted Streamable HTTP endpoint or a local stdio server bridged through `mcpo`. |
29
- | An existing `.xlsx` file with stale formula results after Node edits | `npx --package @bilig/xlsx-formula-recalc xlsx-recalc --demo --json` | The file-level path updates inputs and returns fresh formula values without Excel, LibreOffice, or a browser. |
22
+ | You need... | Run this first | Proof you should get |
23
+ | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
24
+ | Formula workbook logic inside a Node service, route, queue, or test | `npm create @bilig/workpaper@latest pricing-workpaper` | Inputs are written, formulas recalculate, JSON persists, restore matches readback, and `verified: true` is printed. |
25
+ | A coding agent or MCP client that needs spreadsheet operations | `npm create @bilig/workpaper@latest pricing-agent -- --agent` | The generated project includes an agent contract, MCP config, and `npm run agent:verify`. |
26
+ | Windmill TypeScript workflow fields | `cd examples/windmill-workpaper-script && pnpm install --ignore-workspace --lockfile=false && pnpm run smoke` | The script returns a calculated field patch plus before/after/restore WorkPaper proof with `verified: true`. |
27
+ | Trigger.dev durable task fields | `cd examples/triggerdev-workpaper-task && pnpm install --ignore-workspace --lockfile=false && pnpm run smoke` | The task helper returns a calculated field patch plus before/after/restore WorkPaper proof with `verified: true`. |
28
+ | Inngest durable step fields | `cd examples/inngest-workpaper-step && pnpm install --ignore-workspace --lockfile=false && pnpm run smoke` | The step helper returns a calculated field patch plus before/after/restore WorkPaper proof with `verified: true`. |
29
+ | Airbyte post-sync record and state validation | `cd examples/airbyte-workpaper-validation && pnpm install --ignore-workspace --lockfile=false && pnpm run smoke` | The validation step reads Airbyte-style `STREAM`/`GLOBAL` state JSONL and returns a patch plus restore proof. |
30
+ | Meltano custom utility validation | `cd examples/meltano-workpaper-utility && pnpm install --ignore-workspace --lockfile=false && pnpm run smoke` | The utility reads a post-ELT JSONL export and writes a formula-backed WorkPaper proof artifact. |
31
+ | Temporal TypeScript Activity decisions | `cd examples/temporal-workpaper-activity && pnpm install --ignore-workspace --lockfile=false && pnpm run smoke` | The Activity owns WorkPaper formula work while Workflow code stays free of workbook imports. |
32
+ | Apache Airflow DAG task outputs | `cd examples/airflow-workpaper-dag && pnpm install --ignore-workspace --lockfile=false && pnpm run smoke` | The Node step writes a full proof file while the DAG returns a compact XCom summary for downstream tasks. |
33
+ | Dagster asset materialization metadata | `cd examples/dagster-workpaper-asset && pnpm install --ignore-workspace --lockfile=false && pnpm run smoke` | The Node subprocess writes WorkPaper proof and emits compact Dagster Pipes materialization metadata. |
34
+ | Kestra Node Commands flow fields | `cd examples/kestra-workpaper-flow && pnpm install --ignore-workspace --lockfile=false && pnpm run smoke` | The flow script writes a `workpaper-proof.json` artifact with before/after/restore proof and `verified: true`. |
35
+ | Prefect flow fields | `cd examples/prefect-workpaper-flow && pnpm install --ignore-workspace --lockfile=false && pnpm run smoke` | The Node step writes a `workpaper-proof.json` artifact that a Prefect task can validate and return. |
36
+ | Directus Flow operation for persisted calculated fields | `cd examples/directus-workpaper-flow-operation && npm install && npm run smoke` | The operation returns a Directus `patch` plus before/after/restore WorkPaper proof with `verified: true`. |
37
+ | n8n, Dify, or Flowise formula readback without spreadsheet UI automation | `npm exec --package @bilig/workpaper@latest -- bilig-n8n-formula-server --port 4321` | The workflow writes one input cell, reads dependent formula output, and returns a compact JSON proof. |
38
+ | Vercel AI SDK `generateText()` or `streamText()` tools | Import `createAiSdkWorkPaperTools` from `@bilig/workpaper/ai-sdk` | The tool call returns before/after/restore formula readback instead of a blind write result. |
39
+ | Open WebUI needs MCP spreadsheet tools | `npm exec --package @bilig/workpaper@latest -- bilig-mcp-challenge --json` | Open WebUI can call the hosted Streamable HTTP endpoint or a local stdio server bridged through `mcpo`. |
40
+ | FastMCP Python client for hosted MCP smoke tests | `cd examples/fastmcp-workpaper-client && uv run --python 3.12 --with 'fastmcp-slim[client]' python fastmcp_workpaper_client.py --output .tmp/fastmcp-workpaper-proof.json` | FastMCP lists Bilig tools, writes `Inputs!B3`, checks restore proof, and exports WorkPaper JSON. |
41
+ | LangGraph.js ToolNode should keep formula proof in state | `cd examples/langgraph-workpaper-tool-state && pnpm install --ignore-workspace --lockfile=false && pnpm run smoke` | Real `@langchain/langgraph` `ToolNode` returns `ToolMessage` readback proof after a WorkPaper mutation. |
42
+ | LangChain MCP adapters should load WorkPaper tools | `cd examples/langchain-mcp-workpaper-toolnode && pnpm install --ignore-workspace --lockfile=false && pnpm run smoke` | `@langchain/mcp-adapters` discovers Bilig MCP tools and `ToolNode` proves write, readback, persistence, and restart. |
43
+ | Hugging Face smolagents tool | `cd examples/smolagents-workpaper-tool && uv run --python 3.12 --with smolagents python smolagents_workpaper_tool.py --output .tmp/smolagents-workpaper-proof.json` | A smolagents `Tool` runs Bilig formula readback proof and returns a structured `verified: true` object. |
44
+ | An existing `.xlsx` file with stale formula results after Node edits | `npx --package @bilig/xlsx-formula-recalc xlsx-recalc --demo --json` | The file-level path updates inputs and returns fresh formula values without Excel, LibreOffice, or a browser. |
30
45
 
31
46
  ## Use A WorkPaper In Node
32
47
 
@@ -83,6 +98,56 @@ console.log({
83
98
  workbook.dispose()
84
99
  ```
85
100
 
101
+ ## Use WorkPaper Tools With The Vercel AI SDK
102
+
103
+ Install the AI SDK and Zod in the application that owns the agent loop:
104
+
105
+ ```sh
106
+ npm install @bilig/workpaper ai zod
107
+ ```
108
+
109
+ Then expose a WorkPaper as normal AI SDK tools:
110
+
111
+ ```ts
112
+ import { generateText, stepCountIs } from 'ai'
113
+ import { WorkPaper } from '@bilig/workpaper'
114
+ import { createAiSdkWorkPaperTools } from '@bilig/workpaper/ai-sdk'
115
+
116
+ const workpaper = WorkPaper.buildFromSheets({
117
+ Inputs: [
118
+ ['Metric', 'Value'],
119
+ ['Qualified opportunities', 20],
120
+ ['Win rate', 0.25],
121
+ ['Average ARR', 12000],
122
+ ],
123
+ Summary: [
124
+ ['Metric', 'Value'],
125
+ ['Expected customers', '=Inputs!B2*Inputs!B3'],
126
+ ['Expected ARR', '=B2*Inputs!B4'],
127
+ ],
128
+ })
129
+
130
+ const tools = createAiSdkWorkPaperTools({
131
+ workpaper,
132
+ defaultReadRange: 'Summary!A1:B3',
133
+ proofRange: 'Summary!A1:B3',
134
+ writableSheets: ['Inputs'],
135
+ })
136
+
137
+ const result = await generateText({
138
+ model,
139
+ tools,
140
+ stopWhen: stepCountIs(2),
141
+ prompt: 'Read the summary, set Inputs!B3 to 0.4, then report the computed ARR change.',
142
+ })
143
+
144
+ console.log(result.text)
145
+ ```
146
+
147
+ The mutating tool returns `editedCell`, `before`, `after`, `restored`, and
148
+ `checks`. Keep `writableSheets` narrow so the model can edit inputs without
149
+ rewriting formula sheets.
150
+
86
151
  ## Prove The Agent Loop Without Cloning
87
152
 
88
153
  The package ships proof commands for coding agents and service evaluators:
@@ -109,17 +174,41 @@ npm exec --package @bilig/workpaper@latest -- bilig-n8n-formula-server --port 43
109
174
  Start from the repo examples:
110
175
 
111
176
  - `examples/directus-workpaper-flow-operation`
177
+ - `examples/windmill-workpaper-script`
178
+ - `examples/triggerdev-workpaper-task`
179
+ - `examples/airbyte-workpaper-validation`
180
+ - `examples/meltano-workpaper-utility`
181
+ - `examples/temporal-workpaper-activity`
182
+ - `examples/airflow-workpaper-dag`
183
+ - `examples/dagster-workpaper-asset`
184
+ - `examples/kestra-workpaper-flow`
185
+ - `examples/prefect-workpaper-flow`
112
186
  - `examples/n8n-workpaper-formula-readback/bilig-workpaper-formula-readback.n8n.json`
113
187
  - `examples/dify-workpaper-formula-readback`
114
188
  - `examples/flowise-workpaper-formula-readback/bilig-workpaper-formula-readback.flowise-tool.json`
189
+ - `examples/fastmcp-workpaper-client`
190
+ - `examples/langchain-mcp-workpaper-toolnode`
191
+ - `examples/smolagents-workpaper-tool`
115
192
 
116
193
  Docs:
117
194
 
118
195
  - <https://proompteng.github.io/bilig/directus-workpaper-flow-operation.html>
196
+ - <https://proompteng.github.io/bilig/windmill-workpaper-script.html>
197
+ - <https://proompteng.github.io/bilig/triggerdev-workpaper-task.html>
198
+ - <https://proompteng.github.io/bilig/airbyte-workpaper-validation.html>
199
+ - <https://proompteng.github.io/bilig/meltano-workpaper-utility.html>
200
+ - <https://proompteng.github.io/bilig/temporal-workpaper-activity.html>
201
+ - <https://proompteng.github.io/bilig/airflow-workpaper-dag.html>
202
+ - <https://proompteng.github.io/bilig/dagster-workpaper-asset.html>
203
+ - <https://proompteng.github.io/bilig/kestra-workpaper-flow.html>
204
+ - <https://proompteng.github.io/bilig/prefect-workpaper-flow.html>
119
205
  - <https://proompteng.github.io/bilig/open-webui-workpaper-mcp.html>
120
206
  - <https://proompteng.github.io/bilig/n8n-workpaper-formula-readback.html>
121
207
  - <https://proompteng.github.io/bilig/dify-workpaper-formula-readback.html>
122
208
  - <https://proompteng.github.io/bilig/flowise-workpaper-formula-readback.html>
209
+ - <https://proompteng.github.io/bilig/fastmcp-workpaper-client.html>
210
+ - <https://proompteng.github.io/bilig/langgraph-workpaper-toolnode-spreadsheet.html>
211
+ - <https://proompteng.github.io/bilig/smolagents-workpaper-tool.html>
123
212
 
124
213
  ## XLSX Import And Export
125
214
 
@@ -155,4 +244,17 @@ service-owned calculations, JSON persistence, XLSX import/export, and
155
244
  agent-readable readback. Unsupported Excel functions, external workbook links,
156
245
  macros, and volatile functions may need review.
157
246
 
247
+ ## After The Proof
248
+
249
+ If the starter or challenge output gives you `verified: true` for the service
250
+ or agent workflow you need, star or bookmark Bilig so the WorkPaper runtime is
251
+ easy to find again: <https://github.com/proompteng/bilig/stargazers>.
252
+
253
+ Watch releases if this is close to a production path:
254
+ <https://github.com/proompteng/bilig/subscription>.
255
+
256
+ If the model is close but blocked by a formula, import/export, persistence,
257
+ framework, MCP, or package-boundary gap, open the smallest adoption blocker:
258
+ <https://github.com/proompteng/bilig/discussions/new?category=general>.
259
+
158
260
  Full docs: <https://proompteng.github.io/bilig/>
package/SKILL.md CHANGED
@@ -37,12 +37,19 @@ Do not build shell commands by concatenating user text. Treat the commands below
37
37
  Use MCP when the host can run a stdio server or call a Streamable HTTP server.
38
38
  Configure stdio as an argument array, not a shell-concatenated string:
39
39
 
40
+ If the host supports installable skills, first check that the public skill
41
+ package is discoverable:
42
+
43
+ ```sh
44
+ npx --yes skills@latest add proompteng/bilig --skill bilig-workpaper --list
45
+ ```
46
+
40
47
  Before wiring a client, an agent can prove the direct WorkPaper loop with:
41
48
 
42
49
  ```json
43
50
  {
44
51
  "command": "npm",
45
- "args": ["exec", "--package", "@bilig/workpaper@0.107.3", "--", "bilig-agent-challenge"]
52
+ "args": ["exec", "--package", "@bilig/workpaper@latest", "--", "bilig-agent-challenge"]
46
53
  }
47
54
  ```
48
55
 
@@ -51,7 +58,7 @@ For the actual file-backed MCP path, run the package-owned challenge first:
51
58
  ```json
52
59
  {
53
60
  "command": "npm",
54
- "args": ["exec", "--package", "@bilig/workpaper@0.107.3", "--", "bilig-mcp-challenge"]
61
+ "args": ["exec", "--package", "@bilig/workpaper@latest", "--", "bilig-mcp-challenge"]
55
62
  }
56
63
  ```
57
64
 
@@ -61,7 +68,7 @@ For the actual file-backed MCP path, run the package-owned challenge first:
61
68
  "args": [
62
69
  "exec",
63
70
  "--package",
64
- "@bilig/workpaper@0.107.3",
71
+ "@bilig/workpaper@latest",
65
72
  "--",
66
73
  "bilig-workpaper-mcp",
67
74
  "--workpaper",
@@ -72,7 +79,8 @@ For the actual file-backed MCP path, run the package-owned challenge first:
72
79
  }
73
80
  ```
74
81
 
75
- The useful file-backed tools are:
82
+ Run `bilig-mcp-challenge` and treat its returned `tools` array as the source
83
+ of truth for the currently published package. The core file-backed tools are:
76
84
 
77
85
  - `list_sheets`
78
86
  - `read_range`
@@ -82,7 +90,11 @@ The useful file-backed tools are:
82
90
  - `export_workpaper_document`
83
91
  - `validate_formula`
84
92
 
85
- After a write, always read the dependent output cell and export the WorkPaper document.
93
+ After a write, always read the dependent output cell and export the WorkPaper
94
+ document. If the listed tool set includes `set_cell_contents_and_readback`,
95
+ prefer it for stateless clients because the edit and dependent readback happen
96
+ in one tool call. If it is absent, call `set_cell_contents`, then `read_cell`
97
+ or `read_range`, then `export_workpaper_document`.
86
98
 
87
99
  For remote MCP clients, use the stateless demo endpoint when the client supports
88
100
  Streamable HTTP:
@@ -138,7 +150,7 @@ When the user has a reduced XLSX formula/import bug, generate a local report thr
138
150
  "args": [
139
151
  "exec",
140
152
  "--package",
141
- "@bilig/workpaper@0.107.3",
153
+ "@bilig/workpaper@latest",
142
154
  "--",
143
155
  "bilig-formula-clinic",
144
156
  "./reduced.xlsx",
@@ -170,7 +182,22 @@ If any proof step fails, report the blocker instead of claiming the workbook was
170
182
  - Agent handbook: https://proompteng.github.io/bilig/headless-workpaper-agent-handbook.html
171
183
  - Agent workbook challenge: https://proompteng.github.io/bilig/agent-workbook-challenge.html
172
184
  - MCP server guide: https://proompteng.github.io/bilig/mcp-workpaper-tool-server.html
173
- - Open WebUI MCP setup: https://proompteng.github.io/bilig/open-webui-workpaper-mcp.html
185
+ - Open WebUI tool setup: https://proompteng.github.io/bilig/open-webui-workpaper-mcp.html
186
+ - LobeHub MCP setup: https://proompteng.github.io/bilig/lobehub-workpaper-mcp.html
187
+ - AnythingLLM MCP setup: https://proompteng.github.io/bilig/anythingllm-workpaper-mcp.html
188
+ - Sim MCP setup: https://proompteng.github.io/bilig/sim-workpaper-mcp.html
189
+ - FastMCP Python client: https://proompteng.github.io/bilig/fastmcp-workpaper-client.html
190
+ - smolagents WorkPaper tool: https://proompteng.github.io/bilig/smolagents-workpaper-tool.html
191
+ - Windmill TypeScript script: https://proompteng.github.io/bilig/windmill-workpaper-script.html
192
+ - Trigger.dev task: https://proompteng.github.io/bilig/triggerdev-workpaper-task.html
193
+ - Inngest step: https://proompteng.github.io/bilig/inngest-workpaper-step.html
194
+ - Airbyte validation: https://proompteng.github.io/bilig/airbyte-workpaper-validation.html
195
+ - Meltano utility: https://proompteng.github.io/bilig/meltano-workpaper-utility.html
196
+ - Temporal Activity: https://proompteng.github.io/bilig/temporal-workpaper-activity.html
197
+ - Airflow DAG: https://proompteng.github.io/bilig/airflow-workpaper-dag.html
198
+ - Dagster asset: https://proompteng.github.io/bilig/dagster-workpaper-asset.html
199
+ - Kestra Node flow: https://proompteng.github.io/bilig/kestra-workpaper-flow.html
200
+ - Prefect flow: https://proompteng.github.io/bilig/prefect-workpaper-flow.html
174
201
  - XLSX formula clinic: https://proompteng.github.io/bilig/formula-bug-clinic.html
175
202
  - Compatibility limits: https://proompteng.github.io/bilig/where-bilig-is-not-excel-compatible-yet.html
176
203
  - Repository: https://github.com/proompteng/bilig
@@ -0,0 +1,47 @@
1
+ import type { WorkPaper } from 'bilig-workpaper';
2
+ type WorkPaperInstance = ReturnType<typeof WorkPaper.buildFromSheets>;
3
+ export type AiSdkWorkPaperCellValue = string | number | boolean | null;
4
+ export interface AiSdkWorkPaperToolsOptions {
5
+ readonly workpaper: WorkPaperInstance;
6
+ readonly defaultReadRange?: string;
7
+ readonly proofRange?: string;
8
+ readonly writableSheets?: readonly string[];
9
+ readonly includeSerializedDocument?: boolean;
10
+ }
11
+ export interface AiSdkWorkPaperSetCellArgs {
12
+ readonly sheetName: string;
13
+ readonly address: string;
14
+ readonly value: AiSdkWorkPaperCellValue;
15
+ }
16
+ export interface AiSdkWorkPaperReadRangeArgs {
17
+ readonly range?: string;
18
+ }
19
+ export interface AiSdkWorkPaperReadResult {
20
+ readonly range: string;
21
+ readonly values: unknown[][];
22
+ readonly serialized: unknown[][];
23
+ }
24
+ export interface AiSdkWorkPaperWriteResult {
25
+ readonly editedCell: string;
26
+ readonly before: AiSdkWorkPaperReadResult;
27
+ readonly after: AiSdkWorkPaperReadResult;
28
+ readonly restored: AiSdkWorkPaperReadResult;
29
+ readonly checks: {
30
+ readonly previousValue: unknown;
31
+ readonly newValue: unknown;
32
+ readonly formulasPersisted: boolean;
33
+ readonly restoredMatchesAfter: boolean;
34
+ readonly proofRangeChanged: boolean;
35
+ readonly serializedBytes: number;
36
+ };
37
+ readonly serializedDocument?: string;
38
+ }
39
+ export declare function createAiSdkWorkPaperTools(options: AiSdkWorkPaperToolsOptions): {
40
+ readWorkPaperSummary: import("ai").Tool<AiSdkWorkPaperReadRangeArgs, AiSdkWorkPaperReadResult>;
41
+ setWorkPaperInputCell: import("ai").Tool<AiSdkWorkPaperSetCellArgs, AiSdkWorkPaperWriteResult>;
42
+ };
43
+ export declare function createWorkPaperToolHandlers(options: AiSdkWorkPaperToolsOptions): {
44
+ readWorkPaperSummary(range?: string): AiSdkWorkPaperReadResult;
45
+ setWorkPaperInputCell(args: AiSdkWorkPaperSetCellArgs): AiSdkWorkPaperWriteResult;
46
+ };
47
+ export {};
package/dist/ai-sdk.js ADDED
@@ -0,0 +1,118 @@
1
+ import { createWorkPaperFromDocument, exportWorkPaperDocument, parseWorkPaperDocument, serializeWorkPaperDocument } from 'bilig-workpaper';
2
+ import { tool } from 'ai';
3
+ import { z } from 'zod';
4
+ const setInputCellSchema = z.object({
5
+ sheetName: z.string().min(1).describe('Target sheet name, for example Inputs.'),
6
+ address: z
7
+ .string()
8
+ .regex(/^[A-Z]+[1-9][0-9]*$/)
9
+ .describe('A1 cell address inside the target sheet, for example B3.'),
10
+ value: z
11
+ .union([z.string(), z.number(), z.boolean(), z.null()])
12
+ .describe('Literal cell value. Formula strings are accepted only when your WorkPaper contract allows them.'),
13
+ });
14
+ export function createAiSdkWorkPaperTools(options) {
15
+ const handlers = createWorkPaperToolHandlers(options);
16
+ const defaultReadRange = options.defaultReadRange ?? 'Summary!A1:B5';
17
+ return {
18
+ readWorkPaperSummary: tool({
19
+ description: 'Read computed WorkPaper values and serialized cells for a small proof range.',
20
+ inputSchema: createReadRangeInputSchema(defaultReadRange),
21
+ execute: async ({ range = defaultReadRange } = {}) => {
22
+ return handlers.readWorkPaperSummary(range);
23
+ },
24
+ }),
25
+ setWorkPaperInputCell: tool({
26
+ description: 'Set one validated WorkPaper input cell and return before/after/restore formula readback.',
27
+ inputSchema: setInputCellSchema,
28
+ execute: async (args) => handlers.setWorkPaperInputCell(args),
29
+ }),
30
+ };
31
+ }
32
+ function createReadRangeInputSchema(defaultReadRange) {
33
+ return z.object({
34
+ range: z.string().default(defaultReadRange).describe(`A small A1 range including the sheet name, for example ${defaultReadRange}.`),
35
+ });
36
+ }
37
+ export function createWorkPaperToolHandlers(options) {
38
+ const defaultReadRange = options.defaultReadRange ?? 'Summary!A1:B5';
39
+ const proofRange = options.proofRange ?? defaultReadRange;
40
+ return {
41
+ readWorkPaperSummary(range = defaultReadRange) {
42
+ return readWorkPaperRange(options.workpaper, range);
43
+ },
44
+ setWorkPaperInputCell(args) {
45
+ const parsedArgs = setInputCellSchema.parse(args);
46
+ assertWritableSheet(parsedArgs.sheetName, options.writableSheets);
47
+ const address = requireCellAddress(options.workpaper, parsedArgs.sheetName, parsedArgs.address);
48
+ const before = readWorkPaperRange(options.workpaper, proofRange);
49
+ const previousValue = options.workpaper.getCellSerialized(address);
50
+ options.workpaper.setCellContents(address, parsedArgs.value);
51
+ const after = readWorkPaperRange(options.workpaper, proofRange);
52
+ const saved = serializeWorkPaperDocument(exportWorkPaperDocument(options.workpaper, {
53
+ includeConfig: true,
54
+ }));
55
+ const restored = createWorkPaperFromDocument(parseWorkPaperDocument(saved));
56
+ const restoredReadback = readWorkPaperRange(restored, proofRange);
57
+ return {
58
+ editedCell: options.workpaper.simpleCellAddressToString(address, {
59
+ includeSheetName: true,
60
+ }),
61
+ before,
62
+ after,
63
+ restored: restoredReadback,
64
+ checks: {
65
+ previousValue,
66
+ newValue: options.workpaper.getCellSerialized(address),
67
+ formulasPersisted: sameJson(after.serialized, restoredReadback.serialized),
68
+ restoredMatchesAfter: sameJson(after.values, restoredReadback.values),
69
+ proofRangeChanged: !sameJson(before.values, after.values),
70
+ serializedBytes: Buffer.byteLength(saved, 'utf8'),
71
+ },
72
+ ...(options.includeSerializedDocument ? { serializedDocument: saved } : {}),
73
+ };
74
+ },
75
+ };
76
+ }
77
+ function readWorkPaperRange(workpaper, range) {
78
+ const parsedRange = workpaper.simpleCellRangeFromString(range, resolveDefaultSheet(workpaper));
79
+ if (parsedRange === undefined) {
80
+ throw new Error(`Invalid readable WorkPaper range: ${range}`);
81
+ }
82
+ return {
83
+ range,
84
+ values: workpaper.getRangeValues(parsedRange),
85
+ serialized: workpaper.getRangeSerialized(parsedRange),
86
+ };
87
+ }
88
+ function requireCellAddress(workpaper, sheetName, address) {
89
+ const sheetId = requireSheet(workpaper, sheetName);
90
+ const parsedAddress = workpaper.simpleCellAddressFromString(address, sheetId);
91
+ if (parsedAddress === undefined || parsedAddress.sheet !== sheetId) {
92
+ throw new Error(`Invalid WorkPaper address: ${sheetName}!${address}`);
93
+ }
94
+ return parsedAddress;
95
+ }
96
+ function requireSheet(workpaper, sheetName) {
97
+ const sheetId = workpaper.getSheetId(sheetName);
98
+ if (sheetId === undefined) {
99
+ throw new Error(`Expected sheet "${sheetName}" to exist`);
100
+ }
101
+ return sheetId;
102
+ }
103
+ function resolveDefaultSheet(workpaper) {
104
+ const firstSheetName = workpaper.getSheetNames()[0];
105
+ if (firstSheetName === undefined) {
106
+ throw new Error('Expected WorkPaper to contain at least one sheet');
107
+ }
108
+ return requireSheet(workpaper, firstSheetName);
109
+ }
110
+ function assertWritableSheet(sheetName, writableSheets) {
111
+ if (writableSheets !== undefined && !writableSheets.includes(sheetName)) {
112
+ throw new Error(`Sheet "${sheetName}" is not writable for this AI SDK tool`);
113
+ }
114
+ }
115
+ function sameJson(left, right) {
116
+ return JSON.stringify(left) === JSON.stringify(right);
117
+ }
118
+ //# sourceMappingURL=ai-sdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-sdk.js","sourceRoot":"","sources":["../src/ai-sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAA;AAE1I,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAA;AACzB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AA+CvB,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,wCAAwC,CAAC;IAC/E,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,KAAK,CAAC,qBAAqB,CAAC;SAC5B,QAAQ,CAAC,0DAA0D,CAAC;IACvE,KAAK,EAAE,CAAC;SACL,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;SACtD,QAAQ,CAAC,iGAAiG,CAAC;CAC/G,CAAC,CAAA;AAEF,MAAM,UAAU,yBAAyB,CAAC,OAAmC;IAC3E,MAAM,QAAQ,GAAG,2BAA2B,CAAC,OAAO,CAAC,CAAA;IACrD,MAAM,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,IAAI,eAAe,CAAA;IAEpE,OAAO;QACL,oBAAoB,EAAE,IAAI,CAAC;YACzB,WAAW,EAAE,8EAA8E;YAC3F,WAAW,E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,CAAC;AAED,SAAS,mBAAmB,CAAC,SAA4B;IACvD,MAAM,cAAc,GAAG,SAAS,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,CAAA;IACnD,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;IACrE,CAAC;IACD,OAAO,YAAY,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;AAChD,CAAC;AAED,SAAS,mBAAmB,CAAC,SAAiB,EAAE,cAA6C;IAC3F,IAAI,cAAc,KAAK,SAAS,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QACxE,MAAM,IAAI,KAAK,CAAC,UAAU,SAAS,wCAAwC,CAAC,CAAA;IAC9E,CAAC;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,IAAa,EAAE,KAAc;IAC7C,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AACvD,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,69 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { WorkPaper } from './index.js';
3
+ import { createWorkPaperToolHandlers } from './ai-sdk.js';
4
+ describe('@bilig/workpaper AI SDK handlers', () => {
5
+ it('edits a WorkPaper input and returns computed restore proof', () => {
6
+ const workpaper = WorkPaper.buildFromSheets({
7
+ Inputs: [
8
+ ['Metric', 'Value'],
9
+ ['Qualified opportunities', 20],
10
+ ['Win rate', 0.25],
11
+ ['Average ARR', 12000],
12
+ ],
13
+ Summary: [
14
+ ['Metric', 'Value'],
15
+ ['Expected customers', '=Inputs!B2*Inputs!B3'],
16
+ ['Expected ARR', '=B2*Inputs!B4'],
17
+ ],
18
+ });
19
+ const handlers = createWorkPaperToolHandlers({
20
+ workpaper,
21
+ defaultReadRange: 'Summary!A1:B3',
22
+ proofRange: 'Summary!A1:B3',
23
+ writableSheets: ['Inputs'],
24
+ });
25
+ const before = handlers.readWorkPaperSummary();
26
+ const write = handlers.setWorkPaperInputCell({
27
+ sheetName: 'Inputs',
28
+ address: 'B3',
29
+ value: 0.4,
30
+ });
31
+ expect(readNumber(before.values, 2, 1)).toBe(60000);
32
+ expect(write.editedCell).toBe('Inputs!B3');
33
+ expect(readNumber(write.after.values, 2, 1)).toBe(96000);
34
+ expect(readNumber(write.restored.values, 2, 1)).toBe(96000);
35
+ expect(write.checks).toMatchObject({
36
+ previousValue: 0.25,
37
+ newValue: 0.4,
38
+ formulasPersisted: true,
39
+ restoredMatchesAfter: true,
40
+ proofRangeChanged: true,
41
+ });
42
+ expect(write.checks.serializedBytes).toBeGreaterThan(100);
43
+ });
44
+ it('blocks writes outside the configured input sheet boundary', () => {
45
+ const workpaper = WorkPaper.buildFromSheets({
46
+ Inputs: [['Metric', 'Value']],
47
+ Summary: [['Metric', '=1+1']],
48
+ });
49
+ const handlers = createWorkPaperToolHandlers({
50
+ workpaper,
51
+ defaultReadRange: 'Summary!A1:B1',
52
+ proofRange: 'Summary!A1:B1',
53
+ writableSheets: ['Inputs'],
54
+ });
55
+ expect(() => handlers.setWorkPaperInputCell({
56
+ sheetName: 'Summary',
57
+ address: 'B1',
58
+ value: 3,
59
+ })).toThrow('Sheet "Summary" is not writable');
60
+ });
61
+ });
62
+ function readNumber(values, row, col) {
63
+ const cell = values[row]?.[col];
64
+ if (!cell || typeof cell !== 'object' || !('value' in cell) || typeof cell.value !== 'number') {
65
+ throw new Error(`Expected numeric cell at row ${row}, col ${col}; received ${JSON.stringify(cell)}`);
66
+ }
67
+ return Math.round(cell.value * 100) / 100;
68
+ }
69
+ //# sourceMappingURL=ai-sdk.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-sdk.test.js","sourceRoot":"","sources":["../src/ai-sdk.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA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AAE,CAAC,GAAG,CAAC,CAAA;IAC/B,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9F,MAAM,IAAI,KAAK,CAAC,gCAAgC,GAAG,SAAS,GAAG,cAAc,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACtG,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAA;AAC3C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bilig/workpaper",
3
- "version": "0.107.3",
3
+ "version": "0.119.0",
4
4
  "description": "Scoped Bilig WorkPaper runtime and MCP server for Node.js services, agent tools, and server-side spreadsheet formulas.",
5
5
  "keywords": [
6
6
  "agent-tools",
@@ -66,6 +66,11 @@
66
66
  "import": "./dist/index.js",
67
67
  "default": "./dist/index.js"
68
68
  },
69
+ "./ai-sdk": {
70
+ "types": "./dist/ai-sdk.d.ts",
71
+ "import": "./dist/ai-sdk.js",
72
+ "default": "./dist/ai-sdk.js"
73
+ },
69
74
  "./mcp": {
70
75
  "types": "./dist/mcp.d.ts",
71
76
  "import": "./dist/mcp.js",
@@ -84,8 +89,24 @@
84
89
  "build": "pnpm --dir ../.. --filter bilig-workpaper build && rm -rf dist tsconfig.tsbuildinfo && tsc -p tsconfig.json"
85
90
  },
86
91
  "dependencies": {
87
- "@bilig/headless": "0.107.3",
88
- "bilig-workpaper": "0.107.3"
92
+ "@bilig/headless": "0.119.0",
93
+ "bilig-workpaper": "0.119.0"
94
+ },
95
+ "devDependencies": {
96
+ "ai": "6.0.182",
97
+ "zod": "4.3.6"
98
+ },
99
+ "peerDependencies": {
100
+ "ai": ">=6.0.0",
101
+ "zod": ">=4.0.0"
102
+ },
103
+ "peerDependenciesMeta": {
104
+ "ai": {
105
+ "optional": true
106
+ },
107
+ "zod": {
108
+ "optional": true
109
+ }
89
110
  },
90
111
  "engines": {
91
112
  "node": ">=22.0.0"
package/server.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "io.github.proompteng/bilig-workpaper",
4
4
  "title": "Bilig WorkPaper",
5
5
  "description": "WorkPaper MCP tools, resources, and prompts for readback, edits, and JSON persistence.",
6
- "version": "0.107.3",
6
+ "version": "0.119.0",
7
7
  "repository": {
8
8
  "url": "https://github.com/proompteng/bilig",
9
9
  "source": "github"
@@ -18,7 +18,7 @@
18
18
  {
19
19
  "registryType": "npm",
20
20
  "identifier": "@bilig/workpaper",
21
- "version": "0.107.3",
21
+ "version": "0.119.0",
22
22
  "transport": {
23
23
  "type": "stdio"
24
24
  }