The best way to control Claude Code, Codex and more from any computer or phone

main
ts 64 lines 1.81 KB
Raw
1 import * as Schema from "effect/Schema";
2
3 export const RelayClientStatusSchema = Schema.Union([
4 Schema.Struct({
5 status: Schema.Literal("available"),
6 executablePath: Schema.String,
7 source: Schema.Literals(["override", "managed", "path"]),
8 version: Schema.String,
9 }),
10 Schema.Struct({
11 status: Schema.Literal("missing"),
12 version: Schema.String,
13 }),
14 Schema.Struct({
15 status: Schema.Literal("unsupported"),
16 platform: Schema.String,
17 arch: Schema.String,
18 version: Schema.String,
19 }),
20 ]);
21 export type RelayClientStatus = typeof RelayClientStatusSchema.Type;
22
23 export const RelayClientInstallProgressStageSchema = Schema.Literals([
24 "checking",
25 "waiting_for_lock",
26 "downloading",
27 "verifying",
28 "installing",
29 "validating",
30 "activating",
31 ]);
32 export type RelayClientInstallProgressStage = typeof RelayClientInstallProgressStageSchema.Type;
33
34 export const RelayClientInstallProgressEventSchema = Schema.Union([
35 Schema.Struct({
36 type: Schema.Literal("progress"),
37 stage: RelayClientInstallProgressStageSchema,
38 }),
39 Schema.Struct({
40 type: Schema.Literal("complete"),
41 status: RelayClientStatusSchema,
42 }),
43 ]);
44 export type RelayClientInstallProgressEvent = typeof RelayClientInstallProgressEventSchema.Type;
45
46 export const RelayClientInstallFailureReasonSchema = Schema.Literals([
47 "download_failed",
48 "invalid_checksum",
49 "install_locked",
50 "managed_by_policy",
51 "override_missing",
52 "unsupported_platform",
53 "validation_failed",
54 "write_failed",
55 ]);
56 export type RelayClientInstallFailureReason = typeof RelayClientInstallFailureReasonSchema.Type;
57
58 export class RelayClientInstallFailedError extends Schema.TaggedError<RelayClientInstallFailedError>()(
59 "RelayClientInstallFailedError",
60 {
61 reason: RelayClientInstallFailureReasonSchema,
62 message: Schema.String,
63 },
64 ) {}