@rodrigocoliveira/agno-react 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/hooks/useAgnoToolExecution.d.ts +7 -11
- package/dist/hooks/useAgnoToolExecution.d.ts.map +1 -1
- package/dist/index.d.ts +3 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +645 -986
- package/dist/index.js.map +7 -10
- package/dist/index.mjs +564 -905
- package/dist/index.mjs.map +7 -10
- package/dist/ui/components/chart.d.ts +63 -0
- package/dist/ui/components/chart.d.ts.map +1 -0
- package/dist/ui/composed/agno-chat/agno-chat.d.ts +6 -4
- package/dist/ui/composed/agno-chat/agno-chat.d.ts.map +1 -1
- package/dist/ui/composed/agno-chat/tool-building-blocks.d.ts +0 -4
- package/dist/ui/composed/agno-chat/tool-building-blocks.d.ts.map +1 -1
- package/dist/ui/composed/agno-message/tools.d.ts.map +1 -1
- package/dist/ui/composed/generative-components/card-grid.d.ts +4 -0
- package/dist/ui/composed/generative-components/card-grid.d.ts.map +1 -0
- package/dist/ui/composed/generative-components/charts.d.ts +7 -0
- package/dist/ui/composed/generative-components/charts.d.ts.map +1 -0
- package/dist/ui/composed/index.d.ts +6 -2
- package/dist/ui/composed/index.d.ts.map +1 -1
- package/dist/ui/index.d.ts +8 -2
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui.js +586 -424
- package/dist/ui.js.map +9 -11
- package/dist/ui.mjs +606 -430
- package/dist/ui.mjs.map +9 -11
- package/package.json +8 -3
- package/dist/components/GenerativeUIRenderer.d.ts +0 -21
- package/dist/components/GenerativeUIRenderer.d.ts.map +0 -1
- package/dist/utils/component-registry.d.ts +0 -63
- package/dist/utils/component-registry.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -61,10 +61,6 @@ __export(exports_src, {
|
|
|
61
61
|
resultWithSmartChart: () => resultWithSmartChart,
|
|
62
62
|
resultWithCardGrid: () => resultWithCardGrid,
|
|
63
63
|
resultWithBarChart: () => resultWithBarChart,
|
|
64
|
-
registerChartComponent: () => registerChartComponent,
|
|
65
|
-
getCustomRender: () => getCustomRender,
|
|
66
|
-
getComponentRegistry: () => getComponentRegistry,
|
|
67
|
-
getChartComponent: () => getChartComponent,
|
|
68
64
|
createToolResult: () => createToolResult,
|
|
69
65
|
createTable: () => createTable,
|
|
70
66
|
createSmartChart: () => createSmartChart,
|
|
@@ -79,10 +75,7 @@ __export(exports_src, {
|
|
|
79
75
|
createAreaChart: () => createAreaChart,
|
|
80
76
|
byToolName: () => byToolName,
|
|
81
77
|
ToolHandlerProvider: () => ToolHandlerProvider,
|
|
82
|
-
ToolGenerativeUI: () => ToolGenerativeUI,
|
|
83
78
|
ToolDebugCard: () => ToolDebugCard,
|
|
84
|
-
GenerativeUIRenderer: () => GenerativeUIRenderer,
|
|
85
|
-
ComponentRegistry: () => ComponentRegistry,
|
|
86
79
|
AgnoProvider: () => AgnoProvider,
|
|
87
80
|
AgnoMessageTools: () => AgnoMessageTools,
|
|
88
81
|
AgnoMessageReferences: () => AgnoMessageReferences,
|
|
@@ -150,509 +143,6 @@ function ToolHandlerProvider({ handlers: initialHandlers = {}, children }) {
|
|
|
150
143
|
function useToolHandlers() {
|
|
151
144
|
return import_react2.useContext(ToolHandlerContext);
|
|
152
145
|
}
|
|
153
|
-
// src/components/GenerativeUIRenderer.tsx
|
|
154
|
-
var import_react4 = __toESM(require("react"));
|
|
155
|
-
|
|
156
|
-
// src/utils/component-registry.ts
|
|
157
|
-
class ComponentRegistry {
|
|
158
|
-
static instance;
|
|
159
|
-
components = new Map;
|
|
160
|
-
constructor() {}
|
|
161
|
-
static getInstance() {
|
|
162
|
-
if (!ComponentRegistry.instance) {
|
|
163
|
-
ComponentRegistry.instance = new ComponentRegistry;
|
|
164
|
-
}
|
|
165
|
-
return ComponentRegistry.instance;
|
|
166
|
-
}
|
|
167
|
-
register(type, renderer) {
|
|
168
|
-
this.components.set(type, renderer);
|
|
169
|
-
}
|
|
170
|
-
registerBatch(components) {
|
|
171
|
-
Object.entries(components).forEach(([type, renderer]) => {
|
|
172
|
-
this.register(type, renderer);
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
get(type) {
|
|
176
|
-
return this.components.get(type);
|
|
177
|
-
}
|
|
178
|
-
has(type) {
|
|
179
|
-
return this.components.has(type);
|
|
180
|
-
}
|
|
181
|
-
unregister(type) {
|
|
182
|
-
this.components.delete(type);
|
|
183
|
-
}
|
|
184
|
-
getRegisteredTypes() {
|
|
185
|
-
return Array.from(this.components.keys());
|
|
186
|
-
}
|
|
187
|
-
clear() {
|
|
188
|
-
this.components.clear();
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
function getComponentRegistry() {
|
|
192
|
-
return ComponentRegistry.getInstance();
|
|
193
|
-
}
|
|
194
|
-
function registerChartComponent(name, renderer) {
|
|
195
|
-
getComponentRegistry().register(`chart:${name}`, renderer);
|
|
196
|
-
}
|
|
197
|
-
function getChartComponent(name) {
|
|
198
|
-
return getComponentRegistry().get(`chart:${name}`);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
// src/hooks/useAgnoToolExecution.ts
|
|
202
|
-
var import_react3 = require("react");
|
|
203
|
-
var customRenderRegistry = new Map;
|
|
204
|
-
function registerCustomRender(renderFn) {
|
|
205
|
-
const key = `custom-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
206
|
-
customRenderRegistry.set(key, renderFn);
|
|
207
|
-
return key;
|
|
208
|
-
}
|
|
209
|
-
function getCustomRender(key) {
|
|
210
|
-
return customRenderRegistry.get(key);
|
|
211
|
-
}
|
|
212
|
-
function isToolHandlerResult(value) {
|
|
213
|
-
return value && typeof value === "object" && (("data" in value) || ("ui" in value));
|
|
214
|
-
}
|
|
215
|
-
function isUIComponentSpec(value) {
|
|
216
|
-
return value && typeof value === "object" && "type" in value;
|
|
217
|
-
}
|
|
218
|
-
function processToolResult(result, _tool) {
|
|
219
|
-
if (isToolHandlerResult(result)) {
|
|
220
|
-
const { data, ui } = result;
|
|
221
|
-
let uiComponent = undefined;
|
|
222
|
-
if (ui) {
|
|
223
|
-
if (ui.type === "custom" && typeof ui.render === "function") {
|
|
224
|
-
const renderKey = registerCustomRender(ui.render);
|
|
225
|
-
uiComponent = {
|
|
226
|
-
...ui,
|
|
227
|
-
renderKey,
|
|
228
|
-
render: undefined
|
|
229
|
-
};
|
|
230
|
-
} else {
|
|
231
|
-
uiComponent = ui;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
return {
|
|
235
|
-
resultData: typeof data === "string" ? data : JSON.stringify(data),
|
|
236
|
-
uiComponent
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
if (isUIComponentSpec(result)) {
|
|
240
|
-
let uiComponent;
|
|
241
|
-
if (result.type === "custom" && typeof result.render === "function") {
|
|
242
|
-
const renderKey = registerCustomRender(result.render);
|
|
243
|
-
uiComponent = {
|
|
244
|
-
...result,
|
|
245
|
-
renderKey,
|
|
246
|
-
render: undefined
|
|
247
|
-
};
|
|
248
|
-
} else {
|
|
249
|
-
uiComponent = result;
|
|
250
|
-
}
|
|
251
|
-
return {
|
|
252
|
-
resultData: JSON.stringify(result),
|
|
253
|
-
uiComponent
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
return {
|
|
257
|
-
resultData: typeof result === "string" ? result : JSON.stringify(result),
|
|
258
|
-
uiComponent: undefined
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
function useAgnoToolExecution(handlers = {}, autoExecute = true, options) {
|
|
262
|
-
const client = useAgnoClient();
|
|
263
|
-
const toolHandlerContext = useToolHandlers();
|
|
264
|
-
const isTeamMode = client.getConfig().mode === "team";
|
|
265
|
-
import_react3.useEffect(() => {
|
|
266
|
-
if (isTeamMode) {
|
|
267
|
-
console.warn("[useAgnoToolExecution] HITL (Human-in-the-Loop) frontend tool execution is not supported for teams. " + "Only agents support the continue endpoint. This hook will not function in team mode.");
|
|
268
|
-
}
|
|
269
|
-
}, [isTeamMode]);
|
|
270
|
-
const mergedHandlers = import_react3.useMemo(() => {
|
|
271
|
-
const globalHandlers = toolHandlerContext?.handlers || {};
|
|
272
|
-
return { ...globalHandlers, ...handlers };
|
|
273
|
-
}, [toolHandlerContext?.handlers, handlers]);
|
|
274
|
-
const [pendingTools, setPendingTools] = import_react3.useState([]);
|
|
275
|
-
const [isPaused, setIsPaused] = import_react3.useState(false);
|
|
276
|
-
const [isExecuting, setIsExecuting] = import_react3.useState(false);
|
|
277
|
-
const [executionError, setExecutionError] = import_react3.useState();
|
|
278
|
-
import_react3.useEffect(() => {
|
|
279
|
-
if (isTeamMode) {
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
const handleRunPaused = (event) => {
|
|
283
|
-
setIsPaused(true);
|
|
284
|
-
setPendingTools(event.tools);
|
|
285
|
-
setExecutionError(undefined);
|
|
286
|
-
};
|
|
287
|
-
const handleRunContinued = () => {
|
|
288
|
-
setIsPaused(false);
|
|
289
|
-
setPendingTools([]);
|
|
290
|
-
setIsExecuting(false);
|
|
291
|
-
setExecutionError(undefined);
|
|
292
|
-
};
|
|
293
|
-
client.on("run:paused", handleRunPaused);
|
|
294
|
-
client.on("run:continued", handleRunContinued);
|
|
295
|
-
return () => {
|
|
296
|
-
client.off("run:paused", handleRunPaused);
|
|
297
|
-
client.off("run:continued", handleRunContinued);
|
|
298
|
-
};
|
|
299
|
-
}, [client, isTeamMode]);
|
|
300
|
-
const executeAndContinue = import_react3.useCallback(async () => {
|
|
301
|
-
if (!isPaused || pendingTools.length === 0) {
|
|
302
|
-
console.warn("[useAgnoToolExecution] Cannot execute: no pending tools");
|
|
303
|
-
return;
|
|
304
|
-
}
|
|
305
|
-
setIsExecuting(true);
|
|
306
|
-
setExecutionError(undefined);
|
|
307
|
-
try {
|
|
308
|
-
const updatedTools = await Promise.all(pendingTools.map(async (tool) => {
|
|
309
|
-
const handler = mergedHandlers[tool.tool_name];
|
|
310
|
-
if (!handler) {
|
|
311
|
-
return {
|
|
312
|
-
...tool,
|
|
313
|
-
result: JSON.stringify({
|
|
314
|
-
error: `No handler registered for ${tool.tool_name}`
|
|
315
|
-
})
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
try {
|
|
319
|
-
const result = await handler(tool.tool_args);
|
|
320
|
-
const { resultData, uiComponent } = processToolResult(result, tool);
|
|
321
|
-
return {
|
|
322
|
-
...tool,
|
|
323
|
-
result: resultData,
|
|
324
|
-
ui_component: uiComponent
|
|
325
|
-
};
|
|
326
|
-
} catch (error) {
|
|
327
|
-
return {
|
|
328
|
-
...tool,
|
|
329
|
-
result: JSON.stringify({
|
|
330
|
-
error: error instanceof Error ? error.message : String(error)
|
|
331
|
-
})
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
}));
|
|
335
|
-
const toolsWithUI = updatedTools.filter((t) => t.ui_component);
|
|
336
|
-
if (toolsWithUI.length > 0) {
|
|
337
|
-
client.emit("ui:render", {
|
|
338
|
-
tools: updatedTools,
|
|
339
|
-
runId: client.getState().pausedRunId
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
client.addToolCallsToLastMessage(updatedTools);
|
|
343
|
-
await client.continueRun(updatedTools);
|
|
344
|
-
} catch (error) {
|
|
345
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
346
|
-
setExecutionError(errorMessage);
|
|
347
|
-
setIsExecuting(false);
|
|
348
|
-
throw error;
|
|
349
|
-
}
|
|
350
|
-
}, [client, mergedHandlers, isPaused, pendingTools]);
|
|
351
|
-
import_react3.useEffect(() => {
|
|
352
|
-
const handleSessionLoaded = async (_sessionId) => {
|
|
353
|
-
const messages = client.getMessages();
|
|
354
|
-
for (const message of messages) {
|
|
355
|
-
if (!message.tool_calls)
|
|
356
|
-
continue;
|
|
357
|
-
for (const tool of message.tool_calls) {
|
|
358
|
-
if (tool.ui_component)
|
|
359
|
-
continue;
|
|
360
|
-
if (options?.skipHydration?.includes(tool.tool_name))
|
|
361
|
-
continue;
|
|
362
|
-
const handler = mergedHandlers[tool.tool_name];
|
|
363
|
-
if (!handler)
|
|
364
|
-
continue;
|
|
365
|
-
try {
|
|
366
|
-
const result = await handler(tool.tool_args);
|
|
367
|
-
const { uiComponent } = processToolResult(result, tool);
|
|
368
|
-
if (uiComponent) {
|
|
369
|
-
client.hydrateToolCallUI(tool.tool_call_id, uiComponent);
|
|
370
|
-
}
|
|
371
|
-
} catch (err) {
|
|
372
|
-
console.error(`Failed to hydrate UI for ${tool.tool_name}:`, err);
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
};
|
|
377
|
-
client.on("session:loaded", handleSessionLoaded);
|
|
378
|
-
return () => {
|
|
379
|
-
client.off("session:loaded", handleSessionLoaded);
|
|
380
|
-
};
|
|
381
|
-
}, [client, mergedHandlers]);
|
|
382
|
-
const executeTools = import_react3.useCallback(async (tools) => {
|
|
383
|
-
return Promise.all(tools.map(async (tool) => {
|
|
384
|
-
const handler = mergedHandlers[tool.tool_name];
|
|
385
|
-
if (!handler)
|
|
386
|
-
return tool;
|
|
387
|
-
try {
|
|
388
|
-
const result = await handler(tool.tool_args);
|
|
389
|
-
const { resultData, uiComponent } = processToolResult(result, tool);
|
|
390
|
-
return {
|
|
391
|
-
...tool,
|
|
392
|
-
result: resultData,
|
|
393
|
-
ui_component: uiComponent
|
|
394
|
-
};
|
|
395
|
-
} catch (error) {
|
|
396
|
-
return {
|
|
397
|
-
...tool,
|
|
398
|
-
result: JSON.stringify({
|
|
399
|
-
error: error instanceof Error ? error.message : String(error)
|
|
400
|
-
})
|
|
401
|
-
};
|
|
402
|
-
}
|
|
403
|
-
}));
|
|
404
|
-
}, [mergedHandlers]);
|
|
405
|
-
const continueWithResults = import_react3.useCallback(async (tools, options2) => {
|
|
406
|
-
if (!isPaused) {
|
|
407
|
-
throw new Error("No paused run to continue");
|
|
408
|
-
}
|
|
409
|
-
setIsExecuting(true);
|
|
410
|
-
try {
|
|
411
|
-
await client.continueRun(tools, options2);
|
|
412
|
-
} catch (error) {
|
|
413
|
-
setIsExecuting(false);
|
|
414
|
-
throw error;
|
|
415
|
-
}
|
|
416
|
-
}, [client, isPaused]);
|
|
417
|
-
import_react3.useEffect(() => {
|
|
418
|
-
if (autoExecute && isPaused && !isExecuting && pendingTools.length > 0) {
|
|
419
|
-
executeAndContinue();
|
|
420
|
-
}
|
|
421
|
-
}, [autoExecute, isPaused, isExecuting, pendingTools.length, executeAndContinue]);
|
|
422
|
-
return {
|
|
423
|
-
isPaused,
|
|
424
|
-
isExecuting,
|
|
425
|
-
pendingTools,
|
|
426
|
-
executeAndContinue,
|
|
427
|
-
executeTools,
|
|
428
|
-
continueWithResults,
|
|
429
|
-
executionError
|
|
430
|
-
};
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
// src/components/GenerativeUIRenderer.tsx
|
|
434
|
-
var jsx_runtime3 = require("react/jsx-runtime");
|
|
435
|
-
|
|
436
|
-
class UIErrorBoundary extends import_react4.default.Component {
|
|
437
|
-
constructor(props) {
|
|
438
|
-
super(props);
|
|
439
|
-
this.state = { hasError: false };
|
|
440
|
-
}
|
|
441
|
-
static getDerivedStateFromError(error) {
|
|
442
|
-
return { hasError: true, error };
|
|
443
|
-
}
|
|
444
|
-
componentDidCatch(error, errorInfo) {
|
|
445
|
-
console.error("[GenerativeUIRenderer] Error rendering component:", error, errorInfo);
|
|
446
|
-
this.props.onError?.(error);
|
|
447
|
-
}
|
|
448
|
-
render() {
|
|
449
|
-
if (this.state.hasError) {
|
|
450
|
-
return this.props.fallback || /* @__PURE__ */ jsx_runtime3.jsxs("div", {
|
|
451
|
-
className: "p-4 border border-red-300 rounded-md bg-red-50 text-red-800",
|
|
452
|
-
children: [
|
|
453
|
-
/* @__PURE__ */ jsx_runtime3.jsx("p", {
|
|
454
|
-
className: "font-semibold",
|
|
455
|
-
children: "Failed to render UI component"
|
|
456
|
-
}),
|
|
457
|
-
/* @__PURE__ */ jsx_runtime3.jsx("p", {
|
|
458
|
-
className: "text-sm mt-1",
|
|
459
|
-
children: this.state.error?.message || "Unknown error"
|
|
460
|
-
})
|
|
461
|
-
]
|
|
462
|
-
});
|
|
463
|
-
}
|
|
464
|
-
return this.props.children;
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
function GenerativeUIRenderer({
|
|
468
|
-
spec,
|
|
469
|
-
className,
|
|
470
|
-
onError
|
|
471
|
-
}) {
|
|
472
|
-
const registry = getComponentRegistry();
|
|
473
|
-
if (spec.type === "custom") {
|
|
474
|
-
const customSpec = spec;
|
|
475
|
-
if (customSpec.renderKey) {
|
|
476
|
-
const renderFn = getCustomRender(customSpec.renderKey);
|
|
477
|
-
if (renderFn) {
|
|
478
|
-
return /* @__PURE__ */ jsx_runtime3.jsx(UIErrorBoundary, {
|
|
479
|
-
onError,
|
|
480
|
-
children: /* @__PURE__ */ jsx_runtime3.jsx("div", {
|
|
481
|
-
className,
|
|
482
|
-
children: renderFn(customSpec.props || {})
|
|
483
|
-
})
|
|
484
|
-
});
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
return /* @__PURE__ */ jsx_runtime3.jsxs("div", {
|
|
488
|
-
className: `p-4 border border-yellow-300 rounded-md bg-yellow-50 text-yellow-800 ${className || ""}`,
|
|
489
|
-
children: [
|
|
490
|
-
/* @__PURE__ */ jsx_runtime3.jsx("p", {
|
|
491
|
-
className: "font-semibold",
|
|
492
|
-
children: "Custom component not available"
|
|
493
|
-
}),
|
|
494
|
-
/* @__PURE__ */ jsx_runtime3.jsx("p", {
|
|
495
|
-
className: "text-sm mt-1",
|
|
496
|
-
children: "The custom render function for this component is not available."
|
|
497
|
-
})
|
|
498
|
-
]
|
|
499
|
-
});
|
|
500
|
-
}
|
|
501
|
-
if (spec.type === "chart") {
|
|
502
|
-
const chartSpec = spec;
|
|
503
|
-
const chartType = `chart:${chartSpec.component}`;
|
|
504
|
-
if (registry.has(chartType)) {
|
|
505
|
-
const ChartRenderer = registry.get(chartType);
|
|
506
|
-
return /* @__PURE__ */ jsx_runtime3.jsx(UIErrorBoundary, {
|
|
507
|
-
onError,
|
|
508
|
-
children: /* @__PURE__ */ jsx_runtime3.jsxs("div", {
|
|
509
|
-
className,
|
|
510
|
-
children: [
|
|
511
|
-
chartSpec.title && /* @__PURE__ */ jsx_runtime3.jsx("h3", {
|
|
512
|
-
className: "font-semibold mb-2",
|
|
513
|
-
children: chartSpec.title
|
|
514
|
-
}),
|
|
515
|
-
chartSpec.description && /* @__PURE__ */ jsx_runtime3.jsx("p", {
|
|
516
|
-
className: "text-sm text-gray-600 mb-4",
|
|
517
|
-
children: chartSpec.description
|
|
518
|
-
}),
|
|
519
|
-
/* @__PURE__ */ jsx_runtime3.jsx(ChartRenderer, {
|
|
520
|
-
...chartSpec.props
|
|
521
|
-
})
|
|
522
|
-
]
|
|
523
|
-
})
|
|
524
|
-
});
|
|
525
|
-
}
|
|
526
|
-
return /* @__PURE__ */ jsx_runtime3.jsxs("div", {
|
|
527
|
-
className: `p-4 border border-gray-300 rounded-md ${className || ""}`,
|
|
528
|
-
children: [
|
|
529
|
-
/* @__PURE__ */ jsx_runtime3.jsx("p", {
|
|
530
|
-
className: "font-semibold mb-2",
|
|
531
|
-
children: chartSpec.title || "Chart Data"
|
|
532
|
-
}),
|
|
533
|
-
chartSpec.description && /* @__PURE__ */ jsx_runtime3.jsx("p", {
|
|
534
|
-
className: "text-sm text-gray-600 mb-2",
|
|
535
|
-
children: chartSpec.description
|
|
536
|
-
}),
|
|
537
|
-
/* @__PURE__ */ jsx_runtime3.jsx("pre", {
|
|
538
|
-
className: "text-xs bg-gray-100 p-2 rounded overflow-auto",
|
|
539
|
-
children: JSON.stringify(chartSpec.props.data, null, 2)
|
|
540
|
-
})
|
|
541
|
-
]
|
|
542
|
-
});
|
|
543
|
-
}
|
|
544
|
-
if (spec.type === "card-grid") {
|
|
545
|
-
const cardGridSpec = spec;
|
|
546
|
-
if (registry.has("card-grid")) {
|
|
547
|
-
const CardGridRenderer = registry.get("card-grid");
|
|
548
|
-
return /* @__PURE__ */ jsx_runtime3.jsx(UIErrorBoundary, {
|
|
549
|
-
onError,
|
|
550
|
-
children: /* @__PURE__ */ jsx_runtime3.jsxs("div", {
|
|
551
|
-
className,
|
|
552
|
-
children: [
|
|
553
|
-
cardGridSpec.title && /* @__PURE__ */ jsx_runtime3.jsx("h3", {
|
|
554
|
-
className: "font-semibold mb-2",
|
|
555
|
-
children: cardGridSpec.title
|
|
556
|
-
}),
|
|
557
|
-
cardGridSpec.description && /* @__PURE__ */ jsx_runtime3.jsx("p", {
|
|
558
|
-
className: "text-sm text-gray-600 mb-4",
|
|
559
|
-
children: cardGridSpec.description
|
|
560
|
-
}),
|
|
561
|
-
/* @__PURE__ */ jsx_runtime3.jsx(CardGridRenderer, {
|
|
562
|
-
...cardGridSpec.props
|
|
563
|
-
})
|
|
564
|
-
]
|
|
565
|
-
})
|
|
566
|
-
});
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
if (spec.type === "table") {
|
|
570
|
-
const tableSpec = spec;
|
|
571
|
-
if (registry.has("table")) {
|
|
572
|
-
const TableRenderer = registry.get("table");
|
|
573
|
-
return /* @__PURE__ */ jsx_runtime3.jsx(UIErrorBoundary, {
|
|
574
|
-
onError,
|
|
575
|
-
children: /* @__PURE__ */ jsx_runtime3.jsxs("div", {
|
|
576
|
-
className,
|
|
577
|
-
children: [
|
|
578
|
-
tableSpec.title && /* @__PURE__ */ jsx_runtime3.jsx("h3", {
|
|
579
|
-
className: "font-semibold mb-2",
|
|
580
|
-
children: tableSpec.title
|
|
581
|
-
}),
|
|
582
|
-
tableSpec.description && /* @__PURE__ */ jsx_runtime3.jsx("p", {
|
|
583
|
-
className: "text-sm text-gray-600 mb-4",
|
|
584
|
-
children: tableSpec.description
|
|
585
|
-
}),
|
|
586
|
-
/* @__PURE__ */ jsx_runtime3.jsx(TableRenderer, {
|
|
587
|
-
...tableSpec.props
|
|
588
|
-
})
|
|
589
|
-
]
|
|
590
|
-
})
|
|
591
|
-
});
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
if (spec.type === "markdown") {
|
|
595
|
-
const markdownSpec = spec;
|
|
596
|
-
if (registry.has("markdown")) {
|
|
597
|
-
const MarkdownRenderer = registry.get("markdown");
|
|
598
|
-
return /* @__PURE__ */ jsx_runtime3.jsx(UIErrorBoundary, {
|
|
599
|
-
onError,
|
|
600
|
-
children: /* @__PURE__ */ jsx_runtime3.jsx("div", {
|
|
601
|
-
className,
|
|
602
|
-
children: /* @__PURE__ */ jsx_runtime3.jsx(MarkdownRenderer, {
|
|
603
|
-
...markdownSpec.props
|
|
604
|
-
})
|
|
605
|
-
})
|
|
606
|
-
});
|
|
607
|
-
}
|
|
608
|
-
return /* @__PURE__ */ jsx_runtime3.jsx("div", {
|
|
609
|
-
className,
|
|
610
|
-
children: markdownSpec.props.content
|
|
611
|
-
});
|
|
612
|
-
}
|
|
613
|
-
if (spec.type === "artifact") {
|
|
614
|
-
const artifactSpec = spec;
|
|
615
|
-
return /* @__PURE__ */ jsx_runtime3.jsx(UIErrorBoundary, {
|
|
616
|
-
onError,
|
|
617
|
-
children: /* @__PURE__ */ jsx_runtime3.jsxs("div", {
|
|
618
|
-
className: `p-4 border rounded-md ${className || ""}`,
|
|
619
|
-
children: [
|
|
620
|
-
artifactSpec.title && /* @__PURE__ */ jsx_runtime3.jsx("h3", {
|
|
621
|
-
className: "font-semibold mb-4",
|
|
622
|
-
children: artifactSpec.title
|
|
623
|
-
}),
|
|
624
|
-
artifactSpec.description && /* @__PURE__ */ jsx_runtime3.jsx("p", {
|
|
625
|
-
className: "text-sm text-gray-600 mb-4",
|
|
626
|
-
children: artifactSpec.description
|
|
627
|
-
}),
|
|
628
|
-
/* @__PURE__ */ jsx_runtime3.jsx("div", {
|
|
629
|
-
className: "space-y-4",
|
|
630
|
-
children: artifactSpec.props.content?.map((childSpec, index) => /* @__PURE__ */ jsx_runtime3.jsx(GenerativeUIRenderer, {
|
|
631
|
-
spec: childSpec,
|
|
632
|
-
onError
|
|
633
|
-
}, index))
|
|
634
|
-
})
|
|
635
|
-
]
|
|
636
|
-
})
|
|
637
|
-
});
|
|
638
|
-
}
|
|
639
|
-
return /* @__PURE__ */ jsx_runtime3.jsxs("div", {
|
|
640
|
-
className: `p-4 border border-gray-300 rounded-md ${className || ""}`,
|
|
641
|
-
children: [
|
|
642
|
-
/* @__PURE__ */ jsx_runtime3.jsx("p", {
|
|
643
|
-
className: "font-semibold",
|
|
644
|
-
children: "Unsupported UI component"
|
|
645
|
-
}),
|
|
646
|
-
/* @__PURE__ */ jsx_runtime3.jsxs("p", {
|
|
647
|
-
className: "text-sm text-gray-600 mt-1",
|
|
648
|
-
children: [
|
|
649
|
-
"Component type: ",
|
|
650
|
-
spec.type
|
|
651
|
-
]
|
|
652
|
-
})
|
|
653
|
-
]
|
|
654
|
-
});
|
|
655
|
-
}
|
|
656
146
|
// src/utils/ui-helpers.ts
|
|
657
147
|
function createBarChart(data, xKey, bars, options) {
|
|
658
148
|
return {
|
|
@@ -857,12 +347,12 @@ function resultWithTable(data, columns, options) {
|
|
|
857
347
|
return createToolResult(data, createTable(data, columns, options));
|
|
858
348
|
}
|
|
859
349
|
// src/hooks/useAgnoChat.ts
|
|
860
|
-
var
|
|
350
|
+
var import_react3 = require("react");
|
|
861
351
|
function useAgnoChat() {
|
|
862
352
|
const client = useAgnoClient();
|
|
863
|
-
const [messages, setMessages] =
|
|
864
|
-
const [state, setState] =
|
|
865
|
-
|
|
353
|
+
const [messages, setMessages] = import_react3.useState(client.getMessages());
|
|
354
|
+
const [state, setState] = import_react3.useState(client.getState());
|
|
355
|
+
import_react3.useEffect(() => {
|
|
866
356
|
const handleMessageUpdate = (updatedMessages) => {
|
|
867
357
|
setMessages(updatedMessages);
|
|
868
358
|
};
|
|
@@ -901,18 +391,18 @@ function useAgnoChat() {
|
|
|
901
391
|
client.off("run:cancelled", handleRunCancelled);
|
|
902
392
|
};
|
|
903
393
|
}, [client]);
|
|
904
|
-
const sendMessage =
|
|
394
|
+
const sendMessage = import_react3.useCallback(async (message, options) => {
|
|
905
395
|
try {
|
|
906
396
|
await client.sendMessage(message, options);
|
|
907
397
|
} catch (err) {
|
|
908
398
|
throw err;
|
|
909
399
|
}
|
|
910
400
|
}, [client]);
|
|
911
|
-
const clearMessages =
|
|
401
|
+
const clearMessages = import_react3.useCallback(() => {
|
|
912
402
|
client.clearMessages();
|
|
913
403
|
setMessages([]);
|
|
914
404
|
}, [client]);
|
|
915
|
-
const cancelRun =
|
|
405
|
+
const cancelRun = import_react3.useCallback(async () => {
|
|
916
406
|
await client.cancelRun();
|
|
917
407
|
}, [client]);
|
|
918
408
|
return {
|
|
@@ -930,14 +420,14 @@ function useAgnoChat() {
|
|
|
930
420
|
};
|
|
931
421
|
}
|
|
932
422
|
// src/hooks/useAgnoSession.ts
|
|
933
|
-
var
|
|
423
|
+
var import_react4 = require("react");
|
|
934
424
|
function useAgnoSession() {
|
|
935
425
|
const client = useAgnoClient();
|
|
936
|
-
const [sessions, setSessions] =
|
|
937
|
-
const [currentSessionId, setCurrentSessionId] =
|
|
938
|
-
const [isLoading, setIsLoading] =
|
|
939
|
-
const [error, setError] =
|
|
940
|
-
|
|
426
|
+
const [sessions, setSessions] = import_react4.useState([]);
|
|
427
|
+
const [currentSessionId, setCurrentSessionId] = import_react4.useState(client.getConfig().sessionId);
|
|
428
|
+
const [isLoading, setIsLoading] = import_react4.useState(false);
|
|
429
|
+
const [error, setError] = import_react4.useState();
|
|
430
|
+
import_react4.useEffect(() => {
|
|
941
431
|
const handleSessionLoaded = (sessionId) => {
|
|
942
432
|
setCurrentSessionId(sessionId);
|
|
943
433
|
};
|
|
@@ -961,7 +451,7 @@ function useAgnoSession() {
|
|
|
961
451
|
client.off("state:change", handleStateChange);
|
|
962
452
|
};
|
|
963
453
|
}, [client]);
|
|
964
|
-
const loadSession =
|
|
454
|
+
const loadSession = import_react4.useCallback(async (sessionId, options) => {
|
|
965
455
|
setIsLoading(true);
|
|
966
456
|
setError(undefined);
|
|
967
457
|
try {
|
|
@@ -976,7 +466,7 @@ function useAgnoSession() {
|
|
|
976
466
|
setIsLoading(false);
|
|
977
467
|
}
|
|
978
468
|
}, [client]);
|
|
979
|
-
const fetchSessions =
|
|
469
|
+
const fetchSessions = import_react4.useCallback(async (options) => {
|
|
980
470
|
setIsLoading(true);
|
|
981
471
|
setError(undefined);
|
|
982
472
|
try {
|
|
@@ -991,7 +481,7 @@ function useAgnoSession() {
|
|
|
991
481
|
setIsLoading(false);
|
|
992
482
|
}
|
|
993
483
|
}, [client]);
|
|
994
|
-
const getSessionById =
|
|
484
|
+
const getSessionById = import_react4.useCallback(async (sessionId, options) => {
|
|
995
485
|
setIsLoading(true);
|
|
996
486
|
setError(undefined);
|
|
997
487
|
try {
|
|
@@ -1004,7 +494,7 @@ function useAgnoSession() {
|
|
|
1004
494
|
setIsLoading(false);
|
|
1005
495
|
}
|
|
1006
496
|
}, [client]);
|
|
1007
|
-
const getRunById =
|
|
497
|
+
const getRunById = import_react4.useCallback(async (sessionId, runId, options) => {
|
|
1008
498
|
setIsLoading(true);
|
|
1009
499
|
setError(undefined);
|
|
1010
500
|
try {
|
|
@@ -1017,7 +507,7 @@ function useAgnoSession() {
|
|
|
1017
507
|
setIsLoading(false);
|
|
1018
508
|
}
|
|
1019
509
|
}, [client]);
|
|
1020
|
-
const createSession =
|
|
510
|
+
const createSession = import_react4.useCallback(async (request, options) => {
|
|
1021
511
|
setIsLoading(true);
|
|
1022
512
|
setError(undefined);
|
|
1023
513
|
try {
|
|
@@ -1031,7 +521,7 @@ function useAgnoSession() {
|
|
|
1031
521
|
setIsLoading(false);
|
|
1032
522
|
}
|
|
1033
523
|
}, [client]);
|
|
1034
|
-
const updateSession =
|
|
524
|
+
const updateSession = import_react4.useCallback(async (sessionId, request, options) => {
|
|
1035
525
|
setIsLoading(true);
|
|
1036
526
|
setError(undefined);
|
|
1037
527
|
try {
|
|
@@ -1044,7 +534,7 @@ function useAgnoSession() {
|
|
|
1044
534
|
setIsLoading(false);
|
|
1045
535
|
}
|
|
1046
536
|
}, [client]);
|
|
1047
|
-
const renameSession =
|
|
537
|
+
const renameSession = import_react4.useCallback(async (sessionId, newName, options) => {
|
|
1048
538
|
setIsLoading(true);
|
|
1049
539
|
setError(undefined);
|
|
1050
540
|
try {
|
|
@@ -1057,7 +547,7 @@ function useAgnoSession() {
|
|
|
1057
547
|
setIsLoading(false);
|
|
1058
548
|
}
|
|
1059
549
|
}, [client]);
|
|
1060
|
-
const deleteSession =
|
|
550
|
+
const deleteSession = import_react4.useCallback(async (sessionId, options) => {
|
|
1061
551
|
setIsLoading(true);
|
|
1062
552
|
setError(undefined);
|
|
1063
553
|
try {
|
|
@@ -1070,7 +560,7 @@ function useAgnoSession() {
|
|
|
1070
560
|
setIsLoading(false);
|
|
1071
561
|
}
|
|
1072
562
|
}, [client]);
|
|
1073
|
-
const deleteMultipleSessions =
|
|
563
|
+
const deleteMultipleSessions = import_react4.useCallback(async (sessionIds, options) => {
|
|
1074
564
|
setIsLoading(true);
|
|
1075
565
|
setError(undefined);
|
|
1076
566
|
try {
|
|
@@ -1100,12 +590,12 @@ function useAgnoSession() {
|
|
|
1100
590
|
};
|
|
1101
591
|
}
|
|
1102
592
|
// src/hooks/useAgnoActions.ts
|
|
1103
|
-
var
|
|
593
|
+
var import_react5 = require("react");
|
|
1104
594
|
function useAgnoActions() {
|
|
1105
595
|
const client = useAgnoClient();
|
|
1106
|
-
const [isInitializing, setIsInitializing] =
|
|
1107
|
-
const [error, setError] =
|
|
1108
|
-
const initialize =
|
|
596
|
+
const [isInitializing, setIsInitializing] = import_react5.useState(false);
|
|
597
|
+
const [error, setError] = import_react5.useState();
|
|
598
|
+
const initialize = import_react5.useCallback(async (options) => {
|
|
1109
599
|
setIsInitializing(true);
|
|
1110
600
|
setError(undefined);
|
|
1111
601
|
try {
|
|
@@ -1119,7 +609,7 @@ function useAgnoActions() {
|
|
|
1119
609
|
setIsInitializing(false);
|
|
1120
610
|
}
|
|
1121
611
|
}, [client]);
|
|
1122
|
-
const checkStatus =
|
|
612
|
+
const checkStatus = import_react5.useCallback(async (options) => {
|
|
1123
613
|
setError(undefined);
|
|
1124
614
|
try {
|
|
1125
615
|
return await client.checkStatus(options);
|
|
@@ -1128,38 +618,236 @@ function useAgnoActions() {
|
|
|
1128
618
|
setError(errorMessage);
|
|
1129
619
|
return false;
|
|
1130
620
|
}
|
|
1131
|
-
}, [client]);
|
|
1132
|
-
const fetchAgents =
|
|
1133
|
-
setError(undefined);
|
|
621
|
+
}, [client]);
|
|
622
|
+
const fetchAgents = import_react5.useCallback(async (options) => {
|
|
623
|
+
setError(undefined);
|
|
624
|
+
try {
|
|
625
|
+
return await client.fetchAgents(options);
|
|
626
|
+
} catch (err) {
|
|
627
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
628
|
+
setError(errorMessage);
|
|
629
|
+
throw err;
|
|
630
|
+
}
|
|
631
|
+
}, [client]);
|
|
632
|
+
const fetchTeams = import_react5.useCallback(async (options) => {
|
|
633
|
+
setError(undefined);
|
|
634
|
+
try {
|
|
635
|
+
return await client.fetchTeams(options);
|
|
636
|
+
} catch (err) {
|
|
637
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
638
|
+
setError(errorMessage);
|
|
639
|
+
throw err;
|
|
640
|
+
}
|
|
641
|
+
}, [client]);
|
|
642
|
+
const updateConfig = import_react5.useCallback((updates) => {
|
|
643
|
+
client.updateConfig(updates);
|
|
644
|
+
}, [client]);
|
|
645
|
+
return {
|
|
646
|
+
initialize,
|
|
647
|
+
checkStatus,
|
|
648
|
+
fetchAgents,
|
|
649
|
+
fetchTeams,
|
|
650
|
+
updateConfig,
|
|
651
|
+
isInitializing,
|
|
652
|
+
error
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
// src/hooks/useAgnoToolExecution.ts
|
|
656
|
+
var import_react6 = require("react");
|
|
657
|
+
function isToolHandlerResult(value) {
|
|
658
|
+
return value && typeof value === "object" && (("data" in value) || ("ui" in value));
|
|
659
|
+
}
|
|
660
|
+
function isUIComponentSpec(value) {
|
|
661
|
+
return value && typeof value === "object" && "type" in value;
|
|
662
|
+
}
|
|
663
|
+
function processToolResult(result, _tool) {
|
|
664
|
+
if (isToolHandlerResult(result)) {
|
|
665
|
+
const { data, ui } = result;
|
|
666
|
+
return {
|
|
667
|
+
resultData: typeof data === "string" ? data : JSON.stringify(data),
|
|
668
|
+
uiComponent: ui
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
if (isUIComponentSpec(result)) {
|
|
672
|
+
return {
|
|
673
|
+
resultData: JSON.stringify(result),
|
|
674
|
+
uiComponent: result
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
return {
|
|
678
|
+
resultData: typeof result === "string" ? result : JSON.stringify(result),
|
|
679
|
+
uiComponent: undefined
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
function useAgnoToolExecution(handlers = {}, autoExecute = true, options) {
|
|
683
|
+
const client = useAgnoClient();
|
|
684
|
+
const toolHandlerContext = useToolHandlers();
|
|
685
|
+
const isTeamMode = client.getConfig().mode === "team";
|
|
686
|
+
import_react6.useEffect(() => {
|
|
687
|
+
if (isTeamMode) {
|
|
688
|
+
console.warn("[useAgnoToolExecution] HITL (Human-in-the-Loop) frontend tool execution is not supported for teams. " + "Only agents support the continue endpoint. This hook will not function in team mode.");
|
|
689
|
+
}
|
|
690
|
+
}, [isTeamMode]);
|
|
691
|
+
const mergedHandlers = import_react6.useMemo(() => {
|
|
692
|
+
const globalHandlers = toolHandlerContext?.handlers || {};
|
|
693
|
+
return { ...globalHandlers, ...handlers };
|
|
694
|
+
}, [toolHandlerContext?.handlers, handlers]);
|
|
695
|
+
const [pendingTools, setPendingTools] = import_react6.useState([]);
|
|
696
|
+
const [isPaused, setIsPaused] = import_react6.useState(false);
|
|
697
|
+
const [isExecuting, setIsExecuting] = import_react6.useState(false);
|
|
698
|
+
const [executionError, setExecutionError] = import_react6.useState();
|
|
699
|
+
import_react6.useEffect(() => {
|
|
700
|
+
if (isTeamMode) {
|
|
701
|
+
return;
|
|
702
|
+
}
|
|
703
|
+
const handleRunPaused = (event) => {
|
|
704
|
+
setIsPaused(true);
|
|
705
|
+
setPendingTools(event.tools);
|
|
706
|
+
setExecutionError(undefined);
|
|
707
|
+
};
|
|
708
|
+
const handleRunContinued = () => {
|
|
709
|
+
setIsPaused(false);
|
|
710
|
+
setPendingTools([]);
|
|
711
|
+
setIsExecuting(false);
|
|
712
|
+
setExecutionError(undefined);
|
|
713
|
+
};
|
|
714
|
+
client.on("run:paused", handleRunPaused);
|
|
715
|
+
client.on("run:continued", handleRunContinued);
|
|
716
|
+
return () => {
|
|
717
|
+
client.off("run:paused", handleRunPaused);
|
|
718
|
+
client.off("run:continued", handleRunContinued);
|
|
719
|
+
};
|
|
720
|
+
}, [client, isTeamMode]);
|
|
721
|
+
const executeAndContinue = import_react6.useCallback(async () => {
|
|
722
|
+
if (!isPaused || pendingTools.length === 0) {
|
|
723
|
+
console.warn("[useAgnoToolExecution] Cannot execute: no pending tools");
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
setIsExecuting(true);
|
|
727
|
+
setExecutionError(undefined);
|
|
728
|
+
try {
|
|
729
|
+
const updatedTools = await Promise.all(pendingTools.map(async (tool) => {
|
|
730
|
+
const handler = mergedHandlers[tool.tool_name];
|
|
731
|
+
if (!handler) {
|
|
732
|
+
return {
|
|
733
|
+
...tool,
|
|
734
|
+
result: JSON.stringify({
|
|
735
|
+
error: `No handler registered for ${tool.tool_name}`
|
|
736
|
+
})
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
try {
|
|
740
|
+
const result = await handler(tool.tool_args);
|
|
741
|
+
const { resultData, uiComponent } = processToolResult(result, tool);
|
|
742
|
+
return {
|
|
743
|
+
...tool,
|
|
744
|
+
result: resultData,
|
|
745
|
+
ui_component: uiComponent
|
|
746
|
+
};
|
|
747
|
+
} catch (error) {
|
|
748
|
+
return {
|
|
749
|
+
...tool,
|
|
750
|
+
result: JSON.stringify({
|
|
751
|
+
error: error instanceof Error ? error.message : String(error)
|
|
752
|
+
})
|
|
753
|
+
};
|
|
754
|
+
}
|
|
755
|
+
}));
|
|
756
|
+
const toolsWithUI = updatedTools.filter((t) => t.ui_component);
|
|
757
|
+
if (toolsWithUI.length > 0) {
|
|
758
|
+
client.emit("ui:render", {
|
|
759
|
+
tools: updatedTools,
|
|
760
|
+
runId: client.getState().pausedRunId
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
client.addToolCallsToLastMessage(updatedTools);
|
|
764
|
+
await client.continueRun(updatedTools);
|
|
765
|
+
} catch (error) {
|
|
766
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
767
|
+
setExecutionError(errorMessage);
|
|
768
|
+
setIsExecuting(false);
|
|
769
|
+
throw error;
|
|
770
|
+
}
|
|
771
|
+
}, [client, mergedHandlers, isPaused, pendingTools]);
|
|
772
|
+
import_react6.useEffect(() => {
|
|
773
|
+
const handleSessionLoaded = async (_sessionId) => {
|
|
774
|
+
const messages = client.getMessages();
|
|
775
|
+
for (const message of messages) {
|
|
776
|
+
if (!message.tool_calls)
|
|
777
|
+
continue;
|
|
778
|
+
for (const tool of message.tool_calls) {
|
|
779
|
+
if (tool.ui_component)
|
|
780
|
+
continue;
|
|
781
|
+
if (options?.skipToolsOnSessionLoad?.includes(tool.tool_name))
|
|
782
|
+
continue;
|
|
783
|
+
const handler = mergedHandlers[tool.tool_name];
|
|
784
|
+
if (!handler)
|
|
785
|
+
continue;
|
|
786
|
+
try {
|
|
787
|
+
const result = await handler(tool.tool_args);
|
|
788
|
+
const { uiComponent } = processToolResult(result, tool);
|
|
789
|
+
if (uiComponent) {
|
|
790
|
+
client.hydrateToolCallUI(tool.tool_call_id, uiComponent);
|
|
791
|
+
}
|
|
792
|
+
} catch (err) {
|
|
793
|
+
console.error(`Failed to hydrate UI for ${tool.tool_name}:`, err);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
};
|
|
798
|
+
client.on("session:loaded", handleSessionLoaded);
|
|
799
|
+
return () => {
|
|
800
|
+
client.off("session:loaded", handleSessionLoaded);
|
|
801
|
+
};
|
|
802
|
+
}, [client, mergedHandlers]);
|
|
803
|
+
const executeTools = import_react6.useCallback(async (tools) => {
|
|
804
|
+
return Promise.all(tools.map(async (tool) => {
|
|
805
|
+
const handler = mergedHandlers[tool.tool_name];
|
|
806
|
+
if (!handler)
|
|
807
|
+
return tool;
|
|
808
|
+
try {
|
|
809
|
+
const result = await handler(tool.tool_args);
|
|
810
|
+
const { resultData, uiComponent } = processToolResult(result, tool);
|
|
811
|
+
return {
|
|
812
|
+
...tool,
|
|
813
|
+
result: resultData,
|
|
814
|
+
ui_component: uiComponent
|
|
815
|
+
};
|
|
816
|
+
} catch (error) {
|
|
817
|
+
return {
|
|
818
|
+
...tool,
|
|
819
|
+
result: JSON.stringify({
|
|
820
|
+
error: error instanceof Error ? error.message : String(error)
|
|
821
|
+
})
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
}));
|
|
825
|
+
}, [mergedHandlers]);
|
|
826
|
+
const continueWithResults = import_react6.useCallback(async (tools, options2) => {
|
|
827
|
+
if (!isPaused) {
|
|
828
|
+
throw new Error("No paused run to continue");
|
|
829
|
+
}
|
|
830
|
+
setIsExecuting(true);
|
|
1134
831
|
try {
|
|
1135
|
-
|
|
1136
|
-
} catch (
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
throw err;
|
|
832
|
+
await client.continueRun(tools, options2);
|
|
833
|
+
} catch (error) {
|
|
834
|
+
setIsExecuting(false);
|
|
835
|
+
throw error;
|
|
1140
836
|
}
|
|
1141
|
-
}, [client]);
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
return await client.fetchTeams(options);
|
|
1146
|
-
} catch (err) {
|
|
1147
|
-
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
1148
|
-
setError(errorMessage);
|
|
1149
|
-
throw err;
|
|
837
|
+
}, [client, isPaused]);
|
|
838
|
+
import_react6.useEffect(() => {
|
|
839
|
+
if (autoExecute && isPaused && !isExecuting && pendingTools.length > 0) {
|
|
840
|
+
executeAndContinue();
|
|
1150
841
|
}
|
|
1151
|
-
}, [
|
|
1152
|
-
const updateConfig = import_react7.useCallback((updates) => {
|
|
1153
|
-
client.updateConfig(updates);
|
|
1154
|
-
}, [client]);
|
|
842
|
+
}, [autoExecute, isPaused, isExecuting, pendingTools.length, executeAndContinue]);
|
|
1155
843
|
return {
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
844
|
+
isPaused,
|
|
845
|
+
isExecuting,
|
|
846
|
+
pendingTools,
|
|
847
|
+
executeAndContinue,
|
|
848
|
+
executeTools,
|
|
849
|
+
continueWithResults,
|
|
850
|
+
executionError
|
|
1163
851
|
};
|
|
1164
852
|
}
|
|
1165
853
|
// src/ui/composed/agno-chat/render-tool.ts
|
|
@@ -1185,7 +873,7 @@ function cn(...inputs) {
|
|
|
1185
873
|
}
|
|
1186
874
|
|
|
1187
875
|
// src/ui/primitives/badge.tsx
|
|
1188
|
-
var
|
|
876
|
+
var jsx_runtime3 = require("react/jsx-runtime");
|
|
1189
877
|
var badgeVariants = import_class_variance_authority.cva("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", {
|
|
1190
878
|
variants: {
|
|
1191
879
|
variant: {
|
|
@@ -1200,7 +888,7 @@ var badgeVariants = import_class_variance_authority.cva("inline-flex items-cente
|
|
|
1200
888
|
}
|
|
1201
889
|
});
|
|
1202
890
|
function Badge({ className, variant, ...props }) {
|
|
1203
|
-
return /* @__PURE__ */
|
|
891
|
+
return /* @__PURE__ */ jsx_runtime3.jsx("div", {
|
|
1204
892
|
className: cn(badgeVariants({ variant }), className),
|
|
1205
893
|
...props
|
|
1206
894
|
});
|
|
@@ -1214,13 +902,13 @@ var CollapsibleContent2 = CollapsiblePrimitive.CollapsibleContent;
|
|
|
1214
902
|
|
|
1215
903
|
// src/ui/components/tool.tsx
|
|
1216
904
|
var import_lucide_react2 = require("lucide-react");
|
|
1217
|
-
var
|
|
905
|
+
var import_react8 = require("react");
|
|
1218
906
|
|
|
1219
907
|
// src/ui/primitives/button.tsx
|
|
1220
|
-
var
|
|
908
|
+
var React3 = __toESM(require("react"));
|
|
1221
909
|
var import_react_slot = require("@radix-ui/react-slot");
|
|
1222
910
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
1223
|
-
var
|
|
911
|
+
var jsx_runtime4 = require("react/jsx-runtime");
|
|
1224
912
|
var buttonVariants = import_class_variance_authority2.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", {
|
|
1225
913
|
variants: {
|
|
1226
914
|
variant: {
|
|
@@ -1243,9 +931,9 @@ var buttonVariants = import_class_variance_authority2.cva("inline-flex items-cen
|
|
|
1243
931
|
size: "default"
|
|
1244
932
|
}
|
|
1245
933
|
});
|
|
1246
|
-
var Button =
|
|
934
|
+
var Button = React3.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
1247
935
|
const Comp = asChild ? import_react_slot.Slot : "button";
|
|
1248
|
-
return /* @__PURE__ */
|
|
936
|
+
return /* @__PURE__ */ jsx_runtime4.jsx(Comp, {
|
|
1249
937
|
className: cn(buttonVariants({ variant, size, className })),
|
|
1250
938
|
ref,
|
|
1251
939
|
...props
|
|
@@ -1255,9 +943,9 @@ Button.displayName = "Button";
|
|
|
1255
943
|
|
|
1256
944
|
// src/ui/components/code-block.tsx
|
|
1257
945
|
var import_lucide_react = require("lucide-react");
|
|
1258
|
-
var
|
|
1259
|
-
var
|
|
1260
|
-
var CodeBlockContext =
|
|
946
|
+
var import_react7 = require("react");
|
|
947
|
+
var jsx_runtime5 = require("react/jsx-runtime");
|
|
948
|
+
var CodeBlockContext = import_react7.createContext({
|
|
1261
949
|
code: ""
|
|
1262
950
|
});
|
|
1263
951
|
async function highlightCode(code, language, showLineNumbers = false) {
|
|
@@ -1295,10 +983,10 @@ var CodeBlock = ({
|
|
|
1295
983
|
children,
|
|
1296
984
|
...props
|
|
1297
985
|
}) => {
|
|
1298
|
-
const [html, setHtml] =
|
|
1299
|
-
const [darkHtml, setDarkHtml] =
|
|
1300
|
-
const effectIdRef =
|
|
1301
|
-
|
|
986
|
+
const [html, setHtml] = import_react7.useState("");
|
|
987
|
+
const [darkHtml, setDarkHtml] = import_react7.useState("");
|
|
988
|
+
const effectIdRef = import_react7.useRef(0);
|
|
989
|
+
import_react7.useEffect(() => {
|
|
1302
990
|
const id = ++effectIdRef.current;
|
|
1303
991
|
highlightCode(code, language, showLineNumbers).then(([light, dark]) => {
|
|
1304
992
|
if (id === effectIdRef.current) {
|
|
@@ -1308,33 +996,33 @@ var CodeBlock = ({
|
|
|
1308
996
|
});
|
|
1309
997
|
}, [code, language, showLineNumbers]);
|
|
1310
998
|
const useFallback = !html && !darkHtml;
|
|
1311
|
-
return /* @__PURE__ */
|
|
999
|
+
return /* @__PURE__ */ jsx_runtime5.jsx(CodeBlockContext.Provider, {
|
|
1312
1000
|
value: { code },
|
|
1313
|
-
children: /* @__PURE__ */
|
|
1001
|
+
children: /* @__PURE__ */ jsx_runtime5.jsx("div", {
|
|
1314
1002
|
className: cn("group relative w-full overflow-hidden rounded-md border bg-background text-foreground", className),
|
|
1315
1003
|
...props,
|
|
1316
|
-
children: /* @__PURE__ */
|
|
1004
|
+
children: /* @__PURE__ */ jsx_runtime5.jsxs("div", {
|
|
1317
1005
|
className: "relative",
|
|
1318
1006
|
children: [
|
|
1319
|
-
useFallback ? /* @__PURE__ */
|
|
1007
|
+
useFallback ? /* @__PURE__ */ jsx_runtime5.jsx("pre", {
|
|
1320
1008
|
className: "m-0 overflow-auto bg-background p-4 text-foreground text-sm",
|
|
1321
|
-
children: /* @__PURE__ */
|
|
1009
|
+
children: /* @__PURE__ */ jsx_runtime5.jsx("code", {
|
|
1322
1010
|
className: "font-mono text-sm",
|
|
1323
1011
|
children: code
|
|
1324
1012
|
})
|
|
1325
|
-
}) : /* @__PURE__ */
|
|
1013
|
+
}) : /* @__PURE__ */ jsx_runtime5.jsxs(jsx_runtime5.Fragment, {
|
|
1326
1014
|
children: [
|
|
1327
|
-
/* @__PURE__ */
|
|
1015
|
+
/* @__PURE__ */ jsx_runtime5.jsx("div", {
|
|
1328
1016
|
className: "overflow-hidden dark:hidden [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm",
|
|
1329
1017
|
dangerouslySetInnerHTML: { __html: html }
|
|
1330
1018
|
}),
|
|
1331
|
-
/* @__PURE__ */
|
|
1019
|
+
/* @__PURE__ */ jsx_runtime5.jsx("div", {
|
|
1332
1020
|
className: "hidden overflow-hidden dark:block [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm",
|
|
1333
1021
|
dangerouslySetInnerHTML: { __html: darkHtml }
|
|
1334
1022
|
})
|
|
1335
1023
|
]
|
|
1336
1024
|
}),
|
|
1337
|
-
children && /* @__PURE__ */
|
|
1025
|
+
children && /* @__PURE__ */ jsx_runtime5.jsx("div", {
|
|
1338
1026
|
className: "absolute top-2 right-2 flex items-center gap-2",
|
|
1339
1027
|
children
|
|
1340
1028
|
})
|
|
@@ -1345,8 +1033,8 @@ var CodeBlock = ({
|
|
|
1345
1033
|
};
|
|
1346
1034
|
|
|
1347
1035
|
// src/ui/components/tool.tsx
|
|
1348
|
-
var
|
|
1349
|
-
var Tool = ({ className, ...props }) => /* @__PURE__ */
|
|
1036
|
+
var jsx_runtime6 = require("react/jsx-runtime");
|
|
1037
|
+
var Tool = ({ className, ...props }) => /* @__PURE__ */ jsx_runtime6.jsx(Collapsible, {
|
|
1350
1038
|
className: cn("not-prose mb-4 w-full rounded-md border", className),
|
|
1351
1039
|
...props
|
|
1352
1040
|
});
|
|
@@ -1361,29 +1049,29 @@ var getStatusBadge = (status) => {
|
|
|
1361
1049
|
"output-denied": "Denied"
|
|
1362
1050
|
};
|
|
1363
1051
|
const icons = {
|
|
1364
|
-
"input-streaming": /* @__PURE__ */
|
|
1052
|
+
"input-streaming": /* @__PURE__ */ jsx_runtime6.jsx(import_lucide_react2.CircleIcon, {
|
|
1365
1053
|
className: "size-4"
|
|
1366
1054
|
}),
|
|
1367
|
-
"input-available": /* @__PURE__ */
|
|
1055
|
+
"input-available": /* @__PURE__ */ jsx_runtime6.jsx(import_lucide_react2.ClockIcon, {
|
|
1368
1056
|
className: "size-4 animate-pulse"
|
|
1369
1057
|
}),
|
|
1370
|
-
"approval-requested": /* @__PURE__ */
|
|
1058
|
+
"approval-requested": /* @__PURE__ */ jsx_runtime6.jsx(import_lucide_react2.ClockIcon, {
|
|
1371
1059
|
className: "size-4 text-yellow-600"
|
|
1372
1060
|
}),
|
|
1373
|
-
"approval-responded": /* @__PURE__ */
|
|
1061
|
+
"approval-responded": /* @__PURE__ */ jsx_runtime6.jsx(import_lucide_react2.CheckCircleIcon, {
|
|
1374
1062
|
className: "size-4 text-blue-600"
|
|
1375
1063
|
}),
|
|
1376
|
-
"output-available": /* @__PURE__ */
|
|
1064
|
+
"output-available": /* @__PURE__ */ jsx_runtime6.jsx(import_lucide_react2.CheckCircleIcon, {
|
|
1377
1065
|
className: "size-4 text-green-600"
|
|
1378
1066
|
}),
|
|
1379
|
-
"output-error": /* @__PURE__ */
|
|
1067
|
+
"output-error": /* @__PURE__ */ jsx_runtime6.jsx(import_lucide_react2.XCircleIcon, {
|
|
1380
1068
|
className: "size-4 text-red-600"
|
|
1381
1069
|
}),
|
|
1382
|
-
"output-denied": /* @__PURE__ */
|
|
1070
|
+
"output-denied": /* @__PURE__ */ jsx_runtime6.jsx(import_lucide_react2.XCircleIcon, {
|
|
1383
1071
|
className: "size-4 text-orange-600"
|
|
1384
1072
|
})
|
|
1385
1073
|
};
|
|
1386
|
-
return /* @__PURE__ */
|
|
1074
|
+
return /* @__PURE__ */ jsx_runtime6.jsxs(Badge, {
|
|
1387
1075
|
className: "gap-1.5 rounded-full text-xs",
|
|
1388
1076
|
variant: "secondary",
|
|
1389
1077
|
children: [
|
|
@@ -1392,43 +1080,43 @@ var getStatusBadge = (status) => {
|
|
|
1392
1080
|
]
|
|
1393
1081
|
});
|
|
1394
1082
|
};
|
|
1395
|
-
var ToolHeader = ({ className, title, type, state, ...props }) => /* @__PURE__ */
|
|
1083
|
+
var ToolHeader = ({ className, title, type, state, ...props }) => /* @__PURE__ */ jsx_runtime6.jsxs(CollapsibleTrigger2, {
|
|
1396
1084
|
className: cn("group flex w-full items-center justify-between gap-4 p-3", className),
|
|
1397
1085
|
...props,
|
|
1398
1086
|
children: [
|
|
1399
|
-
/* @__PURE__ */
|
|
1087
|
+
/* @__PURE__ */ jsx_runtime6.jsxs("div", {
|
|
1400
1088
|
className: "flex items-center gap-2",
|
|
1401
1089
|
children: [
|
|
1402
|
-
/* @__PURE__ */
|
|
1090
|
+
/* @__PURE__ */ jsx_runtime6.jsx(import_lucide_react2.WrenchIcon, {
|
|
1403
1091
|
className: "size-4 text-muted-foreground"
|
|
1404
1092
|
}),
|
|
1405
|
-
/* @__PURE__ */
|
|
1093
|
+
/* @__PURE__ */ jsx_runtime6.jsx("span", {
|
|
1406
1094
|
className: "font-medium text-sm",
|
|
1407
1095
|
children: title ?? type?.split("-").slice(1).join("-") ?? "Tool"
|
|
1408
1096
|
}),
|
|
1409
1097
|
getStatusBadge(state)
|
|
1410
1098
|
]
|
|
1411
1099
|
}),
|
|
1412
|
-
/* @__PURE__ */
|
|
1100
|
+
/* @__PURE__ */ jsx_runtime6.jsx(import_lucide_react2.ChevronDownIcon, {
|
|
1413
1101
|
className: "size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"
|
|
1414
1102
|
})
|
|
1415
1103
|
]
|
|
1416
1104
|
});
|
|
1417
|
-
var ToolContent = ({ className, ...props }) => /* @__PURE__ */
|
|
1105
|
+
var ToolContent = ({ className, ...props }) => /* @__PURE__ */ jsx_runtime6.jsx(CollapsibleContent2, {
|
|
1418
1106
|
className: cn("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in", className),
|
|
1419
1107
|
...props
|
|
1420
1108
|
});
|
|
1421
|
-
var ToolInput = ({ className, input, ...props }) => /* @__PURE__ */
|
|
1109
|
+
var ToolInput = ({ className, input, ...props }) => /* @__PURE__ */ jsx_runtime6.jsxs("div", {
|
|
1422
1110
|
className: cn("space-y-2 overflow-hidden p-4", className),
|
|
1423
1111
|
...props,
|
|
1424
1112
|
children: [
|
|
1425
|
-
/* @__PURE__ */
|
|
1113
|
+
/* @__PURE__ */ jsx_runtime6.jsx("h4", {
|
|
1426
1114
|
className: "font-medium text-muted-foreground text-xs uppercase tracking-wide",
|
|
1427
1115
|
children: "Parameters"
|
|
1428
1116
|
}),
|
|
1429
|
-
/* @__PURE__ */
|
|
1117
|
+
/* @__PURE__ */ jsx_runtime6.jsx("div", {
|
|
1430
1118
|
className: "rounded-md bg-muted/50",
|
|
1431
|
-
children: /* @__PURE__ */
|
|
1119
|
+
children: /* @__PURE__ */ jsx_runtime6.jsx(CodeBlock, {
|
|
1432
1120
|
code: JSON.stringify(input, null, 2),
|
|
1433
1121
|
language: "json"
|
|
1434
1122
|
})
|
|
@@ -1439,32 +1127,32 @@ var ToolOutput = ({ className, output, errorText, ...props }) => {
|
|
|
1439
1127
|
if (!(output || errorText)) {
|
|
1440
1128
|
return null;
|
|
1441
1129
|
}
|
|
1442
|
-
let Output = /* @__PURE__ */
|
|
1130
|
+
let Output = /* @__PURE__ */ jsx_runtime6.jsx("div", {
|
|
1443
1131
|
children: output
|
|
1444
1132
|
});
|
|
1445
|
-
if (typeof output === "object" && !
|
|
1446
|
-
Output = /* @__PURE__ */
|
|
1133
|
+
if (typeof output === "object" && !import_react8.isValidElement(output)) {
|
|
1134
|
+
Output = /* @__PURE__ */ jsx_runtime6.jsx(CodeBlock, {
|
|
1447
1135
|
code: JSON.stringify(output, null, 2),
|
|
1448
1136
|
language: "json"
|
|
1449
1137
|
});
|
|
1450
1138
|
} else if (typeof output === "string") {
|
|
1451
|
-
Output = /* @__PURE__ */
|
|
1139
|
+
Output = /* @__PURE__ */ jsx_runtime6.jsx(CodeBlock, {
|
|
1452
1140
|
code: output,
|
|
1453
1141
|
language: "json"
|
|
1454
1142
|
});
|
|
1455
1143
|
}
|
|
1456
|
-
return /* @__PURE__ */
|
|
1144
|
+
return /* @__PURE__ */ jsx_runtime6.jsxs("div", {
|
|
1457
1145
|
className: cn("space-y-2 p-4", className),
|
|
1458
1146
|
...props,
|
|
1459
1147
|
children: [
|
|
1460
|
-
/* @__PURE__ */
|
|
1148
|
+
/* @__PURE__ */ jsx_runtime6.jsx("h4", {
|
|
1461
1149
|
className: "font-medium text-muted-foreground text-xs uppercase tracking-wide",
|
|
1462
1150
|
children: errorText ? "Error" : "Result"
|
|
1463
1151
|
}),
|
|
1464
|
-
/* @__PURE__ */
|
|
1152
|
+
/* @__PURE__ */ jsx_runtime6.jsxs("div", {
|
|
1465
1153
|
className: cn("overflow-x-auto rounded-md text-xs [&_table]:w-full", errorText ? "bg-destructive/10 text-destructive" : "bg-muted/50 text-foreground"),
|
|
1466
1154
|
children: [
|
|
1467
|
-
errorText && /* @__PURE__ */
|
|
1155
|
+
errorText && /* @__PURE__ */ jsx_runtime6.jsx("div", {
|
|
1468
1156
|
children: errorText
|
|
1469
1157
|
}),
|
|
1470
1158
|
Output
|
|
@@ -1474,50 +1162,25 @@ var ToolOutput = ({ className, output, errorText, ...props }) => {
|
|
|
1474
1162
|
});
|
|
1475
1163
|
};
|
|
1476
1164
|
|
|
1477
|
-
// src/ui/primitives/tooltip.tsx
|
|
1478
|
-
var React5 = __toESM(require("react"));
|
|
1479
|
-
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"));
|
|
1480
|
-
var jsx_runtime8 = require("react/jsx-runtime");
|
|
1481
|
-
var TooltipProvider = TooltipPrimitive.Provider;
|
|
1482
|
-
var Tooltip = TooltipPrimitive.Root;
|
|
1483
|
-
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
1484
|
-
var TooltipContent = React5.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx_runtime8.jsx(TooltipPrimitive.Portal, {
|
|
1485
|
-
children: /* @__PURE__ */ jsx_runtime8.jsx(TooltipPrimitive.Content, {
|
|
1486
|
-
ref,
|
|
1487
|
-
sideOffset,
|
|
1488
|
-
className: cn("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]", className),
|
|
1489
|
-
...props
|
|
1490
|
-
})
|
|
1491
|
-
}));
|
|
1492
|
-
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
1493
|
-
|
|
1494
|
-
// src/ui/components/artifact.tsx
|
|
1495
|
-
var import_lucide_react3 = require("lucide-react");
|
|
1496
|
-
var jsx_runtime9 = require("react/jsx-runtime");
|
|
1497
|
-
var Artifact = ({ className, ...props }) => /* @__PURE__ */ jsx_runtime9.jsx("div", {
|
|
1498
|
-
className: cn("flex flex-col overflow-hidden rounded-lg border bg-background shadow-sm", className),
|
|
1499
|
-
...props
|
|
1500
|
-
});
|
|
1501
|
-
|
|
1502
1165
|
// src/ui/composed/agno-chat/tool-building-blocks.tsx
|
|
1503
|
-
var
|
|
1166
|
+
var jsx_runtime7 = require("react/jsx-runtime");
|
|
1504
1167
|
var getToolState = (tool) => tool.tool_call_error ? "output-error" : "output-available";
|
|
1505
1168
|
function ToolDebugCard({ tool, defaultOpen }) {
|
|
1506
1169
|
const output = tool.result ?? tool.content;
|
|
1507
|
-
return /* @__PURE__ */
|
|
1170
|
+
return /* @__PURE__ */ jsx_runtime7.jsxs(Tool, {
|
|
1508
1171
|
defaultOpen,
|
|
1509
1172
|
children: [
|
|
1510
|
-
/* @__PURE__ */
|
|
1173
|
+
/* @__PURE__ */ jsx_runtime7.jsx(ToolHeader, {
|
|
1511
1174
|
title: tool.tool_name,
|
|
1512
1175
|
type: "tool-use",
|
|
1513
1176
|
state: getToolState(tool)
|
|
1514
1177
|
}),
|
|
1515
|
-
/* @__PURE__ */
|
|
1178
|
+
/* @__PURE__ */ jsx_runtime7.jsxs(ToolContent, {
|
|
1516
1179
|
children: [
|
|
1517
|
-
/* @__PURE__ */
|
|
1180
|
+
/* @__PURE__ */ jsx_runtime7.jsx(ToolInput, {
|
|
1518
1181
|
input: tool.tool_args
|
|
1519
1182
|
}),
|
|
1520
|
-
output ? /* @__PURE__ */
|
|
1183
|
+
output ? /* @__PURE__ */ jsx_runtime7.jsx(ToolOutput, {
|
|
1521
1184
|
output,
|
|
1522
1185
|
errorText: tool.tool_call_error ? "Tool execution failed" : undefined
|
|
1523
1186
|
}) : null
|
|
@@ -1526,23 +1189,26 @@ function ToolDebugCard({ tool, defaultOpen }) {
|
|
|
1526
1189
|
]
|
|
1527
1190
|
});
|
|
1528
1191
|
}
|
|
1529
|
-
function ToolGenerativeUI({ tool }) {
|
|
1530
|
-
const uiComponent = tool.ui_component;
|
|
1531
|
-
if (!uiComponent)
|
|
1532
|
-
return null;
|
|
1533
|
-
return uiComponent.layout === "artifact" ? /* @__PURE__ */ jsx_runtime10.jsx(Artifact, {
|
|
1534
|
-
children: /* @__PURE__ */ jsx_runtime10.jsx(GenerativeUIRenderer, {
|
|
1535
|
-
spec: uiComponent,
|
|
1536
|
-
className: "w-full p-2"
|
|
1537
|
-
})
|
|
1538
|
-
}) : /* @__PURE__ */ jsx_runtime10.jsx(GenerativeUIRenderer, {
|
|
1539
|
-
spec: uiComponent,
|
|
1540
|
-
className: "w-full"
|
|
1541
|
-
});
|
|
1542
|
-
}
|
|
1543
1192
|
// src/ui/composed/agno-message/message.tsx
|
|
1544
|
-
var
|
|
1545
|
-
var
|
|
1193
|
+
var import_react13 = require("react");
|
|
1194
|
+
var import_lucide_react12 = require("lucide-react");
|
|
1195
|
+
|
|
1196
|
+
// src/ui/primitives/tooltip.tsx
|
|
1197
|
+
var React4 = __toESM(require("react"));
|
|
1198
|
+
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"));
|
|
1199
|
+
var jsx_runtime8 = require("react/jsx-runtime");
|
|
1200
|
+
var TooltipProvider = TooltipPrimitive.Provider;
|
|
1201
|
+
var Tooltip = TooltipPrimitive.Root;
|
|
1202
|
+
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
1203
|
+
var TooltipContent = React4.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx_runtime8.jsx(TooltipPrimitive.Portal, {
|
|
1204
|
+
children: /* @__PURE__ */ jsx_runtime8.jsx(TooltipPrimitive.Content, {
|
|
1205
|
+
ref,
|
|
1206
|
+
sideOffset,
|
|
1207
|
+
className: cn("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]", className),
|
|
1208
|
+
...props
|
|
1209
|
+
})
|
|
1210
|
+
}));
|
|
1211
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
1546
1212
|
|
|
1547
1213
|
// src/ui/lib/format-timestamp.ts
|
|
1548
1214
|
function formatSmartTimestamp(date) {
|
|
@@ -1580,22 +1246,22 @@ function formatFullTimestamp(date) {
|
|
|
1580
1246
|
}
|
|
1581
1247
|
|
|
1582
1248
|
// src/ui/components/smart-timestamp.tsx
|
|
1583
|
-
var
|
|
1249
|
+
var jsx_runtime9 = require("react/jsx-runtime");
|
|
1584
1250
|
function SmartTimestamp({ date, formatShort, className }) {
|
|
1585
1251
|
const shortText = formatShort ? formatShort(date) : formatSmartTimestamp(date);
|
|
1586
1252
|
const fullText = formatFullTimestamp(date);
|
|
1587
|
-
return /* @__PURE__ */
|
|
1588
|
-
children: /* @__PURE__ */
|
|
1253
|
+
return /* @__PURE__ */ jsx_runtime9.jsx(TooltipProvider, {
|
|
1254
|
+
children: /* @__PURE__ */ jsx_runtime9.jsxs(Tooltip, {
|
|
1589
1255
|
children: [
|
|
1590
|
-
/* @__PURE__ */
|
|
1256
|
+
/* @__PURE__ */ jsx_runtime9.jsx(TooltipTrigger, {
|
|
1591
1257
|
asChild: true,
|
|
1592
|
-
children: /* @__PURE__ */
|
|
1258
|
+
children: /* @__PURE__ */ jsx_runtime9.jsx("span", {
|
|
1593
1259
|
className,
|
|
1594
1260
|
children: shortText
|
|
1595
1261
|
})
|
|
1596
1262
|
}),
|
|
1597
|
-
/* @__PURE__ */
|
|
1598
|
-
children: /* @__PURE__ */
|
|
1263
|
+
/* @__PURE__ */ jsx_runtime9.jsx(TooltipContent, {
|
|
1264
|
+
children: /* @__PURE__ */ jsx_runtime9.jsx("p", {
|
|
1599
1265
|
children: fullText
|
|
1600
1266
|
})
|
|
1601
1267
|
})
|
|
@@ -1672,12 +1338,12 @@ function isPreviewable(mimeType) {
|
|
|
1672
1338
|
}
|
|
1673
1339
|
|
|
1674
1340
|
// src/ui/components/file-preview-card.tsx
|
|
1675
|
-
var
|
|
1676
|
-
var
|
|
1341
|
+
var import_lucide_react3 = require("lucide-react");
|
|
1342
|
+
var jsx_runtime10 = require("react/jsx-runtime");
|
|
1677
1343
|
function ExtBadge({ ext }) {
|
|
1678
1344
|
if (!ext)
|
|
1679
1345
|
return null;
|
|
1680
|
-
return /* @__PURE__ */
|
|
1346
|
+
return /* @__PURE__ */ jsx_runtime10.jsx("span", {
|
|
1681
1347
|
className: "absolute bottom-1.5 left-1.5 rounded px-1 py-0.5 text-[9px] font-semibold uppercase leading-none bg-background/80 text-muted-foreground border border-border/50 backdrop-blur-sm",
|
|
1682
1348
|
children: ext
|
|
1683
1349
|
});
|
|
@@ -1688,23 +1354,23 @@ function FilePreviewCard({ file, onClick, className }) {
|
|
|
1688
1354
|
const ext = getFileExtension(file.name, file.type);
|
|
1689
1355
|
const cardBase = cn("group relative flex flex-col overflow-hidden rounded-xl border border-border bg-muted/20 w-28 h-28", isClickable && "cursor-pointer hover:border-foreground/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 transition-colors", className);
|
|
1690
1356
|
if (previewType === "image" && file.url) {
|
|
1691
|
-
return /* @__PURE__ */
|
|
1357
|
+
return /* @__PURE__ */ jsx_runtime10.jsxs("button", {
|
|
1692
1358
|
type: "button",
|
|
1693
1359
|
onClick,
|
|
1694
1360
|
disabled: !isClickable,
|
|
1695
1361
|
className: cardBase,
|
|
1696
1362
|
children: [
|
|
1697
|
-
/* @__PURE__ */
|
|
1363
|
+
/* @__PURE__ */ jsx_runtime10.jsx("img", {
|
|
1698
1364
|
src: file.url,
|
|
1699
1365
|
alt: file.name,
|
|
1700
1366
|
className: "w-full h-full object-cover"
|
|
1701
1367
|
}),
|
|
1702
|
-
/* @__PURE__ */
|
|
1368
|
+
/* @__PURE__ */ jsx_runtime10.jsx(ExtBadge, {
|
|
1703
1369
|
ext
|
|
1704
1370
|
}),
|
|
1705
|
-
isClickable && /* @__PURE__ */
|
|
1371
|
+
isClickable && /* @__PURE__ */ jsx_runtime10.jsx("div", {
|
|
1706
1372
|
className: "absolute inset-0 flex items-center justify-center bg-black/0 group-hover:bg-black/30 transition-colors",
|
|
1707
|
-
children: /* @__PURE__ */
|
|
1373
|
+
children: /* @__PURE__ */ jsx_runtime10.jsx(import_lucide_react3.Search, {
|
|
1708
1374
|
className: "h-5 w-5 text-white opacity-0 group-hover:opacity-100 transition-opacity"
|
|
1709
1375
|
})
|
|
1710
1376
|
})
|
|
@@ -1712,66 +1378,66 @@ function FilePreviewCard({ file, onClick, className }) {
|
|
|
1712
1378
|
});
|
|
1713
1379
|
}
|
|
1714
1380
|
if (previewType === "pdf" && file.url) {
|
|
1715
|
-
return /* @__PURE__ */
|
|
1381
|
+
return /* @__PURE__ */ jsx_runtime10.jsxs("button", {
|
|
1716
1382
|
type: "button",
|
|
1717
1383
|
onClick,
|
|
1718
1384
|
disabled: !isClickable,
|
|
1719
1385
|
className: cardBase,
|
|
1720
1386
|
children: [
|
|
1721
|
-
/* @__PURE__ */
|
|
1387
|
+
/* @__PURE__ */ jsx_runtime10.jsx("div", {
|
|
1722
1388
|
className: "w-full h-full overflow-hidden pointer-events-none",
|
|
1723
|
-
children: /* @__PURE__ */
|
|
1389
|
+
children: /* @__PURE__ */ jsx_runtime10.jsx("object", {
|
|
1724
1390
|
data: `${file.url}#page=1&view=FitH`,
|
|
1725
1391
|
type: "application/pdf",
|
|
1726
1392
|
className: "w-[200%] h-[200%] origin-top-left scale-50",
|
|
1727
1393
|
"aria-label": file.name,
|
|
1728
|
-
children: /* @__PURE__ */
|
|
1394
|
+
children: /* @__PURE__ */ jsx_runtime10.jsx("div", {
|
|
1729
1395
|
className: "flex items-center justify-center w-full h-full",
|
|
1730
|
-
children: /* @__PURE__ */
|
|
1396
|
+
children: /* @__PURE__ */ jsx_runtime10.jsx(import_lucide_react3.FileIcon, {
|
|
1731
1397
|
className: "h-8 w-8 text-muted-foreground/40"
|
|
1732
1398
|
})
|
|
1733
1399
|
})
|
|
1734
1400
|
})
|
|
1735
1401
|
}),
|
|
1736
|
-
/* @__PURE__ */
|
|
1402
|
+
/* @__PURE__ */ jsx_runtime10.jsx(ExtBadge, {
|
|
1737
1403
|
ext
|
|
1738
1404
|
}),
|
|
1739
|
-
isClickable && /* @__PURE__ */
|
|
1405
|
+
isClickable && /* @__PURE__ */ jsx_runtime10.jsx("div", {
|
|
1740
1406
|
className: "absolute inset-0 flex items-center justify-center bg-black/0 group-hover:bg-black/10 transition-colors",
|
|
1741
|
-
children: /* @__PURE__ */
|
|
1407
|
+
children: /* @__PURE__ */ jsx_runtime10.jsx(import_lucide_react3.Search, {
|
|
1742
1408
|
className: "h-5 w-5 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"
|
|
1743
1409
|
})
|
|
1744
1410
|
})
|
|
1745
1411
|
]
|
|
1746
1412
|
});
|
|
1747
1413
|
}
|
|
1748
|
-
return /* @__PURE__ */
|
|
1414
|
+
return /* @__PURE__ */ jsx_runtime10.jsxs("button", {
|
|
1749
1415
|
type: "button",
|
|
1750
1416
|
onClick,
|
|
1751
1417
|
disabled: !isClickable,
|
|
1752
1418
|
className: cardBase,
|
|
1753
1419
|
children: [
|
|
1754
|
-
/* @__PURE__ */
|
|
1420
|
+
/* @__PURE__ */ jsx_runtime10.jsx("div", {
|
|
1755
1421
|
className: "flex-1 flex items-center justify-center",
|
|
1756
|
-
children: /* @__PURE__ */
|
|
1422
|
+
children: /* @__PURE__ */ jsx_runtime10.jsx(import_lucide_react3.FileIcon, {
|
|
1757
1423
|
className: "h-8 w-8 text-muted-foreground/40"
|
|
1758
1424
|
})
|
|
1759
1425
|
}),
|
|
1760
|
-
/* @__PURE__ */
|
|
1426
|
+
/* @__PURE__ */ jsx_runtime10.jsxs("div", {
|
|
1761
1427
|
className: "w-full text-center min-w-0 px-2 pb-2 space-y-0.5",
|
|
1762
1428
|
children: [
|
|
1763
|
-
/* @__PURE__ */
|
|
1429
|
+
/* @__PURE__ */ jsx_runtime10.jsx("p", {
|
|
1764
1430
|
className: "text-[10px] text-foreground truncate leading-tight",
|
|
1765
1431
|
title: file.name,
|
|
1766
1432
|
children: file.name
|
|
1767
1433
|
}),
|
|
1768
|
-
file.size != null && file.size > 0 && /* @__PURE__ */
|
|
1434
|
+
file.size != null && file.size > 0 && /* @__PURE__ */ jsx_runtime10.jsx("p", {
|
|
1769
1435
|
className: "text-[9px] text-muted-foreground leading-tight",
|
|
1770
1436
|
children: formatFileSize(file.size)
|
|
1771
1437
|
})
|
|
1772
1438
|
]
|
|
1773
1439
|
}),
|
|
1774
|
-
/* @__PURE__ */
|
|
1440
|
+
/* @__PURE__ */ jsx_runtime10.jsx(ExtBadge, {
|
|
1775
1441
|
ext
|
|
1776
1442
|
})
|
|
1777
1443
|
]
|
|
@@ -1779,14 +1445,14 @@ function FilePreviewCard({ file, onClick, className }) {
|
|
|
1779
1445
|
}
|
|
1780
1446
|
|
|
1781
1447
|
// src/ui/primitives/dialog.tsx
|
|
1782
|
-
var
|
|
1448
|
+
var React5 = __toESM(require("react"));
|
|
1783
1449
|
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"));
|
|
1784
1450
|
var import_class_variance_authority3 = require("class-variance-authority");
|
|
1785
|
-
var
|
|
1786
|
-
var
|
|
1451
|
+
var import_lucide_react4 = require("lucide-react");
|
|
1452
|
+
var jsx_runtime11 = require("react/jsx-runtime");
|
|
1787
1453
|
var Dialog = DialogPrimitive.Root;
|
|
1788
1454
|
var DialogPortal = DialogPrimitive.Portal;
|
|
1789
|
-
var DialogOverlay =
|
|
1455
|
+
var DialogOverlay = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx_runtime11.jsx(DialogPrimitive.Overlay, {
|
|
1790
1456
|
ref,
|
|
1791
1457
|
className: cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className),
|
|
1792
1458
|
...props
|
|
@@ -1803,22 +1469,22 @@ var dialogContentVariants = import_class_variance_authority3.cva("fixed left-[50
|
|
|
1803
1469
|
variant: "default"
|
|
1804
1470
|
}
|
|
1805
1471
|
});
|
|
1806
|
-
var DialogContent =
|
|
1472
|
+
var DialogContent = React5.forwardRef(({ className, variant, children, ...props }, ref) => /* @__PURE__ */ jsx_runtime11.jsxs(DialogPortal, {
|
|
1807
1473
|
children: [
|
|
1808
|
-
/* @__PURE__ */
|
|
1809
|
-
/* @__PURE__ */
|
|
1474
|
+
/* @__PURE__ */ jsx_runtime11.jsx(DialogOverlay, {}),
|
|
1475
|
+
/* @__PURE__ */ jsx_runtime11.jsxs(DialogPrimitive.Content, {
|
|
1810
1476
|
ref,
|
|
1811
1477
|
className: cn(dialogContentVariants({ variant }), className),
|
|
1812
1478
|
...props,
|
|
1813
1479
|
children: [
|
|
1814
1480
|
children,
|
|
1815
|
-
/* @__PURE__ */
|
|
1481
|
+
/* @__PURE__ */ jsx_runtime11.jsxs(DialogPrimitive.Close, {
|
|
1816
1482
|
className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",
|
|
1817
1483
|
children: [
|
|
1818
|
-
/* @__PURE__ */
|
|
1484
|
+
/* @__PURE__ */ jsx_runtime11.jsx(import_lucide_react4.X, {
|
|
1819
1485
|
className: "h-4 w-4"
|
|
1820
1486
|
}),
|
|
1821
|
-
/* @__PURE__ */
|
|
1487
|
+
/* @__PURE__ */ jsx_runtime11.jsx("span", {
|
|
1822
1488
|
className: "sr-only",
|
|
1823
1489
|
children: "Close"
|
|
1824
1490
|
})
|
|
@@ -1829,23 +1495,23 @@ var DialogContent = React6.forwardRef(({ className, variant, children, ...props
|
|
|
1829
1495
|
]
|
|
1830
1496
|
}));
|
|
1831
1497
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
1832
|
-
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */
|
|
1498
|
+
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx_runtime11.jsx("div", {
|
|
1833
1499
|
className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className),
|
|
1834
1500
|
...props
|
|
1835
1501
|
});
|
|
1836
1502
|
DialogHeader.displayName = "DialogHeader";
|
|
1837
|
-
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */
|
|
1503
|
+
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx_runtime11.jsx("div", {
|
|
1838
1504
|
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
1839
1505
|
...props
|
|
1840
1506
|
});
|
|
1841
1507
|
DialogFooter.displayName = "DialogFooter";
|
|
1842
|
-
var DialogTitle =
|
|
1508
|
+
var DialogTitle = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx_runtime11.jsx(DialogPrimitive.Title, {
|
|
1843
1509
|
ref,
|
|
1844
1510
|
className: cn("text-lg font-semibold leading-none tracking-tight", className),
|
|
1845
1511
|
...props
|
|
1846
1512
|
}));
|
|
1847
1513
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
1848
|
-
var DialogDescription =
|
|
1514
|
+
var DialogDescription = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx_runtime11.jsx(DialogPrimitive.Description, {
|
|
1849
1515
|
ref,
|
|
1850
1516
|
className: cn("text-sm text-muted-foreground", className),
|
|
1851
1517
|
...props
|
|
@@ -1853,57 +1519,57 @@ var DialogDescription = React6.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
1853
1519
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
1854
1520
|
|
|
1855
1521
|
// src/ui/components/file-preview-modal.tsx
|
|
1856
|
-
var
|
|
1857
|
-
var
|
|
1522
|
+
var import_lucide_react5 = require("lucide-react");
|
|
1523
|
+
var jsx_runtime12 = require("react/jsx-runtime");
|
|
1858
1524
|
function FilePreviewModal({ open, onOpenChange, file }) {
|
|
1859
1525
|
if (!file)
|
|
1860
1526
|
return null;
|
|
1861
1527
|
const previewType = getFilePreviewType(file.type);
|
|
1862
1528
|
const canPreview = isPreviewable(file.type) && !!file.url;
|
|
1863
|
-
return /* @__PURE__ */
|
|
1529
|
+
return /* @__PURE__ */ jsx_runtime12.jsx(Dialog, {
|
|
1864
1530
|
open,
|
|
1865
1531
|
onOpenChange,
|
|
1866
|
-
children: previewType === "image" && file.url ? /* @__PURE__ */
|
|
1532
|
+
children: previewType === "image" && file.url ? /* @__PURE__ */ jsx_runtime12.jsxs(DialogContent, {
|
|
1867
1533
|
variant: "lightbox",
|
|
1868
1534
|
"aria-describedby": undefined,
|
|
1869
1535
|
children: [
|
|
1870
|
-
/* @__PURE__ */
|
|
1536
|
+
/* @__PURE__ */ jsx_runtime12.jsx(DialogTitle, {
|
|
1871
1537
|
className: "sr-only",
|
|
1872
1538
|
children: file.name
|
|
1873
1539
|
}),
|
|
1874
|
-
/* @__PURE__ */
|
|
1540
|
+
/* @__PURE__ */ jsx_runtime12.jsx("img", {
|
|
1875
1541
|
src: file.url,
|
|
1876
1542
|
alt: file.name,
|
|
1877
1543
|
className: "max-h-[85vh] max-w-full object-contain rounded-md"
|
|
1878
1544
|
})
|
|
1879
1545
|
]
|
|
1880
|
-
}) : previewType === "pdf" && file.url ? /* @__PURE__ */
|
|
1546
|
+
}) : previewType === "pdf" && file.url ? /* @__PURE__ */ jsx_runtime12.jsxs(DialogContent, {
|
|
1881
1547
|
variant: "lightbox",
|
|
1882
1548
|
className: "w-[80vw] h-[85vh]",
|
|
1883
1549
|
"aria-describedby": undefined,
|
|
1884
1550
|
children: [
|
|
1885
|
-
/* @__PURE__ */
|
|
1551
|
+
/* @__PURE__ */ jsx_runtime12.jsx(DialogTitle, {
|
|
1886
1552
|
className: "sr-only",
|
|
1887
1553
|
children: file.name
|
|
1888
1554
|
}),
|
|
1889
|
-
/* @__PURE__ */
|
|
1555
|
+
/* @__PURE__ */ jsx_runtime12.jsx("object", {
|
|
1890
1556
|
data: file.url,
|
|
1891
1557
|
type: "application/pdf",
|
|
1892
1558
|
className: "w-full h-full rounded-md",
|
|
1893
|
-
children: /* @__PURE__ */
|
|
1559
|
+
children: /* @__PURE__ */ jsx_runtime12.jsxs("div", {
|
|
1894
1560
|
className: "flex flex-col items-center justify-center h-full gap-3 text-muted-foreground",
|
|
1895
1561
|
children: [
|
|
1896
|
-
/* @__PURE__ */
|
|
1562
|
+
/* @__PURE__ */ jsx_runtime12.jsx("p", {
|
|
1897
1563
|
className: "text-sm",
|
|
1898
1564
|
children: "Unable to display PDF"
|
|
1899
1565
|
}),
|
|
1900
|
-
/* @__PURE__ */
|
|
1566
|
+
/* @__PURE__ */ jsx_runtime12.jsxs("a", {
|
|
1901
1567
|
href: file.url,
|
|
1902
1568
|
target: "_blank",
|
|
1903
1569
|
rel: "noopener noreferrer",
|
|
1904
1570
|
className: "inline-flex items-center gap-1.5 text-sm text-primary hover:underline",
|
|
1905
1571
|
children: [
|
|
1906
|
-
/* @__PURE__ */
|
|
1572
|
+
/* @__PURE__ */ jsx_runtime12.jsx(import_lucide_react5.Download, {
|
|
1907
1573
|
className: "h-4 w-4"
|
|
1908
1574
|
}),
|
|
1909
1575
|
"Download ",
|
|
@@ -1914,48 +1580,48 @@ function FilePreviewModal({ open, onOpenChange, file }) {
|
|
|
1914
1580
|
})
|
|
1915
1581
|
})
|
|
1916
1582
|
]
|
|
1917
|
-
}) : /* @__PURE__ */
|
|
1583
|
+
}) : /* @__PURE__ */ jsx_runtime12.jsxs(DialogContent, {
|
|
1918
1584
|
children: [
|
|
1919
|
-
/* @__PURE__ */
|
|
1585
|
+
/* @__PURE__ */ jsx_runtime12.jsxs(DialogHeader, {
|
|
1920
1586
|
children: [
|
|
1921
|
-
/* @__PURE__ */
|
|
1587
|
+
/* @__PURE__ */ jsx_runtime12.jsxs(DialogTitle, {
|
|
1922
1588
|
className: "flex items-center gap-2",
|
|
1923
1589
|
children: [
|
|
1924
|
-
/* @__PURE__ */
|
|
1590
|
+
/* @__PURE__ */ jsx_runtime12.jsx(import_lucide_react5.FileIcon, {
|
|
1925
1591
|
className: "h-5 w-5 text-muted-foreground"
|
|
1926
1592
|
}),
|
|
1927
1593
|
file.name
|
|
1928
1594
|
]
|
|
1929
1595
|
}),
|
|
1930
|
-
/* @__PURE__ */
|
|
1596
|
+
/* @__PURE__ */ jsx_runtime12.jsxs(DialogDescription, {
|
|
1931
1597
|
children: [
|
|
1932
|
-
file.size != null && file.size > 0 && /* @__PURE__ */
|
|
1598
|
+
file.size != null && file.size > 0 && /* @__PURE__ */ jsx_runtime12.jsx("span", {
|
|
1933
1599
|
children: formatFileSize(file.size)
|
|
1934
1600
|
}),
|
|
1935
|
-
!canPreview && /* @__PURE__ */
|
|
1601
|
+
!canPreview && /* @__PURE__ */ jsx_runtime12.jsx("span", {
|
|
1936
1602
|
children: " · Preview not available for this file type"
|
|
1937
1603
|
})
|
|
1938
1604
|
]
|
|
1939
1605
|
})
|
|
1940
1606
|
]
|
|
1941
1607
|
}),
|
|
1942
|
-
/* @__PURE__ */
|
|
1608
|
+
/* @__PURE__ */ jsx_runtime12.jsxs("div", {
|
|
1943
1609
|
className: "flex flex-col items-center justify-center py-8 text-muted-foreground gap-3",
|
|
1944
1610
|
children: [
|
|
1945
|
-
/* @__PURE__ */
|
|
1611
|
+
/* @__PURE__ */ jsx_runtime12.jsx(import_lucide_react5.FileIcon, {
|
|
1946
1612
|
className: "h-12 w-12"
|
|
1947
1613
|
}),
|
|
1948
|
-
/* @__PURE__ */
|
|
1614
|
+
/* @__PURE__ */ jsx_runtime12.jsx("p", {
|
|
1949
1615
|
className: "text-sm",
|
|
1950
1616
|
children: "Preview not available"
|
|
1951
1617
|
}),
|
|
1952
|
-
file.url && /^https?:\/\//i.test(file.url) && /* @__PURE__ */
|
|
1618
|
+
file.url && /^https?:\/\//i.test(file.url) && /* @__PURE__ */ jsx_runtime12.jsxs("a", {
|
|
1953
1619
|
href: file.url,
|
|
1954
1620
|
target: "_blank",
|
|
1955
1621
|
rel: "noopener noreferrer",
|
|
1956
1622
|
className: "inline-flex items-center gap-1.5 text-sm text-primary hover:underline",
|
|
1957
1623
|
children: [
|
|
1958
|
-
/* @__PURE__ */
|
|
1624
|
+
/* @__PURE__ */ jsx_runtime12.jsx(import_lucide_react5.Download, {
|
|
1959
1625
|
className: "h-4 w-4"
|
|
1960
1626
|
}),
|
|
1961
1627
|
"Download file"
|
|
@@ -1969,23 +1635,23 @@ function FilePreviewModal({ open, onOpenChange, file }) {
|
|
|
1969
1635
|
}
|
|
1970
1636
|
|
|
1971
1637
|
// src/ui/components/image-lightbox.tsx
|
|
1972
|
-
var
|
|
1973
|
-
var
|
|
1974
|
-
var
|
|
1638
|
+
var import_react9 = require("react");
|
|
1639
|
+
var import_lucide_react6 = require("lucide-react");
|
|
1640
|
+
var jsx_runtime13 = require("react/jsx-runtime");
|
|
1975
1641
|
function ImageLightbox({ open, onOpenChange, images, initialIndex = 0 }) {
|
|
1976
|
-
const [currentIndex, setCurrentIndex] =
|
|
1642
|
+
const [currentIndex, setCurrentIndex] = import_react9.useState(initialIndex);
|
|
1977
1643
|
const hasMultiple = images.length > 1;
|
|
1978
|
-
|
|
1644
|
+
import_react9.useEffect(() => {
|
|
1979
1645
|
if (open)
|
|
1980
1646
|
setCurrentIndex(initialIndex);
|
|
1981
1647
|
}, [open, initialIndex]);
|
|
1982
|
-
const goNext =
|
|
1648
|
+
const goNext = import_react9.useCallback(() => {
|
|
1983
1649
|
setCurrentIndex((i) => (i + 1) % images.length);
|
|
1984
1650
|
}, [images.length]);
|
|
1985
|
-
const goPrev =
|
|
1651
|
+
const goPrev = import_react9.useCallback(() => {
|
|
1986
1652
|
setCurrentIndex((i) => (i - 1 + images.length) % images.length);
|
|
1987
1653
|
}, [images.length]);
|
|
1988
|
-
|
|
1654
|
+
import_react9.useEffect(() => {
|
|
1989
1655
|
if (!open || !hasMultiple)
|
|
1990
1656
|
return;
|
|
1991
1657
|
const handler = (e) => {
|
|
@@ -2002,56 +1668,56 @@ function ImageLightbox({ open, onOpenChange, images, initialIndex = 0 }) {
|
|
|
2002
1668
|
const current = images[currentIndex];
|
|
2003
1669
|
if (!current)
|
|
2004
1670
|
return null;
|
|
2005
|
-
return /* @__PURE__ */
|
|
1671
|
+
return /* @__PURE__ */ jsx_runtime13.jsx(Dialog, {
|
|
2006
1672
|
open,
|
|
2007
1673
|
onOpenChange,
|
|
2008
|
-
children: /* @__PURE__ */
|
|
1674
|
+
children: /* @__PURE__ */ jsx_runtime13.jsxs(DialogContent, {
|
|
2009
1675
|
variant: "lightbox",
|
|
2010
1676
|
"aria-describedby": undefined,
|
|
2011
1677
|
children: [
|
|
2012
|
-
/* @__PURE__ */
|
|
1678
|
+
/* @__PURE__ */ jsx_runtime13.jsx(DialogTitle, {
|
|
2013
1679
|
className: "sr-only",
|
|
2014
1680
|
children: current.alt || `Image ${currentIndex + 1} of ${images.length}`
|
|
2015
1681
|
}),
|
|
2016
|
-
/* @__PURE__ */
|
|
1682
|
+
/* @__PURE__ */ jsx_runtime13.jsxs("div", {
|
|
2017
1683
|
className: "relative flex items-center justify-center",
|
|
2018
1684
|
children: [
|
|
2019
|
-
/* @__PURE__ */
|
|
1685
|
+
/* @__PURE__ */ jsx_runtime13.jsx("img", {
|
|
2020
1686
|
src: current.url,
|
|
2021
1687
|
alt: current.alt || "Image preview",
|
|
2022
1688
|
className: "max-h-[85vh] max-w-full object-contain rounded-md"
|
|
2023
1689
|
}),
|
|
2024
|
-
hasMultiple && /* @__PURE__ */
|
|
1690
|
+
hasMultiple && /* @__PURE__ */ jsx_runtime13.jsxs(jsx_runtime13.Fragment, {
|
|
2025
1691
|
children: [
|
|
2026
|
-
/* @__PURE__ */
|
|
1692
|
+
/* @__PURE__ */ jsx_runtime13.jsxs("button", {
|
|
2027
1693
|
type: "button",
|
|
2028
1694
|
onClick: goPrev,
|
|
2029
1695
|
className: cn("absolute left-2 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white", "hover:bg-black/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors"),
|
|
2030
1696
|
children: [
|
|
2031
|
-
/* @__PURE__ */
|
|
1697
|
+
/* @__PURE__ */ jsx_runtime13.jsx(import_lucide_react6.ChevronLeft, {
|
|
2032
1698
|
className: "h-5 w-5"
|
|
2033
1699
|
}),
|
|
2034
|
-
/* @__PURE__ */
|
|
1700
|
+
/* @__PURE__ */ jsx_runtime13.jsx("span", {
|
|
2035
1701
|
className: "sr-only",
|
|
2036
1702
|
children: "Previous image"
|
|
2037
1703
|
})
|
|
2038
1704
|
]
|
|
2039
1705
|
}),
|
|
2040
|
-
/* @__PURE__ */
|
|
1706
|
+
/* @__PURE__ */ jsx_runtime13.jsxs("button", {
|
|
2041
1707
|
type: "button",
|
|
2042
1708
|
onClick: goNext,
|
|
2043
1709
|
className: cn("absolute right-2 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white", "hover:bg-black/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors"),
|
|
2044
1710
|
children: [
|
|
2045
|
-
/* @__PURE__ */
|
|
1711
|
+
/* @__PURE__ */ jsx_runtime13.jsx(import_lucide_react6.ChevronRight, {
|
|
2046
1712
|
className: "h-5 w-5"
|
|
2047
1713
|
}),
|
|
2048
|
-
/* @__PURE__ */
|
|
1714
|
+
/* @__PURE__ */ jsx_runtime13.jsx("span", {
|
|
2049
1715
|
className: "sr-only",
|
|
2050
1716
|
children: "Next image"
|
|
2051
1717
|
})
|
|
2052
1718
|
]
|
|
2053
1719
|
}),
|
|
2054
|
-
/* @__PURE__ */
|
|
1720
|
+
/* @__PURE__ */ jsx_runtime13.jsxs("div", {
|
|
2055
1721
|
className: "absolute bottom-2 left-1/2 -translate-x-1/2 rounded-full bg-black/50 px-3 py-1 text-xs text-white",
|
|
2056
1722
|
children: [
|
|
2057
1723
|
currentIndex + 1,
|
|
@@ -2069,10 +1735,10 @@ function ImageLightbox({ open, onOpenChange, images, initialIndex = 0 }) {
|
|
|
2069
1735
|
}
|
|
2070
1736
|
|
|
2071
1737
|
// src/ui/composed/agno-message/context.ts
|
|
2072
|
-
var
|
|
2073
|
-
var AgnoMessageContext =
|
|
1738
|
+
var import_react10 = require("react");
|
|
1739
|
+
var AgnoMessageContext = import_react10.createContext(null);
|
|
2074
1740
|
function useAgnoMessageContext() {
|
|
2075
|
-
const ctx =
|
|
1741
|
+
const ctx = import_react10.useContext(AgnoMessageContext);
|
|
2076
1742
|
if (!ctx) {
|
|
2077
1743
|
throw new Error("useAgnoMessageContext must be used within an <AgnoMessage> provider. " + "Wrap your slots with <AgnoMessage message={...}>.");
|
|
2078
1744
|
}
|
|
@@ -2080,40 +1746,40 @@ function useAgnoMessageContext() {
|
|
|
2080
1746
|
}
|
|
2081
1747
|
|
|
2082
1748
|
// src/ui/composed/agno-message/reasoning.tsx
|
|
2083
|
-
var
|
|
1749
|
+
var import_lucide_react8 = require("lucide-react");
|
|
2084
1750
|
|
|
2085
1751
|
// src/ui/primitives/accordion.tsx
|
|
2086
|
-
var
|
|
1752
|
+
var React6 = __toESM(require("react"));
|
|
2087
1753
|
var AccordionPrimitive = __toESM(require("@radix-ui/react-accordion"));
|
|
2088
|
-
var
|
|
2089
|
-
var
|
|
1754
|
+
var import_lucide_react7 = require("lucide-react");
|
|
1755
|
+
var jsx_runtime14 = require("react/jsx-runtime");
|
|
2090
1756
|
var Accordion = AccordionPrimitive.Root;
|
|
2091
|
-
var AccordionItem =
|
|
1757
|
+
var AccordionItem = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx_runtime14.jsx(AccordionPrimitive.Item, {
|
|
2092
1758
|
ref,
|
|
2093
1759
|
className: cn("border-b", className),
|
|
2094
1760
|
...props
|
|
2095
1761
|
}));
|
|
2096
1762
|
AccordionItem.displayName = "AccordionItem";
|
|
2097
|
-
var AccordionTrigger =
|
|
1763
|
+
var AccordionTrigger = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx_runtime14.jsx(AccordionPrimitive.Header, {
|
|
2098
1764
|
className: "flex",
|
|
2099
|
-
children: /* @__PURE__ */
|
|
1765
|
+
children: /* @__PURE__ */ jsx_runtime14.jsxs(AccordionPrimitive.Trigger, {
|
|
2100
1766
|
ref,
|
|
2101
1767
|
className: cn("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180", className),
|
|
2102
1768
|
...props,
|
|
2103
1769
|
children: [
|
|
2104
1770
|
children,
|
|
2105
|
-
/* @__PURE__ */
|
|
1771
|
+
/* @__PURE__ */ jsx_runtime14.jsx(import_lucide_react7.ChevronDown, {
|
|
2106
1772
|
className: "h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"
|
|
2107
1773
|
})
|
|
2108
1774
|
]
|
|
2109
1775
|
})
|
|
2110
1776
|
}));
|
|
2111
1777
|
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
|
|
2112
|
-
var AccordionContent =
|
|
1778
|
+
var AccordionContent = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx_runtime14.jsx(AccordionPrimitive.Content, {
|
|
2113
1779
|
ref,
|
|
2114
1780
|
className: "overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",
|
|
2115
1781
|
...props,
|
|
2116
|
-
children: /* @__PURE__ */
|
|
1782
|
+
children: /* @__PURE__ */ jsx_runtime14.jsx("div", {
|
|
2117
1783
|
className: cn("pb-4 pt-0", className),
|
|
2118
1784
|
children
|
|
2119
1785
|
})
|
|
@@ -2121,19 +1787,19 @@ var AccordionContent = React7.forwardRef(({ className, children, ...props }, ref
|
|
|
2121
1787
|
AccordionContent.displayName = AccordionPrimitive.Content.displayName;
|
|
2122
1788
|
|
|
2123
1789
|
// src/ui/composed/agno-message/reasoning.tsx
|
|
2124
|
-
var
|
|
1790
|
+
var jsx_runtime15 = require("react/jsx-runtime");
|
|
2125
1791
|
function AgnoMessageReasoning() {
|
|
2126
1792
|
const { message, classNames } = useAgnoMessageContext();
|
|
2127
1793
|
const steps = message.extra_data?.reasoning_steps;
|
|
2128
1794
|
if (!steps || steps.length === 0)
|
|
2129
1795
|
return null;
|
|
2130
|
-
return /* @__PURE__ */
|
|
1796
|
+
return /* @__PURE__ */ jsx_runtime15.jsxs("div", {
|
|
2131
1797
|
className: cn("space-y-2 pt-1", classNames?.assistant?.reasoning),
|
|
2132
1798
|
children: [
|
|
2133
|
-
/* @__PURE__ */
|
|
1799
|
+
/* @__PURE__ */ jsx_runtime15.jsxs("div", {
|
|
2134
1800
|
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
2135
1801
|
children: [
|
|
2136
|
-
/* @__PURE__ */
|
|
1802
|
+
/* @__PURE__ */ jsx_runtime15.jsx(import_lucide_react8.Lightbulb, {
|
|
2137
1803
|
className: "h-3.5 w-3.5"
|
|
2138
1804
|
}),
|
|
2139
1805
|
"Reasoning (",
|
|
@@ -2141,23 +1807,23 @@ function AgnoMessageReasoning() {
|
|
|
2141
1807
|
" steps)"
|
|
2142
1808
|
]
|
|
2143
1809
|
}),
|
|
2144
|
-
/* @__PURE__ */
|
|
1810
|
+
/* @__PURE__ */ jsx_runtime15.jsx(Accordion, {
|
|
2145
1811
|
type: "multiple",
|
|
2146
1812
|
className: "w-full",
|
|
2147
|
-
children: steps.map((step, idx) => /* @__PURE__ */
|
|
1813
|
+
children: steps.map((step, idx) => /* @__PURE__ */ jsx_runtime15.jsxs(AccordionItem, {
|
|
2148
1814
|
value: `reasoning-${idx}`,
|
|
2149
1815
|
className: "border-muted",
|
|
2150
1816
|
children: [
|
|
2151
|
-
/* @__PURE__ */
|
|
1817
|
+
/* @__PURE__ */ jsx_runtime15.jsx(AccordionTrigger, {
|
|
2152
1818
|
className: "text-xs py-1.5 hover:no-underline",
|
|
2153
1819
|
children: step.title || `Step ${idx + 1}`
|
|
2154
1820
|
}),
|
|
2155
|
-
/* @__PURE__ */
|
|
1821
|
+
/* @__PURE__ */ jsx_runtime15.jsxs(AccordionContent, {
|
|
2156
1822
|
className: "space-y-1.5 text-xs text-muted-foreground",
|
|
2157
1823
|
children: [
|
|
2158
|
-
step.action && /* @__PURE__ */
|
|
1824
|
+
step.action && /* @__PURE__ */ jsx_runtime15.jsxs("div", {
|
|
2159
1825
|
children: [
|
|
2160
|
-
/* @__PURE__ */
|
|
1826
|
+
/* @__PURE__ */ jsx_runtime15.jsx("span", {
|
|
2161
1827
|
className: "font-medium text-foreground",
|
|
2162
1828
|
children: "Action:"
|
|
2163
1829
|
}),
|
|
@@ -2165,9 +1831,9 @@ function AgnoMessageReasoning() {
|
|
|
2165
1831
|
step.action
|
|
2166
1832
|
]
|
|
2167
1833
|
}),
|
|
2168
|
-
step.reasoning && /* @__PURE__ */
|
|
1834
|
+
step.reasoning && /* @__PURE__ */ jsx_runtime15.jsxs("div", {
|
|
2169
1835
|
children: [
|
|
2170
|
-
/* @__PURE__ */
|
|
1836
|
+
/* @__PURE__ */ jsx_runtime15.jsx("span", {
|
|
2171
1837
|
className: "font-medium text-foreground",
|
|
2172
1838
|
children: "Reasoning:"
|
|
2173
1839
|
}),
|
|
@@ -2175,9 +1841,9 @@ function AgnoMessageReasoning() {
|
|
|
2175
1841
|
step.reasoning
|
|
2176
1842
|
]
|
|
2177
1843
|
}),
|
|
2178
|
-
step.result && /* @__PURE__ */
|
|
1844
|
+
step.result && /* @__PURE__ */ jsx_runtime15.jsxs("div", {
|
|
2179
1845
|
children: [
|
|
2180
|
-
/* @__PURE__ */
|
|
1846
|
+
/* @__PURE__ */ jsx_runtime15.jsx("span", {
|
|
2181
1847
|
className: "font-medium text-foreground",
|
|
2182
1848
|
children: "Result:"
|
|
2183
1849
|
}),
|
|
@@ -2185,9 +1851,9 @@ function AgnoMessageReasoning() {
|
|
|
2185
1851
|
step.result
|
|
2186
1852
|
]
|
|
2187
1853
|
}),
|
|
2188
|
-
step.confidence !== undefined && /* @__PURE__ */
|
|
1854
|
+
step.confidence !== undefined && /* @__PURE__ */ jsx_runtime15.jsxs("div", {
|
|
2189
1855
|
children: [
|
|
2190
|
-
/* @__PURE__ */
|
|
1856
|
+
/* @__PURE__ */ jsx_runtime15.jsx("span", {
|
|
2191
1857
|
className: "font-medium text-foreground",
|
|
2192
1858
|
children: "Confidence:"
|
|
2193
1859
|
}),
|
|
@@ -2206,8 +1872,8 @@ function AgnoMessageReasoning() {
|
|
|
2206
1872
|
}
|
|
2207
1873
|
|
|
2208
1874
|
// src/ui/composed/agno-message/media.tsx
|
|
2209
|
-
var
|
|
2210
|
-
var
|
|
1875
|
+
var import_lucide_react9 = require("lucide-react");
|
|
1876
|
+
var jsx_runtime16 = require("react/jsx-runtime");
|
|
2211
1877
|
function AgnoMessageMedia() {
|
|
2212
1878
|
const {
|
|
2213
1879
|
message,
|
|
@@ -2225,15 +1891,15 @@ function AgnoMessageMedia() {
|
|
|
2225
1891
|
const hasResponseAudio = !!message.response_audio;
|
|
2226
1892
|
if (!hasImages && !hasVideos && !hasAudio && !hasFiles && !hasResponseAudio)
|
|
2227
1893
|
return null;
|
|
2228
|
-
return /* @__PURE__ */
|
|
1894
|
+
return /* @__PURE__ */ jsx_runtime16.jsxs(jsx_runtime16.Fragment, {
|
|
2229
1895
|
children: [
|
|
2230
|
-
hasImages && /* @__PURE__ */
|
|
1896
|
+
hasImages && /* @__PURE__ */ jsx_runtime16.jsxs("div", {
|
|
2231
1897
|
className: cn("space-y-2 pt-1", mediaClassName),
|
|
2232
1898
|
children: [
|
|
2233
|
-
/* @__PURE__ */
|
|
1899
|
+
/* @__PURE__ */ jsx_runtime16.jsxs("div", {
|
|
2234
1900
|
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
2235
1901
|
children: [
|
|
2236
|
-
/* @__PURE__ */
|
|
1902
|
+
/* @__PURE__ */ jsx_runtime16.jsx(import_lucide_react9.Image, {
|
|
2237
1903
|
className: "h-3.5 w-3.5"
|
|
2238
1904
|
}),
|
|
2239
1905
|
"Images (",
|
|
@@ -2241,26 +1907,26 @@ function AgnoMessageMedia() {
|
|
|
2241
1907
|
")"
|
|
2242
1908
|
]
|
|
2243
1909
|
}),
|
|
2244
|
-
/* @__PURE__ */
|
|
1910
|
+
/* @__PURE__ */ jsx_runtime16.jsx("div", {
|
|
2245
1911
|
className: "grid grid-cols-2 gap-2",
|
|
2246
|
-
children: message.images.map((img, idx) => /* @__PURE__ */
|
|
1912
|
+
children: message.images.map((img, idx) => /* @__PURE__ */ jsx_runtime16.jsxs("div", {
|
|
2247
1913
|
className: "space-y-1",
|
|
2248
1914
|
children: [
|
|
2249
|
-
showImageLightbox ? /* @__PURE__ */
|
|
1915
|
+
showImageLightbox ? /* @__PURE__ */ jsx_runtime16.jsx("button", {
|
|
2250
1916
|
type: "button",
|
|
2251
1917
|
onClick: () => openImageLightbox(message.images.map((i) => ({ url: i.url, alt: i.revised_prompt })), idx),
|
|
2252
1918
|
className: "group relative w-full overflow-hidden rounded-lg border border-border cursor-pointer hover:border-primary/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors",
|
|
2253
|
-
children: /* @__PURE__ */
|
|
1919
|
+
children: /* @__PURE__ */ jsx_runtime16.jsx("img", {
|
|
2254
1920
|
src: img.url,
|
|
2255
1921
|
alt: img.revised_prompt || "Generated image",
|
|
2256
1922
|
className: "w-full rounded-lg"
|
|
2257
1923
|
})
|
|
2258
|
-
}) : /* @__PURE__ */
|
|
1924
|
+
}) : /* @__PURE__ */ jsx_runtime16.jsx("img", {
|
|
2259
1925
|
src: img.url,
|
|
2260
1926
|
alt: img.revised_prompt || "Generated image",
|
|
2261
1927
|
className: "w-full rounded-lg border border-border"
|
|
2262
1928
|
}),
|
|
2263
|
-
img.revised_prompt && /* @__PURE__ */
|
|
1929
|
+
img.revised_prompt && /* @__PURE__ */ jsx_runtime16.jsx("p", {
|
|
2264
1930
|
className: "text-[11px] text-muted-foreground italic px-0.5",
|
|
2265
1931
|
children: img.revised_prompt
|
|
2266
1932
|
})
|
|
@@ -2269,13 +1935,13 @@ function AgnoMessageMedia() {
|
|
|
2269
1935
|
})
|
|
2270
1936
|
]
|
|
2271
1937
|
}),
|
|
2272
|
-
hasVideos && /* @__PURE__ */
|
|
1938
|
+
hasVideos && /* @__PURE__ */ jsx_runtime16.jsxs("div", {
|
|
2273
1939
|
className: cn("space-y-2 pt-1", mediaClassName),
|
|
2274
1940
|
children: [
|
|
2275
|
-
/* @__PURE__ */
|
|
1941
|
+
/* @__PURE__ */ jsx_runtime16.jsxs("div", {
|
|
2276
1942
|
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
2277
1943
|
children: [
|
|
2278
|
-
/* @__PURE__ */
|
|
1944
|
+
/* @__PURE__ */ jsx_runtime16.jsx(import_lucide_react9.Video, {
|
|
2279
1945
|
className: "h-3.5 w-3.5"
|
|
2280
1946
|
}),
|
|
2281
1947
|
"Videos (",
|
|
@@ -2283,14 +1949,14 @@ function AgnoMessageMedia() {
|
|
|
2283
1949
|
")"
|
|
2284
1950
|
]
|
|
2285
1951
|
}),
|
|
2286
|
-
/* @__PURE__ */
|
|
1952
|
+
/* @__PURE__ */ jsx_runtime16.jsx("div", {
|
|
2287
1953
|
className: "space-y-2",
|
|
2288
|
-
children: message.videos.map((video, idx) => /* @__PURE__ */
|
|
2289
|
-
children: video.url ? /* @__PURE__ */
|
|
1954
|
+
children: message.videos.map((video, idx) => /* @__PURE__ */ jsx_runtime16.jsx("div", {
|
|
1955
|
+
children: video.url ? /* @__PURE__ */ jsx_runtime16.jsx("video", {
|
|
2290
1956
|
src: video.url,
|
|
2291
1957
|
controls: true,
|
|
2292
1958
|
className: "w-full rounded-lg border border-border"
|
|
2293
|
-
}) : /* @__PURE__ */
|
|
1959
|
+
}) : /* @__PURE__ */ jsx_runtime16.jsxs("div", {
|
|
2294
1960
|
className: "bg-muted/50 border border-border p-2.5 rounded-lg text-xs text-muted-foreground",
|
|
2295
1961
|
children: [
|
|
2296
1962
|
"Video ID: ",
|
|
@@ -2304,13 +1970,13 @@ function AgnoMessageMedia() {
|
|
|
2304
1970
|
})
|
|
2305
1971
|
]
|
|
2306
1972
|
}),
|
|
2307
|
-
hasAudio && /* @__PURE__ */
|
|
1973
|
+
hasAudio && /* @__PURE__ */ jsx_runtime16.jsxs("div", {
|
|
2308
1974
|
className: cn("space-y-2 pt-1", mediaClassName),
|
|
2309
1975
|
children: [
|
|
2310
|
-
/* @__PURE__ */
|
|
1976
|
+
/* @__PURE__ */ jsx_runtime16.jsxs("div", {
|
|
2311
1977
|
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
2312
1978
|
children: [
|
|
2313
|
-
/* @__PURE__ */
|
|
1979
|
+
/* @__PURE__ */ jsx_runtime16.jsx(import_lucide_react9.Music, {
|
|
2314
1980
|
className: "h-3.5 w-3.5"
|
|
2315
1981
|
}),
|
|
2316
1982
|
"Audio (",
|
|
@@ -2318,18 +1984,18 @@ function AgnoMessageMedia() {
|
|
|
2318
1984
|
")"
|
|
2319
1985
|
]
|
|
2320
1986
|
}),
|
|
2321
|
-
/* @__PURE__ */
|
|
1987
|
+
/* @__PURE__ */ jsx_runtime16.jsx("div", {
|
|
2322
1988
|
className: "space-y-2",
|
|
2323
|
-
children: message.audio.map((audio, idx) => /* @__PURE__ */
|
|
2324
|
-
children: audio.url ? /* @__PURE__ */
|
|
1989
|
+
children: message.audio.map((audio, idx) => /* @__PURE__ */ jsx_runtime16.jsx("div", {
|
|
1990
|
+
children: audio.url ? /* @__PURE__ */ jsx_runtime16.jsx("audio", {
|
|
2325
1991
|
src: audio.url,
|
|
2326
1992
|
controls: true,
|
|
2327
1993
|
className: "w-full"
|
|
2328
|
-
}) : audio.base64_audio ? /* @__PURE__ */
|
|
1994
|
+
}) : audio.base64_audio ? /* @__PURE__ */ jsx_runtime16.jsx("audio", {
|
|
2329
1995
|
src: `data:${audio.mime_type || "audio/wav"};base64,${audio.base64_audio}`,
|
|
2330
1996
|
controls: true,
|
|
2331
1997
|
className: "w-full"
|
|
2332
|
-
}) : /* @__PURE__ */
|
|
1998
|
+
}) : /* @__PURE__ */ jsx_runtime16.jsx("div", {
|
|
2333
1999
|
className: "bg-muted/50 border border-border p-2.5 rounded-lg text-xs text-muted-foreground",
|
|
2334
2000
|
children: "Audio data unavailable"
|
|
2335
2001
|
})
|
|
@@ -2337,13 +2003,13 @@ function AgnoMessageMedia() {
|
|
|
2337
2003
|
})
|
|
2338
2004
|
]
|
|
2339
2005
|
}),
|
|
2340
|
-
hasFiles && /* @__PURE__ */
|
|
2006
|
+
hasFiles && /* @__PURE__ */ jsx_runtime16.jsxs("div", {
|
|
2341
2007
|
className: cn("space-y-2 pt-1", mediaClassName),
|
|
2342
2008
|
children: [
|
|
2343
|
-
/* @__PURE__ */
|
|
2009
|
+
/* @__PURE__ */ jsx_runtime16.jsxs("div", {
|
|
2344
2010
|
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
2345
2011
|
children: [
|
|
2346
|
-
/* @__PURE__ */
|
|
2012
|
+
/* @__PURE__ */ jsx_runtime16.jsx(import_lucide_react9.Paperclip, {
|
|
2347
2013
|
className: "h-3.5 w-3.5"
|
|
2348
2014
|
}),
|
|
2349
2015
|
"Files (",
|
|
@@ -2351,22 +2017,22 @@ function AgnoMessageMedia() {
|
|
|
2351
2017
|
")"
|
|
2352
2018
|
]
|
|
2353
2019
|
}),
|
|
2354
|
-
/* @__PURE__ */
|
|
2020
|
+
/* @__PURE__ */ jsx_runtime16.jsx("div", {
|
|
2355
2021
|
className: "flex flex-wrap gap-2",
|
|
2356
|
-
children: message.files.map((file, idx) => showFilePreview ? /* @__PURE__ */
|
|
2022
|
+
children: message.files.map((file, idx) => showFilePreview ? /* @__PURE__ */ jsx_runtime16.jsx(FilePreviewCard, {
|
|
2357
2023
|
file: { name: file.name, type: file.type, url: file.url, size: file.size },
|
|
2358
2024
|
onClick: () => openFilePreview({ name: file.name, type: file.type, url: file.url, size: file.size })
|
|
2359
|
-
}, idx) : /* @__PURE__ */
|
|
2025
|
+
}, idx) : /* @__PURE__ */ jsx_runtime16.jsxs("div", {
|
|
2360
2026
|
className: "flex items-center gap-2 rounded-lg border border-border px-3 py-2 text-xs bg-muted/30 hover:bg-muted/50 transition-colors",
|
|
2361
2027
|
children: [
|
|
2362
|
-
/* @__PURE__ */
|
|
2028
|
+
/* @__PURE__ */ jsx_runtime16.jsx(import_lucide_react9.FileIcon, {
|
|
2363
2029
|
className: "h-3.5 w-3.5 shrink-0 text-muted-foreground"
|
|
2364
2030
|
}),
|
|
2365
|
-
/* @__PURE__ */
|
|
2031
|
+
/* @__PURE__ */ jsx_runtime16.jsx("span", {
|
|
2366
2032
|
className: "truncate max-w-[180px]",
|
|
2367
2033
|
children: file.name
|
|
2368
2034
|
}),
|
|
2369
|
-
file.size && /* @__PURE__ */
|
|
2035
|
+
file.size && /* @__PURE__ */ jsx_runtime16.jsxs("span", {
|
|
2370
2036
|
className: "text-muted-foreground/70",
|
|
2371
2037
|
children: [
|
|
2372
2038
|
"(",
|
|
@@ -2374,7 +2040,7 @@ function AgnoMessageMedia() {
|
|
|
2374
2040
|
"KB)"
|
|
2375
2041
|
]
|
|
2376
2042
|
}),
|
|
2377
|
-
file.url && /^https?:\/\//i.test(file.url) && /* @__PURE__ */
|
|
2043
|
+
file.url && /^https?:\/\//i.test(file.url) && /* @__PURE__ */ jsx_runtime16.jsx("a", {
|
|
2378
2044
|
href: file.url,
|
|
2379
2045
|
target: "_blank",
|
|
2380
2046
|
rel: "noopener noreferrer",
|
|
@@ -2386,19 +2052,19 @@ function AgnoMessageMedia() {
|
|
|
2386
2052
|
})
|
|
2387
2053
|
]
|
|
2388
2054
|
}),
|
|
2389
|
-
hasResponseAudio && message.response_audio && /* @__PURE__ */
|
|
2055
|
+
hasResponseAudio && message.response_audio && /* @__PURE__ */ jsx_runtime16.jsxs("div", {
|
|
2390
2056
|
className: cn("space-y-2 pt-1", mediaClassName),
|
|
2391
2057
|
children: [
|
|
2392
|
-
/* @__PURE__ */
|
|
2058
|
+
/* @__PURE__ */ jsx_runtime16.jsxs("div", {
|
|
2393
2059
|
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
2394
2060
|
children: [
|
|
2395
|
-
/* @__PURE__ */
|
|
2061
|
+
/* @__PURE__ */ jsx_runtime16.jsx(import_lucide_react9.Music, {
|
|
2396
2062
|
className: "h-3.5 w-3.5"
|
|
2397
2063
|
}),
|
|
2398
2064
|
"Response Audio"
|
|
2399
2065
|
]
|
|
2400
2066
|
}),
|
|
2401
|
-
message.response_audio.transcript && /* @__PURE__ */
|
|
2067
|
+
message.response_audio.transcript && /* @__PURE__ */ jsx_runtime16.jsxs("div", {
|
|
2402
2068
|
className: "text-xs italic bg-muted/50 border border-border p-2.5 rounded-lg text-muted-foreground",
|
|
2403
2069
|
children: [
|
|
2404
2070
|
'"',
|
|
@@ -2406,7 +2072,7 @@ function AgnoMessageMedia() {
|
|
|
2406
2072
|
'"'
|
|
2407
2073
|
]
|
|
2408
2074
|
}),
|
|
2409
|
-
message.response_audio.content && /* @__PURE__ */
|
|
2075
|
+
message.response_audio.content && /* @__PURE__ */ jsx_runtime16.jsx("audio", {
|
|
2410
2076
|
src: `data:audio/wav;base64,${message.response_audio.content}`,
|
|
2411
2077
|
controls: true,
|
|
2412
2078
|
className: "w-full"
|
|
@@ -2418,10 +2084,10 @@ function AgnoMessageMedia() {
|
|
|
2418
2084
|
}
|
|
2419
2085
|
|
|
2420
2086
|
// src/ui/composed/agno-chat/context.ts
|
|
2421
|
-
var
|
|
2422
|
-
var AgnoChatContext =
|
|
2087
|
+
var import_react11 = require("react");
|
|
2088
|
+
var AgnoChatContext = import_react11.createContext(null);
|
|
2423
2089
|
function useAgnoChatContext() {
|
|
2424
|
-
const ctx =
|
|
2090
|
+
const ctx = import_react11.useContext(AgnoChatContext);
|
|
2425
2091
|
if (!ctx) {
|
|
2426
2092
|
throw new Error("useAgnoChatContext must be used within an <AgnoChat> provider. " + "Wrap your component tree with <AgnoChat>.");
|
|
2427
2093
|
}
|
|
@@ -2429,31 +2095,24 @@ function useAgnoChatContext() {
|
|
|
2429
2095
|
}
|
|
2430
2096
|
|
|
2431
2097
|
// src/ui/composed/agno-message/tools.tsx
|
|
2432
|
-
var
|
|
2098
|
+
var jsx_runtime17 = require("react/jsx-runtime");
|
|
2433
2099
|
function AgnoMessageTools({ renderTool: renderToolProp } = {}) {
|
|
2434
2100
|
const { message, classNames, renderTool: ctxMsgRenderTool } = useAgnoMessageContext();
|
|
2435
2101
|
const { renderTool: ctxChatRenderTool, isDebug } = useAgnoChatContext();
|
|
2436
2102
|
const renderTool = renderToolProp ?? ctxMsgRenderTool ?? ctxChatRenderTool;
|
|
2437
2103
|
if (!message.tool_calls || message.tool_calls.length === 0)
|
|
2438
2104
|
return null;
|
|
2439
|
-
return /* @__PURE__ */
|
|
2105
|
+
return /* @__PURE__ */ jsx_runtime17.jsx("div", {
|
|
2440
2106
|
className: cn("space-y-2 pt-1", classNames?.assistant?.toolCalls),
|
|
2441
2107
|
children: message.tool_calls.map((tool, idx) => {
|
|
2442
|
-
const defaultRender = () => /* @__PURE__ */
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
}),
|
|
2447
|
-
isDebug ? /* @__PURE__ */ jsx_runtime19.jsx(ToolDebugCard, {
|
|
2448
|
-
tool,
|
|
2449
|
-
defaultOpen: idx === 0
|
|
2450
|
-
}) : null
|
|
2451
|
-
]
|
|
2452
|
-
});
|
|
2108
|
+
const defaultRender = () => isDebug ? /* @__PURE__ */ jsx_runtime17.jsx(ToolDebugCard, {
|
|
2109
|
+
tool,
|
|
2110
|
+
defaultOpen: idx === 0
|
|
2111
|
+
}) : null;
|
|
2453
2112
|
const node = renderTool ? renderTool(tool, { index: idx, isDebug, defaultRender }) : defaultRender();
|
|
2454
2113
|
if (node === null || node === undefined)
|
|
2455
2114
|
return null;
|
|
2456
|
-
return /* @__PURE__ */
|
|
2115
|
+
return /* @__PURE__ */ jsx_runtime17.jsx("div", {
|
|
2457
2116
|
children: node
|
|
2458
2117
|
}, tool.tool_call_id || idx);
|
|
2459
2118
|
})
|
|
@@ -2461,44 +2120,44 @@ function AgnoMessageTools({ renderTool: renderToolProp } = {}) {
|
|
|
2461
2120
|
}
|
|
2462
2121
|
|
|
2463
2122
|
// src/ui/components/response.tsx
|
|
2464
|
-
var
|
|
2123
|
+
var import_react12 = require("react");
|
|
2465
2124
|
var import_streamdown = require("streamdown");
|
|
2466
|
-
var
|
|
2467
|
-
var Response =
|
|
2125
|
+
var jsx_runtime18 = require("react/jsx-runtime");
|
|
2126
|
+
var Response = import_react12.memo(({ className, ...props }) => /* @__PURE__ */ jsx_runtime18.jsx(import_streamdown.Streamdown, {
|
|
2468
2127
|
className: cn("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0", className),
|
|
2469
2128
|
...props
|
|
2470
2129
|
}), (prevProps, nextProps) => prevProps.children === nextProps.children);
|
|
2471
2130
|
Response.displayName = "Response";
|
|
2472
2131
|
|
|
2473
2132
|
// src/ui/composed/agno-message/content.tsx
|
|
2474
|
-
var
|
|
2133
|
+
var jsx_runtime19 = require("react/jsx-runtime");
|
|
2475
2134
|
function AgnoMessageContent() {
|
|
2476
2135
|
const { message } = useAgnoMessageContext();
|
|
2477
2136
|
if (!message.content)
|
|
2478
2137
|
return null;
|
|
2479
|
-
return /* @__PURE__ */
|
|
2138
|
+
return /* @__PURE__ */ jsx_runtime19.jsx("div", {
|
|
2480
2139
|
className: "prose prose-sm dark:prose-invert max-w-none prose-p:leading-relaxed prose-pre:bg-muted prose-pre:border prose-pre:border-border",
|
|
2481
|
-
children: /* @__PURE__ */
|
|
2140
|
+
children: /* @__PURE__ */ jsx_runtime19.jsx(Response, {
|
|
2482
2141
|
children: message.content
|
|
2483
2142
|
})
|
|
2484
2143
|
});
|
|
2485
2144
|
}
|
|
2486
2145
|
|
|
2487
2146
|
// src/ui/composed/agno-message/references.tsx
|
|
2488
|
-
var
|
|
2489
|
-
var
|
|
2147
|
+
var import_lucide_react10 = require("lucide-react");
|
|
2148
|
+
var jsx_runtime20 = require("react/jsx-runtime");
|
|
2490
2149
|
function AgnoMessageReferences() {
|
|
2491
2150
|
const { message, classNames } = useAgnoMessageContext();
|
|
2492
2151
|
const references = message.extra_data?.references;
|
|
2493
2152
|
if (!references || references.length === 0)
|
|
2494
2153
|
return null;
|
|
2495
|
-
return /* @__PURE__ */
|
|
2154
|
+
return /* @__PURE__ */ jsx_runtime20.jsxs("div", {
|
|
2496
2155
|
className: cn("space-y-2 pt-1", classNames?.assistant?.references),
|
|
2497
2156
|
children: [
|
|
2498
|
-
/* @__PURE__ */
|
|
2157
|
+
/* @__PURE__ */ jsx_runtime20.jsxs("div", {
|
|
2499
2158
|
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
2500
2159
|
children: [
|
|
2501
|
-
/* @__PURE__ */
|
|
2160
|
+
/* @__PURE__ */ jsx_runtime20.jsx(import_lucide_react10.FileText, {
|
|
2502
2161
|
className: "h-3.5 w-3.5"
|
|
2503
2162
|
}),
|
|
2504
2163
|
"References (",
|
|
@@ -2506,22 +2165,22 @@ function AgnoMessageReferences() {
|
|
|
2506
2165
|
")"
|
|
2507
2166
|
]
|
|
2508
2167
|
}),
|
|
2509
|
-
/* @__PURE__ */
|
|
2168
|
+
/* @__PURE__ */ jsx_runtime20.jsx("div", {
|
|
2510
2169
|
className: "space-y-2",
|
|
2511
|
-
children: references.map((refData, idx) => /* @__PURE__ */
|
|
2170
|
+
children: references.map((refData, idx) => /* @__PURE__ */ jsx_runtime20.jsxs("div", {
|
|
2512
2171
|
className: "text-xs space-y-1.5",
|
|
2513
2172
|
children: [
|
|
2514
|
-
refData.query && /* @__PURE__ */
|
|
2173
|
+
refData.query && /* @__PURE__ */ jsx_runtime20.jsxs("div", {
|
|
2515
2174
|
className: "font-medium text-foreground",
|
|
2516
2175
|
children: [
|
|
2517
2176
|
"Query: ",
|
|
2518
2177
|
refData.query
|
|
2519
2178
|
]
|
|
2520
2179
|
}),
|
|
2521
|
-
refData.references.map((ref, refIdx) => /* @__PURE__ */
|
|
2180
|
+
refData.references.map((ref, refIdx) => /* @__PURE__ */ jsx_runtime20.jsxs("div", {
|
|
2522
2181
|
className: "bg-muted/50 border border-border p-2.5 rounded-lg",
|
|
2523
2182
|
children: [
|
|
2524
|
-
/* @__PURE__ */
|
|
2183
|
+
/* @__PURE__ */ jsx_runtime20.jsxs("div", {
|
|
2525
2184
|
className: "italic text-muted-foreground mb-1",
|
|
2526
2185
|
children: [
|
|
2527
2186
|
'"',
|
|
@@ -2529,7 +2188,7 @@ function AgnoMessageReferences() {
|
|
|
2529
2188
|
'"'
|
|
2530
2189
|
]
|
|
2531
2190
|
}),
|
|
2532
|
-
/* @__PURE__ */
|
|
2191
|
+
/* @__PURE__ */ jsx_runtime20.jsxs("div", {
|
|
2533
2192
|
className: "text-muted-foreground/70",
|
|
2534
2193
|
children: [
|
|
2535
2194
|
"Source: ",
|
|
@@ -2551,8 +2210,8 @@ function AgnoMessageReferences() {
|
|
|
2551
2210
|
}
|
|
2552
2211
|
|
|
2553
2212
|
// src/ui/composed/agno-message/footer.tsx
|
|
2554
|
-
var
|
|
2555
|
-
var
|
|
2213
|
+
var import_lucide_react11 = require("lucide-react");
|
|
2214
|
+
var jsx_runtime21 = require("react/jsx-runtime");
|
|
2556
2215
|
function AgnoMessageFooter({ showTimestamp = true } = {}) {
|
|
2557
2216
|
const { message, classNames, actions, isLastAssistantMessage, formatTimestamp } = useAgnoMessageContext();
|
|
2558
2217
|
const hasError = message.streamingError;
|
|
@@ -2560,7 +2219,7 @@ function AgnoMessageFooter({ showTimestamp = true } = {}) {
|
|
|
2560
2219
|
const resolvedFormatTimestamp = formatTimestamp ?? formatSmartTimestamp;
|
|
2561
2220
|
if (!actions?.assistant && !showTimestamp && !hasError)
|
|
2562
2221
|
return null;
|
|
2563
|
-
return /* @__PURE__ */
|
|
2222
|
+
return /* @__PURE__ */ jsx_runtime21.jsxs("div", {
|
|
2564
2223
|
className: "flex items-center gap-2 pt-1",
|
|
2565
2224
|
children: [
|
|
2566
2225
|
actions?.assistant && (() => {
|
|
@@ -2568,21 +2227,21 @@ function AgnoMessageFooter({ showTimestamp = true } = {}) {
|
|
|
2568
2227
|
if (visibility === "last-assistant" && !isLastAssistantMessage)
|
|
2569
2228
|
return null;
|
|
2570
2229
|
const useHover = visibility === "hover" || visibility === "hover-last-visible" && !isLastAssistantMessage;
|
|
2571
|
-
return /* @__PURE__ */
|
|
2230
|
+
return /* @__PURE__ */ jsx_runtime21.jsx("div", {
|
|
2572
2231
|
className: cn("flex items-center gap-1 transition-opacity", useHover && "opacity-0 group-hover/message:opacity-100", classNames?.assistant?.actions),
|
|
2573
2232
|
children: actions.assistant(message)
|
|
2574
2233
|
});
|
|
2575
2234
|
})(),
|
|
2576
|
-
hasError && /* @__PURE__ */
|
|
2235
|
+
hasError && /* @__PURE__ */ jsx_runtime21.jsxs("span", {
|
|
2577
2236
|
className: "flex items-center gap-1 text-[11px] text-destructive",
|
|
2578
2237
|
children: [
|
|
2579
|
-
/* @__PURE__ */
|
|
2238
|
+
/* @__PURE__ */ jsx_runtime21.jsx(import_lucide_react11.AlertCircle, {
|
|
2580
2239
|
className: "h-3 w-3"
|
|
2581
2240
|
}),
|
|
2582
2241
|
"Error"
|
|
2583
2242
|
]
|
|
2584
2243
|
}),
|
|
2585
|
-
showTimestamp && /* @__PURE__ */
|
|
2244
|
+
showTimestamp && /* @__PURE__ */ jsx_runtime21.jsx(SmartTimestamp, {
|
|
2586
2245
|
date: new Date(message.created_at * 1000),
|
|
2587
2246
|
formatShort: isCustomTimestamp ? resolvedFormatTimestamp : undefined,
|
|
2588
2247
|
className: "text-[11px] text-muted-foreground"
|
|
@@ -2592,16 +2251,16 @@ function AgnoMessageFooter({ showTimestamp = true } = {}) {
|
|
|
2592
2251
|
}
|
|
2593
2252
|
|
|
2594
2253
|
// src/ui/composed/agno-message/message.tsx
|
|
2595
|
-
var
|
|
2254
|
+
var jsx_runtime22 = require("react/jsx-runtime");
|
|
2596
2255
|
function DefaultAssistantComposition({ showTimestamp }) {
|
|
2597
|
-
return /* @__PURE__ */
|
|
2256
|
+
return /* @__PURE__ */ jsx_runtime22.jsxs(jsx_runtime22.Fragment, {
|
|
2598
2257
|
children: [
|
|
2599
|
-
/* @__PURE__ */
|
|
2600
|
-
/* @__PURE__ */
|
|
2601
|
-
/* @__PURE__ */
|
|
2602
|
-
/* @__PURE__ */
|
|
2603
|
-
/* @__PURE__ */
|
|
2604
|
-
/* @__PURE__ */
|
|
2258
|
+
/* @__PURE__ */ jsx_runtime22.jsx(AgnoMessageReasoning, {}),
|
|
2259
|
+
/* @__PURE__ */ jsx_runtime22.jsx(AgnoMessageMedia, {}),
|
|
2260
|
+
/* @__PURE__ */ jsx_runtime22.jsx(AgnoMessageTools, {}),
|
|
2261
|
+
/* @__PURE__ */ jsx_runtime22.jsx(AgnoMessageContent, {}),
|
|
2262
|
+
/* @__PURE__ */ jsx_runtime22.jsx(AgnoMessageReferences, {}),
|
|
2263
|
+
/* @__PURE__ */ jsx_runtime22.jsx(AgnoMessageFooter, {
|
|
2605
2264
|
showTimestamp
|
|
2606
2265
|
})
|
|
2607
2266
|
]
|
|
@@ -2623,10 +2282,10 @@ function AgnoMessage({
|
|
|
2623
2282
|
}) {
|
|
2624
2283
|
const isUser = message.role === "user";
|
|
2625
2284
|
const hasError = message.streamingError;
|
|
2626
|
-
const [preview, setPreview] =
|
|
2285
|
+
const [preview, setPreview] = import_react13.useState(null);
|
|
2627
2286
|
const isCustomTimestamp = !!formatTimestamp;
|
|
2628
2287
|
const resolvedFormatTimestamp = formatTimestamp ?? formatSmartTimestamp;
|
|
2629
|
-
const ctx =
|
|
2288
|
+
const ctx = import_react13.useMemo(() => ({
|
|
2630
2289
|
message,
|
|
2631
2290
|
isLastAssistantMessage,
|
|
2632
2291
|
classNames,
|
|
@@ -2658,12 +2317,12 @@ function AgnoMessage({
|
|
|
2658
2317
|
renderTool
|
|
2659
2318
|
]);
|
|
2660
2319
|
const closePreview = () => setPreview(null);
|
|
2661
|
-
return /* @__PURE__ */
|
|
2320
|
+
return /* @__PURE__ */ jsx_runtime22.jsx(AgnoMessageContext.Provider, {
|
|
2662
2321
|
value: ctx,
|
|
2663
|
-
children: /* @__PURE__ */
|
|
2322
|
+
children: /* @__PURE__ */ jsx_runtime22.jsxs("div", {
|
|
2664
2323
|
className: cn("py-5 first:pt-2", isUser ? "flex justify-end" : "", classNames?.root, className),
|
|
2665
2324
|
children: [
|
|
2666
|
-
isUser ? /* @__PURE__ */
|
|
2325
|
+
isUser ? /* @__PURE__ */ jsx_runtime22.jsx(UserMessageLayout, {
|
|
2667
2326
|
message,
|
|
2668
2327
|
classNames,
|
|
2669
2328
|
avatars,
|
|
@@ -2676,19 +2335,19 @@ function AgnoMessage({
|
|
|
2676
2335
|
openImageLightbox: ctx.openImageLightbox,
|
|
2677
2336
|
openFilePreview: ctx.openFilePreview,
|
|
2678
2337
|
hasError
|
|
2679
|
-
}) : /* @__PURE__ */
|
|
2338
|
+
}) : /* @__PURE__ */ jsx_runtime22.jsxs("div", {
|
|
2680
2339
|
className: "flex items-start gap-3 group/message",
|
|
2681
2340
|
children: [
|
|
2682
2341
|
avatars?.assistant,
|
|
2683
|
-
/* @__PURE__ */
|
|
2342
|
+
/* @__PURE__ */ jsx_runtime22.jsx("div", {
|
|
2684
2343
|
className: cn("flex-1 min-w-0 space-y-3", classNames?.assistant?.container),
|
|
2685
|
-
children: children ?? /* @__PURE__ */
|
|
2344
|
+
children: children ?? /* @__PURE__ */ jsx_runtime22.jsx(DefaultAssistantComposition, {
|
|
2686
2345
|
showTimestamp
|
|
2687
2346
|
})
|
|
2688
2347
|
})
|
|
2689
2348
|
]
|
|
2690
2349
|
}),
|
|
2691
|
-
preview?.type === "image" && /* @__PURE__ */
|
|
2350
|
+
preview?.type === "image" && /* @__PURE__ */ jsx_runtime22.jsx(ImageLightbox, {
|
|
2692
2351
|
open: true,
|
|
2693
2352
|
onOpenChange: (open) => {
|
|
2694
2353
|
if (!open)
|
|
@@ -2697,7 +2356,7 @@ function AgnoMessage({
|
|
|
2697
2356
|
images: preview.images,
|
|
2698
2357
|
initialIndex: preview.initialIndex
|
|
2699
2358
|
}),
|
|
2700
|
-
preview?.type === "file" && /* @__PURE__ */
|
|
2359
|
+
preview?.type === "file" && /* @__PURE__ */ jsx_runtime22.jsx(FilePreviewModal, {
|
|
2701
2360
|
open: true,
|
|
2702
2361
|
onOpenChange: (open) => {
|
|
2703
2362
|
if (!open)
|
|
@@ -2729,42 +2388,42 @@ function UserMessageLayout({
|
|
|
2729
2388
|
openFilePreview,
|
|
2730
2389
|
hasError
|
|
2731
2390
|
}) {
|
|
2732
|
-
return /* @__PURE__ */
|
|
2391
|
+
return /* @__PURE__ */ jsx_runtime22.jsxs("div", {
|
|
2733
2392
|
className: "flex items-start gap-2.5 max-w-[80%] flex-row-reverse",
|
|
2734
2393
|
children: [
|
|
2735
2394
|
avatars?.user,
|
|
2736
|
-
/* @__PURE__ */
|
|
2395
|
+
/* @__PURE__ */ jsx_runtime22.jsxs("div", {
|
|
2737
2396
|
className: "space-y-1.5 flex flex-col items-end min-w-0",
|
|
2738
2397
|
children: [
|
|
2739
|
-
(message.images && message.images.length > 0 || message.audio && message.audio.length > 0 || message.files && message.files.length > 0) && /* @__PURE__ */
|
|
2398
|
+
(message.images && message.images.length > 0 || message.audio && message.audio.length > 0 || message.files && message.files.length > 0) && /* @__PURE__ */ jsx_runtime22.jsxs("div", {
|
|
2740
2399
|
className: "flex flex-wrap gap-2 justify-end",
|
|
2741
2400
|
children: [
|
|
2742
|
-
message.images?.map((img, idx) => /* @__PURE__ */
|
|
2401
|
+
message.images?.map((img, idx) => /* @__PURE__ */ jsx_runtime22.jsx(FilePreviewCard, {
|
|
2743
2402
|
file: { name: img.revised_prompt || `Image ${idx + 1}`, type: "image/png", url: img.url },
|
|
2744
2403
|
onClick: showImageLightbox ? () => openImageLightbox(message.images.map((i) => ({ url: i.url, alt: i.revised_prompt })), idx) : undefined
|
|
2745
2404
|
}, `img-${idx}`)),
|
|
2746
|
-
message.audio?.map((audio, idx) => /* @__PURE__ */
|
|
2405
|
+
message.audio?.map((audio, idx) => /* @__PURE__ */ jsx_runtime22.jsxs("div", {
|
|
2747
2406
|
className: "flex items-center gap-1.5 rounded-lg border border-border bg-muted/50 px-2.5 py-1.5 text-xs text-foreground self-end",
|
|
2748
2407
|
children: [
|
|
2749
|
-
/* @__PURE__ */
|
|
2408
|
+
/* @__PURE__ */ jsx_runtime22.jsx(import_lucide_react12.Music, {
|
|
2750
2409
|
className: "h-3.5 w-3.5 text-muted-foreground"
|
|
2751
2410
|
}),
|
|
2752
|
-
/* @__PURE__ */
|
|
2411
|
+
/* @__PURE__ */ jsx_runtime22.jsx("span", {
|
|
2753
2412
|
className: "truncate max-w-[150px]",
|
|
2754
2413
|
children: audio.id || `Audio ${idx + 1}`
|
|
2755
2414
|
})
|
|
2756
2415
|
]
|
|
2757
2416
|
}, `audio-${idx}`)),
|
|
2758
|
-
message.files?.map((file, idx) => showFilePreview ? /* @__PURE__ */
|
|
2417
|
+
message.files?.map((file, idx) => showFilePreview ? /* @__PURE__ */ jsx_runtime22.jsx(FilePreviewCard, {
|
|
2759
2418
|
file: { name: file.name, type: file.type, url: file.url, size: file.size },
|
|
2760
2419
|
onClick: () => openFilePreview({ name: file.name, type: file.type, url: file.url, size: file.size })
|
|
2761
|
-
}, `file-${idx}`) : /* @__PURE__ */
|
|
2420
|
+
}, `file-${idx}`) : /* @__PURE__ */ jsx_runtime22.jsxs("div", {
|
|
2762
2421
|
className: "flex items-center gap-1.5 rounded-lg border border-border bg-muted/50 px-2.5 py-1.5 text-xs text-foreground self-end",
|
|
2763
2422
|
children: [
|
|
2764
|
-
/* @__PURE__ */
|
|
2423
|
+
/* @__PURE__ */ jsx_runtime22.jsx(import_lucide_react12.FileIcon, {
|
|
2765
2424
|
className: "h-3.5 w-3.5 text-muted-foreground"
|
|
2766
2425
|
}),
|
|
2767
|
-
/* @__PURE__ */
|
|
2426
|
+
/* @__PURE__ */ jsx_runtime22.jsx("span", {
|
|
2768
2427
|
className: "truncate max-w-[150px]",
|
|
2769
2428
|
children: file.name
|
|
2770
2429
|
})
|
|
@@ -2772,26 +2431,26 @@ function UserMessageLayout({
|
|
|
2772
2431
|
}, `file-${idx}`))
|
|
2773
2432
|
]
|
|
2774
2433
|
}),
|
|
2775
|
-
message.content && /* @__PURE__ */
|
|
2434
|
+
message.content && /* @__PURE__ */ jsx_runtime22.jsx("div", {
|
|
2776
2435
|
className: cn("rounded-2xl rounded-br-md px-4 py-2.5", classNames?.user?.bubble ?? "bg-primary text-primary-foreground", hasError && "opacity-70"),
|
|
2777
|
-
children: /* @__PURE__ */
|
|
2436
|
+
children: /* @__PURE__ */ jsx_runtime22.jsx("p", {
|
|
2778
2437
|
className: "text-sm whitespace-pre-wrap",
|
|
2779
2438
|
children: message.content
|
|
2780
2439
|
})
|
|
2781
2440
|
}),
|
|
2782
|
-
(showTimestamp || actions?.user) && /* @__PURE__ */
|
|
2441
|
+
(showTimestamp || actions?.user) && /* @__PURE__ */ jsx_runtime22.jsxs("div", {
|
|
2783
2442
|
className: "flex items-center justify-end gap-1.5 px-1",
|
|
2784
2443
|
children: [
|
|
2785
|
-
actions?.user && /* @__PURE__ */
|
|
2444
|
+
actions?.user && /* @__PURE__ */ jsx_runtime22.jsx("div", {
|
|
2786
2445
|
className: "flex items-center gap-1",
|
|
2787
2446
|
children: actions.user(message)
|
|
2788
2447
|
}),
|
|
2789
|
-
/* @__PURE__ */
|
|
2448
|
+
/* @__PURE__ */ jsx_runtime22.jsx(SmartTimestamp, {
|
|
2790
2449
|
date: new Date(message.created_at * 1000),
|
|
2791
2450
|
formatShort: isCustomTimestamp ? resolvedFormatTimestamp : undefined,
|
|
2792
2451
|
className: "text-[11px] text-muted-foreground"
|
|
2793
2452
|
}),
|
|
2794
|
-
hasError && /* @__PURE__ */
|
|
2453
|
+
hasError && /* @__PURE__ */ jsx_runtime22.jsx(import_lucide_react12.AlertCircle, {
|
|
2795
2454
|
className: "h-3 w-3 text-destructive"
|
|
2796
2455
|
})
|
|
2797
2456
|
]
|
|
@@ -2802,13 +2461,13 @@ function UserMessageLayout({
|
|
|
2802
2461
|
});
|
|
2803
2462
|
}
|
|
2804
2463
|
// src/hooks/useAgnoCustomEvents.ts
|
|
2805
|
-
var
|
|
2464
|
+
var import_react14 = require("react");
|
|
2806
2465
|
function useAgnoCustomEvents(handler) {
|
|
2807
2466
|
const client = useAgnoClient();
|
|
2808
|
-
const [events, setEvents] =
|
|
2809
|
-
const handlerRef =
|
|
2467
|
+
const [events, setEvents] = import_react14.useState([]);
|
|
2468
|
+
const handlerRef = import_react14.useRef(handler);
|
|
2810
2469
|
handlerRef.current = handler;
|
|
2811
|
-
|
|
2470
|
+
import_react14.useEffect(() => {
|
|
2812
2471
|
const handleCustomEvent = (event) => {
|
|
2813
2472
|
setEvents((prev) => [...prev, event]);
|
|
2814
2473
|
handlerRef.current?.(event);
|
|
@@ -2818,20 +2477,20 @@ function useAgnoCustomEvents(handler) {
|
|
|
2818
2477
|
client.off("custom:event", handleCustomEvent);
|
|
2819
2478
|
};
|
|
2820
2479
|
}, [client]);
|
|
2821
|
-
const clearEvents =
|
|
2480
|
+
const clearEvents = import_react14.useCallback(() => {
|
|
2822
2481
|
setEvents([]);
|
|
2823
2482
|
}, []);
|
|
2824
2483
|
return { events, clearEvents };
|
|
2825
2484
|
}
|
|
2826
2485
|
// src/hooks/useAgnoMemory.ts
|
|
2827
|
-
var
|
|
2486
|
+
var import_react15 = require("react");
|
|
2828
2487
|
function useAgnoMemory() {
|
|
2829
2488
|
const client = useAgnoClient();
|
|
2830
|
-
const [memories, setMemories] =
|
|
2831
|
-
const [topics, setTopics] =
|
|
2832
|
-
const [isLoading, setIsLoading] =
|
|
2833
|
-
const [error, setError] =
|
|
2834
|
-
|
|
2489
|
+
const [memories, setMemories] = import_react15.useState([]);
|
|
2490
|
+
const [topics, setTopics] = import_react15.useState([]);
|
|
2491
|
+
const [isLoading, setIsLoading] = import_react15.useState(false);
|
|
2492
|
+
const [error, setError] = import_react15.useState();
|
|
2493
|
+
import_react15.useEffect(() => {
|
|
2835
2494
|
const handleMemoryCreated = (memory) => {
|
|
2836
2495
|
setMemories((prev) => [memory, ...prev]);
|
|
2837
2496
|
};
|
|
@@ -2866,7 +2525,7 @@ function useAgnoMemory() {
|
|
|
2866
2525
|
client.off("state:change", handleStateChange);
|
|
2867
2526
|
};
|
|
2868
2527
|
}, [client]);
|
|
2869
|
-
const fetchMemories =
|
|
2528
|
+
const fetchMemories = import_react15.useCallback(async (queryParams, options) => {
|
|
2870
2529
|
setIsLoading(true);
|
|
2871
2530
|
setError(undefined);
|
|
2872
2531
|
try {
|
|
@@ -2881,7 +2540,7 @@ function useAgnoMemory() {
|
|
|
2881
2540
|
setIsLoading(false);
|
|
2882
2541
|
}
|
|
2883
2542
|
}, [client]);
|
|
2884
|
-
const getMemoryById =
|
|
2543
|
+
const getMemoryById = import_react15.useCallback(async (memoryId, options) => {
|
|
2885
2544
|
setIsLoading(true);
|
|
2886
2545
|
setError(undefined);
|
|
2887
2546
|
try {
|
|
@@ -2894,7 +2553,7 @@ function useAgnoMemory() {
|
|
|
2894
2553
|
setIsLoading(false);
|
|
2895
2554
|
}
|
|
2896
2555
|
}, [client]);
|
|
2897
|
-
const getMemoryTopics =
|
|
2556
|
+
const getMemoryTopics = import_react15.useCallback(async (options) => {
|
|
2898
2557
|
setIsLoading(true);
|
|
2899
2558
|
setError(undefined);
|
|
2900
2559
|
try {
|
|
@@ -2909,7 +2568,7 @@ function useAgnoMemory() {
|
|
|
2909
2568
|
setIsLoading(false);
|
|
2910
2569
|
}
|
|
2911
2570
|
}, [client]);
|
|
2912
|
-
const getUserMemoryStats =
|
|
2571
|
+
const getUserMemoryStats = import_react15.useCallback(async (queryParams, options) => {
|
|
2913
2572
|
setIsLoading(true);
|
|
2914
2573
|
setError(undefined);
|
|
2915
2574
|
try {
|
|
@@ -2922,7 +2581,7 @@ function useAgnoMemory() {
|
|
|
2922
2581
|
setIsLoading(false);
|
|
2923
2582
|
}
|
|
2924
2583
|
}, [client]);
|
|
2925
|
-
const createMemory =
|
|
2584
|
+
const createMemory = import_react15.useCallback(async (request, options) => {
|
|
2926
2585
|
setIsLoading(true);
|
|
2927
2586
|
setError(undefined);
|
|
2928
2587
|
try {
|
|
@@ -2935,7 +2594,7 @@ function useAgnoMemory() {
|
|
|
2935
2594
|
setIsLoading(false);
|
|
2936
2595
|
}
|
|
2937
2596
|
}, [client]);
|
|
2938
|
-
const updateMemory =
|
|
2597
|
+
const updateMemory = import_react15.useCallback(async (memoryId, request, options) => {
|
|
2939
2598
|
setIsLoading(true);
|
|
2940
2599
|
setError(undefined);
|
|
2941
2600
|
try {
|
|
@@ -2948,7 +2607,7 @@ function useAgnoMemory() {
|
|
|
2948
2607
|
setIsLoading(false);
|
|
2949
2608
|
}
|
|
2950
2609
|
}, [client]);
|
|
2951
|
-
const deleteMemory =
|
|
2610
|
+
const deleteMemory = import_react15.useCallback(async (memoryId, options) => {
|
|
2952
2611
|
setIsLoading(true);
|
|
2953
2612
|
setError(undefined);
|
|
2954
2613
|
try {
|
|
@@ -2961,7 +2620,7 @@ function useAgnoMemory() {
|
|
|
2961
2620
|
setIsLoading(false);
|
|
2962
2621
|
}
|
|
2963
2622
|
}, [client]);
|
|
2964
|
-
const deleteMultipleMemories =
|
|
2623
|
+
const deleteMultipleMemories = import_react15.useCallback(async (memoryIds, options) => {
|
|
2965
2624
|
setIsLoading(true);
|
|
2966
2625
|
setError(undefined);
|
|
2967
2626
|
try {
|
|
@@ -2990,12 +2649,12 @@ function useAgnoMemory() {
|
|
|
2990
2649
|
};
|
|
2991
2650
|
}
|
|
2992
2651
|
// src/hooks/useAgnoSessionState.ts
|
|
2993
|
-
var
|
|
2652
|
+
var import_react16 = require("react");
|
|
2994
2653
|
function useAgnoSessionState() {
|
|
2995
2654
|
const client = useAgnoClient();
|
|
2996
|
-
const [sessionState, setLocalSessionState] =
|
|
2997
|
-
const [isRefreshing, setIsRefreshing] =
|
|
2998
|
-
|
|
2655
|
+
const [sessionState, setLocalSessionState] = import_react16.useState(() => client.getSessionState());
|
|
2656
|
+
const [isRefreshing, setIsRefreshing] = import_react16.useState(() => client.getState().isSessionStateRefreshing ?? false);
|
|
2657
|
+
import_react16.useEffect(() => {
|
|
2999
2658
|
const handleStateChange = (state) => {
|
|
3000
2659
|
setLocalSessionState(state);
|
|
3001
2660
|
};
|
|
@@ -3012,16 +2671,16 @@ function useAgnoSessionState() {
|
|
|
3012
2671
|
client.off("session-state:refresh:end", handleRefreshEnd);
|
|
3013
2672
|
};
|
|
3014
2673
|
}, [client]);
|
|
3015
|
-
const setSessionState =
|
|
2674
|
+
const setSessionState = import_react16.useCallback(async (next) => {
|
|
3016
2675
|
const resolved = typeof next === "function" ? next(client.getSessionState()) : next;
|
|
3017
2676
|
await client.setSessionState(resolved);
|
|
3018
2677
|
}, [client]);
|
|
3019
|
-
const mergeSessionState =
|
|
2678
|
+
const mergeSessionState = import_react16.useCallback(async (partial) => {
|
|
3020
2679
|
const current = client.getSessionState() ?? {};
|
|
3021
2680
|
const merged = { ...current, ...partial };
|
|
3022
2681
|
await client.setSessionState(merged);
|
|
3023
2682
|
}, [client]);
|
|
3024
|
-
const refreshSessionState =
|
|
2683
|
+
const refreshSessionState = import_react16.useCallback(async () => {
|
|
3025
2684
|
const result = await client.refreshSessionState();
|
|
3026
2685
|
return result ?? null;
|
|
3027
2686
|
}, [client]);
|
|
@@ -3034,14 +2693,14 @@ function useAgnoSessionState() {
|
|
|
3034
2693
|
};
|
|
3035
2694
|
}
|
|
3036
2695
|
// src/hooks/useAgnoKnowledge.ts
|
|
3037
|
-
var
|
|
2696
|
+
var import_react17 = require("react");
|
|
3038
2697
|
function useAgnoKnowledge() {
|
|
3039
2698
|
const client = useAgnoClient();
|
|
3040
|
-
const [isLoading, setIsLoading] =
|
|
3041
|
-
const [error, setError] =
|
|
3042
|
-
const [config, setConfig] =
|
|
3043
|
-
const [content, setContent] =
|
|
3044
|
-
const getConfig =
|
|
2699
|
+
const [isLoading, setIsLoading] = import_react17.useState(false);
|
|
2700
|
+
const [error, setError] = import_react17.useState();
|
|
2701
|
+
const [config, setConfig] = import_react17.useState();
|
|
2702
|
+
const [content, setContent] = import_react17.useState([]);
|
|
2703
|
+
const getConfig = import_react17.useCallback(async (options) => {
|
|
3045
2704
|
setIsLoading(true);
|
|
3046
2705
|
setError(undefined);
|
|
3047
2706
|
try {
|
|
@@ -3056,7 +2715,7 @@ function useAgnoKnowledge() {
|
|
|
3056
2715
|
setIsLoading(false);
|
|
3057
2716
|
}
|
|
3058
2717
|
}, [client]);
|
|
3059
|
-
const listContent =
|
|
2718
|
+
const listContent = import_react17.useCallback(async (listOptions, options) => {
|
|
3060
2719
|
setIsLoading(true);
|
|
3061
2720
|
setError(undefined);
|
|
3062
2721
|
try {
|
|
@@ -3071,7 +2730,7 @@ function useAgnoKnowledge() {
|
|
|
3071
2730
|
setIsLoading(false);
|
|
3072
2731
|
}
|
|
3073
2732
|
}, [client]);
|
|
3074
|
-
const getContent =
|
|
2733
|
+
const getContent = import_react17.useCallback(async (contentId, options) => {
|
|
3075
2734
|
setIsLoading(true);
|
|
3076
2735
|
setError(undefined);
|
|
3077
2736
|
try {
|
|
@@ -3084,7 +2743,7 @@ function useAgnoKnowledge() {
|
|
|
3084
2743
|
setIsLoading(false);
|
|
3085
2744
|
}
|
|
3086
2745
|
}, [client]);
|
|
3087
|
-
const getContentStatus =
|
|
2746
|
+
const getContentStatus = import_react17.useCallback(async (contentId, options) => {
|
|
3088
2747
|
setIsLoading(true);
|
|
3089
2748
|
setError(undefined);
|
|
3090
2749
|
try {
|
|
@@ -3097,7 +2756,7 @@ function useAgnoKnowledge() {
|
|
|
3097
2756
|
setIsLoading(false);
|
|
3098
2757
|
}
|
|
3099
2758
|
}, [client]);
|
|
3100
|
-
const search =
|
|
2759
|
+
const search = import_react17.useCallback(async (request, options) => {
|
|
3101
2760
|
setIsLoading(true);
|
|
3102
2761
|
setError(undefined);
|
|
3103
2762
|
try {
|
|
@@ -3110,7 +2769,7 @@ function useAgnoKnowledge() {
|
|
|
3110
2769
|
setIsLoading(false);
|
|
3111
2770
|
}
|
|
3112
2771
|
}, [client]);
|
|
3113
|
-
const uploadContent =
|
|
2772
|
+
const uploadContent = import_react17.useCallback(async (data, options) => {
|
|
3114
2773
|
setIsLoading(true);
|
|
3115
2774
|
setError(undefined);
|
|
3116
2775
|
try {
|
|
@@ -3125,7 +2784,7 @@ function useAgnoKnowledge() {
|
|
|
3125
2784
|
setIsLoading(false);
|
|
3126
2785
|
}
|
|
3127
2786
|
}, [client]);
|
|
3128
|
-
const updateContent =
|
|
2787
|
+
const updateContent = import_react17.useCallback(async (contentId, request, options) => {
|
|
3129
2788
|
setIsLoading(true);
|
|
3130
2789
|
setError(undefined);
|
|
3131
2790
|
try {
|
|
@@ -3140,7 +2799,7 @@ function useAgnoKnowledge() {
|
|
|
3140
2799
|
setIsLoading(false);
|
|
3141
2800
|
}
|
|
3142
2801
|
}, [client]);
|
|
3143
|
-
const deleteAllContent =
|
|
2802
|
+
const deleteAllContent = import_react17.useCallback(async (options) => {
|
|
3144
2803
|
setIsLoading(true);
|
|
3145
2804
|
setError(undefined);
|
|
3146
2805
|
try {
|
|
@@ -3154,7 +2813,7 @@ function useAgnoKnowledge() {
|
|
|
3154
2813
|
setIsLoading(false);
|
|
3155
2814
|
}
|
|
3156
2815
|
}, [client]);
|
|
3157
|
-
const deleteContent =
|
|
2816
|
+
const deleteContent = import_react17.useCallback(async (contentId, options) => {
|
|
3158
2817
|
setIsLoading(true);
|
|
3159
2818
|
setError(undefined);
|
|
3160
2819
|
try {
|
|
@@ -3186,14 +2845,14 @@ function useAgnoKnowledge() {
|
|
|
3186
2845
|
};
|
|
3187
2846
|
}
|
|
3188
2847
|
// src/hooks/useAgnoMetrics.ts
|
|
3189
|
-
var
|
|
2848
|
+
var import_react18 = require("react");
|
|
3190
2849
|
function useAgnoMetrics() {
|
|
3191
2850
|
const client = useAgnoClient();
|
|
3192
|
-
const [isLoading, setIsLoading] =
|
|
3193
|
-
const [isRefreshing, setIsRefreshing] =
|
|
3194
|
-
const [error, setError] =
|
|
3195
|
-
const [metrics, setMetrics] =
|
|
3196
|
-
const fetchMetrics =
|
|
2851
|
+
const [isLoading, setIsLoading] = import_react18.useState(false);
|
|
2852
|
+
const [isRefreshing, setIsRefreshing] = import_react18.useState(false);
|
|
2853
|
+
const [error, setError] = import_react18.useState();
|
|
2854
|
+
const [metrics, setMetrics] = import_react18.useState();
|
|
2855
|
+
const fetchMetrics = import_react18.useCallback(async (options) => {
|
|
3197
2856
|
setIsLoading(true);
|
|
3198
2857
|
setError(undefined);
|
|
3199
2858
|
try {
|
|
@@ -3208,7 +2867,7 @@ function useAgnoMetrics() {
|
|
|
3208
2867
|
setIsLoading(false);
|
|
3209
2868
|
}
|
|
3210
2869
|
}, [client]);
|
|
3211
|
-
const refreshMetrics =
|
|
2870
|
+
const refreshMetrics = import_react18.useCallback(async (options) => {
|
|
3212
2871
|
setIsRefreshing(true);
|
|
3213
2872
|
setError(undefined);
|
|
3214
2873
|
try {
|
|
@@ -3222,7 +2881,7 @@ function useAgnoMetrics() {
|
|
|
3222
2881
|
setIsRefreshing(false);
|
|
3223
2882
|
}
|
|
3224
2883
|
}, [client]);
|
|
3225
|
-
const clearMetrics =
|
|
2884
|
+
const clearMetrics = import_react18.useCallback(() => {
|
|
3226
2885
|
setMetrics(undefined);
|
|
3227
2886
|
setError(undefined);
|
|
3228
2887
|
}, []);
|
|
@@ -3237,14 +2896,14 @@ function useAgnoMetrics() {
|
|
|
3237
2896
|
};
|
|
3238
2897
|
}
|
|
3239
2898
|
// src/hooks/useAgnoEvals.ts
|
|
3240
|
-
var
|
|
2899
|
+
var import_react19 = require("react");
|
|
3241
2900
|
function useAgnoEvals() {
|
|
3242
2901
|
const client = useAgnoClient();
|
|
3243
|
-
const [evalRuns, setEvalRuns] =
|
|
3244
|
-
const [pagination, setPagination] =
|
|
3245
|
-
const [isLoading, setIsLoading] =
|
|
3246
|
-
const [error, setError] =
|
|
3247
|
-
const listEvalRuns =
|
|
2902
|
+
const [evalRuns, setEvalRuns] = import_react19.useState([]);
|
|
2903
|
+
const [pagination, setPagination] = import_react19.useState();
|
|
2904
|
+
const [isLoading, setIsLoading] = import_react19.useState(false);
|
|
2905
|
+
const [error, setError] = import_react19.useState();
|
|
2906
|
+
const listEvalRuns = import_react19.useCallback(async (listParams = {}, options) => {
|
|
3248
2907
|
setIsLoading(true);
|
|
3249
2908
|
setError(undefined);
|
|
3250
2909
|
try {
|
|
@@ -3260,7 +2919,7 @@ function useAgnoEvals() {
|
|
|
3260
2919
|
setIsLoading(false);
|
|
3261
2920
|
}
|
|
3262
2921
|
}, [client]);
|
|
3263
|
-
const getEvalRun =
|
|
2922
|
+
const getEvalRun = import_react19.useCallback(async (evalRunId, options) => {
|
|
3264
2923
|
setIsLoading(true);
|
|
3265
2924
|
setError(undefined);
|
|
3266
2925
|
try {
|
|
@@ -3273,7 +2932,7 @@ function useAgnoEvals() {
|
|
|
3273
2932
|
setIsLoading(false);
|
|
3274
2933
|
}
|
|
3275
2934
|
}, [client]);
|
|
3276
|
-
const executeEval =
|
|
2935
|
+
const executeEval = import_react19.useCallback(async (request, options) => {
|
|
3277
2936
|
setIsLoading(true);
|
|
3278
2937
|
setError(undefined);
|
|
3279
2938
|
try {
|
|
@@ -3288,7 +2947,7 @@ function useAgnoEvals() {
|
|
|
3288
2947
|
setIsLoading(false);
|
|
3289
2948
|
}
|
|
3290
2949
|
}, [client]);
|
|
3291
|
-
const updateEvalRun =
|
|
2950
|
+
const updateEvalRun = import_react19.useCallback(async (evalRunId, request, options) => {
|
|
3292
2951
|
setIsLoading(true);
|
|
3293
2952
|
setError(undefined);
|
|
3294
2953
|
try {
|
|
@@ -3303,7 +2962,7 @@ function useAgnoEvals() {
|
|
|
3303
2962
|
setIsLoading(false);
|
|
3304
2963
|
}
|
|
3305
2964
|
}, [client]);
|
|
3306
|
-
const deleteEvalRuns =
|
|
2965
|
+
const deleteEvalRuns = import_react19.useCallback(async (evalRunIds, options) => {
|
|
3307
2966
|
setIsLoading(true);
|
|
3308
2967
|
setError(undefined);
|
|
3309
2968
|
try {
|
|
@@ -3318,7 +2977,7 @@ function useAgnoEvals() {
|
|
|
3318
2977
|
setIsLoading(false);
|
|
3319
2978
|
}
|
|
3320
2979
|
}, [client]);
|
|
3321
|
-
const renameEvalRun =
|
|
2980
|
+
const renameEvalRun = import_react19.useCallback(async (evalRunId, newName, options) => {
|
|
3322
2981
|
return updateEvalRun(evalRunId, { name: newName }, options);
|
|
3323
2982
|
}, [updateEvalRun]);
|
|
3324
2983
|
return {
|
|
@@ -3335,14 +2994,14 @@ function useAgnoEvals() {
|
|
|
3335
2994
|
};
|
|
3336
2995
|
}
|
|
3337
2996
|
// src/hooks/useAgnoTraces.ts
|
|
3338
|
-
var
|
|
2997
|
+
var import_react20 = require("react");
|
|
3339
2998
|
function useAgnoTraces() {
|
|
3340
2999
|
const client = useAgnoClient();
|
|
3341
|
-
const [traces, setTraces] =
|
|
3342
|
-
const [traceSessionStats, setTraceSessionStats] =
|
|
3343
|
-
const [isLoading, setIsLoading] =
|
|
3344
|
-
const [error, setError] =
|
|
3345
|
-
|
|
3000
|
+
const [traces, setTraces] = import_react20.useState([]);
|
|
3001
|
+
const [traceSessionStats, setTraceSessionStats] = import_react20.useState([]);
|
|
3002
|
+
const [isLoading, setIsLoading] = import_react20.useState(false);
|
|
3003
|
+
const [error, setError] = import_react20.useState();
|
|
3004
|
+
import_react20.useEffect(() => {
|
|
3346
3005
|
const handleStateChange = () => {
|
|
3347
3006
|
const state2 = client.getState();
|
|
3348
3007
|
setTraces(state2.traces);
|
|
@@ -3356,7 +3015,7 @@ function useAgnoTraces() {
|
|
|
3356
3015
|
client.off("state:change", handleStateChange);
|
|
3357
3016
|
};
|
|
3358
3017
|
}, [client]);
|
|
3359
|
-
const fetchTraces =
|
|
3018
|
+
const fetchTraces = import_react20.useCallback(async (options = {}, requestOptions) => {
|
|
3360
3019
|
setIsLoading(true);
|
|
3361
3020
|
setError(undefined);
|
|
3362
3021
|
try {
|
|
@@ -3371,7 +3030,7 @@ function useAgnoTraces() {
|
|
|
3371
3030
|
setIsLoading(false);
|
|
3372
3031
|
}
|
|
3373
3032
|
}, [client]);
|
|
3374
|
-
const getTraceDetail =
|
|
3033
|
+
const getTraceDetail = import_react20.useCallback(async (traceId, options = {}, requestOptions) => {
|
|
3375
3034
|
setIsLoading(true);
|
|
3376
3035
|
setError(undefined);
|
|
3377
3036
|
try {
|
|
@@ -3384,7 +3043,7 @@ function useAgnoTraces() {
|
|
|
3384
3043
|
setIsLoading(false);
|
|
3385
3044
|
}
|
|
3386
3045
|
}, [client]);
|
|
3387
|
-
const fetchTraceSessionStats =
|
|
3046
|
+
const fetchTraceSessionStats = import_react20.useCallback(async (options = {}, requestOptions) => {
|
|
3388
3047
|
setIsLoading(true);
|
|
3389
3048
|
setError(undefined);
|
|
3390
3049
|
try {
|
|
@@ -3410,13 +3069,13 @@ function useAgnoTraces() {
|
|
|
3410
3069
|
};
|
|
3411
3070
|
}
|
|
3412
3071
|
// src/hooks/useAgnoComponents.ts
|
|
3413
|
-
var
|
|
3072
|
+
var import_react21 = require("react");
|
|
3414
3073
|
function useAgnoComponents() {
|
|
3415
3074
|
const client = useAgnoClient();
|
|
3416
|
-
const [components, setComponents] =
|
|
3417
|
-
const [isLoading, setIsLoading] =
|
|
3418
|
-
const [error, setError] =
|
|
3419
|
-
|
|
3075
|
+
const [components, setComponents] = import_react21.useState([]);
|
|
3076
|
+
const [isLoading, setIsLoading] = import_react21.useState(false);
|
|
3077
|
+
const [error, setError] = import_react21.useState();
|
|
3078
|
+
import_react21.useEffect(() => {
|
|
3420
3079
|
const handleComponentCreated = (component) => {
|
|
3421
3080
|
setComponents((prev) => [component, ...prev]);
|
|
3422
3081
|
};
|
|
@@ -3441,7 +3100,7 @@ function useAgnoComponents() {
|
|
|
3441
3100
|
client.off("state:change", handleStateChange);
|
|
3442
3101
|
};
|
|
3443
3102
|
}, [client]);
|
|
3444
|
-
const fetchComponents =
|
|
3103
|
+
const fetchComponents = import_react21.useCallback(async (queryParams, options) => {
|
|
3445
3104
|
setIsLoading(true);
|
|
3446
3105
|
setError(undefined);
|
|
3447
3106
|
try {
|
|
@@ -3456,7 +3115,7 @@ function useAgnoComponents() {
|
|
|
3456
3115
|
setIsLoading(false);
|
|
3457
3116
|
}
|
|
3458
3117
|
}, [client]);
|
|
3459
|
-
const getComponentById =
|
|
3118
|
+
const getComponentById = import_react21.useCallback(async (componentId, options) => {
|
|
3460
3119
|
setIsLoading(true);
|
|
3461
3120
|
setError(undefined);
|
|
3462
3121
|
try {
|
|
@@ -3469,7 +3128,7 @@ function useAgnoComponents() {
|
|
|
3469
3128
|
setIsLoading(false);
|
|
3470
3129
|
}
|
|
3471
3130
|
}, [client]);
|
|
3472
|
-
const createComponent =
|
|
3131
|
+
const createComponent = import_react21.useCallback(async (request, options) => {
|
|
3473
3132
|
setIsLoading(true);
|
|
3474
3133
|
setError(undefined);
|
|
3475
3134
|
try {
|
|
@@ -3482,7 +3141,7 @@ function useAgnoComponents() {
|
|
|
3482
3141
|
setIsLoading(false);
|
|
3483
3142
|
}
|
|
3484
3143
|
}, [client]);
|
|
3485
|
-
const updateComponent =
|
|
3144
|
+
const updateComponent = import_react21.useCallback(async (componentId, request, options) => {
|
|
3486
3145
|
setIsLoading(true);
|
|
3487
3146
|
setError(undefined);
|
|
3488
3147
|
try {
|
|
@@ -3495,7 +3154,7 @@ function useAgnoComponents() {
|
|
|
3495
3154
|
setIsLoading(false);
|
|
3496
3155
|
}
|
|
3497
3156
|
}, [client]);
|
|
3498
|
-
const deleteComponent =
|
|
3157
|
+
const deleteComponent = import_react21.useCallback(async (componentId, options) => {
|
|
3499
3158
|
setIsLoading(true);
|
|
3500
3159
|
setError(undefined);
|
|
3501
3160
|
try {
|
|
@@ -3508,7 +3167,7 @@ function useAgnoComponents() {
|
|
|
3508
3167
|
setIsLoading(false);
|
|
3509
3168
|
}
|
|
3510
3169
|
}, [client]);
|
|
3511
|
-
const fetchComponentConfigs =
|
|
3170
|
+
const fetchComponentConfigs = import_react21.useCallback(async (componentId, options) => {
|
|
3512
3171
|
setIsLoading(true);
|
|
3513
3172
|
setError(undefined);
|
|
3514
3173
|
try {
|
|
@@ -3521,7 +3180,7 @@ function useAgnoComponents() {
|
|
|
3521
3180
|
setIsLoading(false);
|
|
3522
3181
|
}
|
|
3523
3182
|
}, [client]);
|
|
3524
|
-
const createComponentConfig =
|
|
3183
|
+
const createComponentConfig = import_react21.useCallback(async (componentId, request, options) => {
|
|
3525
3184
|
setIsLoading(true);
|
|
3526
3185
|
setError(undefined);
|
|
3527
3186
|
try {
|
|
@@ -3534,7 +3193,7 @@ function useAgnoComponents() {
|
|
|
3534
3193
|
setIsLoading(false);
|
|
3535
3194
|
}
|
|
3536
3195
|
}, [client]);
|
|
3537
|
-
const getCurrentComponentConfig =
|
|
3196
|
+
const getCurrentComponentConfig = import_react21.useCallback(async (componentId, options) => {
|
|
3538
3197
|
setIsLoading(true);
|
|
3539
3198
|
setError(undefined);
|
|
3540
3199
|
try {
|
|
@@ -3547,7 +3206,7 @@ function useAgnoComponents() {
|
|
|
3547
3206
|
setIsLoading(false);
|
|
3548
3207
|
}
|
|
3549
3208
|
}, [client]);
|
|
3550
|
-
const getComponentConfigByVersion =
|
|
3209
|
+
const getComponentConfigByVersion = import_react21.useCallback(async (componentId, version, options) => {
|
|
3551
3210
|
setIsLoading(true);
|
|
3552
3211
|
setError(undefined);
|
|
3553
3212
|
try {
|
|
@@ -3560,7 +3219,7 @@ function useAgnoComponents() {
|
|
|
3560
3219
|
setIsLoading(false);
|
|
3561
3220
|
}
|
|
3562
3221
|
}, [client]);
|
|
3563
|
-
const updateComponentConfig =
|
|
3222
|
+
const updateComponentConfig = import_react21.useCallback(async (componentId, version, request, options) => {
|
|
3564
3223
|
setIsLoading(true);
|
|
3565
3224
|
setError(undefined);
|
|
3566
3225
|
try {
|
|
@@ -3573,7 +3232,7 @@ function useAgnoComponents() {
|
|
|
3573
3232
|
setIsLoading(false);
|
|
3574
3233
|
}
|
|
3575
3234
|
}, [client]);
|
|
3576
|
-
const deleteComponentConfig =
|
|
3235
|
+
const deleteComponentConfig = import_react21.useCallback(async (componentId, version, options) => {
|
|
3577
3236
|
setIsLoading(true);
|
|
3578
3237
|
setError(undefined);
|
|
3579
3238
|
try {
|
|
@@ -3586,7 +3245,7 @@ function useAgnoComponents() {
|
|
|
3586
3245
|
setIsLoading(false);
|
|
3587
3246
|
}
|
|
3588
3247
|
}, [client]);
|
|
3589
|
-
const setCurrentComponentConfig =
|
|
3248
|
+
const setCurrentComponentConfig = import_react21.useCallback(async (componentId, version, options) => {
|
|
3590
3249
|
setIsLoading(true);
|
|
3591
3250
|
setError(undefined);
|
|
3592
3251
|
try {
|
|
@@ -3618,4 +3277,4 @@ function useAgnoComponents() {
|
|
|
3618
3277
|
};
|
|
3619
3278
|
}
|
|
3620
3279
|
|
|
3621
|
-
//# debugId=
|
|
3280
|
+
//# debugId=6A9B00E27FD63EE064756E2164756E21
|