@tangle-network/sandbox-ui 0.4.0 → 0.5.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.
Files changed (61) hide show
  1. package/dist/auth.js +3 -3
  2. package/dist/chat.d.ts +1 -1
  3. package/dist/chat.js +11 -9
  4. package/dist/{chunk-ZP6GSX4D.js → chunk-565V6JTN.js} +26 -50
  5. package/dist/chunk-5CEMHKBP.js +72 -0
  6. package/dist/{chunk-FOQTE67I.js → chunk-5F4NX5R2.js} +10 -5
  7. package/dist/{chunk-MVYFNPAH.js → chunk-7DVFZEVW.js} +298 -272
  8. package/dist/{chunk-MUOL44AE.js → chunk-BRBTD7RH.js} +6 -6
  9. package/dist/{chunk-SSKVYXCR.js → chunk-DCPYTL4W.js} +62 -79
  10. package/dist/chunk-DLCFZDGX.js +182 -0
  11. package/dist/{chunk-HXEA7L2T.js → chunk-FFOXUHOF.js} +10 -10
  12. package/dist/chunk-H5XYSFYE.js +228 -0
  13. package/dist/{chunk-TQN3VR4F.js → chunk-JP725R4W.js} +2 -2
  14. package/dist/{chunk-CJ2RYVZH.js → chunk-NTSRY4GW.js} +68 -10
  15. package/dist/{chunk-DQYODCBN.js → chunk-P24K22CV.js} +57 -66
  16. package/dist/{chunk-GVUW4VDD.js → chunk-R3IU37AW.js} +161 -229
  17. package/dist/chunk-TDYQBLL5.js +127 -0
  18. package/dist/{chunk-HWLX5NME.js → chunk-TSE423UF.js} +12 -12
  19. package/dist/{chunk-YDBXQQLC.js → chunk-VBWY44UU.js} +30 -76
  20. package/dist/{chunk-IW2JZCOC.js → chunk-WBQ7VULC.js} +7 -7
  21. package/dist/{chunk-72UEKFZ2.js → chunk-WC7QTWPN.js} +65 -42
  22. package/dist/{chunk-HYLTXGOI.js → chunk-WQH233GF.js} +5 -5
  23. package/dist/{chunk-CCKNIAS7.js → chunk-XBR3IP7B.js} +2 -2
  24. package/dist/{chunk-OHMO7NUX.js → chunk-XTPAWK7L.js} +20 -31
  25. package/dist/{chunk-SULQQJPB.js → chunk-YS66Q3RC.js} +1 -1
  26. package/dist/{chunk-FRGMMANX.js → chunk-YYGECNZZ.js} +3 -3
  27. package/dist/dashboard.d.ts +2 -2
  28. package/dist/dashboard.js +6 -6
  29. package/dist/{document-editor-pane-5TN2VWGZ.js → document-editor-pane-JNXPANWM.js} +2 -2
  30. package/dist/editor.js +2 -2
  31. package/dist/files.js +2 -2
  32. package/dist/globals.css +129 -95
  33. package/dist/hooks.d.ts +2 -2
  34. package/dist/hooks.js +5 -5
  35. package/dist/{index-tTfThG0n.d.ts → index-BT_-ecpc.d.ts} +11 -10
  36. package/dist/index.d.ts +16 -23
  37. package/dist/index.js +27 -26
  38. package/dist/markdown.d.ts +14 -17
  39. package/dist/markdown.js +1 -1
  40. package/dist/openui.js +5 -5
  41. package/dist/pages.d.ts +10 -3
  42. package/dist/pages.js +147 -184
  43. package/dist/primitives.d.ts +8 -5
  44. package/dist/primitives.js +8 -8
  45. package/dist/run.d.ts +1 -1
  46. package/dist/run.js +4 -4
  47. package/dist/sdk-hooks.d.ts +1 -1
  48. package/dist/sdk-hooks.js +4 -4
  49. package/dist/styles.css +129 -95
  50. package/dist/terminal.d.ts +2 -2
  51. package/dist/terminal.js +13 -43
  52. package/dist/tokens.css +299 -179
  53. package/dist/{tool-call-feed-D5Ume-Pt.d.ts → tool-call-feed-Bs3MyQMT.d.ts} +3 -1
  54. package/dist/{usage-chart-CY9xo3KX.d.ts → usage-chart-XCoB_7Xu.d.ts} +1 -2
  55. package/dist/{use-pty-session-DeZSxOCN.d.ts → use-pty-session-COzVkhtc.d.ts} +1 -1
  56. package/dist/workspace.d.ts +3 -1
  57. package/dist/workspace.js +11 -11
  58. package/package.json +14 -2
  59. package/dist/chunk-GRYHFH5O.js +0 -110
  60. package/dist/chunk-LTFK464G.js +0 -103
  61. 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-OHMO7NUX.js";
7
- import "./chunk-IW2JZCOC.js";
8
- import "./chunk-HWLX5NME.js";
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-D5Ume-Pt.js';
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-GVUW4VDD.js";
11
+ } from "./chunk-R3IU37AW.js";
10
12
  import "./chunk-CNWVHQFY.js";
11
- import "./chunk-72UEKFZ2.js";
13
+ import "./chunk-WC7QTWPN.js";
12
14
  import "./chunk-HRMUF35V.js";
13
- import "./chunk-CJ2RYVZH.js";
15
+ import "./chunk-NTSRY4GW.js";
14
16
  import "./chunk-BX6AQMUS.js";
15
- import "./chunk-YDBXQQLC.js";
16
- import "./chunk-TQN3VR4F.js";
17
- import "./chunk-LTFK464G.js";
18
- import "./chunk-MXCSSOGH.js";
19
- import "./chunk-HWLX5NME.js";
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-FRGMMANX.js";
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-MXCSSOGH.js";
12
+ } from "./chunk-TDYQBLL5.js";
13
13
  import {
14
14
  Button
15
- } from "./chunk-HWLX5NME.js";
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 colors = variantColors[variant];
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: colors.accent }),
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", colors.accent), children: subscription.tierName }),
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: colors.accent }),
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", colors.accent), children: formatCredits(balance.available) })
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: colors.accent }),
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", colors.accent), children: formatCredits(usage.total) })
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" && colors.progress
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 colors = variantColors2[variant];
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", colors.ring, "ring-2") : "text-muted-foreground hover: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", colors.ring, "ring-2") : "text-muted-foreground hover: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", colors.accent), children: "Save 20%" })
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(colors.border, "border-2 ring-2", colors.ring),
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 && colors.ring
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", colors.accent), children: formatPrice(displayPrice) }),
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", colors.bg), children: [
371
- /* @__PURE__ */ jsx2("span", { className: cn("font-semibold", colors.accent), children: tier.creditsPerMonth.toLocaleString() }),
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", colors.accent)
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 variantColors3 = {
410
- agentrun: {
411
- bar: "bg-gradient-to-t from-blue-600 to-blue-400",
412
- barHover: "hover:from-blue-500 hover:to-blue-300",
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-CCKNIAS7.js";
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
- handleSSEEvent(eventType, parsed);
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, props) => {
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 {