@beyondwork/docx-react-component 1.0.124 → 1.0.126
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/api/public-types.cjs +147 -35
- package/dist/api/public-types.d.cts +2 -2
- package/dist/api/public-types.d.ts +2 -2
- package/dist/api/public-types.js +3 -3
- package/dist/api/v3.cjs +796 -102
- package/dist/api/v3.d.cts +3 -3
- package/dist/api/v3.d.ts +3 -3
- package/dist/api/v3.js +10 -10
- package/dist/{canonical-document-CG2TgAzj.d.cts → canonical-document-CXCFCbAz.d.cts} +2 -0
- package/dist/{canonical-document-CG2TgAzj.d.ts → canonical-document-CXCFCbAz.d.ts} +2 -0
- package/dist/{chunk-PFYUJU3Q.js → chunk-2QL5DAKF.js} +98 -43
- package/dist/{chunk-4IPEZYQX.js → chunk-4EENH4FG.js} +1 -1
- package/dist/{chunk-BOHHIVQ2.js → chunk-4G3OS2H6.js} +3 -3
- package/dist/{chunk-A74Y5NE4.js → chunk-4YJVRIUB.js} +52 -21
- package/dist/{chunk-FNWKE74J.js → chunk-5DGKFNQT.js} +5 -1
- package/dist/{chunk-RSYN6FTS.js → chunk-6F5QW44A.js} +2 -2
- package/dist/{chunk-ZMRO6P3A.js → chunk-6IGWPAR4.js} +505 -44
- package/dist/{chunk-KOHQFZMM.js → chunk-BYSRJ4FE.js} +1 -1
- package/dist/{chunk-H6IL5ABU.js → chunk-CXSYRB37.js} +64 -20
- package/dist/{chunk-32ZAOQ54.js → chunk-D5HYZQTG.js} +1 -1
- package/dist/{chunk-TY4DIJO3.js → chunk-ESJ2MES5.js} +1 -1
- package/dist/{chunk-Q76XPPTA.js → chunk-FPRWV54X.js} +101 -14
- package/dist/{chunk-MPH4ZQS4.js → chunk-GL7XRYBY.js} +624 -87
- package/dist/{chunk-IR7QV2BX.js → chunk-KV435YXO.js} +2 -2
- package/dist/{chunk-N4VIXI2Z.js → chunk-MWSBGJQO.js} +137 -18
- package/dist/{chunk-7PC6XUNO.js → chunk-TQDQU2E3.js} +2 -2
- package/dist/{chunk-4B74ETJI.js → chunk-V6XVZFFH.js} +2 -2
- package/dist/{chunk-NAMAWCXN.js → chunk-YD2JE54B.js} +1 -1
- package/dist/{chunk-ZRHLLPSJ.js → chunk-YHZHPXDB.js} +85 -18
- package/dist/{chunk-HXHQA4BU.js → chunk-YIYM4ZAP.js} +1 -1
- package/dist/{chunk-LGWNN3L2.js → chunk-ZDOAUP3V.js} +2 -2
- package/dist/compare.d.cts +1 -1
- package/dist/compare.d.ts +1 -1
- package/dist/core/commands/formatting-commands.d.cts +2 -2
- package/dist/core/commands/formatting-commands.d.ts +2 -2
- package/dist/core/commands/image-commands.cjs +65 -20
- package/dist/core/commands/image-commands.d.cts +2 -2
- package/dist/core/commands/image-commands.d.ts +2 -2
- package/dist/core/commands/image-commands.js +5 -5
- package/dist/core/commands/section-layout-commands.d.cts +2 -2
- package/dist/core/commands/section-layout-commands.d.ts +2 -2
- package/dist/core/commands/style-commands.d.cts +2 -2
- package/dist/core/commands/style-commands.d.ts +2 -2
- package/dist/core/commands/table-structure-commands.cjs +65 -20
- package/dist/core/commands/table-structure-commands.d.cts +2 -2
- package/dist/core/commands/table-structure-commands.d.ts +2 -2
- package/dist/core/commands/table-structure-commands.js +4 -4
- package/dist/core/commands/text-commands.cjs +66 -21
- package/dist/core/commands/text-commands.d.cts +2 -2
- package/dist/core/commands/text-commands.d.ts +2 -2
- package/dist/core/commands/text-commands.js +5 -5
- package/dist/core/selection/mapping.d.cts +2 -2
- package/dist/core/selection/mapping.d.ts +2 -2
- package/dist/core/state/editor-state.d.cts +2 -2
- package/dist/core/state/editor-state.d.ts +2 -2
- package/dist/index.cjs +1677 -240
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +62 -25
- package/dist/io/docx-session.cjs +51 -20
- package/dist/io/docx-session.d.cts +4 -4
- package/dist/io/docx-session.d.ts +4 -4
- package/dist/io/docx-session.js +4 -4
- package/dist/legal.cjs +36 -12
- package/dist/legal.d.cts +1 -1
- package/dist/legal.d.ts +1 -1
- package/dist/legal.js +3 -3
- package/dist/{loader-D9y4ZRjj.d.ts → loader-CS9-9KFa.d.ts} +3 -3
- package/dist/{loader-D9KCtj4m.d.cts → loader-OoWJ1_17.d.cts} +3 -3
- package/dist/{public-types-CNnMHZM9.d.ts → public-types-BP3vqJR5.d.cts} +157 -11
- package/dist/{public-types-DajNGKV4.d.cts → public-types-DdcHqcow.d.ts} +157 -11
- package/dist/public-types.cjs +147 -35
- package/dist/public-types.d.cts +2 -2
- package/dist/public-types.d.ts +2 -2
- package/dist/public-types.js +3 -3
- package/dist/runtime/collab.d.cts +3 -3
- package/dist/runtime/collab.d.ts +3 -3
- package/dist/runtime/document-runtime.cjs +945 -134
- package/dist/runtime/document-runtime.d.cts +2 -2
- package/dist/runtime/document-runtime.d.ts +2 -2
- package/dist/runtime/document-runtime.js +14 -14
- package/dist/{session-DyQGlryH.d.cts → session-Cq-fzx3B.d.cts} +3 -3
- package/dist/{session-DEmaOEjA.d.ts → session-DyFQt8Ph.d.ts} +3 -3
- package/dist/session.cjs +51 -20
- package/dist/session.d.cts +5 -5
- package/dist/session.d.ts +5 -5
- package/dist/session.js +5 -5
- package/dist/tailwind.cjs +238 -73
- package/dist/tailwind.d.cts +2 -2
- package/dist/tailwind.d.ts +2 -2
- package/dist/tailwind.js +7 -7
- package/dist/{types-CxE1aZiv.d.cts → types-Bg7D-GD3.d.cts} +2 -2
- package/dist/{types-DjJNaE9c.d.ts → types-bJAgMq1M.d.ts} +2 -2
- package/dist/ui-tailwind/editor-surface/search-plugin.d.cts +3 -3
- package/dist/ui-tailwind/editor-surface/search-plugin.d.ts +3 -3
- package/dist/ui-tailwind/editor-surface/search-plugin.js +4 -4
- package/dist/ui-tailwind.cjs +238 -73
- package/dist/ui-tailwind.d.cts +3 -3
- package/dist/ui-tailwind.d.ts +3 -3
- package/dist/ui-tailwind.js +7 -7
- package/package.json +1 -1
package/dist/api/v3.cjs
CHANGED
|
@@ -13436,7 +13436,7 @@ function createParagraphEditableTarget(paragraph, kind, storyKey, blockPath, tar
|
|
|
13436
13436
|
context: { storyKey, insideSdt: contentControl !== void 0 },
|
|
13437
13437
|
...tableTarget
|
|
13438
13438
|
}) : void 0;
|
|
13439
|
-
const listAddress =
|
|
13439
|
+
const listAddress = paragraph.numbering !== void 0 ? createCanonicalAddress({
|
|
13440
13440
|
addressKind: "list-item-text",
|
|
13441
13441
|
storyKey,
|
|
13442
13442
|
staleCheckKind: "paragraph",
|
|
@@ -13470,6 +13470,7 @@ function createParagraphEditableTarget(paragraph, kind, storyKey, blockPath, tar
|
|
|
13470
13470
|
...contentControl !== void 0 ? { contentControl } : {},
|
|
13471
13471
|
...tableIdentity !== void 0 ? { table: tableIdentity } : {},
|
|
13472
13472
|
...editableOwner !== void 0 ? { editableOwner } : {},
|
|
13473
|
+
...listAddress !== void 0 ? { listAddress } : {},
|
|
13473
13474
|
...tableIdentity !== void 0 ? {
|
|
13474
13475
|
canonicalAddress: createTableTargetCanonicalAddress(
|
|
13475
13476
|
tableIdentity,
|
|
@@ -14333,6 +14334,9 @@ function validateEditableTargetRef(value, path = "$") {
|
|
|
14333
14334
|
if (record.canonicalAddress !== void 0) {
|
|
14334
14335
|
validateTargetCanonicalAddress(record.canonicalAddress, `${path}.canonicalAddress`, issues);
|
|
14335
14336
|
}
|
|
14337
|
+
if (record.listAddress !== void 0) {
|
|
14338
|
+
validateTargetCanonicalAddress(record.listAddress, `${path}.listAddress`, issues);
|
|
14339
|
+
}
|
|
14336
14340
|
const staleCheck = asPlainObject(record.staleCheck, `${path}.staleCheck`, issues);
|
|
14337
14341
|
if (staleCheck) {
|
|
14338
14342
|
if (staleCheck.paragraphTextHash !== void 0) {
|
|
@@ -18405,7 +18409,8 @@ function resolveContentType(path, contentTypes) {
|
|
|
18405
18409
|
// src/io/ooxml/parse-bookmark-references.ts
|
|
18406
18410
|
var HYPERLINK_ANCHOR_RE = /<(?:\w+:)?hyperlink\b[^>]*\bw:anchor\s*=\s*"([^"]*)"/gi;
|
|
18407
18411
|
var INSTR_TEXT_RE = /<(?:\w+:)?instrText\b[^>]*>([\s\S]*?)<\/(?:\w+:)?instrText>/gi;
|
|
18408
|
-
var
|
|
18412
|
+
var FLD_SIMPLE_INSTR_DOUBLE_RE = /<(?:\w+:)?fldSimple\b[^>]*?\b(?:w:)?instr\s*=\s*"([^"]*)"/gi;
|
|
18413
|
+
var FLD_SIMPLE_INSTR_SINGLE_RE = /<(?:\w+:)?fldSimple\b[^>]*?\b(?:w:)?instr\s*=\s*'([^']*)'/gi;
|
|
18409
18414
|
var TOC_FIELD_RE = /\bTOC\b/;
|
|
18410
18415
|
var REFLIKE_FIELD_RE = /\b(?:HYPERLINK|REF|PAGEREF|NOTEREF)\s+([A-Za-z0-9_:.\-]+)/g;
|
|
18411
18416
|
var DATA_BINDING_RE = /<(?:\w+:)?dataBinding\b/i;
|
|
@@ -18424,11 +18429,22 @@ function scanBookmarkReferences(documentXml, callerAllowlist = []) {
|
|
|
18424
18429
|
}
|
|
18425
18430
|
INSTR_TEXT_RE.lastIndex = 0;
|
|
18426
18431
|
while ((m = INSTR_TEXT_RE.exec(documentXml)) !== null) {
|
|
18427
|
-
|
|
18432
|
+
const instrText = m[1] ?? "";
|
|
18433
|
+
scanFieldInstruction(instrText, retained, () => {
|
|
18434
|
+
retainAllToc = true;
|
|
18435
|
+
});
|
|
18428
18436
|
}
|
|
18429
|
-
|
|
18430
|
-
while ((m =
|
|
18431
|
-
|
|
18437
|
+
FLD_SIMPLE_INSTR_DOUBLE_RE.lastIndex = 0;
|
|
18438
|
+
while ((m = FLD_SIMPLE_INSTR_DOUBLE_RE.exec(documentXml)) !== null) {
|
|
18439
|
+
scanFieldInstruction(decodeXmlAttribute(m[1] ?? ""), retained, () => {
|
|
18440
|
+
retainAllToc = true;
|
|
18441
|
+
});
|
|
18442
|
+
}
|
|
18443
|
+
FLD_SIMPLE_INSTR_SINGLE_RE.lastIndex = 0;
|
|
18444
|
+
while ((m = FLD_SIMPLE_INSTR_SINGLE_RE.exec(documentXml)) !== null) {
|
|
18445
|
+
scanFieldInstruction(decodeXmlAttribute(m[1] ?? ""), retained, () => {
|
|
18446
|
+
retainAllToc = true;
|
|
18447
|
+
});
|
|
18432
18448
|
}
|
|
18433
18449
|
retainRevisionBoundedBookmarks(documentXml, retained);
|
|
18434
18450
|
return {
|
|
@@ -18437,14 +18453,16 @@ function scanBookmarkReferences(documentXml, callerAllowlist = []) {
|
|
|
18437
18453
|
retainAll
|
|
18438
18454
|
};
|
|
18439
18455
|
}
|
|
18440
|
-
function
|
|
18441
|
-
|
|
18456
|
+
function scanFieldInstruction(instrText, retained, retainToc) {
|
|
18457
|
+
if (TOC_FIELD_RE.test(instrText)) retainToc();
|
|
18442
18458
|
REFLIKE_FIELD_RE.lastIndex = 0;
|
|
18443
18459
|
let r;
|
|
18444
18460
|
while ((r = REFLIKE_FIELD_RE.exec(instrText)) !== null) {
|
|
18445
18461
|
if (r[1]) retained.add(r[1]);
|
|
18446
18462
|
}
|
|
18447
|
-
|
|
18463
|
+
}
|
|
18464
|
+
function decodeXmlAttribute(value) {
|
|
18465
|
+
return value.replace(/"/g, '"').replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
18448
18466
|
}
|
|
18449
18467
|
function retainRevisionBoundedBookmarks(documentXml, retained) {
|
|
18450
18468
|
const starts = /* @__PURE__ */ new Map();
|
|
@@ -18797,18 +18815,23 @@ function parseNumberingXml(xml, context) {
|
|
|
18797
18815
|
const abstractDefinitions = {};
|
|
18798
18816
|
const instances = {};
|
|
18799
18817
|
const numPicBullets = {};
|
|
18818
|
+
const topLevelOrdinals = /* @__PURE__ */ new Map();
|
|
18800
18819
|
for (const child of numberingElement.children) {
|
|
18801
18820
|
if (child.type !== "element") {
|
|
18802
18821
|
continue;
|
|
18803
18822
|
}
|
|
18804
|
-
|
|
18823
|
+
const childName = localName(child.name);
|
|
18824
|
+
const childOrdinal = (topLevelOrdinals.get(childName) ?? 0) + 1;
|
|
18825
|
+
topLevelOrdinals.set(childName, childOrdinal);
|
|
18826
|
+
const childXmlPath = `/numbering[1]/${childName}[${childOrdinal}]`;
|
|
18827
|
+
if (childName === "numPicBullet") {
|
|
18805
18828
|
const rawId = readStringAttr(child, "w:numPicBulletId");
|
|
18806
18829
|
if (rawId) {
|
|
18807
|
-
numPicBullets[rawId] = readNumPicBullet(child, rawId, context);
|
|
18830
|
+
numPicBullets[rawId] = readNumPicBullet(child, rawId, context, childXmlPath);
|
|
18808
18831
|
}
|
|
18809
18832
|
continue;
|
|
18810
18833
|
}
|
|
18811
|
-
switch (
|
|
18834
|
+
switch (childName) {
|
|
18812
18835
|
case "abstractNum": {
|
|
18813
18836
|
const rawId = readStringAttr(child, "w:abstractNumId");
|
|
18814
18837
|
if (!rawId) {
|
|
@@ -18828,7 +18851,7 @@ function parseNumberingXml(xml, context) {
|
|
|
18828
18851
|
const numStyleLink = numStyleLinkEl ? readStringAttr(numStyleLinkEl, "w:val") : void 0;
|
|
18829
18852
|
abstractDefinitions[abstractNumberingId] = {
|
|
18830
18853
|
abstractNumberingId,
|
|
18831
|
-
...context?.partPath !== void 0 ? { sourceRef: createNumberingSourceRef(context.partPath, "abstractNum", rawId) } : {},
|
|
18854
|
+
...context?.partPath !== void 0 ? { sourceRef: createNumberingSourceRef(context.partPath, "abstractNum", rawId, childXmlPath) } : {},
|
|
18832
18855
|
levels: readLevels(child),
|
|
18833
18856
|
...nsid ? { nsid } : {},
|
|
18834
18857
|
...multiLevelType ? { multiLevelType } : {},
|
|
@@ -18848,7 +18871,7 @@ function parseNumberingXml(xml, context) {
|
|
|
18848
18871
|
const numberingInstanceId = toCanonicalNumberingInstanceId(rawId);
|
|
18849
18872
|
instances[numberingInstanceId] = {
|
|
18850
18873
|
numberingInstanceId,
|
|
18851
|
-
...context?.partPath !== void 0 ? { sourceRef: createNumberingSourceRef(context.partPath, "num", rawId) } : {},
|
|
18874
|
+
...context?.partPath !== void 0 ? { sourceRef: createNumberingSourceRef(context.partPath, "num", rawId, childXmlPath) } : {},
|
|
18852
18875
|
abstractNumberingId: toCanonicalAbstractNumberingId(rawAbstractId),
|
|
18853
18876
|
overrides: readOverrides(child)
|
|
18854
18877
|
};
|
|
@@ -18862,15 +18885,16 @@ function parseNumberingXml(xml, context) {
|
|
|
18862
18885
|
...Object.keys(numPicBullets).length > 0 ? { numPicBullets } : {}
|
|
18863
18886
|
};
|
|
18864
18887
|
}
|
|
18865
|
-
function createNumberingSourceRef(partPath, element, rawId) {
|
|
18888
|
+
function createNumberingSourceRef(partPath, element, rawId, xmlPath) {
|
|
18866
18889
|
return {
|
|
18867
18890
|
sourceId: `part:${partPath}#${element}:${rawId}`,
|
|
18868
18891
|
partPath,
|
|
18869
18892
|
storyKind: "numbering",
|
|
18870
|
-
element
|
|
18893
|
+
element,
|
|
18894
|
+
...xmlPath !== void 0 ? { xmlPath } : {}
|
|
18871
18895
|
};
|
|
18872
18896
|
}
|
|
18873
|
-
function readNumPicBullet(node, numPicBulletId, context) {
|
|
18897
|
+
function readNumPicBullet(node, numPicBulletId, context, xmlPath) {
|
|
18874
18898
|
let widthEmu;
|
|
18875
18899
|
let heightEmu;
|
|
18876
18900
|
let mediaId;
|
|
@@ -18933,6 +18957,7 @@ function readNumPicBullet(node, numPicBulletId, context) {
|
|
|
18933
18957
|
}
|
|
18934
18958
|
return {
|
|
18935
18959
|
numPicBulletId,
|
|
18960
|
+
...context?.partPath !== void 0 ? { sourceRef: createNumberingSourceRef(context.partPath, "numPicBullet", numPicBulletId, xmlPath) } : {},
|
|
18936
18961
|
rawXml: serializeXmlElementToString(node),
|
|
18937
18962
|
...widthEmu !== void 0 ? { widthEmu } : {},
|
|
18938
18963
|
...heightEmu !== void 0 ? { heightEmu } : {},
|
|
@@ -22906,7 +22931,11 @@ function parseBodyChild(node, sourceXml, relationshipMap, relationships, mediaPa
|
|
|
22906
22931
|
switch (localName(child.name)) {
|
|
22907
22932
|
case "pPr":
|
|
22908
22933
|
styleId = readParagraphStyleId(child);
|
|
22909
|
-
numbering = readParagraphNumbering(
|
|
22934
|
+
numbering = readParagraphNumbering(
|
|
22935
|
+
child,
|
|
22936
|
+
sourcePartPath,
|
|
22937
|
+
`${sourceXmlPath}/pPr[${countPriorElementSiblingsByName(node, child) + 1}]`
|
|
22938
|
+
);
|
|
22910
22939
|
alignment = readParagraphAlignment(child);
|
|
22911
22940
|
spacing = readParagraphSpacing2(child);
|
|
22912
22941
|
contextualSpacing = readOptionalOnOffParagraphProperty(child, "contextualSpacing");
|
|
@@ -23989,7 +24018,7 @@ function readParagraphStyleId(node) {
|
|
|
23989
24018
|
}
|
|
23990
24019
|
return void 0;
|
|
23991
24020
|
}
|
|
23992
|
-
function readParagraphNumbering(node, sourcePartPath) {
|
|
24021
|
+
function readParagraphNumbering(node, sourcePartPath, sourceXmlPath) {
|
|
23993
24022
|
const numberingProperties = node.children.find(
|
|
23994
24023
|
(child) => child.type === "element" && localName(child.name) === "numPr"
|
|
23995
24024
|
);
|
|
@@ -24009,16 +24038,22 @@ function readParagraphNumbering(node, sourcePartPath) {
|
|
|
24009
24038
|
}
|
|
24010
24039
|
return {
|
|
24011
24040
|
numberingInstanceId: toCanonicalNumberingInstanceId(rawInstanceId),
|
|
24012
|
-
sourceRef: createElementSourceRef(
|
|
24041
|
+
sourceRef: createElementSourceRef(
|
|
24042
|
+
sourcePartPath,
|
|
24043
|
+
"numPr",
|
|
24044
|
+
numberingProperties,
|
|
24045
|
+
sourceXmlPath !== void 0 ? `${sourceXmlPath}/numPr[${countPriorElementSiblingsByName(node, numberingProperties) + 1}]` : void 0
|
|
24046
|
+
),
|
|
24013
24047
|
level: Number.parseInt(rawLevel, 10)
|
|
24014
24048
|
};
|
|
24015
24049
|
}
|
|
24016
|
-
function createElementSourceRef(partPath, element, node) {
|
|
24050
|
+
function createElementSourceRef(partPath, element, node, xmlPath) {
|
|
24017
24051
|
return {
|
|
24018
24052
|
sourceId: `part:${partPath}#${element}:${node.start}`,
|
|
24019
24053
|
partPath,
|
|
24020
24054
|
storyKind: storyKindFromPartPath(partPath),
|
|
24021
24055
|
element,
|
|
24056
|
+
...xmlPath !== void 0 ? { xmlPath } : {},
|
|
24022
24057
|
startOffset: node.start,
|
|
24023
24058
|
endOffset: node.end
|
|
24024
24059
|
};
|
|
@@ -32543,8 +32578,8 @@ async function computeStructuralHash(blocks) {
|
|
|
32543
32578
|
}
|
|
32544
32579
|
|
|
32545
32580
|
// src/runtime/layout/layout-engine-version.ts
|
|
32546
|
-
var LAYOUT_ENGINE_VERSION =
|
|
32547
|
-
var LAYCACHE_SCHEMA_VERSION =
|
|
32581
|
+
var LAYOUT_ENGINE_VERSION = 88;
|
|
32582
|
+
var LAYCACHE_SCHEMA_VERSION = 12;
|
|
32548
32583
|
|
|
32549
32584
|
// src/runtime/prerender/customxml-cache.ts
|
|
32550
32585
|
var LAYCACHE_NAMESPACE_NAME = "laycache";
|
|
@@ -34215,14 +34250,17 @@ function paragraphHasBookmarkId(paragraph, bookmarkId) {
|
|
|
34215
34250
|
function commandActionHandleForAddress(commandFamily, address) {
|
|
34216
34251
|
return address ? `scope-command:${commandFamily}:${address.addressKey}` : void 0;
|
|
34217
34252
|
}
|
|
34218
|
-
function withCommandAction(evidence, target) {
|
|
34219
|
-
if (evidence.status !== "supported" || !
|
|
34253
|
+
function withCommandAction(evidence, target, canonicalAddress = target.canonicalAddress) {
|
|
34254
|
+
if (evidence.status !== "supported" || !canonicalAddress) return evidence;
|
|
34220
34255
|
return {
|
|
34221
34256
|
...evidence,
|
|
34222
|
-
actionHandle: commandActionHandleForAddress(target.commandFamily,
|
|
34223
|
-
canonicalAddress
|
|
34257
|
+
actionHandle: commandActionHandleForAddress(target.commandFamily, canonicalAddress),
|
|
34258
|
+
canonicalAddress
|
|
34224
34259
|
};
|
|
34225
34260
|
}
|
|
34261
|
+
function commandAddressForTarget(target, scopeKind) {
|
|
34262
|
+
return scopeKind === "list-item" && target.listAddress !== void 0 ? target.listAddress : target.canonicalAddress;
|
|
34263
|
+
}
|
|
34226
34264
|
function runtimeTextCommandEvidence(target, workflowBlockers) {
|
|
34227
34265
|
const shapeIssues = validateEditableTargetRef(target);
|
|
34228
34266
|
if (shapeIssues.length > 0) {
|
|
@@ -34275,6 +34313,9 @@ var TABLE_TEXT_TARGET_KINDS2 = /* @__PURE__ */ new Set([
|
|
|
34275
34313
|
var LIST_TEXT_TARGET_KINDS2 = /* @__PURE__ */ new Set([
|
|
34276
34314
|
"paragraph-text",
|
|
34277
34315
|
"sdt-paragraph-text",
|
|
34316
|
+
"table-cell-paragraph-text",
|
|
34317
|
+
"nested-table-cell-paragraph-text",
|
|
34318
|
+
"sdt-table-cell-paragraph-text",
|
|
34278
34319
|
"secondary-story-paragraph-text"
|
|
34279
34320
|
]);
|
|
34280
34321
|
function tableTextScopeReplacementPosture(target) {
|
|
@@ -34325,7 +34366,7 @@ function runtimeCommandEvidence(target, workflowBlockers, textCommand, scopeKind
|
|
|
34325
34366
|
intents: commandIntentsForTarget(target, scopeKind),
|
|
34326
34367
|
reason: textCommand.reason,
|
|
34327
34368
|
...textCommand.blockers ? { blockers: textCommand.blockers } : {}
|
|
34328
|
-
}, target);
|
|
34369
|
+
}, target, commandAddressForTarget(target, scopeKind));
|
|
34329
34370
|
}
|
|
34330
34371
|
if (target.commandFamily === "comment-revision") {
|
|
34331
34372
|
const isOpen = target.review?.status === "open";
|
|
@@ -36786,6 +36827,7 @@ function mergeLevelDefinition(base, override, startOverride, fallbackLevel) {
|
|
|
36786
36827
|
);
|
|
36787
36828
|
const runProperties = override?.runProperties ?? base?.runProperties;
|
|
36788
36829
|
const restartAfterLevel = override?.restartAfterLevel ?? base?.restartAfterLevel;
|
|
36830
|
+
const picBulletId = override?.picBulletId ?? base?.picBulletId;
|
|
36789
36831
|
return {
|
|
36790
36832
|
level,
|
|
36791
36833
|
format,
|
|
@@ -36796,7 +36838,8 @@ function mergeLevelDefinition(base, override, startOverride, fallbackLevel) {
|
|
|
36796
36838
|
...override?.suffix ?? base?.suffix ? { suffix: override?.suffix ?? base?.suffix } : {},
|
|
36797
36839
|
...paragraphGeometry ? { paragraphGeometry } : {},
|
|
36798
36840
|
...runProperties ? { runProperties } : {},
|
|
36799
|
-
...restartAfterLevel !== void 0 ? { restartAfterLevel } : {}
|
|
36841
|
+
...restartAfterLevel !== void 0 ? { restartAfterLevel } : {},
|
|
36842
|
+
...picBulletId !== void 0 ? { picBulletId } : {}
|
|
36800
36843
|
};
|
|
36801
36844
|
}
|
|
36802
36845
|
function withDefaultStartAt(level) {
|
|
@@ -36924,7 +36967,7 @@ function resolveHangingWidth(indentation) {
|
|
|
36924
36967
|
// src/runtime/formatting/numbering/prefix.ts
|
|
36925
36968
|
function createNumberingPrefixResolver(catalog) {
|
|
36926
36969
|
const sequenceStates = /* @__PURE__ */ new Map();
|
|
36927
|
-
function resolveInternal(numbering, paragraph) {
|
|
36970
|
+
function resolveInternal(numbering, paragraph, options = {}) {
|
|
36928
36971
|
const resolved = resolveNumberingDefinitionSet(
|
|
36929
36972
|
catalog,
|
|
36930
36973
|
paragraph?.numbering ?? numbering,
|
|
@@ -36937,29 +36980,44 @@ function createNumberingPrefixResolver(catalog) {
|
|
|
36937
36980
|
if (!resolvedNumbering) {
|
|
36938
36981
|
return null;
|
|
36939
36982
|
}
|
|
36940
|
-
const
|
|
36941
|
-
|
|
36983
|
+
const advance = options.advance !== false;
|
|
36984
|
+
const sequenceState = getSequenceState(
|
|
36985
|
+
sequenceStates,
|
|
36986
|
+
resolvedNumbering.numberingInstanceId,
|
|
36987
|
+
{ create: advance }
|
|
36988
|
+
);
|
|
36989
|
+
if (!sequenceState) {
|
|
36990
|
+
return null;
|
|
36991
|
+
}
|
|
36992
|
+
const workingState = advance ? sequenceState : cloneSequenceState(sequenceState);
|
|
36993
|
+
advanceSequence(workingState, resolved.effectiveLevel.level, resolved.effectiveLevels);
|
|
36994
|
+
const currentCounter = workingState.counters[resolved.effectiveLevel.level];
|
|
36942
36995
|
const effectiveLevelDefs = resolved.effectiveLevel.isLegalNumbering ? new Map(
|
|
36943
36996
|
Array.from(resolved.effectiveLevels.entries()).map(([level, definition]) => [
|
|
36944
36997
|
level,
|
|
36945
36998
|
{ ...definition, format: "decimal" }
|
|
36946
36999
|
])
|
|
36947
37000
|
) : resolved.effectiveLevels;
|
|
37001
|
+
const picBulletId = resolved.effectiveLevel.picBulletId;
|
|
36948
37002
|
const text = renderLevelText(
|
|
36949
37003
|
resolved.effectiveLevel.text,
|
|
36950
|
-
|
|
37004
|
+
workingState.counters,
|
|
36951
37005
|
effectiveLevelDefs
|
|
36952
37006
|
);
|
|
36953
|
-
if (resolved.effectiveLevel.format !== "none" && text === null) {
|
|
37007
|
+
if (picBulletId == null && resolved.effectiveLevel.format !== "none" && text === null) {
|
|
36954
37008
|
return null;
|
|
36955
37009
|
}
|
|
36956
37010
|
const visibleText = resolved.effectiveLevel.format === "none" ? null : text;
|
|
36957
|
-
const
|
|
37011
|
+
const formatPosture = getNumberingFormatPosture(
|
|
37012
|
+
resolved.effectiveLevel.format,
|
|
37013
|
+
currentCounter
|
|
37014
|
+
);
|
|
36958
37015
|
const picBulletMediaId = picBulletId != null ? catalog.numPicBullets?.[picBulletId]?.mediaId : void 0;
|
|
36959
37016
|
return {
|
|
36960
37017
|
text: visibleText,
|
|
36961
37018
|
level: resolved.effectiveLevel.level,
|
|
36962
37019
|
format: resolved.effectiveLevel.format,
|
|
37020
|
+
...formatPosture !== void 0 ? { formatPosture } : {},
|
|
36963
37021
|
startAt: resolved.effectiveLevel.startAt ?? DEFAULT_NUMBERING_START_AT,
|
|
36964
37022
|
...resolved.effectiveLevel.suffix ? { suffix: resolved.effectiveLevel.suffix } : {},
|
|
36965
37023
|
...resolved.effectiveLevel.paragraphStyleId ? { paragraphStyleId: resolved.effectiveLevel.paragraphStyleId } : {},
|
|
@@ -36970,23 +37028,26 @@ function createNumberingPrefixResolver(catalog) {
|
|
|
36970
37028
|
};
|
|
36971
37029
|
}
|
|
36972
37030
|
return {
|
|
36973
|
-
resolve(numbering) {
|
|
36974
|
-
const result = resolveInternal(numbering);
|
|
37031
|
+
resolve(numbering, options) {
|
|
37032
|
+
const result = resolveInternal(numbering, void 0, options);
|
|
36975
37033
|
return result?.text ?? null;
|
|
36976
37034
|
},
|
|
36977
|
-
resolveDetailed(numbering, paragraph) {
|
|
36978
|
-
return resolveInternal(numbering, paragraph);
|
|
37035
|
+
resolveDetailed(numbering, paragraph, options) {
|
|
37036
|
+
return resolveInternal(numbering, paragraph, options);
|
|
36979
37037
|
},
|
|
36980
|
-
resolveParagraph(paragraph) {
|
|
36981
|
-
return resolveInternal(paragraph.numbering, paragraph);
|
|
37038
|
+
resolveParagraph(paragraph, options) {
|
|
37039
|
+
return resolveInternal(paragraph.numbering, paragraph, options);
|
|
36982
37040
|
}
|
|
36983
37041
|
};
|
|
36984
37042
|
}
|
|
36985
|
-
function getSequenceState(states, numberingInstanceId) {
|
|
37043
|
+
function getSequenceState(states, numberingInstanceId, options = { create: true }) {
|
|
36986
37044
|
const existing = states.get(numberingInstanceId);
|
|
36987
37045
|
if (existing) {
|
|
36988
37046
|
return existing;
|
|
36989
37047
|
}
|
|
37048
|
+
if (options.create === false) {
|
|
37049
|
+
return { counters: [], lastLevel: null };
|
|
37050
|
+
}
|
|
36990
37051
|
const created = {
|
|
36991
37052
|
counters: [],
|
|
36992
37053
|
lastLevel: null
|
|
@@ -36994,6 +37055,12 @@ function getSequenceState(states, numberingInstanceId) {
|
|
|
36994
37055
|
states.set(numberingInstanceId, created);
|
|
36995
37056
|
return created;
|
|
36996
37057
|
}
|
|
37058
|
+
function cloneSequenceState(state) {
|
|
37059
|
+
return {
|
|
37060
|
+
counters: [...state.counters],
|
|
37061
|
+
lastLevel: state.lastLevel
|
|
37062
|
+
};
|
|
37063
|
+
}
|
|
36997
37064
|
function advanceSequence(state, currentLevel, levelDefinitions) {
|
|
36998
37065
|
for (let level = currentLevel + 1; level < state.counters.length; level += 1) {
|
|
36999
37066
|
if (shouldResetDeeperLevel(level, currentLevel, levelDefinitions)) {
|
|
@@ -37025,6 +37092,25 @@ function shouldResetDeeperLevel(level, triggeringLevel, levelDefinitions) {
|
|
|
37025
37092
|
function getLevelStartAt(level, levelDefinitions) {
|
|
37026
37093
|
return levelDefinitions.get(level)?.startAt ?? DEFAULT_NUMBERING_START_AT;
|
|
37027
37094
|
}
|
|
37095
|
+
function getNumberingFormatPosture(format, value) {
|
|
37096
|
+
if (!isSupportedNumberingFormat(format)) {
|
|
37097
|
+
return {
|
|
37098
|
+
status: "approximated",
|
|
37099
|
+
requestedFormat: format,
|
|
37100
|
+
renderedFormat: "decimal",
|
|
37101
|
+
reason: "unsupported-numbering-format-decimal-fallback"
|
|
37102
|
+
};
|
|
37103
|
+
}
|
|
37104
|
+
if (value !== void 0 && ((format === "upperRoman" || format === "lowerRoman") && (value <= 0 || value >= 4e3) || (format === "cardinalText" || format === "ordinalText") && (!Number.isInteger(value) || value < 1 || value > 999) || (format === "upperLetter" || format === "lowerLetter" || format === "chicago") && value < 1)) {
|
|
37105
|
+
return {
|
|
37106
|
+
status: "approximated",
|
|
37107
|
+
requestedFormat: format,
|
|
37108
|
+
renderedFormat: "decimal",
|
|
37109
|
+
reason: "numbering-format-range-decimal-fallback"
|
|
37110
|
+
};
|
|
37111
|
+
}
|
|
37112
|
+
return void 0;
|
|
37113
|
+
}
|
|
37028
37114
|
function renderLevelText(text, counters, levelDefinitions) {
|
|
37029
37115
|
if (!text) {
|
|
37030
37116
|
return null;
|
|
@@ -37867,6 +37953,7 @@ function toNumberingLayoutInput(numbering) {
|
|
|
37867
37953
|
associatedTabStops: toLayoutTabStops(numbering.geometry.tabStops, "numbering"),
|
|
37868
37954
|
level: numbering.level,
|
|
37869
37955
|
format: numbering.format,
|
|
37956
|
+
...numbering.formatPosture !== void 0 ? { formatPosture: { ...numbering.formatPosture } } : {},
|
|
37870
37957
|
startAt: numbering.startAt,
|
|
37871
37958
|
...numbering.isLegalNumbering ? { isLegalNumbering: true } : {},
|
|
37872
37959
|
...numbering.picBulletMediaId ? { pictureBulletMediaId: numbering.picBulletMediaId } : {}
|
|
@@ -38096,13 +38183,10 @@ var FormattingContextImpl = class {
|
|
|
38096
38183
|
const effectiveNumbering = this.resolveEffectiveParagraphNumbering(para);
|
|
38097
38184
|
if (!effectiveNumbering) return null;
|
|
38098
38185
|
if (!emitGeometry) {
|
|
38099
|
-
|
|
38186
|
+
this.numbering.resolve(effectiveNumbering, { advance });
|
|
38100
38187
|
return null;
|
|
38101
38188
|
}
|
|
38102
|
-
|
|
38103
|
-
console.warn("[formatting-context] resolveParagraphNumbering({advance:false}) is not supported; counter always advances");
|
|
38104
|
-
}
|
|
38105
|
-
return this.numbering.resolveDetailed(effectiveNumbering, para);
|
|
38189
|
+
return this.numbering.resolveDetailed(effectiveNumbering, para, { advance });
|
|
38106
38190
|
}
|
|
38107
38191
|
resolveNumberingLayoutInput(para, options = {}) {
|
|
38108
38192
|
return toNumberingLayoutInput(this.resolveParagraphNumbering(para, options));
|
|
@@ -39192,6 +39276,21 @@ function compileParagraphScope(entry, options = {}) {
|
|
|
39192
39276
|
partial: true
|
|
39193
39277
|
};
|
|
39194
39278
|
}
|
|
39279
|
+
function storyKeyFromHandle(handle) {
|
|
39280
|
+
const target = handle.storyTarget;
|
|
39281
|
+
if (target.kind === "main") return "main";
|
|
39282
|
+
return null;
|
|
39283
|
+
}
|
|
39284
|
+
function textLeafEditableTargetHint(entry, semanticBlockRange) {
|
|
39285
|
+
const storyKey = storyKeyFromHandle(entry.handle);
|
|
39286
|
+
if (!storyKey) return void 0;
|
|
39287
|
+
return {
|
|
39288
|
+
kind: "text-leaf",
|
|
39289
|
+
storyKey,
|
|
39290
|
+
blockPath: `${storyKey}/block[${entry.blockIndex}]`,
|
|
39291
|
+
semanticBlockRange
|
|
39292
|
+
};
|
|
39293
|
+
}
|
|
39195
39294
|
function compileParagraphReplacement(entry, proposed, options) {
|
|
39196
39295
|
if (proposed.operation !== "replace" && proposed.operation !== "insert-before" && proposed.operation !== "insert-after") {
|
|
39197
39296
|
return null;
|
|
@@ -39247,6 +39346,7 @@ function compileParagraphReplacement(entry, proposed, options) {
|
|
|
39247
39346
|
{
|
|
39248
39347
|
kind: stepKind,
|
|
39249
39348
|
summary: stepKind === "text-replace" ? actionSummary : `suggest-mode ${actionSummary}`,
|
|
39349
|
+
...textLeafEditableTargetHint(entry, blockRange) ? { editableTargetHint: textLeafEditableTargetHint(entry, blockRange) } : {},
|
|
39250
39350
|
range: { from: operationRange.from, to: operationRange.to },
|
|
39251
39351
|
text,
|
|
39252
39352
|
...proposed.formatting ? { formatting: proposed.formatting } : {}
|
|
@@ -39274,6 +39374,7 @@ function compileParagraphReplacement(entry, proposed, options) {
|
|
|
39274
39374
|
{
|
|
39275
39375
|
kind: "fragment-replace",
|
|
39276
39376
|
summary: actionSummary,
|
|
39377
|
+
...textLeafEditableTargetHint(entry, blockRange) ? { editableTargetHint: textLeafEditableTargetHint(entry, blockRange) } : {},
|
|
39277
39378
|
range: { from: operationRange.from, to: operationRange.to },
|
|
39278
39379
|
fragment
|
|
39279
39380
|
}
|
|
@@ -42315,6 +42416,24 @@ function refusalIdForPostureBlocker(target, blocker2) {
|
|
|
42315
42416
|
return "editable_target_opaque_content";
|
|
42316
42417
|
case "synthetic-layout-cell":
|
|
42317
42418
|
return "editable_target_synthetic_layout_cell";
|
|
42419
|
+
case "list-text-readback-missing":
|
|
42420
|
+
return "list_text_readback_missing";
|
|
42421
|
+
case "list-structure-command-missing":
|
|
42422
|
+
return "list_structure_command_missing";
|
|
42423
|
+
case "list-target-stale":
|
|
42424
|
+
return "list_target_stale";
|
|
42425
|
+
case "list-secondary-story-unsupported":
|
|
42426
|
+
return "list_secondary_story_unsupported";
|
|
42427
|
+
case "list-table-target-missing":
|
|
42428
|
+
return "list_table_target_missing";
|
|
42429
|
+
case "list-export-persistence-missing":
|
|
42430
|
+
return "list_export_persistence_missing";
|
|
42431
|
+
case "numbering-format-unsupported":
|
|
42432
|
+
return "numbering_format_unsupported";
|
|
42433
|
+
case "picture-bullet-preserve-only":
|
|
42434
|
+
return "picture_bullet_preserve_only";
|
|
42435
|
+
case "marker-geometry-unavailable":
|
|
42436
|
+
return "marker_geometry_unavailable";
|
|
42318
42437
|
case "unmodeled-target":
|
|
42319
42438
|
return target.commandFamily === "link-bookmark" ? "editable_target_linked_content_unmodeled" : "editable_target_unmodeled";
|
|
42320
42439
|
}
|
|
@@ -42337,12 +42456,42 @@ function auditCategoryForPostureBlocker(target, blocker2) {
|
|
|
42337
42456
|
return target.commandFamily === "link-bookmark" ? "linked-content" : "unsupported-command";
|
|
42338
42457
|
case "synthetic-layout-cell":
|
|
42339
42458
|
return "synthetic-cell";
|
|
42459
|
+
case "list-target-stale":
|
|
42460
|
+
return "stale-ref";
|
|
42461
|
+
case "picture-bullet-preserve-only":
|
|
42462
|
+
case "list-export-persistence-missing":
|
|
42463
|
+
return "preserve-only";
|
|
42464
|
+
case "list-text-readback-missing":
|
|
42465
|
+
case "list-structure-command-missing":
|
|
42466
|
+
case "list-secondary-story-unsupported":
|
|
42467
|
+
case "list-table-target-missing":
|
|
42468
|
+
case "numbering-format-unsupported":
|
|
42469
|
+
case "marker-geometry-unavailable":
|
|
42470
|
+
return "unsupported-command";
|
|
42340
42471
|
}
|
|
42341
42472
|
}
|
|
42342
42473
|
function messageForPostureBlocker(blocker2) {
|
|
42343
42474
|
switch (blocker2) {
|
|
42344
42475
|
case "synthetic-layout-cell":
|
|
42345
42476
|
return "Hidden vertical-merge continuation or synthetic layout cells are not editable targets.";
|
|
42477
|
+
case "list-text-readback-missing":
|
|
42478
|
+
return "List text edits need an authoritative list-item text target before mutation.";
|
|
42479
|
+
case "list-structure-command-missing":
|
|
42480
|
+
return "List structure changes need a supported list command envelope before mutation.";
|
|
42481
|
+
case "list-target-stale":
|
|
42482
|
+
return "List target identity is stale for the current canonical document.";
|
|
42483
|
+
case "list-secondary-story-unsupported":
|
|
42484
|
+
return "List edits in this secondary story are not yet supported.";
|
|
42485
|
+
case "list-table-target-missing":
|
|
42486
|
+
return "Table-contained list item is missing a command-safe list target.";
|
|
42487
|
+
case "list-export-persistence-missing":
|
|
42488
|
+
return "List mutation is blocked until export/reopen persistence is available.";
|
|
42489
|
+
case "numbering-format-unsupported":
|
|
42490
|
+
return "Numbering format is unsupported for this list command.";
|
|
42491
|
+
case "picture-bullet-preserve-only":
|
|
42492
|
+
return "Picture bullet lists are preserve-only until picture bullet mutation is supported.";
|
|
42493
|
+
case "marker-geometry-unavailable":
|
|
42494
|
+
return "List marker geometry is unavailable for this target.";
|
|
42346
42495
|
default:
|
|
42347
42496
|
return void 0;
|
|
42348
42497
|
}
|
|
@@ -48024,6 +48173,7 @@ function toSurfaceResolvedNumbering(numbering) {
|
|
|
48024
48173
|
return {
|
|
48025
48174
|
level: numbering.level,
|
|
48026
48175
|
format: numbering.format,
|
|
48176
|
+
...numbering.formatPosture !== void 0 ? { formatPosture: { ...numbering.formatPosture } } : {},
|
|
48027
48177
|
...numbering.text !== null ? { text: numbering.text } : {},
|
|
48028
48178
|
startAt: numbering.startAt,
|
|
48029
48179
|
...numbering.paragraphStyleId ? { paragraphStyleId: numbering.paragraphStyleId } : {},
|
|
@@ -52347,8 +52497,9 @@ function projectSurfaceBlocksToPageFragments(surface, pages, splits, columnByBlo
|
|
|
52347
52497
|
const perPageCounter = /* @__PURE__ */ new Map();
|
|
52348
52498
|
const fieldRegionsByParagraphIndex = buildFieldRegionsByParagraphIndex(fieldRegions);
|
|
52349
52499
|
const generatedTargets = buildGeneratedTargets(editableTargets);
|
|
52500
|
+
const numberingTargets = buildNumberingTargets(editableTargets);
|
|
52350
52501
|
const bookmarkRanges = buildBookmarkRanges(editableTargets);
|
|
52351
|
-
const
|
|
52502
|
+
const numberingIndex = buildNumberingInputIndex(numberingInputs);
|
|
52352
52503
|
const pushFragment = (pageIndex, fragment) => {
|
|
52353
52504
|
const existing = byPage.get(pageIndex);
|
|
52354
52505
|
if (existing) {
|
|
@@ -52384,8 +52535,9 @@ function projectSurfaceBlocksToPageFragments(surface, pages, splits, columnByBlo
|
|
|
52384
52535
|
},
|
|
52385
52536
|
fieldRegionsByParagraphIndex,
|
|
52386
52537
|
generatedTargets,
|
|
52538
|
+
numberingTargets,
|
|
52387
52539
|
bookmarkRanges,
|
|
52388
|
-
|
|
52540
|
+
numberingIndex,
|
|
52389
52541
|
blockPath
|
|
52390
52542
|
);
|
|
52391
52543
|
continue;
|
|
@@ -52406,8 +52558,9 @@ function projectSurfaceBlocksToPageFragments(surface, pages, splits, columnByBlo
|
|
|
52406
52558
|
},
|
|
52407
52559
|
fieldRegionsByParagraphIndex,
|
|
52408
52560
|
generatedTargets,
|
|
52561
|
+
numberingTargets,
|
|
52409
52562
|
bookmarkRanges,
|
|
52410
|
-
|
|
52563
|
+
numberingIndex,
|
|
52411
52564
|
blockPath
|
|
52412
52565
|
);
|
|
52413
52566
|
continue;
|
|
@@ -52439,8 +52592,9 @@ function projectSurfaceBlocksToPageFragments(surface, pages, splits, columnByBlo
|
|
|
52439
52592
|
paginationRole: "whole",
|
|
52440
52593
|
fieldRegionsByParagraphIndex,
|
|
52441
52594
|
generatedTargets,
|
|
52595
|
+
numberingTargets,
|
|
52442
52596
|
bookmarkRanges,
|
|
52443
|
-
|
|
52597
|
+
numberingIndex,
|
|
52444
52598
|
blockPath
|
|
52445
52599
|
}),
|
|
52446
52600
|
...columnIndex !== void 0 ? { columnIndex } : {}
|
|
@@ -52587,7 +52741,7 @@ function buildRunAnchorsForLine(input) {
|
|
|
52587
52741
|
}
|
|
52588
52742
|
return anchors;
|
|
52589
52743
|
}
|
|
52590
|
-
function emitSlicedParagraph(block, slices, emit2, fieldRegionsByParagraphIndex = /* @__PURE__ */ new Map(), generatedTargets = [],
|
|
52744
|
+
function emitSlicedParagraph(block, slices, emit2, fieldRegionsByParagraphIndex = /* @__PURE__ */ new Map(), generatedTargets = [], numberingTargets = [], bookmarkRanges = [], numberingIndex = EMPTY_NUMBERING_INPUT_INDEX, blockPath) {
|
|
52591
52745
|
for (let i = 0; i < slices.length; i += 1) {
|
|
52592
52746
|
const slice = slices[i];
|
|
52593
52747
|
const heightTwips = slice.heightTwips ?? estimateSliceHeightFromLines(slice.lineRange);
|
|
@@ -52612,8 +52766,9 @@ function emitSlicedParagraph(block, slices, emit2, fieldRegionsByParagraphIndex
|
|
|
52612
52766
|
paginationRole: slice.lineRange.from > 0 ? "continuation" : "slice",
|
|
52613
52767
|
fieldRegionsByParagraphIndex,
|
|
52614
52768
|
generatedTargets,
|
|
52769
|
+
numberingTargets,
|
|
52615
52770
|
bookmarkRanges,
|
|
52616
|
-
|
|
52771
|
+
numberingIndex,
|
|
52617
52772
|
blockPath
|
|
52618
52773
|
})
|
|
52619
52774
|
};
|
|
@@ -52634,7 +52789,7 @@ function estimateSliceHeightFromLines(lineRange) {
|
|
|
52634
52789
|
const lines = Math.max(0, lineRange.to - lineRange.from);
|
|
52635
52790
|
return lines * 240;
|
|
52636
52791
|
}
|
|
52637
|
-
function emitSlicedTable(block, slices, emit2, fieldRegionsByParagraphIndex = /* @__PURE__ */ new Map(), generatedTargets = [],
|
|
52792
|
+
function emitSlicedTable(block, slices, emit2, fieldRegionsByParagraphIndex = /* @__PURE__ */ new Map(), generatedTargets = [], numberingTargets = [], bookmarkRanges = [], numberingIndex = EMPTY_NUMBERING_INPUT_INDEX, blockPath) {
|
|
52638
52793
|
for (let i = 0; i < slices.length; i += 1) {
|
|
52639
52794
|
const slice = slices[i];
|
|
52640
52795
|
const heightTwips = slice.heightTwips ?? estimateSliceHeightFromRows(slice.rowRange);
|
|
@@ -52658,8 +52813,9 @@ function emitSlicedTable(block, slices, emit2, fieldRegionsByParagraphIndex = /*
|
|
|
52658
52813
|
paginationRole: slice.rowRange.from > 0 ? "continuation" : "slice",
|
|
52659
52814
|
fieldRegionsByParagraphIndex,
|
|
52660
52815
|
generatedTargets,
|
|
52816
|
+
numberingTargets,
|
|
52661
52817
|
bookmarkRanges,
|
|
52662
|
-
|
|
52818
|
+
numberingIndex,
|
|
52663
52819
|
blockPath
|
|
52664
52820
|
}),
|
|
52665
52821
|
...slice.columnIndex !== void 0 ? { columnIndex: slice.columnIndex } : {}
|
|
@@ -52733,7 +52889,8 @@ function buildFragmentLayoutObject(input) {
|
|
|
52733
52889
|
const numberingRows = collectNumberingLayoutFactsForBlock(
|
|
52734
52890
|
input.block,
|
|
52735
52891
|
input.blockPath,
|
|
52736
|
-
input.
|
|
52892
|
+
input.numberingIndex,
|
|
52893
|
+
input.numberingTargets
|
|
52737
52894
|
);
|
|
52738
52895
|
const numbering = input.block.kind === "paragraph" ? numberingRows[0] : void 0;
|
|
52739
52896
|
const fieldRegions = collectFieldRegionLayoutFacts(
|
|
@@ -52904,6 +53061,11 @@ function buildGeneratedTargets(targets) {
|
|
|
52904
53061
|
(target) => target.kind === "field-result-text" || target.kind === "hyperlink-text" || target.kind === "hyperlink-destination" || target.kind === "bookmark-anchor" || target.kind === "bookmark-content-range"
|
|
52905
53062
|
);
|
|
52906
53063
|
}
|
|
53064
|
+
function buildNumberingTargets(targets) {
|
|
53065
|
+
return targets.filter(
|
|
53066
|
+
(target) => target.listAddress !== void 0 || target.canonicalAddress?.addressKind === "list-item-text"
|
|
53067
|
+
);
|
|
53068
|
+
}
|
|
52907
53069
|
function buildBookmarkRanges(targets) {
|
|
52908
53070
|
const anchors = /* @__PURE__ */ new Map();
|
|
52909
53071
|
const contentRanges = /* @__PURE__ */ new Map();
|
|
@@ -52951,14 +53113,27 @@ function buildBookmarkRanges(targets) {
|
|
|
52951
53113
|
}
|
|
52952
53114
|
return ranges;
|
|
52953
53115
|
}
|
|
52954
|
-
|
|
53116
|
+
var EMPTY_NUMBERING_INPUT_INDEX = {
|
|
53117
|
+
byNumberingKey: /* @__PURE__ */ new Map(),
|
|
53118
|
+
byBlockPath: /* @__PURE__ */ new Map(),
|
|
53119
|
+
byParagraphIndex: /* @__PURE__ */ new Map()
|
|
53120
|
+
};
|
|
53121
|
+
function buildNumberingInputIndex(numberingInputs) {
|
|
53122
|
+
const byNumberingKey = /* @__PURE__ */ new Map();
|
|
53123
|
+
const byBlockPath = /* @__PURE__ */ new Map();
|
|
52955
53124
|
const byParagraph = /* @__PURE__ */ new Map();
|
|
52956
53125
|
for (const input of numberingInputs) {
|
|
53126
|
+
if (!byNumberingKey.has(input.numberingKey)) {
|
|
53127
|
+
byNumberingKey.set(input.numberingKey, input);
|
|
53128
|
+
}
|
|
53129
|
+
if (!byBlockPath.has(input.blockPath)) {
|
|
53130
|
+
byBlockPath.set(input.blockPath, input);
|
|
53131
|
+
}
|
|
52957
53132
|
if (!byParagraph.has(input.paragraphIndex)) {
|
|
52958
53133
|
byParagraph.set(input.paragraphIndex, input);
|
|
52959
53134
|
}
|
|
52960
53135
|
}
|
|
52961
|
-
return byParagraph;
|
|
53136
|
+
return { byNumberingKey, byBlockPath, byParagraphIndex: byParagraph };
|
|
52962
53137
|
}
|
|
52963
53138
|
function collectBookmarkRangeLayoutFacts(fragmentId, blockPath, bookmarkRanges) {
|
|
52964
53139
|
if (!blockPath || !bookmarkRanges || bookmarkRanges.length === 0) return [];
|
|
@@ -53039,6 +53214,7 @@ function collectNumberingLayoutFacts(block) {
|
|
|
53039
53214
|
...block.numbering?.numberingInstanceId !== void 0 ? { numberingInstanceId: block.numbering.numberingInstanceId } : {},
|
|
53040
53215
|
...block.numbering?.level !== void 0 ? { level: block.numbering.level } : {},
|
|
53041
53216
|
...block.resolvedNumbering?.format !== void 0 ? { format: block.resolvedNumbering.format } : {},
|
|
53217
|
+
...block.resolvedNumbering?.formatPosture !== void 0 ? { formatPosture: { ...block.resolvedNumbering.formatPosture } } : {},
|
|
53042
53218
|
...block.numberingPrefix !== void 0 ? { markerText: block.numberingPrefix } : {},
|
|
53043
53219
|
...block.numberingSuffix !== void 0 ? { markerSuffix: block.numberingSuffix } : {},
|
|
53044
53220
|
...block.resolvedNumbering?.geometry.markerJustification !== void 0 ? { markerJustification: block.resolvedNumbering.geometry.markerJustification } : {},
|
|
@@ -53066,15 +53242,21 @@ function collectNumberingLayoutFacts(block) {
|
|
|
53066
53242
|
} : {}
|
|
53067
53243
|
};
|
|
53068
53244
|
}
|
|
53069
|
-
function collectNumberingLayoutFactsForBlock(block, blockPath,
|
|
53245
|
+
function collectNumberingLayoutFactsForBlock(block, blockPath, numberingIndex, numberingTargets = []) {
|
|
53070
53246
|
const rows = [];
|
|
53071
53247
|
const seen = /* @__PURE__ */ new Set();
|
|
53072
53248
|
visitParagraphBlocks(block, (paragraph, context) => {
|
|
53073
53249
|
const numbering = collectNumberingLayoutFacts(paragraph);
|
|
53074
53250
|
if (!numbering) return;
|
|
53075
53251
|
const paragraphIndex = parseParagraphBlockIndex(paragraph.blockId);
|
|
53076
|
-
const canonical = paragraphIndex !== void 0 ? numberingByParagraphIndex?.get(paragraphIndex) : void 0;
|
|
53077
53252
|
const numberingKey = context.path !== void 0 ? `main:${context.path}:numbering` : void 0;
|
|
53253
|
+
const canonical = lookupNumberingInput(
|
|
53254
|
+
numberingIndex,
|
|
53255
|
+
numberingKey,
|
|
53256
|
+
context.path,
|
|
53257
|
+
paragraphIndex
|
|
53258
|
+
);
|
|
53259
|
+
const target = findNumberingTarget(numberingTargets, context.path);
|
|
53078
53260
|
const numberingLayoutId = numberingKey ?? [
|
|
53079
53261
|
"numbering",
|
|
53080
53262
|
paragraph.blockId,
|
|
@@ -53083,6 +53265,7 @@ function collectNumberingLayoutFactsForBlock(block, blockPath, numberingByParagr
|
|
|
53083
53265
|
].join(":");
|
|
53084
53266
|
if (seen.has(numberingLayoutId)) return;
|
|
53085
53267
|
seen.add(numberingLayoutId);
|
|
53268
|
+
const unavailableReasons = collectNumberingUnavailableReasons(numbering, canonical);
|
|
53086
53269
|
rows.push({
|
|
53087
53270
|
numberingLayoutId,
|
|
53088
53271
|
...numberingKey !== void 0 ? { numberingKey } : {},
|
|
@@ -53090,6 +53273,10 @@ function collectNumberingLayoutFactsForBlock(block, blockPath, numberingByParagr
|
|
|
53090
53273
|
...canonical?.blockPath !== void 0 ? { sourceBlockPath: canonical.blockPath } : context.path !== void 0 ? { sourceBlockPath: context.path } : {},
|
|
53091
53274
|
sourceBlockId: paragraph.blockId,
|
|
53092
53275
|
...paragraphIndex !== void 0 ? { paragraphIndex } : {},
|
|
53276
|
+
...target?.targetKey !== void 0 ? { targetKey: target.targetKey } : {},
|
|
53277
|
+
...target?.kind !== void 0 ? { targetKind: target.kind } : {},
|
|
53278
|
+
...target?.canonicalAddress?.addressKey !== void 0 ? { canonicalAddressKey: target.canonicalAddress.addressKey } : {},
|
|
53279
|
+
...target?.listAddress?.addressKey !== void 0 ? { listAddressKey: target.listAddress.addressKey } : {},
|
|
53093
53280
|
...canonical?.sourceRef !== void 0 ? { sourceRef: { ...canonical.sourceRef } } : {},
|
|
53094
53281
|
...canonical?.numberingSourceRef !== void 0 ? { numberingSourceRef: { ...canonical.numberingSourceRef } } : {},
|
|
53095
53282
|
...canonical?.numberingOrigin !== void 0 ? { numberingOrigin: canonical.numberingOrigin } : {},
|
|
@@ -53097,11 +53284,41 @@ function collectNumberingLayoutFactsForBlock(block, blockPath, numberingByParagr
|
|
|
53097
53284
|
...canonical?.numberingInstanceSourceRef !== void 0 ? { numberingInstanceSourceRef: { ...canonical.numberingInstanceSourceRef } } : {},
|
|
53098
53285
|
...canonical?.abstractNumberingId !== void 0 ? { abstractNumberingId: canonical.abstractNumberingId } : {},
|
|
53099
53286
|
...canonical?.abstractNumberingSourceRef !== void 0 ? { abstractNumberingSourceRef: { ...canonical.abstractNumberingSourceRef } } : {},
|
|
53100
|
-
...numbering
|
|
53287
|
+
...numbering,
|
|
53288
|
+
...unavailableReasons.length > 0 ? { unavailableReasons } : {}
|
|
53101
53289
|
});
|
|
53102
53290
|
}, blockPath);
|
|
53103
53291
|
return rows;
|
|
53104
53292
|
}
|
|
53293
|
+
function findNumberingTarget(numberingTargets, blockPath) {
|
|
53294
|
+
if (blockPath === void 0) return void 0;
|
|
53295
|
+
return numberingTargets.find((target) => target.blockPath === blockPath);
|
|
53296
|
+
}
|
|
53297
|
+
function lookupNumberingInput(numberingIndex, numberingKey, blockPath, paragraphIndex) {
|
|
53298
|
+
if (!numberingIndex) return void 0;
|
|
53299
|
+
if (numberingKey !== void 0) {
|
|
53300
|
+
const byKey = numberingIndex.byNumberingKey.get(numberingKey);
|
|
53301
|
+
if (byKey !== void 0) return byKey;
|
|
53302
|
+
}
|
|
53303
|
+
if (blockPath !== void 0) {
|
|
53304
|
+
const byPath = numberingIndex.byBlockPath.get(blockPath);
|
|
53305
|
+
if (byPath !== void 0) return byPath;
|
|
53306
|
+
}
|
|
53307
|
+
return paragraphIndex !== void 0 ? numberingIndex.byParagraphIndex.get(paragraphIndex) : void 0;
|
|
53308
|
+
}
|
|
53309
|
+
function collectNumberingUnavailableReasons(numbering, canonical) {
|
|
53310
|
+
const reasons = [];
|
|
53311
|
+
if (canonical === void 0) {
|
|
53312
|
+
reasons.push("canonical-numbering-input-missing");
|
|
53313
|
+
}
|
|
53314
|
+
if (numbering.markerLane === void 0) {
|
|
53315
|
+
reasons.push("numbering-marker-lane-unavailable");
|
|
53316
|
+
}
|
|
53317
|
+
if (numbering.textColumn === void 0) {
|
|
53318
|
+
reasons.push("numbering-text-column-unavailable");
|
|
53319
|
+
}
|
|
53320
|
+
return reasons;
|
|
53321
|
+
}
|
|
53105
53322
|
function findPageIndexForOffset(pages, offset) {
|
|
53106
53323
|
for (let i = 0; i < pages.length; i += 1) {
|
|
53107
53324
|
const page = pages[i];
|
|
@@ -56519,7 +56736,8 @@ function reject(code, message) {
|
|
|
56519
56736
|
};
|
|
56520
56737
|
}
|
|
56521
56738
|
function sameResolvedTarget2(left, right) {
|
|
56522
|
-
|
|
56739
|
+
const textTargetLengthDrift = hasTextTargetLengthDrift(left, right);
|
|
56740
|
+
return left.kind === right.kind && left.storyKey === right.storyKey && left.blockPath === right.blockPath && left.leafPath === right.leafPath && left.commandFamily === right.commandFamily && left.editability === right.editability && sameTextTargetStaleCheck(left, right) && left.staleCheck.inlineCount === right.staleCheck.inlineCount && left.staleCheck.targetHash === right.staleCheck.targetHash && left.staleCheck.targetTextLength === right.staleCheck.targetTextLength && left.staleCheck.childCount === right.staleCheck.childCount && left.staleCheck.blockType === right.staleCheck.blockType && left.staleCheck.wordParaId === right.staleCheck.wordParaId && left.staleCheck.wordTextId === right.staleCheck.wordTextId && (textTargetLengthDrift || jsonStable(left.staleCheck.sourceRef) === jsonStable(right.staleCheck.sourceRef)) && (textTargetLengthDrift || jsonStable(left.sourceRef) === jsonStable(right.sourceRef)) && jsonStable(left.table) === jsonStable(right.table) && jsonStable(left.editableOwner) === jsonStable(right.editableOwner);
|
|
56523
56741
|
}
|
|
56524
56742
|
function sameTextTargetStaleCheck(left, right) {
|
|
56525
56743
|
if (left.staleCheck.paragraphTextHash === right.staleCheck.paragraphTextHash && left.staleCheck.paragraphTextLength === right.staleCheck.paragraphTextLength) {
|
|
@@ -56527,6 +56745,9 @@ function sameTextTargetStaleCheck(left, right) {
|
|
|
56527
56745
|
}
|
|
56528
56746
|
return left.commandFamily === "text-leaf" && left.staleCheck.paragraphTextLength !== void 0 && right.staleCheck.paragraphTextLength !== void 0 && left.staleCheck.paragraphTextLength !== right.staleCheck.paragraphTextLength;
|
|
56529
56747
|
}
|
|
56748
|
+
function hasTextTargetLengthDrift(left, right) {
|
|
56749
|
+
return left.commandFamily === "text-leaf" && left.staleCheck.paragraphTextLength !== void 0 && right.staleCheck.paragraphTextLength !== void 0 && left.staleCheck.paragraphTextLength !== right.staleCheck.paragraphTextLength;
|
|
56750
|
+
}
|
|
56530
56751
|
function locateTargetRange(document2, surface, target) {
|
|
56531
56752
|
if (target.kind === "hyperlink-text") {
|
|
56532
56753
|
return locateHyperlinkDisplayRange(document2, surface, target);
|
|
@@ -56557,19 +56778,19 @@ function locateTargetRange(document2, surface, target) {
|
|
|
56557
56778
|
if (!sdt || sdt.kind !== "sdt_block") return null;
|
|
56558
56779
|
const paragraph = sdt.children[sdtPath.childIndex];
|
|
56559
56780
|
if (!paragraph || paragraph.kind !== "paragraph") return null;
|
|
56560
|
-
return
|
|
56781
|
+
return textLeafTargetRange(target, paragraph.from, paragraph.to);
|
|
56561
56782
|
}
|
|
56562
56783
|
const paragraphPath = parseTopLevelParagraphPath(target.blockPath);
|
|
56563
56784
|
if (paragraphPath) {
|
|
56564
56785
|
const paragraph = surface[paragraphPath.blockIndex];
|
|
56565
56786
|
if (!paragraph || paragraph.kind !== "paragraph") return null;
|
|
56566
|
-
return
|
|
56787
|
+
return textLeafTargetRange(target, paragraph.from, paragraph.to);
|
|
56567
56788
|
}
|
|
56568
56789
|
const secondaryParagraphPath = parseSecondaryStoryParagraphPath(target.blockPath);
|
|
56569
56790
|
if (secondaryParagraphPath) {
|
|
56570
56791
|
const paragraph = surface[secondaryParagraphPath.blockIndex];
|
|
56571
56792
|
if (!paragraph || paragraph.kind !== "paragraph") return null;
|
|
56572
|
-
return
|
|
56793
|
+
return textLeafTargetRange(target, paragraph.from, paragraph.to);
|
|
56573
56794
|
}
|
|
56574
56795
|
if (target.kind === "textbox-paragraph-text") {
|
|
56575
56796
|
return {
|
|
@@ -56585,6 +56806,18 @@ function locateTargetRange(document2, surface, target) {
|
|
|
56585
56806
|
}
|
|
56586
56807
|
return null;
|
|
56587
56808
|
}
|
|
56809
|
+
function textLeafTargetRange(target, from, to) {
|
|
56810
|
+
return {
|
|
56811
|
+
from,
|
|
56812
|
+
to,
|
|
56813
|
+
textTarget: {
|
|
56814
|
+
kind: "text-leaf",
|
|
56815
|
+
blockPath: target.blockPath,
|
|
56816
|
+
paragraphStart: from,
|
|
56817
|
+
paragraphEnd: to
|
|
56818
|
+
}
|
|
56819
|
+
};
|
|
56820
|
+
}
|
|
56588
56821
|
function locateHyperlinkDisplayRange(document2, surface, target) {
|
|
56589
56822
|
const canonical = resolveHyperlinkDisplayPath(document2, target.blockPath);
|
|
56590
56823
|
if (!canonical) return null;
|
|
@@ -57704,6 +57937,17 @@ var hyperlinkDestinationEditMetadata = actionMethodMetadata(
|
|
|
57704
57937
|
expectedDelta: "hyperlink destination changes"
|
|
57705
57938
|
}
|
|
57706
57939
|
);
|
|
57940
|
+
var hyperlinkTextEditMetadata = actionMethodMetadata(
|
|
57941
|
+
"hyperlinkTextEdit",
|
|
57942
|
+
"mutate",
|
|
57943
|
+
"actions-link-bookmark",
|
|
57944
|
+
"Edit supported hyperlink display text through the L07 text-leaf command target; broad carrier scope rewrite remains refused.",
|
|
57945
|
+
{
|
|
57946
|
+
uiVisible: true,
|
|
57947
|
+
expectsUxResponse: "inline-change",
|
|
57948
|
+
expectedDelta: "hyperlink display text changes"
|
|
57949
|
+
}
|
|
57950
|
+
);
|
|
57707
57951
|
var listOperationMetadata = actionMethodMetadata(
|
|
57708
57952
|
"listOperation",
|
|
57709
57953
|
"mutate",
|
|
@@ -57763,6 +58007,7 @@ var ACTION_METHODS = Object.freeze([
|
|
|
57763
58007
|
"tocRefresh",
|
|
57764
58008
|
"bookmarkEdit",
|
|
57765
58009
|
"hyperlinkDestinationEdit",
|
|
58010
|
+
"hyperlinkTextEdit",
|
|
57766
58011
|
"listOperation",
|
|
57767
58012
|
"tableFragment",
|
|
57768
58013
|
"tableSelection",
|
|
@@ -57772,6 +58017,9 @@ var DEFAULT_LOCATE_LIMIT = 20;
|
|
|
57772
58017
|
var DEFAULT_REWRITE_ALL_LIMIT = 10;
|
|
57773
58018
|
var DEFAULT_TABLE_TEXT_SCOPE_LIMIT = 3;
|
|
57774
58019
|
var DEFAULT_PLAN_STEP_LIMIT = 20;
|
|
58020
|
+
function documentContentHash(runtime) {
|
|
58021
|
+
return JSON.stringify(runtime.getCanonicalDocument().content);
|
|
58022
|
+
}
|
|
57775
58023
|
function createActionsFamily(runtime) {
|
|
57776
58024
|
const category = {
|
|
57777
58025
|
discover(input) {
|
|
@@ -58018,6 +58266,14 @@ function createActionsFamily(runtime) {
|
|
|
58018
58266
|
...readback ? { text: readback.text, excerpt: excerpt(readback.text) } : {}
|
|
58019
58267
|
};
|
|
58020
58268
|
}
|
|
58269
|
+
if (resolved.target.kind === "editable-text") {
|
|
58270
|
+
return {
|
|
58271
|
+
status: "read",
|
|
58272
|
+
target: summarizeTarget(resolved.target),
|
|
58273
|
+
text: resolved.target.readback.text,
|
|
58274
|
+
excerpt: excerpt(resolved.target.readback.text)
|
|
58275
|
+
};
|
|
58276
|
+
}
|
|
58021
58277
|
const text = resolved.target.scope.content.text;
|
|
58022
58278
|
return {
|
|
58023
58279
|
status: "read",
|
|
@@ -58098,6 +58354,31 @@ function createActionsFamily(runtime) {
|
|
|
58098
58354
|
input
|
|
58099
58355
|
);
|
|
58100
58356
|
},
|
|
58357
|
+
hyperlinkTextEdit(input) {
|
|
58358
|
+
if (input.text === void 0) {
|
|
58359
|
+
return blockedApply(
|
|
58360
|
+
"actions:hyperlink-text-edit:text-required",
|
|
58361
|
+
"input",
|
|
58362
|
+
"Hyperlink display text edit actions require a text value.",
|
|
58363
|
+
"Retry with a text string."
|
|
58364
|
+
);
|
|
58365
|
+
}
|
|
58366
|
+
const resolved = resolveTarget(runtime, input.target);
|
|
58367
|
+
if (!resolved.ok) return blockedApplyFromResolution(resolved);
|
|
58368
|
+
if (resolved.target.kind !== "editable-text" || resolved.target.targetKind !== "hyperlink-text") {
|
|
58369
|
+
return blockedApply(
|
|
58370
|
+
"actions:hyperlink-text-edit:hyperlink-text-handle-required",
|
|
58371
|
+
"unsupported",
|
|
58372
|
+
"Hyperlink display text edits require an exact hyperlink-text actionHandle.",
|
|
58373
|
+
"Call ai.actions.locateAll and retry with a returned scope-command:text-leaf actionHandle."
|
|
58374
|
+
);
|
|
58375
|
+
}
|
|
58376
|
+
return applyEditableTextRewrite(runtime, resolved.target, {
|
|
58377
|
+
text: input.text,
|
|
58378
|
+
actorId: input.actorId,
|
|
58379
|
+
origin: input.origin
|
|
58380
|
+
});
|
|
58381
|
+
},
|
|
58101
58382
|
listOperation(input) {
|
|
58102
58383
|
return applyListOperation(runtime, input);
|
|
58103
58384
|
},
|
|
@@ -58146,6 +58427,7 @@ function runPlan(runtime, input) {
|
|
|
58146
58427
|
for (const step of input.steps) {
|
|
58147
58428
|
const result = runPlanStep(runtime, mode, step, input);
|
|
58148
58429
|
results.push(result);
|
|
58430
|
+
if (isSuspectMutationStep(result)) break;
|
|
58149
58431
|
if (stopOnBlocker && (result.status === "blocked" || result.status === "unsupported")) {
|
|
58150
58432
|
break;
|
|
58151
58433
|
}
|
|
@@ -58210,24 +58492,27 @@ function runPlanStep(runtime, mode, step, plan) {
|
|
|
58210
58492
|
...before.readback ? { beforeReadback: before.readback } : {}
|
|
58211
58493
|
};
|
|
58212
58494
|
}
|
|
58495
|
+
const documentHashBeforeApply = documentContentHash(runtime);
|
|
58213
58496
|
const applied = applyPlanStep(runtime, step, plan);
|
|
58497
|
+
const documentHashAfterApply = documentContentHash(runtime);
|
|
58498
|
+
const projectedApply = !applied.applied && documentHashAfterApply !== documentHashBeforeApply ? withSuspectMutationApplyResult(applied, step.id, applied.target ?? before.target) : applied;
|
|
58214
58499
|
const after = step.kind === "flag" ? before : step.target ? readPlanTarget(runtime, step.target) : before;
|
|
58215
58500
|
return {
|
|
58216
58501
|
id: step.id,
|
|
58217
58502
|
kind: step.kind,
|
|
58218
|
-
status:
|
|
58219
|
-
applied:
|
|
58220
|
-
changed:
|
|
58221
|
-
...
|
|
58503
|
+
status: projectedApply.status === "unsupported" ? "unsupported" : projectedApply.applied ? "applied" : "blocked",
|
|
58504
|
+
applied: projectedApply.applied,
|
|
58505
|
+
changed: projectedApply.changed,
|
|
58506
|
+
...projectedApply.target ?? before.target ? { target: projectedApply.target ?? before.target } : {},
|
|
58222
58507
|
...before.tableAction ? { tableAction: before.tableAction } : {},
|
|
58223
58508
|
...before.readback ? { beforeReadback: before.readback } : {},
|
|
58224
58509
|
...after.ok && after.readback ? { afterReadback: after.readback } : {},
|
|
58225
|
-
...
|
|
58226
|
-
...
|
|
58227
|
-
...
|
|
58228
|
-
...
|
|
58229
|
-
...
|
|
58230
|
-
...
|
|
58510
|
+
...projectedApply.proposalId ? { proposalId: projectedApply.proposalId } : {},
|
|
58511
|
+
...projectedApply.posture ? { posture: projectedApply.posture } : {},
|
|
58512
|
+
...projectedApply.blockers ? { blockers: projectedApply.blockers } : {},
|
|
58513
|
+
...projectedApply.blockerDetails ? { blockerDetails: projectedApply.blockerDetails } : {},
|
|
58514
|
+
...projectedApply.auditReference ? { auditReference: projectedApply.auditReference } : {},
|
|
58515
|
+
...projectedApply.commandReference ? { commandReference: projectedApply.commandReference } : {}
|
|
58231
58516
|
};
|
|
58232
58517
|
}
|
|
58233
58518
|
function runPlanTableActionStep(runtime, mode, step, plan) {
|
|
@@ -58355,6 +58640,23 @@ function locateAll(runtime, input) {
|
|
|
58355
58640
|
isEmpty: text.trim().length === 0
|
|
58356
58641
|
});
|
|
58357
58642
|
}
|
|
58643
|
+
if (matches.length < limit && !input.kind) {
|
|
58644
|
+
for (const scope of scopes) {
|
|
58645
|
+
if (matches.length >= limit) break;
|
|
58646
|
+
for (const action of editableTextActionsForScope(runtime, scope.handle)) {
|
|
58647
|
+
if (matches.length >= limit) break;
|
|
58648
|
+
if (!textMatches(action.readback.text, input.query, input.matchCase)) continue;
|
|
58649
|
+
matches.push({
|
|
58650
|
+
kind: action.targetKind,
|
|
58651
|
+
text: action.readback.text,
|
|
58652
|
+
excerpt: excerpt(action.readback.text),
|
|
58653
|
+
actionHandle: action.actionHandle,
|
|
58654
|
+
readback: action.readback,
|
|
58655
|
+
isEmpty: action.readback.isEmpty
|
|
58656
|
+
});
|
|
58657
|
+
}
|
|
58658
|
+
}
|
|
58659
|
+
}
|
|
58358
58660
|
if (matches.length < limit && shouldScanTableText) {
|
|
58359
58661
|
const tableTextScopeLimit = Math.max(
|
|
58360
58662
|
0,
|
|
@@ -58389,23 +58691,27 @@ function locateAll(runtime, input) {
|
|
|
58389
58691
|
function resolveTarget(runtime, target) {
|
|
58390
58692
|
if ("actionHandle" in target) {
|
|
58391
58693
|
const action = findTableAction(runtime, target.actionHandle);
|
|
58392
|
-
if (
|
|
58393
|
-
|
|
58394
|
-
|
|
58395
|
-
|
|
58396
|
-
|
|
58397
|
-
|
|
58398
|
-
|
|
58694
|
+
if (action) {
|
|
58695
|
+
if (action.family !== "table-text") {
|
|
58696
|
+
return blockedResolution(
|
|
58697
|
+
`actions:target:action-handle-not-text:${target.actionHandle}`,
|
|
58698
|
+
"unsupported",
|
|
58699
|
+
"This actionHandle is not a table text action.",
|
|
58700
|
+
"Use table structure handles with ai.applyTableAction, or use a table text actionHandle for rewrite."
|
|
58701
|
+
);
|
|
58702
|
+
}
|
|
58703
|
+
return { ok: true, target: { kind: "table-text", action } };
|
|
58399
58704
|
}
|
|
58400
|
-
|
|
58401
|
-
|
|
58402
|
-
|
|
58403
|
-
"unsupported",
|
|
58404
|
-
"This actionHandle is not a table text action.",
|
|
58405
|
-
"Use table structure handles with ai.applyTableAction, or use a table text actionHandle for rewrite."
|
|
58406
|
-
);
|
|
58705
|
+
const editableTextAction = findEditableTextAction(runtime, target.actionHandle);
|
|
58706
|
+
if (editableTextAction) {
|
|
58707
|
+
return { ok: true, target: editableTextAction };
|
|
58407
58708
|
}
|
|
58408
|
-
return
|
|
58709
|
+
return blockedResolution(
|
|
58710
|
+
`actions:target:action-handle-not-found:${target.actionHandle}`,
|
|
58711
|
+
"unresolved-target",
|
|
58712
|
+
"No current table text or editable text action matches the supplied actionHandle.",
|
|
58713
|
+
"Call ai.actions.locateAll again and retry with a fresh actionHandle."
|
|
58714
|
+
);
|
|
58409
58715
|
}
|
|
58410
58716
|
if ("handle" in target) {
|
|
58411
58717
|
const compiled = createScopeCompilerService(runtime).compileScopeById(target.handle.scopeId);
|
|
@@ -58490,7 +58796,21 @@ function applyRewrite(runtime, target, input) {
|
|
|
58490
58796
|
...result2.afterReadback ? { afterReadback: result2.afterReadback } : {}
|
|
58491
58797
|
};
|
|
58492
58798
|
}
|
|
58799
|
+
if (target.kind === "editable-text") {
|
|
58800
|
+
return applyEditableTextRewrite(runtime, target, input);
|
|
58801
|
+
}
|
|
58802
|
+
const rewriteBlocker = scopeRewriteCapabilityBlocker(target.scope);
|
|
58803
|
+
if (rewriteBlocker) {
|
|
58804
|
+
return blockedApply(
|
|
58805
|
+
rewriteBlocker.code,
|
|
58806
|
+
rewriteBlocker.category,
|
|
58807
|
+
rewriteBlocker.message,
|
|
58808
|
+
rewriteBlocker.nextStep,
|
|
58809
|
+
[rewriteBlocker]
|
|
58810
|
+
);
|
|
58811
|
+
}
|
|
58493
58812
|
const beforeText = target.scope.content.text;
|
|
58813
|
+
const documentHashBeforeApply = documentContentHash(runtime);
|
|
58494
58814
|
const result = createReplacementFamily(runtime).applyReplacementScope({
|
|
58495
58815
|
targetScopeId: target.handle.scopeId,
|
|
58496
58816
|
operation: "replace",
|
|
@@ -58502,7 +58822,22 @@ function applyRewrite(runtime, target, input) {
|
|
|
58502
58822
|
...input.origin ? { origin: input.origin } : {},
|
|
58503
58823
|
...input.proposalId ? { proposalId: input.proposalId } : {}
|
|
58504
58824
|
});
|
|
58505
|
-
|
|
58825
|
+
const documentMutated = documentContentHash(runtime) !== documentHashBeforeApply;
|
|
58826
|
+
if (!result.applied) {
|
|
58827
|
+
return documentMutated ? withSuspectMutationApplyResult(
|
|
58828
|
+
projectApplyResult(result, target),
|
|
58829
|
+
target.handle.scopeId,
|
|
58830
|
+
summarizeTarget(target)
|
|
58831
|
+
) : projectApplyResult(result, target);
|
|
58832
|
+
}
|
|
58833
|
+
return projectRewriteScopeResult(
|
|
58834
|
+
runtime,
|
|
58835
|
+
result,
|
|
58836
|
+
target,
|
|
58837
|
+
beforeText,
|
|
58838
|
+
input.text,
|
|
58839
|
+
documentMutated
|
|
58840
|
+
);
|
|
58506
58841
|
}
|
|
58507
58842
|
function projectApplyResult(result, target) {
|
|
58508
58843
|
return {
|
|
@@ -58523,7 +58858,79 @@ function projectApplyResult(result, target) {
|
|
|
58523
58858
|
...result.auditReference ? { auditReference: result.auditReference } : {}
|
|
58524
58859
|
};
|
|
58525
58860
|
}
|
|
58526
|
-
function
|
|
58861
|
+
function applyEditableTextRewrite(runtime, target, input) {
|
|
58862
|
+
const before = runtime.getCanonicalDocument();
|
|
58863
|
+
runtime.dispatch({
|
|
58864
|
+
type: "selection.set",
|
|
58865
|
+
selection: target.selection,
|
|
58866
|
+
origin: actionOrigin(runtime, input)
|
|
58867
|
+
});
|
|
58868
|
+
runtime.applyActiveStoryTextCommand({
|
|
58869
|
+
type: "text.insert",
|
|
58870
|
+
text: input.text,
|
|
58871
|
+
editableTarget: target.editableTarget,
|
|
58872
|
+
origin: actionOrigin(runtime, input)
|
|
58873
|
+
});
|
|
58874
|
+
const changed = runtime.getCanonicalDocument() !== before;
|
|
58875
|
+
if (!changed) {
|
|
58876
|
+
return blockedApply(
|
|
58877
|
+
`actions:editable-text:runtime-noop:${target.actionHandle}`,
|
|
58878
|
+
"blocked",
|
|
58879
|
+
"The editable text command was accepted but produced no document change.",
|
|
58880
|
+
"Refresh the action handle with ai.actions.locateAll and retry; route persistent failures to L07 text command support.",
|
|
58881
|
+
[
|
|
58882
|
+
blockerWithOwner(
|
|
58883
|
+
`actions:editable-text:runtime-noop:${target.actionHandle}`,
|
|
58884
|
+
"blocked",
|
|
58885
|
+
"The editable text command was accepted but produced no document change.",
|
|
58886
|
+
"Refresh the action handle with ai.actions.locateAll and retry; route persistent failures to L07 text command support.",
|
|
58887
|
+
"L07 runtime text command support"
|
|
58888
|
+
)
|
|
58889
|
+
]
|
|
58890
|
+
);
|
|
58891
|
+
}
|
|
58892
|
+
const afterTarget = findEditableTextActionByTargetKey(
|
|
58893
|
+
runtime,
|
|
58894
|
+
target.editableTarget.targetKey
|
|
58895
|
+
);
|
|
58896
|
+
const afterReadback = afterTarget?.readback ?? editableTextTargetState(
|
|
58897
|
+
runtime.getCanonicalDocument(),
|
|
58898
|
+
target.editableTarget
|
|
58899
|
+
)?.readback;
|
|
58900
|
+
if (!afterReadback || afterReadback.text !== input.text) {
|
|
58901
|
+
return {
|
|
58902
|
+
status: "blocked",
|
|
58903
|
+
applied: false,
|
|
58904
|
+
changed: true,
|
|
58905
|
+
target: summarizeTarget(afterTarget ?? target),
|
|
58906
|
+
posture: "suspect-readback",
|
|
58907
|
+
blockers: Object.freeze([`actions:editable-text:readback-mismatch:${target.actionHandle}`]),
|
|
58908
|
+
blockerDetails: Object.freeze([
|
|
58909
|
+
blocker(
|
|
58910
|
+
`actions:editable-text:readback-mismatch:${target.actionHandle}`,
|
|
58911
|
+
"blocked",
|
|
58912
|
+
"The editable text command changed the document, but exact target readback did not match the proposed text.",
|
|
58913
|
+
"Treat the mutation as suspect. Re-read the target and export before claiming success."
|
|
58914
|
+
)
|
|
58915
|
+
]),
|
|
58916
|
+
...afterReadback ? { afterReadback } : {}
|
|
58917
|
+
};
|
|
58918
|
+
}
|
|
58919
|
+
return {
|
|
58920
|
+
status: "applied",
|
|
58921
|
+
applied: true,
|
|
58922
|
+
changed: true,
|
|
58923
|
+
target: summarizeTarget(afterTarget ?? { ...target, readback: afterReadback }),
|
|
58924
|
+
commandReference: {
|
|
58925
|
+
command: "text.insert",
|
|
58926
|
+
actorId: input.actorId ?? "v3-ai-api",
|
|
58927
|
+
origin: input.origin ?? "agent",
|
|
58928
|
+
emittedAtUtc: currentAuditTimestamp(runtime)
|
|
58929
|
+
},
|
|
58930
|
+
afterReadback
|
|
58931
|
+
};
|
|
58932
|
+
}
|
|
58933
|
+
function projectRewriteScopeResult(runtime, result, target, beforeText, proposedText, documentMutated) {
|
|
58527
58934
|
if (!result.applied) return projectApplyResult(result, target);
|
|
58528
58935
|
const compiledAfter = createScopeCompilerService(runtime).compileScopeById(
|
|
58529
58936
|
target.handle.scopeId
|
|
@@ -58534,7 +58941,8 @@ function projectRewriteScopeResult(runtime, result, target, beforeText, proposed
|
|
|
58534
58941
|
target,
|
|
58535
58942
|
`actions:rewrite:authoritative-readback-unresolvable:${target.handle.scopeId}`,
|
|
58536
58943
|
"The replacement primitive reported success, but the target scope could not be re-read afterwards.",
|
|
58537
|
-
"Treat the mutation as untrusted. Re-locate the target and retry only after the scope resolves, or create an issue flag instead."
|
|
58944
|
+
"Treat the mutation as untrusted. Re-locate the target and retry only after the scope resolves, or create an issue flag instead.",
|
|
58945
|
+
documentMutated
|
|
58538
58946
|
);
|
|
58539
58947
|
}
|
|
58540
58948
|
const afterText = compiledAfter.scope.content.text;
|
|
@@ -58546,7 +58954,8 @@ function projectRewriteScopeResult(runtime, result, target, beforeText, proposed
|
|
|
58546
58954
|
{ ...target, scope: compiledAfter.scope, handle: compiledAfter.scope.handle },
|
|
58547
58955
|
`actions:rewrite:authoritative-readback-unchanged:${target.handle.scopeId}`,
|
|
58548
58956
|
"The replacement primitive reported success, but authoritative scope readback showed unchanged text.",
|
|
58549
|
-
"Treat the mutation as not applied. Retry with a narrower scope or create an issue flag; do not claim the replacement succeeded."
|
|
58957
|
+
"Treat the mutation as not applied. Retry with a narrower scope or create an issue flag; do not claim the replacement succeeded.",
|
|
58958
|
+
documentMutated
|
|
58550
58959
|
);
|
|
58551
58960
|
}
|
|
58552
58961
|
if (!expectedPresent) {
|
|
@@ -58555,7 +58964,8 @@ function projectRewriteScopeResult(runtime, result, target, beforeText, proposed
|
|
|
58555
58964
|
{ ...target, scope: compiledAfter.scope, handle: compiledAfter.scope.handle },
|
|
58556
58965
|
`actions:rewrite:authoritative-readback-mismatch:${target.handle.scopeId}`,
|
|
58557
58966
|
"The replacement primitive reported success, but authoritative scope readback did not contain the proposed text.",
|
|
58558
|
-
"Treat the mutation as suspect. Re-read the target, inspect the exported package when available, and retry only with a verified target."
|
|
58967
|
+
"Treat the mutation as suspect. Re-read the target, inspect the exported package when available, and retry only with a verified target.",
|
|
58968
|
+
documentMutated
|
|
58559
58969
|
);
|
|
58560
58970
|
}
|
|
58561
58971
|
return {
|
|
@@ -58572,17 +58982,27 @@ function projectRewriteScopeResult(runtime, result, target, beforeText, proposed
|
|
|
58572
58982
|
...result.auditReference ? { auditReference: result.auditReference } : {}
|
|
58573
58983
|
};
|
|
58574
58984
|
}
|
|
58575
|
-
function blockedRewriteReadback(result, target, code, message, nextStep) {
|
|
58985
|
+
function blockedRewriteReadback(result, target, code, message, nextStep, documentMutated = false) {
|
|
58576
58986
|
const detail = blocker(code, "blocked", message, nextStep);
|
|
58987
|
+
const details = documentMutated ? [
|
|
58988
|
+
detail,
|
|
58989
|
+
blockerWithOwner(
|
|
58990
|
+
`actions:rewrite:suspect-mutation:${target.handle.scopeId}`,
|
|
58991
|
+
"blocked",
|
|
58992
|
+
"The document changed even though authoritative target readback failed.",
|
|
58993
|
+
"Abort the plan, inspect the export/readback evidence, and route the target to L08/L07 scope edit-target mapping before retrying.",
|
|
58994
|
+
"L08 semantic scopes and L07 runtime text commands"
|
|
58995
|
+
)
|
|
58996
|
+
] : [detail];
|
|
58577
58997
|
return {
|
|
58578
58998
|
status: "blocked",
|
|
58579
58999
|
applied: false,
|
|
58580
|
-
changed:
|
|
59000
|
+
changed: documentMutated,
|
|
58581
59001
|
target: summarizeTarget(target),
|
|
58582
59002
|
proposalId: result.proposalId,
|
|
58583
|
-
posture: "suspect-readback",
|
|
58584
|
-
blockers: Object.freeze(
|
|
58585
|
-
blockerDetails: Object.freeze(
|
|
59003
|
+
posture: documentMutated ? "suspect-mutation" : "suspect-readback",
|
|
59004
|
+
blockers: Object.freeze(details.map((entry) => entry.code)),
|
|
59005
|
+
blockerDetails: Object.freeze(details),
|
|
58586
59006
|
...result.auditReference ? { auditReference: result.auditReference } : {}
|
|
58587
59007
|
};
|
|
58588
59008
|
}
|
|
@@ -58598,11 +59018,23 @@ function summarizeTarget(target) {
|
|
|
58598
59018
|
canMark: false
|
|
58599
59019
|
};
|
|
58600
59020
|
}
|
|
59021
|
+
if (target.kind === "editable-text") {
|
|
59022
|
+
return {
|
|
59023
|
+
kind: target.targetKind,
|
|
59024
|
+
handle: target.ownerHandle,
|
|
59025
|
+
actionHandle: target.actionHandle,
|
|
59026
|
+
readback: target.readback,
|
|
59027
|
+
canRewriteText: true,
|
|
59028
|
+
canInsertAdjacentText: false,
|
|
59029
|
+
canFlag: false,
|
|
59030
|
+
canMark: false
|
|
59031
|
+
};
|
|
59032
|
+
}
|
|
58601
59033
|
return {
|
|
58602
59034
|
kind: target.scope.kind,
|
|
58603
59035
|
handle: target.handle,
|
|
58604
59036
|
canRewriteText: canRewriteScopeText(target.scope),
|
|
58605
|
-
canInsertAdjacentText:
|
|
59037
|
+
canInsertAdjacentText: canInsertAdjacentScopeText(target.scope),
|
|
58606
59038
|
canFlag: true,
|
|
58607
59039
|
canMark: canMarkScope(target.scope)
|
|
58608
59040
|
};
|
|
@@ -58614,6 +59046,34 @@ function tableTextActionsForScope(runtime, handle) {
|
|
|
58614
59046
|
});
|
|
58615
59047
|
return result.actions.filter((action) => action.family === "table-text");
|
|
58616
59048
|
}
|
|
59049
|
+
function editableTextActionsForScope(runtime, handle) {
|
|
59050
|
+
const bundle = createScopeCompilerService(runtime).compileBundleById(
|
|
59051
|
+
handle.scopeId,
|
|
59052
|
+
currentAuditTimestamp(runtime)
|
|
59053
|
+
);
|
|
59054
|
+
const entries = bundle?.evidence.editableTargets?.entries ?? [];
|
|
59055
|
+
const currentTargets = collectEditableTargetRefs(runtime.getCanonicalDocument());
|
|
59056
|
+
const actions2 = [];
|
|
59057
|
+
for (const entry of entries) {
|
|
59058
|
+
if (entry.kind !== "hyperlink-text" || entry.commandFamily !== "text-leaf" || entry.runtimeCommand.status !== "supported" || !entry.runtimeCommand.actionHandle) {
|
|
59059
|
+
continue;
|
|
59060
|
+
}
|
|
59061
|
+
const currentTarget = currentTargets.find((target) => target.targetKey === entry.targetKey);
|
|
59062
|
+
if (!currentTarget || currentTarget.kind !== "hyperlink-text") continue;
|
|
59063
|
+
const targetState = editableTextTargetState(runtime.getCanonicalDocument(), currentTarget);
|
|
59064
|
+
if (!targetState) continue;
|
|
59065
|
+
actions2.push({
|
|
59066
|
+
kind: "editable-text",
|
|
59067
|
+
targetKind: "hyperlink-text",
|
|
59068
|
+
actionHandle: entry.runtimeCommand.actionHandle,
|
|
59069
|
+
editableTarget: currentTarget,
|
|
59070
|
+
ownerHandle: handle,
|
|
59071
|
+
readback: targetState.readback,
|
|
59072
|
+
selection: targetState.selection
|
|
59073
|
+
});
|
|
59074
|
+
}
|
|
59075
|
+
return Object.freeze(actions2);
|
|
59076
|
+
}
|
|
58617
59077
|
function findTableAction(runtime, actionHandle) {
|
|
58618
59078
|
const action = findAnyTableAction(runtime, actionHandle);
|
|
58619
59079
|
return action?.family === "table-text" ? action : null;
|
|
@@ -58633,6 +59093,27 @@ function findAnyTableAction(runtime, actionHandle) {
|
|
|
58633
59093
|
}
|
|
58634
59094
|
return null;
|
|
58635
59095
|
}
|
|
59096
|
+
function findEditableTextAction(runtime, actionHandle) {
|
|
59097
|
+
if (!actionHandle.startsWith("scope-command:text-leaf:")) return null;
|
|
59098
|
+
const compiler = createScopeCompilerService(runtime);
|
|
59099
|
+
for (const scope of compiler.compileAllScopes()) {
|
|
59100
|
+
const action = editableTextActionsForScope(runtime, scope.handle).find(
|
|
59101
|
+
(candidate) => candidate.actionHandle === actionHandle
|
|
59102
|
+
);
|
|
59103
|
+
if (action) return action;
|
|
59104
|
+
}
|
|
59105
|
+
return null;
|
|
59106
|
+
}
|
|
59107
|
+
function findEditableTextActionByTargetKey(runtime, targetKey) {
|
|
59108
|
+
const compiler = createScopeCompilerService(runtime);
|
|
59109
|
+
for (const scope of compiler.compileAllScopes()) {
|
|
59110
|
+
const action = editableTextActionsForScope(runtime, scope.handle).find(
|
|
59111
|
+
(candidate) => candidate.editableTarget.targetKey === targetKey
|
|
59112
|
+
);
|
|
59113
|
+
if (action) return action;
|
|
59114
|
+
}
|
|
59115
|
+
return null;
|
|
59116
|
+
}
|
|
58636
59117
|
function readDocumentPlanTarget(runtime) {
|
|
58637
59118
|
const document2 = createInspectFamily(runtime).inspectDocument();
|
|
58638
59119
|
return {
|
|
@@ -58689,6 +59170,18 @@ function readPlanTarget(runtime, target) {
|
|
|
58689
59170
|
])
|
|
58690
59171
|
};
|
|
58691
59172
|
}
|
|
59173
|
+
const editableText = findEditableTextAction(runtime, target.actionHandle);
|
|
59174
|
+
if (editableText) {
|
|
59175
|
+
return {
|
|
59176
|
+
ok: true,
|
|
59177
|
+
target: summarizeTarget(editableText),
|
|
59178
|
+
readback: {
|
|
59179
|
+
text: editableText.readback.text,
|
|
59180
|
+
excerpt: excerpt(editableText.readback.text),
|
|
59181
|
+
isEmpty: editableText.readback.isEmpty
|
|
59182
|
+
}
|
|
59183
|
+
};
|
|
59184
|
+
}
|
|
58692
59185
|
return readPlanTableAction(runtime, target.actionHandle);
|
|
58693
59186
|
}
|
|
58694
59187
|
function readPlanTableAction(runtime, actionHandle) {
|
|
@@ -58751,6 +59244,15 @@ function checkPlanStepCapability(runtime, step, before) {
|
|
|
58751
59244
|
"Regenerate the plan with a ScopeHandle or opaque actionHandle returned by L09."
|
|
58752
59245
|
);
|
|
58753
59246
|
}
|
|
59247
|
+
if (step.kind === "rewrite" && target.kind === "list-item") {
|
|
59248
|
+
return blockerWithOwner(
|
|
59249
|
+
"capability:list-item:authoritative-readback-required",
|
|
59250
|
+
"blocked",
|
|
59251
|
+
"List-item text replacement is not yet backed by an authoritative mutation/readback route.",
|
|
59252
|
+
"Use listOperation for numbering changes, or create an issue/explanation until L08/L07 list-item text replacement is proven.",
|
|
59253
|
+
"L08 semantic scopes and L07 runtime text commands"
|
|
59254
|
+
);
|
|
59255
|
+
}
|
|
58754
59256
|
if (step.kind === "rewrite" && !target.canRewriteText) {
|
|
58755
59257
|
return blocker(
|
|
58756
59258
|
`actions:plan:target-not-rewriteable:${step.id}`,
|
|
@@ -58783,7 +59285,20 @@ function checkPlanStepCapability(runtime, step, before) {
|
|
|
58783
59285
|
"Use a supported semantic scope or create an issue flag instead."
|
|
58784
59286
|
);
|
|
58785
59287
|
}
|
|
58786
|
-
if (step.kind === "fieldRefresh" || step.kind === "tocRefresh" || step.kind === "bookmarkEdit" || step.kind === "hyperlinkDestinationEdit") {
|
|
59288
|
+
if (step.kind === "fieldRefresh" || step.kind === "tocRefresh" || step.kind === "bookmarkEdit" || step.kind === "hyperlinkDestinationEdit" || step.kind === "hyperlinkTextEdit") {
|
|
59289
|
+
if (step.kind === "hyperlinkTextEdit") {
|
|
59290
|
+
const resolved2 = resolveTarget(runtime, step.target);
|
|
59291
|
+
if (!resolved2.ok) return resolved2.blockerDetails[0] ?? null;
|
|
59292
|
+
if (resolved2.target.kind !== "editable-text" || resolved2.target.targetKind !== "hyperlink-text") {
|
|
59293
|
+
return blocker(
|
|
59294
|
+
`actions:hyperlink-text-edit:hyperlink-text-handle-required:${step.id}`,
|
|
59295
|
+
"unsupported",
|
|
59296
|
+
"Hyperlink display text plan steps require an exact hyperlink-text actionHandle.",
|
|
59297
|
+
"Regenerate the plan with a scope-command:text-leaf actionHandle returned by ai.actions.locateAll."
|
|
59298
|
+
);
|
|
59299
|
+
}
|
|
59300
|
+
return null;
|
|
59301
|
+
}
|
|
58787
59302
|
const resolved = resolveScopeExactTarget(runtime, step.target, step.kind);
|
|
58788
59303
|
if (!resolved.ok) return resolved.blockerDetails[0] ?? null;
|
|
58789
59304
|
const targetRef = resolveModeledEditableTarget(runtime, resolved.target, step.kind);
|
|
@@ -58888,6 +59403,13 @@ function applyPlanStep(runtime, step, plan) {
|
|
|
58888
59403
|
actorId: step.actorId ?? plan.actorId,
|
|
58889
59404
|
origin: step.origin ?? plan.origin
|
|
58890
59405
|
});
|
|
59406
|
+
case "hyperlinkTextEdit":
|
|
59407
|
+
return createActionsFamily(runtime).actions.hyperlinkTextEdit({
|
|
59408
|
+
target: step.target,
|
|
59409
|
+
text: step.text,
|
|
59410
|
+
actorId: step.actorId ?? plan.actorId,
|
|
59411
|
+
origin: step.origin ?? plan.origin
|
|
59412
|
+
});
|
|
58891
59413
|
case "listOperation":
|
|
58892
59414
|
return createActionsFamily(runtime).actions.listOperation({
|
|
58893
59415
|
target: step.target,
|
|
@@ -59204,11 +59726,159 @@ function isTableFamilyScope(kind) {
|
|
|
59204
59726
|
return kind === "table" || kind === "table-row" || kind === "table-cell";
|
|
59205
59727
|
}
|
|
59206
59728
|
function canRewriteScopeText(scope) {
|
|
59729
|
+
return !isTableFamilyScope(scope.kind) && scope.kind !== "list-item" && (scope.replaceability.level === "full" || scope.replaceability.level === "text-only");
|
|
59730
|
+
}
|
|
59731
|
+
function canInsertAdjacentScopeText(scope) {
|
|
59207
59732
|
return !isTableFamilyScope(scope.kind) && (scope.replaceability.level === "full" || scope.replaceability.level === "text-only");
|
|
59208
59733
|
}
|
|
59734
|
+
function scopeRewriteCapabilityBlocker(scope) {
|
|
59735
|
+
if (scope.kind === "list-item") {
|
|
59736
|
+
return blockerWithOwner(
|
|
59737
|
+
"capability:list-item:authoritative-readback-required",
|
|
59738
|
+
"blocked",
|
|
59739
|
+
"List-item text replacement is not yet backed by an authoritative mutation/readback route.",
|
|
59740
|
+
"Use listOperation for numbering changes, or create an issue/explanation until L08/L07 list-item text replacement is proven.",
|
|
59741
|
+
"L08 semantic scopes and L07 runtime text commands"
|
|
59742
|
+
);
|
|
59743
|
+
}
|
|
59744
|
+
if (!canRewriteScopeText(scope)) {
|
|
59745
|
+
return blocker(
|
|
59746
|
+
`actions:rewrite:target-not-rewriteable:${scope.handle.scopeId}`,
|
|
59747
|
+
"unsupported",
|
|
59748
|
+
"The target capability posture does not allow text rewrite.",
|
|
59749
|
+
"Use a supported text target, table text actionHandle, or create an issue flag instead."
|
|
59750
|
+
);
|
|
59751
|
+
}
|
|
59752
|
+
return null;
|
|
59753
|
+
}
|
|
59209
59754
|
function canMarkScope(scope) {
|
|
59210
59755
|
return !isTableFamilyScope(scope.kind) && scope.replaceability.level !== "blocked" && scope.replaceability.level !== "preserve-only";
|
|
59211
59756
|
}
|
|
59757
|
+
function editableTextTargetState(document2, target) {
|
|
59758
|
+
if (target.kind !== "hyperlink-text") return void 0;
|
|
59759
|
+
const resolved = resolveHyperlinkTarget(document2, target);
|
|
59760
|
+
if (!resolved) return void 0;
|
|
59761
|
+
const text = collectInlineText2(resolved.hyperlink.children);
|
|
59762
|
+
return {
|
|
59763
|
+
readback: { text, isEmpty: text.length === 0 },
|
|
59764
|
+
selection: {
|
|
59765
|
+
anchor: resolved.from,
|
|
59766
|
+
head: resolved.to,
|
|
59767
|
+
isCollapsed: resolved.from === resolved.to,
|
|
59768
|
+
activeRange: {
|
|
59769
|
+
kind: "range",
|
|
59770
|
+
from: resolved.from,
|
|
59771
|
+
to: resolved.to,
|
|
59772
|
+
assoc: { start: -1, end: 1 }
|
|
59773
|
+
}
|
|
59774
|
+
}
|
|
59775
|
+
};
|
|
59776
|
+
}
|
|
59777
|
+
function resolveHyperlinkTarget(document2, target) {
|
|
59778
|
+
const parsed = parseBlockInlinePath(target.blockPath);
|
|
59779
|
+
if (!parsed) return null;
|
|
59780
|
+
let blocks = document2.content.children;
|
|
59781
|
+
let block;
|
|
59782
|
+
let row;
|
|
59783
|
+
let offset = 0;
|
|
59784
|
+
for (const token of parsed) {
|
|
59785
|
+
switch (token.kind) {
|
|
59786
|
+
case "block":
|
|
59787
|
+
for (let index = 0; index < token.index; index += 1) {
|
|
59788
|
+
offset += blockTextLength(blocks[index]);
|
|
59789
|
+
}
|
|
59790
|
+
block = blocks[token.index];
|
|
59791
|
+
row = void 0;
|
|
59792
|
+
if (!block) return null;
|
|
59793
|
+
break;
|
|
59794
|
+
case "row":
|
|
59795
|
+
if (block?.type !== "table") return null;
|
|
59796
|
+
row = block.rows[token.index];
|
|
59797
|
+
block = void 0;
|
|
59798
|
+
if (!row) return null;
|
|
59799
|
+
break;
|
|
59800
|
+
case "cell": {
|
|
59801
|
+
const cell = row?.cells[token.index];
|
|
59802
|
+
if (!cell) return null;
|
|
59803
|
+
blocks = cell.children;
|
|
59804
|
+
block = void 0;
|
|
59805
|
+
row = void 0;
|
|
59806
|
+
break;
|
|
59807
|
+
}
|
|
59808
|
+
case "inline": {
|
|
59809
|
+
if (block?.type !== "paragraph") return null;
|
|
59810
|
+
for (let index = 0; index < token.index; index += 1) {
|
|
59811
|
+
offset += inlineTextLength(block.children[index]);
|
|
59812
|
+
}
|
|
59813
|
+
const inline = block.children[token.index];
|
|
59814
|
+
if (inline?.type !== "hyperlink") return null;
|
|
59815
|
+
const length = collectInlineText2(inline.children).length;
|
|
59816
|
+
return { hyperlink: inline, from: offset, to: offset + length };
|
|
59817
|
+
}
|
|
59818
|
+
}
|
|
59819
|
+
}
|
|
59820
|
+
return null;
|
|
59821
|
+
}
|
|
59822
|
+
function parseBlockInlinePath(path) {
|
|
59823
|
+
if (!path.startsWith("main/")) return null;
|
|
59824
|
+
const tokens = [];
|
|
59825
|
+
const re = /(block|row|cell|inline)\[(\d+)\]/gu;
|
|
59826
|
+
let match;
|
|
59827
|
+
while ((match = re.exec(path)) !== null) {
|
|
59828
|
+
const kind = match[1];
|
|
59829
|
+
tokens.push({ kind, index: Number(match[2]) });
|
|
59830
|
+
}
|
|
59831
|
+
return tokens.length > 0 ? Object.freeze(tokens) : null;
|
|
59832
|
+
}
|
|
59833
|
+
function collectInlineText2(inlines) {
|
|
59834
|
+
let text = "";
|
|
59835
|
+
for (const inline of inlines) {
|
|
59836
|
+
switch (inline.type) {
|
|
59837
|
+
case "text":
|
|
59838
|
+
text += inline.text;
|
|
59839
|
+
break;
|
|
59840
|
+
case "hyperlink":
|
|
59841
|
+
case "field":
|
|
59842
|
+
text += collectInlineText2(inline.children);
|
|
59843
|
+
break;
|
|
59844
|
+
default:
|
|
59845
|
+
break;
|
|
59846
|
+
}
|
|
59847
|
+
}
|
|
59848
|
+
return text;
|
|
59849
|
+
}
|
|
59850
|
+
function blockTextLength(block) {
|
|
59851
|
+
if (!block) return 0;
|
|
59852
|
+
switch (block.type) {
|
|
59853
|
+
case "paragraph":
|
|
59854
|
+
return collectInlineText2(block.children).length;
|
|
59855
|
+
case "table":
|
|
59856
|
+
return block.rows.reduce(
|
|
59857
|
+
(rowSum, row) => rowSum + row.cells.reduce(
|
|
59858
|
+
(cellSum, cell) => cellSum + cell.children.reduce((blockSum, child) => blockSum + blockTextLength(child), 0),
|
|
59859
|
+
0
|
|
59860
|
+
),
|
|
59861
|
+
0
|
|
59862
|
+
);
|
|
59863
|
+
case "sdt":
|
|
59864
|
+
case "custom_xml":
|
|
59865
|
+
return block.children.reduce((sum, child) => sum + blockTextLength(child), 0);
|
|
59866
|
+
default:
|
|
59867
|
+
return 0;
|
|
59868
|
+
}
|
|
59869
|
+
}
|
|
59870
|
+
function inlineTextLength(inline) {
|
|
59871
|
+
if (!inline) return 0;
|
|
59872
|
+
switch (inline.type) {
|
|
59873
|
+
case "text":
|
|
59874
|
+
return inline.text.length;
|
|
59875
|
+
case "hyperlink":
|
|
59876
|
+
case "field":
|
|
59877
|
+
return collectInlineText2(inline.children).length;
|
|
59878
|
+
default:
|
|
59879
|
+
return 0;
|
|
59880
|
+
}
|
|
59881
|
+
}
|
|
59212
59882
|
function textMatches(text, query, matchCase) {
|
|
59213
59883
|
if (matchCase) return text.includes(query);
|
|
59214
59884
|
return text.toLocaleLowerCase().includes(query.toLocaleLowerCase());
|
|
@@ -59267,6 +59937,30 @@ function blockedApplyFromResolution(resolution) {
|
|
|
59267
59937
|
blockerDetails: resolution.blockerDetails
|
|
59268
59938
|
};
|
|
59269
59939
|
}
|
|
59940
|
+
function withSuspectMutationApplyResult(result, stepOrScopeId, target) {
|
|
59941
|
+
const detail = blockerWithOwner(
|
|
59942
|
+
`actions:plan:suspect-mutation:${stepOrScopeId}`,
|
|
59943
|
+
"blocked",
|
|
59944
|
+
"The document changed even though the action did not return an applied result.",
|
|
59945
|
+
"Abort the remaining plan, inspect authoritative readback/export evidence, and route the target to the owning edit-target/readback layer before retrying.",
|
|
59946
|
+
"L08 semantic scopes and L07 runtime text commands"
|
|
59947
|
+
);
|
|
59948
|
+
return {
|
|
59949
|
+
...result,
|
|
59950
|
+
status: "blocked",
|
|
59951
|
+
applied: false,
|
|
59952
|
+
changed: true,
|
|
59953
|
+
...target ? { target } : {},
|
|
59954
|
+
posture: "suspect-mutation",
|
|
59955
|
+
blockers: Object.freeze([...result.blockers ?? [], detail.code]),
|
|
59956
|
+
blockerDetails: Object.freeze([...result.blockerDetails ?? [], detail])
|
|
59957
|
+
};
|
|
59958
|
+
}
|
|
59959
|
+
function isSuspectMutationStep(step) {
|
|
59960
|
+
return step.posture === "suspect-mutation" || (step.blockers ?? []).some(
|
|
59961
|
+
(code) => code.startsWith("actions:plan:suspect-mutation:") || code.startsWith("actions:rewrite:suspect-mutation:")
|
|
59962
|
+
);
|
|
59963
|
+
}
|
|
59270
59964
|
function blockedPlan(mode, code, category, message, nextStep) {
|
|
59271
59965
|
const detail = blocker(code, category, message, nextStep);
|
|
59272
59966
|
return {
|