@amodalai/react 0.1.0 → 0.1.1

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.
Files changed (97) hide show
  1. package/dist/client/ChatClient.d.ts +76 -0
  2. package/dist/client/ChatClient.d.ts.map +1 -0
  3. package/dist/client/ChatStream.d.ts +63 -0
  4. package/dist/client/ChatStream.d.ts.map +1 -0
  5. package/dist/client/EventEmitter.d.ts +16 -0
  6. package/dist/client/EventEmitter.d.ts.map +1 -0
  7. package/dist/client/chat-api.d.ts +80 -0
  8. package/dist/client/chat-api.d.ts.map +1 -0
  9. package/dist/client/index.d.ts +7 -0
  10. package/dist/client/index.d.ts.map +1 -1
  11. package/dist/client.js +437 -123
  12. package/dist/client.js.map +1 -1
  13. package/dist/event-bus-h26clqbZ.js +297 -0
  14. package/dist/event-bus-h26clqbZ.js.map +1 -0
  15. package/dist/events/entity-extractor.d.ts +7 -0
  16. package/dist/events/entity-extractor.d.ts.map +1 -0
  17. package/dist/events/event-bus.d.ts +27 -0
  18. package/dist/events/event-bus.d.ts.map +1 -0
  19. package/dist/events/index.d.ts +9 -0
  20. package/dist/events/index.d.ts.map +1 -0
  21. package/dist/events/types.d.ts +72 -0
  22. package/dist/events/types.d.ts.map +1 -0
  23. package/dist/hooks/useAmodalChat.d.ts.map +1 -1
  24. package/dist/hooks/useChat.d.ts +52 -0
  25. package/dist/hooks/useChat.d.ts.map +1 -0
  26. package/dist/hooks/useSessionHistory.d.ts +17 -0
  27. package/dist/hooks/useSessionHistory.d.ts.map +1 -0
  28. package/dist/hooks/useWidgetEvents.d.ts +17 -0
  29. package/dist/hooks/useWidgetEvents.d.ts.map +1 -0
  30. package/dist/index.d.ts +17 -1
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/react.css +5 -0
  33. package/dist/react.js +245 -222
  34. package/dist/react.js.map +1 -1
  35. package/dist/theme-BaBR_tym.js +691 -0
  36. package/dist/theme-BaBR_tym.js.map +1 -0
  37. package/dist/theme.d.ts +11 -0
  38. package/dist/theme.d.ts.map +1 -0
  39. package/dist/types.d.ts +106 -8
  40. package/dist/types.d.ts.map +1 -1
  41. package/dist/umd-entry.d.ts +21 -0
  42. package/dist/umd-entry.d.ts.map +1 -0
  43. package/dist/widget/AskUserCard.d.ts +8 -0
  44. package/dist/widget/AskUserCard.d.ts.map +1 -0
  45. package/dist/widget/ChatWidget.d.ts +9 -0
  46. package/dist/widget/ChatWidget.d.ts.map +1 -0
  47. package/dist/widget/FormattedText.d.ts +12 -0
  48. package/dist/widget/FormattedText.d.ts.map +1 -0
  49. package/dist/widget/InputBar.d.ts +15 -0
  50. package/dist/widget/InputBar.d.ts.map +1 -0
  51. package/dist/widget/KBProposalCard.d.ts +7 -0
  52. package/dist/widget/KBProposalCard.d.ts.map +1 -0
  53. package/dist/widget/MessageList.d.ts +15 -0
  54. package/dist/widget/MessageList.d.ts.map +1 -0
  55. package/dist/widget/SessionHistory.d.ts +12 -0
  56. package/dist/widget/SessionHistory.d.ts.map +1 -0
  57. package/dist/widget/SkillPill.d.ts +11 -0
  58. package/dist/widget/SkillPill.d.ts.map +1 -0
  59. package/dist/widget/StreamingIndicator.d.ts +7 -0
  60. package/dist/widget/StreamingIndicator.d.ts.map +1 -0
  61. package/dist/widget/TagEditor.d.ts +11 -0
  62. package/dist/widget/TagEditor.d.ts.map +1 -0
  63. package/dist/widget/ToolCallCard.d.ts +7 -0
  64. package/dist/widget/ToolCallCard.d.ts.map +1 -0
  65. package/dist/widget/index.d.ts +33 -0
  66. package/dist/widget/index.d.ts.map +1 -0
  67. package/dist/widget/widgets/AlertCard.d.ts +3 -0
  68. package/dist/widget/widgets/AlertCard.d.ts.map +1 -0
  69. package/dist/widget/widgets/Comparison.d.ts +3 -0
  70. package/dist/widget/widgets/Comparison.d.ts.map +1 -0
  71. package/dist/widget/widgets/CredentialInput.d.ts +3 -0
  72. package/dist/widget/widgets/CredentialInput.d.ts.map +1 -0
  73. package/dist/widget/widgets/DataTable.d.ts +3 -0
  74. package/dist/widget/widgets/DataTable.d.ts.map +1 -0
  75. package/dist/widget/widgets/DocumentPreview.d.ts +3 -0
  76. package/dist/widget/widgets/DocumentPreview.d.ts.map +1 -0
  77. package/dist/widget/widgets/EntityCard.d.ts +3 -0
  78. package/dist/widget/widgets/EntityCard.d.ts.map +1 -0
  79. package/dist/widget/widgets/EntityList.d.ts +3 -0
  80. package/dist/widget/widgets/EntityList.d.ts.map +1 -0
  81. package/dist/widget/widgets/InfoCard.d.ts +3 -0
  82. package/dist/widget/widgets/InfoCard.d.ts.map +1 -0
  83. package/dist/widget/widgets/Metric.d.ts +3 -0
  84. package/dist/widget/widgets/Metric.d.ts.map +1 -0
  85. package/dist/widget/widgets/ScopeMap.d.ts +3 -0
  86. package/dist/widget/widgets/ScopeMap.d.ts.map +1 -0
  87. package/dist/widget/widgets/ScoreBreakdown.d.ts +3 -0
  88. package/dist/widget/widgets/ScoreBreakdown.d.ts.map +1 -0
  89. package/dist/widget/widgets/StatusBoard.d.ts +3 -0
  90. package/dist/widget/widgets/StatusBoard.d.ts.map +1 -0
  91. package/dist/widget/widgets/Timeline.d.ts +3 -0
  92. package/dist/widget/widgets/Timeline.d.ts.map +1 -0
  93. package/dist/widget/widgets/WidgetRenderer.d.ts +28 -0
  94. package/dist/widget/widgets/WidgetRenderer.d.ts.map +1 -0
  95. package/dist/widget.js +1668 -0
  96. package/dist/widget.js.map +1 -0
  97. package/package.json +8 -1
package/dist/react.js CHANGED
@@ -1,23 +1,25 @@
1
1
  import { jsx as v, jsxs as w } from "react/jsx-runtime";
2
- import { createContext as P, useMemo as B, useContext as j, useReducer as H, useRef as T, useCallback as N, useEffect as I, useState as y } from "react";
2
+ import { createContext as F, useMemo as B, useContext as j, useReducer as Q, useRef as N, useCallback as A, useEffect as R, useState as y } from "react";
3
3
  import { RuntimeClient as V } from "./client.js";
