@tangle-network/agent-app 0.50.32 → 0.50.33
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/agent-enrollment/application.d.ts +25 -5
- package/dist/agent-enrollment/drizzle.js +1 -1
- package/dist/agent-enrollment/index.d.ts +1 -1
- package/dist/agent-enrollment/index.js +1 -1
- package/dist/app-oauth/index.d.ts +101 -0
- package/dist/app-oauth/index.js +231 -0
- package/dist/app-oauth/index.js.map +1 -0
- package/dist/assistant/index.js +1 -1
- package/dist/chat-routes/index.js +4 -4
- package/dist/{chunk-LDCR7MRU.js → chunk-2PDKWV2S.js} +2 -2
- package/dist/{chunk-NLXY7TFB.js → chunk-C3JSO2CB.js} +43 -18
- package/dist/chunk-C3JSO2CB.js.map +1 -0
- package/dist/{chunk-CNI46COH.js → chunk-CBRYWGUO.js} +2 -2
- package/dist/{chunk-CNI46COH.js.map → chunk-CBRYWGUO.js.map} +1 -1
- package/dist/{chunk-BATKJP3P.js → chunk-E4AY62T2.js} +24 -7
- package/dist/chunk-E4AY62T2.js.map +1 -0
- package/dist/{chunk-5KFRCVAO.js → chunk-IYLPQKAH.js} +2 -2
- package/dist/{chunk-5TOV7EDF.js → chunk-PF3AZD5G.js} +4 -4
- package/dist/{chunk-ACFM2GFL.js → chunk-SYIV74NB.js} +1 -1
- package/dist/design-canvas-react/index.js +4 -4
- package/dist/design-canvas-react/lazy.js +1 -1
- package/dist/hosted-agent/react/SharedLineAppNotice.d.ts +16 -0
- package/dist/hosted-agent/react/index.d.ts +1 -0
- package/dist/hosted-agent/react/index.js +46 -1
- package/dist/hosted-agent/react/index.js.map +1 -1
- package/dist/hosted-agent/react/lines.css +92 -2
- package/dist/preset-cloudflare/index.js +2 -2
- package/dist/sandbox/index.js +4 -4
- package/dist/studio-react/index.js +91 -56
- package/dist/studio-react/index.js.map +1 -1
- package/dist/theme/tokens.css +3 -1
- package/dist/tools/index.js +4 -4
- package/dist/web-react/index.js +4 -4
- package/dist/web-react/sandbox-terminal.d.ts +2 -0
- package/dist/web-react/terminal.js +1 -1
- package/dist/work-product/index.js +2 -2
- package/dist/workspace-react/companion.d.ts +31 -0
- package/dist/workspace-react/index.d.ts +1 -1
- package/dist/workspace-react/index.js +140 -2
- package/dist/workspace-react/index.js.map +1 -1
- package/package.json +25 -5
- package/dist/chunk-BATKJP3P.js.map +0 -1
- package/dist/chunk-NLXY7TFB.js.map +0 -1
- /package/dist/{chunk-LDCR7MRU.js.map → chunk-2PDKWV2S.js.map} +0 -0
- /package/dist/{chunk-5KFRCVAO.js.map → chunk-IYLPQKAH.js.map} +0 -0
- /package/dist/{chunk-5TOV7EDF.js.map → chunk-PF3AZD5G.js.map} +0 -0
- /package/dist/{chunk-ACFM2GFL.js.map → chunk-SYIV74NB.js.map} +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
GENERATION_TYPES,
|
|
2
3
|
MEDIA_TYPE_FILTERS,
|
|
3
4
|
WIDE_WAVEFORM_BARS,
|
|
4
5
|
aspectRatioFromOptions,
|
|
@@ -109,7 +110,7 @@ function useStudioGenerations(loaderGenerations, options = {}) {
|
|
|
109
110
|
}
|
|
110
111
|
|
|
111
112
|
// src/studio-react/studio-composer.tsx
|
|
112
|
-
import { useEffect as useEffect3, useMemo as useMemo2, useRef as useRef2, useState as useState3 } from "react";
|
|
113
|
+
import { useEffect as useEffect3, useId as useId2, useMemo as useMemo2, useRef as useRef2, useState as useState3 } from "react";
|
|
113
114
|
import {
|
|
114
115
|
AudioLines,
|
|
115
116
|
ArrowUp,
|
|
@@ -136,12 +137,12 @@ import {
|
|
|
136
137
|
} from "react";
|
|
137
138
|
import { ImagePlus, TriangleAlert, Volume2, VolumeX, X } from "lucide-react";
|
|
138
139
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
139
|
-
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-[
|
|
140
|
+
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";
|
|
140
141
|
var PILL_LABEL = "[text-box:trim-both_cap_alphabetic]";
|
|
141
142
|
var MENU_PANEL = `flex min-w-[184px] flex-col overflow-y-auto rounded-xl border border-border bg-popover p-1 text-popover-foreground ${OVERLAY_SHADOW}`;
|
|
142
|
-
var MENU_HEADER = "px-2.5 pb-1 pt-1.5 text-[
|
|
143
|
+
var MENU_HEADER = "px-2.5 pb-1 pt-1.5 text-[14px] font-semibold uppercase tracking-[0.08em] text-muted-foreground";
|
|
143
144
|
function menuRowClass(selected) {
|
|
144
|
-
return `flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-[
|
|
145
|
+
return `flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-[14px] transition ${POPOVER_OPTION_FOCUS} ${selected ? "bg-primary/10 font-medium" : "hover:bg-accent"}`;
|
|
145
146
|
}
|
|
146
147
|
var MAX_FADE = 32;
|
|
147
148
|
function MediaTypeSegments({
|
|
@@ -165,7 +166,7 @@ function MediaTypeSegments({
|
|
|
165
166
|
"aria-label": label,
|
|
166
167
|
title: label,
|
|
167
168
|
onClick: () => onChange(type),
|
|
168
|
-
className: `inline-flex h-7 items-center gap-1.5 whitespace-nowrap rounded-full text-[
|
|
169
|
+
className: `inline-flex h-7 items-center gap-1.5 whitespace-nowrap rounded-full text-[14px] transition ${active ? "bg-card px-2.5 font-medium text-foreground shadow-sm" : "px-2 text-muted-foreground hover:text-foreground"}`,
|
|
169
170
|
children: [
|
|
170
171
|
/* @__PURE__ */ jsx(Icon, { className: "h-4 w-4 shrink-0", strokeWidth: 1.5 }),
|
|
171
172
|
active && /* @__PURE__ */ jsx("span", { children: label })
|
|
@@ -215,7 +216,7 @@ function ComposerBand({
|
|
|
215
216
|
ref: bandRef,
|
|
216
217
|
"data-overflow": "none",
|
|
217
218
|
onScroll: sync,
|
|
218
|
-
className: "studio-band flex min-w-0 flex-
|
|
219
|
+
className: "studio-band order-3 flex w-full min-w-0 flex-auto flex-nowrap items-center gap-2 overflow-x-auto empty:hidden @[640px]/studio-composer:order-none @[640px]/studio-composer:w-auto @[640px]/studio-composer:flex-1",
|
|
219
220
|
children
|
|
220
221
|
}
|
|
221
222
|
);
|
|
@@ -284,7 +285,7 @@ function MenuPill({
|
|
|
284
285
|
title: label,
|
|
285
286
|
"aria-label": label,
|
|
286
287
|
onClick: () => setOpen(!open),
|
|
287
|
-
className: `${trigger === "text" ? "inline-flex h-7 flex-none items-center gap-1 whitespace-nowrap rounded-full px-2 text-[
|
|
288
|
+
className: `${trigger === "text" ? "inline-flex h-7 flex-none items-center gap-1 whitespace-nowrap rounded-full px-2 text-[14px] font-medium text-primary transition hover:bg-accent" : PILL} ${className ?? ""}`,
|
|
288
289
|
children: [
|
|
289
290
|
Icon && /* @__PURE__ */ jsx(Icon, { "aria-hidden": true, className: "h-3.5 w-3.5 shrink-0 text-muted-foreground", strokeWidth: 1.5 }),
|
|
290
291
|
/* @__PURE__ */ jsx("span", { className: PILL_LABEL, children: selected?.label ?? "\u2014" }),
|
|
@@ -406,7 +407,7 @@ function CustomSizeForm({
|
|
|
406
407
|
const [width, setWidth] = useState2(parsed?.[1] ?? "");
|
|
407
408
|
const [height, setHeight] = useState2(parsed?.[2] ?? "");
|
|
408
409
|
const [error, setError] = useState2(null);
|
|
409
|
-
const fieldClass = "h-8 w-[74px] rounded-md border border-input bg-background px-2 text-[
|
|
410
|
+
const fieldClass = "h-8 w-[74px] rounded-md border border-input bg-background px-2 text-[14px] tabular-nums";
|
|
410
411
|
function apply() {
|
|
411
412
|
const verdict = validateCustomImageSize(Number(width), Number(height));
|
|
412
413
|
if (!verdict.ok) {
|
|
@@ -445,14 +446,14 @@ function CustomSizeForm({
|
|
|
445
446
|
}
|
|
446
447
|
)
|
|
447
448
|
] }),
|
|
448
|
-
error ? /* @__PURE__ */ jsx("p", { className: "text-[
|
|
449
|
+
error ? /* @__PURE__ */ jsx("p", { className: "text-[14px] text-destructive", children: error }) : /* @__PURE__ */ jsx("p", { className: "text-[14px] text-muted-foreground", children: "Multiples of 16, long edge up to 3840, ratio between 1:3 and 3:1." }),
|
|
449
450
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-1.5", children: [
|
|
450
451
|
/* @__PURE__ */ jsx(
|
|
451
452
|
"button",
|
|
452
453
|
{
|
|
453
454
|
type: "button",
|
|
454
455
|
onClick: onCancel,
|
|
455
|
-
className: "rounded-md px-2.5 py-1 text-[
|
|
456
|
+
className: "rounded-md px-2.5 py-1 text-[14px] font-medium text-muted-foreground transition hover:bg-accent hover:text-foreground",
|
|
456
457
|
children: "Cancel"
|
|
457
458
|
}
|
|
458
459
|
),
|
|
@@ -461,7 +462,7 @@ function CustomSizeForm({
|
|
|
461
462
|
{
|
|
462
463
|
type: "button",
|
|
463
464
|
onClick: apply,
|
|
464
|
-
className: "rounded-md bg-primary px-2.5 py-1 text-[
|
|
465
|
+
className: "rounded-md bg-primary px-2.5 py-1 text-[14px] font-medium text-primary-foreground transition hover:opacity-90",
|
|
465
466
|
children: "Apply"
|
|
466
467
|
}
|
|
467
468
|
)
|
|
@@ -500,7 +501,7 @@ function ReferencePill({
|
|
|
500
501
|
if (url) {
|
|
501
502
|
return /* @__PURE__ */ jsxs("div", { className: `${PILL} border-primary bg-primary/10 pr-1.5 text-primary hover:bg-primary/10`, children: [
|
|
502
503
|
/* @__PURE__ */ jsx("img", { src: url, alt: "", className: "h-[18px] w-[18px] shrink-0 rounded-[5px] object-cover" }),
|
|
503
|
-
/* @__PURE__ */ jsx("span", { className: PILL_LABEL, children: "Reference" }),
|
|
504
|
+
/* @__PURE__ */ jsx("span", { className: PILL_LABEL, children: "Reference image" }),
|
|
504
505
|
/* @__PURE__ */ jsx(
|
|
505
506
|
"button",
|
|
506
507
|
{
|
|
@@ -531,7 +532,8 @@ function ReferencePill({
|
|
|
531
532
|
type: "button",
|
|
532
533
|
ref: triggerRef,
|
|
533
534
|
...pick ? {} : { "aria-haspopup": true, "aria-expanded": open, "aria-controls": open ? panelId : void 0 },
|
|
534
|
-
title: "
|
|
535
|
+
title: "Add reference image",
|
|
536
|
+
"aria-label": "Add reference image",
|
|
535
537
|
onClick: () => {
|
|
536
538
|
if (!pick) {
|
|
537
539
|
setOpen(!open);
|
|
@@ -544,7 +546,7 @@ function ReferencePill({
|
|
|
544
546
|
className: PILL,
|
|
545
547
|
children: [
|
|
546
548
|
/* @__PURE__ */ jsx(ImagePlus, { className: "h-4 w-4 shrink-0 text-muted-foreground", strokeWidth: 1.5 }),
|
|
547
|
-
/* @__PURE__ */ jsx("span", { className: PILL_LABEL, children: "
|
|
549
|
+
/* @__PURE__ */ jsx("span", { className: PILL_LABEL, children: "Add image" })
|
|
548
550
|
]
|
|
549
551
|
}
|
|
550
552
|
),
|
|
@@ -570,17 +572,17 @@ function ReferencePill({
|
|
|
570
572
|
setDraft(event.target.value);
|
|
571
573
|
setError(null);
|
|
572
574
|
},
|
|
573
|
-
className: "h-8 w-full rounded-md border border-input bg-background px-2 text-[
|
|
575
|
+
className: "h-8 w-full rounded-md border border-input bg-background px-2 text-[14px]"
|
|
574
576
|
}
|
|
575
577
|
),
|
|
576
|
-
error && /* @__PURE__ */ jsx("p", { className: "text-[
|
|
578
|
+
error && /* @__PURE__ */ jsx("p", { className: "text-[14px] text-destructive", children: error }),
|
|
577
579
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-1.5", children: [
|
|
578
580
|
/* @__PURE__ */ jsx(
|
|
579
581
|
"button",
|
|
580
582
|
{
|
|
581
583
|
type: "button",
|
|
582
584
|
onClick: () => setOpen(false),
|
|
583
|
-
className: "rounded-md px-2.5 py-1 text-[
|
|
585
|
+
className: "rounded-md px-2.5 py-1 text-[14px] font-medium text-muted-foreground transition hover:bg-accent hover:text-foreground",
|
|
584
586
|
children: "Cancel"
|
|
585
587
|
}
|
|
586
588
|
),
|
|
@@ -589,7 +591,7 @@ function ReferencePill({
|
|
|
589
591
|
{
|
|
590
592
|
type: "button",
|
|
591
593
|
onClick: attach,
|
|
592
|
-
className: "rounded-md bg-primary px-2.5 py-1 text-[
|
|
594
|
+
className: "rounded-md bg-primary px-2.5 py-1 text-[14px] font-medium text-primary-foreground transition hover:opacity-90",
|
|
593
595
|
children: "Attach"
|
|
594
596
|
}
|
|
595
597
|
)
|
|
@@ -643,7 +645,7 @@ function ModelPill({
|
|
|
643
645
|
className: `${MENU_PANEL} max-w-[320px]`,
|
|
644
646
|
children: [
|
|
645
647
|
/* @__PURE__ */ jsx("div", { className: MENU_HEADER, children: "Model" }),
|
|
646
|
-
models.length === 0 && /* @__PURE__ */ jsx("p", { className: "px-2.5 py-2 text-[
|
|
648
|
+
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." }),
|
|
647
649
|
models.map((model) => /* @__PURE__ */ jsxs(
|
|
648
650
|
"button",
|
|
649
651
|
{
|
|
@@ -659,9 +661,9 @@ function ModelPill({
|
|
|
659
661
|
model.provider && /* @__PURE__ */ jsx("span", { className: model.status === "unavailable" ? "opacity-45" : void 0, children: /* @__PURE__ */ jsx(ProviderLogo, { provider: model.provider, size: 14 }) }),
|
|
660
662
|
/* @__PURE__ */ jsx("span", { className: `truncate${model.status === "unavailable" ? " opacity-45" : ""}`, children: model.name || model.id }),
|
|
661
663
|
model.status === "unavailable" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
662
|
-
/* @__PURE__ */ jsx("span", { className: "ml-auto shrink-0 text-[
|
|
664
|
+
/* @__PURE__ */ jsx("span", { className: "ml-auto shrink-0 text-[14px] text-warning", children: "Unavailable" }),
|
|
663
665
|
/* @__PURE__ */ jsx(TriangleAlert, { "aria-hidden": true, className: "h-3.5 w-3.5 shrink-0 text-warning", strokeWidth: 2 })
|
|
664
|
-
] }) : model.status === "limited" && /* @__PURE__ */ jsx("span", { className: "ml-auto shrink-0 text-[
|
|
666
|
+
] }) : model.status === "limited" && /* @__PURE__ */ jsx("span", { className: "ml-auto shrink-0 text-[14px] capitalize text-muted-foreground", children: model.status }),
|
|
665
667
|
model.id === value && /* @__PURE__ */ jsx(CheckGlyph, { className: `${model.status === "available" ? "ml-auto " : ""}h-3.5 w-3.5 shrink-0 text-primary` })
|
|
666
668
|
]
|
|
667
669
|
},
|
|
@@ -793,6 +795,17 @@ function defaultModelId(type, catalog, curated) {
|
|
|
793
795
|
if (preferred && curated.some((model) => model.id === preferred && model.status !== "unavailable")) return preferred;
|
|
794
796
|
return curated.find((model) => model.status !== "unavailable")?.id ?? curated[0]?.id ?? "";
|
|
795
797
|
}
|
|
798
|
+
function isRecord(value) {
|
|
799
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
800
|
+
}
|
|
801
|
+
function isMediaCatalog(value) {
|
|
802
|
+
if (!isRecord(value) || !isRecord(value.defaults) || !isRecord(value.models)) return false;
|
|
803
|
+
const { defaults, models } = value;
|
|
804
|
+
return GENERATION_TYPES.every((type) => {
|
|
805
|
+
const rows = models[type];
|
|
806
|
+
return typeof defaults[type] === "string" && Array.isArray(rows) && rows.every((row) => isRecord(row) && typeof row.id === "string" && Boolean(row.id.trim()) && typeof row.name === "string" && row.type === type && typeof row.status === "string" && ["available", "limited", "unavailable"].includes(row.status) && (row.provider === void 0 || typeof row.provider === "string") && (row.reason === void 0 || typeof row.reason === "string") && (row.options === void 0 || isRecord(row.options)));
|
|
807
|
+
});
|
|
808
|
+
}
|
|
796
809
|
function StudioComposer({
|
|
797
810
|
workspaceId,
|
|
798
811
|
onGenerated,
|
|
@@ -801,9 +814,12 @@ function StudioComposer({
|
|
|
801
814
|
sendTone = "contrast",
|
|
802
815
|
className
|
|
803
816
|
}) {
|
|
817
|
+
const laneWarningId = useId2();
|
|
804
818
|
const [type, setType] = useState3("image");
|
|
805
819
|
const [prompt, setPrompt] = useState3("");
|
|
806
820
|
const [catalog, setCatalog] = useState3(null);
|
|
821
|
+
const [catalogRequest, setCatalogRequest] = useState3(0);
|
|
822
|
+
const catalogPendingRef = useRef2(false);
|
|
807
823
|
const [catalogLoading, setCatalogLoading] = useState3(false);
|
|
808
824
|
const [catalogError, setCatalogError] = useState3(null);
|
|
809
825
|
const [selectedModels, setSelectedModels] = useState3({});
|
|
@@ -838,11 +854,14 @@ function StudioComposer({
|
|
|
838
854
|
useEffect3(() => {
|
|
839
855
|
if (!workspaceId) return;
|
|
840
856
|
let cancelled = false;
|
|
857
|
+
const controller = new AbortController();
|
|
858
|
+
catalogPendingRef.current = true;
|
|
859
|
+
setCatalog(null);
|
|
841
860
|
setCatalogLoading(true);
|
|
842
861
|
setCatalogError(null);
|
|
843
|
-
fetch(`/api/media-models?workspaceId=${encodeURIComponent(workspaceId)}
|
|
862
|
+
fetch(`/api/media-models?workspaceId=${encodeURIComponent(workspaceId)}`, { signal: controller.signal }).then(async (res) => {
|
|
844
863
|
const data = await res.json();
|
|
845
|
-
if (!res.ok) throw new Error(
|
|
864
|
+
if (!res.ok || !isMediaCatalog(data)) throw new Error("Could not load media models");
|
|
846
865
|
return data;
|
|
847
866
|
}).then((data) => {
|
|
848
867
|
if (cancelled) return;
|
|
@@ -852,12 +871,16 @@ function StudioComposer({
|
|
|
852
871
|
setCatalog(null);
|
|
853
872
|
setCatalogError("Could not load media models");
|
|
854
873
|
}).finally(() => {
|
|
855
|
-
if (!cancelled)
|
|
874
|
+
if (!cancelled) {
|
|
875
|
+
catalogPendingRef.current = false;
|
|
876
|
+
setCatalogLoading(false);
|
|
877
|
+
}
|
|
856
878
|
});
|
|
857
879
|
return () => {
|
|
858
880
|
cancelled = true;
|
|
881
|
+
controller.abort();
|
|
859
882
|
};
|
|
860
|
-
}, [workspaceId]);
|
|
883
|
+
}, [workspaceId, catalogRequest]);
|
|
861
884
|
const laneModels = useMemo2(() => catalog?.models[type] ?? [], [catalog, type]);
|
|
862
885
|
const curatedModels = useMemo2(() => curateComposerModels(type, laneModels), [laneModels, type]);
|
|
863
886
|
const retained = selectedModels[type];
|
|
@@ -916,14 +939,15 @@ function StudioComposer({
|
|
|
916
939
|
});
|
|
917
940
|
persistedOptionsRef.current = optionsByModel;
|
|
918
941
|
}, [catalog, hydratedWorkspaceId, modelId, optionValues, options, selectedModels, type, workspaceId]);
|
|
942
|
+
const catalogReady = Boolean(catalog) && !catalogLoading && !catalogError;
|
|
919
943
|
const laneDown = Boolean(catalog) && !catalogLoading && !catalogError && laneUnavailable(curatedModels);
|
|
920
944
|
const values = optionValues[type];
|
|
921
|
-
const params = laneDown ?
|
|
945
|
+
const params = catalogReady && !laneDown ? visibleParams(type, options) : [];
|
|
922
946
|
const audioMeta = type === "video" ? options?.audio : void 0;
|
|
923
|
-
const audioSupported = !laneDown && Boolean(audioMeta) && audioMeta?.supported !== false;
|
|
947
|
+
const audioSupported = catalogReady && !laneDown && Boolean(audioMeta) && audioMeta?.supported !== false;
|
|
924
948
|
const unlistedSibling = !modelOption && Boolean(textToVideoSibling(modelId));
|
|
925
|
-
const referenceSupported = !laneDown && type === "video" && Boolean(imageToVideoSibling(modelId) ?? textToVideoSibling(modelId));
|
|
926
|
-
const modelReady = (Boolean(modelOption) || unlistedSibling) && modelOption?.status !== "unavailable" && !catalogLoading && !catalogError;
|
|
949
|
+
const referenceSupported = catalogReady && !laneDown && type === "video" && Boolean(imageToVideoSibling(modelId) ?? textToVideoSibling(modelId));
|
|
950
|
+
const modelReady = catalogReady && (Boolean(modelOption) || unlistedSibling) && modelOption?.status !== "unavailable" && !catalogLoading && !catalogError;
|
|
927
951
|
const canSubmit = Boolean(workspaceId) && modelReady && Boolean(prompt.trim()) && !isSubmitting;
|
|
928
952
|
function selectModel(id) {
|
|
929
953
|
setSelectedModels((current) => ({ ...current, [type]: id }));
|
|
@@ -1024,22 +1048,28 @@ function StudioComposer({
|
|
|
1024
1048
|
setIsSubmitting(false);
|
|
1025
1049
|
}
|
|
1026
1050
|
}
|
|
1027
|
-
const notice =
|
|
1051
|
+
const notice = error;
|
|
1028
1052
|
const laneLabel = SEGMENTS.find((segment) => segment.type === type).label;
|
|
1029
|
-
const
|
|
1053
|
+
const blockedReasons = [...new Set(curatedModels.map((model) => model.reason?.trim()).filter(Boolean))];
|
|
1054
|
+
const sharedBlockReason = curatedModels.every((model) => Boolean(model.reason?.trim())) && blockedReasons.length === 1 ? blockedReasons[0] : void 0;
|
|
1055
|
+
const laneDownMessage = curatedModels.length === 0 ? `No ${laneLabel.toLowerCase()} models are available` : sharedBlockReason ?? `${laneLabel} models are unavailable`;
|
|
1056
|
+
const loadingModels = Boolean(workspaceId) && (catalogLoading || !catalog && !catalogError);
|
|
1057
|
+
const modelStatus = loadingModels ? "Loading media models\u2026" : catalogError ?? (laneDown ? laneDownMessage : null);
|
|
1058
|
+
const showModelMenu = catalogReady && curatedModels.length > 0;
|
|
1059
|
+
const canReloadModels = Boolean(workspaceId) && !loadingModels && Boolean(catalogError || catalogReady && curatedModels.length === 0);
|
|
1060
|
+
function reloadModels() {
|
|
1061
|
+
if (!workspaceId || catalogLoading || catalogPendingRef.current) return;
|
|
1062
|
+
catalogPendingRef.current = true;
|
|
1063
|
+
setCatalogLoading(true);
|
|
1064
|
+
setCatalogRequest((current) => current + 1);
|
|
1065
|
+
}
|
|
1030
1066
|
return /* @__PURE__ */ jsxs2(
|
|
1031
1067
|
"section",
|
|
1032
1068
|
{
|
|
1033
1069
|
"data-variant": variant,
|
|
1034
|
-
className: `studio-composer-card rounded-2xl border border-border bg-surface-container-high p-2.5 shadow-sm transition focus-within:border-primary/60 ${className ?? ""}`,
|
|
1070
|
+
className: `studio-composer-card @container/studio-composer rounded-2xl border border-border bg-surface-container-high p-2.5 shadow-sm transition focus-within:border-primary/60 ${className ?? ""}`,
|
|
1035
1071
|
children: [
|
|
1036
|
-
|
|
1037
|
-
// Match rows={3} at 14.5px/1.625 plus the textarea's vertical padding.
|
|
1038
|
-
/* @__PURE__ */ jsxs2("p", { className: "flex min-h-[calc(70.6875px+0.625rem)] items-center gap-2 px-1.5 pb-3 pt-1.5 text-[13px] font-medium text-warning", children: [
|
|
1039
|
-
/* @__PURE__ */ jsx2(TriangleAlert2, { "aria-hidden": true, className: "h-4 w-4 shrink-0", strokeWidth: 2 }),
|
|
1040
|
-
/* @__PURE__ */ jsx2("span", { children: laneDownMessage })
|
|
1041
|
-
] })
|
|
1042
|
-
) : /* @__PURE__ */ jsx2(
|
|
1072
|
+
/* @__PURE__ */ jsx2(
|
|
1043
1073
|
"textarea",
|
|
1044
1074
|
{
|
|
1045
1075
|
value: prompt,
|
|
@@ -1051,14 +1081,22 @@ function StudioComposer({
|
|
|
1051
1081
|
},
|
|
1052
1082
|
rows: 3,
|
|
1053
1083
|
"aria-label": "Prompt",
|
|
1054
|
-
|
|
1084
|
+
"aria-describedby": modelStatus ? laneWarningId : void 0,
|
|
1085
|
+
placeholder: type === "speech" ? "Write the words to speak\u2026" : `Describe the ${type} you want to create\u2026`,
|
|
1055
1086
|
className: "block min-h-[66px] w-full resize-none border-0 bg-transparent px-1.5 pb-1 pt-1.5 text-[14.5px] leading-relaxed outline-none placeholder:text-muted-foreground"
|
|
1056
1087
|
}
|
|
1057
1088
|
),
|
|
1058
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2", children: [
|
|
1089
|
+
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: [
|
|
1090
|
+
/* @__PURE__ */ jsxs2("span", { className: "flex min-w-0 max-w-full items-start gap-2", children: [
|
|
1091
|
+
!loadingModels && /* @__PURE__ */ jsx2(TriangleAlert2, { "aria-hidden": true, className: "mt-0.5 h-4 w-4 shrink-0 text-warning", strokeWidth: 2 }),
|
|
1092
|
+
/* @__PURE__ */ jsx2("span", { className: "min-w-0", children: modelStatus })
|
|
1093
|
+
] }),
|
|
1094
|
+
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" })
|
|
1095
|
+
] }),
|
|
1096
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex flex-wrap items-center gap-2 @[640px]/studio-composer:flex-nowrap", children: [
|
|
1059
1097
|
/* @__PURE__ */ jsx2(MediaTypeSegments, { value: type, segments: SEGMENTS, onChange: setType }),
|
|
1060
1098
|
/* @__PURE__ */ jsxs2(ComposerBand, { bandRef, resetKey: type, children: [
|
|
1061
|
-
/* @__PURE__ */ jsx2(
|
|
1099
|
+
showModelMenu && /* @__PURE__ */ jsx2(
|
|
1062
1100
|
ModelPill,
|
|
1063
1101
|
{
|
|
1064
1102
|
models: curatedModels,
|
|
@@ -1126,7 +1164,7 @@ function StudioComposer({
|
|
|
1126
1164
|
}
|
|
1127
1165
|
)
|
|
1128
1166
|
] }),
|
|
1129
|
-
notice && /* @__PURE__ */ jsx2("p", { className: "px-1.5 pt-1.5 text-[
|
|
1167
|
+
notice && /* @__PURE__ */ jsx2("p", { className: "px-1.5 pt-1.5 text-[14px] text-destructive", children: notice })
|
|
1130
1168
|
]
|
|
1131
1169
|
}
|
|
1132
1170
|
);
|
|
@@ -1181,7 +1219,7 @@ import {
|
|
|
1181
1219
|
} from "react";
|
|
1182
1220
|
|
|
1183
1221
|
// src/studio-react/vault-path-popover.tsx
|
|
1184
|
-
import { useEffect as useEffect4, useId as
|
|
1222
|
+
import { useEffect as useEffect4, useId as useId3, useRef as useRef3, useState as useState4 } from "react";
|
|
1185
1223
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1186
1224
|
function VaultPathPopover({
|
|
1187
1225
|
open,
|
|
@@ -1193,7 +1231,7 @@ function VaultPathPopover({
|
|
|
1193
1231
|
pending = false
|
|
1194
1232
|
}) {
|
|
1195
1233
|
const inputRef = useRef3(null);
|
|
1196
|
-
const inputId =
|
|
1234
|
+
const inputId = useId3();
|
|
1197
1235
|
const [error, setError] = useState4(null);
|
|
1198
1236
|
useEffect4(() => {
|
|
1199
1237
|
if (!open) return;
|
|
@@ -2167,7 +2205,7 @@ import {
|
|
|
2167
2205
|
} from "react";
|
|
2168
2206
|
|
|
2169
2207
|
// src/studio-react/studio-confirm.tsx
|
|
2170
|
-
import { useEffect as useEffect8, useId as
|
|
2208
|
+
import { useEffect as useEffect8, useId as useId4, useRef as useRef6 } from "react";
|
|
2171
2209
|
import { createPortal as createPortal2 } from "react-dom";
|
|
2172
2210
|
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2173
2211
|
function StudioConfirmDialog({
|
|
@@ -2179,8 +2217,8 @@ function StudioConfirmDialog({
|
|
|
2179
2217
|
const panelRef = useRef6(null);
|
|
2180
2218
|
const cancelRef = useRef6(null);
|
|
2181
2219
|
const previousFocusRef = useRef6(null);
|
|
2182
|
-
const titleId =
|
|
2183
|
-
const descriptionId =
|
|
2220
|
+
const titleId = useId4();
|
|
2221
|
+
const descriptionId = useId4();
|
|
2184
2222
|
useEffect8(() => {
|
|
2185
2223
|
if (!open) return;
|
|
2186
2224
|
previousFocusRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
@@ -2585,23 +2623,20 @@ function StudioHomeScreen({
|
|
|
2585
2623
|
}
|
|
2586
2624
|
)
|
|
2587
2625
|
] }),
|
|
2588
|
-
/* @__PURE__ */ jsxs9("section", { className: "studio-home-recent pb-[72px]", children: [
|
|
2589
|
-
/* @__PURE__ */ jsxs9("div", { className: "mb-3 mt-[34px] flex items-center justify-between gap-3
|
|
2590
|
-
/* @__PURE__ */ jsx10("h2", { className: "text-[
|
|
2626
|
+
visible.length > 0 && /* @__PURE__ */ jsxs9("section", { className: "studio-home-recent mx-auto w-full max-w-[868px] px-6 pb-[72px] max-[900px]:px-4", children: [
|
|
2627
|
+
/* @__PURE__ */ jsxs9("div", { className: "mb-3 mt-[34px] flex items-center justify-between gap-3", children: [
|
|
2628
|
+
/* @__PURE__ */ jsx10("h2", { className: "text-[14px] font-medium text-foreground", children: "Recent media" }),
|
|
2591
2629
|
/* @__PURE__ */ jsx10(
|
|
2592
2630
|
"button",
|
|
2593
2631
|
{
|
|
2594
2632
|
type: "button",
|
|
2595
2633
|
onClick: onOpenHistory,
|
|
2596
|
-
className: "h-
|
|
2634
|
+
className: "h-8 whitespace-nowrap rounded-md px-1 text-[14px] font-medium text-foreground underline underline-offset-4 hover:decoration-foreground",
|
|
2597
2635
|
children: "View history"
|
|
2598
2636
|
}
|
|
2599
2637
|
)
|
|
2600
2638
|
] }),
|
|
2601
|
-
/* @__PURE__ */ jsx10("div", { className: "studio-grid studio-grid-library", children: visible.
|
|
2602
|
-
/* @__PURE__ */ jsx10("p", { className: "text-[14px] text-foreground", children: "Nothing generated yet." }),
|
|
2603
|
-
/* @__PURE__ */ jsx10("p", { className: "max-w-[380px] text-[13px] text-muted-foreground", children: "Whatever you make lands here first \u2014 it only reaches the vault when you save it." })
|
|
2604
|
-
] }) : visible.slice(0, recentLimit).map((generation) => /* @__PURE__ */ jsx10(
|
|
2639
|
+
/* @__PURE__ */ jsx10("div", { className: "studio-grid studio-grid-library", children: visible.slice(0, recentLimit).map((generation) => /* @__PURE__ */ jsx10(
|
|
2605
2640
|
MediaTile,
|
|
2606
2641
|
{
|
|
2607
2642
|
generation,
|