@athenaintel/react 0.10.24 → 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 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}` };
@@ -8570,20 +8614,59 @@ function deserializeMessage(msg) {
8570
8614
  }
8571
8615
  return msg;
8572
8616
  }
8617
+ function getAuthMode(auth) {
8618
+ if (auth.token) {
8619
+ return "bearer";
8620
+ }
8621
+ if (auth.apiKey) {
8622
+ return "api-key";
8623
+ }
8624
+ return "none";
8625
+ }
8626
+ function getResponseErrorBody(response) {
8627
+ return response.text().catch(() => "");
8628
+ }
8573
8629
  async function getThreadState(backendUrl, auth, threadId) {
8574
8630
  const base2 = getAthenaApiBaseUrl(backendUrl);
8575
- const res = await fetch(`${base2}/api/unstable/threads/${threadId}`, {
8576
- method: "GET",
8577
- headers: { ...getAuthHeaders(auth) }
8631
+ const authMode = getAuthMode(auth);
8632
+ const endpoint = `${base2}/api/conversations/threads/get`;
8633
+ console.info("[AthenaSDK] Loading thread state from conversations API:", {
8634
+ threadId,
8635
+ endpoint,
8636
+ authMode,
8637
+ hasToken: Boolean(auth.token),
8638
+ hasApiKey: Boolean(auth.apiKey)
8639
+ });
8640
+ const res = await fetch(endpoint, {
8641
+ method: "POST",
8642
+ headers: { "Content-Type": "application/json", ...getAuthHeaders(auth) },
8643
+ body: JSON.stringify({
8644
+ thread_id: threadId,
8645
+ skip_cache: true
8646
+ })
8578
8647
  });
8579
8648
  if (!res.ok) {
8580
- throw new Error(`[AthenaSDK] Failed to get thread state: ${res.status}`);
8649
+ const body = await getResponseErrorBody(res);
8650
+ throw new Error(
8651
+ `[AthenaSDK] Failed to get thread state: ${res.status} (${authMode})${body ? `: ${body.slice(0, 300)}` : ""}`
8652
+ );
8581
8653
  }
8582
8654
  const data = await res.json();
8583
- if (Array.isArray(data.messages)) {
8584
- data.messages = data.messages.map(deserializeMessage);
8655
+ const thread = data.thread;
8656
+ if (data.thread_found === false || !thread) {
8657
+ return {
8658
+ thread_id: threadId,
8659
+ messages: []
8660
+ };
8585
8661
  }
8586
- return data;
8662
+ const channelValues = thread.channel_values ?? {};
8663
+ const rawMessages = Array.isArray(channelValues.messages) ? channelValues.messages : Array.isArray(thread.messages) ? thread.messages : [];
8664
+ return {
8665
+ ...channelValues,
8666
+ thread_id: thread.thread_id ?? threadId,
8667
+ messages: rawMessages.map(deserializeMessage),
8668
+ ...thread.state ? { status: thread.state } : {}
8669
+ };
8587
8670
  }
8588
8671
  async function archiveThread(backendUrl, auth, threadId) {
8589
8672
  const base2 = getAthenaApiBaseUrl(backendUrl);
@@ -8978,7 +9061,7 @@ const useAthenaRuntime = (config2) => {
8978
9061
  hasMessages: messageCount > 0
8979
9062
  });
8980
9063
  runtime.thread.importExternalState({
8981
- messages: state.messages
9064
+ ...state
8982
9065
  });
8983
9066
  console.log(
8984
9067
  "[AthenaSDK] importExternalState completed, runtime messages:",
@@ -46905,7 +46988,12 @@ const ComposerKeybinds = Extension.create({
46905
46988
  if (editor.isActive("bulletList") || editor.isActive("orderedList")) {
46906
46989
  return false;
46907
46990
  }
46908
- this.options.onSubmit();
46991
+ const submit = this.options.onSubmit;
46992
+ if (typeof window !== "undefined" && typeof window.requestAnimationFrame === "function") {
46993
+ window.requestAnimationFrame(() => submit());
46994
+ } else {
46995
+ submit();
46996
+ }
46909
46997
  return true;
46910
46998
  },
46911
46999
  "Shift-Enter": ({ editor }) => {
@@ -49472,6 +49560,43 @@ function CollapsibleTrigger({ ...props }) {
49472
49560
  function CollapsibleContent({ ...props }) {
49473
49561
  return /* @__PURE__ */ jsxRuntime.jsx(CollapsibleContent$1, { "data-slot": "collapsible-content", ...props });
49474
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
+ };
49475
49600
  const ANIMATION_DURATION = 200;
49476
49601
  function truncateLine(text2, max2 = 70) {
49477
49602
  const oneLine = text2.replace(/\s+/g, " ").trim();
@@ -50020,16 +50145,20 @@ const ToolFallbackImpl = ({
50020
50145
  status
50021
50146
  }) => {
50022
50147
  const isCancelled = (status == null ? void 0 : status.type) === "incomplete" && status.reason === "cancelled";
50148
+ const nestedComponents = useNestedPtcComponents(ToolFallback);
50023
50149
  if (isAssetTool(toolName, result)) {
50024
- return /* @__PURE__ */ jsxRuntime.jsx(
50025
- AssetToolCard,
50026
- {
50027
- toolName,
50028
- argsText,
50029
- result,
50030
- status
50031
- }
50032
- );
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
+ ] });
50033
50162
  }
50034
50163
  const isComplete = (status == null ? void 0 : status.type) === "complete" || !status;
50035
50164
  const resultAssetId = extractAssetId$1(result);
@@ -50054,6 +50183,7 @@ const ToolFallbackImpl = ({
50054
50183
  }
50055
50184
  ),
50056
50185
  !isCancelled && /* @__PURE__ */ jsxRuntime.jsx(ToolFallbackResult, { result }),
50186
+ /* @__PURE__ */ jsxRuntime.jsx(NestedPtcMessages, { components: nestedComponents }),
50057
50187
  !isCancelled && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end px-3 pt-1", children: /* @__PURE__ */ jsxRuntime.jsx(CopyToolSpec, { toolName, argsText, result }) })
50058
50188
  ] })
50059
50189
  ]
@@ -52946,14 +53076,14 @@ const useAthenaChatDefaultComponents = () => {
52946
53076
  return value;
52947
53077
  };
52948
53078
  const AthenaDefaultAssistantMessage = () => {
52949
- const { toolUIs, TextComponent, ReasoningComponent, EmptyComponent, ActionBarComponent } = useAthenaChatDefaultComponents();
53079
+ const { toolUIs, TextComponent, ReasoningComponent, EmptyComponent: EmptyComponent2, ActionBarComponent } = useAthenaChatDefaultComponents();
52950
53080
  return /* @__PURE__ */ jsxRuntime.jsx(
52951
53081
  AthenaAssistantMessage,
52952
53082
  {
52953
53083
  toolUIs,
52954
53084
  TextComponent,
52955
53085
  ReasoningComponent,
52956
- EmptyComponent,
53086
+ EmptyComponent: EmptyComponent2,
52957
53087
  ActionBarComponent
52958
53088
  }
52959
53089
  );
@@ -52978,6 +53108,16 @@ const getReasoningTokensFromMetadata = (metadata) => {
52978
53108
  return typeof reasoningTokens === "number" && Number.isFinite(reasoningTokens) ? reasoningTokens : void 0;
52979
53109
  };
52980
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
+ };
52981
53121
  const SuggestionCard = ({
52982
53122
  suggestion,
52983
53123
  index: index2
@@ -53333,10 +53473,29 @@ const AthenaAssistantMessage = ({
53333
53473
  toolUIs,
53334
53474
  TextComponent = TiptapText,
53335
53475
  ReasoningComponent,
53336
- EmptyComponent = AthenaAssistantMessageEmpty,
53476
+ EmptyComponent: EmptyComponent2 = AthenaAssistantMessageEmpty,
53337
53477
  ActionBarComponent = AthenaAssistantActionBar
53338
53478
  }) => {
53339
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
+ );
53340
53499
  return /* @__PURE__ */ jsxRuntime.jsxs(
53341
53500
  react$1.MessagePrimitive.Root,
53342
53501
  {
@@ -53344,20 +53503,7 @@ const AthenaAssistantMessage = ({
53344
53503
  "data-role": "assistant",
53345
53504
  children: [
53346
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: [
53347
- /* @__PURE__ */ jsxRuntime.jsx(
53348
- react$1.MessagePrimitive.Parts,
53349
- {
53350
- components: {
53351
- Text: TextComponent,
53352
- Reasoning: effectiveReasoningComponent,
53353
- tools: {
53354
- Fallback: ToolFallback,
53355
- by_name: toolUIs
53356
- },
53357
- Empty: EmptyComponent
53358
- }
53359
- }
53360
- ),
53506
+ /* @__PURE__ */ jsxRuntime.jsx(NestedPtcComponentsProvider, { components: partsComponents, children: /* @__PURE__ */ jsxRuntime.jsx(react$1.MessagePrimitive.Parts, { components: partsComponents }) }),
53361
53507
  /* @__PURE__ */ jsxRuntime.jsx(MessageError, {})
53362
53508
  ] }) }),
53363
53509
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aui-assistant-message-footer mt-1 ml-2 flex", children: /* @__PURE__ */ jsxRuntime.jsx(ActionBarComponent, {}) })
@@ -53864,7 +54010,9 @@ exports.ExpandableSection = ExpandableSection;
53864
54010
  exports.FileUploadButton = FileUploadButton;
53865
54011
  exports.GetDatabaseTableSchemaToolUI = GetDatabaseTableSchemaToolUI;
53866
54012
  exports.ListDatabaseTablesToolUI = ListDatabaseTablesToolUI;
54013
+ exports.NestedPtcMessages = NestedPtcMessages;
53867
54014
  exports.OpenAssetToolUI = OpenAssetToolUI;
54015
+ exports.PTC_SUBCALL_DID_NOT_COMPLETE_MESSAGE = PTC_SUBCALL_DID_NOT_COMPLETE_MESSAGE;
53868
54016
  exports.ReadAssetToolUI = ReadAssetToolUI;
53869
54017
  exports.RunPythonCodeToolUI = RunPythonCodeToolUI;
53870
54018
  exports.RunSqlToolUI = RunSqlToolUI;
@@ -53889,9 +54037,11 @@ exports.TooltipTrigger = TooltipTrigger;
53889
54037
  exports.UpdateSheetRangeToolUI = UpdateSheetRangeToolUI;
53890
54038
  exports.WebSearchToolUI = WebSearchToolUI;
53891
54039
  exports.archiveThread = archiveThread;
54040
+ exports.autoCloseInFlightSubgraphMessages = autoCloseInFlightSubgraphMessages;
53892
54041
  exports.buttonVariants = buttonVariants;
53893
54042
  exports.clearAutoOpenedAssets = clearAutoOpenedAssets;
53894
54043
  exports.cn = cn;
54044
+ exports.convertLangChainToThreadMessages = convertLangChainToThreadMessages;
53895
54045
  exports.createAssetToolUI = createAssetToolUI;
53896
54046
  exports.createThread = createThread;
53897
54047
  exports.formatToolName = formatToolName;