@tiwater/office-mcp 0.16.13 → 0.16.14
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.
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"sourceTableRef": { "type": "string", "pattern": "^dox1_[0-9a-f]{64}$" },
|
|
42
42
|
"sourceRows": {
|
|
43
43
|
"type": "object",
|
|
44
|
-
|
|
44
|
+
"description": "Contiguous source business-row range. excludeRefs contains every physical row to remove; excluding a vertically merged group requires its restart row and all continuation rows. Do not begin on an unlabeled continuation row. If another column's visible merge began before the range, the provider carries its origin value into a new merge start.",
|
|
45
45
|
"properties": {
|
|
46
46
|
"firstRef": { "type": "string", "pattern": "^dox1_[0-9a-f]{64}$" },
|
|
47
47
|
"lastRef": { "type": "string", "pattern": "^dox1_[0-9a-f]{64}$" },
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"pattern": "^docx-rev-v1-[0-9a-f]{64}$"
|
|
19
19
|
},
|
|
20
20
|
"kinds": {
|
|
21
|
-
"description": "Object kinds required by the next operation.
|
|
21
|
+
"description": "Object kinds required by the next operation. Both the response and artifact contain only matching descendant identities.",
|
|
22
22
|
"type": "array",
|
|
23
23
|
"items": {
|
|
24
24
|
"type": "string",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"output": {
|
|
39
39
|
"type": "string",
|
|
40
40
|
"minLength": 1,
|
|
41
|
-
"description": "Absolute path for a new JSON artifact containing the
|
|
41
|
+
"description": "Absolute path for a new JSON artifact containing the selected native object and only the requested descendant kinds.",
|
|
42
42
|
"x-tiwater-file-role": "write"
|
|
43
43
|
}
|
|
44
44
|
},
|
|
@@ -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.16.
|
|
5
|
+
"version": "0.16.14"
|
|
6
6
|
},
|
|
7
7
|
"tools": [
|
|
8
8
|
{
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"name": "docx_copy_table_rows",
|
|
43
43
|
"providerContract": {
|
|
44
44
|
"source": "packages/docx-cli/contracts/mcp-input/docx_copy_table_rows.schema.json",
|
|
45
|
-
"sha256": "
|
|
45
|
+
"sha256": "2b6ba0a54290ab8671f1f5547850bb37370655f05170f6dcaffa9586e9f409f2"
|
|
46
46
|
},
|
|
47
47
|
"inputContract": {
|
|
48
48
|
"path": "office/contracts/docx_copy_table_rows.schema.json",
|
|
49
|
-
"sha256": "
|
|
49
|
+
"sha256": "2b6ba0a54290ab8671f1f5547850bb37370655f05170f6dcaffa9586e9f409f2"
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
{
|
|
@@ -119,11 +119,11 @@
|
|
|
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": "
|
|
122
|
+
"sha256": "9b78138005fc6f875cf9ed530b8389ec4b2a751294c9d316e8b9fc2463560a3f"
|
|
123
123
|
},
|
|
124
124
|
"inputContract": {
|
|
125
125
|
"path": "office/contracts/docx_read_object.schema.json",
|
|
126
|
-
"sha256": "
|
|
126
|
+
"sha256": "9b78138005fc6f875cf9ed530b8389ec4b2a751294c9d316e8b9fc2463560a3f"
|
|
127
127
|
}
|
|
128
128
|
},
|
|
129
129
|
{
|
package/office/index.mjs
CHANGED
|
@@ -145,10 +145,9 @@ const docxRevision = z.object({
|
|
|
145
145
|
|
|
146
146
|
const docxTableIndexEntry = z.object({
|
|
147
147
|
ref: z.string().regex(/^dox1_[0-9a-f]{64}$/),
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
storyKind: z.string(),
|
|
148
|
+
parentRef: z.string().regex(/^dox1_[0-9a-f]{64}$/).nullable(),
|
|
149
|
+
storyPart: z.string(),
|
|
150
|
+
nativePath: z.string(),
|
|
152
151
|
rowCount: z.number().int().nonnegative(),
|
|
153
152
|
columnCount: z.number().int().nonnegative(),
|
|
154
153
|
textPreview: z.string(),
|
|
@@ -167,6 +166,8 @@ const docxObjectIdentity = z.object({
|
|
|
167
166
|
parentRef: z.string().regex(/^dox1_[0-9a-f]{64}$/).nullable(),
|
|
168
167
|
kind: z.string(),
|
|
169
168
|
textPreview: z.string().nullable(),
|
|
169
|
+
gridSpan: z.number().int().positive().nullable(),
|
|
170
|
+
verticalMerge: z.string().nullable(),
|
|
170
171
|
}).strict();
|
|
171
172
|
|
|
172
173
|
const docxReadObjectOutput = artifactOutput('docx_read_object').extend({
|
|
@@ -406,29 +407,10 @@ function buildServer() {
|
|
|
406
407
|
}
|
|
407
408
|
|
|
408
409
|
function compactDocxTableIndex(report) {
|
|
409
|
-
if (!report?.
|
|
410
|
-
|| (report.StoryTables !== null && !Array.isArray(report.StoryTables))) {
|
|
410
|
+
if (!report?.revision || !Array.isArray(report.tables)) {
|
|
411
411
|
throw new Error('docx-table-inspection-result-invalid');
|
|
412
412
|
}
|
|
413
|
-
|
|
414
|
-
const text = table.Rows.flatMap(row => row.Cells.map(cell => cell.Text))
|
|
415
|
-
.filter(value => typeof value === 'string' && value.length > 0)
|
|
416
|
-
.join(' ')
|
|
417
|
-
.replace(/\s+/gu, ' ')
|
|
418
|
-
.trim();
|
|
419
|
-
return {
|
|
420
|
-
ref: table.Ref,
|
|
421
|
-
tableIndex: table.TableIndex,
|
|
422
|
-
containmentPath: table.ContainmentPath,
|
|
423
|
-
parentCellAddress: table.ParentCellAddress ?? null,
|
|
424
|
-
storyKind: table.Story.Kind,
|
|
425
|
-
rowCount: table.RowCount,
|
|
426
|
-
columnCount: table.ColumnCount,
|
|
427
|
-
textPreview: text.length <= 160 ? text : `${text.slice(0, 160)}...`,
|
|
428
|
-
textLength: text.length,
|
|
429
|
-
};
|
|
430
|
-
});
|
|
431
|
-
return { revision: report.Revision, tables };
|
|
413
|
+
return { revision: report.revision, tables: report.tables };
|
|
432
414
|
}
|
|
433
415
|
|
|
434
416
|
function compactDocxObjectIdentity(object) {
|
|
@@ -437,6 +419,8 @@ function compactDocxObjectIdentity(object) {
|
|
|
437
419
|
parentRef: object.parentRef,
|
|
438
420
|
kind: object.kind,
|
|
439
421
|
textPreview: object.textPreview,
|
|
422
|
+
gridSpan: object.gridSpan,
|
|
423
|
+
verticalMerge: object.verticalMerge,
|
|
440
424
|
};
|
|
441
425
|
}
|
|
442
426
|
|
|
@@ -462,7 +446,6 @@ async function docxObservation(tool, args) {
|
|
|
462
446
|
async function docxReadObject(args) {
|
|
463
447
|
const input = path.resolve(requireString(args.input, 'input'));
|
|
464
448
|
const output = requireString(args.output, 'output');
|
|
465
|
-
const kinds = new Set(args.kinds);
|
|
466
449
|
const { output: _output, ...request } = args;
|
|
467
450
|
return withTempJsonFile(request, async requestPath => {
|
|
468
451
|
const result = await runJsonCandidateChain(docxCandidates, ['docx_read_object', requestPath]);
|
|
@@ -474,7 +457,6 @@ async function docxReadObject(args) {
|
|
|
474
457
|
revision: result.json.receipt.revision,
|
|
475
458
|
object: compactDocxObjectIdentity(result.json.observation.object),
|
|
476
459
|
descendants: result.json.observation.descendants
|
|
477
|
-
.filter(identity => kinds.has(identity.kind))
|
|
478
460
|
.map(compactDocxObjectIdentity),
|
|
479
461
|
};
|
|
480
462
|
});
|