@tiwater/office-mcp 0.19.1 → 0.20.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.
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"type": "integer",
|
|
28
28
|
"minimum": 0,
|
|
29
29
|
"maximum": 9007199254740991,
|
|
30
|
-
"description": "Zero-based row offset.
|
|
30
|
+
"description": "Zero-based row offset. Process each returned compact page once and continue from receipt.nextOffset; do not revisit an earlier offset."
|
|
31
31
|
},
|
|
32
32
|
"output": {
|
|
33
33
|
"type": "string",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"schema": "tiwater.office-provider-contract-manifest/v1",
|
|
3
3
|
"provider": {
|
|
4
4
|
"id": "@tiwater/office-mcp",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.20.0"
|
|
6
6
|
},
|
|
7
7
|
"tools": [
|
|
8
8
|
{
|
|
@@ -152,11 +152,11 @@
|
|
|
152
152
|
"name": "docx_read_table",
|
|
153
153
|
"providerContract": {
|
|
154
154
|
"source": "packages/docx-cli/contracts/mcp-input/docx_read_table.schema.json",
|
|
155
|
-
"sha256": "
|
|
155
|
+
"sha256": "71e8461f5dd9522714eb832dc01d04c324f03f4deb9d2291686f4c531a68087c"
|
|
156
156
|
},
|
|
157
157
|
"inputContract": {
|
|
158
158
|
"path": "office/contracts/docx_read_table.schema.json",
|
|
159
|
-
"sha256": "
|
|
159
|
+
"sha256": "71e8461f5dd9522714eb832dc01d04c324f03f4deb9d2291686f4c531a68087c"
|
|
160
160
|
}
|
|
161
161
|
},
|
|
162
162
|
{
|
package/office/index.mjs
CHANGED
|
@@ -246,14 +246,14 @@ const docxTableIndexOutput = artifactOutput('docx_table_index').extend({
|
|
|
246
246
|
}).strict();
|
|
247
247
|
|
|
248
248
|
const docxTableReadOutput = artifactOutput('docx_read_table').extend({
|
|
249
|
-
schema: z.literal('tiwater.docx-table-
|
|
249
|
+
schema: z.literal('tiwater.docx-table-page/v1'),
|
|
250
250
|
receipt: z.object({
|
|
251
|
-
schema: z.literal('tiwater.docx-table-
|
|
251
|
+
schema: z.literal('tiwater.docx-table-page-receipt/v1'),
|
|
252
252
|
totalRowCount: z.number().int().nonnegative(),
|
|
253
253
|
returnedRowCount: z.number().int().nonnegative(),
|
|
254
254
|
remaining: z.number().int().nonnegative(),
|
|
255
255
|
nextOffset: z.number().int().nonnegative().nullable(),
|
|
256
|
-
|
|
256
|
+
detailPageRetained: z.literal(true),
|
|
257
257
|
narrowingRequired: z.boolean(),
|
|
258
258
|
}).strict(),
|
|
259
259
|
address: docxAddress,
|
|
@@ -285,14 +285,7 @@ const docxTableReadOutput = artifactOutput('docx_read_table').extend({
|
|
|
285
285
|
gridSpan: z.number().int().positive(),
|
|
286
286
|
verticalMerge: z.string().nullable(),
|
|
287
287
|
verticalMergeOwner: docxAddress.nullable(),
|
|
288
|
-
|
|
289
|
-
address: docxAddress,
|
|
290
|
-
text: z.string(),
|
|
291
|
-
textNodes: z.array(z.object({
|
|
292
|
-
address: docxAddress,
|
|
293
|
-
text: z.string(),
|
|
294
|
-
}).strict()),
|
|
295
|
-
}).strict()),
|
|
288
|
+
text: z.string(),
|
|
296
289
|
}).strict()),
|
|
297
290
|
}).strict()),
|
|
298
291
|
}).strict();
|
|
@@ -343,7 +336,7 @@ const tools = [
|
|
|
343
336
|
},
|
|
344
337
|
{
|
|
345
338
|
name: 'docx_read_table',
|
|
346
|
-
description: 'Read exactly one table selected from docx_table_index by native OpenXML address.
|
|
339
|
+
description: 'Read exactly one table selected from docx_table_index by native OpenXML address. Each call retains full paragraph and text-node detail for exactly the returned row page at output; it never builds another whole-table data object. The machine response is the compact form of that page: each row and cell keeps its reusable native address, grid position and span, vertical-merge owner, and joined text. In a vertical merge, restart begins one logical cell and a continue cell is not an independent row value. Process the current page before continuing once with receipt.nextOffset; never revisit an earlier offset. Use docx_read_object only when one selected object needs a narrower descendant view. The provider reports physical structure only; the Agent decides the template and business meaning.',
|
|
347
340
|
inputSchema: inputContract('docx_read_table'),
|
|
348
341
|
outputSchema: docxTableReadOutput,
|
|
349
342
|
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
@@ -665,7 +658,9 @@ async function docxObservation(tool, args) {
|
|
|
665
658
|
tool,
|
|
666
659
|
runtime: payload.runtime,
|
|
667
660
|
source: await fileArtifact(input),
|
|
668
|
-
|
|
661
|
+
...(tool === 'docx_read_table' ? {} : {
|
|
662
|
+
artifact: await writeJsonArtifact(output, result.json),
|
|
663
|
+
}),
|
|
669
664
|
};
|
|
670
665
|
if (tool === 'docx_list_objects') {
|
|
671
666
|
const totalCount = payload.receipt.totalCount;
|
|
@@ -723,10 +718,18 @@ async function docxObservation(tool, args) {
|
|
|
723
718
|
let narrowingRequired = false;
|
|
724
719
|
for (const sourceRow of payload.rows.slice(offset, offset + requestedLimit)) {
|
|
725
720
|
const row = {
|
|
726
|
-
|
|
721
|
+
address: sourceRow.address,
|
|
722
|
+
repeatHeader: sourceRow.repeatHeader,
|
|
723
|
+
cantSplit: sourceRow.cantSplit,
|
|
724
|
+
gridBefore: sourceRow.gridBefore,
|
|
725
|
+
gridAfter: sourceRow.gridAfter,
|
|
727
726
|
cells: sourceRow.cells.map(cell => ({
|
|
728
|
-
|
|
729
|
-
|
|
727
|
+
address: cell.address,
|
|
728
|
+
gridColumnStart: cell.gridColumnStart,
|
|
729
|
+
gridSpan: cell.gridSpan,
|
|
730
|
+
verticalMerge: cell.verticalMerge,
|
|
731
|
+
verticalMergeOwner: cell.verticalMergeOwner,
|
|
732
|
+
text: cell.paragraphs.map(paragraph => paragraph.text).join('\n'),
|
|
730
733
|
})),
|
|
731
734
|
};
|
|
732
735
|
const candidate = [...rows, row];
|
|
@@ -739,9 +742,28 @@ async function docxObservation(tool, args) {
|
|
|
739
742
|
const nextOffset = !narrowingRequired && offset + rows.length < totalRowCount
|
|
740
743
|
? offset + rows.length
|
|
741
744
|
: null;
|
|
745
|
+
const pageReceipt = {
|
|
746
|
+
schema: 'tiwater.docx-table-page-receipt/v1',
|
|
747
|
+
totalRowCount,
|
|
748
|
+
returnedRowCount: rows.length,
|
|
749
|
+
remaining: totalRowCount - offset - rows.length,
|
|
750
|
+
nextOffset,
|
|
751
|
+
};
|
|
752
|
+
const detailPage = {
|
|
753
|
+
schema: 'tiwater.docx-table-detail-page/v1',
|
|
754
|
+
address: payload.address,
|
|
755
|
+
rowCount: payload.rowCount,
|
|
756
|
+
columnCount: payload.columnCount,
|
|
757
|
+
gridColumns: payload.gridColumns,
|
|
758
|
+
precedingParagraph: payload.precedingParagraph,
|
|
759
|
+
followingParagraph: payload.followingParagraph,
|
|
760
|
+
receipt: pageReceipt,
|
|
761
|
+
rows: payload.rows.slice(offset, offset + rows.length),
|
|
762
|
+
};
|
|
742
763
|
return {
|
|
743
764
|
...retained,
|
|
744
|
-
|
|
765
|
+
artifact: await writeJsonArtifact(output, detailPage),
|
|
766
|
+
schema: 'tiwater.docx-table-page/v1',
|
|
745
767
|
address: payload.address,
|
|
746
768
|
rowCount: payload.rowCount,
|
|
747
769
|
columnCount: payload.columnCount,
|
|
@@ -749,12 +771,8 @@ async function docxObservation(tool, args) {
|
|
|
749
771
|
precedingParagraph: payload.precedingParagraph,
|
|
750
772
|
followingParagraph: payload.followingParagraph,
|
|
751
773
|
receipt: {
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
returnedRowCount: rows.length,
|
|
755
|
-
remaining: totalRowCount - offset - rows.length,
|
|
756
|
-
nextOffset,
|
|
757
|
-
inlineTextNodesOmitted: true,
|
|
774
|
+
...pageReceipt,
|
|
775
|
+
detailPageRetained: true,
|
|
758
776
|
narrowingRequired,
|
|
759
777
|
},
|
|
760
778
|
rows,
|