@superdoc/mcp 1.11.0-next.1 → 1.11.0-next.2
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/dist/index.js +100 -15
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -31630,7 +31630,7 @@ var init_host = __esm(() => {
|
|
|
31630
31630
|
});
|
|
31631
31631
|
|
|
31632
31632
|
// ../../packages/sdk/langs/node/src/runtime/sdk-version.generated.ts
|
|
31633
|
-
var SDK_VERSION = "2.24.0-next.
|
|
31633
|
+
var SDK_VERSION = "2.24.0-next.2";
|
|
31634
31634
|
|
|
31635
31635
|
// ../../packages/sdk/langs/node/src/runtime/embedded-platform.ts
|
|
31636
31636
|
import { accessSync, chmodSync, constants, existsSync, statSync } from "node:fs";
|
|
@@ -97404,8 +97404,6 @@ function inlineLookFromRow(row) {
|
|
|
97404
97404
|
inline.color = row.color;
|
|
97405
97405
|
if (row.bold === true)
|
|
97406
97406
|
inline.bold = true;
|
|
97407
|
-
if (row.italic === true)
|
|
97408
|
-
inline.italic = true;
|
|
97409
97407
|
return inline;
|
|
97410
97408
|
}
|
|
97411
97409
|
function runInlineAgainstBaseline(marks, baseline) {
|
|
@@ -283415,7 +283413,7 @@ function prepareSDDocumentSessionInternalTemporaryCommit(session, prepared, txId
|
|
|
283415
283413
|
state.history.order.push(txId);
|
|
283416
283414
|
};
|
|
283417
283415
|
}
|
|
283418
|
-
function prepareSDDocumentSessionInternalAtomicReview(session, compile) {
|
|
283416
|
+
function prepareSDDocumentSessionInternalAtomicReview(session, compile, shownSemanticDelta) {
|
|
283419
283417
|
const internal = INTERNALS.get(session);
|
|
283420
283418
|
if (!internal)
|
|
283421
283419
|
throw new Error("internal: unknown SDDocumentSession instance");
|
|
@@ -283456,8 +283454,10 @@ function prepareSDDocumentSessionInternalAtomicReview(session, compile) {
|
|
|
283456
283454
|
};
|
|
283457
283455
|
group.source = source;
|
|
283458
283456
|
const baselineSemanticDelta = mergeCapturedSemanticDelta(entries2, storyIds);
|
|
283457
|
+
const displayedChoice = shownSemanticDelta ?? mergeCapturedSemanticDelta(retiredEntries, storyIds);
|
|
283458
|
+
const undoDisplayedChoice = retiredEntries.length ? [{ semanticDelta: invertCapturedSemanticDelta(displayedChoice) }] : [];
|
|
283459
283459
|
const semantic = mergeCapturedSemanticDelta([
|
|
283460
|
-
...
|
|
283460
|
+
...undoDisplayedChoice,
|
|
283461
283461
|
...entries2
|
|
283462
283462
|
], storyIds);
|
|
283463
283463
|
const prepared = {
|
|
@@ -283497,7 +283497,7 @@ function prepareSDDocumentSessionInternalAtomicReview(session, compile) {
|
|
|
283497
283497
|
}
|
|
283498
283498
|
}
|
|
283499
283499
|
};
|
|
283500
|
-
return { value, prepared,
|
|
283500
|
+
return { value, prepared, baselineSemanticDelta };
|
|
283501
283501
|
} finally {
|
|
283502
283502
|
INTERNALS.delete(staging);
|
|
283503
283503
|
}
|
|
@@ -316148,6 +316148,43 @@ function composeHistoryGroupEffects(effects2) {
|
|
|
316148
316148
|
return result;
|
|
316149
316149
|
}
|
|
316150
316150
|
|
|
316151
|
+
// ../../../v2/document-api-v2-adapter/dist/projection/entity-effects.js
|
|
316152
|
+
function diffTrackedChangeCatalogs(before, after) {
|
|
316153
|
+
return {
|
|
316154
|
+
created: [...after.keys()].filter((id) => !before.has(id)),
|
|
316155
|
+
updated: [...after].filter(([id, content]) => before.has(id) && before.get(id) !== content).map(([id]) => id),
|
|
316156
|
+
removed: [...before.keys()].filter((id) => !after.has(id))
|
|
316157
|
+
};
|
|
316158
|
+
}
|
|
316159
|
+
function diffEntityCatalogs(before, after) {
|
|
316160
|
+
return {
|
|
316161
|
+
trackedChange: diffTrackedChangeCatalogs(before.trackedChange, after.trackedChange),
|
|
316162
|
+
comment: diffTrackedChangeCatalogs(before.comment, after.comment)
|
|
316163
|
+
};
|
|
316164
|
+
}
|
|
316165
|
+
function invertTrackedChangeEffects(effects2) {
|
|
316166
|
+
return { created: effects2.removed, updated: effects2.updated, removed: effects2.created };
|
|
316167
|
+
}
|
|
316168
|
+
function invertEntityEffects(effects2) {
|
|
316169
|
+
return { trackedChange: invertTrackedChangeEffects(effects2.trackedChange), comment: invertTrackedChangeEffects(effects2.comment) };
|
|
316170
|
+
}
|
|
316171
|
+
function withEntityEffects(result, effects2) {
|
|
316172
|
+
const refs = (pick2) => entityTypes.flatMap((entityType) => pick2(effects2[entityType]).map((entityId) => ({ kind: "entity", entityType, entityId })));
|
|
316173
|
+
const other = (list) => (list ?? []).filter((ref5) => !isNetted(ref5));
|
|
316174
|
+
return {
|
|
316175
|
+
...result,
|
|
316176
|
+
inserted: [...other(result.inserted), ...refs((effect) => effect.created)],
|
|
316177
|
+
updated: [...other(result.updated), ...refs((effect) => effect.updated)],
|
|
316178
|
+
...result.removed ? { removed: [...other(result.removed), ...refs((effect) => effect.removed)] } : {},
|
|
316179
|
+
invalidatedRefs: [...other(result.invalidatedRefs), ...refs((effect) => effect.removed)],
|
|
316180
|
+
remappedRefs: (result.remappedRefs ?? []).filter(({ from, to }) => !isNetted(from) && !isNetted(to))
|
|
316181
|
+
};
|
|
316182
|
+
}
|
|
316183
|
+
var entityTypes, isNetted = (ref5) => ref5.kind === "entity" && entityTypes.includes(ref5.entityType);
|
|
316184
|
+
var init_entity_effects = __esm(() => {
|
|
316185
|
+
entityTypes = ["trackedChange", "comment"];
|
|
316186
|
+
});
|
|
316187
|
+
|
|
316151
316188
|
// ../../../v2/document-api-v2-adapter/dist/operations/registry.js
|
|
316152
316189
|
function contractTrackedSupport(operationId) {
|
|
316153
316190
|
return OPERATION_DEFINITIONS2[operationId].metadata.trackedSupport;
|
|
@@ -318459,7 +318496,7 @@ class V2HistoryAdapter {
|
|
|
318459
318496
|
projected: applyHistoryGroupEffects(projectUndoToHistoryResult(entry, result, this.context.session, priorLogicalIds), this.context.getHistoryTrackedChangeGroupEffects(entry.txId), "undo")
|
|
318460
318497
|
});
|
|
318461
318498
|
}
|
|
318462
|
-
return aggregateHistoryResults(this.context, group, applied);
|
|
318499
|
+
return netGroupEffects(group, aggregateHistoryResults(this.context, group, applied), "undo");
|
|
318463
318500
|
}
|
|
318464
318501
|
redo() {
|
|
318465
318502
|
const preview = readTemporaryMutation(this.context.session);
|
|
@@ -318495,7 +318532,7 @@ class V2HistoryAdapter {
|
|
|
318495
318532
|
projected: applyHistoryGroupEffects(projectRedoToHistoryResult(entry, result, this.context.session, priorLogicalIds), this.context.getHistoryTrackedChangeGroupEffects(entry.txId), "redo")
|
|
318496
318533
|
});
|
|
318497
318534
|
}
|
|
318498
|
-
return aggregateHistoryResults(this.context, group, applied);
|
|
318535
|
+
return netGroupEffects(group, aggregateHistoryResults(this.context, group, applied), "redo");
|
|
318499
318536
|
}
|
|
318500
318537
|
currentPackageRevision() {
|
|
318501
318538
|
return getSDDocumentSessionInternalPackageRevision(this.context.session);
|
|
@@ -318524,6 +318561,12 @@ function rollbackAppliedHistory(context, applied, rejectedDirection) {
|
|
|
318524
318561
|
context.recordKernelApplyResult(result);
|
|
318525
318562
|
}
|
|
318526
318563
|
}
|
|
318564
|
+
function netGroupEffects(group, result, direction) {
|
|
318565
|
+
const effects2 = group.logicalGroup?.entityEffects;
|
|
318566
|
+
if (!effects2)
|
|
318567
|
+
return result;
|
|
318568
|
+
return withEntityEffects(result, direction === "undo" ? invertEntityEffects(effects2) : effects2);
|
|
318569
|
+
}
|
|
318527
318570
|
function aggregateHistoryResults(context, group, applied) {
|
|
318528
318571
|
const first = applied[0];
|
|
318529
318572
|
const last = applied[applied.length - 1];
|
|
@@ -318637,6 +318680,7 @@ var init_adapter = __esm(() => {
|
|
|
318637
318680
|
init_temporary_state();
|
|
318638
318681
|
init_src3();
|
|
318639
318682
|
init_sd_document_session_internal();
|
|
318683
|
+
init_entity_effects();
|
|
318640
318684
|
init_source();
|
|
318641
318685
|
init_history();
|
|
318642
318686
|
COVERED_OPERATIONS = new Set(V2_OPERATION_COVERAGE.filter((entry) => {
|
|
@@ -441461,6 +441505,35 @@ var init_prepare_review_mutation = __esm(() => {
|
|
|
441461
441505
|
init_operation_classification();
|
|
441462
441506
|
});
|
|
441463
441507
|
|
|
441508
|
+
// ../../../v2/document-api-v2-adapter/dist/projection/entity-catalog.js
|
|
441509
|
+
function readTrackedChangeCatalog(context) {
|
|
441510
|
+
const { logical } = buildCachedTrackedChangeLogicalView(context);
|
|
441511
|
+
const catalog = new Map;
|
|
441512
|
+
for (const entry of logical.byId.values()) {
|
|
441513
|
+
if (!isVisibleLogicalTrackedChange(entry))
|
|
441514
|
+
continue;
|
|
441515
|
+
const { id, documentOrderStart, documentOrderEnd, fragments, formattingFragments, structuralFragments, ...content3 } = entry;
|
|
441516
|
+
catalog.set(id, JSON.stringify(content3));
|
|
441517
|
+
}
|
|
441518
|
+
return catalog;
|
|
441519
|
+
}
|
|
441520
|
+
function readCommentCatalog(context) {
|
|
441521
|
+
const catalog = new Map;
|
|
441522
|
+
for (const entry of getSDDocumentSessionInternalCommentsCatalog(context.session)?.commentsByCommentId.values() ?? []) {
|
|
441523
|
+
catalog.set(publicCommentIdForEntry(entry), JSON.stringify([entry.bodyText, entry.doneState, entry.parentParaId]));
|
|
441524
|
+
}
|
|
441525
|
+
return catalog;
|
|
441526
|
+
}
|
|
441527
|
+
function readEntityCatalog(context) {
|
|
441528
|
+
return { trackedChange: readTrackedChangeCatalog(context), comment: readCommentCatalog(context) };
|
|
441529
|
+
}
|
|
441530
|
+
var init_entity_catalog = __esm(() => {
|
|
441531
|
+
init_sd_document_session_internal();
|
|
441532
|
+
init_review_read_model();
|
|
441533
|
+
init_logical_view_cache();
|
|
441534
|
+
init_comment_id_resolution();
|
|
441535
|
+
});
|
|
441536
|
+
|
|
441464
441537
|
// ../../../v2/document-api-v2-adapter/dist/mutations/temporary.js
|
|
441465
441538
|
function fail7(code2, message) {
|
|
441466
441539
|
throw new DocumentApiValidationError2(code2, message);
|
|
@@ -441551,14 +441624,17 @@ async function prepare(context, state, input, replace2) {
|
|
|
441551
441624
|
receipts.push(result);
|
|
441552
441625
|
}
|
|
441553
441626
|
return { value: { receipts, logicalIdsBefore }, targetBlockIds: [...blocks] };
|
|
441554
|
-
});
|
|
441627
|
+
}, state.shown);
|
|
441628
|
+
}
|
|
441629
|
+
function attributed(operation) {
|
|
441630
|
+
return Boolean(operation.options && "author" in operation.options && operation.options.author);
|
|
441555
441631
|
}
|
|
441556
441632
|
function invokeOperation(api2, operation) {
|
|
441557
441633
|
switch (operation.operation) {
|
|
441558
441634
|
case "replace":
|
|
441559
|
-
return api2.replace(operation.input, operation.options);
|
|
441635
|
+
return attributed(operation) ? api2.replace(operation.input, operation.options) : api2.replace(operation.input, operation.options);
|
|
441560
441636
|
case "insert":
|
|
441561
|
-
return api2.insert(operation.input, operation.options);
|
|
441637
|
+
return attributed(operation) ? api2.insert(operation.input, operation.options) : api2.insert(operation.input, operation.options);
|
|
441562
441638
|
case "delete":
|
|
441563
441639
|
return api2.delete(operation.input, operation.options);
|
|
441564
441640
|
case "blocks.delete":
|
|
@@ -441609,6 +441685,7 @@ async function beginTemporary(context, raw) {
|
|
|
441609
441685
|
if (context.isCollaborativeSession())
|
|
441610
441686
|
fail7("CAPABILITY_UNSUPPORTED", "Temporary mutation sessions currently require a non-collaborative document.");
|
|
441611
441687
|
guard(context, input.expectedRevision);
|
|
441688
|
+
const baseline = readEntityCatalog(context);
|
|
441612
441689
|
const state = {
|
|
441613
441690
|
id: `preview-${++nextPreview}-${crypto.randomUUID()}`,
|
|
441614
441691
|
tag: input.tag,
|
|
@@ -441616,6 +441693,8 @@ async function beginTemporary(context, raw) {
|
|
|
441616
441693
|
revision: currentRevisionString(context),
|
|
441617
441694
|
busy: true,
|
|
441618
441695
|
baselineHistory: new Set([...context.undoStack, ...context.redoStack]),
|
|
441696
|
+
baseline,
|
|
441697
|
+
catalog: baseline,
|
|
441619
441698
|
...input.onNativeEdit ? { onNativeEdit: input.onNativeEdit } : {}
|
|
441620
441699
|
};
|
|
441621
441700
|
setTemporaryMutation(context.session, state);
|
|
@@ -441669,6 +441748,7 @@ async function applyTemporary(context, state, input, replace2) {
|
|
|
441669
441748
|
state.txIds = [];
|
|
441670
441749
|
}
|
|
441671
441750
|
const baseline = p.baselineSemanticDelta;
|
|
441751
|
+
state.shown = state.txIds.length ? baseline : undefined;
|
|
441672
441752
|
const publicReceipt = baseline ? {
|
|
441673
441753
|
...receipt3,
|
|
441674
441754
|
createdRefs: baseline.createdRefs,
|
|
@@ -441678,7 +441758,9 @@ async function applyTemporary(context, state, input, replace2) {
|
|
|
441678
441758
|
textRangeShifts: baseline.textRangeShifts,
|
|
441679
441759
|
trackedTextRangeShifts: baseline.trackedTextRangeShifts
|
|
441680
441760
|
} : receipt3;
|
|
441681
|
-
|
|
441761
|
+
const shown = state.catalog;
|
|
441762
|
+
state.catalog = readEntityCatalog(context);
|
|
441763
|
+
return finish(context, state, before, replace2 ? "replace" : "begin", withEntityEffects(project2(context, publicReceipt, p.value.logicalIdsBefore, logicalIdsAfter), diffEntityCatalogs(shown, state.catalog)), capture);
|
|
441682
441764
|
} catch (error48) {
|
|
441683
441765
|
capture.finish();
|
|
441684
441766
|
throw error48;
|
|
@@ -441695,7 +441777,7 @@ async function rollbackTemporary(context, input) {
|
|
|
441695
441777
|
const prepared = prepareSDDocumentSessionInternalAtomicReview(context.session, (session) => {
|
|
441696
441778
|
rollbackSDDocumentSessionInternalCapturedHistory(session, state.txIds);
|
|
441697
441779
|
return { value: null, targetBlockIds: [] };
|
|
441698
|
-
});
|
|
441780
|
+
}, state.shown);
|
|
441699
441781
|
let receipt3 = { success: true };
|
|
441700
441782
|
if (prepared.prepared) {
|
|
441701
441783
|
const committed = withTemporaryMutationOwner(context.session, () => applySDDocumentSessionInternalPreparedMutation(context.session, {
|
|
@@ -441711,7 +441793,7 @@ async function rollbackTemporary(context, input) {
|
|
|
441711
441793
|
for (const txId of state.txIds)
|
|
441712
441794
|
deleteSDDocumentSessionInternalHistoryEntry(context.session, txId);
|
|
441713
441795
|
context.discardHistoryMetadata(state.txIds);
|
|
441714
|
-
const output = finish(context, state, before, "rollback", receipt3, capture);
|
|
441796
|
+
const output = finish(context, state, before, "rollback", withEntityEffects(receipt3, diffEntityCatalogs(state.catalog, state.baseline)), capture);
|
|
441715
441797
|
clearTemporaryMutation(context.session);
|
|
441716
441798
|
return output;
|
|
441717
441799
|
} catch (error48) {
|
|
@@ -441750,9 +441832,10 @@ async function commitTemporary(context, input) {
|
|
|
441750
441832
|
const receipt3 = applyFinalization(context, finalization);
|
|
441751
441833
|
if (finalization?.prepared)
|
|
441752
441834
|
state.txIds.push(finalization.prepared.txId);
|
|
441835
|
+
const entityEffects = diffEntityCatalogs(state.baseline, readEntityCatalog(context));
|
|
441753
441836
|
for (const txId of state.txIds)
|
|
441754
441837
|
recordCommittedTxIdForHistory(context, txId, {
|
|
441755
|
-
logicalGroup: { kind: "temporary", id: state.id },
|
|
441838
|
+
logicalGroup: { kind: "temporary", id: state.id, entityEffects },
|
|
441756
441839
|
trackedChangeLogicalIds: context.getHistoryTrackedChangeLogicalIds(txId) ?? undefined,
|
|
441757
441840
|
trackedChangeGroupEffects: context.getHistoryTrackedChangeGroupEffects(txId) ?? undefined
|
|
441758
441841
|
});
|
|
@@ -441878,6 +441961,8 @@ var init_temporary = __esm(() => {
|
|
|
441878
441961
|
init_stories();
|
|
441879
441962
|
init_text_range_shifts();
|
|
441880
441963
|
init_temporary_state();
|
|
441964
|
+
init_entity_effects();
|
|
441965
|
+
init_entity_catalog();
|
|
441881
441966
|
operations = new Set(["insert", "replace", "delete", "blocks.delete", "trackChanges.decide", "comments.create"]);
|
|
441882
441967
|
});
|
|
441883
441968
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc/mcp",
|
|
3
|
-
"version": "1.11.0-next.
|
|
3
|
+
"version": "1.11.0-next.2",
|
|
4
4
|
"description": "Model Context Protocol server for SuperDoc, giving an AI agent tools to read and edit .docx files.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "AGPL-3.0",
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
27
|
-
"@superdoc/sdk": "2.24.0-next.
|
|
27
|
+
"@superdoc/sdk": "2.24.0-next.2",
|
|
28
28
|
"debug": "^4.4.3",
|
|
29
29
|
"zod": "^4.3.6"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"superdoc": "2.27.0-next.
|
|
33
|
-
"@superdoc/docx-engine": "0.26.0-next.
|
|
32
|
+
"superdoc": "2.27.0-next.2",
|
|
33
|
+
"@superdoc/docx-engine": "0.26.0-next.2",
|
|
34
34
|
"@superdoc/document-api": "0.1.0-alpha.0",
|
|
35
35
|
"@types/bun": "^1.3.8",
|
|
36
36
|
"@types/node": "22.19.2",
|