@stll/folio-agents 0.8.8 → 0.9.0
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/README.md +4 -4
- package/dist/bridge.d.ts +15 -2
- package/dist/bridge.js +9 -0
- package/dist/bridges/editor-ref.d.ts +1 -0
- package/dist/bridges/editor-ref.js +39 -36
- package/dist/bridges/reviewer.js +16 -15
- package/dist/codecs.d.ts +92 -0
- package/dist/codecs.js +150 -0
- package/dist/execute.d.ts +5 -3
- package/dist/execute.js +50 -86
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/operation-schema.d.ts +21 -2083
- package/dist/parse.d.ts +15 -2
- package/dist/parse.js +24 -20
- package/dist/tool-contract.d.ts +111 -0
- package/dist/tool-contract.js +4 -0
- package/dist/tools.d.ts +69 -2
- package/dist/tools.js +44 -124
- package/dist/types.d.ts +18 -3
- package/dist/types.js +0 -6
- package/package.json +2 -2
- package/skills/folio-agents/SKILL.md +1 -1
package/dist/parse.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FolioAIEditOperation } from "@stll/folio-core/server";
|
|
1
|
+
import { FolioAIEditOperation, FolioDocumentOperationBatch, FolioDocumentOperationMode } from "@stll/folio-core/server";
|
|
2
2
|
//#region src/parse.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Hard caps on `suggest_changes` / `add_comment` / `reply_comment` input
|
|
@@ -25,6 +25,19 @@ declare const MAX_OPERATION_TEXT_LENGTH = 100000;
|
|
|
25
25
|
declare const MAX_TOTAL_OPERATION_TEXT_LENGTH = 2000000;
|
|
26
26
|
/** Plain-language error for a string argument over {@link MAX_OPERATION_TEXT_LENGTH}. */
|
|
27
27
|
declare const explainTextTooLong: (label: string, length: number) => string;
|
|
28
|
+
type PrepareFolioAgentDocumentOperationBatchOptions = {
|
|
29
|
+
operations: readonly FolioAIEditOperation[];
|
|
30
|
+
mode?: FolioDocumentOperationMode;
|
|
31
|
+
atomic?: boolean;
|
|
32
|
+
dryRun?: boolean;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Wrap agent-preprocessed operations in the versioned batch envelope and
|
|
36
|
+
* delegate the canonical contract validation to core's parser. The returned
|
|
37
|
+
* batch is safe to hand straight to `applyDocumentOperations`; core marks
|
|
38
|
+
* parsed batches internally so the downstream apply path can skip reparsing.
|
|
39
|
+
*/
|
|
40
|
+
declare const prepareFolioAgentDocumentOperationBatch: ({ operations, mode, atomic, dryRun }: PrepareFolioAgentDocumentOperationBatchOptions) => FolioDocumentOperationBatch;
|
|
28
41
|
/** Result of {@link parseAddCommentInput}. */
|
|
29
42
|
type ParseAddCommentResult = {
|
|
30
43
|
ok: true;
|
|
@@ -54,4 +67,4 @@ type ParseSuggestChangesResult = {
|
|
|
54
67
|
*/
|
|
55
68
|
declare const parseSuggestChangesInput: (args: unknown) => ParseSuggestChangesResult;
|
|
56
69
|
//#endregion
|
|
57
|
-
export { MAX_OPERATIONS_PER_CALL, MAX_OPERATION_TEXT_LENGTH, MAX_TOTAL_OPERATION_TEXT_LENGTH, ParseAddCommentResult, ParseSuggestChangesResult, explainTextTooLong, parseAddCommentInput, parseSuggestChangesInput };
|
|
70
|
+
export { MAX_OPERATIONS_PER_CALL, MAX_OPERATION_TEXT_LENGTH, MAX_TOTAL_OPERATION_TEXT_LENGTH, ParseAddCommentResult, ParseSuggestChangesResult, PrepareFolioAgentDocumentOperationBatchOptions, explainTextTooLong, parseAddCommentInput, parseSuggestChangesInput, prepareFolioAgentDocumentOperationBatch };
|
package/dist/parse.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { decodeMainStoryTextRangeHandle } from "./codecs.js";
|
|
2
|
+
import { FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, parseFolioDocumentOperationBatch } from "@stll/folio-core/server";
|
|
1
3
|
//#region src/parse.ts
|
|
2
4
|
const isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3
5
|
const isNonEmptyString = (value) => typeof value === "string" && value.length > 0;
|
|
@@ -56,6 +58,19 @@ const consumeTextBudget = (budget, length) => {
|
|
|
56
58
|
return budget.remaining < 0;
|
|
57
59
|
};
|
|
58
60
|
/**
|
|
61
|
+
* Wrap agent-preprocessed operations in the versioned batch envelope and
|
|
62
|
+
* delegate the canonical contract validation to core's parser. The returned
|
|
63
|
+
* batch is safe to hand straight to `applyDocumentOperations`; core marks
|
|
64
|
+
* parsed batches internally so the downstream apply path can skip reparsing.
|
|
65
|
+
*/
|
|
66
|
+
const prepareFolioAgentDocumentOperationBatch = ({ operations, mode, atomic, dryRun }) => parseFolioDocumentOperationBatch({
|
|
67
|
+
version: FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION,
|
|
68
|
+
operations,
|
|
69
|
+
...mode !== void 0 && { mode },
|
|
70
|
+
...atomic !== void 0 && { atomic },
|
|
71
|
+
...dryRun !== void 0 && { dryRun }
|
|
72
|
+
});
|
|
73
|
+
/**
|
|
59
74
|
* Validate `add_comment`'s raw tool-call arguments and build the
|
|
60
75
|
* `commentOnBlock` {@link FolioAIEditOperation} it applies. Pure: does not
|
|
61
76
|
* touch a bridge or document.
|
|
@@ -110,25 +125,14 @@ const isOperationType = (value) => value === "replaceInBlock" || value === "repl
|
|
|
110
125
|
const readTextRange = (value, index) => {
|
|
111
126
|
const path = `operations[${index}].range`;
|
|
112
127
|
if (!isPlainObject(value)) return `${path} must be an object copied from find_text.`;
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if (
|
|
120
|
-
|
|
121
|
-
if (typeof startOffset !== "number" || !Number.isInteger(startOffset) || startOffset < 0) return `${path}.startOffset must be a non-negative integer.`;
|
|
122
|
-
if (typeof endOffset !== "number" || !Number.isInteger(endOffset) || endOffset <= startOffset) return `${path}.endOffset must be an integer greater than startOffset.`;
|
|
123
|
-
if (!isNonEmptyString(selectedTextHash) || !NORMALIZED_TEXT_HASH_PATTERN.test(selectedTextHash)) return `${path}.selectedTextHash must be a normalized text hash.`;
|
|
124
|
-
return {
|
|
125
|
-
type,
|
|
126
|
-
story,
|
|
127
|
-
blockId,
|
|
128
|
-
startOffset,
|
|
129
|
-
endOffset,
|
|
130
|
-
selectedTextHash
|
|
131
|
-
};
|
|
128
|
+
const range = decodeMainStoryTextRangeHandle(value);
|
|
129
|
+
if (range !== null) return range;
|
|
130
|
+
if (value["type"] !== "textRange" || value["story"] !== "main") return `${path} must be a main-story textRange copied from find_text.`;
|
|
131
|
+
if (!isNonEmptyString(value["blockId"])) return `${path}.blockId must be a non-empty string.`;
|
|
132
|
+
if (typeof value["startOffset"] !== "number" || !Number.isInteger(value["startOffset"]) || value["startOffset"] < 0) return `${path}.startOffset must be a non-negative integer.`;
|
|
133
|
+
if (typeof value["endOffset"] !== "number" || !Number.isInteger(value["endOffset"]) || value["endOffset"] <= value["startOffset"]) return `${path}.endOffset must be an integer greater than startOffset.`;
|
|
134
|
+
if (!isNonEmptyString(value["selectedTextHash"]) || !NORMALIZED_TEXT_HASH_PATTERN.test(value["selectedTextHash"])) return `${path}.selectedTextHash must be a normalized text hash.`;
|
|
135
|
+
return `${path} must be copied from find_text.`;
|
|
132
136
|
};
|
|
133
137
|
/**
|
|
134
138
|
* Validate + map one `suggest_changes` operation, or return a plain-language
|
|
@@ -339,4 +343,4 @@ const parseSuggestChangesInput = (args) => {
|
|
|
339
343
|
};
|
|
340
344
|
};
|
|
341
345
|
//#endregion
|
|
342
|
-
export { MAX_OPERATIONS_PER_CALL, MAX_OPERATION_TEXT_LENGTH, MAX_TOTAL_OPERATION_TEXT_LENGTH, explainTextTooLong, parseAddCommentInput, parseSuggestChangesInput };
|
|
346
|
+
export { MAX_OPERATIONS_PER_CALL, MAX_OPERATION_TEXT_LENGTH, MAX_TOTAL_OPERATION_TEXT_LENGTH, explainTextTooLong, parseAddCommentInput, parseSuggestChangesInput, prepareFolioAgentDocumentOperationBatch };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { FOLIO_AGENT_TOOL_NAMES, FolioAgentApplyOperationsSummary, FolioAgentBlock, FolioAgentChange, FolioAgentComment, FolioAgentCommentFilter, FolioAgentDocumentOutline, FolioAgentScopedFindTextResult, FolioAgentSectionRead, FolioAgentToolName, FolioAgentTypedToolDefinition, FolioToolCallResult } from "./types.js";
|
|
2
|
+
import { FolioAITextRangeHandle, FolioDocumentSectionHandle, FolioDocumentStory, FolioDocumentStoryHandle } from "@stll/folio-core/server";
|
|
3
|
+
//#region src/tool-contract.d.ts
|
|
4
|
+
type EmptyArgs = Readonly<Record<string, never>>;
|
|
5
|
+
type FolioAgentFindTextScope = {
|
|
6
|
+
type: "document";
|
|
7
|
+
} | {
|
|
8
|
+
type: "section";
|
|
9
|
+
handle: FolioDocumentSectionHandle;
|
|
10
|
+
} | {
|
|
11
|
+
type: "page";
|
|
12
|
+
page: number;
|
|
13
|
+
} | {
|
|
14
|
+
type: "story";
|
|
15
|
+
handle: FolioDocumentStoryHandle;
|
|
16
|
+
};
|
|
17
|
+
type FolioAgentShowInDocumentArgs = {
|
|
18
|
+
blockId: string;
|
|
19
|
+
range?: never;
|
|
20
|
+
} | {
|
|
21
|
+
blockId?: never;
|
|
22
|
+
range: FolioAITextRangeHandle;
|
|
23
|
+
};
|
|
24
|
+
type FolioAgentToolInputByName = {
|
|
25
|
+
[FOLIO_AGENT_TOOL_NAMES.readDocument]: EmptyArgs;
|
|
26
|
+
[FOLIO_AGENT_TOOL_NAMES.getDocumentOutline]: {
|
|
27
|
+
maxDepth?: number;
|
|
28
|
+
};
|
|
29
|
+
[FOLIO_AGENT_TOOL_NAMES.readSection]: {
|
|
30
|
+
handle: FolioDocumentSectionHandle;
|
|
31
|
+
maxBlocks?: number;
|
|
32
|
+
afterBlockId?: string;
|
|
33
|
+
};
|
|
34
|
+
[FOLIO_AGENT_TOOL_NAMES.listStories]: EmptyArgs;
|
|
35
|
+
[FOLIO_AGENT_TOOL_NAMES.readStory]: {
|
|
36
|
+
handle: FolioDocumentStoryHandle;
|
|
37
|
+
};
|
|
38
|
+
[FOLIO_AGENT_TOOL_NAMES.findText]: {
|
|
39
|
+
query: string;
|
|
40
|
+
matchCase?: boolean;
|
|
41
|
+
wholeWord?: boolean;
|
|
42
|
+
scope?: FolioAgentFindTextScope;
|
|
43
|
+
};
|
|
44
|
+
[FOLIO_AGENT_TOOL_NAMES.readComments]: {
|
|
45
|
+
filter?: FolioAgentCommentFilter;
|
|
46
|
+
};
|
|
47
|
+
[FOLIO_AGENT_TOOL_NAMES.readChanges]: EmptyArgs;
|
|
48
|
+
[FOLIO_AGENT_TOOL_NAMES.addComment]: {
|
|
49
|
+
blockId: string;
|
|
50
|
+
quote?: string;
|
|
51
|
+
text: string;
|
|
52
|
+
precondition?: {
|
|
53
|
+
blockTextHash: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
[FOLIO_AGENT_TOOL_NAMES.suggestChanges]: {
|
|
57
|
+
operations: unknown[];
|
|
58
|
+
};
|
|
59
|
+
[FOLIO_AGENT_TOOL_NAMES.replyComment]: {
|
|
60
|
+
commentId: string;
|
|
61
|
+
text: string;
|
|
62
|
+
};
|
|
63
|
+
[FOLIO_AGENT_TOOL_NAMES.resolveComment]: {
|
|
64
|
+
commentId: string;
|
|
65
|
+
reopen?: boolean;
|
|
66
|
+
};
|
|
67
|
+
[FOLIO_AGENT_TOOL_NAMES.readPage]: {
|
|
68
|
+
page: number;
|
|
69
|
+
};
|
|
70
|
+
[FOLIO_AGENT_TOOL_NAMES.readSelection]: EmptyArgs;
|
|
71
|
+
[FOLIO_AGENT_TOOL_NAMES.scrollToBlock]: {
|
|
72
|
+
blockId: string;
|
|
73
|
+
};
|
|
74
|
+
[FOLIO_AGENT_TOOL_NAMES.showInDocument]: FolioAgentShowInDocumentArgs;
|
|
75
|
+
};
|
|
76
|
+
type FolioAgentToolOutputByName = {
|
|
77
|
+
[FOLIO_AGENT_TOOL_NAMES.readDocument]: FolioAgentBlock[];
|
|
78
|
+
[FOLIO_AGENT_TOOL_NAMES.getDocumentOutline]: FolioAgentDocumentOutline;
|
|
79
|
+
[FOLIO_AGENT_TOOL_NAMES.readSection]: FolioAgentSectionRead;
|
|
80
|
+
[FOLIO_AGENT_TOOL_NAMES.listStories]: FolioDocumentStory[];
|
|
81
|
+
[FOLIO_AGENT_TOOL_NAMES.readStory]: FolioDocumentStory;
|
|
82
|
+
[FOLIO_AGENT_TOOL_NAMES.findText]: FolioAgentScopedFindTextResult;
|
|
83
|
+
[FOLIO_AGENT_TOOL_NAMES.readComments]: FolioAgentComment[];
|
|
84
|
+
[FOLIO_AGENT_TOOL_NAMES.readChanges]: FolioAgentChange[];
|
|
85
|
+
[FOLIO_AGENT_TOOL_NAMES.addComment]: FolioAgentApplyOperationsSummary;
|
|
86
|
+
[FOLIO_AGENT_TOOL_NAMES.suggestChanges]: FolioAgentApplyOperationsSummary;
|
|
87
|
+
[FOLIO_AGENT_TOOL_NAMES.replyComment]: {
|
|
88
|
+
replied: true;
|
|
89
|
+
};
|
|
90
|
+
[FOLIO_AGENT_TOOL_NAMES.resolveComment]: {
|
|
91
|
+
resolved: boolean;
|
|
92
|
+
};
|
|
93
|
+
[FOLIO_AGENT_TOOL_NAMES.readPage]: {
|
|
94
|
+
page: number;
|
|
95
|
+
totalPages?: number;
|
|
96
|
+
text: string;
|
|
97
|
+
};
|
|
98
|
+
[FOLIO_AGENT_TOOL_NAMES.readSelection]: {
|
|
99
|
+
text: string;
|
|
100
|
+
};
|
|
101
|
+
[FOLIO_AGENT_TOOL_NAMES.scrollToBlock]: {
|
|
102
|
+
scrolled: boolean;
|
|
103
|
+
};
|
|
104
|
+
[FOLIO_AGENT_TOOL_NAMES.showInDocument]: {
|
|
105
|
+
shown: boolean;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
type FolioToolCallResultFor<TName extends FolioAgentToolName> = FolioToolCallResult<FolioAgentToolOutputByName[TName]>;
|
|
109
|
+
declare const defineFolioAgentToolDefinition: <TName extends FolioAgentToolName>(definition: FolioAgentTypedToolDefinition<TName, FolioAgentToolInputByName[TName], FolioAgentToolOutputByName[TName]>) => FolioAgentTypedToolDefinition<TName, FolioAgentToolInputByName[TName], FolioAgentToolOutputByName[TName]>;
|
|
110
|
+
//#endregion
|
|
111
|
+
export { FolioAgentFindTextScope, FolioAgentShowInDocumentArgs, FolioAgentToolInputByName, FolioAgentToolOutputByName, FolioToolCallResultFor, defineFolioAgentToolDefinition };
|
package/dist/tools.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { FolioAgentToolDefinition } from "./types.js";
|
|
1
|
+
import { FolioAgentApplyOperationsSummary, FolioAgentBlock, FolioAgentChange, FolioAgentComment, FolioAgentCommentFilter, FolioAgentDocumentOutline, FolioAgentScopedFindTextResult, FolioAgentSectionRead, FolioAgentToolDefinition, FolioAgentTypedToolDefinition } from "./types.js";
|
|
2
|
+
import { FolioAgentFindTextScope, FolioAgentShowInDocumentArgs } from "./tool-contract.js";
|
|
2
3
|
import { FolioDocumentOperationType } from "@stll/folio-core/server";
|
|
3
4
|
//#region src/tools.d.ts
|
|
4
5
|
/**
|
|
@@ -17,8 +18,74 @@ declare const SUGGEST_CHANGES_OPERATION_TYPES: readonly FolioDocumentOperationTy
|
|
|
17
18
|
* mutation (`add_comment`, `suggest_changes`) becomes a tracked change or
|
|
18
19
|
* comment pending human review; nothing is silently finalized.
|
|
19
20
|
*/
|
|
21
|
+
declare const FOLIO_AGENT_TOOL_REGISTRY: {
|
|
22
|
+
readonly read_document: FolioAgentTypedToolDefinition<"read_document", Readonly<Record<string, never>>, FolioAgentBlock[]>;
|
|
23
|
+
readonly get_document_outline: FolioAgentTypedToolDefinition<"get_document_outline", {
|
|
24
|
+
maxDepth?: number;
|
|
25
|
+
}, FolioAgentDocumentOutline>;
|
|
26
|
+
readonly read_section: FolioAgentTypedToolDefinition<"read_section", {
|
|
27
|
+
handle: import("@stll/folio-core/server").FolioDocumentSectionHandle;
|
|
28
|
+
maxBlocks?: number;
|
|
29
|
+
afterBlockId?: string;
|
|
30
|
+
}, FolioAgentSectionRead>;
|
|
31
|
+
readonly list_stories: FolioAgentTypedToolDefinition<"list_stories", Readonly<Record<string, never>>, import("@stll/folio-core/server").FolioDocumentStory[]>;
|
|
32
|
+
readonly read_story: FolioAgentTypedToolDefinition<"read_story", {
|
|
33
|
+
handle: import("@stll/folio-core/server").FolioDocumentStoryHandle;
|
|
34
|
+
}, import("@stll/folio-core/server").FolioDocumentStory>;
|
|
35
|
+
readonly find_text: FolioAgentTypedToolDefinition<"find_text", {
|
|
36
|
+
query: string;
|
|
37
|
+
matchCase?: boolean;
|
|
38
|
+
wholeWord?: boolean;
|
|
39
|
+
scope?: FolioAgentFindTextScope;
|
|
40
|
+
}, FolioAgentScopedFindTextResult>;
|
|
41
|
+
readonly read_comments: FolioAgentTypedToolDefinition<"read_comments", {
|
|
42
|
+
filter?: FolioAgentCommentFilter;
|
|
43
|
+
}, FolioAgentComment[]>;
|
|
44
|
+
readonly read_changes: FolioAgentTypedToolDefinition<"read_changes", Readonly<Record<string, never>>, FolioAgentChange[]>;
|
|
45
|
+
readonly add_comment: FolioAgentTypedToolDefinition<"add_comment", {
|
|
46
|
+
blockId: string;
|
|
47
|
+
quote?: string;
|
|
48
|
+
text: string;
|
|
49
|
+
precondition?: {
|
|
50
|
+
blockTextHash: string;
|
|
51
|
+
};
|
|
52
|
+
}, FolioAgentApplyOperationsSummary>;
|
|
53
|
+
readonly suggest_changes: FolioAgentTypedToolDefinition<"suggest_changes", {
|
|
54
|
+
operations: unknown[];
|
|
55
|
+
}, FolioAgentApplyOperationsSummary>;
|
|
56
|
+
readonly reply_comment: FolioAgentTypedToolDefinition<"reply_comment", {
|
|
57
|
+
commentId: string;
|
|
58
|
+
text: string;
|
|
59
|
+
}, {
|
|
60
|
+
replied: true;
|
|
61
|
+
}>;
|
|
62
|
+
readonly resolve_comment: FolioAgentTypedToolDefinition<"resolve_comment", {
|
|
63
|
+
commentId: string;
|
|
64
|
+
reopen?: boolean;
|
|
65
|
+
}, {
|
|
66
|
+
resolved: boolean;
|
|
67
|
+
}>;
|
|
68
|
+
readonly read_page: FolioAgentTypedToolDefinition<"read_page", {
|
|
69
|
+
page: number;
|
|
70
|
+
}, {
|
|
71
|
+
page: number;
|
|
72
|
+
totalPages?: number;
|
|
73
|
+
text: string;
|
|
74
|
+
}>;
|
|
75
|
+
readonly read_selection: FolioAgentTypedToolDefinition<"read_selection", Readonly<Record<string, never>>, {
|
|
76
|
+
text: string;
|
|
77
|
+
}>;
|
|
78
|
+
readonly show_in_document: FolioAgentTypedToolDefinition<"show_in_document", FolioAgentShowInDocumentArgs, {
|
|
79
|
+
shown: boolean;
|
|
80
|
+
}>;
|
|
81
|
+
readonly scroll_to_block: FolioAgentTypedToolDefinition<"scroll_to_block", {
|
|
82
|
+
blockId: string;
|
|
83
|
+
}, {
|
|
84
|
+
scrolled: boolean;
|
|
85
|
+
}>;
|
|
86
|
+
};
|
|
20
87
|
declare const FOLIO_AGENT_TOOLS: FolioAgentToolDefinition[];
|
|
21
88
|
/** The tool definitions this package exposes. Same array as {@link FOLIO_AGENT_TOOLS}, as a function for symmetry with the other providers. */
|
|
22
89
|
declare const getFolioToolDefinitions: () => FolioAgentToolDefinition[];
|
|
23
90
|
//#endregion
|
|
24
|
-
export { FOLIO_AGENT_TOOLS, SUGGEST_CHANGES_OPERATION_TYPES, getFolioToolDefinitions };
|
|
91
|
+
export { FOLIO_AGENT_TOOLS, FOLIO_AGENT_TOOL_REGISTRY, SUGGEST_CHANGES_OPERATION_TYPES, getFolioToolDefinitions };
|
package/dist/tools.js
CHANGED
|
@@ -1,85 +1,9 @@
|
|
|
1
|
+
import { FOLIO_COMMENT_ID_JSON_SCHEMA, FOLIO_SCOPED_HANDLE_JSON_SCHEMA, FOLIO_SECTION_HANDLE_JSON_SCHEMA, FOLIO_STORY_HANDLE_JSON_SCHEMA } from "./codecs.js";
|
|
1
2
|
import { FOLIO_PRECONDITION_JSON_SCHEMA, FOLIO_TEXT_RANGE_JSON_SCHEMA } from "./operation-schema.js";
|
|
3
|
+
import { defineFolioAgentToolDefinition } from "./tool-contract.js";
|
|
2
4
|
import { FOLIO_AGENT_TOOL_NAMES } from "./types.js";
|
|
3
5
|
import { FOLIO_DOCUMENT_OPERATION_TYPES } from "@stll/folio-core/server";
|
|
4
6
|
//#region src/tools.ts
|
|
5
|
-
const storyHandleSchema = {
|
|
6
|
-
type: "object",
|
|
7
|
-
properties: {
|
|
8
|
-
type: {
|
|
9
|
-
type: "string",
|
|
10
|
-
enum: [
|
|
11
|
-
"main",
|
|
12
|
-
"header",
|
|
13
|
-
"footer",
|
|
14
|
-
"footnote",
|
|
15
|
-
"endnote"
|
|
16
|
-
]
|
|
17
|
-
},
|
|
18
|
-
relationshipId: { type: "string" },
|
|
19
|
-
noteId: { type: "integer" }
|
|
20
|
-
},
|
|
21
|
-
required: ["type"],
|
|
22
|
-
additionalProperties: false
|
|
23
|
-
};
|
|
24
|
-
const sectionHandleSchema = {
|
|
25
|
-
type: "object",
|
|
26
|
-
properties: {
|
|
27
|
-
type: {
|
|
28
|
-
type: "string",
|
|
29
|
-
enum: ["headingSection"]
|
|
30
|
-
},
|
|
31
|
-
story: {
|
|
32
|
-
type: "string",
|
|
33
|
-
enum: ["main"]
|
|
34
|
-
},
|
|
35
|
-
headingBlockId: { type: "string" },
|
|
36
|
-
headingTextHash: { type: "string" },
|
|
37
|
-
headingLevel: {
|
|
38
|
-
type: "integer",
|
|
39
|
-
minimum: 1,
|
|
40
|
-
maximum: 9
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
required: [
|
|
44
|
-
"type",
|
|
45
|
-
"story",
|
|
46
|
-
"headingBlockId",
|
|
47
|
-
"headingTextHash",
|
|
48
|
-
"headingLevel"
|
|
49
|
-
],
|
|
50
|
-
additionalProperties: false
|
|
51
|
-
};
|
|
52
|
-
const scopedHandleSchema = {
|
|
53
|
-
type: "object",
|
|
54
|
-
properties: {
|
|
55
|
-
type: {
|
|
56
|
-
type: "string",
|
|
57
|
-
enum: [
|
|
58
|
-
"main",
|
|
59
|
-
"header",
|
|
60
|
-
"footer",
|
|
61
|
-
"footnote",
|
|
62
|
-
"endnote",
|
|
63
|
-
"headingSection"
|
|
64
|
-
]
|
|
65
|
-
},
|
|
66
|
-
story: {
|
|
67
|
-
type: "string",
|
|
68
|
-
enum: ["main"]
|
|
69
|
-
},
|
|
70
|
-
relationshipId: { type: "string" },
|
|
71
|
-
noteId: { type: "integer" },
|
|
72
|
-
headingBlockId: { type: "string" },
|
|
73
|
-
headingTextHash: { type: "string" },
|
|
74
|
-
headingLevel: {
|
|
75
|
-
type: "integer",
|
|
76
|
-
minimum: 1,
|
|
77
|
-
maximum: 9
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
required: ["type"],
|
|
81
|
-
additionalProperties: false
|
|
82
|
-
};
|
|
83
7
|
/**
|
|
84
8
|
* `suggest_changes` deliberately narrows the full document-operation contract
|
|
85
9
|
* (see `FOLIO_DOCUMENT_OPERATION_JSON_SCHEMA` in `operation-schema.ts`):
|
|
@@ -178,6 +102,7 @@ const suggestChangesOperationSchema = {
|
|
|
178
102
|
required: ["type"],
|
|
179
103
|
additionalProperties: false
|
|
180
104
|
};
|
|
105
|
+
const definitionsFromRegistry = (registry) => Object.values(registry);
|
|
181
106
|
/**
|
|
182
107
|
* The tools this package exposes, described for an LLM. Every tool that reads
|
|
183
108
|
* or mutates the document expects `blockId` values that came from
|
|
@@ -186,8 +111,8 @@ const suggestChangesOperationSchema = {
|
|
|
186
111
|
* mutation (`add_comment`, `suggest_changes`) becomes a tracked change or
|
|
187
112
|
* comment pending human review; nothing is silently finalized.
|
|
188
113
|
*/
|
|
189
|
-
const
|
|
190
|
-
{
|
|
114
|
+
const FOLIO_AGENT_TOOL_REGISTRY = {
|
|
115
|
+
[FOLIO_AGENT_TOOL_NAMES.readDocument]: defineFolioAgentToolDefinition({
|
|
191
116
|
name: FOLIO_AGENT_TOOL_NAMES.readDocument,
|
|
192
117
|
description: "Read the full document body as a list of blocks (paragraphs, headings, list items). Call this first, or whenever you need fresh block ids after a mutation — block ids from a stale read may no longer resolve. Each block includes a `blockTextHash`; echo it as `precondition.blockTextHash` on a suggest_changes / add_comment operation to guard against the block changing before that call runs.",
|
|
193
118
|
inputSchema: {
|
|
@@ -196,8 +121,8 @@ const FOLIO_AGENT_TOOLS = [
|
|
|
196
121
|
required: [],
|
|
197
122
|
additionalProperties: false
|
|
198
123
|
}
|
|
199
|
-
},
|
|
200
|
-
{
|
|
124
|
+
}),
|
|
125
|
+
[FOLIO_AGENT_TOOL_NAMES.getDocumentOutline]: defineFolioAgentToolDefinition({
|
|
201
126
|
name: FOLIO_AGENT_TOOL_NAMES.getDocumentOutline,
|
|
202
127
|
description: "Read a lightweight heading outline before opening document content. Returns stable section handles, heading hierarchy, and real rendered page numbers when a live paginated editor is available.",
|
|
203
128
|
inputSchema: {
|
|
@@ -211,14 +136,14 @@ const FOLIO_AGENT_TOOLS = [
|
|
|
211
136
|
required: [],
|
|
212
137
|
additionalProperties: false
|
|
213
138
|
}
|
|
214
|
-
},
|
|
215
|
-
{
|
|
139
|
+
}),
|
|
140
|
+
[FOLIO_AGENT_TOOL_NAMES.readSection]: defineFolioAgentToolDefinition({
|
|
216
141
|
name: FOLIO_AGENT_TOOL_NAMES.readSection,
|
|
217
142
|
description: "Read one logical heading section using a handle from get_document_outline. Content is block-bounded and paginated with an afterBlockId cursor, avoiding a full-document read. Each block includes a `blockTextHash`; echo it as `precondition.blockTextHash` on a suggest_changes / add_comment operation.",
|
|
218
143
|
inputSchema: {
|
|
219
144
|
type: "object",
|
|
220
145
|
properties: {
|
|
221
|
-
handle:
|
|
146
|
+
handle: FOLIO_SECTION_HANDLE_JSON_SCHEMA,
|
|
222
147
|
maxBlocks: {
|
|
223
148
|
type: "integer",
|
|
224
149
|
minimum: 1,
|
|
@@ -233,8 +158,8 @@ const FOLIO_AGENT_TOOLS = [
|
|
|
233
158
|
required: ["handle"],
|
|
234
159
|
additionalProperties: false
|
|
235
160
|
}
|
|
236
|
-
},
|
|
237
|
-
{
|
|
161
|
+
}),
|
|
162
|
+
[FOLIO_AGENT_TOOL_NAMES.listStories]: defineFolioAgentToolDefinition({
|
|
238
163
|
name: FOLIO_AGENT_TOOL_NAMES.listStories,
|
|
239
164
|
description: "List readable document stories and their typed handles.",
|
|
240
165
|
inputSchema: {
|
|
@@ -243,18 +168,18 @@ const FOLIO_AGENT_TOOLS = [
|
|
|
243
168
|
required: [],
|
|
244
169
|
additionalProperties: false
|
|
245
170
|
}
|
|
246
|
-
},
|
|
247
|
-
{
|
|
171
|
+
}),
|
|
172
|
+
[FOLIO_AGENT_TOOL_NAMES.readStory]: defineFolioAgentToolDefinition({
|
|
248
173
|
name: FOLIO_AGENT_TOOL_NAMES.readStory,
|
|
249
174
|
description: "Read one document story using a handle returned by `list_stories`.",
|
|
250
175
|
inputSchema: {
|
|
251
176
|
type: "object",
|
|
252
|
-
properties: { handle:
|
|
177
|
+
properties: { handle: FOLIO_STORY_HANDLE_JSON_SCHEMA },
|
|
253
178
|
required: ["handle"],
|
|
254
179
|
additionalProperties: false
|
|
255
180
|
}
|
|
256
|
-
},
|
|
257
|
-
{
|
|
181
|
+
}),
|
|
182
|
+
[FOLIO_AGENT_TOOL_NAMES.findText]: defineFolioAgentToolDefinition({
|
|
258
183
|
name: FOLIO_AGENT_TOOL_NAMES.findText,
|
|
259
184
|
description: "Search a document, section, rendered page, or story and return `{ matches, truncated, totalMatches }`. Main-story matches include a stable block, exact range, and `blockTextHash` (echo it as `precondition.blockTextHash` on a later suggest_changes / add_comment operation); other stories return story-relative offsets. Every match includes surrounding context. `matches` is capped at 200 entries; `truncated` is true and `totalMatches` reports the real count when there were more — narrow the query or scope instead of assuming you saw every hit.",
|
|
260
185
|
inputSchema: {
|
|
@@ -284,7 +209,7 @@ const FOLIO_AGENT_TOOLS = [
|
|
|
284
209
|
"story"
|
|
285
210
|
]
|
|
286
211
|
},
|
|
287
|
-
handle:
|
|
212
|
+
handle: FOLIO_SCOPED_HANDLE_JSON_SCHEMA,
|
|
288
213
|
page: {
|
|
289
214
|
type: "integer",
|
|
290
215
|
minimum: 1
|
|
@@ -298,8 +223,8 @@ const FOLIO_AGENT_TOOLS = [
|
|
|
298
223
|
required: ["query"],
|
|
299
224
|
additionalProperties: false
|
|
300
225
|
}
|
|
301
|
-
},
|
|
302
|
-
{
|
|
226
|
+
}),
|
|
227
|
+
[FOLIO_AGENT_TOOL_NAMES.readComments]: defineFolioAgentToolDefinition({
|
|
303
228
|
name: FOLIO_AGENT_TOOL_NAMES.readComments,
|
|
304
229
|
description: "Read comment threads in the document, each with its author, text, resolved status, anchored block, and replies. Filter to unresolved (\"open\") comments to see what still needs attention.",
|
|
305
230
|
inputSchema: {
|
|
@@ -316,8 +241,8 @@ const FOLIO_AGENT_TOOLS = [
|
|
|
316
241
|
required: [],
|
|
317
242
|
additionalProperties: false
|
|
318
243
|
}
|
|
319
|
-
},
|
|
320
|
-
{
|
|
244
|
+
}),
|
|
245
|
+
[FOLIO_AGENT_TOOL_NAMES.readChanges]: defineFolioAgentToolDefinition({
|
|
321
246
|
name: FOLIO_AGENT_TOOL_NAMES.readChanges,
|
|
322
247
|
description: "Read pending tracked changes awaiting human review. Use this to see the effect of edits already suggested via `suggest_changes` before proposing more.",
|
|
323
248
|
inputSchema: {
|
|
@@ -326,8 +251,8 @@ const FOLIO_AGENT_TOOLS = [
|
|
|
326
251
|
required: [],
|
|
327
252
|
additionalProperties: false
|
|
328
253
|
}
|
|
329
|
-
},
|
|
330
|
-
{
|
|
254
|
+
}),
|
|
255
|
+
[FOLIO_AGENT_TOOL_NAMES.addComment]: defineFolioAgentToolDefinition({
|
|
331
256
|
name: FOLIO_AGENT_TOOL_NAMES.addComment,
|
|
332
257
|
description: "Attach a comment to a block, optionally quoting the specific text it is about. The comment is added immediately (comments are not tracked changes) but the underlying text is left untouched — use this for notes/questions, and `suggest_changes` for edits. `text` and `quote` are each capped at 100,000 characters.",
|
|
333
258
|
inputSchema: {
|
|
@@ -350,8 +275,8 @@ const FOLIO_AGENT_TOOLS = [
|
|
|
350
275
|
required: ["blockId", "text"],
|
|
351
276
|
additionalProperties: false
|
|
352
277
|
}
|
|
353
|
-
},
|
|
354
|
-
{
|
|
278
|
+
}),
|
|
279
|
+
[FOLIO_AGENT_TOOL_NAMES.suggestChanges]: defineFolioAgentToolDefinition({
|
|
355
280
|
name: FOLIO_AGENT_TOOL_NAMES.suggestChanges,
|
|
356
281
|
description: "Propose one or more edits as tracked changes for a human to accept or reject — nothing is applied directly to the visible text. Each operation needs a blockId from `read_document` or `find_text`; if the document changed since that read, re-read it and retry with fresh ids (a skip reason will say so). Pass the `blockTextHash` from that read as `precondition.blockTextHash` to guard against the document changing between the read and this call. At most 50 operations per call — batch larger edits across multiple calls. Each `find` / `replace` / `text` / `comment` string is capped at 100,000 characters.",
|
|
357
282
|
inputSchema: {
|
|
@@ -364,17 +289,14 @@ const FOLIO_AGENT_TOOLS = [
|
|
|
364
289
|
required: ["operations"],
|
|
365
290
|
additionalProperties: false
|
|
366
291
|
}
|
|
367
|
-
},
|
|
368
|
-
{
|
|
292
|
+
}),
|
|
293
|
+
[FOLIO_AGENT_TOOL_NAMES.replyComment]: defineFolioAgentToolDefinition({
|
|
369
294
|
name: FOLIO_AGENT_TOOL_NAMES.replyComment,
|
|
370
295
|
description: "Reply to an existing comment thread, referenced by the id from `read_comments`. `text` is capped at 100,000 characters.",
|
|
371
296
|
inputSchema: {
|
|
372
297
|
type: "object",
|
|
373
298
|
properties: {
|
|
374
|
-
commentId:
|
|
375
|
-
type: "string",
|
|
376
|
-
description: "The comment id from `read_comments`."
|
|
377
|
-
},
|
|
299
|
+
commentId: FOLIO_COMMENT_ID_JSON_SCHEMA,
|
|
378
300
|
text: {
|
|
379
301
|
type: "string",
|
|
380
302
|
description: "The reply body, up to 100,000 characters."
|
|
@@ -383,17 +305,14 @@ const FOLIO_AGENT_TOOLS = [
|
|
|
383
305
|
required: ["commentId", "text"],
|
|
384
306
|
additionalProperties: false
|
|
385
307
|
}
|
|
386
|
-
},
|
|
387
|
-
{
|
|
308
|
+
}),
|
|
309
|
+
[FOLIO_AGENT_TOOL_NAMES.resolveComment]: defineFolioAgentToolDefinition({
|
|
388
310
|
name: FOLIO_AGENT_TOOL_NAMES.resolveComment,
|
|
389
311
|
description: "Mark a comment thread resolved, or pass `reopen: true` to reopen a previously resolved one.",
|
|
390
312
|
inputSchema: {
|
|
391
313
|
type: "object",
|
|
392
314
|
properties: {
|
|
393
|
-
commentId:
|
|
394
|
-
type: "string",
|
|
395
|
-
description: "The comment id from `read_comments`."
|
|
396
|
-
},
|
|
315
|
+
commentId: FOLIO_COMMENT_ID_JSON_SCHEMA,
|
|
397
316
|
reopen: {
|
|
398
317
|
type: "boolean",
|
|
399
318
|
description: "Reopen an already-resolved thread instead of resolving it."
|
|
@@ -402,8 +321,8 @@ const FOLIO_AGENT_TOOLS = [
|
|
|
402
321
|
required: ["commentId"],
|
|
403
322
|
additionalProperties: false
|
|
404
323
|
}
|
|
405
|
-
},
|
|
406
|
-
{
|
|
324
|
+
}),
|
|
325
|
+
[FOLIO_AGENT_TOOL_NAMES.readPage]: defineFolioAgentToolDefinition({
|
|
407
326
|
name: FOLIO_AGENT_TOOL_NAMES.readPage,
|
|
408
327
|
description: "Read the plain text of one page (1-based) as currently paginated in the live editor. Only available when the document is open in a live, paginated editor surface — not on a headless document.",
|
|
409
328
|
inputSchema: {
|
|
@@ -415,8 +334,8 @@ const FOLIO_AGENT_TOOLS = [
|
|
|
415
334
|
required: ["page"],
|
|
416
335
|
additionalProperties: false
|
|
417
336
|
}
|
|
418
|
-
},
|
|
419
|
-
{
|
|
337
|
+
}),
|
|
338
|
+
[FOLIO_AGENT_TOOL_NAMES.readSelection]: defineFolioAgentToolDefinition({
|
|
420
339
|
name: FOLIO_AGENT_TOOL_NAMES.readSelection,
|
|
421
340
|
description: "Read the user's current text selection in the live editor, as plain text. Only available on a live editor surface with an active selection.",
|
|
422
341
|
inputSchema: {
|
|
@@ -425,8 +344,8 @@ const FOLIO_AGENT_TOOLS = [
|
|
|
425
344
|
required: [],
|
|
426
345
|
additionalProperties: false
|
|
427
346
|
}
|
|
428
|
-
},
|
|
429
|
-
{
|
|
347
|
+
}),
|
|
348
|
+
[FOLIO_AGENT_TOOL_NAMES.showInDocument]: defineFolioAgentToolDefinition({
|
|
430
349
|
name: FOLIO_AGENT_TOOL_NAMES.showInDocument,
|
|
431
350
|
description: "Reveal and select a block or exact text range in the live editor. Pass either blockId or the range returned by find_text; stale or missing targets return false.",
|
|
432
351
|
inputSchema: {
|
|
@@ -441,8 +360,8 @@ const FOLIO_AGENT_TOOLS = [
|
|
|
441
360
|
required: [],
|
|
442
361
|
additionalProperties: false
|
|
443
362
|
}
|
|
444
|
-
},
|
|
445
|
-
{
|
|
363
|
+
}),
|
|
364
|
+
[FOLIO_AGENT_TOOL_NAMES.scrollToBlock]: defineFolioAgentToolDefinition({
|
|
446
365
|
name: FOLIO_AGENT_TOOL_NAMES.scrollToBlock,
|
|
447
366
|
description: "Scroll the live editor to the given block and select it, so the user can see what you are discussing. Only available on a live editor surface.",
|
|
448
367
|
inputSchema: {
|
|
@@ -454,9 +373,10 @@ const FOLIO_AGENT_TOOLS = [
|
|
|
454
373
|
required: ["blockId"],
|
|
455
374
|
additionalProperties: false
|
|
456
375
|
}
|
|
457
|
-
}
|
|
458
|
-
|
|
376
|
+
})
|
|
377
|
+
};
|
|
378
|
+
const FOLIO_AGENT_TOOLS = definitionsFromRegistry(FOLIO_AGENT_TOOL_REGISTRY);
|
|
459
379
|
/** The tool definitions this package exposes. Same array as {@link FOLIO_AGENT_TOOLS}, as a function for symmetry with the other providers. */
|
|
460
380
|
const getFolioToolDefinitions = () => FOLIO_AGENT_TOOLS;
|
|
461
381
|
//#endregion
|
|
462
|
-
export { FOLIO_AGENT_TOOLS, SUGGEST_CHANGES_OPERATION_TYPES, getFolioToolDefinitions };
|
|
382
|
+
export { FOLIO_AGENT_TOOLS, FOLIO_AGENT_TOOL_REGISTRY, SUGGEST_CHANGES_OPERATION_TYPES, getFolioToolDefinitions };
|
package/dist/types.d.ts
CHANGED
|
@@ -6,6 +6,13 @@ import { FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FolioAITextRangeHandle, Foli
|
|
|
6
6
|
* prose description + a JSON-Schema-shaped input schema); `providers.ts` maps
|
|
7
7
|
* that single shape onto each SDK's own tool-definition envelope.
|
|
8
8
|
*/
|
|
9
|
+
declare const folioAgentToolDefinitionBrand: unique symbol;
|
|
10
|
+
type FolioAgentJsonObjectSchema = {
|
|
11
|
+
readonly type: "object";
|
|
12
|
+
readonly properties: Record<string, unknown>;
|
|
13
|
+
readonly required: readonly string[];
|
|
14
|
+
readonly additionalProperties: false;
|
|
15
|
+
} & Record<string, unknown>;
|
|
9
16
|
/** Every tool name this package exposes, as a stable string union (no enums). */
|
|
10
17
|
declare const FOLIO_AGENT_TOOL_NAMES: {
|
|
11
18
|
readonly readDocument: "read_document";
|
|
@@ -37,6 +44,14 @@ type FolioAgentToolDefinition = {
|
|
|
37
44
|
description: string;
|
|
38
45
|
inputSchema: Record<string, unknown>;
|
|
39
46
|
};
|
|
47
|
+
type FolioAgentTypedToolDefinition<TName extends FolioAgentToolName = FolioAgentToolName, TInput = unknown, TOutput = unknown, TSchema extends FolioAgentJsonObjectSchema = FolioAgentJsonObjectSchema> = FolioAgentToolDefinition & {
|
|
48
|
+
readonly name: TName;
|
|
49
|
+
readonly inputSchema: TSchema;
|
|
50
|
+
readonly [folioAgentToolDefinitionBrand]?: {
|
|
51
|
+
readonly input: TInput;
|
|
52
|
+
readonly output: TOutput;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
40
55
|
/**
|
|
41
56
|
* Result of executing one tool call. `ok: false` covers every EXPECTED failure
|
|
42
57
|
* (bad arguments, an unknown tool, a capability the bridge does not support, a
|
|
@@ -45,9 +60,9 @@ type FolioAgentToolDefinition = {
|
|
|
45
60
|
* is the only boundary layer allowed to catch an unexpected throw and fold it
|
|
46
61
|
* into this shape too.
|
|
47
62
|
*/
|
|
48
|
-
type FolioToolCallResult = {
|
|
63
|
+
type FolioToolCallResult<TResult = unknown> = {
|
|
49
64
|
ok: true;
|
|
50
|
-
result:
|
|
65
|
+
result: TResult;
|
|
51
66
|
} | {
|
|
52
67
|
ok: false;
|
|
53
68
|
error: string;
|
|
@@ -175,4 +190,4 @@ type FolioAgentApplyOperationsSummary = {
|
|
|
175
190
|
receipts: FolioDocumentOperationReceipt[];
|
|
176
191
|
};
|
|
177
192
|
//#endregion
|
|
178
|
-
export { FOLIO_AGENT_TOOL_NAMES, FolioAgentApplyOperationsSummary, FolioAgentBlock, FolioAgentChange, FolioAgentComment, FolioAgentCommentFilter, FolioAgentCommentReply, FolioAgentDocumentOutline, FolioAgentFindTextResult, FolioAgentOutlineEntry, FolioAgentScopedFindTextResult, FolioAgentSectionRead, FolioAgentStoryFindTextResult, FolioAgentStoryTextMatch, FolioAgentTextMatch, FolioAgentToolDefinition, FolioAgentToolName, FolioToolCallResult };
|
|
193
|
+
export { FOLIO_AGENT_TOOL_NAMES, FolioAgentApplyOperationsSummary, FolioAgentBlock, FolioAgentChange, FolioAgentComment, FolioAgentCommentFilter, FolioAgentCommentReply, FolioAgentDocumentOutline, FolioAgentFindTextResult, FolioAgentJsonObjectSchema, FolioAgentOutlineEntry, FolioAgentScopedFindTextResult, FolioAgentSectionRead, FolioAgentStoryFindTextResult, FolioAgentStoryTextMatch, FolioAgentTextMatch, FolioAgentToolDefinition, FolioAgentToolName, FolioAgentTypedToolDefinition, FolioToolCallResult };
|
package/dist/types.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
//#region src/types.ts
|
|
2
|
-
/**
|
|
3
|
-
* Provider-neutral tool-layer types. `FolioAgentToolDefinition` describes a
|
|
4
|
-
* tool the same way every model provider ends up wanting it described (name +
|
|
5
|
-
* prose description + a JSON-Schema-shaped input schema); `providers.ts` maps
|
|
6
|
-
* that single shape onto each SDK's own tool-definition envelope.
|
|
7
|
-
*/
|
|
8
2
|
/** Every tool name this package exposes, as a stable string union (no enums). */
|
|
9
3
|
const FOLIO_AGENT_TOOL_NAMES = {
|
|
10
4
|
readDocument: "read_document",
|