@sourcebot/mcp 1.0.14 → 1.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/schemas.d.ts CHANGED
@@ -98,7 +98,6 @@ export declare const searchRequestSchema: z.ZodObject<{
98
98
  isRegexEnabled: z.ZodOptional<z.ZodBoolean>;
99
99
  isCaseSensitivityEnabled: z.ZodOptional<z.ZodBoolean>;
100
100
  query: z.ZodString;
101
- source: z.ZodOptional<z.ZodString>;
102
101
  }, "strip", z.ZodTypeAny, {
103
102
  matches: number;
104
103
  query: string;
@@ -106,7 +105,6 @@ export declare const searchRequestSchema: z.ZodObject<{
106
105
  whole?: boolean | undefined;
107
106
  isRegexEnabled?: boolean | undefined;
108
107
  isCaseSensitivityEnabled?: boolean | undefined;
109
- source?: string | undefined;
110
108
  }, {
111
109
  matches: number;
112
110
  query: string;
@@ -114,7 +112,6 @@ export declare const searchRequestSchema: z.ZodObject<{
114
112
  whole?: boolean | undefined;
115
113
  isRegexEnabled?: boolean | undefined;
116
114
  isCaseSensitivityEnabled?: boolean | undefined;
117
- source?: string | undefined;
118
115
  }>;
119
116
  export declare const repositoryInfoSchema: z.ZodObject<{
120
117
  id: z.ZodNumber;
@@ -901,31 +898,154 @@ export declare const fileSourceResponseSchema: z.ZodObject<{
901
898
  repoCodeHostType: z.ZodString;
902
899
  repoDisplayName: z.ZodOptional<z.ZodString>;
903
900
  repoExternalWebUrl: z.ZodOptional<z.ZodString>;
904
- branch: z.ZodOptional<z.ZodString>;
905
901
  webUrl: z.ZodString;
906
902
  externalWebUrl: z.ZodOptional<z.ZodString>;
907
903
  }, "strip", z.ZodTypeAny, {
908
904
  path: string;
909
- source: string;
910
905
  webUrl: string;
911
906
  language: string;
912
907
  repo: string;
908
+ source: string;
913
909
  repoCodeHostType: string;
914
910
  externalWebUrl?: string | undefined;
915
911
  repoDisplayName?: string | undefined;
916
912
  repoExternalWebUrl?: string | undefined;
917
- branch?: string | undefined;
918
913
  }, {
919
914
  path: string;
920
- source: string;
921
915
  webUrl: string;
922
916
  language: string;
923
917
  repo: string;
918
+ source: string;
924
919
  repoCodeHostType: string;
925
920
  externalWebUrl?: string | undefined;
926
921
  repoDisplayName?: string | undefined;
927
922
  repoExternalWebUrl?: string | undefined;
928
- branch?: string | undefined;
923
+ }>;
924
+ type TreeNode = {
925
+ type: string;
926
+ path: string;
927
+ name: string;
928
+ children: TreeNode[];
929
+ };
930
+ export declare const listTreeApiRequestSchema: z.ZodObject<{
931
+ repoName: z.ZodString;
932
+ revisionName: z.ZodString;
933
+ paths: z.ZodArray<z.ZodString, "many">;
934
+ }, "strip", z.ZodTypeAny, {
935
+ repoName: string;
936
+ revisionName: string;
937
+ paths: string[];
938
+ }, {
939
+ repoName: string;
940
+ revisionName: string;
941
+ paths: string[];
942
+ }>;
943
+ export declare const listTreeApiResponseSchema: z.ZodObject<{
944
+ tree: z.ZodType<TreeNode, z.ZodTypeDef, TreeNode>;
945
+ }, "strip", z.ZodTypeAny, {
946
+ tree: TreeNode;
947
+ }, {
948
+ tree: TreeNode;
949
+ }>;
950
+ export declare const DEFAULT_TREE_DEPTH = 1;
951
+ export declare const MAX_TREE_DEPTH = 10;
952
+ export declare const DEFAULT_MAX_TREE_ENTRIES = 1000;
953
+ export declare const MAX_MAX_TREE_ENTRIES = 10000;
954
+ export declare const listTreeRequestSchema: z.ZodObject<{
955
+ repo: z.ZodString;
956
+ path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
957
+ ref: z.ZodDefault<z.ZodOptional<z.ZodString>>;
958
+ depth: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
959
+ includeFiles: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
960
+ includeDirectories: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
961
+ maxEntries: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
962
+ }, "strip", z.ZodTypeAny, {
963
+ path: string;
964
+ repo: string;
965
+ ref: string;
966
+ depth: number;
967
+ includeFiles: boolean;
968
+ includeDirectories: boolean;
969
+ maxEntries: number;
970
+ }, {
971
+ repo: string;
972
+ path?: string | undefined;
973
+ ref?: string | undefined;
974
+ depth?: number | undefined;
975
+ includeFiles?: boolean | undefined;
976
+ includeDirectories?: boolean | undefined;
977
+ maxEntries?: number | undefined;
978
+ }>;
979
+ export declare const listTreeEntrySchema: z.ZodObject<{
980
+ type: z.ZodEnum<["tree", "blob"]>;
981
+ path: z.ZodString;
982
+ name: z.ZodString;
983
+ parentPath: z.ZodString;
984
+ depth: z.ZodNumber;
985
+ }, "strip", z.ZodTypeAny, {
986
+ path: string;
987
+ type: "tree" | "blob";
988
+ name: string;
989
+ depth: number;
990
+ parentPath: string;
991
+ }, {
992
+ path: string;
993
+ type: "tree" | "blob";
994
+ name: string;
995
+ depth: number;
996
+ parentPath: string;
997
+ }>;
998
+ export declare const listTreeResponseSchema: z.ZodObject<{
999
+ repo: z.ZodString;
1000
+ ref: z.ZodString;
1001
+ path: z.ZodString;
1002
+ entries: z.ZodArray<z.ZodObject<{
1003
+ type: z.ZodEnum<["tree", "blob"]>;
1004
+ path: z.ZodString;
1005
+ name: z.ZodString;
1006
+ parentPath: z.ZodString;
1007
+ depth: z.ZodNumber;
1008
+ }, "strip", z.ZodTypeAny, {
1009
+ path: string;
1010
+ type: "tree" | "blob";
1011
+ name: string;
1012
+ depth: number;
1013
+ parentPath: string;
1014
+ }, {
1015
+ path: string;
1016
+ type: "tree" | "blob";
1017
+ name: string;
1018
+ depth: number;
1019
+ parentPath: string;
1020
+ }>, "many">;
1021
+ totalReturned: z.ZodNumber;
1022
+ truncated: z.ZodBoolean;
1023
+ }, "strip", z.ZodTypeAny, {
1024
+ path: string;
1025
+ entries: {
1026
+ path: string;
1027
+ type: "tree" | "blob";
1028
+ name: string;
1029
+ depth: number;
1030
+ parentPath: string;
1031
+ }[];
1032
+ repo: string;
1033
+ ref: string;
1034
+ totalReturned: number;
1035
+ truncated: boolean;
1036
+ }, {
1037
+ path: string;
1038
+ entries: {
1039
+ path: string;
1040
+ type: "tree" | "blob";
1041
+ name: string;
1042
+ depth: number;
1043
+ parentPath: string;
1044
+ }[];
1045
+ repo: string;
1046
+ ref: string;
1047
+ totalReturned: number;
1048
+ truncated: boolean;
929
1049
  }>;
930
1050
  export declare const serviceErrorSchema: z.ZodObject<{
931
1051
  statusCode: z.ZodNumber;
@@ -993,3 +1113,117 @@ export declare const listCommitsResponseSchema: z.ZodArray<z.ZodObject<{
993
1113
  author_name: string;
994
1114
  author_email: string;
995
1115
  }>, "many">;
1116
+ export declare const languageModelInfoSchema: z.ZodObject<{
1117
+ provider: z.ZodString;
1118
+ model: z.ZodString;
1119
+ displayName: z.ZodOptional<z.ZodString>;
1120
+ }, "strip", z.ZodTypeAny, {
1121
+ provider: string;
1122
+ model: string;
1123
+ displayName?: string | undefined;
1124
+ }, {
1125
+ provider: string;
1126
+ model: string;
1127
+ displayName?: string | undefined;
1128
+ }>;
1129
+ export declare const listLanguageModelsResponseSchema: z.ZodArray<z.ZodObject<{
1130
+ provider: z.ZodString;
1131
+ model: z.ZodString;
1132
+ displayName: z.ZodOptional<z.ZodString>;
1133
+ }, "strip", z.ZodTypeAny, {
1134
+ provider: string;
1135
+ model: string;
1136
+ displayName?: string | undefined;
1137
+ }, {
1138
+ provider: string;
1139
+ model: string;
1140
+ displayName?: string | undefined;
1141
+ }>, "many">;
1142
+ export declare const askCodebaseRequestSchema: z.ZodObject<{
1143
+ query: z.ZodString;
1144
+ repos: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1145
+ languageModel: z.ZodOptional<z.ZodObject<Omit<{
1146
+ provider: z.ZodString;
1147
+ model: z.ZodString;
1148
+ displayName: z.ZodOptional<z.ZodString>;
1149
+ }, "displayName">, "strip", z.ZodTypeAny, {
1150
+ provider: string;
1151
+ model: string;
1152
+ }, {
1153
+ provider: string;
1154
+ model: string;
1155
+ }>>;
1156
+ }, "strip", z.ZodTypeAny, {
1157
+ query: string;
1158
+ repos?: string[] | undefined;
1159
+ languageModel?: {
1160
+ provider: string;
1161
+ model: string;
1162
+ } | undefined;
1163
+ }, {
1164
+ query: string;
1165
+ repos?: string[] | undefined;
1166
+ languageModel?: {
1167
+ provider: string;
1168
+ model: string;
1169
+ } | undefined;
1170
+ }>;
1171
+ export declare const sourceSchema: z.ZodObject<{
1172
+ type: z.ZodLiteral<"file">;
1173
+ repo: z.ZodString;
1174
+ path: z.ZodString;
1175
+ name: z.ZodString;
1176
+ language: z.ZodString;
1177
+ revision: z.ZodString;
1178
+ }, "strip", z.ZodTypeAny, {
1179
+ path: string;
1180
+ type: "file";
1181
+ name: string;
1182
+ language: string;
1183
+ repo: string;
1184
+ revision: string;
1185
+ }, {
1186
+ path: string;
1187
+ type: "file";
1188
+ name: string;
1189
+ language: string;
1190
+ repo: string;
1191
+ revision: string;
1192
+ }>;
1193
+ export declare const askCodebaseResponseSchema: z.ZodObject<{
1194
+ answer: z.ZodString;
1195
+ chatId: z.ZodString;
1196
+ chatUrl: z.ZodString;
1197
+ languageModel: z.ZodObject<{
1198
+ provider: z.ZodString;
1199
+ model: z.ZodString;
1200
+ displayName: z.ZodOptional<z.ZodString>;
1201
+ }, "strip", z.ZodTypeAny, {
1202
+ provider: string;
1203
+ model: string;
1204
+ displayName?: string | undefined;
1205
+ }, {
1206
+ provider: string;
1207
+ model: string;
1208
+ displayName?: string | undefined;
1209
+ }>;
1210
+ }, "strip", z.ZodTypeAny, {
1211
+ languageModel: {
1212
+ provider: string;
1213
+ model: string;
1214
+ displayName?: string | undefined;
1215
+ };
1216
+ answer: string;
1217
+ chatId: string;
1218
+ chatUrl: string;
1219
+ }, {
1220
+ languageModel: {
1221
+ provider: string;
1222
+ model: string;
1223
+ displayName?: string | undefined;
1224
+ };
1225
+ answer: string;
1226
+ chatId: string;
1227
+ chatUrl: string;
1228
+ }>;
1229
+ export {};
package/dist/schemas.js CHANGED
@@ -26,7 +26,6 @@ export const searchOptionsSchema = z.object({
26
26
  });
27
27
  export const searchRequestSchema = z.object({
28
28
  query: z.string(), // The zoekt query to execute.
29
- source: z.string().optional(), // The source of the search request.
30
29
  ...searchOptionsSchema.shape,
31
30
  });
32
31
  export const repositoryInfoSchema = z.object({
@@ -180,10 +179,83 @@ export const fileSourceResponseSchema = z.object({
180
179
  repoCodeHostType: z.string(),
181
180
  repoDisplayName: z.string().optional(),
182
181
  repoExternalWebUrl: z.string().optional(),
183
- branch: z.string().optional(),
184
182
  webUrl: z.string(),
185
183
  externalWebUrl: z.string().optional(),
186
184
  });
185
+ const treeNodeSchema = z.lazy(() => z.object({
186
+ type: z.string(),
187
+ path: z.string(),
188
+ name: z.string(),
189
+ children: z.array(treeNodeSchema),
190
+ }));
191
+ export const listTreeApiRequestSchema = z.object({
192
+ repoName: z.string(),
193
+ revisionName: z.string(),
194
+ paths: z.array(z.string()),
195
+ });
196
+ export const listTreeApiResponseSchema = z.object({
197
+ tree: treeNodeSchema,
198
+ });
199
+ export const DEFAULT_TREE_DEPTH = 1;
200
+ export const MAX_TREE_DEPTH = 10;
201
+ export const DEFAULT_MAX_TREE_ENTRIES = 1000;
202
+ export const MAX_MAX_TREE_ENTRIES = 10000;
203
+ export const listTreeRequestSchema = z.object({
204
+ repo: z
205
+ .string()
206
+ .describe("The name of the repository to list files from."),
207
+ path: z
208
+ .string()
209
+ .describe("Directory path (relative to repo root). If omitted, the repo root is used.")
210
+ .optional()
211
+ .default(''),
212
+ ref: z
213
+ .string()
214
+ .describe("Commit SHA, branch or tag name to list files from. If not provided, uses the default branch.")
215
+ .optional()
216
+ .default('HEAD'),
217
+ depth: z
218
+ .number()
219
+ .int()
220
+ .positive()
221
+ .max(MAX_TREE_DEPTH)
222
+ .describe(`How many directory levels to traverse below \`path\` (min 1, max ${MAX_TREE_DEPTH}, default ${DEFAULT_TREE_DEPTH}).`)
223
+ .optional()
224
+ .default(DEFAULT_TREE_DEPTH),
225
+ includeFiles: z
226
+ .boolean()
227
+ .describe("Whether to include files in the output (default: true).")
228
+ .optional()
229
+ .default(true),
230
+ includeDirectories: z
231
+ .boolean()
232
+ .describe("Whether to include directories in the output (default: true).")
233
+ .optional()
234
+ .default(true),
235
+ maxEntries: z
236
+ .number()
237
+ .int()
238
+ .positive()
239
+ .max(MAX_MAX_TREE_ENTRIES)
240
+ .describe(`Maximum number of entries to return (min 1, max ${MAX_MAX_TREE_ENTRIES}, default ${DEFAULT_MAX_TREE_ENTRIES}).`)
241
+ .optional()
242
+ .default(DEFAULT_MAX_TREE_ENTRIES),
243
+ });
244
+ export const listTreeEntrySchema = z.object({
245
+ type: z.enum(['tree', 'blob']),
246
+ path: z.string(),
247
+ name: z.string(),
248
+ parentPath: z.string(),
249
+ depth: z.number().int().positive(),
250
+ });
251
+ export const listTreeResponseSchema = z.object({
252
+ repo: z.string(),
253
+ ref: z.string(),
254
+ path: z.string(),
255
+ entries: z.array(listTreeEntrySchema),
256
+ totalReturned: z.number().int().nonnegative(),
257
+ truncated: z.boolean(),
258
+ });
187
259
  export const serviceErrorSchema = z.object({
188
260
  statusCode: z.number(),
189
261
  errorCode: z.string(),
@@ -238,4 +310,41 @@ export const listCommitsResponseSchema = z.array(z.object({
238
310
  author_name: z.string(),
239
311
  author_email: z.string(),
240
312
  }));
313
+ export const languageModelInfoSchema = z.object({
314
+ provider: z.string().describe("The model provider (e.g., 'anthropic', 'openai')"),
315
+ model: z.string().describe("The model ID"),
316
+ displayName: z.string().optional().describe("Optional display name for the model"),
317
+ });
318
+ export const listLanguageModelsResponseSchema = z.array(languageModelInfoSchema);
319
+ export const askCodebaseRequestSchema = z.object({
320
+ query: z
321
+ .string()
322
+ .describe("The query to ask about the codebase."),
323
+ repos: z
324
+ .array(z.string())
325
+ .optional()
326
+ .describe("The repositories that are accessible to the agent during the chat. If not provided, all repositories are accessible."),
327
+ languageModel: languageModelInfoSchema
328
+ .omit({ displayName: true })
329
+ .optional()
330
+ .describe("The language model to use for answering the question. If not provided, defaults to the first model in the config. Use list_language_models to see available options."),
331
+ });
332
+ export const sourceSchema = z.object({
333
+ type: z.literal('file'),
334
+ repo: z.string(),
335
+ path: z.string(),
336
+ name: z.string(),
337
+ language: z.string(),
338
+ revision: z.string(),
339
+ });
340
+ export const askCodebaseResponseSchema = z.object({
341
+ answer: z.string().describe("The agent's final answer in markdown format"),
342
+ chatId: z.string().describe("ID of the persisted chat session"),
343
+ chatUrl: z.string().describe("URL to view the chat in the web UI"),
344
+ languageModel: z.object({
345
+ provider: z.string().describe("The model provider (e.g., 'anthropic', 'openai')"),
346
+ model: z.string().describe("The model ID"),
347
+ displayName: z.string().optional().describe("Optional display name for the model"),
348
+ }).describe("The language model used to generate the response"),
349
+ });
241
350
  //# sourceMappingURL=schemas.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,6DAA6D;AAC7D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,qDAAqD;IACrD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,qDAAqD;IACrD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,8DAA8D;IAC9D,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;CACrB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,KAAK,EAAE,cAAc;IACrB,GAAG,EAAE,cAAc;CACtB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;CACnB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,OAAO,EAAE,CAAC,CAAC,MAAM,EA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AI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;CAC3B,CAAC,CAAC,CAAC","sourcesContent":["// @NOTE : Please keep this file in sync with @sourcebot/web/src/features/search/types.ts\n// At some point, we should move these to a shared package...\nimport { z } from \"zod\";\n\nexport const locationSchema = z.object({\n // 0-based byte offset from the beginning of the file\n byteOffset: z.number(),\n // 1-based line number from the beginning of the file\n lineNumber: z.number(),\n // 1-based column number (in runes) from the beginning of line\n column: z.number(),\n});\n\nexport const rangeSchema = z.object({\n start: locationSchema,\n end: locationSchema,\n});\n\nexport const symbolSchema = z.object({\n symbol: z.string(),\n kind: z.string(),\n});\n\nexport const searchOptionsSchema = z.object({\n matches: z.number(), // The number of matches to return.\n contextLines: z.number().optional(), // The number of context lines to return.\n whole: z.boolean().optional(), // Whether to return the whole file as part of the response.\n isRegexEnabled: z.boolean().optional(), // Whether to enable regular expression search.\n isCaseSensitivityEnabled: z.boolean().optional(), // Whether to enable case sensitivity.\n});\n\nexport const searchRequestSchema = z.object({\n query: z.string(), // The zoekt query to execute.\n source: z.string().optional(), // The source of the search request.\n ...searchOptionsSchema.shape,\n});\n\nexport const repositoryInfoSchema = z.object({\n id: z.number(),\n codeHostType: z.string(),\n name: z.string(),\n displayName: z.string().optional(),\n webUrl: z.string().optional(),\n});\n\n// Many of these fields are defined in zoekt/api.go.\nexport const searchStatsSchema = z.object({\n // The actual number of matches returned by the search.\n // This will always be less than or equal to `totalMatchCount`.\n actualMatchCount: z.number(),\n\n // The total number of matches found during the search.\n totalMatchCount: z.number(),\n\n // The duration (in nanoseconds) of the search.\n duration: z.number(),\n\n // Number of files containing a match.\n fileCount: z.number(),\n\n // Candidate files whose contents weren't examined because we\n // gathered enough matches.\n filesSkipped: z.number(),\n\n // Amount of I/O for reading contents.\n contentBytesLoaded: z.number(),\n\n // Amount of I/O for reading from index.\n indexBytesLoaded: z.number(),\n\n // Number of search shards that had a crash.\n crashes: z.number(),\n\n // Number of files in shards that we considered.\n shardFilesConsidered: z.number(),\n\n // Files that we evaluated. Equivalent to files for which all\n // atom matches (including negations) evaluated to true.\n filesConsidered: z.number(),\n\n // Files for which we loaded file content to verify substring matches\n filesLoaded: z.number(),\n\n // Shards that we scanned to find matches.\n shardsScanned: z.number(),\n\n // Shards that we did not process because a query was canceled.\n shardsSkipped: z.number(),\n\n // Shards that we did not process because the query was rejected by the\n // ngram filter indicating it had no matches.\n shardsSkippedFilter: z.number(),\n\n // Number of candidate matches as a result of searching ngrams.\n ngramMatches: z.number(),\n\n // NgramLookups is the number of times we accessed an ngram in the index.\n ngramLookups: z.number(),\n\n // Wall clock time for queued search.\n wait: z.number(),\n\n // Aggregate wall clock time spent constructing and pruning the match tree.\n // This accounts for time such as lookups in the trigram index.\n matchTreeConstruction: z.number(),\n\n // Aggregate wall clock time spent searching the match tree. This accounts\n // for the bulk of search work done looking for matches.\n matchTreeSearch: z.number(),\n\n // Number of times regexp was called on files that we evaluated.\n regexpsConsidered: z.number(),\n\n // FlushReason explains why results were flushed.\n flushReason: z.string(),\n});\n\nexport const searchResponseSchema = z.object({\n stats: searchStatsSchema,\n files: z.array(z.object({\n fileName: z.object({\n // The name of the file\n text: z.string(),\n // Any matching ranges\n matchRanges: z.array(rangeSchema),\n }),\n webUrl: z.string(),\n externalWebUrl: z.string().optional(),\n repository: z.string(),\n repositoryId: z.number(),\n language: z.string(),\n chunks: z.array(z.object({\n content: z.string(),\n matchRanges: z.array(rangeSchema),\n contentStart: locationSchema,\n symbols: z.array(z.object({\n ...symbolSchema.shape,\n parent: symbolSchema.optional(),\n })).optional(),\n })),\n branches: z.array(z.string()).optional(),\n // Set if `whole` is true.\n content: z.string().optional(),\n })),\n repositoryInfo: z.array(repositoryInfoSchema),\n isSearchExhaustive: z.boolean(),\n});\n\nexport const repositoryQuerySchema = z.object({\n codeHostType: z.string(),\n repoId: z.number(),\n repoName: z.string(),\n repoDisplayName: z.string().optional(),\n webUrl: z.string(),\n externalWebUrl: z.string().optional(),\n imageUrl: z.string().optional(),\n indexedAt: z.coerce.date().optional(),\n pushedAt: z.coerce.date().optional(),\n});\n\nexport const listReposResponseSchema = repositoryQuerySchema.array();\n\nexport const listReposQueryParamsSchema = z.object({\n query: z\n .string()\n .describe(\"Filter repositories by name (case-insensitive)\")\n .optional(),\n page: z\n .number()\n .int()\n .positive()\n .describe(\"Page number for pagination (min 1). Default: 1\")\n .optional()\n .default(1),\n perPage: z\n .number()\n .int()\n .positive()\n .max(100)\n .describe(\"Results per page for pagination (min 1, max 100). Default: 30\")\n .optional()\n .default(30),\n sort: z\n .enum(['name', 'pushed'])\n .describe(\"Sort repositories by 'name' or 'pushed' (most recent commit). Default: 'name'\")\n .optional()\n .default('name'),\n direction: z\n .enum(['asc', 'desc'])\n .describe(\"Sort direction: 'asc' or 'desc'. Default: 'asc'\")\n .optional()\n .default('asc'),\n});\n\nexport const fileSourceRequestSchema = z.object({\n repo: z\n .string()\n .describe(\"The repository name.\"),\n path: z\n .string()\n .describe(\"The path to the file.\"),\n ref: z\n .string()\n .optional()\n .describe(\"Commit SHA, branch or tag name to fetch the source code for. If not provided, uses the default branch of the repository.\"),\n});\n\nexport const fileSourceResponseSchema = z.object({\n source: z.string(),\n language: z.string(),\n path: z.string(),\n repo: z.string(),\n repoCodeHostType: z.string(),\n repoDisplayName: z.string().optional(),\n repoExternalWebUrl: z.string().optional(),\n branch: z.string().optional(),\n webUrl: z.string(),\n externalWebUrl: z.string().optional(),\n});\n\nexport const serviceErrorSchema = z.object({\n statusCode: z.number(),\n errorCode: z.string(),\n message: z.string(),\n});\n\nexport const listCommitsQueryParamsSchema = z.object({\n repo: z\n .string()\n .describe(\"The name of the repository to list commits for.\"),\n query: z\n .string()\n .describe(\"Search query to filter commits by message content (case-insensitive).\")\n .optional(),\n since: z\n .string()\n .describe(`Show commits more recent than this date. Filters by actual commit time. Supports ISO 8601 (e.g., '2024-01-01') or relative formats (e.g., '30 days ago', 'last week').`)\n .optional(),\n until: z\n .string()\n .describe(`Show commits older than this date. Filters by actual commit time. Supports ISO 8601 (e.g., '2024-12-31') or relative formats (e.g., 'yesterday').`)\n .optional(),\n author: z\n .string()\n .describe(`Filter commits by author name or email (case-insensitive).`)\n .optional(),\n ref: z\n .string()\n .describe(\"Commit SHA, branch or tag name to list commits of. If not provided, uses the default branch of the repository.\")\n .optional(),\n page: z\n .number()\n .int()\n .positive()\n .describe(\"Page number for pagination (min 1). Default: 1\")\n .optional()\n .default(1),\n perPage: z\n .number()\n .int()\n .positive()\n .max(100)\n .describe(\"Results per page for pagination (min 1, max 100). Default: 50\")\n .optional()\n .default(50),\n});\n\nexport const listCommitsResponseSchema = z.array(z.object({\n hash: z.string(),\n date: z.string(),\n message: z.string(),\n refs: z.string(),\n body: z.string(),\n author_name: z.string(),\n author_email: z.string(),\n}));\n"]}
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,6DAA6D;AAC7D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,qDAAqD;IACrD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,qDAAqD;IACrD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,8DAA8D;IAC9D,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;CACrB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,KAAK,EAAE,cAAc;IACrB,GAAG,EAAE,cAAc;CACtB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,I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AAC,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IACvB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;CACvB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6CAA6C,CAAC;IAC1E,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;IAC/D,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;IAClE,aAAa,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kDAAkD,CAAC;QACjF,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;QAC1C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;KACrF,CAAC,CAAC,QAAQ,CAAC,kDAAkD,CAAC;CAClE,CAAC,CAAC","sourcesContent":["// @NOTE : Please keep this file in sync with @sourcebot/web/src/features/search/types.ts\n// At some point, we should move these to a shared package...\nimport { z } from \"zod\";\n\nexport const locationSchema = z.object({\n // 0-based byte offset from the beginning of the file\n byteOffset: z.number(),\n // 1-based line number from the beginning of the file\n lineNumber: z.number(),\n // 1-based column number (in runes) from the beginning of line\n column: z.number(),\n});\n\nexport const rangeSchema = z.object({\n start: locationSchema,\n end: locationSchema,\n});\n\nexport const symbolSchema = z.object({\n symbol: z.string(),\n kind: z.string(),\n});\n\nexport const searchOptionsSchema = z.object({\n matches: z.number(), // The number of matches to return.\n contextLines: z.number().optional(), // The number of context lines to return.\n whole: z.boolean().optional(), // Whether to return the whole file as part of the response.\n isRegexEnabled: z.boolean().optional(), // Whether to enable regular expression search.\n isCaseSensitivityEnabled: z.boolean().optional(), // Whether to enable case sensitivity.\n});\n\nexport const searchRequestSchema = z.object({\n query: z.string(), // The zoekt query to execute.\n ...searchOptionsSchema.shape,\n});\n\nexport const repositoryInfoSchema = z.object({\n id: z.number(),\n codeHostType: z.string(),\n name: z.string(),\n displayName: z.string().optional(),\n webUrl: z.string().optional(),\n});\n\n// Many of these fields are defined in zoekt/api.go.\nexport const searchStatsSchema = z.object({\n // The actual number of matches returned by the search.\n // This will always be less than or equal to `totalMatchCount`.\n actualMatchCount: z.number(),\n\n // The total number of matches found during the search.\n totalMatchCount: z.number(),\n\n // The duration (in nanoseconds) of the search.\n duration: z.number(),\n\n // Number of files containing a match.\n fileCount: z.number(),\n\n // Candidate files whose contents weren't examined because we\n // gathered enough matches.\n filesSkipped: z.number(),\n\n // Amount of I/O for reading contents.\n contentBytesLoaded: z.number(),\n\n // Amount of I/O for reading from index.\n indexBytesLoaded: z.number(),\n\n // Number of search shards that had a crash.\n crashes: z.number(),\n\n // Number of files in shards that we considered.\n shardFilesConsidered: z.number(),\n\n // Files that we evaluated. Equivalent to files for which all\n // atom matches (including negations) evaluated to true.\n filesConsidered: z.number(),\n\n // Files for which we loaded file content to verify substring matches\n filesLoaded: z.number(),\n\n // Shards that we scanned to find matches.\n shardsScanned: z.number(),\n\n // Shards that we did not process because a query was canceled.\n shardsSkipped: z.number(),\n\n // Shards that we did not process because the query was rejected by the\n // ngram filter indicating it had no matches.\n shardsSkippedFilter: z.number(),\n\n // Number of candidate matches as a result of searching ngrams.\n ngramMatches: z.number(),\n\n // NgramLookups is the number of times we accessed an ngram in the index.\n ngramLookups: z.number(),\n\n // Wall clock time for queued search.\n wait: z.number(),\n\n // Aggregate wall clock time spent constructing and pruning the match tree.\n // This accounts for time such as lookups in the trigram index.\n matchTreeConstruction: z.number(),\n\n // Aggregate wall clock time spent searching the match tree. This accounts\n // for the bulk of search work done looking for matches.\n matchTreeSearch: z.number(),\n\n // Number of times regexp was called on files that we evaluated.\n regexpsConsidered: z.number(),\n\n // FlushReason explains why results were flushed.\n flushReason: z.string(),\n});\n\nexport const searchResponseSchema = z.object({\n stats: searchStatsSchema,\n files: z.array(z.object({\n fileName: z.object({\n // The name of the file\n text: z.string(),\n // Any matching ranges\n matchRanges: z.array(rangeSchema),\n }),\n webUrl: z.string(),\n externalWebUrl: z.string().optional(),\n repository: z.string(),\n repositoryId: z.number(),\n language: z.string(),\n chunks: z.array(z.object({\n content: z.string(),\n matchRanges: z.array(rangeSchema),\n contentStart: locationSchema,\n symbols: z.array(z.object({\n ...symbolSchema.shape,\n parent: symbolSchema.optional(),\n })).optional(),\n })),\n branches: z.array(z.string()).optional(),\n // Set if `whole` is true.\n content: z.string().optional(),\n })),\n repositoryInfo: z.array(repositoryInfoSchema),\n isSearchExhaustive: z.boolean(),\n});\n\nexport const repositoryQuerySchema = z.object({\n codeHostType: z.string(),\n repoId: z.number(),\n repoName: z.string(),\n repoDisplayName: z.string().optional(),\n webUrl: z.string(),\n externalWebUrl: z.string().optional(),\n imageUrl: z.string().optional(),\n indexedAt: z.coerce.date().optional(),\n pushedAt: z.coerce.date().optional(),\n});\n\nexport const listReposResponseSchema = repositoryQuerySchema.array();\n\nexport const listReposQueryParamsSchema = z.object({\n query: z\n .string()\n .describe(\"Filter repositories by name (case-insensitive)\")\n .optional(),\n page: z\n .number()\n .int()\n .positive()\n .describe(\"Page number for pagination (min 1). Default: 1\")\n .optional()\n .default(1),\n perPage: z\n .number()\n .int()\n .positive()\n .max(100)\n .describe(\"Results per page for pagination (min 1, max 100). Default: 30\")\n .optional()\n .default(30),\n sort: z\n .enum(['name', 'pushed'])\n .describe(\"Sort repositories by 'name' or 'pushed' (most recent commit). Default: 'name'\")\n .optional()\n .default('name'),\n direction: z\n .enum(['asc', 'desc'])\n .describe(\"Sort direction: 'asc' or 'desc'. Default: 'asc'\")\n .optional()\n .default('asc'),\n});\n\nexport const fileSourceRequestSchema = z.object({\n repo: z\n .string()\n .describe(\"The repository name.\"),\n path: z\n .string()\n .describe(\"The path to the file.\"),\n ref: z\n .string()\n .optional()\n .describe(\"Commit SHA, branch or tag name to fetch the source code for. If not provided, uses the default branch of the repository.\"),\n});\n\nexport const fileSourceResponseSchema = z.object({\n source: z.string(),\n language: z.string(),\n path: z.string(),\n repo: z.string(),\n repoCodeHostType: z.string(),\n repoDisplayName: z.string().optional(),\n repoExternalWebUrl: z.string().optional(),\n webUrl: z.string(),\n externalWebUrl: z.string().optional(),\n});\n\ntype TreeNode = {\n type: string;\n path: string;\n name: string;\n children: TreeNode[];\n};\n\nconst treeNodeSchema: z.ZodType<TreeNode> = z.lazy(() => z.object({\n type: z.string(),\n path: z.string(),\n name: z.string(),\n children: z.array(treeNodeSchema),\n}));\n\nexport const listTreeApiRequestSchema = z.object({\n repoName: z.string(),\n revisionName: z.string(),\n paths: z.array(z.string()),\n});\n\nexport const listTreeApiResponseSchema = z.object({\n tree: treeNodeSchema,\n});\n\nexport const DEFAULT_TREE_DEPTH = 1;\nexport const MAX_TREE_DEPTH = 10;\nexport const DEFAULT_MAX_TREE_ENTRIES = 1000;\nexport const MAX_MAX_TREE_ENTRIES = 10000;\n\nexport const listTreeRequestSchema = z.object({\n repo: z\n .string()\n .describe(\"The name of the repository to list files from.\"),\n path: z\n .string()\n .describe(\"Directory path (relative to repo root). If omitted, the repo root is used.\")\n .optional()\n .default(''),\n ref: z\n .string()\n .describe(\"Commit SHA, branch or tag name to list files from. If not provided, uses the default branch.\")\n .optional()\n .default('HEAD'),\n depth: z\n .number()\n .int()\n .positive()\n .max(MAX_TREE_DEPTH)\n .describe(`How many directory levels to traverse below \\`path\\` (min 1, max ${MAX_TREE_DEPTH}, default ${DEFAULT_TREE_DEPTH}).`)\n .optional()\n .default(DEFAULT_TREE_DEPTH),\n includeFiles: z\n .boolean()\n .describe(\"Whether to include files in the output (default: true).\")\n .optional()\n .default(true),\n includeDirectories: z\n .boolean()\n .describe(\"Whether to include directories in the output (default: true).\")\n .optional()\n .default(true),\n maxEntries: z\n .number()\n .int()\n .positive()\n .max(MAX_MAX_TREE_ENTRIES)\n .describe(`Maximum number of entries to return (min 1, max ${MAX_MAX_TREE_ENTRIES}, default ${DEFAULT_MAX_TREE_ENTRIES}).`)\n .optional()\n .default(DEFAULT_MAX_TREE_ENTRIES),\n});\n\nexport const listTreeEntrySchema = z.object({\n type: z.enum(['tree', 'blob']),\n path: z.string(),\n name: z.string(),\n parentPath: z.string(),\n depth: z.number().int().positive(),\n});\n\nexport const listTreeResponseSchema = z.object({\n repo: z.string(),\n ref: z.string(),\n path: z.string(),\n entries: z.array(listTreeEntrySchema),\n totalReturned: z.number().int().nonnegative(),\n truncated: z.boolean(),\n});\n\nexport const serviceErrorSchema = z.object({\n statusCode: z.number(),\n errorCode: z.string(),\n message: z.string(),\n});\n\nexport const listCommitsQueryParamsSchema = z.object({\n repo: z\n .string()\n .describe(\"The name of the repository to list commits for.\"),\n query: z\n .string()\n .describe(\"Search query to filter commits by message content (case-insensitive).\")\n .optional(),\n since: z\n .string()\n .describe(`Show commits more recent than this date. Filters by actual commit time. Supports ISO 8601 (e.g., '2024-01-01') or relative formats (e.g., '30 days ago', 'last week').`)\n .optional(),\n until: z\n .string()\n .describe(`Show commits older than this date. Filters by actual commit time. Supports ISO 8601 (e.g., '2024-12-31') or relative formats (e.g., 'yesterday').`)\n .optional(),\n author: z\n .string()\n .describe(`Filter commits by author name or email (case-insensitive).`)\n .optional(),\n ref: z\n .string()\n .describe(\"Commit SHA, branch or tag name to list commits of. If not provided, uses the default branch of the repository.\")\n .optional(),\n page: z\n .number()\n .int()\n .positive()\n .describe(\"Page number for pagination (min 1). Default: 1\")\n .optional()\n .default(1),\n perPage: z\n .number()\n .int()\n .positive()\n .max(100)\n .describe(\"Results per page for pagination (min 1, max 100). Default: 50\")\n .optional()\n .default(50),\n});\n\nexport const listCommitsResponseSchema = z.array(z.object({\n hash: z.string(),\n date: z.string(),\n message: z.string(),\n refs: z.string(),\n body: z.string(),\n author_name: z.string(),\n author_email: z.string(),\n}));\n\nexport const languageModelInfoSchema = z.object({\n provider: z.string().describe(\"The model provider (e.g., 'anthropic', 'openai')\"),\n model: z.string().describe(\"The model ID\"),\n displayName: z.string().optional().describe(\"Optional display name for the model\"),\n});\n\nexport const listLanguageModelsResponseSchema = z.array(languageModelInfoSchema);\n\nexport const askCodebaseRequestSchema = z.object({\n query: z\n .string()\n .describe(\"The query to ask about the codebase.\"),\n repos: z\n .array(z.string())\n .optional()\n .describe(\"The repositories that are accessible to the agent during the chat. If not provided, all repositories are accessible.\"),\n languageModel: languageModelInfoSchema\n .omit({ displayName: true })\n .optional()\n .describe(\"The language model to use for answering the question. If not provided, defaults to the first model in the config. Use list_language_models to see available options.\"),\n});\n\nexport const sourceSchema = z.object({\n type: z.literal('file'),\n repo: z.string(),\n path: z.string(),\n name: z.string(),\n language: z.string(),\n revision: z.string(),\n});\n\nexport const askCodebaseResponseSchema = z.object({\n answer: z.string().describe(\"The agent's final answer in markdown format\"),\n chatId: z.string().describe(\"ID of the persisted chat session\"),\n chatUrl: z.string().describe(\"URL to view the chat in the web UI\"),\n languageModel: z.object({\n provider: z.string().describe(\"The model provider (e.g., 'anthropic', 'openai')\"),\n model: z.string().describe(\"The model ID\"),\n displayName: z.string().optional().describe(\"Optional display name for the model\"),\n }).describe(\"The language model used to generate the response\"),\n});\n"]}