@rodrigocoliveira/agno-react 1.2.0 → 1.3.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.
@@ -0,0 +1,54 @@
1
+ import type { ComponentResponse, ComponentCreate, ComponentUpdate, ComponentConfigResponse, ConfigCreate, ConfigUpdate, ComponentsListResponse, ListComponentsParams } from '@rodrigocoliveira/agno-types';
2
+ /**
3
+ * Hook for AgentOS Studio components (DB-stored agents/teams/workflows).
4
+ *
5
+ * Covers both component CRUD and config versioning. Components live in the
6
+ * AgentOS database and represent agents/teams/workflows that can be created,
7
+ * edited, and published without code changes.
8
+ *
9
+ * Note: the Agno `/components` endpoint has no native filter by `user_id`.
10
+ * For per-user scoping, either store `user_id` in `metadata` and filter
11
+ * client-side, or extend your backend and pass `params: { user_id }` through.
12
+ */
13
+ export declare function useAgnoComponents(): {
14
+ components: ComponentResponse[];
15
+ isLoading: boolean;
16
+ error: string | undefined;
17
+ fetchComponents: (queryParams?: ListComponentsParams, options?: {
18
+ params?: Record<string, string>;
19
+ }) => Promise<ComponentsListResponse>;
20
+ getComponentById: (componentId: string, options?: {
21
+ params?: Record<string, string>;
22
+ }) => Promise<ComponentResponse>;
23
+ createComponent: (request: ComponentCreate, options?: {
24
+ params?: Record<string, string>;
25
+ }) => Promise<ComponentResponse>;
26
+ updateComponent: (componentId: string, request: ComponentUpdate, options?: {
27
+ params?: Record<string, string>;
28
+ }) => Promise<ComponentResponse>;
29
+ deleteComponent: (componentId: string, options?: {
30
+ params?: Record<string, string>;
31
+ }) => Promise<void>;
32
+ fetchComponentConfigs: (componentId: string, options?: {
33
+ params?: Record<string, string>;
34
+ }) => Promise<ComponentConfigResponse[]>;
35
+ createComponentConfig: (componentId: string, request: ConfigCreate, options?: {
36
+ params?: Record<string, string>;
37
+ }) => Promise<ComponentConfigResponse>;
38
+ getCurrentComponentConfig: (componentId: string, options?: {
39
+ params?: Record<string, string>;
40
+ }) => Promise<ComponentConfigResponse>;
41
+ getComponentConfigByVersion: (componentId: string, version: number, options?: {
42
+ params?: Record<string, string>;
43
+ }) => Promise<ComponentConfigResponse>;
44
+ updateComponentConfig: (componentId: string, version: number, request: ConfigUpdate, options?: {
45
+ params?: Record<string, string>;
46
+ }) => Promise<ComponentConfigResponse>;
47
+ deleteComponentConfig: (componentId: string, version: number, options?: {
48
+ params?: Record<string, string>;
49
+ }) => Promise<void>;
50
+ setCurrentComponentConfig: (componentId: string, version: number, options?: {
51
+ params?: Record<string, string>;
52
+ }) => Promise<ComponentConfigResponse>;
53
+ };
54
+ //# sourceMappingURL=useAgnoComponents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAgnoComponents.d.ts","sourceRoot":"","sources":["../../src/hooks/useAgnoComponents.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,uBAAuB,EACvB,YAAY,EACZ,YAAY,EACZ,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,8BAA8B,CAAC;AAGtC;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB;;;;oCA0Cb,oBAAoB,YACxB;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,KAC5C,OAAO,CAAC,sBAAsB,CAAC;oCAoBnB,MAAM,YACT;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,KAC5C,OAAO,CAAC,iBAAiB,CAAC;+BAkBlB,eAAe,YACd;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,KAC5C,OAAO,CAAC,iBAAiB,CAAC;mCAkBd,MAAM,WACV,eAAe,YACd;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,KAC5C,OAAO,CAAC,iBAAiB,CAAC;mCAkBd,MAAM,YACT;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,KAC5C,OAAO,CAAC,IAAI,CAAC;yCAkBD,MAAM,YACT;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,KAC5C,OAAO,CAAC,uBAAuB,EAAE,CAAC;yCAkBtB,MAAM,WACV,YAAY,YACX;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,KAC5C,OAAO,CAAC,uBAAuB,CAAC;6CAkBpB,MAAM,YACT;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,KAC5C,OAAO,CAAC,uBAAuB,CAAC;+CAkBpB,MAAM,WACV,MAAM,YACL;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,KAC5C,OAAO,CAAC,uBAAuB,CAAC;yCAkBpB,MAAM,WACV,MAAM,WACN,YAAY,YACX;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,KAC5C,OAAO,CAAC,uBAAuB,CAAC;yCAkBpB,MAAM,WACV,MAAM,YACL;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,KAC5C,OAAO,CAAC,IAAI,CAAC;6CAkBD,MAAM,WACV,MAAM,YACL;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,KAC5C,OAAO,CAAC,uBAAuB,CAAC;EAiCtC"}
package/dist/index.d.ts CHANGED
@@ -25,6 +25,7 @@ export { useAgnoKnowledge } from './hooks/useAgnoKnowledge';
25
25
  export { useAgnoMetrics } from './hooks/useAgnoMetrics';
