@stll/folio-agents 0.16.1 → 0.16.3
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/compare.js +10 -1
- package/dist/execute.js +13 -2
- package/package.json +23 -4
package/dist/compare.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { compareDocxVersions as compareDocxVersions$1, generateRedlineDocx as generateRedlineDocx$1 } from "@stll/folio-core/server";
|
|
2
|
+
import { sliceText } from "@stll/folio-core/utils/sliceText";
|
|
2
3
|
//#region src/compare.ts
|
|
3
4
|
/** Compare two `.docx` buffers using folio-core's version comparison semantics. */
|
|
4
5
|
const compareDocxVersions = (base, revised, options = {}) => compareDocxVersions$1(base, revised, options);
|
|
@@ -8,7 +9,15 @@ const ELLIPSIS = "…";
|
|
|
8
9
|
const UNCHANGED_EDGE_CHARS = 30;
|
|
9
10
|
const truncateUnchangedRun = (text) => {
|
|
10
11
|
if (text.length <= 61) return text;
|
|
11
|
-
return `${
|
|
12
|
+
return `${sliceText({
|
|
13
|
+
text,
|
|
14
|
+
units: "codeUnits",
|
|
15
|
+
end: UNCHANGED_EDGE_CHARS
|
|
16
|
+
})}${ELLIPSIS}${sliceText({
|
|
17
|
+
text,
|
|
18
|
+
units: "codeUnits",
|
|
19
|
+
start: -30
|
|
20
|
+
})}`;
|
|
12
21
|
};
|
|
13
22
|
const renderSegment = (segment) => {
|
|
14
23
|
switch (segment.type) {
|
package/dist/execute.js
CHANGED
|
@@ -3,6 +3,7 @@ import { decodeCommentId, decodeMainStoryTextRangeHandle, decodeSectionHandle, d
|
|
|
3
3
|
import { explainTextTooLong, parseAddCommentInput, parseSuggestChangesInput, prepareFolioAgentDocumentOperationBatch } from "./parse.js";
|
|
4
4
|
import { FOLIO_AGENT_TOOL_NAMES } from "./types.js";
|
|
5
5
|
import { FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, createFolioAITextRangeHandle, getFolioDocumentOperationIssues, getFolioDocumentOutline, hashFolioAIBlockText, isFolioAIContentBlock, normalizeFolioAIBlockText, readFolioDocumentSection } from "@stll/folio-core/server";
|
|
6
|
+
import { sliceText } from "@stll/folio-core/utils/sliceText";
|
|
6
7
|
import { panic } from "better-result";
|
|
7
8
|
//#region src/execute.ts
|
|
8
9
|
const isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -202,7 +203,12 @@ const findTextMatches = (blocks, query, matchCase, wholeWord, getTargetPage, pag
|
|
|
202
203
|
blockTextHash,
|
|
203
204
|
range,
|
|
204
205
|
occurrenceInBlock: occurrence,
|
|
205
|
-
context:
|
|
206
|
+
context: sliceText({
|
|
207
|
+
text: block.text,
|
|
208
|
+
units: "codeUnits",
|
|
209
|
+
start: contextStart,
|
|
210
|
+
end: contextEnd
|
|
211
|
+
}),
|
|
206
212
|
...page !== void 0 && page !== null && { page }
|
|
207
213
|
});
|
|
208
214
|
}
|
|
@@ -229,7 +235,12 @@ const findStoryTextMatches = (text, story, query, matchCase, wholeWord) => {
|
|
|
229
235
|
startOffset: at,
|
|
230
236
|
endOffset: at + matchedText.length,
|
|
231
237
|
occurrenceInStory: totalMatches,
|
|
232
|
-
context:
|
|
238
|
+
context: sliceText({
|
|
239
|
+
text,
|
|
240
|
+
units: "codeUnits",
|
|
241
|
+
start: Math.max(0, at - CONTEXT_RADIUS),
|
|
242
|
+
end: Math.min(text.length, at + matchedText.length + CONTEXT_RADIUS)
|
|
243
|
+
})
|
|
233
244
|
});
|
|
234
245
|
totalMatches += 1;
|
|
235
246
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/folio-agents",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.3",
|
|
4
4
|
"description": "Framework-neutral LLM tool layer over folio's ai-edits engine: function-calling tools so an agent can read and mutate .docx documents through @stll/folio-core.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -36,11 +36,13 @@
|
|
|
36
36
|
"exports": {
|
|
37
37
|
".": {
|
|
38
38
|
"types": "./dist/index.d.ts",
|
|
39
|
-
"import": "./dist/index.js"
|
|
39
|
+
"import": "./dist/index.js",
|
|
40
|
+
"default": "./dist/index.js"
|
|
40
41
|
},
|
|
41
42
|
"./*": {
|
|
42
43
|
"types": "./dist/*.d.ts",
|
|
43
|
-
"import": "./dist/*.js"
|
|
44
|
+
"import": "./dist/*.js",
|
|
45
|
+
"default": "./dist/*.js"
|
|
44
46
|
}
|
|
45
47
|
},
|
|
46
48
|
"publishConfig": {
|
|
@@ -54,9 +56,26 @@
|
|
|
54
56
|
"test": "bun test src"
|
|
55
57
|
},
|
|
56
58
|
"dependencies": {
|
|
57
|
-
"@stll/folio-core": "^0.
|
|
59
|
+
"@stll/folio-core": "^0.62.0",
|
|
60
|
+
"@stll/utf8-boundaries": "0.1.0",
|
|
58
61
|
"better-result": "3.0.1"
|
|
59
62
|
},
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"prosemirror-commands": "^1.7.1",
|
|
65
|
+
"prosemirror-dropcursor": "^1.8.2",
|
|
66
|
+
"prosemirror-gapcursor": "^1.4.1",
|
|
67
|
+
"prosemirror-history": "^1.5.0",
|
|
68
|
+
"prosemirror-inputrules": "^1.5.0",
|
|
69
|
+
"prosemirror-keymap": "^1.2.3",
|
|
70
|
+
"prosemirror-model": "^1.25.9",
|
|
71
|
+
"prosemirror-state": "^1.4.4",
|
|
72
|
+
"prosemirror-tables": "^1.8.5",
|
|
73
|
+
"prosemirror-transform": "^1.12.0",
|
|
74
|
+
"prosemirror-view": "^1.42.6",
|
|
75
|
+
"y-prosemirror": "^1.3.7",
|
|
76
|
+
"y-protocols": "^1.0.6",
|
|
77
|
+
"yjs": "^13.6.31"
|
|
78
|
+
},
|
|
60
79
|
"main": "./dist/index.js",
|
|
61
80
|
"types": "./dist/index.d.ts"
|
|
62
81
|
}
|