@ottocode/web-sdk 0.1.256 → 0.1.258

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.
@@ -4,8 +4,11 @@ export declare function useFileTree(dirPath: string, enabled?: boolean): import(
4
4
  path: string;
5
5
  type: "file" | "directory";
6
6
  gitignored?: boolean;
7
+ vendor?: boolean;
8
+ searchable?: boolean;
7
9
  }>;
8
10
  path: string;
11
+ truncated: boolean;
9
12
  }, Error>;
10
13
  export declare function useFileContent(filePath: string | null): import("@tanstack/react-query").UseQueryResult<{
11
14
  content: string;
@@ -1 +1 @@
1
- {"version":3,"file":"useFileBrowser.d.ts","sourceRoot":"","sources":["../../src/hooks/useFileBrowser.ts"],"names":[],"mappings":"AAGA,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,UAAO;;;;;kBA0BR,CAAC;;;UAlBnD;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;;;;;UAQrD;AAED,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,MAAM,UAAQ,EACd,OAAO,UAAQ,uFASf"}
1
+ {"version":3,"file":"useFileBrowser.d.ts","sourceRoot":"","sources":["../../src/hooks/useFileBrowser.ts"],"names":[],"mappings":"AAGA,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,UAAO;;;;;kBAiC+J,CAAC;cAAoB,CAAC;kBAAwB,CAAC;;;;UAzBxQ;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;;;;;UAQrD;AAED,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,MAAM,UAAQ,EACd,OAAO,UAAQ,uFASf"}
@@ -1,4 +1,7 @@
1
- export declare function useFiles(): import("@tanstack/react-query").UseQueryResult<{
1
+ export declare function useFiles(options?: {
2
+ enabled?: boolean;
3
+ query?: string;
4
+ }): import("@tanstack/react-query").UseQueryResult<{
2
5
  files: string[];
3
6
  ignoredFiles?: string[];
4
7
  changedFiles: Array<{
@@ -1 +1 @@
1
- {"version":3,"file":"useFiles.d.ts","sourceRoot":"","sources":["../../src/hooks/useFiles.ts"],"names":[],"mappings":"AAGA,wBAAgB,QAAQ;;;;;;;;UAWvB"}
1
+ {"version":3,"file":"useFiles.d.ts","sourceRoot":"","sources":["../../src/hooks/useFiles.ts"],"names":[],"mappings":"AAGA,wBAAgB,QAAQ,CAAC,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO;;;;;;;;UAY3E"}
package/dist/index.js CHANGED
@@ -1207,6 +1207,7 @@ var configMixin = {
1207
1207
  // src/lib/api-client/files.ts
1208
1208
  import {
1209
1209
  listFiles as apiListFiles,
1210
+ searchFiles as apiSearchFiles,
1210
1211
  getFileTree as apiGetFileTree,
1211
1212
  readFile as apiReadFile,
1212
1213
  getSessionFiles as apiGetSessionFiles
@@ -1218,6 +1219,12 @@ var filesMixin = {
1218
1219
  throw new Error(extractErrorMessage(response.error));
1219
1220
  return response.data;
1220
1221
  },
1222
+ async searchFiles(query = "") {
1223
+ const response = await apiSearchFiles({ query: { q: query } });
1224
+ if (response.error)
1225
+ throw new Error(extractErrorMessage(response.error));
1226
+ return response.data;
1227
+ },
1221
1228
  async getFileTree(dirPath = ".") {
1222
1229
  const response = await apiGetFileTree({
1223
1230
  query: { path: dirPath }
@@ -1684,6 +1691,7 @@ class ApiClient {
1684
1691
  deleteProviderSettings = configMixin.deleteProviderSettings;
1685
1692
  updateDefaults = configMixin.updateDefaults;
1686
1693
  listFiles = filesMixin.listFiles;
1694
+ searchFiles = filesMixin.searchFiles;
1687
1695
  getFileTree = filesMixin.getFileTree;
1688
1696
  readFileContent = filesMixin.readFileContent;
1689
1697
  getSessionFiles = filesMixin.getSessionFiles;
@@ -2732,13 +2740,14 @@ var ProviderLogo = memo2(function ProviderLogo2({
2732
2740
 
2733
2741
  // src/hooks/useFiles.ts
2734
2742
  import { useQuery as useQuery3 } from "@tanstack/react-query";
2735
- function useFiles() {
2743
+ function useFiles(options = {}) {
2736
2744
  return useQuery3({
2737
- queryKey: ["files"],
2745
+ queryKey: ["files", options.query ?? ""],
2738
2746
  queryFn: async () => {
2739
- const result = await apiClient.listFiles();
2747
+ const result = await apiClient.searchFiles(options.query ?? "");
2740
2748
  return result;
2741
2749
  },
2750
+ enabled: options.enabled ?? true,
2742
2751
  staleTime: 1e4,
2743
2752
  refetchOnWindowFocus: true,
2744
2753
  retry: 1
@@ -3558,12 +3567,9 @@ var ChatInput = memo4(forwardRef5(function ChatInput2({
3558
3567
  const [showAgentDropdown, setShowAgentDropdown] = useState8(false);
3559
3568
  const textareaRef = useRef3(null);
3560
3569
  const agentDropdownRef = useRef3(null);
3561
- const { data: filesData, isLoading: filesLoading } = useFiles();
3562
3570
  const { preferences: preferences2, updatePreferences } = usePreferences();
3563
3571
  const { data: configData } = useConfig();
3564
3572
  const updateDefaultsMutation = useUpdateDefaults();
3565
- const files = filesData?.files || [];
3566
- const changedFiles = filesData?.changedFiles || [];
3567
3573
  const setuSubscription = useOttoRouterStore((s) => s.subscription);
3568
3574
  const isSetu = providerName === "ottorouter";
3569
3575
  const setuPlanLabel = useMemo4(() => {
@@ -3598,6 +3604,12 @@ var ChatInput = memo4(forwardRef5(function ChatInput2({
3598
3604
  handleEnterSelect: handleMentionEnterSelect,
3599
3605
  checkForMention
3600
3606
  } = useFileMention();
3607
+ const { data: filesData, isLoading: filesLoading } = useFiles({
3608
+ enabled: showFileMention,
3609
+ query: mentionQuery
3610
+ });
3611
+ const files = filesData?.files || [];
3612
+ const changedFiles = filesData?.changedFiles || [];
3601
3613
  const {
3602
3614
  showCommandSuggestions,
3603
3615
  commandQuery,
@@ -24938,7 +24950,8 @@ function TreeDirectory({ dirPath }) {
24938
24950
  name: item.name,
24939
24951
  path: item.path,
24940
24952
  type: item.type,
24941
- gitignored: item.gitignored
24953
+ gitignored: item.gitignored,
24954
+ vendor: item.vendor
24942
24955
  }, item.path))
24943
24956
  });
24944
24957
  }
@@ -24946,7 +24959,8 @@ function TreeItem({
24946
24959
  name,
24947
24960
  path,
24948
24961
  type,
24949
- gitignored
24962
+ gitignored,
24963
+ vendor
24950
24964
  }) {
24951
24965
  const expandedDirs = useFileBrowserStore((s) => s.expandedDirs);
24952
24966
  const toggleDir = useFileBrowserStore((s) => s.toggleDir);
@@ -24966,7 +24980,7 @@ function TreeItem({
24966
24980
  /* @__PURE__ */ jsxs88("button", {
24967
24981
  type: "button",
24968
24982
  onClick: handleClick,
24969
- className: `w-full text-left flex items-center gap-1.5 px-2 py-1 text-sm hover:bg-muted/50 rounded transition-colors ${isSelected ? "bg-muted text-foreground" : "text-foreground/80"} ${gitignored ? "opacity-40" : ""}`,
24983
+ className: `w-full text-left flex items-center gap-1.5 px-2 py-1 text-sm hover:bg-muted/50 rounded transition-colors ${isSelected ? "bg-muted text-foreground" : "text-foreground/80"} ${gitignored || vendor ? "opacity-40" : ""}`,
24970
24984
  children: [
24971
24985
  type === "directory" ? /* @__PURE__ */ jsxs88(Fragment38, {
24972
24986
  children: [
@@ -25061,7 +25075,8 @@ var FileBrowserSidebar = memo42(function FileBrowserSidebar2() {
25061
25075
  name: item.name,
25062
25076
  path: item.path,
25063
25077
  type: item.type,
25064
- gitignored: item.gitignored
25078
+ gitignored: item.gitignored,
25079
+ vendor: item.vendor
25065
25080
  }, item.path))
25066
25081
  }),
25067
25082
  /* @__PURE__ */ jsxs88("div", {
@@ -25352,7 +25367,7 @@ var QuickFilePicker = memo45(function QuickFilePicker2() {
25352
25367
  const [selectedIndex, setSelectedIndex] = useState43(0);
25353
25368
  const inputRef = useRef31(null);
25354
25369
  const listRef = useRef31(null);
25355
- const { data: filesData } = useFiles();
25370
+ const { data: filesData } = useFiles({ enabled: isOpen, query });
25356
25371
  const ignoredSet = useMemo25(() => new Set(filesData?.ignoredFiles ?? []), [filesData?.ignoredFiles]);
25357
25372
  const filtered = useMemo25(() => {
25358
25373
  if (!filesData?.files)
@@ -28317,4 +28332,4 @@ export {
28317
28332
  API_BASE_URL
28318
28333
  };
28319
28334
 
28320
- //# debugId=0D6593457D16E9FE64756E2164756E21
28335
+ //# debugId=792F885FACB2DBCC64756E2164756E21