4
- import { parseSSELine as me, streamSSE as fe, streamSSEGet as pe } from "./client.js";
5
- const U = P(null);
6
- function Z({ runtimeUrl: r, tenantId: s, getToken: t, children: e }) {
7
- const a = B(
8
- () => new V({ runtimeUrl: r, tenantId: s, getToken: t }),
9
- [r, s, t]
10
- ), n = B(
11
- () => ({ client: a, runtimeUrl: r, tenantId: s }),
12
- [a, r, s]
4
+ import { ChatClient as me, ChatStream as fe } from "./client.js";
5
+ import { a as ge, d as _e, m as he, u as ve, b as ye, c as Ee } from "./theme-BaBR_tym.js";
6
+ import { T as be, W as Te, c as Ae, a as Ne, d as xe, g as Ce, l as we, p as Re, s as Ie, b as ke, e as De, u as Me } from "./event-bus-h26clqbZ.js";
7
+ const U = F(null);
8
+ function Z({ runtimeUrl: s, tenantId: r, getToken: t, children: e }) {
9
+ const n = B(
10
+ () => new V({ runtimeUrl: s, tenantId: r, getToken: t }),
11
+ [s, r, t]
12
+ ), a = B(
13
+ () => ({ client: n, runtimeUrl: s, tenantId: r }),
14
+ [n, s, r]
13
15
  );
14
- return /* @__PURE__ */ v(U.Provider, { value: n, children: e });
16
+ return /* @__PURE__ */ v(U.Provider, { value: a, children: e });
15
17
  }
16
- function C() {
17
- const r = j(U);
18
- if (!r)
18
+ function I() {
19
+ const s = j(U);
20
+ if (!s)
19
21
  throw new Error("useAmodalContext must be used within an <AmodalProvider>");
20
- return r;
22
+ return s;
21
23
  }
22
24
  /**
23
25
  * @license
@@ -29,167 +31,171 @@ const G = {
29
31
  sessionId: null,
30
32
  isStreaming: !1,
31
33
  error: null,
32
- activeToolCalls: []
34
+ activeToolCalls: [],
35
+ isHistorical: !1
33
36
  };
34
37
  let $ = 0;
35
- function F() {
38
+ function P() {
36
39
  return $++, `msg-${Date.now()}-${String($)}`;
37
40
  }
38
- function X(r, s) {
39
- switch (s.type) {
41
+ function X(s, r) {
42
+ switch (r.type) {
40
43
  case "SEND_MESSAGE": {
41
44
  const t = {
42
45
  type: "user",
43
- id: F(),
44
- text: s.text,
46
+ id: P(),
47
+ text: r.text,
45
48
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
46
49
  }, e = {
47
50
  type: "assistant_text",
48
- id: F(),
51
+ id: P(),
49
52
  text: "",
50
53
  toolCalls: [],
51
54
  confirmations: [],
55
+ skillActivations: [],
56
+ kbProposals: [],
57
+ widgets: [],
52
58
  contentBlocks: [],
53
59
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
54
60
  };
55
61
  return {
56
- ...r,
57
- messages: [...r.messages, t, e],
62
+ ...s,
63
+ messages: [...s.messages, t, e],
58
64
  isStreaming: !0,
59
65
  error: null,
60
66
  activeToolCalls: []
61
67
  };
62
68
  }
63
69
  case "STREAM_INIT":
64
- return { ...r, sessionId: s.sessionId };
70
+ return { ...s, sessionId: r.sessionId };
65
71
  case "STREAM_TEXT_DELTA": {
66
- const t = [...r.messages], e = t[t.length - 1];
72
+ const t = [...s.messages], e = t[t.length - 1];
67
73
  if (e && e.type === "assistant_text") {
68
- const a = [...e.contentBlocks], n = a[a.length - 1];
69
- n && n.type === "text" ? a[a.length - 1] = { type: "text", text: n.text + s.content } : a.push({ type: "text", text: s.content }), t[t.length - 1] = { ...e, text: e.text + s.content, contentBlocks: a };
74
+ const n = [...e.contentBlocks], a = n[n.length - 1];
75
+ a && a.type === "text" ? n[n.length - 1] = { type: "text", text: a.text + r.content } : n.push({ type: "text", text: r.content }), t[t.length - 1] = { ...e, text: e.text + r.content, contentBlocks: n };
70
76
  }
71
- return { ...r, messages: t };
77
+ return { ...s, messages: t };
72
78
  }
73
79
  case "STREAM_TOOL_CALL_START": {
74
- const t = [...r.messages], e = t[t.length - 1], a = {
75
- toolId: s.toolId,
76
- toolName: s.toolName,
77
- parameters: s.parameters,
80
+ const t = [...s.messages], e = t[t.length - 1], n = {
81
+ toolId: r.toolId,
82
+ toolName: r.toolName,
83
+ parameters: r.parameters,
78
84
  status: "running"
79
85
  };
80
86
  if (e && e.type === "assistant_text") {
81
- const n = [...e.toolCalls, a], c = [...e.contentBlocks], i = c[c.length - 1];
82
- i && i.type === "tool_calls" ? c[c.length - 1] = { type: "tool_calls", calls: [...i.calls, a] } : c.push({ type: "tool_calls", calls: [a] }), t[t.length - 1] = { ...e, toolCalls: n, contentBlocks: c };
87
+ const a = [...e.toolCalls, n], c = [...e.contentBlocks], i = c[c.length - 1];
88
+ i && i.type === "tool_calls" ? c[c.length - 1] = { type: "tool_calls", calls: [...i.calls, n] } : c.push({ type: "tool_calls", calls: [n] }), t[t.length - 1] = { ...e, toolCalls: a, contentBlocks: c };
83
89
  }
84
90
  return {
85
- ...r,
91
+ ...s,
86
92
  messages: t,
87
- activeToolCalls: [...r.activeToolCalls, a]
93
+ activeToolCalls: [...s.activeToolCalls, n]
88
94
  };
89
95
  }
90
96
  case "STREAM_TOOL_CALL_RESULT": {
91
- const t = [...r.messages], e = t[t.length - 1];
97
+ const t = [...s.messages], e = t[t.length - 1];
92
98
  if (e && e.type === "assistant_text") {
93
- const n = (p) => p.toolId === s.toolId ? {
99
+ const a = (p) => p.toolId === r.toolId ? {
94
100
  ...p,
95
- status: s.status,
96
- result: s.result,
97
- duration_ms: s.duration_ms,
98
- error: s.error
99
- } : p, c = e.toolCalls.map(n), i = e.contentBlocks.map(
100
- (p) => p.type === "tool_calls" ? { ...p, calls: p.calls.map(n) } : p
101
+ status: r.status,
102
+ result: r.result,
103
+ duration_ms: r.duration_ms,
104
+ error: r.error
105
+ } : p, c = e.toolCalls.map(a), i = e.contentBlocks.map(
106
+ (p) => p.type === "tool_calls" ? { ...p, calls: p.calls.map(a) } : p
101
107
  );
102
108
  t[t.length - 1] = { ...e, toolCalls: c, contentBlocks: i };
103
109
  }
104
- const a = r.activeToolCalls.filter(
105
- (n) => n.toolId !== s.toolId
110
+ const n = s.activeToolCalls.filter(
111
+ (a) => a.toolId !== r.toolId
106
112
  );
107
- return { ...r, messages: t, activeToolCalls: a };
113
+ return { ...s, messages: t, activeToolCalls: n };
108
114
  }
109
115
  case "STREAM_SUBAGENT_EVENT": {
110
- const t = [...r.messages], e = t[t.length - 1];
116
+ const t = [...s.messages], e = t[t.length - 1];
111
117
  if (e && e.type === "assistant_text") {
112
- const a = (i) => i.toolId === s.parentToolId ? { ...i, subagentEvents: [...i.subagentEvents ?? [], s.event] } : i, n = e.toolCalls.map(a), c = e.contentBlocks.map(
113
- (i) => i.type === "tool_calls" ? { ...i, calls: i.calls.map(a) } : i
118
+ const n = (i) => i.toolId === r.parentToolId ? { ...i, subagentEvents: [...i.subagentEvents ?? [], r.event] } : i, a = e.toolCalls.map(n), c = e.contentBlocks.map(
119
+ (i) => i.type === "tool_calls" ? { ...i, calls: i.calls.map(n) } : i
114
120
  );
115
- t[t.length - 1] = { ...e, toolCalls: n, contentBlocks: c };
121
+ t[t.length - 1] = { ...e, toolCalls: a, contentBlocks: c };
116
122
  }
117
- return { ...r, messages: t };
123
+ return { ...s, messages: t };
118
124
  }
119
125
  case "STREAM_WIDGET": {
120
- const t = [...r.messages], e = t[t.length - 1];
126
+ const t = [...s.messages], e = t[t.length - 1];
121
127
  if (e && e.type === "assistant_text") {
122
- const a = {
128
+ const n = {
123
129
  type: "widget",
124
- widgetType: s.widgetType,
125
- data: s.data
130
+ widgetType: r.widgetType,
131
+ data: r.data
126
132
  };
127
133
  t[t.length - 1] = {
128
134
  ...e,
129
- contentBlocks: [...e.contentBlocks, a]
135
+ contentBlocks: [...e.contentBlocks, n]
130
136
  };
131
137
  }
132
- return { ...r, messages: t };
138
+ return { ...s, messages: t };
133
139
  }
134
140
  case "STREAM_CONFIRMATION_REQUIRED": {
135
- const t = [...r.messages], e = t[t.length - 1];
141
+ const t = [...s.messages], e = t[t.length - 1];
136
142
  if (e && e.type === "assistant_text") {
137
- const a = {
143
+ const n = {
138
144
  type: "confirmation",
139
- confirmation: s.confirmation
145
+ confirmation: r.confirmation
140
146
  };
141
147
  t[t.length - 1] = {
142
148
  ...e,
143
- confirmations: [...e.confirmations, s.confirmation],
144
- contentBlocks: [...e.contentBlocks, a]
149
+ confirmations: [...e.confirmations, r.confirmation],
150
+ contentBlocks: [...e.contentBlocks, n]
145
151
  };
146
152
  }
147
- return { ...r, messages: t };
153
+ return { ...s, messages: t };
148
154
  }
149
155
  case "CONFIRMATION_RESPONDED": {
150
- const t = [...r.messages], e = t[t.length - 1];
156
+ const t = [...s.messages], e = t[t.length - 1];
151
157
  if (e && e.type === "assistant_text") {
152
- const a = e.confirmations.map(
153
- (c) => c.correlationId === s.correlationId ? { ...c, status: s.approved ? "approved" : "denied" } : c
154
- ), n = e.contentBlocks.map(
155
- (c) => c.type === "confirmation" && c.confirmation.correlationId === s.correlationId ? { ...c, confirmation: { ...c.confirmation, status: s.approved ? "approved" : "denied" } } : c
158
+ const n = e.confirmations.map(
159
+ (c) => c.correlationId === r.correlationId ? { ...c, status: r.approved ? "approved" : "denied" } : c
160
+ ), a = e.contentBlocks.map(
161
+ (c) => c.type === "confirmation" && c.confirmation.correlationId === r.correlationId ? { ...c, confirmation: { ...c.confirmation, status: r.approved ? "approved" : "denied" } } : c
156
162
  );
157
- t[t.length - 1] = { ...e, confirmations: a, contentBlocks: n };
163
+ t[t.length - 1] = { ...e, confirmations: n, contentBlocks: a };
158
164
  }
159
- return { ...r, messages: t };
165
+ return { ...s, messages: t };
160
166
  }
161
167
  case "STREAM_ERROR":
162
- return { ...r, isStreaming: !1, error: s.message, activeToolCalls: [] };
168
+ return { ...s, isStreaming: !1, error: r.message, activeToolCalls: [] };
163
169
  case "STREAM_DONE": {
164
- const t = [...r.messages], e = t[t.length - 1];
170
+ const t = [...s.messages], e = t[t.length - 1];
165
171
  if (e && e.type === "assistant_text") {
166
- const a = (i) => i.status === "running" ? { ...i, status: "error", error: "Stopped" } : i, n = e.toolCalls.map(a), c = e.contentBlocks.map(
167
- (i) => i.type === "tool_calls" ? { ...i, calls: i.calls.map(a) } : i
172
+ const n = (i) => i.status === "running" ? { ...i, status: "error", error: "Stopped" } : i, a = e.toolCalls.map(n), c = e.contentBlocks.map(
173
+ (i) => i.type === "tool_calls" ? { ...i, calls: i.calls.map(n) } : i
168
174
  );
169
- t[t.length - 1] = { ...e, toolCalls: n, contentBlocks: c };
175
+ t[t.length - 1] = { ...e, toolCalls: a, contentBlocks: c };
170
176
  }
171
- return { ...r, messages: t, isStreaming: !1, activeToolCalls: [] };
177
+ return { ...s, messages: t, isStreaming: !1, activeToolCalls: [] };
172
178
  }
173
179
  case "RESET":
174
180
  return { ...G };
175
181
  default:
176
- return r;
182
+ return s;
177
183
  }
178
184
  }
179
- function J(r) {
180
- const { client: s } = C(), [t, e] = H(X, G), a = T(null), n = T(null), c = T(r);
181
- c.current = r, a.current = t.sessionId;
182
- const i = N(
185
+ function W(s) {
186
+ const { client: r } = I(), [t, e] = Q(X, G), n = N(null), a = N(null), c = N(s);
187
+ c.current = s, n.current = t.sessionId;
188
+ const i = A(
183
189
  (g) => {
184
190
  if (t.isStreaming) return;
185
191
  e({ type: "SEND_MESSAGE", text: g });
186
192
  const _ = new AbortController();
187
- n.current = _, (async () => {
188
- var o, d, f, l, b, A, x, R, M, D, O;
193
+ a.current = _, (async () => {
194
+ var o, d, f, l, b, T, x, C, M, D, O;
189
195
  let m = !1;
190
196
  try {
191
- const k = s.chatStream(g, {
192
- sessionId: a.current ?? void 0,
197
+ const k = r.chatStream(g, {
198
+ sessionId: n.current ?? void 0,
193
199
  context: (o = c.current) == null ? void 0 : o.context,
194
200
  signal: _.signal
195
201
  });
@@ -261,14 +267,14 @@ function J(r) {
261
267
  correlationId: h.correlation_id,
262
268
  status: "pending"
263
269
  };
264
- e({ type: "STREAM_CONFIRMATION_REQUIRED", confirmation: L }), (x = (A = c.current) == null ? void 0 : A.onConfirmation) == null || x.call(A, L);
270
+ e({ type: "STREAM_CONFIRMATION_REQUIRED", confirmation: L }), (x = (T = c.current) == null ? void 0 : T.onConfirmation) == null || x.call(T, L);
265
271
  break;
266
272
  }
267
273
  case "error":
268
274
  e({ type: "STREAM_ERROR", message: h.message });
269
275
  break;
270
276
  case "done":
271
- m = !0, e({ type: "STREAM_DONE" }), (M = (R = c.current) == null ? void 0 : R.onStreamEnd) == null || M.call(R);
277
+ m = !0, e({ type: "STREAM_DONE" }), (M = (C = c.current) == null ? void 0 : C.onStreamEnd) == null || M.call(C);
272
278
  break;
273
279
  default:
274
280
  break;
@@ -279,16 +285,16 @@ function J(r) {
279
285
  message: k instanceof Error ? k.message : "Unknown error"
280
286
  });
281
287
  } finally {
282
- n.current = null, !m && !_.signal.aborted && (e({ type: "STREAM_DONE" }), (O = (D = c.current) == null ? void 0 : D.onStreamEnd) == null || O.call(D));
288
+ a.current = null, !m && !_.signal.aborted && (e({ type: "STREAM_DONE" }), (O = (D = c.current) == null ? void 0 : D.onStreamEnd) == null || O.call(D));
283
289
  }
284
290
  })();
285
291
  },
286
- [s, t.isStreaming]
287
- ), p = N(() => {
288
- n.current && (n.current.abort(), n.current = null), e({ type: "STREAM_DONE" });
289
- }, []), S = N(() => {
290
- n.current && (n.current.abort(), n.current = null), e({ type: "RESET" });
291
- }, []), E = N(
292
+ [r, t.isStreaming]
293
+ ), p = A(() => {
294
+ a.current && (a.current.abort(), a.current = null), e({ type: "STREAM_DONE" });
295
+ }, []), S = A(() => {
296
+ a.current && (a.current.abort(), a.current = null), e({ type: "RESET" });
297
+ }, []), E = A(
292
298
  (g, _) => {
293
299
  e({ type: "CONFIRMATION_RESPONDED", correlationId: g, approved: _ });
294
300
  const u = _ ? `I approve the action (correlation: ${g})` : `I deny the action (correlation: ${g})`;
@@ -296,9 +302,9 @@ function J(r) {
296
302
  },
297
303
  [i, t.isStreaming]
298
304
  );
299
- return I(
305
+ return R(
300
306
  () => () => {
301
- n.current && n.current.abort();
307
+ a.current && a.current.abort();
302
308
  },
303
309
  []
304
310
  ), {
@@ -318,20 +324,20 @@ function J(r) {
318
324
  * Copyright 2025 Amodal Labs, Inc.
319
325
  * SPDX-License-Identifier: MIT
320
326
  */
321
- function Q({ confirmation: r, onApprove: s, onDeny: t }) {
322
- const e = r.status === "pending";
327
+ function H({ confirmation: s, onApprove: r, onDeny: t }) {
328
+ const e = s.status === "pending";
323
329
  return /* @__PURE__ */ w("div", { className: "amodal-confirm-card", "data-testid": "confirm-card", children: [
324
330
  /* @__PURE__ */ w("div", { className: "amodal-confirm-card__header", children: [
325
- /* @__PURE__ */ v("span", { className: "amodal-confirm-card__method", children: r.method }),
326
- /* @__PURE__ */ v("span", { className: "amodal-confirm-card__endpoint", children: r.endpoint })
331
+ /* @__PURE__ */ v("span", { className: "amodal-confirm-card__method", children: s.method }),
332
+ /* @__PURE__ */ v("span", { className: "amodal-confirm-card__endpoint", children: s.endpoint })
327
333
  ] }),
328
- /* @__PURE__ */ v("p", { className: "amodal-confirm-card__reason", children: r.reason }),
334
+ /* @__PURE__ */ v("p", { className: "amodal-confirm-card__reason", children: s.reason }),
329
335
  e ? /* @__PURE__ */ w("div", { className: "amodal-confirm-card__actions", children: [
330
336
  /* @__PURE__ */ v(
331
337
  "button",
332
338
  {
333
339
  className: "amodal-confirm-card__btn amodal-confirm-card__btn--approve",
334
- onClick: s,
340
+ onClick: r,
335
341
  "data-testid": "confirm-approve",
336
342
  children: "Approve"
337
343
  }
@@ -345,7 +351,7 @@ function Q({ confirmation: r, onApprove: s, onDeny: t }) {
345
351
  children: "Deny"
346
352
  }
347
353
  )
348
- ] }) : /* @__PURE__ */ v("div", { className: "amodal-confirm-card__status", "data-testid": "confirm-status", children: r.status === "approved" ? "Approved" : "Denied" })
354
+ ] }) : /* @__PURE__ */ v("div", { className: "amodal-confirm-card__status", "data-testid": "confirm-status", children: s.status === "approved" ? "Approved" : "Denied" })
349
355
  ] });
350
356
  }
351
357
  /**
@@ -353,29 +359,29 @@ function Q({ confirmation: r, onApprove: s, onDeny: t }) {
353
359
  * Copyright 2025 Amodal Labs, Inc.
354
360
  * SPDX-License-Identifier: MIT
355
361
  */
356
- function W({ confirmation: r, onApprove: s, onDeny: t }) {
357
- const e = r.status === "pending";
362
+ function J({ confirmation: s, onApprove: r, onDeny: t }) {
363
+ const e = s.status === "pending";
358
364
  return /* @__PURE__ */ w("div", { className: "amodal-review-card", "data-testid": "review-card", children: [
359
365
  /* @__PURE__ */ w("div", { className: "amodal-review-card__header", children: [
360
- /* @__PURE__ */ v("span", { className: "amodal-review-card__method", children: r.method }),
361
- /* @__PURE__ */ v("span", { className: "amodal-review-card__endpoint", children: r.endpoint }),
362
- r.escalated && /* @__PURE__ */ v("span", { className: "amodal-review-card__badge", "data-testid": "escalation-badge", children: "Escalated" })
366
+ /* @__PURE__ */ v("span", { className: "amodal-review-card__method", children: s.method }),
367
+ /* @__PURE__ */ v("span", { className: "amodal-review-card__endpoint", children: s.endpoint }),
368
+ s.escalated && /* @__PURE__ */ v("span", { className: "amodal-review-card__badge", "data-testid": "escalation-badge", children: "Escalated" })
363
369
  ] }),
364
- r.connectionName && /* @__PURE__ */ w("div", { className: "amodal-review-card__connection", children: [
370
+ s.connectionName && /* @__PURE__ */ w("div", { className: "amodal-review-card__connection", children: [
365
371
  "Connection: ",
366
- r.connectionName
372
+ s.connectionName
367
373
  ] }),
368
- /* @__PURE__ */ v("p", { className: "amodal-review-card__reason", children: r.reason }),
369
- r.params && Object.keys(r.params).length > 0 && /* @__PURE__ */ w("div", { className: "amodal-review-card__params", "data-testid": "review-params", children: [
374
+ /* @__PURE__ */ v("p", { className: "amodal-review-card__reason", children: s.reason }),
375
+ s.params && Object.keys(s.params).length > 0 && /* @__PURE__ */ w("div", { className: "amodal-review-card__params", "data-testid": "review-params", children: [
370
376
  /* @__PURE__ */ v("div", { className: "amodal-review-card__params-title", children: "Parameters" }),
371
- /* @__PURE__ */ v("pre", { className: "amodal-review-card__params-body", children: JSON.stringify(r.params, null, 2) })
377
+ /* @__PURE__ */ v("pre", { className: "amodal-review-card__params-body", children: JSON.stringify(s.params, null, 2) })
372
378
  ] }),
373
379
  e ? /* @__PURE__ */ w("div", { className: "amodal-review-card__actions", children: [
374
380
  /* @__PURE__ */ v(
375
381
  "button",
376
382
  {
377
383
  className: "amodal-review-card__btn amodal-review-card__btn--approve",
378
- onClick: s,
384
+ onClick: r,
379
385
  "data-testid": "review-approve",
380
386
  children: "Approve"
381
387
  }
@@ -389,25 +395,25 @@ function W({ confirmation: r, onApprove: s, onDeny: t }) {
389
395
  children: "Deny"
390
396
  }
391
397
  )
392
- ] }) : /* @__PURE__ */ v("div", { className: "amodal-review-card__status", "data-testid": "review-status", children: r.status === "approved" ? "Approved" : "Denied" })
398
+ ] }) : /* @__PURE__ */ v("div", { className: "amodal-review-card__status", "data-testid": "review-status", children: s.status === "approved" ? "Approved" : "Denied" })
393
399
  ] });
394
400
  }
395
401
  function ee({
396
- placeholder: r = "Type a message...",
397
- renderText: s,
402
+ placeholder: s = "Type a message...",
403
+ renderText: r,
398
404
  renderToolCall: t,
399
405
  renderConfirmation: e,
400
- className: a,
401
- ...n
406
+ className: n,
407
+ ...a
402
408
  }) {
403
- const { messages: c, send: i, isStreaming: p, respondToConfirmation: S } = J(n), [E, g] = y(""), _ = T(null), u = N(
409
+ const { messages: c, send: i, isStreaming: p, respondToConfirmation: S } = W(a), [E, g] = y(""), _ = N(null), u = A(
404
410
  (o) => {
405
411
  o.preventDefault();
406
412
  const d = E.trim();
407
413
  d.length === 0 || p || (g(""), i(d));
408
414
  },
409
415
  [E, p, i]
410
- ), m = ["amodal-chat", a].filter(Boolean).join(" ");
416
+ ), m = ["amodal-chat", n].filter(Boolean).join(" ");
411
417
  return /* @__PURE__ */ w("div", { className: m, "data-testid": "amodal-chat", children: [
412
418
  /* @__PURE__ */ w("div", { className: "amodal-chat__messages", "data-testid": "message-list", children: [
413
419
  c.map((o) => {
@@ -418,7 +424,7 @@ function ee({
418
424
  return /* @__PURE__ */ v("div", { className: "amodal-chat__message amodal-chat__message--assistant", "data-testid": "assistant-message", children: o.contentBlocks.map((d, f) => {
419
425
  switch (d.type) {
420
426
  case "text":
421
- return /* @__PURE__ */ v("div", { className: "amodal-chat__text", children: s ? s(d.text) : d.text }, `text-${String(f)}`);
427
+ return /* @__PURE__ */ v("div", { className: "amodal-chat__text", children: r ? r(d.text) : d.text }, `text-${String(f)}`);
422
428
  case "tool_calls":
423
429
  return /* @__PURE__ */ v("div", { className: "amodal-chat__tool-calls", children: d.calls.map(
424
430
  (l) => t ? /* @__PURE__ */ v("div", { children: t(l) }, l.toolId) : /* @__PURE__ */ w("div", { className: "amodal-chat__tool-call", "data-testid": "tool-call", children: [
@@ -429,10 +435,10 @@ function ee({
429
435
  case "confirmation": {
430
436
  const l = d.confirmation, b = () => {
431
437
  l.correlationId && S(l.correlationId, !0);
432
- }, A = () => {
438
+ }, T = () => {
433
439
  l.correlationId && S(l.correlationId, !1);
434
440
  };
435
- return e ? /* @__PURE__ */ v("div", { children: e(l, b, A) }, `conf-${String(f)}`) : l.escalated || l.params && Object.keys(l.params).length > 0 ? /* @__PURE__ */ v(W, { confirmation: l, onApprove: b, onDeny: A }, `conf-${String(f)}`) : /* @__PURE__ */ v(Q, { confirmation: l, onApprove: b, onDeny: A }, `conf-${String(f)}`);
441
+ return e ? /* @__PURE__ */ v("div", { children: e(l, b, T) }, `conf-${String(f)}`) : l.escalated || l.params && Object.keys(l.params).length > 0 ? /* @__PURE__ */ v(J, { confirmation: l, onApprove: b, onDeny: T }, `conf-${String(f)}`) : /* @__PURE__ */ v(H, { confirmation: l, onApprove: b, onDeny: T }, `conf-${String(f)}`);
436
442
  }
437
443
  case "widget":
438
444
  return /* @__PURE__ */ v("div", { className: "amodal-chat__widget", "data-testid": "widget", children: d.widgetType }, `widget-${String(f)}`);
@@ -455,7 +461,7 @@ function ee({
455
461
  className: "amodal-chat__input",
456
462
  value: E,
457
463
  onChange: (o) => g(o.target.value),
458
- placeholder: r,
464
+ placeholder: s,
459
465
  disabled: p,
460
466
  "data-testid": "chat-input"
461
467
  }
@@ -473,23 +479,23 @@ function ee({
473
479
  ] })
474
480
  ] });
475
481
  }
476
- function te({ prompt: r, label: s, context: t, onComplete: e, onError: a }) {
477
- const [n, c] = y(!1), { messages: i, send: p, isStreaming: S, respondToConfirmation: E } = J({
482
+ function te({ prompt: s, label: r, context: t, onComplete: e, onError: n }) {
483
+ const [a, c] = y(!1), { messages: i, send: p, isStreaming: S, respondToConfirmation: E } = W({
478
484
  context: t,
479
485
  onStreamEnd: () => {
480
486
  const o = i[i.length - 1];
481
- o && o.type === "assistant_text" ? e == null || e(o.text) : o && o.type === "error" && (a == null || a(o.message));
487
+ o && o.type === "assistant_text" ? e == null || e(o.text) : o && o.type === "error" && (n == null || n(o.message));
482
488
  }
483
- }), g = N(() => {
484
- n || S || (c(!0), p(r));
485
- }, [n, S, p, r]), _ = [...i].reverse().find((o) => o.type === "assistant_text"), u = _ && _.type === "assistant_text" ? _.confirmations.filter((o) => o.status === "pending") : [], m = (o, d) => {
489
+ }), g = A(() => {
490
+ a || S || (c(!0), p(s));
491
+ }, [a, S, p, s]), _ = [...i].reverse().find((o) => o.type === "assistant_text"), u = _ && _.type === "assistant_text" ? _.confirmations.filter((o) => o.status === "pending") : [], m = (o, d) => {
486
492
  const f = () => {
487
493
  o.correlationId && E(o.correlationId, !0);
488
494
  }, l = () => {
489
495
  o.correlationId && E(o.correlationId, !1);
490
496
  };
491
497
  return o.escalated || o.params && Object.keys(o.params).length > 0 ? /* @__PURE__ */ v(
492
- W,
498
+ J,
493
499
  {
494
500
  confirmation: o,
495
501
  onApprove: f,
@@ -497,7 +503,7 @@ function te({ prompt: r, label: s, context: t, onComplete: e, onError: a }) {
497
503
  },
498
504
  o.correlationId ?? String(d)
499
505
  ) : /* @__PURE__ */ v(
500
- Q,
506
+ H,
501
507
  {
502
508
  confirmation: o,
503
509
  onApprove: f,
@@ -506,7 +512,7 @@ function te({ prompt: r, label: s, context: t, onComplete: e, onError: a }) {
506
512
  o.correlationId ?? String(d)
507
513
  );
508
514
  };
509
- return n ? /* @__PURE__ */ w("div", { className: "amodal-action", "data-testid": "action-container", children: [
515
+ return a ? /* @__PURE__ */ w("div", { className: "amodal-action", "data-testid": "action-container", children: [
510
516
  S && /* @__PURE__ */ v("div", { className: "amodal-action__loading", "data-testid": "action-loading", children: "Processing..." }),
511
517
  _ && _.type === "assistant_text" && _.text && /* @__PURE__ */ v("div", { className: "amodal-action__result", "data-testid": "action-result", children: _.text }),
512
518
  u.map(m)
@@ -516,7 +522,7 @@ function te({ prompt: r, label: s, context: t, onComplete: e, onError: a }) {
516
522
  className: "amodal-action__trigger",
517
523
  onClick: g,
518
524
  "data-testid": "action-trigger",
519
- children: s ?? "Run"
525
+ children: r ?? "Run"
520
526
  }
521
527
  );
522
528
  }
@@ -525,15 +531,15 @@ function te({ prompt: r, label: s, context: t, onComplete: e, onError: a }) {
525
531
  * Copyright 2025 Amodal Labs, Inc.
526
532
  * SPDX-License-Identifier: MIT
527
533
  */
528
- function re(r) {
529
- const { prompt: s, context: t, autoFetch: e = !0 } = r, { client: a } = C(), [n, c] = y(null), [i, p] = y(!1), [S, E] = y(null), g = T(null), _ = T(!1), u = N(async () => {
534
+ function se(s) {
535
+ const { prompt: r, context: t, autoFetch: e = !0 } = s, { client: n } = I(), [a, c] = y(null), [i, p] = y(!1), [S, E] = y(null), g = N(null), _ = N(!1), u = A(async () => {
530
536
  g.current && g.current.abort();
531
537
  const o = new AbortController();
532
538
  g.current = o, p(!0), E(null);
533
539
  try {
534
540
  let d = "";
535
541
  const f = [];
536
- for await (const l of a.chatStream(s, { context: t, signal: o.signal }))
542
+ for await (const l of n.chatStream(r, { context: t, signal: o.signal }))
537
543
  switch (l.type) {
538
544
  case "text_delta":
539
545
  d += l.content;
@@ -547,7 +553,7 @@ function re(r) {
547
553
  });
548
554
  break;
549
555
  case "tool_call_result": {
550
- const b = f.find((A) => A.toolId === l.tool_id);
556
+ const b = f.find((T) => T.toolId === l.tool_id);
551
557
  b && (b.status = l.status, b.result = l.result, b.duration_ms = l.duration_ms, b.error = l.error);
552
558
  break;
553
559
  }
@@ -563,32 +569,32 @@ function re(r) {
563
569
  } finally {
564
570
  p(!1), g.current = null;
565
571
  }
566
- }, [a, s, t]), m = N(() => {
572
+ }, [n, r, t]), m = A(() => {
567
573
  u();
568
574
  }, [u]);
569
- return I(() => (e && !_.current && (_.current = !0, u()), () => {
575
+ return R(() => (e && !_.current && (_.current = !0, u()), () => {
570
576
  g.current && g.current.abort();
571
- }), [e, u]), { brief: n, isLoading: i, error: S, refresh: m };
577
+ }), [e, u]), { brief: a, isLoading: i, error: S, refresh: m };
572
578
  }
573
579
  /**
574
580
  * @license
575
581
  * Copyright 2025 Amodal Labs, Inc.
576
582
  * SPDX-License-Identifier: MIT
577
583
  */
578
- function se(r) {
579
- const { prompt: s, context: t, autoFetch: e = !0 } = r, { client: a } = C(), [n, c] = y("idle"), [i, p] = y(""), [S, E] = y(""), [g, _] = y(null), u = T(null), m = T(!1), o = N(async () => {
584
+ function re(s) {
585
+ const { prompt: r, context: t, autoFetch: e = !0 } = s, { client: n } = I(), [a, c] = y("idle"), [i, p] = y(""), [S, E] = y(""), [g, _] = y(null), u = N(null), m = N(!1), o = A(async () => {
580
586
  u.current && u.current.abort();
581
587
  const f = new AbortController();
582
588
  u.current = f, c("loading"), _(null), p(""), E("");
583
589
  try {
584
590
  let l = "";
585
- for await (const A of a.chatStream(s, { context: t, signal: f.signal }))
586
- switch (A.type) {
591
+ for await (const T of n.chatStream(r, { context: t, signal: f.signal }))
592
+ switch (T.type) {
587
593
  case "text_delta":
588
- l += A.content;
594
+ l += T.content;
589
595
  break;
590
596
  case "error":
591
- _(A.message), c("error");
597
+ _(T.message), c("error");
592
598
  return;
593
599
  default:
594
600
  break;
@@ -602,29 +608,29 @@ function se(r) {
602
608
  } finally {
603
609
  u.current = null;
604
610
  }
605
- }, [a, s, t]), d = N(() => {
611
+ }, [n, r, t]), d = A(() => {
606
612
  o();
607
613
  }, [o]);
608
- return I(() => (e && !m.current && (m.current = !0, o()), () => {
614
+ return R(() => (e && !m.current && (m.current = !0, o()), () => {
609
615
  u.current && u.current.abort();
610
- }), [e, o]), { status: n, summary: i, details: S, isLoading: n === "loading", error: g, refresh: d };
616
+ }), [e, o]), { status: a, summary: i, details: S, isLoading: a === "loading", error: g, refresh: d };
611
617
  }
612
618
  /**
613
619
  * @license
614
620
  * Copyright 2025 Amodal Labs, Inc.
615
621
  * SPDX-License-Identifier: MIT
616
622
  */
617
- function ne(r) {
618
- const { taskId: s, autoStream: t = !0 } = r, { client: e } = C(), [a, n] = y("idle"), [c, i] = y(""), [p, S] = y(""), [E, g] = y([]), [_, u] = y(null), m = T(null), o = T(!1), d = N(async () => {
623
+ function ae(s) {
624
+ const { taskId: r, autoStream: t = !0 } = s, { client: e } = I(), [n, a] = y("idle"), [c, i] = y(""), [p, S] = y(""), [E, g] = y([]), [_, u] = y(null), m = N(null), o = N(!1), d = A(async () => {
619
625
  m.current && m.current.abort();
620
626
  const b = new AbortController();
621
- m.current = b, n("running"), u(null), g([]), S(""), i("");
627
+ m.current = b, a("running"), u(null), g([]), S(""), i("");
622
628
  try {
623
- let A = "";
624
- for await (const x of e.streamTask(s, b.signal))
625
- switch (g((R) => [...R, x]), x.type) {
629
+ let T = "";
630
+ for await (const x of e.streamTask(r, b.signal))
631
+ switch (g((C) => [...C, x]), x.type) {
626
632
  case "text_delta":
627
- A += x.content, S(A);
633
+ T += x.content, S(T);
628
634
  break;
629
635
  case "tool_call_start":
630
636
  i(`Running ${x.tool_name}...`);
@@ -633,27 +639,27 @@ function ne(r) {
633
639
  i("");
634
640
  break;
635
641
  case "error":
636
- u(x.message), n("error");
642
+ u(x.message), a("error");
637
643
  return;
638
644
  case "done":
639
- n("completed");
645
+ a("completed");
640
646
  return;
641
647
  default:
642
648
  break;
643
649
  }
644
- a === "running" && n("completed");
645
- } catch (A) {
646
- A instanceof DOMException && A.name === "AbortError" || (u(A instanceof Error ? A.message : "Unknown error"), n("error"));
650
+ n === "running" && a("completed");
651
+ } catch (T) {
652
+ T instanceof DOMException && T.name === "AbortError" || (u(T instanceof Error ? T.message : "Unknown error"), a("error"));
647
653
  } finally {
648
654
  m.current = null;
649
655
  }
650
- }, [e, s, a]), f = N(() => {
656
+ }, [e, r, n]), f = A(() => {
651
657
  m.current && (m.current.abort(), m.current = null);
652
- }, []), l = T(d);
653
- return l.current = d, I(() => (t && !o.current && (o.current = !0, l.current()), () => {
658
+ }, []), l = N(d);
659
+ return l.current = d, R(() => (t && !o.current && (o.current = !0, l.current()), () => {
654
660
  m.current && m.current.abort();
655
661
  }), [t]), {
656
- status: a,
662
+ status: n,
657
663
  progress: c,
658
664
  result: p,
659
665
  events: E,
@@ -667,14 +673,14 @@ function ne(r) {
667
673
  * Copyright 2025 Amodal Labs, Inc.
668
674
  * SPDX-License-Identifier: MIT
669
675
  */
670
- function ae(r) {
671
- const { prompt: s, context: t, autoFetch: e = !0 } = r, { client: a } = C(), [n, c] = y(null), [i, p] = y(!1), [S, E] = y(null), g = T(null), _ = T(!1), u = N(async () => {
676
+ function ne(s) {
677
+ const { prompt: r, context: t, autoFetch: e = !0 } = s, { client: n } = I(), [a, c] = y(null), [i, p] = y(!1), [S, E] = y(null), g = N(null), _ = N(!1), u = A(async () => {
672
678
  g.current && g.current.abort();
673
679
  const o = new AbortController();
674
680
  g.current = o, p(!0), E(null);
675
681
  try {
676
682
  let d = "";
677
- for await (const f of a.chatStream(s, { context: t, signal: o.signal }))
683
+ for await (const f of n.chatStream(r, { context: t, signal: o.signal }))
678
684
  switch (f.type) {
679
685
  case "text_delta":
680
686
  d += f.content;
@@ -691,46 +697,46 @@ function ae(r) {
691
697
  } finally {
692
698
  p(!1), g.current = null;
693
699
  }
694
- }, [a, s, t]), m = N(() => {
700
+ }, [n, r, t]), m = A(() => {
695
701
  u();
696
702
  }, [u]);
697
- return I(() => (e && !_.current && (_.current = !0, u()), () => {
703
+ return R(() => (e && !_.current && (_.current = !0, u()), () => {
698
704
  g.current && g.current.abort();
699
- }), [e, u]), { data: n, isLoading: i, error: S, refetch: m };
705
+ }), [e, u]), { data: a, isLoading: i, error: S, refetch: m };
700
706
  }
701
707
  /**
702
708
  * @license
703
709
  * Copyright 2025 Amodal Labs, Inc.
704
710
  * SPDX-License-Identifier: MIT
705
711
  */
706
- function oe(r, s) {
707
- const { key: t, refreshInterval: e = 3e4 } = s, { client: a } = C(), [n, c] = y(null), [i, p] = y([]), [S, E] = y(!0), [g, _] = y(null), u = T(null), m = N(async () => {
712
+ function oe(s, r) {
713
+ const { key: t, refreshInterval: e = 3e4 } = r, { client: n } = I(), [a, c] = y(null), [i, p] = y([]), [S, E] = y(!0), [g, _] = y(null), u = N(null), m = A(async () => {
708
714
  u.current && u.current.abort();
709
715
  const d = new AbortController();
710
716
  u.current = d;
711
717
  try {
712
- const f = await a.getStoreDocument(r, t, d.signal);
718
+ const f = await n.getStoreDocument(s, t, d.signal);
713
719
  c(f.document), p(f.history), _(null);
714
720
  } catch (f) {
715
721
  f instanceof DOMException && f.name === "AbortError" || _(f instanceof Error ? f.message : "Failed to fetch document");
716
722
  } finally {
717
723
  E(!1), u.current = null;
718
724
  }
719
- }, [a, r, t]), o = N(() => {
725
+ }, [n, s, t]), o = A(() => {
720
726
  m();
721
727
  }, [m]);
722
- return I(() => (E(!0), m(), () => {
728
+ return R(() => (E(!0), m(), () => {
723
729
  u.current && u.current.abort();
724
- }), [m]), I(() => {
730
+ }), [m]), R(() => {
725
731
  if (e <= 0) return;
726
732
  const d = setInterval(() => {
727
733
  m();
728
734
  }, e);
729
735
  return () => clearInterval(d);
730
736
  }, [m, e]), {
731
- data: (n == null ? void 0 : n.payload) ?? null,
732
- meta: (n == null ? void 0 : n.meta) ?? null,
733
- document: n,
737
+ data: (a == null ? void 0 : a.payload) ?? null,
738
+ meta: (a == null ? void 0 : a.meta) ?? null,
739
+ document: a,
734
740
  history: i,
735
741
  isLoading: S,
736
742
  error: g,
@@ -742,43 +748,43 @@ function oe(r, s) {
742
748
  * Copyright 2025 Amodal Labs, Inc.
743
749
  * SPDX-License-Identifier: MIT
744
750
  */
745
- function le(r, s = {}) {
746
- const { filter: t, sort: e, limit: a = 20, refreshInterval: n = 3e4 } = s, { client: c } = C(), [i, p] = y([]), [S, E] = y(0), [g, _] = y(!1), [u, m] = y(!0), [o, d] = y(null), f = T(null), l = t ? JSON.stringify(t) : "", b = N(async () => {
751
+ function le(s, r = {}) {
752
+ const { filter: t, sort: e, limit: n = 20, refreshInterval: a = 3e4 } = r, { client: c } = I(), [i, p] = y([]), [S, E] = y(0), [g, _] = y(!1), [u, m] = y(!0), [o, d] = y(null), f = N(null), l = t ? JSON.stringify(t) : "", b = A(async () => {
747
753
  f.current && f.current.abort();
748
754
  const x = new AbortController();
749
755
  f.current = x;
750
756
  try {
751
- const R = await c.getStoreDocuments(r, {
757
+ const C = await c.getStoreDocuments(s, {
752
758
  filter: l ? JSON.parse(l) : void 0,
753
759
  sort: e,
754
- limit: a,
760
+ limit: n,
755
761
  signal: x.signal
756
762
  });
757
- p(R.documents), E(R.total), _(R.hasMore), d(null);
758
- } catch (R) {
759
- R instanceof DOMException && R.name === "AbortError" || d(R instanceof Error ? R.message : "Failed to fetch store list");
763
+ p(C.documents), E(C.total), _(C.hasMore), d(null);
764
+ } catch (C) {
765
+ C instanceof DOMException && C.name === "AbortError" || d(C instanceof Error ? C.message : "Failed to fetch store list");
760
766
  } finally {
761
767
  m(!1), f.current = null;
762
768
  }
763
- }, [c, r, l, e, a]), A = N(() => {
769
+ }, [c, s, l, e, n]), T = A(() => {
764
770
  b();
765
771
  }, [b]);
766
- return I(() => (m(!0), b(), () => {
772
+ return R(() => (m(!0), b(), () => {
767
773
  f.current && f.current.abort();
768
- }), [b]), I(() => {
769
- if (n <= 0) return;
774
+ }), [b]), R(() => {
775
+ if (a <= 0) return;
770
776
  const x = setInterval(() => {
771
777
  b();
772
- }, n);
778
+ }, a);
773
779
  return () => clearInterval(x);
774
- }, [b, n]), {
780
+ }, [b, a]), {
775
781
  data: i.map((x) => x.payload),
776
782
  documents: i,
777
783
  total: S,
778
784
  hasMore: g,
779
785
  isLoading: u,
780
786
  error: o,
781
- refetch: A
787
+ refetch: T
782
788
  };
783
789
  }
784
790
  /**
@@ -786,15 +792,15 @@ function le(r, s = {}) {
786
792
  * Copyright 2025 Amodal Labs, Inc.
787
793
  * SPDX-License-Identifier: MIT
788
794
  */
789
- function ce(r, s = {}) {
790
- const { client: t } = C(), [e, a] = y(!1), [n, c] = y(null), [i, p] = y(null), S = T(null);
791
- return { execute: N(
795
+ function ce(s, r = {}) {
796
+ const { client: t } = I(), [e, n] = y(!1), [a, c] = y(null), [i, p] = y(null), S = N(null);
797
+ return { execute: A(
792
798
  (g) => {
793
799
  S.current && S.current.abort();
794
800
  const _ = new AbortController();
795
- S.current = _, a(!0), c(null), p(null);
796
- let u = `Run skill "${r}"`;
797
- g && Object.keys(g).length > 0 && (u += ` with parameters: ${JSON.stringify(g)}`), s.stores && s.stores.length > 0 && (u += `. Write results to stores: ${s.stores.join(", ")}`), s.confirm && (u += ". Confirm before writing."), (async () => {
801
+ S.current = _, n(!0), c(null), p(null);
802
+ let u = `Run skill "${s}"`;
803
+ g && Object.keys(g).length > 0 && (u += ` with parameters: ${JSON.stringify(g)}`), r.stores && r.stores.length > 0 && (u += `. Write results to stores: ${r.stores.join(", ")}`), r.confirm && (u += ". Confirm before writing."), (async () => {
798
804
  try {
799
805
  let m = "";
800
806
  for await (const o of t.chatStream(u, { signal: _.signal }))
@@ -812,44 +818,61 @@ function ce(r, s = {}) {
812
818
  } catch (m) {
813
819
  m instanceof DOMException && m.name === "AbortError" || p(m instanceof Error ? m.message : "Skill execution failed");
814
820
  } finally {
815
- a(!1), S.current = null;
821
+ n(!1), S.current = null;
816
822
  }
817
823
  })();
818
824
  },
819
- [t, r, s.stores, s.confirm]
820
- ), loading: e, result: n, error: i };
825
+ [t, s, r.stores, r.confirm]
826
+ ), loading: e, result: a, error: i };
821
827
  }
822
828
  /**
823
829
  * @license
824
830
  * Copyright 2025 Amodal Labs, Inc.
825
831
  * SPDX-License-Identifier: MIT
826
832
  */
827
- const q = P(null);
833
+ const q = F(null);
828
834
  function ie() {
829
- const r = j(q), s = N((t, e) => {
835
+ const s = j(q), r = A((t, e) => {
830
836
  }, []);
831
- return r ?? s;
837
+ return s ?? r;
832
838
  }
833
839
  export {
834
840
  te as AmodalAction,
835
841
  ee as AmodalChat,
836
842
  Z as AmodalProvider,
837
- Q as ConfirmCard,
843
+ me as ChatClient,
844
+ fe as ChatStream,
845
+ H as ConfirmCard,
838
846
  q as NavigateContext,
839
- W as ReviewCard,
847
+ J as ReviewCard,
840
848
  V as RuntimeClient,
841
- me as parseSSELine,
842
- fe as streamSSE,
843
- pe as streamSSEGet,
844
- re as useAmodalBrief,
845
- J as useAmodalChat,
846
- C as useAmodalContext,
847
- se as useAmodalInsight,
848
- ae as useAmodalQuery,
849
- ne as useAmodalTask,
849
+ be as TypedEventEmitter,
850
+ Te as WidgetEventBus,
851
+ ge as applyTheme,
852
+ Ae as createChatClient,
853
+ Ne as createSession,
854
+ xe as defaultEntityExtractor,
855
+ _e as defaultTheme,
856
+ Ce as getSessionHistory,
857
+ we as listSessions,
858
+ he as mergeTheme,
859
+ Re as parseSSELine,
860
+ Ie as streamChat,
861
+ ke as streamSSE,
862
+ De as streamSSEGet,
863
+ Me as updateSession,
864
+ se as useAmodalBrief,
865
+ W as useAmodalChat,
866
+ I as useAmodalContext,
867
+ re as useAmodalInsight,
868
+ ne as useAmodalQuery,
869
+ ae as useAmodalTask,
870
+ ve as useChat,
850
871
  ie as useNavigate,
872
+ ye as useSessionHistory,
851
873
  ce as useSkillAction,
852
874
  oe as useStore,
853
- le as useStoreList
875
+ le as useStoreList,
876
+ Ee as useWidgetEvents
854
877
  };
855
878
  //# sourceMappingURL=react.js.map