@ottocode/web-sdk 0.1.303 → 0.1.305

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.
@@ -8126,19 +8126,190 @@ import {
8126
8126
  memo as memo10,
8127
8127
  useState as useState19,
8128
8128
  useCallback as useCallback17,
8129
- useEffect as useEffect19,
8129
+ useEffect as useEffect20,
8130
8130
  useRef as useRef11,
8131
8131
  forwardRef as forwardRef8,
8132
8132
  useImperativeHandle as useImperativeHandle4,
8133
- useMemo as useMemo13
8133
+ useMemo as useMemo14
8134
8134
  } from "react";
8135
- import { useQueryClient as useQueryClient8 } from "@tanstack/react-query";
8135
+ import { useQueryClient as useQueryClient9 } from "@tanstack/react-query";
8136
+
8137
+ // src/hooks/useAgents.ts
8138
+ import { useEffect as useEffect15 } from "react";
8139
+ import { useMutation as useMutation6, useQuery as useQuery8, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
8140
+
8141
+ // src/stores/agentsStore.ts
8142
+ import { create as create18 } from "zustand";
8143
+ function collapseOtherRightPanels() {
8144
+ useGitStore.getState().collapseSidebar();
8145
+ useSessionFilesStore.getState().collapseSidebar();
8146
+ useResearchStore.getState().collapseSidebar();
8147
+ useSettingsStore.getState().collapseSidebar();
8148
+ useTunnelStore.getState().collapseSidebar();
8149
+ useFileBrowserStore.getState().collapseSidebar();
8150
+ useMCPStore.getState().collapseSidebar();
8151
+ useSkillsStore.getState().collapseSidebar();
8152
+ }
8153
+ var useAgentsStore = create18((set) => ({
8154
+ isExpanded: false,
8155
+ isManagerOpen: false,
8156
+ managerMode: "library",
8157
+ editorPage: "overview",
8158
+ agents: [],
8159
+ defaultAgent: null,
8160
+ selectedAgent: null,
8161
+ isCreateModalOpen: false,
8162
+ setManagerMode: (mode) => set({ managerMode: mode }),
8163
+ openManager: () => {
8164
+ collapseOtherRightPanels();
8165
+ set({ isManagerOpen: true, isExpanded: true, managerMode: "library" });
8166
+ },
8167
+ closeManager: () => set({
8168
+ isManagerOpen: false,
8169
+ isExpanded: false,
8170
+ isCreateModalOpen: false,
8171
+ managerMode: "library",
8172
+ editorPage: "overview"
8173
+ }),
8174
+ toggleManager: () => {
8175
+ const open = useAgentsStore.getState().isManagerOpen;
8176
+ if (open) {
8177
+ useAgentsStore.getState().closeManager();
8178
+ } else {
8179
+ useAgentsStore.getState().openManager();
8180
+ }
8181
+ },
8182
+ setAgents: (agents, defaultAgent) => set((state) => ({
8183
+ agents,
8184
+ defaultAgent,
8185
+ selectedAgent: state.selectedAgent && agents.some((a) => a.name === state.selectedAgent) ? state.selectedAgent : agents.find((a) => a.name === defaultAgent)?.name ?? agents[0]?.name ?? null
8186
+ })),
8187
+ selectAgent: (agent) => set({ selectedAgent: agent }),
8188
+ backToList: () => set({ selectedAgent: null, editorPage: "overview" }),
8189
+ openAgentInManager: (agent) => set({
8190
+ isManagerOpen: true,
8191
+ isExpanded: true,
8192
+ managerMode: "workspace",
8193
+ selectedAgent: agent,
8194
+ editorPage: "overview",
8195
+ isCreateModalOpen: false
8196
+ }),
8197
+ setEditorPage: (page) => set({ editorPage: page }),
8198
+ openCreateModal: () => set({ isManagerOpen: true, isExpanded: true, isCreateModalOpen: true }),
8199
+ closeCreateModal: () => set({
8200
+ isCreateModalOpen: false,
8201
+ managerMode: "library",
8202
+ editorPage: "overview"
8203
+ })
8204
+ }));
8205
+
8206
+ // src/hooks/useAgents.ts
8207
+ function useAgentDetails(options = {}) {
8208
+ const managerOpen = useAgentsStore((s) => s.isManagerOpen);
8209
+ const createOpen = useAgentsStore((s) => s.isCreateModalOpen);
8210
+ const enabled = options.enabled ?? (managerOpen || createOpen);
8211
+ const setAgents = useAgentsStore((s) => s.setAgents);
8212
+ const selectedAgent = useAgentsStore((s) => s.selectedAgent);
8213
+ const selectAgent = useAgentsStore((s) => s.selectAgent);
8214
+ const query = useQuery8({
8215
+ queryKey: ["config", "agents"],
8216
+ queryFn: () => apiClient.getAgentDetails(),
8217
+ enabled,
8218
+ staleTime: 15000
8219
+ });
8220
+ useEffect15(() => {
8221
+ if (!query.data)
8222
+ return;
8223
+ setAgents(query.data.agents, query.data.default);
8224
+ if (!selectedAgent && query.data.agents.length > 0) {
8225
+ const defaultAgent = query.data.agents.find((agent) => agent.name === query.data.default);
8226
+ selectAgent(defaultAgent?.name ?? query.data.agents[0].name);
8227
+ }
8228
+ }, [query.data, selectAgent, selectedAgent, setAgents]);
8229
+ return query;
8230
+ }
8231
+ function useAgent(agentName) {
8232
+ return useQuery8({
8233
+ queryKey: ["config", "agents", agentName],
8234
+ queryFn: async () => {
8235
+ if (!agentName)
8236
+ return null;
8237
+ return apiClient.getAgent(agentName);
8238
+ },
8239
+ enabled: Boolean(agentName),
8240
+ staleTime: 15000
8241
+ });
8242
+ }
8243
+ function useConfigTools(options = {}) {
8244
+ const managerOpen = useAgentsStore((s) => s.isManagerOpen);
8245
+ const createOpen = useAgentsStore((s) => s.isCreateModalOpen);
8246
+ const enabled = options.enabled ?? (managerOpen || createOpen);
8247
+ return useQuery8({
8248
+ queryKey: ["config", "tools"],
8249
+ queryFn: () => apiClient.getConfigTools(),
8250
+ enabled,
8251
+ staleTime: 30000
8252
+ });
8253
+ }
8254
+ function useUpdateAgent() {
8255
+ const queryClient = useQueryClient7();
8256
+ return useMutation6({
8257
+ mutationFn: ({ name, input }) => apiClient.updateAgent(name, input),
8258
+ onSuccess: (data, variables) => {
8259
+ queryClient.setQueryData(["config", "agents", variables.name], data);
8260
+ queryClient.invalidateQueries({ queryKey: ["config", "agents"] });
8261
+ queryClient.invalidateQueries({ queryKey: ["config"] });
8262
+ }
8263
+ });
8264
+ }
8265
+ function useDeleteAgent() {
8266
+ const queryClient = useQueryClient7();
8267
+ const setAgents = useAgentsStore((s) => s.setAgents);
8268
+ const selectAgent = useAgentsStore((s) => s.selectAgent);
8269
+ return useMutation6({
8270
+ mutationFn: ({
8271
+ name,
8272
+ scope = "local"
8273
+ }) => apiClient.deleteAgent(name, scope),
8274
+ onSuccess: async (_data, variables) => {
8275
+ await queryClient.invalidateQueries({ queryKey: ["config", "agents"] });
8276
+ const refreshed = await queryClient.fetchQuery({
8277
+ queryKey: ["config", "agents"],
8278
+ queryFn: () => apiClient.getAgentDetails()
8279
+ });
8280
+ setAgents(refreshed.agents, refreshed.default);
8281
+ if (variables.name === useAgentsStore.getState().selectedAgent) {
8282
+ const next = refreshed.agents.find((a) => a.name === refreshed.default)?.name ?? refreshed.agents[0]?.name ?? null;
8283
+ selectAgent(next);
8284
+ }
8285
+ queryClient.invalidateQueries({ queryKey: ["config"] });
8286
+ }
8287
+ });
8288
+ }
8289
+ function useSetDefaultAgent() {
8290
+ const queryClient = useQueryClient7();
8291
+ return useMutation6({
8292
+ mutationFn: (name) => apiClient.updateDefaults({ agent: name, scope: "global" }),
8293
+ onSuccess: () => {
8294
+ queryClient.invalidateQueries({ queryKey: ["config", "agents"] });
8295
+ queryClient.invalidateQueries({ queryKey: ["config"] });
8296
+ }
8297
+ });
8298
+ }
8299
+ function getAgentToolCount(agent) {
8300
+ if (!agent)
8301
+ return 0;
8302
+ return Array.from(new Set([
8303
+ ...agent.toolConfig.firstClass ?? [],
8304
+ ...agent.toolConfig.loadable ?? []
8305
+ ])).length;
8306
+ }
8136
8307
 
8137
8308
  // src/hooks/useGit.ts
8138
- import { useQuery as useQuery8, useMutation as useMutation6, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
8309
+ import { useQuery as useQuery9, useMutation as useMutation7, useQueryClient as useQueryClient8 } from "@tanstack/react-query";
8139
8310
  function useGitStatus() {
8140
8311
  const isExpanded = useGitStore((state) => state.isExpanded);
8141
- return useQuery8({
8312
+ return useQuery9({
8142
8313
  queryKey: ["git", "status"],
8143
8314
  queryFn: () => apiClient.getGitStatus(),
8144
8315
  refetchInterval: isExpanded ? 5000 : false,
@@ -8147,7 +8318,7 @@ function useGitStatus() {
8147
8318
  });
8148
8319
  }
8149
8320
  function useGitDiff(file, staged = false) {
8150
- return useQuery8({
8321
+ return useQuery9({
8151
8322
  queryKey: ["git", "diff", file, staged],
8152
8323
  queryFn: () => file ? apiClient.getGitDiff(file, staged) : null,
8153
8324
  enabled: !!file,
@@ -8157,7 +8328,7 @@ function useGitDiff(file, staged = false) {
8157
8328
  }
8158
8329
  function useGitBranch() {
8159
8330
  const isExpanded = useGitStore((state) => state.isExpanded);
8160
- return useQuery8({
8331
+ return useQuery9({
8161
8332
  queryKey: ["git", "branch"],
8162
8333
  queryFn: () => apiClient.getGitBranch(),
8163
8334
  refetchInterval: isExpanded ? 1e4 : false,
@@ -8166,13 +8337,13 @@ function useGitBranch() {
8166
8337
  });
8167
8338
  }
8168
8339
  function useGenerateCommitMessage(sessionId) {
8169
- return useMutation6({
8340
+ return useMutation7({
8170
8341
  mutationFn: () => apiClient.generateCommitMessage(sessionId ?? undefined)
8171
8342
  });
8172
8343
  }
8173
8344
  function useStageFiles() {
8174
- const queryClient = useQueryClient7();
8175
- return useMutation6({
8345
+ const queryClient = useQueryClient8();
8346
+ return useMutation7({
8176
8347
  mutationFn: (files) => apiClient.stageFiles(files),
8177
8348
  onSuccess: () => {
8178
8349
  queryClient.invalidateQueries({ queryKey: ["git", "status"] });
@@ -8180,8 +8351,8 @@ function useStageFiles() {
8180
8351
  });
8181
8352
  }
8182
8353
  function useUnstageFiles() {
8183
- const queryClient = useQueryClient7();
8184
- return useMutation6({
8354
+ const queryClient = useQueryClient8();
8355
+ return useMutation7({
8185
8356
  mutationFn: (files) => apiClient.unstageFiles(files),
8186
8357
  onSuccess: () => {
8187
8358
  queryClient.invalidateQueries({ queryKey: ["git", "status"] });
@@ -8189,8 +8360,8 @@ function useUnstageFiles() {
8189
8360
  });
8190
8361
  }
8191
8362
  function useRestoreFiles() {
8192
- const queryClient = useQueryClient7();
8193
- return useMutation6({
8363
+ const queryClient = useQueryClient8();
8364
+ return useMutation7({
8194
8365
  mutationFn: (files) => apiClient.restoreFiles(files),
8195
8366
  onSuccess: () => {
8196
8367
  queryClient.invalidateQueries({ queryKey: ["git", "status"] });
@@ -8198,8 +8369,8 @@ function useRestoreFiles() {
8198
8369
  });
8199
8370
  }
8200
8371
  function useDeleteFiles() {
8201
- const queryClient = useQueryClient7();
8202
- return useMutation6({
8372
+ const queryClient = useQueryClient8();
8373
+ return useMutation7({
8203
8374
  mutationFn: (files) => apiClient.deleteFiles(files),
8204
8375
  onSuccess: () => {
8205
8376
  queryClient.invalidateQueries({ queryKey: ["git", "status"] });
@@ -8207,8 +8378,8 @@ function useDeleteFiles() {
8207
8378
  });
8208
8379
  }
8209
8380
  function useCommitChanges() {
8210
- const queryClient = useQueryClient7();
8211
- return useMutation6({
8381
+ const queryClient = useQueryClient8();
8382
+ return useMutation7({
8212
8383
  mutationFn: (message) => apiClient.commitChanges(message),
8213
8384
  onSuccess: () => {
8214
8385
  queryClient.invalidateQueries({ queryKey: ["git", "status"] });
@@ -8217,8 +8388,8 @@ function useCommitChanges() {
8217
8388
  });
8218
8389
  }
8219
8390
  function usePushCommits() {
8220
- const queryClient = useQueryClient7();
8221
- return useMutation6({
8391
+ const queryClient = useQueryClient8();
8392
+ return useMutation7({
8222
8393
  mutationFn: () => apiClient.pushCommits(),
8223
8394
  onSuccess: () => {
8224
8395
  queryClient.invalidateQueries({ queryKey: ["git", "status"] });
@@ -8227,8 +8398,8 @@ function usePushCommits() {
8227
8398
  });
8228
8399
  }
8229
8400
  function usePullChanges() {
8230
- const queryClient = useQueryClient7();
8231
- return useMutation6({
8401
+ const queryClient = useQueryClient8();
8402
+ return useMutation7({
8232
8403
  mutationFn: () => apiClient.pullChanges(),
8233
8404
  onSuccess: () => {
8234
8405
  queryClient.invalidateQueries({ queryKey: ["git", "status"] });
@@ -8237,8 +8408,8 @@ function usePullChanges() {
8237
8408
  });
8238
8409
  }
8239
8410
  function useGitRebaseAction() {
8240
- const queryClient = useQueryClient7();
8241
- return useMutation6({
8411
+ const queryClient = useQueryClient8();
8412
+ return useMutation7({
8242
8413
  mutationFn: (action) => apiClient.performRebaseAction(action),
8243
8414
  onSuccess: () => {
8244
8415
  queryClient.invalidateQueries({ queryKey: ["git", "status"] });
@@ -8247,8 +8418,8 @@ function useGitRebaseAction() {
8247
8418
  });
8248
8419
  }
8249
8420
  function useGitInit() {
8250
- const queryClient = useQueryClient7();
8251
- return useMutation6({
8421
+ const queryClient = useQueryClient8();
8422
+ return useMutation7({
8252
8423
  mutationFn: () => apiClient.initGitRepo(),
8253
8424
  onSuccess: () => {
8254
8425
  queryClient.invalidateQueries({ queryKey: ["git", "status"] });
@@ -8258,7 +8429,7 @@ function useGitInit() {
8258
8429
  }
8259
8430
  function useGitRemotes() {
8260
8431
  const isExpanded = useGitStore((state) => state.isExpanded);
8261
- return useQuery8({
8432
+ return useQuery9({
8262
8433
  queryKey: ["git", "remotes"],
8263
8434
  queryFn: () => apiClient.getRemotes(),
8264
8435
  enabled: isExpanded,
@@ -8267,8 +8438,8 @@ function useGitRemotes() {
8267
8438
  });
8268
8439
  }
8269
8440
  function useAddRemote() {
8270
- const queryClient = useQueryClient7();
8271
- return useMutation6({
8441
+ const queryClient = useQueryClient8();
8442
+ return useMutation7({
8272
8443
  mutationFn: ({ name, url }) => apiClient.addRemote(name, url),
8273
8444
  onSuccess: () => {
8274
8445
  queryClient.invalidateQueries({ queryKey: ["git", "remotes"] });
@@ -8277,8 +8448,8 @@ function useAddRemote() {
8277
8448
  });
8278
8449
  }
8279
8450
  function useRemoveRemote() {
8280
- const queryClient = useQueryClient7();
8281
- return useMutation6({
8451
+ const queryClient = useQueryClient8();
8452
+ return useMutation7({
8282
8453
  mutationFn: (name) => apiClient.removeRemote(name),
8283
8454
  onSuccess: () => {
8284
8455
  queryClient.invalidateQueries({ queryKey: ["git", "remotes"] });
@@ -8287,7 +8458,7 @@ function useRemoveRemote() {
8287
8458
  });
8288
8459
  }
8289
8460
  function useGitBranches(enabled = true) {
8290
- return useQuery8({
8461
+ return useQuery9({
8291
8462
  queryKey: ["git", "branches"],
8292
8463
  queryFn: () => apiClient.listGitBranches(),
8293
8464
  enabled,
@@ -8296,8 +8467,8 @@ function useGitBranches(enabled = true) {
8296
8467
  });
8297
8468
  }
8298
8469
  function useCheckoutBranch() {
8299
- const queryClient = useQueryClient7();
8300
- return useMutation6({
8470
+ const queryClient = useQueryClient8();
8471
+ return useMutation7({
8301
8472
  mutationFn: (branch) => apiClient.checkoutBranch(branch),
8302
8473
  onSuccess: () => {
8303
8474
  queryClient.invalidateQueries({ queryKey: ["git", "status"] });
@@ -8307,8 +8478,8 @@ function useCheckoutBranch() {
8307
8478
  });
8308
8479
  }
8309
8480
  function useCreateGitBranch() {
8310
- const queryClient = useQueryClient7();
8311
- return useMutation6({
8481
+ const queryClient = useQueryClient8();
8482
+ return useMutation7({
8312
8483
  mutationFn: ({
8313
8484
  name,
8314
8485
  startPoint,
@@ -8326,7 +8497,7 @@ function useCreateGitBranch() {
8326
8497
  import {
8327
8498
  useState as useState15,
8328
8499
  useCallback as useCallback16,
8329
- useEffect as useEffect15
8500
+ useEffect as useEffect16
8330
8501
  } from "react";
8331
8502
  import { uploadAttachment } from "@ottocode/api";
8332
8503
  var IMAGE_TYPES = ["image/png", "image/jpeg", "image/gif", "image/webp"];
@@ -8615,7 +8786,7 @@ function useFileUpload(options = {}) {
8615
8786
  addFiles(pastedFiles);
8616
8787
  }
8617
8788
  }, [addFiles]);
8618
- useEffect15(() => {
8789
+ useEffect16(() => {
8619
8790
  if (!pageWide)
8620
8791
  return;
8621
8792
  let dragCounter = 0;
@@ -8678,8 +8849,8 @@ function useFileUpload(options = {}) {
8678
8849
  }
8679
8850
 
8680
8851
  // src/stores/pendingResearchStore.ts
8681
- import { create as create18 } from "zustand";
8682
- var usePendingResearchStore = create18((set, get) => ({
8852
+ import { create as create19 } from "zustand";
8853
+ var usePendingResearchStore = create19((set, get) => ({
8683
8854
  pendingContexts: new Map,
8684
8855
  addContext: (parentSessionId, context) => {
8685
8856
  set((state) => {
@@ -8717,9 +8888,9 @@ var usePendingResearchStore = create18((set, get) => ({
8717
8888
  }));
8718
8889
 
8719
8890
  // src/stores/fileSelectionStore.ts
8720
- import { create as create19 } from "zustand";
8891
+ import { create as create20 } from "zustand";
8721
8892
  var NEW_SESSION_FILE_SELECTIONS_KEY = "__new-session__";
8722
- var useFileSelectionStore = create19((set, get) => ({
8893
+ var useFileSelectionStore = create20((set, get) => ({
8723
8894
  activeSelection: null,
8724
8895
  pendingSelections: new Map,
8725
8896
  setActiveSelection: (selection) => set({ activeSelection: selection }),
@@ -8859,12 +9030,12 @@ function parseFileSelections(content) {
8859
9030
  }
8860
9031
 
8861
9032
  // src/components/chat/ConfigModal.tsx
8862
- import { useEffect as useEffect18, useRef as useRef10 } from "react";
9033
+ import { useEffect as useEffect19, useMemo as useMemo13, useRef as useRef10 } from "react";
8863
9034
 
8864
9035
  // src/components/chat/UnifiedModelSelector.tsx
8865
9036
  import {
8866
9037
  useState as useState16,
8867
- useEffect as useEffect16,
9038
+ useEffect as useEffect17,
8868
9039
  useRef as useRef7,
8869
9040
  useMemo as useMemo11,
8870
9041
  useImperativeHandle as useImperativeHandle2,
@@ -8897,7 +9068,7 @@ var UnifiedModelSelector = forwardRef6(function UnifiedModelSelector2({
8897
9068
  const menuRef = useRef7(null);
8898
9069
  const [menuStyle, setMenuStyle] = useState16({});
8899
9070
  const itemRefs = useRef7([]);
8900
- useEffect16(() => {
9071
+ useEffect17(() => {
8901
9072
  if (!allModels)
8902
9073
  return;
8903
9074
  setLoadedModels((prev) => {
@@ -8918,7 +9089,7 @@ var UnifiedModelSelector = forwardRef6(function UnifiedModelSelector2({
8918
9089
  }
8919
9090
  return [provider, ...providers];
8920
9091
  }, [allModels, provider]);
8921
- useEffect16(() => {
9092
+ useEffect17(() => {
8922
9093
  if (!provider || !currentProviderModels)
8923
9094
  return;
8924
9095
  setLoadedModels((prev) => ({
@@ -8931,7 +9102,7 @@ var UnifiedModelSelector = forwardRef6(function UnifiedModelSelector2({
8931
9102
  }));
8932
9103
  setHydratedProviders((prev) => ({ ...prev, [provider]: true }));
8933
9104
  }, [currentProviderModels, provider]);
8934
- useEffect16(() => {
9105
+ useEffect17(() => {
8935
9106
  if (!isOpen || !configuredProviders.length)
8936
9107
  return;
8937
9108
  for (const providerId of configuredProviders) {
@@ -9075,12 +9246,12 @@ var UnifiedModelSelector = forwardRef6(function UnifiedModelSelector2({
9075
9246
  }
9076
9247
  return list;
9077
9248
  }, [filteredModels]);
9078
- useEffect16(() => {
9249
+ useEffect17(() => {
9079
9250
  if (isOpen) {
9080
9251
  setHighlightedIndex(0);
9081
9252
  }
9082
9253
  }, [isOpen]);
9083
- useEffect16(() => {
9254
+ useEffect17(() => {
9084
9255
  if (isOpen && highlightedIndex >= 0 && highlightedIndex < itemRefs.current.length) {
9085
9256
  itemRefs.current[highlightedIndex]?.scrollIntoView({
9086
9257
  block: "nearest",
@@ -9088,7 +9259,7 @@ var UnifiedModelSelector = forwardRef6(function UnifiedModelSelector2({
9088
9259
  });
9089
9260
  }
9090
9261
  }, [highlightedIndex, isOpen]);
9091
- useEffect16(() => {
9262
+ useEffect17(() => {
9092
9263
  const handleClickOutside = (event) => {
9093
9264
  if (dropdownRef.current && !dropdownRef.current.contains(event.target) && (!menuRef.current || !menuRef.current.contains(event.target))) {
9094
9265
  setIsOpen(false);
@@ -9315,7 +9486,7 @@ var UnifiedModelSelector = forwardRef6(function UnifiedModelSelector2({
9315
9486
  // src/components/chat/UnifiedAgentSelector.tsx
9316
9487
  import {
9317
9488
  useState as useState17,
9318
- useEffect as useEffect17,
9489
+ useEffect as useEffect18,
9319
9490
  useRef as useRef8,
9320
9491
  useMemo as useMemo12,
9321
9492
  useImperativeHandle as useImperativeHandle3,
@@ -9348,12 +9519,12 @@ var UnifiedAgentSelector = forwardRef7(function UnifiedAgentSelector2({ agent, a
9348
9519
  const results = fuse.search(searchQuery);
9349
9520
  return results.map((result) => result.item);
9350
9521
  }, [agents, searchQuery, fuse]);
9351
- useEffect17(() => {
9522
+ useEffect18(() => {
9352
9523
  if (isOpen) {
9353
9524
  setHighlightedIndex(0);
9354
9525
  }
9355
9526
  }, [isOpen]);
9356
- useEffect17(() => {
9527
+ useEffect18(() => {
9357
9528
  if (isOpen && highlightedIndex >= 0 && highlightedIndex < itemRefs.current.length) {
9358
9529
  itemRefs.current[highlightedIndex]?.scrollIntoView({
9359
9530
  block: "nearest",
@@ -9361,7 +9532,7 @@ var UnifiedAgentSelector = forwardRef7(function UnifiedAgentSelector2({ agent, a
9361
9532
  });
9362
9533
  }
9363
9534
  }, [highlightedIndex, isOpen]);
9364
- useEffect17(() => {
9535
+ useEffect18(() => {
9365
9536
  const handleClickOutside = (event) => {
9366
9537
  if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
9367
9538
  setIsOpen(false);
@@ -9550,12 +9721,14 @@ function ConfigModal({
9550
9721
  modalPosition = "fixed"
9551
9722
  }) {
9552
9723
  const { data: config2, isLoading: configLoading } = useConfig();
9724
+ const { data: agentDetails } = useAgentDetails({ enabled: true });
9553
9725
  const updateDefaults = useUpdateDefaults();
9554
9726
  const reasoningEnabled = config2?.defaults?.reasoningText ?? true;
9555
9727
  const reasoningLevel = config2?.defaults?.reasoningLevel ?? "high";
9728
+ const agentNames = useMemo13(() => agentDetails?.agents.length ? agentDetails.agents.map((agentDetail) => agentDetail.name) : config2?.agents ?? [], [agentDetails?.agents, config2?.agents]);
9556
9729
  const agentSelectorRef = useRef10(null);
9557
9730
  const modelSelectorRef = useRef10(null);
9558
- useEffect18(() => {
9731
+ useEffect19(() => {
9559
9732
  if (isOpen && initialFocus) {
9560
9733
  setTimeout(() => {
9561
9734
  if (initialFocus === "agent") {
@@ -9638,7 +9811,7 @@ function ConfigModal({
9638
9811
  /* @__PURE__ */ jsx27(UnifiedAgentSelector, {
9639
9812
  ref: agentSelectorRef,
9640
9813
  agent,
9641
- agents: config2.agents,
9814
+ agents: agentNames,
9642
9815
  onChange: onAgentChange
9643
9816
  })
9644
9817
  ]
@@ -9694,15 +9867,17 @@ var ChatInputContainer = memo10(forwardRef8(function ChatInputContainer2({
9694
9867
  const deleteSession = useDeleteSession();
9695
9868
  const { data: allModels } = useAllModels();
9696
9869
  const { data: config2 } = useConfig();
9870
+ const { data: agentDetails } = useAgentDetails({ enabled: true });
9697
9871
  const stageFiles = useStageFiles();
9698
9872
  const openCommitModalForSession = useGitStore((state) => state.openCommitModalForSession);
9699
9873
  const setActiveSessionId = useGitStore((state) => state.setActiveSessionId);
9700
- const queryClient = useQueryClient8();
9701
- const selectedModel = useMemo13(() => allModels?.[provider]?.models?.find((m) => m.id === model), [allModels, provider, model]);
9874
+ const queryClient = useQueryClient9();
9875
+ const selectedModel = useMemo14(() => allModels?.[provider]?.models?.find((m) => m.id === model), [allModels, provider, model]);
9702
9876
  const modelSupportsReasoning = selectedModel?.reasoningText;
9703
9877
  const modelSupportsVision = selectedModel?.vision;
9704
9878
  const modelSupportsAttachment = selectedModel?.attachment;
9705
9879
  const modelIsFree = selectedModel?.free;
9880
+ const agentNames = useMemo14(() => agentDetails?.agents.length ? agentDetails.agents.map((agentDetail) => agentDetail.name) : config2?.agents ?? [], [agentDetails?.agents, config2?.agents]);
9706
9881
  const {
9707
9882
  images,
9708
9883
  documents,
@@ -9724,11 +9899,11 @@ var ChatInputContainer = memo10(forwardRef8(function ChatInputContainer2({
9724
9899
  const clearFileSelections = useFileSelectionStore((state) => state.clearSelections);
9725
9900
  const pendingResearchContexts = pendingContextsMap.get(sessionId) || [];
9726
9901
  const pendingFileSelections = pendingFileSelectionsMap.get(sessionId) || [];
9727
- const researchContexts = useMemo13(() => pendingResearchContexts.map((ctx) => ({
9902
+ const researchContexts = useMemo14(() => pendingResearchContexts.map((ctx) => ({
9728
9903
  id: ctx.id,
9729
9904
  label: ctx.label
9730
9905
  })), [pendingResearchContexts]);
9731
- const fileSelectionContexts = useMemo13(() => pendingFileSelections.map((selection) => ({
9906
+ const fileSelectionContexts = useMemo14(() => pendingFileSelections.map((selection) => ({
9732
9907
  id: selection.id,
9733
9908
  label: selection.label
9734
9909
  })), [pendingFileSelections]);
@@ -9740,23 +9915,23 @@ var ChatInputContainer = memo10(forwardRef8(function ChatInputContainer2({
9740
9915
  }, [sessionId, removeFileSelection]);
9741
9916
  const providerAuthType = allModels?.[provider]?.authType;
9742
9917
  const isCustomProvider = allModels?.[provider]?.label?.includes("(custom)") ?? false;
9743
- useEffect19(() => {
9918
+ useEffect20(() => {
9744
9919
  if (session) {
9745
9920
  setAgent(session.agent);
9746
9921
  setProvider(session.provider);
9747
9922
  setModel(session.model);
9748
9923
  }
9749
9924
  }, [session]);
9750
- useEffect19(() => {
9925
+ useEffect20(() => {
9751
9926
  setActiveSessionId(sessionId);
9752
9927
  return () => setActiveSessionId(null);
9753
9928
  }, [sessionId, setActiveSessionId]);
9754
- useEffect19(() => {
9929
+ useEffect20(() => {
9755
9930
  setInputKey((prev) => prev + 1);
9756
9931
  }, []);
9757
9932
  const pendingRestoreText = useQueueStore((state) => state.pendingRestoreText);
9758
9933
  const consumeRestoreText = useQueueStore((state) => state.consumeRestoreText);
9759
- useEffect19(() => {
9934
+ useEffect20(() => {
9760
9935
  if (pendingRestoreText) {
9761
9936
  const text = consumeRestoreText();
9762
9937
  if (text) {
@@ -9944,12 +10119,29 @@ var ChatInputContainer = memo10(forwardRef8(function ChatInputContainer2({
9944
10119
  ]);
9945
10120
  const handleAgentChange = useCallback17(async (value) => {
9946
10121
  setAgent(value);
10122
+ const selectedAgent = agentDetails?.agents.find((agentDetail) => agentDetail.name === value);
10123
+ const update = selectedAgent ? {
10124
+ agent: value,
10125
+ provider: selectedAgent.provider ?? config2?.defaults?.provider ?? provider,
10126
+ model: selectedAgent.model ?? config2?.defaults?.model ?? model
10127
+ } : { agent: value };
10128
+ if ("provider" in update)
10129
+ setProvider(update.provider);
10130
+ if ("model" in update)
10131
+ setModel(update.model);
9947
10132
  try {
9948
- await updateSession.mutateAsync({ agent: value });
10133
+ await updateSession.mutateAsync(update);
9949
10134
  } catch (error) {
9950
10135
  console.error("Failed to update agent:", error);
9951
10136
  }
9952
- }, [updateSession]);
10137
+ }, [
10138
+ agentDetails?.agents,
10139
+ config2?.defaults?.model,
10140
+ config2?.defaults?.provider,
10141
+ model,
10142
+ provider,
10143
+ updateSession
10144
+ ]);
9953
10145
  const handleModelSelectorChange = useCallback17(async (newProvider, newModel) => {
9954
10146
  setProvider(newProvider);
9955
10147
  setModel(newModel);
@@ -9985,13 +10177,8 @@ var ChatInputContainer = memo10(forwardRef8(function ChatInputContainer2({
9985
10177
  }, [provider, updateSession]);
9986
10178
  const handlePlanModeToggle = useCallback17(async (isPlanMode) => {
9987
10179
  const newAgent = isPlanMode ? "plan" : "build";
9988
- setAgent(newAgent);
9989
- try {
9990
- await updateSession.mutateAsync({ agent: newAgent });
9991
- } catch (error) {
9992
- console.error("Failed to switch agent:", error);
9993
- }
9994
- }, [updateSession]);
10180
+ await handleAgentChange(newAgent);
10181
+ }, [handleAgentChange]);
9995
10182
  const openConfigRef = useRef11(null);
9996
10183
  const handleOpenConfigReady = useCallback17((openConfig) => {
9997
10184
  openConfigRef.current = openConfig;
@@ -10036,7 +10223,7 @@ var ChatInputContainer = memo10(forwardRef8(function ChatInputContainer2({
10036
10223
  onFileSelectionContextRemove: handleFileSelectionContextRemove,
10037
10224
  onModelInfoClick: openModelConfig,
10038
10225
  agent,
10039
- agents: config2?.agents,
10226
+ agents: agentNames,
10040
10227
  onAgentChange: handleAgentChange
10041
10228
  }, inputKey)
10042
10229
  });
@@ -10061,7 +10248,7 @@ var ChatConfigModalHost = memo10(function ChatConfigModalHost2({
10061
10248
  setConfigFocusTarget(target);
10062
10249
  setIsConfigOpen(true);
10063
10250
  }, []);
10064
- useEffect19(() => {
10251
+ useEffect20(() => {
10065
10252
  onOpenConfigReady(openConfig);
10066
10253
  }, [onOpenConfigReady, openConfig]);
10067
10254
  const toggleConfig = useCallback17(() => {
@@ -10074,7 +10261,7 @@ var ChatConfigModalHost = memo10(function ChatConfigModalHost2({
10074
10261
  const openModelConfig = useCallback17(() => {
10075
10262
  openConfig("model");
10076
10263
  }, [openConfig]);
10077
- const controls = useMemo13(() => ({ openConfig, openModelConfig, toggleConfig }), [openConfig, openModelConfig, toggleConfig]);
10264
+ const controls = useMemo14(() => ({ openConfig, openModelConfig, toggleConfig }), [openConfig, openModelConfig, toggleConfig]);
10078
10265
  return /* @__PURE__ */ jsxs21(Fragment7, {
10079
10266
  children: [
10080
10267
  isConfigOpen ? /* @__PURE__ */ jsx28(ConfigModal, {
@@ -10097,7 +10284,7 @@ var ChatConfigModalHost = memo10(function ChatConfigModalHost2({
10097
10284
  });
10098
10285
  });
10099
10286
  // src/components/chat/ConfigSelector.tsx
10100
- import { useEffect as useEffect20 } from "react";
10287
+ import { useEffect as useEffect21 } from "react";
10101
10288
  import { Settings } from "lucide-react";
10102
10289
  import { jsx as jsx29, jsxs as jsxs22 } from "react/jsx-runtime";
10103
10290
  function ConfigSelector({
@@ -10118,7 +10305,7 @@ function ConfigSelector({
10118
10305
  provider,
10119
10306
  model
10120
10307
  });
10121
- useEffect20(() => {
10308
+ useEffect21(() => {
10122
10309
  if (config2 && !agent && !provider && !model) {
10123
10310
  onAgentChange(config2.defaults.agent);
10124
10311
  onProviderChange(config2.defaults.provider);
@@ -10133,7 +10320,7 @@ function ConfigSelector({
10133
10320
  onProviderChange,
10134
10321
  onModelChange
10135
10322
  ]);
10136
- useEffect20(() => {
10323
+ useEffect21(() => {
10137
10324
  if (modelsData && modelsData.models.length > 0) {
10138
10325
  const currentModelExists = modelsData.models.some((m) => m.id === model);
10139
10326
  if (!currentModelExists) {
@@ -10241,15 +10428,15 @@ import {
10241
10428
  useRef as useRef12,
10242
10429
  forwardRef as forwardRef9,
10243
10430
  useImperativeHandle as useImperativeHandle5,
10244
- useEffect as useEffect21,
10245
- useMemo as useMemo14
10431
+ useEffect as useEffect22,
10432
+ useMemo as useMemo15
10246
10433
  } from "react";
10247
- import { useQueryClient as useQueryClient9 } from "@tanstack/react-query";
10434
+ import { useQueryClient as useQueryClient10 } from "@tanstack/react-query";
10248
10435
  import { jsx as jsx31, jsxs as jsxs23 } from "react/jsx-runtime";
10249
10436
  var NewSessionLanding = memo11(forwardRef9(function NewSessionLanding2({ onSessionCreated, defaultAgent, wordmark, compact, modalPosition }, ref) {
10250
10437
  const { data: config2 } = useConfig();
10251
10438
  const { data: allModels } = useAllModels();
10252
- const queryClient = useQueryClient9();
10439
+ const queryClient = useQueryClient10();
10253
10440
  const [sending, setSending] = useState21(false);
10254
10441
  const [transitioning, setTransitioning] = useState21(false);
10255
10442
  const pendingSessionIdRef = useRef12(null);
@@ -10260,7 +10447,7 @@ var NewSessionLanding = memo11(forwardRef9(function NewSessionLanding2({ onSessi
10260
10447
  const [configFocusTarget, setConfigFocusTarget] = useState21(null);
10261
10448
  const chatInputRef = useRef12(null);
10262
10449
  const initializedRef = useRef12(false);
10263
- useEffect21(() => {
10450
+ useEffect22(() => {
10264
10451
  if (initializedRef.current || !config2?.defaults)
10265
10452
  return;
10266
10453
  initializedRef.current = true;
@@ -10290,7 +10477,7 @@ var NewSessionLanding = memo11(forwardRef9(function NewSessionLanding2({ onSessi
10290
10477
  const removeFileSelection = useFileSelectionStore((state) => state.removeSelectionFromSession);
10291
10478
  const clearFileSelections = useFileSelectionStore((state) => state.clearSelections);
10292
10479
  const pendingFileSelections = pendingFileSelectionsMap.get(NEW_SESSION_FILE_SELECTIONS_KEY) ?? [];
10293
- const fileSelectionContexts = useMemo14(() => pendingFileSelections.map((selection) => ({
10480
+ const fileSelectionContexts = useMemo15(() => pendingFileSelections.map((selection) => ({
10294
10481
  id: selection.id,
10295
10482
  label: selection.label
10296
10483
  })), [pendingFileSelections]);
@@ -10302,7 +10489,7 @@ var NewSessionLanding = memo11(forwardRef9(function NewSessionLanding2({ onSessi
10302
10489
  chatInputRef.current?.focus();
10303
10490
  }
10304
10491
  }));
10305
- useEffect21(() => {
10492
+ useEffect22(() => {
10306
10493
  const timer = setTimeout(() => {
10307
10494
  chatInputRef.current?.focus();
10308
10495
  }, 100);
@@ -10415,7 +10602,7 @@ var NewSessionLanding = memo11(forwardRef9(function NewSessionLanding2({ onSessi
10415
10602
  queryClient,
10416
10603
  modelSupportsReasoning
10417
10604
  ]);
10418
- const defaultWordmark = useMemo14(() => /* @__PURE__ */ jsx31("svg", {
10605
+ const defaultWordmark = useMemo15(() => /* @__PURE__ */ jsx31("svg", {
10419
10606
  width: compact ? 60 : 80,
10420
10607
  height: compact ? 24 : 32,
10421
10608
  viewBox: "0 0 748 303",
@@ -10497,18 +10684,18 @@ var NewSessionLanding = memo11(forwardRef9(function NewSessionLanding2({ onSessi
10497
10684
  import {
10498
10685
  memo as memo23,
10499
10686
  useCallback as useCallback26,
10500
- useEffect as useEffect38,
10687
+ useEffect as useEffect39,
10501
10688
  useLayoutEffect as useLayoutEffect7,
10502
- useMemo as useMemo22,
10689
+ useMemo as useMemo23,
10503
10690
  useRef as useRef24,
10504
10691
  useState as useState40
10505
10692
  } from "react";
10506
- import { useQueryClient as useQueryClient15 } from "@tanstack/react-query";
10693
+ import { useQueryClient as useQueryClient16 } from "@tanstack/react-query";
10507
10694
  import { X as X15 } from "lucide-react";
10508
10695
 
10509
10696
  // src/stores/btwStore.ts
10510
- import { create as create20 } from "zustand";
10511
- var useBtwStore = create20((set) => ({
10697
+ import { create as create21 } from "zustand";
10698
+ var useBtwStore = create21((set) => ({
10512
10699
  isOpen: false,
10513
10700
  selection: null,
10514
10701
  parentSessionId: null,
@@ -10532,12 +10719,12 @@ var useBtwStore = create20((set) => ({
10532
10719
  }));
10533
10720
 
10534
10721
  // src/components/messages/MessageThreadContainer.tsx
10535
- import { memo as memo22, useEffect as useEffect37, useMemo as useMemo21 } from "react";
10536
- import { useQueryClient as useQueryClient14 } from "@tanstack/react-query";
10722
+ import { memo as memo22, useEffect as useEffect38, useMemo as useMemo22 } from "react";
10723
+ import { useQueryClient as useQueryClient15 } from "@tanstack/react-query";
10537
10724
 
10538
10725
  // src/hooks/useSessionStream.ts
10539
- import { useEffect as useEffect22, useRef as useRef13 } from "react";
10540
- import { useQueryClient as useQueryClient10 } from "@tanstack/react-query";
10726
+ import { useEffect as useEffect23, useRef as useRef13 } from "react";
10727
+ import { useQueryClient as useQueryClient11 } from "@tanstack/react-query";
10541
10728
 
10542
10729
  // src/lib/sse-client.ts
10543
10730
  class SSEClient {
@@ -10662,7 +10849,7 @@ var STREAMING_TOOL_INPUT_HEAD_CHARS = 8000;
10662
10849
  var STREAMING_TOOL_INPUT_TAIL_CHARS = 16000;
10663
10850
  var STREAMING_TOOL_MESSAGE_THROTTLE_MS = 500;
10664
10851
  function useSessionStream(sessionId, enabled = true) {
10665
- const queryClient = useQueryClient10();
10852
+ const queryClient = useQueryClient11();
10666
10853
  const clientRef = useRef13(null);
10667
10854
  const assistantMessageIdRef = useRef13(null);
10668
10855
  const toolInputBuffersRef = useRef13(new Map);
@@ -10675,7 +10862,7 @@ function useSessionStream(sessionId, enabled = true) {
10675
10862
  setPendingApprovals
10676
10863
  } = useToolApprovalStore();
10677
10864
  const { addPendingInput, removePendingInput, setPendingInputs } = useSecureInputStore();
10678
- useEffect22(() => {
10865
+ useEffect23(() => {
10679
10866
  if (!sessionId || !enabled) {
10680
10867
  return;
10681
10868
  }
@@ -12150,16 +12337,16 @@ ${bestEffortUnescapeJsonString(rawTail)}`;
12150
12337
 
12151
12338
  // src/components/messages/MessageThread.tsx
12152
12339
  import {
12153
- useEffect as useEffect34,
12340
+ useEffect as useEffect35,
12154
12341
  useRef as useRef22,
12155
12342
  useState as useState38,
12156
- useMemo as useMemo20,
12343
+ useMemo as useMemo21,
12157
12344
  memo as memo19,
12158
12345
  useCallback as useCallback23,
12159
12346
  useLayoutEffect as useLayoutEffect6
12160
12347
  } from "react";
12161
12348
  import { ArrowDown } from "lucide-react";
12162
- import { useQueryClient as useQueryClient13 } from "@tanstack/react-query";
12349
+ import { useQueryClient as useQueryClient14 } from "@tanstack/react-query";
12163
12350
  import { Virtuoso } from "react-virtuoso";
12164
12351
 
12165
12352
  // src/components/messages/AssistantMessageGroup.tsx
@@ -12168,8 +12355,8 @@ import {
12168
12355
  memo as memo14,
12169
12356
  useState as useState33,
12170
12357
  useCallback as useCallback19,
12171
- useMemo as useMemo16,
12172
- useEffect as useEffect29
12358
+ useMemo as useMemo17,
12359
+ useEffect as useEffect30
12173
12360
  } from "react";
12174
12361
  import {
12175
12362
  Sparkles as Sparkles4,
@@ -13689,7 +13876,7 @@ function WriteRenderer({
13689
13876
  }
13690
13877
 
13691
13878
  // src/components/messages/renderers/BashRenderer.tsx
13692
- import { useEffect as useEffect23 } from "react";
13879
+ import { useEffect as useEffect24 } from "react";
13693
13880
  import { Terminal as Terminal3 } from "lucide-react";
13694
13881
  import { Prism as SyntaxHighlighter4 } from "react-syntax-highlighter";
13695
13882
  import {
@@ -13756,7 +13943,7 @@ function BashRenderer({
13756
13943
  onToggle,
13757
13944
  compact
13758
13945
  }) {
13759
- useEffect23(() => {
13946
+ useEffect24(() => {
13760
13947
  loadNerdFont();
13761
13948
  }, []);
13762
13949
  const result = contentJson.result || {};
@@ -16563,7 +16750,7 @@ function DatabaseToolRenderer({
16563
16750
  }
16564
16751
 
16565
16752
  // src/components/messages/renderers/TerminalRenderer.tsx
16566
- import { useEffect as useEffect24, useState as useState26 } from "react";
16753
+ import { useEffect as useEffect25, useState as useState26 } from "react";
16567
16754
  import { Terminal as Terminal4 } from "lucide-react";
16568
16755
  import { jsx as jsx60, jsxs as jsxs51, Fragment as Fragment24 } from "react/jsx-runtime";
16569
16756
  var ANSI_RE = /[\x1B\x9B][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nq-uy=><~]/g;
@@ -16582,7 +16769,7 @@ function TerminalRenderer({
16582
16769
  compact
16583
16770
  }) {
16584
16771
  const [, setFontReady] = useState26(false);
16585
- useEffect24(() => {
16772
+ useEffect25(() => {
16586
16773
  loadNerdFont().then(() => setFontReady(true));
16587
16774
  }, []);
16588
16775
  const result = contentJson.result || {};
@@ -17553,7 +17740,7 @@ function formatFileSize(bytes) {
17553
17740
  return `${(kb / 1024).toFixed(1)}MB`;
17554
17741
  }
17555
17742
  // src/components/messages/renderers/ReasoningRenderer.tsx
17556
- import { useState as useState27, useRef as useRef14, useEffect as useEffect25 } from "react";
17743
+ import { useState as useState27, useRef as useRef14, useEffect as useEffect26 } from "react";
17557
17744
  import { ChevronDown as ChevronDown7, ChevronRight as ChevronRight11 } from "lucide-react";
17558
17745
  import { jsx as jsx66, jsxs as jsxs57 } from "react/jsx-runtime";
17559
17746
  function ReasoningRenderer({ part }) {
@@ -17567,7 +17754,7 @@ function ReasoningRenderer({ part }) {
17567
17754
  } else if (typeof data === "string") {
17568
17755
  content = data;
17569
17756
  }
17570
- useEffect25(() => {
17757
+ useEffect26(() => {
17571
17758
  if (scrollRef.current && isExpanded && !part.completedAt && !isHoveredRef.current) {
17572
17759
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
17573
17760
  }
@@ -18375,7 +18562,7 @@ var MessagePartItem = memo13(function MessagePartItem2({
18375
18562
  });
18376
18563
 
18377
18564
  // src/components/messages/CompactActivityGroup.tsx
18378
- import { useEffect as useEffect26, useLayoutEffect as useLayoutEffect3, useMemo as useMemo15, useRef as useRef15, useState as useState29 } from "react";
18565
+ import { useEffect as useEffect27, useLayoutEffect as useLayoutEffect3, useMemo as useMemo16, useRef as useRef15, useState as useState29 } from "react";
18379
18566
  import { Brain as Brain4, Search as Search6 } from "lucide-react";
18380
18567
 
18381
18568
  // src/components/messages/compactActivity.ts
@@ -18746,13 +18933,13 @@ function CompactActivityGroup({
18746
18933
  const hoveredRef = useRef15(false);
18747
18934
  const prevCountRef = useRef15(entries.length);
18748
18935
  const [contentHeight, setContentHeight] = useState29(0);
18749
- const summary = useMemo15(() => summarizeCompactActivities(entries), [entries]);
18936
+ const summary = useMemo16(() => summarizeCompactActivities(entries), [entries]);
18750
18937
  const summaryTitle = titleOverride || summary.title;
18751
18938
  const summaryText = [summaryTitle, ...summary.details].join(" · ");
18752
18939
  const hasReasoning = entries.some((e) => e.toolName === "reasoning");
18753
18940
  const lastEntry = entries.length > 0 ? entries[entries.length - 1] : null;
18754
18941
  const shouldRenderLiveEntries = !showSummary;
18755
- useEffect26(() => {
18942
+ useEffect27(() => {
18756
18943
  if (!collapsed) {
18757
18944
  setLatched(false);
18758
18945
  setShowSummary(false);
@@ -18783,14 +18970,14 @@ function CompactActivityGroup({
18783
18970
  observer.observe(el);
18784
18971
  return () => observer.disconnect();
18785
18972
  }, [showSummary]);
18786
- useEffect26(() => {
18973
+ useEffect27(() => {
18787
18974
  return () => {
18788
18975
  if (scrollAnimationRef.current !== null) {
18789
18976
  window.cancelAnimationFrame(scrollAnimationRef.current);
18790
18977
  }
18791
18978
  };
18792
18979
  }, []);
18793
- useEffect26(() => {
18980
+ useEffect27(() => {
18794
18981
  if (showSummary || hoveredRef.current)
18795
18982
  return;
18796
18983
  const el = scrollRef.current;
@@ -18827,7 +19014,7 @@ function CompactActivityGroup({
18827
19014
  };
18828
19015
  scrollAnimationRef.current = window.requestAnimationFrame(tick);
18829
19016
  }, [entries.length, lastEntry?.fullText, showSummary, contentHeight]);
18830
- useEffect26(() => {
19017
+ useEffect27(() => {
18831
19018
  prevCountRef.current = entries.length;
18832
19019
  }, [entries.length]);
18833
19020
  const isLive = !showSummary;
@@ -18950,7 +19137,7 @@ function CompactActivityGroup({
18950
19137
  }
18951
19138
 
18952
19139
  // src/components/messages/CompactionSummaryBox.tsx
18953
- import { useEffect as useEffect27, useLayoutEffect as useLayoutEffect4, useRef as useRef16, useState as useState30 } from "react";
19140
+ import { useEffect as useEffect28, useLayoutEffect as useLayoutEffect4, useRef as useRef16, useState as useState30 } from "react";
18954
19141
  import { Package } from "lucide-react";
18955
19142
 
18956
19143
  // src/components/messages/compactionSummary.ts
@@ -19032,7 +19219,7 @@ function CompactionSummaryBox({
19032
19219
  const collapsedSummary = summarizeCompactionText(summaryText);
19033
19220
  const [showSummary, setShowSummary] = useState30(() => isComplete);
19034
19221
  const [latched, setLatched] = useState30(() => isComplete);
19035
- useEffect27(() => {
19222
+ useEffect28(() => {
19036
19223
  if (!isComplete && !latched) {
19037
19224
  setShowSummary(false);
19038
19225
  return;
@@ -19058,14 +19245,14 @@ function CompactionSummaryBox({
19058
19245
  const nextHeight = Math.min(el.scrollHeight, MAX_SCROLL_H2 - 12);
19059
19246
  setContentHeight((prev) => prev === nextHeight ? prev : nextHeight);
19060
19247
  }, [summaryText, hasSummaryText]);
19061
- useEffect27(() => {
19248
+ useEffect28(() => {
19062
19249
  return () => {
19063
19250
  if (scrollAnimationRef.current !== null) {
19064
19251
  window.cancelAnimationFrame(scrollAnimationRef.current);
19065
19252
  }
19066
19253
  };
19067
19254
  }, []);
19068
- useEffect27(() => {
19255
+ useEffect28(() => {
19069
19256
  const el = scrollRef.current;
19070
19257
  if (!el || hoveredRef.current || showSummary)
19071
19258
  return;
@@ -19235,7 +19422,7 @@ function CompactionSummaryBox({
19235
19422
  }
19236
19423
 
19237
19424
  // src/components/messages/ActionToolBox.tsx
19238
- import { useEffect as useEffect28, useLayoutEffect as useLayoutEffect5, useRef as useRef17, useState as useState31 } from "react";
19425
+ import { useEffect as useEffect29, useLayoutEffect as useLayoutEffect5, useRef as useRef17, useState as useState31 } from "react";
19239
19426
  import { Terminal as Terminal6, FileEdit as FileEdit3, Diff as Diff2 } from "lucide-react";
19240
19427
  import { jsx as jsx72, jsxs as jsxs61, Fragment as Fragment32 } from "react/jsx-runtime";
19241
19428
  var ANIM_MS3 = 320;
@@ -19418,7 +19605,7 @@ function ActionToolBox({ part, showLine, compact }) {
19418
19605
  }
19419
19606
  return;
19420
19607
  })();
19421
- useEffect28(() => {
19608
+ useEffect29(() => {
19422
19609
  if (!isComplete && !latched) {
19423
19610
  setShowSummary(false);
19424
19611
  return;
@@ -19444,14 +19631,14 @@ function ActionToolBox({ part, showLine, compact }) {
19444
19631
  const nextHeight = Math.min(el.scrollHeight, MAX_SCROLL_H3 - 12);
19445
19632
  setContentHeight((prev) => prev === nextHeight ? prev : nextHeight);
19446
19633
  }, [displayContent, hasDisplayContent]);
19447
- useEffect28(() => {
19634
+ useEffect29(() => {
19448
19635
  return () => {
19449
19636
  if (scrollAnimationRef.current !== null) {
19450
19637
  window.cancelAnimationFrame(scrollAnimationRef.current);
19451
19638
  }
19452
19639
  };
19453
19640
  }, []);
19454
- useEffect28(() => {
19641
+ useEffect29(() => {
19455
19642
  const el = scrollRef.current;
19456
19643
  if (!el || hoveredRef.current)
19457
19644
  return;
@@ -19772,10 +19959,10 @@ import { useState as useState32, useId } from "react";
19772
19959
  import { GitBranch as GitBranch4 } from "lucide-react";
19773
19960
 
19774
19961
  // src/hooks/useBranch.ts
19775
- import { useQuery as useQuery9, useMutation as useMutation7, useQueryClient as useQueryClient11 } from "@tanstack/react-query";
19962
+ import { useQuery as useQuery10, useMutation as useMutation8, useQueryClient as useQueryClient12 } from "@tanstack/react-query";
19776
19963
  function useCreateBranch(sessionId) {
19777
- const queryClient = useQueryClient11();
19778
- return useMutation7({
19964
+ const queryClient = useQueryClient12();
19965
+ return useMutation8({
19779
19966
  mutationFn: (data) => {
19780
19967
  if (!sessionId)
19781
19968
  throw new Error("No session ID");
@@ -19792,7 +19979,7 @@ function useCreateBranch(sessionId) {
19792
19979
  });
19793
19980
  }
19794
19981
  function useBranches(sessionId) {
19795
- return useQuery9({
19982
+ return useQuery10({
19796
19983
  queryKey: ["branches", sessionId],
19797
19984
  queryFn: () => {
19798
19985
  if (!sessionId)
@@ -19803,7 +19990,7 @@ function useBranches(sessionId) {
19803
19990
  });
19804
19991
  }
19805
19992
  function useParentSession(sessionId) {
19806
- return useQuery9({
19993
+ return useQuery10({
19807
19994
  queryKey: ["parentSession", sessionId],
19808
19995
  queryFn: () => {
19809
19996
  if (!sessionId)
@@ -20144,7 +20331,7 @@ var AssistantMessageGroup = memo14(function AssistantMessageGroup2({
20144
20331
  const [showBranchModal, setShowBranchModal] = useState33(false);
20145
20332
  const [copied, setCopied] = useState33(false);
20146
20333
  const [showAllParts, setShowAllParts] = useState33(false);
20147
- useEffect29(() => {
20334
+ useEffect30(() => {
20148
20335
  if (!message.id)
20149
20336
  return;
20150
20337
  setShowAllParts(false);
@@ -20170,7 +20357,7 @@ var AssistantMessageGroup = memo14(function AssistantMessageGroup2({
20170
20357
  console.error("Failed to reject tool call:", error);
20171
20358
  }
20172
20359
  }, [sessionId, removePendingApproval]);
20173
- const messagePendingApprovals = useMemo16(() => {
20360
+ const messagePendingApprovals = useMemo17(() => {
20174
20361
  return pendingApprovals.filter((a) => a.messageId === message.id);
20175
20362
  }, [pendingApprovals, message.id]);
20176
20363
  const handleApproveAll = useCallback19(async () => {
@@ -20185,7 +20372,7 @@ var AssistantMessageGroup = memo14(function AssistantMessageGroup2({
20185
20372
  console.error("Failed to approve all tool calls:", error);
20186
20373
  }
20187
20374
  }, [sessionId, messagePendingApprovals, removePendingApproval]);
20188
- const parts = useMemo16(() => {
20375
+ const parts = useMemo17(() => {
20189
20376
  const rawParts = message.parts || [];
20190
20377
  return areMessagePartsOrdered(rawParts) ? rawParts : [...rawParts].sort(compareMessageParts);
20191
20378
  }, [message.parts]);
@@ -20207,7 +20394,7 @@ var AssistantMessageGroup = memo14(function AssistantMessageGroup2({
20207
20394
  "apply_patch",
20208
20395
  "terminal"
20209
20396
  ].includes(part.toolName || "")).map((part) => part.toolCallId).filter((callId) => Boolean(callId)));
20210
- const renderItems = useMemo16(() => {
20397
+ const renderItems = useMemo17(() => {
20211
20398
  const items = [];
20212
20399
  let compactBuffer = [];
20213
20400
  let bufferStartIndex = -1;
@@ -20276,7 +20463,7 @@ var AssistantMessageGroup = memo14(function AssistantMessageGroup2({
20276
20463
  flushCompactBuffer();
20277
20464
  return items;
20278
20465
  }, [parts, shouldCompactActivity]);
20279
- const { visibleRenderItems, omittedRenderItemCount } = useMemo16(() => getVisibleRenderItems(renderItems, showAllParts, message.status), [renderItems, showAllParts, message.status]);
20466
+ const { visibleRenderItems, omittedRenderItemCount } = useMemo17(() => getVisibleRenderItems(renderItems, showAllParts, message.status), [renderItems, showAllParts, message.status]);
20280
20467
  const hasVisibleNonProgressParts = renderItems.length > 0;
20281
20468
  const firstVisiblePartIndex = parts.findIndex((part) => !isStatusLineTool(part.toolName));
20282
20469
  const shouldShowStatusLineToolCall = message.status === "pending" && !hasFinish && Boolean(latestStatusLineToolCallPart);
@@ -20639,7 +20826,7 @@ var AssistantMessageGroup = memo14(function AssistantMessageGroup2({
20639
20826
 
20640
20827
  // src/components/messages/UserMessageGroup.tsx
20641
20828
  import { memo as memo15, useState as useState34 } from "react";
20642
- import { useQueryClient as useQueryClient12 } from "@tanstack/react-query";
20829
+ import { useQueryClient as useQueryClient13 } from "@tanstack/react-query";
20643
20830
  import {
20644
20831
  User,
20645
20832
  X as X13,
@@ -20676,7 +20863,7 @@ var UserMessageGroup = memo15(function UserMessageGroup2({
20676
20863
  }) {
20677
20864
  const [expandedImage, setExpandedImage] = useState34(null);
20678
20865
  const parts = message.parts || [];
20679
- const queryClient = useQueryClient12();
20866
+ const queryClient = useQueryClient13();
20680
20867
  const { data: skillsConfig } = useSkills();
20681
20868
  const expandSkillsSidebar = useSkillsStore((state) => state.expandSidebar);
20682
20869
  const selectSkill = useSkillsStore((state) => state.selectSkill);
@@ -21016,7 +21203,7 @@ var UserMessageGroup = memo15(function UserMessageGroup2({
21016
21203
  });
21017
21204
 
21018
21205
  // src/components/sessions/SessionHeader.tsx
21019
- import { useMemo as useMemo17, useRef as useRef19 } from "react";
21206
+ import { useMemo as useMemo18, useRef as useRef19 } from "react";
21020
21207
  import {
21021
21208
  estimateModelCostUsd,
21022
21209
  getModelInfo
@@ -21032,10 +21219,10 @@ import {
21032
21219
  } from "lucide-react";
21033
21220
 
21034
21221
  // src/hooks/useContainerWidth.ts
21035
- import { useEffect as useEffect30, useState as useState35 } from "react";
21222
+ import { useEffect as useEffect31, useState as useState35 } from "react";
21036
21223
  function useContainerWidth(ref) {
21037
21224
  const [width, setWidth] = useState35(0);
21038
- useEffect30(() => {
21225
+ useEffect31(() => {
21039
21226
  const el = ref.current;
21040
21227
  if (!el)
21041
21228
  return;
@@ -21069,7 +21256,7 @@ function ToolActivityToggle({
21069
21256
  }
21070
21257
 
21071
21258
  // src/components/sessions/EditableTitle.tsx
21072
- import { useState as useState36, useRef as useRef18, useEffect as useEffect31, useCallback as useCallback20 } from "react";
21259
+ import { useState as useState36, useRef as useRef18, useEffect as useEffect32, useCallback as useCallback20 } from "react";
21073
21260
  import { Pencil as Pencil2 } from "lucide-react";
21074
21261
  import { jsx as jsx77, jsxs as jsxs65 } from "react/jsx-runtime";
21075
21262
  function EditableTitle({
@@ -21081,13 +21268,13 @@ function EditableTitle({
21081
21268
  const [draft, setDraft] = useState36(title || "");
21082
21269
  const inputRef = useRef18(null);
21083
21270
  const { mutate: updateSession } = useUpdateSession(sessionId);
21084
- useEffect31(() => {
21271
+ useEffect32(() => {
21085
21272
  if (isEditing && inputRef.current) {
21086
21273
  inputRef.current.focus();
21087
21274
  inputRef.current.select();
21088
21275
  }
21089
21276
  }, [isEditing]);
21090
- useEffect31(() => {
21277
+ useEffect32(() => {
21091
21278
  setDraft(title || "");
21092
21279
  }, [title]);
21093
21280
  const save = useCallback20(() => {
@@ -21147,7 +21334,7 @@ function SessionHeader({
21147
21334
  const rootRef = useRef19(null);
21148
21335
  const width = useContainerWidth(rootRef);
21149
21336
  const isCompact = width > 0 && width < 640;
21150
- const estimatedCost = useMemo17(() => {
21337
+ const estimatedCost = useMemo18(() => {
21151
21338
  const inputTokens = session.totalInputTokens || 0;
21152
21339
  const outputTokens2 = session.totalOutputTokens || 0;
21153
21340
  const cachedInputTokens = session.totalCachedTokens || 0;
@@ -21190,7 +21377,7 @@ function SessionHeader({
21190
21377
  const outputTokens = session.totalOutputTokens || 0;
21191
21378
  const isBranch = session.sessionType === "branch";
21192
21379
  const parentSession = parentData?.parent;
21193
- const contextLimit = useMemo17(() => {
21380
+ const contextLimit = useMemo18(() => {
21194
21381
  const info = getModelInfo(session.provider, session.model);
21195
21382
  return info?.limit?.context;
21196
21383
  }, [session.provider, session.model]);
@@ -21365,7 +21552,7 @@ function SessionHeader({
21365
21552
  }
21366
21553
 
21367
21554
  // src/components/sessions/LeanHeader.tsx
21368
- import { useMemo as useMemo19, useRef as useRef21 } from "react";
21555
+ import { useMemo as useMemo20, useRef as useRef21 } from "react";
21369
21556
  import {
21370
21557
  estimateModelCostUsd as estimateModelCostUsd2,
21371
21558
  getModelInfo as getModelInfo2
@@ -21383,8 +21570,8 @@ import {
21383
21570
  import { memo as memo16 } from "react";
21384
21571
 
21385
21572
  // src/stores/usageStore.ts
21386
- import { create as create21 } from "zustand";
21387
- var useUsageStore = create21((set) => ({
21573
+ import { create as create22 } from "zustand";
21574
+ var useUsageStore = create22((set) => ({
21388
21575
  usage: {},
21389
21576
  isLoading: {},
21390
21577
  lastFetched: {},
@@ -21466,7 +21653,7 @@ var UsageRing = memo16(function UsageRing2({
21466
21653
  });
21467
21654
 
21468
21655
  // src/components/common/UsageModal.tsx
21469
- import { memo as memo17, useMemo as useMemo18 } from "react";
21656
+ import { memo as memo17, useMemo as useMemo19 } from "react";
21470
21657
  import { jsx as jsx80, jsxs as jsxs68 } from "react/jsx-runtime";
21471
21658
  function formatTimeRemaining(resetsAt) {
21472
21659
  if (!resetsAt)
@@ -21546,7 +21733,7 @@ var UsageModal = memo17(function UsageModal2() {
21546
21733
  const provider = useUsageStore((s) => s.modalProvider);
21547
21734
  const closeModal = useUsageStore((s) => s.closeModal);
21548
21735
  const usage = useUsageStore((s) => provider ? s.usage[provider] : undefined);
21549
- const title = useMemo18(() => /* @__PURE__ */ jsxs68("div", {
21736
+ const title = useMemo19(() => /* @__PURE__ */ jsxs68("div", {
21550
21737
  className: "flex items-center gap-2",
21551
21738
  children: [
21552
21739
  provider && /* @__PURE__ */ jsx80(ProviderLogo, {
@@ -21655,7 +21842,7 @@ var UsageModal = memo17(function UsageModal2() {
21655
21842
  });
21656
21843
 
21657
21844
  // src/hooks/useProviderUsage.ts
21658
- import { useEffect as useEffect32, useCallback as useCallback21, useRef as useRef20 } from "react";
21845
+ import { useEffect as useEffect33, useCallback as useCallback21, useRef as useRef20 } from "react";
21659
21846
  var POLL_INTERVAL = 60000;
21660
21847
  var STALE_THRESHOLD = 60000;
21661
21848
  var inflight = new Set;
@@ -21688,12 +21875,12 @@ function useProviderUsage(provider, authType) {
21688
21875
  }, [provider, isOAuthProvider, setUsage, setLoading, setLastFetched]);
21689
21876
  const fetchRef = useRef20(fetchUsage);
21690
21877
  fetchRef.current = fetchUsage;
21691
- useEffect32(() => {
21878
+ useEffect33(() => {
21692
21879
  if (!provider || !isOAuthProvider)
21693
21880
  return;
21694
21881
  fetchRef.current();
21695
21882
  }, [isOAuthProvider, provider]);
21696
- useEffect32(() => {
21883
+ useEffect33(() => {
21697
21884
  if (!provider || !isOAuthProvider || !isModalOpen || modalProvider !== provider) {
21698
21885
  return;
21699
21886
  }
@@ -21709,7 +21896,7 @@ function useProviderUsage(provider, authType) {
21709
21896
  }
21710
21897
 
21711
21898
  // src/hooks/useOttoRouterBalance.ts
21712
- import { useEffect as useEffect33, useCallback as useCallback22 } from "react";
21899
+ import { useEffect as useEffect34, useCallback as useCallback22 } from "react";
21713
21900
  function useOttoRouterBalance(providerName) {
21714
21901
  const setBalance = useOttoRouterStore((s) => s.setBalance);
21715
21902
  const setUsdcBalance = useOttoRouterStore((s) => s.setUsdcBalance);
@@ -21786,7 +21973,7 @@ function useOttoRouterBalance(providerName) {
21786
21973
  setUsage
21787
21974
  ]);
21788
21975
  const needsUsageWindows = subscription?.active && !subscription.usageWindows;
21789
- useEffect33(() => {
21976
+ useEffect34(() => {
21790
21977
  if (providerName === "ottorouter" && (balance === null || usdcBalance === null || needsUsageWindows)) {
21791
21978
  fetchBalance();
21792
21979
  }
@@ -21806,7 +21993,7 @@ function LeanHeader({
21806
21993
  }) {
21807
21994
  const { data: parentData } = useParentSession(session.sessionType === "branch" ? session.id : undefined);
21808
21995
  const { data: shareStatus } = useShareStatus(session.id);
21809
- const estimatedCost = useMemo19(() => {
21996
+ const estimatedCost = useMemo20(() => {
21810
21997
  const inputTokens = session.totalInputTokens || 0;
21811
21998
  const outputTokens = session.totalOutputTokens || 0;
21812
21999
  const cachedInputTokens = session.totalCachedTokens || 0;
@@ -21835,7 +22022,7 @@ function LeanHeader({
21835
22022
  const contextTokens = session.currentContextTokens || 0;
21836
22023
  const isBranch = session.sessionType === "branch";
21837
22024
  const parentSession = parentData?.parent;
21838
- const contextLimit = useMemo19(() => {
22025
+ const contextLimit = useMemo20(() => {
21839
22026
  const info = getModelInfo2(session.provider, session.model);
21840
22027
  return info?.limit?.context;
21841
22028
  }, [session.provider, session.model]);
@@ -22154,8 +22341,8 @@ var TopupApprovalCard = memo18(function TopupApprovalCard2({
22154
22341
  });
22155
22342
 
22156
22343
  // src/stores/topupApprovalStore.ts
22157
- import { create as create22 } from "zustand";
22158
- var useTopupApprovalStore = create22((set) => ({
22344
+ import { create as create23 } from "zustand";
22345
+ var useTopupApprovalStore = create23((set) => ({
22159
22346
  pendingTopup: null,
22160
22347
  isProcessing: false,
22161
22348
  selectedMethod: null,
@@ -22345,7 +22532,7 @@ var ThreadMessageRow = memo19(function ThreadMessageRow2({
22345
22532
  const nextAssistantMessage = nextMessage && nextMessage.role === "assistant" ? nextMessage : undefined;
22346
22533
  const hasQueuedOrRunningLaterTurn = Boolean(currentMessageId && currentMessageId !== message.id);
22347
22534
  const canRetryTurn = message.role === "assistant" && isLastMessage && !hasQueuedOrRunningLaterTurn && queueLength === 0;
22348
- const retryHandler = useMemo20(() => canRetryTurn ? createRetryHandler(message.id) : undefined, [canRetryTurn, createRetryHandler, message.id]);
22535
+ const retryHandler = useMemo21(() => canRetryTurn ? createRetryHandler(message.id) : undefined, [canRetryTurn, createRetryHandler, message.id]);
22349
22536
  if (message.role === "user") {
22350
22537
  return /* @__PURE__ */ jsx83(UserMessageGroup, {
22351
22538
  sessionId,
@@ -22417,7 +22604,7 @@ var MessageThread = memo19(function MessageThread2({
22417
22604
  onSelectSession,
22418
22605
  footerBottomPaddingClass: footerBottomPaddingClassOverride
22419
22606
  }) {
22420
- const queryClient = useQueryClient13();
22607
+ const queryClient = useQueryClient14();
22421
22608
  const { preferences } = usePreferences();
22422
22609
  const virtuosoRef = useRef22(null);
22423
22610
  const scrollContainerRef = useRef22(null);
@@ -22442,11 +22629,11 @@ var MessageThread = memo19(function MessageThread2({
22442
22629
  const clearPendingTopup = useTopupApprovalStore((s) => s.clearPendingTopup);
22443
22630
  const setSessionTodos = useTodoStore((s) => s.setSessionTodos);
22444
22631
  const queueState = useQueueState(sessionId);
22445
- const queuedMessageIds = useMemo20(() => new Set(queueState.queuedMessages.map((item) => item.messageId)), [queueState.queuedMessages]);
22632
+ const queuedMessageIds = useMemo21(() => new Set(queueState.queuedMessages.map((item) => item.messageId)), [queueState.queuedMessages]);
22446
22633
  const showTopupApproval = pendingTopup && pendingTopup.sessionId === sessionId;
22447
- const todoSnapshotScanMessages = useMemo20(() => getTodoSnapshotScanWindow(messages), [messages]);
22448
- const latestTodoSnapshot = useMemo20(() => findLatestTodoSnapshot(todoSnapshotScanMessages, queuedMessageIds), [todoSnapshotScanMessages, queuedMessageIds]);
22449
- const filteredMessages = useMemo20(() => {
22634
+ const todoSnapshotScanMessages = useMemo21(() => getTodoSnapshotScanWindow(messages), [messages]);
22635
+ const latestTodoSnapshot = useMemo21(() => findLatestTodoSnapshot(todoSnapshotScanMessages, queuedMessageIds), [todoSnapshotScanMessages, queuedMessageIds]);
22636
+ const filteredMessages = useMemo21(() => {
22450
22637
  return filterThreadMessages(messages, queueState.currentMessageId, queueState.queueLength, queuedMessageIds);
22451
22638
  }, [
22452
22639
  messages,
@@ -22454,7 +22641,7 @@ var MessageThread = memo19(function MessageThread2({
22454
22641
  queueState.queueLength,
22455
22642
  queuedMessageIds
22456
22643
  ]);
22457
- useEffect34(() => {
22644
+ useEffect35(() => {
22458
22645
  if (!sessionId)
22459
22646
  return;
22460
22647
  if (latestTodoSnapshot || messages.length <= TODO_SNAPSHOT_SCAN_MESSAGE_LIMIT) {
@@ -22540,7 +22727,7 @@ var MessageThread = memo19(function MessageThread2({
22540
22727
  disableAutoScroll,
22541
22728
  scheduleScrollToThreadBottom
22542
22729
  ]);
22543
- useEffect34(() => {
22730
+ useEffect35(() => {
22544
22731
  if (disableAutoScroll)
22545
22732
  return;
22546
22733
  const justStartedGenerating = isGenerating && !prevIsGeneratingRef.current;
@@ -22570,7 +22757,7 @@ var MessageThread = memo19(function MessageThread2({
22570
22757
  return;
22571
22758
  scheduleScrollToThreadBottom("auto", 1);
22572
22759
  }, [messages, disableAutoScroll, scheduleScrollToThreadBottom]);
22573
- useEffect34(() => {
22760
+ useEffect35(() => {
22574
22761
  return () => {
22575
22762
  if (userScrollTimeoutRef.current) {
22576
22763
  clearTimeout(userScrollTimeoutRef.current);
@@ -22590,7 +22777,7 @@ var MessageThread = memo19(function MessageThread2({
22590
22777
  const rowOuterClass = density === "compact" ? "px-2 pb-3" : compact ? "px-4 pb-4" : "px-6 pb-6";
22591
22778
  const firstRowTopClass = density === "compact" ? "pt-3" : compact ? "pt-4" : "pt-6";
22592
22779
  const footerBottomPaddingClass = footerBottomPaddingClassOverride ?? (density === "compact" || compact ? "pb-80" : "pb-96");
22593
- const virtuosoContext = useMemo20(() => ({
22780
+ const virtuosoContext = useMemo21(() => ({
22594
22781
  session,
22595
22782
  isGenerating,
22596
22783
  onSelectSession,
@@ -22734,7 +22921,7 @@ var MessageThread = memo19(function MessageThread2({
22734
22921
  });
22735
22922
 
22736
22923
  // src/hooks/useToolApprovalShortcuts.ts
22737
- import { useEffect as useEffect35, useCallback as useCallback24 } from "react";
22924
+ import { useEffect as useEffect36, useCallback as useCallback24 } from "react";
22738
22925
  function useToolApprovalShortcuts(sessionId) {
22739
22926
  const { pendingApprovals, removePendingApproval } = useToolApprovalStore();
22740
22927
  const sessionPendingApprovals = pendingApprovals;
@@ -22770,7 +22957,7 @@ function useToolApprovalShortcuts(sessionId) {
22770
22957
  console.error("Failed to approve all tool calls:", error);
22771
22958
  }
22772
22959
  }, [sessionId, sessionPendingApprovals, removePendingApproval]);
22773
- useEffect35(() => {
22960
+ useEffect36(() => {
22774
22961
  if (!sessionId || sessionPendingApprovals.length === 0)
22775
22962
  return;
22776
22963
  const handleKeyDown = (e) => {
@@ -22801,7 +22988,7 @@ function useToolApprovalShortcuts(sessionId) {
22801
22988
  }
22802
22989
 
22803
22990
  // src/components/settings/OttoRouterTopupModal.tsx
22804
- import { memo as memo21, useState as useState39, useEffect as useEffect36, useCallback as useCallback25, useRef as useRef23 } from "react";
22991
+ import { memo as memo21, useState as useState39, useEffect as useEffect37, useCallback as useCallback25, useRef as useRef23 } from "react";
22805
22992
  import { CreditCard as CreditCard3, Wallet as Wallet2, ExternalLink as ExternalLink7, RefreshCw as RefreshCw5 } from "lucide-react";
22806
22993
 
22807
22994
  // src/components/common/StatusIndicator.tsx
@@ -23043,7 +23230,7 @@ var OttoRouterTopupModalContent = memo21(function OttoRouterTopupModalContent2()
23043
23230
  setIsLoadingEstimate(false);
23044
23231
  }
23045
23232
  }, [gateway, minAmount]);
23046
- useEffect36(() => {
23233
+ useEffect37(() => {
23047
23234
  if (effectiveAmount >= minAmount && view === "amount") {
23048
23235
  const timeout = setTimeout(() => fetchEstimate(effectiveAmount), 300);
23049
23236
  return () => clearTimeout(timeout);
@@ -23056,7 +23243,7 @@ var OttoRouterTopupModalContent = memo21(function OttoRouterTopupModalContent2()
23056
23243
  }
23057
23244
  setIsPolling(false);
23058
23245
  }, []);
23059
- useEffect36(() => {
23246
+ useEffect37(() => {
23060
23247
  return () => stopPolling();
23061
23248
  }, [stopPolling]);
23062
23249
  const startPolling = useCallback25((checkoutId) => {
@@ -23661,9 +23848,9 @@ var MessageThreadContainer = memo22(function MessageThreadContainer2({
23661
23848
  });
23662
23849
  });
23663
23850
  function SessionStreamController({ sessionId }) {
23664
- const queryClient = useQueryClient14();
23851
+ const queryClient = useQueryClient15();
23665
23852
  useSessionStream(sessionId);
23666
- useEffect37(() => {
23853
+ useEffect38(() => {
23667
23854
  queryClient.invalidateQueries({ queryKey: ["messages", sessionId] });
23668
23855
  queryClient.invalidateQueries({ queryKey: ["queueState", sessionId] });
23669
23856
  queryClient.invalidateQueries({ queryKey: sessionsQueryKey });
@@ -23685,8 +23872,8 @@ var MessageThreadData = memo22(function MessageThreadData2({
23685
23872
  const { data: messages = [], isLoading } = useMessages(sessionId);
23686
23873
  const { data: sessions = [] } = useSessions();
23687
23874
  const { preferences } = usePreferences();
23688
- const session = useMemo21(() => sessions.find((s) => s.id === sessionId), [sessions, sessionId]);
23689
- const isGenerating = useMemo21(() => messages.some((m) => m.role === "assistant" && m.status === "pending"), [messages]);
23875
+ const session = useMemo22(() => sessions.find((s) => s.id === sessionId), [sessions, sessionId]);
23876
+ const isGenerating = useMemo22(() => messages.some((m) => m.role === "assistant" && m.status === "pending"), [messages]);
23690
23877
  if (isLoading) {
23691
23878
  return /* @__PURE__ */ jsx86("div", {
23692
23879
  className: "flex-1 flex items-center justify-center text-muted-foreground",
@@ -23720,9 +23907,9 @@ var BtwFloatingChat = memo23(function BtwFloatingChat2() {
23720
23907
  const close = useBtwStore((state) => state.close);
23721
23908
  const { data: config2 } = useConfig();
23722
23909
  const { data: sessions = [] } = useSessions();
23723
- const queryClient = useQueryClient15();
23910
+ const queryClient = useQueryClient16();
23724
23911
  const [sending, setSending] = useState40(false);
23725
- const parentSession = useMemo22(() => sessions.find((session) => session.id === parentSessionId), [sessions, parentSessionId]);
23912
+ const parentSession = useMemo23(() => sessions.find((session) => session.id === parentSessionId), [sessions, parentSessionId]);
23726
23913
  const handleSend = useCallback26(async (content) => {
23727
23914
  const trimmed = content.trim();
23728
23915
  if (!trimmed || sending || !selection)
@@ -23774,7 +23961,7 @@ ${trimmed}`,
23774
23961
  ]);
23775
23962
  const panelHeight = sessionId ? ACTIVE_HEIGHT : EMPTY_HEIGHT;
23776
23963
  const position = useFloatingPosition(anchorRect, isOpen, panelHeight);
23777
- useEffect38(() => {
23964
+ useEffect39(() => {
23778
23965
  if (!isOpen)
23779
23966
  return;
23780
23967
  const handleKeyDown = (event) => {
@@ -23844,7 +24031,7 @@ ${trimmed}`,
23844
24031
  });
23845
24032
  });
23846
24033
  function useFloatingPosition(anchorRect, isOpen, panelHeight) {
23847
- const initial = useMemo22(() => computePosition(anchorRect, panelHeight), [anchorRect, panelHeight]);
24034
+ const initial = useMemo23(() => computePosition(anchorRect, panelHeight), [anchorRect, panelHeight]);
23848
24035
  const [position, setPosition] = useState40(initial);
23849
24036
  const lastAnchorRef = useRef24(anchorRect);
23850
24037
  useLayoutEffect7(() => {
@@ -24012,11 +24199,11 @@ var SessionItem = memo24(function SessionItem2({
24012
24199
  });
24013
24200
  });
24014
24201
  // src/components/sessions/SessionListContainer.tsx
24015
- import { memo as memo25, useMemo as useMemo23, useCallback as useCallback27, useEffect as useEffect39, useRef as useRef25 } from "react";
24202
+ import { memo as memo25, useMemo as useMemo24, useCallback as useCallback27, useEffect as useEffect40, useRef as useRef25 } from "react";
24016
24203
 
24017
24204
  // src/stores/focusStore.ts
24018
- import { create as create23 } from "zustand";
24019
- var useFocusStore = create23((set) => ({
24205
+ import { create as create24 } from "zustand";
24206
+ var useFocusStore = create24((set) => ({
24020
24207
  currentFocus: null,
24021
24208
  sessionIndex: 0,
24022
24209
  gitFileIndex: 0,
@@ -24064,7 +24251,7 @@ function SessionFocusController({
24064
24251
  const currentFocus = useFocusStore((state) => state.currentFocus);
24065
24252
  const sessionIndex = useFocusStore((state) => state.sessionIndex);
24066
24253
  const previousFocusedSessionId = useRef25(null);
24067
- useEffect39(() => {
24254
+ useEffect40(() => {
24068
24255
  const previousId = previousFocusedSessionId.current;
24069
24256
  if (previousId) {
24070
24257
  const previousElement = itemRefs.current?.get(previousId);
@@ -24119,7 +24306,7 @@ var SessionListContainer = memo25(function SessionListContainer2({
24119
24306
  const handleTogglePinned = useCallback27((sessionId, isPinned) => {
24120
24307
  setSessionPinned.mutate({ sessionId, isPinned });
24121
24308
  }, [setSessionPinned]);
24122
- const sessionSnapshot = useMemo23(() => {
24309
+ const sessionSnapshot = useMemo24(() => {
24123
24310
  return sessions.map((s, index) => ({
24124
24311
  id: s.id,
24125
24312
  index,
@@ -24133,9 +24320,9 @@ var SessionListContainer = memo25(function SessionListContainer2({
24133
24320
  activityAt: s.lastActiveAt ?? s.createdAt
24134
24321
  }));
24135
24322
  }, [sessions]);
24136
- const sessionMap = useMemo23(() => new Map(sessions.map((session) => [session.id, session])), [sessions]);
24137
- const sessionSnapshotMap = useMemo23(() => new Map(sessionSnapshot.map((session) => [session.id, session])), [sessionSnapshot]);
24138
- const runningSessions = useMemo23(() => {
24323
+ const sessionMap = useMemo24(() => new Map(sessions.map((session) => [session.id, session])), [sessions]);
24324
+ const sessionSnapshotMap = useMemo24(() => new Map(sessionSnapshot.map((session) => [session.id, session])), [sessionSnapshot]);
24325
+ const runningSessions = useMemo24(() => {
24139
24326
  const runningSessionMap = new Map(sessionSnapshot.filter((session) => session.isRunning && session.pinnedAt == null).map((session) => [session.id, session]));
24140
24327
  runningOrderRef.current = runningOrderRef.current.filter((id) => runningSessionMap.has(id));
24141
24328
  for (const session of sessionSnapshot) {
@@ -24145,12 +24332,12 @@ var SessionListContainer = memo25(function SessionListContainer2({
24145
24332
  }
24146
24333
  return runningOrderRef.current.map((id) => runningSessionMap.get(id)).filter((session) => Boolean(session));
24147
24334
  }, [sessionSnapshot]);
24148
- const runningSessionIds = useMemo23(() => new Set(runningSessions.map((session) => session.id)), [runningSessions]);
24149
- const pinnedGroups = useMemo23(() => {
24335
+ const runningSessionIds = useMemo24(() => new Set(runningSessions.map((session) => session.id)), [runningSessions]);
24336
+ const pinnedGroups = useMemo24(() => {
24150
24337
  const pinnedSessions = sessionSnapshot.filter((session) => session.pinnedAt != null);
24151
24338
  return pinnedSessions.length > 0 ? [{ label: "Pinned", sessions: pinnedSessions }] : [];
24152
24339
  }, [sessionSnapshot]);
24153
- const statusGroups = useMemo23(() => [
24340
+ const statusGroups = useMemo24(() => [
24154
24341
  ...runningSessions.length > 0 ? [
24155
24342
  {
24156
24343
  label: "Running",
@@ -24158,7 +24345,7 @@ var SessionListContainer = memo25(function SessionListContainer2({
24158
24345
  }
24159
24346
  ] : []
24160
24347
  ], [runningSessions]);
24161
- const recentGroups = useMemo23(() => {
24348
+ const recentGroups = useMemo24(() => {
24162
24349
  const groups = new Map;
24163
24350
  for (const session of sessionSnapshot) {
24164
24351
  if (session.pinnedAt != null)
@@ -24189,14 +24376,14 @@ var SessionListContainer = memo25(function SessionListContainer2({
24189
24376
  onError: () => markedViewedRef.current.delete(session.id)
24190
24377
  });
24191
24378
  }, [markSessionViewed, sessionSnapshotMap]);
24192
- useEffect39(() => {
24379
+ useEffect40(() => {
24193
24380
  const previousId = previousActiveSessionId.current;
24194
24381
  if (previousId && previousId !== activeSessionId) {
24195
24382
  markViewedIfReady(previousId);
24196
24383
  }
24197
24384
  previousActiveSessionId.current = activeSessionId;
24198
24385
  }, [activeSessionId, markViewedIfReady]);
24199
- useEffect39(() => {
24386
+ useEffect40(() => {
24200
24387
  if (!activeSessionId || lastScrolledSessionId.current === activeSessionId || sessionSnapshot.length === 0)
24201
24388
  return;
24202
24389
  const activeSession = sessionSnapshotMap.get(activeSessionId);
@@ -24218,7 +24405,7 @@ var SessionListContainer = memo25(function SessionListContainer2({
24218
24405
  hasNextPage,
24219
24406
  fetchNextPage
24220
24407
  ]);
24221
- useEffect39(() => {
24408
+ useEffect40(() => {
24222
24409
  const container = scrollContainerRef.current;
24223
24410
  if (!container)
24224
24411
  return;
@@ -24239,7 +24426,7 @@ var SessionListContainer = memo25(function SessionListContainer2({
24239
24426
  container.addEventListener("scroll", handleScroll, { passive: true });
24240
24427
  return () => container.removeEventListener("scroll", handleScroll);
24241
24428
  }, [hasNextPage, isFetchingNextPage, fetchNextPage]);
24242
- useEffect39(() => {
24429
+ useEffect40(() => {
24243
24430
  const container = scrollContainerRef.current;
24244
24431
  const sentinel = paginationSentinelRef.current;
24245
24432
  if (!container || !sentinel || typeof IntersectionObserver === "undefined") {
@@ -24386,7 +24573,7 @@ import {
24386
24573
  lineNumbers
24387
24574
  } from "@codemirror/view";
24388
24575
  import { tags } from "@lezer/highlight";
24389
- import { useCallback as useCallback28, useEffect as useEffect40, useMemo as useMemo24, useRef as useRef26 } from "react";
24576
+ import { useCallback as useCallback28, useEffect as useEffect41, useMemo as useMemo25, useRef as useRef26 } from "react";
24390
24577
  import { jsx as jsx90 } from "react/jsx-runtime";
24391
24578
  var viewerTheme = EditorView.theme({
24392
24579
  "&": {
@@ -24677,13 +24864,13 @@ function CodeMirrorViewer({
24677
24864
  const languageExtensionRef = useRef26([]);
24678
24865
  const decorationsExtensionRef = useRef26([]);
24679
24866
  const selectionExtensionRef = useRef26([]);
24680
- useEffect40(() => {
24867
+ useEffect41(() => {
24681
24868
  onSelectionChangeRef.current = onSelectionChange;
24682
24869
  }, [onSelectionChange]);
24683
- const lineNumberExtension = useMemo24(() => lineNumbersExtension(lineNumberFormatter), [lineNumberFormatter]);
24684
- const languageExtension = useMemo24(() => getLanguageExtension(path, disableMarkdownSyntax), [path, disableMarkdownSyntax]);
24685
- const decorationsExtension = useMemo24(() => lineDecorationsExtension(highlightedLines, highlightTone, lineTones), [highlightedLines, highlightTone, lineTones]);
24686
- const selectionExtension = useMemo24(() => EditorView.updateListener.of((update) => {
24870
+ const lineNumberExtension = useMemo25(() => lineNumbersExtension(lineNumberFormatter), [lineNumberFormatter]);
24871
+ const languageExtension = useMemo25(() => getLanguageExtension(path, disableMarkdownSyntax), [path, disableMarkdownSyntax]);
24872
+ const decorationsExtension = useMemo25(() => lineDecorationsExtension(highlightedLines, highlightTone, lineTones), [highlightedLines, highlightTone, lineTones]);
24873
+ const selectionExtension = useMemo25(() => EditorView.updateListener.of((update) => {
24687
24874
  if (!update.selectionSet && !update.docChanged)
24688
24875
  return;
24689
24876
  onSelectionChangeRef.current?.(getTextSelection(update.view));
@@ -24710,7 +24897,7 @@ function CodeMirrorViewer({
24710
24897
  decorationsExtension,
24711
24898
  selectionExtension
24712
24899
  ]);
24713
- useEffect40(() => {
24900
+ useEffect41(() => {
24714
24901
  const host = hostRef.current;
24715
24902
  if (!host)
24716
24903
  return;
@@ -24738,7 +24925,7 @@ function CodeMirrorViewer({
24738
24925
  viewRef.current = null;
24739
24926
  };
24740
24927
  }, []);
24741
- useEffect40(() => {
24928
+ useEffect41(() => {
24742
24929
  const view = viewRef.current;
24743
24930
  if (!view)
24744
24931
  return;
@@ -24750,7 +24937,7 @@ function CodeMirrorViewer({
24750
24937
  view.setState(createEditorState(contentRef.current));
24751
24938
  }
24752
24939
  }, [lineNumberExtension, createEditorState]);
24753
- useEffect40(() => {
24940
+ useEffect41(() => {
24754
24941
  const view = viewRef.current;
24755
24942
  if (!view)
24756
24943
  return;
@@ -24762,7 +24949,7 @@ function CodeMirrorViewer({
24762
24949
  view.setState(createEditorState(contentRef.current));
24763
24950
  }
24764
24951
  }, [languageExtension, createEditorState]);
24765
- useEffect40(() => {
24952
+ useEffect41(() => {
24766
24953
  const view = viewRef.current;
24767
24954
  if (!view)
24768
24955
  return;
@@ -24774,7 +24961,7 @@ function CodeMirrorViewer({
24774
24961
  view.setState(createEditorState(contentRef.current));
24775
24962
  }
24776
24963
  }, [decorationsExtension, createEditorState]);
24777
- useEffect40(() => {
24964
+ useEffect41(() => {
24778
24965
  const view = viewRef.current;
24779
24966
  if (!view)
24780
24967
  return;
@@ -24790,7 +24977,7 @@ function CodeMirrorViewer({
24790
24977
  }
24791
24978
  contentRef.current = content;
24792
24979
  }, [content, createEditorState]);
24793
- useEffect40(() => {
24980
+ useEffect41(() => {
24794
24981
  const view = viewRef.current;
24795
24982
  if (!view || !scrollToLine || scrollToLine < 1)
24796
24983
  return;
@@ -24803,7 +24990,7 @@ function CodeMirrorViewer({
24803
24990
  view.setState(createEditorState(contentRef.current));
24804
24991
  }
24805
24992
  }, [scrollToLine, createEditorState]);
24806
- useEffect40(() => {
24993
+ useEffect41(() => {
24807
24994
  const view = viewRef.current;
24808
24995
  if (!view || scrollToEndSignal === undefined)
24809
24996
  return;
@@ -24981,7 +25168,7 @@ function GitDiffViewer({ diff: diff2 }) {
24981
25168
  import { GitCommit as GitCommit3, CheckSquare, AlertTriangle as AlertTriangle2 } from "lucide-react";
24982
25169
 
24983
25170
  // src/components/git/GitFileTree.tsx
24984
- import { useCallback as useCallback29, useEffect as useEffect41, useMemo as useMemo25, useRef as useRef27 } from "react";
25171
+ import { useCallback as useCallback29, useEffect as useEffect42, useMemo as useMemo26, useRef as useRef27 } from "react";
24985
25172
  import { ChevronDown as ChevronDown8, ChevronRight as ChevronRight12, Folder as Folder2 } from "lucide-react";
24986
25173
 
24987
25174
  // src/components/git/GitFileItem.tsx
@@ -25371,8 +25558,8 @@ function GitFileTree({
25371
25558
  onToggleFolder,
25372
25559
  showModifiedIndicator
25373
25560
  }) {
25374
- const tree = useMemo25(() => buildTree(files), [files]);
25375
- const folderPaths = useMemo25(() => getInitialExpanded(tree), [tree]);
25561
+ const tree = useMemo26(() => buildTree(files), [files]);
25562
+ const folderPaths = useMemo26(() => getInitialExpanded(tree), [tree]);
25376
25563
  const currentFocus = useFocusStore((state) => state.currentFocus);
25377
25564
  const gitFileIndex = useFocusStore((state) => state.gitFileIndex);
25378
25565
  const expandedFolders = useGitStore((state) => state.gitTreeExpandedFolders[sectionId]);
@@ -25382,17 +25569,17 @@ function GitFileTree({
25382
25569
  const setGitTreeSectionRows = useGitStore((state) => state.setGitTreeSectionRows);
25383
25570
  const expanded = expandedFolders ?? folderPaths;
25384
25571
  const lastScrolledFocusedRowIdRef = useRef27(null);
25385
- useEffect41(() => {
25572
+ useEffect42(() => {
25386
25573
  syncGitTreeFolders(sectionId, [...folderPaths]);
25387
25574
  }, [sectionId, folderPaths, syncGitTreeFolders]);
25388
- useEffect41(() => {
25575
+ useEffect42(() => {
25389
25576
  if (currentFocus !== "git") {
25390
25577
  lastScrolledFocusedRowIdRef.current = null;
25391
25578
  }
25392
25579
  }, [currentFocus]);
25393
25580
  const toggleExpanded = useCallback29((path) => toggleGitTreeFolder(sectionId, path), [sectionId, toggleGitTreeFolder]);
25394
- const visibleRows = useMemo25(() => collectVisibleRows(tree, sectionId, staged, expanded, toggleExpanded), [tree, sectionId, staged, expanded, toggleExpanded]);
25395
- useEffect41(() => {
25581
+ const visibleRows = useMemo26(() => collectVisibleRows(tree, sectionId, staged, expanded, toggleExpanded), [tree, sectionId, staged, expanded, toggleExpanded]);
25582
+ useEffect42(() => {
25396
25583
  setGitTreeSectionRows(sectionId, visibleRows);
25397
25584
  return () => setGitTreeSectionRows(sectionId, []);
25398
25585
  }, [sectionId, visibleRows, setGitTreeSectionRows]);
@@ -25487,7 +25674,7 @@ function GitFileTree({
25487
25674
  }
25488
25675
 
25489
25676
  // src/components/git/GitFileList.tsx
25490
- import { useCallback as useCallback30, useMemo as useMemo26 } from "react";
25677
+ import { useCallback as useCallback30, useMemo as useMemo27 } from "react";
25491
25678
  import { jsx as jsx94, jsxs as jsxs81 } from "react/jsx-runtime";
25492
25679
  function GitFileList({ status }) {
25493
25680
  const { openCommitModal } = useGitStore();
@@ -25496,9 +25683,9 @@ function GitFileList({ status }) {
25496
25683
  const hasConflicts = (status.conflicted?.length ?? 0) > 0;
25497
25684
  const hasStaged = status.staged.length > 0;
25498
25685
  const hasUnstaged = status.unstaged.length > 0 || status.untracked.length > 0;
25499
- const unstagedFiles = useMemo26(() => [...status.unstaged, ...status.untracked], [status.unstaged, status.untracked]);
25686
+ const unstagedFiles = useMemo27(() => [...status.unstaged, ...status.untracked], [status.unstaged, status.untracked]);
25500
25687
  const hasUnstagedFiles = unstagedFiles.length > 0;
25501
- const unstagedPaths = useMemo26(() => new Set(status.unstaged.map((f) => f.path)), [status.unstaged]);
25688
+ const unstagedPaths = useMemo27(() => new Set(status.unstaged.map((f) => f.path)), [status.unstaged]);
25502
25689
  const handleStagePaths = useCallback30((paths) => stageFiles.mutate(paths), [stageFiles]);
25503
25690
  const handleUnstagePaths = useCallback30((paths) => unstageFiles.mutate(paths), [unstageFiles]);
25504
25691
  const showStagedModifiedIndicator = useCallback30((file) => unstagedPaths.has(file.path), [unstagedPaths]);
@@ -25632,7 +25819,7 @@ function GitFileList({ status }) {
25632
25819
  });
25633
25820
  }
25634
25821
  // src/components/git/GitSidebar.tsx
25635
- import { memo as memo26, useCallback as useCallback31, useEffect as useEffect44, useState as useState44 } from "react";
25822
+ import { memo as memo26, useCallback as useCallback31, useEffect as useEffect45, useState as useState44 } from "react";
25636
25823
  import {
25637
25824
  FolderGit2,
25638
25825
  ChevronRight as ChevronRight13,
@@ -25647,13 +25834,13 @@ import {
25647
25834
  Upload,
25648
25835
  X as X16
25649
25836
  } from "lucide-react";
25650
- import { useQueryClient as useQueryClient16 } from "@tanstack/react-query";
25837
+ import { useQueryClient as useQueryClient17 } from "@tanstack/react-query";
25651
25838
 
25652
25839
  // src/components/git/GitBranchSwitcher.tsx
25653
25840
  import {
25654
- useEffect as useEffect43,
25841
+ useEffect as useEffect44,
25655
25842
  useId as useId3,
25656
- useMemo as useMemo27,
25843
+ useMemo as useMemo28,
25657
25844
  useRef as useRef29,
25658
25845
  useState as useState43
25659
25846
  } from "react";
@@ -25661,7 +25848,7 @@ import { AnimatePresence as AnimatePresence2, motion as motion3 } from "motion/r
25661
25848
  import { Check as Check12, GitBranch as GitBranch9, Plus as Plus3, RefreshCw as RefreshCw6, Search as Search7 } from "lucide-react";
25662
25849
 
25663
25850
  // src/components/git/GitCreateBranchModal.tsx
25664
- import { useEffect as useEffect42, useId as useId2, useRef as useRef28, useState as useState42 } from "react";
25851
+ import { useEffect as useEffect43, useId as useId2, useRef as useRef28, useState as useState42 } from "react";
25665
25852
  import { GitBranch as GitBranch8 } from "lucide-react";
25666
25853
  import { jsx as jsx95, jsxs as jsxs82, Fragment as Fragment41 } from "react/jsx-runtime";
25667
25854
  var INVALID_BRANCH_PATTERN = /[\s~^:?*[\]\\]/;
@@ -25694,7 +25881,7 @@ function GitCreateBranchModal({
25694
25881
  const [checkout, setCheckout] = useState42(true);
25695
25882
  const [error, setError] = useState42(null);
25696
25883
  const inputRef = useRef28(null);
25697
- useEffect42(() => {
25884
+ useEffect43(() => {
25698
25885
  if (isOpen) {
25699
25886
  setName(defaultName);
25700
25887
  setCheckout(true);
@@ -25883,17 +26070,17 @@ function GitBranchSwitcher({
25883
26070
  refetch
25884
26071
  } = useGitBranches(isOpen);
25885
26072
  const checkoutBranch = useCheckoutBranch();
25886
- const rows = useMemo27(() => buildRows(data?.branches ?? [], currentBranch), [data, currentBranch]);
25887
- const filteredRows = useMemo27(() => {
26073
+ const rows = useMemo28(() => buildRows(data?.branches ?? [], currentBranch), [data, currentBranch]);
26074
+ const filteredRows = useMemo28(() => {
25888
26075
  const q = query.trim().toLowerCase();
25889
26076
  if (!q)
25890
26077
  return rows;
25891
26078
  return rows.filter((row) => row.displayName.toLowerCase().includes(q) || row.branch.name.toLowerCase().includes(q));
25892
26079
  }, [rows, query]);
25893
- useEffect43(() => {
26080
+ useEffect44(() => {
25894
26081
  setActiveIndex(0);
25895
26082
  }, [query]);
25896
- useEffect43(() => {
26083
+ useEffect44(() => {
25897
26084
  if (!isOpen)
25898
26085
  return;
25899
26086
  const handleClickOutside = (e) => {
@@ -25907,7 +26094,7 @@ function GitBranchSwitcher({
25907
26094
  document.addEventListener("mousedown", handleClickOutside);
25908
26095
  return () => document.removeEventListener("mousedown", handleClickOutside);
25909
26096
  }, [isOpen]);
25910
- useEffect43(() => {
26097
+ useEffect44(() => {
25911
26098
  if (!isOpen) {
25912
26099
  setQuery("");
25913
26100
  setActionError(null);
@@ -25915,7 +26102,7 @@ function GitBranchSwitcher({
25915
26102
  requestAnimationFrame(() => searchInputRef.current?.focus());
25916
26103
  }
25917
26104
  }, [isOpen]);
25918
- useEffect43(() => {
26105
+ useEffect44(() => {
25919
26106
  const node = itemRefs.current.get(activeIndex);
25920
26107
  node?.scrollIntoView({ block: "nearest" });
25921
26108
  }, [activeIndex]);
@@ -26134,7 +26321,7 @@ var GitSidebarContent = memo26(function GitSidebarContent2({
26134
26321
  const panelWidth = usePanelWidthStore((s) => s.widths[PANEL_KEY] ?? DEFAULT_WIDTH);
26135
26322
  const { data: status, isLoading, error, refetch } = useGitStatus();
26136
26323
  const { data: remotes } = useGitRemotes();
26137
- const queryClient = useQueryClient16();
26324
+ const queryClient = useQueryClient17();
26138
26325
  const pushMutation = usePushCommits();
26139
26326
  const pullMutation = usePullChanges();
26140
26327
  const initMutation = useGitInit();
@@ -26147,7 +26334,7 @@ var GitSidebarContent = memo26(function GitSidebarContent2({
26147
26334
  const [remoteName, setRemoteName] = useState44("origin");
26148
26335
  const [remoteUrl, setRemoteUrl] = useState44("");
26149
26336
  const [confirmRemoveRemote, setConfirmRemoveRemote] = useState44(null);
26150
- useEffect44(() => {
26337
+ useEffect45(() => {
26151
26338
  queryClient.invalidateQueries({ queryKey: ["git", "status"] });
26152
26339
  }, [queryClient]);
26153
26340
  const handleRefresh = () => {
@@ -26665,11 +26852,11 @@ import { GitBranch as GitBranch11 } from "lucide-react";
26665
26852
  import { memo as memo27 } from "react";
26666
26853
 
26667
26854
  // src/hooks/useShortcutHintsVisible.ts
26668
- import { useEffect as useEffect45, useState as useState45 } from "react";
26855
+ import { useEffect as useEffect46, useState as useState45 } from "react";
26669
26856
  var SHORTCUT_HINT_MODIFIERS = new Set(["Control", "Meta"]);
26670
26857
  function useShortcutHintsVisible() {
26671
26858
  const [isVisible, setIsVisible] = useState45(false);
26672
- useEffect45(() => {
26859
+ useEffect46(() => {
26673
26860
  const handleKeyDown = (event) => {
26674
26861
  if (SHORTCUT_HINT_MODIFIERS.has(event.key) || event.ctrlKey || event.metaKey) {
26675
26862
  setIsVisible(true);
@@ -26735,13 +26922,13 @@ var GitSidebarToggle = memo28(function GitSidebarToggle2() {
26735
26922
  });
26736
26923
  });
26737
26924
  // src/components/git/GitDiffPanel.tsx
26738
- import { useEffect as useEffect46, memo as memo29, useState as useState46 } from "react";
26925
+ import { useEffect as useEffect47, memo as memo29, useState as useState46 } from "react";
26739
26926
  import { X as X17, Maximize2, Minimize2 as Minimize22 } from "lucide-react";
26740
26927
 
26741
26928
  // src/hooks/useFileBrowser.ts
26742
- import { useQuery as useQuery10 } from "@tanstack/react-query";
26929
+ import { useQuery as useQuery11 } from "@tanstack/react-query";
26743
26930
  function useFileTree(dirPath, enabled = true) {
26744
- return useQuery10({
26931
+ return useQuery11({
26745
26932
  queryKey: ["files", "tree", dirPath],
26746
26933
  queryFn: () => apiClient.getFileTree(dirPath),
26747
26934
  enabled,
@@ -26750,7 +26937,7 @@ function useFileTree(dirPath, enabled = true) {
26750
26937
  });
26751
26938
  }
26752
26939
  function useFileContent(filePath) {
26753
- return useQuery10({
26940
+ return useQuery11({
26754
26941
  queryKey: ["files", "read", filePath],
26755
26942
  queryFn: () => filePath ? apiClient.readFileContent(filePath) : null,
26756
26943
  enabled: !!filePath,
@@ -26759,7 +26946,7 @@ function useFileContent(filePath) {
26759
26946
  });
26760
26947
  }
26761
26948
  function useGitDiffFullFile(file, staged = false, enabled = false) {
26762
- return useQuery10({
26949
+ return useQuery11({
26763
26950
  queryKey: ["git", "diff", "fullFile", file, staged],
26764
26951
  queryFn: () => file ? apiClient.getGitDiffFullFile(file, staged) : null,
26765
26952
  enabled: enabled && !!file,
@@ -26790,11 +26977,11 @@ var GitDiffPanel = memo29(function GitDiffPanel2({
26790
26977
  const { data: fullFileDiff, isLoading: fullFileLoading } = useGitDiffFullFile(selectedFile, selectedFileStaged, showFullFile);
26791
26978
  const activeDiff = showFullFile && fullFileDiff ? fullFileDiff : diff2;
26792
26979
  const activeLoading = showFullFile ? fullFileLoading : isLoading;
26793
- useEffect46(() => {
26980
+ useEffect47(() => {
26794
26981
  if (!isDiffOpen)
26795
26982
  setShowFullFile(false);
26796
26983
  }, [isDiffOpen]);
26797
- useEffect46(() => {
26984
+ useEffect47(() => {
26798
26985
  const handleEscape = (e) => {
26799
26986
  const target = e.target;
26800
26987
  const isInInput = target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable;
@@ -26898,7 +27085,7 @@ ${activeDiff?.absPath || ""}`,
26898
27085
  });
26899
27086
  });
26900
27087
  // src/components/git/GitCommitModal.tsx
26901
- import { useState as useState47, useId as useId4, useEffect as useEffect47, useCallback as useCallback32 } from "react";
27088
+ import { useState as useState47, useId as useId4, useEffect as useEffect48, useCallback as useCallback32 } from "react";
26902
27089
  import { GitCommit as GitCommit4, Sparkles as Sparkles6 } from "lucide-react";
26903
27090
  import { jsx as jsx101, jsxs as jsxs87, Fragment as Fragment43 } from "react/jsx-runtime";
26904
27091
  function GitCommitModal() {
@@ -26935,7 +27122,7 @@ function GitCommitModalContent() {
26935
27122
  console.error("Failed to generate commit message:", error);
26936
27123
  }
26937
27124
  }, [generateMessage]);
26938
- useEffect47(() => {
27125
+ useEffect48(() => {
26939
27126
  const handleKeyDown = (e) => {
26940
27127
  if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
26941
27128
  e.preventDefault();
@@ -27066,7 +27253,7 @@ function GitCommitModalContent() {
27066
27253
  });
27067
27254
  }
27068
27255
  // src/components/terminals/TerminalsPanel.tsx
27069
- import { memo as memo32, useCallback as useCallback35, useRef as useRef31, useEffect as useEffect49 } from "react";
27256
+ import { memo as memo32, useCallback as useCallback35, useRef as useRef31, useEffect as useEffect50 } from "react";
27070
27257
  import {
27071
27258
  Terminal as TerminalIcon,
27072
27259
  Maximize2 as Maximize22,
@@ -27075,10 +27262,10 @@ import {
27075
27262
  } from "lucide-react";
27076
27263
 
27077
27264
  // src/stores/terminalStore.ts
27078
- import { create as create24 } from "zustand";
27265
+ import { create as create25 } from "zustand";
27079
27266
  var DEFAULT_HEIGHT = 300;
27080
27267
  var MIN_HEIGHT = 150;
27081
- var useTerminalStore = create24((set) => ({
27268
+ var useTerminalStore = create25((set) => ({
27082
27269
  isOpen: false,
27083
27270
  panelHeight: DEFAULT_HEIGHT,
27084
27271
  activeTabId: null,
@@ -27108,7 +27295,7 @@ var useTerminalStore = create24((set) => ({
27108
27295
  }));
27109
27296
 
27110
27297
  // src/hooks/useTerminals.ts
27111
- import { useQuery as useQuery11, useMutation as useMutation8, useQueryClient as useQueryClient17 } from "@tanstack/react-query";
27298
+ import { useQuery as useQuery12, useMutation as useMutation9, useQueryClient as useQueryClient18 } from "@tanstack/react-query";
27112
27299
  import {
27113
27300
  getTerminals,
27114
27301
  postTerminals,
@@ -27116,7 +27303,7 @@ import {
27116
27303
  getTerminalsById
27117
27304
  } from "@ottocode/api";
27118
27305
  function useTerminals() {
27119
- return useQuery11({
27306
+ return useQuery12({
27120
27307
  queryKey: ["terminals"],
27121
27308
  queryFn: async () => {
27122
27309
  const response = await getTerminals();
@@ -27129,8 +27316,8 @@ function useTerminals() {
27129
27316
  });
27130
27317
  }
27131
27318
  function useCreateTerminal() {
27132
- const queryClient = useQueryClient17();
27133
- return useMutation8({
27319
+ const queryClient = useQueryClient18();
27320
+ return useMutation9({
27134
27321
  mutationFn: async (params) => {
27135
27322
  const response = await postTerminals({
27136
27323
  body: params
@@ -27146,8 +27333,8 @@ function useCreateTerminal() {
27146
27333
  });
27147
27334
  }
27148
27335
  function useKillTerminal() {
27149
- const queryClient = useQueryClient17();
27150
- return useMutation8({
27336
+ const queryClient = useQueryClient18();
27337
+ return useMutation9({
27151
27338
  mutationFn: async (terminalId) => {
27152
27339
  const response = await deleteTerminalsById({
27153
27340
  path: { id: terminalId }
@@ -27249,7 +27436,7 @@ var TerminalTab = memo30(function TerminalTab2({
27249
27436
  });
27250
27437
 
27251
27438
  // src/components/terminals/TerminalViewer.tsx
27252
- import { memo as memo31, useEffect as useEffect48, useRef as useRef30, useState as useState48, useCallback as useCallback34 } from "react";
27439
+ import { memo as memo31, useEffect as useEffect49, useRef as useRef30, useState as useState48, useCallback as useCallback34 } from "react";
27253
27440
  import {
27254
27441
  init,
27255
27442
  Terminal as Terminal7,
@@ -27449,7 +27636,7 @@ var TerminalViewer = memo31(function TerminalViewer2({
27449
27636
  }
27450
27637
  };
27451
27638
  }, [terminalId]);
27452
- useEffect48(() => {
27639
+ useEffect49(() => {
27453
27640
  if (!containerRef.current || !terminalId)
27454
27641
  return;
27455
27642
  let disposed = false;
@@ -27620,7 +27807,7 @@ var TerminalViewer = memo31(function TerminalViewer2({
27620
27807
  fitAddonRef.current = null;
27621
27808
  };
27622
27809
  }, [terminalId, connectWebSocket]);
27623
- useEffect48(() => {
27810
+ useEffect49(() => {
27624
27811
  const term = termRef.current;
27625
27812
  if (!term)
27626
27813
  return;
@@ -27638,7 +27825,7 @@ var TerminalViewer = memo31(function TerminalViewer2({
27638
27825
  }
27639
27826
  }
27640
27827
  }, [isActive, fitTerminal]);
27641
- useEffect48(() => {
27828
+ useEffect49(() => {
27642
27829
  if (isActive) {
27643
27830
  fitTerminal();
27644
27831
  }
@@ -27690,7 +27877,7 @@ var TerminalsPanel = memo32(function TerminalsPanel2() {
27690
27877
  });
27691
27878
  function TerminalPanelShortcutController() {
27692
27879
  const togglePanel = useTerminalStore((s) => s.togglePanel);
27693
- useEffect49(() => {
27880
+ useEffect50(() => {
27694
27881
  const handleKeyDown = (e) => {
27695
27882
  if (e.key === "`" && e.ctrlKey) {
27696
27883
  e.preventDefault();
@@ -27718,12 +27905,12 @@ var TerminalsPanelContent = memo32(function TerminalsPanelContent2() {
27718
27905
  const autoCreatingRef = useRef31(false);
27719
27906
  const terminalsListRef = useRef31(terminalsList);
27720
27907
  terminalsListRef.current = terminalsList;
27721
- useEffect49(() => {
27908
+ useEffect50(() => {
27722
27909
  if (terminalsListRef.current.length > 0 && (!activeTabId || !terminalsListRef.current.find((t) => t.id === activeTabId))) {
27723
27910
  selectTab(terminalsListRef.current[0].id);
27724
27911
  }
27725
27912
  }, [terminalsList.length, activeTabId, selectTab]);
27726
- useEffect49(() => {
27913
+ useEffect50(() => {
27727
27914
  if (terminals && terminalsList.length === 0 && !autoCreatingRef.current && !createTerminal.isPending) {
27728
27915
  autoCreatingRef.current = true;
27729
27916
  createTerminal.mutateAsync({
@@ -27960,14 +28147,14 @@ var TerminalPanelToggle = memo33(function TerminalPanelToggle2() {
27960
28147
  });
27961
28148
  });
27962
28149
  // src/components/session-files/SessionFilesSidebar.tsx
27963
- import { memo as memo34, useCallback as useCallback36, useMemo as useMemo28 } from "react";
28150
+ import { memo as memo34, useCallback as useCallback36, useMemo as useMemo29 } from "react";
27964
28151
  import { FilePen, FilePlus as FilePlus2, FileEdit as FileEdit4, RefreshCw as RefreshCw8 } from "lucide-react";
27965
28152
 
27966
28153
  // src/hooks/useSessionFiles.ts
27967
- import { useQuery as useQuery12 } from "@tanstack/react-query";
28154
+ import { useQuery as useQuery13 } from "@tanstack/react-query";
27968
28155
  function useSessionFiles(sessionId, enabled = true) {
27969
28156
  const isExpanded = useSessionFilesStore((state) => state.isExpanded);
27970
- return useQuery12({
28157
+ return useQuery13({
27971
28158
  queryKey: ["session", sessionId, "files"],
27972
28159
  queryFn: () => sessionId ? apiClient.getSessionFiles(sessionId) : null,
27973
28160
  enabled: !!sessionId && enabled,
@@ -28049,7 +28236,7 @@ var SessionFileItem = memo34(function SessionFileItem2({
28049
28236
  onOpen
28050
28237
  }) {
28051
28238
  const lastOp = file.operations[file.operations.length - 1];
28052
- const { totalAdditions, totalDeletions } = useMemo28(() => {
28239
+ const { totalAdditions, totalDeletions } = useMemo29(() => {
28053
28240
  let additions = 0;
28054
28241
  let deletions = 0;
28055
28242
  for (const op of file.operations) {
@@ -28267,7 +28454,7 @@ var SessionFilesSidebarToggle = memo35(function SessionFilesSidebarToggle2({
28267
28454
  });
28268
28455
  });
28269
28456
  // src/components/session-files/SessionFilesDiffPanel.tsx
28270
- import { useEffect as useEffect50, useMemo as useMemo29, memo as memo36 } from "react";
28457
+ import { useEffect as useEffect51, useMemo as useMemo30, memo as memo36 } from "react";
28271
28458
  import { X as X19, ChevronLeft, ChevronRight as ChevronRight14 } from "lucide-react";
28272
28459
  import { jsx as jsx108, jsxs as jsxs94 } from "react/jsx-runtime";
28273
28460
  function transformToUnifiedDiff(patch) {
@@ -28372,7 +28559,7 @@ function FullHeightDiffView({
28372
28559
  patch,
28373
28560
  filePath
28374
28561
  }) {
28375
- const display = useMemo29(() => buildSessionPatchDisplay(patch), [patch]);
28562
+ const display = useMemo30(() => buildSessionPatchDisplay(patch), [patch]);
28376
28563
  return /* @__PURE__ */ jsx108(CodeMirrorViewer, {
28377
28564
  content: display.content,
28378
28565
  path: filePath,
@@ -28407,7 +28594,7 @@ var SessionFilesDiffPanel = memo36(function SessionFilesDiffPanel2({
28407
28594
  const selectOperation = onOperationIndexChange ?? storeSelectOperation;
28408
28595
  const closeDiff = onClose ?? storeCloseDiff;
28409
28596
  const selectedOperation = allOperations[selectedOperationIndex];
28410
- const patchContent = useMemo29(() => {
28597
+ const patchContent = useMemo30(() => {
28411
28598
  if (!selectedOperation || !selectedFile)
28412
28599
  return null;
28413
28600
  let rawPatch = null;
@@ -28430,7 +28617,7 @@ ${contentLines.map((line) => `+${line}`).join(`
28430
28617
  }
28431
28618
  return rawPatch;
28432
28619
  }, [selectedOperation, selectedFile]);
28433
- useEffect50(() => {
28620
+ useEffect51(() => {
28434
28621
  const handleKeyDown = (e) => {
28435
28622
  const target = e.target;
28436
28623
  const isInInput = target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable;
@@ -28603,7 +28790,7 @@ ${contentLines.map((line) => `+${line}`).join(`
28603
28790
  });
28604
28791
  });
28605
28792
  // src/components/research/ResearchSidebar.tsx
28606
- import { memo as memo37, useState as useState49, useEffect as useEffect51, useCallback as useCallback37, useRef as useRef32, useMemo as useMemo30 } from "react";
28793
+ import { memo as memo37, useState as useState49, useEffect as useEffect52, useCallback as useCallback37, useRef as useRef32, useMemo as useMemo31 } from "react";
28607
28794
  import {
28608
28795
  FlaskConical as FlaskConical3,
28609
28796
  Plus as Plus6,
@@ -28617,7 +28804,7 @@ import {
28617
28804
  } from "lucide-react";
28618
28805
 
28619
28806
  // src/hooks/useResearch.ts
28620
- import { useQuery as useQuery13, useMutation as useMutation9, useQueryClient as useQueryClient18 } from "@tanstack/react-query";
28807
+ import { useQuery as useQuery14, useMutation as useMutation10, useQueryClient as useQueryClient19 } from "@tanstack/react-query";
28621
28808
  import {
28622
28809
  createResearchSession as apiCreateResearchSession,
28623
28810
  deleteResearchSession as apiDeleteResearchSession,
@@ -28672,7 +28859,7 @@ class ResearchApiClient {
28672
28859
  }
28673
28860
  var researchApi = new ResearchApiClient;
28674
28861
  function useResearchSessions(parentSessionId, enabled = true) {
28675
- return useQuery13({
28862
+ return useQuery14({
28676
28863
  queryKey: ["research", "sessions", parentSessionId],
28677
28864
  queryFn: () => researchApi.listResearchSessions(parentSessionId),
28678
28865
  enabled: !!parentSessionId && enabled,
@@ -28680,8 +28867,8 @@ function useResearchSessions(parentSessionId, enabled = true) {
28680
28867
  });
28681
28868
  }
28682
28869
  function useCreateResearchSession() {
28683
- const queryClient = useQueryClient18();
28684
- return useMutation9({
28870
+ const queryClient = useQueryClient19();
28871
+ return useMutation10({
28685
28872
  mutationFn: ({
28686
28873
  parentSessionId,
28687
28874
  data
@@ -28694,8 +28881,8 @@ function useCreateResearchSession() {
28694
28881
  });
28695
28882
  }
28696
28883
  function useDeleteResearchSession() {
28697
- const queryClient = useQueryClient18();
28698
- return useMutation9({
28884
+ const queryClient = useQueryClient19();
28885
+ return useMutation10({
28699
28886
  mutationFn: (researchId) => researchApi.deleteResearchSession(researchId),
28700
28887
  onSuccess: () => {
28701
28888
  queryClient.invalidateQueries({ queryKey: ["research", "sessions"] });
@@ -28704,7 +28891,7 @@ function useDeleteResearchSession() {
28704
28891
  }
28705
28892
  function useInjectContext() {
28706
28893
  const addContext = usePendingResearchStore((state) => state.addContext);
28707
- return useMutation9({
28894
+ return useMutation10({
28708
28895
  mutationFn: ({
28709
28896
  parentSessionId,
28710
28897
  researchSessionId,
@@ -28721,8 +28908,8 @@ function useInjectContext() {
28721
28908
  });
28722
28909
  }
28723
28910
  function useExportToSession() {
28724
- const queryClient = useQueryClient18();
28725
- return useMutation9({
28911
+ const queryClient = useQueryClient19();
28912
+ return useMutation10({
28726
28913
  mutationFn: ({
28727
28914
  researchId,
28728
28915
  data
@@ -28734,7 +28921,7 @@ function useExportToSession() {
28734
28921
  }
28735
28922
 
28736
28923
  // src/components/research/ResearchSidebar.tsx
28737
- import { useMutation as useMutation10, useQueryClient as useQueryClient19 } from "@tanstack/react-query";
28924
+ import { useMutation as useMutation11, useQueryClient as useQueryClient20 } from "@tanstack/react-query";
28738
28925
  import { jsx as jsx109, jsxs as jsxs95, Fragment as Fragment46 } from "react/jsx-runtime";
28739
28926
  var PANEL_KEY3 = "research";
28740
28927
  var DEFAULT_WIDTH3 = 320;
@@ -28777,8 +28964,8 @@ var ResearchSidebarContent = memo37(function ResearchSidebarContent2({
28777
28964
  const { data: parentMessagesData } = useMessages(parentSessionId ?? undefined, { enabled: true });
28778
28965
  useSessionStream(activeResearchSessionId ?? undefined, true);
28779
28966
  const updateSession = useUpdateSession(activeResearchSessionId ?? "");
28780
- const queryClient = useQueryClient19();
28781
- const sendMessage = useMutation10({
28967
+ const queryClient = useQueryClient20();
28968
+ const sendMessage = useMutation11({
28782
28969
  mutationFn: async ({
28783
28970
  sessionId,
28784
28971
  content
@@ -28787,12 +28974,12 @@ var ResearchSidebarContent = memo37(function ResearchSidebarContent2({
28787
28974
  queryClient.invalidateQueries({ queryKey: ["messages", sessionId] });
28788
28975
  }
28789
28976
  });
28790
- useEffect51(() => {
28977
+ useEffect52(() => {
28791
28978
  if (parentSessionId) {
28792
28979
  useResearchStore.getState().setParentSessionId(parentSessionId);
28793
28980
  }
28794
28981
  }, [parentSessionId]);
28795
- useEffect51(() => {
28982
+ useEffect52(() => {
28796
28983
  if (researchData?.sessions?.length) {
28797
28984
  const currentIsValid = researchData.sessions.some((s) => s.id === activeResearchSessionId);
28798
28985
  if (!currentIsValid) {
@@ -28802,7 +28989,7 @@ var ResearchSidebarContent = memo37(function ResearchSidebarContent2({
28802
28989
  selectResearchSession(null);
28803
28990
  }
28804
28991
  }, [researchData, activeResearchSessionId, selectResearchSession]);
28805
- useEffect51(() => {
28992
+ useEffect52(() => {
28806
28993
  messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
28807
28994
  }, []);
28808
28995
  const adjustTextareaHeight = useCallback37(() => {
@@ -28812,7 +28999,7 @@ var ResearchSidebarContent = memo37(function ResearchSidebarContent2({
28812
28999
  textarea.style.height = "auto";
28813
29000
  textarea.style.height = `${Math.min(textarea.scrollHeight, 120)}px`;
28814
29001
  }, []);
28815
- useEffect51(() => {
29002
+ useEffect52(() => {
28816
29003
  adjustTextareaHeight();
28817
29004
  }, [adjustTextareaHeight]);
28818
29005
  const handleCreateNew = useCallback37(async () => {
@@ -28924,8 +29111,8 @@ var ResearchSidebarContent = memo37(function ResearchSidebarContent2({
28924
29111
  handleSendMessage();
28925
29112
  }
28926
29113
  }, [handleSendMessage]);
28927
- const isGenerating = useMemo30(() => messagesData?.some((m) => m.role === "assistant" && m.status === "pending") ?? false, [messagesData]);
28928
- const isAlreadyInjected = useMemo30(() => {
29114
+ const isGenerating = useMemo31(() => messagesData?.some((m) => m.role === "assistant" && m.status === "pending") ?? false, [messagesData]);
29115
+ const isAlreadyInjected = useMemo31(() => {
28929
29116
  if (!activeResearchSessionId || !parentMessagesData)
28930
29117
  return false;
28931
29118
  return parentMessagesData.some((m) => m.role === "system" && m.parts?.some((p) => typeof p.content === "string" && p.content.includes(`from="${activeResearchSessionId}"`)));
@@ -29304,7 +29491,7 @@ var ResearchSidebarToggle = memo38(function ResearchSidebarToggle2({
29304
29491
  });
29305
29492
  });
29306
29493
  // src/components/settings/SettingsSidebar.tsx
29307
- import { memo as memo40, useState as useState51, useMemo as useMemo31, useCallback as useCallback39, useEffect as useEffect54, useRef as useRef35 } from "react";
29494
+ import { memo as memo40, useState as useState51, useMemo as useMemo32, useCallback as useCallback39, useEffect as useEffect55, useRef as useRef35 } from "react";
29308
29495
  import { createPortal as createPortal2 } from "react-dom";
29309
29496
  import { AnimatePresence as AnimatePresence3, motion as motion4 } from "motion/react";
29310
29497
  import {
@@ -29329,9 +29516,9 @@ import {
29329
29516
  import { QRCodeSVG } from "qrcode.react";
29330
29517
 
29331
29518
  // src/stores/onboardingStore.ts
29332
- import { create as create25 } from "zustand";
29519
+ import { create as create26 } from "zustand";
29333
29520
  var STEPS = ["wallet", "defaults"];
29334
- var useOnboardingStore = create25((set, get) => ({
29521
+ var useOnboardingStore = create26((set, get) => ({
29335
29522
  isOpen: false,
29336
29523
  currentStep: "wallet",
29337
29524
  manageMode: false,
@@ -29368,8 +29555,8 @@ var useOnboardingStore = create25((set, get) => ({
29368
29555
  }));
29369
29556
 
29370
29557
  // src/hooks/useAuthStatus.ts
29371
- import { useEffect as useEffect52, useCallback as useCallback38, useState as useState50, useRef as useRef33 } from "react";
29372
- import { useQueryClient as useQueryClient20 } from "@tanstack/react-query";
29558
+ import { useEffect as useEffect53, useCallback as useCallback38, useState as useState50, useRef as useRef33 } from "react";
29559
+ import { useQueryClient as useQueryClient21 } from "@tanstack/react-query";
29373
29560
  var isInIframe = typeof window !== "undefined" && window.self !== window.top;
29374
29561
  function useAuthStatus() {
29375
29562
  const setAuthStatus = useOnboardingStore((s) => s.setAuthStatus);
@@ -29378,7 +29565,7 @@ function useAuthStatus() {
29378
29565
  const setError = useOnboardingStore((s) => s.setError);
29379
29566
  const authStatus = useOnboardingStore((s) => s.authStatus);
29380
29567
  const isOpen = useOnboardingStore((s) => s.isOpen);
29381
- const queryClient = useQueryClient20();
29568
+ const queryClient = useQueryClient21();
29382
29569
  const [initialized, setInitialized] = useState50(false);
29383
29570
  const [oauthPolling, setOauthPolling] = useState50(false);
29384
29571
  const oauthPollingRef = useRef33(null);
@@ -29572,7 +29759,7 @@ function useAuthStatus() {
29572
29759
  setLoading(false);
29573
29760
  }
29574
29761
  }, [fetchAuthStatus, setLoading, setError]);
29575
- useEffect52(() => {
29762
+ useEffect53(() => {
29576
29763
  if (!oauthPolling || !isInIframe)
29577
29764
  return;
29578
29765
  oauthPollingRef.current = setInterval(() => {
@@ -29586,7 +29773,7 @@ function useAuthStatus() {
29586
29773
  clearTimeout(timeout);
29587
29774
  };
29588
29775
  }, [oauthPolling, fetchAuthStatus]);
29589
- useEffect52(() => {
29776
+ useEffect53(() => {
29590
29777
  if (!oauthPolling || !authStatus)
29591
29778
  return;
29592
29779
  const currentConfigured = Object.entries(authStatus.providers).filter(([, p]) => p.configured);
@@ -29595,7 +29782,7 @@ function useAuthStatus() {
29595
29782
  setOauthPolling(false);
29596
29783
  }
29597
29784
  }, [authStatus, oauthPolling]);
29598
- useEffect52(() => {
29785
+ useEffect53(() => {
29599
29786
  const handleOAuthMessage = (event) => {
29600
29787
  if (event.data?.type === "oauth-success") {
29601
29788
  fetchAuthStatus();
@@ -29907,14 +30094,14 @@ var DictationSettings = memo39(function DictationSettings2({
29907
30094
  });
29908
30095
 
29909
30096
  // src/hooks/useTopupCallback.ts
29910
- import { useEffect as useEffect53, useRef as useRef34 } from "react";
30097
+ import { useEffect as useEffect54, useRef as useRef34 } from "react";
29911
30098
  var STORAGE_KEY = "pendingPolarCheckout";
29912
30099
  function useTopupCallback() {
29913
30100
  const hasHandled = useRef34(false);
29914
30101
  const loadingToastId = useRef34(null);
29915
30102
  const setBalance = useOttoRouterStore((s) => s.setBalance);
29916
30103
  const removeToast = useToastStore((s) => s.removeToast);
29917
- useEffect53(() => {
30104
+ useEffect54(() => {
29918
30105
  if (hasHandled.current)
29919
30106
  return;
29920
30107
  const params = new URLSearchParams(window.location.search);
@@ -30119,7 +30306,7 @@ var SelectRow = memo40(function SelectRow2({
30119
30306
  const [menuStyle, setMenuStyle] = useState51(null);
30120
30307
  const buttonRef = useRef35(null);
30121
30308
  const selectedOption = options.find((o) => o.id === value);
30122
- useEffect54(() => {
30309
+ useEffect55(() => {
30123
30310
  if (!isOpen || !buttonRef.current)
30124
30311
  return;
30125
30312
  const update = () => {
@@ -30218,10 +30405,10 @@ var FontPickerRow = memo40(function FontPickerRow2({
30218
30405
  const [fontError, setFontError] = useState51(null);
30219
30406
  const canQueryLocalFonts = typeof window !== "undefined" && typeof window.queryLocalFonts === "function";
30220
30407
  const canRequestDesktopFonts = hasPlatformSystemFonts() || typeof window !== "undefined" && window.self !== window.top;
30221
- const fontOptions = useMemo31(() => {
30408
+ const fontOptions = useMemo32(() => {
30222
30409
  return Array.from(new Set([value, ...localFonts, ...COMMON_SYSTEM_FONTS].filter(Boolean))).sort((a, b) => a.localeCompare(b));
30223
30410
  }, [localFonts, value]);
30224
- const filteredFonts = useMemo31(() => {
30411
+ const filteredFonts = useMemo32(() => {
30225
30412
  const query = search.trim().toLowerCase();
30226
30413
  if (!query)
30227
30414
  return fontOptions;
@@ -30345,7 +30532,7 @@ var NumberInputRow = memo40(function NumberInputRow2({
30345
30532
  disabled
30346
30533
  }) {
30347
30534
  const [draft, setDraft] = useState51(value !== null && value !== undefined ? String(value) : "");
30348
- useEffect54(() => {
30535
+ useEffect55(() => {
30349
30536
  setDraft(value !== null && value !== undefined ? String(value) : "");
30350
30537
  }, [value]);
30351
30538
  const persistedValue = value !== null && value !== undefined ? String(value) : "";
@@ -30702,7 +30889,7 @@ var SettingsSidebarContent = memo40(function SettingsSidebarContent2({
30702
30889
  const exportOttoRouterPrivateKey = useCallback39(async () => {
30703
30890
  return await apiClient.exportOttoRouterWallet();
30704
30891
  }, []);
30705
- const providerOptions = useMemo31(() => {
30892
+ const providerOptions = useMemo32(() => {
30706
30893
  if (!config2?.providers || !allModels)
30707
30894
  return [];
30708
30895
  return config2.providers.filter((p) => allModels[p]).map((p) => ({
@@ -30710,7 +30897,7 @@ var SettingsSidebarContent = memo40(function SettingsSidebarContent2({
30710
30897
  label: allModels[p]?.label || p
30711
30898
  }));
30712
30899
  }, [config2?.providers, allModels]);
30713
- const modelOptions = useMemo31(() => {
30900
+ const modelOptions = useMemo32(() => {
30714
30901
  const provider = config2?.defaults?.provider;
30715
30902
  if (!provider || !allModels?.[provider])
30716
30903
  return [];
@@ -30719,7 +30906,7 @@ var SettingsSidebarContent = memo40(function SettingsSidebarContent2({
30719
30906
  label: m.label
30720
30907
  }));
30721
30908
  }, [config2?.defaults?.provider, allModels]);
30722
- const agentOptions = useMemo31(() => {
30909
+ const agentOptions = useMemo32(() => {
30723
30910
  if (!config2?.agents)
30724
30911
  return [];
30725
30912
  return config2.agents.map((a) => ({ id: a, label: a }));
@@ -31257,8 +31444,8 @@ import {
31257
31444
  import { QRCodeSVG as QRCodeSVG2 } from "qrcode.react";
31258
31445
 
31259
31446
  // src/hooks/useTunnel.ts
31260
- import { useQuery as useQuery14, useMutation as useMutation11, useQueryClient as useQueryClient21 } from "@tanstack/react-query";
31261
- import { useEffect as useEffect55, useCallback as useCallback40, useRef as useRef36 } from "react";
31447
+ import { useQuery as useQuery15, useMutation as useMutation12, useQueryClient as useQueryClient22 } from "@tanstack/react-query";
31448
+ import { useEffect as useEffect56, useCallback as useCallback40, useRef as useRef36 } from "react";
31262
31449
  import {
31263
31450
  client as client4,
31264
31451
  getTunnelQr,
@@ -31305,13 +31492,13 @@ function useTunnelStatus() {
31305
31492
  const setStatus = useTunnelStore((s) => s.setStatus);
31306
31493
  const setUrl = useTunnelStore((s) => s.setUrl);
31307
31494
  const setError = useTunnelStore((s) => s.setError);
31308
- const query = useQuery14({
31495
+ const query = useQuery15({
31309
31496
  queryKey: ["tunnel", "status"],
31310
31497
  queryFn: fetchTunnelStatus,
31311
31498
  refetchInterval: 3000,
31312
31499
  refetchOnMount: "always"
31313
31500
  });
31314
- useEffect55(() => {
31501
+ useEffect56(() => {
31315
31502
  if (query.data) {
31316
31503
  setStatus(normalizeTunnelStatus(query.data));
31317
31504
  setUrl(query.data.url);
@@ -31321,12 +31508,12 @@ function useTunnelStatus() {
31321
31508
  return query;
31322
31509
  }
31323
31510
  function useStartTunnel() {
31324
- const queryClient = useQueryClient21();
31511
+ const queryClient = useQueryClient22();
31325
31512
  const setStatus = useTunnelStore((s) => s.setStatus);
31326
31513
  const setUrl = useTunnelStore((s) => s.setUrl);
31327
31514
  const setError = useTunnelStore((s) => s.setError);
31328
31515
  const setProgress = useTunnelStore((s) => s.setProgress);
31329
- return useMutation11({
31516
+ return useMutation12({
31330
31517
  mutationFn: () => startTunnel(),
31331
31518
  onMutate: () => {
31332
31519
  setStatus("starting");
@@ -31355,9 +31542,9 @@ function useStartTunnel() {
31355
31542
  });
31356
31543
  }
31357
31544
  function useStopTunnel() {
31358
- const queryClient = useQueryClient21();
31545
+ const queryClient = useQueryClient22();
31359
31546
  const reset = useTunnelStore((s) => s.reset);
31360
- return useMutation11({
31547
+ return useMutation12({
31361
31548
  mutationFn: stopTunnel,
31362
31549
  onSuccess: () => {
31363
31550
  reset();
@@ -31368,12 +31555,12 @@ function useStopTunnel() {
31368
31555
  function useTunnelQr() {
31369
31556
  const url = useTunnelStore((s) => s.url);
31370
31557
  const setQrCode = useTunnelStore((s) => s.setQrCode);
31371
- const query = useQuery14({
31558
+ const query = useQuery15({
31372
31559
  queryKey: ["tunnel", "qr", url],
31373
31560
  queryFn: fetchTunnelQr,
31374
31561
  enabled: !!url
31375
31562
  });
31376
- useEffect55(() => {
31563
+ useEffect56(() => {
31377
31564
  if (query.data?.ok && query.data.qrCode) {
31378
31565
  setQrCode(query.data.qrCode);
31379
31566
  }
@@ -31413,7 +31600,7 @@ function useTunnelStream() {
31413
31600
  eventSourceRef.current = null;
31414
31601
  };
31415
31602
  }, [setStatus, setUrl, setError, setProgress]);
31416
- useEffect55(() => {
31603
+ useEffect56(() => {
31417
31604
  if (isExpanded) {
31418
31605
  const cleanup = connect();
31419
31606
  return cleanup;
@@ -31673,7 +31860,7 @@ var TunnelSidebarToggle = memo43(function TunnelSidebarToggle2() {
31673
31860
  });
31674
31861
  });
31675
31862
  // src/components/mcp/MCPSidebar.tsx
31676
- import { memo as memo46, useState as useState54, useCallback as useCallback43, useMemo as useMemo32, useEffect as useEffect58, useRef as useRef39 } from "react";
31863
+ import { memo as memo46, useState as useState54, useCallback as useCallback43, useMemo as useMemo33, useEffect as useEffect59, useRef as useRef39 } from "react";
31677
31864
  import {
31678
31865
  ChevronDown as ChevronDown13,
31679
31866
  ChevronRight as ChevronRight16,
@@ -31690,11 +31877,11 @@ import {
31690
31877
  Wrench as Wrench2,
31691
31878
  X as X21
31692
31879
  } from "lucide-react";
31693
- import { useQueryClient as useQueryClient23 } from "@tanstack/react-query";
31880
+ import { useQueryClient as useQueryClient24 } from "@tanstack/react-query";
31694
31881
 
31695
31882
  // src/hooks/useMCP.ts
31696
- import { useQuery as useQuery15, useMutation as useMutation12, useQueryClient as useQueryClient22 } from "@tanstack/react-query";
31697
- import { useEffect as useEffect56, useRef as useRef37, useCallback as useCallback41 } from "react";
31883
+ import { useQuery as useQuery16, useMutation as useMutation13, useQueryClient as useQueryClient23 } from "@tanstack/react-query";
31884
+ import { useEffect as useEffect57, useRef as useRef37, useCallback as useCallback41 } from "react";
31698
31885
  import {
31699
31886
  listMcpServers,
31700
31887
  startMcpServer,
@@ -31708,7 +31895,7 @@ import {
31708
31895
  } from "@ottocode/api";
31709
31896
  function useMCPServers() {
31710
31897
  const setServers = useMCPStore((s) => s.setServers);
31711
- const query = useQuery15({
31898
+ const query = useQuery16({
31712
31899
  queryKey: ["mcp", "servers"],
31713
31900
  queryFn: async () => {
31714
31901
  const { data } = await listMcpServers();
@@ -31716,7 +31903,7 @@ function useMCPServers() {
31716
31903
  },
31717
31904
  refetchInterval: 1e4
31718
31905
  });
31719
- useEffect56(() => {
31906
+ useEffect57(() => {
31720
31907
  if (query.data?.servers) {
31721
31908
  setServers(query.data.servers);
31722
31909
  }
@@ -31724,8 +31911,8 @@ function useMCPServers() {
31724
31911
  return query;
31725
31912
  }
31726
31913
  function useStartMCPServer() {
31727
- const queryClient = useQueryClient22();
31728
- return useMutation12({
31914
+ const queryClient = useQueryClient23();
31915
+ return useMutation13({
31729
31916
  mutationFn: async (name) => {
31730
31917
  const { data, error } = await startMcpServer({
31731
31918
  path: { name }
@@ -31743,9 +31930,9 @@ function useStartMCPServer() {
31743
31930
  });
31744
31931
  }
31745
31932
  function useStopMCPServer() {
31746
- const queryClient = useQueryClient22();
31933
+ const queryClient = useQueryClient23();
31747
31934
  const setLoading = useMCPStore((s) => s.setLoading);
31748
- return useMutation12({
31935
+ return useMutation13({
31749
31936
  mutationFn: async (name) => {
31750
31937
  setLoading(name, true);
31751
31938
  const { data, error } = await stopMcpServer({
@@ -31765,8 +31952,8 @@ function useStopMCPServer() {
31765
31952
  });
31766
31953
  }
31767
31954
  function useAddMCPServer() {
31768
- const queryClient = useQueryClient22();
31769
- return useMutation12({
31955
+ const queryClient = useQueryClient23();
31956
+ return useMutation13({
31770
31957
  mutationFn: async (params) => {
31771
31958
  const { data, error } = await addMcpServer({
31772
31959
  body: params
@@ -31784,8 +31971,8 @@ function useAddMCPServer() {
31784
31971
  });
31785
31972
  }
31786
31973
  function useRemoveMCPServer() {
31787
- const queryClient = useQueryClient22();
31788
- return useMutation12({
31974
+ const queryClient = useQueryClient23();
31975
+ return useMutation13({
31789
31976
  mutationFn: async (name) => {
31790
31977
  const { data, error } = await removeMcpServer({
31791
31978
  path: { name }
@@ -31803,8 +31990,8 @@ function useRemoveMCPServer() {
31803
31990
  });
31804
31991
  }
31805
31992
  function useAuthenticateMCPServer() {
31806
- const queryClient = useQueryClient22();
31807
- return useMutation12({
31993
+ const queryClient = useQueryClient23();
31994
+ return useMutation13({
31808
31995
  mutationFn: async (name) => {
31809
31996
  const { data, error } = await initiateMcpAuth({
31810
31997
  path: { name }
@@ -31822,8 +32009,8 @@ function useAuthenticateMCPServer() {
31822
32009
  });
31823
32010
  }
31824
32011
  function useRevokeMCPAuth() {
31825
- const queryClient = useQueryClient22();
31826
- return useMutation12({
32012
+ const queryClient = useQueryClient23();
32013
+ return useMutation13({
31827
32014
  mutationFn: async (name) => {
31828
32015
  const { data, error } = await revokeMcpAuth({
31829
32016
  path: { name }
@@ -31841,7 +32028,7 @@ function useRevokeMCPAuth() {
31841
32028
  });
31842
32029
  }
31843
32030
  function useMCPAuthStatus(name) {
31844
- return useQuery15({
32031
+ return useQuery16({
31845
32032
  queryKey: ["mcp", "auth", name],
31846
32033
  queryFn: async () => {
31847
32034
  if (!name)
@@ -31859,7 +32046,7 @@ function useCopilotDevicePoller() {
31859
32046
  const copilotDevice = useMCPStore((s) => s.copilotDevice);
31860
32047
  const setCopilotDevice = useMCPStore((s) => s.setCopilotDevice);
31861
32048
  const setLoading = useMCPStore((s) => s.setLoading);
31862
- const queryClient = useQueryClient22();
32049
+ const queryClient = useQueryClient23();
31863
32050
  const timerRef = useRef37(null);
31864
32051
  const stopPolling = useCallback41(() => {
31865
32052
  if (timerRef.current) {
@@ -31867,7 +32054,7 @@ function useCopilotDevicePoller() {
31867
32054
  timerRef.current = null;
31868
32055
  }
31869
32056
  }, []);
31870
- useEffect56(() => {
32057
+ useEffect57(() => {
31871
32058
  if (!copilotDevice) {
31872
32059
  stopPolling();
31873
32060
  return;
@@ -31903,7 +32090,7 @@ function useCopilotDevicePoller() {
31903
32090
  }
31904
32091
 
31905
32092
  // src/components/mcp/AddMCPServerModal.tsx
31906
- import { memo as memo44, useState as useState53, useCallback as useCallback42, useRef as useRef38, useEffect as useEffect57 } from "react";
32093
+ import { memo as memo44, useState as useState53, useCallback as useCallback42, useRef as useRef38, useEffect as useEffect58 } from "react";
31907
32094
  import { Globe as Globe5, Laptop, FolderDot, Terminal as Terminal9 } from "lucide-react";
31908
32095
  import { jsx as jsx116, jsxs as jsxs102, Fragment as Fragment49 } from "react/jsx-runtime";
31909
32096
  function parseCommandString(input) {
@@ -32026,7 +32213,7 @@ var AddMCPServerModal = memo44(function AddMCPServerModal2({
32026
32213
  ]);
32027
32214
  const contentRef = useRef38(null);
32028
32215
  const [contentHeight, setContentHeight] = useState53(undefined);
32029
- useEffect57(() => {
32216
+ useEffect58(() => {
32030
32217
  const el = contentRef.current;
32031
32218
  if (!el)
32032
32219
  return;
@@ -32574,7 +32761,7 @@ var MCPServerCard = memo46(function MCPServerCard2({
32574
32761
  function useAuthPoller(name, onAuthenticated) {
32575
32762
  const { data } = useMCPAuthStatus(name);
32576
32763
  const prevAuth = useRef39(false);
32577
- useEffect58(() => {
32764
+ useEffect59(() => {
32578
32765
  if (data?.authenticated && !prevAuth.current) {
32579
32766
  onAuthenticated();
32580
32767
  }
@@ -32603,7 +32790,7 @@ var MCPSidebarContent = memo46(function MCPSidebarContent2() {
32603
32790
  const [pollingServer, setPollingServer] = useState54(null);
32604
32791
  const [deleteTarget, setDeleteTarget] = useState54(null);
32605
32792
  const [searchQuery, setSearchQuery] = useState54("");
32606
- const queryClient = useQueryClient23();
32793
+ const queryClient = useQueryClient24();
32607
32794
  const handleAuthCompleted = useCallback43(() => {
32608
32795
  if (pollingServer) {
32609
32796
  setAuthUrl(pollingServer, null);
@@ -32612,7 +32799,7 @@ var MCPSidebarContent = memo46(function MCPSidebarContent2() {
32612
32799
  }
32613
32800
  }, [pollingServer, setAuthUrl, queryClient]);
32614
32801
  useAuthPoller(pollingServer, handleAuthCompleted);
32615
- useEffect58(() => {
32802
+ useEffect59(() => {
32616
32803
  for (const name of loading) {
32617
32804
  const server = servers.find((s) => s.name === name);
32618
32805
  if (server?.connected) {
@@ -32679,7 +32866,7 @@ var MCPSidebarContent = memo46(function MCPSidebarContent2() {
32679
32866
  setAuthUrl(name, null);
32680
32867
  }
32681
32868
  }, [startServer, setAuthUrl, setLoading, handleCopilotDeviceResponse]);
32682
- const sortedServers = useMemo32(() => {
32869
+ const sortedServers = useMemo33(() => {
32683
32870
  const q = searchQuery.trim().toLowerCase();
32684
32871
  const filtered = q ? servers.filter((s) => {
32685
32872
  const cmd = s.command ? `${s.command} ${s.args.join(" ")}` : "";
@@ -32893,7 +33080,7 @@ var MCPSidebarToggle = memo47(function MCPSidebarToggle2() {
32893
33080
  });
32894
33081
  });
32895
33082
  // src/components/skills/SkillsSidebar.tsx
32896
- import { memo as memo48, useMemo as useMemo33, useState as useState55 } from "react";
33083
+ import { memo as memo48, useMemo as useMemo34, useState as useState55 } from "react";
32897
33084
  import {
32898
33085
  Sparkles as Sparkles7,
32899
33086
  FolderDot as FolderDot3,
@@ -32947,13 +33134,13 @@ var SkillsSidebarContent = memo48(function SkillsSidebarContent2() {
32947
33134
  const { data: skillDetail } = useSkillDetail(selectedSkill);
32948
33135
  const { data: skillFilesData } = useSkillFiles(selectedSkill);
32949
33136
  const skillFiles = skillFilesData?.files ?? [];
32950
- const filteredSkills = useMemo33(() => {
33137
+ const filteredSkills = useMemo34(() => {
32951
33138
  const q = searchQuery.trim().toLowerCase();
32952
33139
  if (!q)
32953
33140
  return skills;
32954
33141
  return skills.filter((s) => s.name.toLowerCase().includes(q) || (s.description ?? "").toLowerCase().includes(q));
32955
33142
  }, [skills, searchQuery]);
32956
- const groupedSkills = useMemo33(() => {
33143
+ const groupedSkills = useMemo34(() => {
32957
33144
  const groups = new Map;
32958
33145
  for (const skill of filteredSkills) {
32959
33146
  const list = groups.get(skill.scope) ?? [];
@@ -33304,7 +33491,7 @@ var SkillsSidebarToggle = memo49(function SkillsSidebarToggle2() {
33304
33491
  });
33305
33492
  });
33306
33493
  // src/components/skills/SkillViewerPanel.tsx
33307
- import { memo as memo50, useEffect as useEffect59 } from "react";
33494
+ import { memo as memo50, useEffect as useEffect60 } from "react";
33308
33495
  import { X as X23 } from "lucide-react";
33309
33496
  import { jsx as jsx122, jsxs as jsxs107 } from "react/jsx-runtime";
33310
33497
  var SkillViewerPanel = memo50(function SkillViewerPanel2({
@@ -33328,7 +33515,7 @@ var SkillViewerPanel = memo50(function SkillViewerPanel2({
33328
33515
  const content = isMainFile ? skillDetail?.content : fileData?.content;
33329
33516
  const isLoading = isMainFile ? !skillDetail : fileLoading;
33330
33517
  const displayPath = isMainFile ? "SKILL.md" : viewingFile ?? "";
33331
- useEffect59(() => {
33518
+ useEffect60(() => {
33332
33519
  const handleEscape = (e) => {
33333
33520
  const target = e.target;
33334
33521
  const isInInput = target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable;
@@ -33409,69 +33596,6 @@ var AgentsSidebar = function AgentsSidebar2() {
33409
33596
  // src/components/agents/AgentsSidebarToggle.tsx
33410
33597
  import { memo as memo51 } from "react";
33411
33598
  import { Bot as Bot2 } from "lucide-react";
33412
-
33413
- // src/stores/agentsStore.ts
33414
- import { create as create26 } from "zustand";
33415
- function collapseOtherRightPanels() {
33416
- useGitStore.getState().collapseSidebar();
33417
- useSessionFilesStore.getState().collapseSidebar();
33418
- useResearchStore.getState().collapseSidebar();
33419
- useSettingsStore.getState().collapseSidebar();
33420
- useTunnelStore.getState().collapseSidebar();
33421
- useFileBrowserStore.getState().collapseSidebar();
33422
- useMCPStore.getState().collapseSidebar();
33423
- useSkillsStore.getState().collapseSidebar();
33424
- }
33425
- var useAgentsStore = create26((set) => ({
33426
- isExpanded: false,
33427
- isManagerOpen: false,
33428
- managerMode: "library",
33429
- editorPage: "overview",
33430
- agents: [],
33431
- defaultAgent: null,
33432
- selectedAgent: null,
33433
- isCreateModalOpen: false,
33434
- setManagerMode: (mode) => set({ managerMode: mode }),
33435
- openManager: () => {
33436
- collapseOtherRightPanels();
33437
- set({ isManagerOpen: true, isExpanded: true, managerMode: "library" });
33438
- },
33439
- closeManager: () => set({
33440
- isManagerOpen: false,
33441
- isExpanded: false,
33442
- isCreateModalOpen: false,
33443
- managerMode: "library",
33444
- editorPage: "overview"
33445
- }),
33446
- toggleManager: () => {
33447
- const open = useAgentsStore.getState().isManagerOpen;
33448
- if (open) {
33449
- useAgentsStore.getState().closeManager();
33450
- } else {
33451
- useAgentsStore.getState().openManager();
33452
- }
33453
- },
33454
- setAgents: (agents, defaultAgent) => set((state) => ({
33455
- agents,
33456
- defaultAgent,
33457
- selectedAgent: state.selectedAgent && agents.some((a) => a.name === state.selectedAgent) ? state.selectedAgent : agents.find((a) => a.name === defaultAgent)?.name ?? agents[0]?.name ?? null
33458
- })),
33459
- selectAgent: (agent) => set({ selectedAgent: agent }),
33460
- backToList: () => set({ selectedAgent: null, editorPage: "overview" }),
33461
- openAgentInManager: (agent) => set({
33462
- isManagerOpen: true,
33463
- isExpanded: true,
33464
- managerMode: "workspace",
33465
- selectedAgent: agent,
33466
- editorPage: "overview",
33467
- isCreateModalOpen: false
33468
- }),
33469
- setEditorPage: (page) => set({ editorPage: page }),
33470
- openCreateModal: () => set({ isManagerOpen: true, isExpanded: true, isCreateModalOpen: true }),
33471
- closeCreateModal: () => set({ isCreateModalOpen: false })
33472
- }));
33473
-
33474
- // src/components/agents/AgentsSidebarToggle.tsx
33475
33599
  import { jsx as jsx123 } from "react/jsx-runtime";
33476
33600
  var AgentsSidebarToggle = memo51(function AgentsSidebarToggle2() {
33477
33601
  const isExpanded = useAgentsStore((state) => state.isExpanded);
@@ -33487,7 +33611,7 @@ var AgentsSidebarToggle = memo51(function AgentsSidebarToggle2() {
33487
33611
  });
33488
33612
  });
33489
33613
  // src/components/agents/AgentsManagerModal.tsx
33490
- import { memo as memo55, useCallback as useCallback44, useEffect as useEffect62, useMemo as useMemo36, useRef as useRef41, useState as useState58 } from "react";
33614
+ import { memo as memo55, useCallback as useCallback44, useEffect as useEffect62, useMemo as useMemo37, useRef as useRef41, useState as useState58 } from "react";
33491
33615
  import { AnimatePresence as AnimatePresence4, motion as motion5 } from "motion/react";
33492
33616
  import {
33493
33617
  ArrowLeft as ArrowLeft2,
@@ -33501,110 +33625,8 @@ import {
33501
33625
  Wrench as Wrench3
33502
33626
  } from "lucide-react";
33503
33627
 
33504
- // src/hooks/useAgents.ts
33505
- import { useEffect as useEffect60 } from "react";
33506
- import { useMutation as useMutation13, useQuery as useQuery16, useQueryClient as useQueryClient24 } from "@tanstack/react-query";
33507
- function useAgentDetails(options = {}) {
33508
- const managerOpen = useAgentsStore((s) => s.isManagerOpen);
33509
- const createOpen = useAgentsStore((s) => s.isCreateModalOpen);
33510
- const enabled = options.enabled ?? (managerOpen || createOpen);
33511
- const setAgents = useAgentsStore((s) => s.setAgents);
33512
- const selectedAgent = useAgentsStore((s) => s.selectedAgent);
33513
- const selectAgent = useAgentsStore((s) => s.selectAgent);
33514
- const query = useQuery16({
33515
- queryKey: ["config", "agents"],
33516
- queryFn: () => apiClient.getAgentDetails(),
33517
- enabled,
33518
- staleTime: 15000
33519
- });
33520
- useEffect60(() => {
33521
- if (!query.data)
33522
- return;
33523
- setAgents(query.data.agents, query.data.default);
33524
- if (!selectedAgent && query.data.agents.length > 0) {
33525
- const defaultAgent = query.data.agents.find((agent) => agent.name === query.data.default);
33526
- selectAgent(defaultAgent?.name ?? query.data.agents[0].name);
33527
- }
33528
- }, [query.data, selectAgent, selectedAgent, setAgents]);
33529
- return query;
33530
- }
33531
- function useAgent(agentName) {
33532
- return useQuery16({
33533
- queryKey: ["config", "agents", agentName],
33534
- queryFn: async () => {
33535
- if (!agentName)
33536
- return null;
33537
- return apiClient.getAgent(agentName);
33538
- },
33539
- enabled: Boolean(agentName),
33540
- staleTime: 15000
33541
- });
33542
- }
33543
- function useConfigTools(options = {}) {
33544
- const managerOpen = useAgentsStore((s) => s.isManagerOpen);
33545
- const createOpen = useAgentsStore((s) => s.isCreateModalOpen);
33546
- const enabled = options.enabled ?? (managerOpen || createOpen);
33547
- return useQuery16({
33548
- queryKey: ["config", "tools"],
33549
- queryFn: () => apiClient.getConfigTools(),
33550
- enabled,
33551
- staleTime: 30000
33552
- });
33553
- }
33554
- function useUpdateAgent() {
33555
- const queryClient = useQueryClient24();
33556
- return useMutation13({
33557
- mutationFn: ({ name, input }) => apiClient.updateAgent(name, input),
33558
- onSuccess: (data, variables) => {
33559
- queryClient.setQueryData(["config", "agents", variables.name], data);
33560
- queryClient.invalidateQueries({ queryKey: ["config", "agents"] });
33561
- }
33562
- });
33563
- }
33564
- function useDeleteAgent() {
33565
- const queryClient = useQueryClient24();
33566
- const setAgents = useAgentsStore((s) => s.setAgents);
33567
- const selectAgent = useAgentsStore((s) => s.selectAgent);
33568
- return useMutation13({
33569
- mutationFn: ({
33570
- name,
33571
- scope = "local"
33572
- }) => apiClient.deleteAgent(name, scope),
33573
- onSuccess: async (_data, variables) => {
33574
- await queryClient.invalidateQueries({ queryKey: ["config", "agents"] });
33575
- const refreshed = await queryClient.fetchQuery({
33576
- queryKey: ["config", "agents"],
33577
- queryFn: () => apiClient.getAgentDetails()
33578
- });
33579
- setAgents(refreshed.agents, refreshed.default);
33580
- if (variables.name === useAgentsStore.getState().selectedAgent) {
33581
- const next = refreshed.agents.find((a) => a.name === refreshed.default)?.name ?? refreshed.agents[0]?.name ?? null;
33582
- selectAgent(next);
33583
- }
33584
- }
33585
- });
33586
- }
33587
- function useSetDefaultAgent() {
33588
- const queryClient = useQueryClient24();
33589
- return useMutation13({
33590
- mutationFn: (name) => apiClient.updateDefaults({ agent: name, scope: "global" }),
33591
- onSuccess: () => {
33592
- queryClient.invalidateQueries({ queryKey: ["config", "agents"] });
33593
- queryClient.invalidateQueries({ queryKey: ["config"] });
33594
- }
33595
- });
33596
- }
33597
- function getAgentToolCount(agent) {
33598
- if (!agent)
33599
- return 0;
33600
- return Array.from(new Set([
33601
- ...agent.toolConfig.firstClass ?? [],
33602
- ...agent.toolConfig.loadable ?? []
33603
- ])).length;
33604
- }
33605
-
33606
33628
  // src/components/agents/AgentToolList.tsx
33607
- import { memo as memo52, useEffect as useEffect61, useMemo as useMemo34, useRef as useRef40, useState as useState56 } from "react";
33629
+ import { memo as memo52, useEffect as useEffect61, useMemo as useMemo35, useRef as useRef40, useState as useState56 } from "react";
33608
33630
  import { GripVertical, Plus as Plus9, Search as Search10, X as X24, Zap as Zap2 } from "lucide-react";
33609
33631
 
33610
33632
  // src/components/agents/agentConstants.ts
@@ -33817,7 +33839,7 @@ var AgentToolList = memo52(function AgentToolList2({
33817
33839
  onMoveTool,
33818
33840
  disabled
33819
33841
  }) {
33820
- const toolDisplays = useMemo34(() => {
33842
+ const toolDisplays = useMemo35(() => {
33821
33843
  const byName = new Map(availableTools.map((tool) => [tool.name, tool]));
33822
33844
  const displays = [];
33823
33845
  const seen = new Set;
@@ -33853,7 +33875,7 @@ var AgentToolList = memo52(function AgentToolList2({
33853
33875
  }
33854
33876
  return displays;
33855
33877
  }, [availableTools, selectedToolNames, toolBuckets]);
33856
- const buckets = useMemo34(() => {
33878
+ const buckets = useMemo35(() => {
33857
33879
  const result = {
33858
33880
  first_class: [],
33859
33881
  loadable: []
@@ -33866,7 +33888,7 @@ var AgentToolList = memo52(function AgentToolList2({
33866
33888
  return result;
33867
33889
  }, [toolDisplays]);
33868
33890
  const enabledCount = selectedToolNames.size;
33869
- const toolsByName = useMemo34(() => {
33891
+ const toolsByName = useMemo35(() => {
33870
33892
  const map = new Map;
33871
33893
  for (const tool of toolDisplays)
33872
33894
  map.set(tool.name, tool);
@@ -34008,7 +34030,7 @@ var ToolPicker = memo52(function ToolPicker2({
34008
34030
  useEffect61(() => {
34009
34031
  inputRef.current?.focus();
34010
34032
  }, []);
34011
- const filtered = useMemo34(() => {
34033
+ const filtered = useMemo35(() => {
34012
34034
  const q = query.trim().toLowerCase();
34013
34035
  if (!q)
34014
34036
  return available;
@@ -34196,7 +34218,7 @@ var AgentProviderModelFields = memo53(function AgentProviderModelFields2({
34196
34218
  });
34197
34219
 
34198
34220
  // src/components/agents/CreateAgentModal.tsx
34199
- import { memo as memo54, useId as useId5, useMemo as useMemo35, useState as useState57 } from "react";
34221
+ import { memo as memo54, useId as useId5, useMemo as useMemo36, useState as useState57 } from "react";
34200
34222
  import { ArrowLeft } from "lucide-react";
34201
34223
  import { jsx as jsx126, jsxs as jsxs110, Fragment as Fragment51 } from "react/jsx-runtime";
34202
34224
  var AGENT_NAME_RE = /^[a-zA-Z0-9_-]+$/;
@@ -34218,7 +34240,6 @@ var AgentCreatePane = memo54(function AgentCreatePane2({
34218
34240
  availableTools
34219
34241
  }) {
34220
34242
  const closeCreateModal = useAgentsStore((s) => s.closeCreateModal);
34221
- const openAgentInManager = useAgentsStore((s) => s.openAgentInManager);
34222
34243
  const updateAgent = useUpdateAgent();
34223
34244
  const nameId = useId5();
34224
34245
  const duplicateId = useId5();
@@ -34235,7 +34256,7 @@ var AgentCreatePane = memo54(function AgentCreatePane2({
34235
34256
  const [copyModelSettings, setCopyModelSettings] = useState57(false);
34236
34257
  const [error, setError] = useState57(null);
34237
34258
  const duplicateSource = duplicateFrom ? agents.find((a) => a.name === duplicateFrom) : undefined;
34238
- const selectedTools = useMemo35(() => {
34259
+ const selectedTools = useMemo36(() => {
34239
34260
  const base = new Set(toolNamesFromConfig(TOOL_PRESETS[preset].tools));
34240
34261
  for (const t of REQUIRED_TOOLS)
34241
34262
  base.add(t);
@@ -34323,7 +34344,7 @@ var AgentCreatePane = memo54(function AgentCreatePane2({
34323
34344
  }, {
34324
34345
  onSuccess: () => {
34325
34346
  resetForm();
34326
- openAgentInManager(trimmed);
34347
+ closeCreateModal();
34327
34348
  },
34328
34349
  onError: (err) => {
34329
34350
  setError(String(err));
@@ -34908,7 +34929,7 @@ var AgentWorkspaceMain = memo55(function AgentWorkspaceMain2({
34908
34929
  const updateAgent = useUpdateAgent();
34909
34930
  const deleteAgent = useDeleteAgent();
34910
34931
  const setDefaultAgent = useSetDefaultAgent();
34911
- const savedToolNames = useMemo36(() => toolNamesFromConfig(agent.toolConfig), [agent.toolConfig]);
34932
+ const savedToolNames = useMemo37(() => toolNamesFromConfig(agent.toolConfig), [agent.toolConfig]);
34912
34933
  const [prompt, setPrompt] = useState58(agent.prompt);
34913
34934
  const [provider, setProvider] = useState58(agent.provider ?? "");
34914
34935
  const [model, setModel] = useState58(agent.model ?? "");
@@ -34927,8 +34948,8 @@ var AgentWorkspaceMain = memo55(function AgentWorkspaceMain2({
34927
34948
  savedToolNames,
34928
34949
  agent.toolConfig
34929
34950
  ]);
34930
- const currentToolConfig = useMemo36(() => buildAgentToolConfig(selectedToolNames, availableTools, toolBuckets), [selectedToolNames, availableTools, toolBuckets]);
34931
- const isDirty = useMemo36(() => {
34951
+ const currentToolConfig = useMemo37(() => buildAgentToolConfig(selectedToolNames, availableTools, toolBuckets), [selectedToolNames, availableTools, toolBuckets]);
34952
+ const isDirty = useMemo37(() => {
34932
34953
  if (prompt !== agent.prompt)
34933
34954
  return true;
34934
34955
  if (provider !== (agent.provider ?? ""))
@@ -35659,7 +35680,7 @@ import {
35659
35680
  memo as memo58,
35660
35681
  useCallback as useCallback46,
35661
35682
  useEffect as useEffect65,
35662
- useMemo as useMemo38,
35683
+ useMemo as useMemo39,
35663
35684
  useRef as useRef44,
35664
35685
  useState as useState59
35665
35686
  } from "react";
@@ -35669,7 +35690,7 @@ import remarkGfm3 from "remark-gfm";
35669
35690
 
35670
35691
  // src/components/workspace/ToolPreviewPanel.tsx
35671
35692
  import { CheckCircle2 as CheckCircle23, XCircle as XCircle4 } from "lucide-react";
35672
- import { useEffect as useEffect64, useMemo as useMemo37, useRef as useRef43 } from "react";
35693
+ import { useEffect as useEffect64, useMemo as useMemo38, useRef as useRef43 } from "react";
35673
35694
  import { jsx as jsx131, jsxs as jsxs114 } from "react/jsx-runtime";
35674
35695
  var LARGE_WRITE_PREVIEW_CHARS = 24000;
35675
35696
  var LARGE_WRITE_PREVIEW_LINES = 500;
@@ -36293,16 +36314,16 @@ function ToolPreviewPanel({ tab }) {
36293
36314
  const shouldLoadAppliedFile = shouldLoadPatchFile && tab.status === "success";
36294
36315
  const { data: appliedFile, refetch: refetchAppliedFile } = useFileContent(shouldLoadPatchFile ? tab.path : null);
36295
36316
  const shouldUseLargePatchFallback = Boolean(isPatchPreview && ((tab.patch?.length ?? 0) >= LARGE_PATCH_PREVIEW_CHARS || (appliedFile?.content?.length ?? 0) >= LARGE_PATCH_FILE_CHARS));
36296
- const largePatchPreview = useMemo37(() => {
36317
+ const largePatchPreview = useMemo38(() => {
36297
36318
  if (!shouldUseLargePatchFallback)
36298
36319
  return null;
36299
36320
  return getTailByCharCount(tab.patch ?? "Patch content is not available yet.", LARGE_PATCH_PREVIEW_TAIL_CHARS);
36300
36321
  }, [shouldUseLargePatchFallback, tab.patch]);
36301
- const patchHighlights = useMemo37(() => getPatchLineHighlights(tab.patch, tab.path, tab.changedLines), [tab.patch, tab.path, tab.changedLines]);
36302
- const patchTextLineTones = useMemo37(() => getPatchTextLineTones(tab.patch), [tab.patch]);
36303
- const writePreview = useMemo37(() => tab.toolName === "write" && tab.content !== undefined ? getOptimizedWritePreview(tab.content, tab.status) : null, [tab.toolName, tab.content, tab.status]);
36322
+ const patchHighlights = useMemo38(() => getPatchLineHighlights(tab.patch, tab.path, tab.changedLines), [tab.patch, tab.path, tab.changedLines]);
36323
+ const patchTextLineTones = useMemo38(() => getPatchTextLineTones(tab.patch), [tab.patch]);
36324
+ const writePreview = useMemo38(() => tab.toolName === "write" && tab.content !== undefined ? getOptimizedWritePreview(tab.content, tab.status) : null, [tab.toolName, tab.content, tab.status]);
36304
36325
  const scrollSignal = `${tab.content?.length ?? 0}:${tab.patch?.length ?? 0}:${appliedFile?.content?.length ?? 0}`;
36305
- const livePatchPreview = useMemo37(() => isPatchPreview && tab.status !== "success" && !shouldUseLargePatchFallback && appliedFile?.content !== undefined ? buildLivePatchPreview(tab.baseContent ?? appliedFile.content, tab.patch, tab.path) : null, [
36326
+ const livePatchPreview = useMemo38(() => isPatchPreview && tab.status !== "success" && !shouldUseLargePatchFallback && appliedFile?.content !== undefined ? buildLivePatchPreview(tab.baseContent ?? appliedFile.content, tab.patch, tab.path) : null, [
36306
36327
  isPatchPreview,
36307
36328
  tab.status,
36308
36329
  tab.baseContent,
@@ -36311,7 +36332,7 @@ function ToolPreviewPanel({ tab }) {
36311
36332
  appliedFile?.content,
36312
36333
  shouldUseLargePatchFallback
36313
36334
  ]);
36314
- const persistedPatchPreview = useMemo37(() => {
36335
+ const persistedPatchPreview = useMemo38(() => {
36315
36336
  if (!tab.previewContent || !tab.previewLineTones)
36316
36337
  return null;
36317
36338
  return {
@@ -36684,7 +36705,7 @@ var FileViewerPanel = memo58(function FileViewerPanel2({
36684
36705
  return () => document.removeEventListener("keydown", handleOpenBtw);
36685
36706
  }, [isViewerOpen, openBtwForActiveSelection, selectedFile]);
36686
36707
  const effectiveHighlight = patchPreview || writePreview ? undefined : highlight;
36687
- const persistedPatchPreview = useMemo38(() => {
36708
+ const persistedPatchPreview = useMemo39(() => {
36688
36709
  if (!patchPreview?.previewContent || !patchPreview.previewLineTones) {
36689
36710
  return null;
36690
36711
  }
@@ -36697,7 +36718,7 @@ var FileViewerPanel = memo58(function FileViewerPanel2({
36697
36718
  };
36698
36719
  }, [patchPreview]);
36699
36720
  const patchBaseContent = patchPreview ? patchPreview.baseContent ?? data?.content ?? "" : undefined;
36700
- const livePatchPreview = useMemo38(() => selectedFile && patchPreview?.patch && patchBaseContent !== undefined ? buildLivePatchPreview(patchBaseContent, patchPreview.patch, selectedFile) : null, [selectedFile, patchPreview?.patch, patchBaseContent]);
36721
+ const livePatchPreview = useMemo39(() => selectedFile && patchPreview?.patch && patchBaseContent !== undefined ? buildLivePatchPreview(patchBaseContent, patchPreview.patch, selectedFile) : null, [selectedFile, patchPreview?.patch, patchBaseContent]);
36701
36722
  const activePatchPreview = patchPreview?.status === "success" ? persistedPatchPreview ?? livePatchPreview : livePatchPreview ?? persistedPatchPreview;
36702
36723
  useEffect65(() => {
36703
36724
  if (!selectedFile || !patchPreview || !livePatchPreview)
@@ -36748,7 +36769,7 @@ var FileViewerPanel = memo58(function FileViewerPanel2({
36748
36769
  const highlightStart = effectiveHighlight?.startLine;
36749
36770
  const highlightEnd = effectiveHighlight?.endLine ?? highlightStart;
36750
36771
  const patchChangedLines = patchPreview?.changedLines;
36751
- const persistentLineTones = useMemo38(() => {
36772
+ const persistentLineTones = useMemo39(() => {
36752
36773
  if (!annotations?.length)
36753
36774
  return;
36754
36775
  const tones = new Map;
@@ -36760,7 +36781,7 @@ var FileViewerPanel = memo58(function FileViewerPanel2({
36760
36781
  }
36761
36782
  return tones.size > 0 ? tones : undefined;
36762
36783
  }, [annotations]);
36763
- const writePreviewLineTones = useMemo38(() => {
36784
+ const writePreviewLineTones = useMemo39(() => {
36764
36785
  if (writePreview?.content === undefined)
36765
36786
  return;
36766
36787
  const tones = new Map;
@@ -36770,7 +36791,7 @@ var FileViewerPanel = memo58(function FileViewerPanel2({
36770
36791
  tones.set(line, "add");
36771
36792
  return tones;
36772
36793
  }, [writePreview?.content]);
36773
- const highlightedLines = useMemo38(() => {
36794
+ const highlightedLines = useMemo39(() => {
36774
36795
  if (highlightStart && highlightEnd) {
36775
36796
  return new Set(Array.from({ length: highlightEnd - highlightStart + 1 }, (_, index) => highlightStart + index));
36776
36797
  }
@@ -36781,7 +36802,7 @@ var FileViewerPanel = memo58(function FileViewerPanel2({
36781
36802
  }, [highlightStart, highlightEnd, activePatchPreview, patchChangedLines]);
36782
36803
  const fallbackPatchHighlightStart = !activePatchPreview && patchChangedLines?.length ? Math.min(...patchChangedLines) : undefined;
36783
36804
  const scrollToHighlightLine = highlightStart ?? fallbackPatchHighlightStart;
36784
- const activePatchLineTones = useMemo38(() => {
36805
+ const activePatchLineTones = useMemo39(() => {
36785
36806
  if (!activePatchPreview)
36786
36807
  return persistentLineTones;
36787
36808
  const tones = new Map(persistentLineTones);
@@ -36794,7 +36815,7 @@ var FileViewerPanel = memo58(function FileViewerPanel2({
36794
36815
  }
36795
36816
  return tones;
36796
36817
  }, [activePatchPreview, patchChangedLines, persistentLineTones]);
36797
- const patchChangeCount = useMemo38(() => {
36818
+ const patchChangeCount = useMemo39(() => {
36798
36819
  const patchTextCount = countPatchTextChanges(patchPreview?.patch, selectedFile);
36799
36820
  if (patchTextCount)
36800
36821
  return patchTextCount;
@@ -36811,7 +36832,7 @@ var FileViewerPanel = memo58(function FileViewerPanel2({
36811
36832
  patchPreview?.previewLineTones,
36812
36833
  patchChangedLines
36813
36834
  ]);
36814
- const writeChangeCount = useMemo38(() => {
36835
+ const writeChangeCount = useMemo39(() => {
36815
36836
  if (writePreview?.changeCount)
36816
36837
  return writePreview.changeCount;
36817
36838
  if (writePreview?.content === undefined)
@@ -37010,7 +37031,7 @@ var FileViewerPanel = memo58(function FileViewerPanel2({
37010
37031
  });
37011
37032
  });
37012
37033
  // src/components/file-browser/QuickFilePicker.tsx
37013
- import { memo as memo59, useState as useState60, useEffect as useEffect66, useRef as useRef45, useCallback as useCallback47, useMemo as useMemo39 } from "react";
37034
+ import { memo as memo59, useState as useState60, useEffect as useEffect66, useRef as useRef45, useCallback as useCallback47, useMemo as useMemo40 } from "react";
37014
37035
  import { FileCode as FileCode3, Search as Search11 } from "lucide-react";
37015
37036
 
37016
37037
  // src/stores/filePickerStore.ts
@@ -37059,8 +37080,8 @@ var QuickFilePickerContent = memo59(function QuickFilePickerContent2() {
37059
37080
  const inputRef = useRef45(null);
37060
37081
  const listRef = useRef45(null);
37061
37082
  const { data: filesData } = useFiles({ enabled: true, query });
37062
- const ignoredSet = useMemo39(() => new Set(filesData?.ignoredFiles ?? []), [filesData?.ignoredFiles]);
37063
- const filtered = useMemo39(() => {
37083
+ const ignoredSet = useMemo40(() => new Set(filesData?.ignoredFiles ?? []), [filesData?.ignoredFiles]);
37084
+ const filtered = useMemo40(() => {
37064
37085
  if (!filesData?.files)
37065
37086
  return [];
37066
37087
  if (!query)
@@ -40604,7 +40625,7 @@ var OnboardingModal = memo64(function OnboardingModal2({
40604
40625
  });
40605
40626
  });
40606
40627
  // src/components/dashboard/UsageDashboard.tsx
40607
- import { useCallback as useCallback49, useEffect as useEffect72, useMemo as useMemo40, useState as useState64 } from "react";
40628
+ import { useCallback as useCallback49, useEffect as useEffect72, useMemo as useMemo41, useState as useState64 } from "react";
40608
40629
  import { AlertTriangle as AlertTriangle3, ArrowLeft as ArrowLeft4, Globe2 as Globe25, RefreshCw as RefreshCw16 } from "lucide-react";
40609
40630
  import { jsx as jsx140, jsxs as jsxs122, Fragment as Fragment56 } from "react/jsx-runtime";
40610
40631
  function formatNumber(n) {
@@ -40654,7 +40675,7 @@ function authColor(t) {
40654
40675
  function DailyChart({ data }) {
40655
40676
  const [tab, setTab] = useState64("cost");
40656
40677
  const [hover, setHover] = useState64(null);
40657
- const max = useMemo40(() => {
40678
+ const max = useMemo41(() => {
40658
40679
  if (tab === "tokens") {
40659
40680
  return data.reduce((m, d) => Math.max(m, d.inputTokens + d.outputTokens), 0);
40660
40681
  }
@@ -41207,7 +41228,7 @@ function UsageDashboard({ onBack }) {
41207
41228
  else
41208
41229
  window.location.assign("/");
41209
41230
  }, [onBack]);
41210
- const projectName = useMemo40(() => {
41231
+ const projectName = useMemo41(() => {
41211
41232
  if (scope === "global") {
41212
41233
  const included = stats?.projects?.included.length ?? 0;
41213
41234
  const unavailable = stats?.projects?.unavailable.length ?? 0;
@@ -41653,4 +41674,4 @@ export {
41653
41674
  AgentProviderModelFields
41654
41675
  };
41655
41676
 
41656
- //# debugId=A8C93AE66ACB161064756E2164756E21
41677
+ //# debugId=D66BBFB439A9F5D264756E2164756E21