@stll/folio-agents 0.16.5 → 0.16.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bridge.d.ts +0 -2
- package/dist/bridge.js +1 -2
- package/dist/bridges/editor-ref.d.ts +1 -3
- package/dist/bridges/editor-ref.js +1 -2
- package/dist/bridges/reviewer.d.ts +1 -3
- package/dist/bridges/reviewer.js +1 -2
- package/dist/bridges/shared.d.ts +1 -3
- package/dist/bridges/shared.js +1 -2
- package/dist/codecs.d.ts +0 -2
- package/dist/codecs.js +1 -2
- package/dist/compare.d.ts +1 -3
- package/dist/compare.js +1 -2
- package/dist/execute.d.ts +1 -3
- package/dist/execute.js +1 -2
- package/dist/operation-schema.d.ts +0 -2
- package/dist/operation-schema.js +1 -2
- package/dist/parse.d.ts +1 -3
- package/dist/parse.js +1 -2
- package/dist/providers.d.ts +1 -3
- package/dist/providers.js +1 -2
- package/dist/suggest-changes-options.d.ts +0 -2
- package/dist/suggest-changes-options.js +1 -2
- package/dist/tool-contract.d.ts +0 -2
- package/dist/tool-contract.js +1 -2
- package/dist/tools.d.ts +1 -3
- package/dist/tools.js +1 -2
- package/dist/types.d.ts +0 -2
- package/dist/types.js +1 -2
- package/package.json +6 -3
package/dist/bridge.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { FolioAgentCommentId } from "./codecs.js";
|
|
2
2
|
import { FolioAgentChange, FolioAgentComment } from "./types.js";
|
|
3
3
|
import { FolioAIEditSnapshot, FolioDocumentNavigationTarget, FolioDocumentOperationBatch, FolioDocumentOperationMode, FolioDocumentOperationResult, FolioDocumentOperationUndoHandle, FolioDocumentOperationUndoResult, FolioDocumentStory, FolioDocumentStoryHandle } from "@stll/folio-core/server";
|
|
4
|
-
//#region src/bridge.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* The structural contract every folio surface (headless reviewer, live
|
|
7
6
|
* editor) implements so the tool executor can drive either one identically.
|
|
@@ -73,5 +72,4 @@ export declare const registerDecodedCommentHandlers: (bridge: FolioAgentBridge,
|
|
|
73
72
|
export declare const getDecodedCommentHandlers: (bridge: FolioAgentBridge) => DecodedCommentHandlers | undefined;
|
|
74
73
|
export declare const registerOperationSession: (bridge: FolioAgentBridge, session: object) => FolioAgentBridge;
|
|
75
74
|
export declare const getOperationSession: (bridge: FolioAgentBridge) => object;
|
|
76
|
-
//#endregion
|
|
77
75
|
export {};
|
package/dist/bridge.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/bridge.ts
|
|
2
2
|
const decodedCommentHandlers = /* @__PURE__ */ new WeakMap();
|
|
3
3
|
const registerDecodedCommentHandlers = (bridge, handlers) => {
|
|
4
4
|
decodedCommentHandlers.set(bridge, handlers);
|
|
@@ -18,5 +18,4 @@ const registerOperationSession = (bridge, session) => {
|
|
|
18
18
|
return bridge;
|
|
19
19
|
};
|
|
20
20
|
const getOperationSession = (bridge) => operationSessions.get(bridge) ?? bridge;
|
|
21
|
-
//#endregion
|
|
22
21
|
export { getDecodedCommentHandlers, getOperationSession, registerDecodedCommentHandlers, registerOperationSession };
|
|
@@ -3,7 +3,6 @@ import { FolioAIEditApplyMode, FolioAIEditApplyResult, FolioAIEditOperation, Fol
|
|
|
3
3
|
import { FolioUndefinedReferencePolicy } from "@stll/folio-core/ai-edits/apply";
|
|
4
4
|
import { FolioCommentAnchor } from "@stll/folio-core/ai-edits/read";
|
|
5
5
|
import { Comment } from "@stll/folio-core/types/content";
|
|
6
|
-
//#region src/bridges/editor-ref.d.ts
|
|
7
6
|
export type FolioAgentEditorApplyDocumentOperationsOptions = {
|
|
8
7
|
undefinedReferences: FolioUndefinedReferencePolicy;
|
|
9
8
|
snapshot: FolioAIEditSnapshot;
|
|
@@ -112,5 +111,4 @@ export type CreateEditorRefBridgeOptions = {
|
|
|
112
111
|
* - Page-scoped search and `show_in_document` report an unsupported-capability
|
|
113
112
|
* error when `ref.getTargetPage` / `ref.showInDocument` are absent.
|
|
114
113
|
*/
|
|
115
|
-
export declare const createEditorRefBridge: (options: CreateEditorRefBridgeOptions) => FolioAgentBridge;
|
|
116
|
-
//#endregion
|
|
114
|
+
export declare const createEditorRefBridge: (options: CreateEditorRefBridgeOptions) => FolioAgentBridge;
|
|
@@ -3,7 +3,7 @@ import { decodeCommentId } from "../codecs.js";
|
|
|
3
3
|
import { toAgentChange } from "./shared.js";
|
|
4
4
|
import { FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, assertSupportedFolioDocumentOperationVersion, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts } from "@stll/folio-core/server";
|
|
5
5
|
import { createReply } from "@stll/folio-core/docx/replyToComment";
|
|
6
|
-
|
|
6
|
+
// src/bridges/editor-ref.ts
|
|
7
7
|
const toAgentCommentReply = (reply) => ({
|
|
8
8
|
id: String(reply.id),
|
|
9
9
|
author: reply.author,
|
|
@@ -205,5 +205,4 @@ const createEditorRefBridge = (options) => {
|
|
|
205
205
|
resolveComment: ({ numeric }, resolved) => resolveDecodedComment(numeric, resolved)
|
|
206
206
|
});
|
|
207
207
|
};
|
|
208
|
-
//#endregion
|
|
209
208
|
export { createEditorRefBridge };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FolioAgentBridge } from "../bridge.js";
|
|
2
2
|
import { FolioAIEditApplyMode, FolioDocxReviewer, FolioRevisionStamp } from "@stll/folio-core/server";
|
|
3
|
-
//#region src/bridges/reviewer.d.ts
|
|
4
3
|
/** Options for {@link createReviewerBridge}. */
|
|
5
4
|
export type CreateReviewerBridgeOptions = {
|
|
6
5
|
/** `"tracked-changes"` (default) produces ins/del redlines; `"direct"` edits in place. */
|
|
@@ -21,5 +20,4 @@ export type CreateReviewerBridgeOptions = {
|
|
|
21
20
|
* unsupported-capability error via {@link executeFolioToolCall} on this
|
|
22
21
|
* bridge.
|
|
23
22
|
*/
|
|
24
|
-
export declare const createReviewerBridge: (reviewer: FolioDocxReviewer, options?: CreateReviewerBridgeOptions) => FolioAgentBridge;
|
|
25
|
-
//#endregion
|
|
23
|
+
export declare const createReviewerBridge: (reviewer: FolioDocxReviewer, options?: CreateReviewerBridgeOptions) => FolioAgentBridge;
|
package/dist/bridges/reviewer.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { registerDecodedCommentHandlers, registerOperationSession } from "../bridge.js";
|
|
2
2
|
import { decodeCommentId } from "../codecs.js";
|
|
3
3
|
import { toAgentChange } from "./shared.js";
|
|
4
|
-
|
|
4
|
+
// src/bridges/reviewer.ts
|
|
5
5
|
const toAgentCommentReply = (reply) => ({
|
|
6
6
|
id: String(reply.id),
|
|
7
7
|
author: reply.author,
|
|
@@ -65,5 +65,4 @@ const createReviewerBridge = (reviewer, options = {}) => {
|
|
|
65
65
|
resolveComment: ({ raw }, resolved) => reviewer.resolveComment(raw, { resolved })
|
|
66
66
|
});
|
|
67
67
|
};
|
|
68
|
-
//#endregion
|
|
69
68
|
export { createReviewerBridge };
|
package/dist/bridges/shared.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FolioAgentChange } from "../types.js";
|
|
2
2
|
import { FolioReviewChange } from "@stll/folio-core/server";
|
|
3
|
-
//#region src/bridges/shared.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Map a core {@link FolioReviewChange} — from `FolioDocxReviewer.getChanges`
|
|
6
5
|
* (headless bridge, `bridges/reviewer.ts`) or `DocxEditorRef.getTrackedChanges`
|
|
@@ -10,5 +9,4 @@ import { FolioReviewChange } from "@stll/folio-core/server";
|
|
|
10
9
|
* `@stll/folio-core/ai-edits`), so they share this one mapping instead of
|
|
11
10
|
* drifting into two subtly different shapes.
|
|
12
11
|
*/
|
|
13
|
-
export declare const toAgentChange: (change: FolioReviewChange) => FolioAgentChange;
|
|
14
|
-
//#endregion
|
|
12
|
+
export declare const toAgentChange: (change: FolioReviewChange) => FolioAgentChange;
|
package/dist/bridges/shared.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/bridges/shared.ts
|
|
2
2
|
/**
|
|
3
3
|
* Map a core {@link FolioReviewChange} — from `FolioDocxReviewer.getChanges`
|
|
4
4
|
* (headless bridge, `bridges/reviewer.ts`) or `DocxEditorRef.getTrackedChanges`
|
|
@@ -15,5 +15,4 @@ const toAgentChange = (change) => ({
|
|
|
15
15
|
text: change.text,
|
|
16
16
|
blockId: change.blockId
|
|
17
17
|
});
|
|
18
|
-
//#endregion
|
|
19
18
|
export { toAgentChange };
|
package/dist/codecs.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FOLIO_TEXT_RANGE_JSON_SCHEMA } from "./operation-schema.js";
|
|
2
2
|
import { FolioAITextRangeHandle, FolioDocumentSectionHandle, FolioDocumentStoryHandle } from "@stll/folio-core/server";
|
|
3
|
-
//#region src/codecs.d.ts
|
|
4
3
|
export declare const FOLIO_STORY_HANDLE_JSON_SCHEMA: {
|
|
5
4
|
readonly type: "object";
|
|
6
5
|
readonly properties: {
|
|
@@ -88,5 +87,4 @@ export declare const decodeSectionHandle: (value: unknown) => FolioDocumentSecti
|
|
|
88
87
|
export declare const decodeStoryHandle: (value: unknown) => FolioDocumentStoryHandle | null;
|
|
89
88
|
export declare const decodeMainStoryTextRangeHandle: (value: unknown) => FolioAITextRangeHandle | null;
|
|
90
89
|
export declare const decodeCommentId: (value: unknown) => FolioAgentCommentId | null;
|
|
91
|
-
//#endregion
|
|
92
90
|
export { FOLIO_TEXT_RANGE_JSON_SCHEMA };
|
package/dist/codecs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FOLIO_TEXT_RANGE_JSON_SCHEMA } from "./operation-schema.js";
|
|
2
|
-
|
|
2
|
+
// src/codecs.ts
|
|
3
3
|
const NORMALIZED_TEXT_HASH_PATTERN = /^h[0-9a-z]+$/;
|
|
4
4
|
const isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5
5
|
const isNonEmptyString = (value) => typeof value === "string" && value.length > 0;
|
|
@@ -146,5 +146,4 @@ const decodeCommentId = (value) => {
|
|
|
146
146
|
numeric
|
|
147
147
|
};
|
|
148
148
|
};
|
|
149
|
-
//#endregion
|
|
150
149
|
export { FOLIO_COMMENT_ID_JSON_SCHEMA, FOLIO_SCOPED_HANDLE_JSON_SCHEMA, FOLIO_SECTION_HANDLE_JSON_SCHEMA, FOLIO_STORY_HANDLE_JSON_SCHEMA, FOLIO_TEXT_RANGE_JSON_SCHEMA, decodeCommentId, decodeMainStoryTextRangeHandle, decodeSectionHandle, decodeStoryHandle };
|
package/dist/compare.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { FolioBlockDiff, FolioCompareDocxVersionsOptions, FolioVersionDiff, FolioVersionDiffSegment, GenerateRedlineDocxOptions, GenerateRedlineDocxResult } from "@stll/folio-core/server";
|
|
2
|
-
//#region src/compare.d.ts
|
|
3
2
|
/** Backward-compatible name for a core word-level version-diff segment. */
|
|
4
3
|
export type FolioAgentVersionDiffSegment = FolioVersionDiffSegment;
|
|
5
4
|
/** Backward-compatible name for a core block-level version diff. */
|
|
@@ -17,5 +16,4 @@ export declare const compareDocxVersions: (base: ArrayBuffer, revised: ArrayBuff
|
|
|
17
16
|
/** Generate a reviewed package from two `.docx` buffers. */
|
|
18
17
|
export declare const generateRedlineDocx: (base: ArrayBuffer, revised: ArrayBuffer, options?: FolioAgentGenerateRedlineDocxOptions) => Promise<FolioAgentGenerateRedlineDocxResult>;
|
|
19
18
|
/** Render a structured version diff as compact, deterministic model input. */
|
|
20
|
-
export declare const formatVersionDiffForLLM: (diff: FolioAgentVersionDiff) => string;
|
|
21
|
-
//#endregion
|
|
19
|
+
export declare const formatVersionDiffForLLM: (diff: FolioAgentVersionDiff) => string;
|
package/dist/compare.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { compareDocxVersions as compareDocxVersions$1, generateRedlineDocx as generateRedlineDocx$1 } from "@stll/folio-core/server";
|
|
2
2
|
import { sliceText } from "@stll/folio-core/utils/sliceText";
|
|
3
|
-
|
|
3
|
+
// src/compare.ts
|
|
4
4
|
/** Compare two `.docx` buffers using folio-core's version comparison semantics. */
|
|
5
5
|
const compareDocxVersions = (base, revised, options = {}) => compareDocxVersions$1(base, revised, options);
|
|
6
6
|
/** Generate a reviewed package from two `.docx` buffers. */
|
|
@@ -55,5 +55,4 @@ const formatVersionDiffForLLM = (diff) => {
|
|
|
55
55
|
...metadataLines
|
|
56
56
|
].join("\n");
|
|
57
57
|
};
|
|
58
|
-
//#endregion
|
|
59
58
|
export { compareDocxVersions, formatVersionDiffForLLM, generateRedlineDocx };
|
package/dist/execute.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { FolioAgentToolName, FolioToolCallResult } from "./types.js";
|
|
|
2
2
|
import { FolioAgentBridge } from "./bridge.js";
|
|
3
3
|
import { FolioAgentToolOptions } from "./suggest-changes-options.js";
|
|
4
4
|
import { FolioAgentToolInputByName, FolioToolCallResultFor } from "./tool-contract.js";
|
|
5
|
-
//#region src/execute.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* Execute one tool call against a {@link FolioAgentBridge}. Every EXPECTED
|
|
8
7
|
* failure — bad arguments, an unknown tool name, a capability the bridge does
|
|
@@ -16,5 +15,4 @@ import { FolioAgentToolInputByName, FolioToolCallResultFor } from "./tool-contra
|
|
|
16
15
|
* ref) is synchronous, so this stays synchronous too.
|
|
17
16
|
*/
|
|
18
17
|
export declare const executeFolioToolCallUntyped: (name: string, args: unknown, bridge: FolioAgentBridge, options?: FolioAgentToolOptions) => FolioToolCallResult;
|
|
19
|
-
export declare function executeFolioToolCall<TName extends FolioAgentToolName>(name: TName, args: FolioAgentToolInputByName[TName], bridge: FolioAgentBridge, options?: FolioAgentToolOptions): FolioToolCallResultFor<TName>;
|
|
20
|
-
//#endregion
|
|
18
|
+
export declare function executeFolioToolCall<TName extends FolioAgentToolName>(name: TName, args: FolioAgentToolInputByName[TName], bridge: FolioAgentBridge, options?: FolioAgentToolOptions): FolioToolCallResultFor<TName>;
|
package/dist/execute.js
CHANGED
|
@@ -5,7 +5,7 @@ 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
6
|
import { sliceText } from "@stll/folio-core/utils/sliceText";
|
|
7
7
|
import { panic } from "better-result";
|
|
8
|
-
|
|
8
|
+
// src/execute.ts
|
|
9
9
|
const isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
10
10
|
const isNonEmptyString = (value) => typeof value === "string" && value.length > 0;
|
|
11
11
|
const ok = (result) => ({
|
|
@@ -628,5 +628,4 @@ const TOOL_HANDLERS = {
|
|
|
628
628
|
[FOLIO_AGENT_TOOL_NAMES.showInDocument]: showInDocument
|
|
629
629
|
};
|
|
630
630
|
const isFolioAgentToolName = (name) => Object.hasOwn(TOOL_HANDLERS, name);
|
|
631
|
-
//#endregion
|
|
632
631
|
export { executeFolioToolCall, executeFolioToolCallUntyped };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FolioDocumentOperationBatch } from "@stll/folio-core/server";
|
|
2
2
|
import { LineSpacingRule, ParagraphAlignment } from "@stll/folio-core/types/document";
|
|
3
|
-
//#region src/operation-schema.d.ts
|
|
4
3
|
/** Compact public shape for the runtime JSON Schema projections. */
|
|
5
4
|
export type FolioJsonSchema = {
|
|
6
5
|
readonly type?: string;
|
|
@@ -460,5 +459,4 @@ type FolioDocumentOperationBatchSchema = StandardSchemaV1<unknown, FolioDocument
|
|
|
460
459
|
* as {@link FolioDocumentOperationBatchSchema.jsonSchema}.
|
|
461
460
|
*/
|
|
462
461
|
export declare const folioDocumentOperationBatchSchema: FolioDocumentOperationBatchSchema;
|
|
463
|
-
//#endregion
|
|
464
462
|
export {};
|
package/dist/operation-schema.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_LINE_SPACING_RULE_VALUES, FOLIO_PAGE_BREAK_CLEAR_VALUES, FOLIO_PARAGRAPH_ALIGNMENT_VALUES, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, parseFolioDocumentOperationBatch } from "@stll/folio-core/server";
|
|
2
|
-
|
|
2
|
+
// src/operation-schema.ts
|
|
3
3
|
/**
|
|
4
4
|
* Reusable projections of folio's versioned document-operation contract for
|
|
5
5
|
* tool builders: a JSON Schema for one operation, a JSON Schema for the
|
|
@@ -1108,5 +1108,4 @@ const folioDocumentOperationBatchSchema = {
|
|
|
1108
1108
|
},
|
|
1109
1109
|
jsonSchema: FOLIO_DOCUMENT_OPERATION_BATCH_JSON_SCHEMA
|
|
1110
1110
|
};
|
|
1111
|
-
//#endregion
|
|
1112
1111
|
export { FOLIO_BLOCK_PARAGRAPH_PROPERTIES_JSON_SCHEMA, FOLIO_CLEARABLE_OUTLINE_LEVEL_JSON_SCHEMA, FOLIO_CLEARABLE_PARAGRAPH_INDENTATION_JSON_SCHEMA, FOLIO_CLEARABLE_PARAGRAPH_SPACING_JSON_SCHEMA, FOLIO_CLEARABLE_PARAGRAPH_STYLE_ID_JSON_SCHEMA, FOLIO_DOCUMENT_OPERATION_BATCH_JSON_SCHEMA, FOLIO_DOCUMENT_OPERATION_JSON_SCHEMA, FOLIO_HARD_PAGE_BREAK_JSON_SCHEMA, FOLIO_HARD_PAGE_BREAK_OPERATION_CONSTRAINT, FOLIO_INSERT_FORMATTING_SCOPE_JSON_SCHEMA, FOLIO_PARAGRAPH_NUMBERING_JSON_SCHEMA, FOLIO_PRECONDITION_JSON_SCHEMA, FOLIO_TEXT_RANGE_JSON_SCHEMA, folioDocumentOperationBatchSchema };
|
package/dist/parse.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { FolioAgentInputNormalization } from "./types.js";
|
|
2
2
|
import { FolioSuggestChangesOptions } from "./suggest-changes-options.js";
|
|
3
3
|
import { FolioAIEditOperation, FolioDocumentOperationBatch, FolioDocumentOperationBatchPrecondition, FolioDocumentOperationMode } from "@stll/folio-core/server";
|
|
4
|
-
//#region src/parse.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Hard caps on `suggest_changes` / `add_comment` / `reply_comment` input
|
|
7
6
|
* size. Without these, a single tool call could ask the bridge to apply an
|
|
@@ -73,5 +72,4 @@ export type ParseSuggestChangesResult = {
|
|
|
73
72
|
* document. `options` must match the {@link FolioSuggestChangesOptions} the
|
|
74
73
|
* tool definition was built with.
|
|
75
74
|
*/
|
|
76
|
-
export declare const parseSuggestChangesInput: (args: unknown, options?: FolioSuggestChangesOptions) => ParseSuggestChangesResult;
|
|
77
|
-
//#endregion
|
|
75
|
+
export declare const parseSuggestChangesInput: (args: unknown, options?: FolioSuggestChangesOptions) => ParseSuggestChangesResult;
|
package/dist/parse.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolveSuggestChangesOptions } from "./suggest-changes-options.js";
|
|
2
2
|
import { FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_KEYS_BY_TYPE, InvalidFolioDocumentOperationBatchError, parseFolioDocumentOperationBatch } from "@stll/folio-core/server";
|
|
3
|
-
|
|
3
|
+
// src/parse.ts
|
|
4
4
|
/**
|
|
5
5
|
* Validation-only parsers for `suggest_changes` / `add_comment` tool-call
|
|
6
6
|
* arguments — the canonical rules `execute.ts` runs before handing operations
|
|
@@ -355,5 +355,4 @@ const parseSuggestChangesInput = (args, options) => {
|
|
|
355
355
|
};
|
|
356
356
|
}
|
|
357
357
|
};
|
|
358
|
-
//#endregion
|
|
359
358
|
export { MAX_OPERATION_TEXT_LENGTH, MAX_TOTAL_OPERATION_TEXT_LENGTH, explainTextTooLong, parseAddCommentInput, parseSuggestChangesInput, prepareFolioAgentDocumentOperationBatch };
|
package/dist/providers.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { FolioAgentToolDefinition } from "./types.js";
|
|
2
|
-
//#region src/providers.d.ts
|
|
3
2
|
/** Anthropic Messages API tool-definition shape (`input_schema`, snake_case). */
|
|
4
3
|
export type AnthropicToolDefinition = {
|
|
5
4
|
name: string;
|
|
@@ -18,5 +17,4 @@ export type OpenAIToolDefinition = {
|
|
|
18
17
|
};
|
|
19
18
|
};
|
|
20
19
|
/** Map folio's provider-neutral tool definitions onto OpenAI's function-tool shape. */
|
|
21
|
-
export declare const toOpenAITools: (definitions: FolioAgentToolDefinition[]) => OpenAIToolDefinition[];
|
|
22
|
-
//#endregion
|
|
20
|
+
export declare const toOpenAITools: (definitions: FolioAgentToolDefinition[]) => OpenAIToolDefinition[];
|
package/dist/providers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/providers.ts
|
|
2
2
|
/** Map folio's provider-neutral tool definitions onto Anthropic's tool shape. */
|
|
3
3
|
const toAnthropicTools = (definitions) => definitions.map((definition) => ({
|
|
4
4
|
name: definition.name,
|
|
@@ -14,5 +14,4 @@ const toOpenAITools = (definitions) => definitions.map((definition) => ({
|
|
|
14
14
|
parameters: definition.inputSchema
|
|
15
15
|
}
|
|
16
16
|
}));
|
|
17
|
-
//#endregion
|
|
18
17
|
export { toAnthropicTools, toOpenAITools };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FolioDocumentOperationType } from "@stll/folio-core/server";
|
|
2
2
|
import { TaggedErrorClass } from "better-result";
|
|
3
|
-
//#region src/suggest-changes-options.d.ts
|
|
4
3
|
declare const InvalidFolioSuggestChangesOptionsErrorBase: TaggedErrorClass<"InvalidFolioSuggestChangesOptionsError">;
|
|
5
4
|
/** Whether every operation must carry `severity` and `area`. */
|
|
6
5
|
export type FolioSuggestChangesReviewMetaPolicy = "optional" | "required";
|
|
@@ -57,5 +56,4 @@ export declare class InvalidFolioSuggestChangesOptionsError extends InvalidFolio
|
|
|
57
56
|
}> {}
|
|
58
57
|
/** Validate and default a host's options; throws {@link InvalidFolioSuggestChangesOptionsError} on misuse. */
|
|
59
58
|
export declare const resolveSuggestChangesOptions: (options?: FolioSuggestChangesOptions) => ResolvedFolioSuggestChangesOptions;
|
|
60
|
-
//#endregion
|
|
61
59
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FOLIO_DOCUMENT_OPERATION_TYPES } from "@stll/folio-core/server";
|
|
2
2
|
import { TaggedError } from "better-result";
|
|
3
|
-
|
|
3
|
+
// src/suggest-changes-options.ts
|
|
4
4
|
/**
|
|
5
5
|
* Host-facing configuration of the `suggest_changes` tool. One resolved
|
|
6
6
|
* options object drives the tool's JSON Schema (`tools.ts`), its parser
|
|
@@ -49,5 +49,4 @@ const resolveSuggestChangesOptions = (options = {}) => ({
|
|
|
49
49
|
maxOperations: resolveMaxOperations(options.maxOperations),
|
|
50
50
|
documentVersion: resolveDocumentVersion(options.documentVersion)
|
|
51
51
|
});
|
|
52
|
-
//#endregion
|
|
53
52
|
export { DEFAULT_MAX_OPERATIONS_PER_CALL, DEFAULT_SUGGEST_CHANGES_OPERATION_TYPES, InvalidFolioSuggestChangesOptionsError, MAX_OPERATIONS_PER_CALL_LIMIT, resolveSuggestChangesOptions };
|
package/dist/tool-contract.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FOLIO_AGENT_TOOL_NAMES, FolioAgentApplyOperationsSummary, FolioAgentBlock, FolioAgentChange, FolioAgentComment, FolioAgentCommentFilter, FolioAgentDocumentOutline, FolioAgentScopedFindTextResult, FolioAgentSectionRead, FolioAgentToolName, FolioAgentTypedToolDefinition, FolioToolCallResult } from "./types.js";
|
|
2
2
|
import { FolioAITextRangeHandle, FolioDocumentSectionHandle, FolioDocumentStory, FolioDocumentStoryHandle } from "@stll/folio-core/server";
|
|
3
|
-
//#region src/tool-contract.d.ts
|
|
4
3
|
type EmptyArgs = Readonly<Record<string, never>>;
|
|
5
4
|
export type FolioAgentFindTextScope = {
|
|
6
5
|
type: "document";
|
|
@@ -109,5 +108,4 @@ export type FolioAgentToolOutputByName = {
|
|
|
109
108
|
};
|
|
110
109
|
export type FolioToolCallResultFor<TName extends FolioAgentToolName> = FolioToolCallResult<FolioAgentToolOutputByName[TName]>;
|
|
111
110
|
export declare const defineFolioAgentToolDefinition: <TName extends FolioAgentToolName>(definition: FolioAgentTypedToolDefinition<TName, FolioAgentToolInputByName[TName], FolioAgentToolOutputByName[TName]>) => FolioAgentTypedToolDefinition<TName, FolioAgentToolInputByName[TName], FolioAgentToolOutputByName[TName]>;
|
|
112
|
-
//#endregion
|
|
113
111
|
export {};
|
package/dist/tool-contract.js
CHANGED
package/dist/tools.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { FolioAgentApplyOperationsSummary, FolioAgentBlock, FolioAgentChange, Fo
|
|
|
2
2
|
import { FolioAgentToolOptions, FolioSuggestChangesOptions } from "./suggest-changes-options.js";
|
|
3
3
|
import { FolioAgentFindTextScope, FolioAgentShowInDocumentArgs } from "./tool-contract.js";
|
|
4
4
|
import { FolioDocumentOperationType, FolioDocumentSectionHandle, FolioDocumentStory, FolioDocumentStoryHandle } from "@stll/folio-core/server";
|
|
5
|
-
//#region src/tools.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* `suggest_changes` is a host-configurable projection of the document-operation
|
|
8
7
|
* contract (see `FOLIO_DOCUMENT_OPERATION_JSON_SCHEMA` in `operation-schema.ts`):
|
|
@@ -108,5 +107,4 @@ export declare const FOLIO_AGENT_TOOLS: FolioAgentToolDefinition[];
|
|
|
108
107
|
* options to `executeFolioToolCall` so the parser enforces what the schema
|
|
109
108
|
* advertises.
|
|
110
109
|
*/
|
|
111
|
-
export declare const getFolioToolDefinitions: (options?: FolioAgentToolOptions) => FolioAgentToolDefinition[];
|
|
112
|
-
//#endregion
|
|
110
|
+
export declare const getFolioToolDefinitions: (options?: FolioAgentToolOptions) => FolioAgentToolDefinition[];
|
package/dist/tools.js
CHANGED
|
@@ -4,7 +4,7 @@ import { DEFAULT_SUGGEST_CHANGES_OPERATION_TYPES, resolveSuggestChangesOptions }
|
|
|
4
4
|
import { defineFolioAgentToolDefinition } from "./tool-contract.js";
|
|
5
5
|
import { FOLIO_AGENT_TOOL_NAMES } from "./types.js";
|
|
6
6
|
import { FOLIO_DOCUMENT_OPERATION_KEYS_BY_TYPE, FOLIO_PARAGRAPH_ALIGNMENT_VALUES } from "@stll/folio-core/server";
|
|
7
|
-
|
|
7
|
+
// src/tools.ts
|
|
8
8
|
/**
|
|
9
9
|
* `suggest_changes` is a host-configurable projection of the document-operation
|
|
10
10
|
* contract (see `FOLIO_DOCUMENT_OPERATION_JSON_SCHEMA` in `operation-schema.ts`):
|
|
@@ -576,5 +576,4 @@ const getFolioToolDefinitions = (options = {}) => {
|
|
|
576
576
|
const suggestChanges = buildSuggestChangesToolDefinition(resolveSuggestChangesOptions(options.suggestChanges));
|
|
577
577
|
return FOLIO_AGENT_TOOLS.map((definition) => definition.name === FOLIO_AGENT_TOOL_NAMES.suggestChanges ? suggestChanges : definition);
|
|
578
578
|
};
|
|
579
|
-
//#endregion
|
|
580
579
|
export { FOLIO_AGENT_TOOLS, FOLIO_AGENT_TOOL_REGISTRY, SUGGEST_CHANGES_OPERATION_TYPES, describeSuggestChangesCapabilities, getFolioToolDefinitions };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FolioAIDiagnosticBlock, FolioAIParagraphBlock, FolioAITextRangeHandle, FolioDocumentOperationIssue, FolioDocumentOperationReceipt, FolioDocumentOutlineEntry, FolioDocumentSectionHandle, FolioDocumentStoryHandle, FolioReviewChange } from "@stll/folio-core/server";
|
|
2
|
-
//#region src/types.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Provider-neutral tool-layer types. `FolioAgentToolDefinition` describes a
|
|
5
4
|
* tool the same way every model provider ends up wanting it described (name +
|
|
@@ -235,5 +234,4 @@ export type FolioAgentApplyOperationsSummary = {
|
|
|
235
234
|
receipts: FolioDocumentOperationReceipt[];
|
|
236
235
|
normalizations: FolioAgentInputNormalization[];
|
|
237
236
|
};
|
|
238
|
-
//#endregion
|
|
239
237
|
export {};
|
package/dist/types.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/types.ts
|
|
2
2
|
/** Every tool name this package exposes, as a stable string union (no enums). */
|
|
3
3
|
const FOLIO_AGENT_TOOL_NAMES = {
|
|
4
4
|
readDocument: "read_document",
|
|
@@ -18,5 +18,4 @@ const FOLIO_AGENT_TOOL_NAMES = {
|
|
|
18
18
|
scrollToBlock: "scroll_to_block",
|
|
19
19
|
showInDocument: "show_in_document"
|
|
20
20
|
};
|
|
21
|
-
//#endregion
|
|
22
21
|
export { FOLIO_AGENT_TOOL_NAMES };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/folio-agents",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.7",
|
|
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",
|
|
@@ -56,10 +56,13 @@
|
|
|
56
56
|
"test": "bun test src"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@stll/folio-core": "^0.
|
|
60
|
-
"@stll/utf8-boundaries": "0.
|
|
59
|
+
"@stll/folio-core": "^0.65.0",
|
|
60
|
+
"@stll/utf8-boundaries": "0.2.0",
|
|
61
61
|
"better-result": "3.0.1"
|
|
62
62
|
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@stll/docx-core": "0.40.0"
|
|
65
|
+
},
|
|
63
66
|
"peerDependencies": {
|
|
64
67
|
"prosemirror-commands": "^1.7.1",
|
|
65
68
|
"prosemirror-dropcursor": "^1.8.2",
|