@athenaintel/react 0.10.25 → 0.10.26
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/index.cjs +1153 -457
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +31 -1
- package/dist/index.js +1154 -458
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -3936,407 +3936,6 @@ function cn(...inputs) {
|
|
|
3936
3936
|
function isRecord(value) {
|
|
3937
3937
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3938
3938
|
}
|
|
3939
|
-
const { fromThreadMessageLike, getAutoStatus } = react$1.INTERNAL;
|
|
3940
|
-
const joinExternalMessages = (messages) => {
|
|
3941
|
-
var _a2;
|
|
3942
|
-
const assistantMessage = {
|
|
3943
|
-
role: "assistant",
|
|
3944
|
-
content: []
|
|
3945
|
-
};
|
|
3946
|
-
let firstAssistantId;
|
|
3947
|
-
let lastAssistantId;
|
|
3948
|
-
let assistantMessageCount = 0;
|
|
3949
|
-
for (const output of messages) {
|
|
3950
|
-
if (!output || !("role" in output)) {
|
|
3951
|
-
continue;
|
|
3952
|
-
}
|
|
3953
|
-
if (output.role === "tool") {
|
|
3954
|
-
const toolCallIdx = assistantMessage.content.findIndex(
|
|
3955
|
-
(c) => c.type === "tool-call" && c.toolCallId === output.toolCallId
|
|
3956
|
-
);
|
|
3957
|
-
if (toolCallIdx !== -1) {
|
|
3958
|
-
const toolCall = assistantMessage.content[toolCallIdx];
|
|
3959
|
-
if (output.toolName != null) {
|
|
3960
|
-
if (toolCall.toolName !== output.toolName)
|
|
3961
|
-
console.error(
|
|
3962
|
-
Error(
|
|
3963
|
-
`Tool call name ${output.toolCallId} ${output.toolName} does not match existing tool call ${toolCall.toolName}`
|
|
3964
|
-
)
|
|
3965
|
-
);
|
|
3966
|
-
}
|
|
3967
|
-
const { messages: existingMessages, ...toolCallRest } = toolCall;
|
|
3968
|
-
const updatedToolCall = {
|
|
3969
|
-
...toolCallRest,
|
|
3970
|
-
result: output.result,
|
|
3971
|
-
artifact: output.artifact,
|
|
3972
|
-
isError: output.isError,
|
|
3973
|
-
...(output.messages ?? existingMessages) !== void 0 && {
|
|
3974
|
-
messages: output.messages ?? existingMessages
|
|
3975
|
-
}
|
|
3976
|
-
};
|
|
3977
|
-
react$1.bindExternalStoreMessage(updatedToolCall, [
|
|
3978
|
-
...react$1.getExternalStoreMessages(toolCallRest),
|
|
3979
|
-
output
|
|
3980
|
-
]);
|
|
3981
|
-
assistantMessage.content[toolCallIdx] = updatedToolCall;
|
|
3982
|
-
} else {
|
|
3983
|
-
console.warn(
|
|
3984
|
-
`Tool call ${output.toolCallId} ${output.toolName} not found in assistant message`
|
|
3985
|
-
);
|
|
3986
|
-
}
|
|
3987
|
-
} else {
|
|
3988
|
-
const role = output.role;
|
|
3989
|
-
const rawContent = typeof output.content === "string" ? [{ type: "text", text: output.content }] : Array.isArray(output.content) ? output.content : [];
|
|
3990
|
-
const content = rawContent.flatMap((c) => {
|
|
3991
|
-
if (!c || typeof c !== "object") {
|
|
3992
|
-
return [];
|
|
3993
|
-
}
|
|
3994
|
-
const mapped = { ...c };
|
|
3995
|
-
react$1.bindExternalStoreMessage(mapped, output);
|
|
3996
|
-
return [mapped];
|
|
3997
|
-
});
|
|
3998
|
-
switch (role) {
|
|
3999
|
-
case "system":
|
|
4000
|
-
case "user":
|
|
4001
|
-
return {
|
|
4002
|
-
...output,
|
|
4003
|
-
content
|
|
4004
|
-
};
|
|
4005
|
-
case "assistant":
|
|
4006
|
-
if (output.id) {
|
|
4007
|
-
lastAssistantId = output.id;
|
|
4008
|
-
assistantMessageCount++;
|
|
4009
|
-
}
|
|
4010
|
-
if (assistantMessage.content.length === 0) {
|
|
4011
|
-
firstAssistantId = output.id;
|
|
4012
|
-
assistantMessage.createdAt ?? (assistantMessage.createdAt = output.createdAt);
|
|
4013
|
-
assistantMessage.status ?? (assistantMessage.status = output.status);
|
|
4014
|
-
if (output.attachments) {
|
|
4015
|
-
assistantMessage.attachments = [
|
|
4016
|
-
...assistantMessage.attachments ?? [],
|
|
4017
|
-
...output.attachments
|
|
4018
|
-
];
|
|
4019
|
-
}
|
|
4020
|
-
if (output.metadata) {
|
|
4021
|
-
assistantMessage.metadata ?? (assistantMessage.metadata = {});
|
|
4022
|
-
if (output.metadata.unstable_state) {
|
|
4023
|
-
assistantMessage.metadata.unstable_state = output.metadata.unstable_state;
|
|
4024
|
-
}
|
|
4025
|
-
if (output.metadata.unstable_annotations) {
|
|
4026
|
-
assistantMessage.metadata.unstable_annotations = [
|
|
4027
|
-
...assistantMessage.metadata.unstable_annotations ?? [],
|
|
4028
|
-
...output.metadata.unstable_annotations
|
|
4029
|
-
];
|
|
4030
|
-
}
|
|
4031
|
-
if (output.metadata.unstable_data) {
|
|
4032
|
-
assistantMessage.metadata.unstable_data = [
|
|
4033
|
-
...assistantMessage.metadata.unstable_data ?? [],
|
|
4034
|
-
...output.metadata.unstable_data
|
|
4035
|
-
];
|
|
4036
|
-
}
|
|
4037
|
-
if (output.metadata.steps) {
|
|
4038
|
-
assistantMessage.metadata.steps = [
|
|
4039
|
-
...assistantMessage.metadata.steps ?? [],
|
|
4040
|
-
...output.metadata.steps
|
|
4041
|
-
];
|
|
4042
|
-
}
|
|
4043
|
-
if (output.metadata.custom) {
|
|
4044
|
-
assistantMessage.metadata.custom = {
|
|
4045
|
-
...assistantMessage.metadata.custom ?? {},
|
|
4046
|
-
...output.metadata.custom
|
|
4047
|
-
};
|
|
4048
|
-
}
|
|
4049
|
-
if (output.metadata.submittedFeedback) {
|
|
4050
|
-
assistantMessage.metadata.submittedFeedback = output.metadata.submittedFeedback;
|
|
4051
|
-
}
|
|
4052
|
-
}
|
|
4053
|
-
} else {
|
|
4054
|
-
if ((_a2 = output.metadata) == null ? void 0 : _a2.custom) {
|
|
4055
|
-
assistantMessage.metadata ?? (assistantMessage.metadata = {});
|
|
4056
|
-
assistantMessage.metadata.custom = {
|
|
4057
|
-
...assistantMessage.metadata.custom ?? {},
|
|
4058
|
-
...output.metadata.custom
|
|
4059
|
-
};
|
|
4060
|
-
}
|
|
4061
|
-
}
|
|
4062
|
-
assistantMessage.content.push(...content);
|
|
4063
|
-
break;
|
|
4064
|
-
default: {
|
|
4065
|
-
const unsupportedRole = role;
|
|
4066
|
-
throw new Error(`Unknown message role: ${unsupportedRole}`);
|
|
4067
|
-
}
|
|
4068
|
-
}
|
|
4069
|
-
}
|
|
4070
|
-
}
|
|
4071
|
-
assistantMessage.id = lastAssistantId ?? firstAssistantId;
|
|
4072
|
-
if (assistantMessageCount > 1) {
|
|
4073
|
-
assistantMessage.metadata ?? (assistantMessage.metadata = {});
|
|
4074
|
-
assistantMessage.metadata.custom = {
|
|
4075
|
-
...assistantMessage.metadata.custom ?? {},
|
|
4076
|
-
_firstMessageId: firstAssistantId,
|
|
4077
|
-
_lastMessageId: lastAssistantId,
|
|
4078
|
-
_joinedMessageCount: assistantMessageCount
|
|
4079
|
-
};
|
|
4080
|
-
}
|
|
4081
|
-
return assistantMessage;
|
|
4082
|
-
};
|
|
4083
|
-
const chunkExternalMessages = (callbackResults, _joinStrategy) => {
|
|
4084
|
-
var _a2;
|
|
4085
|
-
const results = [];
|
|
4086
|
-
let isAssistant = false;
|
|
4087
|
-
let pendingNone = false;
|
|
4088
|
-
let inputs = [];
|
|
4089
|
-
let outputs = [];
|
|
4090
|
-
const flush2 = () => {
|
|
4091
|
-
if (outputs.length) {
|
|
4092
|
-
results.push({
|
|
4093
|
-
inputs,
|
|
4094
|
-
outputs
|
|
4095
|
-
});
|
|
4096
|
-
}
|
|
4097
|
-
inputs = [];
|
|
4098
|
-
outputs = [];
|
|
4099
|
-
isAssistant = false;
|
|
4100
|
-
pendingNone = false;
|
|
4101
|
-
};
|
|
4102
|
-
for (const callbackResult of callbackResults) {
|
|
4103
|
-
for (const output of callbackResult.outputs) {
|
|
4104
|
-
if (!output || !("role" in output)) {
|
|
4105
|
-
continue;
|
|
4106
|
-
}
|
|
4107
|
-
if (pendingNone && output.role !== "tool" || !isAssistant || output.role === "user" || output.role === "system") {
|
|
4108
|
-
flush2();
|
|
4109
|
-
}
|
|
4110
|
-
isAssistant = output.role === "assistant" || output.role === "tool";
|
|
4111
|
-
if (inputs.at(-1) !== callbackResult.input) {
|
|
4112
|
-
inputs.push(callbackResult.input);
|
|
4113
|
-
}
|
|
4114
|
-
outputs.push(output);
|
|
4115
|
-
if (output.role === "assistant" && (((_a2 = output.convertConfig) == null ? void 0 : _a2.joinStrategy) === "none" || _joinStrategy === "none")) {
|
|
4116
|
-
pendingNone = true;
|
|
4117
|
-
}
|
|
4118
|
-
}
|
|
4119
|
-
}
|
|
4120
|
-
flush2();
|
|
4121
|
-
return results;
|
|
4122
|
-
};
|
|
4123
|
-
const convertExternalMessages = (messages, callback, isRunning, metadata) => {
|
|
4124
|
-
const callbackResults = [];
|
|
4125
|
-
for (const message of messages) {
|
|
4126
|
-
const output = callback(message, metadata);
|
|
4127
|
-
const rawOutputs = Array.isArray(output) ? output : [output];
|
|
4128
|
-
const outputs = rawOutputs.filter(
|
|
4129
|
-
(candidate) => candidate != null
|
|
4130
|
-
);
|
|
4131
|
-
if (outputs.length === 0) {
|
|
4132
|
-
continue;
|
|
4133
|
-
}
|
|
4134
|
-
const result = { input: message, outputs };
|
|
4135
|
-
callbackResults.push(result);
|
|
4136
|
-
}
|
|
4137
|
-
const chunks = chunkExternalMessages(callbackResults);
|
|
4138
|
-
return chunks.map((message, idx) => {
|
|
4139
|
-
const isLast = idx === chunks.length - 1;
|
|
4140
|
-
const joined = joinExternalMessages(message.outputs);
|
|
4141
|
-
const hasPendingToolCalls = typeof joined.content === "object" && joined.content.some((c) => c.type === "tool-call" && c.result === void 0);
|
|
4142
|
-
const autoStatus = getAutoStatus(isLast, isRunning, hasPendingToolCalls, hasPendingToolCalls);
|
|
4143
|
-
const newMessage = fromThreadMessageLike(joined, idx.toString(), autoStatus);
|
|
4144
|
-
react$1.bindExternalStoreMessage(newMessage, message.inputs);
|
|
4145
|
-
return newMessage;
|
|
4146
|
-
});
|
|
4147
|
-
};
|
|
4148
|
-
const warnedMessagePartTypes = /* @__PURE__ */ new Set();
|
|
4149
|
-
const warnForUnknownMessagePartType = (type) => {
|
|
4150
|
-
if (warnedMessagePartTypes.has(type)) return;
|
|
4151
|
-
warnedMessagePartTypes.add(type);
|
|
4152
|
-
console.warn(`Unknown message part type: ${type}`);
|
|
4153
|
-
};
|
|
4154
|
-
const contentToParts = (content) => {
|
|
4155
|
-
if (typeof content === "string") return [{ type: "text", text: content }];
|
|
4156
|
-
return content.flatMap((part) => {
|
|
4157
|
-
if (!part || typeof part !== "object" || !("type" in part)) {
|
|
4158
|
-
return [];
|
|
4159
|
-
}
|
|
4160
|
-
const type = part.type;
|
|
4161
|
-
switch (type) {
|
|
4162
|
-
case "text":
|
|
4163
|
-
return [{ type: "text", text: part.text }];
|
|
4164
|
-
case "text_delta":
|
|
4165
|
-
return [{ type: "text", text: part.text }];
|
|
4166
|
-
case "image_url":
|
|
4167
|
-
if (typeof part.image_url === "string") {
|
|
4168
|
-
return [{ type: "image", image: part.image_url }];
|
|
4169
|
-
}
|
|
4170
|
-
return [{
|
|
4171
|
-
type: "image",
|
|
4172
|
-
image: part.image_url.url
|
|
4173
|
-
}];
|
|
4174
|
-
case "thinking":
|
|
4175
|
-
return [{ type: "reasoning", text: part.thinking }];
|
|
4176
|
-
case "reasoning":
|
|
4177
|
-
return [{
|
|
4178
|
-
type: "reasoning",
|
|
4179
|
-
text: part.summary.map((s) => s.text).join("\n\n\n")
|
|
4180
|
-
}];
|
|
4181
|
-
case "tool_use":
|
|
4182
|
-
return [];
|
|
4183
|
-
case "input_json_delta":
|
|
4184
|
-
return [];
|
|
4185
|
-
default:
|
|
4186
|
-
warnForUnknownMessagePartType(type);
|
|
4187
|
-
return [];
|
|
4188
|
-
}
|
|
4189
|
-
});
|
|
4190
|
-
};
|
|
4191
|
-
const getNumberAtPath = (value, path) => {
|
|
4192
|
-
let current = value;
|
|
4193
|
-
for (const segment of path) {
|
|
4194
|
-
if (!isRecord(current)) {
|
|
4195
|
-
return void 0;
|
|
4196
|
-
}
|
|
4197
|
-
current = current[segment];
|
|
4198
|
-
}
|
|
4199
|
-
return typeof current === "number" && Number.isFinite(current) ? current : void 0;
|
|
4200
|
-
};
|
|
4201
|
-
const extractReasoningTokens = ({
|
|
4202
|
-
usageMetadata,
|
|
4203
|
-
responseMetadata
|
|
4204
|
-
}) => {
|
|
4205
|
-
const rawReasoningTokens = getNumberAtPath(usageMetadata, ["output_token_details", "reasoning"]) ?? getNumberAtPath(usageMetadata, ["output_token_details", "reasoning_tokens"]) ?? getNumberAtPath(usageMetadata, ["reasoning_tokens"]) ?? getNumberAtPath(responseMetadata, ["output_token_details", "reasoning"]) ?? getNumberAtPath(responseMetadata, ["output_token_details", "reasoning_tokens"]) ?? getNumberAtPath(responseMetadata, ["token_usage", "output_token_details", "reasoning"]) ?? getNumberAtPath(responseMetadata, ["token_usage", "output_token_details", "reasoning_tokens"]);
|
|
4206
|
-
return rawReasoningTokens !== void 0 && rawReasoningTokens > 0 ? rawReasoningTokens : void 0;
|
|
4207
|
-
};
|
|
4208
|
-
const buildCustomMetadata = ({
|
|
4209
|
-
additionalKwargs,
|
|
4210
|
-
usageMetadata,
|
|
4211
|
-
responseMetadata
|
|
4212
|
-
}) => {
|
|
4213
|
-
const customMetadata = additionalKwargs ? { ...additionalKwargs } : {};
|
|
4214
|
-
const reasoningTokens = extractReasoningTokens({ usageMetadata, responseMetadata });
|
|
4215
|
-
const existingAthenaMetadata = isRecord(customMetadata._athena) ? customMetadata._athena : void 0;
|
|
4216
|
-
const athenaMetadata = {
|
|
4217
|
-
...existingAthenaMetadata ?? {}
|
|
4218
|
-
};
|
|
4219
|
-
if (usageMetadata) {
|
|
4220
|
-
athenaMetadata.rawUsageMetadata = usageMetadata;
|
|
4221
|
-
}
|
|
4222
|
-
if (responseMetadata) {
|
|
4223
|
-
athenaMetadata.rawResponseMetadata = responseMetadata;
|
|
4224
|
-
}
|
|
4225
|
-
if (reasoningTokens !== void 0) {
|
|
4226
|
-
athenaMetadata.reasoningTokens = reasoningTokens;
|
|
4227
|
-
}
|
|
4228
|
-
if (Object.keys(athenaMetadata).length > 0) {
|
|
4229
|
-
customMetadata._athena = athenaMetadata;
|
|
4230
|
-
}
|
|
4231
|
-
return Object.keys(customMetadata).length > 0 ? customMetadata : void 0;
|
|
4232
|
-
};
|
|
4233
|
-
const convertLangChainMessage = (message) => {
|
|
4234
|
-
var _a2, _b, _c;
|
|
4235
|
-
switch (message.type) {
|
|
4236
|
-
case "system": {
|
|
4237
|
-
const customMetadata = buildCustomMetadata({
|
|
4238
|
-
additionalKwargs: message.additional_kwargs
|
|
4239
|
-
});
|
|
4240
|
-
return {
|
|
4241
|
-
role: "system",
|
|
4242
|
-
id: message.id,
|
|
4243
|
-
content: [{ type: "text", text: message.content }],
|
|
4244
|
-
...customMetadata && {
|
|
4245
|
-
metadata: {
|
|
4246
|
-
custom: customMetadata
|
|
4247
|
-
}
|
|
4248
|
-
}
|
|
4249
|
-
};
|
|
4250
|
-
}
|
|
4251
|
-
case "human": {
|
|
4252
|
-
const customMetadata = buildCustomMetadata({
|
|
4253
|
-
additionalKwargs: message.additional_kwargs
|
|
4254
|
-
});
|
|
4255
|
-
return {
|
|
4256
|
-
role: "user",
|
|
4257
|
-
id: message.id,
|
|
4258
|
-
content: contentToParts(message.content),
|
|
4259
|
-
...customMetadata && {
|
|
4260
|
-
metadata: {
|
|
4261
|
-
custom: customMetadata
|
|
4262
|
-
}
|
|
4263
|
-
}
|
|
4264
|
-
};
|
|
4265
|
-
}
|
|
4266
|
-
case "ai": {
|
|
4267
|
-
const customMetadata = buildCustomMetadata({
|
|
4268
|
-
additionalKwargs: message.additional_kwargs,
|
|
4269
|
-
usageMetadata: message.usage_metadata,
|
|
4270
|
-
responseMetadata: message.response_metadata
|
|
4271
|
-
});
|
|
4272
|
-
const toolCallParts = ((_a2 = message.tool_calls) == null ? void 0 : _a2.map((chunk) => {
|
|
4273
|
-
var _a3, _b2;
|
|
4274
|
-
let argsText;
|
|
4275
|
-
if (typeof chunk.args === "string") {
|
|
4276
|
-
argsText = chunk.args;
|
|
4277
|
-
} else {
|
|
4278
|
-
const rawString = chunk.partial_json ?? ((_b2 = (_a3 = message.tool_call_chunks) == null ? void 0 : _a3.find((c) => c.id === chunk.id)) == null ? void 0 : _b2.args) ?? JSON.stringify(chunk.args);
|
|
4279
|
-
argsText = rawString;
|
|
4280
|
-
}
|
|
4281
|
-
return {
|
|
4282
|
-
type: "tool-call",
|
|
4283
|
-
toolCallId: chunk.id,
|
|
4284
|
-
toolName: chunk.name,
|
|
4285
|
-
args: typeof chunk.args === "string" ? parsePartialJsonObject(argsText) ?? {} : chunk.args,
|
|
4286
|
-
argsText
|
|
4287
|
-
};
|
|
4288
|
-
})) ?? [];
|
|
4289
|
-
const normalizedContent = typeof message.content === "string" ? [{ type: "text", text: message.content }] : message.content;
|
|
4290
|
-
const allContent = [
|
|
4291
|
-
(_b = message.additional_kwargs) == null ? void 0 : _b.reasoning,
|
|
4292
|
-
...normalizedContent,
|
|
4293
|
-
...((_c = message.additional_kwargs) == null ? void 0 : _c.tool_outputs) ?? []
|
|
4294
|
-
].filter((c) => c != null);
|
|
4295
|
-
return {
|
|
4296
|
-
role: "assistant",
|
|
4297
|
-
id: message.id,
|
|
4298
|
-
content: [...contentToParts(allContent), ...toolCallParts],
|
|
4299
|
-
...message.status && { status: message.status },
|
|
4300
|
-
...customMetadata && {
|
|
4301
|
-
metadata: {
|
|
4302
|
-
custom: customMetadata
|
|
4303
|
-
}
|
|
4304
|
-
}
|
|
4305
|
-
};
|
|
4306
|
-
}
|
|
4307
|
-
case "tool": {
|
|
4308
|
-
return {
|
|
4309
|
-
role: "tool",
|
|
4310
|
-
toolName: message.name,
|
|
4311
|
-
toolCallId: message.tool_call_id,
|
|
4312
|
-
result: message.content,
|
|
4313
|
-
artifact: message.artifact,
|
|
4314
|
-
isError: message.status === "error"
|
|
4315
|
-
};
|
|
4316
|
-
}
|
|
4317
|
-
default:
|
|
4318
|
-
return null;
|
|
4319
|
-
}
|
|
4320
|
-
};
|
|
4321
|
-
const convertLangChainToThreadMessages = (messages, isRunning = false, metadata = {}) => {
|
|
4322
|
-
const validToolCallIds = /* @__PURE__ */ new Set();
|
|
4323
|
-
for (const message of messages) {
|
|
4324
|
-
if (message.type === "ai" && message.tool_calls) {
|
|
4325
|
-
for (const tc of message.tool_calls) {
|
|
4326
|
-
if (tc.id) {
|
|
4327
|
-
validToolCallIds.add(tc.id);
|
|
4328
|
-
}
|
|
4329
|
-
}
|
|
4330
|
-
}
|
|
4331
|
-
}
|
|
4332
|
-
const filteredMessages = messages.filter((message) => {
|
|
4333
|
-
if (message.type === "tool" && message.tool_call_id && !validToolCallIds.has(message.tool_call_id)) {
|
|
4334
|
-
return false;
|
|
4335
|
-
}
|
|
4336
|
-
return true;
|
|
4337
|
-
});
|
|
4338
|
-
return convertExternalMessages(filteredMessages, convertLangChainMessage, isRunning, metadata);
|
|
4339
|
-
};
|
|
4340
3939
|
function $constructor(name, initializer2, params) {
|
|
4341
3940
|
function init2(inst, def) {
|
|
4342
3941
|
if (!inst._zod) {
|
|
@@ -8504,6 +8103,451 @@ const parseLangGraphState = (state) => {
|
|
|
8504
8103
|
}
|
|
8505
8104
|
return result;
|
|
8506
8105
|
};
|
|
8106
|
+
const { fromThreadMessageLike, getAutoStatus } = react$1.INTERNAL;
|
|
8107
|
+
const joinExternalMessages = (messages) => {
|
|
8108
|
+
var _a2;
|
|
8109
|
+
const assistantMessage = {
|
|
8110
|
+
role: "assistant",
|
|
8111
|
+
content: []
|
|
8112
|
+
};
|
|
8113
|
+
let firstAssistantId;
|
|
8114
|
+
let lastAssistantId;
|
|
8115
|
+
let assistantMessageCount = 0;
|
|
8116
|
+
for (const output of messages) {
|
|
8117
|
+
if (!output || !("role" in output)) {
|
|
8118
|
+
continue;
|
|
8119
|
+
}
|
|
8120
|
+
if (output.role === "tool") {
|
|
8121
|
+
const toolCallIdx = assistantMessage.content.findIndex(
|
|
8122
|
+
(c) => c.type === "tool-call" && c.toolCallId === output.toolCallId
|
|
8123
|
+
);
|
|
8124
|
+
if (toolCallIdx !== -1) {
|
|
8125
|
+
const toolCall = assistantMessage.content[toolCallIdx];
|
|
8126
|
+
if (output.toolName != null) {
|
|
8127
|
+
if (toolCall.toolName !== output.toolName)
|
|
8128
|
+
console.error(
|
|
8129
|
+
Error(
|
|
8130
|
+
`Tool call name ${output.toolCallId} ${output.toolName} does not match existing tool call ${toolCall.toolName}`
|
|
8131
|
+
)
|
|
8132
|
+
);
|
|
8133
|
+
}
|
|
8134
|
+
const { messages: existingMessages, ...toolCallRest } = toolCall;
|
|
8135
|
+
const updatedToolCall = {
|
|
8136
|
+
...toolCallRest,
|
|
8137
|
+
result: output.result,
|
|
8138
|
+
artifact: output.artifact,
|
|
8139
|
+
isError: output.isError,
|
|
8140
|
+
...(output.messages ?? existingMessages) !== void 0 && {
|
|
8141
|
+
messages: output.messages ?? existingMessages
|
|
8142
|
+
}
|
|
8143
|
+
};
|
|
8144
|
+
react$1.bindExternalStoreMessage(updatedToolCall, [
|
|
8145
|
+
...react$1.getExternalStoreMessages(toolCallRest),
|
|
8146
|
+
output
|
|
8147
|
+
]);
|
|
8148
|
+
assistantMessage.content[toolCallIdx] = updatedToolCall;
|
|
8149
|
+
} else {
|
|
8150
|
+
console.warn(
|
|
8151
|
+
`Tool call ${output.toolCallId} ${output.toolName} not found in assistant message`
|
|
8152
|
+
);
|
|
8153
|
+
}
|
|
8154
|
+
} else {
|
|
8155
|
+
const role = output.role;
|
|
8156
|
+
const rawContent = typeof output.content === "string" ? [{ type: "text", text: output.content }] : Array.isArray(output.content) ? output.content : [];
|
|
8157
|
+
const content = rawContent.flatMap((c) => {
|
|
8158
|
+
if (!c || typeof c !== "object") {
|
|
8159
|
+
return [];
|
|
8160
|
+
}
|
|
8161
|
+
const mapped = { ...c };
|
|
8162
|
+
react$1.bindExternalStoreMessage(mapped, output);
|
|
8163
|
+
return [mapped];
|
|
8164
|
+
});
|
|
8165
|
+
switch (role) {
|
|
8166
|
+
case "system":
|
|
8167
|
+
case "user":
|
|
8168
|
+
return {
|
|
8169
|
+
...output,
|
|
8170
|
+
content
|
|
8171
|
+
};
|
|
8172
|
+
case "assistant":
|
|
8173
|
+
if (output.id) {
|
|
8174
|
+
lastAssistantId = output.id;
|
|
8175
|
+
assistantMessageCount++;
|
|
8176
|
+
}
|
|
8177
|
+
if (assistantMessage.content.length === 0) {
|
|
8178
|
+
firstAssistantId = output.id;
|
|
8179
|
+
assistantMessage.createdAt ?? (assistantMessage.createdAt = output.createdAt);
|
|
8180
|
+
assistantMessage.status ?? (assistantMessage.status = output.status);
|
|
8181
|
+
if (output.attachments) {
|
|
8182
|
+
assistantMessage.attachments = [
|
|
8183
|
+
...assistantMessage.attachments ?? [],
|
|
8184
|
+
...output.attachments
|
|
8185
|
+
];
|
|
8186
|
+
}
|
|
8187
|
+
if (output.metadata) {
|
|
8188
|
+
assistantMessage.metadata ?? (assistantMessage.metadata = {});
|
|
8189
|
+
if (output.metadata.unstable_state) {
|
|
8190
|
+
assistantMessage.metadata.unstable_state = output.metadata.unstable_state;
|
|
8191
|
+
}
|
|
8192
|
+
if (output.metadata.unstable_annotations) {
|
|
8193
|
+
assistantMessage.metadata.unstable_annotations = [
|
|
8194
|
+
...assistantMessage.metadata.unstable_annotations ?? [],
|
|
8195
|
+
...output.metadata.unstable_annotations
|
|
8196
|
+
];
|
|
8197
|
+
}
|
|
8198
|
+
if (output.metadata.unstable_data) {
|
|
8199
|
+
assistantMessage.metadata.unstable_data = [
|
|
8200
|
+
...assistantMessage.metadata.unstable_data ?? [],
|
|
8201
|
+
...output.metadata.unstable_data
|
|
8202
|
+
];
|
|
8203
|
+
}
|
|
8204
|
+
if (output.metadata.steps) {
|
|
8205
|
+
assistantMessage.metadata.steps = [
|
|
8206
|
+
...assistantMessage.metadata.steps ?? [],
|
|
8207
|
+
...output.metadata.steps
|
|
8208
|
+
];
|
|
8209
|
+
}
|
|
8210
|
+
if (output.metadata.custom) {
|
|
8211
|
+
assistantMessage.metadata.custom = {
|
|
8212
|
+
...assistantMessage.metadata.custom ?? {},
|
|
8213
|
+
...output.metadata.custom
|
|
8214
|
+
};
|
|
8215
|
+
}
|
|
8216
|
+
if (output.metadata.submittedFeedback) {
|
|
8217
|
+
assistantMessage.metadata.submittedFeedback = output.metadata.submittedFeedback;
|
|
8218
|
+
}
|
|
8219
|
+
}
|
|
8220
|
+
} else {
|
|
8221
|
+
if ((_a2 = output.metadata) == null ? void 0 : _a2.custom) {
|
|
8222
|
+
assistantMessage.metadata ?? (assistantMessage.metadata = {});
|
|
8223
|
+
assistantMessage.metadata.custom = {
|
|
8224
|
+
...assistantMessage.metadata.custom ?? {},
|
|
8225
|
+
...output.metadata.custom
|
|
8226
|
+
};
|
|
8227
|
+
}
|
|
8228
|
+
}
|
|
8229
|
+
assistantMessage.content.push(...content);
|
|
8230
|
+
break;
|
|
8231
|
+
default: {
|
|
8232
|
+
const unsupportedRole = role;
|
|
8233
|
+
throw new Error(`Unknown message role: ${unsupportedRole}`);
|
|
8234
|
+
}
|
|
8235
|
+
}
|
|
8236
|
+
}
|
|
8237
|
+
}
|
|
8238
|
+
assistantMessage.id = lastAssistantId ?? firstAssistantId;
|
|
8239
|
+
if (assistantMessageCount > 1) {
|
|
8240
|
+
assistantMessage.metadata ?? (assistantMessage.metadata = {});
|
|
8241
|
+
assistantMessage.metadata.custom = {
|
|
8242
|
+
...assistantMessage.metadata.custom ?? {},
|
|
8243
|
+
_firstMessageId: firstAssistantId,
|
|
8244
|
+
_lastMessageId: lastAssistantId,
|
|
8245
|
+
_joinedMessageCount: assistantMessageCount
|
|
8246
|
+
};
|
|
8247
|
+
}
|
|
8248
|
+
return assistantMessage;
|
|
8249
|
+
};
|
|
8250
|
+
const chunkExternalMessages = (callbackResults, _joinStrategy) => {
|
|
8251
|
+
var _a2;
|
|
8252
|
+
const results = [];
|
|
8253
|
+
let isAssistant = false;
|
|
8254
|
+
let pendingNone = false;
|
|
8255
|
+
let inputs = [];
|
|
8256
|
+
let outputs = [];
|
|
8257
|
+
const flush2 = () => {
|
|
8258
|
+
if (outputs.length) {
|
|
8259
|
+
results.push({
|
|
8260
|
+
inputs,
|
|
8261
|
+
outputs
|
|
8262
|
+
});
|
|
8263
|
+
}
|
|
8264
|
+
inputs = [];
|
|
8265
|
+
outputs = [];
|
|
8266
|
+
isAssistant = false;
|
|
8267
|
+
pendingNone = false;
|
|
8268
|
+
};
|
|
8269
|
+
for (const callbackResult of callbackResults) {
|
|
8270
|
+
for (const output of callbackResult.outputs) {
|
|
8271
|
+
if (!output || !("role" in output)) {
|
|
8272
|
+
continue;
|
|
8273
|
+
}
|
|
8274
|
+
if (pendingNone && output.role !== "tool" || !isAssistant || output.role === "user" || output.role === "system") {
|
|
8275
|
+
flush2();
|
|
8276
|
+
}
|
|
8277
|
+
isAssistant = output.role === "assistant" || output.role === "tool";
|
|
8278
|
+
if (inputs.at(-1) !== callbackResult.input) {
|
|
8279
|
+
inputs.push(callbackResult.input);
|
|
8280
|
+
}
|
|
8281
|
+
outputs.push(output);
|
|
8282
|
+
if (output.role === "assistant" && (((_a2 = output.convertConfig) == null ? void 0 : _a2.joinStrategy) === "none" || _joinStrategy === "none")) {
|
|
8283
|
+
pendingNone = true;
|
|
8284
|
+
}
|
|
8285
|
+
}
|
|
8286
|
+
}
|
|
8287
|
+
flush2();
|
|
8288
|
+
return results;
|
|
8289
|
+
};
|
|
8290
|
+
const convertExternalMessages = (messages, callback, isRunning, metadata) => {
|
|
8291
|
+
const callbackResults = [];
|
|
8292
|
+
for (const message of messages) {
|
|
8293
|
+
const output = callback(message, metadata);
|
|
8294
|
+
const rawOutputs = Array.isArray(output) ? output : [output];
|
|
8295
|
+
const outputs = rawOutputs.filter(
|
|
8296
|
+
(candidate) => candidate != null
|
|
8297
|
+
);
|
|
8298
|
+
if (outputs.length === 0) {
|
|
8299
|
+
continue;
|
|
8300
|
+
}
|
|
8301
|
+
const result = { input: message, outputs };
|
|
8302
|
+
callbackResults.push(result);
|
|
8303
|
+
}
|
|
8304
|
+
const chunks = chunkExternalMessages(callbackResults);
|
|
8305
|
+
return chunks.map((message, idx) => {
|
|
8306
|
+
const isLast = idx === chunks.length - 1;
|
|
8307
|
+
const joined = joinExternalMessages(message.outputs);
|
|
8308
|
+
const hasPendingToolCalls = typeof joined.content === "object" && joined.content.some((c) => c.type === "tool-call" && c.result === void 0);
|
|
8309
|
+
const autoStatus = getAutoStatus(isLast, isRunning, hasPendingToolCalls, hasPendingToolCalls);
|
|
8310
|
+
const newMessage = fromThreadMessageLike(joined, idx.toString(), autoStatus);
|
|
8311
|
+
react$1.bindExternalStoreMessage(newMessage, message.inputs);
|
|
8312
|
+
return newMessage;
|
|
8313
|
+
});
|
|
8314
|
+
};
|
|
8315
|
+
const PTC_SUBCALL_DID_NOT_COMPLETE_MESSAGE = "Sub-call did not complete before the parent tool returned.";
|
|
8316
|
+
const autoCloseInFlightSubgraphMessages = (msgs) => {
|
|
8317
|
+
const beginIds = /* @__PURE__ */ new Set();
|
|
8318
|
+
const endIds = /* @__PURE__ */ new Set();
|
|
8319
|
+
for (const message of msgs) {
|
|
8320
|
+
if (!isRecord(message)) continue;
|
|
8321
|
+
if (message.type === "ai" && Array.isArray(message.tool_calls)) {
|
|
8322
|
+
for (const toolCall of message.tool_calls) {
|
|
8323
|
+
if (!isRecord(toolCall)) continue;
|
|
8324
|
+
const id = toolCall.id;
|
|
8325
|
+
if (typeof id === "string") beginIds.add(id);
|
|
8326
|
+
}
|
|
8327
|
+
} else if (message.type === "tool" && typeof message.tool_call_id === "string") {
|
|
8328
|
+
endIds.add(message.tool_call_id);
|
|
8329
|
+
}
|
|
8330
|
+
}
|
|
8331
|
+
const unmatchedIds = [...beginIds].filter((id) => !endIds.has(id));
|
|
8332
|
+
if (unmatchedIds.length === 0) return [...msgs];
|
|
8333
|
+
return [
|
|
8334
|
+
...msgs,
|
|
8335
|
+
...unmatchedIds.map((toolCallId) => ({
|
|
8336
|
+
type: "tool",
|
|
8337
|
+
tool_call_id: toolCallId,
|
|
8338
|
+
content: PTC_SUBCALL_DID_NOT_COMPLETE_MESSAGE,
|
|
8339
|
+
status: "error"
|
|
8340
|
+
}))
|
|
8341
|
+
];
|
|
8342
|
+
};
|
|
8343
|
+
const warnedMessagePartTypes = /* @__PURE__ */ new Set();
|
|
8344
|
+
const warnForUnknownMessagePartType = (type) => {
|
|
8345
|
+
if (warnedMessagePartTypes.has(type)) return;
|
|
8346
|
+
warnedMessagePartTypes.add(type);
|
|
8347
|
+
console.warn(`Unknown message part type: ${type}`);
|
|
8348
|
+
};
|
|
8349
|
+
const contentToParts = (content) => {
|
|
8350
|
+
if (typeof content === "string") return [{ type: "text", text: content }];
|
|
8351
|
+
return content.flatMap((part) => {
|
|
8352
|
+
if (!part || typeof part !== "object" || !("type" in part)) {
|
|
8353
|
+
return [];
|
|
8354
|
+
}
|
|
8355
|
+
const type = part.type;
|
|
8356
|
+
switch (type) {
|
|
8357
|
+
case "text":
|
|
8358
|
+
return [{ type: "text", text: part.text }];
|
|
8359
|
+
case "text_delta":
|
|
8360
|
+
return [{ type: "text", text: part.text }];
|
|
8361
|
+
case "image_url":
|
|
8362
|
+
if (typeof part.image_url === "string") {
|
|
8363
|
+
return [{ type: "image", image: part.image_url }];
|
|
8364
|
+
}
|
|
8365
|
+
return [{
|
|
8366
|
+
type: "image",
|
|
8367
|
+
image: part.image_url.url
|
|
8368
|
+
}];
|
|
8369
|
+
case "thinking":
|
|
8370
|
+
return [{ type: "reasoning", text: part.thinking }];
|
|
8371
|
+
case "reasoning":
|
|
8372
|
+
return [{
|
|
8373
|
+
type: "reasoning",
|
|
8374
|
+
text: part.summary.map((s) => s.text).join("\n\n\n")
|
|
8375
|
+
}];
|
|
8376
|
+
case "tool_use":
|
|
8377
|
+
return [];
|
|
8378
|
+
case "input_json_delta":
|
|
8379
|
+
return [];
|
|
8380
|
+
default:
|
|
8381
|
+
warnForUnknownMessagePartType(type);
|
|
8382
|
+
return [];
|
|
8383
|
+
}
|
|
8384
|
+
});
|
|
8385
|
+
};
|
|
8386
|
+
const getNumberAtPath = (value, path) => {
|
|
8387
|
+
let current = value;
|
|
8388
|
+
for (const segment of path) {
|
|
8389
|
+
if (!isRecord(current)) {
|
|
8390
|
+
return void 0;
|
|
8391
|
+
}
|
|
8392
|
+
current = current[segment];
|
|
8393
|
+
}
|
|
8394
|
+
return typeof current === "number" && Number.isFinite(current) ? current : void 0;
|
|
8395
|
+
};
|
|
8396
|
+
const extractReasoningTokens = ({
|
|
8397
|
+
usageMetadata,
|
|
8398
|
+
responseMetadata
|
|
8399
|
+
}) => {
|
|
8400
|
+
const rawReasoningTokens = getNumberAtPath(usageMetadata, ["output_token_details", "reasoning"]) ?? getNumberAtPath(usageMetadata, ["output_token_details", "reasoning_tokens"]) ?? getNumberAtPath(usageMetadata, ["reasoning_tokens"]) ?? getNumberAtPath(responseMetadata, ["output_token_details", "reasoning"]) ?? getNumberAtPath(responseMetadata, ["output_token_details", "reasoning_tokens"]) ?? getNumberAtPath(responseMetadata, ["token_usage", "output_token_details", "reasoning"]) ?? getNumberAtPath(responseMetadata, ["token_usage", "output_token_details", "reasoning_tokens"]);
|
|
8401
|
+
return rawReasoningTokens !== void 0 && rawReasoningTokens > 0 ? rawReasoningTokens : void 0;
|
|
8402
|
+
};
|
|
8403
|
+
const buildCustomMetadata = ({
|
|
8404
|
+
additionalKwargs,
|
|
8405
|
+
usageMetadata,
|
|
8406
|
+
responseMetadata
|
|
8407
|
+
}) => {
|
|
8408
|
+
const customMetadata = additionalKwargs ? { ...additionalKwargs } : {};
|
|
8409
|
+
const reasoningTokens = extractReasoningTokens({ usageMetadata, responseMetadata });
|
|
8410
|
+
const existingAthenaMetadata = isRecord(customMetadata._athena) ? customMetadata._athena : void 0;
|
|
8411
|
+
const athenaMetadata = {
|
|
8412
|
+
...existingAthenaMetadata ?? {}
|
|
8413
|
+
};
|
|
8414
|
+
if (usageMetadata) {
|
|
8415
|
+
athenaMetadata.rawUsageMetadata = usageMetadata;
|
|
8416
|
+
}
|
|
8417
|
+
if (responseMetadata) {
|
|
8418
|
+
athenaMetadata.rawResponseMetadata = responseMetadata;
|
|
8419
|
+
}
|
|
8420
|
+
if (reasoningTokens !== void 0) {
|
|
8421
|
+
athenaMetadata.reasoningTokens = reasoningTokens;
|
|
8422
|
+
}
|
|
8423
|
+
if (Object.keys(athenaMetadata).length > 0) {
|
|
8424
|
+
customMetadata._athena = athenaMetadata;
|
|
8425
|
+
}
|
|
8426
|
+
return Object.keys(customMetadata).length > 0 ? customMetadata : void 0;
|
|
8427
|
+
};
|
|
8428
|
+
const getSubgraphMessages = (artifact) => {
|
|
8429
|
+
if (!isRecord(artifact)) return void 0;
|
|
8430
|
+
const subgraphState = artifact.subgraph_state;
|
|
8431
|
+
if (!isRecord(subgraphState)) return void 0;
|
|
8432
|
+
const messages = subgraphState.messages;
|
|
8433
|
+
return Array.isArray(messages) && messages.length > 0 ? messages : void 0;
|
|
8434
|
+
};
|
|
8435
|
+
const convertLangChainMessage = (message) => {
|
|
8436
|
+
var _a2, _b, _c;
|
|
8437
|
+
switch (message.type) {
|
|
8438
|
+
case "system": {
|
|
8439
|
+
const customMetadata = buildCustomMetadata({
|
|
8440
|
+
additionalKwargs: message.additional_kwargs
|
|
8441
|
+
});
|
|
8442
|
+
return {
|
|
8443
|
+
role: "system",
|
|
8444
|
+
id: message.id,
|
|
8445
|
+
content: [{ type: "text", text: message.content }],
|
|
8446
|
+
...customMetadata && {
|
|
8447
|
+
metadata: {
|
|
8448
|
+
custom: customMetadata
|
|
8449
|
+
}
|
|
8450
|
+
}
|
|
8451
|
+
};
|
|
8452
|
+
}
|
|
8453
|
+
case "human": {
|
|
8454
|
+
const customMetadata = buildCustomMetadata({
|
|
8455
|
+
additionalKwargs: message.additional_kwargs
|
|
8456
|
+
});
|
|
8457
|
+
return {
|
|
8458
|
+
role: "user",
|
|
8459
|
+
id: message.id,
|
|
8460
|
+
content: contentToParts(message.content),
|
|
8461
|
+
...customMetadata && {
|
|
8462
|
+
metadata: {
|
|
8463
|
+
custom: customMetadata
|
|
8464
|
+
}
|
|
8465
|
+
}
|
|
8466
|
+
};
|
|
8467
|
+
}
|
|
8468
|
+
case "ai": {
|
|
8469
|
+
const customMetadata = buildCustomMetadata({
|
|
8470
|
+
additionalKwargs: message.additional_kwargs,
|
|
8471
|
+
usageMetadata: message.usage_metadata,
|
|
8472
|
+
responseMetadata: message.response_metadata
|
|
8473
|
+
});
|
|
8474
|
+
const toolCallParts = ((_a2 = message.tool_calls) == null ? void 0 : _a2.map((chunk) => {
|
|
8475
|
+
var _a3, _b2;
|
|
8476
|
+
let argsText;
|
|
8477
|
+
if (typeof chunk.args === "string") {
|
|
8478
|
+
argsText = chunk.args;
|
|
8479
|
+
} else {
|
|
8480
|
+
const rawString = chunk.partial_json ?? ((_b2 = (_a3 = message.tool_call_chunks) == null ? void 0 : _a3.find((c) => c.id === chunk.id)) == null ? void 0 : _b2.args) ?? JSON.stringify(chunk.args);
|
|
8481
|
+
argsText = rawString;
|
|
8482
|
+
}
|
|
8483
|
+
return {
|
|
8484
|
+
type: "tool-call",
|
|
8485
|
+
toolCallId: chunk.id,
|
|
8486
|
+
toolName: chunk.name,
|
|
8487
|
+
args: typeof chunk.args === "string" ? parsePartialJsonObject(argsText) ?? {} : chunk.args,
|
|
8488
|
+
argsText
|
|
8489
|
+
};
|
|
8490
|
+
})) ?? [];
|
|
8491
|
+
const normalizedContent = typeof message.content === "string" ? [{ type: "text", text: message.content }] : message.content;
|
|
8492
|
+
const allContent = [
|
|
8493
|
+
(_b = message.additional_kwargs) == null ? void 0 : _b.reasoning,
|
|
8494
|
+
...normalizedContent,
|
|
8495
|
+
...((_c = message.additional_kwargs) == null ? void 0 : _c.tool_outputs) ?? []
|
|
8496
|
+
].filter((c) => c != null);
|
|
8497
|
+
return {
|
|
8498
|
+
role: "assistant",
|
|
8499
|
+
id: message.id,
|
|
8500
|
+
content: [...contentToParts(allContent), ...toolCallParts],
|
|
8501
|
+
...message.status && { status: message.status },
|
|
8502
|
+
...customMetadata && {
|
|
8503
|
+
metadata: {
|
|
8504
|
+
custom: customMetadata
|
|
8505
|
+
}
|
|
8506
|
+
}
|
|
8507
|
+
};
|
|
8508
|
+
}
|
|
8509
|
+
case "tool": {
|
|
8510
|
+
const subgraphMessages = getSubgraphMessages(message.artifact);
|
|
8511
|
+
const parentEnded = message.content !== void 0 && message.content !== null;
|
|
8512
|
+
const nestedMessages = subgraphMessages !== void 0 ? convertLangChainToThreadMessages(
|
|
8513
|
+
parseMessages(
|
|
8514
|
+
parentEnded ? autoCloseInFlightSubgraphMessages(subgraphMessages) : subgraphMessages
|
|
8515
|
+
),
|
|
8516
|
+
!parentEnded
|
|
8517
|
+
) : void 0;
|
|
8518
|
+
return {
|
|
8519
|
+
role: "tool",
|
|
8520
|
+
toolName: message.name,
|
|
8521
|
+
toolCallId: message.tool_call_id,
|
|
8522
|
+
result: message.content,
|
|
8523
|
+
artifact: message.artifact,
|
|
8524
|
+
isError: message.status === "error",
|
|
8525
|
+
...nestedMessages !== void 0 && { messages: nestedMessages }
|
|
8526
|
+
};
|
|
8527
|
+
}
|
|
8528
|
+
default:
|
|
8529
|
+
return null;
|
|
8530
|
+
}
|
|
8531
|
+
};
|
|
8532
|
+
const convertLangChainToThreadMessages = (messages, isRunning = false, metadata = {}) => {
|
|
8533
|
+
const validToolCallIds = /* @__PURE__ */ new Set();
|
|
8534
|
+
for (const message of messages) {
|
|
8535
|
+
if (message.type === "ai" && message.tool_calls) {
|
|
8536
|
+
for (const tc of message.tool_calls) {
|
|
8537
|
+
if (tc.id) {
|
|
8538
|
+
validToolCallIds.add(tc.id);
|
|
8539
|
+
}
|
|
8540
|
+
}
|
|
8541
|
+
}
|
|
8542
|
+
}
|
|
8543
|
+
const filteredMessages = messages.filter((message) => {
|
|
8544
|
+
if (message.type === "tool" && message.tool_call_id && !validToolCallIds.has(message.tool_call_id)) {
|
|
8545
|
+
return false;
|
|
8546
|
+
}
|
|
8547
|
+
return true;
|
|
8548
|
+
});
|
|
8549
|
+
return convertExternalMessages(filteredMessages, convertLangChainMessage, isRunning, metadata);
|
|
8550
|
+
};
|
|
8507
8551
|
function getAuthHeaders(auth) {
|
|
8508
8552
|
if (auth.token) {
|
|
8509
8553
|
return { Authorization: `Bearer ${auth.token}` };
|
|
@@ -9093,12 +9137,12 @@ function useComposedRefs(...refs) {
|
|
|
9093
9137
|
return React__namespace.useCallback(composeRefs(...refs), refs);
|
|
9094
9138
|
}
|
|
9095
9139
|
// @__NO_SIDE_EFFECTS__
|
|
9096
|
-
function createSlot(ownerName) {
|
|
9097
|
-
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
9140
|
+
function createSlot$7(ownerName) {
|
|
9141
|
+
const SlotClone = /* @__PURE__ */ createSlotClone$7(ownerName);
|
|
9098
9142
|
const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
9099
9143
|
const { children, ...slotProps } = props;
|
|
9100
9144
|
const childrenArray = React__namespace.Children.toArray(children);
|
|
9101
|
-
const slottable = childrenArray.find(isSlottable);
|
|
9145
|
+
const slottable = childrenArray.find(isSlottable$7);
|
|
9102
9146
|
if (slottable) {
|
|
9103
9147
|
const newElement = slottable.props.children;
|
|
9104
9148
|
const newChildren = childrenArray.map((child) => {
|
|
@@ -9116,14 +9160,13 @@ function createSlot(ownerName) {
|
|
|
9116
9160
|
Slot2.displayName = `${ownerName}.Slot`;
|
|
9117
9161
|
return Slot2;
|
|
9118
9162
|
}
|
|
9119
|
-
var Slot = /* @__PURE__ */ createSlot("Slot");
|
|
9120
9163
|
// @__NO_SIDE_EFFECTS__
|
|
9121
|
-
function createSlotClone(ownerName) {
|
|
9164
|
+
function createSlotClone$7(ownerName) {
|
|
9122
9165
|
const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
|
|
9123
9166
|
const { children, ...slotProps } = props;
|
|
9124
9167
|
if (React__namespace.isValidElement(children)) {
|
|
9125
|
-
const childrenRef = getElementRef$
|
|
9126
|
-
const props2 = mergeProps(slotProps, children.props);
|
|
9168
|
+
const childrenRef = getElementRef$8(children);
|
|
9169
|
+
const props2 = mergeProps$7(slotProps, children.props);
|
|
9127
9170
|
if (children.type !== React__namespace.Fragment) {
|
|
9128
9171
|
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
9129
9172
|
}
|
|
@@ -9134,21 +9177,11 @@ function createSlotClone(ownerName) {
|
|
|
9134
9177
|
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
9135
9178
|
return SlotClone;
|
|
9136
9179
|
}
|
|
9137
|
-
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
9138
|
-
|
|
9139
|
-
|
|
9140
|
-
const Slottable2 = ({ children }) => {
|
|
9141
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
9142
|
-
};
|
|
9143
|
-
Slottable2.displayName = `${ownerName}.Slottable`;
|
|
9144
|
-
Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
|
|
9145
|
-
return Slottable2;
|
|
9146
|
-
}
|
|
9147
|
-
var Slottable$1 = /* @__PURE__ */ createSlottable("Slottable");
|
|
9148
|
-
function isSlottable(child) {
|
|
9149
|
-
return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
9180
|
+
var SLOTTABLE_IDENTIFIER$7 = Symbol("radix.slottable");
|
|
9181
|
+
function isSlottable$7(child) {
|
|
9182
|
+
return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$7;
|
|
9150
9183
|
}
|
|
9151
|
-
function mergeProps(slotProps, childProps) {
|
|
9184
|
+
function mergeProps$7(slotProps, childProps) {
|
|
9152
9185
|
const overrideProps = { ...childProps };
|
|
9153
9186
|
for (const propName in childProps) {
|
|
9154
9187
|
const slotPropValue = slotProps[propName];
|
|
@@ -9172,7 +9205,7 @@ function mergeProps(slotProps, childProps) {
|
|
|
9172
9205
|
}
|
|
9173
9206
|
return { ...slotProps, ...overrideProps };
|
|
9174
9207
|
}
|
|
9175
|
-
function getElementRef$
|
|
9208
|
+
function getElementRef$8(element) {
|
|
9176
9209
|
var _a2, _b;
|
|
9177
9210
|
let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
|
|
9178
9211
|
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
@@ -9206,7 +9239,7 @@ var NODES$6 = [
|
|
|
9206
9239
|
"ul"
|
|
9207
9240
|
];
|
|
9208
9241
|
var Primitive$6 = NODES$6.reduce((primitive, node) => {
|
|
9209
|
-
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
9242
|
+
const Slot2 = /* @__PURE__ */ createSlot$7(`Primitive.${node}`);
|
|
9210
9243
|
const Node4 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
9211
9244
|
const { asChild, ...primitiveProps } = props;
|
|
9212
9245
|
const Comp = asChild ? Slot2 : node;
|
|
@@ -9381,6 +9414,89 @@ function composeContextScopes$2(...scopes) {
|
|
|
9381
9414
|
createScope.scopeName = baseScope.scopeName;
|
|
9382
9415
|
return createScope;
|
|
9383
9416
|
}
|
|
9417
|
+
// @__NO_SIDE_EFFECTS__
|
|
9418
|
+
function createSlot$6(ownerName) {
|
|
9419
|
+
const SlotClone = /* @__PURE__ */ createSlotClone$6(ownerName);
|
|
9420
|
+
const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
9421
|
+
const { children, ...slotProps } = props;
|
|
9422
|
+
const childrenArray = React__namespace.Children.toArray(children);
|
|
9423
|
+
const slottable = childrenArray.find(isSlottable$6);
|
|
9424
|
+
if (slottable) {
|
|
9425
|
+
const newElement = slottable.props.children;
|
|
9426
|
+
const newChildren = childrenArray.map((child) => {
|
|
9427
|
+
if (child === slottable) {
|
|
9428
|
+
if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
|
|
9429
|
+
return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
|
|
9430
|
+
} else {
|
|
9431
|
+
return child;
|
|
9432
|
+
}
|
|
9433
|
+
});
|
|
9434
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
|
|
9435
|
+
}
|
|
9436
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
9437
|
+
});
|
|
9438
|
+
Slot2.displayName = `${ownerName}.Slot`;
|
|
9439
|
+
return Slot2;
|
|
9440
|
+
}
|
|
9441
|
+
// @__NO_SIDE_EFFECTS__
|
|
9442
|
+
function createSlotClone$6(ownerName) {
|
|
9443
|
+
const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
|
|
9444
|
+
const { children, ...slotProps } = props;
|
|
9445
|
+
if (React__namespace.isValidElement(children)) {
|
|
9446
|
+
const childrenRef = getElementRef$7(children);
|
|
9447
|
+
const props2 = mergeProps$6(slotProps, children.props);
|
|
9448
|
+
if (children.type !== React__namespace.Fragment) {
|
|
9449
|
+
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
9450
|
+
}
|
|
9451
|
+
return React__namespace.cloneElement(children, props2);
|
|
9452
|
+
}
|
|
9453
|
+
return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
|
|
9454
|
+
});
|
|
9455
|
+
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
9456
|
+
return SlotClone;
|
|
9457
|
+
}
|
|
9458
|
+
var SLOTTABLE_IDENTIFIER$6 = Symbol("radix.slottable");
|
|
9459
|
+
function isSlottable$6(child) {
|
|
9460
|
+
return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$6;
|
|
9461
|
+
}
|
|
9462
|
+
function mergeProps$6(slotProps, childProps) {
|
|
9463
|
+
const overrideProps = { ...childProps };
|
|
9464
|
+
for (const propName in childProps) {
|
|
9465
|
+
const slotPropValue = slotProps[propName];
|
|
9466
|
+
const childPropValue = childProps[propName];
|
|
9467
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
9468
|
+
if (isHandler) {
|
|
9469
|
+
if (slotPropValue && childPropValue) {
|
|
9470
|
+
overrideProps[propName] = (...args) => {
|
|
9471
|
+
const result = childPropValue(...args);
|
|
9472
|
+
slotPropValue(...args);
|
|
9473
|
+
return result;
|
|
9474
|
+
};
|
|
9475
|
+
} else if (slotPropValue) {
|
|
9476
|
+
overrideProps[propName] = slotPropValue;
|
|
9477
|
+
}
|
|
9478
|
+
} else if (propName === "style") {
|
|
9479
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
9480
|
+
} else if (propName === "className") {
|
|
9481
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
9482
|
+
}
|
|
9483
|
+
}
|
|
9484
|
+
return { ...slotProps, ...overrideProps };
|
|
9485
|
+
}
|
|
9486
|
+
function getElementRef$7(element) {
|
|
9487
|
+
var _a2, _b;
|
|
9488
|
+
let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
|
|
9489
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
9490
|
+
if (mayWarn) {
|
|
9491
|
+
return element.ref;
|
|
9492
|
+
}
|
|
9493
|
+
getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
|
|
9494
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
9495
|
+
if (mayWarn) {
|
|
9496
|
+
return element.props.ref;
|
|
9497
|
+
}
|
|
9498
|
+
return element.props.ref || element.ref;
|
|
9499
|
+
}
|
|
9384
9500
|
var NODES$5 = [
|
|
9385
9501
|
"a",
|
|
9386
9502
|
"button",
|
|
@@ -9401,7 +9517,7 @@ var NODES$5 = [
|
|
|
9401
9517
|
"ul"
|
|
9402
9518
|
];
|
|
9403
9519
|
var Primitive$5 = NODES$5.reduce((primitive, node) => {
|
|
9404
|
-
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
9520
|
+
const Slot2 = /* @__PURE__ */ createSlot$6(`Primitive.${node}`);
|
|
9405
9521
|
const Node4 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
9406
9522
|
const { asChild, ...primitiveProps } = props;
|
|
9407
9523
|
const Comp = asChild ? Slot2 : node;
|
|
@@ -9423,7 +9539,7 @@ var Presence = (props) => {
|
|
|
9423
9539
|
const { present, children } = props;
|
|
9424
9540
|
const presence = usePresence(present);
|
|
9425
9541
|
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React__namespace.Children.only(children);
|
|
9426
|
-
const ref = useComposedRefs(presence.ref, getElementRef(child));
|
|
9542
|
+
const ref = useComposedRefs(presence.ref, getElementRef$6(child));
|
|
9427
9543
|
const forceMount = typeof children === "function";
|
|
9428
9544
|
return forceMount || presence.isPresent ? React__namespace.cloneElement(child, { ref }) : null;
|
|
9429
9545
|
};
|
|
@@ -9522,7 +9638,7 @@ function usePresence(present) {
|
|
|
9522
9638
|
function getAnimationName(styles) {
|
|
9523
9639
|
return (styles == null ? void 0 : styles.animationName) || "none";
|
|
9524
9640
|
}
|
|
9525
|
-
function getElementRef(element) {
|
|
9641
|
+
function getElementRef$6(element) {
|
|
9526
9642
|
var _a2, _b;
|
|
9527
9643
|
let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
|
|
9528
9644
|
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
@@ -9675,6 +9791,89 @@ function getState(open) {
|
|
|
9675
9791
|
return open ? "open" : "closed";
|
|
9676
9792
|
}
|
|
9677
9793
|
var Root$1 = Collapsible$1;
|
|
9794
|
+
// @__NO_SIDE_EFFECTS__
|
|
9795
|
+
function createSlot$5(ownerName) {
|
|
9796
|
+
const SlotClone = /* @__PURE__ */ createSlotClone$5(ownerName);
|
|
9797
|
+
const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
9798
|
+
const { children, ...slotProps } = props;
|
|
9799
|
+
const childrenArray = React__namespace.Children.toArray(children);
|
|
9800
|
+
const slottable = childrenArray.find(isSlottable$5);
|
|
9801
|
+
if (slottable) {
|
|
9802
|
+
const newElement = slottable.props.children;
|
|
9803
|
+
const newChildren = childrenArray.map((child) => {
|
|
9804
|
+
if (child === slottable) {
|
|
9805
|
+
if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
|
|
9806
|
+
return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
|
|
9807
|
+
} else {
|
|
9808
|
+
return child;
|
|
9809
|
+
}
|
|
9810
|
+
});
|
|
9811
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
|
|
9812
|
+
}
|
|
9813
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
9814
|
+
});
|
|
9815
|
+
Slot2.displayName = `${ownerName}.Slot`;
|
|
9816
|
+
return Slot2;
|
|
9817
|
+
}
|
|
9818
|
+
// @__NO_SIDE_EFFECTS__
|
|
9819
|
+
function createSlotClone$5(ownerName) {
|
|
9820
|
+
const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
|
|
9821
|
+
const { children, ...slotProps } = props;
|
|
9822
|
+
if (React__namespace.isValidElement(children)) {
|
|
9823
|
+
const childrenRef = getElementRef$5(children);
|
|
9824
|
+
const props2 = mergeProps$5(slotProps, children.props);
|
|
9825
|
+
if (children.type !== React__namespace.Fragment) {
|
|
9826
|
+
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
9827
|
+
}
|
|
9828
|
+
return React__namespace.cloneElement(children, props2);
|
|
9829
|
+
}
|
|
9830
|
+
return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
|
|
9831
|
+
});
|
|
9832
|
+
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
9833
|
+
return SlotClone;
|
|
9834
|
+
}
|
|
9835
|
+
var SLOTTABLE_IDENTIFIER$5 = Symbol("radix.slottable");
|
|
9836
|
+
function isSlottable$5(child) {
|
|
9837
|
+
return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$5;
|
|
9838
|
+
}
|
|
9839
|
+
function mergeProps$5(slotProps, childProps) {
|
|
9840
|
+
const overrideProps = { ...childProps };
|
|
9841
|
+
for (const propName in childProps) {
|
|
9842
|
+
const slotPropValue = slotProps[propName];
|
|
9843
|
+
const childPropValue = childProps[propName];
|
|
9844
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
9845
|
+
if (isHandler) {
|
|
9846
|
+
if (slotPropValue && childPropValue) {
|
|
9847
|
+
overrideProps[propName] = (...args) => {
|
|
9848
|
+
const result = childPropValue(...args);
|
|
9849
|
+
slotPropValue(...args);
|
|
9850
|
+
return result;
|
|
9851
|
+
};
|
|
9852
|
+
} else if (slotPropValue) {
|
|
9853
|
+
overrideProps[propName] = slotPropValue;
|
|
9854
|
+
}
|
|
9855
|
+
} else if (propName === "style") {
|
|
9856
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
9857
|
+
} else if (propName === "className") {
|
|
9858
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
9859
|
+
}
|
|
9860
|
+
}
|
|
9861
|
+
return { ...slotProps, ...overrideProps };
|
|
9862
|
+
}
|
|
9863
|
+
function getElementRef$5(element) {
|
|
9864
|
+
var _a2, _b;
|
|
9865
|
+
let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
|
|
9866
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
9867
|
+
if (mayWarn) {
|
|
9868
|
+
return element.ref;
|
|
9869
|
+
}
|
|
9870
|
+
getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
|
|
9871
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
9872
|
+
if (mayWarn) {
|
|
9873
|
+
return element.props.ref;
|
|
9874
|
+
}
|
|
9875
|
+
return element.props.ref || element.ref;
|
|
9876
|
+
}
|
|
9678
9877
|
var NODES$4 = [
|
|
9679
9878
|
"a",
|
|
9680
9879
|
"button",
|
|
@@ -9695,7 +9894,7 @@ var NODES$4 = [
|
|
|
9695
9894
|
"ul"
|
|
9696
9895
|
];
|
|
9697
9896
|
var Primitive$4 = NODES$4.reduce((primitive, node) => {
|
|
9698
|
-
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
9897
|
+
const Slot2 = /* @__PURE__ */ createSlot$5(`Primitive.${node}`);
|
|
9699
9898
|
const Node4 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
9700
9899
|
const { asChild, ...primitiveProps } = props;
|
|
9701
9900
|
const Comp = asChild ? Slot2 : node;
|
|
@@ -9933,6 +10132,89 @@ function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
|
9933
10132
|
target.dispatchEvent(event);
|
|
9934
10133
|
}
|
|
9935
10134
|
}
|
|
10135
|
+
// @__NO_SIDE_EFFECTS__
|
|
10136
|
+
function createSlot$4(ownerName) {
|
|
10137
|
+
const SlotClone = /* @__PURE__ */ createSlotClone$4(ownerName);
|
|
10138
|
+
const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
10139
|
+
const { children, ...slotProps } = props;
|
|
10140
|
+
const childrenArray = React__namespace.Children.toArray(children);
|
|
10141
|
+
const slottable = childrenArray.find(isSlottable$4);
|
|
10142
|
+
if (slottable) {
|
|
10143
|
+
const newElement = slottable.props.children;
|
|
10144
|
+
const newChildren = childrenArray.map((child) => {
|
|
10145
|
+
if (child === slottable) {
|
|
10146
|
+
if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
|
|
10147
|
+
return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
|
|
10148
|
+
} else {
|
|
10149
|
+
return child;
|
|
10150
|
+
}
|
|
10151
|
+
});
|
|
10152
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
|
|
10153
|
+
}
|
|
10154
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
10155
|
+
});
|
|
10156
|
+
Slot2.displayName = `${ownerName}.Slot`;
|
|
10157
|
+
return Slot2;
|
|
10158
|
+
}
|
|
10159
|
+
// @__NO_SIDE_EFFECTS__
|
|
10160
|
+
function createSlotClone$4(ownerName) {
|
|
10161
|
+
const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
|
|
10162
|
+
const { children, ...slotProps } = props;
|
|
10163
|
+
if (React__namespace.isValidElement(children)) {
|
|
10164
|
+
const childrenRef = getElementRef$4(children);
|
|
10165
|
+
const props2 = mergeProps$4(slotProps, children.props);
|
|
10166
|
+
if (children.type !== React__namespace.Fragment) {
|
|
10167
|
+
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
10168
|
+
}
|
|
10169
|
+
return React__namespace.cloneElement(children, props2);
|
|
10170
|
+
}
|
|
10171
|
+
return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
|
|
10172
|
+
});
|
|
10173
|
+
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
10174
|
+
return SlotClone;
|
|
10175
|
+
}
|
|
10176
|
+
var SLOTTABLE_IDENTIFIER$4 = Symbol("radix.slottable");
|
|
10177
|
+
function isSlottable$4(child) {
|
|
10178
|
+
return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$4;
|
|
10179
|
+
}
|
|
10180
|
+
function mergeProps$4(slotProps, childProps) {
|
|
10181
|
+
const overrideProps = { ...childProps };
|
|
10182
|
+
for (const propName in childProps) {
|
|
10183
|
+
const slotPropValue = slotProps[propName];
|
|
10184
|
+
const childPropValue = childProps[propName];
|
|
10185
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
10186
|
+
if (isHandler) {
|
|
10187
|
+
if (slotPropValue && childPropValue) {
|
|
10188
|
+
overrideProps[propName] = (...args) => {
|
|
10189
|
+
const result = childPropValue(...args);
|
|
10190
|
+
slotPropValue(...args);
|
|
10191
|
+
return result;
|
|
10192
|
+
};
|
|
10193
|
+
} else if (slotPropValue) {
|
|
10194
|
+
overrideProps[propName] = slotPropValue;
|
|
10195
|
+
}
|
|
10196
|
+
} else if (propName === "style") {
|
|
10197
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
10198
|
+
} else if (propName === "className") {
|
|
10199
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
10200
|
+
}
|
|
10201
|
+
}
|
|
10202
|
+
return { ...slotProps, ...overrideProps };
|
|
10203
|
+
}
|
|
10204
|
+
function getElementRef$4(element) {
|
|
10205
|
+
var _a2, _b;
|
|
10206
|
+
let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
|
|
10207
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
10208
|
+
if (mayWarn) {
|
|
10209
|
+
return element.ref;
|
|
10210
|
+
}
|
|
10211
|
+
getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
|
|
10212
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
10213
|
+
if (mayWarn) {
|
|
10214
|
+
return element.props.ref;
|
|
10215
|
+
}
|
|
10216
|
+
return element.props.ref || element.ref;
|
|
10217
|
+
}
|
|
9936
10218
|
var NODES$3 = [
|
|
9937
10219
|
"a",
|
|
9938
10220
|
"button",
|
|
@@ -9953,7 +10235,7 @@ var NODES$3 = [
|
|
|
9953
10235
|
"ul"
|
|
9954
10236
|
];
|
|
9955
10237
|
var Primitive$3 = NODES$3.reduce((primitive, node) => {
|
|
9956
|
-
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
10238
|
+
const Slot2 = /* @__PURE__ */ createSlot$4(`Primitive.${node}`);
|
|
9957
10239
|
const Node4 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
9958
10240
|
const { asChild, ...primitiveProps } = props;
|
|
9959
10241
|
const Comp = asChild ? Slot2 : node;
|
|
@@ -9975,6 +10257,100 @@ var Portal$1 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
|
9975
10257
|
return container ? ReactDOM.createPortal(/* @__PURE__ */ jsxRuntime.jsx(Primitive$3.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
9976
10258
|
});
|
|
9977
10259
|
Portal$1.displayName = PORTAL_NAME$1;
|
|
10260
|
+
// @__NO_SIDE_EFFECTS__
|
|
10261
|
+
function createSlot$3(ownerName) {
|
|
10262
|
+
const SlotClone = /* @__PURE__ */ createSlotClone$3(ownerName);
|
|
10263
|
+
const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
10264
|
+
const { children, ...slotProps } = props;
|
|
10265
|
+
const childrenArray = React__namespace.Children.toArray(children);
|
|
10266
|
+
const slottable = childrenArray.find(isSlottable$3);
|
|
10267
|
+
if (slottable) {
|
|
10268
|
+
const newElement = slottable.props.children;
|
|
10269
|
+
const newChildren = childrenArray.map((child) => {
|
|
10270
|
+
if (child === slottable) {
|
|
10271
|
+
if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
|
|
10272
|
+
return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
|
|
10273
|
+
} else {
|
|
10274
|
+
return child;
|
|
10275
|
+
}
|
|
10276
|
+
});
|
|
10277
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
|
|
10278
|
+
}
|
|
10279
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
10280
|
+
});
|
|
10281
|
+
Slot2.displayName = `${ownerName}.Slot`;
|
|
10282
|
+
return Slot2;
|
|
10283
|
+
}
|
|
10284
|
+
var Slot = /* @__PURE__ */ createSlot$3("Slot");
|
|
10285
|
+
// @__NO_SIDE_EFFECTS__
|
|
10286
|
+
function createSlotClone$3(ownerName) {
|
|
10287
|
+
const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
|
|
10288
|
+
const { children, ...slotProps } = props;
|
|
10289
|
+
if (React__namespace.isValidElement(children)) {
|
|
10290
|
+
const childrenRef = getElementRef$3(children);
|
|
10291
|
+
const props2 = mergeProps$3(slotProps, children.props);
|
|
10292
|
+
if (children.type !== React__namespace.Fragment) {
|
|
10293
|
+
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
10294
|
+
}
|
|
10295
|
+
return React__namespace.cloneElement(children, props2);
|
|
10296
|
+
}
|
|
10297
|
+
return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
|
|
10298
|
+
});
|
|
10299
|
+
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
10300
|
+
return SlotClone;
|
|
10301
|
+
}
|
|
10302
|
+
var SLOTTABLE_IDENTIFIER$3 = Symbol("radix.slottable");
|
|
10303
|
+
// @__NO_SIDE_EFFECTS__
|
|
10304
|
+
function createSlottable$1(ownerName) {
|
|
10305
|
+
const Slottable2 = ({ children }) => {
|
|
10306
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
10307
|
+
};
|
|
10308
|
+
Slottable2.displayName = `${ownerName}.Slottable`;
|
|
10309
|
+
Slottable2.__radixId = SLOTTABLE_IDENTIFIER$3;
|
|
10310
|
+
return Slottable2;
|
|
10311
|
+
}
|
|
10312
|
+
var Slottable$1 = /* @__PURE__ */ createSlottable$1("Slottable");
|
|
10313
|
+
function isSlottable$3(child) {
|
|
10314
|
+
return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$3;
|
|
10315
|
+
}
|
|
10316
|
+
function mergeProps$3(slotProps, childProps) {
|
|
10317
|
+
const overrideProps = { ...childProps };
|
|
10318
|
+
for (const propName in childProps) {
|
|
10319
|
+
const slotPropValue = slotProps[propName];
|
|
10320
|
+
const childPropValue = childProps[propName];
|
|
10321
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
10322
|
+
if (isHandler) {
|
|
10323
|
+
if (slotPropValue && childPropValue) {
|
|
10324
|
+
overrideProps[propName] = (...args) => {
|
|
10325
|
+
const result = childPropValue(...args);
|
|
10326
|
+
slotPropValue(...args);
|
|
10327
|
+
return result;
|
|
10328
|
+
};
|
|
10329
|
+
} else if (slotPropValue) {
|
|
10330
|
+
overrideProps[propName] = slotPropValue;
|
|
10331
|
+
}
|
|
10332
|
+
} else if (propName === "style") {
|
|
10333
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
10334
|
+
} else if (propName === "className") {
|
|
10335
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
10336
|
+
}
|
|
10337
|
+
}
|
|
10338
|
+
return { ...slotProps, ...overrideProps };
|
|
10339
|
+
}
|
|
10340
|
+
function getElementRef$3(element) {
|
|
10341
|
+
var _a2, _b;
|
|
10342
|
+
let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
|
|
10343
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
10344
|
+
if (mayWarn) {
|
|
10345
|
+
return element.ref;
|
|
10346
|
+
}
|
|
10347
|
+
getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
|
|
10348
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
10349
|
+
if (mayWarn) {
|
|
10350
|
+
return element.props.ref;
|
|
10351
|
+
}
|
|
10352
|
+
return element.props.ref || element.ref;
|
|
10353
|
+
}
|
|
9978
10354
|
var shim$1 = { exports: {} };
|
|
9979
10355
|
var useSyncExternalStoreShim_production = {};
|
|
9980
10356
|
/**
|
|
@@ -12067,6 +12443,89 @@ const arrow$2 = (options, deps) => {
|
|
|
12067
12443
|
options: [options, deps]
|
|
12068
12444
|
};
|
|
12069
12445
|
};
|
|
12446
|
+
// @__NO_SIDE_EFFECTS__
|
|
12447
|
+
function createSlot$2(ownerName) {
|
|
12448
|
+
const SlotClone = /* @__PURE__ */ createSlotClone$2(ownerName);
|
|
12449
|
+
const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
12450
|
+
const { children, ...slotProps } = props;
|
|
12451
|
+
const childrenArray = React__namespace.Children.toArray(children);
|
|
12452
|
+
const slottable = childrenArray.find(isSlottable$2);
|
|
12453
|
+
if (slottable) {
|
|
12454
|
+
const newElement = slottable.props.children;
|
|
12455
|
+
const newChildren = childrenArray.map((child) => {
|
|
12456
|
+
if (child === slottable) {
|
|
12457
|
+
if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
|
|
12458
|
+
return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
|
|
12459
|
+
} else {
|
|
12460
|
+
return child;
|
|
12461
|
+
}
|
|
12462
|
+
});
|
|
12463
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
|
|
12464
|
+
}
|
|
12465
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
12466
|
+
});
|
|
12467
|
+
Slot2.displayName = `${ownerName}.Slot`;
|
|
12468
|
+
return Slot2;
|
|
12469
|
+
}
|
|
12470
|
+
// @__NO_SIDE_EFFECTS__
|
|
12471
|
+
function createSlotClone$2(ownerName) {
|
|
12472
|
+
const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
|
|
12473
|
+
const { children, ...slotProps } = props;
|
|
12474
|
+
if (React__namespace.isValidElement(children)) {
|
|
12475
|
+
const childrenRef = getElementRef$2(children);
|
|
12476
|
+
const props2 = mergeProps$2(slotProps, children.props);
|
|
12477
|
+
if (children.type !== React__namespace.Fragment) {
|
|
12478
|
+
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
12479
|
+
}
|
|
12480
|
+
return React__namespace.cloneElement(children, props2);
|
|
12481
|
+
}
|
|
12482
|
+
return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
|
|
12483
|
+
});
|
|
12484
|
+
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
12485
|
+
return SlotClone;
|
|
12486
|
+
}
|
|
12487
|
+
var SLOTTABLE_IDENTIFIER$2 = Symbol("radix.slottable");
|
|
12488
|
+
function isSlottable$2(child) {
|
|
12489
|
+
return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$2;
|
|
12490
|
+
}
|
|
12491
|
+
function mergeProps$2(slotProps, childProps) {
|
|
12492
|
+
const overrideProps = { ...childProps };
|
|
12493
|
+
for (const propName in childProps) {
|
|
12494
|
+
const slotPropValue = slotProps[propName];
|
|
12495
|
+
const childPropValue = childProps[propName];
|
|
12496
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
12497
|
+
if (isHandler) {
|
|
12498
|
+
if (slotPropValue && childPropValue) {
|
|
12499
|
+
overrideProps[propName] = (...args) => {
|
|
12500
|
+
const result = childPropValue(...args);
|
|
12501
|
+
slotPropValue(...args);
|
|
12502
|
+
return result;
|
|
12503
|
+
};
|
|
12504
|
+
} else if (slotPropValue) {
|
|
12505
|
+
overrideProps[propName] = slotPropValue;
|
|
12506
|
+
}
|
|
12507
|
+
} else if (propName === "style") {
|
|
12508
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
12509
|
+
} else if (propName === "className") {
|
|
12510
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
12511
|
+
}
|
|
12512
|
+
}
|
|
12513
|
+
return { ...slotProps, ...overrideProps };
|
|
12514
|
+
}
|
|
12515
|
+
function getElementRef$2(element) {
|
|
12516
|
+
var _a2, _b;
|
|
12517
|
+
let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
|
|
12518
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
12519
|
+
if (mayWarn) {
|
|
12520
|
+
return element.ref;
|
|
12521
|
+
}
|
|
12522
|
+
getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
|
|
12523
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
12524
|
+
if (mayWarn) {
|
|
12525
|
+
return element.props.ref;
|
|
12526
|
+
}
|
|
12527
|
+
return element.props.ref || element.ref;
|
|
12528
|
+
}
|
|
12070
12529
|
var NODES$2 = [
|
|
12071
12530
|
"a",
|
|
12072
12531
|
"button",
|
|
@@ -12087,7 +12546,7 @@ var NODES$2 = [
|
|
|
12087
12546
|
"ul"
|
|
12088
12547
|
];
|
|
12089
12548
|
var Primitive$2 = NODES$2.reduce((primitive, node) => {
|
|
12090
|
-
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
12549
|
+
const Slot2 = /* @__PURE__ */ createSlot$2(`Primitive.${node}`);
|
|
12091
12550
|
const Node4 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
12092
12551
|
const { asChild, ...primitiveProps } = props;
|
|
12093
12552
|
const Comp = asChild ? Slot2 : node;
|
|
@@ -12176,6 +12635,89 @@ function composeContextScopes$1(...scopes) {
|
|
|
12176
12635
|
createScope.scopeName = baseScope.scopeName;
|
|
12177
12636
|
return createScope;
|
|
12178
12637
|
}
|
|
12638
|
+
// @__NO_SIDE_EFFECTS__
|
|
12639
|
+
function createSlot$1(ownerName) {
|
|
12640
|
+
const SlotClone = /* @__PURE__ */ createSlotClone$1(ownerName);
|
|
12641
|
+
const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
12642
|
+
const { children, ...slotProps } = props;
|
|
12643
|
+
const childrenArray = React__namespace.Children.toArray(children);
|
|
12644
|
+
const slottable = childrenArray.find(isSlottable$1);
|
|
12645
|
+
if (slottable) {
|
|
12646
|
+
const newElement = slottable.props.children;
|
|
12647
|
+
const newChildren = childrenArray.map((child) => {
|
|
12648
|
+
if (child === slottable) {
|
|
12649
|
+
if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
|
|
12650
|
+
return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
|
|
12651
|
+
} else {
|
|
12652
|
+
return child;
|
|
12653
|
+
}
|
|
12654
|
+
});
|
|
12655
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
|
|
12656
|
+
}
|
|
12657
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
12658
|
+
});
|
|
12659
|
+
Slot2.displayName = `${ownerName}.Slot`;
|
|
12660
|
+
return Slot2;
|
|
12661
|
+
}
|
|
12662
|
+
// @__NO_SIDE_EFFECTS__
|
|
12663
|
+
function createSlotClone$1(ownerName) {
|
|
12664
|
+
const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
|
|
12665
|
+
const { children, ...slotProps } = props;
|
|
12666
|
+
if (React__namespace.isValidElement(children)) {
|
|
12667
|
+
const childrenRef = getElementRef$1(children);
|
|
12668
|
+
const props2 = mergeProps$1(slotProps, children.props);
|
|
12669
|
+
if (children.type !== React__namespace.Fragment) {
|
|
12670
|
+
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
12671
|
+
}
|
|
12672
|
+
return React__namespace.cloneElement(children, props2);
|
|
12673
|
+
}
|
|
12674
|
+
return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
|
|
12675
|
+
});
|
|
12676
|
+
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
12677
|
+
return SlotClone;
|
|
12678
|
+
}
|
|
12679
|
+
var SLOTTABLE_IDENTIFIER$1 = Symbol("radix.slottable");
|
|
12680
|
+
function isSlottable$1(child) {
|
|
12681
|
+
return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$1;
|
|
12682
|
+
}
|
|
12683
|
+
function mergeProps$1(slotProps, childProps) {
|
|
12684
|
+
const overrideProps = { ...childProps };
|
|
12685
|
+
for (const propName in childProps) {
|
|
12686
|
+
const slotPropValue = slotProps[propName];
|
|
12687
|
+
const childPropValue = childProps[propName];
|
|
12688
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
12689
|
+
if (isHandler) {
|
|
12690
|
+
if (slotPropValue && childPropValue) {
|
|
12691
|
+
overrideProps[propName] = (...args) => {
|
|
12692
|
+
const result = childPropValue(...args);
|
|
12693
|
+
slotPropValue(...args);
|
|
12694
|
+
return result;
|
|
12695
|
+
};
|
|
12696
|
+
} else if (slotPropValue) {
|
|
12697
|
+
overrideProps[propName] = slotPropValue;
|
|
12698
|
+
}
|
|
12699
|
+
} else if (propName === "style") {
|
|
12700
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
12701
|
+
} else if (propName === "className") {
|
|
12702
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
12703
|
+
}
|
|
12704
|
+
}
|
|
12705
|
+
return { ...slotProps, ...overrideProps };
|
|
12706
|
+
}
|
|
12707
|
+
function getElementRef$1(element) {
|
|
12708
|
+
var _a2, _b;
|
|
12709
|
+
let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
|
|
12710
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
12711
|
+
if (mayWarn) {
|
|
12712
|
+
return element.ref;
|
|
12713
|
+
}
|
|
12714
|
+
getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
|
|
12715
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
12716
|
+
if (mayWarn) {
|
|
12717
|
+
return element.props.ref;
|
|
12718
|
+
}
|
|
12719
|
+
return element.props.ref || element.ref;
|
|
12720
|
+
}
|
|
12179
12721
|
var NODES$1 = [
|
|
12180
12722
|
"a",
|
|
12181
12723
|
"button",
|
|
@@ -12196,7 +12738,7 @@ var NODES$1 = [
|
|
|
12196
12738
|
"ul"
|
|
12197
12739
|
];
|
|
12198
12740
|
var Primitive$1 = NODES$1.reduce((primitive, node) => {
|
|
12199
|
-
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
12741
|
+
const Slot2 = /* @__PURE__ */ createSlot$1(`Primitive.${node}`);
|
|
12200
12742
|
const Node4 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
12201
12743
|
const { asChild, ...primitiveProps } = props;
|
|
12202
12744
|
const Comp = asChild ? Slot2 : node;
|
|
@@ -12538,6 +13080,98 @@ function composeContextScopes(...scopes) {
|
|
|
12538
13080
|
createScope.scopeName = baseScope.scopeName;
|
|
12539
13081
|
return createScope;
|
|
12540
13082
|
}
|
|
13083
|
+
// @__NO_SIDE_EFFECTS__
|
|
13084
|
+
function createSlot(ownerName) {
|
|
13085
|
+
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
13086
|
+
const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
13087
|
+
const { children, ...slotProps } = props;
|
|
13088
|
+
const childrenArray = React__namespace.Children.toArray(children);
|
|
13089
|
+
const slottable = childrenArray.find(isSlottable);
|
|
13090
|
+
if (slottable) {
|
|
13091
|
+
const newElement = slottable.props.children;
|
|
13092
|
+
const newChildren = childrenArray.map((child) => {
|
|
13093
|
+
if (child === slottable) {
|
|
13094
|
+
if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
|
|
13095
|
+
return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
|
|
13096
|
+
} else {
|
|
13097
|
+
return child;
|
|
13098
|
+
}
|
|
13099
|
+
});
|
|
13100
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
|
|
13101
|
+
}
|
|
13102
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
13103
|
+
});
|
|
13104
|
+
Slot2.displayName = `${ownerName}.Slot`;
|
|
13105
|
+
return Slot2;
|
|
13106
|
+
}
|
|
13107
|
+
// @__NO_SIDE_EFFECTS__
|
|
13108
|
+
function createSlotClone(ownerName) {
|
|
13109
|
+
const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
|
|
13110
|
+
const { children, ...slotProps } = props;
|
|
13111
|
+
if (React__namespace.isValidElement(children)) {
|
|
13112
|
+
const childrenRef = getElementRef(children);
|
|
13113
|
+
const props2 = mergeProps(slotProps, children.props);
|
|
13114
|
+
if (children.type !== React__namespace.Fragment) {
|
|
13115
|
+
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
13116
|
+
}
|
|
13117
|
+
return React__namespace.cloneElement(children, props2);
|
|
13118
|
+
}
|
|
13119
|
+
return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
|
|
13120
|
+
});
|
|
13121
|
+
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
13122
|
+
return SlotClone;
|
|
13123
|
+
}
|
|
13124
|
+
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
13125
|
+
// @__NO_SIDE_EFFECTS__
|
|
13126
|
+
function createSlottable(ownerName) {
|
|
13127
|
+
const Slottable2 = ({ children }) => {
|
|
13128
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
13129
|
+
};
|
|
13130
|
+
Slottable2.displayName = `${ownerName}.Slottable`;
|
|
13131
|
+
Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
|
|
13132
|
+
return Slottable2;
|
|
13133
|
+
}
|
|
13134
|
+
function isSlottable(child) {
|
|
13135
|
+
return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
13136
|
+
}
|
|
13137
|
+
function mergeProps(slotProps, childProps) {
|
|
13138
|
+
const overrideProps = { ...childProps };
|
|
13139
|
+
for (const propName in childProps) {
|
|
13140
|
+
const slotPropValue = slotProps[propName];
|
|
13141
|
+
const childPropValue = childProps[propName];
|
|
13142
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
13143
|
+
if (isHandler) {
|
|
13144
|
+
if (slotPropValue && childPropValue) {
|
|
13145
|
+
overrideProps[propName] = (...args) => {
|
|
13146
|
+
const result = childPropValue(...args);
|
|
13147
|
+
slotPropValue(...args);
|
|
13148
|
+
return result;
|
|
13149
|
+
};
|
|
13150
|
+
} else if (slotPropValue) {
|
|
13151
|
+
overrideProps[propName] = slotPropValue;
|
|
13152
|
+
}
|
|
13153
|
+
} else if (propName === "style") {
|
|
13154
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
13155
|
+
} else if (propName === "className") {
|
|
13156
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
13157
|
+
}
|
|
13158
|
+
}
|
|
13159
|
+
return { ...slotProps, ...overrideProps };
|
|
13160
|
+
}
|
|
13161
|
+
function getElementRef(element) {
|
|
13162
|
+
var _a2, _b;
|
|
13163
|
+
let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
|
|
13164
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
13165
|
+
if (mayWarn) {
|
|
13166
|
+
return element.ref;
|
|
13167
|
+
}
|
|
13168
|
+
getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
|
|
13169
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
13170
|
+
if (mayWarn) {
|
|
13171
|
+
return element.props.ref;
|
|
13172
|
+
}
|
|
13173
|
+
return element.props.ref || element.ref;
|
|
13174
|
+
}
|
|
12541
13175
|
var NODES = [
|
|
12542
13176
|
"a",
|
|
12543
13177
|
"button",
|
|
@@ -48926,6 +49560,43 @@ function CollapsibleTrigger({ ...props }) {
|
|
|
48926
49560
|
function CollapsibleContent({ ...props }) {
|
|
48927
49561
|
return /* @__PURE__ */ jsxRuntime.jsx(CollapsibleContent$1, { "data-slot": "collapsible-content", ...props });
|
|
48928
49562
|
}
|
|
49563
|
+
const NestedPtcComponentsContext = React.createContext(null);
|
|
49564
|
+
const NestedPtcComponentsProvider = ({ components, children }) => /* @__PURE__ */ jsxRuntime.jsx(NestedPtcComponentsContext.Provider, { value: components, children });
|
|
49565
|
+
const useNestedPtcComponents = (fallback) => {
|
|
49566
|
+
const components = React.useContext(NestedPtcComponentsContext);
|
|
49567
|
+
return React.useMemo(() => {
|
|
49568
|
+
const standardComponents = components && "ChainOfThought" in components && components.ChainOfThought ? void 0 : components;
|
|
49569
|
+
return {
|
|
49570
|
+
...standardComponents ?? {},
|
|
49571
|
+
tools: {
|
|
49572
|
+
...(standardComponents == null ? void 0 : standardComponents.tools) ?? {},
|
|
49573
|
+
Fallback: fallback
|
|
49574
|
+
}
|
|
49575
|
+
};
|
|
49576
|
+
}, [components, fallback]);
|
|
49577
|
+
};
|
|
49578
|
+
const EmptyComponent = () => null;
|
|
49579
|
+
const NestedPtcMessages = ({
|
|
49580
|
+
components,
|
|
49581
|
+
messageClassName
|
|
49582
|
+
}) => {
|
|
49583
|
+
const propsRef = React.useRef({ components, messageClassName });
|
|
49584
|
+
propsRef.current = { components, messageClassName };
|
|
49585
|
+
const messageComponents = React.useMemo(() => {
|
|
49586
|
+
const NestedMessage = () => {
|
|
49587
|
+
const { components: components2, messageClassName: messageClassName2 } = propsRef.current;
|
|
49588
|
+
const parts = /* @__PURE__ */ jsxRuntime.jsx(
|
|
49589
|
+
react$1.MessagePrimitive.Parts,
|
|
49590
|
+
{
|
|
49591
|
+
components: { Empty: EmptyComponent, ...components2 }
|
|
49592
|
+
}
|
|
49593
|
+
);
|
|
49594
|
+
return messageClassName2 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: messageClassName2, children: parts }) : parts;
|
|
49595
|
+
};
|
|
49596
|
+
return { Message: NestedMessage };
|
|
49597
|
+
}, []);
|
|
49598
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react$1.MessagePartPrimitive.Messages, { components: messageComponents });
|
|
49599
|
+
};
|
|
48929
49600
|
const ANIMATION_DURATION = 200;
|
|
48930
49601
|
function truncateLine(text2, max2 = 70) {
|
|
48931
49602
|
const oneLine = text2.replace(/\s+/g, " ").trim();
|
|
@@ -49474,16 +50145,20 @@ const ToolFallbackImpl = ({
|
|
|
49474
50145
|
status
|
|
49475
50146
|
}) => {
|
|
49476
50147
|
const isCancelled = (status == null ? void 0 : status.type) === "incomplete" && status.reason === "cancelled";
|
|
50148
|
+
const nestedComponents = useNestedPtcComponents(ToolFallback);
|
|
49477
50149
|
if (isAssetTool(toolName, result)) {
|
|
49478
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
49479
|
-
|
|
49480
|
-
|
|
49481
|
-
|
|
49482
|
-
|
|
49483
|
-
|
|
49484
|
-
|
|
49485
|
-
|
|
49486
|
-
|
|
50150
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
50151
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
50152
|
+
AssetToolCard,
|
|
50153
|
+
{
|
|
50154
|
+
toolName,
|
|
50155
|
+
argsText,
|
|
50156
|
+
result,
|
|
50157
|
+
status
|
|
50158
|
+
}
|
|
50159
|
+
),
|
|
50160
|
+
/* @__PURE__ */ jsxRuntime.jsx(NestedPtcMessages, { components: nestedComponents })
|
|
50161
|
+
] });
|
|
49487
50162
|
}
|
|
49488
50163
|
const isComplete = (status == null ? void 0 : status.type) === "complete" || !status;
|
|
49489
50164
|
const resultAssetId = extractAssetId$1(result);
|
|
@@ -49508,6 +50183,7 @@ const ToolFallbackImpl = ({
|
|
|
49508
50183
|
}
|
|
49509
50184
|
),
|
|
49510
50185
|
!isCancelled && /* @__PURE__ */ jsxRuntime.jsx(ToolFallbackResult, { result }),
|
|
50186
|
+
/* @__PURE__ */ jsxRuntime.jsx(NestedPtcMessages, { components: nestedComponents }),
|
|
49511
50187
|
!isCancelled && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end px-3 pt-1", children: /* @__PURE__ */ jsxRuntime.jsx(CopyToolSpec, { toolName, argsText, result }) })
|
|
49512
50188
|
] })
|
|
49513
50189
|
]
|
|
@@ -52400,14 +53076,14 @@ const useAthenaChatDefaultComponents = () => {
|
|
|
52400
53076
|
return value;
|
|
52401
53077
|
};
|
|
52402
53078
|
const AthenaDefaultAssistantMessage = () => {
|
|
52403
|
-
const { toolUIs, TextComponent, ReasoningComponent, EmptyComponent, ActionBarComponent } = useAthenaChatDefaultComponents();
|
|
53079
|
+
const { toolUIs, TextComponent, ReasoningComponent, EmptyComponent: EmptyComponent2, ActionBarComponent } = useAthenaChatDefaultComponents();
|
|
52404
53080
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
52405
53081
|
AthenaAssistantMessage,
|
|
52406
53082
|
{
|
|
52407
53083
|
toolUIs,
|
|
52408
53084
|
TextComponent,
|
|
52409
53085
|
ReasoningComponent,
|
|
52410
|
-
EmptyComponent,
|
|
53086
|
+
EmptyComponent: EmptyComponent2,
|
|
52411
53087
|
ActionBarComponent
|
|
52412
53088
|
}
|
|
52413
53089
|
);
|
|
@@ -52432,6 +53108,16 @@ const getReasoningTokensFromMetadata = (metadata) => {
|
|
|
52432
53108
|
return typeof reasoningTokens === "number" && Number.isFinite(reasoningTokens) ? reasoningTokens : void 0;
|
|
52433
53109
|
};
|
|
52434
53110
|
const formatReasoningTokens = (reasoningTokens) => `${reasoningTokens.toLocaleString("en-US")} ${reasoningTokens === 1 ? "token" : "tokens"}`;
|
|
53111
|
+
const withNestedPtcMessages = (ToolUI) => {
|
|
53112
|
+
const ToolUIWithNestedPtcMessages = (props) => {
|
|
53113
|
+
const nestedComponents = useNestedPtcComponents(ToolFallback);
|
|
53114
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
53115
|
+
/* @__PURE__ */ jsxRuntime.jsx(ToolUI, { ...props }),
|
|
53116
|
+
/* @__PURE__ */ jsxRuntime.jsx(NestedPtcMessages, { components: nestedComponents })
|
|
53117
|
+
] });
|
|
53118
|
+
};
|
|
53119
|
+
return ToolUIWithNestedPtcMessages;
|
|
53120
|
+
};
|
|
52435
53121
|
const SuggestionCard = ({
|
|
52436
53122
|
suggestion,
|
|
52437
53123
|
index: index2
|
|
@@ -52787,10 +53473,29 @@ const AthenaAssistantMessage = ({
|
|
|
52787
53473
|
toolUIs,
|
|
52788
53474
|
TextComponent = TiptapText,
|
|
52789
53475
|
ReasoningComponent,
|
|
52790
|
-
EmptyComponent = AthenaAssistantMessageEmpty,
|
|
53476
|
+
EmptyComponent: EmptyComponent2 = AthenaAssistantMessageEmpty,
|
|
52791
53477
|
ActionBarComponent = AthenaAssistantActionBar
|
|
52792
53478
|
}) => {
|
|
52793
53479
|
const effectiveReasoningComponent = ReasoningComponent ?? AthenaReasoningPart;
|
|
53480
|
+
const toolUIsWithNestedMessages = React.useMemo(() => {
|
|
53481
|
+
const wrappedToolUIs = {};
|
|
53482
|
+
for (const [toolName, ToolUI] of Object.entries(toolUIs)) {
|
|
53483
|
+
wrappedToolUIs[toolName] = withNestedPtcMessages(ToolUI);
|
|
53484
|
+
}
|
|
53485
|
+
return wrappedToolUIs;
|
|
53486
|
+
}, [toolUIs]);
|
|
53487
|
+
const partsComponents = React.useMemo(
|
|
53488
|
+
() => ({
|
|
53489
|
+
Text: TextComponent,
|
|
53490
|
+
Reasoning: effectiveReasoningComponent,
|
|
53491
|
+
tools: {
|
|
53492
|
+
Fallback: ToolFallback,
|
|
53493
|
+
by_name: toolUIsWithNestedMessages
|
|
53494
|
+
},
|
|
53495
|
+
Empty: EmptyComponent2
|
|
53496
|
+
}),
|
|
53497
|
+
[EmptyComponent2, TextComponent, effectiveReasoningComponent, toolUIsWithNestedMessages]
|
|
53498
|
+
);
|
|
52794
53499
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
52795
53500
|
react$1.MessagePrimitive.Root,
|
|
52796
53501
|
{
|
|
@@ -52798,20 +53503,7 @@ const AthenaAssistantMessage = ({
|
|
|
52798
53503
|
"data-role": "assistant",
|
|
52799
53504
|
children: [
|
|
52800
53505
|
/* @__PURE__ */ jsxRuntime.jsx(AthenaReasoningTextComponentContext.Provider, { value: TextComponent, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "aui-assistant-message-content wrap-break-word px-2 text-foreground leading-relaxed", children: [
|
|
52801
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
52802
|
-
react$1.MessagePrimitive.Parts,
|
|
52803
|
-
{
|
|
52804
|
-
components: {
|
|
52805
|
-
Text: TextComponent,
|
|
52806
|
-
Reasoning: effectiveReasoningComponent,
|
|
52807
|
-
tools: {
|
|
52808
|
-
Fallback: ToolFallback,
|
|
52809
|
-
by_name: toolUIs
|
|
52810
|
-
},
|
|
52811
|
-
Empty: EmptyComponent
|
|
52812
|
-
}
|
|
52813
|
-
}
|
|
52814
|
-
),
|
|
53506
|
+
/* @__PURE__ */ jsxRuntime.jsx(NestedPtcComponentsProvider, { components: partsComponents, children: /* @__PURE__ */ jsxRuntime.jsx(react$1.MessagePrimitive.Parts, { components: partsComponents }) }),
|
|
52815
53507
|
/* @__PURE__ */ jsxRuntime.jsx(MessageError, {})
|
|
52816
53508
|
] }) }),
|
|
52817
53509
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "aui-assistant-message-footer mt-1 ml-2 flex", children: /* @__PURE__ */ jsxRuntime.jsx(ActionBarComponent, {}) })
|
|
@@ -53318,7 +54010,9 @@ exports.ExpandableSection = ExpandableSection;
|
|
|
53318
54010
|
exports.FileUploadButton = FileUploadButton;
|
|
53319
54011
|
exports.GetDatabaseTableSchemaToolUI = GetDatabaseTableSchemaToolUI;
|
|
53320
54012
|
exports.ListDatabaseTablesToolUI = ListDatabaseTablesToolUI;
|
|
54013
|
+
exports.NestedPtcMessages = NestedPtcMessages;
|
|
53321
54014
|
exports.OpenAssetToolUI = OpenAssetToolUI;
|
|
54015
|
+
exports.PTC_SUBCALL_DID_NOT_COMPLETE_MESSAGE = PTC_SUBCALL_DID_NOT_COMPLETE_MESSAGE;
|
|
53322
54016
|
exports.ReadAssetToolUI = ReadAssetToolUI;
|
|
53323
54017
|
exports.RunPythonCodeToolUI = RunPythonCodeToolUI;
|
|
53324
54018
|
exports.RunSqlToolUI = RunSqlToolUI;
|
|
@@ -53343,9 +54037,11 @@ exports.TooltipTrigger = TooltipTrigger;
|
|
|
53343
54037
|
exports.UpdateSheetRangeToolUI = UpdateSheetRangeToolUI;
|
|
53344
54038
|
exports.WebSearchToolUI = WebSearchToolUI;
|
|
53345
54039
|
exports.archiveThread = archiveThread;
|
|
54040
|
+
exports.autoCloseInFlightSubgraphMessages = autoCloseInFlightSubgraphMessages;
|
|
53346
54041
|
exports.buttonVariants = buttonVariants;
|
|
53347
54042
|
exports.clearAutoOpenedAssets = clearAutoOpenedAssets;
|
|
53348
54043
|
exports.cn = cn;
|
|
54044
|
+
exports.convertLangChainToThreadMessages = convertLangChainToThreadMessages;
|
|
53349
54045
|
exports.createAssetToolUI = createAssetToolUI;
|
|
53350
54046
|
exports.createThread = createThread;
|
|
53351
54047
|
exports.formatToolName = formatToolName;
|