@tangle-network/sandbox-ui 0.3.11 → 0.3.13
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/README.md +7 -1
- package/dist/auth.js +2 -3
- package/dist/{chunk-CREVWUCA.js → chunk-DJEZKF5A.js} +3 -2
- package/dist/chunk-DLCFZDGX.js +182 -0
- package/dist/{chunk-FOQTE67I.js → chunk-FJLS7PNT.js} +9 -4
- package/dist/chunk-HXEA7L2T.js +1401 -0
- package/dist/{chunk-6NYG2R7V.js → chunk-HYLTXGOI.js} +1 -1
- package/dist/{chunk-MCGKDCOR.js → chunk-IW2JZCOC.js} +55 -14
- package/dist/{chunk-PCTEG6HR.js → chunk-OHMO7NUX.js} +2 -4
- package/dist/{chunk-DMYYQXPN.js → chunk-SMBF6HB5.js} +646 -465
- package/dist/dashboard.d.ts +1 -1
- package/dist/dashboard.js +40 -6
- package/dist/{document-editor-pane-AFBP2KFT.js → document-editor-pane-5TN2VWGZ.js} +1 -1
- package/dist/{document-editor-pane-Xnl8SmA7.d.ts → document-editor-pane-A70-EhdQ.d.ts} +1 -1
- package/dist/editor.d.ts +2 -2
- package/dist/editor.js +1 -1
- package/dist/files.d.ts +1 -1
- package/dist/files.js +1 -1
- package/dist/hooks.d.ts +1 -1
- package/dist/hooks.js +2 -2
- package/dist/index-D7_ZDkwB.d.ts +375 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +74 -16
- package/dist/pages.d.ts +12 -2
- package/dist/pages.js +60 -5
- package/dist/primitives.js +4 -6
- package/dist/sdk-hooks.js +1 -1
- package/dist/terminal.d.ts +2 -2
- package/dist/terminal.js +9 -39
- package/dist/{use-pty-session-DeZSxOCN.d.ts → use-pty-session-COzVkhtc.d.ts} +1 -1
- package/dist/workspace.d.ts +3 -1
- package/dist/workspace.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-B26TQ7SA.js +0 -47
- package/dist/chunk-BOBXH6CH.js +0 -10981
- package/dist/chunk-GRYHFH5O.js +0 -110
- package/dist/index-BJIPTCKk.d.ts +0 -264
package/dist/chunk-GRYHFH5O.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
// src/hooks/use-pty-session.ts
|
|
2
|
-
import { useState, useEffect, useRef, useCallback } from "react";
|
|
3
|
-
function usePtySession({ apiUrl, token, onData }) {
|
|
4
|
-
const [isConnected, setIsConnected] = useState(false);
|
|
5
|
-
const [error, setError] = useState(null);
|
|
6
|
-
const sessionIdRef = useRef(null);
|
|
7
|
-
const eventSourceRef = useRef(null);
|
|
8
|
-
const retryTimerRef = useRef(void 0);
|
|
9
|
-
const mountedRef = useRef(true);
|
|
10
|
-
const onDataRef = useRef(onData);
|
|
11
|
-
onDataRef.current = onData;
|
|
12
|
-
const cleanup = useCallback(() => {
|
|
13
|
-
if (retryTimerRef.current) {
|
|
14
|
-
clearTimeout(retryTimerRef.current);
|
|
15
|
-
retryTimerRef.current = void 0;
|
|
16
|
-
}
|
|
17
|
-
if (eventSourceRef.current) {
|
|
18
|
-
eventSourceRef.current.close();
|
|
19
|
-
eventSourceRef.current = null;
|
|
20
|
-
}
|
|
21
|
-
if (sessionIdRef.current) {
|
|
22
|
-
const sid = sessionIdRef.current;
|
|
23
|
-
sessionIdRef.current = null;
|
|
24
|
-
fetch(`${apiUrl}/terminals/${sid}`, {
|
|
25
|
-
method: "DELETE",
|
|
26
|
-
headers: { Authorization: `Bearer ${token}` }
|
|
27
|
-
}).catch(() => {
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
setIsConnected(false);
|
|
31
|
-
}, [apiUrl, token]);
|
|
32
|
-
const connect = useCallback(async () => {
|
|
33
|
-
cleanup();
|
|
34
|
-
setError(null);
|
|
35
|
-
try {
|
|
36
|
-
const res = await fetch(`${apiUrl}/terminals`, {
|
|
37
|
-
method: "POST",
|
|
38
|
-
headers: {
|
|
39
|
-
Authorization: `Bearer ${token}`,
|
|
40
|
-
"Content-Type": "application/json"
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
if (!res.ok) {
|
|
44
|
-
throw new Error(`Failed to create terminal: ${res.status}`);
|
|
45
|
-
}
|
|
46
|
-
const body = await res.json();
|
|
47
|
-
const sessionId = body.data?.sessionId ?? body.sessionId;
|
|
48
|
-
if (!sessionId) throw new Error("No sessionId in response");
|
|
49
|
-
if (!mountedRef.current) return;
|
|
50
|
-
sessionIdRef.current = sessionId;
|
|
51
|
-
const streamUrl = `${apiUrl}/terminals/${sessionId}/stream?token=${encodeURIComponent(token)}`;
|
|
52
|
-
const es = new EventSource(streamUrl);
|
|
53
|
-
eventSourceRef.current = es;
|
|
54
|
-
es.onopen = () => {
|
|
55
|
-
if (mountedRef.current) {
|
|
56
|
-
setIsConnected(true);
|
|
57
|
-
setError(null);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
es.onmessage = (event) => {
|
|
61
|
-
if (mountedRef.current && event.data) {
|
|
62
|
-
onDataRef.current(event.data);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
es.onerror = () => {
|
|
66
|
-
if (!mountedRef.current) return;
|
|
67
|
-
es.close();
|
|
68
|
-
eventSourceRef.current = null;
|
|
69
|
-
setIsConnected(false);
|
|
70
|
-
retryTimerRef.current = setTimeout(() => {
|
|
71
|
-
if (mountedRef.current) connect();
|
|
72
|
-
}, 3e3);
|
|
73
|
-
};
|
|
74
|
-
} catch (err) {
|
|
75
|
-
if (mountedRef.current) {
|
|
76
|
-
setError(err instanceof Error ? err.message : "Terminal connection failed");
|
|
77
|
-
setIsConnected(false);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}, [apiUrl, token, cleanup]);
|
|
81
|
-
const sendCommand = useCallback(async (command) => {
|
|
82
|
-
const sid = sessionIdRef.current;
|
|
83
|
-
if (!sid) return;
|
|
84
|
-
const res = await fetch(`${apiUrl}/terminals/${sid}/execute`, {
|
|
85
|
-
method: "POST",
|
|
86
|
-
headers: {
|
|
87
|
-
Authorization: `Bearer ${token}`,
|
|
88
|
-
"Content-Type": "application/json"
|
|
89
|
-
},
|
|
90
|
-
body: JSON.stringify({ command })
|
|
91
|
-
});
|
|
92
|
-
if (!res.ok) {
|
|
93
|
-
const text = await res.text();
|
|
94
|
-
throw new Error(text || `Execute failed: ${res.status}`);
|
|
95
|
-
}
|
|
96
|
-
}, [apiUrl, token]);
|
|
97
|
-
useEffect(() => {
|
|
98
|
-
mountedRef.current = true;
|
|
99
|
-
connect();
|
|
100
|
-
return () => {
|
|
101
|
-
mountedRef.current = false;
|
|
102
|
-
cleanup();
|
|
103
|
-
};
|
|
104
|
-
}, [connect, cleanup]);
|
|
105
|
-
return { isConnected, error, sendCommand, reconnect: connect };
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export {
|
|
109
|
-
usePtySession
|
|
110
|
-
};
|
package/dist/index-BJIPTCKk.d.ts
DELETED
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import './usage-chart-CY9xo3KX.js';
|
|
4
|
-
|
|
5
|
-
interface SidebarNavItem {
|
|
6
|
-
id: string;
|
|
7
|
-
label: string;
|
|
8
|
-
href: string;
|
|
9
|
-
icon: string;
|
|
10
|
-
badge?: string;
|
|
11
|
-
}
|
|
12
|
-
interface SidebarSandbox {
|
|
13
|
-
id: string;
|
|
14
|
-
name: string;
|
|
15
|
-
label?: string;
|
|
16
|
-
}
|
|
17
|
-
interface AppSidebarProps {
|
|
18
|
-
navItems: SidebarNavItem[];
|
|
19
|
-
activeNavId?: string;
|
|
20
|
-
sandboxes?: SidebarSandbox[];
|
|
21
|
-
activeSandboxId?: string;
|
|
22
|
-
onSandboxChange?: (id: string) => void;
|
|
23
|
-
onNewAgent?: () => void;
|
|
24
|
-
className?: string;
|
|
25
|
-
LinkComponent?: React.ComponentType<any>;
|
|
26
|
-
}
|
|
27
|
-
declare function AppSidebar({ navItems, activeNavId, sandboxes, activeSandboxId, onSandboxChange, onNewAgent, className, LinkComponent, }: AppSidebarProps): react_jsx_runtime.JSX.Element;
|
|
28
|
-
|
|
29
|
-
interface ClusterStatusItem {
|
|
30
|
-
icon: string;
|
|
31
|
-
label: string;
|
|
32
|
-
value: string;
|
|
33
|
-
valueClass?: string;
|
|
34
|
-
}
|
|
35
|
-
interface ClusterStatusBarProps {
|
|
36
|
-
items: ClusterStatusItem[];
|
|
37
|
-
latency?: string;
|
|
38
|
-
className?: string;
|
|
39
|
-
}
|
|
40
|
-
declare function ClusterStatusBar({ items, latency, className }: ClusterStatusBarProps): react_jsx_runtime.JSX.Element;
|
|
41
|
-
|
|
42
|
-
interface CreditBalanceProps {
|
|
43
|
-
amount: number;
|
|
44
|
-
description?: string;
|
|
45
|
-
onTopUp?: (amount: number) => void;
|
|
46
|
-
quickAmounts?: number[];
|
|
47
|
-
className?: string;
|
|
48
|
-
}
|
|
49
|
-
declare function CreditBalance({ amount, description, onTopUp, quickAmounts, className, }: CreditBalanceProps): react_jsx_runtime.JSX.Element;
|
|
50
|
-
|
|
51
|
-
interface Invoice {
|
|
52
|
-
id: string;
|
|
53
|
-
date: string;
|
|
54
|
-
amount: number;
|
|
55
|
-
status: "paid" | "pending" | "failed";
|
|
56
|
-
}
|
|
57
|
-
interface InvoiceTableProps {
|
|
58
|
-
invoices: Invoice[];
|
|
59
|
-
onExportAll?: () => void;
|
|
60
|
-
onLoadMore?: () => void;
|
|
61
|
-
onViewInvoice?: (id: string) => void;
|
|
62
|
-
hasMore?: boolean;
|
|
63
|
-
className?: string;
|
|
64
|
-
}
|
|
65
|
-
declare function InvoiceTable({ invoices, onExportAll, onLoadMore, onViewInvoice, hasMore, className }: InvoiceTableProps): react_jsx_runtime.JSX.Element;
|
|
66
|
-
|
|
67
|
-
interface PlanFeature {
|
|
68
|
-
text: string;
|
|
69
|
-
}
|
|
70
|
-
interface PlanCardData {
|
|
71
|
-
id: string;
|
|
72
|
-
name: string;
|
|
73
|
-
price: number;
|
|
74
|
-
period?: string;
|
|
75
|
-
features: PlanFeature[];
|
|
76
|
-
popular?: boolean;
|
|
77
|
-
current?: boolean;
|
|
78
|
-
ctaLabel?: string;
|
|
79
|
-
onSelect?: (id: string) => void;
|
|
80
|
-
}
|
|
81
|
-
interface PlanCardsProps {
|
|
82
|
-
plans: PlanCardData[];
|
|
83
|
-
className?: string;
|
|
84
|
-
}
|
|
85
|
-
declare function PlanCards({ plans, className }: PlanCardsProps): react_jsx_runtime.JSX.Element;
|
|
86
|
-
|
|
87
|
-
type ProductVariant = "sandbox";
|
|
88
|
-
interface NavItem {
|
|
89
|
-
id: string;
|
|
90
|
-
label: string;
|
|
91
|
-
href: string;
|
|
92
|
-
icon: React.ComponentType<{
|
|
93
|
-
className?: string;
|
|
94
|
-
}>;
|
|
95
|
-
/** Material icon name for Stitch sidebar (optional, falls back to icon component) */
|
|
96
|
-
materialIcon?: string;
|
|
97
|
-
}
|
|
98
|
-
interface DashboardUser {
|
|
99
|
-
email: string;
|
|
100
|
-
name?: string;
|
|
101
|
-
tier?: string;
|
|
102
|
-
avatarUrl?: string;
|
|
103
|
-
}
|
|
104
|
-
interface TopNavLink {
|
|
105
|
-
label: string;
|
|
106
|
-
href: string;
|
|
107
|
-
}
|
|
108
|
-
interface DashboardLayoutProps {
|
|
109
|
-
children: React.ReactNode;
|
|
110
|
-
variant?: ProductVariant;
|
|
111
|
-
navItems: NavItem[];
|
|
112
|
-
activeNavId?: string;
|
|
113
|
-
user?: DashboardUser | null;
|
|
114
|
-
isLoading?: boolean;
|
|
115
|
-
onLogout?: () => void;
|
|
116
|
-
onSettingsClick?: () => void;
|
|
117
|
-
settingsHref?: string;
|
|
118
|
-
onNewSandbox?: () => void;
|
|
119
|
-
className?: string;
|
|
120
|
-
sidebarClassName?: string;
|
|
121
|
-
contentClassName?: string;
|
|
122
|
-
topNavLinks?: TopNavLink[];
|
|
123
|
-
activeTopNavHref?: string;
|
|
124
|
-
sandboxName?: string;
|
|
125
|
-
sandboxLabel?: string;
|
|
126
|
-
/** Custom link component (e.g., Next.js Link). Use any type to support various router implementations. */
|
|
127
|
-
LinkComponent?: React.ComponentType<any>;
|
|
128
|
-
/** Footer content rendered at bottom of viewport */
|
|
129
|
-
footer?: React.ReactNode;
|
|
130
|
-
}
|
|
131
|
-
declare function DashboardLayout({ children, variant, navItems, activeNavId, user, isLoading, onLogout, onSettingsClick, settingsHref, onNewSandbox, className, sidebarClassName, contentClassName, topNavLinks, activeTopNavHref, sandboxName, sandboxLabel, LinkComponent, footer, }: DashboardLayoutProps): react_jsx_runtime.JSX.Element;
|
|
132
|
-
|
|
133
|
-
interface ResourceMeterProps {
|
|
134
|
-
label: string;
|
|
135
|
-
value: number;
|
|
136
|
-
max?: number;
|
|
137
|
-
unit?: string;
|
|
138
|
-
icon?: string;
|
|
139
|
-
className?: string;
|
|
140
|
-
}
|
|
141
|
-
declare function ResourceMeter({ label, value, max, unit, icon, className }: ResourceMeterProps): react_jsx_runtime.JSX.Element;
|
|
142
|
-
|
|
143
|
-
type SandboxStatus = "running" | "hibernating" | "provisioning" | "stopped" | "failed" | "archived";
|
|
144
|
-
interface SandboxCardData {
|
|
145
|
-
id: string;
|
|
146
|
-
name: string;
|
|
147
|
-
nodeId?: string;
|
|
148
|
-
status: SandboxStatus;
|
|
149
|
-
image?: string;
|
|
150
|
-
imageIcon?: React.ReactNode;
|
|
151
|
-
cpuPercent?: number;
|
|
152
|
-
ramUsed?: number;
|
|
153
|
-
ramTotal?: number;
|
|
154
|
-
provisioningMessage?: string;
|
|
155
|
-
provisioningPercent?: number;
|
|
156
|
-
archivedAt?: string;
|
|
157
|
-
}
|
|
158
|
-
interface SandboxCardProps {
|
|
159
|
-
sandbox: SandboxCardData;
|
|
160
|
-
onOpenIDE?: (id: string) => void;
|
|
161
|
-
onOpenTerminal?: (id: string) => void;
|
|
162
|
-
onWake?: (id: string) => void;
|
|
163
|
-
onRestore?: (id: string) => void;
|
|
164
|
-
className?: string;
|
|
165
|
-
}
|
|
166
|
-
declare function SandboxCard({ sandbox, onOpenIDE, onOpenTerminal, onWake, onRestore, className }: SandboxCardProps): react_jsx_runtime.JSX.Element;
|
|
167
|
-
interface NewSandboxCardProps {
|
|
168
|
-
onClick?: () => void;
|
|
169
|
-
className?: string;
|
|
170
|
-
}
|
|
171
|
-
declare function NewSandboxCard({ onClick, className }: NewSandboxCardProps): react_jsx_runtime.JSX.Element;
|
|
172
|
-
|
|
173
|
-
interface SandboxTableProps {
|
|
174
|
-
sandboxes: SandboxCardData[];
|
|
175
|
-
page?: number;
|
|
176
|
-
pageSize?: number;
|
|
177
|
-
total?: number;
|
|
178
|
-
onPageChange?: (page: number) => void;
|
|
179
|
-
onOpenIDE?: (id: string) => void;
|
|
180
|
-
onOpenTerminal?: (id: string) => void;
|
|
181
|
-
onSSH?: (id: string) => void;
|
|
182
|
-
onWake?: (id: string) => void;
|
|
183
|
-
onMore?: (id: string) => void;
|
|
184
|
-
className?: string;
|
|
185
|
-
}
|
|
186
|
-
declare function SandboxTable({ sandboxes, page, pageSize, total, onPageChange, onOpenIDE, onOpenTerminal, onSSH, onWake, onMore, className, }: SandboxTableProps): react_jsx_runtime.JSX.Element;
|
|
187
|
-
|
|
188
|
-
interface Backend {
|
|
189
|
-
type: string;
|
|
190
|
-
label: string;
|
|
191
|
-
description?: string;
|
|
192
|
-
}
|
|
193
|
-
interface BackendSelectorProps {
|
|
194
|
-
backends: Backend[];
|
|
195
|
-
selected: string[];
|
|
196
|
-
onChange: (selected: string[]) => void;
|
|
197
|
-
label?: string;
|
|
198
|
-
hint?: string;
|
|
199
|
-
multiSelect?: boolean;
|
|
200
|
-
className?: string;
|
|
201
|
-
}
|
|
202
|
-
declare function BackendSelector({ backends, selected, onChange, label, hint, multiSelect, className, }: BackendSelectorProps): react_jsx_runtime.JSX.Element;
|
|
203
|
-
|
|
204
|
-
interface Profile {
|
|
205
|
-
id: string;
|
|
206
|
-
name: string;
|
|
207
|
-
description?: string;
|
|
208
|
-
is_builtin?: boolean;
|
|
209
|
-
extends?: string;
|
|
210
|
-
model?: string;
|
|
211
|
-
metrics?: {
|
|
212
|
-
total_runs: number;
|
|
213
|
-
success_rate: number;
|
|
214
|
-
avg_duration_ms: number;
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
interface ProfileSelectorProps {
|
|
218
|
-
profiles: Profile[];
|
|
219
|
-
selectedId?: string | null;
|
|
220
|
-
onSelect: (profile: Profile | null) => void;
|
|
221
|
-
onCreateClick?: () => void;
|
|
222
|
-
onManageClick?: () => void;
|
|
223
|
-
label?: string;
|
|
224
|
-
placeholder?: string;
|
|
225
|
-
showMetrics?: boolean;
|
|
226
|
-
className?: string;
|
|
227
|
-
}
|
|
228
|
-
declare function ProfileSelector({ profiles, selectedId, onSelect, onCreateClick, onManageClick, label, placeholder, showMetrics, className, }: ProfileSelectorProps): react_jsx_runtime.JSX.Element;
|
|
229
|
-
/**
|
|
230
|
-
* Profile performance comparison card.
|
|
231
|
-
* Shows metrics from multiple profiles side by side.
|
|
232
|
-
*/
|
|
233
|
-
interface ProfileComparisonProps {
|
|
234
|
-
profiles: Profile[];
|
|
235
|
-
className?: string;
|
|
236
|
-
}
|
|
237
|
-
declare function ProfileComparison({ profiles, className, }: ProfileComparisonProps): react_jsx_runtime.JSX.Element | null;
|
|
238
|
-
|
|
239
|
-
type VariantStatus = "pending" | "running" | "completed" | "failed" | "cancelled";
|
|
240
|
-
type VariantOutcome = "pending_review" | "accepted" | "rejected" | "merged_with_conflicts" | "expired";
|
|
241
|
-
interface Variant {
|
|
242
|
-
id: string;
|
|
243
|
-
label: string;
|
|
244
|
-
sublabel?: string;
|
|
245
|
-
status: VariantStatus;
|
|
246
|
-
outcome?: VariantOutcome;
|
|
247
|
-
durationMs?: number;
|
|
248
|
-
error?: string;
|
|
249
|
-
summary?: string;
|
|
250
|
-
/** Link to view variant details (e.g., chat UI) */
|
|
251
|
-
detailsUrl?: string;
|
|
252
|
-
}
|
|
253
|
-
interface VariantListProps {
|
|
254
|
-
variants: Variant[];
|
|
255
|
-
selectedId?: string | null;
|
|
256
|
-
onSelect?: (id: string) => void;
|
|
257
|
-
onAccept?: (id: string) => void;
|
|
258
|
-
onReject?: (id: string) => void;
|
|
259
|
-
isActioning?: string | null;
|
|
260
|
-
className?: string;
|
|
261
|
-
}
|
|
262
|
-
declare function VariantList({ variants, selectedId, onSelect, onAccept, onReject, isActioning, className, }: VariantListProps): react_jsx_runtime.JSX.Element;
|
|
263
|
-
|
|
264
|
-
export { AppSidebar as A, type Backend as B, ClusterStatusBar as C, DashboardLayout as D, type SidebarSandbox as E, type VariantListProps as F, type Profile as G, type PlanFeature as H, type Invoice as I, type ProductVariant as J, type Variant as K, type VariantOutcome as L, type VariantStatus as M, type NavItem as N, type PlanCardData as P, ResourceMeter as R, SandboxCard as S, type TopNavLink as T, VariantList as V, type AppSidebarProps as a, BackendSelector as b, type BackendSelectorProps as c, type ClusterStatusBarProps as d, type ClusterStatusItem as e, CreditBalance as f, type CreditBalanceProps as g, type DashboardLayoutProps as h, type DashboardUser as i, InvoiceTable as j, type InvoiceTableProps as k, NewSandboxCard as l, type NewSandboxCardProps as m, PlanCards as n, type PlanCardsProps as o, ProfileComparison as p, type ProfileComparisonProps as q, ProfileSelector as r, type ProfileSelectorProps as s, type ResourceMeterProps as t, type SandboxCardData as u, type SandboxCardProps as v, type SandboxStatus as w, SandboxTable as x, type SandboxTableProps as y, type SidebarNavItem as z };
|