File size: 1,444 Bytes
4e23b01
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { z } from 'zod';

export const fsOpenRequestSchema = z.object({
  path: z.string().min(1),
  line: z.number().int().positive().optional(),
});
export type FsOpenRequest = z.infer<typeof fsOpenRequestSchema>;

export const fsOpenResponseSchema = z.object({
  opened: z.literal(true),
});
export type FsOpenResponse = z.infer<typeof fsOpenResponseSchema>;

export const fsRevealRequestSchema = z.object({
  path: z.string().min(1),
});
export type FsRevealRequest = z.infer<typeof fsRevealRequestSchema>;

export const fsRevealResponseSchema = z.object({
  revealed: z.literal(true),
});
export type FsRevealResponse = z.infer<typeof fsRevealResponseSchema>;

export const fsOpenInAppIdSchema = z.enum([
  'finder',
  'cursor',
  'vscode',
  'iterm',
  'terminal',
]);
export type FsOpenInAppId = z.infer<typeof fsOpenInAppIdSchema>;

export const fsOpenInRequestSchema = z.object({
  app_id: fsOpenInAppIdSchema,
  path: z.string().min(1),
  line: z.number().int().positive().optional(),
});
export type FsOpenInRequest = z.infer<typeof fsOpenInRequestSchema>;

export const fsOpenInResponseSchema = z.object({
  opened: z.literal(true),
});
export type FsOpenInResponse = z.infer<typeof fsOpenInResponseSchema>;

export const fsDownloadParamsSchema = z.object({
  path: z.string().min(1),
  range: z.string().optional(),
  if_none_match: z.string().optional(),
});
export type FsDownloadParams = z.infer<typeof fsDownloadParamsSchema>;