@tangle-network/agent-app 0.60.231 → 0.60.233
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/assistant/index.js +8 -8
- package/dist/chat-react/index.js +4 -4
- package/dist/chat-routes/index.js +6 -8
- package/dist/chat-routes/index.js.map +1 -1
- package/dist/{chunk-5IS3GCMR.js → chunk-232KA6MR.js} +3 -3
- package/dist/{chunk-KMIDRUUH.js → chunk-35APKGPB.js} +2 -2
- package/dist/{chunk-GNBBY3KN.js → chunk-3K45OQ5X.js} +3 -3
- package/dist/{chunk-A3CUVYRZ.js → chunk-4JAXSEYW.js} +3 -3
- package/dist/{chunk-BKVDPMFD.js → chunk-BBYUWYEL.js} +2 -2
- package/dist/{chunk-DA5XLDZR.js → chunk-BNFUJNPS.js} +4 -4
- package/dist/{chunk-7QZNHBQT.js → chunk-DUGIVKNA.js} +215 -2
- package/dist/chunk-DUGIVKNA.js.map +1 -0
- package/dist/{chunk-J63KUZBE.js → chunk-F5FFOIS5.js} +6 -3
- package/dist/chunk-F5FFOIS5.js.map +1 -0
- package/dist/{chunk-BQILMP73.js → chunk-FJEGGUOQ.js} +2 -2
- package/dist/{chunk-TEIKC276.js → chunk-GMC5DO2O.js} +3 -3
- package/dist/{chunk-HEPEGY6Q.js → chunk-JYVUFRRV.js} +2 -2
- package/dist/{chunk-JILHXHJE.js → chunk-K7SKQ7GY.js} +2 -2
- package/dist/{chunk-RMPPWNW7.js → chunk-MX3RI3MO.js} +6 -10
- package/dist/{chunk-RMPPWNW7.js.map → chunk-MX3RI3MO.js.map} +1 -1
- package/dist/{chunk-XG6FODYO.js → chunk-XIN7DOAB.js} +108 -100
- package/dist/chunk-XIN7DOAB.js.map +1 -0
- package/dist/{mention-editor-NOS5R3AU.js → mention-editor-6FJ6HRSN.js} +2 -2
- package/dist/public-consultation/index.d.ts +1 -1
- package/dist/public-consultation/index.js +2 -4
- package/dist/public-consultation/index.js.map +1 -1
- package/dist/runtime/index.js +4 -5
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/router-turn.js +3 -4
- package/dist/sandbox/index.js +3 -3
- package/dist/settings-react/index.js +1 -1
- package/dist/studio-react/index.js +2 -2
- package/dist/turn-trace/index.js +8 -12
- package/dist/web-react/agent-profile-editor.js +4 -4
- package/dist/web-react/control-glyphs.d.ts +20 -0
- package/dist/web-react/controls.d.ts +6 -358
- package/dist/web-react/effort-picker.d.ts +98 -0
- package/dist/web-react/index.js +8 -8
- package/dist/web-react/model-picker.d.ts +67 -0
- package/dist/web-react/picker-presentation.d.ts +89 -0
- package/dist/web-react/popover-surface.d.ts +89 -0
- package/dist/web-react/use-pending.d.ts +11 -0
- package/dist/workspace-react/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-7QZNHBQT.js.map +0 -1
- package/dist/chunk-J63KUZBE.js.map +0 -1
- package/dist/chunk-LHGYK5I3.js +0 -160
- package/dist/chunk-LHGYK5I3.js.map +0 -1
- package/dist/chunk-PIUYJTTK.js +0 -63
- package/dist/chunk-PIUYJTTK.js.map +0 -1
- package/dist/chunk-XG6FODYO.js.map +0 -1
- /package/dist/{chunk-5IS3GCMR.js.map → chunk-232KA6MR.js.map} +0 -0
- /package/dist/{chunk-KMIDRUUH.js.map → chunk-35APKGPB.js.map} +0 -0
- /package/dist/{chunk-GNBBY3KN.js.map → chunk-3K45OQ5X.js.map} +0 -0
- /package/dist/{chunk-A3CUVYRZ.js.map → chunk-4JAXSEYW.js.map} +0 -0
- /package/dist/{chunk-BKVDPMFD.js.map → chunk-BBYUWYEL.js.map} +0 -0
- /package/dist/{chunk-DA5XLDZR.js.map → chunk-BNFUJNPS.js.map} +0 -0
- /package/dist/{chunk-BQILMP73.js.map → chunk-FJEGGUOQ.js.map} +0 -0
- /package/dist/{chunk-TEIKC276.js.map → chunk-GMC5DO2O.js.map} +0 -0
- /package/dist/{chunk-HEPEGY6Q.js.map → chunk-JYVUFRRV.js.map} +0 -0
- /package/dist/{chunk-JILHXHJE.js.map → chunk-K7SKQ7GY.js.map} +0 -0
- /package/dist/{mention-editor-NOS5R3AU.js.map → mention-editor-6FJ6HRSN.js.map} +0 -0
|
@@ -6,20 +6,8 @@ import {
|
|
|
6
6
|
sortModelsByFreshness
|
|
7
7
|
} from "./chunk-AMUXRAUO.js";
|
|
8
8
|
|
|
9
|
-
// src/web-react/
|
|
10
|
-
import {
|
|
11
|
-
useCallback,
|
|
12
|
-
useEffect,
|
|
13
|
-
useId,
|
|
14
|
-
useLayoutEffect,
|
|
15
|
-
useMemo,
|
|
16
|
-
useRef,
|
|
17
|
-
useState
|
|
18
|
-
} from "react";
|
|
19
|
-
import { createPortal } from "react-dom";
|
|
20
|
-
import { StatusPill } from "@tangle-network/ui/primitives";
|
|
21
|
-
import { fieldPresentation, fieldSizes, fieldTouchText } from "@tangle-network/ui/presentation";
|
|
22
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
// src/web-react/control-glyphs.tsx
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
23
11
|
function ChevronDown({ className }) {
|
|
24
12
|
return /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" }) });
|
|
25
13
|
}
|
|
@@ -47,6 +35,11 @@ function BrainGlyph({ className }) {
|
|
|
47
35
|
function CheckGlyph({ className }) {
|
|
48
36
|
return /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" }) });
|
|
49
37
|
}
|
|
38
|
+
|
|
39
|
+
// src/web-react/popover-surface.tsx
|
|
40
|
+
import { useCallback, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
41
|
+
import { createPortal } from "react-dom";
|
|
42
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
50
43
|
function usePopover(open, setOpen) {
|
|
51
44
|
const containerRef = useRef(null);
|
|
52
45
|
const triggerRef = useRef(null);
|
|
@@ -166,7 +159,7 @@ function PopoverSurface({
|
|
|
166
159
|
const ownerPath = triggerRef.current?.closest?.(`[${POPOVER_SURFACE_ATTR}]`)?.getAttribute(POPOVER_SURFACE_ATTR);
|
|
167
160
|
const path = ownerPath ? `${ownerPath}${POPOVER_PATH_SEPARATOR}${surfaceId}` : surfaceId;
|
|
168
161
|
return createPortal(
|
|
169
|
-
/* @__PURE__ */
|
|
162
|
+
/* @__PURE__ */ jsx2(
|
|
170
163
|
"div",
|
|
171
164
|
{
|
|
172
165
|
ref: panelRef,
|
|
@@ -182,6 +175,9 @@ function PopoverSurface({
|
|
|
182
175
|
document.body
|
|
183
176
|
);
|
|
184
177
|
}
|
|
178
|
+
|
|
179
|
+
// src/web-react/picker-presentation.ts
|
|
180
|
+
import { fieldPresentation, fieldSizes, fieldTouchText } from "@tangle-network/ui/presentation";
|
|
185
181
|
var POPOVER_OPTION_FOCUS = "focus-visible:[outline-offset:-2px]";
|
|
186
182
|
var OVERLAY_SHADOW = "shadow-[var(--shadow-overlay)]";
|
|
187
183
|
function pickerRootClass(fullWidth) {
|
|
@@ -196,11 +192,14 @@ var QUIET_PICKER_TRIGGER_INTERACTIVE = "hover:bg-accent hover:text-foreground da
|
|
|
196
192
|
function quietPickerTriggerClass({ interactive = true } = {}) {
|
|
197
193
|
return interactive ? `${QUIET_PICKER_TRIGGER_BASE} ${QUIET_PICKER_TRIGGER_INTERACTIVE}` : `${QUIET_PICKER_TRIGGER_BASE} cursor-default`;
|
|
198
194
|
}
|
|
195
|
+
|
|
196
|
+
// src/web-react/use-pending.ts
|
|
197
|
+
import { useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
199
198
|
function usePending() {
|
|
200
|
-
const [pending, setPending] =
|
|
201
|
-
const inFlight =
|
|
202
|
-
const mounted =
|
|
203
|
-
|
|
199
|
+
const [pending, setPending] = useState2(false);
|
|
200
|
+
const inFlight = useRef2(false);
|
|
201
|
+
const mounted = useRef2(true);
|
|
202
|
+
useEffect2(() => {
|
|
204
203
|
mounted.current = true;
|
|
205
204
|
return () => {
|
|
206
205
|
mounted.current = false;
|
|
@@ -224,6 +223,11 @@ function usePending() {
|
|
|
224
223
|
};
|
|
225
224
|
return { pending, run };
|
|
226
225
|
}
|
|
226
|
+
|
|
227
|
+
// src/web-react/model-picker.tsx
|
|
228
|
+
import { useCallback as useCallback2, useEffect as useEffect3, useId as useId2, useMemo, useRef as useRef3, useState as useState3 } from "react";
|
|
229
|
+
import { StatusPill } from "@tangle-network/ui/primitives";
|
|
230
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
227
231
|
function formatPrice(p) {
|
|
228
232
|
if (!p) return void 0;
|
|
229
233
|
const n = Number(p);
|
|
@@ -256,7 +260,7 @@ function logoBrand(model) {
|
|
|
256
260
|
return model.maker?.trim() || model.provider;
|
|
257
261
|
}
|
|
258
262
|
function SectionHeader({ children }) {
|
|
259
|
-
return /* @__PURE__ */
|
|
263
|
+
return /* @__PURE__ */ jsx3("div", { className: "px-3 pb-1 pt-3 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children });
|
|
260
264
|
}
|
|
261
265
|
function ModelRow({
|
|
262
266
|
model,
|
|
@@ -271,7 +275,7 @@ function ModelRow({
|
|
|
271
275
|
const unavailable = model.status === "unavailable";
|
|
272
276
|
const flagged = unavailable || model.status === "limited";
|
|
273
277
|
const capability = model.capability ?? (flagged ? model.statusReason : void 0);
|
|
274
|
-
return /* @__PURE__ */
|
|
278
|
+
return /* @__PURE__ */ jsxs2(
|
|
275
279
|
"button",
|
|
276
280
|
{
|
|
277
281
|
type: "button",
|
|
@@ -282,7 +286,7 @@ function ModelRow({
|
|
|
282
286
|
children: [
|
|
283
287
|
thumb ? (
|
|
284
288
|
// A media model shows what it makes: a 40px example beside its name.
|
|
285
|
-
/* @__PURE__ */
|
|
289
|
+
/* @__PURE__ */ jsx3(
|
|
286
290
|
"img",
|
|
287
291
|
{
|
|
288
292
|
src: thumb,
|
|
@@ -293,21 +297,21 @@ function ModelRow({
|
|
|
293
297
|
className: `size-10 shrink-0 rounded-md border border-border object-cover${unavailable ? " opacity-50" : ""}`
|
|
294
298
|
}
|
|
295
299
|
)
|
|
296
|
-
) : /* @__PURE__ */
|
|
297
|
-
/* @__PURE__ */
|
|
298
|
-
/* @__PURE__ */
|
|
299
|
-
thumb && /* @__PURE__ */
|
|
300
|
-
/* @__PURE__ */
|
|
301
|
-
flagged && /* @__PURE__ */
|
|
300
|
+
) : /* @__PURE__ */ jsx3("span", { className: "shrink-0", "aria-hidden": true, children: renderProviderBadge ? renderProviderBadge(logoBrand(model)) : /* @__PURE__ */ jsx3(ProviderLogo, { provider: logoBrand(model), size: 16 }) }),
|
|
301
|
+
/* @__PURE__ */ jsxs2("span", { className: "min-w-0 flex-1", children: [
|
|
302
|
+
/* @__PURE__ */ jsxs2("span", { className: "flex min-w-0 items-center gap-1.5", children: [
|
|
303
|
+
thumb && /* @__PURE__ */ jsx3("span", { className: "shrink-0", "aria-hidden": true, children: renderProviderBadge ? renderProviderBadge(logoBrand(model)) : /* @__PURE__ */ jsx3(ProviderLogo, { provider: logoBrand(model), size: 14 }) }),
|
|
304
|
+
/* @__PURE__ */ jsx3("span", { className: `min-w-0 break-words [overflow-wrap:anywhere]${unavailable ? " text-muted-foreground" : ""}`, children: model.name }),
|
|
305
|
+
flagged && /* @__PURE__ */ jsx3(StatusPill, { tone: "warning", size: "sm", className: "shrink-0", title: model.statusReason, "data-model-status": model.status, children: unavailable ? "Unavailable" : "Limited" })
|
|
302
306
|
] }),
|
|
303
|
-
capability && /* @__PURE__ */
|
|
304
|
-
(ctx || price || !media && !model.supportsTools) && /* @__PURE__ */
|
|
305
|
-
!media && !model.supportsTools && /* @__PURE__ */
|
|
306
|
-
!media && ctx && /* @__PURE__ */
|
|
307
|
-
price && /* @__PURE__ */
|
|
307
|
+
capability && /* @__PURE__ */ jsx3("span", { className: "mt-0.5 block truncate text-xs font-normal text-muted-foreground", "data-model-capability": true, children: capability }),
|
|
308
|
+
(ctx || price || !media && !model.supportsTools) && /* @__PURE__ */ jsxs2("span", { className: "mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs font-normal text-muted-foreground", children: [
|
|
309
|
+
!media && !model.supportsTools && /* @__PURE__ */ jsx3("span", { className: "rounded bg-secondary px-1.5 py-0.5", children: "no tools" }),
|
|
310
|
+
!media && ctx && /* @__PURE__ */ jsx3("span", { children: ctx }),
|
|
311
|
+
price && /* @__PURE__ */ jsx3("span", { "data-model-price": true, children: price })
|
|
308
312
|
] })
|
|
309
313
|
] }),
|
|
310
|
-
selected && /* @__PURE__ */
|
|
314
|
+
selected && /* @__PURE__ */ jsx3(CheckGlyph, { className: "h-3.5 w-3.5 shrink-0 text-primary" })
|
|
311
315
|
]
|
|
312
316
|
}
|
|
313
317
|
);
|
|
@@ -331,10 +335,10 @@ function ModelPicker({
|
|
|
331
335
|
triggerContent,
|
|
332
336
|
defaultOption
|
|
333
337
|
}) {
|
|
334
|
-
const [open, setOpen] =
|
|
335
|
-
const [query, setQuery] =
|
|
336
|
-
const [showAll, setShowAll] =
|
|
337
|
-
const changeOpen =
|
|
338
|
+
const [open, setOpen] = useState3(false);
|
|
339
|
+
const [query, setQuery] = useState3("");
|
|
340
|
+
const [showAll, setShowAll] = useState3(false);
|
|
341
|
+
const changeOpen = useCallback2((next) => {
|
|
338
342
|
setOpen(next && !disabled);
|
|
339
343
|
if (!next) {
|
|
340
344
|
setQuery("");
|
|
@@ -343,19 +347,19 @@ function ModelPicker({
|
|
|
343
347
|
}, [disabled]);
|
|
344
348
|
const expanded = open && !disabled;
|
|
345
349
|
const { containerRef, triggerRef, panelRef, triggerProps } = usePopover(expanded, changeOpen);
|
|
346
|
-
const inputRef =
|
|
347
|
-
const panelId =
|
|
348
|
-
const valueId =
|
|
350
|
+
const inputRef = useRef3(null);
|
|
351
|
+
const panelId = useId2();
|
|
352
|
+
const valueId = useId2();
|
|
349
353
|
const unavailable = error != null;
|
|
350
354
|
const sortedModels = useMemo(() => sortModelsByFreshness(models), [models]);
|
|
351
355
|
const contentKey = useMemo(
|
|
352
356
|
() => ({ query, showAll, loading, error, models, value, priorityGroup }),
|
|
353
357
|
[query, showAll, loading, error, models, value, priorityGroup]
|
|
354
358
|
);
|
|
355
|
-
|
|
359
|
+
useEffect3(() => {
|
|
356
360
|
if (disabled) changeOpen(false);
|
|
357
361
|
}, [disabled, changeOpen]);
|
|
358
|
-
|
|
362
|
+
useEffect3(() => {
|
|
359
363
|
if (!expanded) return;
|
|
360
364
|
const focus = () => inputRef.current?.focus();
|
|
361
365
|
focus();
|
|
@@ -363,7 +367,7 @@ function ModelPicker({
|
|
|
363
367
|
const frame = requestAnimationFrame(focus);
|
|
364
368
|
return () => cancelAnimationFrame(frame);
|
|
365
369
|
}, [expanded]);
|
|
366
|
-
|
|
370
|
+
useEffect3(() => {
|
|
367
371
|
const panel = panelRef.current;
|
|
368
372
|
if (!expanded || !panel) return;
|
|
369
373
|
function onKeyDown(event) {
|
|
@@ -425,9 +429,9 @@ function ModelPicker({
|
|
|
425
429
|
triggerRef.current?.focus();
|
|
426
430
|
onChange(modelId);
|
|
427
431
|
};
|
|
428
|
-
const row = (model) => /* @__PURE__ */
|
|
429
|
-
return /* @__PURE__ */
|
|
430
|
-
/* @__PURE__ */
|
|
432
|
+
const row = (model) => /* @__PURE__ */ jsx3(ModelRow, { model, selected: model.id === value, onSelect: () => select(model.id), renderProviderBadge }, model.id);
|
|
433
|
+
return /* @__PURE__ */ jsxs2("div", { ref: containerRef, className: variant === "field" ? "relative flex w-full min-w-0" : "relative inline-flex min-w-0 max-w-full", children: [
|
|
434
|
+
/* @__PURE__ */ jsxs2(
|
|
431
435
|
"button",
|
|
432
436
|
{
|
|
433
437
|
type: "button",
|
|
@@ -450,19 +454,19 @@ function ModelPicker({
|
|
|
450
454
|
"data-state": expanded ? "open" : "closed",
|
|
451
455
|
className: `${variant === "field" ? fieldPickerTriggerClass({ interactive: !disabled }) : variant === "quiet" ? quietPickerTriggerClass({ interactive: !disabled }) : `${CHIP_PICKER_TRIGGER} ${disabled ? "" : "hover:bg-accent"}`} max-w-full disabled:cursor-not-allowed disabled:opacity-50`,
|
|
452
456
|
children: [
|
|
453
|
-
triggerContent ?? /* @__PURE__ */
|
|
454
|
-
/* @__PURE__ */
|
|
455
|
-
/* @__PURE__ */
|
|
457
|
+
triggerContent ?? /* @__PURE__ */ jsxs2("span", { className: variant === "field" ? "flex min-w-0 flex-1 items-center gap-2" : "contents", children: [
|
|
458
|
+
/* @__PURE__ */ jsx3("span", { className: "shrink-0", "aria-hidden": true, children: selected ? renderProviderBadge ? renderProviderBadge(logoBrand(selected)) : /* @__PURE__ */ jsx3(ProviderLogo, { provider: logoBrand(selected), size: 16 }) : /* @__PURE__ */ jsx3(SparkleGlyph, { className: "h-3.5 w-3.5 text-muted-foreground" }) }),
|
|
459
|
+
/* @__PURE__ */ jsx3("span", { className: variant === "field" ? `min-w-0 flex-1 truncate ${value ? "" : "text-muted-foreground"}` : "max-w-[160px] truncate", children: selectedLabel || defaultOption?.label || "Select model" })
|
|
456
460
|
] }),
|
|
457
|
-
/* @__PURE__ */
|
|
461
|
+
/* @__PURE__ */ jsx3(ChevronDown, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" })
|
|
458
462
|
]
|
|
459
463
|
}
|
|
460
464
|
),
|
|
461
|
-
describeValue && value && /* @__PURE__ */
|
|
465
|
+
describeValue && value && /* @__PURE__ */ jsxs2("span", { id: valueId, className: "sr-only", children: [
|
|
462
466
|
"Selected model: ",
|
|
463
467
|
selectedLabel
|
|
464
468
|
] }),
|
|
465
|
-
/* @__PURE__ */
|
|
469
|
+
/* @__PURE__ */ jsxs2(
|
|
466
470
|
PopoverSurface,
|
|
467
471
|
{
|
|
468
472
|
open: expanded,
|
|
@@ -476,9 +480,9 @@ function ModelPicker({
|
|
|
476
480
|
side: variant === "field" ? "below" : void 0,
|
|
477
481
|
className: `flex w-[420px] max-w-[calc(100vw-2rem)] flex-col overflow-hidden rounded-xl border border-card-edge bg-popover text-foreground ${OVERLAY_SHADOW}`,
|
|
478
482
|
children: [
|
|
479
|
-
/* @__PURE__ */
|
|
480
|
-
/* @__PURE__ */
|
|
481
|
-
/* @__PURE__ */
|
|
483
|
+
/* @__PURE__ */ jsx3("div", { className: "shrink-0 border-b border-border px-3 py-2", children: /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 rounded-lg border border-strong bg-background px-3 py-2 focus-within:ring-2 focus-within:ring-ring", children: [
|
|
484
|
+
/* @__PURE__ */ jsx3(SearchGlyph, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
485
|
+
/* @__PURE__ */ jsx3(
|
|
482
486
|
"input",
|
|
483
487
|
{
|
|
484
488
|
ref: inputRef,
|
|
@@ -491,8 +495,8 @@ function ModelPicker({
|
|
|
491
495
|
}
|
|
492
496
|
)
|
|
493
497
|
] }) }),
|
|
494
|
-
/* @__PURE__ */
|
|
495
|
-
defaultOption && !query.trim() && /* @__PURE__ */
|
|
498
|
+
/* @__PURE__ */ jsxs2("div", { className: "max-h-[520px] min-h-0 overflow-y-auto p-1 pb-2", children: [
|
|
499
|
+
defaultOption && !query.trim() && /* @__PURE__ */ jsxs2(
|
|
496
500
|
"button",
|
|
497
501
|
{
|
|
498
502
|
type: "button",
|
|
@@ -500,23 +504,23 @@ function ModelPicker({
|
|
|
500
504
|
"aria-pressed": !value,
|
|
501
505
|
className: `flex w-full items-center gap-2.5 rounded-md px-3 py-2.5 text-left text-sm transition ${POPOVER_OPTION_FOCUS} ${value ? "hover:bg-accent" : "bg-primary/10 font-medium"}`,
|
|
502
506
|
children: [
|
|
503
|
-
/* @__PURE__ */
|
|
504
|
-
/* @__PURE__ */
|
|
505
|
-
!value && /* @__PURE__ */
|
|
507
|
+
/* @__PURE__ */ jsx3(SparkleGlyph, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
508
|
+
/* @__PURE__ */ jsx3("span", { className: "min-w-0 flex-1", children: defaultOption.label }),
|
|
509
|
+
!value && /* @__PURE__ */ jsx3(CheckGlyph, { className: "h-3.5 w-3.5 shrink-0 text-primary" })
|
|
506
510
|
]
|
|
507
511
|
}
|
|
508
512
|
),
|
|
509
|
-
value && !selected && /* @__PURE__ */
|
|
510
|
-
/* @__PURE__ */
|
|
511
|
-
/* @__PURE__ */
|
|
512
|
-
/* @__PURE__ */
|
|
513
|
+
value && !selected && /* @__PURE__ */ jsxs2("div", { className: "mx-2 mb-1 mt-2 rounded-lg bg-secondary px-3 py-2 text-sm", children: [
|
|
514
|
+
/* @__PURE__ */ jsx3("p", { className: "text-xs font-medium text-muted-foreground", children: "Saved model" }),
|
|
515
|
+
/* @__PURE__ */ jsx3("p", { className: "break-words [overflow-wrap:anywhere]", children: value }),
|
|
516
|
+
/* @__PURE__ */ jsx3("p", { className: "mt-1 text-xs text-muted-foreground", children: loading || unavailable ? "Your saved selection is unchanged." : "Not in this catalogue. Your saved selection is unchanged." })
|
|
513
517
|
] }),
|
|
514
|
-
loading ? /* @__PURE__ */
|
|
515
|
-
/* @__PURE__ */
|
|
516
|
-
/* @__PURE__ */
|
|
517
|
-
/* @__PURE__ */
|
|
518
|
+
loading ? /* @__PURE__ */ jsx3("div", { role: "status", className: "px-3 py-4 text-center text-sm text-muted-foreground", children: "Loading models..." }) : unavailable ? /* @__PURE__ */ jsxs2("div", { className: "px-3 py-4 text-sm", children: [
|
|
519
|
+
/* @__PURE__ */ jsxs2("div", { role: "alert", children: [
|
|
520
|
+
/* @__PURE__ */ jsx3("p", { className: "font-medium", children: "Model catalogue unavailable" }),
|
|
521
|
+
/* @__PURE__ */ jsx3("p", { className: "mt-1 break-words text-muted-foreground [overflow-wrap:anywhere]", children: error || "The catalogue could not be loaded." })
|
|
518
522
|
] }),
|
|
519
|
-
onRetry && /* @__PURE__ */
|
|
523
|
+
onRetry && /* @__PURE__ */ jsx3(
|
|
520
524
|
"button",
|
|
521
525
|
{
|
|
522
526
|
type: "button",
|
|
@@ -528,24 +532,24 @@ function ModelPicker({
|
|
|
528
532
|
children: "Retry"
|
|
529
533
|
}
|
|
530
534
|
)
|
|
531
|
-
] }) : models.length === 0 ? /* @__PURE__ */
|
|
532
|
-
filtered.length === 0 && /* @__PURE__ */
|
|
535
|
+
] }) : models.length === 0 ? /* @__PURE__ */ jsx3("div", { role: "status", className: "px-3 py-4 text-center text-sm text-muted-foreground", children: "No models available" }) : filtered ? /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
536
|
+
filtered.length === 0 && /* @__PURE__ */ jsx3("div", { role: "status", className: "px-3 py-4 text-center text-sm text-muted-foreground", children: "No models match your search" }),
|
|
533
537
|
filtered.map(row)
|
|
534
|
-
] }) : /* @__PURE__ */
|
|
535
|
-
priorityGroup && sections.priority.length > 0 && /* @__PURE__ */
|
|
536
|
-
/* @__PURE__ */
|
|
538
|
+
] }) : /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
539
|
+
priorityGroup && sections.priority.length > 0 && /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
540
|
+
/* @__PURE__ */ jsx3(SectionHeader, { children: priorityGroup.label }),
|
|
537
541
|
sections.priority.map(row)
|
|
538
542
|
] }),
|
|
539
|
-
sections.currentSelection && !showAll && /* @__PURE__ */
|
|
540
|
-
/* @__PURE__ */
|
|
543
|
+
sections.currentSelection && !showAll && /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
544
|
+
/* @__PURE__ */ jsx3(SectionHeader, { children: "Selected model" }),
|
|
541
545
|
row(sections.currentSelection)
|
|
542
546
|
] }),
|
|
543
|
-
sections.recommended.length > 0 && /* @__PURE__ */
|
|
544
|
-
/* @__PURE__ */
|
|
547
|
+
sections.recommended.length > 0 && /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
548
|
+
/* @__PURE__ */ jsx3(SectionHeader, { children: recommendedLabel }),
|
|
545
549
|
sections.recommended.map(row)
|
|
546
550
|
] }),
|
|
547
|
-
sections.recommended.length === 0 && sections.priority.length === 0 && !sections.currentSelection && /* @__PURE__ */
|
|
548
|
-
sections.byProvider.length > 0 && /* @__PURE__ */
|
|
551
|
+
sections.recommended.length === 0 && sections.priority.length === 0 && !sections.currentSelection && /* @__PURE__ */ jsx3("div", { className: "px-3 py-3 text-sm text-muted-foreground", children: "Search or browse all models" }),
|
|
552
|
+
sections.byProvider.length > 0 && /* @__PURE__ */ jsx3(
|
|
549
553
|
"button",
|
|
550
554
|
{
|
|
551
555
|
type: "button",
|
|
@@ -555,8 +559,8 @@ function ModelPicker({
|
|
|
555
559
|
children: showAll ? "Hide older models" : "Browse all models"
|
|
556
560
|
}
|
|
557
561
|
),
|
|
558
|
-
showAll && sections.byProvider.map((group) => /* @__PURE__ */
|
|
559
|
-
/* @__PURE__ */
|
|
562
|
+
showAll && sections.byProvider.map((group) => /* @__PURE__ */ jsxs2("div", { children: [
|
|
563
|
+
/* @__PURE__ */ jsx3(SectionHeader, { children: group.provider }),
|
|
560
564
|
group.items.map(row)
|
|
561
565
|
] }, group.provider))
|
|
562
566
|
] })
|
|
@@ -566,6 +570,10 @@ function ModelPicker({
|
|
|
566
570
|
)
|
|
567
571
|
] });
|
|
568
572
|
}
|
|
573
|
+
|
|
574
|
+
// src/web-react/effort-picker.tsx
|
|
575
|
+
import { useId as useId3, useState as useState4 } from "react";
|
|
576
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
569
577
|
var KNOWN_EFFORT_LABELS = {
|
|
570
578
|
off: "Off",
|
|
571
579
|
low: "Quick",
|
|
@@ -606,7 +614,7 @@ function effortMeterFill(levelId, levels = DEFAULT_EFFORT_LEVELS) {
|
|
|
606
614
|
return Math.max(1, Math.floor((index + 1) * EFFORT_METER_SEGMENTS / active.length));
|
|
607
615
|
}
|
|
608
616
|
function EffortMeter({ fill, className }) {
|
|
609
|
-
return /* @__PURE__ */
|
|
617
|
+
return /* @__PURE__ */ jsx4("span", { "aria-hidden": true, className: `inline-flex items-center gap-[2px] ${className ?? ""}`, children: Array.from({ length: EFFORT_METER_SEGMENTS }, (_, i) => /* @__PURE__ */ jsx4(
|
|
610
618
|
"span",
|
|
611
619
|
{
|
|
612
620
|
className: "h-3 w-[3px] rounded-full bg-current",
|
|
@@ -626,16 +634,16 @@ function EffortPicker({
|
|
|
626
634
|
id,
|
|
627
635
|
"aria-describedby": ariaDescribedBy
|
|
628
636
|
}) {
|
|
629
|
-
const [requestedOpen, setOpen] =
|
|
637
|
+
const [requestedOpen, setOpen] = useState4(false);
|
|
630
638
|
const open = requestedOpen && !disabled;
|
|
631
639
|
const { containerRef, triggerRef, panelRef, triggerProps } = usePopover(open, setOpen);
|
|
632
640
|
const field = variant === "field";
|
|
633
|
-
const panelId =
|
|
641
|
+
const panelId = useId3();
|
|
634
642
|
const rendered = reconcileEffortLevels(value, levels);
|
|
635
643
|
const isDeclared = (id2) => levels.some((l) => l.id === id2) && !UNPLACEABLE_LEVEL_IDS.has(id2);
|
|
636
644
|
const selected = rendered.find((l) => l.id === value);
|
|
637
|
-
return /* @__PURE__ */
|
|
638
|
-
/* @__PURE__ */
|
|
645
|
+
return /* @__PURE__ */ jsxs3("div", { ref: containerRef, className: pickerRootClass(fullWidth || field), children: [
|
|
646
|
+
/* @__PURE__ */ jsxs3(
|
|
639
647
|
"button",
|
|
640
648
|
{
|
|
641
649
|
type: "button",
|
|
@@ -649,26 +657,26 @@ function EffortPicker({
|
|
|
649
657
|
"data-state": open ? "open" : "closed",
|
|
650
658
|
className: `${field ? fieldPickerTriggerClass({ interactive: !disabled }) : variant === "quiet" ? quietPickerTriggerClass() : fullWidth ? "inline-flex min-h-[36px] shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full border border-border bg-card px-3 py-1.5 text-sm font-medium text-foreground transition hover:bg-accent" : `${CHIP_PICKER_TRIGGER} shrink-0 hover:bg-accent`} ${fullWidth ? "w-full" : ""}`,
|
|
651
659
|
children: [
|
|
652
|
-
/* @__PURE__ */
|
|
653
|
-
/* @__PURE__ */
|
|
654
|
-
label ? /* @__PURE__ */
|
|
660
|
+
/* @__PURE__ */ jsx4(BrainGlyph, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
661
|
+
/* @__PURE__ */ jsxs3("span", { className: fullWidth || field ? "flex-1 truncate text-left" : void 0, children: [
|
|
662
|
+
label ? /* @__PURE__ */ jsxs3("span", { className: "text-muted-foreground", children: [
|
|
655
663
|
label,
|
|
656
664
|
": "
|
|
657
665
|
] }) : null,
|
|
658
666
|
selected ? selected.label : "\u2014"
|
|
659
667
|
] }),
|
|
660
|
-
selected && isDeclared(selected.id) && /* @__PURE__ */
|
|
668
|
+
selected && isDeclared(selected.id) && /* @__PURE__ */ jsx4(
|
|
661
669
|
EffortMeter,
|
|
662
670
|
{
|
|
663
671
|
fill: effortMeterFill(selected.id, levels),
|
|
664
672
|
className: variant === "quiet" ? "shrink-0" : "shrink-0 text-foreground"
|
|
665
673
|
}
|
|
666
674
|
),
|
|
667
|
-
/* @__PURE__ */
|
|
675
|
+
/* @__PURE__ */ jsx4(ChevronDown, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" })
|
|
668
676
|
]
|
|
669
677
|
}
|
|
670
678
|
),
|
|
671
|
-
/* @__PURE__ */
|
|
679
|
+
/* @__PURE__ */ jsx4(
|
|
672
680
|
PopoverSurface,
|
|
673
681
|
{
|
|
674
682
|
open,
|
|
@@ -679,7 +687,7 @@ function EffortPicker({
|
|
|
679
687
|
matchTriggerWidth: fullWidth || field,
|
|
680
688
|
side: field ? "below" : void 0,
|
|
681
689
|
className: `w-44 overflow-y-auto rounded-xl border border-card-edge bg-popover p-1 ${OVERLAY_SHADOW}`,
|
|
682
|
-
children: rendered.map((l) => /* @__PURE__ */
|
|
690
|
+
children: rendered.map((l) => /* @__PURE__ */ jsxs3(
|
|
683
691
|
"button",
|
|
684
692
|
{
|
|
685
693
|
type: "button",
|
|
@@ -691,10 +699,10 @@ function EffortPicker({
|
|
|
691
699
|
},
|
|
692
700
|
className: `flex min-h-[40px] w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm transition ${POPOVER_OPTION_FOCUS} ${l.id === value ? "bg-primary/10 font-medium" : "hover:bg-accent"}`,
|
|
693
701
|
children: [
|
|
694
|
-
/* @__PURE__ */
|
|
695
|
-
/* @__PURE__ */
|
|
696
|
-
isDeclared(l.id) && /* @__PURE__ */
|
|
697
|
-
l.id === value && /* @__PURE__ */
|
|
702
|
+
/* @__PURE__ */ jsx4(BrainGlyph, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
703
|
+
/* @__PURE__ */ jsx4("span", { className: "truncate", children: l.label }),
|
|
704
|
+
isDeclared(l.id) && /* @__PURE__ */ jsx4(EffortMeter, { fill: effortMeterFill(l.id, levels), className: "ml-auto text-foreground" }),
|
|
705
|
+
l.id === value && /* @__PURE__ */ jsx4(CheckGlyph, { className: `${isDeclared(l.id) ? "" : "ml-auto "}h-3.5 w-3.5 shrink-0 text-primary` })
|
|
698
706
|
]
|
|
699
707
|
},
|
|
700
708
|
l.id
|
|
@@ -729,4 +737,4 @@ export {
|
|
|
729
737
|
EffortMeter,
|
|
730
738
|
EffortPicker
|
|
731
739
|
};
|
|
732
|
-
//# sourceMappingURL=chunk-
|
|
740
|
+
//# sourceMappingURL=chunk-XIN7DOAB.js.map
|