@tangle-network/sandbox-ui 0.4.0 → 0.5.0
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.js +3 -3
- package/dist/chat.d.ts +1 -1
- package/dist/chat.js +11 -9
- package/dist/{chunk-ZP6GSX4D.js → chunk-565V6JTN.js} +26 -50
- package/dist/chunk-5CEMHKBP.js +72 -0
- package/dist/{chunk-FOQTE67I.js → chunk-5F4NX5R2.js} +10 -5
- package/dist/{chunk-MUOL44AE.js → chunk-BRBTD7RH.js} +6 -6
- package/dist/{chunk-SSKVYXCR.js → chunk-DCPYTL4W.js} +62 -79
- package/dist/chunk-DLCFZDGX.js +182 -0
- package/dist/{chunk-HXEA7L2T.js → chunk-FFOXUHOF.js} +10 -10
- package/dist/chunk-H5XYSFYE.js +228 -0
- package/dist/{chunk-TQN3VR4F.js → chunk-JP725R4W.js} +2 -2
- package/dist/{chunk-CJ2RYVZH.js → chunk-NTSRY4GW.js} +68 -10
- package/dist/{chunk-DQYODCBN.js → chunk-P24K22CV.js} +57 -66
- package/dist/{chunk-GVUW4VDD.js → chunk-R3IU37AW.js} +161 -229
- package/dist/chunk-TDYQBLL5.js +127 -0
- package/dist/{chunk-HWLX5NME.js → chunk-TSE423UF.js} +12 -12
- package/dist/{chunk-YDBXQQLC.js → chunk-VBWY44UU.js} +30 -76
- package/dist/{chunk-IW2JZCOC.js → chunk-WBQ7VULC.js} +7 -7
- package/dist/{chunk-72UEKFZ2.js → chunk-WC7QTWPN.js} +65 -42
- package/dist/{chunk-HYLTXGOI.js → chunk-WQH233GF.js} +5 -5
- package/dist/{chunk-CCKNIAS7.js → chunk-XBR3IP7B.js} +2 -2
- package/dist/{chunk-OHMO7NUX.js → chunk-XTPAWK7L.js} +20 -31
- package/dist/{chunk-SULQQJPB.js → chunk-YS66Q3RC.js} +1 -1
- package/dist/{chunk-FRGMMANX.js → chunk-YYGECNZZ.js} +3 -3
- package/dist/{chunk-MVYFNPAH.js → chunk-ZOZX2U6I.js} +285 -271
- package/dist/dashboard.d.ts +2 -2
- package/dist/dashboard.js +6 -6
- package/dist/{document-editor-pane-5TN2VWGZ.js → document-editor-pane-JNXPANWM.js} +2 -2
- package/dist/editor.js +2 -2
- package/dist/files.js +2 -2
- package/dist/globals.css +129 -95
- package/dist/hooks.d.ts +2 -2
- package/dist/hooks.js +5 -5
- package/dist/{index-tTfThG0n.d.ts → index-CDt0GE4A.d.ts} +7 -8
- package/dist/index.d.ts +16 -23
- package/dist/index.js +27 -26
- package/dist/markdown.d.ts +14 -17
- package/dist/markdown.js +1 -1
- package/dist/openui.js +5 -5
- package/dist/pages.d.ts +10 -3
- package/dist/pages.js +147 -184
- package/dist/primitives.d.ts +8 -5
- package/dist/primitives.js +8 -8
- package/dist/run.d.ts +1 -1
- package/dist/run.js +4 -4
- package/dist/sdk-hooks.d.ts +1 -1
- package/dist/sdk-hooks.js +4 -4
- package/dist/styles.css +129 -95
- package/dist/terminal.d.ts +2 -2
- package/dist/terminal.js +13 -43
- package/dist/tokens.css +299 -179
- package/dist/{tool-call-feed-D5Ume-Pt.d.ts → tool-call-feed-Bs3MyQMT.d.ts} +3 -1
- package/dist/{usage-chart-CY9xo3KX.d.ts → usage-chart-XCoB_7Xu.d.ts} +1 -2
- 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 +11 -11
- package/package.json +14 -2
- package/dist/chunk-GRYHFH5O.js +0 -110
- package/dist/chunk-LTFK464G.js +0 -103
- package/dist/chunk-MXCSSOGH.js +0 -105
package/dist/auth.js
CHANGED
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
GitHubLoginButton,
|
|
4
4
|
LoginLayout,
|
|
5
5
|
UserMenu
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-XTPAWK7L.js";
|
|
7
|
+
import "./chunk-WBQ7VULC.js";
|
|
8
|
+
import "./chunk-TSE423UF.js";
|
|
9
9
|
import "./chunk-RQHJBTEU.js";
|
|
10
10
|
export {
|
|
11
11
|
AuthHeader,
|
package/dist/chat.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { G as GroupedMessage } from './run-CtFZ6s-D.js';
|
|
|
6
6
|
import { a as SessionPart, S as SessionMessage, b as ToolPart } from './parts-CyGkM6Fp.js';
|
|
7
7
|
import { A as AgentBranding } from './branding-DCi5VEik.js';
|
|
8
8
|
import { C as CustomToolRenderer } from './tool-display-Ct9nFAzJ.js';
|
|
9
|
-
import { T as ToolCallData } from './tool-call-feed-
|
|
9
|
+
import { T as ToolCallData } from './tool-call-feed-Bs3MyQMT.js';
|
|
10
10
|
import './openui.js';
|
|
11
11
|
|
|
12
12
|
type MessageRole = "user" | "assistant" | "system";
|
package/dist/chat.js
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChatMessage
|
|
3
|
+
} from "./chunk-5CEMHKBP.js";
|
|
1
4
|
import {
|
|
2
5
|
AgentTimeline,
|
|
3
6
|
ChatContainer,
|
|
4
7
|
ChatInput,
|
|
5
|
-
ChatMessage,
|
|
6
8
|
MessageList,
|
|
7
9
|
ThinkingIndicator,
|
|
8
10
|
UserMessage
|
|
9
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-R3IU37AW.js";
|
|
10
12
|
import "./chunk-CNWVHQFY.js";
|
|
11
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-WC7QTWPN.js";
|
|
12
14
|
import "./chunk-HRMUF35V.js";
|
|
13
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-NTSRY4GW.js";
|
|
14
16
|
import "./chunk-BX6AQMUS.js";
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-VBWY44UU.js";
|
|
18
|
+
import "./chunk-JP725R4W.js";
|
|
19
|
+
import "./chunk-H5XYSFYE.js";
|
|
20
|
+
import "./chunk-TDYQBLL5.js";
|
|
21
|
+
import "./chunk-TSE423UF.js";
|
|
20
22
|
import "./chunk-RQHJBTEU.js";
|
|
21
23
|
export {
|
|
22
24
|
AgentTimeline,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Progress
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YYGECNZZ.js";
|
|
4
4
|
import {
|
|
5
5
|
Badge,
|
|
6
6
|
Card,
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
CardFooter,
|
|
10
10
|
CardHeader,
|
|
11
11
|
CardTitle
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-TDYQBLL5.js";
|
|
13
13
|
import {
|
|
14
14
|
Button
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-TSE423UF.js";
|
|
16
16
|
import {
|
|
17
17
|
cn
|
|
18
18
|
} from "./chunk-RQHJBTEU.js";
|
|
@@ -130,7 +130,7 @@ function BillingDashboard({
|
|
|
130
130
|
className,
|
|
131
131
|
cardClassName
|
|
132
132
|
}) {
|
|
133
|
-
const
|
|
133
|
+
const colors2 = variantColors[variant];
|
|
134
134
|
const totalCredits = balance.available + balance.used;
|
|
135
135
|
const usagePercent = totalCredits > 0 ? balance.used / totalCredits * 100 : 0;
|
|
136
136
|
const sortedModels = Object.entries(usage.byModel).sort(
|
|
@@ -140,14 +140,14 @@ function BillingDashboard({
|
|
|
140
140
|
/* @__PURE__ */ jsxs(Card, { variant, className: cn("lg:col-span-1", cardClassName), children: [
|
|
141
141
|
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
142
142
|
/* @__PURE__ */ jsxs(CardTitle, { className: "flex items-center gap-2 text-base", children: [
|
|
143
|
-
/* @__PURE__ */ jsx(CreditCardIcon, { className:
|
|
143
|
+
/* @__PURE__ */ jsx(CreditCardIcon, { className: colors2.accent }),
|
|
144
144
|
"Current Plan"
|
|
145
145
|
] }),
|
|
146
146
|
subscription && /* @__PURE__ */ jsx(Badge, { variant: getStatusBadgeVariant(subscription.status), children: subscription.status })
|
|
147
147
|
] }) }),
|
|
148
148
|
/* @__PURE__ */ jsx(CardContent, { className: "space-y-4", children: subscription ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
149
149
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
150
|
-
/* @__PURE__ */ jsx("p", { className: cn("font-bold text-2xl",
|
|
150
|
+
/* @__PURE__ */ jsx("p", { className: cn("font-bold text-2xl", colors2.accent), children: subscription.tierName }),
|
|
151
151
|
/* @__PURE__ */ jsxs("p", { className: "text-muted-foreground text-sm", children: [
|
|
152
152
|
"Renews ",
|
|
153
153
|
formatDate(subscription.renewsAt)
|
|
@@ -181,7 +181,7 @@ function BillingDashboard({
|
|
|
181
181
|
/* @__PURE__ */ jsxs(Card, { variant, className: cn("lg:col-span-1", cardClassName), children: [
|
|
182
182
|
/* @__PURE__ */ jsxs(CardHeader, { children: [
|
|
183
183
|
/* @__PURE__ */ jsxs(CardTitle, { className: "flex items-center gap-2 text-base", children: [
|
|
184
|
-
/* @__PURE__ */ jsx(CoinsIcon, { className:
|
|
184
|
+
/* @__PURE__ */ jsx(CoinsIcon, { className: colors2.accent }),
|
|
185
185
|
"Credit Balance"
|
|
186
186
|
] }),
|
|
187
187
|
/* @__PURE__ */ jsxs(CardDescription, { children: [
|
|
@@ -198,7 +198,7 @@ function BillingDashboard({
|
|
|
198
198
|
/* @__PURE__ */ jsx(Progress, { value: usagePercent, variant, className: "h-3" }),
|
|
199
199
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm", children: [
|
|
200
200
|
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Available" }),
|
|
201
|
-
/* @__PURE__ */ jsx("span", { className: cn("font-medium",
|
|
201
|
+
/* @__PURE__ */ jsx("span", { className: cn("font-medium", colors2.accent), children: formatCredits(balance.available) })
|
|
202
202
|
] })
|
|
203
203
|
] }),
|
|
204
204
|
/* @__PURE__ */ jsx(Button, { variant, className: "w-full", onClick: onAddCredits, children: "Add Credits" })
|
|
@@ -207,7 +207,7 @@ function BillingDashboard({
|
|
|
207
207
|
/* @__PURE__ */ jsxs(Card, { variant, className: cn("lg:col-span-1", cardClassName), children: [
|
|
208
208
|
/* @__PURE__ */ jsxs(CardHeader, { children: [
|
|
209
209
|
/* @__PURE__ */ jsxs(CardTitle, { className: "flex items-center gap-2 text-base", children: [
|
|
210
|
-
/* @__PURE__ */ jsx(ChartIcon, { className:
|
|
210
|
+
/* @__PURE__ */ jsx(ChartIcon, { className: colors2.accent }),
|
|
211
211
|
"Usage Breakdown"
|
|
212
212
|
] }),
|
|
213
213
|
/* @__PURE__ */ jsx(CardDescription, { children: usage.period })
|
|
@@ -215,7 +215,7 @@ function BillingDashboard({
|
|
|
215
215
|
/* @__PURE__ */ jsxs(CardContent, { className: "space-y-4", children: [
|
|
216
216
|
/* @__PURE__ */ jsxs("div", { className: "flex items-baseline justify-between", children: [
|
|
217
217
|
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-sm", children: "Total Usage" }),
|
|
218
|
-
/* @__PURE__ */ jsx("span", { className: cn("font-bold text-2xl",
|
|
218
|
+
/* @__PURE__ */ jsx("span", { className: cn("font-bold text-2xl", colors2.accent), children: formatCredits(usage.total) })
|
|
219
219
|
] }),
|
|
220
220
|
/* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
221
221
|
/* @__PURE__ */ jsx("p", { className: "font-medium text-muted-foreground text-xs uppercase tracking-wider", children: "By Model" }),
|
|
@@ -232,7 +232,7 @@ function BillingDashboard({
|
|
|
232
232
|
{
|
|
233
233
|
className: cn(
|
|
234
234
|
"h-full rounded-full transition-all",
|
|
235
|
-
variant === "sandbox" &&
|
|
235
|
+
variant === "sandbox" && colors2.progress
|
|
236
236
|
),
|
|
237
237
|
style: { width: `${modelPercent}%` }
|
|
238
238
|
}
|
|
@@ -303,7 +303,7 @@ function PricingPage({
|
|
|
303
303
|
className,
|
|
304
304
|
cardClassName
|
|
305
305
|
}) {
|
|
306
|
-
const
|
|
306
|
+
const colors2 = variantColors2[variant];
|
|
307
307
|
return /* @__PURE__ */ jsxs2("div", { className: cn("w-full space-y-8", className), children: [
|
|
308
308
|
/* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-center gap-4", children: [
|
|
309
309
|
/* @__PURE__ */ jsx2(
|
|
@@ -313,7 +313,7 @@ function PricingPage({
|
|
|
313
313
|
onClick: () => onBillingPeriodChange("monthly"),
|
|
314
314
|
className: cn(
|
|
315
315
|
"rounded-lg px-4 py-2 font-medium text-sm transition-all",
|
|
316
|
-
billingPeriod === "monthly" ? cn("bg-muted text-foreground",
|
|
316
|
+
billingPeriod === "monthly" ? cn("bg-muted text-foreground", colors2.ring, "ring-2") : "text-muted-foreground hover:text-foreground"
|
|
317
317
|
),
|
|
318
318
|
children: "Monthly"
|
|
319
319
|
}
|
|
@@ -325,11 +325,11 @@ function PricingPage({
|
|
|
325
325
|
onClick: () => onBillingPeriodChange("yearly"),
|
|
326
326
|
className: cn(
|
|
327
327
|
"rounded-lg px-4 py-2 font-medium text-sm transition-all",
|
|
328
|
-
billingPeriod === "yearly" ? cn("bg-muted text-foreground",
|
|
328
|
+
billingPeriod === "yearly" ? cn("bg-muted text-foreground", colors2.ring, "ring-2") : "text-muted-foreground hover:text-foreground"
|
|
329
329
|
),
|
|
330
330
|
children: [
|
|
331
331
|
"Yearly",
|
|
332
|
-
/* @__PURE__ */ jsx2("span", { className: cn("ml-2 text-xs",
|
|
332
|
+
/* @__PURE__ */ jsx2("span", { className: cn("ml-2 text-xs", colors2.accent), children: "Save 20%" })
|
|
333
333
|
]
|
|
334
334
|
}
|
|
335
335
|
)
|
|
@@ -345,9 +345,9 @@ function PricingPage({
|
|
|
345
345
|
className: cn(
|
|
346
346
|
"relative flex flex-col",
|
|
347
347
|
cardClassName,
|
|
348
|
-
tier.recommended && cn(
|
|
348
|
+
tier.recommended && cn(colors2.border, "border-2 ring-2", colors2.ring),
|
|
349
349
|
isCurrentTier && "ring-2 ring-offset-2 ring-offset-background",
|
|
350
|
-
isCurrentTier &&
|
|
350
|
+
isCurrentTier && colors2.ring
|
|
351
351
|
),
|
|
352
352
|
children: [
|
|
353
353
|
tier.recommended && /* @__PURE__ */ jsx2("div", { className: "absolute -top-3 left-1/2 -translate-x-1/2", children: /* @__PURE__ */ jsx2(Badge, { variant, children: "Recommended" }) }),
|
|
@@ -359,7 +359,7 @@ function PricingPage({
|
|
|
359
359
|
/* @__PURE__ */ jsxs2(CardContent, { className: "flex-1 space-y-6", children: [
|
|
360
360
|
/* @__PURE__ */ jsxs2("div", { className: "text-center", children: [
|
|
361
361
|
/* @__PURE__ */ jsxs2("div", { className: "flex items-baseline justify-center gap-1", children: [
|
|
362
|
-
/* @__PURE__ */ jsx2("span", { className: cn("font-bold text-4xl",
|
|
362
|
+
/* @__PURE__ */ jsx2("span", { className: cn("font-bold text-4xl", colors2.accent), children: formatPrice(displayPrice) }),
|
|
363
363
|
/* @__PURE__ */ jsx2("span", { className: "text-muted-foreground", children: "/mo" })
|
|
364
364
|
] }),
|
|
365
365
|
billingPeriod === "yearly" && tier.yearlyPriceCents !== void 0 && /* @__PURE__ */ jsxs2("p", { className: "mt-1 text-muted-foreground text-sm", children: [
|
|
@@ -367,8 +367,8 @@ function PricingPage({
|
|
|
367
367
|
" billed annually"
|
|
368
368
|
] })
|
|
369
369
|
] }),
|
|
370
|
-
tier.creditsPerMonth !== void 0 && /* @__PURE__ */ jsxs2("div", { className: cn("rounded-lg p-3 text-center",
|
|
371
|
-
/* @__PURE__ */ jsx2("span", { className: cn("font-semibold",
|
|
370
|
+
tier.creditsPerMonth !== void 0 && /* @__PURE__ */ jsxs2("div", { className: cn("rounded-lg p-3 text-center", colors2.bg), children: [
|
|
371
|
+
/* @__PURE__ */ jsx2("span", { className: cn("font-semibold", colors2.accent), children: tier.creditsPerMonth.toLocaleString() }),
|
|
372
372
|
/* @__PURE__ */ jsxs2("span", { className: "text-muted-foreground text-sm", children: [
|
|
373
373
|
" ",
|
|
374
374
|
"credits/month"
|
|
@@ -378,7 +378,7 @@ function PricingPage({
|
|
|
378
378
|
/* @__PURE__ */ jsx2(
|
|
379
379
|
CheckIcon,
|
|
380
380
|
{
|
|
381
|
-
className: cn("mt-0.5 shrink-0",
|
|
381
|
+
className: cn("mt-0.5 shrink-0", colors2.accent)
|
|
382
382
|
}
|
|
383
383
|
),
|
|
384
384
|
/* @__PURE__ */ jsx2("span", { className: "text-muted-foreground text-sm", children: feature })
|
|
@@ -406,27 +406,10 @@ function PricingPage({
|
|
|
406
406
|
// src/dashboard/usage-chart.tsx
|
|
407
407
|
import * as React from "react";
|
|
408
408
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
409
|
-
var
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
text: "text-blue-400"
|
|
414
|
-
},
|
|
415
|
-
automateai: {
|
|
416
|
-
bar: "bg-[image:linear-gradient(to_top,var(--brand-purple),var(--brand-cool))]",
|
|
417
|
-
barHover: "hover:brightness-110",
|
|
418
|
-
text: "text-[var(--brand-purple)]"
|
|
419
|
-
},
|
|
420
|
-
tradingbots: {
|
|
421
|
-
bar: "bg-gradient-to-t from-green-600 to-green-400",
|
|
422
|
-
barHover: "hover:from-green-500 hover:to-green-300",
|
|
423
|
-
text: "text-green-400"
|
|
424
|
-
},
|
|
425
|
-
sandbox: {
|
|
426
|
-
bar: "bg-[image:var(--accent-gradient-strong)]",
|
|
427
|
-
barHover: "hover:brightness-110",
|
|
428
|
-
text: "text-[var(--accent-text)]"
|
|
429
|
-
}
|
|
409
|
+
var colors = {
|
|
410
|
+
bar: "bg-[image:var(--accent-gradient-strong)]",
|
|
411
|
+
barHover: "hover:brightness-110",
|
|
412
|
+
text: "text-[var(--accent-text)]"
|
|
430
413
|
};
|
|
431
414
|
function formatDate2(dateStr) {
|
|
432
415
|
const date = new Date(dateStr);
|
|
@@ -441,14 +424,7 @@ function formatValue(value) {
|
|
|
441
424
|
}
|
|
442
425
|
return value.toLocaleString();
|
|
443
426
|
}
|
|
444
|
-
function UsageChart({
|
|
445
|
-
data,
|
|
446
|
-
title,
|
|
447
|
-
unit,
|
|
448
|
-
variant = "agentrun",
|
|
449
|
-
className
|
|
450
|
-
}) {
|
|
451
|
-
const colors = variantColors3[variant];
|
|
427
|
+
function UsageChart({ data, title, unit, className }) {
|
|
452
428
|
const maxValue = Math.max(...data.map((d) => d.value), 1);
|
|
453
429
|
const total = data.reduce((sum, d) => sum + d.value, 0);
|
|
454
430
|
const [hoveredIndex, setHoveredIndex] = React.useState(null);
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Markdown
|
|
3
|
+
} from "./chunk-H5XYSFYE.js";
|
|
4
|
+
import {
|
|
5
|
+
cn
|
|
6
|
+
} from "./chunk-RQHJBTEU.js";
|
|
7
|
+
|
|
8
|
+
// src/chat/chat-message.tsx
|
|
9
|
+
import { User, Bot } from "lucide-react";
|
|
10
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
function ChatMessage({
|
|
12
|
+
role,
|
|
13
|
+
content,
|
|
14
|
+
toolCalls,
|
|
15
|
+
isStreaming,
|
|
16
|
+
timestamp,
|
|
17
|
+
className
|
|
18
|
+
}) {
|
|
19
|
+
const isUser = role === "user";
|
|
20
|
+
return /* @__PURE__ */ jsxs(
|
|
21
|
+
"div",
|
|
22
|
+
{
|
|
23
|
+
className: cn(
|
|
24
|
+
"flex gap-3",
|
|
25
|
+
isUser ? "flex-row-reverse" : "flex-row",
|
|
26
|
+
className
|
|
27
|
+
),
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ jsx(
|
|
30
|
+
"div",
|
|
31
|
+
{
|
|
32
|
+
className: cn(
|
|
33
|
+
"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-[calc(var(--radius-md)+2px)] border",
|
|
34
|
+
isUser ? "border-[var(--border-accent)] bg-[var(--accent-surface-soft)] text-[var(--accent-text)]" : "border-[var(--border-subtle)] bg-[var(--bg-section)] text-[var(--brand-cool)]"
|
|
35
|
+
),
|
|
36
|
+
children: isUser ? /* @__PURE__ */ jsx(User, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx(Bot, { className: "h-3.5 w-3.5" })
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
/* @__PURE__ */ jsxs(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
className: cn(
|
|
43
|
+
"min-w-0 max-w-[85%] space-y-1.5 rounded-[var(--radius-xl)] border px-4 py-3",
|
|
44
|
+
isUser ? "border-[var(--border-accent)] bg-[var(--depth-3)]" : "border-[var(--border-subtle)] bg-[var(--depth-2)]"
|
|
45
|
+
),
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-2", isUser && "flex-row-reverse"), children: [
|
|
48
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] font-semibold uppercase tracking-[0.14em] text-[var(--text-secondary)]", children: isUser ? "You" : "Agent" }),
|
|
49
|
+
timestamp && /* @__PURE__ */ jsx("span", { className: "text-[11px] text-[var(--text-muted)]", children: formatTime(timestamp) })
|
|
50
|
+
] }),
|
|
51
|
+
isUser ? /* @__PURE__ */ jsx("div", { className: "whitespace-pre-wrap text-[15px] leading-7 text-[var(--text-primary)]", children: content }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
52
|
+
content && /* @__PURE__ */ jsx(Markdown, { className: "tangle-prose text-[15px] leading-7", children: content }),
|
|
53
|
+
isStreaming && /* @__PURE__ */ jsx("span", { className: "ml-0.5 inline-block h-4 w-2 animate-pulse rounded-sm bg-[var(--brand-cool)] align-text-bottom" })
|
|
54
|
+
] }),
|
|
55
|
+
toolCalls
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
function formatTime(date) {
|
|
64
|
+
return date.toLocaleTimeString(void 0, {
|
|
65
|
+
hour: "numeric",
|
|
66
|
+
minute: "2-digit"
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export {
|
|
71
|
+
ChatMessage
|
|
72
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseToolEvent
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XBR3IP7B.js";
|
|
4
4
|
import {
|
|
5
5
|
bumpActiveSessionActivity,
|
|
6
6
|
registerActiveSession,
|
|
@@ -1040,7 +1040,7 @@ function mapApiMessage(msg) {
|
|
|
1040
1040
|
async function fetchJson(url, token, init) {
|
|
1041
1041
|
const headers = { Authorization: `Bearer ${token}` };
|
|
1042
1042
|
if (init?.body) headers["Content-Type"] = "application/json";
|
|
1043
|
-
const res = await fetch(url, { ...init, headers: { ...headers, ...init?.headers } });
|
|
1043
|
+
const res = await fetch(url, { ...init, headers: { ...headers, ...init?.headers }, credentials: "include" });
|
|
1044
1044
|
if (!res.ok) throw new Error(`HTTP ${res.status}: ${res.statusText}`);
|
|
1045
1045
|
return res.json();
|
|
1046
1046
|
}
|
|
@@ -1057,6 +1057,7 @@ function useSessionStream({
|
|
|
1057
1057
|
const [connected, setConnected] = useState5(false);
|
|
1058
1058
|
const abortRef = useRef5(null);
|
|
1059
1059
|
const streamingMsgIdRef = useRef5(null);
|
|
1060
|
+
const handleSSEEventRef = useRef5(null);
|
|
1060
1061
|
const refetch = useCallback4(async () => {
|
|
1061
1062
|
if (!token || !sessionId || !apiUrl) return;
|
|
1062
1063
|
try {
|
|
@@ -1087,7 +1088,8 @@ function useSessionStream({
|
|
|
1087
1088
|
const url = `${apiUrl}/session/events?sessionId=${encodeURIComponent(sessionId)}`;
|
|
1088
1089
|
const res = await fetch(url, {
|
|
1089
1090
|
headers: { Authorization: `Bearer ${token}` },
|
|
1090
|
-
signal: controller.signal
|
|
1091
|
+
signal: controller.signal,
|
|
1092
|
+
credentials: "include"
|
|
1091
1093
|
});
|
|
1092
1094
|
if (!res.ok) throw new Error(`SSE connection failed: ${res.status}`);
|
|
1093
1095
|
setConnected(true);
|
|
@@ -1120,7 +1122,7 @@ function useSessionStream({
|
|
|
1120
1122
|
} catch {
|
|
1121
1123
|
continue;
|
|
1122
1124
|
}
|
|
1123
|
-
|
|
1125
|
+
handleSSEEventRef.current?.(eventType, parsed);
|
|
1124
1126
|
}
|
|
1125
1127
|
}
|
|
1126
1128
|
} catch (err) {
|
|
@@ -1133,7 +1135,9 @@ function useSessionStream({
|
|
|
1133
1135
|
}
|
|
1134
1136
|
}
|
|
1135
1137
|
}, [apiUrl, token, sessionId, enabled]);
|
|
1136
|
-
const handleSSEEvent = useCallback4((type,
|
|
1138
|
+
const handleSSEEvent = useCallback4((type, raw) => {
|
|
1139
|
+
const envelope = raw?.properties;
|
|
1140
|
+
const props = envelope?.info ?? envelope?.part ?? envelope ?? raw;
|
|
1137
1141
|
if (type === "message.updated") {
|
|
1138
1142
|
const id = props.id ?? props.messageId ?? "";
|
|
1139
1143
|
const role = props.role ?? "assistant";
|
|
@@ -1219,6 +1223,7 @@ function useSessionStream({
|
|
|
1219
1223
|
refetch();
|
|
1220
1224
|
}
|
|
1221
1225
|
}, [refetch]);
|
|
1226
|
+
handleSSEEventRef.current = handleSSEEvent;
|
|
1222
1227
|
const send = useCallback4(async (text) => {
|
|
1223
1228
|
if (!token || !sessionId || !apiUrl) return;
|
|
1224
1229
|
try {
|
|
@@ -18,12 +18,12 @@ var Input = React.forwardRef(
|
|
|
18
18
|
type,
|
|
19
19
|
id: inputId,
|
|
20
20
|
className: cn(
|
|
21
|
-
"flex h-11 w-full rounded-lg border bg-
|
|
21
|
+
"flex h-11 w-full rounded-lg border bg-[var(--depth-2)] px-4 py-2 text-sm transition-all duration-200",
|
|
22
22
|
"placeholder:text-muted-foreground",
|
|
23
23
|
"focus:outline-none focus:ring-2 focus:ring-offset-0",
|
|
24
24
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
25
25
|
"file:border-0 file:bg-transparent file:font-medium file:text-sm",
|
|
26
|
-
error ? "border-
|
|
26
|
+
error ? "border-[var(--surface-danger-border)] focus:ring-[var(--surface-danger-border)]" : variants[variant],
|
|
27
27
|
className
|
|
28
28
|
),
|
|
29
29
|
ref,
|
|
@@ -41,7 +41,7 @@ var Input = React.forwardRef(
|
|
|
41
41
|
}
|
|
42
42
|
),
|
|
43
43
|
input,
|
|
44
|
-
error && /* @__PURE__ */ jsx("p", { className: "text-
|
|
44
|
+
error && /* @__PURE__ */ jsx("p", { className: "text-[var(--surface-danger-text)] text-sm", children: error }),
|
|
45
45
|
hint && !error && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground/70 text-sm", children: hint })
|
|
46
46
|
] });
|
|
47
47
|
}
|
|
@@ -59,11 +59,11 @@ var Textarea = React.forwardRef(
|
|
|
59
59
|
{
|
|
60
60
|
id: textareaId,
|
|
61
61
|
className: cn(
|
|
62
|
-
"flex min-h-[120px] w-full resize-y rounded-lg border bg-
|
|
62
|
+
"flex min-h-[120px] w-full resize-y rounded-lg border bg-[var(--depth-2)] px-4 py-3 text-sm transition-all duration-200",
|
|
63
63
|
"placeholder:text-muted-foreground",
|
|
64
64
|
"focus:outline-none focus:ring-2 focus:ring-offset-0",
|
|
65
65
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
66
|
-
error ? "border-
|
|
66
|
+
error ? "border-[var(--surface-danger-border)] focus:ring-[var(--surface-danger-border)]" : variants[variant],
|
|
67
67
|
className
|
|
68
68
|
),
|
|
69
69
|
ref,
|
|
@@ -81,7 +81,7 @@ var Textarea = React.forwardRef(
|
|
|
81
81
|
}
|
|
82
82
|
),
|
|
83
83
|
textarea,
|
|
84
|
-
error && /* @__PURE__ */ jsx("p", { className: "text-
|
|
84
|
+
error && /* @__PURE__ */ jsx("p", { className: "text-[var(--surface-danger-text)] text-sm", children: error }),
|
|
85
85
|
hint && !error && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground/70 text-sm", children: hint })
|
|
86
86
|
] });
|
|
87
87
|
}
|