@distri/react 0.2.5 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/globals.css +2 -61
- package/dist/globals.d.cts +2 -0
- package/dist/globals.d.ts +2 -0
- package/dist/index.cjs +9 -30
- package/dist/index.css +2 -61
- package/dist/index.d.cts +738 -0
- package/dist/index.d.ts +738 -0
- package/dist/index.js +9 -29
- package/package.json +2 -2
package/dist/globals.css
CHANGED
|
@@ -332,67 +332,6 @@ video {
|
|
|
332
332
|
[hidden]:where(:not([hidden=until-found])) {
|
|
333
333
|
display: none;
|
|
334
334
|
}
|
|
335
|
-
:root {
|
|
336
|
-
--background: 0 0% 100%;
|
|
337
|
-
--foreground: 222.2 84% 4.9%;
|
|
338
|
-
--card: 0 0% 100%;
|
|
339
|
-
--card-foreground: 222.2 84% 4.9%;
|
|
340
|
-
--popover: 0 0% 100%;
|
|
341
|
-
--popover-foreground: 222.2 84% 4.9%;
|
|
342
|
-
--primary: 222.2 47.4% 11.2%;
|
|
343
|
-
--primary-foreground: 210 40% 98%;
|
|
344
|
-
--secondary: 210 40% 96%;
|
|
345
|
-
--secondary-foreground: 222.2 84% 4.9%;
|
|
346
|
-
--muted: 210 40% 96%;
|
|
347
|
-
--muted-foreground: 215.4 16.3% 46.9%;
|
|
348
|
-
--accent: 210 40% 96%;
|
|
349
|
-
--accent-foreground: 222.2 84% 4.9%;
|
|
350
|
-
--destructive: 0 84.2% 60.2%;
|
|
351
|
-
--destructive-foreground: 210 40% 98%;
|
|
352
|
-
--border: 214.3 31.8% 91.4%;
|
|
353
|
-
--input: 214.3 31.8% 91.4%;
|
|
354
|
-
--ring: 222.2 84% 4.9%;
|
|
355
|
-
--radius: 0.5rem;
|
|
356
|
-
--sidebar: 0 0% 98%;
|
|
357
|
-
--sidebar-foreground: 240 5.3% 26.1%;
|
|
358
|
-
--sidebar-primary: 240 5.9% 10%;
|
|
359
|
-
--sidebar-primary-foreground: 0 0% 98%;
|
|
360
|
-
--sidebar-accent: 240 4.8% 95.9%;
|
|
361
|
-
--sidebar-accent-foreground: 240 5.9% 10%;
|
|
362
|
-
--sidebar-border: 220 13% 91%;
|
|
363
|
-
--sidebar-ring: 217.2 91.2% 59.8%;
|
|
364
|
-
--thread-content-max-width: 768px;
|
|
365
|
-
}
|
|
366
|
-
.dark {
|
|
367
|
-
--background: 222.2 84% 4.9%;
|
|
368
|
-
--foreground: 210 40% 98%;
|
|
369
|
-
--card: 222.2 84% 4.9%;
|
|
370
|
-
--card-foreground: 210 40% 98%;
|
|
371
|
-
--popover: 222.2 84% 4.9%;
|
|
372
|
-
--popover-foreground: 210 40% 98%;
|
|
373
|
-
--primary: 210 40% 98%;
|
|
374
|
-
--primary-foreground: 222.2 84% 4.9%;
|
|
375
|
-
--secondary: 217.2 32.6% 17.5%;
|
|
376
|
-
--secondary-foreground: 210 40% 98%;
|
|
377
|
-
--muted: 217.2 32.6% 17.5%;
|
|
378
|
-
--muted-foreground: 215 20.2% 65.1%;
|
|
379
|
-
--accent: 217.2 32.6% 17.5%;
|
|
380
|
-
--accent-foreground: 210 40% 98%;
|
|
381
|
-
--destructive: 0 62.8% 30.6%;
|
|
382
|
-
--destructive-foreground: 210 40% 98%;
|
|
383
|
-
--border: 217.2 32.6% 17.5%;
|
|
384
|
-
--input: 217.2 32.6% 17.5%;
|
|
385
|
-
--ring: 212.7 26.8% 83.9%;
|
|
386
|
-
--sidebar: 240 5.9% 10%;
|
|
387
|
-
--sidebar-foreground: 240 4.8% 95.9%;
|
|
388
|
-
--sidebar-primary: 0 0% 98%;
|
|
389
|
-
--sidebar-primary-foreground: 240 5.9% 10%;
|
|
390
|
-
--sidebar-accent: 240 3.7% 15.9%;
|
|
391
|
-
--sidebar-accent-foreground: 240 4.8% 95.9%;
|
|
392
|
-
--sidebar-border: 240 3.7% 15.9%;
|
|
393
|
-
--sidebar-ring: 217.2 91.2% 59.8%;
|
|
394
|
-
--thread-content-max-width: 768px;
|
|
395
|
-
}
|
|
396
335
|
* {
|
|
397
336
|
border-color: hsl(var(--border));
|
|
398
337
|
}
|
|
@@ -2766,3 +2705,5 @@ body {
|
|
|
2766
2705
|
[data-side=right] .\[\[data-side\=right\]_\&\]\:cursor-e-resize {
|
|
2767
2706
|
cursor: e-resize;
|
|
2768
2707
|
}
|
|
2708
|
+
/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com
|
|
2709
|
+
*/
|
package/dist/index.cjs
CHANGED
|
@@ -133,7 +133,6 @@ __export(index_exports, {
|
|
|
133
133
|
useChatStateStore: () => useChatStateStore,
|
|
134
134
|
useConfiguration: () => useConfiguration,
|
|
135
135
|
useDistri: () => useDistri,
|
|
136
|
-
useDistriClient: () => useDistriClient,
|
|
137
136
|
useSidebar: () => useSidebar,
|
|
138
137
|
useSpeechToText: () => useSpeechToText,
|
|
139
138
|
useTheme: () => useTheme,
|
|
@@ -1472,19 +1471,6 @@ function useDistri() {
|
|
|
1472
1471
|
}
|
|
1473
1472
|
return context;
|
|
1474
1473
|
}
|
|
1475
|
-
function useDistriClient() {
|
|
1476
|
-
const { client, error, isLoading } = useDistri();
|
|
1477
|
-
if (isLoading) {
|
|
1478
|
-
throw new Error("Distri client is still loading");
|
|
1479
|
-
}
|
|
1480
|
-
if (error) {
|
|
1481
|
-
throw new Error(`Distri client initialization failed: ${error.message}`);
|
|
1482
|
-
}
|
|
1483
|
-
if (!client) {
|
|
1484
|
-
throw new Error("Distri client is not initialized");
|
|
1485
|
-
}
|
|
1486
|
-
return client;
|
|
1487
|
-
}
|
|
1488
1474
|
|
|
1489
1475
|
// src/useAgent.ts
|
|
1490
1476
|
function useAgent({
|
|
@@ -1707,13 +1693,6 @@ function useThreads() {
|
|
|
1707
1693
|
setLoading(false);
|
|
1708
1694
|
}
|
|
1709
1695
|
}, [clientLoading, clientError, client, fetchThreads]);
|
|
1710
|
-
(0, import_react8.useEffect)(() => {
|
|
1711
|
-
if (!client) return;
|
|
1712
|
-
const interval = setInterval(() => {
|
|
1713
|
-
fetchThreads();
|
|
1714
|
-
}, 3e4);
|
|
1715
|
-
return () => clearInterval(interval);
|
|
1716
|
-
}, [client, fetchThreads]);
|
|
1717
1696
|
return {
|
|
1718
1697
|
threads,
|
|
1719
1698
|
loading: loading || clientLoading,
|
|
@@ -5589,7 +5568,7 @@ var import_react19 = require("react");
|
|
|
5589
5568
|
// src/hooks/useConfiguration.ts
|
|
5590
5569
|
var import_react18 = require("react");
|
|
5591
5570
|
function useConfiguration() {
|
|
5592
|
-
const client =
|
|
5571
|
+
const { client, isLoading } = useDistri();
|
|
5593
5572
|
const [configuration, setConfiguration] = (0, import_react18.useState)(null);
|
|
5594
5573
|
const [meta, setMeta] = (0, import_react18.useState)(null);
|
|
5595
5574
|
const [loading, setLoading] = (0, import_react18.useState)(true);
|
|
@@ -5597,6 +5576,7 @@ function useConfiguration() {
|
|
|
5597
5576
|
const refresh = (0, import_react18.useCallback)(async () => {
|
|
5598
5577
|
setLoading(true);
|
|
5599
5578
|
try {
|
|
5579
|
+
if (isLoading || !client) return;
|
|
5600
5580
|
const response = await client.getConfiguration();
|
|
5601
5581
|
setConfiguration(response.configuration);
|
|
5602
5582
|
setMeta(response.meta);
|
|
@@ -5607,7 +5587,7 @@ function useConfiguration() {
|
|
|
5607
5587
|
} finally {
|
|
5608
5588
|
setLoading(false);
|
|
5609
5589
|
}
|
|
5610
|
-
}, [client]);
|
|
5590
|
+
}, [client, isLoading]);
|
|
5611
5591
|
const saveConfiguration = (0, import_react18.useCallback)(
|
|
5612
5592
|
async (config) => {
|
|
5613
5593
|
setLoading(true);
|
|
@@ -6305,11 +6285,11 @@ function convertA2APartToDistri(a2aPart) {
|
|
|
6305
6285
|
// src/hooks/useChatMessages.ts
|
|
6306
6286
|
function useChatMessages({
|
|
6307
6287
|
initialMessages = [],
|
|
6308
|
-
agent,
|
|
6309
6288
|
threadId,
|
|
6310
6289
|
onError
|
|
6311
6290
|
} = {}) {
|
|
6312
6291
|
const onErrorRef = (0, import_react22.useRef)(onError);
|
|
6292
|
+
const { client } = useDistri();
|
|
6313
6293
|
(0, import_react22.useEffect)(() => {
|
|
6314
6294
|
onErrorRef.current = onError;
|
|
6315
6295
|
}, [onError]);
|
|
@@ -6331,11 +6311,11 @@ function useChatMessages({
|
|
|
6331
6311
|
setMessages([]);
|
|
6332
6312
|
}, []);
|
|
6333
6313
|
const fetchMessages = (0, import_react22.useCallback)(async () => {
|
|
6334
|
-
if (!
|
|
6314
|
+
if (!client || !threadId) return;
|
|
6335
6315
|
try {
|
|
6336
6316
|
setIsLoading(true);
|
|
6337
6317
|
setError(null);
|
|
6338
|
-
const a2aMessages = await
|
|
6318
|
+
const a2aMessages = await client.getThreadMessages(threadId);
|
|
6339
6319
|
const distriMessages = a2aMessages.map(decodeA2AStreamEvent).filter(Boolean);
|
|
6340
6320
|
setMessages(distriMessages);
|
|
6341
6321
|
} catch (err) {
|
|
@@ -6345,12 +6325,12 @@ function useChatMessages({
|
|
|
6345
6325
|
} finally {
|
|
6346
6326
|
setIsLoading(false);
|
|
6347
6327
|
}
|
|
6348
|
-
}, [
|
|
6328
|
+
}, [client, threadId]);
|
|
6349
6329
|
(0, import_react22.useEffect)(() => {
|
|
6350
|
-
if (threadId &&
|
|
6330
|
+
if (threadId && client && !initialMessagesLength) {
|
|
6351
6331
|
fetchMessages();
|
|
6352
6332
|
}
|
|
6353
|
-
}, [
|
|
6333
|
+
}, [client, fetchMessages, initialMessagesLength, threadId]);
|
|
6354
6334
|
return {
|
|
6355
6335
|
messages,
|
|
6356
6336
|
addMessage,
|
|
@@ -6490,7 +6470,6 @@ function wrapTools(tools, options = {}) {
|
|
|
6490
6470
|
useChatStateStore,
|
|
6491
6471
|
useConfiguration,
|
|
6492
6472
|
useDistri,
|
|
6493
|
-
useDistriClient,
|
|
6494
6473
|
useSidebar,
|
|
6495
6474
|
useSpeechToText,
|
|
6496
6475
|
useTheme,
|
package/dist/index.css
CHANGED
|
@@ -332,67 +332,6 @@ video {
|
|
|
332
332
|
[hidden]:where(:not([hidden=until-found])) {
|
|
333
333
|
display: none;
|
|
334
334
|
}
|
|
335
|
-
:root {
|
|
336
|
-
--background: 0 0% 100%;
|
|
337
|
-
--foreground: 222.2 84% 4.9%;
|
|
338
|
-
--card: 0 0% 100%;
|
|
339
|
-
--card-foreground: 222.2 84% 4.9%;
|
|
340
|
-
--popover: 0 0% 100%;
|
|
341
|
-
--popover-foreground: 222.2 84% 4.9%;
|
|
342
|
-
--primary: 222.2 47.4% 11.2%;
|
|
343
|
-
--primary-foreground: 210 40% 98%;
|
|
344
|
-
--secondary: 210 40% 96%;
|
|
345
|
-
--secondary-foreground: 222.2 84% 4.9%;
|
|
346
|
-
--muted: 210 40% 96%;
|
|
347
|
-
--muted-foreground: 215.4 16.3% 46.9%;
|
|
348
|
-
--accent: 210 40% 96%;
|
|
349
|
-
--accent-foreground: 222.2 84% 4.9%;
|
|
350
|
-
--destructive: 0 84.2% 60.2%;
|
|
351
|
-
--destructive-foreground: 210 40% 98%;
|
|
352
|
-
--border: 214.3 31.8% 91.4%;
|
|
353
|
-
--input: 214.3 31.8% 91.4%;
|
|
354
|
-
--ring: 222.2 84% 4.9%;
|
|
355
|
-
--radius: 0.5rem;
|
|
356
|
-
--sidebar: 0 0% 98%;
|
|
357
|
-
--sidebar-foreground: 240 5.3% 26.1%;
|
|
358
|
-
--sidebar-primary: 240 5.9% 10%;
|
|
359
|
-
--sidebar-primary-foreground: 0 0% 98%;
|
|
360
|
-
--sidebar-accent: 240 4.8% 95.9%;
|
|
361
|
-
--sidebar-accent-foreground: 240 5.9% 10%;
|
|
362
|
-
--sidebar-border: 220 13% 91%;
|
|
363
|
-
--sidebar-ring: 217.2 91.2% 59.8%;
|
|
364
|
-
--thread-content-max-width: 768px;
|
|
365
|
-
}
|
|
366
|
-
.dark {
|
|
367
|
-
--background: 222.2 84% 4.9%;
|
|
368
|
-
--foreground: 210 40% 98%;
|
|
369
|
-
--card: 222.2 84% 4.9%;
|
|
370
|
-
--card-foreground: 210 40% 98%;
|
|
371
|
-
--popover: 222.2 84% 4.9%;
|
|
372
|
-
--popover-foreground: 210 40% 98%;
|
|
373
|
-
--primary: 210 40% 98%;
|
|
374
|
-
--primary-foreground: 222.2 84% 4.9%;
|
|
375
|
-
--secondary: 217.2 32.6% 17.5%;
|
|
376
|
-
--secondary-foreground: 210 40% 98%;
|
|
377
|
-
--muted: 217.2 32.6% 17.5%;
|
|
378
|
-
--muted-foreground: 215 20.2% 65.1%;
|
|
379
|
-
--accent: 217.2 32.6% 17.5%;
|
|
380
|
-
--accent-foreground: 210 40% 98%;
|
|
381
|
-
--destructive: 0 62.8% 30.6%;
|
|
382
|
-
--destructive-foreground: 210 40% 98%;
|
|
383
|
-
--border: 217.2 32.6% 17.5%;
|
|
384
|
-
--input: 217.2 32.6% 17.5%;
|
|
385
|
-
--ring: 212.7 26.8% 83.9%;
|
|
386
|
-
--sidebar: 240 5.9% 10%;
|
|
387
|
-
--sidebar-foreground: 240 4.8% 95.9%;
|
|
388
|
-
--sidebar-primary: 0 0% 98%;
|
|
389
|
-
--sidebar-primary-foreground: 240 5.9% 10%;
|
|
390
|
-
--sidebar-accent: 240 3.7% 15.9%;
|
|
391
|
-
--sidebar-accent-foreground: 240 4.8% 95.9%;
|
|
392
|
-
--sidebar-border: 240 3.7% 15.9%;
|
|
393
|
-
--sidebar-ring: 217.2 91.2% 59.8%;
|
|
394
|
-
--thread-content-max-width: 768px;
|
|
395
|
-
}
|
|
396
335
|
* {
|
|
397
336
|
border-color: hsl(var(--border));
|
|
398
337
|
}
|
|
@@ -2766,3 +2705,5 @@ body {
|
|
|
2766
2705
|
[data-side=right] .\[\[data-side\=right\]_\&\]\:cursor-e-resize {
|
|
2767
2706
|
cursor: e-resize;
|
|
2768
2707
|
}
|
|
2708
|
+
/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com
|
|
2709
|
+
*/
|