@tangle-network/sandbox-ui 0.23.1 → 0.23.3

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/chat.d.ts CHANGED
@@ -3,7 +3,7 @@ export { AgentTimeline, AgentTimelineArtifactItem, AgentTimelineCustomItem, Agen
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as React from 'react';
5
5
  import { M as ModelInfo } from './model-picker-DUfMTQo5.js';
6
- import { e as HarnessType } from './harness-picker-C1W3rTeb.js';
6
+ import { e as HarnessType } from './harness-picker-ppDe7ap-.js';
7
7
 
8
8
  type ReasoningLevel = "auto" | "low" | "medium" | "high";
9
9
  interface ReasoningLevelOption {
package/dist/chat.js CHANGED
@@ -16,9 +16,9 @@ import {
16
16
  modelProvider,
17
17
  snapHarnessToModel,
18
18
  snapModelToHarness
19
- } from "./chunk-TAAYDQGM.js";
20
- import "./chunk-ESRYVGHF.js";
21
- import "./chunk-4KAPMTPU.js";
19
+ } from "./chunk-H5PBSY62.js";
20
+ import "./chunk-HXIYUQN2.js";
21
+ import "./chunk-JDMX4HHN.js";
22
22
  import "./chunk-EI44GEQ5.js";
23
23
  export {
24
24
  AgentSessionControls,
@@ -17,7 +17,7 @@ import {
17
17
  DropdownMenuSeparator,
18
18
  DropdownMenuTrigger
19
19
  } from "@tangle-network/ui/primitives";
20
- import { Skeleton } from "@tangle-network/ui/primitives";
20
+ import { Skeleton, useTheme } from "@tangle-network/ui/primitives";
21
21
 
22
22
  // src/dashboard/sidebar-context.tsx
23
23
  import * as React from "react";
@@ -142,6 +142,41 @@ function LogOutIcon({ className }) {
142
142
  /* @__PURE__ */ jsx2("line", { x1: "21", x2: "9", y1: "12", y2: "12" })
143
143
  ] });
144
144
  }
