@librechat/agents 3.6.8 → 3.6.10
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/cjs/agents/AgentContext.cjs +46 -39
- package/dist/cjs/agents/AgentContext.cjs.map +1 -1
- package/dist/cjs/agents/projection.cjs +2 -2
- package/dist/cjs/agents/projection.cjs.map +1 -1
- package/dist/cjs/graphs/Graph.cjs +28 -18
- package/dist/cjs/graphs/Graph.cjs.map +1 -1
- package/dist/cjs/graphs/MultiAgentGraph.cjs +87 -16
- package/dist/cjs/graphs/MultiAgentGraph.cjs.map +1 -1
- package/dist/cjs/llm/openai/index.cjs +10 -0
- package/dist/cjs/llm/openai/index.cjs.map +1 -1
- package/dist/cjs/main.cjs +14 -0
- package/dist/cjs/messages/alternation.cjs +125 -20
- package/dist/cjs/messages/alternation.cjs.map +1 -1
- package/dist/cjs/messages/core.cjs +195 -18
- package/dist/cjs/messages/core.cjs.map +1 -1
- package/dist/cjs/messages/format.cjs +488 -118
- package/dist/cjs/messages/format.cjs.map +1 -1
- package/dist/cjs/messages/handoffCue.cjs +3 -2
- package/dist/cjs/messages/handoffCue.cjs.map +1 -1
- package/dist/cjs/messages/index.cjs +1 -0
- package/dist/cjs/messages/injected.cjs +5 -2
- package/dist/cjs/messages/injected.cjs.map +1 -1
- package/dist/cjs/messages/provenance.cjs +411 -0
- package/dist/cjs/messages/provenance.cjs.map +1 -0
- package/dist/cjs/messages/prune.cjs +18 -13
- package/dist/cjs/messages/prune.cjs.map +1 -1
- package/dist/cjs/messages/toolResultTypes.cjs +663 -0
- package/dist/cjs/messages/toolResultTypes.cjs.map +1 -0
- package/dist/cjs/run.cjs +7 -4
- package/dist/cjs/run.cjs.map +1 -1
- package/dist/cjs/tools/BashProgrammaticToolCalling.cjs +21 -4
- package/dist/cjs/tools/BashProgrammaticToolCalling.cjs.map +1 -1
- package/dist/cjs/tools/CallerCapabilities.cjs +48 -0
- package/dist/cjs/tools/CallerCapabilities.cjs.map +1 -0
- package/dist/cjs/tools/ProgrammaticCallerPolicy.cjs +34 -0
- package/dist/cjs/tools/ProgrammaticCallerPolicy.cjs.map +1 -0
- package/dist/cjs/tools/ProgrammaticToolCalling.cjs +21 -4
- package/dist/cjs/tools/ProgrammaticToolCalling.cjs.map +1 -1
- package/dist/cjs/tools/ToolNode.cjs +25 -24
- package/dist/cjs/tools/ToolNode.cjs.map +1 -1
- package/dist/cjs/tools/cloudflare/CloudflareProgrammaticToolCalling.cjs +12 -4
- package/dist/cjs/tools/cloudflare/CloudflareProgrammaticToolCalling.cjs.map +1 -1
- package/dist/cjs/tools/local/LocalProgrammaticToolCalling.cjs +13 -4
- package/dist/cjs/tools/local/LocalProgrammaticToolCalling.cjs.map +1 -1
- package/dist/cjs/tools/local/resolveLocalExecutionTools.cjs +47 -11
- package/dist/cjs/tools/local/resolveLocalExecutionTools.cjs.map +1 -1
- package/dist/cjs/tools/ptcTimeout.cjs.map +1 -1
- package/dist/cjs/tools/search/search.cjs +19 -9
- package/dist/cjs/tools/search/search.cjs.map +1 -1
- package/dist/cjs/tools/search/tool.cjs +2 -1
- package/dist/cjs/tools/search/tool.cjs.map +1 -1
- package/dist/cjs/tools/subagent/SubagentExecutor.cjs +1 -1
- package/dist/cjs/tools/subagent/SubagentExecutor.cjs.map +1 -1
- package/dist/cjs/utils/toolContent.cjs +2 -2
- package/dist/cjs/utils/toolContent.cjs.map +1 -1
- package/dist/esm/agents/AgentContext.mjs +46 -39
- package/dist/esm/agents/AgentContext.mjs.map +1 -1
- package/dist/esm/agents/projection.mjs +2 -2
- package/dist/esm/agents/projection.mjs.map +1 -1
- package/dist/esm/graphs/Graph.mjs +30 -20
- package/dist/esm/graphs/Graph.mjs.map +1 -1
- package/dist/esm/graphs/MultiAgentGraph.mjs +87 -16
- package/dist/esm/graphs/MultiAgentGraph.mjs.map +1 -1
- package/dist/esm/llm/openai/index.mjs +10 -0
- package/dist/esm/llm/openai/index.mjs.map +1 -1
- package/dist/esm/main.mjs +4 -3
- package/dist/esm/messages/alternation.mjs +125 -20
- package/dist/esm/messages/alternation.mjs.map +1 -1
- package/dist/esm/messages/core.mjs +196 -19
- package/dist/esm/messages/core.mjs.map +1 -1
- package/dist/esm/messages/format.mjs +488 -119
- package/dist/esm/messages/format.mjs.map +1 -1
- package/dist/esm/messages/handoffCue.mjs +3 -2
- package/dist/esm/messages/handoffCue.mjs.map +1 -1
- package/dist/esm/messages/index.mjs +1 -0
- package/dist/esm/messages/injected.mjs +5 -2
- package/dist/esm/messages/injected.mjs.map +1 -1
- package/dist/esm/messages/provenance.mjs +401 -0
- package/dist/esm/messages/provenance.mjs.map +1 -0
- package/dist/esm/messages/prune.mjs +18 -13
- package/dist/esm/messages/prune.mjs.map +1 -1
- package/dist/esm/messages/toolResultTypes.mjs +657 -0
- package/dist/esm/messages/toolResultTypes.mjs.map +1 -0
- package/dist/esm/run.mjs +7 -4
- package/dist/esm/run.mjs.map +1 -1
- package/dist/esm/tools/BashProgrammaticToolCalling.mjs +21 -4
- package/dist/esm/tools/BashProgrammaticToolCalling.mjs.map +1 -1
- package/dist/esm/tools/CallerCapabilities.mjs +45 -0
- package/dist/esm/tools/CallerCapabilities.mjs.map +1 -0
- package/dist/esm/tools/ProgrammaticCallerPolicy.mjs +32 -0
- package/dist/esm/tools/ProgrammaticCallerPolicy.mjs.map +1 -0
- package/dist/esm/tools/ProgrammaticToolCalling.mjs +21 -4
- package/dist/esm/tools/ProgrammaticToolCalling.mjs.map +1 -1
- package/dist/esm/tools/ToolNode.mjs +25 -24
- package/dist/esm/tools/ToolNode.mjs.map +1 -1
- package/dist/esm/tools/cloudflare/CloudflareProgrammaticToolCalling.mjs +14 -6
- package/dist/esm/tools/cloudflare/CloudflareProgrammaticToolCalling.mjs.map +1 -1
- package/dist/esm/tools/local/LocalProgrammaticToolCalling.mjs +15 -6
- package/dist/esm/tools/local/LocalProgrammaticToolCalling.mjs.map +1 -1
- package/dist/esm/tools/local/resolveLocalExecutionTools.mjs +47 -12
- package/dist/esm/tools/local/resolveLocalExecutionTools.mjs.map +1 -1
- package/dist/esm/tools/ptcTimeout.mjs.map +1 -1
- package/dist/esm/tools/search/search.mjs +19 -9
- package/dist/esm/tools/search/search.mjs.map +1 -1
- package/dist/esm/tools/search/tool.mjs +2 -1
- package/dist/esm/tools/search/tool.mjs.map +1 -1
- package/dist/esm/tools/subagent/SubagentExecutor.mjs +1 -1
- package/dist/esm/tools/subagent/SubagentExecutor.mjs.map +1 -1
- package/dist/esm/utils/toolContent.mjs +2 -2
- package/dist/esm/utils/toolContent.mjs.map +1 -1
- package/dist/types/agents/AgentContext.d.ts +8 -13
- package/dist/types/agents/projection.d.ts +3 -1
- package/dist/types/graphs/Graph.d.ts +1 -1
- package/dist/types/llm/openai/index.d.ts +20 -0
- package/dist/types/messages/format.d.ts +5 -0
- package/dist/types/messages/index.d.ts +1 -0
- package/dist/types/messages/provenance.d.ts +85 -0
- package/dist/types/messages/toolResultTypes.d.ts +33 -0
- package/dist/types/tools/CallerCapabilities.d.ts +12 -0
- package/dist/types/tools/ProgrammaticCallerPolicy.d.ts +20 -0
- package/dist/types/tools/ToolNode.d.ts +4 -7
- package/dist/types/tools/local/resolveLocalExecutionTools.d.ts +4 -0
- package/dist/types/tools/ptcTimeout.d.ts +8 -0
- package/dist/types/tools/search/types.d.ts +15 -0
- package/dist/types/types/graph.d.ts +3 -1
- package/dist/types/types/tools.d.ts +13 -2
- package/package.json +1 -1
- package/src/agents/AgentContext.ts +109 -67
- package/src/agents/projection.ts +9 -1
- package/src/graphs/Graph.ts +56 -23
- package/src/graphs/MultiAgentGraph.ts +175 -33
- package/src/llm/openai/index.ts +43 -0
- package/src/messages/alternation.ts +217 -34
- package/src/messages/core.ts +358 -38
- package/src/messages/format.ts +958 -137
- package/src/messages/handoffCue.ts +7 -4
- package/src/messages/index.ts +1 -0
- package/src/messages/injected.ts +9 -6
- package/src/messages/provenance.ts +897 -0
- package/src/messages/prune.ts +28 -10
- package/src/messages/toolResultTypes.ts +1174 -0
- package/src/run.ts +9 -4
- package/src/tools/BashProgrammaticToolCalling.ts +46 -12
- package/src/tools/CallerCapabilities.ts +78 -0
- package/src/tools/ProgrammaticCallerPolicy.ts +97 -0
- package/src/tools/ProgrammaticToolCalling.ts +41 -7
- package/src/tools/ToolNode.ts +70 -52
- package/src/tools/cloudflare/CloudflareProgrammaticToolCalling.ts +24 -26
- package/src/tools/local/LocalProgrammaticToolCalling.ts +28 -23
- package/src/tools/local/resolveLocalExecutionTools.ts +132 -13
- package/src/tools/ptcTimeout.ts +6 -0
- package/src/tools/search/search.ts +25 -8
- package/src/tools/search/tool.ts +2 -0
- package/src/tools/search/types.ts +16 -0
- package/src/tools/subagent/SubagentExecutor.ts +8 -4
- package/src/types/graph.ts +3 -0
- package/src/types/tools.ts +14 -3
- package/src/utils/toolContent.ts +2 -2
|
@@ -0,0 +1,657 @@
|
|
|
1
|
+
import { isProxy } from "node:util/types";
|
|
2
|
+
const PROVIDER_TOOL_PAIRING_MAX_OUTER_PARTS = 4096;
|
|
3
|
+
const TOOL_CALL_KINDS = ["tool"];
|
|
4
|
+
const SERVER_CALL_KINDS = ["server"];
|
|
5
|
+
const ANTHROPIC_SERVER_CALL_KINDS = ["anthropic-server"];
|
|
6
|
+
const MCP_CALL_KINDS = ["mcp"];
|
|
7
|
+
const GOOGLE_CALL_KINDS = ["google"];
|
|
8
|
+
const BEDROCK_CALL_KINDS = ["bedrock", "tool"];
|
|
9
|
+
const ADVISOR_TOOL_NAMES = ["advisor"];
|
|
10
|
+
const BASH_TOOL_NAMES = ["bash_code_execution"];
|
|
11
|
+
const CODE_EXECUTION_TOOL_NAMES = ["code_execution"];
|
|
12
|
+
const TEXT_EDITOR_TOOL_NAMES = ["text_editor_code_execution"];
|
|
13
|
+
const TOOL_SEARCH_TOOL_NAMES = ["tool_search_tool_regex", "tool_search_tool_bm25"];
|
|
14
|
+
const WEB_FETCH_TOOL_NAMES = ["web_fetch"];
|
|
15
|
+
const WEB_SEARCH_TOOL_NAMES = ["web_search"];
|
|
16
|
+
const ANTHROPIC_SERVER_TOOL_ID_PREFIX = "srvtoolu_";
|
|
17
|
+
function stringSet(values) {
|
|
18
|
+
return new Set(values);
|
|
19
|
+
}
|
|
20
|
+
const GOOGLE_CODE_EXECUTION_OUTCOMES = stringSet([
|
|
21
|
+
"OUTCOME_DEADLINE_EXCEEDED",
|
|
22
|
+
"OUTCOME_FAILED",
|
|
23
|
+
"OUTCOME_OK",
|
|
24
|
+
"OUTCOME_UNSPECIFIED",
|
|
25
|
+
"outcome_deadline_exceeded",
|
|
26
|
+
"outcome_failed",
|
|
27
|
+
"outcome_ok",
|
|
28
|
+
"outcome_unspecified"
|
|
29
|
+
]);
|
|
30
|
+
const PROVIDER_TOOL_CALL_KINDS = stringSet([
|
|
31
|
+
"anthropic-server",
|
|
32
|
+
"bedrock",
|
|
33
|
+
"google",
|
|
34
|
+
"mcp",
|
|
35
|
+
"server",
|
|
36
|
+
"tool"
|
|
37
|
+
]);
|
|
38
|
+
const ANTHROPIC_SERVER_TOOL_NAMES = stringSet([
|
|
39
|
+
...ADVISOR_TOOL_NAMES,
|
|
40
|
+
...BASH_TOOL_NAMES,
|
|
41
|
+
...CODE_EXECUTION_TOOL_NAMES,
|
|
42
|
+
...TEXT_EDITOR_TOOL_NAMES,
|
|
43
|
+
...TOOL_SEARCH_TOOL_NAMES,
|
|
44
|
+
...WEB_FETCH_TOOL_NAMES,
|
|
45
|
+
...WEB_SEARCH_TOOL_NAMES
|
|
46
|
+
]);
|
|
47
|
+
function getRecord(value) {
|
|
48
|
+
if (value == null || typeof value !== "object") return;
|
|
49
|
+
try {
|
|
50
|
+
if (isProxy(value) || Array.isArray(value)) return;
|
|
51
|
+
const prototype = Object.getPrototypeOf(value);
|
|
52
|
+
return prototype === Object.prototype || prototype === null ? value : void 0;
|
|
53
|
+
} catch {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function getPropertyContainer(value) {
|
|
58
|
+
if (value == null || typeof value !== "object") return;
|
|
59
|
+
try {
|
|
60
|
+
return !isProxy(value) && !Array.isArray(value) ? value : void 0;
|
|
61
|
+
} catch {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function getArray(value) {
|
|
66
|
+
if (value == null || typeof value !== "object") return;
|
|
67
|
+
try {
|
|
68
|
+
return !isProxy(value) && Array.isArray(value) ? value : void 0;
|
|
69
|
+
} catch {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function readDataProperty(record, key) {
|
|
74
|
+
try {
|
|
75
|
+
const descriptor = Object.getOwnPropertyDescriptor(record, key);
|
|
76
|
+
if (descriptor == null || descriptor.enumerable !== true || !("value" in descriptor)) return { found: false };
|
|
77
|
+
return {
|
|
78
|
+
found: true,
|
|
79
|
+
value: descriptor.value
|
|
80
|
+
};
|
|
81
|
+
} catch {
|
|
82
|
+
return { found: false };
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function hasOnlyOwnDataProperties(record, allowed) {
|
|
86
|
+
try {
|
|
87
|
+
const keys = Reflect.ownKeys(record);
|
|
88
|
+
if (keys.length > allowed.length) return false;
|
|
89
|
+
for (let index = 0; index < keys.length; index++) {
|
|
90
|
+
const key = keys[index];
|
|
91
|
+
if (typeof key !== "string" || !allowed.includes(key)) return false;
|
|
92
|
+
const descriptor = Object.getOwnPropertyDescriptor(record, key);
|
|
93
|
+
if (descriptor == null || descriptor.enumerable !== true || !("value" in descriptor)) return false;
|
|
94
|
+
}
|
|
95
|
+
return true;
|
|
96
|
+
} catch {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function getBoundedDataArray(value, maxEntries, budget) {
|
|
101
|
+
const array = getArray(value);
|
|
102
|
+
if (array == null || array.length > maxEntries || budget != null && array.length > budget.remaining) return;
|
|
103
|
+
if (budget != null) budget.remaining -= array.length;
|
|
104
|
+
for (let index = 0; index < array.length; index++) {
|
|
105
|
+
let descriptor;
|
|
106
|
+
try {
|
|
107
|
+
descriptor = Object.getOwnPropertyDescriptor(array, String(index));
|
|
108
|
+
} catch {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (descriptor == null || descriptor.enumerable !== true || !("value" in descriptor)) return;
|
|
112
|
+
}
|
|
113
|
+
return array;
|
|
114
|
+
}
|
|
115
|
+
function getBoundedProviderPairingArray(value) {
|
|
116
|
+
return getBoundedDataArray(value, PROVIDER_TOOL_PAIRING_MAX_OUTER_PARTS);
|
|
117
|
+
}
|
|
118
|
+
function getBoundedProviderPairingArrayProperty(value, key) {
|
|
119
|
+
const record = getPropertyContainer(value);
|
|
120
|
+
if (record == null) return;
|
|
121
|
+
const property = readDataProperty(record, key);
|
|
122
|
+
return property.found ? getBoundedProviderPairingArray(property.value) : void 0;
|
|
123
|
+
}
|
|
124
|
+
function readString(record, key, allowEmpty = false) {
|
|
125
|
+
const property = readDataProperty(record, key);
|
|
126
|
+
return property.found && typeof property.value === "string" && (allowEmpty || property.value.length > 0) ? property.value : void 0;
|
|
127
|
+
}
|
|
128
|
+
function isBoundedProviderPairingString(value, allowEmpty = false) {
|
|
129
|
+
return typeof value === "string" && (allowEmpty || value.length > 0) && value.length <= 512;
|
|
130
|
+
}
|
|
131
|
+
function readPairingString(record, key, allowEmpty = false) {
|
|
132
|
+
const property = readDataProperty(record, key);
|
|
133
|
+
return property.found && isBoundedProviderPairingString(property.value, allowEmpty) ? property.value : void 0;
|
|
134
|
+
}
|
|
135
|
+
function hasRequiredDataProperties(record, keys) {
|
|
136
|
+
if (keys == null) return true;
|
|
137
|
+
for (let index = 0; index < keys.length; index++) {
|
|
138
|
+
const property = readDataProperty(record, keys[index]);
|
|
139
|
+
if (!property.found || property.value === void 0) return false;
|
|
140
|
+
}
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
function hasOptionalNullableString(record, key) {
|
|
144
|
+
const property = readDataProperty(record, key);
|
|
145
|
+
return !property.found || property.value === null || typeof property.value === "string";
|
|
146
|
+
}
|
|
147
|
+
function isCacheControl(value) {
|
|
148
|
+
if (value == null) return true;
|
|
149
|
+
const record = getRecord(value);
|
|
150
|
+
if (record == null || !hasOnlyOwnDataProperties(record, ["type", "ttl"]) || readString(record, "type") !== "ephemeral") return false;
|
|
151
|
+
const ttl = readDataProperty(record, "ttl");
|
|
152
|
+
return !ttl.found || ttl.value === null || ttl.value === "5m" || ttl.value === "1h";
|
|
153
|
+
}
|
|
154
|
+
function hasValidCacheControlProperty(record) {
|
|
155
|
+
const property = readDataProperty(record, "cache_control");
|
|
156
|
+
return !property.found || isCacheControl(property.value);
|
|
157
|
+
}
|
|
158
|
+
function isServerToolCaller(value) {
|
|
159
|
+
const record = getRecord(value);
|
|
160
|
+
if (record == null) return false;
|
|
161
|
+
const type = readString(record, "type");
|
|
162
|
+
if (type === "direct") return hasOnlyOwnDataProperties(record, ["type"]);
|
|
163
|
+
return (type === "code_execution_20250825" || type === "code_execution_20260120") && hasOnlyOwnDataProperties(record, ["type", "tool_id"]) && readPairingString(record, "tool_id") != null;
|
|
164
|
+
}
|
|
165
|
+
function hasValidCallerProperty(record) {
|
|
166
|
+
const property = readDataProperty(record, "caller");
|
|
167
|
+
return !property.found || isServerToolCaller(property.value);
|
|
168
|
+
}
|
|
169
|
+
function hasValidProviderMetadata(record) {
|
|
170
|
+
const id = readDataProperty(record, "id");
|
|
171
|
+
if (id.found && !isBoundedProviderPairingString(id.value)) return false;
|
|
172
|
+
const agentId = readDataProperty(record, "agentId");
|
|
173
|
+
if (agentId.found && !isBoundedProviderPairingString(agentId.value)) return false;
|
|
174
|
+
const index = readDataProperty(record, "index");
|
|
175
|
+
if (index.found && !(typeof index.value === "number" && Number.isSafeInteger(index.value) || isBoundedProviderPairingString(index.value))) return false;
|
|
176
|
+
const groupId = readDataProperty(record, "groupId");
|
|
177
|
+
if (groupId.found && !(typeof groupId.value === "number" && Number.isFinite(groupId.value))) return false;
|
|
178
|
+
const thought = readDataProperty(record, "thought");
|
|
179
|
+
if (thought.found && typeof thought.value !== "boolean") return false;
|
|
180
|
+
const signature = readDataProperty(record, "thoughtSignature");
|
|
181
|
+
return !signature.found || isBoundedProviderPairingString(signature.value, true);
|
|
182
|
+
}
|
|
183
|
+
const ANTHROPIC_STRUCTURED_RESULT_TOOL_NAMES = {
|
|
184
|
+
advisor_tool_result: ADVISOR_TOOL_NAMES,
|
|
185
|
+
bash_code_execution_tool_result: BASH_TOOL_NAMES,
|
|
186
|
+
code_execution_tool_result: CODE_EXECUTION_TOOL_NAMES,
|
|
187
|
+
text_editor_code_execution_tool_result: TEXT_EDITOR_TOOL_NAMES,
|
|
188
|
+
tool_search_tool_result: TOOL_SEARCH_TOOL_NAMES,
|
|
189
|
+
web_fetch_tool_result: WEB_FETCH_TOOL_NAMES
|
|
190
|
+
};
|
|
191
|
+
function isOpaqueBoundedArray(value) {
|
|
192
|
+
const array = getArray(value);
|
|
193
|
+
return array != null && array.length <= 256;
|
|
194
|
+
}
|
|
195
|
+
function isOpaqueStringOrBoundedArray(value) {
|
|
196
|
+
return typeof value === "string" || isOpaqueBoundedArray(value);
|
|
197
|
+
}
|
|
198
|
+
function isWebSearchResult(value) {
|
|
199
|
+
const record = getRecord(value);
|
|
200
|
+
return record != null && hasOnlyOwnDataProperties(record, [
|
|
201
|
+
"type",
|
|
202
|
+
"encrypted_content",
|
|
203
|
+
"title",
|
|
204
|
+
"url",
|
|
205
|
+
"page_age"
|
|
206
|
+
]) && readString(record, "type") === "web_search_result" && readString(record, "encrypted_content", true) != null && readString(record, "title", true) != null && readString(record, "url") != null && hasOptionalNullableString(record, "page_age");
|
|
207
|
+
}
|
|
208
|
+
function isWireWebSearchContent(value, budget) {
|
|
209
|
+
const error = getRecord(value);
|
|
210
|
+
if (error != null) return hasOnlyOwnDataProperties(error, ["type", "error_code"]) && readString(error, "type") === "web_search_tool_result_error" && readString(error, "error_code") != null;
|
|
211
|
+
const results = getBoundedDataArray(value, 256, budget);
|
|
212
|
+
if (results == null) return false;
|
|
213
|
+
for (let index = 0; index < results.length; index++) if (!isWebSearchResult(results[index])) return false;
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
function hasStructurallyValidAnthropicWebSearchResultContent(part) {
|
|
217
|
+
const record = getRecord(part);
|
|
218
|
+
if (record == null || readPairingString(record, "tool_use_id") == null) return false;
|
|
219
|
+
const content = readDataProperty(record, "content");
|
|
220
|
+
return content.found && isWireWebSearchContent(content.value, { remaining: 4096 });
|
|
221
|
+
}
|
|
222
|
+
function isGoogleCodeExecutionResult(record) {
|
|
223
|
+
const nested = readDataProperty(record, "codeExecutionResult");
|
|
224
|
+
const result = nested.found ? getRecord(nested.value) : void 0;
|
|
225
|
+
const outcome = result == null ? void 0 : readString(result, "outcome");
|
|
226
|
+
return result != null && hasOnlyOwnDataProperties(result, ["outcome", "output"]) && outcome != null && GOOGLE_CODE_EXECUTION_OUTCOMES.has(outcome) && readString(result, "output", true) != null;
|
|
227
|
+
}
|
|
228
|
+
function getGoogleToolResponseDescriptor(record, type) {
|
|
229
|
+
const nested = readDataProperty(record, "toolResponse");
|
|
230
|
+
const response = nested.found ? getRecord(nested.value) : void 0;
|
|
231
|
+
if (response == null) return;
|
|
232
|
+
const toolCallId = readPairingString(response, "id");
|
|
233
|
+
const responsePayload = readDataProperty(response, "response");
|
|
234
|
+
const resultPayload = readDataProperty(response, "result");
|
|
235
|
+
if (toolCallId == null) return;
|
|
236
|
+
if (responsePayload.found && responsePayload.value !== void 0 && !resultPayload.found && hasOnlyOwnDataProperties(response, [
|
|
237
|
+
"id",
|
|
238
|
+
"name",
|
|
239
|
+
"response"
|
|
240
|
+
])) {
|
|
241
|
+
const name = readPairingString(response, "name");
|
|
242
|
+
return name == null ? void 0 : {
|
|
243
|
+
type,
|
|
244
|
+
toolCallId,
|
|
245
|
+
compatibleCallKinds: GOOGLE_CALL_KINDS,
|
|
246
|
+
expectedToolNames: [name]
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
if (resultPayload.found && resultPayload.value !== void 0 && !responsePayload.found && hasOnlyOwnDataProperties(response, [
|
|
250
|
+
"id",
|
|
251
|
+
"toolType",
|
|
252
|
+
"result"
|
|
253
|
+
]) && readPairingString(response, "toolType") != null) return {
|
|
254
|
+
type,
|
|
255
|
+
toolCallId,
|
|
256
|
+
compatibleCallKinds: GOOGLE_CALL_KINDS
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
function getBedrockDescriptor(record, type) {
|
|
260
|
+
const nested = readDataProperty(record, "toolResult");
|
|
261
|
+
const result = nested.found ? getRecord(nested.value) : void 0;
|
|
262
|
+
if (result == null || !hasOnlyOwnDataProperties(result, [
|
|
263
|
+
"toolUseId",
|
|
264
|
+
"content",
|
|
265
|
+
"status",
|
|
266
|
+
"type"
|
|
267
|
+
])) return;
|
|
268
|
+
const toolCallId = readPairingString(result, "toolUseId");
|
|
269
|
+
const content = readDataProperty(result, "content");
|
|
270
|
+
const status = readDataProperty(result, "status");
|
|
271
|
+
const nestedType = readDataProperty(result, "type");
|
|
272
|
+
if (toolCallId == null || !content.found || !isOpaqueBoundedArray(content.value) || status.found && status.value !== "success" && status.value !== "error" || nestedType.found && typeof nestedType.value !== "string") return;
|
|
273
|
+
return {
|
|
274
|
+
type,
|
|
275
|
+
toolCallId,
|
|
276
|
+
compatibleCallKinds: BEDROCK_CALL_KINDS,
|
|
277
|
+
allowHumanMessagePairing: true
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
const ANTHROPIC_RESULT_FIELDS = [
|
|
281
|
+
"type",
|
|
282
|
+
"tool_use_id",
|
|
283
|
+
"content",
|
|
284
|
+
"cache_control"
|
|
285
|
+
];
|
|
286
|
+
const ANTHROPIC_GENERIC_RESULT_FIELDS = [...ANTHROPIC_RESULT_FIELDS, "is_error"];
|
|
287
|
+
const ANTHROPIC_SERVER_RESULT_FIELDS = [...ANTHROPIC_RESULT_FIELDS, "caller"];
|
|
288
|
+
const LOCAL_RESULT_METADATA_FIELDS = [
|
|
289
|
+
"id",
|
|
290
|
+
"index",
|
|
291
|
+
"agentId",
|
|
292
|
+
"groupId"
|
|
293
|
+
];
|
|
294
|
+
const TOOL_RESULT_ENVELOPE_FIELDS = {
|
|
295
|
+
advisor_tool_result: ANTHROPIC_RESULT_FIELDS,
|
|
296
|
+
bash_code_execution_tool_result: ANTHROPIC_RESULT_FIELDS,
|
|
297
|
+
code_execution_tool_result: ANTHROPIC_RESULT_FIELDS,
|
|
298
|
+
mcp_tool_result: ANTHROPIC_GENERIC_RESULT_FIELDS,
|
|
299
|
+
text_editor_code_execution_tool_result: ANTHROPIC_RESULT_FIELDS,
|
|
300
|
+
tool_search_tool_result: ANTHROPIC_RESULT_FIELDS,
|
|
301
|
+
tool_result: ANTHROPIC_GENERIC_RESULT_FIELDS,
|
|
302
|
+
web_fetch_tool_result: ANTHROPIC_SERVER_RESULT_FIELDS,
|
|
303
|
+
web_search_tool_result: ANTHROPIC_SERVER_RESULT_FIELDS,
|
|
304
|
+
server_tool_call_result: [
|
|
305
|
+
"type",
|
|
306
|
+
"toolCallId",
|
|
307
|
+
"status",
|
|
308
|
+
"output",
|
|
309
|
+
...LOCAL_RESULT_METADATA_FIELDS
|
|
310
|
+
],
|
|
311
|
+
server_tool_result: [
|
|
312
|
+
"type",
|
|
313
|
+
"tool_call_id",
|
|
314
|
+
"status",
|
|
315
|
+
"output",
|
|
316
|
+
...LOCAL_RESULT_METADATA_FIELDS
|
|
317
|
+
],
|
|
318
|
+
codeExecutionResult: [
|
|
319
|
+
"type",
|
|
320
|
+
"codeExecutionResult",
|
|
321
|
+
"agentId",
|
|
322
|
+
"groupId"
|
|
323
|
+
],
|
|
324
|
+
toolResponse: [
|
|
325
|
+
"type",
|
|
326
|
+
"toolResponse",
|
|
327
|
+
"thought",
|
|
328
|
+
"thoughtSignature",
|
|
329
|
+
"agentId",
|
|
330
|
+
"groupId"
|
|
331
|
+
],
|
|
332
|
+
toolResult: [
|
|
333
|
+
"type",
|
|
334
|
+
"toolResult",
|
|
335
|
+
"agentId",
|
|
336
|
+
"groupId"
|
|
337
|
+
]
|
|
338
|
+
};
|
|
339
|
+
function anthropicDescriptor(record, type, expectedToolNames) {
|
|
340
|
+
const toolCallId = readPairingString(record, "tool_use_id");
|
|
341
|
+
const content = readDataProperty(record, "content");
|
|
342
|
+
return toolCallId != null && content.found && getRecord(content.value) != null ? {
|
|
343
|
+
type,
|
|
344
|
+
toolCallId,
|
|
345
|
+
compatibleCallKinds: ANTHROPIC_SERVER_CALL_KINDS,
|
|
346
|
+
expectedToolNames
|
|
347
|
+
} : void 0;
|
|
348
|
+
}
|
|
349
|
+
function getProviderToolResultPartDescriptor(part) {
|
|
350
|
+
const record = getRecord(part);
|
|
351
|
+
if (record == null) return;
|
|
352
|
+
const type = readString(record, "type");
|
|
353
|
+
const allowedFields = type == null ? void 0 : TOOL_RESULT_ENVELOPE_FIELDS[type];
|
|
354
|
+
if (type == null || allowedFields == null || !hasOnlyOwnDataProperties(record, allowedFields) || !hasValidProviderMetadata(record) || !hasValidCacheControlProperty(record) || !hasValidCallerProperty(record)) return;
|
|
355
|
+
const structuredToolNames = ANTHROPIC_STRUCTURED_RESULT_TOOL_NAMES[type];
|
|
356
|
+
if (structuredToolNames != null) return anthropicDescriptor(record, type, structuredToolNames);
|
|
357
|
+
if (type === "web_search_tool_result") {
|
|
358
|
+
const toolCallId = readPairingString(record, "tool_use_id");
|
|
359
|
+
const content = readDataProperty(record, "content");
|
|
360
|
+
return toolCallId != null && content.found && (getRecord(content.value) != null || isOpaqueBoundedArray(content.value)) ? {
|
|
361
|
+
type,
|
|
362
|
+
toolCallId,
|
|
363
|
+
compatibleCallKinds: ANTHROPIC_SERVER_CALL_KINDS,
|
|
364
|
+
expectedToolNames: WEB_SEARCH_TOOL_NAMES
|
|
365
|
+
} : void 0;
|
|
366
|
+
}
|
|
367
|
+
if (type === "mcp_tool_result") {
|
|
368
|
+
const toolCallId = readPairingString(record, "tool_use_id");
|
|
369
|
+
const content = readDataProperty(record, "content");
|
|
370
|
+
const isError = readDataProperty(record, "is_error");
|
|
371
|
+
return toolCallId != null && content.found && isOpaqueStringOrBoundedArray(content.value) && isError.found && typeof isError.value === "boolean" ? {
|
|
372
|
+
type,
|
|
373
|
+
toolCallId,
|
|
374
|
+
compatibleCallKinds: MCP_CALL_KINDS
|
|
375
|
+
} : void 0;
|
|
376
|
+
}
|
|
377
|
+
if (type === "server_tool_call_result" || type === "server_tool_result") {
|
|
378
|
+
const toolCallId = readPairingString(record, type === "server_tool_call_result" ? "toolCallId" : "tool_call_id");
|
|
379
|
+
const status = readString(record, "status");
|
|
380
|
+
const output = readDataProperty(record, "output");
|
|
381
|
+
return toolCallId != null && (status === "success" || status === "error") && output.found && output.value !== void 0 ? {
|
|
382
|
+
type,
|
|
383
|
+
toolCallId,
|
|
384
|
+
compatibleCallKinds: SERVER_CALL_KINDS
|
|
385
|
+
} : void 0;
|
|
386
|
+
}
|
|
387
|
+
if (type === "codeExecutionResult") return isGoogleCodeExecutionResult(record) ? {
|
|
388
|
+
type,
|
|
389
|
+
compatibleCallKinds: GOOGLE_CALL_KINDS,
|
|
390
|
+
requiresPreviousExecutableCode: true
|
|
391
|
+
} : void 0;
|
|
392
|
+
if (type === "toolResponse") return getGoogleToolResponseDescriptor(record, type);
|
|
393
|
+
if (type === "toolResult") return getBedrockDescriptor(record, type);
|
|
394
|
+
if (type === "tool_result") {
|
|
395
|
+
const toolCallId = readPairingString(record, "tool_use_id");
|
|
396
|
+
const content = readDataProperty(record, "content");
|
|
397
|
+
const isError = readDataProperty(record, "is_error");
|
|
398
|
+
return toolCallId != null && content.found && isOpaqueStringOrBoundedArray(content.value) && (!isError.found || typeof isError.value === "boolean") ? {
|
|
399
|
+
type,
|
|
400
|
+
toolCallId,
|
|
401
|
+
compatibleCallKinds: TOOL_CALL_KINDS,
|
|
402
|
+
allowHumanMessagePairing: true
|
|
403
|
+
} : void 0;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
function optionalName(record) {
|
|
407
|
+
const property = readDataProperty(record, "name");
|
|
408
|
+
if (!property.found || property.value === void 0) return {};
|
|
409
|
+
return isBoundedProviderPairingString(property.value) ? { name: property.value } : void 0;
|
|
410
|
+
}
|
|
411
|
+
function hasExactCallShape(record, fields, required) {
|
|
412
|
+
return hasOnlyOwnDataProperties(record, fields) && hasRequiredDataProperties(record, required) && hasValidProviderMetadata(record);
|
|
413
|
+
}
|
|
414
|
+
function hasOptionalCallType(record, expected) {
|
|
415
|
+
const type = readDataProperty(record, "type");
|
|
416
|
+
return !type.found || type.value === expected;
|
|
417
|
+
}
|
|
418
|
+
function isAnthropicServerToolCall(callId, name) {
|
|
419
|
+
return callId.startsWith(ANTHROPIC_SERVER_TOOL_ID_PREFIX) && name != null && ANTHROPIC_SERVER_TOOL_NAMES.has(name);
|
|
420
|
+
}
|
|
421
|
+
function getAnthropicCallKind(type, callId, name) {
|
|
422
|
+
if (type === "mcp_tool_use") return "mcp";
|
|
423
|
+
if (type === "server_tool_use" || isAnthropicServerToolCall(callId, name)) return "anthropic-server";
|
|
424
|
+
return "tool";
|
|
425
|
+
}
|
|
426
|
+
const AI_TOOL_CALL_FIELDS = [
|
|
427
|
+
"type",
|
|
428
|
+
"id",
|
|
429
|
+
"name",
|
|
430
|
+
"args"
|
|
431
|
+
];
|
|
432
|
+
const LOCAL_CALL_METADATA_FIELDS = ["agentId", "groupId"];
|
|
433
|
+
const STANDARD_CALL_FIELDS = [
|
|
434
|
+
"type",
|
|
435
|
+
"id",
|
|
436
|
+
"name",
|
|
437
|
+
"args",
|
|
438
|
+
"index",
|
|
439
|
+
...LOCAL_CALL_METADATA_FIELDS
|
|
440
|
+
];
|
|
441
|
+
const LIBRECHAT_CALL_FIELDS = [
|
|
442
|
+
"type",
|
|
443
|
+
"id",
|
|
444
|
+
"name",
|
|
445
|
+
"args",
|
|
446
|
+
"output",
|
|
447
|
+
"outcome",
|
|
448
|
+
"auth",
|
|
449
|
+
"expires_at"
|
|
450
|
+
];
|
|
451
|
+
const ANTHROPIC_CALL_FIELDS = [
|
|
452
|
+
"type",
|
|
453
|
+
"id",
|
|
454
|
+
"name",
|
|
455
|
+
"input",
|
|
456
|
+
"caller",
|
|
457
|
+
"cache_control",
|
|
458
|
+
"index",
|
|
459
|
+
...LOCAL_CALL_METADATA_FIELDS
|
|
460
|
+
];
|
|
461
|
+
const ANTHROPIC_MCP_CALL_FIELDS = [
|
|
462
|
+
"type",
|
|
463
|
+
"id",
|
|
464
|
+
"name",
|
|
465
|
+
"input",
|
|
466
|
+
"server_name",
|
|
467
|
+
"cache_control",
|
|
468
|
+
"index",
|
|
469
|
+
...LOCAL_CALL_METADATA_FIELDS
|
|
470
|
+
];
|
|
471
|
+
const GOOGLE_CALL_FIELDS = [
|
|
472
|
+
"type",
|
|
473
|
+
"toolCall",
|
|
474
|
+
"thought",
|
|
475
|
+
"thoughtSignature",
|
|
476
|
+
...LOCAL_CALL_METADATA_FIELDS
|
|
477
|
+
];
|
|
478
|
+
function getProviderAIMessageToolCallDescriptor(toolCall) {
|
|
479
|
+
const record = getRecord(toolCall);
|
|
480
|
+
if (record == null || !hasExactCallShape(record, AI_TOOL_CALL_FIELDS, [
|
|
481
|
+
"id",
|
|
482
|
+
"name",
|
|
483
|
+
"args"
|
|
484
|
+
]) || !hasOptionalCallType(record, "tool_call")) return;
|
|
485
|
+
const callId = readPairingString(record, "id");
|
|
486
|
+
const name = optionalName(record);
|
|
487
|
+
return callId == null || name == null ? void 0 : {
|
|
488
|
+
callId,
|
|
489
|
+
kind: isAnthropicServerToolCall(callId, name.name) ? "anthropic-server" : "tool",
|
|
490
|
+
sourceType: "ai_tool_calls",
|
|
491
|
+
...name
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
function getProviderToolCallPartDescriptor(part) {
|
|
495
|
+
const record = getRecord(part);
|
|
496
|
+
if (record == null) return;
|
|
497
|
+
const type = readString(record, "type");
|
|
498
|
+
if (type === "tool_call") {
|
|
499
|
+
const nested = readDataProperty(record, "tool_call");
|
|
500
|
+
const call = nested.found ? getRecord(nested.value) : record;
|
|
501
|
+
const outerIsValid = nested.found ? hasExactCallShape(record, [
|
|
502
|
+
"type",
|
|
503
|
+
"tool_call",
|
|
504
|
+
"agentId",
|
|
505
|
+
"groupId"
|
|
506
|
+
], ["tool_call"]) : hasExactCallShape(record, STANDARD_CALL_FIELDS, [
|
|
507
|
+
"id",
|
|
508
|
+
"name",
|
|
509
|
+
"args"
|
|
510
|
+
]);
|
|
511
|
+
const callIsValid = nested.found ? call != null && hasExactCallShape(call, LIBRECHAT_CALL_FIELDS, [
|
|
512
|
+
"id",
|
|
513
|
+
"name",
|
|
514
|
+
"args"
|
|
515
|
+
]) && hasOptionalCallType(call, "tool_call") : call != null;
|
|
516
|
+
if (!outerIsValid || !callIsValid) return;
|
|
517
|
+
const callId = call == null ? void 0 : readPairingString(call, "id");
|
|
518
|
+
const name = call == null ? void 0 : optionalName(call);
|
|
519
|
+
return callId == null || name == null ? void 0 : {
|
|
520
|
+
callId,
|
|
521
|
+
kind: isAnthropicServerToolCall(callId, name.name) ? "anthropic-server" : "tool",
|
|
522
|
+
sourceType: type,
|
|
523
|
+
...name
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
if (type === "tool_use" || type === "server_tool_use" || type === "mcp_tool_use") {
|
|
527
|
+
if (!hasExactCallShape(record, type === "mcp_tool_use" ? ANTHROPIC_MCP_CALL_FIELDS : ANTHROPIC_CALL_FIELDS, type === "mcp_tool_use" ? [
|
|
528
|
+
"id",
|
|
529
|
+
"name",
|
|
530
|
+
"input",
|
|
531
|
+
"server_name"
|
|
532
|
+
] : [
|
|
533
|
+
"id",
|
|
534
|
+
"name",
|
|
535
|
+
"input"
|
|
536
|
+
]) || !hasValidCacheControlProperty(record) || !hasValidCallerProperty(record) || type === "mcp_tool_use" && readPairingString(record, "server_name") == null) return;
|
|
537
|
+
const callId = readPairingString(record, "id");
|
|
538
|
+
const name = optionalName(record);
|
|
539
|
+
if (type === "server_tool_use" && (name?.name == null || !ANTHROPIC_SERVER_TOOL_NAMES.has(name.name))) return;
|
|
540
|
+
return callId == null || name == null ? void 0 : {
|
|
541
|
+
callId,
|
|
542
|
+
kind: getAnthropicCallKind(type, callId, name.name),
|
|
543
|
+
sourceType: type,
|
|
544
|
+
...name
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
if (type === "server_tool_call") {
|
|
548
|
+
if (!hasExactCallShape(record, STANDARD_CALL_FIELDS, [
|
|
549
|
+
"id",
|
|
550
|
+
"name",
|
|
551
|
+
"args"
|
|
552
|
+
])) return;
|
|
553
|
+
const callId = readPairingString(record, "id");
|
|
554
|
+
const name = optionalName(record);
|
|
555
|
+
return callId == null || name == null ? void 0 : {
|
|
556
|
+
callId,
|
|
557
|
+
kind: isAnthropicServerToolCall(callId, name.name) ? "anthropic-server" : "server",
|
|
558
|
+
sourceType: type,
|
|
559
|
+
...name
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
if (type === "toolCall" || type === "toolUse") {
|
|
563
|
+
if (!hasExactCallShape(record, type === "toolCall" ? GOOGLE_CALL_FIELDS : [
|
|
564
|
+
"type",
|
|
565
|
+
"toolUse",
|
|
566
|
+
"agentId",
|
|
567
|
+
"groupId"
|
|
568
|
+
], [type]) || !hasValidProviderMetadata(record)) return;
|
|
569
|
+
const nested = readDataProperty(record, type);
|
|
570
|
+
const call = nested.found ? getRecord(nested.value) : void 0;
|
|
571
|
+
if (call == null) return;
|
|
572
|
+
if (type === "toolCall") {
|
|
573
|
+
const isNamedVariant = hasExactCallShape(call, [
|
|
574
|
+
"id",
|
|
575
|
+
"name",
|
|
576
|
+
"args"
|
|
577
|
+
], [
|
|
578
|
+
"id",
|
|
579
|
+
"name",
|
|
580
|
+
"args"
|
|
581
|
+
]);
|
|
582
|
+
const isTypedVariant = hasExactCallShape(call, [
|
|
583
|
+
"id",
|
|
584
|
+
"toolType",
|
|
585
|
+
"args"
|
|
586
|
+
], [
|
|
587
|
+
"id",
|
|
588
|
+
"toolType",
|
|
589
|
+
"args"
|
|
590
|
+
]);
|
|
591
|
+
if (!isNamedVariant && !isTypedVariant || isTypedVariant && readPairingString(call, "toolType") == null) return;
|
|
592
|
+
} else {
|
|
593
|
+
const nestedType = readDataProperty(call, "type");
|
|
594
|
+
if (!hasExactCallShape(call, [
|
|
595
|
+
"toolUseId",
|
|
596
|
+
"name",
|
|
597
|
+
"input",
|
|
598
|
+
"type"
|
|
599
|
+
], [
|
|
600
|
+
"toolUseId",
|
|
601
|
+
"name",
|
|
602
|
+
"input"
|
|
603
|
+
]) || nestedType.found && typeof nestedType.value !== "string") return;
|
|
604
|
+
}
|
|
605
|
+
const callId = readPairingString(call, type === "toolCall" ? "id" : "toolUseId");
|
|
606
|
+
const name = optionalName(call);
|
|
607
|
+
return callId == null || name == null ? void 0 : {
|
|
608
|
+
callId,
|
|
609
|
+
kind: type === "toolCall" ? "google" : "bedrock",
|
|
610
|
+
sourceType: type,
|
|
611
|
+
...name
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
function appendProviderToolCallDescriptor(index, descriptor) {
|
|
616
|
+
if (!PROVIDER_TOOL_CALL_KINDS.has(descriptor.kind) || !isBoundedProviderPairingString(descriptor.callId) || !isBoundedProviderPairingString(descriptor.sourceType) || descriptor.name != null && !isBoundedProviderPairingString(descriptor.name)) return;
|
|
617
|
+
const existing = index.get(descriptor.callId);
|
|
618
|
+
if (existing === void 0) {
|
|
619
|
+
if (index.size >= 4096) return;
|
|
620
|
+
index.set(descriptor.callId, { descriptor });
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
623
|
+
if (existing === null) return;
|
|
624
|
+
const isDualRepresentation = existing.secondarySourceType == null && existing.descriptor.sourceType !== descriptor.sourceType && (existing.descriptor.sourceType === "ai_tool_calls" || descriptor.sourceType === "ai_tool_calls");
|
|
625
|
+
if (existing.descriptor.kind === descriptor.kind && existing.descriptor.name === descriptor.name && isDualRepresentation) {
|
|
626
|
+
existing.secondarySourceType = descriptor.sourceType;
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
629
|
+
index.set(descriptor.callId, null);
|
|
630
|
+
}
|
|
631
|
+
function isExecutableCodePart(part) {
|
|
632
|
+
const record = getRecord(part);
|
|
633
|
+
if (record == null || readString(record, "type") !== "executableCode" || !hasOnlyOwnDataProperties(record, [
|
|
634
|
+
"type",
|
|
635
|
+
"executableCode",
|
|
636
|
+
"agentId",
|
|
637
|
+
"groupId"
|
|
638
|
+
]) || !hasValidProviderMetadata(record)) return false;
|
|
639
|
+
const nested = readDataProperty(record, "executableCode");
|
|
640
|
+
const executable = nested.found ? getRecord(nested.value) : void 0;
|
|
641
|
+
return executable != null && hasOnlyOwnDataProperties(executable, ["language", "code"]) && readString(executable, "language") != null && readString(executable, "code", true) != null;
|
|
642
|
+
}
|
|
643
|
+
function consumeProviderToolResultPair(descriptor, calls, previousPart) {
|
|
644
|
+
if (descriptor.requiresPreviousExecutableCode === true) return isExecutableCodePart(previousPart);
|
|
645
|
+
if (descriptor.toolCallId == null || !isBoundedProviderPairingString(descriptor.toolCallId)) return false;
|
|
646
|
+
const entry = calls.get(descriptor.toolCallId);
|
|
647
|
+
if (entry == null) return false;
|
|
648
|
+
const candidate = entry.descriptor;
|
|
649
|
+
if (!descriptor.compatibleCallKinds.includes(candidate.kind)) return false;
|
|
650
|
+
if (descriptor.expectedToolNames != null && (candidate.name == null || !descriptor.expectedToolNames.includes(candidate.name))) return false;
|
|
651
|
+
calls.delete(descriptor.toolCallId);
|
|
652
|
+
return true;
|
|
653
|
+
}
|
|
654
|
+
//#endregion
|
|
655
|
+
export { appendProviderToolCallDescriptor, consumeProviderToolResultPair, getBoundedProviderPairingArrayProperty, getProviderAIMessageToolCallDescriptor, getProviderToolCallPartDescriptor, getProviderToolResultPartDescriptor, hasStructurallyValidAnthropicWebSearchResultContent };
|
|
656
|
+
|
|
657
|
+
//# sourceMappingURL=toolResultTypes.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolResultTypes.mjs","names":[],"sources":["../../../src/messages/toolResultTypes.ts"],"mappings":";AA+CA,MAAa,wCAAwC;AAErD,MAAM,kBAAkB,CAAC,MAAM;AAC/B,MAAM,oBAAoB,CAAC,QAAQ;AACnC,MAAM,8BAA8B,CAAC,kBAAkB;AACvD,MAAM,iBAAiB,CAAC,KAAK;AAC7B,MAAM,oBAAoB,CAAC,QAAQ;AACnC,MAAM,qBAAqB,CAAC,WAAW,MAAM;AAE7C,MAAM,qBAAqB,CAAC,SAAS;AACrC,MAAM,kBAAkB,CAAC,qBAAqB;AAC9C,MAAM,4BAA4B,CAAC,gBAAgB;AACnD,MAAM,yBAAyB,CAAC,4BAA4B;AAC5D,MAAM,yBAAyB,CAC7B,0BACA,uBACF;AACA,MAAM,uBAAuB,CAAC,WAAW;AACzC,MAAM,wBAAwB,CAAC,YAAY;AAC3C,MAAM,kCAAkC;AAExC,SAAS,UAAU,QAAgD;CACjE,OAAO,IAAI,IAAI,MAAM;AACvB;AAEA,MAAM,iCAAiC,UAAU;CAC/C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AACD,MAAM,2BAA2B,UAAU;CACzC;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AACD,MAAM,8BAA8B,UAAU;CAC5C,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;AACL,CAAC;AAED,SAAS,UAAU,OAAqD;CACtE,IAAI,SAAS,QAAQ,OAAO,UAAU,UACpC;CAEF,IAAI;EACF,IAAI,QAAQ,KAAK,KAAK,MAAM,QAAQ,KAAK,GACvC;EAEF,MAAM,YAAY,OAAO,eAAe,KAAK;EAC7C,OAAO,cAAc,OAAO,aAAa,cAAc,OAClD,QACD,KAAA;CACN,QAAQ;EACN;CACF;AACF;AAEA,SAAS,qBACP,OACqC;CACrC,IAAI,SAAS,QAAQ,O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