@tangle-network/agent-app 0.60.120 → 0.60.122

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 (49) hide show
  1. package/dist/assistant/index.js +10 -10
  2. package/dist/catalog/index.js +1 -1
  3. package/dist/chat-react/index.js +5 -5
  4. package/dist/chat-routes/index.js +3 -3
  5. package/dist/{chunk-6KCN2VQS.js → chunk-2E32OQIR.js} +3 -3
  6. package/dist/{chunk-HYR3XFTY.js → chunk-2PWMBH67.js} +3 -3
  7. package/dist/{chunk-4U2CA7N2.js → chunk-7DKT4ASQ.js} +2 -2
  8. package/dist/{chunk-26N7PO6M.js → chunk-B3O3WKUJ.js} +4 -4
  9. package/dist/{chunk-I2SDMEM7.js → chunk-DESG72EM.js} +10 -5
  10. package/dist/chunk-DESG72EM.js.map +1 -0
  11. package/dist/{chunk-GS6LD5P2.js → chunk-EOJZLMY3.js} +2 -2
  12. package/dist/{chunk-WEMHBHV2.js → chunk-ICBQWN4L.js} +3 -3
  13. package/dist/{chunk-RFLC7BPY.js → chunk-MJ7ZFURI.js} +1 -1
  14. package/dist/chunk-MJ7ZFURI.js.map +1 -0
  15. package/dist/{chunk-PT7H37YH.js → chunk-OJCBSHSQ.js} +1 -1
  16. package/dist/chunk-OJCBSHSQ.js.map +1 -0
  17. package/dist/{chunk-VTYNU3LN.js → chunk-OQEGCPXR.js} +2 -2
  18. package/dist/{chunk-2HGAMEOY.js → chunk-TEDKU2OY.js} +2 -2
  19. package/dist/{chunk-PTTPLOWC.js → chunk-VYCAYJ7T.js} +3 -3
  20. package/dist/{chunk-ANHMZ5BS.js → chunk-WJEATJW6.js} +2 -2
  21. package/dist/eval/index.js +1 -1
  22. package/dist/eval/index.js.map +1 -1
  23. package/dist/{mention-editor-MEUNCF5P.js → mention-editor-DWY2UH2C.js} +3 -3
  24. package/dist/runtime/index.js +3 -3
  25. package/dist/runtime/model-catalog.d.ts +5 -0
  26. package/dist/runtime/router-turn.js +2 -2
  27. package/dist/studio/generation.d.ts +9 -0
  28. package/dist/studio/index.js +1 -1
  29. package/dist/studio-react/composer-option-controls.d.ts +1 -19
  30. package/dist/studio-react/index.js +49 -91
  31. package/dist/studio-react/index.js.map +1 -1
  32. package/dist/web-react/agent-profile-editor.js +5 -5
  33. package/dist/web-react/index.js +10 -10
  34. package/dist/workspace-react/index.js +5 -5
  35. package/package.json +1 -1
  36. package/dist/chunk-I2SDMEM7.js.map +0 -1
  37. package/dist/chunk-PT7H37YH.js.map +0 -1
  38. package/dist/chunk-RFLC7BPY.js.map +0 -1
  39. /package/dist/{chunk-6KCN2VQS.js.map → chunk-2E32OQIR.js.map} +0 -0
  40. /package/dist/{chunk-HYR3XFTY.js.map → chunk-2PWMBH67.js.map} +0 -0
  41. /package/dist/{chunk-4U2CA7N2.js.map → chunk-7DKT4ASQ.js.map} +0 -0
  42. /package/dist/{chunk-26N7PO6M.js.map → chunk-B3O3WKUJ.js.map} +0 -0
  43. /package/dist/{chunk-GS6LD5P2.js.map → chunk-EOJZLMY3.js.map} +0 -0
  44. /package/dist/{chunk-WEMHBHV2.js.map → chunk-ICBQWN4L.js.map} +0 -0
  45. /package/dist/{chunk-VTYNU3LN.js.map → chunk-OQEGCPXR.js.map} +0 -0
  46. /package/dist/{chunk-2HGAMEOY.js.map → chunk-TEDKU2OY.js.map} +0 -0
  47. /package/dist/{chunk-PTTPLOWC.js.map → chunk-VYCAYJ7T.js.map} +0 -0
  48. /package/dist/{chunk-ANHMZ5BS.js.map → chunk-WJEATJW6.js.map} +0 -0
  49. /package/dist/{mention-editor-MEUNCF5P.js.map → mention-editor-DWY2UH2C.js.map} +0 -0
