local-operator-ui 0.7.2 → 0.7.4

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.
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-CkAsfYTs.js","./fonts-BAmz1ETd.js","./fonts-B9KBGB-g.css","./index-BkZEKoZT.js","./pug-By0kVCfm.js","./javascript-C3MnDRiU.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-BpktHwp9.js","./fonts-BAmz1ETd.js","./fonts-B9KBGB-g.css","./index-D4xePR3Q.js","./pug-By0kVCfm.js","./javascript-C3MnDRiU.js"])))=>i.map(i=>d[i]);
2
2
  import { c as createStyled, r as resolveProps, u as useTheme, a as reactExports, b as clsx, d as useForkRef, e as extendSxProp, j as jsxRuntimeExports, h as handleBreakpoints, f as resolveBreakpointValues, g as createUnarySpacing, i as deepmerge, m as mergeBreakpointsInOrder, k as composeClasses, l as generateUtilityClass, n as createTheme$1, o as getValue, R as React, p as getDefaultExportFromCjs, q as requireReactDom, s as React$1, t as generateUtilityClasses, v as useDefaultProps, w as styled$1, x as capitalize, y as memoTheme, _ as _inheritsLoose, z as _objectWithoutPropertiesLoose$i, T as TransitionGroupContext, A as duration, B as useTheme$1, C as useTimeout, D as useId, E as ButtonBase, F as alpha$1, G as createSimplePaletteValueFilter, H as CircularProgress, P as Paper, I as darken, J as lighten, K as useEventCallback, L as useEnhancedEffect, M as useRtl, N as globalCss, O as formatMuiErrorMessage, Q as rootShouldForwardProp, S as Typography, U as getPath$2, V as isFocusVisible, W as typographyClasses, X as slotShouldForwardProp, Y as css$1, Z as keyframes, $ as clamp, a0 as emphasize, a1 as Timeout, a2 as Button, a3 as Box, a4 as FontAwesomeIcon, a5 as faExclamationTriangle, a6 as DEFAULT_THEME, a7 as faChevronLeft, a8 as faChevronRight, a9 as faRobot, aa as faCheck, ab as faTimes, ac as faEraser, ad as faPen, ae as faFileImport, af as faUpload, ag as requireReact, ah as LinearProgress, ai as faComment, aj as faSave, ak as faEdit, al as faTrashAlt, am as faComments, an as faInfoCircle, ao as faGear, ap as faPlus, aq as faServer, ar as faStar, as as faTag, at as faIdCard, au as faCalendarAlt, av as faCodeBranch, aw as faShieldAlt, ax as faArrowLeft, ay as faClock, az as faHome, aA as faDownload, aB as faFileAlt, aC as faDesktop, aD as faImage, aE as faMusic, aF as faVideo, aG as faLaptop, aH as faUsers, aI as faDatabase, aJ as faBoxOpen, aK as faBook, aL as faHdd, aM as faBox, aN as faArchive, aO as faNetworkWired, aP as faFolder, aQ as faFolderOpen, aR as faFolderTree, aS as faChevronDown, aT as faTools, aU as _extends$u, aV as faSliders, aW as faTrash, aX as faArrowDown, aY as faPaperclip, aZ as faStop, a_ as faPaperPlane, a$ as faChevronUp, b0 as faQuestion, b1 as faFile, b2 as faExclamationCircle, b3 as faLightbulb, b4 as faCode, b5 as faCommentDots, b6 as faShare, b7 as faPencilAlt, b8 as faUser, b9 as faCopy, ba as isDevelopmentMode, bb as faCommentSlash, bc as faArrowRight, bd as faBrain, be as faWandMagicSparkles, bf as faExternalLinkAlt, bg as faKey, bh as radientTheme, bi as faGlobe, bj as faSearch, bk as commonjsGlobal, bl as PropTypes, bm as faLock, bn as faSignOut, bo as themes, bp as faMoon, bq as faSun, br as faHexagonNodes, bs as faSkull, bt as faLeaf, bu as faMountain, bv as faFire, bw as faIcicles, bx as faEnvelope, by as faHistory, bz as faListAlt, bA as faAdjust, bB as faCreditCard, bC as faPlusCircle, bD as faChartLine, bE as faShield, bF as library$1, bG as icons$1, bH as CssBaseline, bI as ThemeProvider$1, bJ as getTheme, bK as ReactDOM$1, bL as ErrorBoundary } from "./fonts-BAmz1ETd.js";
3
3
  const styled = createStyled();
