@tangle-network/sandbox-ui 0.6.1 → 0.8.4
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 +10 -6
- package/dist/auth.js +3 -3
- package/dist/{chat-container-Cg-GwyiK.d.ts → chat-container-f4yEs6KN.d.ts} +9 -1
- package/dist/chat.d.ts +12 -2
- package/dist/chat.js +10 -10
- package/dist/{chunk-TSE423UF.js → chunk-2QZ6G7NM.js} +6 -6
- package/dist/{chunk-WBQ7VULC.js → chunk-34A66VBG.js} +7 -7
- package/dist/{chunk-JP725R4W.js → chunk-34I7UFSX.js} +2 -2
- package/dist/{chunk-YS66Q3RC.js → chunk-3CJ2SOEI.js} +2 -2
- package/dist/{chunk-CNWVHQFY.js → chunk-54SQQMMM.js} +6 -24
- package/dist/{chunk-DLCFZDGX.js → chunk-5UM2XMEJ.js} +39 -14
- package/dist/{chunk-YYGECNZZ.js → chunk-66EZOYZR.js} +3 -3
- package/dist/chunk-7U2Z23NE.js +49 -0
- package/dist/{chunk-RKXIRRKQ.js → chunk-BUOQTBTO.js} +70 -66
- package/dist/{chunk-DCPYTL4W.js → chunk-D4CZWJCD.js} +72 -148
- package/dist/{chunk-MXRQ4MJE.js → chunk-DXMIEK4K.js} +34 -23
- package/dist/{chunk-ZMWWE5RF.js → chunk-EXSOPXIY.js} +141 -123
- package/dist/{chunk-GW4GRAWJ.js → chunk-GSZA3TSY.js} +18 -12
- package/dist/{chunk-W4LM3QYZ.js → chunk-HB5Y37YU.js} +8 -8
- package/dist/{chunk-E2XT3G52.js → chunk-HFMAXUHV.js} +136 -137
- package/dist/{chunk-BRBTD7RH.js → chunk-MA7YKRUP.js} +28 -18
- package/dist/{chunk-MJUDMVRU.js → chunk-MT5FJ3ZT.js} +17 -17
- package/dist/chunk-OKLQVY3Y.js +139 -0
- package/dist/{chunk-KH5UDAJ2.js → chunk-QDH5GEGY.js} +58 -54
- package/dist/{chunk-33W2TLUL.js → chunk-QID2OOMG.js} +12 -3
- package/dist/{chunk-FJSVPBKY.js → chunk-S7OXQTST.js} +17 -3
- package/dist/chunk-T7HMZEVO.js +216 -0
- package/dist/{chunk-FNYJFCGU.js → chunk-U6QTHMY6.js} +145 -256
- package/dist/{chunk-565V6JTN.js → chunk-UXQMIR3D.js} +60 -99
- package/dist/{chunk-XTPAWK7L.js → chunk-VOUV7GGB.js} +25 -47
- package/dist/{chunk-OVNLOE3Y.js → chunk-WXK43R62.js} +41 -41
- package/dist/{chunk-6V4XVKFY.js → chunk-XXDFEF72.js} +340 -335
- package/dist/{chunk-TDYQBLL5.js → chunk-ZMNSRDMH.js} +6 -6
- package/dist/dashboard.d.ts +135 -3
- package/dist/dashboard.js +848 -8
- package/dist/{document-editor-pane-DWWUTTTZ.js → document-editor-pane-TLPVRBBU.js} +3 -3
- package/dist/editor.d.ts +9 -8
- package/dist/editor.js +3 -3
- package/dist/files.js +3 -3
- package/dist/globals.css +5304 -68
- package/dist/hooks.d.ts +1 -1
- package/dist/hooks.js +7 -7
- package/dist/index.d.ts +4 -4
- package/dist/index.js +28 -28
- package/dist/markdown.js +1 -1
- package/dist/openui.js +5 -5
- package/dist/pages.d.ts +47 -3
- package/dist/pages.js +911 -357
- package/dist/primitives.d.ts +5 -2
- package/dist/primitives.js +10 -10
- package/dist/run.js +4 -4
- package/dist/sdk-hooks.d.ts +2 -3
- package/dist/sdk-hooks.js +5 -5
- package/dist/styles.css +5304 -68
- package/dist/template-card-BAtvcAkU.d.ts +18 -0
- package/dist/terminal.d.ts +3 -1
- package/dist/terminal.js +66 -32
- package/dist/tokens.css +701 -40
- package/dist/{usage-chart-XCoB_7Xu.d.ts → usage-chart-SSiOgeQI.d.ts} +3 -1
- package/dist/{use-pty-session-COzVkhtc.d.ts → use-pty-session-0AOuwXgq.d.ts} +2 -0
- package/dist/{index-BT_-ecpc.d.ts → variant-list-C8wx2TqF.d.ts} +17 -8
- package/dist/workspace.d.ts +1 -1
- package/dist/workspace.js +13 -13
- package/package.json +3 -1
- package/tailwind.config.cjs +3 -2
- package/dist/chunk-3HW53XTH.js +0 -228
- package/dist/chunk-OKCIKTXQ.js +0 -63
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Card
|
|
3
|
-
} from "./chunk-TDYQBLL5.js";
|
|
4
1
|
import {
|
|
5
2
|
cn
|
|
6
3
|
} from "./chunk-RQHJBTEU.js";
|
|
@@ -18,7 +15,7 @@ var SelectTrigger = React.forwardRef(({ className, children, ...props }, ref) =>
|
|
|
18
15
|
{
|
|
19
16
|
ref,
|
|
20
17
|
className: cn(
|
|
21
|
-
"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-
|
|
18
|
+
"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-border bg-card px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
|
22
19
|
className
|
|
23
20
|
),
|
|
24
21
|
...props,
|
|
@@ -60,7 +57,7 @@ var SelectContent = React.forwardRef(({ className, children, position = "popper"
|
|
|
60
57
|
{
|
|
61
58
|
ref,
|
|
62
59
|
className: cn(
|
|
63
|
-
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border border-
|
|
60
|
+
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border border-border bg-card text-foreground shadow-[var(--shadow-card)] data-[state=closed]:animate-out data-[state=open]:animate-in",
|
|
64
61
|
position === "popper" && "data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",
|
|
65
62
|
className
|
|
66
63
|
),
|
|
@@ -97,7 +94,7 @@ var SelectItem = React.forwardRef(({ className, children, ...props }, ref) => /*
|
|
|
97
94
|
{
|
|
98
95
|
ref,
|
|
99
96
|
className: cn(
|
|
100
|
-
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pr-8 pl-2 text-sm outline-none focus:bg-
|
|
97
|
+
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pr-8 pl-2 text-sm outline-none focus:bg-muted/50 focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
101
98
|
className
|
|
102
99
|
),
|
|
103
100
|
...props,
|
|
@@ -112,7 +109,7 @@ var SelectSeparator = React.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
112
109
|
SelectPrimitive.Separator,
|
|
113
110
|
{
|
|
114
111
|
ref,
|
|
115
|
-
className: cn("-mx-1 my-1 h-px bg-
|
|
112
|
+
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
116
113
|
...props
|
|
117
114
|
}
|
|
118
115
|
));
|
|
@@ -301,83 +298,11 @@ var Label2 = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
301
298
|
));
|
|
302
299
|
Label2.displayName = LabelPrimitive.Root.displayName;
|
|
303
300
|
|
|
304
|
-
// src/primitives/stat-card.tsx
|
|
305
|
-
import * as React5 from "react";
|
|
306
|
-
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
307
|
-
var StatCard = React5.forwardRef(
|
|
308
|
-
({
|
|
309
|
-
className,
|
|
310
|
-
variant = "default",
|
|
311
|
-
title,
|
|
312
|
-
value,
|
|
313
|
-
subtitle,
|
|
314
|
-
icon,
|
|
315
|
-
trend,
|
|
316
|
-
...props
|
|
317
|
-
}, ref) => {
|
|
318
|
-
const iconColors = {
|
|
319
|
-
default: "text-[var(--text-muted)]",
|
|
320
|
-
sandbox: "text-[var(--accent-text)]"
|
|
321
|
-
};
|
|
322
|
-
const trendColors = {
|
|
323
|
-
positive: "text-[var(--surface-success-text)]",
|
|
324
|
-
negative: "text-[var(--surface-danger-text)]",
|
|
325
|
-
neutral: "text-[var(--text-muted)]"
|
|
326
|
-
};
|
|
327
|
-
const trendStatus = trend ? trend.value > 0 ? "positive" : trend.value < 0 ? "negative" : "neutral" : null;
|
|
328
|
-
return /* @__PURE__ */ jsx5(
|
|
329
|
-
Card,
|
|
330
|
-
{
|
|
331
|
-
ref,
|
|
332
|
-
variant,
|
|
333
|
-
className: cn("p-6", className),
|
|
334
|
-
...props,
|
|
335
|
-
children: /* @__PURE__ */ jsxs3("div", { className: "flex items-start justify-between", children: [
|
|
336
|
-
/* @__PURE__ */ jsxs3("div", { className: "space-y-1", children: [
|
|
337
|
-
/* @__PURE__ */ jsx5("p", { className: "text-[var(--text-muted)] text-sm", children: title }),
|
|
338
|
-
/* @__PURE__ */ jsx5("p", { className: "font-bold text-3xl tracking-tight", children: value }),
|
|
339
|
-
subtitle && /* @__PURE__ */ jsx5("p", { className: "text-[var(--text-muted)] opacity-70 text-xs", children: subtitle }),
|
|
340
|
-
trend && trendStatus && /* @__PURE__ */ jsxs3(
|
|
341
|
-
"div",
|
|
342
|
-
{
|
|
343
|
-
className: cn(
|
|
344
|
-
"flex items-center gap-1 text-sm",
|
|
345
|
-
trendColors[trendStatus]
|
|
346
|
-
),
|
|
347
|
-
children: [
|
|
348
|
-
trend.value > 0 ? "\u2191" : trend.value < 0 ? "\u2193" : "\u2192",
|
|
349
|
-
/* @__PURE__ */ jsxs3("span", { children: [
|
|
350
|
-
Math.abs(trend.value),
|
|
351
|
-
"%"
|
|
352
|
-
] }),
|
|
353
|
-
trend.label && /* @__PURE__ */ jsx5("span", { className: "text-[var(--text-muted)]", children: trend.label })
|
|
354
|
-
]
|
|
355
|
-
}
|
|
356
|
-
)
|
|
357
|
-
] }),
|
|
358
|
-
icon && /* @__PURE__ */ jsx5(
|
|
359
|
-
"div",
|
|
360
|
-
{
|
|
361
|
-
className: cn(
|
|
362
|
-
"rounded-lg bg-[var(--depth-3)] p-2",
|
|
363
|
-
variant === "sandbox" && "bg-[var(--accent-surface-soft)]",
|
|
364
|
-
iconColors[variant]
|
|
365
|
-
),
|
|
366
|
-
children: icon
|
|
367
|
-
}
|
|
368
|
-
)
|
|
369
|
-
] })
|
|
370
|
-
}
|
|
371
|
-
);
|
|
372
|
-
}
|
|
373
|
-
);
|
|
374
|
-
StatCard.displayName = "StatCard";
|
|
375
|
-
|
|
376
301
|
// src/primitives/terminal-display.tsx
|
|
377
|
-
import * as
|
|
302
|
+
import * as React5 from "react";
|
|
378
303
|
import { useEffect, useRef } from "react";
|
|
379
|
-
import { jsx as
|
|
380
|
-
var TerminalDisplay =
|
|
304
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
305
|
+
var TerminalDisplay = React5.forwardRef(
|
|
381
306
|
({
|
|
382
307
|
className,
|
|
383
308
|
variant = "default",
|
|
@@ -395,22 +320,22 @@ var TerminalDisplay = React6.forwardRef(
|
|
|
395
320
|
}
|
|
396
321
|
}, [autoScroll]);
|
|
397
322
|
const variants = {
|
|
398
|
-
default: "border-
|
|
399
|
-
sandbox: "border-
|
|
323
|
+
default: "border-border",
|
|
324
|
+
sandbox: "border-border shadow-[var(--shadow-accent)]"
|
|
400
325
|
};
|
|
401
|
-
return /* @__PURE__ */
|
|
326
|
+
return /* @__PURE__ */ jsxs3(
|
|
402
327
|
"div",
|
|
403
328
|
{
|
|
404
329
|
ref,
|
|
405
330
|
className: cn(
|
|
406
|
-
"overflow-hidden rounded-xl border bg-
|
|
331
|
+
"overflow-hidden rounded-xl border bg-background font-mono text-sm",
|
|
407
332
|
variants[variant],
|
|
408
333
|
className
|
|
409
334
|
),
|
|
410
335
|
...props,
|
|
411
336
|
children: [
|
|
412
|
-
showHeader && /* @__PURE__ */
|
|
413
|
-
/* @__PURE__ */
|
|
337
|
+
showHeader && /* @__PURE__ */ jsx5("div", { className: "flex items-center border-b border-border bg-card px-4 py-3", children: /* @__PURE__ */ jsx5("span", { className: "text-muted-foreground text-xs", children: title }) }),
|
|
338
|
+
/* @__PURE__ */ jsx5(
|
|
414
339
|
"div",
|
|
415
340
|
{
|
|
416
341
|
ref: containerRef,
|
|
@@ -425,19 +350,19 @@ var TerminalDisplay = React6.forwardRef(
|
|
|
425
350
|
}
|
|
426
351
|
);
|
|
427
352
|
TerminalDisplay.displayName = "TerminalDisplay";
|
|
428
|
-
var TerminalLine =
|
|
353
|
+
var TerminalLine = React5.forwardRef(
|
|
429
354
|
({ className, type = "output", prompt = "$", timestamp, children, ...props }, ref) => {
|
|
430
355
|
const typeStyles = {
|
|
431
|
-
input: "text-
|
|
432
|
-
output: "text-
|
|
356
|
+
input: "text-foreground",
|
|
357
|
+
output: "text-foreground",
|
|
433
358
|
error: "text-[var(--surface-danger-text)]",
|
|
434
359
|
success: "text-[var(--surface-success-text)]",
|
|
435
360
|
info: "text-[var(--surface-info-text)]",
|
|
436
361
|
thinking: "text-[var(--surface-warning-text)] animate-pulse",
|
|
437
|
-
command: "text-
|
|
362
|
+
command: "text-foreground",
|
|
438
363
|
warning: "text-[var(--surface-warning-text)]"
|
|
439
364
|
};
|
|
440
|
-
return /* @__PURE__ */
|
|
365
|
+
return /* @__PURE__ */ jsxs3(
|
|
441
366
|
"div",
|
|
442
367
|
{
|
|
443
368
|
ref,
|
|
@@ -448,35 +373,35 @@ var TerminalLine = React6.forwardRef(
|
|
|
448
373
|
),
|
|
449
374
|
...props,
|
|
450
375
|
children: [
|
|
451
|
-
(type === "input" || type === "command") && /* @__PURE__ */
|
|
452
|
-
type === "thinking" && /* @__PURE__ */
|
|
453
|
-
timestamp && /* @__PURE__ */
|
|
376
|
+
(type === "input" || type === "command") && /* @__PURE__ */ jsx5("span", { className: "shrink-0 select-none text-[var(--surface-success-text)]", children: prompt }),
|
|
377
|
+
type === "thinking" && /* @__PURE__ */ jsx5("span", { className: "shrink-0 select-none", children: "..." }),
|
|
378
|
+
timestamp && /* @__PURE__ */ jsxs3("span", { className: "shrink-0 select-none text-muted-foreground opacity-50", children: [
|
|
454
379
|
"[",
|
|
455
380
|
timestamp,
|
|
456
381
|
"]"
|
|
457
382
|
] }),
|
|
458
|
-
/* @__PURE__ */
|
|
383
|
+
/* @__PURE__ */ jsx5("span", { className: "whitespace-pre-wrap break-all", children })
|
|
459
384
|
]
|
|
460
385
|
}
|
|
461
386
|
);
|
|
462
387
|
}
|
|
463
388
|
);
|
|
464
389
|
TerminalLine.displayName = "TerminalLine";
|
|
465
|
-
var TerminalCursor =
|
|
390
|
+
var TerminalCursor = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx5(
|
|
466
391
|
"span",
|
|
467
392
|
{
|
|
468
393
|
ref,
|
|
469
394
|
className: cn(
|
|
470
|
-
"ml-0.5 inline-block h-4 w-2 animate-pulse bg-
|
|
395
|
+
"ml-0.5 inline-block h-4 w-2 animate-pulse bg-foreground",
|
|
471
396
|
className
|
|
472
397
|
),
|
|
473
398
|
...props
|
|
474
399
|
}
|
|
475
400
|
));
|
|
476
401
|
TerminalCursor.displayName = "TerminalCursor";
|
|
477
|
-
var TerminalInput =
|
|
402
|
+
var TerminalInput = React5.forwardRef(
|
|
478
403
|
({ className, onSubmit, variant = "default", ...props }, ref) => {
|
|
479
|
-
const [value, setValue] =
|
|
404
|
+
const [value, setValue] = React5.useState("");
|
|
480
405
|
const handleKeyDown = (e) => {
|
|
481
406
|
if (e.key === "Enter" && value.trim() && onSubmit) {
|
|
482
407
|
onSubmit(value.trim());
|
|
@@ -484,20 +409,20 @@ var TerminalInput = React6.forwardRef(
|
|
|
484
409
|
}
|
|
485
410
|
};
|
|
486
411
|
const variants = {
|
|
487
|
-
default: "border-
|
|
488
|
-
sandbox: "border-
|
|
412
|
+
default: "border-border focus-within:border-border",
|
|
413
|
+
sandbox: "border-border focus-within:border-[var(--border-accent-hover)]"
|
|
489
414
|
};
|
|
490
|
-
return /* @__PURE__ */
|
|
415
|
+
return /* @__PURE__ */ jsxs3(
|
|
491
416
|
"div",
|
|
492
417
|
{
|
|
493
418
|
className: cn(
|
|
494
|
-
"flex items-center rounded-lg border bg-
|
|
419
|
+
"flex items-center rounded-lg border bg-background px-4 py-2.5 font-mono text-sm transition-colors",
|
|
495
420
|
variants[variant],
|
|
496
421
|
className
|
|
497
422
|
),
|
|
498
423
|
children: [
|
|
499
|
-
/* @__PURE__ */
|
|
500
|
-
/* @__PURE__ */
|
|
424
|
+
/* @__PURE__ */ jsx5("span", { className: "mr-2 select-none text-[var(--surface-success-text)]", children: "$" }),
|
|
425
|
+
/* @__PURE__ */ jsx5(
|
|
501
426
|
"input",
|
|
502
427
|
{
|
|
503
428
|
ref,
|
|
@@ -505,11 +430,11 @@ var TerminalInput = React6.forwardRef(
|
|
|
505
430
|
value,
|
|
506
431
|
onChange: (e) => setValue(e.target.value),
|
|
507
432
|
onKeyDown: handleKeyDown,
|
|
508
|
-
className: "flex-1 bg-transparent text-
|
|
433
|
+
className: "flex-1 bg-transparent text-foreground outline-none placeholder:text-muted-foreground",
|
|
509
434
|
...props
|
|
510
435
|
}
|
|
511
436
|
),
|
|
512
|
-
/* @__PURE__ */
|
|
437
|
+
/* @__PURE__ */ jsx5(TerminalCursor, {})
|
|
513
438
|
]
|
|
514
439
|
}
|
|
515
440
|
);
|
|
@@ -519,7 +444,7 @@ TerminalInput.displayName = "TerminalInput";
|
|
|
519
444
|
|
|
520
445
|
// src/primitives/drop-zone.tsx
|
|
521
446
|
import { useCallback as useCallback2, useRef as useRef2, useState as useState3 } from "react";
|
|
522
|
-
import { jsx as
|
|
447
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
523
448
|
function DropZone({
|
|
524
449
|
onDrop,
|
|
525
450
|
accept,
|
|
@@ -575,7 +500,7 @@ function DropZone({
|
|
|
575
500
|
},
|
|
576
501
|
[disabled, accept, isAccepted, onDrop]
|
|
577
502
|
);
|
|
578
|
-
return /* @__PURE__ */
|
|
503
|
+
return /* @__PURE__ */ jsxs4(
|
|
579
504
|
"div",
|
|
580
505
|
{
|
|
581
506
|
onDragEnter: handleDragEnter,
|
|
@@ -584,15 +509,15 @@ function DropZone({
|
|
|
584
509
|
onDrop: handleDrop,
|
|
585
510
|
className: cn("relative", className),
|
|
586
511
|
children: [
|
|
587
|
-
dragOver && (overlay || /* @__PURE__ */
|
|
588
|
-
/* @__PURE__ */
|
|
589
|
-
/* @__PURE__ */
|
|
590
|
-
/* @__PURE__ */
|
|
591
|
-
/* @__PURE__ */
|
|
592
|
-
/* @__PURE__ */
|
|
512
|
+
dragOver && (overlay || /* @__PURE__ */ jsx6("div", { className: "fixed inset-0 z-[100] flex items-center justify-center pointer-events-none bg-background", children: /* @__PURE__ */ jsxs4("div", { className: "rounded-2xl border-2 border-dashed border-border bg-card p-16 text-center shadow-[var(--shadow-dropdown)] max-w-lg mx-auto", children: [
|
|
513
|
+
/* @__PURE__ */ jsx6("div", { className: "mx-auto mb-6 flex h-20 w-20 items-center justify-center rounded-2xl border border-border bg-[var(--accent-surface-soft)]", children: typeof icon === "string" ? /* @__PURE__ */ jsxs4("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", className: "h-10 w-10 text-[var(--accent-text)]", children: [
|
|
514
|
+
/* @__PURE__ */ jsx6("title", { children: "Upload" }),
|
|
515
|
+
/* @__PURE__ */ jsx6("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
516
|
+
/* @__PURE__ */ jsx6("polyline", { points: "17 8 12 3 7 8" }),
|
|
517
|
+
/* @__PURE__ */ jsx6("line", { x1: "12", x2: "12", y1: "3", y2: "15" })
|
|
593
518
|
] }) : icon }),
|
|
594
|
-
/* @__PURE__ */
|
|
595
|
-
/* @__PURE__ */
|
|
519
|
+
/* @__PURE__ */ jsx6("h2", { className: "text-2xl font-bold text-foreground", children: title }),
|
|
520
|
+
/* @__PURE__ */ jsx6("p", { className: "mt-2 text-sm text-muted-foreground", children: description })
|
|
596
521
|
] }) })),
|
|
597
522
|
children
|
|
598
523
|
]
|
|
@@ -602,7 +527,7 @@ function DropZone({
|
|
|
602
527
|
|
|
603
528
|
// src/primitives/upload-progress.tsx
|
|
604
529
|
import { AlertCircle as AlertCircle2, CheckCircle2 as CheckCircle22, FileText, Loader2, RefreshCw, X as X2 } from "lucide-react";
|
|
605
|
-
import { jsx as
|
|
530
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
606
531
|
function formatSize(bytes) {
|
|
607
532
|
if (bytes < 1024) return `${bytes}B`;
|
|
608
533
|
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(0)}KB`;
|
|
@@ -610,49 +535,49 @@ function formatSize(bytes) {
|
|
|
610
535
|
}
|
|
611
536
|
function UploadProgress({ files, onRemove, onRetry, className }) {
|
|
612
537
|
if (files.length === 0) return null;
|
|
613
|
-
return /* @__PURE__ */
|
|
538
|
+
return /* @__PURE__ */ jsx7("div", { className: cn("space-y-2", className), children: files.map((file) => /* @__PURE__ */ jsxs5(
|
|
614
539
|
"div",
|
|
615
540
|
{
|
|
616
541
|
className: cn(
|
|
617
542
|
"flex items-center gap-3 rounded-lg border px-3 py-2 text-sm",
|
|
618
|
-
file.status === "error" ? "border-[var(--surface-danger-border)] bg-[var(--surface-danger-bg)]" : file.status === "complete" ? "border-[var(--surface-success-border)] bg-[var(--surface-success-bg)]" : "border-
|
|
543
|
+
file.status === "error" ? "border-[var(--surface-danger-border)] bg-[var(--surface-danger-bg)]" : file.status === "complete" ? "border-[var(--surface-success-border)] bg-[var(--surface-success-bg)]" : "border-border bg-card"
|
|
619
544
|
),
|
|
620
545
|
children: [
|
|
621
|
-
file.status === "complete" && /* @__PURE__ */
|
|
622
|
-
file.status === "error" && /* @__PURE__ */
|
|
623
|
-
file.status === "uploading" && /* @__PURE__ */
|
|
624
|
-
file.status === "pending" && /* @__PURE__ */
|
|
625
|
-
/* @__PURE__ */
|
|
626
|
-
/* @__PURE__ */
|
|
627
|
-
/* @__PURE__ */
|
|
628
|
-
/* @__PURE__ */
|
|
546
|
+
file.status === "complete" && /* @__PURE__ */ jsx7(CheckCircle22, { className: "h-4 w-4 shrink-0 text-[var(--surface-success-text)]" }),
|
|
547
|
+
file.status === "error" && /* @__PURE__ */ jsx7(AlertCircle2, { className: "h-4 w-4 shrink-0 text-[var(--surface-danger-text)]" }),
|
|
548
|
+
file.status === "uploading" && /* @__PURE__ */ jsx7(Loader2, { className: "h-4 w-4 shrink-0 animate-spin text-primary" }),
|
|
549
|
+
file.status === "pending" && /* @__PURE__ */ jsx7(FileText, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
550
|
+
/* @__PURE__ */ jsxs5("div", { className: "min-w-0 flex-1", children: [
|
|
551
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2", children: [
|
|
552
|
+
/* @__PURE__ */ jsx7("span", { className: "truncate font-medium text-foreground", children: file.name }),
|
|
553
|
+
/* @__PURE__ */ jsx7("span", { className: "shrink-0 text-xs text-muted-foreground", children: formatSize(file.size) })
|
|
629
554
|
] }),
|
|
630
|
-
file.status === "uploading" && file.progress !== void 0 && /* @__PURE__ */
|
|
555
|
+
file.status === "uploading" && file.progress !== void 0 && /* @__PURE__ */ jsx7("div", { className: "mt-1 h-1 w-full overflow-hidden rounded-full bg-muted/50", children: /* @__PURE__ */ jsx7(
|
|
631
556
|
"div",
|
|
632
557
|
{
|
|
633
|
-
className: "h-full rounded-full bg-
|
|
558
|
+
className: "h-full rounded-full bg-primary transition-all",
|
|
634
559
|
style: { width: `${file.progress}%` }
|
|
635
560
|
}
|
|
636
561
|
) }),
|
|
637
|
-
file.status === "error" && file.error && /* @__PURE__ */
|
|
562
|
+
file.status === "error" && file.error && /* @__PURE__ */ jsx7("p", { className: "mt-0.5 text-xs text-[var(--surface-danger-text)]", children: file.error })
|
|
638
563
|
] }),
|
|
639
|
-
/* @__PURE__ */
|
|
640
|
-
file.status === "error" && onRetry && /* @__PURE__ */
|
|
564
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex shrink-0 items-center gap-1", children: [
|
|
565
|
+
file.status === "error" && onRetry && /* @__PURE__ */ jsx7(
|
|
641
566
|
"button",
|
|
642
567
|
{
|
|
643
568
|
type: "button",
|
|
644
569
|
onClick: () => onRetry(file.id),
|
|
645
|
-
className: "rounded p-1 text-
|
|
646
|
-
children: /* @__PURE__ */
|
|
570
|
+
className: "rounded p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
|
|
571
|
+
children: /* @__PURE__ */ jsx7(RefreshCw, { className: "h-3.5 w-3.5" })
|
|
647
572
|
}
|
|
648
573
|
),
|
|
649
|
-
onRemove && /* @__PURE__ */
|
|
574
|
+
onRemove && /* @__PURE__ */ jsx7(
|
|
650
575
|
"button",
|
|
651
576
|
{
|
|
652
577
|
type: "button",
|
|
653
578
|
onClick: () => onRemove(file.id),
|
|
654
|
-
className: "rounded p-1 text-
|
|
655
|
-
children: /* @__PURE__ */
|
|
579
|
+
className: "rounded p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
|
|
580
|
+
children: /* @__PURE__ */ jsx7(X2, { className: "h-3.5 w-3.5" })
|
|
656
581
|
}
|
|
657
582
|
)
|
|
658
583
|
] })
|
|
@@ -665,7 +590,7 @@ function UploadProgress({ files, onRemove, onRetry, className }) {
|
|
|
665
590
|
// src/primitives/sidebar-drop-zone.tsx
|
|
666
591
|
import { useCallback as useCallback3, useRef as useRef3, useState as useState4 } from "react";
|
|
667
592
|
import { Upload } from "lucide-react";
|
|
668
|
-
import { jsx as
|
|
593
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
669
594
|
function SidebarDropZone({
|
|
670
595
|
onDrop,
|
|
671
596
|
accept,
|
|
@@ -725,7 +650,7 @@ function SidebarDropZone({
|
|
|
725
650
|
[disabled, accept, isAccepted, onDrop]
|
|
726
651
|
);
|
|
727
652
|
const isVisible = persistent || dragOver;
|
|
728
|
-
return /* @__PURE__ */
|
|
653
|
+
return /* @__PURE__ */ jsx8(
|
|
729
654
|
"div",
|
|
730
655
|
{
|
|
731
656
|
onDragEnter: handleDragEnter,
|
|
@@ -739,16 +664,16 @@ function SidebarDropZone({
|
|
|
739
664
|
disabled && "opacity-50 pointer-events-none",
|
|
740
665
|
className
|
|
741
666
|
),
|
|
742
|
-
children: isVisible && /* @__PURE__ */
|
|
743
|
-
/* @__PURE__ */
|
|
667
|
+
children: isVisible && /* @__PURE__ */ jsxs6("div", { className: "flex flex-col items-center gap-2 text-center", children: [
|
|
668
|
+
/* @__PURE__ */ jsx8("div", { className: cn(
|
|
744
669
|
"flex h-8 w-8 items-center justify-center rounded-lg transition-colors",
|
|
745
670
|
dragOver ? "bg-[var(--brand-cool,hsl(var(--primary)))]/15 text-[var(--brand-cool,hsl(var(--primary)))]" : "text-[var(--text-muted,hsl(var(--muted-foreground)))]"
|
|
746
|
-
), children: icon ?? /* @__PURE__ */
|
|
747
|
-
/* @__PURE__ */
|
|
671
|
+
), children: icon ?? /* @__PURE__ */ jsx8(Upload, { className: "h-4 w-4" }) }),
|
|
672
|
+
/* @__PURE__ */ jsx8("p", { className: cn(
|
|
748
673
|
"text-xs font-medium",
|
|
749
674
|
dragOver ? "text-[var(--text-primary,hsl(var(--foreground)))]" : "text-[var(--text-muted,hsl(var(--muted-foreground)))]"
|
|
750
675
|
), children: title }),
|
|
751
|
-
description && /* @__PURE__ */
|
|
676
|
+
description && /* @__PURE__ */ jsx8("p", { className: "text-[10px] text-[var(--text-muted,hsl(var(--muted-foreground)))]", children: description })
|
|
752
677
|
] })
|
|
753
678
|
}
|
|
754
679
|
);
|
|
@@ -770,7 +695,6 @@ export {
|
|
|
770
695
|
ToastProvider,
|
|
771
696
|
useToast,
|
|
772
697
|
Label2 as Label,
|
|
773
|
-
StatCard,
|
|
774
698
|
TerminalDisplay,
|
|
775
699
|
TerminalLine,
|
|
776
700
|
TerminalCursor,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseToolEvent
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QID2OOMG.js";
|
|
4
4
|
import {
|
|
5
5
|
bumpActiveSessionActivity,
|
|
6
6
|
registerActiveSession,
|
|
@@ -97,9 +97,9 @@ function useSSEStream(options) {
|
|
|
97
97
|
const [events, setEvents] = React.useState([]);
|
|
98
98
|
const [lastEvent, setLastEvent] = React.useState(null);
|
|
99
99
|
const [error, setError] = React.useState(null);
|
|
100
|
-
const [retryCount, setRetryCount] = React.useState(0);
|
|
101
100
|
const [lastEventTime, setLastEventTime] = React.useState(Date.now());
|
|
102
101
|
const [timeSinceLastEvent, setTimeSinceLastEvent] = React.useState(0);
|
|
102
|
+
const retryCountRef = React.useRef(0);
|
|
103
103
|
const eventSourceRef = React.useRef(null);
|
|
104
104
|
const abortControllerRef = React.useRef(null);
|
|
105
105
|
const reconnectTimeoutRef = React.useRef(null);
|
|
@@ -126,7 +126,10 @@ function useSSEStream(options) {
|
|
|
126
126
|
}
|
|
127
127
|
setLastEventTime(Date.now());
|
|
128
128
|
setLastEvent(event);
|
|
129
|
-
setEvents((prev) =>
|
|
129
|
+
setEvents((prev) => {
|
|
130
|
+
const next = [...prev, event];
|
|
131
|
+
return next.length > 1e3 ? next.slice(-1e3) : next;
|
|
132
|
+
});
|
|
130
133
|
onEvent?.(event);
|
|
131
134
|
},
|
|
132
135
|
[onEvent]
|
|
@@ -181,7 +184,7 @@ function useSSEStream(options) {
|
|
|
181
184
|
throw new Error("Response body is null");
|
|
182
185
|
}
|
|
183
186
|
setState("connected");
|
|
184
|
-
|
|
187
|
+
retryCountRef.current = 0;
|
|
185
188
|
const reader = response.body.getReader();
|
|
186
189
|
const decoder = new TextDecoder();
|
|
187
190
|
let buffer = "";
|
|
@@ -227,10 +230,10 @@ function useSSEStream(options) {
|
|
|
227
230
|
}
|
|
228
231
|
if (autoReconnect && enabled) {
|
|
229
232
|
setState("reconnecting");
|
|
230
|
-
const delay = reconnectDelay * 2 **
|
|
233
|
+
const delay = reconnectDelay * 2 ** retryCountRef.current;
|
|
231
234
|
reconnectTimeoutRef.current = setTimeout(
|
|
232
235
|
() => {
|
|
233
|
-
|
|
236
|
+
retryCountRef.current += 1;
|
|
234
237
|
connect();
|
|
235
238
|
},
|
|
236
239
|
Math.min(delay, 3e4)
|
|
@@ -245,12 +248,12 @@ function useSSEStream(options) {
|
|
|
245
248
|
setError(err);
|
|
246
249
|
onError?.(err);
|
|
247
250
|
setState("error");
|
|
248
|
-
if (autoReconnect && enabled &&
|
|
251
|
+
if (autoReconnect && enabled && retryCountRef.current < maxRetries) {
|
|
249
252
|
setState("reconnecting");
|
|
250
|
-
const delay = reconnectDelay * 2 **
|
|
253
|
+
const delay = reconnectDelay * 2 ** retryCountRef.current;
|
|
251
254
|
reconnectTimeoutRef.current = setTimeout(
|
|
252
255
|
() => {
|
|
253
|
-
|
|
256
|
+
retryCountRef.current += 1;
|
|
254
257
|
connect();
|
|
255
258
|
},
|
|
256
259
|
Math.min(delay, 3e4)
|
|
@@ -262,19 +265,19 @@ function useSSEStream(options) {
|
|
|
262
265
|
eventSourceRef.current = es;
|
|
263
266
|
es.onopen = () => {
|
|
264
267
|
setState("connected");
|
|
265
|
-
|
|
268
|
+
retryCountRef.current = 0;
|
|
266
269
|
};
|
|
267
270
|
es.onerror = () => {
|
|
268
271
|
const err = new Error("EventSource connection error");
|
|
269
272
|
setError(err);
|
|
270
273
|
onError?.(err);
|
|
271
|
-
if (autoReconnect && enabled &&
|
|
274
|
+
if (autoReconnect && enabled && retryCountRef.current < maxRetries) {
|
|
272
275
|
setState("reconnecting");
|
|
273
276
|
es.close();
|
|
274
|
-
const delay = reconnectDelay * 2 **
|
|
277
|
+
const delay = reconnectDelay * 2 ** retryCountRef.current;
|
|
275
278
|
reconnectTimeoutRef.current = setTimeout(
|
|
276
279
|
() => {
|
|
277
|
-
|
|
280
|
+
retryCountRef.current += 1;
|
|
278
281
|
connect();
|
|
279
282
|
},
|
|
280
283
|
Math.min(delay, 3e4)
|
|
@@ -313,7 +316,6 @@ function useSSEStream(options) {
|
|
|
313
316
|
autoReconnect,
|
|
314
317
|
maxRetries,
|
|
315
318
|
reconnectDelay,
|
|
316
|
-
retryCount,
|
|
317
319
|
eventTypes,
|
|
318
320
|
handleEvent,
|
|
319
321
|
onError,
|
|
@@ -337,7 +339,7 @@ function useSSEStream(options) {
|
|
|
337
339
|
connect,
|
|
338
340
|
disconnect,
|
|
339
341
|
clearEvents,
|
|
340
|
-
retryCount,
|
|
342
|
+
retryCount: retryCountRef.current,
|
|
341
343
|
timeSinceLastEvent
|
|
342
344
|
};
|
|
343
345
|
}
|
|
@@ -345,8 +347,11 @@ function useSSEStream(options) {
|
|
|
345
347
|
// src/hooks/use-sdk-session.ts
|
|
346
348
|
import { useCallback as useCallback3, useMemo, useRef as useRef3, useState as useState3 } from "react";
|
|
347
349
|
function uid() {
|
|
348
|
-
if (typeof crypto !== "undefined" && crypto.randomUUID) {
|
|
349
|
-
|
|
350
|
+
if (typeof globalThis.crypto !== "undefined" && typeof globalThis.crypto.randomUUID === "function") {
|
|
351
|
+
try {
|
|
352
|
+
return globalThis.crypto.randomUUID();
|
|
353
|
+
} catch {
|
|
354
|
+
}
|
|
350
355
|
}
|
|
351
356
|
return `sdk-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
|
|
352
357
|
}
|
|
@@ -1001,14 +1006,13 @@ function RealtimeSessionRegistry({ sessions }) {
|
|
|
1001
1006
|
|
|
1002
1007
|
// src/hooks/use-session-stream.ts
|
|
1003
1008
|
import { useCallback as useCallback4, useEffect as useEffect3, useRef as useRef5, useState as useState5 } from "react";
|
|
1004
|
-
|
|
1005
|
-
function mapApiMessage(msg) {
|
|
1009
|
+
function mapApiMessage(msg, counterRef) {
|
|
1006
1010
|
const created = msg.info.timestamp ? new Date(msg.info.timestamp).getTime() : Date.now();
|
|
1007
1011
|
const message = {
|
|
1008
1012
|
id: msg.info.id,
|
|
1009
1013
|
role: msg.info.role,
|
|
1010
1014
|
time: { created },
|
|
1011
|
-
_insertionIndex:
|
|
1015
|
+
_insertionIndex: counterRef.current++
|
|
1012
1016
|
};
|
|
1013
1017
|
const parts = (msg.parts ?? []).map((p, i) => {
|
|
1014
1018
|
if (p.type === "tool" && p.tool) {
|
|
@@ -1056,7 +1060,9 @@ function useSessionStream({
|
|
|
1056
1060
|
const [error, setError] = useState5(null);
|
|
1057
1061
|
const [connected, setConnected] = useState5(false);
|
|
1058
1062
|
const abortRef = useRef5(null);
|
|
1063
|
+
const reconnectTimerRef = useRef5(null);
|
|
1059
1064
|
const streamingMsgIdRef = useRef5(null);
|
|
1065
|
+
const insertionCounterRef = useRef5(0);
|
|
1060
1066
|
const handleSSEEventRef = useRef5(null);
|
|
1061
1067
|
const refetch = useCallback4(async () => {
|
|
1062
1068
|
if (!token || !sessionId || !apiUrl) return;
|
|
@@ -1067,7 +1073,7 @@ function useSessionStream({
|
|
|
1067
1073
|
const newMessages = [];
|
|
1068
1074
|
const newPartMap = {};
|
|
1069
1075
|
for (const apiMsg of apiMessages) {
|
|
1070
|
-
const { message, parts } = mapApiMessage(apiMsg);
|
|
1076
|
+
const { message, parts } = mapApiMessage(apiMsg, insertionCounterRef);
|
|
1071
1077
|
newMessages.push(message);
|
|
1072
1078
|
newPartMap[message.id] = parts;
|
|
1073
1079
|
}
|
|
@@ -1081,6 +1087,10 @@ function useSessionStream({
|
|
|
1081
1087
|
}, [apiUrl, token, sessionId]);
|
|
1082
1088
|
const connectSSE = useCallback4(async () => {
|
|
1083
1089
|
if (!token || !sessionId || !apiUrl || !enabled) return;
|
|
1090
|
+
if (reconnectTimerRef.current) {
|
|
1091
|
+
clearTimeout(reconnectTimerRef.current);
|
|
1092
|
+
reconnectTimerRef.current = null;
|
|
1093
|
+
}
|
|
1084
1094
|
abortRef.current?.abort();
|
|
1085
1095
|
const controller = new AbortController();
|
|
1086
1096
|
abortRef.current = controller;
|
|
@@ -1131,7 +1141,7 @@ function useSessionStream({
|
|
|
1131
1141
|
setError(msg);
|
|
1132
1142
|
setConnected(false);
|
|
1133
1143
|
if (!controller.signal.aborted) {
|
|
1134
|
-
setTimeout(() => connectSSE(), 3e3);
|
|
1144
|
+
reconnectTimerRef.current = setTimeout(() => connectSSE(), 3e3);
|
|
1135
1145
|
}
|
|
1136
1146
|
}
|
|
1137
1147
|
}, [apiUrl, token, sessionId, enabled]);
|
|
@@ -1151,7 +1161,7 @@ function useSessionStream({
|
|
|
1151
1161
|
id,
|
|
1152
1162
|
role,
|
|
1153
1163
|
time: { created: Date.now() },
|
|
1154
|
-
_insertionIndex:
|
|
1164
|
+
_insertionIndex: insertionCounterRef.current++
|
|
1155
1165
|
}
|
|
1156
1166
|
];
|
|
1157
1167
|
});
|
|
@@ -1254,6 +1264,7 @@ function useSessionStream({
|
|
|
1254
1264
|
connectSSE();
|
|
1255
1265
|
return () => {
|
|
1256
1266
|
abortRef.current?.abort();
|
|
1267
|
+
if (reconnectTimerRef.current) clearTimeout(reconnectTimerRef.current);
|
|
1257
1268
|
setConnected(false);
|
|
1258
1269
|
};
|
|
1259
1270
|
}, [enabled, token, sessionId, refetch, connectSSE]);
|