26
26
  export { useAgnoEvals } from './hooks/useAgnoEvals';
27
27
  export { useAgnoTraces } from './hooks/useAgnoTraces';
28
+ export { useAgnoComponents } from './hooks/useAgnoComponents';
28
29
  export type { PaginatedTracesResult, PaginatedTraceSessionStatsResult, } from './hooks/useAgnoTraces';
29
- export type { AgnoClientConfig, ChatMessage, ToolCall, SessionEntry, AgentDetails, TeamDetails, ClientState, RunEvent, UIComponentSpec, ChartComponentSpec, CardGridComponentSpec, TableComponentSpec, MarkdownComponentSpec, CustomComponentSpec, ArtifactComponentSpec, ToolHandlerResult, GenerativeUIData, ChartSeries, CardData, TableColumn, CustomEventData, UserMemory, MemoriesListResponse, ListMemoriesParams, CreateMemoryRequest, UpdateMemoryRequest, DeleteMultipleMemoriesRequest, UserMemoryStats, UserMemoryStatsResponse, UserMemoryStatsParams, ContentStatus, ReaderSchema, ChunkerSchema, VectorDbSchema, KnowledgeConfigResponse, ContentResponse, ContentStatusResponse, ContentListResponse, ContentListOptions, VectorSearchRequest, VectorSearchResult, VectorSearchResponse, ContentUploadRequest, ContentUpdateRequest, TokenMetrics, ModelMetrics, DayAggregatedMetrics, MetricsResponse, MetricsOptions, RefreshMetricsOptions, EvalType, EvalComponentType, ScoringStrategy, SortOrder, EvalSchema, ListEvalRunsParams, EvalRunsListResponse, ExecuteEvalRequest, UpdateEvalRunRequest, DeleteEvalRunsRequest, TraceStatus, TraceSummary, TraceNode, TraceDetail, TraceSessionStats, TracesListResponse, TraceSessionStatsResponse, ListTracesOptions, GetTraceOptions, GetTraceSessionStatsOptions, PaginationInfo, } from '@rodrigocoliveira/agno-types';
30
+ export type { AgnoClientConfig, ChatMessage, ToolCall, SessionEntry, AgentDetails, TeamDetails, ClientState, RunEvent, UIComponentSpec, ChartComponentSpec, CardGridComponentSpec, TableComponentSpec, MarkdownComponentSpec, CustomComponentSpec, ArtifactComponentSpec, ToolHandlerResult, GenerativeUIData, ChartSeries, CardData, TableColumn, CustomEventData, UserMemory, MemoriesListResponse, ListMemoriesParams, CreateMemoryRequest, UpdateMemoryRequest, DeleteMultipleMemoriesRequest, UserMemoryStats, UserMemoryStatsResponse, UserMemoryStatsParams, ContentStatus, ReaderSchema, ChunkerSchema, VectorDbSchema, KnowledgeConfigResponse, ContentResponse, ContentStatusResponse, ContentListResponse, ContentListOptions, VectorSearchRequest, VectorSearchResult, VectorSearchResponse, ContentUploadRequest, ContentUpdateRequest, TokenMetrics, ModelMetrics, DayAggregatedMetrics, MetricsResponse, MetricsOptions, RefreshMetricsOptions, EvalType, EvalComponentType, ScoringStrategy, SortOrder, EvalSchema, ListEvalRunsParams, EvalRunsListResponse, ExecuteEvalRequest, UpdateEvalRunRequest, DeleteEvalRunsRequest, TraceStatus, TraceSummary, TraceNode, TraceDetail, TraceSessionStats, TracesListResponse, TraceSessionStatsResponse, ListTracesOptions, GetTraceOptions, GetTraceSessionStatsOptions, PaginationInfo, ComponentType, ListComponentsParams, ComponentCreate, ComponentUpdate, ComponentResponse, ConfigCreate, ConfigUpdate, ComponentConfigResponse, ComponentsListResponse, } from '@rodrigocoliveira/agno-types';
30
31
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACpE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpF,YAAY,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAGtG,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,YAAY,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AACnF,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EAAE,iBAAiB,EAAE,MAAM,4BAA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qB,EACrB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,WAAW,EACX,eAAe,EAEf,UAAU,EACV,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,6BAA6B,EAC7B,eAAe,EACf,uBAAuB,EACvB,qBAAqB,EAErB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EAEpB,YAAY,EACZ,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,qBAAqB,EAErB,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EAErB,WAAW,EACX,YAAY,EACZ,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,eAAe,EACf,2BAA2B,EAC3B,cAAc,GACf,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACpE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpF,YAAY,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAGtG,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,YAAY,EAAE,yBAAyB,EA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CAAC;AAC9D,YAAY,EACV,qBAAqB,EACrB,gCAAgC,GACjC,MAAM,uBAAuB,CAAC;AAG/B,YAAY,EACV,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,QAAQ,EAER,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,WAAW,EACX,eAAe,EAEf,UAAU,EACV,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,6BAA6B,EAC7B,eAAe,EACf,uBAAuB,EACvB,qBAAqB,EAErB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EAEpB,YAAY,EACZ,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,qBAAqB,EAErB,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EAErB,WAAW,EACX,YAAY,EACZ,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,eAAe,EACf,2BAA2B,EAC3B,cAAc,EAEd,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,8BAA8B,CAAC"}
package/dist/index.js CHANGED
@@ -52,6 +52,7 @@ __export(exports_src, {
52
52
  useAgnoKnowledge: () => useAgnoKnowledge,
53
53
  useAgnoEvals: () => useAgnoEvals,
54
54
  useAgnoCustomEvents: () => useAgnoCustomEvents,
55
+ useAgnoComponents: () => useAgnoComponents,
55
56
  useAgnoClient: () => useAgnoClient,
56
57
  useAgnoChat: () => useAgnoChat,
57
58
  useAgnoActions: () => useAgnoActions,
@@ -85,7 +86,7 @@ module.exports = __toCommonJS(exports_src);
85
86
  // src/context/AgnoContext.tsx
86
87
  var import_react = require("react");
87
88
  var import_agno_client = require("@rodrigocoliveira/agno-client");
88
- var jsx_dev_runtime = require("react/jsx-dev-runtime");
89
+ var jsx_runtime = require("react/jsx-runtime");
89
90
  var AgnoContext = import_react.createContext(null);
90
91
  function AgnoProvider({ config, children }) {
91
92
  const client = import_react.useMemo(() => new import_agno_client.AgnoClient(config), []);
@@ -97,10 +98,10 @@ function AgnoProvider({ config, children }) {
97
98
  client.removeAllListeners();
98
99
  };
99
100
  }, [client]);
100
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(AgnoContext.Provider, {
101
+ return /* @__PURE__ */ jsx_runtime.jsx(AgnoContext.Provider, {
101
102
  value: client,
102
103
  children
103
- }, undefined, false, undefined, this);
104
+ });
104
105
  }
