@zgeoff/imp-client 0.3.0 → 0.4.0
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/index.d.ts +597 -1
- package/dist/index.js +2 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import { ORPCError, isDefinedError, safe } from "@orpc/client";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
import { ContractRouterClient } from "@orpc/contract";
|
|
4
|
+
//#region ../api/src/api-call-schema.d.ts
|
|
5
|
+
declare const ApiCallSchema: z.ZodObject<{
|
|
6
|
+
at: z.ZodDate;
|
|
7
|
+
procedure: z.ZodString;
|
|
8
|
+
actor: z.ZodEnum<{
|
|
9
|
+
dashboard: "dashboard";
|
|
10
|
+
ssh: "ssh";
|
|
11
|
+
token: "token";
|
|
12
|
+
}>;
|
|
13
|
+
imp: z.ZodOptional<z.ZodString>;
|
|
14
|
+
outcome: z.ZodString;
|
|
15
|
+
durationMs: z.ZodInt;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
type ApiCall = z.infer<typeof ApiCallSchema>;
|
|
18
|
+
//#endregion
|
|
4
19
|
//#region ../api/src/checkpoint-schema.d.ts
|
|
5
20
|
declare const CheckpointSchema: z.ZodObject<{
|
|
6
21
|
id: z.ZodString;
|
|
@@ -14,6 +29,181 @@ type Checkpoint = z.infer<typeof CheckpointSchema>;
|
|
|
14
29
|
declare const DETACH_REASONS: readonly ['taken_over', 'slow', 'lost'];
|
|
15
30
|
type DetachReason = (typeof DETACH_REASONS)[number];
|
|
16
31
|
//#endregion
|
|
32
|
+
//#region ../api/src/event-schema.d.ts
|
|
33
|
+
declare const ImpEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
34
|
+
v: z.ZodLiteral<1>;
|
|
35
|
+
at: z.ZodDate;
|
|
36
|
+
ev: z.ZodLiteral<"ImpAdded">;
|
|
37
|
+
reason: z.ZodEnum<{
|
|
38
|
+
created: "created";
|
|
39
|
+
snapshot: "snapshot";
|
|
40
|
+
}>;
|
|
41
|
+
imp: z.ZodObject<{
|
|
42
|
+
id: z.ZodString;
|
|
43
|
+
name: z.ZodString;
|
|
44
|
+
image: z.ZodString;
|
|
45
|
+
state: z.ZodEnum<{
|
|
46
|
+
creating: "creating";
|
|
47
|
+
error: "error";
|
|
48
|
+
running: "running";
|
|
49
|
+
sleeping: "sleeping";
|
|
50
|
+
stopped: "stopped";
|
|
51
|
+
}>;
|
|
52
|
+
vcpus: z.ZodInt;
|
|
53
|
+
memoryMib: z.ZodInt;
|
|
54
|
+
ip: z.ZodIPv4;
|
|
55
|
+
slot: z.ZodInt;
|
|
56
|
+
port: z.ZodInt;
|
|
57
|
+
httpPort: z.ZodInt;
|
|
58
|
+
url: z.ZodURL;
|
|
59
|
+
createdAt: z.ZodDate;
|
|
60
|
+
lastActiveAt: z.ZodDate;
|
|
61
|
+
ramMib: z.ZodOptional<z.ZodInt>;
|
|
62
|
+
rssMib: z.ZodOptional<z.ZodInt>;
|
|
63
|
+
sleptAt: z.ZodOptional<z.ZodDate>;
|
|
64
|
+
holdUntil: z.ZodOptional<z.ZodDate>;
|
|
65
|
+
error: z.ZodOptional<z.ZodString>;
|
|
66
|
+
sessions: z.ZodOptional<z.ZodInt>;
|
|
67
|
+
coldBootReason: z.ZodOptional<z.ZodString>;
|
|
68
|
+
outdated: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
69
|
+
agent: "agent";
|
|
70
|
+
firecracker: "firecracker";
|
|
71
|
+
impd: "impd";
|
|
72
|
+
kernel: "kernel";
|
|
73
|
+
}>>>>;
|
|
74
|
+
}, z.core.$strip>;
|
|
75
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
76
|
+
v: z.ZodLiteral<1>;
|
|
77
|
+
at: z.ZodDate;
|
|
78
|
+
ev: z.ZodLiteral<"ImpChanged">;
|
|
79
|
+
reason: z.ZodEnum<{
|
|
80
|
+
adopted: "adopted";
|
|
81
|
+
booted: "booted";
|
|
82
|
+
failed: "failed";
|
|
83
|
+
held: "held";
|
|
84
|
+
repaired: "repaired";
|
|
85
|
+
restored: "restored";
|
|
86
|
+
slept: "slept";
|
|
87
|
+
stopped: "stopped";
|
|
88
|
+
woke: "woke";
|
|
89
|
+
}>;
|
|
90
|
+
imp: z.ZodObject<{
|
|
91
|
+
id: z.ZodString;
|
|
92
|
+
name: z.ZodString;
|
|
93
|
+
image: z.ZodString;
|
|
94
|
+
state: z.ZodEnum<{
|
|
95
|
+
creating: "creating";
|
|
96
|
+
error: "error";
|
|
97
|
+
running: "running";
|
|
98
|
+
sleeping: "sleeping";
|
|
99
|
+
stopped: "stopped";
|
|
100
|
+
}>;
|
|
101
|
+
vcpus: z.ZodInt;
|
|
102
|
+
memoryMib: z.ZodInt;
|
|
103
|
+
ip: z.ZodIPv4;
|
|
104
|
+
slot: z.ZodInt;
|
|
105
|
+
port: z.ZodInt;
|
|
106
|
+
httpPort: z.ZodInt;
|
|
107
|
+
url: z.ZodURL;
|
|
108
|
+
createdAt: z.ZodDate;
|
|
109
|
+
lastActiveAt: z.ZodDate;
|
|
110
|
+
ramMib: z.ZodOptional<z.ZodInt>;
|
|
111
|
+
rssMib: z.ZodOptional<z.ZodInt>;
|
|
112
|
+
sleptAt: z.ZodOptional<z.ZodDate>;
|
|
113
|
+
holdUntil: z.ZodOptional<z.ZodDate>;
|
|
114
|
+
error: z.ZodOptional<z.ZodString>;
|
|
115
|
+
sessions: z.ZodOptional<z.ZodInt>;
|
|
116
|
+
coldBootReason: z.ZodOptional<z.ZodString>;
|
|
117
|
+
outdated: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
118
|
+
agent: "agent";
|
|
119
|
+
firecracker: "firecracker";
|
|
120
|
+
impd: "impd";
|
|
121
|
+
kernel: "kernel";
|
|
122
|
+
}>>>>;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
detail: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
|
|
125
|
+
durationMs: z.ZodOptional<z.ZodInt>;
|
|
126
|
+
trigger: z.ZodOptional<z.ZodString>;
|
|
127
|
+
coldBootReason: z.ZodOptional<z.ZodString>;
|
|
128
|
+
steps: z.ZodOptional<z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodInt>>>;
|
|
129
|
+
}, z.core.$strip>>>;
|
|
130
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
131
|
+
v: z.ZodLiteral<1>;
|
|
132
|
+
at: z.ZodDate;
|
|
133
|
+
ev: z.ZodLiteral<"ImpRemoved">;
|
|
134
|
+
imp: z.ZodObject<{
|
|
135
|
+
id: z.ZodString;
|
|
136
|
+
name: z.ZodString;
|
|
137
|
+
image: z.ZodString;
|
|
138
|
+
state: z.ZodEnum<{
|
|
139
|
+
creating: "creating";
|
|
140
|
+
error: "error";
|
|
141
|
+
running: "running";
|
|
142
|
+
sleeping: "sleeping";
|
|
143
|
+
stopped: "stopped";
|
|
144
|
+
}>;
|
|
145
|
+
vcpus: z.ZodInt;
|
|
146
|
+
memoryMib: z.ZodInt;
|
|
147
|
+
ip: z.ZodIPv4;
|
|
148
|
+
slot: z.ZodInt;
|
|
149
|
+
port: z.ZodInt;
|
|
150
|
+
httpPort: z.ZodInt;
|
|
151
|
+
url: z.ZodURL;
|
|
152
|
+
createdAt: z.ZodDate;
|
|
153
|
+
lastActiveAt: z.ZodDate;
|
|
154
|
+
ramMib: z.ZodOptional<z.ZodInt>;
|
|
155
|
+
rssMib: z.ZodOptional<z.ZodInt>;
|
|
156
|
+
sleptAt: z.ZodOptional<z.ZodDate>;
|
|
157
|
+
holdUntil: z.ZodOptional<z.ZodDate>;
|
|
158
|
+
error: z.ZodOptional<z.ZodString>;
|
|
159
|
+
sessions: z.ZodOptional<z.ZodInt>;
|
|
160
|
+
coldBootReason: z.ZodOptional<z.ZodString>;
|
|
161
|
+
outdated: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
162
|
+
agent: "agent";
|
|
163
|
+
firecracker: "firecracker";
|
|
164
|
+
impd: "impd";
|
|
165
|
+
kernel: "kernel";
|
|
166
|
+
}>>>>;
|
|
167
|
+
}, z.core.$strip>;
|
|
168
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
169
|
+
v: z.ZodLiteral<1>;
|
|
170
|
+
at: z.ZodDate;
|
|
171
|
+
ev: z.ZodLiteral<"CheckpointAdded">;
|
|
172
|
+
name: z.ZodString;
|
|
173
|
+
checkpoint: z.ZodObject<{
|
|
174
|
+
id: z.ZodString;
|
|
175
|
+
label: z.ZodOptional<z.ZodString>;
|
|
176
|
+
createdAt: z.ZodDate;
|
|
177
|
+
sizeBytes: z.ZodOptional<z.ZodInt>;
|
|
178
|
+
}, z.core.$strip>;
|
|
179
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
180
|
+
v: z.ZodLiteral<1>;
|
|
181
|
+
at: z.ZodDate;
|
|
182
|
+
ev: z.ZodLiteral<"CheckpointRemoved">;
|
|
183
|
+
name: z.ZodString;
|
|
184
|
+
checkpoint: z.ZodObject<{
|
|
185
|
+
id: z.ZodString;
|
|
186
|
+
label: z.ZodOptional<z.ZodString>;
|
|
187
|
+
createdAt: z.ZodDate;
|
|
188
|
+
sizeBytes: z.ZodOptional<z.ZodInt>;
|
|
189
|
+
}, z.core.$strip>;
|
|
190
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
191
|
+
v: z.ZodLiteral<1>;
|
|
192
|
+
at: z.ZodDate;
|
|
193
|
+
ev: z.ZodLiteral<"GovernorDecision">;
|
|
194
|
+
decision: z.ZodEnum<{
|
|
195
|
+
admitted: "admitted";
|
|
196
|
+
refused: "refused";
|
|
197
|
+
slept: "slept";
|
|
198
|
+
}>;
|
|
199
|
+
name: z.ZodString;
|
|
200
|
+
trigger: z.ZodString;
|
|
201
|
+
usedMib: z.ZodInt;
|
|
202
|
+
budgetMib: z.ZodInt;
|
|
203
|
+
reserveMib: z.ZodOptional<z.ZodInt>;
|
|
204
|
+
}, z.core.$strip>], "ev">;
|
|
205
|
+
type ImpEvent = z.infer<typeof ImpEventSchema>;
|
|
206
|
+
//#endregion
|
|
17
207
|
//#region ../api/src/image-schema.d.ts
|
|
18
208
|
declare const ImageSchema: z.ZodObject<{
|
|
19
209
|
id: z.ZodString;
|
|
@@ -3078,6 +3268,412 @@ declare const impContract: {
|
|
|
3078
3268
|
readonly status: 409;
|
|
3079
3269
|
};
|
|
3080
3270
|
}>, Record<never, never>>;
|
|
3271
|
+
calls: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
3272
|
+
name: z.ZodOptional<z.ZodString>;
|
|
3273
|
+
limit: z.ZodOptional<z.ZodInt>;
|
|
3274
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
3275
|
+
at: z.ZodDate;
|
|
3276
|
+
procedure: z.ZodString;
|
|
3277
|
+
actor: z.ZodEnum<{
|
|
3278
|
+
dashboard: "dashboard";
|
|
3279
|
+
ssh: "ssh";
|
|
3280
|
+
token: "token";
|
|
3281
|
+
}>;
|
|
3282
|
+
imp: z.ZodOptional<z.ZodString>;
|
|
3283
|
+
outcome: z.ZodString;
|
|
3284
|
+
durationMs: z.ZodInt;
|
|
3285
|
+
}, z.core.$strip>>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
3286
|
+
NOT_FOUND: {
|
|
3287
|
+
readonly message: "Not found";
|
|
3288
|
+
readonly data: z.ZodObject<{
|
|
3289
|
+
kind: z.ZodEnum<{
|
|
3290
|
+
backup: "backup";
|
|
3291
|
+
checkpoint: "checkpoint";
|
|
3292
|
+
grant: "grant";
|
|
3293
|
+
image: "image";
|
|
3294
|
+
imp: "imp";
|
|
3295
|
+
secret: "secret";
|
|
3296
|
+
session: "session";
|
|
3297
|
+
}>;
|
|
3298
|
+
name: z.ZodString;
|
|
3299
|
+
}, z.core.$strip>;
|
|
3300
|
+
};
|
|
3301
|
+
CONFLICT: {
|
|
3302
|
+
readonly message: "Already exists";
|
|
3303
|
+
readonly data: z.ZodObject<{
|
|
3304
|
+
kind: z.ZodEnum<{
|
|
3305
|
+
backup: "backup";
|
|
3306
|
+
checkpoint: "checkpoint";
|
|
3307
|
+
grant: "grant";
|
|
3308
|
+
image: "image";
|
|
3309
|
+
imp: "imp";
|
|
3310
|
+
secret: "secret";
|
|
3311
|
+
session: "session";
|
|
3312
|
+
}>;
|
|
3313
|
+
name: z.ZodString;
|
|
3314
|
+
}, z.core.$strip>;
|
|
3315
|
+
};
|
|
3316
|
+
FORBIDDEN: {
|
|
3317
|
+
readonly message: "Not allowed";
|
|
3318
|
+
};
|
|
3319
|
+
PRECONDITION_FAILED: {
|
|
3320
|
+
readonly message: "Not possible on this host";
|
|
3321
|
+
};
|
|
3322
|
+
RAM_BUDGET_EXCEEDED: {
|
|
3323
|
+
readonly message: "Not enough RAM budget, even after sleeping idle imps";
|
|
3324
|
+
readonly status: 503;
|
|
3325
|
+
readonly data: z.ZodObject<{
|
|
3326
|
+
budgetMib: z.ZodInt;
|
|
3327
|
+
usedMib: z.ZodInt;
|
|
3328
|
+
requestedMib: z.ZodInt;
|
|
3329
|
+
}, z.core.$strip>;
|
|
3330
|
+
};
|
|
3331
|
+
SERVICE_UNAVAILABLE: {
|
|
3332
|
+
readonly message: "impd is stopping";
|
|
3333
|
+
};
|
|
3334
|
+
INVALID_STATE: {
|
|
3335
|
+
readonly message: "The imp is not in a state that allows this";
|
|
3336
|
+
readonly status: 409;
|
|
3337
|
+
readonly data: z.ZodObject<{
|
|
3338
|
+
state: z.ZodEnum<{
|
|
3339
|
+
creating: "creating";
|
|
3340
|
+
error: "error";
|
|
3341
|
+
running: "running";
|
|
3342
|
+
sleeping: "sleeping";
|
|
3343
|
+
stopped: "stopped";
|
|
3344
|
+
}>;
|
|
3345
|
+
allowed: z.ZodArray<z.ZodEnum<{
|
|
3346
|
+
creating: "creating";
|
|
3347
|
+
error: "error";
|
|
3348
|
+
running: "running";
|
|
3349
|
+
sleeping: "sleeping";
|
|
3350
|
+
stopped: "stopped";
|
|
3351
|
+
}>>;
|
|
3352
|
+
}, z.core.$strip>;
|
|
3353
|
+
};
|
|
3354
|
+
AGENT_OUTDATED: {
|
|
3355
|
+
readonly message: "The imp's agent is too old for this";
|
|
3356
|
+
readonly status: 409;
|
|
3357
|
+
};
|
|
3358
|
+
}>, Record<never, never>>;
|
|
3359
|
+
};
|
|
3360
|
+
events: {
|
|
3361
|
+
stream: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, import("@orpc/contract").Schema<AsyncIteratorObject<{
|
|
3362
|
+
v: 1;
|
|
3363
|
+
at: Date;
|
|
3364
|
+
ev: "ImpAdded";
|
|
3365
|
+
reason: "created" | "snapshot";
|
|
3366
|
+
imp: {
|
|
3367
|
+
id: string;
|
|
3368
|
+
name: string;
|
|
3369
|
+
image: string;
|
|
3370
|
+
state: "creating" | "error" | "running" | "sleeping" | "stopped";
|
|
3371
|
+
vcpus: number;
|
|
3372
|
+
memoryMib: number;
|
|
3373
|
+
ip: string;
|
|
3374
|
+
slot: number;
|
|
3375
|
+
port: number;
|
|
3376
|
+
httpPort: number;
|
|
3377
|
+
url: string;
|
|
3378
|
+
createdAt: Date;
|
|
3379
|
+
lastActiveAt: Date;
|
|
3380
|
+
ramMib?: number | undefined;
|
|
3381
|
+
rssMib?: number | undefined;
|
|
3382
|
+
sleptAt?: Date | undefined;
|
|
3383
|
+
holdUntil?: Date | undefined;
|
|
3384
|
+
error?: string | undefined;
|
|
3385
|
+
sessions?: number | undefined;
|
|
3386
|
+
coldBootReason?: string | undefined;
|
|
3387
|
+
outdated?: readonly ("agent" | "firecracker" | "impd" | "kernel")[] | undefined;
|
|
3388
|
+
};
|
|
3389
|
+
} | {
|
|
3390
|
+
v: 1;
|
|
3391
|
+
at: Date;
|
|
3392
|
+
ev: "ImpChanged";
|
|
3393
|
+
reason: "adopted" | "booted" | "failed" | "held" | "repaired" | "restored" | "slept" | "stopped" | "woke";
|
|
3394
|
+
imp: {
|
|
3395
|
+
id: string;
|
|
3396
|
+
name: string;
|
|
3397
|
+
image: string;
|
|
3398
|
+
state: "creating" | "error" | "running" | "sleeping" | "stopped";
|
|
3399
|
+
vcpus: number;
|
|
3400
|
+
memoryMib: number;
|
|
3401
|
+
ip: string;
|
|
3402
|
+
slot: number;
|
|
3403
|
+
port: number;
|
|
3404
|
+
httpPort: number;
|
|
3405
|
+
url: string;
|
|
3406
|
+
createdAt: Date;
|
|
3407
|
+
lastActiveAt: Date;
|
|
3408
|
+
ramMib?: number | undefined;
|
|
3409
|
+
rssMib?: number | undefined;
|
|
3410
|
+
sleptAt?: Date | undefined;
|
|
3411
|
+
holdUntil?: Date | undefined;
|
|
3412
|
+
error?: string | undefined;
|
|
3413
|
+
sessions?: number | undefined;
|
|
3414
|
+
coldBootReason?: string | undefined;
|
|
3415
|
+
outdated?: readonly ("agent" | "firecracker" | "impd" | "kernel")[] | undefined;
|
|
3416
|
+
};
|
|
3417
|
+
detail?: Readonly<{
|
|
3418
|
+
durationMs?: number | undefined;
|
|
3419
|
+
trigger?: string | undefined;
|
|
3420
|
+
coldBootReason?: string | undefined;
|
|
3421
|
+
steps?: Readonly<Record<string, number>> | undefined;
|
|
3422
|
+
}> | undefined;
|
|
3423
|
+
} | {
|
|
3424
|
+
v: 1;
|
|
3425
|
+
at: Date;
|
|
3426
|
+
ev: "ImpRemoved";
|
|
3427
|
+
imp: {
|
|
3428
|
+
id: string;
|
|
3429
|
+
name: string;
|
|
3430
|
+
image: string;
|
|
3431
|
+
state: "creating" | "error" | "running" | "sleeping" | "stopped";
|
|
3432
|
+
vcpus: number;
|
|
3433
|
+
memoryMib: number;
|
|
3434
|
+
ip: string;
|
|
3435
|
+
slot: number;
|
|
3436
|
+
port: number;
|
|
3437
|
+
httpPort: number;
|
|
3438
|
+
url: string;
|
|
3439
|
+
createdAt: Date;
|
|
3440
|
+
lastActiveAt: Date;
|
|
3441
|
+
ramMib?: number | undefined;
|
|
3442
|
+
rssMib?: number | undefined;
|
|
3443
|
+
sleptAt?: Date | undefined;
|
|
3444
|
+
holdUntil?: Date | undefined;
|
|
3445
|
+
error?: string | undefined;
|
|
3446
|
+
sessions?: number | undefined;
|
|
3447
|
+
coldBootReason?: string | undefined;
|
|
3448
|
+
outdated?: readonly ("agent" | "firecracker" | "impd" | "kernel")[] | undefined;
|
|
3449
|
+
};
|
|
3450
|
+
} | {
|
|
3451
|
+
v: 1;
|
|
3452
|
+
at: Date;
|
|
3453
|
+
ev: "CheckpointAdded";
|
|
3454
|
+
name: string;
|
|
3455
|
+
checkpoint: {
|
|
3456
|
+
id: string;
|
|
3457
|
+
label?: string | undefined;
|
|
3458
|
+
createdAt: Date;
|
|
3459
|
+
sizeBytes?: number | undefined;
|
|
3460
|
+
};
|
|
3461
|
+
} | {
|
|
3462
|
+
v: 1;
|
|
3463
|
+
at: Date;
|
|
3464
|
+
ev: "CheckpointRemoved";
|
|
3465
|
+
name: string;
|
|
3466
|
+
checkpoint: {
|
|
3467
|
+
id: string;
|
|
3468
|
+
label?: string | undefined;
|
|
3469
|
+
createdAt: Date;
|
|
3470
|
+
sizeBytes?: number | undefined;
|
|
3471
|
+
};
|
|
3472
|
+
} | {
|
|
3473
|
+
v: 1;
|
|
3474
|
+
at: Date;
|
|
3475
|
+
ev: "GovernorDecision";
|
|
3476
|
+
decision: "admitted" | "refused" | "slept";
|
|
3477
|
+
name: string;
|
|
3478
|
+
trigger: string;
|
|
3479
|
+
usedMib: number;
|
|
3480
|
+
budgetMib: number;
|
|
3481
|
+
reserveMib?: number | undefined;
|
|
3482
|
+
}, unknown, void>, import("@orpc/client").AsyncIteratorClass<{
|
|
3483
|
+
v: 1;
|
|
3484
|
+
at: Date;
|
|
3485
|
+
ev: "ImpAdded";
|
|
3486
|
+
reason: "created" | "snapshot";
|
|
3487
|
+
imp: {
|
|
3488
|
+
id: string;
|
|
3489
|
+
name: string;
|
|
3490
|
+
image: string;
|
|
3491
|
+
state: "creating" | "error" | "running" | "sleeping" | "stopped";
|
|
3492
|
+
vcpus: number;
|
|
3493
|
+
memoryMib: number;
|
|
3494
|
+
ip: string;
|
|
3495
|
+
slot: number;
|
|
3496
|
+
port: number;
|
|
3497
|
+
httpPort: number;
|
|
3498
|
+
url: string;
|
|
3499
|
+
createdAt: Date;
|
|
3500
|
+
lastActiveAt: Date;
|
|
3501
|
+
ramMib?: number | undefined;
|
|
3502
|
+
rssMib?: number | undefined;
|
|
3503
|
+
sleptAt?: Date | undefined;
|
|
3504
|
+
holdUntil?: Date | undefined;
|
|
3505
|
+
error?: string | undefined;
|
|
3506
|
+
sessions?: number | undefined;
|
|
3507
|
+
coldBootReason?: string | undefined;
|
|
3508
|
+
outdated?: readonly ("agent" | "firecracker" | "impd" | "kernel")[] | undefined;
|
|
3509
|
+
};
|
|
3510
|
+
} | {
|
|
3511
|
+
v: 1;
|
|
3512
|
+
at: Date;
|
|
3513
|
+
ev: "ImpChanged";
|
|
3514
|
+
reason: "adopted" | "booted" | "failed" | "held" | "repaired" | "restored" | "slept" | "stopped" | "woke";
|
|
3515
|
+
imp: {
|
|
3516
|
+
id: string;
|
|
3517
|
+
name: string;
|
|
3518
|
+
image: string;
|
|
3519
|
+
state: "creating" | "error" | "running" | "sleeping" | "stopped";
|
|
3520
|
+
vcpus: number;
|
|
3521
|
+
memoryMib: number;
|
|
3522
|
+
ip: string;
|
|
3523
|
+
slot: number;
|
|
3524
|
+
port: number;
|
|
3525
|
+
httpPort: number;
|
|
3526
|
+
url: string;
|
|
3527
|
+
createdAt: Date;
|
|
3528
|
+
lastActiveAt: Date;
|
|
3529
|
+
ramMib?: number | undefined;
|
|
3530
|
+
rssMib?: number | undefined;
|
|
3531
|
+
sleptAt?: Date | undefined;
|
|
3532
|
+
holdUntil?: Date | undefined;
|
|
3533
|
+
error?: string | undefined;
|
|
3534
|
+
sessions?: number | undefined;
|
|
3535
|
+
coldBootReason?: string | undefined;
|
|
3536
|
+
outdated?: readonly ("agent" | "firecracker" | "impd" | "kernel")[] | undefined;
|
|
3537
|
+
};
|
|
3538
|
+
detail?: Readonly<{
|
|
3539
|
+
durationMs?: number | undefined;
|
|
3540
|
+
trigger?: string | undefined;
|
|
3541
|
+
coldBootReason?: string | undefined;
|
|
3542
|
+
steps?: Readonly<Record<string, number>> | undefined;
|
|
3543
|
+
}> | undefined;
|
|
3544
|
+
} | {
|
|
3545
|
+
v: 1;
|
|
3546
|
+
at: Date;
|
|
3547
|
+
ev: "ImpRemoved";
|
|
3548
|
+
imp: {
|
|
3549
|
+
id: string;
|
|
3550
|
+
name: string;
|
|
3551
|
+
image: string;
|
|
3552
|
+
state: "creating" | "error" | "running" | "sleeping" | "stopped";
|
|
3553
|
+
vcpus: number;
|
|
3554
|
+
memoryMib: number;
|
|
3555
|
+
ip: string;
|
|
3556
|
+
slot: number;
|
|
3557
|
+
port: number;
|
|
3558
|
+
httpPort: number;
|
|
3559
|
+
url: string;
|
|
3560
|
+
createdAt: Date;
|
|
3561
|
+
lastActiveAt: Date;
|
|
3562
|
+
ramMib?: number | undefined;
|
|
3563
|
+
rssMib?: number | undefined;
|
|
3564
|
+
sleptAt?: Date | undefined;
|
|
3565
|
+
holdUntil?: Date | undefined;
|
|
3566
|
+
error?: string | undefined;
|
|
3567
|
+
sessions?: number | undefined;
|
|
3568
|
+
coldBootReason?: string | undefined;
|
|
3569
|
+
outdated?: readonly ("agent" | "firecracker" | "impd" | "kernel")[] | undefined;
|
|
3570
|
+
};
|
|
3571
|
+
} | {
|
|
3572
|
+
v: 1;
|
|
3573
|
+
at: Date;
|
|
3574
|
+
ev: "CheckpointAdded";
|
|
3575
|
+
name: string;
|
|
3576
|
+
checkpoint: {
|
|
3577
|
+
id: string;
|
|
3578
|
+
label?: string | undefined;
|
|
3579
|
+
createdAt: Date;
|
|
3580
|
+
sizeBytes?: number | undefined;
|
|
3581
|
+
};
|
|
3582
|
+
} | {
|
|
3583
|
+
v: 1;
|
|
3584
|
+
at: Date;
|
|
3585
|
+
ev: "CheckpointRemoved";
|
|
3586
|
+
name: string;
|
|
3587
|
+
checkpoint: {
|
|
3588
|
+
id: string;
|
|
3589
|
+
label?: string | undefined;
|
|
3590
|
+
createdAt: Date;
|
|
3591
|
+
sizeBytes?: number | undefined;
|
|
3592
|
+
};
|
|
3593
|
+
} | {
|
|
3594
|
+
v: 1;
|
|
3595
|
+
at: Date;
|
|
3596
|
+
ev: "GovernorDecision";
|
|
3597
|
+
decision: "admitted" | "refused" | "slept";
|
|
3598
|
+
name: string;
|
|
3599
|
+
trigger: string;
|
|
3600
|
+
usedMib: number;
|
|
3601
|
+
budgetMib: number;
|
|
3602
|
+
reserveMib?: number | undefined;
|
|
3603
|
+
}, unknown, void>>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
3604
|
+
NOT_FOUND: {
|
|
3605
|
+
readonly message: "Not found";
|
|
3606
|
+
readonly data: z.ZodObject<{
|
|
3607
|
+
kind: z.ZodEnum<{
|
|
3608
|
+
backup: "backup";
|
|
3609
|
+
checkpoint: "checkpoint";
|
|
3610
|
+
grant: "grant";
|
|
3611
|
+
image: "image";
|
|
3612
|
+
imp: "imp";
|
|
3613
|
+
secret: "secret";
|
|
3614
|
+
session: "session";
|
|
3615
|
+
}>;
|
|
3616
|
+
name: z.ZodString;
|
|
3617
|
+
}, z.core.$strip>;
|
|
3618
|
+
};
|
|
3619
|
+
CONFLICT: {
|
|
3620
|
+
readonly message: "Already exists";
|
|
3621
|
+
readonly data: z.ZodObject<{
|
|
3622
|
+
kind: z.ZodEnum<{
|
|
3623
|
+
backup: "backup";
|
|
3624
|
+
checkpoint: "checkpoint";
|
|
3625
|
+
grant: "grant";
|
|
3626
|
+
image: "image";
|
|
3627
|
+
imp: "imp";
|
|
3628
|
+
secret: "secret";
|
|
3629
|
+
session: "session";
|
|
3630
|
+
}>;
|
|
3631
|
+
name: z.ZodString;
|
|
3632
|
+
}, z.core.$strip>;
|
|
3633
|
+
};
|
|
3634
|
+
FORBIDDEN: {
|
|
3635
|
+
readonly message: "Not allowed";
|
|
3636
|
+
};
|
|
3637
|
+
PRECONDITION_FAILED: {
|
|
3638
|
+
readonly message: "Not possible on this host";
|
|
3639
|
+
};
|
|
3640
|
+
RAM_BUDGET_EXCEEDED: {
|
|
3641
|
+
readonly message: "Not enough RAM budget, even after sleeping idle imps";
|
|
3642
|
+
readonly status: 503;
|
|
3643
|
+
readonly data: z.ZodObject<{
|
|
3644
|
+
budgetMib: z.ZodInt;
|
|
3645
|
+
usedMib: z.ZodInt;
|
|
3646
|
+
requestedMib: z.ZodInt;
|
|
3647
|
+
}, z.core.$strip>;
|
|
3648
|
+
};
|
|
3649
|
+
SERVICE_UNAVAILABLE: {
|
|
3650
|
+
readonly message: "impd is stopping";
|
|
3651
|
+
};
|
|
3652
|
+
INVALID_STATE: {
|
|
3653
|
+
readonly message: "The imp is not in a state that allows this";
|
|
3654
|
+
readonly status: 409;
|
|
3655
|
+
readonly data: z.ZodObject<{
|
|
3656
|
+
state: z.ZodEnum<{
|
|
3657
|
+
creating: "creating";
|
|
3658
|
+
error: "error";
|
|
3659
|
+
running: "running";
|
|
3660
|
+
sleeping: "sleeping";
|
|
3661
|
+
stopped: "stopped";
|
|
3662
|
+
}>;
|
|
3663
|
+
allowed: z.ZodArray<z.ZodEnum<{
|
|
3664
|
+
creating: "creating";
|
|
3665
|
+
error: "error";
|
|
3666
|
+
running: "running";
|
|
3667
|
+
sleeping: "sleeping";
|
|
3668
|
+
stopped: "stopped";
|
|
3669
|
+
}>>;
|
|
3670
|
+
}, z.core.$strip>;
|
|
3671
|
+
};
|
|
3672
|
+
AGENT_OUTDATED: {
|
|
3673
|
+
readonly message: "The imp's agent is too old for this";
|
|
3674
|
+
readonly status: 409;
|
|
3675
|
+
};
|
|
3676
|
+
}>, Record<never, never>>;
|
|
3081
3677
|
};
|
|
3082
3678
|
system: {
|
|
3083
3679
|
info: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodObject<{
|
|
@@ -3463,4 +4059,4 @@ export declare class ExecError extends Error {
|
|
|
3463
4059
|
}>);
|
|
3464
4060
|
}
|
|
3465
4061
|
//#endregion
|
|
3466
|
-
export { type AttachOptions, type Checkpoint, type ConsoleOptions, type DetachReason, type ExecClientErrorCode, type ExecExit, type ExecHandle, type ExecOptions, type ExecOutcome, type ExecSession, type ExecSessionOptions, type ExecStarted, type Image, type Imp, type ImpClient, type ImpClientOptions, type ImpState, ORPCError, type RequireAwakeOptions, type RunOptions, type RunResult, type ServerCheck, type Session, type SystemInfo, isDefinedError, safe };
|
|
4062
|
+
export { type ApiCall, type AttachOptions, type Checkpoint, type ConsoleOptions, type DetachReason, type ExecClientErrorCode, type ExecExit, type ExecHandle, type ExecOptions, type ExecOutcome, type ExecSession, type ExecSessionOptions, type ExecStarted, type Image, type Imp, type ImpClient, type ImpClientOptions, type ImpEvent, type ImpState, ORPCError, type RequireAwakeOptions, type RunOptions, type RunResult, type ServerCheck, type Session, type SystemInfo, isDefinedError, safe };
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { RPCLink } from "@orpc/client/fetch";
|
|
|
3
3
|
import * as z from "zod";
|
|
4
4
|
//#endregion
|
|
5
5
|
//#region src/check-server.ts
|
|
6
|
-
const CLIENT_VERSION = "0.
|
|
6
|
+
const CLIENT_VERSION = "0.4.0";
|
|
7
7
|
async function checkServer(rpc) {
|
|
8
8
|
const info = await rpc.system.info();
|
|
9
9
|
return {
|
|
@@ -663,6 +663,7 @@ function createImpClient(options) {
|
|
|
663
663
|
secrets: rpc.secrets,
|
|
664
664
|
grants: rpc.grants,
|
|
665
665
|
audit: rpc.audit,
|
|
666
|
+
events: rpc.events,
|
|
666
667
|
system: rpc.system
|
|
667
668
|
};
|
|
668
669
|
const execDeps = {
|