@superdoc/mcp 1.7.0-next.10 → 1.7.0-next.11
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 +107 -23
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -31600,7 +31600,7 @@ var init_host = __esm(() => {
|
|
|
31600
31600
|
});
|
|
31601
31601
|
|
|
31602
31602
|
// ../../packages/sdk/langs/node/src/runtime/sdk-version.generated.ts
|
|
31603
|
-
var SDK_VERSION = "2.20.0-next.
|
|
31603
|
+
var SDK_VERSION = "2.20.0-next.11";
|
|
31604
31604
|
|
|
31605
31605
|
// ../../packages/sdk/langs/node/src/runtime/embedded-platform.ts
|
|
31606
31606
|
import { accessSync, chmodSync, constants, existsSync, statSync } from "node:fs";
|
|
@@ -104422,7 +104422,20 @@ function validateChangeMode(value) {
|
|
|
104422
104422
|
value
|
|
104423
104423
|
});
|
|
104424
104424
|
}
|
|
104425
|
+
function normalizeTextMutationOptions(options) {
|
|
104426
|
+
const { author, ...mutationOptions } = options ?? {};
|
|
104427
|
+
const normalized = normalizeMutationOptions(mutationOptions);
|
|
104428
|
+
if (!options || !("author" in options))
|
|
104429
|
+
return normalized;
|
|
104430
|
+
if (options.changeMode !== "tracked" || !isRecord6(author) || Object.keys(author).some((key) => key !== "name") || typeof author.name !== "string" || author.name.trim().length === 0) {
|
|
104431
|
+
throw new DocumentApiValidationError("INVALID_INPUT", 'author requires changeMode: "tracked" and an object containing only a non-empty name.');
|
|
104432
|
+
}
|
|
104433
|
+
return { ...normalized, changeMode: "tracked", author: { name: author.name } };
|
|
104434
|
+
}
|
|
104425
104435
|
function normalizeMutationOptions(options, supportCheckOperation) {
|
|
104436
|
+
if (options && typeof options === "object" && "author" in options) {
|
|
104437
|
+
throw new DocumentApiValidationError("INVALID_INPUT", "author is supported only for tracked plain-text doc.insert, doc.delete, and doc.replace calls.");
|
|
104438
|
+
}
|
|
104426
104439
|
validateChangeMode(options?.changeMode);
|
|
104427
104440
|
const supportCheck = options?.supportCheck;
|
|
104428
104441
|
if (supportCheck !== undefined) {
|
|
@@ -104461,7 +104474,7 @@ function validateSupportCheckGuard(value, operation) {
|
|
|
104461
104474
|
}
|
|
104462
104475
|
}
|
|
104463
104476
|
function executeWrite(adapter, request, options) {
|
|
104464
|
-
return adapter.write(request,
|
|
104477
|
+
return adapter.write(request, normalizeTextMutationOptions(options));
|
|
104465
104478
|
}
|
|
104466
104479
|
var CHANGE_MODE_VALUES;
|
|
104467
104480
|
var init_write = __esm(() => {
|
|
@@ -106674,6 +106687,7 @@ function textReceiptToSDReceipt(receipt2, context = {}) {
|
|
|
106674
106687
|
...receipt2.failure.details != null ? { details: receipt2.failure.details } : {}
|
|
106675
106688
|
};
|
|
106676
106689
|
const CODE_MAP = {
|
|
106690
|
+
INVALID_INPUT: "INVALID_INPUT",
|
|
106677
106691
|
INVALID_TARGET: "INVALID_TARGET",
|
|
106678
106692
|
TARGET_NOT_FOUND: "TARGET_NOT_FOUND",
|
|
106679
106693
|
MATCH_NOT_FOUND: "TARGET_NOT_FOUND",
|
|
@@ -106792,6 +106806,9 @@ function validateStructuralInsertInput(input) {
|
|
|
106792
106806
|
function executeInsert(selectionAdapter, writeAdapter, input, options) {
|
|
106793
106807
|
assertOperationCanStart(options);
|
|
106794
106808
|
validateInsertInput(input);
|
|
106809
|
+
if (options && "author" in options && (isStructuralInsertInput(input) || input.type === "html" || input.type === "markdown")) {
|
|
106810
|
+
throw new DocumentApiValidationError("INVALID_INPUT", "author is supported only for tracked plain-text inserts.");
|
|
106811
|
+
}
|
|
106795
106812
|
if (isStructuralInsertInput(input)) {
|
|
106796
106813
|
return writeAdapter.insertStructured(input, normalizeMutationOptions(options));
|
|
106797
106814
|
}
|
|
@@ -106803,7 +106820,7 @@ function executeInsert(selectionAdapter, writeAdapter, input, options) {
|
|
|
106803
106820
|
const { target, ref, in: storyIn } = input;
|
|
106804
106821
|
if (target || ref) {
|
|
106805
106822
|
const request2 = target ? { kind: "insert", target, text: value, ...storyIn ? { in: storyIn } : {} } : { kind: "insert", ref, text: value, ...storyIn ? { in: storyIn } : {} };
|
|
106806
|
-
const textReceipt2 = selectionAdapter.execute(request2,
|
|
106823
|
+
const textReceipt2 = selectionAdapter.execute(request2, normalizeTextMutationOptions(options));
|
|
106807
106824
|
return textReceiptToSDReceipt(textReceipt2);
|
|
106808
106825
|
}
|
|
106809
106826
|
const request = { kind: "insert", text: value, ...storyIn ? { in: storyIn } : {} };
|
|
@@ -106979,6 +106996,9 @@ function validateBodyReplaceShape(input) {
|
|
|
106979
106996
|
}
|
|
106980
106997
|
function executeReplace(selectionAdapter, writeAdapter, input, options) {
|
|
106981
106998
|
validateReplaceInput(input);
|
|
106999
|
+
if (options && "author" in options && (isStructuralReplaceInput(input) || isRichContentReplaceInput(input) || input.target && isBodyReplaceTarget(input.target))) {
|
|
107000
|
+
throw new DocumentApiValidationError("INVALID_INPUT", "author is supported only for tracked plain-text replacements.");
|
|
107001
|
+
}
|
|
106982
107002
|
if (isStructuralReplaceInput(input)) {
|
|
106983
107003
|
return writeAdapter.replaceStructured(input, normalizeMutationOptions(options));
|
|
106984
107004
|
}
|
|
@@ -106996,7 +107016,7 @@ function executeReplace(selectionAdapter, writeAdapter, input, options) {
|
|
|
106996
107016
|
in: textInput.in,
|
|
106997
107017
|
...textInput.expectedText !== undefined ? { expectedText: textInput.expectedText } : {}
|
|
106998
107018
|
} : { kind: "replace", ref: textInput.ref, text: textInput.text, in: textInput.in };
|
|
106999
|
-
const textReceipt = selectionAdapter.execute(request,
|
|
107019
|
+
const textReceipt = selectionAdapter.execute(request, normalizeTextMutationOptions(options));
|
|
107000
107020
|
return textReceiptToSDReceipt(textReceipt);
|
|
107001
107021
|
}
|
|
107002
107022
|
var TEXT_REPLACE_ALLOWED_KEYS, STRUCTURAL_REPLACE_ALLOWED_KEYS, RICH_REPLACE_ALLOWED_KEYS, RICH_REPLACE_TYPES;
|
|
@@ -117062,7 +117082,7 @@ function validateDeleteInput(input) {
|
|
|
117062
117082
|
function executeDelete(adapter, input, options) {
|
|
117063
117083
|
validateDeleteInput(input);
|
|
117064
117084
|
const request = input.target ? { kind: "delete", target: input.target, behavior: input.behavior ?? "selection", in: input.in } : { kind: "delete", ref: input.ref, behavior: input.behavior ?? "selection", in: input.in };
|
|
117065
|
-
return adapter.execute(request,
|
|
117085
|
+
return adapter.execute(request, normalizeTextMutationOptions(options));
|
|
117066
117086
|
}
|
|
117067
117087
|
var DELETE_INPUT_ALLOWED_KEYS, VALID_BEHAVIORS;
|
|
117068
117088
|
var init_delete = __esm(() => {
|
|
@@ -301621,7 +301641,7 @@ var init_paragraph_ids = __esm(() => {
|
|
|
301621
301641
|
|
|
301622
301642
|
// ../../../v2/document-api-v2-adapter/dist/story-surfaces/tracked-block-range.js
|
|
301623
301643
|
function prepareTrackedBlockRangeReplacement(input) {
|
|
301624
|
-
const author = input.context.readAuthor();
|
|
301644
|
+
const author = input.author ?? input.context.readAuthor();
|
|
301625
301645
|
if (!author?.name)
|
|
301626
301646
|
return {
|
|
301627
301647
|
ok: false,
|
|
@@ -330527,7 +330547,7 @@ function runRangeCollapse(deps, plan) {
|
|
|
330527
330547
|
function runParagraphOp(deps, apply) {
|
|
330528
330548
|
const { context } = deps;
|
|
330529
330549
|
const beginMutationStartedAt = performanceNowMs();
|
|
330530
|
-
const begun = context.beginMutation({});
|
|
330550
|
+
const begun = context.beginMutation({ author: deps.author });
|
|
330531
330551
|
if ("failure" in begun) {
|
|
330532
330552
|
throw new RangePasteStepError({ code: begun.failure.code, message: begun.failure.message });
|
|
330533
330553
|
}
|
|
@@ -330975,7 +330995,7 @@ var init_raw_block_ref = __esm(() => {
|
|
|
330975
330995
|
|
|
330976
330996
|
// ../../../v2/document-api-v2-adapter/dist/story-surfaces/tracked-body-replacement.js
|
|
330977
330997
|
function prepareTrackedBodyReplacement(input) {
|
|
330978
|
-
if (!input.context.readAuthor()?.name)
|
|
330998
|
+
if (!(input.author ?? input.context.readAuthor())?.name)
|
|
330979
330999
|
return {
|
|
330980
331000
|
ok: false,
|
|
330981
331001
|
code: "PRECONDITION_FAILED",
|
|
@@ -330994,7 +331014,8 @@ function prepareTrackedBodyReplacement(input) {
|
|
|
330994
331014
|
...input,
|
|
330995
331015
|
beforeXml: before.content,
|
|
330996
331016
|
afterXml: after.content,
|
|
330997
|
-
namespaceBindings: new Map(Object.entries(before.body.namespaceBindings))
|
|
331017
|
+
namespaceBindings: new Map(Object.entries(before.body.namespaceBindings)),
|
|
331018
|
+
author: input.author
|
|
330998
331019
|
});
|
|
330999
331020
|
if (!replacement.ok)
|
|
331000
331021
|
return replacement;
|
|
@@ -332926,6 +332947,9 @@ var init_effective_inline_uniformity = __esm(() => {
|
|
|
332926
332947
|
});
|
|
332927
332948
|
|
|
332928
332949
|
// ../../../v2/document-api-v2-adapter/dist/selection-mutation/adapter.js
|
|
332950
|
+
function textMutationAuthor(options) {
|
|
332951
|
+
return options?.author;
|
|
332952
|
+
}
|
|
332929
332953
|
function selectionIsAllowedByDocumentProtection(context, target, index2, storyId) {
|
|
332930
332954
|
const protection = new V2ProtectionAdapter(context).get().editingRestriction;
|
|
332931
332955
|
if (!protection.runtimeEnforced)
|
|
@@ -332992,7 +333016,7 @@ class V2SelectionMutationAdapter {
|
|
|
332992
333016
|
resolution: protectedEdit.resolution
|
|
332993
333017
|
};
|
|
332994
333018
|
}
|
|
332995
|
-
const begun = this.context.beginMutation({ expectedRevision: options?.expectedRevision });
|
|
333019
|
+
const begun = this.context.beginMutation({ expectedRevision: options?.expectedRevision, author: textMutationAuthor(options) });
|
|
332996
333020
|
if ("failure" in begun) {
|
|
332997
333021
|
return { success: false, failure: begun.failure, resolution: edits[0].resolution };
|
|
332998
333022
|
}
|
|
@@ -333361,7 +333385,8 @@ class V2SelectionMutationAdapter {
|
|
|
333361
333385
|
resolved: wholeStory.resolved,
|
|
333362
333386
|
resolution: resolution2,
|
|
333363
333387
|
effectiveStory: effectiveStory2,
|
|
333364
|
-
expectedRevision: options?.expectedRevision
|
|
333388
|
+
expectedRevision: options?.expectedRevision,
|
|
333389
|
+
author: textMutationAuthor(options)
|
|
333365
333390
|
});
|
|
333366
333391
|
}
|
|
333367
333392
|
}
|
|
@@ -333527,7 +333552,7 @@ class V2SelectionMutationAdapter {
|
|
|
333527
333552
|
};
|
|
333528
333553
|
}
|
|
333529
333554
|
const beginMutationStartedAt = nowMs6();
|
|
333530
|
-
const begun = this.context.beginMutation({});
|
|
333555
|
+
const begun = this.context.beginMutation({ author: textMutationAuthor(options) });
|
|
333531
333556
|
if ("failure" in begun) {
|
|
333532
333557
|
return {
|
|
333533
333558
|
success: false,
|
|
@@ -333755,6 +333780,9 @@ class V2SelectionMutationAdapter {
|
|
|
333755
333780
|
}
|
|
333756
333781
|
executeCrossParagraphReplace(input) {
|
|
333757
333782
|
const { target, index: index2, story, storyLocator, text: text4, startedAt, storyResolveMs, offsetSpace, options, atomicFieldDelete } = input;
|
|
333783
|
+
if (text4.length > 0 && textMutationAuthor(options)) {
|
|
333784
|
+
return failureWithoutResolution("INVALID_INPUT", "Per-call author is not supported for structural cross-paragraph replacements.");
|
|
333785
|
+
}
|
|
333758
333786
|
if (target.coordinateSpace === "tracked") {
|
|
333759
333787
|
return failureWithoutResolution("CAPABILITY_UNAVAILABLE", "text-range-cross-paragraph-tracked-coordinate-unsupported");
|
|
333760
333788
|
}
|
|
@@ -333863,7 +333891,7 @@ class V2SelectionMutationAdapter {
|
|
|
333863
333891
|
return { success: true, resolution };
|
|
333864
333892
|
if (text4.length > 0) {
|
|
333865
333893
|
const beginMutationStartedAt = nowMs6();
|
|
333866
|
-
const begun = this.context.beginMutation({ expectedRevision: options?.expectedRevision });
|
|
333894
|
+
const begun = this.context.beginMutation({ expectedRevision: options?.expectedRevision, author: textMutationAuthor(options) });
|
|
333867
333895
|
if ("failure" in begun) {
|
|
333868
333896
|
return { success: false, failure: begun.failure, resolution };
|
|
333869
333897
|
}
|
|
@@ -333978,6 +334006,7 @@ class V2SelectionMutationAdapter {
|
|
|
333978
334006
|
index: index2,
|
|
333979
334007
|
historyLabel: "selection.delete.cross-paragraph",
|
|
333980
334008
|
changeMode,
|
|
334009
|
+
author: textMutationAuthor(options),
|
|
333981
334010
|
preflightValidated: true,
|
|
333982
334011
|
recordCommitDiagnostics(diagnostics) {
|
|
333983
334012
|
commitDiagnosticsRef.current = diagnostics;
|
|
@@ -334037,6 +334066,9 @@ class V2SelectionMutationAdapter {
|
|
|
334037
334066
|
}
|
|
334038
334067
|
executeCrossCellDelete(input) {
|
|
334039
334068
|
const { target, index: index2, story, storyLocator, offsetSpace, options } = input;
|
|
334069
|
+
if (textMutationAuthor(options)) {
|
|
334070
|
+
return failureWithoutResolution("INVALID_INPUT", "Per-call author is not supported for cross-cell deletion.");
|
|
334071
|
+
}
|
|
334040
334072
|
const plan = resolveCrossCellDeletePlan({
|
|
334041
334073
|
context: this.context,
|
|
334042
334074
|
buildOffsetMap: buildOffsetMapForCoordinateSpace3,
|
|
@@ -334100,7 +334132,7 @@ class V2SelectionMutationAdapter {
|
|
|
334100
334132
|
};
|
|
334101
334133
|
}
|
|
334102
334134
|
executeTrackedWholeStoryDelete(input) {
|
|
334103
|
-
const begun = this.context.beginMutation(
|
|
334135
|
+
const begun = this.context.beginMutation({ expectedRevision: input.expectedRevision, author: input.author });
|
|
334104
334136
|
if ("failure" in begun) {
|
|
334105
334137
|
return {
|
|
334106
334138
|
success: false,
|
|
@@ -334900,7 +334932,8 @@ class V2SelectionMutationAdapter {
|
|
|
334900
334932
|
context: this.context,
|
|
334901
334933
|
beforeXml: sourceXml,
|
|
334902
334934
|
afterXml: nextXml,
|
|
334903
|
-
dryRun: options?.dryRun
|
|
334935
|
+
dryRun: options?.dryRun,
|
|
334936
|
+
author: textMutationAuthor(options)
|
|
334904
334937
|
});
|
|
334905
334938
|
if (!replacement.ok) {
|
|
334906
334939
|
return { success: false, failure: { code: replacement.code, message: replacement.message }, resolution };
|
|
@@ -337809,7 +337842,9 @@ class V2TablesAdapter {
|
|
|
337809
337842
|
const model = parseTableXmlModel(resolved.tableXml);
|
|
337810
337843
|
mutateTablePr(model, (children2) => {
|
|
337811
337844
|
let next = children2;
|
|
337812
|
-
|
|
337845
|
+
if (input.alignment !== undefined) {
|
|
337846
|
+
next = setOrRemoveChild(next, "jc", input.alignment ? singleElement2(model.prefix, "jc", { val: input.alignment }) : null);
|
|
337847
|
+
}
|
|
337813
337848
|
if (input.autoFitMode) {
|
|
337814
337849
|
if (input.autoFitMode === "fixedWidth") {
|
|
337815
337850
|
next = setOrRemoveChild(next, "tblLayout", singleElement2(model.prefix, "tblLayout", { type: "fixed" }));
|
|
@@ -358918,8 +358953,9 @@ class V2TrackedChangesAdapter {
|
|
|
358918
358953
|
if (entry.type !== "replacement")
|
|
358919
358954
|
return;
|
|
358920
358955
|
const rsid = side === "delete" || side === "deleted" ? entry.sides?.deleted?.rsid : entry.sides?.inserted?.rsid;
|
|
358956
|
+
const kind = side === "delete" || side === "deleted" ? "del" : "ins";
|
|
358921
358957
|
if (rsid)
|
|
358922
|
-
addFragments(entry.fragments.filter((fragment4) => fragment4.rsid === rsid));
|
|
358958
|
+
addFragments(entry.fragments.filter((fragment4) => fragment4.rsid === rsid && fragment4.kind === kind));
|
|
358923
358959
|
} else {
|
|
358924
358960
|
addFragments(entry.fragments);
|
|
358925
358961
|
structural || (structural = entry.formattingFragments.length > 0 || entry.structuralFragments.length > 0);
|
|
@@ -359742,6 +359778,9 @@ class V2TrackedChangesAdapter {
|
|
|
359742
359778
|
return this.decideByLogicalIds(decision, [entry.id], options);
|
|
359743
359779
|
}
|
|
359744
359780
|
if (target.overlap === "side-only" || target.overlap === "empties-one-side") {
|
|
359781
|
+
const pairingFailure = replacementSidePairingFailure(entry);
|
|
359782
|
+
if (pairingFailure)
|
|
359783
|
+
return pairingFailure;
|
|
359745
359784
|
const side = target.side === "delete" || target.side === "deleted" ? "deleted" : "inserted";
|
|
359746
359785
|
const rsid = side === "deleted" ? entry.sides?.deleted?.rsid : entry.sides?.inserted?.rsid;
|
|
359747
359786
|
if (!rsid) {
|
|
@@ -359750,7 +359789,11 @@ class V2TrackedChangesAdapter {
|
|
|
359750
359789
|
const permissionFailure = this.checkTrackedChangePermissions(decision, [entry], logical);
|
|
359751
359790
|
if (permissionFailure)
|
|
359752
359791
|
return permissionFailure;
|
|
359753
|
-
|
|
359792
|
+
const fragments = textFragmentSelectorsForRsid(entry, rsid, side === "deleted" ? "del" : "ins");
|
|
359793
|
+
if (fragments.length === 0) {
|
|
359794
|
+
return failure7("TARGET_NOT_FOUND", `trackChanges.decide range: ${side} replacement side was not found.`);
|
|
359795
|
+
}
|
|
359796
|
+
return this.runDecideWithTargets(decision, [{ rsid, fragments }], logical, options);
|
|
359754
359797
|
}
|
|
359755
359798
|
const textTarget = this.buildTextTargetForLogicalRange(entry, raw, {
|
|
359756
359799
|
overlap: target.overlap,
|
|
@@ -359770,6 +359813,9 @@ class V2TrackedChangesAdapter {
|
|
|
359770
359813
|
if (entry.type !== "replacement") {
|
|
359771
359814
|
return failure7("INVALID_TARGET", `trackChanges.decide: side selector requires a replacement change (id "${id}").`);
|
|
359772
359815
|
}
|
|
359816
|
+
const pairingFailure = replacementSidePairingFailure(entry);
|
|
359817
|
+
if (pairingFailure)
|
|
359818
|
+
return pairingFailure;
|
|
359773
359819
|
const rsid = side === "deleted" ? entry.sides?.deleted?.rsid : entry.sides?.inserted?.rsid;
|
|
359774
359820
|
if (!rsid) {
|
|
359775
359821
|
return failure7("TARGET_NOT_FOUND", `trackChanges.decide: ${side} replacement side was not found.`);
|
|
@@ -359777,7 +359823,11 @@ class V2TrackedChangesAdapter {
|
|
|
359777
359823
|
const permissionFailure = this.checkTrackedChangePermissions(decision, [entry], logical);
|
|
359778
359824
|
if (permissionFailure)
|
|
359779
359825
|
return permissionFailure;
|
|
359780
|
-
|
|
359826
|
+
const fragments = textFragmentSelectorsForRsid(entry, rsid, side === "deleted" ? "del" : "ins");
|
|
359827
|
+
if (fragments.length === 0) {
|
|
359828
|
+
return failure7("TARGET_NOT_FOUND", `trackChanges.decide: ${side} replacement side was not found.`);
|
|
359829
|
+
}
|
|
359830
|
+
return this.runDecideWithTargets(decision, [{ rsid, fragments }], logical, options);
|
|
359781
359831
|
}
|
|
359782
359832
|
buildTextTargetForLogicalRange(entry, raw, input) {
|
|
359783
359833
|
const fragment4 = selectFragmentForLogicalRange(entry, input.side);
|
|
@@ -359988,8 +360038,13 @@ class V2TrackedChangesAdapter {
|
|
|
359988
360038
|
return buildCachedTrackedChangeLogicalView(this.context);
|
|
359989
360039
|
}
|
|
359990
360040
|
}
|
|
359991
|
-
function
|
|
359992
|
-
|
|
360041
|
+
function replacementSidePairingFailure(entry) {
|
|
360042
|
+
if (!entry.textboxAlternateContentPairing)
|
|
360043
|
+
return null;
|
|
360044
|
+
return failure7("CAPABILITY_UNAVAILABLE", "trackChanges.decide: a mirrored text-box replacement cannot be decided by side without risking divergent representations.");
|
|
360045
|
+
}
|
|
360046
|
+
function textFragmentSelectorsForRsid(entry, rsid, kind) {
|
|
360047
|
+
return entry.fragments.filter((fragment4) => fragment4.rsid === rsid && (!kind || fragment4.kind === kind)).map((fragment4) => ({
|
|
359993
360048
|
partUri: fragment4.partUri,
|
|
359994
360049
|
byteStart: fragment4.byteStart,
|
|
359995
360050
|
byteEnd: fragment4.byteEnd
|
|
@@ -369913,7 +369968,8 @@ function createV2AdapterContext(session, options = {}) {
|
|
|
369913
369968
|
return {
|
|
369914
369969
|
tx: beginSDDocumentSessionInternalTransaction(session, {
|
|
369915
369970
|
expectedPackageRevision: currentInternal,
|
|
369916
|
-
actorTag: humanActorScope.current()
|
|
369971
|
+
actorTag: humanActorScope.current(),
|
|
369972
|
+
...options2?.author ? { authorOverride: { name: options2.author.name } } : {}
|
|
369917
369973
|
})
|
|
369918
369974
|
};
|
|
369919
369975
|
},
|
|
@@ -397683,6 +397739,14 @@ function buildAssertOutcome(compiled) {
|
|
|
397683
397739
|
};
|
|
397684
397740
|
}
|
|
397685
397741
|
function validatePlanShape(input) {
|
|
397742
|
+
if (Object.prototype.hasOwnProperty.call(input, "author")) {
|
|
397743
|
+
throw new DocumentApiValidationError2("INVALID_INPUT", "Mutation plans do not support per-call author.");
|
|
397744
|
+
}
|
|
397745
|
+
for (const step3 of Array.isArray(input.steps) ? input.steps : []) {
|
|
397746
|
+
if (hasPlanAuthor(step3)) {
|
|
397747
|
+
throw new DocumentApiValidationError2("INVALID_INPUT", "Mutation plan steps do not support per-call author.");
|
|
397748
|
+
}
|
|
397749
|
+
}
|
|
397686
397750
|
if ("dryRun" in input) {
|
|
397687
397751
|
throw new DocumentApiValidationError2("INVALID_INPUT", "Mutation plans do not accept dryRun; use mutations.preview.");
|
|
397688
397752
|
}
|
|
@@ -397696,6 +397760,23 @@ function validatePlanShape(input) {
|
|
|
397696
397760
|
throw new DocumentApiValidationError2("INVALID_INPUT", 'changeMode must be "direct" or "tracked".');
|
|
397697
397761
|
}
|
|
397698
397762
|
}
|
|
397763
|
+
function hasPlanAuthor(value2) {
|
|
397764
|
+
const pending = [value2];
|
|
397765
|
+
const visited = new Set;
|
|
397766
|
+
while (pending.length > 0) {
|
|
397767
|
+
const current = pending.pop();
|
|
397768
|
+
if (!current || typeof current !== "object" || visited.has(current))
|
|
397769
|
+
continue;
|
|
397770
|
+
visited.add(current);
|
|
397771
|
+
if (Object.prototype.hasOwnProperty.call(current, "author"))
|
|
397772
|
+
return true;
|
|
397773
|
+
if (Array.isArray(current))
|
|
397774
|
+
pending.push(...current);
|
|
397775
|
+
else
|
|
397776
|
+
pending.push(...Object.values(current));
|
|
397777
|
+
}
|
|
397778
|
+
return false;
|
|
397779
|
+
}
|
|
397699
397780
|
function isSupportedMutationStoryScope(story) {
|
|
397700
397781
|
return !story || story.kind === "story" && story.storyType === "body";
|
|
397701
397782
|
}
|
|
@@ -398158,6 +398239,9 @@ class V2WriteAdapter {
|
|
|
398158
398239
|
}
|
|
398159
398240
|
const controlPayload = buildControlPayloadPlan(request.text);
|
|
398160
398241
|
if (controlPayload) {
|
|
398242
|
+
if (options && "author" in options) {
|
|
398243
|
+
return failWithoutResolution("INVALID_INPUT", "Per-call author is not supported for structural control-payload inserts.");
|
|
398244
|
+
}
|
|
398161
398245
|
const committed = rewriteAnchorParagraphWithControlPayload(this.context, anchor.storyId, anchor.blockId, controlPayload, options?.expectedRevision);
|
|
398162
398246
|
if (!committed.ok) {
|
|
398163
398247
|
return {
|
|
@@ -398173,7 +398257,7 @@ class V2WriteAdapter {
|
|
|
398173
398257
|
resolution
|
|
398174
398258
|
};
|
|
398175
398259
|
}
|
|
398176
|
-
const begun = this.context.beginMutation({ expectedRevision: options?.expectedRevision });
|
|
398260
|
+
const begun = this.context.beginMutation({ expectedRevision: options?.expectedRevision, author: "author" in (options ?? {}) ? options.author : undefined });
|
|
398177
398261
|
if ("failure" in begun) {
|
|
398178
398262
|
return {
|
|
398179
398263
|
success: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc/mcp",
|
|
3
|
-
"version": "1.7.0-next.
|
|
3
|
+
"version": "1.7.0-next.11",
|
|
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.20.0-next.
|
|
27
|
+
"@superdoc/sdk": "2.20.0-next.11",
|
|
28
28
|
"debug": "^4.4.3",
|
|
29
29
|
"zod": "^4.3.6"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"superdoc": "2.23.0-next.
|
|
33
|
-
"@superdoc/docx-engine": "0.22.0-next.
|
|
32
|
+
"superdoc": "2.23.0-next.11",
|
|
33
|
+
"@superdoc/docx-engine": "0.22.0-next.11",
|
|
34
34
|
"@superdoc/document-api": "0.1.0-alpha.0",
|
|
35
35
|
"@types/bun": "^1.3.8",
|
|
36
36
|
"@types/node": "22.19.2",
|