@tiwater/office-mcp 0.21.42 → 0.21.43

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.
@@ -21,10 +21,11 @@
21
21
  "required": ["part", "path"],
22
22
  "additionalProperties": false
23
23
  },
24
- "continuation": {
25
- "type": "string",
26
- "minLength": 1,
27
- "description": "Opaque continuation returned by the preceding page. Pass it back unchanged; omit it for the first page."
24
+ "offset": {
25
+ "type": "integer",
26
+ "minimum": 0,
27
+ "maximum": 9007199254740991,
28
+ "description": "Zero-based row offset. Continue from receipt.nextOffset only when a later row is needed."
28
29
  },
29
30
  "output": {
30
31
  "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.21.42"
5
+ "version": "0.21.43"
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": "a0d13fb70cc43d7ee7f3be9730f98df9a5e988d33fb7454b44f5e455d068b950"
155
+ "sha256": "c5f9f628494a11e0377248c256b3c047471f897c92a81b6fa1a01f408e478962"
156
156
  },
157
157
  "inputContract": {
158
158
  "path": "office/contracts/docx_read_table.schema.json",
159
- "sha256": "a0d13fb70cc43d7ee7f3be9730f98df9a5e988d33fb7454b44f5e455d068b950"
159
+ "sha256": "c5f9f628494a11e0377248c256b3c047471f897c92a81b6fa1a01f408e478962"
160
160
  }
161
161
  },
162
162
  {
package/office/index.mjs CHANGED
@@ -488,7 +488,7 @@ const docxTableReadOutput = docxObservationOutput('docx_read_table').extend({
488
488
  retainedRowCount: z.number().int().nonnegative(),
489
489
  returnedRowCount: z.number().int().nonnegative(),
490
490
  remaining: z.number().int().nonnegative(),
491
- nextContinuation: z.string().min(1).optional(),
491
+ nextOffset: z.number().int().nonnegative().nullable(),
492
492
  detailPageRetained: z.boolean(),
493
493
  narrowingRequired: z.boolean(),
494
494
  }).strict(),
@@ -582,7 +582,7 @@ const tools = [
582
582
  },
583
583
  {
584
584
  name: 'docx_read_table',
585
- description: 'Read one explicit native DOCX table. Provide output to retain every remaining row with full paragraph and text-node detail. Set returnContent true to also receive the largest compact inline page within the response limit; these channels are independent and at least one is required. retainedRowCount counts artifact rows and returnedRowCount counts inline rows. When remaining is nonzero, continue only by passing receipt.nextContinuation unchanged in the next call; a continuation page depends on the preceding receipt and cannot be predicted or read in parallel. Match columns by gridColumnStart, not tc position. A vertical-merge restart owns one logical value; a continue cell points to verticalMergeOwner and does not repeat that value inline.',
585
+ description: 'Read one explicit native DOCX table. Provide output to retain every remaining row with full paragraph and text-node detail. Set returnContent true to also receive the largest compact inline page within the response limit; these channels are independent and at least one is required. retainedRowCount counts artifact rows and returnedRowCount counts inline rows. When remaining is nonzero, continue from receipt.nextOffset only when a later row is needed. Match columns by gridColumnStart, not tc position. A vertical-merge restart owns one logical value; a continue cell points to verticalMergeOwner and does not repeat that value inline.',
586
586
  inputSchema: inputContract('docx_read_table'),
587
587
  outputSchema: docxTableReadOutput,
588
588
  annotations: { readOnlyHint: true, idempotentHint: true },
@@ -989,34 +989,6 @@ async function docxInspect(args) {
989
989
  };
990
990
  }
991
991
 
992
- function encodeTableContinuation(input, table, offset) {
993
- return Buffer.from(JSON.stringify({
994
- schema: 'tiwater.docx-table-continuation/v1',
995
- input,
996
- table,
997
- offset,
998
- })).toString('base64url');
999
- }
1000
-
1001
- function decodeTableContinuation(continuation, input, table) {
1002
- if (continuation === undefined) return 0;
1003
- let decoded;
1004
- try {
1005
- decoded = JSON.parse(Buffer.from(continuation, 'base64url').toString('utf8'));
1006
- } catch {
1007
- throw new Error('invalid-docx-table-continuation');
1008
- }
1009
- if (decoded?.schema !== 'tiwater.docx-table-continuation/v1'
1010
- || decoded.input !== input
1011
- || decoded.table?.part !== table?.part
1012
- || decoded.table?.path !== table?.path
1013
- || !Number.isSafeInteger(decoded.offset)
1014
- || decoded.offset < 0) {
1015
- throw new Error('invalid-docx-table-continuation');
1016
- }
1017
- return decoded.offset;
1018
- }
1019
-
1020
992
  async function docxObservation(tool, args) {
1021
993
  const input = path.resolve(requireString(args.input, 'input'));
1022
994
  const delivery = resultChannels(args);
@@ -1111,7 +1083,7 @@ async function docxObservation(tool, args) {
1111
1083
  }
1112
1084
  if (tool === 'docx_read_table') {
1113
1085
  const totalRowCount = payload.rows.length;
1114
- const offset = Math.min(decodeTableContinuation(args.continuation, input, args.table), totalRowCount);
1086
+ const offset = Math.min(args.offset ?? 0, totalRowCount);
1115
1087
  const selectedRows = payload.rows.slice(offset);
1116
1088
  const selectedNextOffset = offset + selectedRows.length < totalRowCount
1117
1089
  ? offset + selectedRows.length
@@ -1122,9 +1094,7 @@ async function docxObservation(tool, args) {
1122
1094
  retainedRowCount: selectedRows.length,
1123
1095
  returnedRowCount: selectedRows.length,
1124
1096
  remaining: totalRowCount - offset - selectedRows.length,
1125
- ...(selectedNextOffset === null ? {} : {
1126
- nextContinuation: encodeTableContinuation(input, args.table, selectedNextOffset),
1127
- }),
1097
+ nextOffset: selectedNextOffset,
1128
1098
  };
1129
1099
  const detailPage = {
1130
1100
  schema: 'tiwater.docx-table-detail-page/v1',
@@ -1195,9 +1165,7 @@ async function docxObservation(tool, args) {
1195
1165
  retainedRowCount,
1196
1166
  returnedRowCount: rows.length,
1197
1167
  remaining: totalRowCount - offset - rows.length,
1198
- ...(inlineNextOffset === null ? {} : {
1199
- nextContinuation: encodeTableContinuation(input, args.table, inlineNextOffset),
1200
- }),
1168
+ nextOffset: inlineNextOffset,
1201
1169
  };
1202
1170
  return {
1203
1171
  ...withArtifact,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiwater/office-mcp",
3
- "version": "0.21.42",
3
+ "version": "0.21.43",
4
4
  "description": "Published MCP distribution for independent Tiwater Office, PDF, and Text document capabilities",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -2,7 +2,7 @@
2
2
  "schema": "tiwater.pdf-provider-contract-manifest/v1",
3
3
  "provider": {
4
4
  "id": "@tiwater/office-mcp",
5
- "version": "0.21.42"
5
+ "version": "0.21.43"
6
6
  },
7
7
  "runtime": {
8
8
  "command": "tiwater-pdf"
@@ -2,7 +2,7 @@
2
2
  "schema": "tiwater.text-provider-contract-manifest/v1",
3
3
  "provider": {
4
4
  "id": "@tiwater/office-mcp",
5
- "version": "0.21.42"
5
+ "version": "0.21.43"
6
6
  },
7
7
  "tools": [
8
8
  {