@@ -36,25 +36,26 @@ import {
36
36
  textToVideoSibling,
37
37
  userSafeGenerationMessage,
38
38
  validateCustomImageSize
39
- } from "../chunk-PT7H37YH.js";
39
+ } from "../chunk-OJCBSHSQ.js";
40
40
  import {
41
41
  useInfiniteScroll
42
- } from "../chunk-WEMHBHV2.js";
43
- import "../chunk-ANHMZ5BS.js";
42
+ } from "../chunk-ICBQWN4L.js";
43
+ import "../chunk-WJEATJW6.js";
44
44
  import {
45
45
  CheckGlyph,
46
46
  ChevronDown,
47
+ ModelPicker,
47
48
  OVERLAY_SHADOW,
48
49
  POPOVER_OPTION_FOCUS,
49
50
  POPOVER_SURFACE_ATTR,
50
51
  PopoverSurface,
51
52
  usePopover
52
- } from "../chunk-I2SDMEM7.js";
53
+ } from "../chunk-DESG72EM.js";
53
54
  import "../chunk-SJWIZT7B.js";
54
55
  import {
55
56
  ProviderLogo
56
57
  } from "../chunk-MLG6XKPV.js";
57
- import "../chunk-RFLC7BPY.js";
58
+ import "../chunk-MJ7ZFURI.js";
58
59
 
59
60
  // src/studio-react/use-studio-generations.ts
60
61
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
@@ -127,7 +128,7 @@ import {
127
128
  Scaling,
128
129
  SlidersHorizontal,
129
130
  Sparkles,
130
- TriangleAlert as TriangleAlert2,
131
+ TriangleAlert,
131
132
  Video
132
133
  } from "lucide-react";
133
134
 
@@ -138,7 +139,7 @@ import {
138
139
  useId,
139
140
  useState as useState2
140
141
  } from "react";
141
- import { ImagePlus, TriangleAlert, Volume2, VolumeX, X } from "lucide-react";
142
+ import { ImagePlus, Volume2, VolumeX, X } from "lucide-react";
142
143
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
143
144
  var PILL = "inline-flex h-7 flex-none items-center gap-1.5 whitespace-nowrap rounded-full border border-border bg-card px-2.5 text-[14px] font-medium text-foreground transition hover:bg-accent";
144
145
  var PILL_LABEL = "[text-box:trim-both_cap_alphabetic]";
@@ -605,78 +606,6 @@ function ReferencePill({
605
606
  )
606
607
  ] });
607
608
  }
