@stll/folio-agents 0.13.9 → 0.14.1
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.
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { FolioAgentBridge } from "../bridge.js";
|
|
2
|
-
import { FolioAIEditApplyMode, FolioDocxReviewer } from "@stll/folio-core/server";
|
|
2
|
+
import { FolioAIEditApplyMode, FolioDocxReviewer, FolioRevisionStamp } from "@stll/folio-core/server";
|
|
3
3
|
//#region src/bridges/reviewer.d.ts
|
|
4
4
|
/** Options for {@link createReviewerBridge}. */
|
|
5
5
|
type CreateReviewerBridgeOptions = {
|
|
6
6
|
/** `"tracked-changes"` (default) produces ins/del redlines; `"direct"` edits in place. */
|
|
7
7
|
mode?: FolioAIEditApplyMode;
|
|
8
|
+
/**
|
|
9
|
+
* Fixed provenance for what this bridge authors: revisions and comments
|
|
10
|
+
* take its date and allocate ids from its seed, and replies take its date.
|
|
11
|
+
* For a bridge that applies one batch (a file transaction); a second batch
|
|
12
|
+
* would allocate from the same seed. Omit to use the wall clock.
|
|
13
|
+
*/
|
|
14
|
+
revisionStamp?: FolioRevisionStamp;
|
|
8
15
|
};
|
|
9
16
|
/**
|
|
10
17
|
* Build a {@link FolioAgentBridge} over a headless {@link FolioDocxReviewer}
|
package/dist/bridges/reviewer.js
CHANGED
|
@@ -26,13 +26,16 @@ const toAgentComment = (comment) => ({
|
|
|
26
26
|
*/
|
|
27
27
|
const createReviewerBridge = (reviewer, options = {}) => {
|
|
28
28
|
const mode = options.mode ?? "tracked-changes";
|
|
29
|
+
const { revisionStamp } = options;
|
|
30
|
+
const applyOptions = revisionStamp === void 0 ? {} : { revisionStamp };
|
|
31
|
+
const replyDate = revisionStamp === void 0 ? {} : { date: revisionStamp.date };
|
|
29
32
|
return registerDecodedCommentHandlers({
|
|
30
33
|
snapshot: () => reviewer.snapshot(),
|
|
31
34
|
documentOperationMode: mode,
|
|
32
35
|
applyDocumentOperations: (batch) => reviewer.applyDocumentOperations(batch.mode === void 0 ? {
|
|
33
36
|
...batch,
|
|
34
37
|
mode
|
|
35
|
-
} : batch),
|
|
38
|
+
} : batch, applyOptions),
|
|
36
39
|
undoDocumentOperations: (undoHandle) => reviewer.undoDocumentOperations(undoHandle),
|
|
37
40
|
getComments: () => reviewer.getComments().map(toAgentComment),
|
|
38
41
|
getChanges: () => reviewer.getChanges().map(toAgentChange),
|
|
@@ -40,14 +43,20 @@ const createReviewerBridge = (reviewer, options = {}) => {
|
|
|
40
43
|
readStory: (handle) => reviewer.readStory(handle),
|
|
41
44
|
replyToComment: (commentId, text) => {
|
|
42
45
|
const decoded = decodeCommentId(commentId);
|
|
43
|
-
return decoded !== null && reviewer.replyTo(decoded.numeric, {
|
|
46
|
+
return decoded !== null && reviewer.replyTo(decoded.numeric, {
|
|
47
|
+
text,
|
|
48
|
+
...replyDate
|
|
49
|
+
}) !== null;
|
|
44
50
|
},
|
|
45
51
|
resolveComment: (commentId, resolved) => {
|
|
46
52
|
const decoded = decodeCommentId(commentId);
|
|
47
53
|
return decoded !== null && reviewer.resolveComment(decoded.raw, { resolved });
|
|
48
54
|
}
|
|
49
55
|
}, {
|
|
50
|
-
replyToComment: ({ numeric }, text) => reviewer.replyTo(numeric, {
|
|
56
|
+
replyToComment: ({ numeric }, text) => reviewer.replyTo(numeric, {
|
|
57
|
+
text,
|
|
58
|
+
...replyDate
|
|
59
|
+
}) !== null,
|
|
51
60
|
resolveComment: ({ raw }, resolved) => reviewer.resolveComment(raw, { resolved })
|
|
52
61
|
});
|
|
53
62
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/folio-agents",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
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",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"test": "bun test src"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@stll/folio-core": "^0.
|
|
57
|
+
"@stll/folio-core": "^0.51.0",
|
|
58
58
|
"better-result": "3.0.1"
|
|
59
59
|
},
|
|
60
60
|
"main": "./dist/index.js",
|