@tangle-network/sandbox-ui 0.13.0 → 0.15.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.
- package/dist/auth.d.ts +1 -74
- package/dist/auth.js +1 -4
- package/dist/chat.d.ts +1 -136
- package/dist/chat.js +2 -15
- package/dist/chunk-2BUPSB7O.js +0 -0
- package/dist/chunk-3J6FG3FJ.js +18 -0
- package/dist/chunk-76IQLPW2.js +206 -0
- package/dist/chunk-7ZA5SEK3.js +239 -0
- package/dist/{chunk-ESVYBDGA.js → chunk-AG7QDC2Q.js} +182 -2
- package/dist/chunk-AHBZCBDO.js +2960 -0
- package/dist/chunk-AZ3AWMTM.js +8 -0
- package/dist/chunk-CMY7W45U.js +380 -0
- package/dist/{chunk-QMU2PWOU.js → chunk-DNZ4DTNA.js} +71 -17
- package/dist/chunk-EI44GEQ5.js +6 -0
- package/dist/{chunk-5OQ27N57.js → chunk-GPT7VKK6.js} +34 -38
- package/dist/chunk-JBGKGLD7.js +16 -0
- package/dist/chunk-NJNME4J4.js +14 -0
- package/dist/chunk-QPAJR74X.js +20 -0
- package/dist/chunk-TK46XFLM.js +28 -0
- package/dist/chunk-WID73FPH.js +89 -0
- package/dist/chunk-YVXK4XRO.js +30 -0
- package/dist/dashboard.d.ts +538 -4
- package/dist/dashboard.js +15 -886
- package/dist/editor.d.ts +1 -120
- package/dist/editor.js +1 -5
- package/dist/files.d.ts +1 -129
- package/dist/files.js +2 -7
- package/dist/globals.css +5 -1265
- package/dist/hooks.d.ts +114 -11
- package/dist/hooks.js +17 -88
- package/dist/index.d.ts +24 -99
- package/dist/index.js +247 -252
- package/dist/markdown.d.ts +1 -29
- package/dist/markdown.js +2 -2
- package/dist/openui.d.ts +8 -115
- package/dist/openui.js +1 -6
- package/dist/pages.d.ts +1 -2
- package/dist/pages.js +68 -66
- package/dist/primitives.d.ts +14 -49
- package/dist/primitives.js +69 -77
- package/dist/run.d.ts +1 -14
- package/dist/run.js +2 -22
- package/dist/sdk-hooks.d.ts +3 -283
- package/dist/sdk-hooks.js +10 -14
- package/dist/stores.d.ts +2 -14
- package/dist/stores.js +11 -39
- package/dist/styles.css +5 -1265
- package/dist/{usage-chart-CPTcNlGs.d.ts → template-card-UhV3pmRC.d.ts} +16 -1
- package/dist/terminal.js +39 -2
- package/dist/types.d.ts +11 -8
- package/dist/types.js +1 -0
- package/dist/utils.d.ts +1 -44
- package/dist/utils.js +6 -12
- package/dist/workspace.d.ts +5 -10
- package/dist/workspace.js +3 -19
- package/package.json +23 -54
- package/dist/active-sessions-store-CeOmXgv5.d.ts +0 -85
- package/dist/artifact-pane-Bh45Ssco.d.ts +0 -24
- package/dist/branding-DCi5VEik.d.ts +0 -13
- package/dist/button-CMQuQEW_.d.ts +0 -17
- package/dist/chat-container-f4yEs6KN.d.ts +0 -106
- package/dist/chunk-34A66VBG.js +0 -214
- package/dist/chunk-34I7UFSX.js +0 -92
- package/dist/chunk-36QY2W5G.js +0 -802
- package/dist/chunk-4CLN43XT.js +0 -45
- package/dist/chunk-54SQQMMM.js +0 -156
- package/dist/chunk-66EZOYZR.js +0 -102
- package/dist/chunk-BX6AQMUS.js +0 -183
- package/dist/chunk-DI3NZ5ZX.js +0 -192
- package/dist/chunk-DPGIXDAI.js +0 -220
- package/dist/chunk-DXMIEK4K.js +0 -1426
- package/dist/chunk-GSZA3TSY.js +0 -79
- package/dist/chunk-HB5Y37YU.js +0 -54
- package/dist/chunk-LQNEZDRM.js +0 -109
- package/dist/chunk-MA7YKRUP.js +0 -131
- package/dist/chunk-MKTSMWVD.js +0 -109
- package/dist/chunk-MQXABZTB.js +0 -1348
- package/dist/chunk-MT5FJ3ZT.js +0 -186
- package/dist/chunk-NKUPJC34.js +0 -2070
- package/dist/chunk-OEX7NZE3.js +0 -321
- package/dist/chunk-OKLQVY3Y.js +0 -139
- package/dist/chunk-Q56BYXQF.js +0 -61
- package/dist/chunk-QD4QE5P5.js +0 -40
- package/dist/chunk-QDH5GEGY.js +0 -630
- package/dist/chunk-QID2OOMG.js +0 -133
- package/dist/chunk-RQHJBTEU.js +0 -10
- package/dist/chunk-T7HMZEVO.js +0 -216
- package/dist/chunk-U6QTHMY6.js +0 -1290
- package/dist/chunk-US6JKJKH.js +0 -124
- package/dist/chunk-VX3XOUEB.js +0 -63
- package/dist/chunk-XLG757B6.js +0 -933
- package/dist/chunk-ZMNSRDMH.js +0 -127
- package/dist/chunk-ZNCEM5CD.js +0 -316
- package/dist/document-editor-pane-A70-EhdQ.d.ts +0 -124
- package/dist/document-editor-pane-TLPVRBBU.js +0 -11
- package/dist/expanded-tool-detail-Dh99mcbY.d.ts +0 -63
- package/dist/file-tabs-BLfxfmAH.d.ts +0 -51
- package/dist/parts-CyGkM6Fp.d.ts +0 -50
- package/dist/run-CtFZ6s-D.d.ts +0 -41
- package/dist/sidebar-drop-zone-tDBsuOH5.d.ts +0 -301
- package/dist/sidecar-CFU2W9j1.d.ts +0 -8
- package/dist/template-card-BAtvcAkU.d.ts +0 -18
- package/dist/tool-call-feed-Bs3MyQMT.d.ts +0 -68
- package/dist/tool-display-Ct9nFAzJ.d.ts +0 -32
- package/dist/use-sandbox-metrics-B64diPqN.d.ts +0 -141
- package/dist/variant-list-BrHYcBCk.d.ts +0 -540
package/dist/primitives.js
CHANGED
|
@@ -1,29 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
SidebarDropZone,
|
|
16
|
-
Switch,
|
|
17
|
-
TerminalCursor,
|
|
18
|
-
TerminalDisplay,
|
|
19
|
-
TerminalInput,
|
|
20
|
-
TerminalLine,
|
|
21
|
-
ToastContainer,
|
|
22
|
-
ToastProvider,
|
|
23
|
-
UploadProgress,
|
|
24
|
-
useToast
|
|
25
|
-
} from "./chunk-36QY2W5G.js";
|
|
26
|
-
import {
|
|
2
|
+
Avatar,
|
|
3
|
+
AvatarFallback,
|
|
4
|
+
AvatarImage,
|
|
5
|
+
Badge,
|
|
6
|
+
Button,
|
|
7
|
+
Card,
|
|
8
|
+
CardContent,
|
|
9
|
+
CardDescription,
|
|
10
|
+
CardFooter,
|
|
11
|
+
CardHeader,
|
|
12
|
+
CardTitle,
|
|
13
|
+
CodeBlock,
|
|
14
|
+
CopyButton,
|
|
27
15
|
Dialog,
|
|
28
16
|
DialogClose,
|
|
29
17
|
DialogContent,
|
|
@@ -33,38 +21,8 @@ import {
|
|
|
33
21
|
DialogOverlay,
|
|
34
22
|
DialogPortal,
|
|
35
23
|
DialogTitle,
|
|
36
|
-
DialogTrigger
|
|
37
|
-
|
|
38
|
-
import {
|
|
39
|
-
Tabs,
|
|
40
|
-
TabsContent,
|
|
41
|
-
TabsList,
|
|
42
|
-
TabsTrigger
|
|
43
|
-
} from "./chunk-Q56BYXQF.js";
|
|
44
|
-
import {
|
|
45
|
-
EmptyState,
|
|
46
|
-
Input,
|
|
47
|
-
Textarea
|
|
48
|
-
} from "./chunk-MA7YKRUP.js";
|
|
49
|
-
import {
|
|
50
|
-
Table,
|
|
51
|
-
TableBody,
|
|
52
|
-
TableCaption,
|
|
53
|
-
TableCell,
|
|
54
|
-
TableFooter,
|
|
55
|
-
TableHead,
|
|
56
|
-
TableHeader,
|
|
57
|
-
TableRow
|
|
58
|
-
} from "./chunk-34I7UFSX.js";
|
|
59
|
-
import {
|
|
60
|
-
Logo,
|
|
61
|
-
StatCard,
|
|
62
|
-
TangleKnot
|
|
63
|
-
} from "./chunk-OKLQVY3Y.js";
|
|
64
|
-
import {
|
|
65
|
-
Avatar,
|
|
66
|
-
AvatarFallback,
|
|
67
|
-
AvatarImage,
|
|
24
|
+
DialogTrigger,
|
|
25
|
+
DropZone,
|
|
68
26
|
DropdownMenu,
|
|
69
27
|
DropdownMenuCheckboxItem,
|
|
70
28
|
DropdownMenuContent,
|
|
@@ -79,29 +37,58 @@ import {
|
|
|
79
37
|
DropdownMenuSub,
|
|
80
38
|
DropdownMenuSubContent,
|
|
81
39
|
DropdownMenuSubTrigger,
|
|
82
|
-
DropdownMenuTrigger
|
|
83
|
-
|
|
84
|
-
|
|
40
|
+
DropdownMenuTrigger,
|
|
41
|
+
EmptyState,
|
|
42
|
+
InlineCode,
|
|
43
|
+
Input,
|
|
44
|
+
Label,
|
|
45
|
+
Logo,
|
|
85
46
|
Progress,
|
|
47
|
+
SegmentedControl,
|
|
48
|
+
Select,
|
|
49
|
+
SelectContent,
|
|
50
|
+
SelectGroup,
|
|
51
|
+
SelectItem,
|
|
52
|
+
SelectLabel,
|
|
53
|
+
SelectScrollDownButton,
|
|
54
|
+
SelectScrollUpButton,
|
|
55
|
+
SelectSeparator,
|
|
56
|
+
SelectTrigger,
|
|
57
|
+
SelectValue,
|
|
58
|
+
SidebarDropZone,
|
|
86
59
|
Skeleton,
|
|
87
60
|
SkeletonCard,
|
|
88
|
-
SkeletonTable
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
61
|
+
SkeletonTable,
|
|
62
|
+
StatCard,
|
|
63
|
+
Switch,
|
|
64
|
+
Table,
|
|
65
|
+
TableBody,
|
|
66
|
+
TableCaption,
|
|
67
|
+
TableCell,
|
|
68
|
+
TableFooter,
|
|
69
|
+
TableHead,
|
|
70
|
+
TableHeader,
|
|
71
|
+
TableRow,
|
|
72
|
+
Tabs,
|
|
73
|
+
TabsContent,
|
|
74
|
+
TabsList,
|
|
75
|
+
TabsTrigger,
|
|
76
|
+
TangleKnot,
|
|
77
|
+
TerminalCursor,
|
|
78
|
+
TerminalDisplay,
|
|
79
|
+
TerminalInput,
|
|
80
|
+
TerminalLine,
|
|
81
|
+
Textarea,
|
|
82
|
+
ThemeToggle,
|
|
83
|
+
ToastContainer,
|
|
84
|
+
ToastProvider,
|
|
85
|
+
UploadProgress,
|
|
86
|
+
badgeVariants,
|
|
87
|
+
buttonVariants,
|
|
88
|
+
useTheme,
|
|
89
|
+
useToast
|
|
90
|
+
} from "./chunk-7ZA5SEK3.js";
|
|
91
|
+
import "./chunk-EI44GEQ5.js";
|
|
105
92
|
export {
|
|
106
93
|
Avatar,
|
|
107
94
|
AvatarFallback,
|
|
@@ -114,6 +101,8 @@ export {
|
|
|
114
101
|
CardFooter,
|
|
115
102
|
CardHeader,
|
|
116
103
|
CardTitle,
|
|
104
|
+
CodeBlock,
|
|
105
|
+
CopyButton,
|
|
117
106
|
Dialog,
|
|
118
107
|
DialogClose,
|
|
119
108
|
DialogContent,
|
|
@@ -141,6 +130,7 @@ export {
|
|
|
141
130
|
DropdownMenuSubTrigger,
|
|
142
131
|
DropdownMenuTrigger,
|
|
143
132
|
EmptyState,
|
|
133
|
+
InlineCode,
|
|
144
134
|
Input,
|
|
145
135
|
Label,
|
|
146
136
|
Logo,
|
|
@@ -180,10 +170,12 @@ export {
|
|
|
180
170
|
TerminalInput,
|
|
181
171
|
TerminalLine,
|
|
182
172
|
Textarea,
|
|
173
|
+
ThemeToggle,
|
|
183
174
|
ToastContainer,
|
|
184
175
|
ToastProvider,
|
|
185
176
|
UploadProgress,
|
|
186
177
|
badgeVariants,
|
|
187
178
|
buttonVariants,
|
|
179
|
+
useTheme,
|
|
188
180
|
useToast
|
|
189
181
|
};
|
package/dist/run.d.ts
CHANGED
|
@@ -1,14 +1 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
-
export { F as FeedSegment, T as ToolCallData, a as ToolCallFeed, b as ToolCallFeedProps, c as ToolCallGroup, d as ToolCallGroupProps, e as ToolCallStatus, f as ToolCallStep, g as ToolCallStepProps, h as ToolCallType, p as parseToolEvent } from './tool-call-feed-Bs3MyQMT.js';
|
|
4
|
-
import 'react';
|
|
5
|
-
import './run-CtFZ6s-D.js';
|
|
6
|
-
import './parts-CyGkM6Fp.js';
|
|
7
|
-
import './branding-DCi5VEik.js';
|
|
8
|
-
import './tool-display-Ct9nFAzJ.js';
|
|
9
|
-
|
|
10
|
-
declare function LiveDuration({ startTime }: {
|
|
11
|
-
startTime: number;
|
|
12
|
-
}): react_jsx_runtime.JSX.Element;
|
|
13
|
-
|
|
14
|
-
export { LiveDuration };
|
|
1
|
+
export { ExpandedToolDetail, ExpandedToolDetailProps, InlineThinkingItem, InlineThinkingItemProps, InlineToolItem, InlineToolItemProps, LiveDuration, RunGroup, RunGroupProps } from '@tangle-network/ui/run';
|
package/dist/run.js
CHANGED
|
@@ -1,34 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ToolCallFeed,
|
|
3
|
-
parseToolEvent
|
|
4
|
-
} from "./chunk-QID2OOMG.js";
|
|
5
1
|
import {
|
|
6
2
|
ExpandedToolDetail,
|
|
7
3
|
InlineThinkingItem,
|
|
8
4
|
InlineToolItem,
|
|
9
5
|
LiveDuration,
|
|
10
6
|
RunGroup
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-4CLN43XT.js";
|
|
13
|
-
import {
|
|
14
|
-
ToolCallGroup,
|
|
15
|
-
ToolCallStep
|
|
16
|
-
} from "./chunk-MT5FJ3ZT.js";
|
|
17
|
-
import "./chunk-BX6AQMUS.js";
|
|
18
|
-
import "./chunk-ZNCEM5CD.js";
|
|
19
|
-
import "./chunk-34I7UFSX.js";
|
|
20
|
-
import "./chunk-T7HMZEVO.js";
|
|
21
|
-
import "./chunk-ZMNSRDMH.js";
|
|
22
|
-
import "./chunk-MKTSMWVD.js";
|
|
23
|
-
import "./chunk-RQHJBTEU.js";
|
|
7
|
+
} from "./chunk-JBGKGLD7.js";
|
|
24
8
|
export {
|
|
25
9
|
ExpandedToolDetail,
|
|
26
10
|
InlineThinkingItem,
|
|
27
11
|
InlineToolItem,
|
|
28
12
|
LiveDuration,
|
|
29
|
-
RunGroup
|
|
30
|
-
ToolCallFeed,
|
|
31
|
-
ToolCallGroup,
|
|
32
|
-
ToolCallStep,
|
|
33
|
-
parseToolEvent
|
|
13
|
+
RunGroup
|
|
34
14
|
};
|
package/dist/sdk-hooks.d.ts
CHANGED
|
@@ -1,274 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { G as GroupedMessage, R as Run } from './run-CtFZ6s-D.js';
|
|
4
|
-
import { S as SessionMessage, a as SessionPart } from './parts-CyGkM6Fp.js';
|
|
5
|
-
import { R as RegisterActiveSessionOptions, g as ActiveSessionTransportMode, c as ActiveSessionConnectionState } from './active-sessions-store-CeOmXgv5.js';
|
|
6
|
-
import { F as FeedSegment } from './tool-call-feed-Bs3MyQMT.js';
|
|
7
|
-
import 'nanostores';
|
|
8
|
-
import 'react/jsx-runtime';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* useToolCallStream — parses SSE events into ToolCallFeed segments.
|
|
12
|
-
*
|
|
13
|
-
* Takes raw SSE event data from the orchestrator stream and produces
|
|
14
|
-
* structured FeedSegments that ToolCallFeed can render.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
interface UseToolCallStreamReturn {
|
|
18
|
-
/** Current feed segments (text + tool calls interleaved) */
|
|
19
|
-
segments: FeedSegment[];
|
|
20
|
-
/** Push a raw SSE event into the stream */
|
|
21
|
-
pushEvent: (event: {
|
|
22
|
-
type: string;
|
|
23
|
-
data: Record<string, unknown>;
|
|
24
|
-
}) => void;
|
|
25
|
-
/** Push a text delta (from message.part.updated) */
|
|
26
|
-
pushText: (delta: string) => void;
|
|
27
|
-
/** Mark a tool call as complete */
|
|
28
|
-
completeToolCall: (id: string, result: {
|
|
29
|
-
output?: string;
|
|
30
|
-
error?: string;
|
|
31
|
-
duration?: number;
|
|
32
|
-
}) => void;
|
|
33
|
-
/** Reset the stream */
|
|
34
|
-
reset: () => void;
|
|
35
|
-
}
|
|
36
|
-
declare function useToolCallStream(): UseToolCallStreamReturn;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* SSE Event data structure
|
|
40
|
-
*/
|
|
41
|
-
interface SSEEvent<T = unknown> {
|
|
42
|
-
id?: string;
|
|
43
|
-
event: string;
|
|
44
|
-
data: T;
|
|
45
|
-
timestamp: number;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Connection state for SSE streams
|
|
49
|
-
*/
|
|
50
|
-
type ConnectionState = "connecting" | "connected" | "reconnecting" | "disconnected" | "error";
|
|
51
|
-
/**
|
|
52
|
-
* SSE stream options
|
|
53
|
-
*/
|
|
54
|
-
interface UseSSEStreamOptions<T = unknown> {
|
|
55
|
-
/** URL to connect to */
|
|
56
|
-
url: string;
|
|
57
|
-
/** Authorization header value */
|
|
58
|
-
authToken?: string;
|
|
59
|
-
/** Enable automatic reconnection (default: true) */
|
|
60
|
-
autoReconnect?: boolean;
|
|
61
|
-
/** Max reconnection attempts (default: 5) */
|
|
62
|
-
maxRetries?: number;
|
|
63
|
-
/** Base delay between reconnects in ms (default: 1000) */
|
|
64
|
-
reconnectDelay?: number;
|
|
65
|
-
/** Event types to listen for (default: all) */
|
|
66
|
-
eventTypes?: string[];
|
|
67
|
-
/** Callback for each event */
|
|
68
|
-
onEvent?: (event: SSEEvent<T>) => void;
|
|
69
|
-
/** Callback on connection state change */
|
|
70
|
-
onStateChange?: (state: ConnectionState) => void;
|
|
71
|
-
/** Callback on error */
|
|
72
|
-
onError?: (error: Error) => void;
|
|
73
|
-
/** Custom headers */
|
|
74
|
-
headers?: Record<string, string>;
|
|
75
|
-
/** Whether to start connected (default: true) */
|
|
76
|
-
enabled?: boolean;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* SSE stream result
|
|
80
|
-
*/
|
|
81
|
-
interface UseSSEStreamResult<T = unknown> {
|
|
82
|
-
/** Current connection state */
|
|
83
|
-
state: ConnectionState;
|
|
84
|
-
/** All received events */
|
|
85
|
-
events: SSEEvent<T>[];
|
|
86
|
-
/** Most recent event */
|
|
87
|
-
lastEvent: SSEEvent<T> | null;
|
|
88
|
-
/** Error if any */
|
|
89
|
-
error: Error | null;
|
|
90
|
-
/** Manually connect */
|
|
91
|
-
connect: () => void;
|
|
92
|
-
/** Manually disconnect */
|
|
93
|
-
disconnect: () => void;
|
|
94
|
-
/** Clear events buffer */
|
|
95
|
-
clearEvents: () => void;
|
|
96
|
-
/** Retry count */
|
|
97
|
-
retryCount: number;
|
|
98
|
-
/** Time since last event (ms) */
|
|
99
|
-
timeSinceLastEvent: number;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* React hook for consuming SSE streams with automatic reconnection,
|
|
103
|
-
* event buffering, and state management.
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
* ```tsx
|
|
107
|
-
* const { events, state, lastEvent } = useSSEStream({
|
|
108
|
-
* url: '/api/v1/tasks/123/stream',
|
|
109
|
-
* authToken: 'Bearer xxx',
|
|
110
|
-
* onEvent: (e) => console.log('Event:', e),
|
|
111
|
-
* });
|
|
112
|
-
*
|
|
113
|
-
* return (
|
|
114
|
-
* <div>
|
|
115
|
-
* <p>Status: {state}</p>
|
|
116
|
-
* {events.map((e, i) => (
|
|
117
|
-
* <div key={i}>{e.event}: {JSON.stringify(e.data)}</div>
|
|
118
|
-
* ))}
|
|
119
|
-
* </div>
|
|
120
|
-
* );
|
|
121
|
-
* ```
|
|
122
|
-
*/
|
|
123
|
-
declare function useSSEStream<T = unknown>(options: UseSSEStreamOptions<T>): UseSSEStreamResult<T>;
|
|
124
|
-
/**
|
|
125
|
-
* Typed event types for common streaming scenarios
|
|
126
|
-
*/
|
|
127
|
-
interface TaskStreamEvent {
|
|
128
|
-
task_id: string;
|
|
129
|
-
status?: string;
|
|
130
|
-
progress?: number;
|
|
131
|
-
message?: string;
|
|
132
|
-
result?: unknown;
|
|
133
|
-
error?: string;
|
|
134
|
-
}
|
|
135
|
-
interface AgentStreamEvent {
|
|
136
|
-
type: "message.updated" | "tool_call" | "tool_result" | "llm_response" | "error" | "session.idle" | "execution.started" | "execution.result";
|
|
137
|
-
data: unknown;
|
|
138
|
-
timestamp?: number;
|
|
139
|
-
}
|
|
140
|
-
interface TerminalStreamEvent {
|
|
141
|
-
type: "output" | "input" | "error" | "exit";
|
|
142
|
-
data: string;
|
|
143
|
-
timestamp: number;
|
|
144
|
-
}
|
|
145
|
-
interface AutomationStreamEvent {
|
|
146
|
-
automation_id: string;
|
|
147
|
-
event_id?: string;
|
|
148
|
-
status?: string;
|
|
149
|
-
variant_id?: string;
|
|
150
|
-
output?: string;
|
|
151
|
-
action_result?: unknown;
|
|
152
|
-
error?: string;
|
|
153
|
-
}
|
|
154
|
-
interface BotStreamEvent {
|
|
155
|
-
bot_id: string;
|
|
156
|
-
type: "balance" | "trade" | "decision" | "log" | "error";
|
|
157
|
-
data: unknown;
|
|
158
|
-
timestamp: number;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
interface SdkSessionAttachment {
|
|
162
|
-
name: string;
|
|
163
|
-
size?: number;
|
|
164
|
-
}
|
|
165
|
-
interface SdkSessionSeed {
|
|
166
|
-
id: string;
|
|
167
|
-
role: SessionMessage["role"];
|
|
168
|
-
createdAt?: number | string | Date;
|
|
169
|
-
content?: string;
|
|
170
|
-
attachments?: SdkSessionAttachment[];
|
|
171
|
-
parts?: SessionPart[];
|
|
172
|
-
}
|
|
173
|
-
interface SdkSessionEvent {
|
|
174
|
-
type: string;
|
|
175
|
-
data?: Record<string, unknown>;
|
|
176
|
-
}
|
|
177
|
-
interface BeginAssistantMessageOptions {
|
|
178
|
-
id?: string;
|
|
179
|
-
role?: Extract<SessionMessage["role"], "assistant" | "system">;
|
|
180
|
-
createdAt?: number | string | Date;
|
|
181
|
-
}
|
|
182
|
-
interface AppendUserMessageOptions {
|
|
183
|
-
id?: string;
|
|
184
|
-
role?: Extract<SessionMessage["role"], "user" | "system">;
|
|
185
|
-
content: string;
|
|
186
|
-
createdAt?: number | string | Date;
|
|
187
|
-
attachments?: SdkSessionAttachment[];
|
|
188
|
-
}
|
|
189
|
-
interface CompleteAssistantMessageOptions {
|
|
190
|
-
messageId?: string;
|
|
191
|
-
finalText?: string;
|
|
192
|
-
}
|
|
193
|
-
interface ApplySdkEventOptions {
|
|
194
|
-
messageId?: string;
|
|
195
|
-
}
|
|
196
|
-
interface UseSdkSessionOptions {
|
|
197
|
-
initialMessages?: SdkSessionSeed[];
|
|
198
|
-
}
|
|
199
|
-
interface UseSdkSessionReturn {
|
|
200
|
-
messages: SessionMessage[];
|
|
201
|
-
partMap: Record<string, SessionPart[]>;
|
|
202
|
-
isStreaming: boolean;
|
|
203
|
-
activeAssistantMessageId: string | null;
|
|
204
|
-
replaceHistory: (messages: SdkSessionSeed[]) => void;
|
|
205
|
-
appendUserMessage: (message: AppendUserMessageOptions) => string;
|
|
206
|
-
beginAssistantMessage: (options?: BeginAssistantMessageOptions) => string;
|
|
207
|
-
applySdkEvent: (event: SdkSessionEvent, options?: ApplySdkEventOptions) => void;
|
|
208
|
-
completeAssistantMessage: (options?: CompleteAssistantMessageOptions) => void;
|
|
209
|
-
failAssistantMessage: (error: string, options?: {
|
|
210
|
-
messageId?: string;
|
|
211
|
-
}) => void;
|
|
212
|
-
setStreaming: (value: boolean) => void;
|
|
213
|
-
reset: () => void;
|
|
214
|
-
}
|
|
215
|
-
declare function useSdkSession({ initialMessages, }?: UseSdkSessionOptions): UseSdkSessionReturn;
|
|
216
|
-
|
|
217
|
-
interface RealtimeSessionOptions extends RegisterActiveSessionOptions {
|
|
218
|
-
connectUrl?: string | null;
|
|
219
|
-
enabled?: boolean;
|
|
220
|
-
foreground?: boolean;
|
|
221
|
-
keepRegistered?: boolean;
|
|
222
|
-
reconnect?: boolean;
|
|
223
|
-
reconnectIntervalMs?: number;
|
|
224
|
-
maxReconnectAttempts?: number;
|
|
225
|
-
transportMode?: ActiveSessionTransportMode;
|
|
226
|
-
onEvent?: (event: SdkSessionEvent) => void;
|
|
227
|
-
onOpen?: () => void;
|
|
228
|
-
onClose?: () => void;
|
|
229
|
-
onError?: (error: Error) => void;
|
|
230
|
-
}
|
|
231
|
-
interface RealtimeSessionState {
|
|
232
|
-
connectionState: ActiveSessionConnectionState;
|
|
233
|
-
lastError: string | null;
|
|
234
|
-
reconnectAttempts: number;
|
|
235
|
-
isConnected: boolean;
|
|
236
|
-
}
|
|
237
|
-
interface RealtimeSessionTarget extends RealtimeSessionOptions {
|
|
238
|
-
key?: string;
|
|
239
|
-
}
|
|
240
|
-
interface RealtimeSessionRegistryProps {
|
|
241
|
-
sessions: RealtimeSessionTarget[];
|
|
242
|
-
}
|
|
243
|
-
declare function useRealtimeSession({ sessionId, projectId, projectLabel, title, href, metadata, connectUrl, enabled, foreground, keepRegistered, reconnect, reconnectIntervalMs, maxReconnectAttempts, transportMode, onEvent, onOpen, onClose, onError, }: RealtimeSessionOptions): RealtimeSessionState;
|
|
244
|
-
declare function RealtimeSessionRegistry({ sessions }: RealtimeSessionRegistryProps): React.FunctionComponentElement<RealtimeSessionTarget>[];
|
|
245
|
-
|
|
246
|
-
interface UseRunGroupsOptions {
|
|
247
|
-
messages: SessionMessage[];
|
|
248
|
-
partMap: Record<string, SessionPart[]>;
|
|
249
|
-
isStreaming: boolean;
|
|
250
|
-
}
|
|
251
|
-
declare function useRunGroups({ messages, partMap, isStreaming, }: UseRunGroupsOptions): GroupedMessage[];
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Manages per-run collapse state with auto-collapse after run completion.
|
|
255
|
-
*
|
|
256
|
-
* - Runs stay expanded by default
|
|
257
|
-
* - Collapse is manual only
|
|
258
|
-
*/
|
|
259
|
-
declare function useRunCollapseState(runs: Run[]): {
|
|
260
|
-
isCollapsed: (runId: string) => boolean;
|
|
261
|
-
toggleCollapse: (runId: string) => void;
|
|
262
|
-
};
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Scroll-to-bottom behaviour: sticks to the bottom while streaming,
|
|
266
|
-
* pauses when user scrolls up, resumes when user scrolls back down.
|
|
267
|
-
*/
|
|
268
|
-
declare function useAutoScroll(containerRef: RefObject<HTMLElement | null>, deps?: unknown[]): {
|
|
269
|
-
isAtBottom: boolean;
|
|
270
|
-
scrollToBottom: () => void;
|
|
271
|
-
};
|
|
1
|
+
export { AgentStreamEvent, AppendUserMessageOptions, ApplySdkEventOptions, AutomationStreamEvent, BeginAssistantMessageOptions, BotStreamEvent, CompleteAssistantMessageOptions, ConnectionState, RealtimeSessionOptions, RealtimeSessionRegistry, RealtimeSessionRegistryProps, RealtimeSessionState, RealtimeSessionTarget, SSEEvent, SdkSessionAttachment, SdkSessionEvent, SdkSessionSeed, TaskStreamEvent, TerminalStreamEvent, UseRunGroupsOptions, UseSSEStreamOptions, UseSSEStreamResult, UseSdkSessionOptions, UseSdkSessionReturn, UseToolCallStreamReturn, useAutoScroll, useDropdownMenu, useRealtimeSession, useRunCollapseState, useRunGroups, useSSEStream, useSdkSession, useToolCallStream } from '@tangle-network/ui/sdk-hooks';
|
|
2
|
+
import { SessionMessage, SessionPart } from '@tangle-network/ui/types';
|
|
272
3
|
|
|
273
4
|
/** Minimal session info returned by the listing API. */
|
|
274
5
|
interface SessionInfo {
|
|
@@ -313,17 +44,6 @@ interface UseSessionStreamResult {
|
|
|
313
44
|
*/
|
|
314
45
|
declare function useSessionStream({ apiUrl, token, sessionId, enabled, }: UseSessionStreamOptions): UseSessionStreamResult;
|
|
315
46
|
|
|
316
|
-
interface UseDropdownMenuOptions {
|
|
317
|
-
closeOnEsc?: boolean;
|
|
318
|
-
}
|
|
319
|
-
declare function useDropdownMenu(options?: UseDropdownMenuOptions): {
|
|
320
|
-
open: boolean;
|
|
321
|
-
setOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
322
|
-
ref: React.RefObject<HTMLDivElement | null>;
|
|
323
|
-
toggle: () => void;
|
|
324
|
-
close: () => void;
|
|
325
|
-
};
|
|
326
|
-
|
|
327
47
|
interface UseSidecarAuthOptions {
|
|
328
48
|
/** Scoping key for token storage (e.g. botId, sandboxId). */
|
|
329
49
|
resourceId: string;
|
|
@@ -355,4 +75,4 @@ interface SidecarAuth {
|
|
|
355
75
|
*/
|
|
356
76
|
declare function useSidecarAuth({ resourceId, apiUrl, signMessage }: UseSidecarAuthOptions): SidecarAuth;
|
|
357
77
|
|
|
358
|
-
export { type
|
|
78
|
+
export { type SessionInfo, type SidecarAuth, type UseSessionStreamOptions, type UseSessionStreamResult, type UseSidecarAuthOptions, useSessionStream, useSidecarAuth };
|
package/dist/sdk-hooks.js
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useSessionStream,
|
|
3
|
+
useSidecarAuth
|
|
4
|
+
} from "./chunk-CMY7W45U.js";
|
|
5
|
+
|
|
6
|
+
// src/sdk-hooks.ts
|
|
1
7
|
import {
|
|
2
8
|
RealtimeSessionRegistry,
|
|
9
|
+
useAutoScroll,
|
|
3
10
|
useDropdownMenu,
|
|
4
11
|
useRealtimeSession,
|
|
12
|
+
useRunCollapseState,
|
|
13
|
+
useRunGroups,
|
|
5
14
|
useSSEStream,
|
|
6
15
|
useSdkSession,
|
|
7
|
-
useSessionStream,
|
|
8
|
-
useSidecarAuth,
|
|
9
16
|
useToolCallStream
|
|
10
|
-
} from "
|
|
11
|
-
import "./chunk-QID2OOMG.js";
|
|
12
|
-
import "./chunk-OEX7NZE3.js";
|
|
13
|
-
import {
|
|
14
|
-
useAutoScroll,
|
|
15
|
-
useRunCollapseState,
|
|
16
|
-
useRunGroups
|
|
17
|
-
} from "./chunk-54SQQMMM.js";
|
|
18
|
-
import "./chunk-MT5FJ3ZT.js";
|
|
19
|
-
import "./chunk-BX6AQMUS.js";
|
|
20
|
-
import "./chunk-T7HMZEVO.js";
|
|
21
|
-
import "./chunk-RQHJBTEU.js";
|
|
17
|
+
} from "@tangle-network/ui/sdk-hooks";
|
|
22
18
|
export {
|
|
23
19
|
RealtimeSessionRegistry,
|
|
24
20
|
useAutoScroll,
|
package/dist/stores.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
+
export { ActiveProjectActivity, ActiveSessionActivityOptions, ActiveSessionConnectionOptions, ActiveSessionConnectionState, ActiveSessionReconnectState, ActiveSessionRecord, ActiveSessionStatus, ActiveSessionTransportMode, ActiveSessionsState, RegisterActiveSessionOptions, SessionProjectKey, activeSessionsAtom, addMessage, addParts, bumpActiveSessionActivity, clearChat, getActiveSession, getAllActiveSessions, getAllProjectActivity, getSessionsByActivity, getSessionsForNavbar, getSessionsForProject, getTotalRunningSessionCount, hasBackgroundRunningSessions, isStreamingAtom, messagesAtom, partMapAtom, registerActiveSession, resetActiveSessions, setActiveSessionAttention, setActiveSessionConnection, setActiveSessionError, setActiveSessionRunning, setForegroundActiveSession, unregisterActiveSession, updateActiveSessionMeta, updatePart, useActiveSession, useActiveSessions, useActiveSessionsState, useHasBackgroundRunningSessions, useNavbarSessions, useProjectActivity, useProjectSessions, useSessionsByActivity, useTotalRunningSessions } from '@tangle-network/ui/stores';
|
|
1
2
|
import * as nanostores from 'nanostores';
|
|
2
|
-
export { A as ActiveProjectActivity, a as ActiveSessionActivityOptions, b as ActiveSessionConnectionOptions, c as ActiveSessionConnectionState, d as ActiveSessionReconnectState, e as ActiveSessionRecord, f as ActiveSessionStatus, g as ActiveSessionTransportMode, h as ActiveSessionsState, R as RegisterActiveSessionOptions, S as SessionProjectKey, i as activeSessionsAtom, j as bumpActiveSessionActivity, k as getActiveSession, l as getAllActiveSessions, m as getAllProjectActivity, n as getSessionsByActivity, o as getSessionsForNavbar, p as getSessionsForProject, q as getTotalRunningSessionCount, r as hasBackgroundRunningSessions, s as registerActiveSession, t as resetActiveSessions, u as setActiveSessionAttention, v as setActiveSessionConnection, w as setActiveSessionError, x as setActiveSessionRunning, y as setForegroundActiveSession, z as unregisterActiveSession, B as updateActiveSessionMeta, C as useActiveSession, D as useActiveSessions, E as useActiveSessionsState, F as useHasBackgroundRunningSessions, G as useNavbarSessions, H as useProjectActivity, I as useProjectSessions, J as useSessionsByActivity, K as useTotalRunningSessions } from './active-sessions-store-CeOmXgv5.js';
|
|
3
|
-
import { S as SessionMessage, a as SessionPart } from './parts-CyGkM6Fp.js';
|
|
4
3
|
|
|
5
4
|
interface ChatSession {
|
|
6
5
|
/** Sidecar HTTP base URL, e.g. "http://localhost:8080". */
|
|
@@ -15,15 +14,4 @@ declare const sessionAtom: nanostores.PreinitializedWritableAtom<ChatSession | n
|
|
|
15
14
|
declare function connectSession(session: ChatSession): void;
|
|
16
15
|
declare function disconnectSession(): void;
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
declare const messagesAtom: nanostores.PreinitializedWritableAtom<SessionMessage[]> & object;
|
|
20
|
-
/** Map of message ID → parts for that message. */
|
|
21
|
-
declare const partMapAtom: nanostores.PreinitializedMapStore<Record<string, SessionPart[]>> & object;
|
|
22
|
-
/** Whether the assistant is currently streaming a response. */
|
|
23
|
-
declare const isStreamingAtom: nanostores.PreinitializedWritableAtom<boolean> & object;
|
|
24
|
-
declare function addMessage(msg: SessionMessage): void;
|
|
25
|
-
declare function addParts(messageId: string, parts: SessionPart[]): void;
|
|
26
|
-
declare function updatePart(messageId: string, partIndex: number, part: SessionPart): void;
|
|
27
|
-
declare function clearChat(): void;
|
|
28
|
-
|
|
29
|
-
export { type ChatSession, addMessage, addParts, clearChat, connectSession, disconnectSession, isStreamingAtom, messagesAtom, partMapAtom, sessionAtom, updatePart };
|
|
17
|
+
export { type ChatSession, connectSession, disconnectSession, sessionAtom };
|
package/dist/stores.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
activeSessionsAtom,
|
|
3
|
+
addMessage,
|
|
4
|
+
addParts,
|
|
3
5
|
bumpActiveSessionActivity,
|
|
6
|
+
clearChat,
|
|
7
|
+
connectSession,
|
|
8
|
+
disconnectSession,
|
|
4
9
|
getActiveSession,
|
|
5
10
|
getAllActiveSessions,
|
|
6
11
|
getAllProjectActivity,
|
|
@@ -9,8 +14,12 @@ import {
|
|
|
9
14
|
getSessionsForProject,
|
|
10
15
|
getTotalRunningSessionCount,
|
|
11
16
|
hasBackgroundRunningSessions,
|
|
17
|
+
isStreamingAtom,
|
|
18
|
+
messagesAtom,
|
|
19
|
+
partMapAtom,
|
|
12
20
|
registerActiveSession,
|
|
13
21
|
resetActiveSessions,
|
|
22
|
+
sessionAtom,
|
|
14
23
|
setActiveSessionAttention,
|
|
15
24
|
setActiveSessionConnection,
|
|
16
25
|
setActiveSessionError,
|
|
@@ -18,6 +27,7 @@ import {
|
|
|
18
27
|
setForegroundActiveSession,
|
|
19
28
|
unregisterActiveSession,
|
|
20
29
|
updateActiveSessionMeta,
|
|
30
|
+
updatePart,
|
|
21
31
|
useActiveSession,
|
|
22
32
|
useActiveSessions,
|
|
23
33
|
useActiveSessionsState,
|
|
@@ -27,45 +37,7 @@ import {
|
|
|
27
37
|
useProjectSessions,
|
|
28
38
|
useSessionsByActivity,
|
|
29
39
|
useTotalRunningSessions
|
|
30
|
-
} from "./chunk-
|
|
31
|
-
|
|
32
|
-
// src/stores/session-store.ts
|
|
33
|
-
import { atom } from "nanostores";
|
|
34
|
-
var sessionAtom = atom(null);
|
|
35
|
-
function connectSession(session) {
|
|
36
|
-
sessionAtom.set(session);
|
|
37
|
-
}
|
|
38
|
-
function disconnectSession() {
|
|
39
|
-
sessionAtom.set(null);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// src/stores/chat-store.ts
|
|
43
|
-
import { atom as atom2, map } from "nanostores";
|
|
44
|
-
var messagesAtom = atom2([]);
|
|
45
|
-
var partMapAtom = map({});
|
|
46
|
-
var isStreamingAtom = atom2(false);
|
|
47
|
-
var insertionCounter = 0;
|
|
48
|
-
function addMessage(msg) {
|
|
49
|
-
const withIndex = { ...msg, _insertionIndex: insertionCounter++ };
|
|
50
|
-
messagesAtom.set([...messagesAtom.get(), withIndex]);
|
|
51
|
-
}
|
|
52
|
-
function addParts(messageId, parts) {
|
|
53
|
-
const current = partMapAtom.get();
|
|
54
|
-
const existing = current[messageId] ?? [];
|
|
55
|
-
partMapAtom.setKey(messageId, [...existing, ...parts]);
|
|
56
|
-
}
|
|
57
|
-
function updatePart(messageId, partIndex, part) {
|
|
58
|
-
const current = partMapAtom.get();
|
|
59
|
-
const existing = [...current[messageId] ?? []];
|
|
60
|
-
existing[partIndex] = part;
|
|
61
|
-
partMapAtom.setKey(messageId, existing);
|
|
62
|
-
}
|
|
63
|
-
function clearChat() {
|
|
64
|
-
messagesAtom.set([]);
|
|
65
|
-
partMapAtom.set({});
|
|
66
|
-
isStreamingAtom.set(false);
|
|
67
|
-
insertionCounter = 0;
|
|
68
|
-
}
|
|
40
|
+
} from "./chunk-WID73FPH.js";
|
|
69
41
|
export {
|
|
70
42
|
activeSessionsAtom,
|
|
71
43
|
addMessage,
|