145
+ function SunIcon({ className }) {
146
+ return /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className, children: [
147
+ /* @__PURE__ */ jsx2("title", { children: "Light mode icon" }),
148
+ /* @__PURE__ */ jsx2("circle", { cx: "12", cy: "12", r: "4" }),
149
+ /* @__PURE__ */ jsx2("path", { d: "M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41" })
150
+ ] });
151
+ }
152
+ function MoonIcon({ className }) {
153
+ return /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className, children: [
154
+ /* @__PURE__ */ jsx2("title", { children: "Dark mode icon" }),
155
+ /* @__PURE__ */ jsx2("path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" })
156
+ ] });
157
+ }
158
+ function RailThemeToggle({ className }) {
159
+ const { theme, setTheme } = useTheme();
160
+ const [mounted, setMounted] = React2.useState(false);
161
+ React2.useEffect(() => setMounted(true), []);
162
+ const isDark = mounted && (theme === "dark" || theme === "system" && typeof window !== "undefined" && window.matchMedia("(prefers-color-scheme: dark)").matches);
163
+ return /* @__PURE__ */ jsx2(
164
+ "button",
165
+ {
166
+ type: "button",
167
+ onClick: () => setTheme(isDark ? "light" : "dark"),
168
+ "aria-label": "Toggle theme",
169
+ title: isDark ? "Switch to light mode" : "Switch to dark mode",
170
+ className: cn(
171
+ "flex h-9 w-9 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition-colors",
172
+ "hover:bg-[var(--accent-surface-soft)] hover:text-[var(--accent-text)]",
173
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",
174
+ className
175
+ ),
176
+ children: isDark ? /* @__PURE__ */ jsx2(SunIcon, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx2(MoonIcon, { className: "h-4 w-4" })
177
+ }
178
+ );
179
+ }
145
180
  function Sidebar({ children, className, style }) {
146
181
  const { panelOpen, hidden, hasPanels, railWidth } = useSidebar();
147
182
  return /* @__PURE__ */ jsx2(
@@ -174,20 +209,20 @@ function SidebarRail({ children, className, wide = false }) {
174
209
  );
175
210
  }
176
211
  function SidebarRailHeader({ children, className }) {
177
- return /* @__PURE__ */ jsx2("div", { className: cn("flex h-14 items-center justify-center border-b border-border", className), children });
212
+ return /* @__PURE__ */ jsx2("div", { className: cn("flex h-14 shrink-0 items-center justify-center border-b border-border", className), children });
178
213
  }
179
214
  function SidebarRailNav({ children, className }) {
180
- return /* @__PURE__ */ jsx2("nav", { className: cn("flex flex-col items-center gap-1 py-3 flex-1", className), children });
215
+ return /* @__PURE__ */ jsx2("nav", { className: cn("flex flex-col items-center gap-1 py-3 flex-1 min-h-0 overflow-y-auto", className), children });
181
216
  }
182
217
  function SidebarRailFooter({ children, className }) {
183
- return /* @__PURE__ */ jsx2("div", { className: cn("flex flex-col items-center gap-1 pb-3", className), children });
218
+ return /* @__PURE__ */ jsx2("div", { className: cn("flex flex-col items-center gap-1 pb-3 shrink-0", className), children });
184
219
  }
185
220
  function RailSeparator({ className }) {
186
221
  return /* @__PURE__ */ jsx2("div", { className: cn("my-2 h-px w-10 bg-[var(--md3-outline-variant)]", className) });
187
222
  }
188
223
  function RailButton({ icon: Icon, label, isActive, badge, onClick, className, showLabel, asChild, children }) {
189
224
  const classes = cn(
190
- "group relative flex items-center justify-center rounded-xl transition-all duration-200",
225
+ "group relative flex shrink-0 items-center justify-center rounded-xl transition-all duration-200",
191
226
  showLabel ? "w-full justify-start px-3 h-11 gap-3" : "w-11 h-11 justify-center",
192
227
  "hover:bg-[var(--accent-surface-soft)] hover:text-[var(--accent-text)]",
193
228
  "active:scale-95",
@@ -289,13 +324,7 @@ function ProfileAvatar({
289
324
  user?.avatarUrl && /* @__PURE__ */ jsx2(AvatarImage, { src: user.avatarUrl, alt: "" }),
290
325
  /* @__PURE__ */ jsx2(AvatarFallback, { className: "text-[10px] bg-violet-500/20 text-violet-300", children: getInitials(user?.name, user?.email) })
291
326
  ] }),
292
- showDetails && /* @__PURE__ */ jsx2("div", { className: "min-w-0 flex-1", children: isLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
293
- /* @__PURE__ */ jsx2(Skeleton, { className: "mb-1 h-3.5 w-20" }),
294
- /* @__PURE__ */ jsx2(Skeleton, { className: "h-3 w-28" })
295
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
296
- /* @__PURE__ */ jsx2("p", { className: "truncate text-sm font-medium text-foreground", children: user?.name ?? user?.email ?? "Not signed in" }),
297
- user?.email && user?.name && /* @__PURE__ */ jsx2("p", { className: "truncate text-xs text-muted-foreground", children: user.email })
298
- ] }) })
327
+ showDetails && /* @__PURE__ */ jsx2("div", { className: "min-w-0 flex-1", children: isLoading ? /* @__PURE__ */ jsx2(Skeleton, { className: "h-3.5 w-24" }) : /* @__PURE__ */ jsx2("p", { className: "truncate text-sm font-medium text-foreground", children: user?.name ?? user?.email ?? "Not signed in" }) })
299
328
  ]
300
329
  }
301
330
  ) }),
