@truefoundry/trueforge-ui 0.1.0-rc.0 → 0.1.0-rc.2
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/CHANGELOG.md +48 -0
- package/dist/{ConnectorSettings-CLBEWGQJ.js → ConnectorSettings-H37ZFC6Z.js} +36 -13
- package/dist/ConnectorSettings-H37ZFC6Z.js.map +1 -0
- package/dist/{DockLayout-WRF7EQLD.js → DockLayout-KEMFRWIR.js} +8 -8
- package/dist/{DrawerLayout-X2UXYTOS.js → DrawerLayout-ZVWCKEIS.js} +8 -8
- package/dist/{ModelSettings-IJ55QJQO.js → ModelSettings-QJMYHCMD.js} +8 -8
- package/dist/{ModelSettings-IJ55QJQO.js.map → ModelSettings-QJMYHCMD.js.map} +1 -1
- package/dist/OpenUiFenceBlock-XFBUGPKQ.js +9 -0
- package/dist/{SandboxSettings-S5XGZWOL.js → SandboxSettings-BUBMLW7Q.js} +160 -66
- package/dist/SandboxSettings-BUBMLW7Q.js.map +1 -0
- package/dist/{SettingsBuilder-64Y33NP3.js → SettingsBuilder-26XSGIHK.js} +25 -17
- package/dist/SettingsBuilder-26XSGIHK.js.map +1 -0
- package/dist/{SidebarLayout-M7HEOZVK.js → SidebarLayout-F3XFXW7B.js} +8 -8
- package/dist/{SkillSettings-MXK4ZEI7.js → SkillSettings-IRMGDFRG.js} +6 -6
- package/dist/{WidgetLayout-7MDOKLHU.js → WidgetLayout-SZMABKIR.js} +8 -8
- package/dist/{chunk-NBMP2XNL.js → chunk-7EEOWDLE.js} +7 -7
- package/dist/chunk-DTF7ZMUJ.js +567 -0
- package/dist/chunk-DTF7ZMUJ.js.map +1 -0
- package/dist/{chunk-UXZOL5GO.js → chunk-H7DR64W3.js} +47 -32
- package/dist/chunk-H7DR64W3.js.map +1 -0
- package/dist/{chunk-42GF723P.js → chunk-HT5HKQXE.js} +2 -2
- package/dist/{chunk-WFC3W4C3.js → chunk-LRQHHZDX.js} +4 -4
- package/dist/{chunk-XSHXH6EI.js → chunk-QGNLP2EE.js} +530 -519
- package/dist/chunk-QGNLP2EE.js.map +1 -0
- package/dist/{chunk-UHGSHDBM.js → chunk-XAZ5HJXV.js} +237 -8
- package/dist/chunk-XAZ5HJXV.js.map +1 -0
- package/dist/index.d.ts +11 -3
- package/dist/index.js +115 -20
- package/dist/index.js.map +1 -1
- package/dist/plugins/trueforge-agent-server-adapter/index.d.ts +47 -37
- package/dist/plugins/trueforge-agent-server-adapter/index.js +74 -42
- package/dist/plugins/trueforge-agent-server-adapter/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -3
- package/dist/ConnectorSettings-CLBEWGQJ.js.map +0 -1
- package/dist/OpenUiFenceBlock-SLLZSTMJ.js +0 -9
- package/dist/SandboxSettings-S5XGZWOL.js.map +0 -1
- package/dist/SettingsBuilder-64Y33NP3.js.map +0 -1
- package/dist/chunk-UBOFEI77.js +0 -567
- package/dist/chunk-UBOFEI77.js.map +0 -1
- package/dist/chunk-UHGSHDBM.js.map +0 -1
- package/dist/chunk-UXZOL5GO.js.map +0 -1
- package/dist/chunk-XSHXH6EI.js.map +0 -1
- /package/dist/{DockLayout-WRF7EQLD.js.map → DockLayout-KEMFRWIR.js.map} +0 -0
- /package/dist/{DrawerLayout-X2UXYTOS.js.map → DrawerLayout-ZVWCKEIS.js.map} +0 -0
- /package/dist/{OpenUiFenceBlock-SLLZSTMJ.js.map → OpenUiFenceBlock-XFBUGPKQ.js.map} +0 -0
- /package/dist/{SidebarLayout-M7HEOZVK.js.map → SidebarLayout-F3XFXW7B.js.map} +0 -0
- /package/dist/{SkillSettings-MXK4ZEI7.js.map → SkillSettings-IRMGDFRG.js.map} +0 -0
- /package/dist/{WidgetLayout-7MDOKLHU.js.map → WidgetLayout-SZMABKIR.js.map} +0 -0
- /package/dist/{chunk-NBMP2XNL.js.map → chunk-7EEOWDLE.js.map} +0 -0
- /package/dist/{chunk-42GF723P.js.map → chunk-HT5HKQXE.js.map} +0 -0
- /package/dist/{chunk-WFC3W4C3.js.map → chunk-LRQHHZDX.js.map} +0 -0
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
|
+
DraftCatalogProvider,
|
|
2
3
|
Icon,
|
|
3
4
|
Spinner,
|
|
4
5
|
auiButtonClass,
|
|
6
|
+
getErrorMessage,
|
|
5
7
|
libraryAgentId,
|
|
6
8
|
useCatalogServer,
|
|
7
9
|
useCompactLayout,
|
|
10
|
+
useDraftCatalog,
|
|
8
11
|
useOptionalCatalogServer,
|
|
9
12
|
useOptionalServer,
|
|
10
13
|
useOptionalShellMode,
|
|
11
14
|
useServerCapabilities
|
|
12
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-XAZ5HJXV.js";
|
|
13
16
|
import {
|
|
14
17
|
OpenUiFenceBlock
|
|
15
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-HT5HKQXE.js";
|
|
16
19
|
import {
|
|
17
20
|
ThemeContext,
|
|
18
21
|
ThemeProvider,
|
|
@@ -20,7 +23,7 @@ import {
|
|
|
20
23
|
useOptionalContentClassNames,
|
|
21
24
|
useOptionalThemeMode,
|
|
22
25
|
useOptionalThemePreset
|
|
23
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-DTF7ZMUJ.js";
|
|
24
27
|
|
|
25
28
|
// src/theme/brand.tsx
|
|
26
29
|
import { useContext } from "react";
|
|
@@ -166,7 +169,7 @@ var Button = React2.forwardRef(
|
|
|
166
169
|
Button.displayName = "Button";
|
|
167
170
|
|
|
168
171
|
// src/theme/SlotsProvider.tsx
|
|
169
|
-
import { createContext as
|
|
172
|
+
import { createContext as createContext3, useContext as useContext4, useMemo as useMemo7 } from "react";
|
|
170
173
|
|
|
171
174
|
// src/atoms/primitives/IconButton.tsx
|
|
172
175
|
import React3 from "react";
|
|
@@ -217,10 +220,45 @@ function AskUserPrompt({
|
|
|
217
220
|
}
|
|
218
221
|
if (!currentQuestion) return null;
|
|
219
222
|
const isCustomSelected = currentAnswer.radioValue === ASK_USER_CUSTOM_OPTION;
|
|
223
|
+
const hasOptions = currentQuestion.options.length > 0;
|
|
220
224
|
const handleOptionSelect = (value) => {
|
|
221
225
|
if (readOnly) return;
|
|
222
226
|
onCurrentAnswerChange?.(currentQuestion.id, { radioValue: value });
|
|
223
227
|
};
|
|
228
|
+
const goToNextQuestion = () => onCurrentQuestionIndexChange?.(currentQuestionIndex + 1);
|
|
229
|
+
const isNextStep = isMultiQuestion && !isLastQuestion;
|
|
230
|
+
const handleAnswerKeyDown = (event) => {
|
|
231
|
+
if (event.key !== "Enter" || event.shiftKey || readOnly) return;
|
|
232
|
+
event.preventDefault();
|
|
233
|
+
if (isNextStep) {
|
|
234
|
+
if (!isSubmitDisabled) goToNextQuestion();
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
if (!isSubmitAllDisabled) onSubmit();
|
|
238
|
+
};
|
|
239
|
+
const answerInput = /* @__PURE__ */ jsx6(
|
|
240
|
+
"textarea",
|
|
241
|
+
{
|
|
242
|
+
rows: 1,
|
|
243
|
+
value: currentAnswer.custom,
|
|
244
|
+
disabled: readOnly || !currentQuestion.id,
|
|
245
|
+
onFocus: () => onCurrentAnswerChange?.(currentQuestion.id, {
|
|
246
|
+
radioValue: ASK_USER_CUSTOM_OPTION
|
|
247
|
+
}),
|
|
248
|
+
onChange: (e) => {
|
|
249
|
+
onCurrentAnswerChange?.(currentQuestion.id, {
|
|
250
|
+
custom: e.target.value,
|
|
251
|
+
radioValue: ASK_USER_CUSTOM_OPTION
|
|
252
|
+
});
|
|
253
|
+
},
|
|
254
|
+
placeholder: hasOptions ? "Other" : "Type your answer",
|
|
255
|
+
"aria-label": hasOptions ? "Other (custom answer)" : "Your answer",
|
|
256
|
+
className: cn(
|
|
257
|
+
"field-sizing-content min-h-6 max-h-[3lh] w-full resize-none overflow-y-auto rounded border border-input-border bg-primary-bg px-2 py-0.5 text-[0.8125rem] leading-snug text-text-primary",
|
|
258
|
+
"placeholder:text-[0.8125rem] focus:outline-none focus:ring-1 focus:ring-focus-ring"
|
|
259
|
+
)
|
|
260
|
+
}
|
|
261
|
+
);
|
|
224
262
|
return /* @__PURE__ */ jsxs2(
|
|
225
263
|
"div",
|
|
226
264
|
{
|
|
@@ -277,8 +315,9 @@ function AskUserPrompt({
|
|
|
277
315
|
"div",
|
|
278
316
|
{
|
|
279
317
|
className: "flex flex-col gap-3 overflow-visible",
|
|
280
|
-
role: "radiogroup",
|
|
281
|
-
"aria-label": currentQuestion.question || "Answer options",
|
|
318
|
+
role: hasOptions ? "radiogroup" : void 0,
|
|
319
|
+
"aria-label": hasOptions ? currentQuestion.question || "Answer options" : void 0,
|
|
320
|
+
onKeyDown: handleAnswerKeyDown,
|
|
282
321
|
children: [
|
|
283
322
|
currentQuestion.options.map((opt, index) => {
|
|
284
323
|
const isSelected = currentAnswer.radioValue === opt;
|
|
@@ -308,11 +347,11 @@ function AskUserPrompt({
|
|
|
308
347
|
`${index}:${opt}`
|
|
309
348
|
);
|
|
310
349
|
}),
|
|
311
|
-
/* @__PURE__ */ jsxs2(
|
|
350
|
+
hasOptions ? /* @__PURE__ */ jsxs2(
|
|
312
351
|
"label",
|
|
313
352
|
{
|
|
314
353
|
className: cn(
|
|
315
|
-
"flex items-
|
|
354
|
+
"flex items-start gap-x-2 overflow-visible",
|
|
316
355
|
readOnly ? "cursor-default" : "cursor-pointer"
|
|
317
356
|
),
|
|
318
357
|
children: [
|
|
@@ -325,34 +364,13 @@ function AskUserPrompt({
|
|
|
325
364
|
name: `ask-user-question-option-${currentQuestion.id}`,
|
|
326
365
|
checked: isCustomSelected,
|
|
327
366
|
onChange: () => handleOptionSelect(ASK_USER_CUSTOM_OPTION),
|
|
328
|
-
className: "accent-primary-button-bg"
|
|
367
|
+
className: "mt-1 accent-primary-button-bg"
|
|
329
368
|
}
|
|
330
369
|
),
|
|
331
|
-
/* @__PURE__ */ jsx6("div", { className: "min-w-0 flex-1", children:
|
|
332
|
-
"input",
|
|
333
|
-
{
|
|
334
|
-
value: currentAnswer.custom,
|
|
335
|
-
disabled: readOnly || !currentQuestion.id,
|
|
336
|
-
onFocus: () => onCurrentAnswerChange?.(currentQuestion.id, {
|
|
337
|
-
radioValue: ASK_USER_CUSTOM_OPTION
|
|
338
|
-
}),
|
|
339
|
-
onChange: (e) => {
|
|
340
|
-
onCurrentAnswerChange?.(currentQuestion.id, {
|
|
341
|
-
custom: e.target.value,
|
|
342
|
-
radioValue: ASK_USER_CUSTOM_OPTION
|
|
343
|
-
});
|
|
344
|
-
},
|
|
345
|
-
placeholder: "Other",
|
|
346
|
-
"aria-label": "Other (custom answer)",
|
|
347
|
-
className: cn(
|
|
348
|
-
"h-6 w-full rounded border border-input-border bg-primary-bg px-2 text-[0.8125rem] text-text-primary",
|
|
349
|
-
"placeholder:text-[0.8125rem] focus:outline-none focus:ring-1 focus:ring-focus-ring"
|
|
350
|
-
)
|
|
351
|
-
}
|
|
352
|
-
) })
|
|
370
|
+
/* @__PURE__ */ jsx6("div", { className: "min-w-0 flex-1", children: answerInput })
|
|
353
371
|
]
|
|
354
372
|
}
|
|
355
|
-
)
|
|
373
|
+
) : answerInput
|
|
356
374
|
]
|
|
357
375
|
}
|
|
358
376
|
)
|
|
@@ -366,16 +384,7 @@ function AskUserPrompt({
|
|
|
366
384
|
}),
|
|
367
385
|
children: [
|
|
368
386
|
isMultiQuestion && isLastQuestion && !allQuestionsAnswered ? /* @__PURE__ */ jsx6("span", { className: "text-xs font-medium text-failure-bg", children: "Answer all questions to submit" }) : /* @__PURE__ */ jsx6("span", {}),
|
|
369
|
-
|
|
370
|
-
Button,
|
|
371
|
-
{
|
|
372
|
-
type: "button",
|
|
373
|
-
size: "sm",
|
|
374
|
-
onClick: () => onCurrentQuestionIndexChange?.(currentQuestionIndex + 1),
|
|
375
|
-
disabled: isSubmitDisabled,
|
|
376
|
-
children: "Next"
|
|
377
|
-
}
|
|
378
|
-
) : /* @__PURE__ */ jsx6(Button, { type: "button", size: "sm", onClick: onSubmit, disabled: isSubmitAllDisabled, children: "Submit" })
|
|
387
|
+
isNextStep ? /* @__PURE__ */ jsx6(Button, { type: "button", size: "sm", onClick: goToNextQuestion, disabled: isSubmitDisabled, children: "Next" }) : /* @__PURE__ */ jsx6(Button, { type: "button", size: "sm", onClick: onSubmit, disabled: isSubmitAllDisabled, children: "Submit" })
|
|
379
388
|
]
|
|
380
389
|
}
|
|
381
390
|
)
|
|
@@ -689,57 +698,6 @@ import { useEffect as useEffect4, useState as useState5 } from "react";
|
|
|
689
698
|
// src/atoms/lib/useSearchAgentsList.ts
|
|
690
699
|
import { useCallback, useEffect as useEffect2, useRef, useState as useState3 } from "react";
|
|
691
700
|
|
|
692
|
-
// src/utils/getErrorMessage.ts
|
|
693
|
-
function isRecord(value) {
|
|
694
|
-
return value != null && typeof value === "object";
|
|
695
|
-
}
|
|
696
|
-
function readNonEmptyString(value) {
|
|
697
|
-
return typeof value === "string" && value.trim() !== "" ? value : void 0;
|
|
698
|
-
}
|
|
699
|
-
function messageFromErrorShaped(value) {
|
|
700
|
-
if (!isRecord(value)) return void 0;
|
|
701
|
-
const direct = readNonEmptyString(value.message);
|
|
702
|
-
if (direct != null) return direct;
|
|
703
|
-
if (isRecord(value.error)) {
|
|
704
|
-
return readNonEmptyString(value.error.message);
|
|
705
|
-
}
|
|
706
|
-
return void 0;
|
|
707
|
-
}
|
|
708
|
-
function stringifyError(error) {
|
|
709
|
-
if (typeof error === "string") return error;
|
|
710
|
-
if (isRecord(error)) {
|
|
711
|
-
try {
|
|
712
|
-
return JSON.stringify(error);
|
|
713
|
-
} catch {
|
|
714
|
-
return Object.prototype.toString.call(error);
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
return String(error);
|
|
718
|
-
}
|
|
719
|
-
function getErrorMessage(error, fallback) {
|
|
720
|
-
if (typeof error === "string") {
|
|
721
|
-
const trimmed = error.trim();
|
|
722
|
-
if (trimmed !== "") return error;
|
|
723
|
-
return fallback ?? error;
|
|
724
|
-
}
|
|
725
|
-
if (isRecord(error) && "body" in error) {
|
|
726
|
-
const fromBody = messageFromErrorShaped(error.body);
|
|
727
|
-
if (fromBody != null) return fromBody;
|
|
728
|
-
if (error.body != null) {
|
|
729
|
-
if (typeof error.body === "string") {
|
|
730
|
-
const trimmed = error.body.trim();
|
|
731
|
-
if (trimmed !== "") return error.body;
|
|
732
|
-
} else {
|
|
733
|
-
return stringifyError(error.body);
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
const fromShape = messageFromErrorShaped(error);
|
|
738
|
-
if (fromShape != null) return fromShape;
|
|
739
|
-
if (fallback != null) return fallback;
|
|
740
|
-
return stringifyError(error);
|
|
741
|
-
}
|
|
742
|
-
|
|
743
701
|
// src/atoms/lib/useDebouncedValue.ts
|
|
744
702
|
import { useEffect, useState as useState2 } from "react";
|
|
745
703
|
function useDebouncedValue(value, delayMs) {
|
|
@@ -1844,7 +1802,7 @@ function ComposerShell({
|
|
|
1844
1802
|
|
|
1845
1803
|
// src/atoms/draft/DraftReasoningEffortSelector.tsx
|
|
1846
1804
|
import { useTrueFoundryAgentSpec as useTrueFoundryAgentSpec2, useTrueFoundryUpdateAgentSpec } from "@truefoundry/assistant-ui-runtime";
|
|
1847
|
-
import { useEffect as
|
|
1805
|
+
import { useEffect as useEffect7, useId as useId3, useRef as useRef4, useState as useState11 } from "react";
|
|
1848
1806
|
|
|
1849
1807
|
// src/atoms/lib/useIsMobile.ts
|
|
1850
1808
|
import { useSyncExternalStore } from "react";
|
|
@@ -1919,96 +1877,6 @@ function BottomSheet({
|
|
|
1919
1877
|
);
|
|
1920
1878
|
}
|
|
1921
1879
|
|
|
1922
|
-
// src/atoms/draft/DraftCatalogProvider.tsx
|
|
1923
|
-
import { createContext as createContext2, useCallback as useCallback3, useContext as useContext3, useEffect as useEffect7, useMemo, useState as useState11 } from "react";
|
|
1924
|
-
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
1925
|
-
var DraftCatalogContext = createContext2(null);
|
|
1926
|
-
var IDLE_ENSURE = () => void 0;
|
|
1927
|
-
var IDLE_REFRESH = async () => void 0;
|
|
1928
|
-
function DraftCatalogProvider({ children }) {
|
|
1929
|
-
const server = useOptionalServer();
|
|
1930
|
-
const existing = useContext3(DraftCatalogContext);
|
|
1931
|
-
if (existing?.server === server) {
|
|
1932
|
-
return children;
|
|
1933
|
-
}
|
|
1934
|
-
return /* @__PURE__ */ jsx30(DraftCatalogStore, { server, children });
|
|
1935
|
-
}
|
|
1936
|
-
function DraftCatalogStore({ server, children }) {
|
|
1937
|
-
const [requested, setRequested] = useState11(false);
|
|
1938
|
-
const [models, setModels] = useState11([]);
|
|
1939
|
-
const [skills, setSkills] = useState11([]);
|
|
1940
|
-
const [connectors, setConnectors] = useState11([]);
|
|
1941
|
-
const [loading, setLoading] = useState11(false);
|
|
1942
|
-
const [error, setError] = useState11(null);
|
|
1943
|
-
const ensureLoaded = useCallback3(() => {
|
|
1944
|
-
setRequested(true);
|
|
1945
|
-
}, []);
|
|
1946
|
-
const refreshConnectors = useCallback3(async () => {
|
|
1947
|
-
if (!server) return;
|
|
1948
|
-
setLoading(true);
|
|
1949
|
-
setError(null);
|
|
1950
|
-
try {
|
|
1951
|
-
const nextConnectors = await server.getMcp();
|
|
1952
|
-
setConnectors(nextConnectors);
|
|
1953
|
-
} catch (reason) {
|
|
1954
|
-
setError(getErrorMessage(reason, "Failed to load connectors."));
|
|
1955
|
-
} finally {
|
|
1956
|
-
setLoading(false);
|
|
1957
|
-
}
|
|
1958
|
-
}, [server]);
|
|
1959
|
-
useEffect7(() => {
|
|
1960
|
-
if (!requested || !server) return;
|
|
1961
|
-
let cancelled = false;
|
|
1962
|
-
setLoading(true);
|
|
1963
|
-
setError(null);
|
|
1964
|
-
void Promise.allSettled([server.getModels(), server.getSkills(), server.getMcp()]).then(([modelsResult, skillsResult, mcpResult]) => {
|
|
1965
|
-
if (cancelled) return;
|
|
1966
|
-
const errors = [];
|
|
1967
|
-
if (modelsResult.status === "fulfilled") {
|
|
1968
|
-
setModels(modelsResult.value);
|
|
1969
|
-
} else {
|
|
1970
|
-
errors.push(getErrorMessage(modelsResult.reason, "Failed to load models."));
|
|
1971
|
-
}
|
|
1972
|
-
if (skillsResult.status === "fulfilled") {
|
|
1973
|
-
setSkills(skillsResult.value);
|
|
1974
|
-
} else {
|
|
1975
|
-
errors.push(getErrorMessage(skillsResult.reason, "Failed to load skills."));
|
|
1976
|
-
}
|
|
1977
|
-
if (mcpResult.status === "fulfilled") {
|
|
1978
|
-
setConnectors(mcpResult.value);
|
|
1979
|
-
} else {
|
|
1980
|
-
errors.push(getErrorMessage(mcpResult.reason, "Failed to load connectors."));
|
|
1981
|
-
}
|
|
1982
|
-
setError(errors[0] ?? null);
|
|
1983
|
-
}).finally(() => {
|
|
1984
|
-
if (!cancelled) setLoading(false);
|
|
1985
|
-
});
|
|
1986
|
-
return () => {
|
|
1987
|
-
cancelled = true;
|
|
1988
|
-
};
|
|
1989
|
-
}, [requested, server]);
|
|
1990
|
-
const value = useMemo(
|
|
1991
|
-
() => ({ server, models, skills, connectors, loading, error, ensureLoaded, refreshConnectors }),
|
|
1992
|
-
[server, models, skills, connectors, loading, error, ensureLoaded, refreshConnectors]
|
|
1993
|
-
);
|
|
1994
|
-
return /* @__PURE__ */ jsx30(DraftCatalogContext.Provider, { value, children });
|
|
1995
|
-
}
|
|
1996
|
-
function useDraftCatalog() {
|
|
1997
|
-
const ctx = useContext3(DraftCatalogContext);
|
|
1998
|
-
if (ctx == null) {
|
|
1999
|
-
return {
|
|
2000
|
-
models: [],
|
|
2001
|
-
skills: [],
|
|
2002
|
-
connectors: [],
|
|
2003
|
-
loading: false,
|
|
2004
|
-
error: null,
|
|
2005
|
-
ensureLoaded: IDLE_ENSURE,
|
|
2006
|
-
refreshConnectors: IDLE_REFRESH
|
|
2007
|
-
};
|
|
2008
|
-
}
|
|
2009
|
-
return ctx;
|
|
2010
|
-
}
|
|
2011
|
-
|
|
2012
1880
|
// src/atoms/draft/reasoningEffort.ts
|
|
2013
1881
|
function hasReasoningEfforts(efforts) {
|
|
2014
1882
|
return Array.isArray(efforts) && efforts.length > 0;
|
|
@@ -2032,12 +1900,12 @@ function modelPatchWithReasoningEffort(name, existingParams, efforts) {
|
|
|
2032
1900
|
}
|
|
2033
1901
|
|
|
2034
1902
|
// src/atoms/draft/DraftReasoningEffortSelector.tsx
|
|
2035
|
-
import { Fragment as Fragment5, jsx as
|
|
1903
|
+
import { Fragment as Fragment5, jsx as jsx30, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2036
1904
|
function DraftReasoningEffortSelector({ disabled, isRunning }) {
|
|
2037
1905
|
const { models, ensureLoaded } = useDraftCatalog();
|
|
2038
1906
|
const { agentSpec } = useTrueFoundryAgentSpec2();
|
|
2039
1907
|
const updateAgentSpec = useTrueFoundryUpdateAgentSpec();
|
|
2040
|
-
const [open, setOpen] =
|
|
1908
|
+
const [open, setOpen] = useState11(false);
|
|
2041
1909
|
const containerRef = useRef4(null);
|
|
2042
1910
|
const clearedStickyEffortForModelRef = useRef4(null);
|
|
2043
1911
|
const menuId = useId3();
|
|
@@ -2048,10 +1916,10 @@ function DraftReasoningEffortSelector({ disabled, isRunning }) {
|
|
|
2048
1916
|
const efforts = selected?.properties.reasoningEfforts;
|
|
2049
1917
|
const currentEffort = agentSpec?.model?.params?.reasoningEffort;
|
|
2050
1918
|
const resolved = resolveReasoningEffort(efforts, currentEffort);
|
|
2051
|
-
|
|
1919
|
+
useEffect7(() => {
|
|
2052
1920
|
ensureLoaded();
|
|
2053
1921
|
}, [ensureLoaded]);
|
|
2054
|
-
|
|
1922
|
+
useEffect7(() => {
|
|
2055
1923
|
if (!open) return;
|
|
2056
1924
|
const handler = (e) => {
|
|
2057
1925
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -2061,7 +1929,7 @@ function DraftReasoningEffortSelector({ disabled, isRunning }) {
|
|
|
2061
1929
|
document.addEventListener("mousedown", handler);
|
|
2062
1930
|
return () => document.removeEventListener("mousedown", handler);
|
|
2063
1931
|
}, [open]);
|
|
2064
|
-
|
|
1932
|
+
useEffect7(() => {
|
|
2065
1933
|
if (!updateAgentSpec || selected === void 0) return;
|
|
2066
1934
|
if (hasReasoningEfforts(efforts)) {
|
|
2067
1935
|
clearedStickyEffortForModelRef.current = null;
|
|
@@ -2076,8 +1944,8 @@ function DraftReasoningEffortSelector({ disabled, isRunning }) {
|
|
|
2076
1944
|
}, [updateAgentSpec, selected, efforts, currentEffort, agentSpec?.model?.params]);
|
|
2077
1945
|
if (!hasReasoningEfforts(efforts) || !resolved) return null;
|
|
2078
1946
|
const content = /* @__PURE__ */ jsxs20(Fragment5, { children: [
|
|
2079
|
-
/* @__PURE__ */
|
|
2080
|
-
/* @__PURE__ */
|
|
1947
|
+
/* @__PURE__ */ jsx30("div", { className: "border-b border-border px-3 py-2", children: /* @__PURE__ */ jsx30("p", { className: "text-text-primary text-sm font-semibold", children: "Reasoning effort" }) }),
|
|
1948
|
+
/* @__PURE__ */ jsx30(
|
|
2081
1949
|
"div",
|
|
2082
1950
|
{
|
|
2083
1951
|
id: menuId,
|
|
@@ -2086,7 +1954,7 @@ function DraftReasoningEffortSelector({ disabled, isRunning }) {
|
|
|
2086
1954
|
className: "flex min-h-0 flex-1 flex-col overflow-y-auto p-1",
|
|
2087
1955
|
children: efforts.map((effort) => {
|
|
2088
1956
|
const active = effort === resolved;
|
|
2089
|
-
return /* @__PURE__ */
|
|
1957
|
+
return /* @__PURE__ */ jsx30(
|
|
2090
1958
|
"button",
|
|
2091
1959
|
{
|
|
2092
1960
|
type: "button",
|
|
@@ -2107,7 +1975,7 @@ function DraftReasoningEffortSelector({ disabled, isRunning }) {
|
|
|
2107
1975
|
});
|
|
2108
1976
|
setOpen(false);
|
|
2109
1977
|
},
|
|
2110
|
-
children: /* @__PURE__ */
|
|
1978
|
+
children: /* @__PURE__ */ jsx30("span", { className: "truncate font-medium", children: effort })
|
|
2111
1979
|
},
|
|
2112
1980
|
effort
|
|
2113
1981
|
);
|
|
@@ -2135,43 +2003,43 @@ function DraftReasoningEffortSelector({ disabled, isRunning }) {
|
|
|
2135
2003
|
}),
|
|
2136
2004
|
onClick: () => setOpen((v) => !v),
|
|
2137
2005
|
children: [
|
|
2138
|
-
/* @__PURE__ */
|
|
2139
|
-
/* @__PURE__ */
|
|
2006
|
+
/* @__PURE__ */ jsx30("span", { className: "truncate", children: resolved }),
|
|
2007
|
+
/* @__PURE__ */ jsx30(Icon, { name: "chevron-down", className: "size-3.5 shrink-0 opacity-60" })
|
|
2140
2008
|
]
|
|
2141
2009
|
}
|
|
2142
2010
|
),
|
|
2143
|
-
open ? isMobile || compactLayout ? /* @__PURE__ */
|
|
2011
|
+
open ? isMobile || compactLayout ? /* @__PURE__ */ jsx30(BottomSheet, { open: true, onOpenChange: setOpen, "aria-label": "Select reasoning effort", children: content }) : /* @__PURE__ */ jsx30("div", { className: "bg-card-bg text-text-primary absolute right-0 bottom-full z-50 mb-2 flex max-h-[22rem] w-[12rem] flex-col overflow-hidden rounded-lg border border-border shadow-lg", children: content }) : null
|
|
2144
2012
|
] });
|
|
2145
2013
|
}
|
|
2146
2014
|
|
|
2147
2015
|
// src/atoms/draft/DraftComposerSections.tsx
|
|
2148
|
-
import { jsx as
|
|
2016
|
+
import { jsx as jsx31, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2149
2017
|
function DraftComposerLeftSection({ disabled, isRunning, onAttach }) {
|
|
2150
2018
|
const DraftCompositeSelector2 = useSlot("DraftCompositeSelector");
|
|
2151
|
-
return /* @__PURE__ */
|
|
2019
|
+
return /* @__PURE__ */ jsx31("div", { className: "flex min-w-0 flex-wrap items-center gap-1.5", children: /* @__PURE__ */ jsx31(DraftCompositeSelector2, { disabled, isRunning, onAttach }) });
|
|
2152
2020
|
}
|
|
2153
2021
|
function DraftComposerRightSection({ disabled, isRunning }) {
|
|
2154
2022
|
const DraftModelSelector2 = useSlot("DraftModelSelector");
|
|
2155
2023
|
return /* @__PURE__ */ jsxs21("div", { className: "flex min-w-0 items-center gap-1", children: [
|
|
2156
|
-
/* @__PURE__ */
|
|
2157
|
-
/* @__PURE__ */
|
|
2024
|
+
/* @__PURE__ */ jsx31(DraftModelSelector2, { disabled, isRunning }),
|
|
2025
|
+
/* @__PURE__ */ jsx31(DraftReasoningEffortSelector, { disabled, isRunning })
|
|
2158
2026
|
] });
|
|
2159
2027
|
}
|
|
2160
2028
|
|
|
2161
2029
|
// src/atoms/draft/DraftCompositeSelector.tsx
|
|
2162
2030
|
import { useTrueFoundryAgentSpec as useTrueFoundryAgentSpec3, useTrueFoundryUpdateAgentSpec as useTrueFoundryUpdateAgentSpec2 } from "@truefoundry/assistant-ui-runtime";
|
|
2163
|
-
import { useCallback as
|
|
2031
|
+
import { useCallback as useCallback5, useEffect as useEffect9, useId as useId4, useMemo as useMemo3, useRef as useRef7, useState as useState15 } from "react";
|
|
2164
2032
|
|
|
2165
2033
|
// src/hooks/useMcpAuth.ts
|
|
2166
|
-
import { useCallback as
|
|
2034
|
+
import { useCallback as useCallback4, useEffect as useEffect8, useMemo as useMemo2, useRef as useRef5, useState as useState13 } from "react";
|
|
2167
2035
|
|
|
2168
2036
|
// src/containers/ToasterContainer.tsx
|
|
2169
|
-
import { createContext as
|
|
2170
|
-
import { jsx as
|
|
2037
|
+
import { createContext as createContext2, useCallback as useCallback3, useContext as useContext3, useMemo, useState as useState12 } from "react";
|
|
2038
|
+
import { jsx as jsx32, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2171
2039
|
var MAX_TOAST_DESCRIPTION_CHARS = 480;
|
|
2172
2040
|
var MAX_VISIBLE_TOASTS = 5;
|
|
2173
2041
|
var SUCCESS_TOAST_TTL_MS = 3e3;
|
|
2174
|
-
var ToasterContext =
|
|
2042
|
+
var ToasterContext = createContext2(null);
|
|
2175
2043
|
var toastId = 0;
|
|
2176
2044
|
function nextToastId() {
|
|
2177
2045
|
toastId += 1;
|
|
@@ -2201,16 +2069,16 @@ function normalizeError(error) {
|
|
|
2201
2069
|
function ToasterProvider({ children }) {
|
|
2202
2070
|
const Toast2 = useSlot("Toast");
|
|
2203
2071
|
const ToastStack2 = useSlot("ToastStack");
|
|
2204
|
-
const [toasts, setToasts] =
|
|
2205
|
-
const dismiss =
|
|
2072
|
+
const [toasts, setToasts] = useState12([]);
|
|
2073
|
+
const dismiss = useCallback3((id) => {
|
|
2206
2074
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
2207
2075
|
}, []);
|
|
2208
|
-
const showError =
|
|
2076
|
+
const showError = useCallback3((error) => {
|
|
2209
2077
|
console.error("[trueforge-ui]", error);
|
|
2210
2078
|
const item = { id: nextToastId(), variant: "error", ...normalizeError(error) };
|
|
2211
2079
|
setToasts((prev) => [...prev, item].slice(-MAX_VISIBLE_TOASTS));
|
|
2212
2080
|
}, []);
|
|
2213
|
-
const showSuccess =
|
|
2081
|
+
const showSuccess = useCallback3(
|
|
2214
2082
|
(content) => {
|
|
2215
2083
|
const id = nextToastId();
|
|
2216
2084
|
const item = { id, variant: "success", ...content };
|
|
@@ -2221,10 +2089,10 @@ function ToasterProvider({ children }) {
|
|
|
2221
2089
|
},
|
|
2222
2090
|
[dismiss]
|
|
2223
2091
|
);
|
|
2224
|
-
const value =
|
|
2092
|
+
const value = useMemo(() => ({ showError, showSuccess }), [showError, showSuccess]);
|
|
2225
2093
|
return /* @__PURE__ */ jsxs22(ToasterContext.Provider, { value, children: [
|
|
2226
2094
|
children,
|
|
2227
|
-
/* @__PURE__ */
|
|
2095
|
+
/* @__PURE__ */ jsx32(ToastStack2, { children: toasts.map((toast) => /* @__PURE__ */ jsx32(
|
|
2228
2096
|
Toast2,
|
|
2229
2097
|
{
|
|
2230
2098
|
title: toast.title,
|
|
@@ -2240,14 +2108,14 @@ function ToasterProvider({ children }) {
|
|
|
2240
2108
|
] });
|
|
2241
2109
|
}
|
|
2242
2110
|
function useToaster() {
|
|
2243
|
-
const context =
|
|
2111
|
+
const context = useContext3(ToasterContext);
|
|
2244
2112
|
if (context == null) {
|
|
2245
2113
|
throw new Error("useToaster must be used within ToasterProvider");
|
|
2246
2114
|
}
|
|
2247
2115
|
return context;
|
|
2248
2116
|
}
|
|
2249
2117
|
function useToasterOptional() {
|
|
2250
|
-
return
|
|
2118
|
+
return useContext3(ToasterContext);
|
|
2251
2119
|
}
|
|
2252
2120
|
|
|
2253
2121
|
// src/hooks/useMcpAuth.ts
|
|
@@ -2261,15 +2129,15 @@ var isPopupMessage = (value) => {
|
|
|
2261
2129
|
var useMCPAuth = ({ callbackPath } = {}) => {
|
|
2262
2130
|
const { connectorCatalog } = useCatalogServer();
|
|
2263
2131
|
const toaster = useToasterOptional();
|
|
2264
|
-
const [isOAuthLoading, setIsOAuthLoading] =
|
|
2265
|
-
const popupUid =
|
|
2132
|
+
const [isOAuthLoading, setIsOAuthLoading] = useState13(false);
|
|
2133
|
+
const popupUid = useMemo2(() => generatePopupUid(), []);
|
|
2266
2134
|
const listenerCleanupRef = useRef5(null);
|
|
2267
|
-
const clearPopupListener =
|
|
2135
|
+
const clearPopupListener = useCallback4(() => {
|
|
2268
2136
|
listenerCleanupRef.current?.();
|
|
2269
2137
|
listenerCleanupRef.current = null;
|
|
2270
2138
|
}, []);
|
|
2271
|
-
|
|
2272
|
-
const openAuthPopup =
|
|
2139
|
+
useEffect8(() => clearPopupListener, [clearPopupListener]);
|
|
2140
|
+
const openAuthPopup = useCallback4(
|
|
2273
2141
|
(authorizationEndpoint, callback) => {
|
|
2274
2142
|
clearPopupListener();
|
|
2275
2143
|
const channel = new BroadcastChannel(MCP_AUTH_POPUP_CHANNEL);
|
|
@@ -2296,7 +2164,7 @@ var useMCPAuth = ({ callbackPath } = {}) => {
|
|
|
2296
2164
|
},
|
|
2297
2165
|
[clearPopupListener, popupUid]
|
|
2298
2166
|
);
|
|
2299
|
-
const handleAuthorize =
|
|
2167
|
+
const handleAuthorize = useCallback4(
|
|
2300
2168
|
async (integrationId, callback) => {
|
|
2301
2169
|
if (!integrationId) return;
|
|
2302
2170
|
try {
|
|
@@ -2333,16 +2201,24 @@ var useMCPAuth = ({ callbackPath } = {}) => {
|
|
|
2333
2201
|
};
|
|
2334
2202
|
};
|
|
2335
2203
|
|
|
2204
|
+
// src/atoms/lib/inputClasses.ts
|
|
2205
|
+
var baseClasses = "w-full cursor-text rounded-md border border-input-border bg-input-box-bg px-3 text-sm text-text-primary outline-none placeholder:text-text-secondary/70 focus-visible:ring-2 focus-visible:ring-focus-ring/40 disabled:cursor-not-allowed";
|
|
2206
|
+
function auiInputClass(className) {
|
|
2207
|
+
return cn(baseClasses, className);
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2336
2210
|
// src/atoms/primitives/Tooltip.tsx
|
|
2337
|
-
import { cloneElement, isValidElement, useLayoutEffect as useLayoutEffect2, useRef as useRef6, useState as
|
|
2211
|
+
import { cloneElement, isValidElement, useLayoutEffect as useLayoutEffect2, useRef as useRef6, useState as useState14 } from "react";
|
|
2338
2212
|
import { createPortal } from "react-dom";
|
|
2339
|
-
import { jsx as
|
|
2213
|
+
import { jsx as jsx33, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2340
2214
|
function themePortalRoot(from) {
|
|
2215
|
+
const dialog = from?.closest("dialog");
|
|
2216
|
+
if (dialog instanceof HTMLElement) return dialog;
|
|
2341
2217
|
return from?.closest(".aui-theme-root") ?? document.body;
|
|
2342
2218
|
}
|
|
2343
2219
|
function Tooltip({ content, children, className, side = "top" }) {
|
|
2344
|
-
const [visible, setVisible] =
|
|
2345
|
-
const [pos, setPos] =
|
|
2220
|
+
const [visible, setVisible] = useState14(false);
|
|
2221
|
+
const [pos, setPos] = useState14(null);
|
|
2346
2222
|
const triggerWrapRef = useRef6(null);
|
|
2347
2223
|
useLayoutEffect2(() => {
|
|
2348
2224
|
if (!visible) {
|
|
@@ -2391,7 +2267,7 @@ function Tooltip({ content, children, className, side = "top" }) {
|
|
|
2391
2267
|
}
|
|
2392
2268
|
});
|
|
2393
2269
|
const tooltip = visible && content != null && pos != null ? createPortal(
|
|
2394
|
-
/* @__PURE__ */
|
|
2270
|
+
/* @__PURE__ */ jsx33(
|
|
2395
2271
|
"span",
|
|
2396
2272
|
{
|
|
2397
2273
|
role: "tooltip",
|
|
@@ -2416,7 +2292,7 @@ function Tooltip({ content, children, className, side = "top" }) {
|
|
|
2416
2292
|
] });
|
|
2417
2293
|
}
|
|
2418
2294
|
function LightTooltip({ title, children, className, size: _size, side }) {
|
|
2419
|
-
return /* @__PURE__ */
|
|
2295
|
+
return /* @__PURE__ */ jsx33(Tooltip, { content: title, className, side, children });
|
|
2420
2296
|
}
|
|
2421
2297
|
|
|
2422
2298
|
// src/atoms/draft/agentCapabilities.ts
|
|
@@ -2445,7 +2321,7 @@ function withAgentCapabilities({
|
|
|
2445
2321
|
}
|
|
2446
2322
|
|
|
2447
2323
|
// src/atoms/primitives/Switch.tsx
|
|
2448
|
-
import { jsx as
|
|
2324
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
2449
2325
|
var sizeClasses2 = {
|
|
2450
2326
|
sm: {
|
|
2451
2327
|
track: "h-5 w-9 p-0.5",
|
|
@@ -2460,7 +2336,7 @@ var sizeClasses2 = {
|
|
|
2460
2336
|
};
|
|
2461
2337
|
function Switch({ checked, onCheckedChange, size = "sm", disabled, className, ...props }) {
|
|
2462
2338
|
const classes = sizeClasses2[size];
|
|
2463
|
-
return /* @__PURE__ */
|
|
2339
|
+
return /* @__PURE__ */ jsx34(
|
|
2464
2340
|
"button",
|
|
2465
2341
|
{
|
|
2466
2342
|
...props,
|
|
@@ -2478,7 +2354,7 @@ function Switch({ checked, onCheckedChange, size = "sm", disabled, className, ..
|
|
|
2478
2354
|
className
|
|
2479
2355
|
),
|
|
2480
2356
|
onClick: () => onCheckedChange(!checked),
|
|
2481
|
-
children: /* @__PURE__ */
|
|
2357
|
+
children: /* @__PURE__ */ jsx34(
|
|
2482
2358
|
"span",
|
|
2483
2359
|
{
|
|
2484
2360
|
"aria-hidden": true,
|
|
@@ -2495,7 +2371,7 @@ function Switch({ checked, onCheckedChange, size = "sm", disabled, className, ..
|
|
|
2495
2371
|
}
|
|
2496
2372
|
|
|
2497
2373
|
// src/atoms/draft/DraftCapabilitiesPanel.tsx
|
|
2498
|
-
import { jsx as
|
|
2374
|
+
import { jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2499
2375
|
var CAPABILITIES = [
|
|
2500
2376
|
{
|
|
2501
2377
|
id: "generativeUi",
|
|
@@ -2517,9 +2393,38 @@ function DraftCapabilitiesPanel({
|
|
|
2517
2393
|
value,
|
|
2518
2394
|
onChange,
|
|
2519
2395
|
disabled = false,
|
|
2520
|
-
divided = false
|
|
2396
|
+
divided = false,
|
|
2397
|
+
layout = "list"
|
|
2521
2398
|
}) {
|
|
2522
|
-
|
|
2399
|
+
if (layout === "cards") {
|
|
2400
|
+
return /* @__PURE__ */ jsx35("div", { className: "flex flex-col gap-2 sm:flex-row", children: CAPABILITIES.map((capability) => {
|
|
2401
|
+
const checked = value[capability.id];
|
|
2402
|
+
return /* @__PURE__ */ jsxs24(
|
|
2403
|
+
"div",
|
|
2404
|
+
{
|
|
2405
|
+
className: "border-border flex min-w-0 flex-col gap-2 rounded-lg border p-3 sm:flex-1",
|
|
2406
|
+
children: [
|
|
2407
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-start justify-between gap-2", children: [
|
|
2408
|
+
/* @__PURE__ */ jsx35("p", { className: "text-text-primary text-sm font-medium", children: capability.label }),
|
|
2409
|
+
/* @__PURE__ */ jsx35(
|
|
2410
|
+
Switch,
|
|
2411
|
+
{
|
|
2412
|
+
checked,
|
|
2413
|
+
"aria-label": capability.label,
|
|
2414
|
+
disabled,
|
|
2415
|
+
className: "mt-0.5",
|
|
2416
|
+
onCheckedChange: (nextChecked) => onChange({ ...value, [capability.id]: nextChecked })
|
|
2417
|
+
}
|
|
2418
|
+
)
|
|
2419
|
+
] }),
|
|
2420
|
+
/* @__PURE__ */ jsx35("p", { className: "text-text-secondary text-xs leading-snug", children: capability.description })
|
|
2421
|
+
]
|
|
2422
|
+
},
|
|
2423
|
+
capability.id
|
|
2424
|
+
);
|
|
2425
|
+
}) });
|
|
2426
|
+
}
|
|
2427
|
+
return /* @__PURE__ */ jsx35("div", { className: cn("flex flex-col", divided && "overflow-hidden rounded-xl border border-border"), children: CAPABILITIES.map((capability, index) => {
|
|
2523
2428
|
const checked = value[capability.id];
|
|
2524
2429
|
return /* @__PURE__ */ jsxs24(
|
|
2525
2430
|
"div",
|
|
@@ -2527,10 +2432,10 @@ function DraftCapabilitiesPanel({
|
|
|
2527
2432
|
className: cn("flex items-start gap-3 px-3 py-3", divided && index > 0 && "border-t border-border"),
|
|
2528
2433
|
children: [
|
|
2529
2434
|
/* @__PURE__ */ jsxs24("div", { className: "min-w-0 flex-1", children: [
|
|
2530
|
-
/* @__PURE__ */
|
|
2531
|
-
/* @__PURE__ */
|
|
2435
|
+
/* @__PURE__ */ jsx35("p", { className: "text-text-primary text-sm font-medium", children: capability.label }),
|
|
2436
|
+
/* @__PURE__ */ jsx35("p", { className: "text-text-secondary mt-0.5 text-xs leading-snug", children: capability.description })
|
|
2532
2437
|
] }),
|
|
2533
|
-
/* @__PURE__ */
|
|
2438
|
+
/* @__PURE__ */ jsx35(
|
|
2534
2439
|
Switch,
|
|
2535
2440
|
{
|
|
2536
2441
|
checked,
|
|
@@ -2547,8 +2452,39 @@ function DraftCapabilitiesPanel({
|
|
|
2547
2452
|
}) });
|
|
2548
2453
|
}
|
|
2549
2454
|
|
|
2455
|
+
// src/atoms/draft/DraftCatalogEmptyState.tsx
|
|
2456
|
+
import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2457
|
+
function DraftCatalogEmptyState({
|
|
2458
|
+
loading,
|
|
2459
|
+
emptyLabel,
|
|
2460
|
+
settingsTarget,
|
|
2461
|
+
onOpenSettings
|
|
2462
|
+
}) {
|
|
2463
|
+
if (!loading && onOpenSettings) {
|
|
2464
|
+
return /* @__PURE__ */ jsxs25(
|
|
2465
|
+
"button",
|
|
2466
|
+
{
|
|
2467
|
+
type: "button",
|
|
2468
|
+
className: auiButtonClass({
|
|
2469
|
+
variant: "ghost",
|
|
2470
|
+
className: "text-text-secondary w-full justify-center gap-1 py-4 text-xs"
|
|
2471
|
+
}),
|
|
2472
|
+
onClick: onOpenSettings,
|
|
2473
|
+
children: [
|
|
2474
|
+
"Please configure ",
|
|
2475
|
+
settingsTarget,
|
|
2476
|
+
" in the ",
|
|
2477
|
+
/* @__PURE__ */ jsx36("span", { className: "underline", children: "settings" }),
|
|
2478
|
+
/* @__PURE__ */ jsx36(Icon, { name: "chevron-right", className: "size-3" })
|
|
2479
|
+
]
|
|
2480
|
+
}
|
|
2481
|
+
);
|
|
2482
|
+
}
|
|
2483
|
+
return /* @__PURE__ */ jsx36("p", { className: "text-text-secondary px-2 py-4 text-center text-sm", children: loading ? "Loading\u2026" : emptyLabel });
|
|
2484
|
+
}
|
|
2485
|
+
|
|
2550
2486
|
// src/atoms/draft/DraftCompositeSelector.tsx
|
|
2551
|
-
import { Fragment as Fragment6, jsx as jsx37, jsxs as
|
|
2487
|
+
import { Fragment as Fragment6, jsx as jsx37, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2552
2488
|
function draftMountsFromSpec(value) {
|
|
2553
2489
|
if (!Array.isArray(value)) return [];
|
|
2554
2490
|
const mounts = [];
|
|
@@ -2588,15 +2524,15 @@ function CatalogRow({
|
|
|
2588
2524
|
onToggle,
|
|
2589
2525
|
action
|
|
2590
2526
|
}) {
|
|
2591
|
-
const content = /* @__PURE__ */
|
|
2527
|
+
const content = /* @__PURE__ */ jsxs26(Fragment6, { children: [
|
|
2592
2528
|
/* @__PURE__ */ jsx37("span", { className: "bg-secondary-bg text-text-secondary mt-0.5 flex size-7 shrink-0 items-center justify-center rounded text-xs font-semibold", children: title.charAt(0).toUpperCase() }),
|
|
2593
|
-
/* @__PURE__ */
|
|
2529
|
+
/* @__PURE__ */ jsxs26("span", { className: "min-w-0 flex-1", children: [
|
|
2594
2530
|
/* @__PURE__ */ jsx37("span", { className: "text-text-primary block truncate text-sm font-medium", children: title }),
|
|
2595
2531
|
description ? /* @__PURE__ */ jsx37("span", { className: "text-text-secondary line-clamp-1 text-xs", children: description }) : null
|
|
2596
2532
|
] })
|
|
2597
2533
|
] });
|
|
2598
2534
|
if (action) {
|
|
2599
|
-
return /* @__PURE__ */
|
|
2535
|
+
return /* @__PURE__ */ jsxs26(
|
|
2600
2536
|
"div",
|
|
2601
2537
|
{
|
|
2602
2538
|
role: "menuitemcheckbox",
|
|
@@ -2617,7 +2553,7 @@ function CatalogRow({
|
|
|
2617
2553
|
}
|
|
2618
2554
|
);
|
|
2619
2555
|
}
|
|
2620
|
-
return /* @__PURE__ */
|
|
2556
|
+
return /* @__PURE__ */ jsxs26(
|
|
2621
2557
|
"button",
|
|
2622
2558
|
{
|
|
2623
2559
|
type: "button",
|
|
@@ -2667,7 +2603,7 @@ function SearchField({
|
|
|
2667
2603
|
onChange,
|
|
2668
2604
|
placeholder
|
|
2669
2605
|
}) {
|
|
2670
|
-
return /* @__PURE__ */
|
|
2606
|
+
return /* @__PURE__ */ jsxs26("label", { className: "relative mx-3 my-2 block", children: [
|
|
2671
2607
|
/* @__PURE__ */ jsx37(
|
|
2672
2608
|
Icon,
|
|
2673
2609
|
{
|
|
@@ -2682,13 +2618,13 @@ function SearchField({
|
|
|
2682
2618
|
value,
|
|
2683
2619
|
onChange: (e) => onChange(e.target.value),
|
|
2684
2620
|
placeholder,
|
|
2685
|
-
className: "
|
|
2621
|
+
className: auiInputClass("h-8 bg-secondary-bg py-1 pr-2 pl-7 dark:bg-primary-bg")
|
|
2686
2622
|
}
|
|
2687
2623
|
)
|
|
2688
2624
|
] });
|
|
2689
2625
|
}
|
|
2690
2626
|
function SectionHeading({ label, count }) {
|
|
2691
|
-
return /* @__PURE__ */
|
|
2627
|
+
return /* @__PURE__ */ jsxs26("div", { className: "text-text-secondary px-3 pt-2 pb-1 text-[11px] font-medium tracking-wide uppercase", children: [
|
|
2692
2628
|
label,
|
|
2693
2629
|
" (",
|
|
2694
2630
|
count,
|
|
@@ -2696,17 +2632,19 @@ function SectionHeading({ label, count }) {
|
|
|
2696
2632
|
] });
|
|
2697
2633
|
}
|
|
2698
2634
|
function DraftCompositeSelector({ disabled, isRunning, onAttach }) {
|
|
2699
|
-
const { skills, connectors, ensureLoaded, refreshConnectors } = useDraftCatalog();
|
|
2635
|
+
const { skills, connectors, loading, ensureLoaded, refreshConnectors } = useDraftCatalog();
|
|
2700
2636
|
const capabilities = useServerCapabilities();
|
|
2637
|
+
const settingsCatalog = useOptionalCatalogServer();
|
|
2638
|
+
const shell = useOptionalShellMode();
|
|
2701
2639
|
const { agentSpec } = useTrueFoundryAgentSpec3();
|
|
2702
2640
|
const updateAgentSpec = useTrueFoundryUpdateAgentSpec2();
|
|
2703
|
-
const [open, setOpen] =
|
|
2704
|
-
const [tab, setTab] =
|
|
2705
|
-
const [query, setQuery] =
|
|
2706
|
-
const [pinnedMcpIds, setPinnedMcpIds] =
|
|
2707
|
-
const [pinnedSkillIds, setPinnedSkillIds] =
|
|
2708
|
-
const [localMcp, setLocalMcp] =
|
|
2709
|
-
const [localSkills, setLocalSkills] =
|
|
2641
|
+
const [open, setOpen] = useState15(false);
|
|
2642
|
+
const [tab, setTab] = useState15("connectors");
|
|
2643
|
+
const [query, setQuery] = useState15("");
|
|
2644
|
+
const [pinnedMcpIds, setPinnedMcpIds] = useState15(() => /* @__PURE__ */ new Set());
|
|
2645
|
+
const [pinnedSkillIds, setPinnedSkillIds] = useState15(() => /* @__PURE__ */ new Set());
|
|
2646
|
+
const [localMcp, setLocalMcp] = useState15([]);
|
|
2647
|
+
const [localSkills, setLocalSkills] = useState15([]);
|
|
2710
2648
|
const dirtyRef = useRef7(false);
|
|
2711
2649
|
const flushTimerRef = useRef7(null);
|
|
2712
2650
|
const localMcpRef = useRef7(localMcp);
|
|
@@ -2719,15 +2657,20 @@ function DraftCompositeSelector({ disabled, isRunning, onAttach }) {
|
|
|
2719
2657
|
const compactLayout = useCompactLayout();
|
|
2720
2658
|
const skillsDisabled = capabilities?.skill.enabled !== true;
|
|
2721
2659
|
const skillsDisabledReason = capabilities?.skill.reason;
|
|
2722
|
-
const
|
|
2723
|
-
const
|
|
2660
|
+
const needsSandbox = capabilities?.sandbox.enabled === false;
|
|
2661
|
+
const settingsEnabled = capabilities?.settings?.enabled !== false;
|
|
2662
|
+
const canConfigureConnectors = settingsEnabled && settingsCatalog?.connectorCatalog != null;
|
|
2663
|
+
const canConfigureSkills = settingsEnabled && settingsCatalog?.skillCatalog != null;
|
|
2664
|
+
const canConfigureSandbox = settingsEnabled && settingsCatalog?.sandboxCatalog != null;
|
|
2665
|
+
const specMcp = useMemo3(() => draftMountsFromSpec(agentSpec?.mcpServers), [agentSpec?.mcpServers]);
|
|
2666
|
+
const specSkills = useMemo3(() => draftMountsFromSpec(agentSpec?.skills), [agentSpec?.skills]);
|
|
2724
2667
|
const selectedMcp = open ? localMcp : specMcp;
|
|
2725
2668
|
const selectedSkills = open ? localSkills : specSkills;
|
|
2726
|
-
const selectedMcpIds =
|
|
2727
|
-
const selectedSkillIds =
|
|
2669
|
+
const selectedMcpIds = useMemo3(() => new Set(selectedMcp.map((m) => m.id)), [selectedMcp]);
|
|
2670
|
+
const selectedSkillIds = useMemo3(() => new Set(selectedSkills.map((s) => s.id)), [selectedSkills]);
|
|
2728
2671
|
const hasValidModel = Boolean(agentSpec?.model?.name.trim());
|
|
2729
2672
|
const toolsCount = selectedMcp.length + selectedSkills.length;
|
|
2730
|
-
const toolsTooltip =
|
|
2673
|
+
const toolsTooltip = useMemo3(() => {
|
|
2731
2674
|
const formatNames = (items) => {
|
|
2732
2675
|
const names = items.map((item) => item.name);
|
|
2733
2676
|
if (names.length <= 4) return names.join(", ");
|
|
@@ -2742,13 +2685,13 @@ function DraftCompositeSelector({ disabled, isRunning, onAttach }) {
|
|
|
2742
2685
|
}
|
|
2743
2686
|
return lines.length > 0 ? lines.join("\n") : "No connectors or skills selected";
|
|
2744
2687
|
}, [selectedMcp, selectedSkills]);
|
|
2745
|
-
const clearFlushTimer =
|
|
2688
|
+
const clearFlushTimer = useCallback5(() => {
|
|
2746
2689
|
if (flushTimerRef.current != null) {
|
|
2747
2690
|
window.clearTimeout(flushTimerRef.current);
|
|
2748
2691
|
flushTimerRef.current = null;
|
|
2749
2692
|
}
|
|
2750
2693
|
}, []);
|
|
2751
|
-
const flushSpec =
|
|
2694
|
+
const flushSpec = useCallback5(() => {
|
|
2752
2695
|
clearFlushTimer();
|
|
2753
2696
|
if (!dirtyRef.current) return;
|
|
2754
2697
|
dirtyRef.current = false;
|
|
@@ -2757,29 +2700,29 @@ function DraftCompositeSelector({ disabled, isRunning, onAttach }) {
|
|
|
2757
2700
|
skills: localSkillsRef.current
|
|
2758
2701
|
});
|
|
2759
2702
|
}, [clearFlushTimer, updateAgentSpec]);
|
|
2760
|
-
const scheduleFlush =
|
|
2703
|
+
const scheduleFlush = useCallback5(() => {
|
|
2761
2704
|
clearFlushTimer();
|
|
2762
2705
|
flushTimerRef.current = window.setTimeout(() => {
|
|
2763
2706
|
flushTimerRef.current = null;
|
|
2764
2707
|
flushSpec();
|
|
2765
2708
|
}, SPEC_FLUSH_MS);
|
|
2766
2709
|
}, [clearFlushTimer, flushSpec]);
|
|
2767
|
-
const setOpenAndFlush =
|
|
2710
|
+
const setOpenAndFlush = useCallback5(
|
|
2768
2711
|
(next) => {
|
|
2769
2712
|
if (!next) flushSpec();
|
|
2770
2713
|
setOpen(next);
|
|
2771
2714
|
},
|
|
2772
2715
|
[flushSpec]
|
|
2773
2716
|
);
|
|
2774
|
-
|
|
2717
|
+
useEffect9(() => {
|
|
2775
2718
|
if (open) ensureLoaded();
|
|
2776
2719
|
}, [open, ensureLoaded]);
|
|
2777
|
-
|
|
2720
|
+
useEffect9(() => {
|
|
2778
2721
|
if (open && !hasValidModel) {
|
|
2779
2722
|
setOpenAndFlush(false);
|
|
2780
2723
|
}
|
|
2781
2724
|
}, [hasValidModel, open, setOpenAndFlush]);
|
|
2782
|
-
|
|
2725
|
+
useEffect9(() => {
|
|
2783
2726
|
if (!open) return;
|
|
2784
2727
|
const handler = (e) => {
|
|
2785
2728
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -2793,8 +2736,8 @@ function DraftCompositeSelector({ disabled, isRunning, onAttach }) {
|
|
|
2793
2736
|
document.removeEventListener("focusin", handler);
|
|
2794
2737
|
};
|
|
2795
2738
|
}, [open, setOpenAndFlush]);
|
|
2796
|
-
|
|
2797
|
-
const filteredConnectors =
|
|
2739
|
+
useEffect9(() => () => clearFlushTimer(), [clearFlushTimer]);
|
|
2740
|
+
const filteredConnectors = useMemo3(() => {
|
|
2798
2741
|
const needle = query.trim().toLowerCase();
|
|
2799
2742
|
const matches = needle ? connectors.filter(
|
|
2800
2743
|
(c) => c.name.toLowerCase().includes(needle) || (c.description?.toLowerCase().includes(needle) ?? false)
|
|
@@ -2803,26 +2746,26 @@ function DraftCompositeSelector({ disabled, isRunning, onAttach }) {
|
|
|
2803
2746
|
(left, right) => Number(isUnauthenticatedDcrConnector(left)) - Number(isUnauthenticatedDcrConnector(right))
|
|
2804
2747
|
);
|
|
2805
2748
|
}, [connectors, query]);
|
|
2806
|
-
const filteredSkills =
|
|
2749
|
+
const filteredSkills = useMemo3(() => {
|
|
2807
2750
|
const needle = query.trim().toLowerCase();
|
|
2808
2751
|
if (!needle) return skills;
|
|
2809
2752
|
return skills.filter(
|
|
2810
2753
|
(s) => s.name.toLowerCase().includes(needle) || (s.description?.toLowerCase().includes(needle) ?? false)
|
|
2811
2754
|
);
|
|
2812
2755
|
}, [skills, query]);
|
|
2813
|
-
const pinnedSelectedConnectors =
|
|
2756
|
+
const pinnedSelectedConnectors = useMemo3(
|
|
2814
2757
|
() => filteredConnectors.filter((c) => pinnedMcpIds.has(c.id)),
|
|
2815
2758
|
[filteredConnectors, pinnedMcpIds]
|
|
2816
2759
|
);
|
|
2817
|
-
const pinnedAvailableConnectors =
|
|
2760
|
+
const pinnedAvailableConnectors = useMemo3(
|
|
2818
2761
|
() => filteredConnectors.filter((c) => !pinnedMcpIds.has(c.id)),
|
|
2819
2762
|
[filteredConnectors, pinnedMcpIds]
|
|
2820
2763
|
);
|
|
2821
|
-
const pinnedSelectedSkills =
|
|
2764
|
+
const pinnedSelectedSkills = useMemo3(
|
|
2822
2765
|
() => filteredSkills.filter((s) => pinnedSkillIds.has(s.id)),
|
|
2823
2766
|
[filteredSkills, pinnedSkillIds]
|
|
2824
2767
|
);
|
|
2825
|
-
const pinnedAvailableSkills =
|
|
2768
|
+
const pinnedAvailableSkills = useMemo3(
|
|
2826
2769
|
() => filteredSkills.filter((s) => !pinnedSkillIds.has(s.id)),
|
|
2827
2770
|
[filteredSkills, pinnedSkillIds]
|
|
2828
2771
|
);
|
|
@@ -2854,11 +2797,16 @@ function DraftCompositeSelector({ disabled, isRunning, onAttach }) {
|
|
|
2854
2797
|
setPinnedSkillIds(new Set(specSkills.map((s) => s.id)));
|
|
2855
2798
|
setOpen(true);
|
|
2856
2799
|
};
|
|
2857
|
-
const
|
|
2800
|
+
const openSettings = (section) => {
|
|
2801
|
+
setOpenAndFlush(false);
|
|
2802
|
+
setQuery("");
|
|
2803
|
+
shell?.setSettingsOpen(true, section);
|
|
2804
|
+
};
|
|
2805
|
+
const content = /* @__PURE__ */ jsxs26(Fragment6, { children: [
|
|
2858
2806
|
/* @__PURE__ */ jsx37("div", { className: "flex shrink-0 border-b border-border", children: TABS.map((t) => {
|
|
2859
2807
|
const count = t.id === "connectors" ? selectedMcp.length : t.id === "skills" ? selectedSkills.length : null;
|
|
2860
2808
|
const active = tab === t.id;
|
|
2861
|
-
return /* @__PURE__ */
|
|
2809
|
+
return /* @__PURE__ */ jsxs26(
|
|
2862
2810
|
"button",
|
|
2863
2811
|
{
|
|
2864
2812
|
type: "button",
|
|
@@ -2896,7 +2844,7 @@ function DraftCompositeSelector({ disabled, isRunning, onAttach }) {
|
|
|
2896
2844
|
});
|
|
2897
2845
|
}
|
|
2898
2846
|
}
|
|
2899
|
-
) }) : /* @__PURE__ */
|
|
2847
|
+
) }) : /* @__PURE__ */ jsxs26(Fragment6, { children: [
|
|
2900
2848
|
/* @__PURE__ */ jsx37(
|
|
2901
2849
|
SearchField,
|
|
2902
2850
|
{
|
|
@@ -2905,7 +2853,7 @@ function DraftCompositeSelector({ disabled, isRunning, onAttach }) {
|
|
|
2905
2853
|
placeholder: tab === "connectors" ? "Search connectors..." : "Search skills..."
|
|
2906
2854
|
}
|
|
2907
2855
|
),
|
|
2908
|
-
tab === "skills" && skillsDisabled && skillsDisabledReason ? /* @__PURE__ */
|
|
2856
|
+
tab === "skills" && skillsDisabled && skillsDisabledReason ? /* @__PURE__ */ jsxs26(
|
|
2909
2857
|
"div",
|
|
2910
2858
|
{
|
|
2911
2859
|
role: "status",
|
|
@@ -2916,8 +2864,8 @@ function DraftCompositeSelector({ disabled, isRunning, onAttach }) {
|
|
|
2916
2864
|
]
|
|
2917
2865
|
}
|
|
2918
2866
|
) : null,
|
|
2919
|
-
/* @__PURE__ */ jsx37("div", { className: "min-h-0 flex-1 overflow-y-auto px-1 pb-2", children: tab === "connectors" ? /* @__PURE__ */
|
|
2920
|
-
pinnedSelectedConnectors.length > 0 ? /* @__PURE__ */
|
|
2867
|
+
/* @__PURE__ */ jsx37("div", { className: "min-h-0 flex-1 overflow-y-auto px-1 pb-2", children: tab === "connectors" ? /* @__PURE__ */ jsxs26(Fragment6, { children: [
|
|
2868
|
+
pinnedSelectedConnectors.length > 0 ? /* @__PURE__ */ jsxs26(Fragment6, { children: [
|
|
2921
2869
|
/* @__PURE__ */ jsx37(SectionHeading, { label: "Selected", count: pinnedSelectedConnectors.length }),
|
|
2922
2870
|
pinnedSelectedConnectors.map((c) => /* @__PURE__ */ jsx37(
|
|
2923
2871
|
CatalogRow,
|
|
@@ -2931,7 +2879,7 @@ function DraftCompositeSelector({ disabled, isRunning, onAttach }) {
|
|
|
2931
2879
|
c.id
|
|
2932
2880
|
))
|
|
2933
2881
|
] }) : null,
|
|
2934
|
-
pinnedAvailableConnectors.length > 0 ? /* @__PURE__ */
|
|
2882
|
+
pinnedAvailableConnectors.length > 0 ? /* @__PURE__ */ jsxs26(Fragment6, { children: [
|
|
2935
2883
|
/* @__PURE__ */ jsx37(SectionHeading, { label: "Available", count: pinnedAvailableConnectors.length }),
|
|
2936
2884
|
pinnedAvailableConnectors.map((c) => /* @__PURE__ */ jsx37(
|
|
2937
2885
|
CatalogRow,
|
|
@@ -2944,9 +2892,18 @@ function DraftCompositeSelector({ disabled, isRunning, onAttach }) {
|
|
|
2944
2892
|
},
|
|
2945
2893
|
c.id
|
|
2946
2894
|
))
|
|
2947
|
-
] }) : null
|
|
2948
|
-
|
|
2949
|
-
|
|
2895
|
+
] }) : null,
|
|
2896
|
+
filteredConnectors.length === 0 ? /* @__PURE__ */ jsx37(
|
|
2897
|
+
DraftCatalogEmptyState,
|
|
2898
|
+
{
|
|
2899
|
+
loading,
|
|
2900
|
+
emptyLabel: "No connectors",
|
|
2901
|
+
settingsTarget: "Connectors",
|
|
2902
|
+
onOpenSettings: connectors.length === 0 && shell && canConfigureConnectors ? () => openSettings("connectors") : void 0
|
|
2903
|
+
}
|
|
2904
|
+
) : null
|
|
2905
|
+
] }) : /* @__PURE__ */ jsxs26(Fragment6, { children: [
|
|
2906
|
+
pinnedSelectedSkills.length > 0 ? /* @__PURE__ */ jsxs26(Fragment6, { children: [
|
|
2950
2907
|
/* @__PURE__ */ jsx37(SectionHeading, { label: "Selected", count: pinnedSelectedSkills.length }),
|
|
2951
2908
|
pinnedSelectedSkills.map((s) => /* @__PURE__ */ jsx37(
|
|
2952
2909
|
CatalogRow,
|
|
@@ -2960,7 +2917,7 @@ function DraftCompositeSelector({ disabled, isRunning, onAttach }) {
|
|
|
2960
2917
|
s.id
|
|
2961
2918
|
))
|
|
2962
2919
|
] }) : null,
|
|
2963
|
-
pinnedAvailableSkills.length > 0 ? /* @__PURE__ */
|
|
2920
|
+
pinnedAvailableSkills.length > 0 ? /* @__PURE__ */ jsxs26(Fragment6, { children: [
|
|
2964
2921
|
/* @__PURE__ */ jsx37(SectionHeading, { label: "Available", count: pinnedAvailableSkills.length }),
|
|
2965
2922
|
pinnedAvailableSkills.map((s) => /* @__PURE__ */ jsx37(
|
|
2966
2923
|
CatalogRow,
|
|
@@ -2973,12 +2930,21 @@ function DraftCompositeSelector({ disabled, isRunning, onAttach }) {
|
|
|
2973
2930
|
},
|
|
2974
2931
|
s.id
|
|
2975
2932
|
))
|
|
2976
|
-
] }) : null
|
|
2933
|
+
] }) : null,
|
|
2934
|
+
filteredSkills.length === 0 ? /* @__PURE__ */ jsx37(
|
|
2935
|
+
DraftCatalogEmptyState,
|
|
2936
|
+
{
|
|
2937
|
+
loading,
|
|
2938
|
+
emptyLabel: "No skills",
|
|
2939
|
+
settingsTarget: needsSandbox ? "a Sandbox" : "Skills",
|
|
2940
|
+
onOpenSettings: skills.length === 0 && shell && (needsSandbox ? canConfigureSandbox : canConfigureSkills) ? () => openSettings(needsSandbox ? "sandbox" : "skills") : void 0
|
|
2941
|
+
}
|
|
2942
|
+
) : null
|
|
2977
2943
|
] }) })
|
|
2978
2944
|
] })
|
|
2979
2945
|
] });
|
|
2980
|
-
return /* @__PURE__ */
|
|
2981
|
-
hasValidModel ? /* @__PURE__ */ jsx37(Tooltip, { content: toolsTooltip, className: "max-w-xs whitespace-pre-line text-left", side: "top", children: /* @__PURE__ */
|
|
2946
|
+
return /* @__PURE__ */ jsxs26("div", { ref: containerRef, className: "relative flex flex-wrap items-center gap-1.5", children: [
|
|
2947
|
+
hasValidModel ? /* @__PURE__ */ jsx37(Tooltip, { content: toolsTooltip, className: "max-w-xs whitespace-pre-line text-left", side: "top", children: /* @__PURE__ */ jsxs26(
|
|
2982
2948
|
"button",
|
|
2983
2949
|
{
|
|
2984
2950
|
type: "button",
|
|
@@ -3032,16 +2998,10 @@ function DraftCompositeSelector({ disabled, isRunning, onAttach }) {
|
|
|
3032
2998
|
|
|
3033
2999
|
// src/atoms/draft/DraftModelSelector.tsx
|
|
3034
3000
|
import { useTrueFoundryAgentSpec as useTrueFoundryAgentSpec4, useTrueFoundryUpdateAgentSpec as useTrueFoundryUpdateAgentSpec3 } from "@truefoundry/assistant-ui-runtime";
|
|
3035
|
-
import { useEffect as
|
|
3036
|
-
|
|
3037
|
-
// src/atoms/lib/inputClasses.ts
|
|
3038
|
-
var baseClasses = "w-full cursor-text rounded-md border border-input-border bg-input-box-bg px-3 text-sm text-text-primary outline-none placeholder:text-text-secondary/70 focus-visible:ring-2 focus-visible:ring-focus-ring/40 disabled:cursor-not-allowed";
|
|
3039
|
-
function auiInputClass(className) {
|
|
3040
|
-
return cn(baseClasses, className);
|
|
3041
|
-
}
|
|
3001
|
+
import { useEffect as useEffect11, useId as useId5, useRef as useRef8, useState as useState17 } from "react";
|
|
3042
3002
|
|
|
3043
3003
|
// src/atoms/primitives/CatalogLogo.tsx
|
|
3044
|
-
import { useEffect as
|
|
3004
|
+
import { useEffect as useEffect10, useState as useState16 } from "react";
|
|
3045
3005
|
|
|
3046
3006
|
// src/utils/catalogLogo.ts
|
|
3047
3007
|
function splitCatalogLogoUrl(src) {
|
|
@@ -3074,8 +3034,8 @@ import { createElement } from "react";
|
|
|
3074
3034
|
function CatalogLogo({ src, alt = "", onError, ...props }) {
|
|
3075
3035
|
const mode = useThemeMode();
|
|
3076
3036
|
const preferred = resolveCatalogLogoSrc({ src, mode });
|
|
3077
|
-
const [failedPreferred, setFailedPreferred] =
|
|
3078
|
-
|
|
3037
|
+
const [failedPreferred, setFailedPreferred] = useState16(false);
|
|
3038
|
+
useEffect10(() => {
|
|
3079
3039
|
setFailedPreferred(false);
|
|
3080
3040
|
}, [src, mode, preferred]);
|
|
3081
3041
|
const canFallback = preferred !== src;
|
|
@@ -3099,7 +3059,7 @@ function CatalogLogo({ src, alt = "", onError, ...props }) {
|
|
|
3099
3059
|
}
|
|
3100
3060
|
|
|
3101
3061
|
// src/atoms/draft/DraftModelCatalogPanel.tsx
|
|
3102
|
-
import { Fragment as Fragment7, jsx as jsx38, jsxs as
|
|
3062
|
+
import { Fragment as Fragment7, jsx as jsx38, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
3103
3063
|
function monogram(value) {
|
|
3104
3064
|
const trimmed = value.trim();
|
|
3105
3065
|
return trimmed ? trimmed.charAt(0).toUpperCase() : "?";
|
|
@@ -3157,10 +3117,10 @@ function DraftModelCatalogPanel({
|
|
|
3157
3117
|
(model) => model.name.toLowerCase().includes(needle) || model.id.toLowerCase().includes(needle) || model.provider.name.toLowerCase().includes(needle)
|
|
3158
3118
|
) : models;
|
|
3159
3119
|
const sections = groupModelsByProvider(filtered);
|
|
3160
|
-
return /* @__PURE__ */
|
|
3161
|
-
/* @__PURE__ */
|
|
3120
|
+
return /* @__PURE__ */ jsxs27(Fragment7, { children: [
|
|
3121
|
+
/* @__PURE__ */ jsxs27("div", { className: "border-b border-border px-3 py-2", children: [
|
|
3162
3122
|
showHeading ? /* @__PURE__ */ jsx38("p", { className: "text-text-primary mb-2 text-sm font-semibold", children: "Select model" }) : null,
|
|
3163
|
-
/* @__PURE__ */
|
|
3123
|
+
/* @__PURE__ */ jsxs27("label", { className: "relative block", children: [
|
|
3164
3124
|
/* @__PURE__ */ jsx38(
|
|
3165
3125
|
Icon,
|
|
3166
3126
|
{
|
|
@@ -3188,31 +3148,24 @@ function DraftModelCatalogPanel({
|
|
|
3188
3148
|
role: "listbox",
|
|
3189
3149
|
"aria-label": "Select model",
|
|
3190
3150
|
className: "flex min-h-0 flex-1 flex-col overflow-y-auto p-1",
|
|
3191
|
-
children: filtered.length === 0 ?
|
|
3192
|
-
|
|
3151
|
+
children: filtered.length === 0 ? /* @__PURE__ */ jsx38(
|
|
3152
|
+
DraftCatalogEmptyState,
|
|
3193
3153
|
{
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
}),
|
|
3199
|
-
onClick: onOpenSettings,
|
|
3200
|
-
children: [
|
|
3201
|
-
"Please configure Models in the ",
|
|
3202
|
-
/* @__PURE__ */ jsx38("span", { className: "underline", children: "settings" }),
|
|
3203
|
-
/* @__PURE__ */ jsx38(Icon, { name: "chevron-right", className: "size-3.5" })
|
|
3204
|
-
]
|
|
3154
|
+
loading,
|
|
3155
|
+
emptyLabel: "No models",
|
|
3156
|
+
settingsTarget: "Models",
|
|
3157
|
+
onOpenSettings
|
|
3205
3158
|
}
|
|
3206
|
-
) :
|
|
3159
|
+
) : sections.map((section, sectionIndex) => {
|
|
3207
3160
|
const headingId = `${listboxId}-provider-${sectionIndex}`;
|
|
3208
|
-
return /* @__PURE__ */
|
|
3161
|
+
return /* @__PURE__ */ jsxs27(
|
|
3209
3162
|
"div",
|
|
3210
3163
|
{
|
|
3211
3164
|
role: "group",
|
|
3212
3165
|
"aria-labelledby": headingId,
|
|
3213
3166
|
className: cn(sectionIndex > 0 && "mt-2"),
|
|
3214
3167
|
children: [
|
|
3215
|
-
/* @__PURE__ */
|
|
3168
|
+
/* @__PURE__ */ jsxs27(
|
|
3216
3169
|
"div",
|
|
3217
3170
|
{
|
|
3218
3171
|
id: headingId,
|
|
@@ -3225,7 +3178,7 @@ function DraftModelCatalogPanel({
|
|
|
3225
3178
|
),
|
|
3226
3179
|
section.models.map((model) => {
|
|
3227
3180
|
const active = selectedName ? model.name === selectedName : filtered[0] === model;
|
|
3228
|
-
return /* @__PURE__ */
|
|
3181
|
+
return /* @__PURE__ */ jsxs27(
|
|
3229
3182
|
"button",
|
|
3230
3183
|
{
|
|
3231
3184
|
type: "button",
|
|
@@ -3255,25 +3208,25 @@ function DraftModelCatalogPanel({
|
|
|
3255
3208
|
}
|
|
3256
3209
|
|
|
3257
3210
|
// src/atoms/draft/DraftModelSelector.tsx
|
|
3258
|
-
import { jsx as jsx39, jsxs as
|
|
3211
|
+
import { jsx as jsx39, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3259
3212
|
function DraftModelSelector({ disabled, isRunning }) {
|
|
3260
3213
|
const { models, loading, ensureLoaded } = useDraftCatalog();
|
|
3261
3214
|
const { agentSpec } = useTrueFoundryAgentSpec4();
|
|
3262
3215
|
const updateAgentSpec = useTrueFoundryUpdateAgentSpec3();
|
|
3263
3216
|
const catalog = useOptionalCatalogServer();
|
|
3264
3217
|
const shell = useOptionalShellMode();
|
|
3265
|
-
const [open, setOpen] =
|
|
3266
|
-
const [query, setQuery] =
|
|
3218
|
+
const [open, setOpen] = useState17(false);
|
|
3219
|
+
const [query, setQuery] = useState17("");
|
|
3267
3220
|
const containerRef = useRef8(null);
|
|
3268
3221
|
const menuId = useId5();
|
|
3269
3222
|
const isMobile = useIsMobile();
|
|
3270
3223
|
const compactLayout = useCompactLayout();
|
|
3271
3224
|
const showConfigureSettingsCta = !loading && models.length === 0 && catalog != null;
|
|
3272
3225
|
const seededDefaultModelRef = useRef8(null);
|
|
3273
|
-
|
|
3226
|
+
useEffect11(() => {
|
|
3274
3227
|
ensureLoaded();
|
|
3275
3228
|
}, [ensureLoaded]);
|
|
3276
|
-
|
|
3229
|
+
useEffect11(() => {
|
|
3277
3230
|
if (!updateAgentSpec || loading || models.length === 0) return;
|
|
3278
3231
|
const first = models[0];
|
|
3279
3232
|
if (first === void 0) return;
|
|
@@ -3295,7 +3248,7 @@ function DraftModelSelector({ disabled, isRunning }) {
|
|
|
3295
3248
|
const selectedName = agentSpec?.model?.name ?? models[0]?.name ?? "";
|
|
3296
3249
|
const selected = models.find((m) => m.name === selectedName);
|
|
3297
3250
|
const label = selected ? displayModelLabel2(selected.name) : selectedName ? displayModelLabel2(selectedName) : loading ? "Loading\u2026" : "Select model";
|
|
3298
|
-
|
|
3251
|
+
useEffect11(() => {
|
|
3299
3252
|
if (!open) return;
|
|
3300
3253
|
const handler = (e) => {
|
|
3301
3254
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -3318,7 +3271,7 @@ function DraftModelSelector({ disabled, isRunning }) {
|
|
|
3318
3271
|
onOpenSettings: showConfigureSettingsCta ? () => {
|
|
3319
3272
|
setOpen(false);
|
|
3320
3273
|
setQuery("");
|
|
3321
|
-
shell?.setSettingsOpen(true);
|
|
3274
|
+
shell?.setSettingsOpen(true, "models");
|
|
3322
3275
|
} : void 0,
|
|
3323
3276
|
onSelect: (model) => {
|
|
3324
3277
|
updateAgentSpec?.({
|
|
@@ -3329,8 +3282,8 @@ function DraftModelSelector({ disabled, isRunning }) {
|
|
|
3329
3282
|
}
|
|
3330
3283
|
}
|
|
3331
3284
|
);
|
|
3332
|
-
return /* @__PURE__ */
|
|
3333
|
-
/* @__PURE__ */
|
|
3285
|
+
return /* @__PURE__ */ jsxs28("div", { ref: containerRef, className: "relative", children: [
|
|
3286
|
+
/* @__PURE__ */ jsxs28(
|
|
3334
3287
|
"button",
|
|
3335
3288
|
{
|
|
3336
3289
|
type: "button",
|
|
@@ -3377,12 +3330,12 @@ var HistoryLoader = forwardRef(
|
|
|
3377
3330
|
HistoryLoader.displayName = "HistoryLoader";
|
|
3378
3331
|
|
|
3379
3332
|
// src/atoms/Markdown.tsx
|
|
3380
|
-
import { useMemo as
|
|
3333
|
+
import { useMemo as useMemo4, useRef as useRef9 } from "react";
|
|
3381
3334
|
import ReactMarkdown from "react-markdown";
|
|
3382
3335
|
import remarkGfm from "remark-gfm";
|
|
3383
3336
|
import { Fragment as Fragment8, jsx as jsx41 } from "react/jsx-runtime";
|
|
3384
3337
|
function preloadMarkdownOpenUI() {
|
|
3385
|
-
return import("./OpenUiFenceBlock-
|
|
3338
|
+
return import("./OpenUiFenceBlock-XFBUGPKQ.js");
|
|
3386
3339
|
}
|
|
3387
3340
|
var LARGE_STREAMING_FENCE_CHARS = 8 * 1024;
|
|
3388
3341
|
function getActiveStreamingFenceCode(content) {
|
|
@@ -3476,7 +3429,7 @@ function Markdown({
|
|
|
3476
3429
|
const SyntaxHighlighter2 = useSlot("SyntaxHighlighter");
|
|
3477
3430
|
const activeFenceCodeRef = useRef9(null);
|
|
3478
3431
|
activeFenceCodeRef.current = isStreaming === true ? getActiveStreamingFenceCode(content) : null;
|
|
3479
|
-
const components =
|
|
3432
|
+
const components = useMemo4(
|
|
3480
3433
|
() => makeComponents({
|
|
3481
3434
|
isStreaming,
|
|
3482
3435
|
getActiveFenceCode: () => activeFenceCodeRef.current,
|
|
@@ -3511,11 +3464,11 @@ function Markdown({
|
|
|
3511
3464
|
}
|
|
3512
3465
|
|
|
3513
3466
|
// src/atoms/MessageActionBar.tsx
|
|
3514
|
-
import { jsx as jsx42, jsxs as
|
|
3467
|
+
import { jsx as jsx42, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3515
3468
|
var actionBtnClass = "h-6 w-6 text-text-secondary hover:text-text-primary [&_svg]:size-3.5";
|
|
3516
3469
|
function MessageActionBar({ isCopied, onCopy, createdAt, className }) {
|
|
3517
3470
|
const MessageTimestamp2 = useSlot("MessageTimestamp");
|
|
3518
|
-
return /* @__PURE__ */
|
|
3471
|
+
return /* @__PURE__ */ jsxs29(
|
|
3519
3472
|
"div",
|
|
3520
3473
|
{
|
|
3521
3474
|
className: cn("aui-assistant-action-bar-root animate-in fade-in flex items-center gap-1 duration-200", className),
|
|
@@ -3593,7 +3546,7 @@ function MessageTimestamp({ createdAt, className }) {
|
|
|
3593
3546
|
}
|
|
3594
3547
|
|
|
3595
3548
|
// src/atoms/MonacoEditorCore.tsx
|
|
3596
|
-
import { useEffect as
|
|
3549
|
+
import { useEffect as useEffect12, useRef as useRef10, useState as useState18 } from "react";
|
|
3597
3550
|
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
3598
3551
|
var AUI_MONACO_LIGHT = "aui-monaco-light";
|
|
3599
3552
|
var AUI_MONACO_DARK = "aui-monaco-dark";
|
|
@@ -3707,7 +3660,7 @@ function MonacoEditorCore({
|
|
|
3707
3660
|
const maxPx = toPx(maxHeight, toPx(DEFAULT_MAX_HEIGHT, 168));
|
|
3708
3661
|
const clampRef = useRef10({ minPx, maxPx, autoHeight });
|
|
3709
3662
|
clampRef.current = { minPx, maxPx, autoHeight };
|
|
3710
|
-
const [autoPx, setAutoPx] =
|
|
3663
|
+
const [autoPx, setAutoPx] = useState18(() => autoHeight ? estimateHeightFromValue(value, minPx, maxPx) : 0);
|
|
3711
3664
|
const resolvedTheme = resolveThemeName(theme, classNames.monaco?.monacoTheme, mode);
|
|
3712
3665
|
const syncAutoHeight = () => {
|
|
3713
3666
|
const editor = editorRef.current;
|
|
@@ -3720,7 +3673,7 @@ function MonacoEditorCore({
|
|
|
3720
3673
|
editor.layout();
|
|
3721
3674
|
onAutoHeightChangeRef.current?.(next);
|
|
3722
3675
|
};
|
|
3723
|
-
|
|
3676
|
+
useEffect12(() => {
|
|
3724
3677
|
if (!containerRef.current) return;
|
|
3725
3678
|
let editor = null;
|
|
3726
3679
|
let changeDisposable = null;
|
|
@@ -3760,7 +3713,7 @@ function MonacoEditorCore({
|
|
|
3760
3713
|
monacoRef.current = null;
|
|
3761
3714
|
};
|
|
3762
3715
|
}, []);
|
|
3763
|
-
|
|
3716
|
+
useEffect12(() => {
|
|
3764
3717
|
const editor = editorRef.current;
|
|
3765
3718
|
if (editor && editor.getValue() !== value) {
|
|
3766
3719
|
editor.setValue(value);
|
|
@@ -3769,12 +3722,12 @@ function MonacoEditorCore({
|
|
|
3769
3722
|
}
|
|
3770
3723
|
}
|
|
3771
3724
|
}, [value, autoHeight, minPx, maxPx]);
|
|
3772
|
-
|
|
3725
|
+
useEffect12(() => {
|
|
3773
3726
|
if (autoHeight) {
|
|
3774
3727
|
requestAnimationFrame(() => syncAutoHeight());
|
|
3775
3728
|
}
|
|
3776
3729
|
}, [autoHeight, minPx, maxPx]);
|
|
3777
|
-
|
|
3730
|
+
useEffect12(() => {
|
|
3778
3731
|
monacoRef.current?.editor.setTheme(resolvedTheme);
|
|
3779
3732
|
}, [resolvedTheme]);
|
|
3780
3733
|
const styleHeight = autoHeight ? autoPx : typeof height === "number" ? height : height;
|
|
@@ -3790,7 +3743,7 @@ function MonacoEditorCore({
|
|
|
3790
3743
|
}
|
|
3791
3744
|
|
|
3792
3745
|
// src/atoms/SandboxArtifactDownload.tsx
|
|
3793
|
-
import { useMemo as
|
|
3746
|
+
import { useMemo as useMemo5 } from "react";
|
|
3794
3747
|
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
3795
3748
|
var PREFIX = "sandbox_artifacts";
|
|
3796
3749
|
var PAIR_RE = /\[([^\]]*)\]\(([^)]*)\)/g;
|
|
@@ -3824,7 +3777,7 @@ function SandboxArtifactDownload({
|
|
|
3824
3777
|
readOnly
|
|
3825
3778
|
}) {
|
|
3826
3779
|
const ChatFileDownload2 = useSlot("ChatFileDownload");
|
|
3827
|
-
const artifacts =
|
|
3780
|
+
const artifacts = useMemo5(() => parseSandboxArtifacts(code), [code]);
|
|
3828
3781
|
if (artifacts.length === 0) return null;
|
|
3829
3782
|
return /* @__PURE__ */ jsx47(
|
|
3830
3783
|
ChatFileDownload2,
|
|
@@ -3838,7 +3791,7 @@ function SandboxArtifactDownload({
|
|
|
3838
3791
|
}
|
|
3839
3792
|
|
|
3840
3793
|
// src/atoms/SandboxToolCallCard.tsx
|
|
3841
|
-
import { Fragment as Fragment9, jsx as jsx48, jsxs as
|
|
3794
|
+
import { Fragment as Fragment9, jsx as jsx48, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
3842
3795
|
function JsonPane({ value, className }) {
|
|
3843
3796
|
const MonacoEditorCore2 = useSlot("MonacoEditorCore");
|
|
3844
3797
|
return /* @__PURE__ */ jsx48(
|
|
@@ -3872,22 +3825,22 @@ function SandboxBody({
|
|
|
3872
3825
|
onViewModeChange,
|
|
3873
3826
|
dataTestPrefix
|
|
3874
3827
|
}) {
|
|
3875
|
-
return /* @__PURE__ */
|
|
3828
|
+
return /* @__PURE__ */ jsxs30(
|
|
3876
3829
|
"div",
|
|
3877
3830
|
{
|
|
3878
3831
|
className: "rounded-lg border border-border bg-primary-bg",
|
|
3879
3832
|
"data-testid": dataTestPrefix ? `${dataTestPrefix}-sandbox` : void 0,
|
|
3880
3833
|
children: [
|
|
3881
|
-
/* @__PURE__ */ jsx48("div", { className: "rounded-t-md border-b border-primary-button-bg/30 bg-primary-button-bg/10", children: /* @__PURE__ */
|
|
3834
|
+
/* @__PURE__ */ jsx48("div", { className: "rounded-t-md border-b border-primary-button-bg/30 bg-primary-button-bg/10", children: /* @__PURE__ */ jsxs30("div", { className: "flex w-full min-w-0 items-center gap-2 px-3 py-1.5", children: [
|
|
3882
3835
|
/* @__PURE__ */ jsx48("p", { className: "min-w-0 font-sans text-xs font-medium text-primary-button-bg", children: "sandbox" }),
|
|
3883
|
-
/* @__PURE__ */
|
|
3836
|
+
/* @__PURE__ */ jsxs30(
|
|
3884
3837
|
"div",
|
|
3885
3838
|
{
|
|
3886
3839
|
className: "ml-auto flex shrink-0 items-center gap-1.5",
|
|
3887
3840
|
onClick: (e) => e.stopPropagation(),
|
|
3888
3841
|
onKeyDown: (e) => e.stopPropagation(),
|
|
3889
3842
|
children: [
|
|
3890
|
-
exitCode != null && /* @__PURE__ */
|
|
3843
|
+
exitCode != null && /* @__PURE__ */ jsxs30(
|
|
3891
3844
|
"span",
|
|
3892
3845
|
{
|
|
3893
3846
|
className: cn(
|
|
@@ -3902,7 +3855,7 @@ function SandboxBody({
|
|
|
3902
3855
|
]
|
|
3903
3856
|
}
|
|
3904
3857
|
),
|
|
3905
|
-
/* @__PURE__ */
|
|
3858
|
+
/* @__PURE__ */ jsxs30(
|
|
3906
3859
|
"div",
|
|
3907
3860
|
{
|
|
3908
3861
|
className: "inline-flex h-6 items-center rounded-md border border-border bg-primary-bg p-0.5",
|
|
@@ -3946,33 +3899,33 @@ function SandboxBody({
|
|
|
3946
3899
|
}
|
|
3947
3900
|
)
|
|
3948
3901
|
] }) }),
|
|
3949
|
-
/* @__PURE__ */ jsx48("div", { className: "rounded-b-lg border border-t-0 border-border p-3", children: hasContent && /* @__PURE__ */ jsx48("div", { className: "max-h-80 overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words font-mono text-xs text-text-primary", children: viewMode === "code" ? /* @__PURE__ */
|
|
3950
|
-
argsJson && /* @__PURE__ */
|
|
3902
|
+
/* @__PURE__ */ jsx48("div", { className: "rounded-b-lg border border-t-0 border-border p-3", children: hasContent && /* @__PURE__ */ jsx48("div", { className: "max-h-80 overflow-x-hidden overflow-y-auto whitespace-pre-wrap break-words font-mono text-xs text-text-primary", children: viewMode === "code" ? /* @__PURE__ */ jsxs30(Fragment9, { children: [
|
|
3903
|
+
argsJson && /* @__PURE__ */ jsxs30("div", { className: "my-1 border-l-4 border-primary-button-bg px-3", children: [
|
|
3951
3904
|
/* @__PURE__ */ jsx48("div", { className: "mb-1 font-sans text-xs font-medium leading-4", children: "Arguments" }),
|
|
3952
3905
|
/* @__PURE__ */ jsx48(JsonPane, { value: argsJson, className: "pl-2" })
|
|
3953
3906
|
] }),
|
|
3954
|
-
resultJson && /* @__PURE__ */
|
|
3907
|
+
resultJson && /* @__PURE__ */ jsxs30("div", { className: "my-1 border-l-4 border-primary-button-bg/60 px-3", children: [
|
|
3955
3908
|
/* @__PURE__ */ jsx48("div", { className: "mb-1 mt-2 font-sans text-xs font-medium leading-4", children: "Result" }),
|
|
3956
3909
|
/* @__PURE__ */ jsx48(JsonPane, { value: resultJson, className: "pl-2" })
|
|
3957
3910
|
] })
|
|
3958
|
-
] }) : /* @__PURE__ */
|
|
3959
|
-
command && /* @__PURE__ */
|
|
3911
|
+
] }) : /* @__PURE__ */ jsxs30(Fragment9, { children: [
|
|
3912
|
+
command && /* @__PURE__ */ jsxs30("div", { className: "my-1 break-all border-l-4 border-primary-button-bg px-3", children: [
|
|
3960
3913
|
/* @__PURE__ */ jsx48("div", { className: "mb-1 text-[12px] font-medium leading-4 text-text-secondary", children: "COMMAND" }),
|
|
3961
|
-
/* @__PURE__ */
|
|
3914
|
+
/* @__PURE__ */ jsxs30("div", { children: [
|
|
3962
3915
|
/* @__PURE__ */ jsx48("span", { className: "text-primary-button-bg", children: "$" }),
|
|
3963
3916
|
" ",
|
|
3964
3917
|
command
|
|
3965
3918
|
] })
|
|
3966
3919
|
] }),
|
|
3967
|
-
resultText ? /* @__PURE__ */
|
|
3920
|
+
resultText ? /* @__PURE__ */ jsxs30(Fragment9, { children: [
|
|
3968
3921
|
/* @__PURE__ */ jsx48("div", { className: "mx-3 my-1 border-t border-border" }),
|
|
3969
|
-
/* @__PURE__ */
|
|
3922
|
+
/* @__PURE__ */ jsxs30("div", { className: "my-1 break-all border-l-4 border-primary-button-bg/60 px-3", children: [
|
|
3970
3923
|
/* @__PURE__ */ jsx48("div", { className: "mb-1 text-[12px] font-medium leading-4 text-text-secondary", children: "OUTPUT" }),
|
|
3971
3924
|
/* @__PURE__ */ jsx48("div", { children: resultText })
|
|
3972
3925
|
] })
|
|
3973
|
-
] }) : resultJson && /* @__PURE__ */
|
|
3926
|
+
] }) : resultJson && /* @__PURE__ */ jsxs30(Fragment9, { children: [
|
|
3974
3927
|
/* @__PURE__ */ jsx48("div", { className: "mx-3 my-1 border-t border-border" }),
|
|
3975
|
-
/* @__PURE__ */
|
|
3928
|
+
/* @__PURE__ */ jsxs30("div", { className: "my-1 border-l-4 border-primary-button-bg/60 px-3", children: [
|
|
3976
3929
|
/* @__PURE__ */ jsx48("div", { className: "mb-1 text-[12px] font-medium leading-4 text-text-secondary", children: "OUTPUT" }),
|
|
3977
3930
|
/* @__PURE__ */ jsx48(JsonPane, { value: resultJson, className: "pl-2" })
|
|
3978
3931
|
] })
|
|
@@ -4041,8 +3994,8 @@ import {
|
|
|
4041
3994
|
useTrueFoundryAgentSpec as useTrueFoundryAgentSpec5,
|
|
4042
3995
|
useTrueFoundryFlushAgentSpec
|
|
4043
3996
|
} from "@truefoundry/assistant-ui-runtime";
|
|
4044
|
-
import { useEffect as
|
|
4045
|
-
import { Fragment as Fragment10, jsx as jsx49, jsxs as
|
|
3997
|
+
import { useEffect as useEffect13, useId as useId6, useMemo as useMemo6, useRef as useRef11, useState as useState19 } from "react";
|
|
3998
|
+
import { Fragment as Fragment10, jsx as jsx49, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
4046
3999
|
function editableMountsFromSpec(value) {
|
|
4047
4000
|
if (!Array.isArray(value)) return [];
|
|
4048
4001
|
const mounts = [];
|
|
@@ -4055,32 +4008,94 @@ function editableMountsFromSpec(value) {
|
|
|
4055
4008
|
}
|
|
4056
4009
|
return mounts;
|
|
4057
4010
|
}
|
|
4058
|
-
function
|
|
4059
|
-
|
|
4060
|
-
title,
|
|
4061
|
-
value,
|
|
4011
|
+
function ConfigSection({
|
|
4012
|
+
label,
|
|
4062
4013
|
onEdit,
|
|
4063
|
-
disabled
|
|
4014
|
+
disabled,
|
|
4015
|
+
children
|
|
4064
4016
|
}) {
|
|
4065
|
-
return /* @__PURE__ */
|
|
4066
|
-
/* @__PURE__ */
|
|
4067
|
-
|
|
4068
|
-
/* @__PURE__ */ jsx49(
|
|
4069
|
-
|
|
4017
|
+
return /* @__PURE__ */ jsxs31("div", { className: "mb-3", children: [
|
|
4018
|
+
/* @__PURE__ */ jsxs31("div", { className: "mb-1.5 flex items-center justify-between", children: [
|
|
4019
|
+
/* @__PURE__ */ jsx49("span", { className: "text-text-secondary text-xs font-semibold tracking-wide uppercase", children: label }),
|
|
4020
|
+
/* @__PURE__ */ jsx49(
|
|
4021
|
+
"button",
|
|
4022
|
+
{
|
|
4023
|
+
type: "button",
|
|
4024
|
+
"aria-label": `Edit ${label}`,
|
|
4025
|
+
disabled,
|
|
4026
|
+
className: auiButtonClass({ variant: "ghost", size: "icon", className: "size-7" }),
|
|
4027
|
+
onClick: onEdit,
|
|
4028
|
+
children: /* @__PURE__ */ jsx49(Icon, { name: "pencil", className: "size-3.5" })
|
|
4029
|
+
}
|
|
4030
|
+
)
|
|
4070
4031
|
] }),
|
|
4071
|
-
|
|
4072
|
-
"button",
|
|
4073
|
-
{
|
|
4074
|
-
type: "button",
|
|
4075
|
-
"aria-label": `Edit ${title}`,
|
|
4076
|
-
disabled,
|
|
4077
|
-
className: auiButtonClass({ variant: "ghost", size: "icon", className: "size-8" }),
|
|
4078
|
-
onClick: onEdit,
|
|
4079
|
-
children: /* @__PURE__ */ jsx49(Icon, { name: "pencil", className: "size-3.5" })
|
|
4080
|
-
}
|
|
4081
|
-
)
|
|
4032
|
+
children
|
|
4082
4033
|
] });
|
|
4083
4034
|
}
|
|
4035
|
+
var PRELOAD_TOOLS_COPY = {
|
|
4036
|
+
header: "Preload tools",
|
|
4037
|
+
on: "Tool definitions load into context upfront. No discovery step, but uses more context.",
|
|
4038
|
+
off: "The agent discovers tools on demand. Lighter context upfront, but a discovery step the first time it needs a tool."
|
|
4039
|
+
};
|
|
4040
|
+
function PreloadToggle({ on, disabled, onToggle }) {
|
|
4041
|
+
const label = `${PRELOAD_TOOLS_COPY.header} \xB7 ${on ? "ON" : "OFF"}`;
|
|
4042
|
+
const body = on ? PRELOAD_TOOLS_COPY.on : PRELOAD_TOOLS_COPY.off;
|
|
4043
|
+
return /* @__PURE__ */ jsx49(
|
|
4044
|
+
Tooltip,
|
|
4045
|
+
{
|
|
4046
|
+
className: "max-w-[17rem] whitespace-normal",
|
|
4047
|
+
content: /* @__PURE__ */ jsxs31("div", { className: "text-left", children: [
|
|
4048
|
+
/* @__PURE__ */ jsx49("p", { className: "mb-1 text-[11px] font-semibold tracking-wide uppercase", children: label }),
|
|
4049
|
+
/* @__PURE__ */ jsx49("p", { className: "text-xs leading-snug", children: body })
|
|
4050
|
+
] }),
|
|
4051
|
+
children: /* @__PURE__ */ jsx49(
|
|
4052
|
+
"button",
|
|
4053
|
+
{
|
|
4054
|
+
type: "button",
|
|
4055
|
+
"aria-label": label,
|
|
4056
|
+
"aria-pressed": on,
|
|
4057
|
+
disabled,
|
|
4058
|
+
onClick: onToggle,
|
|
4059
|
+
className: cn(
|
|
4060
|
+
"flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md border",
|
|
4061
|
+
"transition-[color,background-color,border-color,transform] active:scale-90",
|
|
4062
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring/40",
|
|
4063
|
+
"disabled:cursor-not-allowed disabled:opacity-50 disabled:active:scale-100",
|
|
4064
|
+
on ? "border-primary-button-bg/40 bg-primary-button-bg/10 text-primary-button-bg hover:border-primary-button-bg/70 hover:bg-primary-button-bg/20" : "border-border text-text-secondary hover:border-text-secondary/50 hover:bg-text-secondary/10 hover:text-text-primary"
|
|
4065
|
+
),
|
|
4066
|
+
children: /* @__PURE__ */ jsx49(Icon, { name: "book-open", className: "size-3.5" })
|
|
4067
|
+
}
|
|
4068
|
+
)
|
|
4069
|
+
}
|
|
4070
|
+
);
|
|
4071
|
+
}
|
|
4072
|
+
function MountChips({
|
|
4073
|
+
mounts,
|
|
4074
|
+
disabled,
|
|
4075
|
+
emptyLabel,
|
|
4076
|
+
onTogglePreload
|
|
4077
|
+
}) {
|
|
4078
|
+
if (mounts.length === 0) {
|
|
4079
|
+
return /* @__PURE__ */ jsx49("p", { className: "text-text-secondary text-xs", children: emptyLabel });
|
|
4080
|
+
}
|
|
4081
|
+
return /* @__PURE__ */ jsx49("div", { className: "flex flex-wrap gap-2", children: mounts.map((mount) => {
|
|
4082
|
+
const on = Boolean(mount.value.preload);
|
|
4083
|
+
return /* @__PURE__ */ jsxs31(
|
|
4084
|
+
"span",
|
|
4085
|
+
{
|
|
4086
|
+
className: cn(
|
|
4087
|
+
"border-border flex items-center gap-2 rounded-lg border py-1 pr-2.5",
|
|
4088
|
+
onTogglePreload ? "pl-1.5" : "pl-2.5"
|
|
4089
|
+
),
|
|
4090
|
+
children: [
|
|
4091
|
+
onTogglePreload ? /* @__PURE__ */ jsx49(PreloadToggle, { on, disabled, onToggle: () => onTogglePreload(mount.id) }) : null,
|
|
4092
|
+
/* @__PURE__ */ jsx49("span", { className: "text-text-primary text-sm", children: mount.name })
|
|
4093
|
+
]
|
|
4094
|
+
},
|
|
4095
|
+
mount.id
|
|
4096
|
+
);
|
|
4097
|
+
}) });
|
|
4098
|
+
}
|
|
4084
4099
|
function SaveAgentButton({ disabled = false, className, children = "Save Agent" }) {
|
|
4085
4100
|
return /* @__PURE__ */ jsx49(DraftCatalogProvider, { children: /* @__PURE__ */ jsx49(SaveAgentButtonContent, { disabled, className, children }) });
|
|
4086
4101
|
}
|
|
@@ -4100,19 +4115,23 @@ function SaveAgentButtonContent({
|
|
|
4100
4115
|
const serverCapabilities = useServerCapabilities();
|
|
4101
4116
|
const modelListId = useId6();
|
|
4102
4117
|
const visible = useSaveAgentVisible();
|
|
4103
|
-
const [open, setOpen] =
|
|
4104
|
-
const [editor, setEditor] =
|
|
4105
|
-
const [intent, setIntent] =
|
|
4106
|
-
const [name, setName] =
|
|
4107
|
-
const [draftSpec, setDraftSpec] =
|
|
4108
|
-
const [modelQuery, setModelQuery] =
|
|
4109
|
-
const [search, setSearch] =
|
|
4110
|
-
const [saving, setSaving] =
|
|
4111
|
-
const [error, setError] =
|
|
4118
|
+
const [open, setOpen] = useState19(false);
|
|
4119
|
+
const [editor, setEditor] = useState19(null);
|
|
4120
|
+
const [intent, setIntent] = useState19("create");
|
|
4121
|
+
const [name, setName] = useState19("");
|
|
4122
|
+
const [draftSpec, setDraftSpec] = useState19(null);
|
|
4123
|
+
const [modelQuery, setModelQuery] = useState19("");
|
|
4124
|
+
const [search, setSearch] = useState19("");
|
|
4125
|
+
const [saving, setSaving] = useState19(false);
|
|
4126
|
+
const [error, setError] = useState19(null);
|
|
4112
4127
|
const errorRef = useRef11(null);
|
|
4113
|
-
const mcpMounts =
|
|
4114
|
-
const skillMounts =
|
|
4115
|
-
|
|
4128
|
+
const mcpMounts = useMemo6(() => editableMountsFromSpec(draftSpec?.mcpServers), [draftSpec?.mcpServers]);
|
|
4129
|
+
const skillMounts = useMemo6(() => editableMountsFromSpec(draftSpec?.skills), [draftSpec?.skills]);
|
|
4130
|
+
const modelEntry = useMemo6(
|
|
4131
|
+
() => catalog.models.find((model) => model.name === draftSpec?.model.name),
|
|
4132
|
+
[catalog.models, draftSpec?.model.name]
|
|
4133
|
+
);
|
|
4134
|
+
useEffect13(() => {
|
|
4116
4135
|
if (error === null) return;
|
|
4117
4136
|
errorRef.current?.scrollIntoView?.({ block: "nearest", behavior: "smooth" });
|
|
4118
4137
|
}, [error]);
|
|
@@ -4174,6 +4193,15 @@ function SaveAgentButtonContent({
|
|
|
4174
4193
|
setSaving(false);
|
|
4175
4194
|
}
|
|
4176
4195
|
};
|
|
4196
|
+
const toggleMcpPreload = (id) => {
|
|
4197
|
+
if (draftSpec === null) return;
|
|
4198
|
+
const next = (draftSpec.mcpServers ?? []).map((item) => {
|
|
4199
|
+
const record = item;
|
|
4200
|
+
const itemId = typeof record.id === "string" ? record.id : record.name;
|
|
4201
|
+
return itemId === id ? { ...record, preload: record.preload !== true } : item;
|
|
4202
|
+
});
|
|
4203
|
+
setDraftSpec({ ...draftSpec, mcpServers: next });
|
|
4204
|
+
};
|
|
4177
4205
|
const filteredConnectors = catalog.connectors.filter(
|
|
4178
4206
|
(item) => `${item.name} ${item.description ?? ""}`.toLowerCase().includes(search.trim().toLowerCase())
|
|
4179
4207
|
);
|
|
@@ -4183,8 +4211,8 @@ function SaveAgentButtonContent({
|
|
|
4183
4211
|
const isUpdateMode = shell?.mode.status === "active" && shell.mode.isMutable && (shell.mode.agentName !== void 0 || shell.mode.agentId !== void 0);
|
|
4184
4212
|
const triggerLabel = isUpdateMode && children === "Save Agent" ? "Update Agent" : children;
|
|
4185
4213
|
if (!visible) return null;
|
|
4186
|
-
return /* @__PURE__ */
|
|
4187
|
-
/* @__PURE__ */
|
|
4214
|
+
return /* @__PURE__ */ jsxs31(Fragment10, { children: [
|
|
4215
|
+
/* @__PURE__ */ jsxs31(
|
|
4188
4216
|
"button",
|
|
4189
4217
|
{
|
|
4190
4218
|
type: "button",
|
|
@@ -4203,12 +4231,11 @@ function SaveAgentButtonContent({
|
|
|
4203
4231
|
open,
|
|
4204
4232
|
onOpenChange: (next) => !next && close(),
|
|
4205
4233
|
title: intent === "create" ? "Save agent" : "Update agent",
|
|
4206
|
-
|
|
4207
|
-
className: "md:max-w-lg",
|
|
4234
|
+
className: "md:h-auto md:max-h-[85dvh] md:max-w-2xl",
|
|
4208
4235
|
"aria-label": intent === "create" ? "Save agent" : "Update agent",
|
|
4209
|
-
children: draftSpec ? /* @__PURE__ */
|
|
4210
|
-
/* @__PURE__ */
|
|
4211
|
-
/* @__PURE__ */
|
|
4236
|
+
children: draftSpec ? /* @__PURE__ */ jsxs31("div", { className: "flex min-h-0 w-full flex-1 flex-col", children: [
|
|
4237
|
+
/* @__PURE__ */ jsxs31("div", { className: "min-h-0 flex-1 overflow-y-auto px-5 py-3", children: [
|
|
4238
|
+
/* @__PURE__ */ jsxs31("label", { className: "mb-3 block", children: [
|
|
4212
4239
|
/* @__PURE__ */ jsx49("span", { className: "mb-1.5 block text-sm font-medium", children: "Agent name" }),
|
|
4213
4240
|
/* @__PURE__ */ jsx49(
|
|
4214
4241
|
"input",
|
|
@@ -4221,7 +4248,7 @@ function SaveAgentButtonContent({
|
|
|
4221
4248
|
}
|
|
4222
4249
|
)
|
|
4223
4250
|
] }),
|
|
4224
|
-
/* @__PURE__ */
|
|
4251
|
+
/* @__PURE__ */ jsxs31("label", { className: "mb-3 block", children: [
|
|
4225
4252
|
/* @__PURE__ */ jsx49("span", { className: "mb-1.5 block text-sm font-medium", children: "Instructions" }),
|
|
4226
4253
|
/* @__PURE__ */ jsx49(
|
|
4227
4254
|
"textarea",
|
|
@@ -4229,53 +4256,39 @@ function SaveAgentButtonContent({
|
|
|
4229
4256
|
value: draftSpec.instructions ?? "",
|
|
4230
4257
|
disabled: saving,
|
|
4231
4258
|
onChange: (event) => setDraftSpec({ ...draftSpec, instructions: event.target.value }),
|
|
4232
|
-
rows:
|
|
4259
|
+
rows: 5,
|
|
4233
4260
|
placeholder: "You are a release notes writer for a platform team.",
|
|
4234
4261
|
className: auiInputClass("resize-y py-2 disabled:opacity-60")
|
|
4235
4262
|
}
|
|
4236
4263
|
)
|
|
4237
4264
|
] }),
|
|
4238
|
-
/* @__PURE__ */
|
|
4239
|
-
/* @__PURE__ */ jsx49(
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
/* @__PURE__ */ jsx49(
|
|
4262
|
-
SummarySection,
|
|
4263
|
-
{
|
|
4264
|
-
icon: "lightbulb",
|
|
4265
|
-
title: "Skills",
|
|
4266
|
-
value: `${skillMounts.length} selected`,
|
|
4267
|
-
disabled: saving,
|
|
4268
|
-
onEdit: () => setEditor("skills")
|
|
4269
|
-
}
|
|
4270
|
-
)
|
|
4271
|
-
] })
|
|
4272
|
-
] }),
|
|
4273
|
-
/* @__PURE__ */ jsxs30("div", { children: [
|
|
4274
|
-
/* @__PURE__ */ jsx49("h3", { className: "mb-2 text-sm font-medium", children: "Capabilities" }),
|
|
4265
|
+
/* @__PURE__ */ jsx49(ConfigSection, { label: "Model", onEdit: () => setEditor("model"), disabled: saving, children: draftSpec.model.name ? /* @__PURE__ */ jsxs31("span", { className: "border-border inline-flex items-center gap-2 rounded-lg border py-1 pr-2.5 pl-2", children: [
|
|
4266
|
+
/* @__PURE__ */ jsx49(
|
|
4267
|
+
ProviderMark,
|
|
4268
|
+
{
|
|
4269
|
+
logo: modelEntry?.provider.logo,
|
|
4270
|
+
label: modelEntry?.provider.name ?? draftSpec.model.name,
|
|
4271
|
+
className: "size-5 text-[10px]"
|
|
4272
|
+
}
|
|
4273
|
+
),
|
|
4274
|
+
/* @__PURE__ */ jsx49("span", { className: "text-text-primary text-sm", children: displayModelLabel2(draftSpec.model.name) })
|
|
4275
|
+
] }) : /* @__PURE__ */ jsx49("p", { className: "text-text-secondary text-xs", children: "No model selected." }) }),
|
|
4276
|
+
/* @__PURE__ */ jsx49(ConfigSection, { label: "Connectors", onEdit: () => setEditor("mcp"), disabled: saving, children: /* @__PURE__ */ jsx49(
|
|
4277
|
+
MountChips,
|
|
4278
|
+
{
|
|
4279
|
+
mounts: mcpMounts,
|
|
4280
|
+
disabled: saving,
|
|
4281
|
+
emptyLabel: "No connectors added.",
|
|
4282
|
+
onTogglePreload: toggleMcpPreload
|
|
4283
|
+
}
|
|
4284
|
+
) }),
|
|
4285
|
+
/* @__PURE__ */ jsx49(ConfigSection, { label: "Skills", onEdit: () => setEditor("skills"), disabled: saving, children: /* @__PURE__ */ jsx49(MountChips, { mounts: skillMounts, disabled: saving, emptyLabel: "No skills added." }) }),
|
|
4286
|
+
/* @__PURE__ */ jsxs31("div", { children: [
|
|
4287
|
+
/* @__PURE__ */ jsx49("p", { className: "text-text-secondary mb-1.5 text-xs font-semibold tracking-wide uppercase", children: "Capabilities" }),
|
|
4275
4288
|
/* @__PURE__ */ jsx49(
|
|
4276
4289
|
DraftCapabilitiesPanel,
|
|
4277
4290
|
{
|
|
4278
|
-
|
|
4291
|
+
layout: "cards",
|
|
4279
4292
|
value: readAgentCapabilities(draftSpec.config),
|
|
4280
4293
|
disabled: saving,
|
|
4281
4294
|
onChange: (values) => setDraftSpec({
|
|
@@ -4287,7 +4300,7 @@ function SaveAgentButtonContent({
|
|
|
4287
4300
|
] }),
|
|
4288
4301
|
error ? /* @__PURE__ */ jsx49("p", { ref: errorRef, role: "alert", className: "text-failure-bg mt-3 text-sm", children: error }) : null
|
|
4289
4302
|
] }),
|
|
4290
|
-
/* @__PURE__ */
|
|
4303
|
+
/* @__PURE__ */ jsxs31("div", { className: "bg-card-bg sticky bottom-0 z-10 flex shrink-0 justify-end gap-2 border-t border-border px-5 py-4", children: [
|
|
4291
4304
|
/* @__PURE__ */ jsx49(
|
|
4292
4305
|
"button",
|
|
4293
4306
|
{
|
|
@@ -4327,8 +4340,8 @@ function SaveAgentButtonContent({
|
|
|
4327
4340
|
className: "md:max-w-md",
|
|
4328
4341
|
contentSized: true,
|
|
4329
4342
|
"aria-label": editor === "model" ? "Edit model" : editor === "mcp" ? "Edit Connectors" : "Edit skills",
|
|
4330
|
-
children: draftSpec && editor ? /* @__PURE__ */
|
|
4331
|
-
editor === "model" ? /* @__PURE__ */
|
|
4343
|
+
children: draftSpec && editor ? /* @__PURE__ */ jsxs31("div", { className: "flex h-[min(28rem,calc(100dvh-10rem))] w-[min(28rem,calc(100vw-2rem))] flex-col", children: [
|
|
4344
|
+
editor === "model" ? /* @__PURE__ */ jsxs31(Fragment10, { children: [
|
|
4332
4345
|
catalog.error ? /* @__PURE__ */ jsx49("p", { role: "alert", className: "text-failure-bg px-3 pt-3 text-sm", children: catalog.error }) : null,
|
|
4333
4346
|
/* @__PURE__ */ jsx49(
|
|
4334
4347
|
DraftModelCatalogPanel,
|
|
@@ -4352,9 +4365,9 @@ function SaveAgentButtonContent({
|
|
|
4352
4365
|
}
|
|
4353
4366
|
}
|
|
4354
4367
|
)
|
|
4355
|
-
] }) : /* @__PURE__ */
|
|
4368
|
+
] }) : /* @__PURE__ */ jsxs31(Fragment10, { children: [
|
|
4356
4369
|
catalog.error ? /* @__PURE__ */ jsx49("p", { role: "alert", className: "text-failure-bg px-3 pt-3 text-sm", children: catalog.error }) : null,
|
|
4357
|
-
/* @__PURE__ */ jsx49("div", { className: "border-b border-border p-3", children: /* @__PURE__ */
|
|
4370
|
+
/* @__PURE__ */ jsx49("div", { className: "border-b border-border p-3", children: /* @__PURE__ */ jsxs31("label", { className: "relative block", children: [
|
|
4358
4371
|
/* @__PURE__ */ jsx49(
|
|
4359
4372
|
Icon,
|
|
4360
4373
|
{
|
|
@@ -4481,12 +4494,12 @@ var ScrollToBottomButton = forwardRef2(
|
|
|
4481
4494
|
ScrollToBottomButton.displayName = "ScrollToBottomButton";
|
|
4482
4495
|
|
|
4483
4496
|
// src/atoms/SelectAgentEmptyState.tsx
|
|
4484
|
-
import { jsx as jsx51, jsxs as
|
|
4497
|
+
import { jsx as jsx51, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
4485
4498
|
function SelectAgentEmptyState() {
|
|
4486
4499
|
const shell = useOptionalShellMode();
|
|
4487
4500
|
const AgentsLibraryButton2 = useSlot("AgentsLibraryButton");
|
|
4488
4501
|
if (shell?.mode.status !== "idle") return null;
|
|
4489
|
-
return /* @__PURE__ */
|
|
4502
|
+
return /* @__PURE__ */ jsxs32(
|
|
4490
4503
|
"div",
|
|
4491
4504
|
{
|
|
4492
4505
|
className: "flex h-full min-h-0 w-full flex-col items-center justify-center gap-4 px-6",
|
|
@@ -4505,9 +4518,9 @@ function ShellActionsActionSlot() {
|
|
|
4505
4518
|
}
|
|
4506
4519
|
|
|
4507
4520
|
// src/atoms/Skeletons.tsx
|
|
4508
|
-
import { jsx as jsx52, jsxs as
|
|
4521
|
+
import { jsx as jsx52, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
4509
4522
|
function MessageListSkeleton({ className }) {
|
|
4510
|
-
return /* @__PURE__ */
|
|
4523
|
+
return /* @__PURE__ */ jsxs33(
|
|
4511
4524
|
"div",
|
|
4512
4525
|
{
|
|
4513
4526
|
role: "status",
|
|
@@ -4516,7 +4529,7 @@ function MessageListSkeleton({ className }) {
|
|
|
4516
4529
|
className: cn("mb-14 flex flex-col gap-y-6", className),
|
|
4517
4530
|
children: [
|
|
4518
4531
|
/* @__PURE__ */ jsx52("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx52(Skeleton, { className: "h-10 w-[min(85%,20rem)] rounded-xl" }) }),
|
|
4519
|
-
/* @__PURE__ */
|
|
4532
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-2 px-2", children: [
|
|
4520
4533
|
/* @__PURE__ */ jsx52(Skeleton, { className: "h-4 w-full max-w-md" }),
|
|
4521
4534
|
/* @__PURE__ */ jsx52(Skeleton, { className: "h-4 w-full max-w-sm" }),
|
|
4522
4535
|
/* @__PURE__ */ jsx52(Skeleton, { className: "h-4 w-2/3 max-w-xs" })
|
|
@@ -4527,7 +4540,7 @@ function MessageListSkeleton({ className }) {
|
|
|
4527
4540
|
}
|
|
4528
4541
|
|
|
4529
4542
|
// src/atoms/SubAgentCard.tsx
|
|
4530
|
-
import { jsx as jsx53, jsxs as
|
|
4543
|
+
import { jsx as jsx53, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
4531
4544
|
function SubAgentCard({
|
|
4532
4545
|
agentName,
|
|
4533
4546
|
instruction,
|
|
@@ -4549,7 +4562,7 @@ function SubAgentCard({
|
|
|
4549
4562
|
{
|
|
4550
4563
|
className: cn("aui-sub-agent-card min-w-0", className),
|
|
4551
4564
|
"data-testid": dataTestPrefix ? `${dataTestPrefix}-sub-agent-card` : void 0,
|
|
4552
|
-
children: /* @__PURE__ */
|
|
4565
|
+
children: /* @__PURE__ */ jsxs34(
|
|
4553
4566
|
AgentStepRow,
|
|
4554
4567
|
{
|
|
4555
4568
|
icon: "agent-2",
|
|
@@ -4562,7 +4575,7 @@ function SubAgentCard({
|
|
|
4562
4575
|
statusText: durationText,
|
|
4563
4576
|
dataTestPrefix,
|
|
4564
4577
|
children: [
|
|
4565
|
-
instructionContent != null && /* @__PURE__ */
|
|
4578
|
+
instructionContent != null && /* @__PURE__ */ jsxs34("div", { className: "mb-3 flex flex-col gap-2 rounded-md border border-border p-2", children: [
|
|
4566
4579
|
/* @__PURE__ */ jsx53("h4", { className: "text-sm font-semibold text-text-primary", children: "Instructions" }),
|
|
4567
4580
|
/* @__PURE__ */ jsx53(
|
|
4568
4581
|
"div",
|
|
@@ -4594,8 +4607,8 @@ import {
|
|
|
4594
4607
|
cloneElement as cloneElement2,
|
|
4595
4608
|
isValidElement as isValidElement2,
|
|
4596
4609
|
memo,
|
|
4597
|
-
useCallback as
|
|
4598
|
-
useState as
|
|
4610
|
+
useCallback as useCallback6,
|
|
4611
|
+
useState as useState20
|
|
4599
4612
|
} from "react";
|
|
4600
4613
|
import { Prism as PrismHighlighter } from "react-syntax-highlighter";
|
|
4601
4614
|
|
|
@@ -5594,7 +5607,7 @@ var one_light_default = {
|
|
|
5594
5607
|
};
|
|
5595
5608
|
|
|
5596
5609
|
// src/atoms/SyntaxHighlighter.tsx
|
|
5597
|
-
import { jsx as jsx54, jsxs as
|
|
5610
|
+
import { jsx as jsx54, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
5598
5611
|
function applyLineNumberClassName(children, className) {
|
|
5599
5612
|
if (!className) return children;
|
|
5600
5613
|
return Children.map(children, (child) => {
|
|
@@ -5607,14 +5620,14 @@ function applyLineNumberClassName(children, className) {
|
|
|
5607
5620
|
function SyntaxHighlighterImpl({ code, language, darkTheme, className, showLineNumbers }) {
|
|
5608
5621
|
const classNames = useOptionalContentClassNames();
|
|
5609
5622
|
const style = darkTheme ? one_dark_default : one_light_default;
|
|
5610
|
-
const [copied, setCopied] =
|
|
5611
|
-
const handleCopy =
|
|
5623
|
+
const [copied, setCopied] = useState20(false);
|
|
5624
|
+
const handleCopy = useCallback6(() => {
|
|
5612
5625
|
void navigator.clipboard.writeText(code).then(() => {
|
|
5613
5626
|
setCopied(true);
|
|
5614
5627
|
setTimeout(() => setCopied(false), 2e3);
|
|
5615
5628
|
});
|
|
5616
5629
|
}, [code]);
|
|
5617
|
-
return /* @__PURE__ */
|
|
5630
|
+
return /* @__PURE__ */ jsxs35(
|
|
5618
5631
|
"div",
|
|
5619
5632
|
{
|
|
5620
5633
|
className: cn(
|
|
@@ -5675,7 +5688,7 @@ function SyntaxHighlighterImpl({ code, language, darkTheme, className, showLineN
|
|
|
5675
5688
|
var SyntaxHighlighter = memo(SyntaxHighlighterImpl);
|
|
5676
5689
|
|
|
5677
5690
|
// src/atoms/ThreadListMisc.tsx
|
|
5678
|
-
import { Fragment as Fragment11, jsx as jsx55, jsxs as
|
|
5691
|
+
import { Fragment as Fragment11, jsx as jsx55, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
5679
5692
|
function ThreadListNewButton({ className, children, style, ...rest }) {
|
|
5680
5693
|
return /* @__PURE__ */ jsx55(
|
|
5681
5694
|
"button",
|
|
@@ -5691,7 +5704,7 @@ function ThreadListNewButton({ className, children, style, ...rest }) {
|
|
|
5691
5704
|
)
|
|
5692
5705
|
}),
|
|
5693
5706
|
...rest,
|
|
5694
|
-
children: children ?? /* @__PURE__ */
|
|
5707
|
+
children: children ?? /* @__PURE__ */ jsxs36(Fragment11, { children: [
|
|
5695
5708
|
/* @__PURE__ */ jsx55(Icon, { name: "square-pen" }),
|
|
5696
5709
|
"New Chat"
|
|
5697
5710
|
] })
|
|
@@ -5711,7 +5724,7 @@ function ThreadListEmptyState({ message = "No threads yet", className }) {
|
|
|
5711
5724
|
);
|
|
5712
5725
|
}
|
|
5713
5726
|
function ThreadListShell({ header, children, className }) {
|
|
5714
|
-
return /* @__PURE__ */
|
|
5727
|
+
return /* @__PURE__ */ jsxs36("div", { className: cn("font-sans-flex flex h-full min-h-0 flex-1 flex-col overflow-hidden", className), children: [
|
|
5715
5728
|
/* @__PURE__ */ jsx55("div", { className: "shrink-0 border-b border-border px-2 py-2", children: header }),
|
|
5716
5729
|
/* @__PURE__ */ jsx55("div", { className: "flex min-h-0 flex-1 flex-col overflow-hidden p-2", children })
|
|
5717
5730
|
] });
|
|
@@ -5774,7 +5787,7 @@ function canReuseMutableShell({
|
|
|
5774
5787
|
}
|
|
5775
5788
|
|
|
5776
5789
|
// src/atoms/ThreadListRow.tsx
|
|
5777
|
-
import { jsx as jsx56, jsxs as
|
|
5790
|
+
import { jsx as jsx56, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
5778
5791
|
function ThreadListRow({
|
|
5779
5792
|
title,
|
|
5780
5793
|
active,
|
|
@@ -5786,7 +5799,7 @@ function ThreadListRow({
|
|
|
5786
5799
|
}) {
|
|
5787
5800
|
const relative = lastMessageAt != null ? formatRelativeShort(lastMessageAt) : void 0;
|
|
5788
5801
|
const hasTrailing = relative != null || actions != null;
|
|
5789
|
-
return /* @__PURE__ */
|
|
5802
|
+
return /* @__PURE__ */ jsxs37(
|
|
5790
5803
|
"div",
|
|
5791
5804
|
{
|
|
5792
5805
|
"data-slot": "aui_thread-list-item",
|
|
@@ -5811,16 +5824,16 @@ function ThreadListRow({
|
|
|
5811
5824
|
active ? "text-dropdown-selected-item-text" : "text-inherit"
|
|
5812
5825
|
)
|
|
5813
5826
|
}),
|
|
5814
|
-
children: /* @__PURE__ */
|
|
5827
|
+
children: /* @__PURE__ */ jsxs37("span", { className: "min-w-0 flex-1", children: [
|
|
5815
5828
|
/* @__PURE__ */ jsx56("span", { className: "block truncate text-sm font-medium text-text-primary", children: title }),
|
|
5816
|
-
agentName != null ? /* @__PURE__ */
|
|
5829
|
+
agentName != null ? /* @__PURE__ */ jsxs37("span", { className: "mt-0.5 flex min-w-0 items-center gap-1 text-xs text-text-secondary", children: [
|
|
5817
5830
|
/* @__PURE__ */ jsx56(Icon, { name: "robot", className: "size-3 shrink-0" }),
|
|
5818
5831
|
/* @__PURE__ */ jsx56("span", { className: "truncate", children: agentName })
|
|
5819
5832
|
] }) : null
|
|
5820
5833
|
] })
|
|
5821
5834
|
}
|
|
5822
5835
|
),
|
|
5823
|
-
hasTrailing ? /* @__PURE__ */
|
|
5836
|
+
hasTrailing ? /* @__PURE__ */ jsxs37("div", { className: "relative mr-1 flex size-7 shrink-0 items-center justify-center", children: [
|
|
5824
5837
|
relative != null ? /* @__PURE__ */ jsx56(
|
|
5825
5838
|
"span",
|
|
5826
5839
|
{
|
|
@@ -5926,12 +5939,12 @@ var MessageGroup = forwardRef3(({ className, ...rest }, ref) => /* @__PURE__ */
|
|
|
5926
5939
|
MessageGroup.displayName = "MessageGroup";
|
|
5927
5940
|
|
|
5928
5941
|
// src/atoms/Toast.tsx
|
|
5929
|
-
import { useCallback as
|
|
5942
|
+
import { useCallback as useCallback7, useState as useState21 } from "react";
|
|
5930
5943
|
import { createPortal as createPortal2 } from "react-dom";
|
|
5931
|
-
import { jsx as jsx58, jsxs as
|
|
5944
|
+
import { jsx as jsx58, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
5932
5945
|
function Toast({ title, description, open, onOpenChange, variant = "error", className }) {
|
|
5933
|
-
const [copied, setCopied] =
|
|
5934
|
-
const handleCopy =
|
|
5946
|
+
const [copied, setCopied] = useState21(false);
|
|
5947
|
+
const handleCopy = useCallback7(async () => {
|
|
5935
5948
|
const text = `${title}
|
|
5936
5949
|
${description}`;
|
|
5937
5950
|
try {
|
|
@@ -5942,7 +5955,7 @@ ${description}`;
|
|
|
5942
5955
|
}
|
|
5943
5956
|
}, [title, description]);
|
|
5944
5957
|
if (!open) return null;
|
|
5945
|
-
return /* @__PURE__ */
|
|
5958
|
+
return /* @__PURE__ */ jsxs38(
|
|
5946
5959
|
"div",
|
|
5947
5960
|
{
|
|
5948
5961
|
role: "alert",
|
|
@@ -5960,8 +5973,8 @@ ${description}`;
|
|
|
5960
5973
|
className: cn("shrink-0", variant === "success" ? "text-success-bg" : "text-failure-bg")
|
|
5961
5974
|
}
|
|
5962
5975
|
),
|
|
5963
|
-
/* @__PURE__ */
|
|
5964
|
-
/* @__PURE__ */
|
|
5976
|
+
/* @__PURE__ */ jsxs38("div", { className: "min-w-0 flex-1", children: [
|
|
5977
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex items-start justify-between gap-2", children: [
|
|
5965
5978
|
/* @__PURE__ */ jsx58(
|
|
5966
5979
|
"div",
|
|
5967
5980
|
{
|
|
@@ -5972,7 +5985,7 @@ ${description}`;
|
|
|
5972
5985
|
children: title
|
|
5973
5986
|
}
|
|
5974
5987
|
),
|
|
5975
|
-
/* @__PURE__ */
|
|
5988
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex shrink-0 items-center gap-1", children: [
|
|
5976
5989
|
variant === "error" ? /* @__PURE__ */ jsx58(
|
|
5977
5990
|
"button",
|
|
5978
5991
|
{
|
|
@@ -6029,7 +6042,7 @@ function ToastStack({ children, duration: _duration = Number.POSITIVE_INFINITY }
|
|
|
6029
6042
|
}
|
|
6030
6043
|
|
|
6031
6044
|
// src/atoms/ToolApprovalBar.tsx
|
|
6032
|
-
import { jsx as jsx59, jsxs as
|
|
6045
|
+
import { jsx as jsx59, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
6033
6046
|
var DEFAULT_APPROVE_OPTIONS = [{ id: "approve", label: "Approve", variant: "primary" }];
|
|
6034
6047
|
var DEFAULT_DENY_OPTIONS = [
|
|
6035
6048
|
{ id: "deny", label: "Deny", variant: "secondary", requiresReason: true }
|
|
@@ -6062,22 +6075,22 @@ function ToolApprovalBar({
|
|
|
6062
6075
|
const isDenied = status?.type === "denied";
|
|
6063
6076
|
const interactionsLocked = disabled && !isDecided;
|
|
6064
6077
|
const headingText = isApproved ? "Tool Approved" : isDenied ? "Tool Approval Denied" : "Tool Approval Required for";
|
|
6065
|
-
return /* @__PURE__ */
|
|
6078
|
+
return /* @__PURE__ */ jsxs39(
|
|
6066
6079
|
"div",
|
|
6067
6080
|
{
|
|
6068
6081
|
className: cn("aui-tool-approval-bar", className),
|
|
6069
6082
|
"data-testid": dataTestPrefix ? `${dataTestPrefix}-approval` : void 0,
|
|
6070
6083
|
children: [
|
|
6071
|
-
/* @__PURE__ */
|
|
6072
|
-
/* @__PURE__ */
|
|
6084
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex gap-2", children: [
|
|
6085
|
+
/* @__PURE__ */ jsxs39("div", { className: cn("flex shrink-0 flex-col items-center", !showLineBelow && "pb-1"), children: [
|
|
6073
6086
|
/* @__PURE__ */ jsx59("div", { className: "min-h-[0.75rem] w-px flex-1 bg-border" }),
|
|
6074
6087
|
/* @__PURE__ */ jsx59(StepIconBox, { icon: "wrench", variant: "muted", iconSize: "0.875em", className: "my-1" }),
|
|
6075
6088
|
showLineBelow && /* @__PURE__ */ jsx59("div", { className: "min-h-[0.75rem] w-px flex-1 bg-border" })
|
|
6076
6089
|
] }),
|
|
6077
|
-
/* @__PURE__ */
|
|
6078
|
-
/* @__PURE__ */
|
|
6079
|
-
/* @__PURE__ */
|
|
6080
|
-
/* @__PURE__ */
|
|
6090
|
+
/* @__PURE__ */ jsxs39("div", { className: "mt-2 flex flex-1 items-center justify-between", children: [
|
|
6091
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
6092
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex items-center gap-2", children: [
|
|
6093
|
+
/* @__PURE__ */ jsxs39("span", { className: "inline-flex flex-wrap items-center gap-1 font-sans text-xs font-medium leading-4 text-text-primary", children: [
|
|
6081
6094
|
headingText,
|
|
6082
6095
|
/* @__PURE__ */ jsx59("span", { className: "rounded bg-secondary-bg px-1.5 py-0.5 text-xs text-text-secondary", children: toolName })
|
|
6083
6096
|
] }),
|
|
@@ -6101,8 +6114,8 @@ function ToolApprovalBar({
|
|
|
6101
6114
|
}
|
|
6102
6115
|
)
|
|
6103
6116
|
] }),
|
|
6104
|
-
!isDecided && !readOnly && !selectedDenyOption && /* @__PURE__ */
|
|
6105
|
-
approveOptions.map((option) => /* @__PURE__ */
|
|
6117
|
+
!isDecided && !readOnly && !selectedDenyOption && /* @__PURE__ */ jsxs39("div", { className: "flex gap-2", children: [
|
|
6118
|
+
approveOptions.map((option) => /* @__PURE__ */ jsxs39(
|
|
6106
6119
|
Button,
|
|
6107
6120
|
{
|
|
6108
6121
|
size: "sm",
|
|
@@ -6136,16 +6149,16 @@ function ToolApprovalBar({
|
|
|
6136
6149
|
] })
|
|
6137
6150
|
] })
|
|
6138
6151
|
] }),
|
|
6139
|
-
!isDecided && !readOnly && selectedDenyOption && /* @__PURE__ */
|
|
6140
|
-
(selectedDenyOption.confirm?.title || selectedDenyOption.confirm?.description) && /* @__PURE__ */
|
|
6152
|
+
!isDecided && !readOnly && selectedDenyOption && /* @__PURE__ */ jsxs39("div", { className: "flex flex-col gap-1 pl-8 pt-3", children: [
|
|
6153
|
+
(selectedDenyOption.confirm?.title || selectedDenyOption.confirm?.description) && /* @__PURE__ */ jsxs39("div", { className: "flex flex-col gap-0.5", children: [
|
|
6141
6154
|
selectedDenyOption.confirm.title && /* @__PURE__ */ jsx59("span", { className: "text-xs font-medium text-text-primary", children: selectedDenyOption.confirm.title }),
|
|
6142
6155
|
selectedDenyOption.confirm.description && /* @__PURE__ */ jsx59("span", { className: "text-xs text-text-secondary", children: selectedDenyOption.confirm.description })
|
|
6143
6156
|
] }),
|
|
6144
|
-
selectedDenyOption.grants && selectedDenyOption.grants.length > 0 && /* @__PURE__ */
|
|
6157
|
+
selectedDenyOption.grants && selectedDenyOption.grants.length > 0 && /* @__PURE__ */ jsxs39("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
6145
6158
|
/* @__PURE__ */ jsx59("span", { className: "text-xs text-text-secondary", children: "Grants:" }),
|
|
6146
6159
|
selectedDenyOption.grants.map((grant) => /* @__PURE__ */ jsx59("span", { className: "rounded bg-secondary-bg px-1.5 py-0.5 text-xs text-text-secondary", children: grant }, grant))
|
|
6147
6160
|
] }),
|
|
6148
|
-
/* @__PURE__ */
|
|
6161
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex items-center gap-2", children: [
|
|
6149
6162
|
/* @__PURE__ */ jsx59(
|
|
6150
6163
|
"input",
|
|
6151
6164
|
{
|
|
@@ -6166,7 +6179,7 @@ function ToolApprovalBar({
|
|
|
6166
6179
|
] }),
|
|
6167
6180
|
showReasonError && /* @__PURE__ */ jsx59("span", { id: "aui-denial-reason-error", className: "text-xs text-failure-bg", role: "alert", children: "Reason is required" })
|
|
6168
6181
|
] }),
|
|
6169
|
-
isDecided && status?.reason && /* @__PURE__ */ jsx59("div", { className: "pl-8 pt-2", children: /* @__PURE__ */
|
|
6182
|
+
isDecided && status?.reason && /* @__PURE__ */ jsx59("div", { className: "pl-8 pt-2", children: /* @__PURE__ */ jsxs39("span", { className: "text-xs text-text-secondary", children: [
|
|
6170
6183
|
"Reason: ",
|
|
6171
6184
|
status.reason
|
|
6172
6185
|
] }) })
|
|
@@ -6176,7 +6189,7 @@ function ToolApprovalBar({
|
|
|
6176
6189
|
}
|
|
6177
6190
|
|
|
6178
6191
|
// src/atoms/ToolCallCard.tsx
|
|
6179
|
-
import { Fragment as Fragment12, jsx as jsx60, jsxs as
|
|
6192
|
+
import { Fragment as Fragment12, jsx as jsx60, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
6180
6193
|
var DEFAULT_AWAITING_TEXT = "Awaiting Response...";
|
|
6181
6194
|
function ToolCallCard({
|
|
6182
6195
|
icon = "mcp-server",
|
|
@@ -6240,7 +6253,7 @@ function ToolCallCard({
|
|
|
6240
6253
|
showContentConnector: true,
|
|
6241
6254
|
showPersistentContentConnector: !hasApproval,
|
|
6242
6255
|
dataTestPrefix: dataTestPrefix ? `${dataTestPrefix}-header` : void 0,
|
|
6243
|
-
persistentChildren: /* @__PURE__ */
|
|
6256
|
+
persistentChildren: /* @__PURE__ */ jsxs40(Fragment12, { children: [
|
|
6244
6257
|
approvalSlot,
|
|
6245
6258
|
expanded && showResponseLine && responseSlot && /* @__PURE__ */ jsx60("div", { "data-testid": dataTestPrefix ? `${dataTestPrefix}-response` : void 0, children: responseSlot })
|
|
6246
6259
|
] }),
|
|
@@ -6252,8 +6265,8 @@ function ToolCallCard({
|
|
|
6252
6265
|
}
|
|
6253
6266
|
|
|
6254
6267
|
// src/atoms/ToolCallContentBlock.tsx
|
|
6255
|
-
import { useState as
|
|
6256
|
-
import { jsx as jsx61, jsxs as
|
|
6268
|
+
import { useState as useState22 } from "react";
|
|
6269
|
+
import { jsx as jsx61, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
6257
6270
|
function JsonEditor({
|
|
6258
6271
|
content,
|
|
6259
6272
|
height,
|
|
@@ -6300,7 +6313,7 @@ function ToolCallContentBlock({
|
|
|
6300
6313
|
className
|
|
6301
6314
|
}) {
|
|
6302
6315
|
const Markdown2 = useSlot("Markdown");
|
|
6303
|
-
const [copied, setCopied] =
|
|
6316
|
+
const [copied, setCopied] = useState22(false);
|
|
6304
6317
|
const handleCopy = () => {
|
|
6305
6318
|
const val = copyValue ?? content;
|
|
6306
6319
|
void navigator.clipboard.writeText(val).then(() => {
|
|
@@ -6316,7 +6329,7 @@ function ToolCallContentBlock({
|
|
|
6316
6329
|
} : {
|
|
6317
6330
|
padding: "0.25rem"
|
|
6318
6331
|
};
|
|
6319
|
-
return /* @__PURE__ */
|
|
6332
|
+
return /* @__PURE__ */ jsxs41(
|
|
6320
6333
|
"div",
|
|
6321
6334
|
{
|
|
6322
6335
|
className: cn(
|
|
@@ -6326,9 +6339,9 @@ function ToolCallContentBlock({
|
|
|
6326
6339
|
"data-testid": dataTestPrefix ? `${dataTestPrefix}-content-block` : "tfy-tool-call-content-block",
|
|
6327
6340
|
"data-content": content,
|
|
6328
6341
|
children: [
|
|
6329
|
-
/* @__PURE__ */
|
|
6342
|
+
/* @__PURE__ */ jsxs41("div", { className: "flex items-center justify-between rounded-t-lg border border-primary-button-bg/30 bg-primary-button-bg/10 px-3 py-1", children: [
|
|
6330
6343
|
/* @__PURE__ */ jsx61("div", { className: "font-sans text-xs font-medium text-primary-button-bg", children: title }),
|
|
6331
|
-
/* @__PURE__ */
|
|
6344
|
+
/* @__PURE__ */ jsxs41("div", { className: "flex items-center gap-1", children: [
|
|
6332
6345
|
/* @__PURE__ */ jsx61(
|
|
6333
6346
|
"button",
|
|
6334
6347
|
{
|
|
@@ -6380,8 +6393,8 @@ function ToolCallContentBlock({
|
|
|
6380
6393
|
)
|
|
6381
6394
|
}
|
|
6382
6395
|
),
|
|
6383
|
-
fullscreen && /* @__PURE__ */ jsx61(Dialog, { open: true, onOpenChange: (open) => onFullscreenChange?.(open), children: /* @__PURE__ */
|
|
6384
|
-
/* @__PURE__ */
|
|
6396
|
+
fullscreen && /* @__PURE__ */ jsx61(Dialog, { open: true, onOpenChange: (open) => onFullscreenChange?.(open), children: /* @__PURE__ */ jsxs41(DialogContent, { className: "flex h-[80vh] max-w-4xl flex-col", children: [
|
|
6397
|
+
/* @__PURE__ */ jsxs41(DialogHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
|
|
6385
6398
|
/* @__PURE__ */ jsx61(DialogTitle, { children: title }),
|
|
6386
6399
|
/* @__PURE__ */ jsx61(IconButton, { variant: "ghost", onClick: () => onFullscreenChange?.(false), "aria-label": "Minimize", children: /* @__PURE__ */ jsx61(Icon, { name: "compress", size: "0.875em" }) })
|
|
6387
6400
|
] }),
|
|
@@ -6393,7 +6406,7 @@ function ToolCallContentBlock({
|
|
|
6393
6406
|
}
|
|
6394
6407
|
|
|
6395
6408
|
// src/atoms/ToolGroupCard.tsx
|
|
6396
|
-
import { jsx as jsx62, jsxs as
|
|
6409
|
+
import { jsx as jsx62, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
6397
6410
|
function ToolGroupCard({
|
|
6398
6411
|
toolCallCount,
|
|
6399
6412
|
expanded,
|
|
@@ -6406,7 +6419,7 @@ function ToolGroupCard({
|
|
|
6406
6419
|
const AccordionSummary2 = useSlot("AccordionSummary");
|
|
6407
6420
|
const AccordionDetails2 = useSlot("AccordionDetails");
|
|
6408
6421
|
const label = `${toolCallCount} tool ${toolCallCount === 1 ? "call" : "calls"}`;
|
|
6409
|
-
return /* @__PURE__ */
|
|
6422
|
+
return /* @__PURE__ */ jsxs42(
|
|
6410
6423
|
Accordion2,
|
|
6411
6424
|
{
|
|
6412
6425
|
"data-slot": "tool-group-card",
|
|
@@ -6428,7 +6441,7 @@ function ToolGroupCard({
|
|
|
6428
6441
|
"&:hover": { backgroundColor: "transparent" },
|
|
6429
6442
|
"& .MuiAccordionSummary-content": { margin: 0, width: "100%" }
|
|
6430
6443
|
},
|
|
6431
|
-
children: /* @__PURE__ */
|
|
6444
|
+
children: /* @__PURE__ */ jsxs42("div", { className: "text-text-secondary hover:text-text-primary flex origin-left items-center gap-2 py-1.5 text-sm transition-[color,scale] active:scale-[0.98]", children: [
|
|
6432
6445
|
active && /* @__PURE__ */ jsx62(Icon, { name: "loader", className: "size-3 shrink-0 animate-spin [animation-duration:0.6s]" }),
|
|
6433
6446
|
/* @__PURE__ */ jsx62("span", { className: "text-xs font-medium", children: label }),
|
|
6434
6447
|
/* @__PURE__ */ jsx62(
|
|
@@ -6451,7 +6464,7 @@ function ToolGroupCard({
|
|
|
6451
6464
|
}
|
|
6452
6465
|
|
|
6453
6466
|
// src/atoms/UserMessageActionBar.tsx
|
|
6454
|
-
import { jsx as jsx63, jsxs as
|
|
6467
|
+
import { jsx as jsx63, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
6455
6468
|
var actionBtnClass2 = "h-6 w-6 text-text-secondary hover:text-text-primary [&_svg]:size-3.5";
|
|
6456
6469
|
function UserMessageActionBar({
|
|
6457
6470
|
isCopied,
|
|
@@ -6463,7 +6476,7 @@ function UserMessageActionBar({
|
|
|
6463
6476
|
className
|
|
6464
6477
|
}) {
|
|
6465
6478
|
const MessageTimestamp2 = useSlot("MessageTimestamp");
|
|
6466
|
-
return /* @__PURE__ */
|
|
6479
|
+
return /* @__PURE__ */ jsxs43("div", { className: cn("aui-user-action-bar-root animate-in fade-in flex items-center gap-1 duration-200", className), children: [
|
|
6467
6480
|
/* @__PURE__ */ jsx63(MessageTimestamp2, { createdAt, className: "mr-1" }),
|
|
6468
6481
|
/* @__PURE__ */ jsx63(
|
|
6469
6482
|
IconButton,
|
|
@@ -6493,9 +6506,9 @@ function UserMessageActionBar({
|
|
|
6493
6506
|
}
|
|
6494
6507
|
|
|
6495
6508
|
// src/atoms/UserMessageBubble.tsx
|
|
6496
|
-
import { jsx as jsx64, jsxs as
|
|
6509
|
+
import { jsx as jsx64, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
6497
6510
|
function UserMessageBubble({ text, attachments, editAction, className }) {
|
|
6498
|
-
return /* @__PURE__ */
|
|
6511
|
+
return /* @__PURE__ */ jsxs44(
|
|
6499
6512
|
"div",
|
|
6500
6513
|
{
|
|
6501
6514
|
"data-slot": "aui_user-message-root",
|
|
@@ -6519,10 +6532,10 @@ function UserMessageBubble({ text, attachments, editAction, className }) {
|
|
|
6519
6532
|
|
|
6520
6533
|
// src/atoms/UserMessageEdit.tsx
|
|
6521
6534
|
import { forwardRef as forwardRef4 } from "react";
|
|
6522
|
-
import { jsx as jsx65, jsxs as
|
|
6535
|
+
import { jsx as jsx65, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
6523
6536
|
var UserMessageEdit = forwardRef4(
|
|
6524
6537
|
function UserMessageEdit2({ timestamp, attachments, input, footer, className, ...rest }, ref) {
|
|
6525
|
-
return /* @__PURE__ */
|
|
6538
|
+
return /* @__PURE__ */ jsxs45(
|
|
6526
6539
|
"div",
|
|
6527
6540
|
{
|
|
6528
6541
|
ref,
|
|
@@ -6530,7 +6543,7 @@ var UserMessageEdit = forwardRef4(
|
|
|
6530
6543
|
className: cn("flex flex-col gap-2 w-full", className),
|
|
6531
6544
|
...rest,
|
|
6532
6545
|
children: [
|
|
6533
|
-
(timestamp || attachments) && /* @__PURE__ */
|
|
6546
|
+
(timestamp || attachments) && /* @__PURE__ */ jsxs45("div", { className: "flex items-center gap-2 text-sm text-text-secondary", children: [
|
|
6534
6547
|
/* @__PURE__ */ jsx65("span", { className: "font-medium text-text-primary", children: "User" }),
|
|
6535
6548
|
timestamp
|
|
6536
6549
|
] }),
|
|
@@ -6544,12 +6557,12 @@ var UserMessageEdit = forwardRef4(
|
|
|
6544
6557
|
);
|
|
6545
6558
|
|
|
6546
6559
|
// src/atoms/WelcomeScreen.tsx
|
|
6547
|
-
import { jsx as jsx66, jsxs as
|
|
6560
|
+
import { jsx as jsx66, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
6548
6561
|
function WelcomeScreen({ heading = "How can I help you today?", icon, className }) {
|
|
6549
6562
|
const preset = useOptionalThemePreset();
|
|
6550
6563
|
const BrandLogo2 = useSlot("BrandLogo");
|
|
6551
6564
|
const resolvedIcon = icon !== void 0 ? icon : preset === "chatgpt" ? null : preset === "claude" ? /* @__PURE__ */ jsx66(Icon, { name: "welcome-sparkle", className: "size-5 fill-current text-primary-button-bg" }) : /* @__PURE__ */ jsx66(BrandLogo2, { className: "size-10" });
|
|
6552
|
-
return /* @__PURE__ */
|
|
6565
|
+
return /* @__PURE__ */ jsxs46(
|
|
6553
6566
|
"div",
|
|
6554
6567
|
{
|
|
6555
6568
|
"data-preset": preset,
|
|
@@ -6661,16 +6674,16 @@ var defaultSlots = {
|
|
|
6661
6674
|
|
|
6662
6675
|
// src/theme/SlotsProvider.tsx
|
|
6663
6676
|
import { jsx as jsx67 } from "react/jsx-runtime";
|
|
6664
|
-
var SlotsContext =
|
|
6665
|
-
var ThemeModeContext =
|
|
6677
|
+
var SlotsContext = createContext3(defaultSlots);
|
|
6678
|
+
var ThemeModeContext = createContext3(void 0);
|
|
6666
6679
|
function SlotsProvider({
|
|
6667
6680
|
overrides,
|
|
6668
6681
|
theme,
|
|
6669
6682
|
children
|
|
6670
6683
|
}) {
|
|
6671
|
-
const parentSlots =
|
|
6672
|
-
const inheritedTheme =
|
|
6673
|
-
const resolved =
|
|
6684
|
+
const parentSlots = useContext4(SlotsContext);
|
|
6685
|
+
const inheritedTheme = useContext4(ThemeModeContext);
|
|
6686
|
+
const resolved = useMemo7(() => ({ ...parentSlots, ...overrides }), [parentSlots, overrides]);
|
|
6674
6687
|
const slotsTree = /* @__PURE__ */ jsx67(SlotsProviderContents, { slots: resolved, inheritedTheme, theme, children });
|
|
6675
6688
|
const hasParentTheme = inheritedTheme !== void 0;
|
|
6676
6689
|
if (theme !== void 0 || !hasParentTheme) {
|
|
@@ -6690,15 +6703,15 @@ function SlotsProviderContents({
|
|
|
6690
6703
|
return /* @__PURE__ */ jsx67(ThemeModeContext.Provider, { value: resolvedTheme, children: /* @__PURE__ */ jsx67(SlotsContext.Provider, { value: slots, children }) });
|
|
6691
6704
|
}
|
|
6692
6705
|
function useSlot(name) {
|
|
6693
|
-
const slots =
|
|
6706
|
+
const slots = useContext4(SlotsContext);
|
|
6694
6707
|
return slots[name];
|
|
6695
6708
|
}
|
|
6696
6709
|
function useSlotIsDefault(name) {
|
|
6697
|
-
const slots =
|
|
6710
|
+
const slots = useContext4(SlotsContext);
|
|
6698
6711
|
return slots[name] === defaultSlots[name];
|
|
6699
6712
|
}
|
|
6700
6713
|
function useThemeMode() {
|
|
6701
|
-
return
|
|
6714
|
+
return useContext4(ThemeModeContext) ?? "light";
|
|
6702
6715
|
}
|
|
6703
6716
|
|
|
6704
6717
|
export {
|
|
@@ -6715,7 +6728,6 @@ export {
|
|
|
6715
6728
|
useSlotIsDefault,
|
|
6716
6729
|
useThemeMode,
|
|
6717
6730
|
ResumeUnavailable,
|
|
6718
|
-
getErrorMessage,
|
|
6719
6731
|
useSearchAgentsList,
|
|
6720
6732
|
CenteredModal,
|
|
6721
6733
|
SearchInput_default,
|
|
@@ -6740,8 +6752,7 @@ export {
|
|
|
6740
6752
|
ComposerShell,
|
|
6741
6753
|
useIsMobile,
|
|
6742
6754
|
BottomSheet,
|
|
6743
|
-
|
|
6744
|
-
useDraftCatalog,
|
|
6755
|
+
modelPatchWithReasoningEffort,
|
|
6745
6756
|
DraftComposerLeftSection,
|
|
6746
6757
|
DraftComposerRightSection,
|
|
6747
6758
|
ToasterProvider,
|
|
@@ -6749,10 +6760,10 @@ export {
|
|
|
6749
6760
|
useToasterOptional,
|
|
6750
6761
|
MCP_AUTH_POPUP_CHANNEL,
|
|
6751
6762
|
useMCPAuth,
|
|
6763
|
+
auiInputClass,
|
|
6752
6764
|
Tooltip,
|
|
6753
6765
|
Switch,
|
|
6754
6766
|
DraftCompositeSelector,
|
|
6755
|
-
auiInputClass,
|
|
6756
6767
|
CatalogLogo,
|
|
6757
6768
|
DraftModelSelector,
|
|
6758
6769
|
HistoryLoader,
|
|
@@ -6797,4 +6808,4 @@ export {
|
|
|
6797
6808
|
WelcomeScreen,
|
|
6798
6809
|
defaultSlots
|
|
6799
6810
|
};
|
|
6800
|
-
//# sourceMappingURL=chunk-
|
|
6811
|
+
//# sourceMappingURL=chunk-QGNLP2EE.js.map
|