@amodalai/react 0.1.26 → 0.2.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.
@@ -1,693 +0,0 @@
1
- import { useReducer as _e, useRef as h, useCallback as I, useEffect as F, useState as Y } from "react";
2
- import { W as ye, s as Te, g as Ee, l as Se, u as ce } from "./event-bus-h26clqbZ.js";
3
- /**
4
- * @license
5
- * Copyright 2025 Amodal Labs, Inc.
6
- * SPDX-License-Identifier: MIT
7
- */
8
- const J = {
9
- messages: [],
10
- sessionId: null,
11
- isStreaming: !1,
12
- error: null,
13
- activeToolCalls: [],
14
- isHistorical: !1,
15
- usage: { inputTokens: 0, outputTokens: 0 }
16
- };
17
- let ie = 0;
18
- function ue() {
19
- return ie++, `msg-${Date.now()}-${String(ie)}`;
20
- }
21
- function ke(n, s) {
22
- switch (s.type) {
23
- case "SEND_MESSAGE": {
24
- const e = {
25
- type: "user",
26
- id: ue(),
27
- text: s.text,
28
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
29
- }, t = {
30
- type: "assistant_text",
31
- id: ue(),
32
- text: "",
33
- toolCalls: [],
34
- confirmations: [],
35
- skillActivations: [],
36
- kbProposals: [],
37
- widgets: [],
38
- contentBlocks: [],
39
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
40
- };
41
- return {
42
- ...n,
43
- messages: [...n.messages, e, t],
44
- isStreaming: !0,
45
- error: null,
46
- activeToolCalls: [],
47
- isHistorical: !1,
48
- usage: { inputTokens: 0, outputTokens: 0 }
49
- };
50
- }
51
- case "STREAM_INIT":
52
- return { ...n, sessionId: s.sessionId };
53
- case "STREAM_TEXT_DELTA": {
54
- const e = [...n.messages], t = e[e.length - 1];
55
- if (t && t.type === "assistant_text") {
56
- const r = [...t.contentBlocks], a = r[r.length - 1];
57
- a && a.type === "text" ? r[r.length - 1] = { type: "text", text: a.text + s.content } : r.push({ type: "text", text: s.content }), e[e.length - 1] = { ...t, text: t.text + s.content, contentBlocks: r };
58
- }
59
- return { ...n, messages: e };
60
- }
61
- case "STREAM_TOOL_CALL_START": {
62
- const e = [...n.messages], t = e[e.length - 1], r = {
63
- toolId: s.toolId,
64
- toolName: s.toolName,
65
- parameters: s.parameters,
66
- status: "running"
67
- };
68
- if (t && t.type === "assistant_text") {
69
- const a = [...t.toolCalls, r], l = [...t.contentBlocks], c = l[l.length - 1];
70
- c && c.type === "tool_calls" ? l[l.length - 1] = { type: "tool_calls", calls: [...c.calls, r] } : l.push({ type: "tool_calls", calls: [r] }), e[e.length - 1] = { ...t, toolCalls: a, contentBlocks: l };
71
- }
72
- return {
73
- ...n,
74
- messages: e,
75
- activeToolCalls: [...n.activeToolCalls, r]
76
- };
77
- }
78
- case "STREAM_TOOL_CALL_RESULT": {
79
- const e = [...n.messages], t = e[e.length - 1];
80
- if (t && t.type === "assistant_text") {
81
- const a = (y) => y.toolId === s.toolId ? {
82
- ...y,
83
- status: s.status,
84
- result: s.result,
85
- duration_ms: s.duration_ms,
86
- error: s.error
87
- } : y, l = t.toolCalls.map(a), c = t.contentBlocks.map(
88
- (y) => y.type === "tool_calls" ? { ...y, calls: y.calls.map(a) } : y
89
- );
90
- e[e.length - 1] = { ...t, toolCalls: l, contentBlocks: c };
91
- }
92
- const r = n.activeToolCalls.filter(
93
- (a) => a.toolId !== s.toolId
94
- );
95
- return { ...n, messages: e, activeToolCalls: r };
96
- }
97
- case "STREAM_SUBAGENT_EVENT": {
98
- const e = [...n.messages], t = e[e.length - 1];
99
- if (t && t.type === "assistant_text") {
100
- const r = (c) => c.toolId === s.parentToolId ? { ...c, subagentEvents: [...c.subagentEvents ?? [], s.event] } : c, a = t.toolCalls.map(r), l = t.contentBlocks.map(
101
- (c) => c.type === "tool_calls" ? { ...c, calls: c.calls.map(r) } : c
102
- );
103
- e[e.length - 1] = { ...t, toolCalls: a, contentBlocks: l };
104
- }
105
- return { ...n, messages: e };
106
- }
107
- case "STREAM_SKILL_ACTIVATED": {
108
- const e = [...n.messages], t = e[e.length - 1];
109
- return t && t.type === "assistant_text" && (e[e.length - 1] = {
110
- ...t,
111
- skillActivations: [...t.skillActivations, s.skill]
112
- }), { ...n, messages: e };
113
- }
114
- case "STREAM_KB_PROPOSAL": {
115
- const e = [...n.messages], t = e[e.length - 1], r = {
116
- scope: s.scope,
117
- title: s.title,
118
- reasoning: s.reasoning
119
- };
120
- return t && t.type === "assistant_text" && (e[e.length - 1] = {
121
- ...t,
122
- kbProposals: [...t.kbProposals, r]
123
- }), { ...n, messages: e };
124
- }
125
- case "STREAM_WIDGET": {
126
- const e = [...n.messages], t = e[e.length - 1];
127
- if (t && t.type === "assistant_text") {
128
- const r = {
129
- widgetType: s.widgetType,
130
- data: s.data
131
- }, a = {
132
- type: "widget",
133
- widgetType: s.widgetType,
134
- data: s.data
135
- };
136
- e[e.length - 1] = {
137
- ...t,
138
- widgets: [...t.widgets, r],
139
- contentBlocks: [...t.contentBlocks, a]
140
- };
141
- }
142
- return { ...n, messages: e };
143
- }
144
- case "STREAM_ASK_USER": {
145
- const e = [...n.messages], t = e[e.length - 1];
146
- if (t && t.type === "assistant_text") {
147
- const r = {
148
- type: "ask_user",
149
- askId: s.askId,
150
- questions: s.questions,
151
- status: "pending"
152
- };
153
- e[e.length - 1] = {
154
- ...t,
155
- contentBlocks: [...t.contentBlocks, r]
156
- };
157
- }
158
- return { ...n, messages: e };
159
- }
160
- case "ASK_USER_SUBMITTED": {
161
- const e = [...n.messages], t = e[e.length - 1];
162
- if (t && t.type === "assistant_text") {
163
- const r = t.contentBlocks.map(
164
- (a) => a.type === "ask_user" && a.askId === s.askId ? { ...a, status: "submitted", answers: s.answers } : a
165
- );
166
- e[e.length - 1] = { ...t, contentBlocks: r };
167
- }
168
- return { ...n, messages: e };
169
- }
170
- case "STREAM_CONFIRMATION_REQUIRED": {
171
- const e = [...n.messages], t = e[e.length - 1];
172
- if (t && t.type === "assistant_text") {
173
- const r = {
174
- type: "confirmation",
175
- confirmation: s.confirmation
176
- };
177
- e[e.length - 1] = {
178
- ...t,
179
- confirmations: [...t.confirmations, s.confirmation],
180
- contentBlocks: [...t.contentBlocks, r]
181
- };
182
- }
183
- return { ...n, messages: e };
184
- }
185
- case "CONFIRMATION_RESPONDED": {
186
- const e = [...n.messages], t = e[e.length - 1];
187
- if (t && t.type === "assistant_text") {
188
- const r = t.confirmations.map(
189
- (l) => l.correlationId === s.correlationId ? { ...l, status: s.approved ? "approved" : "denied" } : l
190
- ), a = t.contentBlocks.map(
191
- (l) => l.type === "confirmation" && l.confirmation.correlationId === s.correlationId ? { ...l, confirmation: { ...l.confirmation, status: s.approved ? "approved" : "denied" } } : l
192
- );
193
- e[e.length - 1] = { ...t, confirmations: r, contentBlocks: a };
194
- }
195
- return { ...n, messages: e };
196
- }
197
- case "STREAM_CREDENTIAL_SAVED":
198
- case "STREAM_APPROVED":
199
- return n;
200
- case "STREAM_ERROR":
201
- return { ...n, isStreaming: !1, error: s.message, activeToolCalls: [] };
202
- case "STREAM_DONE": {
203
- const e = [...n.messages], t = e[e.length - 1];
204
- if (t && t.type === "assistant_text") {
205
- const r = (c) => c.status === "running" ? { ...c, status: "error", error: "Stopped" } : c, a = t.toolCalls.map(r), l = t.contentBlocks.map(
206
- (c) => c.type === "tool_calls" ? { ...c, calls: c.calls.map(r) } : c
207
- );
208
- e[e.length - 1] = { ...t, toolCalls: a, contentBlocks: l };
209
- }
210
- return { ...n, messages: e, isStreaming: !1, activeToolCalls: [] };
211
- }
212
- case "LOAD_HISTORY":
213
- return {
214
- ...J,
215
- messages: s.messages,
216
- sessionId: s.sessionId,
217
- isHistorical: !0
218
- };
219
- case "RESET":
220
- return { ...J };
221
- default:
222
- return n;
223
- }
224
- }
225
- function Ce(n) {
226
- const { serverUrl: s, user: e, getToken: t, onToolCall: r, onKBProposal: a, onEvent: l, entityExtractors: c, sessionType: y, deployId: V, initialMessage: g, resumeSessionId: w, onStreamEnd: q, onSessionCreated: z } = n, [d, i] = _e(ke, J), T = h(null), m = h(null), p = h({ onToolCall: r, onKBProposal: a, getToken: t, onEvent: l, onStreamEnd: q, onSessionCreated: z });
227
- p.current = { onToolCall: r, onKBProposal: a, getToken: t, onEvent: l, onStreamEnd: q, onSessionCreated: z };
228
- const x = h(null);
229
- x.current || (x.current = new ye(), c && x.current.setExtractors(c));
230
- const S = x.current, k = h(null);
231
- k.current || (k.current = (E) => {
232
- var A, b;
233
- (b = (A = p.current).onEvent) == null || b.call(A, E);
234
- }, S.on("entity_referenced", k.current));
235
- const X = h(/* @__PURE__ */ new Map());
236
- T.current = d.sessionId;
237
- const Q = I(
238
- (E) => {
239
- if (d.isStreaming) return;
240
- i({ type: "SEND_MESSAGE", text: E });
241
- const A = new AbortController();
242
- m.current = A, (async () => {
243
- var C, L, O, u, M, W, U, v, f, R, P, B, $, H, te, se, oe, ne, re, ae;
244
- let D = !1;
245
- try {
246
- const K = ((L = (C = p.current).getToken) == null ? void 0 : L.call(C)) ?? void 0, fe = Te(
247
- s,
248
- {
249
- message: E,
250
- session_id: T.current ?? void 0,
251
- role: e.role,
252
- session_type: y,
253
- deploy_id: V
254
- },
255
- A.signal,
256
- K
257
- );
258
- for await (const o of fe)
259
- switch (o.type) {
260
- case "init":
261
- i({ type: "STREAM_INIT", sessionId: o.session_id }), (u = (O = p.current).onSessionCreated) == null || u.call(O, o.session_id);
262
- break;
263
- case "text_delta":
264
- i({ type: "STREAM_TEXT_DELTA", content: o.content });
265
- break;
266
- case "tool_call_start":
267
- i({
268
- type: "STREAM_TOOL_CALL_START",
269
- toolId: o.tool_id,
270
- toolName: o.tool_name,
271
- parameters: o.parameters
272
- }), X.current.set(o.tool_id, {
273
- toolName: o.tool_name,
274
- parameters: o.parameters
275
- });
276
- break;
277
- case "tool_call_result": {
278
- const _ = X.current.get(o.tool_id), N = {
279
- toolId: o.tool_id,
280
- toolName: (_ == null ? void 0 : _.toolName) ?? "",
281
- parameters: (_ == null ? void 0 : _.parameters) ?? {},
282
- status: o.status,
283
- result: o.result,
284
- duration_ms: o.duration_ms,
285
- error: o.error
286
- };
287
- X.current.delete(o.tool_id), i({
288
- type: "STREAM_TOOL_CALL_RESULT",
289
- toolId: o.tool_id,
290
- status: o.status,
291
- result: o.result,
292
- duration_ms: o.duration_ms,
293
- error: o.error
294
- }), (W = (M = p.current).onToolCall) == null || W.call(M, N);
295
- const le = {
296
- type: "tool_executed",
297
- toolName: N.toolName,
298
- toolId: N.toolId,
299
- parameters: N.parameters,
300
- status: o.status,
301
- result: o.result,
302
- duration_ms: o.duration_ms,
303
- error: o.error,
304
- timestamp: o.timestamp
305
- };
306
- S.processEvent(le), (v = (U = p.current).onEvent) == null || v.call(U, le);
307
- break;
308
- }
309
- case "subagent_event":
310
- i({
311
- type: "STREAM_SUBAGENT_EVENT",
312
- parentToolId: o.parent_tool_id,
313
- event: {
314
- agentName: o.agent_name,
315
- eventType: o.event_type,
316
- toolName: o.tool_name,
317
- toolArgs: o.tool_args,
318
- result: o.result,
319
- text: o.text,
320
- error: o.error,
321
- timestamp: o.timestamp
322
- }
323
- });
324
- break;
325
- case "skill_activated": {
326
- i({ type: "STREAM_SKILL_ACTIVATED", skill: o.skill });
327
- const _ = {
328
- type: "skill_activated",
329
- skill: o.skill,
330
- timestamp: o.timestamp
331
- };
332
- S.processEvent(_), (R = (f = p.current).onEvent) == null || R.call(f, _);
333
- break;
334
- }
335
- case "kb_proposal": {
336
- const _ = {
337
- scope: o.scope,
338
- title: o.title,
339
- reasoning: o.reasoning
340
- };
341
- i({
342
- type: "STREAM_KB_PROPOSAL",
343
- scope: o.scope,
344
- title: o.title,
345
- reasoning: o.reasoning
346
- }), (B = (P = p.current).onKBProposal) == null || B.call(P, _);
347
- const N = {
348
- type: "kb_proposal",
349
- proposal: _,
350
- timestamp: o.timestamp
351
- };
352
- S.processEvent(N), (H = ($ = p.current).onEvent) == null || H.call($, N);
353
- break;
354
- }
355
- case "widget": {
356
- i({
357
- type: "STREAM_WIDGET",
358
- widgetType: o.widget_type,
359
- data: o.data
360
- });
361
- const _ = {
362
- type: "widget_rendered",
363
- widgetType: o.widget_type,
364
- data: o.data,
365
- timestamp: o.timestamp
366
- };
367
- S.processEvent(_), (se = (te = p.current).onEvent) == null || se.call(te, _);
368
- break;
369
- }
370
- case "ask_user":
371
- i({
372
- type: "STREAM_ASK_USER",
373
- askId: o.ask_id,
374
- questions: o.questions
375
- });
376
- break;
377
- case "credential_saved":
378
- i({ type: "STREAM_CREDENTIAL_SAVED", connectionName: o.connection_name });
379
- break;
380
- case "approved":
381
- i({ type: "STREAM_APPROVED", resourceType: o.resource_type, previewId: o.preview_id });
382
- break;
383
- case "error":
384
- i({ type: "STREAM_ERROR", message: o.message });
385
- break;
386
- case "done":
387
- D = !0, i({ type: "STREAM_DONE" }), (ne = (oe = p.current).onStreamEnd) == null || ne.call(oe);
388
- break;
389
- default:
390
- break;
391
- }
392
- } catch (K) {
393
- K instanceof DOMException && K.name === "AbortError" || i({
394
- type: "STREAM_ERROR",
395
- message: K instanceof Error ? K.message : "Unknown error"
396
- });
397
- } finally {
398
- m.current = null, !D && !A.signal.aborted && (i({ type: "STREAM_DONE" }), (ae = (re = p.current).onStreamEnd) == null || ae.call(re));
399
- }
400
- })();
401
- },
402
- [s, e.role, d.isStreaming, S, y, V]
403
- ), Z = h(!1);
404
- F(() => {
405
- !w || Z.current || (Z.current = !0, G.current = !0, ee(w));
406
- }, [w]);
407
- const j = h(!1), G = h(!1);
408
- F(() => {
409
- if (w || d.isHistorical || !g || G.current) return;
410
- j.current = !1;
411
- const E = setTimeout(() => {
412
- !j.current && !G.current && (j.current = !0, Q(g));
413
- }, 0);
414
- return () => {
415
- clearTimeout(E);
416
- };
417
- }, [g, d.isHistorical]), F(() => {
418
- g && j.current && !d.isStreaming && d.messages.length > 0 && (G.current = !0);
419
- }, [g, d.isStreaming, d.messages.length]);
420
- const de = I(() => {
421
- m.current && (m.current.abort(), m.current = null), i({ type: "STREAM_DONE" });
422
- }, []), me = I(() => {
423
- m.current && (m.current.abort(), m.current = null), i({ type: "RESET" });
424
- }, []), ge = I(
425
- (E, A) => {
426
- const b = T.current;
427
- if (!b) return;
428
- i({ type: "ASK_USER_SUBMITTED", askId: E, answers: A }), (async () => {
429
- var C, L;
430
- try {
431
- const O = ((L = (C = p.current).getToken) == null ? void 0 : L.call(C)) ?? void 0, u = { "Content-Type": "application/json" };
432
- O && (u.Authorization = `Bearer ${O}`), await fetch(
433
- `${s}/chat/sessions/${b}/ask-user-response`,
434
- {
435
- method: "POST",
436
- headers: u,
437
- body: JSON.stringify({ ask_id: E, answers: A })
438
- }
439
- );
440
- } catch {
441
- }
442
- })();
443
- },
444
- [s]
445
- ), ee = I(
446
- (E) => {
447
- G.current = !0, (async () => {
448
- var b, D;
449
- try {
450
- const C = ((D = (b = p.current).getToken) == null ? void 0 : D.call(b)) ?? void 0, O = (await Ee(s, E, C)).messages.map((u) => {
451
- if (u.type === "assistant_text") {
452
- const M = (u.toolCalls ?? []).map((f) => ({
453
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- stored tool call from DB
454
- toolId: f.toolId ?? "",
455
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- stored tool call from DB
456
- toolName: f.toolName ?? "",
457
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- stored args from DB
458
- parameters: f.args ?? {},
459
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- stored tool call from DB
460
- status: f.status ?? "success",
461
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- stored tool call from DB
462
- duration_ms: f.duration_ms,
463
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- stored tool call from DB
464
- error: f.error,
465
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- stored tool call from DB
466
- result: f.result
467
- })), W = u.widgets ?? [], U = u.contentBlocks, v = [];
468
- if (U && U.length > 0) {
469
- const f = new Map(M.map((R) => [R.toolId, R]));
470
- for (const R of U) {
471
- const P = R.type;
472
- if (P === "text") {
473
- const B = R.text;
474
- B.length > 0 && v.push({ type: "text", text: B });
475
- } else if (P === "tool_calls") {
476
- const B = R.callIds, $ = B ? B.map((H) => f.get(H)).filter(
477
- (H) => H != null
478
- ) : M;
479
- $.length > 0 && v.push({ type: "tool_calls", calls: $ });
480
- } else P === "widget" && v.push({
481
- type: "widget",
482
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- stored block from DB
483
- widgetType: R.widgetType,
484
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- stored widget data from DB
485
- data: R.data ?? {}
486
- });
487
- }
488
- } else {
489
- M.length > 0 && v.push({ type: "tool_calls", calls: M }), u.text.length > 0 && v.push({ type: "text", text: u.text });
490
- for (const f of W)
491
- v.push({ type: "widget", widgetType: f.widgetType, data: f.data });
492
- }
493
- return {
494
- type: "assistant_text",
495
- id: u.id,
496
- text: u.text,
497
- toolCalls: M,
498
- confirmations: [],
499
- skillActivations: u.skillActivations ?? [],
500
- kbProposals: [],
501
- widgets: W,
502
- contentBlocks: v,
503
- timestamp: u.timestamp
504
- };
505
- }
506
- return u.type === "error" ? {
507
- type: "error",
508
- id: u.id,
509
- message: u.text,
510
- timestamp: u.timestamp
511
- } : {
512
- type: "user",
513
- id: u.id,
514
- text: u.text,
515
- timestamp: u.timestamp
516
- };
517
- });
518
- i({ type: "LOAD_HISTORY", sessionId: E, messages: O });
519
- } catch (C) {
520
- i({
521
- type: "STREAM_ERROR",
522
- message: C instanceof Error ? C.message : "Failed to load session"
523
- });
524
- }
525
- })();
526
- },
527
- [s]
528
- );
529
- return F(
530
- () => () => {
531
- m.current && m.current.abort();
532
- },
533
- []
534
- ), {
535
- messages: d.messages,
536
- send: Q,
537
- stop: de,
538
- isStreaming: d.isStreaming,
539
- activeToolCalls: d.activeToolCalls,
540
- session: { id: d.sessionId, role: e.role },
541
- error: d.error,
542
- reset: me,
543
- eventBus: S,
544
- submitAskUserResponse: ge,
545
- loadSession: ee,
546
- isHistorical: d.isHistorical
547
- };
548
- }
549
- /**
550
- * @license
551
- * Copyright 2025 Amodal Labs, Inc.
552
- * SPDX-License-Identifier: MIT
553
- */
554
- function ve(n) {
555
- const s = h([]);
556
- F(
557
- () => () => {
558
- for (const r of s.current)
559
- r();
560
- s.current = [];
561
- },
562
- []
563
- );
564
- const e = I(
565
- (r, a) => {
566
- if (!n)
567
- return () => {
568
- };
569
- n.on(r, a);
570
- const l = () => {
571
- n.off(r, a);
572
- };
573
- return s.current.push(l), l;
574
- },
575
- [n]
576
- ), t = I(
577
- (r) => {
578
- if (!n)
579
- return () => {
580
- };
581
- n.on("*", r);
582
- const a = () => {
583
- n.off("*", r);
584
- };
585
- return s.current.push(a), a;
586
- },
587
- [n]
588
- );
589
- return { on: e, onAny: t };
590
- }
591
- /**
592
- * @license
593
- * Copyright 2025 Amodal Labs, Inc.
594
- * SPDX-License-Identifier: MIT
595
- */
596
- function Ie(n) {
597
- const { serverUrl: s, getToken: e, enabled: t } = n, [r, a] = Y([]), [l, c] = Y(!1), [y, V] = Y(null), g = h(e);
598
- g.current = e;
599
- const w = I(() => {
600
- if (!t) return;
601
- c(!0), V(null), (async () => {
602
- var T;
603
- try {
604
- const m = ((T = g.current) == null ? void 0 : T.call(g)) ?? void 0, p = await Se(s, m);
605
- a(p);
606
- } catch (m) {
607
- V(m instanceof Error ? m.message : "Failed to load sessions");
608
- } finally {
609
- c(!1);
610
- }
611
- })();
612
- }, [s, t]), q = I(
613
- (i, T) => {
614
- (async () => {
615
- var p;
616
- try {
617
- const x = ((p = g.current) == null ? void 0 : p.call(g)) ?? void 0;
618
- await ce(s, i, { tags: T }, x), a(
619
- (S) => S.map((k) => k.id === i ? { ...k, tags: T } : k)
620
- );
621
- } catch {
622
- }
623
- })();
624
- },
625
- [s]
626
- ), z = I(
627
- (i, T) => {
628
- (async () => {
629
- var p;
630
- try {
631
- const x = ((p = g.current) == null ? void 0 : p.call(g)) ?? void 0;
632
- await ce(s, i, { title: T }, x), a(
633
- (S) => S.map((k) => k.id === i ? { ...k, title: T } : k)
634
- );
635
- } catch {
636
- }
637
- })();
638
- },
639
- [s]
640
- ), d = [...new Set(r.flatMap((i) => i.tags))].sort();
641
- return F(() => {
642
- t && w();
643
- }, [t, w]), { sessions: r, isLoading: l, error: y, refresh: w, updateTags: q, updateTitle: z, allTags: d };
644
- }
645
- /**
646
- * @license
647
- * Copyright 2025 Amodal Labs, Inc.
648
- * SPDX-License-Identifier: MIT
649
- */
650
- const pe = {
651
- primaryColor: "#1e40af",
652
- backgroundColor: "#ffffff",
653
- fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
654
- fontSize: "14px",
655
- borderRadius: "8px",
656
- userBubbleColor: "#1e40af",
657
- agentBubbleColor: "#f3f4f6",
658
- toolCallColor: "#f9fafb",
659
- headerText: "AI Assistant",
660
- placeholder: "Type a message...",
661
- emptyStateText: "Send a message to start a conversation."
662
- }, Re = {
663
- primaryColor: "--pcw-primary",
664
- backgroundColor: "--pcw-bg",
665
- fontFamily: "--pcw-font",
666
- fontSize: "--pcw-font-size",
667
- borderRadius: "--pcw-radius",
668
- userBubbleColor: "--pcw-user-bubble",
669
- agentBubbleColor: "--pcw-agent-bubble",
670
- toolCallColor: "--pcw-tool-call-bg",
671
- headerText: "--pcw-header-text",
672
- placeholder: "--pcw-placeholder",
673
- emptyStateText: "--pcw-empty-state-text"
674
- };
675
- function be(n, s) {
676
- const e = { ...pe, ...s };
677
- for (const [t, r] of Object.entries(Re)) {
678
- const a = e[t];
679
- a !== void 0 && n.style.setProperty(r, a);
680
- }
681
- }
682
- function we(n) {
683
- return { ...pe, ...n };
684
- }
685
- export {
686
- be as a,
687
- Ie as b,
688
- ve as c,
689
- pe as d,
690
- we as m,
691
- Ce as u
692
- };
693
- //# sourceMappingURL=theme-VAUsolBG.js.map