4
4
  function getThemeProps(params) {
@@ -22596,7 +22596,7 @@ const styledRootConfig = {
22596
22596
  slot: "Root"
22597
22597
  };
22598
22598
  const StyledInput$1 = styled$1(Input, styledRootConfig)("");
22599
- const StyledOutlinedInput = styled$1(OutlinedInput, styledRootConfig)("");
22599
+ const StyledOutlinedInput$1 = styled$1(OutlinedInput, styledRootConfig)("");
22600
22600
  const StyledFilledInput = styled$1(FilledInput, styledRootConfig)("");
22601
22601
  const Select = /* @__PURE__ */ reactExports.forwardRef(function Select2(inProps, ref) {
22602
22602
  const props2 = useDefaultProps({
@@ -22649,7 +22649,7 @@ const Select = /* @__PURE__ */ reactExports.forwardRef(function Select2(inProps,
22649
22649
  standard: /* @__PURE__ */ jsxRuntimeExports.jsx(StyledInput$1, {
22650
22650
  ownerState
22651
22651
  }),
22652
- outlined: /* @__PURE__ */ jsxRuntimeExports.jsx(StyledOutlinedInput, {
22652
+ outlined: /* @__PURE__ */ jsxRuntimeExports.jsx(StyledOutlinedInput$1, {
22653
22653
  label,
22654
22654
  ownerState
22655
22655
  }),
@@ -35513,19 +35513,48 @@ const ChatLayout = ({ sidebar, content: content2 }) => {
35513
35513
  ] });
35514
35514
  };
35515
35515
  const DEFAULT_DEFER_TIMELINE_MS = 48 * 60 * 60 * 1e3;
35516
+ var UpdateType = /* @__PURE__ */ ((UpdateType2) => {
35517
+ UpdateType2["UI"] = "ui";
35518
+ UpdateType2["BACKEND"] = "backend";
35519
+ return UpdateType2;
35520
+ })(UpdateType || {});
35516
35521
  const useDeferredUpdatesStore = create$1()(
35517
35522
  persist(
35518
35523
  (set, get2) => ({
35519
- deferredVersion: null,
35520
- deferredAt: null,
35521
- deferUpdate: (version2) => {
35522
- set({
35523
- deferredVersion: version2,
35524
- deferredAt: Date.now()
35525
- });
35524
+ uiDeferredVersion: null,
35525
+ uiDeferredAt: null,
35526
+ backendDeferredVersion: null,
35527
+ backendDeferredAt: null,
35528
+ hydrated: false,
35529
+ deferUpdate: (type2, version2) => {
35530
+ if (type2 === "ui") {
35531
+ set({
35532
+ uiDeferredVersion: version2,
35533
+ uiDeferredAt: Date.now()
35534
+ });
35535
+ } else {
35536
+ set({
35537
+ backendDeferredVersion: version2,
35538
+ backendDeferredAt: Date.now()
35539
+ });
35540
+ }
35526
35541
  },
35527
- shouldShowUpdate: (version2) => {
35528
- const { deferredVersion, deferredAt } = get2();
35542
+ shouldShowUpdate: (type2, version2) => {
35543
+ const {
35544
+ uiDeferredVersion,
35545
+ uiDeferredAt,
35546
+ backendDeferredVersion,
35547
+ backendDeferredAt
35548
+ } = get2();
35549
+ let deferredVersion;
35550
+ let deferredAt;
35551
+ if (type2 === "ui") {
35552
+ deferredVersion = uiDeferredVersion;
35553
+ deferredAt = uiDeferredAt;
35554
+ } else {
35555
+ deferredVersion = backendDeferredVersion;
35556
+ deferredAt = backendDeferredAt;
35557
+ }
35529
35558
  if (!deferredVersion || !deferredAt) {
35530
35559
  return true;
35531
35560
  }
@@ -35536,15 +35565,31 @@ const useDeferredUpdatesStore = create$1()(
35536
35565
  const timeElapsed = now - deferredAt;
35537
35566
  return timeElapsed > DEFAULT_DEFER_TIMELINE_MS;
35538
35567
  },
35539
- clearDeferredUpdate: () => {
35540
- set({
35541
- deferredVersion: null,
35542
- deferredAt: null
35543
- });
35568
+ clearDeferredUpdate: (type2) => {
35569
+ if (type2 === "ui") {
35570
+ set({
35571
+ uiDeferredVersion: null,
35572
+ uiDeferredAt: null
35573
+ });
35574
+ } else if (type2 === "backend") {
35575
+ set({
35576
+ backendDeferredVersion: null,
35577
+ backendDeferredAt: null
35578
+ });
35579
+ } else {
35580
+ throw new Error(`Invalid update type: ${type2}`);
35581
+ }
35544
35582
  }
35545
35583
  }),
35546
35584
  {
35547
- name: "deferred-updates-storage"
35585
+ name: "deferred-updates-storage",
35586
+ onRehydrateStorage: () => (store) => {
35587
+ if (store && typeof store === "object" && "setState" in store && typeof store.setState === "function") {
35588
+ store.setState({
35589
+ hydrated: true
35590
+ });
35591
+ }
35592
+ }
35548
35593
  }
35549
35594
  )
35550
35595
  );
@@ -35607,7 +35652,8 @@ const CheckForUpdatesButton = () => {
35607
35652
  try {
35608
35653
  setChecking(true);
35609
35654
  manualCheckRef.current = true;
35610
- clearDeferredUpdate();
35655
+ clearDeferredUpdate(UpdateType.UI);
35656
+ clearDeferredUpdate(UpdateType.BACKEND);
35611
35657
  await window.api.updater.checkForAllUpdates();
35612
35658
  } catch (error) {
35613
35659
  setSnackbarMessage(
@@ -36946,39 +36992,58 @@ const useJobPolling = ({
36946
36992
  queryFn: async () => {
36947
36993
  if (!currentJobId) return null;
36948
36994
  const client2 = createLocalOperatorClient(apiConfig.baseUrl);
36949
- const response = await client2.jobs.getJobStatus(currentJobId);
36950
- return response.result;
36995
+ try {
36996
+ const response = await client2.jobs.getJobStatus(currentJobId);
36997
+ return response.result;
36998
+ } catch (err) {
36999
+ const errorObj = err;
37000
+ if (errorObj?.response?.status === 404 || errorObj?.status === 404 || errorObj?.message?.toString().includes("404")) {
37001
+ return { status: "not_found" };
37002
+ }
37003
+ throw err;
37004
+ }
36951
37005
  },
36952
- // Only run the query if we have a job ID and server is online (bypass internet check)
36953
37006
  enabled: shouldEnableQuery({ bypassInternetCheck: true }) && !!currentJobId,
36954
- // Poll every 1 second while job is active
36955
37007
  refetchInterval: currentJobId ? 1e3 : false,
36956
37008
  refetchIntervalInBackground: false,
36957
37009
  refetchOnWindowFocus: true,
36958
- // Don't cache the result
36959
37010
  gcTime: 0,
36960
37011
  staleTime: 0,
36961
- // Retry failed requests to ensure polling continues
36962
37012
  retry: true,
36963
37013
  retryDelay: 1e3
36964
37014
  });
37015
+ function isJobDetails(data2) {
37016
+ return typeof data2 === "object" && data2 !== null && "id" in data2 && typeof data2.id === "string";
37017
+ }
36965
37018
  reactExports.useEffect(() => {
36966
- if (!jobData || !conversationId) return void 0;
36967
- const jobDataSignature = `${jobData.id}-${jobData.status}-${dataUpdatedAt}`;
36968
- if (jobDataSignature !== lastProcessedJobDataRef.current) {
36969
- lastProcessedJobDataRef.current = jobDataSignature;
36970
- if (jobData.current_execution) {
36971
- setCurrentExecution(jobData.current_execution);
36972
- }
36973
- if (jobData.status === "processing") {
36974
- const debounceTimeout = setTimeout(() => {
36975
- updateConversationMessages(conversationId);
36976
- }, 500);
36977
- return () => clearTimeout(debounceTimeout);
36978
- }
36979
- if (jobData.status === "completed" || jobData.status === "failed") {
36980
- handleJobCompletion(jobData);
37019
+ if (!conversationId) return void 0;
37020
+ if (jobData && jobData.status === "not_found") {
37021
+ (async () => {
37022
+ await updateConversationMessages(conversationId);
37023
+ setCurrentJobId(null);
37024
+ setIsLoading(false);
36981
37025
  setCurrentExecution(null);
37026
+ })();
37027
+ return;
37028
+ }
37029
+ if (!jobData) return void 0;
37030
+ if (isJobDetails(jobData)) {
37031
+ const jobDataSignature = `${jobData.id}-${jobData.status}-${dataUpdatedAt}`;
37032
+ if (jobDataSignature !== lastProcessedJobDataRef.current) {
37033
+ lastProcessedJobDataRef.current = jobDataSignature;
37034
+ if (jobData.current_execution) {
37035
+ setCurrentExecution(jobData.current_execution);
37036
+ }
37037
+ if (jobData.status === "processing") {
37038
+ const debounceTimeout = setTimeout(() => {
37039
+ updateConversationMessages(conversationId);
37040
+ }, 500);
37041
+ return () => clearTimeout(debounceTimeout);
37042
+ }
37043
+ if (jobData.status === "completed" || jobData.status === "failed") {
37044
+ handleJobCompletion(jobData);
37045
+ setCurrentExecution(null);
37046
+ }
36982
37047
  }
36983
37048
  }
36984
37049
  return void 0;
@@ -36988,7 +37053,6 @@ const useJobPolling = ({
36988
37053
  handleJobCompletion,
36989
37054
  conversationId,
36990
37055
  updateConversationMessages,
36991
- setCurrentExecution,
36992
37056
  setCurrentJobId
36993
37057
  ]);
36994
37058
  reactExports.useEffect(() => {
@@ -36999,43 +37063,254 @@ const useJobPolling = ({
36999
37063
  }
37000
37064
  }
37001
37065
  }, [error, currentJobId, queryClient2]);
37066
+ const validJobStatuses = [
37067
+ "pending",
37068
+ "processing",
37069
+ "completed",
37070
+ "failed",
37071
+ "cancelled"
37072
+ ];
37073
+ let jobStatus = null;
37074
+ if (jobData && typeof jobData.status === "string" && validJobStatuses.includes(jobData.status)) {
37075
+ jobStatus = jobData.status;
37076
+ }
37002
37077
  return {
37003
37078
  currentJobId,
37004
37079
  setCurrentJobId,
37005
- jobStatus: jobData?.status || null,
37080
+ jobStatus,
37006
37081
  isLoading,
37007
37082
  setIsLoading,
37008
37083
  checkForActiveJobs,
37009
37084
  currentExecution
37010
37085
  };
37011
37086
  };
37087
+ const useConversationInputStore = create$1()(
37088
+ persist(
37089
+ (set, get2) => ({
37090
+ inputByConversation: {},
37091
+ setCurrentInput: (conversationId, value) => {
37092
+ const existing = get2().inputByConversation[conversationId] || {
37093
+ currentInput: "",
37094
+ submittedMessages: [],
37095
+ currentHistoryIndex: null
37096
+ };
37097
+ set({
37098
+ inputByConversation: {
37099
+ ...get2().inputByConversation,
37100
+ [conversationId]: {
37101
+ ...existing,
37102
+ currentInput: value
37103
+ }
37104
+ }
37105
+ });
37106
+ },
37107
+ getCurrentInput: (conversationId) => {
37108
+ return get2().inputByConversation[conversationId]?.currentInput || "";
37109
+ },
37110
+ addSubmittedMessage: (conversationId, message2) => {
37111
+ const existing = get2().inputByConversation[conversationId] || {
37112
+ currentInput: "",
37113
+ submittedMessages: [],
37114
+ currentHistoryIndex: null
37115
+ };
37116
+ const last2 = existing.submittedMessages[existing.submittedMessages.length - 1];
37117
+ const newMessages = message2 && message2 !== last2 ? [
37118
+ ...existing.submittedMessages.slice(
37119
+ -20 + 1
37120
+ ),
37121
+ message2
37122
+ ] : existing.submittedMessages;
37123
+ set({
37124
+ inputByConversation: {
37125
+ ...get2().inputByConversation,
37126
+ [conversationId]: {
37127
+ ...existing,
37128
+ submittedMessages: newMessages
37129
+ }
37130
+ }
37131
+ });
37132
+ },
37133
+ getSubmittedMessages: (conversationId) => {
37134
+ return get2().inputByConversation[conversationId]?.submittedMessages || [];
37135
+ },
37136
+ clearSubmittedMessages: (conversationId) => {
37137
+ const existing = get2().inputByConversation[conversationId];
37138
+ if (!existing) return;
37139
+ set({
37140
+ inputByConversation: {
37141
+ ...get2().inputByConversation,
37142
+ [conversationId]: {
37143
+ ...existing,
37144
+ submittedMessages: []
37145
+ }
37146
+ }
37147
+ });
37148
+ },
37149
+ getCurrentHistoryIndex: (conversationId) => {
37150
+ return get2().inputByConversation[conversationId]?.currentHistoryIndex ?? null;
37151
+ },
37152
+ /**
37153
+ * Set the current history navigation index for a conversation, clamped to valid range.
37154
+ * @param conversationId - The ID of the conversation
37155
+ * @param index - The index to set (null = not navigating)
37156
+ */
37157
+ setCurrentHistoryIndex: (conversationId, index2) => {
37158
+ const existing = get2().inputByConversation[conversationId] || {
37159
+ currentInput: "",
37160
+ submittedMessages: [],
37161
+ currentHistoryIndex: null
37162
+ };
37163
+ const messages = existing.submittedMessages;
37164
+ let clampedIndex = null;
37165
+ if (typeof index2 === "number" && messages.length > 0) {
37166
+ clampedIndex = Math.max(0, Math.min(index2, messages.length - 1));
37167
+ }
37168
+ set({
37169
+ inputByConversation: {
37170
+ ...get2().inputByConversation,
37171
+ [conversationId]: {
37172
+ ...existing,
37173
+ currentHistoryIndex: clampedIndex
37174
+ }
37175
+ }
37176
+ });
37177
+ },
37178
+ resetCurrentHistoryIndex: (conversationId) => {
37179
+ const existing = get2().inputByConversation[conversationId];
37180
+ if (!existing) return;
37181
+ set({
37182
+ inputByConversation: {
37183
+ ...get2().inputByConversation,
37184
+ [conversationId]: {
37185
+ ...existing,
37186
+ currentHistoryIndex: null
37187
+ }
37188
+ }
37189
+ });
37190
+ },
37191
+ clearAll: (conversationId) => {
37192
+ const { [conversationId]: _2, ...rest } = get2().inputByConversation;
37193
+ set({
37194
+ inputByConversation: rest
37195
+ });
37196
+ }
37197
+ }),
37198
+ {
37199
+ name: "conversation-input-store",
37200
+ partialize: (state) => ({
37201
+ inputByConversation: state.inputByConversation
37202
+ })
37203
+ }
37204
+ )
37205
+ );
37012
37206
  const useMessageInput = ({
37013
37207
  conversationId,
37014
- messages,
37015
37208
  onSubmit,
37016
37209
  scrollToBottom
37017
37210
  }) => {
37211
+ const getCurrentInput = useConversationInputStore((s2) => s2.getCurrentInput);
37212
+ const setCurrentInput = useConversationInputStore((s2) => s2.setCurrentInput);
37213
+ const addSubmittedMessage = useConversationInputStore(
37214
+ (s2) => s2.addSubmittedMessage
37215
+ );
37216
+ const getSubmittedMessages = useConversationInputStore(
37217
+ (s2) => s2.getSubmittedMessages
37218
+ );
37219
+ const getCurrentHistoryIndex = useConversationInputStore(
37220
+ (s2) => s2.getCurrentHistoryIndex
37221
+ );
37222
+ const setCurrentHistoryIndex = useConversationInputStore(
37223
+ (s2) => s2.setCurrentHistoryIndex
37224
+ );
37225
+ const resetCurrentHistoryIndex = useConversationInputStore(
37226
+ (s2) => s2.resetCurrentHistoryIndex
37227
+ );
37228
+ const [hydrated, setHydrated] = reactExports.useState(
37229
+ useConversationInputStore.persist.hasHydrated?.() ?? false
37230
+ );
37231
+ const initializedRef = reactExports.useRef(void 0);
37018
37232
  const [inputValue, setInputValue] = reactExports.useState("");
37233
+ reactExports.useEffect(() => {
37234
+ const persist2 = useConversationInputStore.persist;
37235
+ let unsubHydrate;
37236
+ let unsubFinish;
37237
+ if (persist2 && typeof persist2.onHydrate === "function" && typeof persist2.onFinishHydration === "function") {
37238
+ unsubHydrate = persist2.onHydrate(() => setHydrated(false));
37239
+ unsubFinish = persist2.onFinishHydration(() => setHydrated(true));
37240
+ setHydrated(persist2.hasHydrated());
37241
+ } else {
37242
+ setHydrated(true);
37243
+ }
37244
+ return () => {
37245
+ unsubHydrate?.();
37246
+ unsubFinish?.();
37247
+ };
37248
+ }, []);
37019
37249
  const textareaRef = reactExports.useRef(null);
37020
- const [historyIndex, setHistoryIndex] = reactExports.useState(null);
37021
37250
  const draftMessageRef = reactExports.useRef("");
37022
- const userMessages = messages.filter((msg) => msg.role === "user");
37023
- const handleChange = reactExports.useCallback((value) => {
37024
- setInputValue(value);
37025
- setHistoryIndex(null);
37026
- }, []);
37251
+ const submittedMessages = conversationId ? getSubmittedMessages(conversationId) : [];
37252
+ const historyIndex = conversationId ? getCurrentHistoryIndex(conversationId) : null;
37253
+ reactExports.useEffect(() => {
37254
+ if (!hydrated) return;
37255
+ if (conversationId) {
37256
+ const draft = getCurrentInput(conversationId);
37257
+ if (historyIndex !== null && submittedMessages.length > 0) {
37258
+ setInputValue(submittedMessages[historyIndex] || "");
37259
+ } else {
37260
+ setInputValue(draft);
37261
+ }
37262
+ initializedRef.current = conversationId;
37263
+ draftMessageRef.current = "";
37264
+ } else {
37265
+ setInputValue("");
37266
+ initializedRef.current = void 0;
37267
+ draftMessageRef.current = "";
37268
+ }
37269
+ }, [
37270
+ conversationId,
37271
+ hydrated,
37272
+ getCurrentInput,
37273
+ historyIndex,
37274
+ submittedMessages
37275
+ ]);
37276
+ reactExports.useEffect(() => {
37277
+ if (!hydrated) return;
37278
+ if (!conversationId) return;
37279
+ if (initializedRef.current === conversationId) return;
37280
+ setCurrentInput(conversationId, inputValue);
37281
+ }, [conversationId, inputValue, setCurrentInput, hydrated]);
37282
+ const handleChange = reactExports.useCallback(
37283
+ (value) => {
37284
+ setInputValue(value);
37285
+ if (conversationId) {
37286
+ setCurrentInput(conversationId, value);
37287
+ resetCurrentHistoryIndex(conversationId);
37288
+ }
37289
+ },
37290
+ [conversationId, setCurrentInput, resetCurrentHistoryIndex]
37291
+ );
37027
37292
  const handleSubmit = reactExports.useCallback(() => {
37028
- if (!inputValue.trim()) return;
37293
+ if (!inputValue.trim() || !conversationId) return;
37029
37294
  onSubmit?.(inputValue);
37295
+ addSubmittedMessage(conversationId, inputValue);
37030
37296
  setInputValue("");
37031
- setHistoryIndex(null);
37297
+ setCurrentInput(conversationId, "");
37298
+ resetCurrentHistoryIndex(conversationId);
37032
37299
  draftMessageRef.current = "";
37033
37300
  if (scrollToBottom) {
37034
37301
  setTimeout(() => {
37035
37302
  scrollToBottom();
37036
37303
  }, 150);
37037
37304
  }
37038
- }, [inputValue, onSubmit, scrollToBottom]);
37305
+ }, [
37306
+ inputValue,
37307
+ conversationId,
37308
+ onSubmit,
37309
+ addSubmittedMessage,
37310
+ setCurrentInput,
37311
+ resetCurrentHistoryIndex,
37312
+ scrollToBottom
37313
+ ]);
37039
37314
  const getCursorPosition = reactExports.useCallback(() => {
37040
37315
  const textarea = textareaRef.current;
37041
37316
  if (!textarea) return { line: 0, totalLines: 1 };
@@ -37046,34 +37321,33 @@ const useMessageInput = ({
37046
37321
  const totalLines = (text4.match(/\n/g) || []).length + 1;
37047
37322
  return { line: linesUpToCursor, totalLines };
37048
37323
  }, []);
37049
- const isCursorAtFirstLine = reactExports.useCallback(() => {
37050
- const { line: line2 } = getCursorPosition();
37051
- return line2 === 1;
37052
- }, [getCursorPosition]);
37324
+ const isCursorAtFirstLine = reactExports.useCallback(
37325
+ () => getCursorPosition().line === 1,
37326
+ [getCursorPosition]
37327
+ );
37053
37328
  const isCursorAtLastLine = reactExports.useCallback(() => {
37054
37329
  const { line: line2, totalLines } = getCursorPosition();
37055
37330
  return line2 === totalLines;
37056
37331
  }, [getCursorPosition]);
37057
37332
  const handleKeyDown = reactExports.useCallback(
37058
37333
  (e3) => {
37334
+ if (!conversationId) return;
37059
37335
  if (e3.key === "Enter" && !e3.shiftKey) {
37060
37336
  e3.preventDefault();
37061
37337
  handleSubmit();
37062
37338
  return;
37063
37339
  }
37064
- if (userMessages.length === 0) {
37065
- return;
37066
- }
37340
+ if (!submittedMessages.length) return;
37067
37341
  if (e3.key === "ArrowUp" && isCursorAtFirstLine()) {
37068
37342
  e3.preventDefault();
37069
37343
  if (historyIndex === null) {
37070
37344
  draftMessageRef.current = inputValue;
37071
- setHistoryIndex(userMessages.length - 1);
37072
- setInputValue(userMessages[userMessages.length - 1].message || "");
37345
+ setCurrentHistoryIndex(conversationId, submittedMessages.length - 1);
37346
+ setInputValue(submittedMessages[submittedMessages.length - 1] || "");
37073
37347
  } else if (historyIndex > 0) {
37074
37348
  const newIndex = historyIndex - 1;
37075
- setHistoryIndex(newIndex);
37076
- setInputValue(userMessages[newIndex].message || "");
37349
+ setCurrentHistoryIndex(conversationId, newIndex);
37350
+ setInputValue(submittedMessages[newIndex] || "");
37077
37351
  }
37078
37352
  setTimeout(() => {
37079
37353
  if (textareaRef.current) {
@@ -37086,12 +37360,12 @@ const useMessageInput = ({
37086
37360
  if (e3.key === "ArrowDown" && isCursorAtLastLine()) {
37087
37361
  e3.preventDefault();
37088
37362
  if (historyIndex !== null) {
37089
- if (historyIndex < userMessages.length - 1) {
37363
+ if (historyIndex < submittedMessages.length - 1) {
37090
37364
  const newIndex = historyIndex + 1;
37091
- setHistoryIndex(newIndex);
37092
- setInputValue(userMessages[newIndex].message || "");
37365
+ setCurrentHistoryIndex(conversationId, newIndex);
37366
+ setInputValue(submittedMessages[newIndex] || "");
37093
37367
  } else {
37094
- setHistoryIndex(null);
37368
+ resetCurrentHistoryIndex(conversationId);
37095
37369
  setInputValue(draftMessageRef.current);
37096
37370
  draftMessageRef.current = "";
37097
37371
  }
@@ -37111,14 +37385,12 @@ const useMessageInput = ({
37111
37385
  isCursorAtLastLine,
37112
37386
  historyIndex,
37113
37387
  inputValue,
37114
- userMessages
37388
+ submittedMessages,
37389
+ conversationId,
37390
+ setCurrentHistoryIndex,
37391
+ resetCurrentHistoryIndex
37115
37392
  ]
37116
37393
  );
37117
- reactExports.useEffect(() => {
37118
- setInputValue("");
37119
- setHistoryIndex(null);
37120
- draftMessageRef.current = "";
37121
- }, [conversationId]);
37122
37394
  return {
37123
37395
  inputValue,
37124
37396
  setInputValue: handleChange,
@@ -37409,19 +37681,18 @@ async function createAgentComment(baseUrl, agentId, accessToken, data2) {
37409
37681
  }
37410
37682
  return response.json();
37411
37683
  }
37412
- async function listAgentComments(baseUrl, agentId, accessToken, page = 1, perPage = 20) {
37684
+ async function listAgentComments(baseUrl, agentId, page = 1, perPage = 20) {
37413
37685
  const url = new URL(
37414
37686
  joinUrl$2(baseUrl, `/v1/agents/${encodeURIComponent(agentId)}/comments`)
37415
37687
  );
37416
37688
  url.searchParams.set("page", String(page));
37417
37689
  url.searchParams.set("per_page", String(perPage));
37690
+ const headers = {};
37418
37691
  let response;
37419
37692
  try {
37420
37693
  response = await fetch(url.toString(), {
37421
37694
  method: "GET",
37422
- headers: {
37423
- Authorization: `Bearer ${accessToken}`
37424
- },
37695
+ headers,
37425
37696
  credentials: "same-origin"
37426
37697
  });
37427
37698
  } catch (err) {
@@ -39557,7 +39828,7 @@ const StyledIcon$1 = styled$1(FontAwesomeIcon)(({ theme: theme2 }) => ({
39557
39828
  color: theme2.palette.primary.main,
39558
39829
  fontSize: "1.2rem"
39559
39830
  }));
39560
- const StyledTextField$5 = styled$1(TextField)(({ theme: theme2 }) => ({
39831
+ const StyledTextField$4 = styled$1(TextField)(({ theme: theme2 }) => ({
39561
39832
  "& .MuiOutlinedInput-root": {
39562
39833
  borderRadius: 8,
39563
39834
  transition: "all 0.2s ease-in-out",
@@ -39578,7 +39849,7 @@ const StyledTextField$5 = styled$1(TextField)(({ theme: theme2 }) => ({
39578
39849
  padding: "12px 14px"
39579
39850
  }
39580
39851
  }));
39581
- const NameField = styled$1(StyledTextField$5)({
39852
+ const NameField = styled$1(StyledTextField$4)({
39582
39853
  marginBottom: 12,
39583
39854
  "& .MuiInputLabel-root": {
39584
39855
  transform: "translate(12px, 12px) scale(1)"
@@ -39707,7 +39978,7 @@ const CreateAgentDialog = ({
39707
39978
  }
39708
39979
  ),
39709
39980
  /* @__PURE__ */ jsxRuntimeExports.jsx(
39710
- StyledTextField$5,
39981
+ StyledTextField$4,
39711
39982
  {
39712
39983
  margin: "dense",
39713
39984
  id: "description",
@@ -39748,7 +40019,7 @@ const LabelIcon$7 = styled$1(Box)({
39748
40019
  display: "flex",
39749
40020
  alignItems: "center"
39750
40021
  });
39751
- const StyledTextField$4 = styled$1(TextField)(
40022
+ const StyledTextField$3 = styled$1(TextField)(
39752
40023
  ({ theme: theme2, multiline }) => ({
39753
40024
  "& .MuiOutlinedInput-root": {
39754
40025
  borderRadius: 6,
@@ -40049,7 +40320,7 @@ const EditableField = ({
40049
40320
  ] }),
40050
40321
  isEditing ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { sx: { position: "relative" }, children: [
40051
40322
  /* @__PURE__ */ jsxRuntimeExports.jsx(
40052
- StyledTextField$4,
40323
+ StyledTextField$3,
40053
40324
  {
40054
40325
  fullWidth: true,
40055
40326
  variant: "outlined",
@@ -40637,12 +40908,12 @@ const StyledSlider = styled$1(Slider)(({ theme: theme2 }) => ({
40637
40908
  const InputContainer = styled$1(Box)({
40638
40909
  display: "flex",
40639
40910
  alignItems: "center",
40640
- minWidth: "90px"
40641
- // Slightly reduced min-width
40911
+ minWidth: "110px"
40912
+ // Increased min-width for wider input
40642
40913
  });
40643
- const StyledTextField$3 = styled$1(TextField)(({ theme: theme2 }) => ({
40644
- width: "90px",
40645
- // Fixed width
40914
+ const StyledTextField$2 = styled$1(TextField)(({ theme: theme2 }) => ({
40915
+ width: "110px",
40916
+ // Increased width for wider input
40646
40917
  "& .MuiOutlinedInput-root": {
40647
40918
  borderRadius: theme2.shape.borderRadius,
40648
40919
  // Standard border radius
@@ -40825,7 +41096,7 @@ const SliderSetting = ({
40825
41096
  // Consistent loading indicator size
40826
41097
  /* @__PURE__ */ jsxRuntimeExports.jsx(CircularProgress, { size: 20, sx: { margin: "8px 12px" } })
40827
41098
  ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
40828
- StyledTextField$3,
41099
+ StyledTextField$2,
40829
41100
  {
40830
41101
  value: inputValue,
40831
41102
  onChange: handleInputChange,
@@ -43408,10 +43679,13 @@ const UpdateNotification = ({
43408
43679
  const [backendUpdateCompleted, setBackendUpdateCompleted] = reactExports.useState(false);
43409
43680
  const [manualUpdateRequired, setManualUpdateRequired] = reactExports.useState(false);
43410
43681
  const [manualUpdateInfo, setManualUpdateInfo] = reactExports.useState(null);
43411
- const { shouldShowUpdate, deferUpdate } = useDeferredUpdatesStore();
43682
+ const { shouldShowUpdate, deferUpdate, hydrated } = useDeferredUpdatesStore();
43412
43683
  reactExports.useEffect(() => {
43413
43684
  window.api.systemInfo.getAppVersion().then((version2) => setAppVersion(version2)).catch(() => setAppVersion("unknown"));
43414
43685
  }, []);
43686
+ if (!hydrated) {
43687
+ return null;
43688
+ }
43415
43689
  const checkForUpdates = reactExports.useCallback(async () => {
43416
43690
  try {
43417
43691
  setChecking(true);
@@ -43459,7 +43733,7 @@ const UpdateNotification = ({
43459
43733
  }, []);
43460
43734
  const handleDeferBackendUpdate = reactExports.useCallback(() => {
43461
43735
  if (backendUpdateInfo) {
43462
- deferUpdate(backendUpdateInfo.latestVersion);
43736
+ deferUpdate(UpdateType.BACKEND, backendUpdateInfo.latestVersion);
43463
43737
  setSnackbarOpen(false);
43464
43738
  setBackendUpdateAvailable(false);
43465
43739
  setBackendUpdateInfo(null);
@@ -43467,7 +43741,7 @@ const UpdateNotification = ({
43467
43741
  }, [deferUpdate, backendUpdateInfo]);
43468
43742
  const handleDeferUpdate = reactExports.useCallback(() => {
43469
43743
  if (updateInfo) {
43470
- deferUpdate(updateInfo.version);
43744
+ deferUpdate(UpdateType.UI, updateInfo.version);
43471
43745
  setSnackbarOpen(false);
43472
43746
  setUpdateAvailable(false);
43473
43747
  setUpdateDownloaded(false);
@@ -43476,7 +43750,7 @@ const UpdateNotification = ({
43476
43750
  reactExports.useEffect(() => {
43477
43751
  const removeUpdateAvailableListener = window.api.updater.onUpdateAvailable(
43478
43752
  (info) => {
43479
- if (shouldShowUpdate(info.version)) {
43753
+ if (shouldShowUpdate(UpdateType.UI, info.version)) {
43480
43754
  setUpdateAvailable(true);
43481
43755
  setUpdateInfo(info);
43482
43756
  setSnackbarOpen(true);
@@ -43489,7 +43763,7 @@ const UpdateNotification = ({
43489
43763
  });
43490
43764
  const removeUpdateDownloadedListener = window.api.updater.onUpdateDownloaded((info) => {
43491
43765
  setDownloading(false);
43492
- if (shouldShowUpdate(info.version)) {
43766
+ if (shouldShowUpdate(UpdateType.UI, info.version)) {
43493
43767
  setUpdateDownloaded(true);
43494
43768
  setUpdateInfo(info);
43495
43769
  setSnackbarOpen(true);
@@ -43518,7 +43792,7 @@ const UpdateNotification = ({
43518
43792
  }
43519
43793
  );
43520
43794
  const removeBackendUpdateAvailableListener = window.api.updater.onBackendUpdateAvailable((info) => {
43521
- if (shouldShowUpdate(info.latestVersion)) {
43795
+ if (shouldShowUpdate(UpdateType.BACKEND, info.latestVersion)) {
43522
43796
  const enhancedInfo = {
43523
43797
  ...info,
43524
43798
  canManageUpdate: !info.updateCommand.includes("manually")
@@ -48816,25 +49090,19 @@ const useAgentCommentsQuery = ({
48816
49090
  agentId,
48817
49091
  enabled = true
48818
49092
  }) => {
48819
- const { isAuthenticated, sessionToken } = useRadientAuth();
48820
- const query = useQuery({
48821
- // Ensure queryKey is valid even if agentId is temporarily undefined/empty
49093
+ return useQuery({
48822
49094
  queryKey: agentCommentsKeys.list(agentId || "invalid"),
48823
49095
  queryFn: async () => {
48824
49096
  if (!agentId) {
48825
49097
  throw new Error("Agent ID is required to fetch comments.");
48826
49098
  }
48827
- if (!sessionToken) {
48828
- throw new Error("Authentication token is required to fetch comments.");
48829
- }
48830
49099
  const response = await listAgentComments(
48831
49100
  apiConfig.radientBaseUrl,
48832
- agentId,
48833
- sessionToken
49101
+ agentId
48834
49102
  );
48835
49103
  return response.result;
48836
49104
  },
48837
- enabled: !!agentId && isAuthenticated && !!sessionToken && enabled,
49105
+ enabled: !!agentId && enabled,
48838
49106
  staleTime: 2 * 60 * 1e3,
48839
49107
  // 2 minutes
48840
49108
  gcTime: 5 * 60 * 1e3,
@@ -48842,7 +49110,6 @@ const useAgentCommentsQuery = ({
48842
49110
  refetchOnWindowFocus: true
48843
49111
  // Refetch comments if window regains focus
48844
49112
  });
48845
- return query;
48846
49113
  };
48847
49114
  const useCreateAgentCommentMutation = () => {
48848
49115
  const queryClient2 = useQueryClient();
@@ -49026,7 +49293,7 @@ const CommentsSection = ({
49026
49293
  // Renamed from 'comments'
49027
49294
  isLoading,
49028
49295
  error
49029
- } = useAgentCommentsQuery({ agentId, enabled: isAuthenticated });
49296
+ } = useAgentCommentsQuery({ agentId });
49030
49297
  const comments2 = commentsResponse?.records ?? [];
49031
49298
  const createCommentMutation = useCreateAgentCommentMutation();
49032
49299
  const updateCommentMutation = useUpdateAgentCommentMutation();
@@ -49121,12 +49388,9 @@ const CommentsSection = ({
49121
49388
  ]
49122
49389
  }
49123
49390
  )
49124
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { variant: "body2", color: "textSecondary", sx: { mt: 3, mb: 2 }, children: [
49125
- " ",
49126
- "Sign in to view and leave comments."
49127
- ] }),
49391
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body2", color: "textSecondary", sx: { mt: 3, mb: 2 }, children: "Sign in to leave comments." }),
49128
49392
  /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, { sx: { my: 3 } }),
49129
- isLoading && isAuthenticated && // Skeleton Loading State
49393
+ isLoading && // Skeleton Loading State
49130
49394
  /* @__PURE__ */ jsxRuntimeExports.jsx(List$1, { children: [...Array(3)].map((_2, index2) => (
49131
49395
  // biome-ignore lint/suspicious/noArrayIndexKey: Static list for skeleton, index is acceptable here
49132
49396
  /* @__PURE__ */ jsxRuntimeExports.jsxs(CommentItem, { divider: true, children: [
@@ -49141,11 +49405,11 @@ const CommentsSection = ({
49141
49405
  ] })
49142
49406
  ] }, `skeleton-${index2}`)
49143
49407
  )) }),
49144
- error && isAuthenticated && /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { color: "error", sx: { my: 3 }, children: [
49408
+ error && /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { color: "error", sx: { my: 3 }, children: [
49145
49409
  "Failed to load comments: ",
49146
49410
  error.message
49147
49411
  ] }),
49148
- !isLoading && !error && isAuthenticated && /* @__PURE__ */ jsxRuntimeExports.jsx(List$1, { children: comments2.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body2", color: "textSecondary", children: "No comments yet. Be the first to comment!" }) : (
49412
+ !isLoading && !error && /* @__PURE__ */ jsxRuntimeExports.jsx(List$1, { children: comments2.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body2", color: "textSecondary", children: "No comments yet. Be the first to comment!" }) : (
49149
49413
  // Use the extracted comments array
49150
49414
  comments2.map(
49151
49415
  (comment2) => editingCommentId === comment2.id ? (
@@ -49701,7 +49965,7 @@ const MetaInfoContainer$1 = styled$1(Box)(({ theme: theme2 }) => ({
49701
49965
  color: theme2.palette.text.secondary,
49702
49966
  fontSize: "0.875rem"
49703
49967
  }));
49704
- const DescriptionBox$2 = styled$1(Box)(({ theme: theme2 }) => ({
49968
+ const DescriptionBox$1 = styled$1(Box)(({ theme: theme2 }) => ({
49705
49969
  marginTop: theme2.spacing(2),
49706
49970
  marginBottom: theme2.spacing(4),
49707
49971
  lineHeight: 1.6
@@ -49951,7 +50215,7 @@ const AgentDetailsPage = () => {
49951
50215
  ")"
49952
50216
  ] })
49953
50217
  ] }),
49954
- /* @__PURE__ */ jsxRuntimeExports.jsx(DescriptionBox$2, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body1", sx: { fontSize: "0.875rem" }, children: agent.description || "No description provided." }) }),
50218
+ /* @__PURE__ */ jsxRuntimeExports.jsx(DescriptionBox$1, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body1", sx: { fontSize: "0.875rem" }, children: agent.description || "No description provided." }) }),
49955
50219
  /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, { sx: { my: 3 } }),
49956
50220
  /* @__PURE__ */ jsxRuntimeExports.jsx(CommentsSection, { agentId: agent.id }),
49957
50221
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -50091,11 +50355,11 @@ const AgentCard = ({
50091
50355
  onLikeToggle,
50092
50356
  onFavouriteToggle,
50093
50357
  isLikeActionLoading = false,
50094
- isFavouriteActionLoading = false,
50095
- showActions = false
50358
+ isFavouriteActionLoading = false
50096
50359
  }) => {
50097
50360
  const navigate = useNavigate();
50098
50361
  const downloadMutation = useDownloadAgentMutation();
50362
+ const { isAuthenticated } = useRadientAuth();
50099
50363
  const { data: likeCount, isLoading: isLoadingLikes } = useAgentLikeCountQuery(
50100
50364
  {
50101
50365
  agentId: agent.id
@@ -50126,6 +50390,9 @@ const AgentCard = ({
50126
50390
  };
50127
50391
  const description = agent.description ?? "";
50128
50392
  const truncatedDescription = truncateWithEllipsis(description, 140);
50393
+ const likeTooltip = isAuthenticated ? isLiked ? "Unlike agent" : "Like agent" : "Log in to Radient to like agents";
50394
+ const favouriteTooltip = isAuthenticated ? isFavourited ? "Unfavourite agent" : "Favourite agent" : "Log in to Radient to favourite agents";
50395
+ const downloadTooltip = "Download agent to your computer";
50129
50396
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(StyledCard$1, { onClick: handleCardClick, children: [
50130
50397
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
50131
50398
  Box,
@@ -50231,12 +50498,12 @@ const AgentCard = ({
50231
50498
  ] })
50232
50499
  ] }),
50233
50500
  /* @__PURE__ */ jsxRuntimeExports.jsxs(StyledCardActions, { children: [
50234
- showActions ? /* @__PURE__ */ jsxRuntimeExports.jsxs(ActionButtonGroup, { children: [
50235
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
50501
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(ActionButtonGroup, { children: [
50502
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { title: likeTooltip, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
50236
50503
  LikeFavouriteButton,
50237
50504
  {
50238
- onClick: (e3) => handleActionClick(e3, onLikeToggle),
50239
- disabled: isLikeActionLoading,
50505
+ onClick: isAuthenticated ? (e3) => handleActionClick(e3, onLikeToggle) : void 0,
50506
+ disabled: isLikeActionLoading || !isAuthenticated,
50240
50507
  color: isLiked ? "error" : void 0,
50241
50508
  "aria-label": isLiked ? "Unlike agent" : "Like agent",
50242
50509
  focusRipple: true,
@@ -50257,12 +50524,12 @@ const AgentCard = ({
50257
50524
  /* @__PURE__ */ jsxRuntimeExports.jsx(CountDisplay, { children: isLoadingLikes ? /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { variant: "text", width: 20 }) : likeCount ?? 0 })
50258
50525
  ]
50259
50526
  }
50260
- ),
50261
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
50527
+ ) }) }),
50528
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { title: favouriteTooltip, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
50262
50529
  LikeFavouriteButton,
50263
50530
  {
50264
- onClick: (e3) => handleActionClick(e3, onFavouriteToggle),
50265
- disabled: isFavouriteActionLoading,
50531
+ onClick: isAuthenticated ? (e3) => handleActionClick(e3, onFavouriteToggle) : void 0,
50532
+ disabled: isFavouriteActionLoading || !isAuthenticated,
50266
50533
  color: isFavourited ? "warning" : void 0,
50267
50534
  "aria-label": isFavourited ? "Unfavourite agent" : "Favourite agent",
50268
50535
  focusRipple: true,
@@ -50283,10 +50550,10 @@ const AgentCard = ({
50283
50550
  /* @__PURE__ */ jsxRuntimeExports.jsx(CountDisplay, { children: isLoadingFavourites ? /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { variant: "text", width: 20 }) : favouriteCount ?? 0 })
50284
50551
  ]
50285
50552
  }
50286
- )
50287
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Box, {}),
50553
+ ) }) })
50554
+ ] }),
50288
50555
  /* @__PURE__ */ jsxRuntimeExports.jsxs(ActionButtonGroup, { children: [
50289
- /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { title: "Download agent to your computer", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
50556
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { title: downloadTooltip, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
50290
50557
  IconButton,
50291
50558
  {
50292
50559
  size: "small",
@@ -50303,7 +50570,7 @@ const AgentCard = ({
50303
50570
  }
50304
50571
  )
50305
50572
  }
50306
- ) }),
50573
+ ) }) }),
50307
50574
  isLoadingDownloads || downloadMutation.isPending ? /* @__PURE__ */ jsxRuntimeExports.jsx(
50308
50575
  Skeleton,
50309
50576
  {
@@ -82606,7 +82873,7 @@ const languages = [
82606
82873
  name: "Go",
82607
82874
  extensions: ["go"],
82608
82875
  load() {
82609
- return __vitePreload(() => import("./index-CkAsfYTs.js"), true ? __vite__mapDeps([0,1,2]) : void 0, import.meta.url).then((m2) => m2.go());
82876
+ return __vitePreload(() => import("./index-BpktHwp9.js"), true ? __vite__mapDeps([0,1,2]) : void 0, import.meta.url).then((m2) => m2.go());
82610
82877
  }
82611
82878
  }),
82612
82879
  /* @__PURE__ */ LanguageDescription.of({
@@ -82783,7 +83050,7 @@ const languages = [
82783
83050
  alias: ["yml"],
82784
83051
  extensions: ["yaml", "yml"],
82785
83052
  load() {
82786
- return __vitePreload(() => import("./index-BkZEKoZT.js"), true ? __vite__mapDeps([3,1,2]) : void 0, import.meta.url).then((m2) => m2.yaml());
83053
+ return __vitePreload(() => import("./index-D4xePR3Q.js"), true ? __vite__mapDeps([3,1,2]) : void 0, import.meta.url).then((m2) => m2.yaml());
82787
83054
  }
82788
83055
  }),
82789
83056
  // Legacy modes ported from CodeMirror 5
@@ -141403,7 +141670,7 @@ const OptionsButton = styled$1(IconButton)(({ theme: theme2 }) => ({
141403
141670
  transform: "translateY(-1px)"
141404
141671
  }
141405
141672
  }));
141406
- const DescriptionBox$1 = styled$1(Box)({
141673
+ const DescriptionBox = styled$1(Box)({
141407
141674
  display: "flex",
141408
141675
  flexDirection: "column",
141409
141676
  width: "90%"
@@ -141437,7 +141704,7 @@ const ChatHeader = ({
141437
141704
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(Bot, { size: 24 })
141438
141705
  }
141439
141706
  ),
141440
- /* @__PURE__ */ jsxRuntimeExports.jsxs(DescriptionBox$1, { children: [
141707
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(DescriptionBox, { children: [
141441
141708
  /* @__PURE__ */ jsxRuntimeExports.jsx(
141442
141709
  Typography,
141443
141710
  {
@@ -142487,7 +142754,7 @@ const SuggestionChip = styled$1(Button)(({ theme: theme2 }) => ({
142487
142754
  }
142488
142755
  }
142489
142756
  }));
142490
- const StyledTextField$2 = styled$1(TextField)(({ theme: theme2 }) => ({
142757
+ const StyledTextField$1 = styled$1(TextField)(({ theme: theme2 }) => ({
142491
142758
  flex: 1,
142492
142759
  "& .MuiOutlinedInput-root": {
142493
142760
  backgroundColor: "transparent",
@@ -142643,7 +142910,6 @@ const MessageInput = ({
142643
142910
  textareaRef
142644
142911
  } = useMessageInput({
142645
142912
  conversationId,
142646
- messages,
142647
142913
  onSubmit,
142648
142914
  scrollToBottom
142649
142915
  });
@@ -142698,7 +142964,7 @@ const MessageInput = ({
142698
142964
  }
142699
142965
  ),
142700
142966
  /* @__PURE__ */ jsxRuntimeExports.jsx(
142701
- StyledTextField$2,
142967
+ StyledTextField$1,
142702
142968
  {
142703
142969
  fullWidth: true,
142704
142970
  placeholder: isInputDisabled ? "Agent is busy" : "Ask me for help",
@@ -180108,6 +180374,153 @@ function ft(n2) {
180108
180374
  }
180109
180375
  return React.memo(l2);
180110
180376
  }
180377
+ const CodeContainer$4 = styled$1(Box)({
180378
+ marginBottom: 16,
180379
+ width: "100%"
180380
+ });
180381
+ const SectionLabel$4 = styled$1(Typography)(({ theme: theme2 }) => ({
180382
+ display: "block",
180383
+ marginBottom: 4,
180384
+ color: theme2.palette.error.light
180385
+ }));
180386
+ const ErrorContainer$2 = styled$1(Box, {
180387
+ shouldForwardProp: (prop) => prop !== "isUser"
180388
+ })(({ isUser, theme: theme2 }) => ({
180389
+ fontFamily: '"Roboto Mono", monospace',
180390
+ fontSize: "0.85rem",
180391
+ backgroundColor: alpha$1(
180392
+ theme2.palette.error.main,
180393
+ theme2.palette.mode === "dark" ? 0.1 : 0.05
180394
+ ),
180395
+ borderRadius: "8px",
180396
+ padding: 12,
180397
+ maxHeight: "200px",
180398
+ overflow: "auto",
180399
+ display: "flex",
180400
+ flexDirection: "column-reverse",
180401
+ whiteSpace: "pre-wrap",
180402
+ color: isUser ? theme2.palette.error.main : theme2.palette.error.light,
180403
+ width: "100%",
180404
+ boxShadow: `0 2px 6px ${alpha$1(theme2.palette.common.black, theme2.palette.mode === "dark" ? 0.15 : 0.1)}`,
180405
+ "&::-webkit-scrollbar": {
180406
+ width: "6px"
180407
+ },
180408
+ "&::-webkit-scrollbar-thumb": {
180409
+ backgroundColor: alpha$1(
180410
+ theme2.palette.mode === "dark" ? theme2.palette.common.white : theme2.palette.common.black,
180411
+ 0.1
180412
+ ),
180413
+ borderRadius: "3px"
180414
+ }
180415
+ }));
180416
+ const ErrorBlock = ({ error, isUser }) => {
180417
+ if (!error || error === "[No error output]") return null;
180418
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(CodeContainer$4, { children: [
180419
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SectionLabel$4, { variant: "caption", children: "Error" }),
180420
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorContainer$2, { isUser, children: error })
180421
+ ] });
180422
+ };
180423
+ const CodeContainer$3 = styled$1(Box)({
180424
+ marginBottom: 16,
180425
+ width: "100%"
180426
+ });
180427
+ const SectionLabel$3 = styled$1(Typography)(({ theme: theme2 }) => ({
180428
+ display: "block",
180429
+ marginBottom: 4,
180430
+ color: theme2.palette.text.secondary
180431
+ }));
180432
+ const LogContainer = styled$1(Box, {
180433
+ shouldForwardProp: (prop) => prop !== "isUser"
180434
+ })(({ isUser, theme: theme2 }) => ({
180435
+ fontFamily: '"Roboto Mono", monospace',
180436
+ fontSize: "0.85rem",
180437
+ backgroundColor: alpha$1(
180438
+ theme2.palette.mode === "dark" ? theme2.palette.common.black : theme2.palette.grey[200],
180439
+ theme2.palette.mode === "dark" ? 0.3 : 0.5
180440
+ ),
180441
+ borderRadius: "8px",
180442
+ padding: 12,
180443
+ maxHeight: "200px",
180444
+ overflow: "auto",
180445
+ display: "flex",
180446
+ flexDirection: "column-reverse",
180447
+ whiteSpace: "pre-wrap",
180448
+ color: isUser ? theme2.palette.info.main : theme2.palette.info.light,
180449
+ width: "100%",
180450
+ boxShadow: `0 2px 6px ${alpha$1(theme2.palette.common.black, theme2.palette.mode === "dark" ? 0.15 : 0.1)}`,
180451
+ "&::-webkit-scrollbar": {
180452
+ width: "6px"
180453
+ },
180454
+ "&::-webkit-scrollbar-thumb": {
180455
+ backgroundColor: alpha$1(
180456
+ theme2.palette.mode === "dark" ? theme2.palette.common.white : theme2.palette.common.black,
180457
+ 0.1
180458
+ ),
180459
+ borderRadius: "3px"
180460
+ }
180461
+ }));
180462
+ const LogBlock = ({ log: log2, isUser }) => {
180463
+ if (!log2 || log2 === "[No logger output]") return null;
180464
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(CodeContainer$3, { children: [
180465
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SectionLabel$3, { variant: "caption", children: "Logs" }),
180466
+ /* @__PURE__ */ jsxRuntimeExports.jsx(LogContainer, { isUser, children: log2 })
180467
+ ] });
180468
+ };
180469
+ const CodeContainer$2 = styled$1(Box)({
180470
+ marginBottom: 16,
180471
+ width: "100%"
180472
+ });
180473
+ const SectionLabel$2 = styled$1(Typography)(({ theme: theme2 }) => ({
180474
+ display: "block",
180475
+ marginBottom: 4,
180476
+ color: theme2.palette.text.secondary
180477
+ }));
180478
+ const OutputContainer = styled$1(Box)(({ theme: theme2 }) => ({
180479
+ fontFamily: '"Roboto Mono", monospace',
180480
+ fontSize: "0.85rem",
180481
+ backgroundColor: alpha$1(
180482
+ theme2.palette.mode === "dark" ? theme2.palette.common.black : theme2.palette.grey[200],
180483
+ theme2.palette.mode === "dark" ? 0.3 : 0.5
180484
+ ),
180485
+ borderRadius: "8px",
180486
+ padding: 12,
180487
+ maxHeight: "300px",
180488
+ overflow: "auto",
180489
+ whiteSpace: "pre",
180490
+ width: "100%",
180491
+ boxShadow: `0 2px 6px ${alpha$1(
180492
+ theme2.palette.common.black,
180493
+ theme2.palette.mode === "dark" ? 0.15 : 0.1
180494
+ )}`,
180495
+ color: theme2.palette.text.primary,
180496
+ overflowX: "auto",
180497
+ display: "flex",
180498
+ flexDirection: "column-reverse",
180499
+ "&::-webkit-scrollbar": {
180500
+ width: "6px",
180501
+ height: "6px"
180502
+ },
180503
+ "&::-webkit-scrollbar-thumb": {
180504
+ backgroundColor: alpha$1(
180505
+ theme2.palette.mode === "dark" ? theme2.palette.common.white : theme2.palette.common.black,
180506
+ 0.1
180507
+ ),
180508
+ borderRadius: "3px"
180509
+ },
180510
+ "&::-webkit-scrollbar-corner": {
180511
+ backgroundColor: alpha$1(
180512
+ theme2.palette.mode === "dark" ? theme2.palette.common.black : theme2.palette.grey[200],
180513
+ theme2.palette.mode === "dark" ? 0.3 : 0.5
180514
+ )
180515
+ }
180516
+ }));
180517
+ const OutputBlock = ({ output }) => {
180518
+ if (!output) return null;
180519
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(CodeContainer$2, { children: [
180520
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SectionLabel$2, { variant: "caption", children: "Output" }),
180521
+ /* @__PURE__ */ jsxRuntimeExports.jsx(OutputContainer, { children: output })
180522
+ ] });
180523
+ };
180111
180524
  const SyntaxHighlighterStyles$1 = ft`
180112
180525
  .loading-syntax-highlighter * {
180113
180526
  font-family: 'Roboto Mono', monospace !important;
@@ -180201,62 +180614,80 @@ const CodeToggleButton = styled$1(Button)(({ theme: theme2 }) => ({
180201
180614
  marginLeft: 0
180202
180615
  }
180203
180616
  }));
180204
- const CodeContainer$4 = styled$1(Box)(() => ({
180617
+ const CodeContainer$1 = styled$1(Box)(() => ({
180205
180618
  maxWidth: "100%",
180206
180619
  marginLeft: 16,
180207
180620
  marginTop: 8
180208
180621
  }));
180209
- const LoadingCodeBlock = ({ code: code2 }) => {
180622
+ const LoadingCodeBlock = ({ code: code2, label, language: language2 = "python" }) => {
180210
180623
  if (!code2) return null;
180211
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
180212
- Box,
180213
- {
180214
- sx: {
180215
- width: "100%",
180216
- maxHeight: "300px",
180217
- overflow: "auto",
180218
- "&::-webkit-scrollbar": {
180219
- width: "6px",
180220
- height: "6px"
180221
- },
180222
- "&::-webkit-scrollbar-thumb": {
180223
- backgroundColor: "rgba(255, 255, 255, 0.1)",
180224
- borderRadius: "3px"
180225
- },
180226
- "&::-webkit-scrollbar-corner": {
180227
- backgroundColor: "rgba(0, 0, 0, 0.3)"
180624
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { sx: { width: "100%", marginBottom: 2 }, children: [
180625
+ label && /* @__PURE__ */ jsxRuntimeExports.jsx(
180626
+ Typography,
180627
+ {
180628
+ variant: "caption",
180629
+ sx: {
180630
+ color: (theme2) => theme2.palette.text.secondary,
180631
+ fontWeight: 600,
180632
+ marginLeft: 0.5,
180633
+ marginBottom: 0.5,
180634
+ letterSpacing: 0.5,
180635
+ textTransform: "uppercase",
180636
+ opacity: 0.7
180228
180637
  },
180229
- borderRadius: "8px"
180230
- },
180231
- children: [
180232
- /* @__PURE__ */ jsxRuntimeExports.jsx(SyntaxHighlighterStyles$1, {}),
180233
- /* @__PURE__ */ jsxRuntimeExports.jsx(
180234
- highlighter,
180235
- {
180236
- language: "python",
180237
- style: atomOneDark,
180238
- customStyle: {
180239
- fontSize: "0.85rem",
180240
- width: "100%",
180241
- boxShadow: "0 2px 6px rgba(0, 0, 0, 0.2)",
180242
- padding: "0.75rem",
180243
- margin: 0
180244
- // Remove margin to make it more compact
180245
- },
180246
- codeTagProps: {
180247
- style: {
180248
- fontFamily: '"Roboto Mono", monospace !important'
180249
- }
180250
- },
180251
- className: "loading-syntax-highlighter",
180252
- wrapLines: true,
180253
- wrapLongLines: true,
180254
- children: code2
180638
+ children: label
180639
+ }
180640
+ ),
180641
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
180642
+ Box,
180643
+ {
180644
+ sx: {
180645
+ width: "100%",
180646
+ maxHeight: "300px",
180647
+ overflow: "auto",
180648
+ display: "flex",
180649
+ borderRadius: "8px",
180650
+ "&::-webkit-scrollbar": {
180651
+ width: "6px",
180652
+ height: "6px"
180653
+ },
180654
+ "&::-webkit-scrollbar-thumb": {
180655
+ backgroundColor: "rgba(255, 255, 255, 0.1)",
180656
+ borderRadius: "3px"
180657
+ },
180658
+ "&::-webkit-scrollbar-corner": {
180659
+ backgroundColor: "rgba(0, 0, 0, 0.3)"
180255
180660
  }
180256
- )
180257
- ]
180258
- }
180259
- );
180661
+ },
180662
+ children: [
180663
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SyntaxHighlighterStyles$1, {}),
180664
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
180665
+ highlighter,
180666
+ {
180667
+ language: language2,
180668
+ style: atomOneDark,
180669
+ customStyle: {
180670
+ fontSize: "0.85rem",
180671
+ width: "100%",
180672
+ boxShadow: "0 2px 6px rgba(0, 0, 0, 0.2)",
180673
+ padding: "0.75rem",
180674
+ margin: 0
180675
+ },
180676
+ codeTagProps: {
180677
+ style: {
180678
+ fontFamily: '"Roboto Mono", monospace !important'
180679
+ }
180680
+ },
180681
+ className: "loading-syntax-highlighter",
180682
+ wrapLines: true,
180683
+ wrapLongLines: true,
180684
+ children: code2
180685
+ }
180686
+ )
180687
+ ]
180688
+ }
180689
+ )
180690
+ ] });
180260
180691
  };
180261
180692
  const getStatusText = (status) => {
180262
180693
  switch (status) {
@@ -180321,6 +180752,9 @@ const LoadingIndicator = ({ status, currentExecution, scrollToBottom }) => {
180321
180752
  const streamingMessage = getStreamingMessage(currentExecution?.id || "");
180322
180753
  const isStreaming = !!streamingMessage && !streamingMessage.isComplete;
180323
180754
  const codeSnippet = currentExecution?.code || null;
180755
+ const stdout = currentExecution?.stdout || "";
180756
+ const stderr = currentExecution?.stderr || "";
180757
+ const logging = currentExecution?.logging || "";
180324
180758
  const message2 = currentExecution?.message || null;
180325
180759
  const statusText = currentExecution ? getDetailedStatusText(status, currentExecution) : status ? getStatusText(status) : "Thinking";
180326
180760
  const {
@@ -180364,7 +180798,7 @@ const LoadingIndicator = ({ status, currentExecution, scrollToBottom }) => {
180364
180798
  /* @__PURE__ */ jsxRuntimeExports.jsx(Dot$1, { delay: 0.2 }),
180365
180799
  /* @__PURE__ */ jsxRuntimeExports.jsx(Dot$1, { delay: 0.4 })
180366
180800
  ] }),
180367
- codeSnippet && /* @__PURE__ */ jsxRuntimeExports.jsx(
180801
+ (codeSnippet || stdout || stderr || logging) && /* @__PURE__ */ jsxRuntimeExports.jsx(
180368
180802
  CodeToggleButton,
180369
180803
  {
180370
180804
  onClick: toggleCodeExpansion,
@@ -180383,7 +180817,19 @@ const LoadingIndicator = ({ status, currentExecution, scrollToBottom }) => {
180383
180817
  )
180384
180818
  ] })
180385
180819
  ] }) }),
180386
- codeSnippet && isCodeExpanded && /* @__PURE__ */ jsxRuntimeExports.jsx(CodeContainer$4, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(LoadingCodeBlock, { code: codeSnippet }) })
180820
+ isCodeExpanded && (codeSnippet || stdout || stderr || logging) && /* @__PURE__ */ jsxRuntimeExports.jsxs(CodeContainer$1, { children: [
180821
+ codeSnippet && /* @__PURE__ */ jsxRuntimeExports.jsx(
180822
+ LoadingCodeBlock,
180823
+ {
180824
+ code: codeSnippet,
180825
+ label: "Code",
180826
+ language: "python"
180827
+ }
180828
+ ),
180829
+ stdout && /* @__PURE__ */ jsxRuntimeExports.jsx(OutputBlock, { output: stdout, isUser: false }),
180830
+ stderr && /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBlock, { error: stderr, isUser: false }),
180831
+ logging && /* @__PURE__ */ jsxRuntimeExports.jsx(LogBlock, { log: logging, isUser: false })
180832
+ ] })
180387
180833
  ] })
180388
180834
  ] });
180389
180835
  };
@@ -180438,11 +180884,11 @@ const ActionHighlight = ({
180438
180884
  children
180439
180885
  ] });
180440
180886
  };
180441
- const CodeContainer$3 = styled$1(Box)({
180887
+ const CodeContainer = styled$1(Box)({
180442
180888
  marginBottom: 16,
180443
180889
  width: "100%"
180444
180890
  });
180445
- const SectionLabel$4 = styled$1(Typography)(({ theme: theme2 }) => ({
180891
+ const SectionLabel$1 = styled$1(Typography)(({ theme: theme2 }) => ({
180446
180892
  display: "block",
180447
180893
  marginBottom: 4,
180448
180894
  color: theme2.palette.text.secondary
@@ -180454,8 +180900,8 @@ const SyntaxHighlighterStyles = ft`
180454
180900
  `;
180455
180901
  const CodeBlock = ({ code: code2 }) => {
180456
180902
  if (!code2) return null;
180457
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(CodeContainer$3, { children: [
180458
- /* @__PURE__ */ jsxRuntimeExports.jsx(SectionLabel$4, { variant: "caption", children: "Code" }),
180903
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(CodeContainer, { children: [
180904
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SectionLabel$1, { variant: "caption", children: "Code" }),
180459
180905
  /* @__PURE__ */ jsxRuntimeExports.jsx(SyntaxHighlighterStyles, {}),
180460
180906
  /* @__PURE__ */ jsxRuntimeExports.jsx(
180461
180907
  highlighter,
@@ -180482,50 +180928,6 @@ const CodeBlock = ({ code: code2 }) => {
180482
180928
  )
180483
180929
  ] });
180484
180930
  };
180485
- const CodeContainer$2 = styled$1(Box)({
180486
- marginBottom: 16,
180487
- width: "100%"
180488
- });
180489
- const SectionLabel$3 = styled$1(Typography)(({ theme: theme2 }) => ({
180490
- display: "block",
180491
- marginBottom: 4,
180492
- color: theme2.palette.error.light
180493
- }));
180494
- const ErrorContainer$2 = styled$1(Box, {
180495
- shouldForwardProp: (prop) => prop !== "isUser"
180496
- })(({ isUser, theme: theme2 }) => ({
180497
- fontFamily: '"Roboto Mono", monospace',
180498
- fontSize: "0.85rem",
180499
- backgroundColor: alpha$1(
180500
- theme2.palette.error.main,
180501
- theme2.palette.mode === "dark" ? 0.1 : 0.05
180502
- ),
180503
- borderRadius: "8px",
180504
- padding: 12,
180505
- maxHeight: "200px",
180506
- overflow: "auto",
180507
- whiteSpace: "pre-wrap",
180508
- color: isUser ? theme2.palette.error.main : theme2.palette.error.light,
180509
- width: "100%",
180510
- boxShadow: `0 2px 6px ${alpha$1(theme2.palette.common.black, theme2.palette.mode === "dark" ? 0.15 : 0.1)}`,
180511
- "&::-webkit-scrollbar": {
180512
- width: "6px"
180513
- },
180514
- "&::-webkit-scrollbar-thumb": {
180515
- backgroundColor: alpha$1(
180516
- theme2.palette.mode === "dark" ? theme2.palette.common.white : theme2.palette.common.black,
180517
- 0.1
180518
- ),
180519
- borderRadius: "3px"
180520
- }
180521
- }));
180522
- const ErrorBlock = ({ error, isUser }) => {
180523
- if (!error || error === "[No error output]") return null;
180524
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(CodeContainer$2, { children: [
180525
- /* @__PURE__ */ jsxRuntimeExports.jsx(SectionLabel$3, { variant: "caption", children: "Error" }),
180526
- /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorContainer$2, { isUser, children: error })
180527
- ] });
180528
- };
180529
180931
  const canvasSupportedExtensions = /* @__PURE__ */ new Set([
180530
180932
  ...Object.keys(langs),
180531
180933
  ...Object.keys(languageOverrideMap)
@@ -180613,8 +181015,13 @@ const FileAttachment = ({
180613
181015
  const state = useCanvasStore.getState();
180614
181016
  const files = state.conversations[conversationId]?.files ?? [];
180615
181017
  const openTabs = state.conversations[conversationId]?.openTabs ?? [];
180616
- const existsFile = files.some((d2) => d2.id === docId);
180617
- const updatedFiles = existsFile ? files : [...files, newDoc];
181018
+ const updatedFiles = (() => {
181019
+ const idx = files.findIndex((d2) => d2.id === docId);
181020
+ if (idx !== -1) {
181021
+ return [...files.slice(0, idx), newDoc, ...files.slice(idx + 1)];
181022
+ }
181023
+ return [...files, newDoc];
181024
+ })();
180618
181025
  setFiles(conversationId, updatedFiles);
180619
181026
  const existsTab = openTabs.some((t2) => t2.id === docId);
180620
181027
  const updatedTabs = existsTab ? openTabs : [...openTabs, { id: docId, title }];
@@ -180741,100 +181148,6 @@ const ImageAttachment = ({
180741
181148
  }
180742
181149
  );
180743
181150
  };
180744
- const CodeContainer$1 = styled$1(Box)({
180745
- marginBottom: 16,
180746
- width: "100%"
180747
- });
180748
- const SectionLabel$2 = styled$1(Typography)(({ theme: theme2 }) => ({
180749
- display: "block",
180750
- marginBottom: 4,
180751
- color: theme2.palette.text.secondary
180752
- }));
180753
- const LogContainer = styled$1(Box, {
180754
- shouldForwardProp: (prop) => prop !== "isUser"
180755
- })(({ isUser, theme: theme2 }) => ({
180756
- fontFamily: '"Roboto Mono", monospace',
180757
- fontSize: "0.85rem",
180758
- backgroundColor: alpha$1(
180759
- theme2.palette.mode === "dark" ? theme2.palette.common.black : theme2.palette.grey[200],
180760
- theme2.palette.mode === "dark" ? 0.3 : 0.5
180761
- ),
180762
- borderRadius: "8px",
180763
- padding: 12,
180764
- maxHeight: "200px",
180765
- overflow: "auto",
180766
- whiteSpace: "pre-wrap",
180767
- color: isUser ? theme2.palette.info.main : theme2.palette.info.light,
180768
- width: "100%",
180769
- boxShadow: `0 2px 6px ${alpha$1(theme2.palette.common.black, theme2.palette.mode === "dark" ? 0.15 : 0.1)}`,
180770
- "&::-webkit-scrollbar": {
180771
- width: "6px"
180772
- },
180773
- "&::-webkit-scrollbar-thumb": {
180774
- backgroundColor: alpha$1(
180775
- theme2.palette.mode === "dark" ? theme2.palette.common.white : theme2.palette.common.black,
180776
- 0.1
180777
- ),
180778
- borderRadius: "3px"
180779
- }
180780
- }));
180781
- const LogBlock = ({ log: log2, isUser }) => {
180782
- if (!log2 || log2 === "[No logger output]") return null;
180783
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(CodeContainer$1, { children: [
180784
- /* @__PURE__ */ jsxRuntimeExports.jsx(SectionLabel$2, { variant: "caption", children: "Logs" }),
180785
- /* @__PURE__ */ jsxRuntimeExports.jsx(LogContainer, { isUser, children: log2 })
180786
- ] });
180787
- };
180788
- const CodeContainer = styled$1(Box)({
180789
- marginBottom: 16,
180790
- width: "100%"
180791
- });
180792
- const SectionLabel$1 = styled$1(Typography)(({ theme: theme2 }) => ({
180793
- display: "block",
180794
- marginBottom: 4,
180795
- color: theme2.palette.text.secondary
180796
- }));
180797
- const OutputContainer = styled$1(Box)(({ theme: theme2 }) => ({
180798
- fontFamily: '"Roboto Mono", monospace',
180799
- fontSize: "0.85rem",
180800
- backgroundColor: alpha$1(
180801
- theme2.palette.mode === "dark" ? theme2.palette.common.black : theme2.palette.grey[200],
180802
- theme2.palette.mode === "dark" ? 0.3 : 0.5
180803
- ),
180804
- borderRadius: "8px",
180805
- padding: 12,
180806
- maxHeight: "300px",
180807
- overflow: "auto",
180808
- whiteSpace: "pre",
180809
- width: "100%",
180810
- boxShadow: `0 2px 6px ${alpha$1(theme2.palette.common.black, theme2.palette.mode === "dark" ? 0.15 : 0.1)}`,
180811
- color: theme2.palette.text.primary,
180812
- overflowX: "auto",
180813
- "&::-webkit-scrollbar": {
180814
- width: "6px",
180815
- height: "6px"
180816
- },
180817
- "&::-webkit-scrollbar-thumb": {
180818
- backgroundColor: alpha$1(
180819
- theme2.palette.mode === "dark" ? theme2.palette.common.white : theme2.palette.common.black,
180820
- 0.1
180821
- ),
180822
- borderRadius: "3px"
180823
- },
180824
- "&::-webkit-scrollbar-corner": {
180825
- backgroundColor: alpha$1(
180826
- theme2.palette.mode === "dark" ? theme2.palette.common.black : theme2.palette.grey[200],
180827
- theme2.palette.mode === "dark" ? 0.3 : 0.5
180828
- )
180829
- }
180830
- }));
180831
- const OutputBlock = ({ output }) => {
180832
- if (!output) return null;
180833
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(CodeContainer, { children: [
180834
- /* @__PURE__ */ jsxRuntimeExports.jsx(SectionLabel$1, { variant: "caption", children: "Output" }),
180835
- /* @__PURE__ */ jsxRuntimeExports.jsx(OutputContainer, { children: output })
180836
- ] });
180837
- };
180838
181151
  const AttachmentVideo = styled$1("video")(({ theme: theme2 }) => ({
180839
181152
  maxWidth: "100%",
180840
181153
  maxHeight: 300,
@@ -182116,6 +182429,47 @@ const getAttachmentUrl = (client, path2) => {
182116
182429
  };
182117
182430
  const MessageItem = reactExports.memo(
182118
182431
  ({ message: message2, onMessageComplete, isLastMessage, conversationId }) => {
182432
+ const setFiles = useCanvasStore((s2) => s2.setFiles);
182433
+ reactExports.useEffect(() => {
182434
+ if (!message2.files || message2.files.length === 0) return;
182435
+ const state = useCanvasStore.getState();
182436
+ const conv = state.conversations[conversationId];
182437
+ if (!conv) return;
182438
+ const { openTabs, files } = conv;
182439
+ if (!openTabs || openTabs.length === 0) return;
182440
+ (async () => {
182441
+ let updatedFiles = files;
182442
+ let didUpdate = false;
182443
+ for (const filePath of message2.files ?? []) {
182444
+ const normalizedPath = filePath.startsWith("file://") ? filePath.substring(7) : filePath;
182445
+ const tabIsOpen = openTabs.some((tab2) => tab2.id === normalizedPath);
182446
+ if (!tabIsOpen) continue;
182447
+ const fileIdx = updatedFiles.findIndex(
182448
+ (f2) => f2.id === normalizedPath
182449
+ );
182450
+ if (fileIdx === -1) continue;
182451
+ try {
182452
+ const result = await window.api.readFile(normalizedPath);
182453
+ if (result.success) {
182454
+ const currentDoc = updatedFiles[fileIdx];
182455
+ if (currentDoc.content !== result.data) {
182456
+ const updatedDoc = { ...currentDoc, content: result.data };
182457
+ updatedFiles = [
182458
+ ...updatedFiles.slice(0, fileIdx),
182459
+ updatedDoc,
182460
+ ...updatedFiles.slice(fileIdx + 1)
182461
+ ];
182462
+ didUpdate = true;
182463
+ }
182464
+ }
182465
+ } catch (_2) {
182466
+ }
182467
+ }
182468
+ if (didUpdate) {
182469
+ setFiles(conversationId, updatedFiles);
182470
+ }
182471
+ })();
182472
+ }, [message2, conversationId, setFiles]);
182119
182473
  const shouldHide = (message2.action === "DONE" || message2.action === "ASK") && message2.execution_type === "action" && message2.task_classification === "conversation" || !message2.message && (!message2.files || message2.files.length === 0) && !message2.code && !message2.stdout && !message2.stderr && !message2.logging && message2.is_complete;
182120
182474
  if (shouldHide) {
182121
182475
  return null;
@@ -183854,7 +184208,7 @@ const menuItemSx = (theme2) => ({
183854
184208
  }
183855
184209
  }
183856
184210
  });
183857
- const menuPropsSx = (theme2) => ({
184211
+ const menuPropsSx$1 = (theme2) => ({
183858
184212
  PaperProps: {
183859
184213
  sx: {
183860
184214
  mt: 0.5,
@@ -183870,8 +184224,6 @@ const RECOMMENDED_AGENT_COUNT = 8;
183870
184224
  const StyledGridContainer = styled$1(Grid)(({ theme: theme2 }) => ({
183871
184225
  overflowY: "auto",
183872
184226
  padding: theme2.spacing(2, 0),
183873
- height: 400,
183874
- maxHeight: 400,
183875
184227
  flexGrow: 1,
183876
184228
  width: "100%",
183877
184229
  "&::-webkit-scrollbar": {
@@ -183991,7 +184343,7 @@ const CreateAgentStep = ({
183991
184343
  ] })
183992
184344
  }
183993
184345
  ),
183994
- !isLoadingAgents && !agentsError && /* @__PURE__ */ jsxRuntimeExports.jsx(StyledGridContainer, { container: true, spacing: 2, children: recommendedAgents.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body1", align: "center", children: "No recommended agents found. You can proceed or add agents later." }) }) : recommendedAgents.map((agent) => /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { item: true, xs: 12, sm: 6, md: 6, lg: 4, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
184346
+ !isLoadingAgents && !agentsError && /* @__PURE__ */ jsxRuntimeExports.jsx(StyledGridContainer, { container: true, spacing: 2, children: recommendedAgents.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body1", align: "center", children: "No recommended agents found. You can proceed or add agents later." }) }) : recommendedAgents.map((agent) => /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { item: true, xs: 12, sm: 6, md: 6, lg: 6, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
183995
184347
  Box,
183996
184348
  {
183997
184349
  sx: {
@@ -184306,7 +184658,7 @@ const DefaultModelStep = () => {
184306
184658
  id: "provider-select",
184307
184659
  value: selectedProvider,
184308
184660
  onChange: handleProviderChange,
184309
- MenuProps: menuPropsSx(theme2),
184661
+ MenuProps: menuPropsSx$1(theme2),
184310
184662
  children: availableProviders.map((provider) => /* @__PURE__ */ jsxRuntimeExports.jsx(MenuItem, { value: provider.id, children: provider.name }, provider.id))
184311
184663
  }
184312
184664
  ),
@@ -184326,7 +184678,7 @@ const DefaultModelStep = () => {
184326
184678
  id: "model-select",
184327
184679
  value: selectedModel,
184328
184680
  onChange: handleModelChange,
184329
- MenuProps: menuPropsSx(theme2),
184681
+ MenuProps: menuPropsSx$1(theme2),
184330
184682
  disabled: availableModels.length === 0,
184331
184683
  children: [
184332
184684
  availableModels.length === 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(MenuItem, { disabled: true, value: "", children: "No models found for this provider" }),
@@ -184629,7 +184981,7 @@ const ModelCredentialStep = () => {
184629
184981
  id: "credential-select",
184630
184982
  value: selectedCredential,
184631
184983
  onChange: handleCredentialChange,
184632
- MenuProps: menuPropsSx(theme2),
184984
+ MenuProps: menuPropsSx$1(theme2),
184633
184985
  children: modelProviderCredentials.map((cred) => /* @__PURE__ */ jsxRuntimeExports.jsx(MenuItem, { value: cred.key, children: cred.name }, cred.key))
184634
184986
  }
184635
184987
  ),
@@ -184881,22 +185233,7 @@ const RadientChoiceStep = ({
184881
185233
  "Get started for free with ",
184882
185234
  /* @__PURE__ */ jsxRuntimeExports.jsx(RadientPassText, { children: "Radient Pass" })
184883
185235
  ] }),
184884
- /* @__PURE__ */ jsxRuntimeExports.jsxs(CardSubtitle, { variant: "body2", children: [
184885
- " ",
184886
- "Batteries included with",
184887
- " ",
184888
- /* @__PURE__ */ jsxRuntimeExports.jsx(
184889
- Typography,
184890
- {
184891
- component: "span",
184892
- fontWeight: "medium",
184893
- color: radientTheme.palette.primary.main,
184894
- sx: { fontSize: "inherit" },
184895
- children: "web search, image generation, site crawling, hundreds of AI models"
184896
- }
184897
- ),
184898
- ", and more. One API key instead of many, with potential savings when Radient picks the best model to handle each step. Two-click setup, no credit card required."
184899
- ] })
185236
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CardSubtitle, { variant: "body2", children: "Designed for best speed, accuracy, and performance with Local Operator. Get access to all tools and models at once, with potential savings when Radient picks the best model to handle each step. Two-click setup, no credit card required." })
184900
185237
  ] }),
184901
185238
  /* @__PURE__ */ jsxRuntimeExports.jsx(CardIcon, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
184902
185239
  "img",
@@ -184923,7 +185260,7 @@ const RadientChoiceStep = ({
184923
185260
  "Set up your own keys ",
184924
185261
  /* @__PURE__ */ jsxRuntimeExports.jsx(FreeText, { children: "(Free Forever)" })
184925
185262
  ] }),
184926
- /* @__PURE__ */ jsxRuntimeExports.jsx(CardSubtitle, { variant: "body2", children: "Full flexibility for technical users. Bring your own API keys for providers like OpenAI, Anthropic, SERP API, etc., and manage billing separately." })
185263
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CardSubtitle, { variant: "body2", children: "Full flexibility for technical users. Bring your own API keys for providers like OpenAI, Anthropic, Tavily API, etc., and manage billing separately." })
184927
185264
  ] }),
184928
185265
  /* @__PURE__ */ jsxRuntimeExports.jsx(CardIcon, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { fontSize: "3.5rem", children: "🔧" }) }),
184929
185266
  /* @__PURE__ */ jsxRuntimeExports.jsxs(ChooseOption, { className: "choose-option", children: [
@@ -185236,7 +185573,7 @@ const SearchApiStep = () => {
185236
185573
  id: "search-api-select",
185237
185574
  value: selectedCredential,
185238
185575
  onChange: handleCredentialChange,
185239
- MenuProps: menuPropsSx(theme2),
185576
+ MenuProps: menuPropsSx$1(theme2),
185240
185577
  children: searchApiCredentials.map((cred) => /* @__PURE__ */ jsxRuntimeExports.jsx(MenuItem, { value: cred.key, children: cred.key === RECOMMENDED_CREDENTIAL ? `${cred.name} (Recommended)` : cred.name }, cred.key))
185241
185578
  }
185242
185579
  ),
@@ -185525,7 +185862,6 @@ const OnboardingModal = ({ open: open2 }) => {
185525
185862
  }
185526
185863
  } catch (error) {
185527
185864
  console.error("Error validating session/fetching user info:", error);
185528
- showErrorToast("Session validation failed. Please sign in again.");
185529
185865
  clearSession();
185530
185866
  }
185531
185867
  };
@@ -208830,6 +209166,7 @@ const StyledCard = styled$1(Card)(({ theme: theme2 }) => ({
208830
209166
  marginBottom: theme2.spacing(3),
208831
209167
  backgroundColor: theme2.palette.background.paper,
208832
209168
  borderRadius: 6,
209169
+ backgroundImage: "none",
208833
209170
  border: `1px solid ${theme2.palette.divider}`,
208834
209171
  boxShadow: "none",
208835
209172
  width: "100%"
@@ -209152,15 +209489,20 @@ const CredentialCard = ({
209152
209489
  variant: "outlined",
209153
209490
  size: "small",
209154
209491
  color: "primary",
209155
- startIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(FontAwesomeIcon, { icon: faKey, size: "xs" }),
209492
+ startIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(
209493
+ FontAwesomeIcon,
209494
+ {
209495
+ icon: faKey,
209496
+ size: "xs",
209497
+ style: { fontSize: "0.875rem" }
209498
+ }
209499
+ ),
209156
209500
  onClick: () => onAdd?.(credentialKey),
209157
209501
  sx: { ...primaryButtonSx, boxShadow: "none" },
209158
209502
  children: "Configure"
209159
209503
  }
209160
209504
  ),
209161
- credInfo.url && // Keep ts-ignore as requested
209162
- // @ts-ignore
209163
- /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { title: `Get your ${credInfo.name} key`, placement: "top", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
209505
+ credInfo.url && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { title: `Get your ${credInfo.name} key`, placement: "top", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
209164
209506
  IconButton,
209165
209507
  {
209166
209508
  size: "small",
@@ -209176,57 +209518,101 @@ const CredentialCard = ({
209176
209518
  ] }) })
209177
209519
  ] });
209178
209520
  };
209179
- const StyledFormControl = styled$1(FormControl)(({ theme: theme2 }) => ({
209180
- marginBottom: theme2.spacing(2.5)
209181
- // Consistent spacing
209182
- }));
209183
- const StyledTextField$1 = styled$1(TextField)(({ theme: theme2 }) => ({
209184
- marginBottom: theme2.spacing(2.5),
209185
- // Consistent spacing
209186
- "& .MuiInputBase-root": {
209187
- borderRadius: theme2.shape.borderRadius * 0.75,
209188
- backgroundColor: theme2.palette.background.paper
209521
+ const StyledOutlinedInput = styled$1(OutlinedInput)(({ theme: theme2 }) => ({
209522
+ borderRadius: theme2.shape.borderRadius * 0.75,
209523
+ backgroundColor: theme2.palette.background.paper,
209524
+ border: `1px solid ${theme2.palette.divider}`,
209525
+ minHeight: "40px",
209526
+ height: "40px",
209527
+ fontSize: "0.875rem",
209528
+ paddingRight: 0,
209529
+ "& .MuiOutlinedInput-notchedOutline": {
209530
+ border: "none"
209189
209531
  },
209532
+ "& .MuiSelect-select": {
209533
+ display: "flex",
209534
+ alignItems: "center",
209535
+ gap: theme2.spacing(1),
209536
+ fontSize: "0.875rem",
209537
+ padding: theme2.spacing(1, 1.5),
209538
+ height: "calc(40px - 16px)",
209539
+ boxSizing: "border-box"
209540
+ },
209541
+ "& .MuiInputBase-input": {
209542
+ padding: theme2.spacing(1, 1.5),
209543
+ fontSize: "0.875rem",
209544
+ height: "calc(40px - 16px)",
209545
+ boxSizing: "border-box"
209546
+ },
209547
+ "& .MuiInputBase-input::placeholder": {
209548
+ color: theme2.palette.text.disabled,
209549
+ opacity: 1
209550
+ },
209551
+ "&:hover": {
209552
+ borderColor: theme2.palette.text.secondary
209553
+ },
209554
+ "&.Mui-focused": {
209555
+ borderColor: theme2.palette.primary.main,
209556
+ boxShadow: `0 0 0 2px ${theme2.palette.primary.main}33`
209557
+ }
209558
+ }));
209559
+ const menuPropsSx = (theme2) => ({
209560
+ PaperProps: {
209561
+ sx: {
209562
+ borderRadius: theme2.shape.borderRadius * 0.75,
209563
+ boxShadow: theme2.shadows[2],
209564
+ mt: 0.5,
209565
+ "& .MuiMenuItem-root": {
209566
+ fontSize: "0.875rem",
209567
+ minHeight: "40px",
209568
+ px: 2
209569
+ }
209570
+ }
209571
+ }
209572
+ });
209573
+ const textFieldInputSx = (theme2) => ({
209190
209574
  "& .MuiOutlinedInput-root": {
209191
- "& .MuiOutlinedInput-notchedOutline": {
209192
- borderColor: theme2.palette.divider
209193
- },
209194
- "&:hover .MuiOutlinedInput-notchedOutline": {
209575
+ borderRadius: theme2.shape.borderRadius * 0.75,
209576
+ backgroundColor: theme2.palette.background.paper,
209577
+ border: `1px solid ${theme2.palette.divider}`,
209578
+ minHeight: "40px",
209579
+ height: "40px",
209580
+ transition: "border-color 0.2s ease, box-shadow 0.2s ease",
209581
+ "&:hover": {
209195
209582
  borderColor: theme2.palette.text.secondary
209196
209583
  },
209197
- "&.Mui-focused .MuiOutlinedInput-notchedOutline": {
209584
+ "&.Mui-focused": {
209198
209585
  borderColor: theme2.palette.primary.main,
209199
- borderWidth: "1px"
209586
+ boxShadow: `0 0 0 2px ${theme2.palette.primary.main}33`
209587
+ },
209588
+ "& .MuiOutlinedInput-notchedOutline": {
209589
+ border: "none"
209200
209590
  }
209201
209591
  },
209202
- "& .MuiInputLabel-root": {
209592
+ "& .MuiInputBase-input": {
209593
+ padding: theme2.spacing(1, 1.5),
209203
209594
  fontSize: "0.875rem",
209204
- "&.Mui-focused": {
209205
- color: theme2.palette.primary.main
209206
- }
209207
- }
209208
- }));
209209
- const StyledSelect = styled$1(Select)(({ theme: theme2 }) => ({
209210
- borderRadius: theme2.shape.borderRadius * 0.75,
209211
- backgroundColor: theme2.palette.background.paper,
209212
- "& .MuiOutlinedInput-notchedOutline": {
209213
- borderColor: theme2.palette.divider
209595
+ height: "calc(40px - 16px)",
209596
+ boxSizing: "border-box"
209214
209597
  },
209215
- "&:hover .MuiOutlinedInput-notchedOutline": {
209216
- borderColor: theme2.palette.text.secondary
209598
+ "& .MuiInputBase-input::placeholder": {
209599
+ color: theme2.palette.text.disabled,
209600
+ opacity: 1
209217
209601
  },
209218
- "&.Mui-focused .MuiOutlinedInput-notchedOutline": {
209219
- borderColor: theme2.palette.primary.main
209602
+ "& .MuiFormHelperText-root": {
209603
+ fontSize: "0.75rem",
209604
+ mt: 0.5,
209605
+ ml: 0.5
209220
209606
  }
209221
- }));
209222
- const DescriptionBox = styled$1(Box)(({ theme: theme2 }) => ({
209607
+ });
209608
+ const DescriptionBoxSx = (theme2) => ({
209223
209609
  marginTop: theme2.spacing(1),
209224
209610
  marginBottom: theme2.spacing(2),
209225
209611
  padding: theme2.spacing(1.5),
209226
- backgroundColor: theme2.palette.action.hover,
209612
+ backgroundColor: alpha$1(theme2.palette.background.default, 0.5),
209227
209613
  border: `1px solid ${theme2.palette.divider}`,
209228
209614
  borderRadius: theme2.shape.borderRadius * 0.75
209229
- }));
209615
+ });
209230
209616
  const CredentialDialog = ({
209231
209617
  open: open2,
209232
209618
  onClose,
@@ -209279,6 +209665,21 @@ const CredentialDialog = ({
209279
209665
  (cred) => cred.key === key
209280
209666
  );
209281
209667
  const dialogTitle = isEditMode ? "Update Credential" : "Add New Credential";
209668
+ const FieldLabel2 = styled$1("div")(({ theme: theme22 }) => ({
209669
+ fontFamily: theme22.typography.fontFamily,
209670
+ fontSize: "0.875rem",
209671
+ fontWeight: 500,
209672
+ color: theme22.palette.text.secondary,
209673
+ marginBottom: 6,
209674
+ display: "flex",
209675
+ alignItems: "center"
209676
+ }));
209677
+ const LabelIcon2 = styled$1(Box)({
209678
+ marginRight: 8,
209679
+ opacity: 0.9,
209680
+ display: "flex",
209681
+ alignItems: "center"
209682
+ });
209282
209683
  const dialogActions = /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
209283
209684
  /* @__PURE__ */ jsxRuntimeExports.jsx(
209284
209685
  Button,
@@ -209325,7 +209726,7 @@ const CredentialDialog = ({
209325
209726
  }
209326
209727
  )
209327
209728
  ] });
209328
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
209729
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
209329
209730
  BaseDialog,
209330
209731
  {
209331
209732
  open: open2,
@@ -209334,111 +209735,120 @@ const CredentialDialog = ({
209334
209735
  actions: dialogActions,
209335
209736
  maxWidth: "sm",
209336
209737
  fullWidth: true,
209337
- children: [
209338
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { sx: { pt: 2 }, children: [
209339
- isEditMode ? (
209340
- // Display the key being edited (non-editable)
209341
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { mb: 2.5, children: [
209342
- /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "overline", color: "text.secondary", children: "Credential Key" }),
209343
- /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { fontWeight: 500, children: initialKey })
209344
- ] })
209345
- ) : (
209346
- // Show selection for adding new credentials
209347
- /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
209348
- /* @__PURE__ */ jsxRuntimeExports.jsxs(StyledFormControl, { fullWidth: true, children: [
209349
- /* @__PURE__ */ jsxRuntimeExports.jsx(InputLabel, { id: "credential-key-label", children: "Credential Type" }),
209350
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
209351
- StyledSelect,
209352
- {
209353
- labelId: "credential-key-label",
209354
- value: useCustomKey ? "_custom_" : key,
209355
- label: "Credential Type",
209356
- onChange: (e3) => {
209357
- const selectedValue = e3.target.value;
209358
- if (selectedValue === "_custom_") {
209359
- setUseCustomKey(true);
209360
- setKey("");
209361
- } else {
209362
- setUseCustomKey(false);
209363
- setKey(selectedValue);
209364
- setCustomKey("");
209365
- }
209366
- },
209367
- displayEmpty: !key && !useCustomKey,
209368
- children: [
209369
- /* @__PURE__ */ jsxRuntimeExports.jsx(MenuItem, { value: "", disabled: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx("em", { children: "Select a credential type..." }) }),
209370
- CREDENTIAL_MANIFEST.map((cred) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
209371
- MenuItem,
209372
- {
209373
- value: cred.key,
209374
- disabled: isExistingKey(cred.key),
209375
- children: [
209376
- cred.name,
209377
- " ",
209378
- isExistingKey(cred.key) && "(Configured)"
209379
- ]
209380
- },
209381
- cred.key
209382
- )),
209383
- /* @__PURE__ */ jsxRuntimeExports.jsx(MenuItem, { value: "_custom_", children: "Custom Credential" })
209384
- ]
209385
- }
209386
- )
209387
- ] }),
209388
- useCustomKey && /* @__PURE__ */ jsxRuntimeExports.jsx(
209389
- StyledTextField$1,
209390
- {
209391
- label: "Custom Credential Key",
209392
- fullWidth: true,
209393
- value: customKey,
209394
- onChange: (e3) => setCustomKey(e3.target.value),
209395
- error: isExistingKey(customKey),
209396
- helperText: isExistingKey(customKey) ? "This credential already exists" : "",
209397
- required: true,
209398
- autoFocus: true
209399
- }
209400
- ),
209401
- selectedCredentialManifest && !useCustomKey && /* @__PURE__ */ jsxRuntimeExports.jsxs(DescriptionBox, { children: [
209402
- /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body2", color: "text.secondary", gutterBottom: true, children: selectedCredentialManifest.description }),
209403
- selectedCredentialManifest.url && /* @__PURE__ */ jsxRuntimeExports.jsxs(
209404
- Link,
209405
- {
209406
- href: selectedCredentialManifest.url,
209407
- target: "_blank",
209408
- rel: "noopener noreferrer",
209409
- variant: "body2",
209410
- sx: { display: "inline-flex", alignItems: "center" },
209411
- children: [
209412
- "Get your ",
209413
- selectedCredentialManifest.name,
209414
- " key"
209415
- ]
209416
- }
209417
- )
209418
- ] })
209419
- ] })
209420
- ),
209738
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { sx: { pt: 2 }, children: [
209739
+ isEditMode ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { mb: 2.5, children: [
209421
209740
  /* @__PURE__ */ jsxRuntimeExports.jsx(
209422
- StyledTextField$1,
209741
+ Typography,
209423
209742
  {
209424
- label: "Credential Value",
209743
+ variant: "overline",
209744
+ color: "text.secondary",
209745
+ sx: { fontSize: "0.75rem", letterSpacing: 1, fontWeight: 500 },
209746
+ children: "Credential Key"
209747
+ }
209748
+ ),
209749
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { fontWeight: 500, sx: { fontSize: "0.95rem" }, children: initialKey })
209750
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
209751
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(FormControl, { fullWidth: true, sx: { mb: 2.5 }, children: [
209752
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(FieldLabel2, { children: [
209753
+ /* @__PURE__ */ jsxRuntimeExports.jsx(LabelIcon2, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(FontAwesomeIcon, { icon: faKey, size: "sm" }) }),
209754
+ "Credential Type"
209755
+ ] }),
209756
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
209757
+ Select,
209758
+ {
209759
+ value: useCustomKey ? "_custom_" : key,
209760
+ onChange: (e3) => {
209761
+ const selectedValue = e3.target.value;
209762
+ if (selectedValue === "_custom_") {
209763
+ setUseCustomKey(true);
209764
+ setKey("");
209765
+ } else {
209766
+ setUseCustomKey(false);
209767
+ setKey(selectedValue);
209768
+ setCustomKey("");
209769
+ }
209770
+ },
209771
+ displayEmpty: !key && !useCustomKey,
209772
+ MenuProps: menuPropsSx(theme2),
209773
+ input: /* @__PURE__ */ jsxRuntimeExports.jsx(StyledOutlinedInput, { notched: false, label: void 0 }),
209774
+ children: [
209775
+ /* @__PURE__ */ jsxRuntimeExports.jsx(MenuItem, { value: "", disabled: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx("em", { children: "Select a credential type..." }) }),
209776
+ CREDENTIAL_MANIFEST.map((cred) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
209777
+ MenuItem,
209778
+ {
209779
+ value: cred.key,
209780
+ disabled: isExistingKey(cred.key),
209781
+ children: [
209782
+ cred.name,
209783
+ " ",
209784
+ isExistingKey(cred.key) && "(Configured)"
209785
+ ]
209786
+ },
209787
+ cred.key
209788
+ )),
209789
+ /* @__PURE__ */ jsxRuntimeExports.jsx(MenuItem, { value: "_custom_", children: "Custom Credential" })
209790
+ ]
209791
+ }
209792
+ )
209793
+ ] }),
209794
+ useCustomKey && /* @__PURE__ */ jsxRuntimeExports.jsx(
209795
+ TextField,
209796
+ {
209797
+ label: "Custom Credential Key",
209425
209798
  fullWidth: true,
209426
- type: "password",
209427
- value,
209428
- onChange: (e3) => setValue(e3.target.value),
209429
- onKeyDown: (e3) => {
209430
- if (e3.key === "Enter" && canSave) {
209431
- handleSave();
209432
- }
209433
- },
209799
+ value: customKey,
209800
+ onChange: (e3) => setCustomKey(e3.target.value),
209801
+ error: isExistingKey(customKey),
209802
+ helperText: isExistingKey(customKey) ? "This credential already exists" : "",
209434
209803
  required: true,
209435
- autoFocus: isEditMode,
209436
- helperText: isEditMode ? `Enter the new value for ${initialKey}` : "Enter the credential value or API key."
209804
+ autoFocus: true,
209805
+ sx: textFieldInputSx(theme2)
209437
209806
  }
209438
- )
209807
+ ),
209808
+ selectedCredentialManifest && !useCustomKey && /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { sx: DescriptionBoxSx(theme2), children: [
209809
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { variant: "body2", color: "text.secondary", gutterBottom: true, children: selectedCredentialManifest.description }),
209810
+ selectedCredentialManifest.url && /* @__PURE__ */ jsxRuntimeExports.jsxs(
209811
+ Link,
209812
+ {
209813
+ href: selectedCredentialManifest.url,
209814
+ target: "_blank",
209815
+ rel: "noopener noreferrer",
209816
+ variant: "body2",
209817
+ sx: { display: "inline-flex", alignItems: "center" },
209818
+ children: [
209819
+ "Get your ",
209820
+ selectedCredentialManifest.name,
209821
+ " key"
209822
+ ]
209823
+ }
209824
+ )
209825
+ ] })
209439
209826
  ] }),
209440
- " "
209441
- ]
209827
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(FieldLabel2, { children: [
209828
+ /* @__PURE__ */ jsxRuntimeExports.jsx(LabelIcon2, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(FontAwesomeIcon, { icon: faKey, size: "sm" }) }),
209829
+ "Credential Value"
209830
+ ] }),
209831
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
209832
+ TextField,
209833
+ {
209834
+ fullWidth: true,
209835
+ type: "password",
209836
+ value,
209837
+ onChange: (e3) => setValue(e3.target.value),
209838
+ onKeyDown: (e3) => {
209839
+ if (e3.key === "Enter" && canSave) {
209840
+ handleSave();
209841
+ }
209842
+ },
209843
+ required: true,
209844
+ autoFocus: isEditMode,
209845
+ placeholder: "Enter the credential value or API key.",
209846
+ helperText: isEditMode ? `Enter the new value for ${initialKey}` : "Enter the credential value or API key.",
209847
+ sx: textFieldInputSx(theme2),
209848
+ InputLabelProps: { shrink: false }
209849
+ }
209850
+ )
209851
+ ] })
209442
209852
  }
209443
209853
  );
209444
209854
  };
@@ -210028,6 +210438,10 @@ const StyledTextField = styled$1(TextField)(({ theme: theme2 }) => ({
210028
210438
  fontSize: "0.875rem",
210029
210439
  // Consistent font size
210030
210440
  lineHeight: 1.5,
210441
+ whiteSpace: "pre-wrap",
210442
+ // Ensure text wraps within the input
210443
+ wordBreak: "break-word",
210444
+ // Break long words to prevent overflow
210031
210445
  // Shadcn-like scrollbar
210032
210446
  "&::-webkit-scrollbar": {
210033
210447
  width: "8px",
@@ -211375,7 +211789,7 @@ const SettingsPage = () => {
211375
211789
  {
211376
211790
  value: config2.values.conversation_length,
211377
211791
  label: "Maximum Conversation History",
211378
- description: "Number of messages to keep in conversation history for context. More messages will make the agents have longer memory but more expensive to run.",
211792
+ description: "Number of messages to keep in conversation history for context. More messages will make the agents have longer memory but more expensive to run. Recommended: 100",
211379
211793
  min: 10,
211380
211794
  max: 200,
211381
211795
  step: 10,
@@ -211390,7 +211804,7 @@ const SettingsPage = () => {
211390
211804
  {
211391
211805
  value: config2.values.detail_length,
211392
211806
  label: "Detail View Length",
211393
- description: "Maximum number of messages to show in the detailed conversation view. Messages beyond this limit will be summarized. Shortening this will decrease costs but some important details could get lost from earlier messages.",
211807
+ description: "Maximum number of messages to show in the detailed conversation view. Messages beyond this limit will be summarized. Shortening this will decrease costs but some important details could get lost from earlier messages. Recommended: 20",
211394
211808
  min: 10,
211395
211809
  max: 100,
211396
211810
  step: 5,
@@ -211405,7 +211819,7 @@ const SettingsPage = () => {
211405
211819
  {
211406
211820
  value: config2.values.max_learnings_history,
211407
211821
  label: "Maximum Learnings History",
211408
- description: "Number of learning items to retain for context and personalization. More items will make the agents acquire a longer history of knowledge from your conversations but more expensive to run.",
211822
+ description: "Number of learning items to retain for context and personalization. More items will make the agents acquire a longer history of knowledge from your conversations but more expensive to run. Recommended: 50",
211409
211823
  min: 10,
211410
211824
  max: 100,
211411
211825
  step: 10,