@superdoc/mcp 1.0.1-next.5 → 1.0.1-next.7
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 +244 -19
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -31314,7 +31314,7 @@ var init_host = __esm(() => {
|
|
|
31314
31314
|
});
|
|
31315
31315
|
|
|
31316
31316
|
// ../../packages/sdk/langs/node/src/runtime/sdk-version.generated.ts
|
|
31317
|
-
var SDK_VERSION = "2.13.1-next.
|
|
31317
|
+
var SDK_VERSION = "2.13.1-next.7";
|
|
31318
31318
|
|
|
31319
31319
|
// ../../packages/sdk/langs/node/src/runtime/embedded-platform.ts
|
|
31320
31320
|
import { chmodSync, existsSync } from "node:fs";
|
|
@@ -369135,6 +369135,7 @@ async function compilePlan(context, input) {
|
|
|
369135
369135
|
}
|
|
369136
369136
|
detectTargetConflicts(context, steps, failures);
|
|
369137
369137
|
detectUnsupportedRuntimeDrift(input.steps, failures);
|
|
369138
|
+
detectTargetOffsetDriftRisk(steps, failures);
|
|
369138
369139
|
return { evaluatedRevision, steps, failures };
|
|
369139
369140
|
}
|
|
369140
369141
|
function isOrderedAtomicTextProgram(steps) {
|
|
@@ -369619,6 +369620,14 @@ function detectUnsupportedRuntimeDrift(steps, failures) {
|
|
|
369619
369620
|
message: "multi-step mutation plans cannot use revision-bound ref targets; use selector targets so the engine can re-resolve each step before commit."
|
|
369620
369621
|
});
|
|
369621
369622
|
}
|
|
369623
|
+
if (step3.where.by === "target" && step3.where.target.kind === "selection" && step3.where.target.start.kind === "text" && step3.where.target.end.kind === "text" && step3.where.target.start.blockId !== step3.where.target.end.blockId) {
|
|
369624
|
+
failures.push({
|
|
369625
|
+
code: "CAPABILITY_UNSUPPORTED",
|
|
369626
|
+
stepId: step3.id,
|
|
369627
|
+
phase: "compile",
|
|
369628
|
+
message: 'multi-step mutation plans cannot combine a cross-block by:"target" step with other mutating steps; ' + "conflict and offset-drift detection only see that step's first block. Apply it alone, or split the " + "plan so the cross-block step runs in its own mutations.apply call."
|
|
369629
|
+
});
|
|
369630
|
+
}
|
|
369622
369631
|
}
|
|
369623
369632
|
}
|
|
369624
369633
|
}
|
|
@@ -369659,6 +369668,33 @@ function detectTargetConflicts(context, steps, failures) {
|
|
|
369659
369668
|
}
|
|
369660
369669
|
}
|
|
369661
369670
|
}
|
|
369671
|
+
function detectTargetOffsetDriftRisk(steps, failures) {
|
|
369672
|
+
const textShiftingOps = new Set(["text.rewrite", "text.delete", "text.insert"]);
|
|
369673
|
+
const byBlock = new Map;
|
|
369674
|
+
for (const step3 of steps) {
|
|
369675
|
+
if (!textShiftingOps.has(step3.op) || step3.source.op === "assert" || step3.source.where?.by !== "target")
|
|
369676
|
+
continue;
|
|
369677
|
+
const resolutions = step3.resolutions ?? (step3.resolution ? [step3.resolution] : []);
|
|
369678
|
+
for (const resolution of resolutions) {
|
|
369679
|
+
const key2 = `${storyKeyForTarget(resolution.target)}::${resolution.target.blockId}`;
|
|
369680
|
+
const list2 = byBlock.get(key2) ?? [];
|
|
369681
|
+
list2.push(step3);
|
|
369682
|
+
byBlock.set(key2, list2);
|
|
369683
|
+
}
|
|
369684
|
+
}
|
|
369685
|
+
for (const blockSteps of byBlock.values()) {
|
|
369686
|
+
if (blockSteps.length <= 1)
|
|
369687
|
+
continue;
|
|
369688
|
+
for (const step3 of blockSteps) {
|
|
369689
|
+
failures.push({
|
|
369690
|
+
code: "CAPABILITY_UNSUPPORTED",
|
|
369691
|
+
stepId: step3.stepId,
|
|
369692
|
+
phase: "compile",
|
|
369693
|
+
message: `step "${step3.stepId}" shares a block with another by:"target" text-shifting step in this plan; explicit ` + "offsets are not re-derived between steps, so an earlier same-block step can shift this one's offsets. " + 'Split same-block edits into separate mutations.apply calls, or use by:"select" for later occurrences in ' + "the same block."
|
|
369694
|
+
});
|
|
369695
|
+
}
|
|
369696
|
+
}
|
|
369697
|
+
}
|
|
369662
369698
|
function conflictRangeForResolution(context, step3, resolution) {
|
|
369663
369699
|
if (step3.source.op !== "format.apply" || step3.source.args.scope !== "block" && step3.source.args.alignment === undefined) {
|
|
369664
369700
|
return resolution.range;
|
|
@@ -369713,9 +369749,117 @@ async function resolveMutationStep(context, step3, story, changeMode) {
|
|
|
369713
369749
|
const compiled = resolveRefMutationStep(context, step3, story, matches[0].ref);
|
|
369714
369750
|
return applySelectMatchReplacementPolicy(compiled, step3, matches[0].groups);
|
|
369715
369751
|
}
|
|
369752
|
+
if (step3.where.by === "target") {
|
|
369753
|
+
return resolveTargetWhereMutationStep(context, step3, step3.where, story, changeMode);
|
|
369754
|
+
}
|
|
369716
369755
|
const ref5 = resolveStepRef(step3);
|
|
369717
369756
|
return resolveRefMutationStep(context, step3, story, ref5);
|
|
369718
369757
|
}
|
|
369758
|
+
function resolveTargetWhereMutationStep(context, step3, where, story, changeMode) {
|
|
369759
|
+
const target = where.target;
|
|
369760
|
+
if (target.kind !== "selection" || target.start.kind !== "text" || target.end.kind !== "text") {
|
|
369761
|
+
throw new DocumentApiValidationError2("INVALID_TARGET", `v2 ${step3.op} target steps require a text SelectionTarget with text-kind endpoints.`);
|
|
369762
|
+
}
|
|
369763
|
+
const storyLocator = target.story ?? story;
|
|
369764
|
+
if (!isSupportedMutationStoryScope(storyLocator)) {
|
|
369765
|
+
throw new DocumentApiValidationError2("CAPABILITY_UNSUPPORTED", `v2 mutation plan engine supports only the body story; "${storyLocator?.storyType}" story targets are not supported.`);
|
|
369766
|
+
}
|
|
369767
|
+
if (step3.op === "text.rewrite" && step3.args.replacementMode === "regex-template") {
|
|
369768
|
+
throw new DocumentApiValidationError2("CAPABILITY_UNSUPPORTED", 'v2 text.rewrite target steps do not support replacementMode "regex-template"; an explicit target carries no ' + 'capture groups. Use a by:"select" step for regex-template replacements.');
|
|
369769
|
+
}
|
|
369770
|
+
const selectionMutation = new V2SelectionMutationAdapter(context);
|
|
369771
|
+
if (step3.op === "text.insert") {
|
|
369772
|
+
const { text: text4, position: position2 } = readInsertArgs(step3);
|
|
369773
|
+
const point3 = position2 === "before" ? target.start : target.end;
|
|
369774
|
+
const collapsed = {
|
|
369775
|
+
kind: "selection",
|
|
369776
|
+
start: point3,
|
|
369777
|
+
end: point3,
|
|
369778
|
+
...target.story ? { story: target.story } : {},
|
|
369779
|
+
...target.coordinateSpace ? { coordinateSpace: target.coordinateSpace } : {}
|
|
369780
|
+
};
|
|
369781
|
+
const request = { kind: "insert", target: collapsed, text: text4, ...story ? { in: story } : {} };
|
|
369782
|
+
const receipt3 = selectionMutation.execute({ kind: "insert", target: collapsed, text: text4, ...story ? { in: story } : {} }, { changeMode, dryRun: true });
|
|
369783
|
+
if (!receipt3.success)
|
|
369784
|
+
throw new DocumentApiValidationError2(receipt3.failure.code, receipt3.failure.message);
|
|
369785
|
+
const resolution2 = {
|
|
369786
|
+
target: receipt3.resolution.target,
|
|
369787
|
+
range: receipt3.resolution.range,
|
|
369788
|
+
text: receipt3.resolution.text
|
|
369789
|
+
};
|
|
369790
|
+
return {
|
|
369791
|
+
stepId: step3.id,
|
|
369792
|
+
op: "text.insert",
|
|
369793
|
+
resolution: resolution2,
|
|
369794
|
+
request,
|
|
369795
|
+
noopEquivalentText: text4.length === 0 ? text4 : undefined,
|
|
369796
|
+
source: step3
|
|
369797
|
+
};
|
|
369798
|
+
}
|
|
369799
|
+
if (step3.op === "format.apply") {
|
|
369800
|
+
const crossBlock = target.start.blockId !== target.end.blockId;
|
|
369801
|
+
if (crossBlock && (step3.args.alignment !== undefined || step3.args.scope === "block")) {
|
|
369802
|
+
throw new DocumentApiValidationError2("CAPABILITY_UNSUPPORTED", "v2 format.apply target steps spanning more than one block support only an inline patch with the default " + '(non-block) scope; split a cross-block alignment or scope:"block" edit into one step per block.');
|
|
369803
|
+
}
|
|
369804
|
+
const placeholderResolution = {
|
|
369805
|
+
target: {
|
|
369806
|
+
kind: "text",
|
|
369807
|
+
blockId: target.start.blockId,
|
|
369808
|
+
range: { start: 0, end: 0 },
|
|
369809
|
+
...storyLocator ? { story: storyLocator } : {}
|
|
369810
|
+
},
|
|
369811
|
+
range: { from: 0, to: 0 },
|
|
369812
|
+
text: ""
|
|
369813
|
+
};
|
|
369814
|
+
const request = buildFormatCommitRequest(context, step3, placeholderResolution, target, story, storyLocator);
|
|
369815
|
+
if (request.kind !== "format") {
|
|
369816
|
+
throw new DocumentApiValidationError2("INVALID_TARGET", "v2 format.apply target steps require a resolvable target.");
|
|
369817
|
+
}
|
|
369818
|
+
let resolution2;
|
|
369819
|
+
if (request.inline) {
|
|
369820
|
+
const receipt3 = "target" in request ? selectionMutation.execute({ kind: "format", target: request.target, inline: request.inline, ...request.in ? { in: request.in } : {} }, { changeMode, dryRun: true, ...request.skipAtomicObjects ? { skipAtomicObjects: true } : {} }) : selectionMutation.execute({ kind: "format", ref: request.ref, inline: request.inline, ...request.in ? { in: request.in } : {} }, { changeMode, dryRun: true, ...request.skipAtomicObjects ? { skipAtomicObjects: true } : {} });
|
|
369821
|
+
if (!receipt3.success)
|
|
369822
|
+
throw new DocumentApiValidationError2(receipt3.failure.code, receipt3.failure.message);
|
|
369823
|
+
resolution2 = {
|
|
369824
|
+
target: receipt3.resolution.target,
|
|
369825
|
+
range: receipt3.resolution.range,
|
|
369826
|
+
text: receipt3.resolution.text
|
|
369827
|
+
};
|
|
369828
|
+
} else {
|
|
369829
|
+
const blockText = readBlockTargetText(context, target.start.blockId, Number.MAX_SAFE_INTEGER, storyLocator, target.coordinateSpace);
|
|
369830
|
+
resolution2 = {
|
|
369831
|
+
target: { kind: "text", blockId: target.start.blockId, range: { start: 0, end: blockText.length }, ...storyLocator ? { story: storyLocator } : {} },
|
|
369832
|
+
range: { from: 0, to: blockText.length },
|
|
369833
|
+
text: blockText
|
|
369834
|
+
};
|
|
369835
|
+
}
|
|
369836
|
+
return {
|
|
369837
|
+
stepId: step3.id,
|
|
369838
|
+
op: "format.apply",
|
|
369839
|
+
resolution: resolution2,
|
|
369840
|
+
request,
|
|
369841
|
+
source: step3
|
|
369842
|
+
};
|
|
369843
|
+
}
|
|
369844
|
+
const rewriteTemplate = step3.op === "text.delete" ? "" : normalizeReplacement(step3.args.replacement);
|
|
369845
|
+
const probeReceipt = selectionMutation.execute({ kind: "replace", target, text: rewriteTemplate, ...story ? { in: story } : {} }, { changeMode, dryRun: true });
|
|
369846
|
+
if (!probeReceipt.success)
|
|
369847
|
+
throw new DocumentApiValidationError2(probeReceipt.failure.code, probeReceipt.failure.message);
|
|
369848
|
+
const resolution = {
|
|
369849
|
+
target: probeReceipt.resolution.target,
|
|
369850
|
+
range: probeReceipt.resolution.range,
|
|
369851
|
+
text: probeReceipt.resolution.text
|
|
369852
|
+
};
|
|
369853
|
+
const replacementText = step3.op === "text.delete" ? "" : replacementTextForMatch(step3, resolution.text);
|
|
369854
|
+
return {
|
|
369855
|
+
stepId: step3.id,
|
|
369856
|
+
op: step3.op,
|
|
369857
|
+
resolution,
|
|
369858
|
+
request: { kind: "replace", target, text: replacementText, ...story ? { in: story } : {} },
|
|
369859
|
+
...step3.op === "text.rewrite" ? { noopEquivalentText: replacementText } : {},
|
|
369860
|
+
source: step3
|
|
369861
|
+
};
|
|
369862
|
+
}
|
|
369719
369863
|
function resolveRefMutationStep(context, step3, story, ref5, cache) {
|
|
369720
369864
|
if (isV2RangeRef(ref5)) {
|
|
369721
369865
|
return resolveRangeRefMutationStep(context, step3, story, ref5);
|
|
@@ -421919,13 +422063,21 @@ function mirrorStoryBlocksFromSession(input) {
|
|
|
421919
422063
|
});
|
|
421920
422064
|
}
|
|
421921
422065
|
syncBlockPayloads(input.doc, payloads);
|
|
421922
|
-
} else
|
|
421923
|
-
|
|
421924
|
-
|
|
421925
|
-
|
|
421926
|
-
|
|
421927
|
-
|
|
421928
|
-
|
|
422066
|
+
} else {
|
|
422067
|
+
const physicallyMerged = input.prepared.semanticDelta.invalidatedRefs.some((ref5) => ref5.kind === "block" && ref5.storyId === input.storyId && ref5.nodeId === source.second.paraId);
|
|
422068
|
+
if (physicallyMerged) {
|
|
422069
|
+
if (findBlockMap(input.doc, source.first.paraId) && findBlockMap(input.doc, source.second.paraId)) {
|
|
422070
|
+
mergeBlocks({
|
|
422071
|
+
doc: input.doc,
|
|
422072
|
+
firstBlockId: source.first.paraId,
|
|
422073
|
+
secondBlockId: source.second.paraId,
|
|
422074
|
+
origin: STORY_SURFACE_BACKEND_ORIGIN
|
|
422075
|
+
});
|
|
422076
|
+
}
|
|
422077
|
+
syncBlocksFromSession(input.session, input.storyId, input.doc, [source.first.paraId]);
|
|
422078
|
+
} else {
|
|
422079
|
+
syncBlocksFromSession(input.session, input.storyId, input.doc, input.extension.targetBlockIds);
|
|
422080
|
+
}
|
|
421929
422081
|
}
|
|
421930
422082
|
writeParagraphMembershipTableOverlaysFromSession(input.session, input.prepared, input.storyId, input.doc, [source.first.paraId, source.second.paraId], "paragraph.merge");
|
|
421931
422083
|
return;
|
|
@@ -423027,6 +423179,14 @@ var init_story_surface_session_sync = __esm(() => {
|
|
|
423027
423179
|
});
|
|
423028
423180
|
|
|
423029
423181
|
// ../../../v2/collaboration-v2/dist/backend/story-surface-execution-backend.js
|
|
423182
|
+
function trackedStoryTextRequiresMergedCarrierSync(validation) {
|
|
423183
|
+
if (!validation || validation.source.changeMode !== "tracked")
|
|
423184
|
+
return false;
|
|
423185
|
+
const authorsText = validation.trackedInsert != null || validation.trackedInsertContinuation === true || (validation.trackedRefinement?.metadata.insertedText.length ?? 0) > 0;
|
|
423186
|
+
if (!authorsText && validation.trackedRefinement?.usesMergedCarrier !== true)
|
|
423187
|
+
return false;
|
|
423188
|
+
return snapshotStoryShard(validation.doc).blocks.some((block) => block.blockId === validation.target.blockId && block.mergedTailBlockIds.length > 0);
|
|
423189
|
+
}
|
|
423030
423190
|
function createStorySurfaceExecutionBackend(options) {
|
|
423031
423191
|
const delegate = options.delegate;
|
|
423032
423192
|
return {
|
|
@@ -423215,7 +423375,8 @@ function runFamilyMirror(prepared, extension2, options, directStoryText, tracked
|
|
|
423215
423375
|
};
|
|
423216
423376
|
}
|
|
423217
423377
|
if (extension2.family === "storyText") {
|
|
423218
|
-
|
|
423378
|
+
const mergedCarrierSync = trackedStoryTextRequiresMergedCarrierSync(directStoryText);
|
|
423379
|
+
if (extension2.historyReplay || extension2.resyncFromSession || extension2.sessionSync || mergedCarrierSync) {
|
|
423219
423380
|
if (!options.session) {
|
|
423220
423381
|
return {
|
|
423221
423382
|
mirrored: false,
|
|
@@ -423229,7 +423390,7 @@ function runFamilyMirror(prepared, extension2, options, directStoryText, tracked
|
|
|
423229
423390
|
const sessionSync = mirrorStorySurfaceFromSession({
|
|
423230
423391
|
session: options.session,
|
|
423231
423392
|
prepared,
|
|
423232
|
-
extension: extension2,
|
|
423393
|
+
extension: mergedCarrierSync && !extension2.sessionSync ? { ...extension2, sessionSync: { reason: "structural-inline-edit" } } : extension2,
|
|
423233
423394
|
storyIds: storyIdsRequiringShards(prepared, extension2),
|
|
423234
423395
|
resolveStoryShard: options.resolveStoryShard
|
|
423235
423396
|
});
|
|
@@ -424050,6 +424211,9 @@ function admitPreparedStorySurfaceMutation(prepared, options) {
|
|
|
424050
424211
|
return validateStoryTextSessionSync(prepared, extension2, options);
|
|
424051
424212
|
}
|
|
424052
424213
|
const direct = validateDirectStoryText(prepared, extension2, options);
|
|
424214
|
+
if (direct.ok && trackedStoryTextRequiresMergedCarrierSync(direct) && !options.session) {
|
|
424215
|
+
return { ok: false, message: "tracked text across merged carriers requires an authoritative session" };
|
|
424216
|
+
}
|
|
424053
424217
|
return direct.ok ? { ok: true, directStoryText: direct } : { ok: false, message: direct.failureReason };
|
|
424054
424218
|
}
|
|
424055
424219
|
const storyIds = [...new Set(prepared.resolvedTargets.stories.map((storyId) => String(storyId)))];
|
|
@@ -424488,9 +424652,18 @@ function validateDirectStoryText(prepared, extension2, options) {
|
|
|
424488
424652
|
let validatedTrackedRefinement;
|
|
424489
424653
|
if (trackedRefinement?.ok) {
|
|
424490
424654
|
const live = validateTrackedTextRefinementTarget(hydratedBlock, trackedRefinement.metadata);
|
|
424491
|
-
if (
|
|
424492
|
-
|
|
424493
|
-
|
|
424655
|
+
if (live.ok) {
|
|
424656
|
+
validatedTrackedRefinement = { metadata: trackedRefinement.metadata, span: live.span };
|
|
424657
|
+
} else {
|
|
424658
|
+
const merged = validateMergedCarrierTrackedTextRefinementTarget(doc2, source.on.startBlockId, trackedRefinement.metadata);
|
|
424659
|
+
if (!merged.ok)
|
|
424660
|
+
return { ok: false, failureReason: live.failureReason };
|
|
424661
|
+
validatedTrackedRefinement = {
|
|
424662
|
+
metadata: trackedRefinement.metadata,
|
|
424663
|
+
span: merged.span,
|
|
424664
|
+
usesMergedCarrier: true
|
|
424665
|
+
};
|
|
424666
|
+
}
|
|
424494
424667
|
} else {
|
|
424495
424668
|
const mutationStart = trackedEdit?.ok ? trackedEdit.trackedEdit.startOffset : source.on.startOffset;
|
|
424496
424669
|
const mutationEnd = trackedEdit?.ok ? trackedEdit.trackedEdit.endOffset : source.on.endOffset;
|
|
@@ -424583,6 +424756,58 @@ function validateTrackedTextRefinementTarget(block, metadata2) {
|
|
|
424583
424756
|
}
|
|
424584
424757
|
return { ok: true, span };
|
|
424585
424758
|
}
|
|
424759
|
+
function validateMergedCarrierTrackedTextRefinementTarget(doc2, blockId, metadata2) {
|
|
424760
|
+
const block = snapshotStoryShard(doc2).blocks.find((candidate2) => candidate2.blockId === blockId);
|
|
424761
|
+
if (!block || block.mergedTailBlockIds.length === 0) {
|
|
424762
|
+
return { ok: false, failureReason: "tracked text refinement has no merged paragraph carriers" };
|
|
424763
|
+
}
|
|
424764
|
+
const starts = block.atoms.map((atom, index2) => ({ atom, index: index2 })).filter(({ atom }) => atom.kind === INLINE_ATOM_KIND.trackedWrapper && atom.meta.wrapper === "ins" && String(atom.meta.rsid ?? "") === metadata2.insertionRsid && atom.meta.position === "start");
|
|
424765
|
+
const ends = block.atoms.map((atom, index2) => ({ atom, index: index2 })).filter(({ atom }) => atom.kind === INLINE_ATOM_KIND.trackedWrapper && atom.meta.wrapper === "ins" && String(atom.meta.rsid ?? "") === metadata2.insertionRsid && atom.meta.position === "end");
|
|
424766
|
+
const candidates = starts.flatMap((start) => {
|
|
424767
|
+
const end = ends.find((candidate2) => candidate2.index > start.index);
|
|
424768
|
+
if (!end)
|
|
424769
|
+
return [];
|
|
424770
|
+
const span2 = {
|
|
424771
|
+
trackedKind: "ins",
|
|
424772
|
+
blockId,
|
|
424773
|
+
startOffset: start.atom.visibleOffset,
|
|
424774
|
+
endOffset: end.atom.visibleOffset,
|
|
424775
|
+
sourceStartOffset: start.atom.visibleOffset,
|
|
424776
|
+
sourceEndOffset: end.atom.visibleOffset,
|
|
424777
|
+
startAtomIndex: start.index,
|
|
424778
|
+
startAtomId: start.atom.id,
|
|
424779
|
+
endAtomId: end.atom.id,
|
|
424780
|
+
preservedAtomIds: [],
|
|
424781
|
+
containedAtomIds: block.atoms.slice(start.index + 1, end.index).map((atom) => atom.id),
|
|
424782
|
+
deletedRuns: [],
|
|
424783
|
+
deletedSegments: []
|
|
424784
|
+
};
|
|
424785
|
+
return metadata2.liveTextRange.startOffset >= span2.startOffset && metadata2.liveTextRange.endOffset <= span2.endOffset ? [span2] : [];
|
|
424786
|
+
});
|
|
424787
|
+
if (candidates.length !== 1) {
|
|
424788
|
+
return {
|
|
424789
|
+
ok: false,
|
|
424790
|
+
failureReason: `tracked text refinement could not resolve insertion ${metadata2.insertionRsid}`
|
|
424791
|
+
};
|
|
424792
|
+
}
|
|
424793
|
+
const span = candidates[0];
|
|
424794
|
+
const resultLength = span.endOffset - span.startOffset - (metadata2.liveTextRange.endOffset - metadata2.liveTextRange.startOffset) + metadata2.insertedText.length;
|
|
424795
|
+
if (resultLength < 0 || metadata2.removesInsertion !== (resultLength === 0)) {
|
|
424796
|
+
return { ok: false, failureReason: "tracked text refinement removal metadata does not match live insertion" };
|
|
424797
|
+
}
|
|
424798
|
+
if (span.containedAtomIds.length > 0) {
|
|
424799
|
+
return {
|
|
424800
|
+
ok: false,
|
|
424801
|
+
failureReason: "tracked text refinement intersects an unsupported insertion carrier"
|
|
424802
|
+
};
|
|
424803
|
+
}
|
|
424804
|
+
const ownCarrierIds = new Set([span.startAtomId, span.endAtomId]);
|
|
424805
|
+
const unsafeCarrier = block.atoms.find((atom) => !ownCarrierIds.has(atom.id) && atom.visibleOffset > metadata2.liveTextRange.startOffset && atom.visibleOffset < metadata2.liveTextRange.endOffset);
|
|
424806
|
+
if (unsafeCarrier) {
|
|
424807
|
+
return { ok: false, failureReason: `tracked text refinement intersects ${unsafeCarrier.kind} atom` };
|
|
424808
|
+
}
|
|
424809
|
+
return { ok: true, span };
|
|
424810
|
+
}
|
|
424586
424811
|
function validateTrackedTextInsert(source, extension2) {
|
|
424587
424812
|
if (extension2.changeMode !== "tracked") {
|
|
424588
424813
|
return { ok: false, failureReason: "tracked editText source requires tracked storySurface metadata" };
|
|
@@ -424681,7 +424906,7 @@ function mirrorTrackedTextInsert(input) {
|
|
|
424681
424906
|
wrapper: "ins",
|
|
424682
424907
|
position: "start",
|
|
424683
424908
|
rsid: input.trackedInsert.rsid,
|
|
424684
|
-
wId: input.trackedInsert.wId,
|
|
424909
|
+
wId: String(input.trackedInsert.wId),
|
|
424685
424910
|
author: input.trackedInsert.author,
|
|
424686
424911
|
authorEmail: author.email ?? null,
|
|
424687
424912
|
date: input.trackedInsert.date
|
|
@@ -424695,7 +424920,7 @@ function mirrorTrackedTextInsert(input) {
|
|
|
424695
424920
|
wrapper: "ins",
|
|
424696
424921
|
position: "end",
|
|
424697
424922
|
rsid: input.trackedInsert.rsid,
|
|
424698
|
-
wId: input.trackedInsert.wId,
|
|
424923
|
+
wId: String(input.trackedInsert.wId),
|
|
424699
424924
|
author: input.trackedInsert.author,
|
|
424700
424925
|
authorEmail: author.email ?? null,
|
|
424701
424926
|
date: input.trackedInsert.date
|
|
@@ -424878,7 +425103,7 @@ function mirrorTrackedTextEdit(input) {
|
|
|
424878
425103
|
wrapper: "del",
|
|
424879
425104
|
position: "start",
|
|
424880
425105
|
rsid: input.trackedEdit.deletion.rsid,
|
|
424881
|
-
wId: input.trackedEdit.deletion.wId,
|
|
425106
|
+
wId: String(input.trackedEdit.deletion.wId),
|
|
424882
425107
|
author: input.trackedEdit.deletion.author,
|
|
424883
425108
|
authorEmail: deletionAuthor.email ?? null,
|
|
424884
425109
|
date: input.trackedEdit.deletion.date
|
|
@@ -424898,7 +425123,7 @@ function mirrorTrackedTextEdit(input) {
|
|
|
424898
425123
|
wrapper: "del",
|
|
424899
425124
|
position: "end",
|
|
424900
425125
|
rsid: input.trackedEdit.deletion.rsid,
|
|
424901
|
-
wId: input.trackedEdit.deletion.wId,
|
|
425126
|
+
wId: String(input.trackedEdit.deletion.wId),
|
|
424902
425127
|
author: input.trackedEdit.deletion.author,
|
|
424903
425128
|
authorEmail: deletionAuthor.email ?? null,
|
|
424904
425129
|
date: input.trackedEdit.deletion.date
|
|
@@ -424918,7 +425143,7 @@ function mirrorTrackedTextEdit(input) {
|
|
|
424918
425143
|
wrapper: "ins",
|
|
424919
425144
|
position: "start",
|
|
424920
425145
|
rsid: insertion.rsid,
|
|
424921
|
-
wId: insertion.wId,
|
|
425146
|
+
wId: String(insertion.wId),
|
|
424922
425147
|
author: insertion.author,
|
|
424923
425148
|
authorEmail: insertionAuthor.email ?? null,
|
|
424924
425149
|
date: insertion.date
|
|
@@ -424931,7 +425156,7 @@ function mirrorTrackedTextEdit(input) {
|
|
|
424931
425156
|
wrapper: "ins",
|
|
424932
425157
|
position: "end",
|
|
424933
425158
|
rsid: insertion.rsid,
|
|
424934
|
-
wId: insertion.wId,
|
|
425159
|
+
wId: String(insertion.wId),
|
|
424935
425160
|
author: insertion.author,
|
|
424936
425161
|
authorEmail: insertionAuthor.email ?? null,
|
|
424937
425162
|
date: insertion.date
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc/mcp",
|
|
3
|
-
"version": "1.0.1-next.
|
|
3
|
+
"version": "1.0.1-next.7",
|
|
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.13.1-next.
|
|
27
|
+
"@superdoc/sdk": "2.13.1-next.7",
|
|
28
28
|
"debug": "^4.4.3",
|
|
29
29
|
"zod": "^4.3.6"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"superdoc": "2.16.1-next.
|
|
33
|
-
"@superdoc/docx-engine": "0.15.1-next.
|
|
32
|
+
"superdoc": "2.16.1-next.7",
|
|
33
|
+
"@superdoc/docx-engine": "0.15.1-next.6",
|
|
34
34
|
"@superdoc/document-api": "0.1.0-alpha.0",
|
|
35
35
|
"@types/bun": "^1.3.8",
|
|
36
36
|
"@types/node": "22.19.2",
|