@tiwater/office-mcp 0.17.34 → 0.18.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.
@@ -2,29 +2,29 @@
2
2
  "schema": "tiwater.office-provider-contract-manifest/v1",
3
3
  "provider": {
4
4
  "id": "@tiwater/office-mcp",
5
- "version": "0.17.34"
5
+ "version": "0.18.0"
6
6
  },
7
7
  "tools": [
8
8
  {
9
9
  "name": "docx_apply_font_policy",
10
10
  "providerContract": {
11
11
  "source": "packages/docx-cli/contracts/mcp-input/docx_apply_font_policy.schema.json",
12
- "sha256": "153e50e2f6577b5ea70fd1d3522f8ccf3a74b82b683f1f8fe724f6433a9c72e0"
12
+ "sha256": "d7c0006cc1ee6a001f8a82f26a9ed260c4ff48babcc7a93b785c019cfa91a3a0"
13
13
  },
14
14
  "inputContract": {
15
15
  "path": "office/contracts/docx_apply_font_policy.schema.json",
16
- "sha256": "153e50e2f6577b5ea70fd1d3522f8ccf3a74b82b683f1f8fe724f6433a9c72e0"
16
+ "sha256": "d7c0006cc1ee6a001f8a82f26a9ed260c4ff48babcc7a93b785c019cfa91a3a0"
17
17
  }
18
18
  },
19
19
  {
20
20
  "name": "docx_apply_toc_style_policy",
21
21
  "providerContract": {
22
22
  "source": "packages/docx-cli/contracts/mcp-input/docx_apply_toc_style_policy.schema.json",
23
- "sha256": "2d4887ab4dc57e2c655f130e67c08886ff1630a889e7258b13519fb6e1529d25"
23
+ "sha256": "20e97023efe9a06354f22c93fff1576e0102a5d8b16058e9684af9478cb36286"
24
24
  },
25
25
  "inputContract": {
26
26
  "path": "office/contracts/docx_apply_toc_style_policy.schema.json",
27
- "sha256": "2d4887ab4dc57e2c655f130e67c08886ff1630a889e7258b13519fb6e1529d25"
27
+ "sha256": "20e97023efe9a06354f22c93fff1576e0102a5d8b16058e9684af9478cb36286"
28
28
  }
29
29
  },
30
30
  {
@@ -42,33 +42,33 @@
42
42
  "name": "docx_copy_content",
43
43
  "providerContract": {
44
44
  "source": "packages/docx-cli/contracts/mcp-input/docx_copy_content.schema.json",
45
- "sha256": "a988f7c4284c5f99bd3cc28f31813c0a12b999c2486f697776bf6f873c9c49e7"
45
+ "sha256": "50e1633e97d0aaab32c58935b92aa73128b566ae3ed742bc3ae1a62d0b1ba617"
46
46
  },
47
47
  "inputContract": {
48
48
  "path": "office/contracts/docx_copy_content.schema.json",
49
- "sha256": "a988f7c4284c5f99bd3cc28f31813c0a12b999c2486f697776bf6f873c9c49e7"
49
+ "sha256": "50e1633e97d0aaab32c58935b92aa73128b566ae3ed742bc3ae1a62d0b1ba617"
50
50
  }
51
51
  },
52
52
  {
53
53
  "name": "docx_copy_object",
54
54
  "providerContract": {
55
55
  "source": "packages/docx-cli/contracts/mcp-input/docx_copy_object.schema.json",
56
- "sha256": "5f0bfc826d68f451055aba20390686e0e0df2182797fc36ff285f42d09084104"
56
+ "sha256": "03bbda134699a76193054a18ca72199d4e74ebd6437a94bb6512a68597dcb0df"
57
57
  },
58
58
  "inputContract": {
59
59
  "path": "office/contracts/docx_copy_object.schema.json",
60
- "sha256": "5f0bfc826d68f451055aba20390686e0e0df2182797fc36ff285f42d09084104"
60
+ "sha256": "03bbda134699a76193054a18ca72199d4e74ebd6437a94bb6512a68597dcb0df"
61
61
  }
62
62
  },
63
63
  {
64
64
  "name": "docx_delete_object",
65
65
  "providerContract": {
66
66
  "source": "packages/docx-cli/contracts/mcp-input/docx_delete_object.schema.json",
67
- "sha256": "a9ef8f5a195a9fd6731023e76731f3aef0905002b160c876e2fbc5288dcde66b"
67
+ "sha256": "efbb9017fe4b5dd0a66ee7d1229560d006fbca09beffbc6a600bda225b4f2d05"
68
68
  },
69
69
  "inputContract": {
70
70
  "path": "office/contracts/docx_delete_object.schema.json",
71
- "sha256": "a9ef8f5a195a9fd6731023e76731f3aef0905002b160c876e2fbc5288dcde66b"
71
+ "sha256": "efbb9017fe4b5dd0a66ee7d1229560d006fbca09beffbc6a600bda225b4f2d05"
72
72
  }
73
73
  },
74
74
  {
@@ -97,33 +97,33 @@
97
97
  "name": "docx_list_objects",
98
98
  "providerContract": {
99
99
  "source": "packages/docx-cli/contracts/mcp-input/docx_list_objects.schema.json",
100
- "sha256": "f496d10fefe414d49993b447b50ccce4d808fd11e6df8625f8f906de8a2d90bb"
100
+ "sha256": "2709c5e81ce6a421d12b8ae5752b9251c7e379c0dc5fb5872b658466172a1c2f"
101
101
  },
102
102
  "inputContract": {
103
103
  "path": "office/contracts/docx_list_objects.schema.json",
104
- "sha256": "f496d10fefe414d49993b447b50ccce4d808fd11e6df8625f8f906de8a2d90bb"
104
+ "sha256": "2709c5e81ce6a421d12b8ae5752b9251c7e379c0dc5fb5872b658466172a1c2f"
105
105
  }
106
106
  },
107
107
  {
108
108
  "name": "docx_merge_cells",
109
109
  "providerContract": {
110
110
  "source": "packages/docx-cli/contracts/mcp-input/docx_merge_cells.schema.json",
111
- "sha256": "35958ebea8ef3123c2122b505a3c02fef3a8d423a3f054a9162d144089092d8b"
111
+ "sha256": "417def05619b271471c76883eea52a2f5772ac399111215df5a7259b8a41c3d1"
112
112
  },
113
113
  "inputContract": {
114
114
  "path": "office/contracts/docx_merge_cells.schema.json",
115
- "sha256": "35958ebea8ef3123c2122b505a3c02fef3a8d423a3f054a9162d144089092d8b"
115
+ "sha256": "417def05619b271471c76883eea52a2f5772ac399111215df5a7259b8a41c3d1"
116
116
  }
117
117
  },
118
118
  {
119
119
  "name": "docx_read_object",
120
120
  "providerContract": {
121
121
  "source": "packages/docx-cli/contracts/mcp-input/docx_read_object.schema.json",
122
- "sha256": "589b616fa60e39107fb6061a67b23387f07acf0d3974a8bf1580cc2567857ff1"
122
+ "sha256": "f8d29a89c0a321332d5d964c970b2cb18c7ecd59f87e9892e6779747a00f9825"
123
123
  },
124
124
  "inputContract": {
125
125
  "path": "office/contracts/docx_read_object.schema.json",
126
- "sha256": "589b616fa60e39107fb6061a67b23387f07acf0d3974a8bf1580cc2567857ff1"
126
+ "sha256": "f8d29a89c0a321332d5d964c970b2cb18c7ecd59f87e9892e6779747a00f9825"
127
127
  }
128
128
  },
129
129
  {
@@ -152,33 +152,33 @@
152
152
  "name": "docx_replace_table_rows",
153
153
  "providerContract": {
154
154
  "source": "packages/docx-cli/contracts/mcp-input/docx_replace_table_rows.schema.json",
155
- "sha256": "2b2aa0f981767c57b974ff088e8bfe51091cc73bd10ad3eb86a6ce5ff3a798e9"
155
+ "sha256": "8dfc2cb6f366610281eb6f14118d3855e1e27a34f27b5e2a425690b581ada5a6"
156
156
  },
157
157
  "inputContract": {
158
158
  "path": "office/contracts/docx_replace_table_rows.schema.json",
159
- "sha256": "2b2aa0f981767c57b974ff088e8bfe51091cc73bd10ad3eb86a6ce5ff3a798e9"
159
+ "sha256": "8dfc2cb6f366610281eb6f14118d3855e1e27a34f27b5e2a425690b581ada5a6"
160
160
  }
161
161
  },
162
162
  {
163
163
  "name": "docx_set_text",
164
164
  "providerContract": {
165
165
  "source": "packages/docx-cli/contracts/mcp-input/docx_set_text.schema.json",
166
- "sha256": "f66adf07e6e53599d93ad29420d7a977d869371ef3e0759a128fb2333f8daf08"
166
+ "sha256": "0e0ccfb2ac910660c6aea6b4dca0e023bd30931c691913647576999b096f43e9"
167
167
  },
168
168
  "inputContract": {
169
169
  "path": "office/contracts/docx_set_text.schema.json",
170
- "sha256": "f66adf07e6e53599d93ad29420d7a977d869371ef3e0759a128fb2333f8daf08"
170
+ "sha256": "0e0ccfb2ac910660c6aea6b4dca0e023bd30931c691913647576999b096f43e9"
171
171
  }
172
172
  },
173
173
  {
174
174
  "name": "docx_split_cells",
175
175
  "providerContract": {
176
176
  "source": "packages/docx-cli/contracts/mcp-input/docx_split_cells.schema.json",
177
- "sha256": "d25ff4b44dade94bf3f09676feae31c93d4ec3a14c22d9f5602f3016d6fd40ec"
177
+ "sha256": "9d53d0234d98c6cc5cb5b523e1457b777d015c5aaf49cbd745e6598c1793d6bb"
178
178
  },
179
179
  "inputContract": {
180
180
  "path": "office/contracts/docx_split_cells.schema.json",
181
- "sha256": "d25ff4b44dade94bf3f09676feae31c93d4ec3a14c22d9f5602f3016d6fd40ec"
181
+ "sha256": "9d53d0234d98c6cc5cb5b523e1457b777d015c5aaf49cbd745e6598c1793d6bb"
182
182
  }
183
183
  },
184
184
  {
package/office/index.mjs CHANGED
@@ -161,20 +161,17 @@ function artifactOutput(tool) {
161
161
  return z.object({ tool: z.literal(tool), runtime: runtimeIdentity, source: artifact, artifact }).strict();
162
162
  }
163
163
 
164
- const docxRevision = z.object({
165
- id: z.string().regex(/^docx-rev-v1-[0-9a-f]{64}$/),
166
- inputSha256: z.string().regex(/^[A-F0-9]{64}$/),
167
- provider: z.literal('tiwater.docx.cli'),
168
- toolVersion: z.string(),
164
+ const docxAddress = z.object({
165
+ part: z.string().min(1),
166
+ path: z.string().startsWith('/'),
169
167
  }).strict();
170
168
 
171
169
  function docxInspectionOutput(tool) {
172
170
  return artifactOutput(tool).extend({
173
- revision: docxRevision,
174
171
  summary: z.object({
175
172
  tableCount: z.number().int().nonnegative(),
176
173
  openingParagraphs: z.array(z.object({
177
- ref: z.string().regex(/^dox1_[0-9a-f]{64}$/),
174
+ address: docxAddress,
178
175
  textPreview: z.string().min(1).max(240),
179
176
  }).strict()).max(6),
180
177
  }).strict(),
@@ -182,8 +179,8 @@ function docxInspectionOutput(tool) {
182
179
  }
183
180
 
184
181
  const docxObjectIdentity = z.object({
185
- ref: z.string().regex(/^dox1_[0-9a-f]{64}$/),
186
- parentRef: z.string().regex(/^dox1_[0-9a-f]{64}$/).nullable(),
182
+ address: docxAddress,
183
+ parentAddress: docxAddress.nullable(),
187
184
  kind: z.string(),
188
185
  textPreview: z.string().nullable(),
189
186
  gridSpan: z.number().int().positive().nullable(),
@@ -191,7 +188,7 @@ const docxObjectIdentity = z.object({
191
188
  }).strict();
192
189
 
193
190
  const docxNestedObjectIdentity = docxObjectIdentity.pick({
194
- ref: true,
191
+ address: true,
195
192
  kind: true,
196
193
  textPreview: true,
197
194
  }).extend({
@@ -206,11 +203,10 @@ const docxObservationNode = z.lazy(() => z.object({
206
203
  const docxObservationReceipt = z.object({
207
204
  schema: z.literal('tiwater.docx-observation-receipt/v1'),
208
205
  operation: z.literal('list'),
209
- revision: docxRevision,
210
206
  totalCount: z.number().int().nonnegative(),
211
207
  returnedCount: z.number().int().nonnegative(),
212
208
  remaining: z.number().int().nonnegative(),
213
- continuation: z.string().nullable(),
209
+ nextOffset: z.number().int().nonnegative().nullable(),
214
210
  }).strict();
215
211
 
216
212
  const docxListObjectsOutput = artifactOutput('docx_list_objects').extend({
@@ -221,14 +217,13 @@ const docxListObjectsOutput = artifactOutput('docx_list_objects').extend({
221
217
  }).strict();
222
218
 
223
219
  const docxReadObjectOutput = artifactOutput('docx_read_object').extend({
224
- revision: docxRevision,
225
220
  observations: z.array(docxObservationNode).min(1),
226
221
  }).strict();
227
222
 
228
223
  const tools = [
229
224
  {
230
225
  name: 'docx_inspect',
231
- description: 'Inspect one current DOCX and retain its complete machine observation at output. The response returns the current revision, observation artifact, table count, and up to six opening non-empty body paragraphs for document identity. Use list and read operations to traverse selected document objects in native structure order.',
226
+ description: 'Inspect one current DOCX and retain its complete machine observation at output. The response returns the observation artifact, table count, and up to six opening non-empty body paragraphs with their OpenXML addresses. Use list and read operations to traverse selected document objects in native structure order.',
232
227
  inputSchema: inputContract('docx_inspect'),
233
228
  outputSchema: docxInspectionOutput('docx_inspect'),
234
229
  annotations: { readOnlyHint: true, idempotentHint: true },
@@ -236,7 +231,7 @@ const tools = [
236
231
  },
237
232
  {
238
233
  name: 'docx_list_objects',
239
- description: 'List one small page of nearest-child identities from the current DOCX in native document order and retain the exact page at output. This call creates and returns the current revision; it does not accept a revision argument. Request only the object kinds needed by the current local traversal, follow continuation in order, and descend only through returned refs with parentRef. Text previews describe already located objects; they do not prove descendant content.',
234
+ description: 'List one small page of nearest-child OpenXML addresses from the current DOCX in native document order and retain the exact page at output. Continue with nextOffset and descend through a returned address as parent. Text previews describe already located objects; they do not prove descendant content.',
240
235
  inputSchema: inputContract('docx_list_objects'),
241
236
  outputSchema: docxListObjectsOutput,
242
237
  annotations: { readOnlyHint: true, idempotentHint: true },
@@ -244,7 +239,7 @@ const tools = [
244
239
  },
245
240
  {
246
241
  name: 'docx_read_object',
247
- description: 'Read selected rows, cells, or paragraphs from one native DOCX in one call and return them in refs order. Unlike docx_list_objects, this call accepts the list result revision to reject stale refs. Pass the document path once and only the refs needed for the current target. For exact inline content, use observed cell or paragraph refs and request run or text.',
242
+ description: 'Read selected rows, cells, or paragraphs from one native DOCX in one call and return them in address order. Pass the document path once and only the OpenXML addresses needed for the current target. For exact inline content, use an observed cell or paragraph address and request run or text.',
248
243
  inputSchema: inputContract('docx_read_object'),
249
244
  outputSchema: docxReadObjectOutput,
250
245
  annotations: { readOnlyHint: true, idempotentHint: true },
@@ -252,7 +247,7 @@ const tools = [
252
247
  },
253
248
  {
254
249
  name: 'docx_copy_content',
255
- description: 'Replace content in existing plain-text target paragraphs or cells while retaining target container formatting and source inline meaning. Targets containing non-text objects are rejected. Batch cells that need exact observed subsets after docx_replace_table_rows. A selection copies a whole object by ref, or an exact substring when range is attached to a run or text ref.',
250
+ description: 'Replace content in existing plain-text target paragraphs or cells while retaining target container formatting and source inline meaning. A selection copies a whole object by OpenXML address, or an exact substring when range is attached to a run or text address.',
256
251
  inputSchema: inputContract('docx_copy_content'),
257
252
  outputSchema: fixedEditOutput('docx_copy_content'),
258
253
  handler: args => fixedEdit('docx_copy_content', args),
@@ -266,7 +261,7 @@ const tools = [
266
261
  },
267
262
  {
268
263
  name: 'docx_replace_table_rows',
269
- description: 'Replace one or more data-row ranges in one current target document. targetDocument appears once; each tables item binds one source document and its source and target rows. All source-cell paragraphs copy by default; sourceCellContents selects exact observed content that the target keeps.',
264
+ description: 'Replace one or more data-row ranges in one current target document. input appears once; each tables item binds sourceInput and exact source and target OpenXML addresses. All source-cell paragraphs copy by default; sourceCellContents selects exact observed content that the target keeps.',
270
265
  inputSchema: inputContract('docx_replace_table_rows'),
271
266
  outputSchema: fixedEditOutput('docx_replace_table_rows'),
272
267
  handler: args => fixedEdit('docx_replace_table_rows', args),
@@ -484,20 +479,20 @@ function buildServer() {
484
479
  }
485
480
 
486
481
  function compactDocxInspection(report) {
487
- if (!report?.tables?.revision || !Array.isArray(report.tables.tables) || !Array.isArray(report.flow)) {
482
+ if (!Array.isArray(report?.tables?.tables) || !Array.isArray(report.flow)) {
488
483
  throw new Error('docx-table-inspection-result-invalid');
489
484
  }
490
485
  const openingParagraphs = report.flow
491
486
  .filter(item => item?.type === 'paragraph'
492
- && /^dox1_[0-9a-f]{64}$/u.test(item.objectRef)
487
+ && typeof item.address?.part === 'string'
488
+ && typeof item.address?.path === 'string'
493
489
  && typeof item.text === 'string' && item.text.trim())
494
490
  .slice(0, 6)
495
491
  .map(item => ({
496
- ref: item.objectRef,
492
+ address: item.address,
497
493
  textPreview: item.text.trim().replace(/\s+/gu, ' ').slice(0, 240),
498
494
  }));
499
495
  return {
500
- revision: report.tables.revision,
501
496
  summary: {
502
497
  tableCount: report.tables.tables.length,
503
498
  openingParagraphs,
@@ -507,8 +502,8 @@ function compactDocxInspection(report) {
507
502
 
508
503
  function compactDocxObjectIdentity(object) {
509
504
  return {
510
- ref: object.ref,
511
- parentRef: object.parentRef,
505
+ address: object.address,
506
+ parentAddress: object.parentAddress,
512
507
  kind: object.kind,
513
508
  textPreview: object.textPreview,
514
509
  gridSpan: object.gridSpan,
@@ -522,7 +517,7 @@ function compactDocxObservation(observation) {
522
517
  const identity = compactDocxObjectIdentity(node.object);
523
518
  const children = (node.children ?? []).map(compactNode);
524
519
  const object = {
525
- ref: identity.ref,
520
+ address: identity.address,
526
521
  kind: identity.kind,
527
522
  textPreview: children.length === 0 ? identity.textPreview : null,
528
523
  ...(identity.gridSpan === null ? {} : { gridSpan: identity.gridSpan }),
@@ -582,7 +577,6 @@ async function docxReadObject(args) {
582
577
  runtime: commandRuntime(result),
583
578
  source: await fileArtifact(input),
584
579
  artifact: await writeJsonArtifact(output, result.json),
585
- revision: result.json.receipt.revision,
586
580
  observations: result.json.observations.map(compactDocxObservation),
587
581
  };
588
582
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiwater/office-mcp",
3
- "version": "0.17.34",
3
+ "version": "0.18.0",
4
4
  "description": "Published MCP server for Tiwater Office document capabilities",
5
5
  "type": "module",
6
6
  "license": "MIT",