105
106
  function useAgnoClient() {
106
107
  const client = import_react.useContext(AgnoContext);
@@ -111,7 +112,7 @@ function useAgnoClient() {
111
112
  }
112
113
  // src/context/ToolHandlerContext.tsx
113
114
  var import_react2 = require("react");
114
- var jsx_dev_runtime2 = require("react/jsx-dev-runtime");
115
+ var jsx_runtime2 = require("react/jsx-runtime");
115
116
  var ToolHandlerContext = import_react2.createContext(null);
116
117
  function ToolHandlerProvider({ handlers: initialHandlers = {}, children }) {
117
118
  const [handlers, setHandlers] = import_react2.useState(initialHandlers);
@@ -129,10 +130,10 @@ function ToolHandlerProvider({ handlers: initialHandlers = {}, children }) {
129
130
  registerHandler,
130
131
  unregisterHandler
131
132
  };
132
- return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ToolHandlerContext.Provider, {
133
+ return /* @__PURE__ */ jsx_runtime2.jsx(ToolHandlerContext.Provider, {
133
134
  value,
134
135
  children
135
- }, undefined, false, undefined, this);
136
+ });
136
137
  }
137
138
  function useToolHandlers() {
138
139
  return import_react2.useContext(ToolHandlerContext);
@@ -418,7 +419,7 @@ function useAgnoToolExecution(handlers = {}, autoExecute = true, options) {
418
419
  }
419
420
 
420
421
  // src/components/GenerativeUIRenderer.tsx
421
- var jsx_dev_runtime3 = require("react/jsx-dev-runtime");
422
+ var jsx_runtime3 = require("react/jsx-runtime");
422
423
 
423
424
  class UIErrorBoundary extends import_react4.default.Component {
424
425
  constructor(props) {
@@ -434,19 +435,19 @@ class UIErrorBoundary extends import_react4.default.Component {
434
435
  }
435
436
  render() {
436
437
  if (this.state.hasError) {
437
- return this.props.fallback || /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("div", {
438
+ return this.props.fallback || /* @__PURE__ */ jsx_runtime3.jsxs("div", {
438
439
  className: "p-4 border border-red-300 rounded-md bg-red-50 text-red-800",
439
440
  children: [
440
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("p", {
441
+ /* @__PURE__ */ jsx_runtime3.jsx("p", {
441
442
  className: "font-semibold",
442
443
  children: "Failed to render UI component"
443
- }, undefined, false, undefined, this),
444
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("p", {
444
+ }),
445
+ /* @__PURE__ */ jsx_runtime3.jsx("p", {
445
446
  className: "text-sm mt-1",
446
447
  children: this.state.error?.message || "Unknown error"
447
- }, undefined, false, undefined, this)
448
+ })
448
449
  ]
449
- }, undefined, true, undefined, this);
450
+ });
450
451
  }
451
452
  return this.props.children;
452
453
  }
@@ -462,183 +463,183 @@ function GenerativeUIRenderer({
462
463
  if (customSpec.renderKey) {
463
464
  const renderFn = getCustomRender(customSpec.renderKey);
464
465
  if (renderFn) {
465
- return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(UIErrorBoundary, {
466
+ return /* @__PURE__ */ jsx_runtime3.jsx(UIErrorBoundary, {
466
467
  onError,
467
- children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("div", {
468
+ children: /* @__PURE__ */ jsx_runtime3.jsx("div", {
468
469
  className,
469
470
  children: renderFn(customSpec.props || {})
470
- }, undefined, false, undefined, this)
471
- }, undefined, false, undefined, this);
471
+ })
472
+ });
472
473
  }
473
474
  }
474
- return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("div", {
475
+ return /* @__PURE__ */ jsx_runtime3.jsxs("div", {
475
476
  className: `p-4 border border-yellow-300 rounded-md bg-yellow-50 text-yellow-800 ${className || ""}`,
476
477
  children: [
477
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("p", {
478
+ /* @__PURE__ */ jsx_runtime3.jsx("p", {
478
479
  className: "font-semibold",
479
480
  children: "Custom component not available"
480
- }, undefined, false, undefined, this),
481
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("p", {
481
+ }),
482
+ /* @__PURE__ */ jsx_runtime3.jsx("p", {
482
483
  className: "text-sm mt-1",
483
484
  children: "The custom render function for this component is not available."
484
- }, undefined, false, undefined, this)
485
+ })
485
486
  ]
486
- }, undefined, true, undefined, this);
487
+ });
487
488
  }
488
489
  if (spec.type === "chart") {
489
490
  const chartSpec = spec;
490
491
  const chartType = `chart:${chartSpec.component}`;
491
492
  if (registry.has(chartType)) {
492
493
  const ChartRenderer = registry.get(chartType);
493
- return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(UIErrorBoundary, {
494
+ return /* @__PURE__ */ jsx_runtime3.jsx(UIErrorBoundary, {
494
495
  onError,
495
- children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("div", {
496
+ children: /* @__PURE__ */ jsx_runtime3.jsxs("div", {
496
497
  className,
497
498
  children: [
498
- chartSpec.title && /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("h3", {
499
+ chartSpec.title && /* @__PURE__ */ jsx_runtime3.jsx("h3", {
499
500
  className: "font-semibold mb-2",
500
501
  children: chartSpec.title
501
- }, undefined, false, undefined, this),
502
- chartSpec.description && /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("p", {
502
+ }),
503
+ chartSpec.description && /* @__PURE__ */ jsx_runtime3.jsx("p", {
503
504
  className: "text-sm text-gray-600 mb-4",
504
505
  children: chartSpec.description
505
- }, undefined, false, undefined, this),
506
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ChartRenderer, {
506
+ }),
507
+ /* @__PURE__ */ jsx_runtime3.jsx(ChartRenderer, {
507
508
  ...chartSpec.props
508
- }, undefined, false, undefined, this)
509
+ })
509
510
  ]
510
- }, undefined, true, undefined, this)
511
- }, undefined, false, undefined, this);
511
+ })
512
+ });
512
513
  }
513
- return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("div", {
514
+ return /* @__PURE__ */ jsx_runtime3.jsxs("div", {
514
515
  className: `p-4 border border-gray-300 rounded-md ${className || ""}`,
515
516
  children: [
516
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("p", {
517
+ /* @__PURE__ */ jsx_runtime3.jsx("p", {
517
518
  className: "font-semibold mb-2",
518
519
  children: chartSpec.title || "Chart Data"
519
- }, undefined, false, undefined, this),
520
- chartSpec.description && /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("p", {
520
+ }),
521
+ chartSpec.description && /* @__PURE__ */ jsx_runtime3.jsx("p", {
521
522
  className: "text-sm text-gray-600 mb-2",
522
523
  children: chartSpec.description
523
- }, undefined, false, undefined, this),
524
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("pre", {
524
+ }),
525
+ /* @__PURE__ */ jsx_runtime3.jsx("pre", {
525
526
  className: "text-xs bg-gray-100 p-2 rounded overflow-auto",
526
527
  children: JSON.stringify(chartSpec.props.data, null, 2)
527
- }, undefined, false, undefined, this)
528
+ })
528
529
  ]
529
- }, undefined, true, undefined, this);
530
+ });
530
531
  }
531
532
  if (spec.type === "card-grid") {
532
533
  const cardGridSpec = spec;
533
534
  if (registry.has("card-grid")) {
534
535
  const CardGridRenderer = registry.get("card-grid");
535
- return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(UIErrorBoundary, {
536
+ return /* @__PURE__ */ jsx_runtime3.jsx(UIErrorBoundary, {
536
537
  onError,
537
- children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("div", {
538
+ children: /* @__PURE__ */ jsx_runtime3.jsxs("div", {
538
539
  className,
539
540
  children: [
540
- cardGridSpec.title && /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("h3", {
541
+ cardGridSpec.title && /* @__PURE__ */ jsx_runtime3.jsx("h3", {
541
542
  className: "font-semibold mb-2",
542
543
  children: cardGridSpec.title
543
- }, undefined, false, undefined, this),
544
- cardGridSpec.description && /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("p", {
544
+ }),
545
+ cardGridSpec.description && /* @__PURE__ */ jsx_runtime3.jsx("p", {
545
546
  className: "text-sm text-gray-600 mb-4",
546
547
  children: cardGridSpec.description
547
- }, undefined, false, undefined, this),
548
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(CardGridRenderer, {
548
+ }),
549
+ /* @__PURE__ */ jsx_runtime3.jsx(CardGridRenderer, {
549
550
  ...cardGridSpec.props
550
- }, undefined, false, undefined, this)
551
+ })
551
552
  ]
552
- }, undefined, true, undefined, this)
553
- }, undefined, false, undefined, this);
553
+ })
554
+ });
554
555
  }
555
556
  }
556
557
  if (spec.type === "table") {
557
558
  const tableSpec = spec;
558
559
  if (registry.has("table")) {
559
560
  const TableRenderer = registry.get("table");
560
- return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(UIErrorBoundary, {
561
+ return /* @__PURE__ */ jsx_runtime3.jsx(UIErrorBoundary, {
561
562
  onError,
562
- children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("div", {
563
+ children: /* @__PURE__ */ jsx_runtime3.jsxs("div", {
563
564
  className,
564
565
  children: [
565
- tableSpec.title && /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("h3", {
566
+ tableSpec.title && /* @__PURE__ */ jsx_runtime3.jsx("h3", {
566
567
  className: "font-semibold mb-2",
567
568
  children: tableSpec.title
568
- }, undefined, false, undefined, this),
569
- tableSpec.description && /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("p", {
569
+ }),
570
+ tableSpec.description && /* @__PURE__ */ jsx_runtime3.jsx("p", {
570
571
  className: "text-sm text-gray-600 mb-4",
571
572
  children: tableSpec.description
572
- }, undefined, false, undefined, this),
573
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(TableRenderer, {
573
+ }),
574
+ /* @__PURE__ */ jsx_runtime3.jsx(TableRenderer, {
574
575
  ...tableSpec.props
575
- }, undefined, false, undefined, this)
576
+ })
576
577
  ]
577
- }, undefined, true, undefined, this)
578
- }, undefined, false, undefined, this);
578
+ })
579
+ });
579
580
  }
580
581
  }
581
582
  if (spec.type === "markdown") {
582
583
  const markdownSpec = spec;
583
584
  if (registry.has("markdown")) {
584
585
  const MarkdownRenderer = registry.get("markdown");
585
- return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(UIErrorBoundary, {
586
+ return /* @__PURE__ */ jsx_runtime3.jsx(UIErrorBoundary, {
586
587
  onError,
587
- children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("div", {
588
+ children: /* @__PURE__ */ jsx_runtime3.jsx("div", {
588
589
  className,
589
- children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(MarkdownRenderer, {
590
+ children: /* @__PURE__ */ jsx_runtime3.jsx(MarkdownRenderer, {
590
591
  ...markdownSpec.props
591
- }, undefined, false, undefined, this)
592
- }, undefined, false, undefined, this)
593
- }, undefined, false, undefined, this);
592
+ })
593
+ })
594
+ });
594
595
  }
595
- return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("div", {
596
+ return /* @__PURE__ */ jsx_runtime3.jsx("div", {
596
597
  className,
597
598
  children: markdownSpec.props.content
598
- }, undefined, false, undefined, this);
599
+ });
599
600
  }
600
601
  if (spec.type === "artifact") {
601
602
  const artifactSpec = spec;
602
- return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(UIErrorBoundary, {
603
+ return /* @__PURE__ */ jsx_runtime3.jsx(UIErrorBoundary, {
603
604
  onError,
604
- children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("div", {
605
+ children: /* @__PURE__ */ jsx_runtime3.jsxs("div", {
605
606
  className: `p-4 border rounded-md ${className || ""}`,
606
607
  children: [
607
- artifactSpec.title && /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("h3", {
608
+ artifactSpec.title && /* @__PURE__ */ jsx_runtime3.jsx("h3", {
608
609
  className: "font-semibold mb-4",
609
610
  children: artifactSpec.title
610
- }, undefined, false, undefined, this),
611
- artifactSpec.description && /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("p", {
611
+ }),
612
+ artifactSpec.description && /* @__PURE__ */ jsx_runtime3.jsx("p", {
612
613
  className: "text-sm text-gray-600 mb-4",
613
614
  children: artifactSpec.description
614
- }, undefined, false, undefined, this),
615
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("div", {
615
+ }),
616
+ /* @__PURE__ */ jsx_runtime3.jsx("div", {
616
617
  className: "space-y-4",
617
- children: artifactSpec.props.content?.map((childSpec, index) => /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(GenerativeUIRenderer, {
618
+ children: artifactSpec.props.content?.map((childSpec, index) => /* @__PURE__ */ jsx_runtime3.jsx(GenerativeUIRenderer, {
618
619
  spec: childSpec,
619
620
  onError
620
- }, index, false, undefined, this))
621
- }, undefined, false, undefined, this)
621
+ }, index))
622
+ })
622
623
  ]
623
- }, undefined, true, undefined, this)
624
- }, undefined, false, undefined, this);
624
+ })
625
+ });
625
626
  }
626
- return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("div", {
627
+ return /* @__PURE__ */ jsx_runtime3.jsxs("div", {
627
628
  className: `p-4 border border-gray-300 rounded-md ${className || ""}`,
628
629
  children: [
629
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("p", {
630
+ /* @__PURE__ */ jsx_runtime3.jsx("p", {
630
631
  className: "font-semibold",
631
632
  children: "Unsupported UI component"
632
- }, undefined, false, undefined, this),
633
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV("p", {
633
+ }),
634
+ /* @__PURE__ */ jsx_runtime3.jsxs("p", {
634
635
  className: "text-sm text-gray-600 mt-1",
635
636
  children: [
636
637
  "Component type: ",
637
638
  spec.type
638
639
  ]
639
- }, undefined, true, undefined, this)
640
+ })
640
641
  ]
641
- }, undefined, true, undefined, this);
642
+ });
642
643
  }
643
644
  // src/utils/ui-helpers.ts
644
645
  function createBarChart(data, xKey, bars, options) {
@@ -1757,5 +1758,213 @@ function useAgnoTraces() {
1757
1758
  error
1758
1759
  };
1759
1760
  }
1761
+ // src/hooks/useAgnoComponents.ts
1762
+ var import_react15 = require("react");
1763
+ function useAgnoComponents() {
1764
+ const client = useAgnoClient();
1765
+ const [components, setComponents] = import_react15.useState([]);
1766
+ const [isLoading, setIsLoading] = import_react15.useState(false);
1767
+ const [error, setError] = import_react15.useState();
1768
+ import_react15.useEffect(() => {
1769
+ const handleComponentCreated = (component) => {
1770
+ setComponents((prev) => [component, ...prev]);
1771
+ };
1772
+ const handleComponentUpdated = (component) => {
1773
+ setComponents((prev) => prev.map((c) => c.component_id === component.component_id ? component : c));
1774
+ };
1775
+ const handleComponentDeleted = ({ componentId }) => {
1776
+ setComponents((prev) => prev.filter((c) => c.component_id !== componentId));
1777
+ };
1778
+ const handleStateChange = () => {
1779
+ setComponents(client.getState().components);
1780
+ };
1781
+ client.on("component:created", handleComponentCreated);
1782
+ client.on("component:updated", handleComponentUpdated);
1783
+ client.on("component:deleted", handleComponentDeleted);
1784
+ client.on("state:change", handleStateChange);
1785
+ setComponents(client.getState().components);
1786
+ return () => {
1787
+ client.off("component:created", handleComponentCreated);
1788
+ client.off("component:updated", handleComponentUpdated);
1789
+ client.off("component:deleted", handleComponentDeleted);
1790
+ client.off("state:change", handleStateChange);
1791
+ };
1792
+ }, [client]);
1793
+ const fetchComponents = import_react15.useCallback(async (queryParams, options) => {
1794
+ setIsLoading(true);
1795
+ setError(undefined);
1796
+ try {
1797
+ const response = await client.fetchComponents(queryParams, options);
1798
+ setComponents(response.data);
1799
+ return response;
1800
+ } catch (err) {
1801
+ const errorMessage = err instanceof Error ? err.message : String(err);
1802
+ setError(errorMessage);
1803
+ throw err;
1804
+ } finally {
1805
+ setIsLoading(false);
1806
+ }
1807
+ }, [client]);
1808
+ const getComponentById = import_react15.useCallback(async (componentId, options) => {
1809
+ setIsLoading(true);
1810
+ setError(undefined);
1811
+ try {
1812
+ return await client.getComponentById(componentId, options);
1813
+ } catch (err) {
1814
+ const errorMessage = err instanceof Error ? err.message : String(err);
1815
+ setError(errorMessage);
1816
+ throw err;
1817
+ } finally {
1818
+ setIsLoading(false);
1819
+ }
1820
+ }, [client]);
1821
+ const createComponent = import_react15.useCallback(async (request, options) => {
1822
+ setIsLoading(true);
1823
+ setError(undefined);
1824
+ try {
1825
+ return await client.createComponent(request, options);
1826
+ } catch (err) {
1827
+ const errorMessage = err instanceof Error ? err.message : String(err);
1828
+ setError(errorMessage);
1829
+ throw err;
1830
+ } finally {
1831
+ setIsLoading(false);
1832
+ }
1833
+ }, [client]);
1834
+ const updateComponent = import_react15.useCallback(async (componentId, request, options) => {
1835
+ setIsLoading(true);
1836
+ setError(undefined);
1837
+ try {
1838
+ return await client.updateComponent(componentId, request, options);
1839
+ } catch (err) {
1840
+ const errorMessage = err instanceof Error ? err.message : String(err);
1841
+ setError(errorMessage);
1842
+ throw err;
1843
+ } finally {
1844
+ setIsLoading(false);
1845
+ }
1846
+ }, [client]);
1847
+ const deleteComponent = import_react15.useCallback(async (componentId, options) => {
1848
+ setIsLoading(true);
1849
+ setError(undefined);
1850
+ try {
1851
+ await client.deleteComponent(componentId, options);
1852
+ } catch (err) {
1853
+ const errorMessage = err instanceof Error ? err.message : String(err);
1854
+ setError(errorMessage);
1855
+ throw err;
1856
+ } finally {
1857
+ setIsLoading(false);
1858
+ }
1859
+ }, [client]);
1860
+ const fetchComponentConfigs = import_react15.useCallback(async (componentId, options) => {
1861
+ setIsLoading(true);
1862
+ setError(undefined);
1863
+ try {
1864
+ return await client.fetchComponentConfigs(componentId, options);
1865
+ } catch (err) {
1866
+ const errorMessage = err instanceof Error ? err.message : String(err);
1867
+ setError(errorMessage);
1868
+ throw err;
1869
+ } finally {
1870
+ setIsLoading(false);
1871
+ }
1872
+ }, [client]);
1873
+ const createComponentConfig = import_react15.useCallback(async (componentId, request, options) => {
1874
+ setIsLoading(true);
1875
+ setError(undefined);
1876
+ try {
1877
+ return await client.createComponentConfig(componentId, request, options);
1878
+ } catch (err) {
1879
+ const errorMessage = err instanceof Error ? err.message : String(err);
1880
+ setError(errorMessage);
1881
+ throw err;
1882
+ } finally {
1883
+ setIsLoading(false);
1884
+ }
1885
+ }, [client]);
1886
+ const getCurrentComponentConfig = import_react15.useCallback(async (componentId, options) => {
1887
+ setIsLoading(true);
1888
+ setError(undefined);
1889
+ try {
1890
+ return await client.getCurrentComponentConfig(componentId, options);
1891
+ } catch (err) {
1892
+ const errorMessage = err instanceof Error ? err.message : String(err);
1893
+ setError(errorMessage);
1894
+ throw err;
1895
+ } finally {
1896
+ setIsLoading(false);
1897
+ }
1898
+ }, [client]);
1899
+ const getComponentConfigByVersion = import_react15.useCallback(async (componentId, version, options) => {
1900
+ setIsLoading(true);
1901
+ setError(undefined);
1902
+ try {
1903
+ return await client.getComponentConfigByVersion(componentId, version, options);
1904
+ } catch (err) {
1905
+ const errorMessage = err instanceof Error ? err.message : String(err);
1906
+ setError(errorMessage);
1907
+ throw err;
1908
+ } finally {
1909
+ setIsLoading(false);
1910
+ }
1911
+ }, [client]);
1912
+ const updateComponentConfig = import_react15.useCallback(async (componentId, version, request, options) => {
1913
+ setIsLoading(true);
1914
+ setError(undefined);
1915
+ try {
1916
+ return await client.updateComponentConfig(componentId, version, request, options);
1917
+ } catch (err) {
1918
+ const errorMessage = err instanceof Error ? err.message : String(err);
1919
+ setError(errorMessage);
1920
+ throw err;
1921
+ } finally {
1922
+ setIsLoading(false);
1923
+ }
1924
+ }, [client]);
1925
+ const deleteComponentConfig = import_react15.useCallback(async (componentId, version, options) => {
1926
+ setIsLoading(true);
1927
+ setError(undefined);
1928
+ try {
1929
+ await client.deleteComponentConfig(componentId, version, options);
1930
+ } catch (err) {
1931
+ const errorMessage = err instanceof Error ? err.message : String(err);
1932
+ setError(errorMessage);
1933
+ throw err;
1934
+ } finally {
1935
+ setIsLoading(false);
1936
+ }
1937
+ }, [client]);
1938
+ const setCurrentComponentConfig = import_react15.useCallback(async (componentId, version, options) => {
1939
+ setIsLoading(true);
1940
+ setError(undefined);
1941
+ try {
1942
+ return await client.setCurrentComponentConfig(componentId, version, options);
1943
+ } catch (err) {
1944
+ const errorMessage = err instanceof Error ? err.message : String(err);
1945
+ setError(errorMessage);
1946
+ throw err;
1947
+ } finally {
1948
+ setIsLoading(false);
1949
+ }
1950
+ }, [client]);
1951
+ return {
1952
+ components,
1953
+ isLoading,
1954
+ error,
1955
+ fetchComponents,
1956
+ getComponentById,
1957
+ createComponent,
1958
+ updateComponent,
1959
+ deleteComponent,
1960
+ fetchComponentConfigs,
1961
+ createComponentConfig,
1962
+ getCurrentComponentConfig,
1963
+ getComponentConfigByVersion,
1964
+ updateComponentConfig,
1965
+ deleteComponentConfig,
1966
+ setCurrentComponentConfig
1967
+ };
1968
+ }
1760
1969
 
1761
- //# debugId=1F5634926049BF8564756E2164756E21
1970
+ //# debugId=D27FED2F9BD03ABF64756E2164756E21