@@ -1562,6 +1591,7 @@ function SidebarLayoutInner({
1562
1591
  onSettingsClick,
1563
1592
  settingsHref,
1564
1593
  profileMenuItems,
1594
+ showThemeToggle = false,
1565
1595
  railFooter,
1566
1596
  LinkComponent,
1567
1597
  hideBelow,
@@ -1603,19 +1633,29 @@ function SidebarLayoutInner({
1603
1633
  ) }),
1604
1634
  (railFooter !== void 0 || hasProfile) && /* @__PURE__ */ jsxs13(SidebarRailFooter, { className: cn("border-t border-border pt-2", railLabels && "items-stretch px-2"), children: [
1605
1635
  railFooter,
1606
- hasProfile && /* @__PURE__ */ jsx14(
1607
- ProfileAvatar,
1608
- {
1609
- user: user ?? void 0,
1610
- isLoading,
1611
- onLogout,
1612
- onSettingsClick,
1613
- settingsHref,
1614
- showDetails: railLabels,
1615
- LinkComponent: Link,
1616
- children: profileMenuItems
1617
- }
1618
- )
1636
+ hasProfile && (() => {
1637
+ const profile = /* @__PURE__ */ jsx14(
1638
+ ProfileAvatar,
1639
+ {
1640
+ user: user ?? void 0,
1641
+ isLoading,
1642
+ onLogout,
1643
+ onSettingsClick,
1644
+ settingsHref,
1645
+ showDetails: railLabels,
1646
+ LinkComponent: Link,
1647
+ children: profileMenuItems
1648
+ }
1649
+ );
1650
+ if (!showThemeToggle) return profile;
1651
+ return railLabels ? /* @__PURE__ */ jsxs13("div", { className: "flex w-full items-center gap-1", children: [
1652
+ /* @__PURE__ */ jsx14("div", { className: "min-w-0 flex-1", children: profile }),
1653
+ /* @__PURE__ */ jsx14(RailThemeToggle, {})
1654
+ ] }) : /* @__PURE__ */ jsxs13("div", { className: "flex flex-col items-center gap-1", children: [
1655
+ /* @__PURE__ */ jsx14(RailThemeToggle, {}),
1656
+ profile
1657
+ ] });
1658
+ })()
1619
1659
  ] })
1620
1660
  ] }),
1621
1661
  panel != null && /* @__PURE__ */ jsx14(SidebarPanel, { children: panel })
@@ -2177,14 +2217,14 @@ function VariantList({
2177
2217
 
2178
2218
  // src/dashboard/system-logs.tsx
2179
2219
  import { Terminal as Terminal3 } from "lucide-react";
2180
- import { useEffect as useEffect2, useRef as useRef2, useState as useState4 } from "react";
2220
+ import { useEffect as useEffect3, useRef as useRef2, useState as useState5 } from "react";
2181
2221
  import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
2182
2222
  function SystemLogsViewer({ apiUrl, token, className }) {
2183
- const [logs, setLogs] = useState4([]);
2184
- const [error, setError] = useState4(null);
2185
- const [isFollowing, setIsFollowing] = useState4(true);
2223
+ const [logs, setLogs] = useState5([]);
2224
+ const [error, setError] = useState5(null);
2225
+ const [isFollowing, setIsFollowing] = useState5(true);
2186
2226
  const scrollRef = useRef2(null);
2187
- useEffect2(() => {
2227
+ useEffect3(() => {
2188
2228
  let timeoutId;
2189
2229
  let backoff = 2e3;
2190
2230
  const controller = new AbortController();
@@ -2220,7 +2260,7 @@ function SystemLogsViewer({ apiUrl, token, className }) {
2220
2260
  clearTimeout(timeoutId);
2221
2261
  };
2222
2262
  }, [apiUrl, token]);
2223
- useEffect2(() => {
2263
+ useEffect3(() => {
2224
2264
  if (isFollowing && scrollRef.current) {
2225
2265
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
2226
2266
  }
@@ -1,10 +1,11 @@
1
1
  import {
2
- HARNESS_OPTIONS
3
- } from "./chunk-ESRYVGHF.js";
2
+ HARNESS_OPTIONS,
3
+ HarnessLogo
4
+ } from "./chunk-HXIYUQN2.js";
4
5
  import {
5
6
  ModelPicker,
6
7
  canonicalModelId
7
- } from "./chunk-4KAPMTPU.js";
8
+ } from "./chunk-JDMX4HHN.js";
8
9
  import {
9
10
  cn
10
11
  } from "./chunk-EI44GEQ5.js";
@@ -22,8 +23,38 @@ import {
22
23
 
23
24
  // src/chat/reasoning-level-picker.tsx
24
25
  import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
25
- import { Brain, ChevronDown } from "lucide-react";
26
+ import { Brain, ChevronDown, Sparkles } from "lucide-react";
26
27
  import { jsx, jsxs } from "react/jsx-runtime";
28
+ var INTENSITY_BARS = {
29
+ low: 1,
30
+ medium: 2,
31
+ high: 3
32
+ };
33
+ function ReasoningGlyph({ level }) {
34
+ if (level === "auto") {
35
+ return /* @__PURE__ */ jsx(Sparkles, { className: "h-3.5 w-3.5 text-muted-foreground" });
36
+ }
37
+ const filled = INTENSITY_BARS[level];
38
+ return /* @__PURE__ */ jsx(
39
+ "span",
40
+ {
41
+ "aria-hidden": true,
42
+ className: "inline-flex h-3.5 items-end gap-px",
43
+ style: { width: 14 },
44
+ children: [0, 1, 2].map((i) => /* @__PURE__ */ jsx(
45
+ "span",
46
+ {
47
+ className: cn(
48
+ "w-1 rounded-[1px]",
49
+ i < filled ? "bg-foreground" : "bg-border"
50
+ ),
51
+ style: { height: `${40 + i * 30}%` }
52
+ },
53
+ i
54
+ ))
55
+ }
56
+ );
57
+ }
27
58
  var DEFAULT_REASONING_LEVEL_OPTIONS = [
28
59
  { value: "auto", label: "Auto", description: "Let the agent pick the right depth." },
29
60
  { value: "low", label: "Low", description: "Fast, direct answers." },
@@ -83,13 +114,16 @@ function ReasoningLevelPicker({
83
114
  onChange(option.value);
84
115
  },
85
116
  className: cn(
86
- "flex cursor-pointer flex-col gap-0.5 rounded-md px-2.5 py-2 outline-none",
117
+ "flex cursor-pointer items-start gap-2.5 rounded-md px-2.5 py-2 outline-none",
87
118
  "transition-colors hover:bg-accent/40 focus:bg-accent/40",
88
119
  option.value === value && "bg-[var(--accent-surface-soft)] text-[var(--accent-text)]"
89
120
  ),
90
121
  children: [
91
- /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: option.label }),
92
- /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: option.description })
122
+ /* @__PURE__ */ jsx("span", { className: "mt-0.5 flex w-3.5 shrink-0 justify-center", children: /* @__PURE__ */ jsx(ReasoningGlyph, { level: option.value }) }),
123
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-col gap-0.5", children: [
124
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: option.label }),
125
+ /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: option.description })
126
+ ] })
93
127
  ]