608
- function ModelPill({
609
- models,
610
- value,
611
- displayName,
612
- provider,
613
- unavailable,
614
- onSelect,
615
- bandRef
616
- }) {
617
- const [open, setOpen] = useState2(false);
618
- const { containerRef, triggerRef, panelRef, triggerProps } = usePopover(open, setOpen);
619
- const panelId = useId();
620
- useCloseWhenScrolledOut(open, setOpen, triggerRef, bandRef);
621
- return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: "relative inline-flex flex-none", children: [
622
- /* @__PURE__ */ jsxs(
623
- "button",
624
- {
625
- type: "button",
626
- ...triggerProps,
627
- "aria-controls": open ? panelId : void 0,
628
- title: "Model",
629
- "aria-label": `Model: ${displayName}${unavailable ? " (unavailable)" : ""}`,
630
- onClick: () => setOpen(!open),
631
- className: `${PILL}${unavailable ? " border-warning/50" : ""}`,
632
- children: [
633
- unavailable && /* @__PURE__ */ jsx(TriangleAlert, { "aria-hidden": true, className: "h-3.5 w-3.5 shrink-0 text-warning", strokeWidth: 2 }),
634
- provider && /* @__PURE__ */ jsx(ProviderLogo, { provider, size: 14 }),
635
- /* @__PURE__ */ jsx("span", { className: "max-w-[168px] truncate leading-normal", children: displayName }),
636
- /* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3 shrink-0 text-muted-foreground" })
637
- ]
638
- }
639
- ),
640
- /* @__PURE__ */ jsxs(
641
- PopoverSurface,
642
- {
643
- open,
644
- id: panelId,
645
- role: "menu",
646
- triggerRef,
647
- panelRef,
648
- className: `${MENU_PANEL} max-w-[320px]`,
649
- children: [
650
- /* @__PURE__ */ jsx("div", { className: MENU_HEADER, children: "Model" }),
651
- models.length === 0 && /* @__PURE__ */ jsx("p", { className: "px-2.5 py-2 text-[14px] text-muted-foreground", children: "No models are available for this media type." }),
652
- models.map((model) => /* @__PURE__ */ jsxs(
653
- "button",
654
- {
655
- type: "button",
656
- role: "menuitemradio",
657
- "aria-checked": model.id === value,
658
- onClick: () => {
659
- onSelect(model.id);
660
- setOpen(false);
661
- },
662
- className: menuRowClass(model.id === value),
663
- children: [
664
- model.provider && /* @__PURE__ */ jsx("span", { className: model.status === "unavailable" ? "opacity-45" : void 0, children: /* @__PURE__ */ jsx(ProviderLogo, { provider: model.provider, size: 14 }) }),
665
- /* @__PURE__ */ jsx("span", { className: `truncate${model.status === "unavailable" ? " opacity-45" : ""}`, children: model.name || model.id }),
666
- model.status === "unavailable" ? /* @__PURE__ */ jsxs(Fragment, { children: [
667
- /* @__PURE__ */ jsx("span", { className: "ml-auto shrink-0 text-[14px] text-warning", children: "Unavailable" }),
668
- /* @__PURE__ */ jsx(TriangleAlert, { "aria-hidden": true, className: "h-3.5 w-3.5 shrink-0 text-warning", strokeWidth: 2 })
669
- ] }) : model.status === "limited" && /* @__PURE__ */ jsx("span", { className: "ml-auto shrink-0 text-[14px] capitalize text-muted-foreground", children: model.status }),
670
- model.id === value && /* @__PURE__ */ jsx(CheckGlyph, { className: `${model.status === "available" ? "ml-auto " : ""}h-3.5 w-3.5 shrink-0 text-primary` })
671
- ]
672
- },
673
- model.id
674
- ))
675
- ]
676
- }
677
- )
678
- ] });
679
- }
680
609
  function optionValueLabel(param, value) {
681
610
  if (typeof value === "boolean") return value ? "On" : "Off";
682
611
  const text = String(value);
@@ -786,6 +715,30 @@ function choicesFor(param, meta) {
786
715
  }
787
716
  return optionChoices(meta);
788
717
  }
718
+ var LANE_OUTPUT = {
719
+ image: "image",
720
+ video: "video",
721
+ speech: "speech"
722
+ };
723
+ function isPublishedPrice(price) {
724
+ return Boolean(price) && Number.isFinite(price?.usd) && (price?.usd ?? 0) > 0 && ["image", "second", "minute", "1k_chars"].includes(price?.unit ?? "");
725
+ }
726
+ function pickerModel(model, type) {
727
+ const reason = model.reason?.trim();
728
+ const capability = model.status === "unavailable" ? `Unavailable${reason ? ` \xB7 ${reason}` : ""}` : model.status === "limited" ? `Limited${reason ? ` \xB7 ${reason}` : ""}` : model.capability?.trim() || void 0;
729
+ return {
730
+ id: model.id,
731
+ name: model.name || model.id,
732
+ provider: model.provider ?? "",
733
+ output: LANE_OUTPUT[type],
734
+ ...isPublishedPrice(model.outputPrice) ? { outputPrice: model.outputPrice } : {},
735
+ ...model.previewUrl?.trim() ? { previewUrl: model.previewUrl.trim() } : {},
736
+ ...capability ? { capability } : {},
737
+ supportsTools: false,
738
+ supportsReasoning: false,
739
+ featured: false
740
+ };
741
+ }
789
742
  function visibleParams(type, options) {
790
743
  if (!options) return [];
791
744
  return PILL_ORDER[type].filter((param) => {
@@ -1059,6 +1012,9 @@ function StudioComposer({
1059
1012
  const loadingModels = Boolean(workspaceId) && (catalogLoading || !catalog && !catalogError);
1060
1013
  const modelStatus = loadingModels ? "Loading media models\u2026" : catalogError ?? (laneDown ? laneDownMessage : null);
1061
1014
  const showModelMenu = catalogReady && curatedModels.length > 0;
1015
+ const pickerModels = useMemo2(() => curatedModels.map((model) => pickerModel(model, type)), [curatedModels, type]);
1016
+ const modelDisplayName = laneDown ? "Unavailable" : modelOption?.name || modelId || "Select a model";
1017
+ const modelUnavailable = laneDown || modelOption?.status === "unavailable";
1062
1018
  const canReloadModels = Boolean(workspaceId) && !loadingModels && Boolean(catalogError || catalogReady && curatedModels.length === 0);
1063
1019
  function reloadModels() {
1064
1020
  if (!workspaceId || catalogLoading || catalogPendingRef.current) return;
@@ -1091,7 +1047,7 @@ function StudioComposer({
1091
1047
  ),
1092
1048
  modelStatus && /* @__PURE__ */ jsxs2("div", { id: laneWarningId, role: "status", className: "flex flex-wrap items-center gap-2 px-1.5 pb-3 pt-1.5 text-[14px] text-muted-foreground", children: [
1093
1049
  /* @__PURE__ */ jsxs2("span", { className: "flex min-w-0 max-w-full items-start gap-2", children: [
1094
- !loadingModels && /* @__PURE__ */ jsx2(TriangleAlert2, { "aria-hidden": true, className: "mt-0.5 h-4 w-4 shrink-0 text-warning", strokeWidth: 2 }),
1050
+ !loadingModels && /* @__PURE__ */ jsx2(TriangleAlert, { "aria-hidden": true, className: "mt-0.5 h-4 w-4 shrink-0 text-warning", strokeWidth: 2 }),
1095
1051
  /* @__PURE__ */ jsx2("span", { className: "min-w-0", children: modelStatus })
1096
1052
  ] }),
1097
1053
  canReloadModels && /* @__PURE__ */ jsx2("button", { type: "button", onClick: reloadModels, className: "rounded-md px-1 font-medium text-foreground underline underline-offset-4 hover:decoration-foreground focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring", children: catalogError ? "Retry models" : "Refresh models" })
@@ -1099,18 +1055,21 @@ function StudioComposer({
1099
1055
  /* @__PURE__ */ jsxs2("div", { className: "flex flex-wrap items-center gap-2 @[640px]/studio-composer:flex-nowrap", children: [
1100
1056
  /* @__PURE__ */ jsx2(MediaTypeSegments, { value: type, segments: SEGMENTS, onChange: setType }),
1101
1057
  /* @__PURE__ */ jsxs2(ComposerBand, { bandRef, resetKey: type, children: [
1102
- showModelMenu && /* @__PURE__ */ jsx2(
1103
- ModelPill,
1058
+ showModelMenu && /* @__PURE__ */ jsx2("div", { className: "flex-none", children: /* @__PURE__ */ jsx2(
1059
+ ModelPicker,
1104
1060
  {
1105
- models: curatedModels,
1106
- value: laneDown ? "" : modelId,
1107
- displayName: laneDown ? "Unavailable" : modelOption?.name || modelId || "Select a model",
1108
- provider: laneDown ? void 0 : modelOption?.provider,
1109
- unavailable: laneDown || modelOption?.status === "unavailable",
1110
- onSelect: chooseModel,
1111
- bandRef
1061
+ value: laneDown ? "" : textToVideoSibling(modelId) ?? modelId,
1062
+ onChange: chooseModel,
1063
+ models: pickerModels,
1064
+ priorityGroup: { label: `${laneLabel} models`, match: () => true },
1065
+ "aria-label": `Model: ${modelDisplayName}${modelUnavailable ? " (unavailable)" : ""}`,
1066
+ triggerContent: /* @__PURE__ */ jsxs2("span", { className: "contents", children: [
1067
+ modelUnavailable && /* @__PURE__ */ jsx2(TriangleAlert, { "aria-hidden": true, className: "h-3.5 w-3.5 shrink-0 text-warning", strokeWidth: 2 }),
1068
+ !laneDown && modelOption?.provider && /* @__PURE__ */ jsx2("span", { className: "shrink-0", "aria-hidden": true, children: /* @__PURE__ */ jsx2(ProviderLogo, { provider: modelOption.provider, size: 16 }) }),
1069
+ /* @__PURE__ */ jsx2("span", { className: "max-w-[160px] truncate leading-normal", children: modelDisplayName })
1070
+ ] })
1112
1071
  }
1113
- ),
1072
+ ) }),
1114
1073
  params.map((param) => /* @__PURE__ */ jsx2("div", { className: "studio-pill-in flex-none", children: /* @__PURE__ */ jsx2(
1115
1074
  OptionPill,
1116
1075
  {
@@ -3376,7 +3335,6 @@ export {
3376
3335
  MediaTypeSegments,
3377
3336
  MediaViewerModal,
3378
3337
  MenuPill,
3379
- ModelPill,
3380
3338
  OptionPill,
3381
3339
  ReferencePill,
3382
3340
  StudioComposer,