@bilig/headless 0.12.0 → 0.13.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/README.md +28 -9
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/work-paper-mcp-server.d.ts +84 -0
- package/dist/work-paper-mcp-server.js +379 -0
- package/dist/work-paper-mcp-server.js.map +1 -0
- package/dist/work-paper-mcp-stdio-bin.d.ts +2 -0
- package/dist/work-paper-mcp-stdio-bin.js +4 -0
- package/dist/work-paper-mcp-stdio-bin.js.map +1 -0
- package/dist/work-paper-mcp-stdio-server.d.ts +13 -0
- package/dist/work-paper-mcp-stdio-server.js +107 -0
- package/dist/work-paper-mcp-stdio-server.js.map +1 -0
- package/package.json +10 -5
- package/server.json +21 -0
package/README.md
CHANGED
|
@@ -50,29 +50,36 @@ before cloning the repository:
|
|
|
50
50
|
mkdir bilig-headless-sanity
|
|
51
51
|
cd bilig-headless-sanity
|
|
52
52
|
npm init -y
|
|
53
|
+
npm pkg set type=module
|
|
53
54
|
npm install @bilig/headless
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
npm install -D tsx typescript @types/node
|
|
56
|
+
cat > sanity.ts <<'EOF'
|
|
57
|
+
import { WorkPaper } from '@bilig/headless';
|
|
58
|
+
|
|
59
|
+
type NumericCell = {
|
|
60
|
+
value: number;
|
|
61
|
+
};
|
|
56
62
|
|
|
57
63
|
const workbook = WorkPaper.buildFromSheets({
|
|
58
64
|
Revenue: [
|
|
59
65
|
['Units', 'Price', 'Revenue'],
|
|
60
66
|
[7, 6, '=A2*B2'],
|
|
61
67
|
],
|
|
62
|
-
})
|
|
68
|
+
});
|
|
63
69
|
|
|
64
|
-
const sheet = workbook.getSheetId('Revenue')
|
|
70
|
+
const sheet = workbook.getSheetId('Revenue');
|
|
65
71
|
if (sheet === undefined) {
|
|
66
|
-
throw new Error('Revenue sheet was not created')
|
|
72
|
+
throw new Error('Revenue sheet was not created');
|
|
67
73
|
}
|
|
68
74
|
|
|
69
|
-
const cell = workbook.getCellValue({ sheet, row: 1, col: 2 })
|
|
70
|
-
if (typeof cell !== 'object' || cell === null || cell.value !== 42) {
|
|
71
|
-
throw new Error(`
|
|
75
|
+
const cell = workbook.getCellValue({ sheet, row: 1, col: 2 });
|
|
76
|
+
if (typeof cell !== 'object' || cell === null || (cell as NumericCell).value !== 42) {
|
|
77
|
+
throw new Error(`Unexpected formula readback: ${JSON.stringify(cell)}`);
|
|
72
78
|
}
|
|
73
79
|
|
|
74
|
-
console.log({ revenue: cell.value, verified: true })
|
|
80
|
+
console.log({ revenue: (cell as NumericCell).value, verified: true });
|
|
75
81
|
EOF
|
|
82
|
+
npx tsx sanity.ts
|
|
76
83
|
```
|
|
77
84
|
|
|
78
85
|
Expected output:
|
|
@@ -110,6 +117,8 @@ Pick the path that matches the job:
|
|
|
110
117
|
[`npm run agent:mcp-tools`](https://github.com/proompteng/bilig/tree/main/examples/headless-workpaper#mcp-tool-server-shape)
|
|
111
118
|
and the
|
|
112
119
|
[MCP spreadsheet tool server guide](https://proompteng.github.io/bilig/mcp-workpaper-tool-server.html).
|
|
120
|
+
- Run the packaged MCP stdio server:
|
|
121
|
+
`npm exec --package @bilig/headless -- bilig-workpaper-mcp`.
|
|
113
122
|
- Put WorkPaper behind HTTP:
|
|
114
123
|
[`examples/serverless-workpaper-api`](https://github.com/proompteng/bilig/tree/main/examples/serverless-workpaper-api).
|
|
115
124
|
- Compare engines before adopting:
|
|
@@ -403,6 +412,16 @@ inputs and structured formula readback.
|
|
|
403
412
|
JSON-RPC over stdin/stdout. The `mcp` keyword points to these runnable local
|
|
404
413
|
adapters: no hosted service, no API key, and no agent framework dependency.
|
|
405
414
|
|
|
415
|
+
The npm package also ships the same demo server as a stdio binary:
|
|
416
|
+
|
|
417
|
+
```sh
|
|
418
|
+
npm exec --package @bilig/headless -- bilig-workpaper-mcp
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
Its package metadata includes `mcpName: io.github.proompteng/bilig-workpaper`
|
|
422
|
+
and `server.json`, so the server can be published to MCP registries after the
|
|
423
|
+
runtime package version is released.
|
|
424
|
+
|
|
406
425
|
For a framework-neutral recipe that wraps WorkPaper operations as agent-callable
|
|
407
426
|
tools, see
|
|
408
427
|
[`docs/agent-workpaper-tool-calling-recipe.md`](https://github.com/proompteng/bilig/blob/main/docs/agent-workpaper-tool-calling-recipe.md).
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,4BAA4B,CAAA;AAC1C,cAAc,kCAAkC,CAAA"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { WorkPaper } from './work-paper.js';
|
|
2
|
+
import type { RawCellContent } from './work-paper-types.js';
|
|
3
|
+
type JsonObject = Record<string, unknown>;
|
|
4
|
+
type JsonRpcId = string | number | null;
|
|
5
|
+
interface JsonRpcRequest {
|
|
6
|
+
jsonrpc: '2.0';
|
|
7
|
+
id: JsonRpcId | undefined;
|
|
8
|
+
method: string;
|
|
9
|
+
params?: JsonObject;
|
|
10
|
+
}
|
|
11
|
+
interface JsonRpcSuccess<Result> {
|
|
12
|
+
jsonrpc: '2.0';
|
|
13
|
+
id: JsonRpcId | undefined;
|
|
14
|
+
result: Result;
|
|
15
|
+
}
|
|
16
|
+
interface WorkPaperMcpCapabilities {
|
|
17
|
+
tools: {
|
|
18
|
+
listChanged: false;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
interface WorkPaperMcpToolDefinition {
|
|
22
|
+
name: 'read_workpaper_summary' | 'set_workpaper_input_cell';
|
|
23
|
+
description: string;
|
|
24
|
+
inputSchema: JsonObject;
|
|
25
|
+
}
|
|
26
|
+
interface WorkPaperMcpToolsListResult {
|
|
27
|
+
tools: WorkPaperMcpToolDefinition[];
|
|
28
|
+
}
|
|
29
|
+
interface WorkPaperMcpToolCallResult {
|
|
30
|
+
content: {
|
|
31
|
+
type: 'text';
|
|
32
|
+
text: string;
|
|
33
|
+
}[];
|
|
34
|
+
structuredContent: WorkPaperSummaryReadback | WorkPaperInputEditReadback;
|
|
35
|
+
isError: false;
|
|
36
|
+
}
|
|
37
|
+
type WorkPaperMcpJsonRpcResponse = JsonRpcSuccess<WorkPaperMcpToolsListResult | WorkPaperMcpToolCallResult>;
|
|
38
|
+
interface WorkPaperMcpToolServer {
|
|
39
|
+
capabilities: WorkPaperMcpCapabilities;
|
|
40
|
+
handleJsonRpc(request: unknown): WorkPaperMcpJsonRpcResponse;
|
|
41
|
+
}
|
|
42
|
+
interface WorkPaperSummary {
|
|
43
|
+
expectedCustomers: number;
|
|
44
|
+
expectedArr: number;
|
|
45
|
+
expansionArr: number;
|
|
46
|
+
targetGap: number;
|
|
47
|
+
}
|
|
48
|
+
interface WorkPaperFormulaContracts {
|
|
49
|
+
expectedCustomers: string;
|
|
50
|
+
expectedArr: string;
|
|
51
|
+
expansionArr: string;
|
|
52
|
+
targetGap: string;
|
|
53
|
+
}
|
|
54
|
+
interface WorkPaperSummaryReadback {
|
|
55
|
+
range: string;
|
|
56
|
+
values: unknown[][];
|
|
57
|
+
serialized: RawCellContent[][];
|
|
58
|
+
}
|
|
59
|
+
interface WorkPaperInputEditReadback {
|
|
60
|
+
editedCell: string;
|
|
61
|
+
before: WorkPaperSummary;
|
|
62
|
+
after: WorkPaperSummary;
|
|
63
|
+
restored: WorkPaperSummary;
|
|
64
|
+
formulaContracts: WorkPaperFormulaContracts;
|
|
65
|
+
checks: {
|
|
66
|
+
previousValue: RawCellContent;
|
|
67
|
+
newValue: RawCellContent;
|
|
68
|
+
formulasPersisted: boolean;
|
|
69
|
+
restoredMatchesAfter: boolean;
|
|
70
|
+
expectedArrChanged: boolean;
|
|
71
|
+
serializedBytes: number;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
interface WorkPaperMcpDemoOutput {
|
|
75
|
+
capabilities: WorkPaperMcpCapabilities;
|
|
76
|
+
listResponse: JsonRpcSuccess<WorkPaperMcpToolsListResult>;
|
|
77
|
+
readResponse: JsonRpcSuccess<WorkPaperMcpToolCallResult>;
|
|
78
|
+
writeResponse: JsonRpcSuccess<WorkPaperMcpToolCallResult>;
|
|
79
|
+
}
|
|
80
|
+
declare function createWorkPaperMcpDemoOutput(): WorkPaperMcpDemoOutput;
|
|
81
|
+
declare function buildDemoWorkPaper(): WorkPaper;
|
|
82
|
+
declare function createWorkPaperMcpToolServer(workbook: WorkPaper): WorkPaperMcpToolServer;
|
|
83
|
+
declare function assertWorkPaperMcpDemoOutput(actual: WorkPaperMcpDemoOutput): void;
|
|
84
|
+
export { assertWorkPaperMcpDemoOutput, buildDemoWorkPaper, createWorkPaperMcpDemoOutput, createWorkPaperMcpToolServer, type JsonRpcId, type JsonRpcRequest, type WorkPaperInputEditReadback, type WorkPaperMcpCapabilities, type WorkPaperMcpJsonRpcResponse, type WorkPaperMcpToolCallResult, type WorkPaperMcpToolDefinition, type WorkPaperMcpToolServer, type WorkPaperMcpToolsListResult, type WorkPaperSummaryReadback, };
|
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
import { createWorkPaperFromDocument, exportWorkPaperDocument, parseWorkPaperDocument, serializeWorkPaperDocument } from './persistence.js';
|
|
2
|
+
import { WorkPaper } from './work-paper.js';
|
|
3
|
+
import { ValueTag } from '@bilig/protocol';
|
|
4
|
+
function createWorkPaperMcpDemoOutput() {
|
|
5
|
+
const server = createWorkPaperMcpToolServer(buildDemoWorkPaper());
|
|
6
|
+
const listResponse = server.handleJsonRpc({
|
|
7
|
+
jsonrpc: '2.0',
|
|
8
|
+
id: 1,
|
|
9
|
+
method: 'tools/list',
|
|
10
|
+
});
|
|
11
|
+
const readResponse = server.handleJsonRpc({
|
|
12
|
+
jsonrpc: '2.0',
|
|
13
|
+
id: 2,
|
|
14
|
+
method: 'tools/call',
|
|
15
|
+
params: {
|
|
16
|
+
name: 'read_workpaper_summary',
|
|
17
|
+
arguments: {
|
|
18
|
+
range: 'Summary!A1:B5',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
const writeResponse = server.handleJsonRpc({
|
|
23
|
+
jsonrpc: '2.0',
|
|
24
|
+
id: 3,
|
|
25
|
+
method: 'tools/call',
|
|
26
|
+
params: {
|
|
27
|
+
name: 'set_workpaper_input_cell',
|
|
28
|
+
arguments: {
|
|
29
|
+
sheetName: 'Inputs',
|
|
30
|
+
address: 'B3',
|
|
31
|
+
value: 0.4,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
return {
|
|
36
|
+
capabilities: server.capabilities,
|
|
37
|
+
listResponse: requireToolsListResponse(listResponse),
|
|
38
|
+
readResponse: requireToolCallResponse(readResponse, 'read_workpaper_summary'),
|
|
39
|
+
writeResponse: requireToolCallResponse(writeResponse, 'set_workpaper_input_cell'),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function buildDemoWorkPaper() {
|
|
43
|
+
return WorkPaper.buildFromSheets({
|
|
44
|
+
Inputs: [
|
|
45
|
+
['Metric', 'Value'],
|
|
46
|
+
['Qualified opportunities', 20],
|
|
47
|
+
['Win rate', 0.25],
|
|
48
|
+
['Average ARR', 12000],
|
|
49
|
+
['Expansion multiplier', 1.1],
|
|
50
|
+
],
|
|
51
|
+
Summary: [
|
|
52
|
+
['Metric', 'Value'],
|
|
53
|
+
['Expected customers', '=Inputs!B2*Inputs!B3'],
|
|
54
|
+
['Expected ARR', '=B2*Inputs!B4'],
|
|
55
|
+
['Expansion ARR', '=B3*Inputs!B5'],
|
|
56
|
+
['Target gap', '=B4-100000'],
|
|
57
|
+
],
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function createWorkPaperMcpToolServer(workbook) {
|
|
61
|
+
const workPaperTools = createWorkPaperTools(workbook);
|
|
62
|
+
const toolDefinitions = [
|
|
63
|
+
{
|
|
64
|
+
name: 'read_workpaper_summary',
|
|
65
|
+
description: 'Read computed WorkPaper summary values for a small range.',
|
|
66
|
+
inputSchema: {
|
|
67
|
+
type: 'object',
|
|
68
|
+
properties: {
|
|
69
|
+
range: {
|
|
70
|
+
type: 'string',
|
|
71
|
+
description: 'A1 range with an optional sheet name.',
|
|
72
|
+
default: 'Summary!A1:B5',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
additionalProperties: false,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'set_workpaper_input_cell',
|
|
80
|
+
description: 'Set one validated WorkPaper input cell and return formula readback.',
|
|
81
|
+
inputSchema: {
|
|
82
|
+
type: 'object',
|
|
83
|
+
required: ['sheetName', 'address', 'value'],
|
|
84
|
+
properties: {
|
|
85
|
+
sheetName: {
|
|
86
|
+
type: 'string',
|
|
87
|
+
const: 'Inputs',
|
|
88
|
+
},
|
|
89
|
+
address: {
|
|
90
|
+
type: 'string',
|
|
91
|
+
description: 'A1 cell address in the Inputs sheet.',
|
|
92
|
+
},
|
|
93
|
+
value: {
|
|
94
|
+
type: ['string', 'number', 'boolean', 'null'],
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
additionalProperties: false,
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
];
|
|
101
|
+
return {
|
|
102
|
+
capabilities: {
|
|
103
|
+
tools: {
|
|
104
|
+
listChanged: false,
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
handleJsonRpc(request) {
|
|
108
|
+
const parsedRequest = parseJsonRpcRequest(request);
|
|
109
|
+
if (parsedRequest.method === 'tools/list') {
|
|
110
|
+
return {
|
|
111
|
+
jsonrpc: '2.0',
|
|
112
|
+
id: parsedRequest.id,
|
|
113
|
+
result: {
|
|
114
|
+
tools: toolDefinitions,
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
if (parsedRequest.method === 'tools/call') {
|
|
119
|
+
const structuredContent = callTool(workPaperTools, parsedRequest.params);
|
|
120
|
+
return {
|
|
121
|
+
jsonrpc: '2.0',
|
|
122
|
+
id: parsedRequest.id,
|
|
123
|
+
result: {
|
|
124
|
+
content: [
|
|
125
|
+
{
|
|
126
|
+
type: 'text',
|
|
127
|
+
text: JSON.stringify(structuredContent),
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
structuredContent,
|
|
131
|
+
isError: false,
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
throw new Error(`Unsupported MCP method: ${parsedRequest.method}`);
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
function callTool(workPaperTools, params) {
|
|
140
|
+
const parsedParams = requireRecord(params ?? {}, 'MCP tool call params');
|
|
141
|
+
const toolName = parsedParams['name'];
|
|
142
|
+
const args = parsedParams['arguments'];
|
|
143
|
+
if (toolName === 'read_workpaper_summary') {
|
|
144
|
+
const readArgs = requireRecord(args ?? {}, 'read_workpaper_summary arguments');
|
|
145
|
+
const range = readArgs['range'];
|
|
146
|
+
return workPaperTools.readWorkPaperSummary(range === undefined ? undefined : requireString(range, 'range'));
|
|
147
|
+
}
|
|
148
|
+
if (toolName === 'set_workpaper_input_cell') {
|
|
149
|
+
return workPaperTools.setWorkPaperInputCell(parseInputCellArgs(args));
|
|
150
|
+
}
|
|
151
|
+
throw new Error(`Unknown WorkPaper tool: ${String(toolName)}`);
|
|
152
|
+
}
|
|
153
|
+
function createWorkPaperTools(workbook) {
|
|
154
|
+
const summarySheet = requireSheet(workbook, 'Summary');
|
|
155
|
+
return {
|
|
156
|
+
readWorkPaperSummary(range = 'Summary!A1:B5') {
|
|
157
|
+
const parsedRange = workbook.simpleCellRangeFromString(range, summarySheet);
|
|
158
|
+
if (parsedRange === undefined) {
|
|
159
|
+
throw new Error(`Invalid readable range: ${range}`);
|
|
160
|
+
}
|
|
161
|
+
return {
|
|
162
|
+
range,
|
|
163
|
+
values: workbook.getRangeValues(parsedRange),
|
|
164
|
+
serialized: workbook.getRangeSerialized(parsedRange),
|
|
165
|
+
};
|
|
166
|
+
},
|
|
167
|
+
setWorkPaperInputCell({ sheetName, address, value }) {
|
|
168
|
+
const target = requireCellAddress(workbook, sheetName, address);
|
|
169
|
+
const before = readSummary(workbook, summarySheet);
|
|
170
|
+
const formulaContracts = readFormulaContracts(workbook, summarySheet);
|
|
171
|
+
const previousValue = workbook.getCellSerialized(target);
|
|
172
|
+
workbook.setCellContents(target, value);
|
|
173
|
+
const after = readSummary(workbook, summarySheet);
|
|
174
|
+
const serialized = serializeWorkbook(workbook);
|
|
175
|
+
const restored = createWorkPaperFromDocument(parseWorkPaperDocument(serialized));
|
|
176
|
+
const restoredSummarySheet = requireSheet(restored, 'Summary');
|
|
177
|
+
const restoredSummary = readSummary(restored, restoredSummarySheet);
|
|
178
|
+
const restoredFormulaContracts = readFormulaContracts(restored, restoredSummarySheet);
|
|
179
|
+
return {
|
|
180
|
+
editedCell: workbook.simpleCellAddressToString(target, {
|
|
181
|
+
includeSheetName: true,
|
|
182
|
+
}),
|
|
183
|
+
before,
|
|
184
|
+
after,
|
|
185
|
+
restored: restoredSummary,
|
|
186
|
+
formulaContracts,
|
|
187
|
+
checks: {
|
|
188
|
+
previousValue,
|
|
189
|
+
newValue: workbook.getCellSerialized(target),
|
|
190
|
+
formulasPersisted: sameJson(formulaContracts, restoredFormulaContracts),
|
|
191
|
+
restoredMatchesAfter: sameJson(after, restoredSummary),
|
|
192
|
+
expectedArrChanged: after.expectedArr > before.expectedArr,
|
|
193
|
+
serializedBytes: Buffer.byteLength(serialized, 'utf8'),
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
function parseJsonRpcRequest(value) {
|
|
200
|
+
const request = requireRecord(value, 'JSON-RPC request');
|
|
201
|
+
if (request['jsonrpc'] !== '2.0' || typeof request['method'] !== 'string') {
|
|
202
|
+
throw new Error('Expected JSON-RPC 2.0 request');
|
|
203
|
+
}
|
|
204
|
+
const id = request['id'];
|
|
205
|
+
if (id !== undefined && id !== null && typeof id !== 'string' && typeof id !== 'number') {
|
|
206
|
+
throw new Error(`Unsupported JSON-RPC id: ${JSON.stringify(id)}`);
|
|
207
|
+
}
|
|
208
|
+
const parsed = {
|
|
209
|
+
jsonrpc: '2.0',
|
|
210
|
+
id,
|
|
211
|
+
method: request['method'],
|
|
212
|
+
};
|
|
213
|
+
const params = request['params'];
|
|
214
|
+
if (params !== undefined) {
|
|
215
|
+
parsed.params = requireRecord(params, 'JSON-RPC params');
|
|
216
|
+
}
|
|
217
|
+
return parsed;
|
|
218
|
+
}
|
|
219
|
+
function parseInputCellArgs(value) {
|
|
220
|
+
const args = requireRecord(value, 'set_workpaper_input_cell arguments');
|
|
221
|
+
const sheetName = requireString(args['sheetName'], 'sheetName');
|
|
222
|
+
if (sheetName !== 'Inputs') {
|
|
223
|
+
throw new Error(`This example only permits Inputs edits, received ${sheetName}`);
|
|
224
|
+
}
|
|
225
|
+
const cellValue = args['value'];
|
|
226
|
+
if (cellValue !== null && typeof cellValue !== 'string' && typeof cellValue !== 'number' && typeof cellValue !== 'boolean') {
|
|
227
|
+
throw new Error(`Unsupported cell value: ${JSON.stringify(cellValue)}`);
|
|
228
|
+
}
|
|
229
|
+
return {
|
|
230
|
+
sheetName,
|
|
231
|
+
address: requireString(args['address'], 'address'),
|
|
232
|
+
value: cellValue,
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
function requireRecord(value, label) {
|
|
236
|
+
if (!isRecord(value)) {
|
|
237
|
+
throw new Error(`Expected ${label} to be an object`);
|
|
238
|
+
}
|
|
239
|
+
return value;
|
|
240
|
+
}
|
|
241
|
+
function requireString(value, label) {
|
|
242
|
+
if (typeof value !== 'string') {
|
|
243
|
+
throw new Error(`Expected ${label} to be a string`);
|
|
244
|
+
}
|
|
245
|
+
return value;
|
|
246
|
+
}
|
|
247
|
+
function requireSheet(workpaper, sheetName) {
|
|
248
|
+
const sheetId = workpaper.getSheetId(sheetName);
|
|
249
|
+
if (sheetId === undefined) {
|
|
250
|
+
throw new Error(`Expected sheet "${sheetName}" to exist`);
|
|
251
|
+
}
|
|
252
|
+
return sheetId;
|
|
253
|
+
}
|
|
254
|
+
function requireCellAddress(workpaper, sheetName, a1Address) {
|
|
255
|
+
const sheetId = requireSheet(workpaper, sheetName);
|
|
256
|
+
const parsed = workpaper.simpleCellAddressFromString(a1Address, sheetId);
|
|
257
|
+
if (parsed === undefined || parsed.sheet !== sheetId) {
|
|
258
|
+
throw new Error(`Invalid cell address: ${sheetName}!${a1Address}`);
|
|
259
|
+
}
|
|
260
|
+
return parsed;
|
|
261
|
+
}
|
|
262
|
+
function readSummary(workpaper, summary) {
|
|
263
|
+
return {
|
|
264
|
+
expectedCustomers: readNumber(workpaper, summary, 1, 1, 'expected customers'),
|
|
265
|
+
expectedArr: readNumber(workpaper, summary, 2, 1, 'expected ARR'),
|
|
266
|
+
expansionArr: readNumber(workpaper, summary, 3, 1, 'expansion ARR'),
|
|
267
|
+
targetGap: readNumber(workpaper, summary, 4, 1, 'target gap'),
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
function readFormulaContracts(workpaper, summary) {
|
|
271
|
+
return {
|
|
272
|
+
expectedCustomers: readFormula(workpaper, summary, 1, 1, 'expected customers'),
|
|
273
|
+
expectedArr: readFormula(workpaper, summary, 2, 1, 'expected ARR'),
|
|
274
|
+
expansionArr: readFormula(workpaper, summary, 3, 1, 'expansion ARR'),
|
|
275
|
+
targetGap: readFormula(workpaper, summary, 4, 1, 'target gap'),
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
function readNumber(workpaper, sheet, row, col, label) {
|
|
279
|
+
const cell = workpaper.getCellValue({ sheet, row, col });
|
|
280
|
+
if (cell.tag !== ValueTag.Number) {
|
|
281
|
+
throw new Error(`Expected ${label} to be numeric, received ${JSON.stringify(cell)}`);
|
|
282
|
+
}
|
|
283
|
+
return Math.round(cell.value * 100) / 100;
|
|
284
|
+
}
|
|
285
|
+
function readFormula(workpaper, sheet, row, col, label) {
|
|
286
|
+
const formula = workpaper.getCellFormula({ sheet, row, col });
|
|
287
|
+
if (formula === undefined) {
|
|
288
|
+
throw new Error(`Expected ${label} to be a formula`);
|
|
289
|
+
}
|
|
290
|
+
return formula;
|
|
291
|
+
}
|
|
292
|
+
function serializeWorkbook(workpaper) {
|
|
293
|
+
return serializeWorkPaperDocument(exportWorkPaperDocument(workpaper, {
|
|
294
|
+
includeConfig: true,
|
|
295
|
+
}));
|
|
296
|
+
}
|
|
297
|
+
function sameJson(left, right) {
|
|
298
|
+
return JSON.stringify(left) === JSON.stringify(right);
|
|
299
|
+
}
|
|
300
|
+
function isRecord(value) {
|
|
301
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
302
|
+
}
|
|
303
|
+
function requireToolsListResponse(response) {
|
|
304
|
+
const result = response.result;
|
|
305
|
+
if (!isToolsListResult(result)) {
|
|
306
|
+
throw new Error(`Expected tools/list response, received ${JSON.stringify(response)}`);
|
|
307
|
+
}
|
|
308
|
+
return {
|
|
309
|
+
jsonrpc: response.jsonrpc,
|
|
310
|
+
id: response.id,
|
|
311
|
+
result,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
function requireToolCallResponse(response, toolName) {
|
|
315
|
+
const result = response.result;
|
|
316
|
+
if (!isToolCallResult(result)) {
|
|
317
|
+
throw new Error(`Expected ${toolName} tool-call response, received ${JSON.stringify(response)}`);
|
|
318
|
+
}
|
|
319
|
+
return {
|
|
320
|
+
jsonrpc: response.jsonrpc,
|
|
321
|
+
id: response.id,
|
|
322
|
+
result,
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
function isToolsListResult(result) {
|
|
326
|
+
return isRecord(result) && Array.isArray(result['tools']);
|
|
327
|
+
}
|
|
328
|
+
function isToolCallResult(result) {
|
|
329
|
+
return isRecord(result) && Array.isArray(result['content']) && result['isError'] === false && isRecord(result['structuredContent']);
|
|
330
|
+
}
|
|
331
|
+
function assertWorkPaperMcpDemoOutput(actual) {
|
|
332
|
+
const toolNames = actual.listResponse.result.tools.map((tool) => tool.name);
|
|
333
|
+
if (!sameJson(toolNames, ['read_workpaper_summary', 'set_workpaper_input_cell'])) {
|
|
334
|
+
throw new Error(`Unexpected MCP tool list: ${JSON.stringify(toolNames)}`);
|
|
335
|
+
}
|
|
336
|
+
const writeResult = actual.writeResponse.result.structuredContent;
|
|
337
|
+
if (!isInputEditReadback(writeResult)) {
|
|
338
|
+
throw new Error(`Unexpected MCP write result: ${JSON.stringify(writeResult)}`);
|
|
339
|
+
}
|
|
340
|
+
const expectedBefore = {
|
|
341
|
+
expectedCustomers: 5,
|
|
342
|
+
expectedArr: 60000,
|
|
343
|
+
expansionArr: 66000,
|
|
344
|
+
targetGap: -34000,
|
|
345
|
+
};
|
|
346
|
+
const expectedAfter = {
|
|
347
|
+
expectedCustomers: 8,
|
|
348
|
+
expectedArr: 96000,
|
|
349
|
+
expansionArr: 105600,
|
|
350
|
+
targetGap: 5600,
|
|
351
|
+
};
|
|
352
|
+
const expectedFormulaContracts = {
|
|
353
|
+
expectedCustomers: '=Inputs!B2*Inputs!B3',
|
|
354
|
+
expectedArr: '=B2*Inputs!B4',
|
|
355
|
+
expansionArr: '=B3*Inputs!B5',
|
|
356
|
+
targetGap: '=B4-100000',
|
|
357
|
+
};
|
|
358
|
+
if (actual.capabilities.tools.listChanged ||
|
|
359
|
+
actual.readResponse.result.content[0]?.type !== 'text' ||
|
|
360
|
+
actual.writeResponse.result.content[0]?.type !== 'text' ||
|
|
361
|
+
writeResult.editedCell !== 'Inputs!B3' ||
|
|
362
|
+
!sameJson(writeResult.before, expectedBefore) ||
|
|
363
|
+
!sameJson(writeResult.after, expectedAfter) ||
|
|
364
|
+
!sameJson(writeResult.restored, expectedAfter) ||
|
|
365
|
+
!sameJson(writeResult.formulaContracts, expectedFormulaContracts) ||
|
|
366
|
+
writeResult.checks.previousValue !== 0.25 ||
|
|
367
|
+
writeResult.checks.newValue !== 0.4 ||
|
|
368
|
+
!writeResult.checks.formulasPersisted ||
|
|
369
|
+
!writeResult.checks.restoredMatchesAfter ||
|
|
370
|
+
!writeResult.checks.expectedArrChanged ||
|
|
371
|
+
writeResult.checks.serializedBytes <= 0) {
|
|
372
|
+
throw new Error(`Unexpected MCP adapter result: ${JSON.stringify(actual)}`);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
function isInputEditReadback(value) {
|
|
376
|
+
return 'editedCell' in value;
|
|
377
|
+
}
|
|
378
|
+
export { assertWorkPaperMcpDemoOutput, buildDemoWorkPaper, createWorkPaperMcpDemoOutput, createWorkPaperMcpToolServer, };
|
|
379
|
+
//# sourceMappingURL=work-paper-mcp-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"work-paper-mcp-server.js","sourceRoot":"","sources":["../src/work-paper-mcp-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAA;AAC3I,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAmG1C,SAAS,4BAA4B;IACnC,MAAM,MAAM,GAAG,4BAA4B,CAAC,kBAAkB,EAAE,CAAC,CAAA;IACjE,MAAM,YAAY,GAAG,MAAM,CAAC,aAAa,CAAC;QACxC,OAAO,EAAE,KAAK;QACd,EAAE,EAAE,CAAC;QACL,MAAM,EAAE,YAAY;KACrB,CAAC,CAAA;IAC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CAAC,MAAM,CAAC,eAAe,IAAI,CAAC,EACvC,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,kCAAkC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IAC7E,CAAC;AACH,CAAC;AAED,SAAS,mBAAmB,CAAC,KAA4D;IACvF,OAAO,YAAY,IAAI,KAAK,CAAA;AAC9B,CAAC;AAED,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,EAClB,4BAA4B,EAC5B,4BAA4B,GAW7B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"work-paper-mcp-stdio-bin.js","sourceRoot":"","sources":["../src/work-paper-mcp-stdio-bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAA;AAEjF,8BAA8B,EAAE,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type WorkPaperMcpToolServer } from './work-paper-mcp-server.js';
|
|
2
|
+
import type { WorkPaper } from './work-paper.js';
|
|
3
|
+
import type { Readable, Writable } from 'node:stream';
|
|
4
|
+
interface WorkPaperMcpStdioOptions {
|
|
5
|
+
input?: Readable;
|
|
6
|
+
output?: Writable;
|
|
7
|
+
server?: WorkPaperMcpToolServer;
|
|
8
|
+
workbook?: WorkPaper;
|
|
9
|
+
serverName?: string;
|
|
10
|
+
serverVersion?: string;
|
|
11
|
+
}
|
|
12
|
+
declare function runDemoWorkPaperMcpStdioServer(options?: WorkPaperMcpStdioOptions): void;
|
|
13
|
+
export { runDemoWorkPaperMcpStdioServer, type WorkPaperMcpStdioOptions };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { buildDemoWorkPaper, createWorkPaperMcpToolServer } from './work-paper-mcp-server.js';
|
|
2
|
+
function runDemoWorkPaperMcpStdioServer(options = {}) {
|
|
3
|
+
const input = options.input ?? process.stdin;
|
|
4
|
+
const output = options.output ?? process.stdout;
|
|
5
|
+
const server = options.server ?? createWorkPaperMcpToolServer(options.workbook ?? buildDemoWorkPaper());
|
|
6
|
+
const serverName = options.serverName ?? 'bilig-headless-workpaper';
|
|
7
|
+
const serverVersion = options.serverVersion ?? '0.1.0';
|
|
8
|
+
let inputBuffer = '';
|
|
9
|
+
input.setEncoding('utf8');
|
|
10
|
+
input.on('data', (chunk) => {
|
|
11
|
+
inputBuffer += chunk;
|
|
12
|
+
drainInputLines(false);
|
|
13
|
+
});
|
|
14
|
+
input.on('end', () => {
|
|
15
|
+
drainInputLines(true);
|
|
16
|
+
});
|
|
17
|
+
function drainInputLines(flush) {
|
|
18
|
+
let newlineIndex = inputBuffer.indexOf('\n');
|
|
19
|
+
while (newlineIndex !== -1) {
|
|
20
|
+
const line = inputBuffer.slice(0, newlineIndex).trim();
|
|
21
|
+
inputBuffer = inputBuffer.slice(newlineIndex + 1);
|
|
22
|
+
if (line.length > 0) {
|
|
23
|
+
handleLine(line);
|
|
24
|
+
}
|
|
25
|
+
newlineIndex = inputBuffer.indexOf('\n');
|
|
26
|
+
}
|
|
27
|
+
const trailingLine = inputBuffer.trim();
|
|
28
|
+
if (flush && trailingLine.length > 0) {
|
|
29
|
+
inputBuffer = '';
|
|
30
|
+
handleLine(trailingLine);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function handleLine(line) {
|
|
34
|
+
let request;
|
|
35
|
+
try {
|
|
36
|
+
request = JSON.parse(line);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
writeJsonRpcError(null, -32700, `Parse error: ${errorMessage(error)}`);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (!isJsonRpcRequest(request)) {
|
|
43
|
+
const id = isRecord(request) ? request['id'] : null;
|
|
44
|
+
writeJsonRpcError(isJsonRpcId(id) ? id : null, -32600, 'Invalid JSON-RPC 2.0 request');
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
const response = dispatchJsonRpc(request);
|
|
49
|
+
if (response !== undefined) {
|
|
50
|
+
writeJson(response);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
writeJsonRpcError(request.id ?? null, -32603, errorMessage(error));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function dispatchJsonRpc(request) {
|
|
58
|
+
if (request.method === 'initialize') {
|
|
59
|
+
return {
|
|
60
|
+
jsonrpc: '2.0',
|
|
61
|
+
id: request.id,
|
|
62
|
+
result: {
|
|
63
|
+
protocolVersion: '2025-06-18',
|
|
64
|
+
capabilities: server.capabilities,
|
|
65
|
+
serverInfo: {
|
|
66
|
+
name: serverName,
|
|
67
|
+
version: serverVersion,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
if (request.method === 'notifications/initialized' || request.id === undefined) {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
return server.handleJsonRpc(request);
|
|
76
|
+
}
|
|
77
|
+
function writeJsonRpcError(id, code, message) {
|
|
78
|
+
writeJson({
|
|
79
|
+
jsonrpc: '2.0',
|
|
80
|
+
id,
|
|
81
|
+
error: {
|
|
82
|
+
code,
|
|
83
|
+
message,
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function writeJson(value) {
|
|
88
|
+
output.write(`${JSON.stringify(value)}\n`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function isJsonRpcRequest(value) {
|
|
92
|
+
if (!isRecord(value) || value['jsonrpc'] !== '2.0' || typeof value['method'] !== 'string') {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
return value['id'] === undefined || isJsonRpcId(value['id']);
|
|
96
|
+
}
|
|
97
|
+
function isJsonRpcId(value) {
|
|
98
|
+
return value === null || typeof value === 'string' || typeof value === 'number';
|
|
99
|
+
}
|
|
100
|
+
function isRecord(value) {
|
|
101
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
102
|
+
}
|
|
103
|
+
function errorMessage(error) {
|
|
104
|
+
return error instanceof Error ? error.message : String(error);
|
|
105
|
+
}
|
|
106
|
+
export { runDemoWorkPaperMcpStdioServer };
|
|
107
|
+
//# sourceMappingURL=work-paper-mcp-stdio-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"work-paper-mcp-stdio-server.js","sourceRoot":"","sources":["../src/work-paper-mcp-stdio-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,4BAA4B,EAA+B,MAAM,4BAA4B,CAAA;AAa1H,SAAS,8BAA8B,CAAC,UAAoC,EAAE;IAC5E,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,CAAA;IAC5C,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAA;IAC/C,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,4BAA4B,CAAC,OAAO,CAAC,QAAQ,IAAI,kBAAkB,EAAE,CAAC,CAAA;IACvG,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,0BAA0B,CAAA;IACnE,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,OAAO,CAAA;IACtD,IAAI,WAAW,GAAG,EAAE,CAAA;IAEpB,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;IACzB,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE;QACjC,WAAW,IAAI,KAAK,CAAA;QACpB,eAAe,CAAC,KAAK,CAAC,CAAA;IACxB,CAAC,CAAC,CAAA;IACF,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;QACnB,eAAe,CAAC,IAAI,CAAC,CAAA;IACvB,CAAC,CAAC,CAAA;IAEF,SAAS,eAAe,CAAC,KAAc;QACrC,IAAI,YAAY,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,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AS,gBAAgB,CAAC,KAAc;IACtC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,SAAS,CAAC,KAAK,KAAK,IAAI,OAAO,KAAK,CAAC,QAAQ,CAAC,KAAK,QAAQ,EAAE,CAAC;QAC1F,OAAO,KAAK,CAAA;IACd,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,SAAS,IAAI,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;AAC9D,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IACjC,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAA;AACjF,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;AAC7E,CAAC;AAED,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC/D,CAAC;AAED,OAAO,EAAE,8BAA8B,EAAiC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bilig/headless",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Headless spreadsheet engine for Node.js formulas, agent tools, workbook JSON persistence, and service-side spreadsheet automation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -57,8 +57,12 @@
|
|
|
57
57
|
"url": "git+https://github.com/proompteng/bilig.git",
|
|
58
58
|
"directory": "packages/headless"
|
|
59
59
|
},
|
|
60
|
+
"bin": {
|
|
61
|
+
"bilig-workpaper-mcp": "./dist/work-paper-mcp-stdio-bin.js"
|
|
62
|
+
},
|
|
60
63
|
"files": [
|
|
61
64
|
"dist",
|
|
65
|
+
"server.json",
|
|
62
66
|
"README.md",
|
|
63
67
|
"LICENSE"
|
|
64
68
|
],
|
|
@@ -79,11 +83,12 @@
|
|
|
79
83
|
"build": "rm -rf dist tsconfig.tsbuildinfo && tsc -p tsconfig.json"
|
|
80
84
|
},
|
|
81
85
|
"dependencies": {
|
|
82
|
-
"@bilig/core": "0.
|
|
83
|
-
"@bilig/formula": "0.
|
|
84
|
-
"@bilig/protocol": "0.
|
|
86
|
+
"@bilig/core": "0.13.0",
|
|
87
|
+
"@bilig/formula": "0.13.0",
|
|
88
|
+
"@bilig/protocol": "0.13.0"
|
|
85
89
|
},
|
|
86
90
|
"engines": {
|
|
87
91
|
"node": ">=24.0.0"
|
|
88
|
-
}
|
|
92
|
+
},
|
|
93
|
+
"mcpName": "io.github.proompteng/bilig-workpaper"
|
|
89
94
|
}
|
package/server.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.proompteng/bilig-workpaper",
|
|
4
|
+
"title": "Bilig WorkPaper",
|
|
5
|
+
"description": "Headless spreadsheet WorkPaper tools for formula-backed workbook readback, validated input edits, and JSON persistence.",
|
|
6
|
+
"version": "0.1.95",
|
|
7
|
+
"repository": {
|
|
8
|
+
"url": "https://github.com/proompteng/bilig",
|
|
9
|
+
"source": "github"
|
|
10
|
+
},
|
|
11
|
+
"packages": [
|
|
12
|
+
{
|
|
13
|
+
"registryType": "npm",
|
|
14
|
+
"identifier": "@bilig/headless",
|
|
15
|
+
"version": "0.1.95",
|
|
16
|
+
"transport": {
|
|
17
|
+
"type": "stdio"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|