94
128
  },
95
129
  option.value
@@ -101,7 +135,7 @@ function ReasoningLevelPicker({
101
135
 
102
136
  // src/chat/agent-session-controls.tsx
103
137
  import * as DropdownMenu2 from "@radix-ui/react-dropdown-menu";
104
- import { Bot, ChevronDown as ChevronDown2, Lock } from "lucide-react";
138
+ import { ChevronDown as ChevronDown2, Lock } from "lucide-react";
105
139
 
106
140
  // src/chat/harness-model-compat.ts
107
141
  var HARNESS_MODEL_POLICIES = {
@@ -122,11 +156,19 @@ var HARNESS_MODEL_POLICIES = {
122
156
  },
123
157
  amp: { providers: null, preferred: [] },
124
158
  "factory-droids": { providers: null, preferred: [] },
125
- "cli-base": { providers: null, preferred: [] }
159
+ "cli-base": { providers: null, preferred: [] },
160
+ "kimi-code": {
161
+ providers: ["moonshot"],
162
+ preferred: [/^moonshot\//]
163
+ },
164
+ openclaw: { providers: null, preferred: [] },
165
+ nanoclaw: { providers: null, preferred: [] },
166
+ hermes: { providers: null, preferred: [] }
126
167
  };
127
168
  var PROVIDER_PREFERRED_HARNESS = {
128
169
  anthropic: "claude-code",
129
- openai: "codex"
170
+ openai: "codex",
171
+ moonshot: "kimi-code"
130
172
  };
131
173
  function modelProvider(modelId) {
132
174
  const slash = modelId.indexOf("/");
@@ -193,7 +235,7 @@ function HarnessDropdown({
193
235
  ),
194
236
  "aria-label": "Agent harness",
195
237
  children: [
196
- locked ? /* @__PURE__ */ jsx2(Lock, { className: "h-3 w-3 text-muted-foreground" }) : /* @__PURE__ */ jsx2(Bot, { className: "h-3.5 w-3.5 text-muted-foreground" }),
238
+ locked ? /* @__PURE__ */ jsx2(Lock, { className: "h-3 w-3 text-muted-foreground" }) : /* @__PURE__ */ jsx2(HarnessLogo, { type: value, size: 16 }),
197
239
  /* @__PURE__ */ jsx2("span", { children: selected?.label ?? value }),
198
240
  !locked && /* @__PURE__ */ jsx2(ChevronDown2, { className: "h-3.5 w-3.5 text-muted-foreground" })
199
241
  ]
@@ -219,13 +261,16 @@ function HarnessDropdown({
219
261
  onChange(option.type);
220
262
  },
221
263
  className: cn(
222
- "flex cursor-pointer flex-col gap-0.5 rounded-md px-2.5 py-2 outline-none",
264
+ "flex cursor-pointer items-start gap-2.5 rounded-md px-2.5 py-2 outline-none",
223
265
  "transition-colors hover:bg-accent/40 focus:bg-accent/40",
224
266
  option.type === value && "bg-[var(--accent-surface-soft)] text-[var(--accent-text)]"
225
267
  ),
226
268
  children: [
227
- /* @__PURE__ */ jsx2("span", { className: "text-sm font-medium", children: option.label }),
228
- option.description && /* @__PURE__ */ jsx2("span", { className: "text-xs text-muted-foreground", children: option.description })
269
+ /* @__PURE__ */ jsx2(HarnessLogo, { type: option.type, size: 20, className: "mt-0.5" }),
270
+ /* @__PURE__ */ jsxs2("span", { className: "flex min-w-0 flex-col gap-0.5", children: [
271
+ /* @__PURE__ */ jsx2("span", { className: "text-sm font-medium", children: option.label }),
272
+ option.description && /* @__PURE__ */ jsx2("span", { className: "text-xs text-muted-foreground", children: option.description })
273
+ ] })
229
274
  ]
230
275
  },
231
276
  option.type
@@ -300,7 +345,7 @@ function AgentSessionControls({
300
345
 
301
346
  // src/chat/artifact-agent-dock.tsx
302
347
  import * as React from "react";
303
- import { Sparkles, Send, Square, X } from "lucide-react";
348
+ import { Sparkles as Sparkles2, Send, Square, X } from "lucide-react";
304
349
  import { ChatMessage } from "@tangle-network/ui/chat";
305
350
  import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
306
351
  function defaultScopeLabel(scope) {
@@ -479,7 +524,7 @@ function ArtifactAgentDock({
479
524
  children: [
480
525
  /* @__PURE__ */ jsxs3("header", { className: "flex items-center justify-between border-b border-border bg-background/60 px-4 py-3", children: [
481
526
  /* @__PURE__ */ jsxs3("div", { className: "flex min-w-0 items-center gap-2", children: [
482
- /* @__PURE__ */ jsx3(Sparkles, { className: "h-4 w-4 shrink-0 text-primary" }),
527
+ /* @__PURE__ */ jsx3(Sparkles2, { className: "h-4 w-4 shrink-0 text-primary" }),
483
528
  /* @__PURE__ */ jsxs3("div", { className: "min-w-0", children: [
484
529
  /* @__PURE__ */ jsx3("div", { className: "text-[10px] font-medium uppercase tracking-wider text-muted-foreground", children: "Discussing" }),
485
530
  /* @__PURE__ */ jsx3("div", { className: "truncate text-sm font-semibold text-foreground", children: heading })
@@ -497,7 +542,7 @@ function ArtifactAgentDock({
497
542
  )
498
543
  ] }),
499
544
  /* @__PURE__ */ jsx3("div", { ref: scrollRef, className: "flex-1 overflow-y-auto px-3 py-4", children: loading ? /* @__PURE__ */ jsx3("div", { className: "px-3 py-8 text-center text-xs text-muted-foreground", children: "Loading conversation\u2026" }) : messages.length === 0 && !streamContent ? /* @__PURE__ */ jsxs3("div", { className: "px-3 py-12 text-center", children: [
500
- /* @__PURE__ */ jsx3(Sparkles, { className: "mx-auto mb-3 h-5 w-5 text-muted-foreground/40" }),
545
+ /* @__PURE__ */ jsx3(Sparkles2, { className: "mx-auto mb-3 h-5 w-5 text-muted-foreground/40" }),
501
546
  /* @__PURE__ */ jsxs3("p", { className: "text-sm text-foreground", children: [
502
547
  "Ask the agent about this ",
503
548
  scope.kind === "vault-file" ? "document" : scope.kind,