@impz/testing 4.2.5 → 5.0.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.js +1018 -916
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -18990,7 +18990,7 @@ import invariant6 from "tiny-invariant";
|
|
|
18990
18990
|
|
|
18991
18991
|
// packages/daemon/src/config.ts
|
|
18992
18992
|
import { join as join4 } from "path";
|
|
18993
|
-
import * as
|
|
18993
|
+
import * as z53 from "zod";
|
|
18994
18994
|
// packages/shared/src/format-bytes.ts
|
|
18995
18995
|
var UNITS = ["B", "KiB", "MiB", "GiB", "TiB"];
|
|
18996
18996
|
function formatBytes(bytes) {
|
|
@@ -19425,7 +19425,7 @@ function buildRangeMatcher(ranges) {
|
|
|
19425
19425
|
}
|
|
19426
19426
|
|
|
19427
19427
|
// packages/daemon/src/identity/auth/parse-tailnet-rules.ts
|
|
19428
|
-
import * as
|
|
19428
|
+
import * as z48 from "zod";
|
|
19429
19429
|
// packages/api/src/schemas/lease-schema.ts
|
|
19430
19430
|
import * as z2 from "zod";
|
|
19431
19431
|
|
|
@@ -19923,11 +19923,14 @@ var BrokerRuleSchema = z15.object({
|
|
|
19923
19923
|
user: BasicUserSchema.optional(),
|
|
19924
19924
|
upstream: BrokerUpstreamSchema.optional()
|
|
19925
19925
|
});
|
|
19926
|
-
var
|
|
19926
|
+
var SecretPresetSchema = z15.enum(["github", "anthropic", "npm"]);
|
|
19927
|
+
var SecretKindSchema = z15.enum(["static", "oauth"]);
|
|
19927
19928
|
var OAuthConfigSchema = z15.object({
|
|
19928
19929
|
tokenUrl: z15.url({ protocol: /^https$/u }).max(2048),
|
|
19929
19930
|
clientId: PrintableSchema.min(1).max(256),
|
|
19930
19931
|
tokenFormat: z15.enum(["json", "form"]).default("form")
|
|
19932
|
+
}, {
|
|
19933
|
+
error: (issue) => issue.input === undefined ? "needs a token URL and a client id" : undefined
|
|
19931
19934
|
});
|
|
19932
19935
|
var OAuthStateSchema = OAuthConfigSchema.extend({
|
|
19933
19936
|
status: z15.enum(["pending", "ready", "needs_login"]),
|
|
@@ -19936,10 +19939,24 @@ var OAuthStateSchema = OAuthConfigSchema.extend({
|
|
|
19936
19939
|
error: z15.string().nullable(),
|
|
19937
19940
|
idClaims: z15.record(z15.string(), z15.unknown()).readonly().nullable()
|
|
19938
19941
|
});
|
|
19942
|
+
var BROKER_ENV_NAMES = [
|
|
19943
|
+
"HTTPS_PROXY",
|
|
19944
|
+
"https_proxy",
|
|
19945
|
+
"NO_PROXY",
|
|
19946
|
+
"no_proxy",
|
|
19947
|
+
"NODE_USE_ENV_PROXY",
|
|
19948
|
+
"SSL_CERT_FILE",
|
|
19949
|
+
"NODE_EXTRA_CA_CERTS",
|
|
19950
|
+
"GIT_SSL_CAINFO",
|
|
19951
|
+
"REQUESTS_CA_BUNDLE",
|
|
19952
|
+
"CURL_CA_BUNDLE"
|
|
19953
|
+
];
|
|
19954
|
+
var SecretEnvSchema = z15.array(z15.string().regex(/^[A-Z_][A-Z0-9_]{0,63}$/u, "must be an upper-case variable name").refine((name) => !BROKER_ENV_NAMES.includes(name), "must not be a variable the broker sets")).max(16).readonly();
|
|
19939
19955
|
var SecretSchema = z15.object({
|
|
19940
19956
|
name: SecretNameSchema,
|
|
19941
19957
|
kind: SecretKindSchema,
|
|
19942
19958
|
rules: z15.array(BrokerRuleSchema).readonly(),
|
|
19959
|
+
env: SecretEnvSchema,
|
|
19943
19960
|
imps: z15.array(NameSchema).readonly(),
|
|
19944
19961
|
createdAt: z15.date(),
|
|
19945
19962
|
oauth: OAuthStateSchema.optional()
|
|
@@ -20200,7 +20217,7 @@ var REFERENCE = new RegExp(String.raw`^(?:${DOMAIN}/)?${PATH_COMPONENT}(?:/${PAT
|
|
|
20200
20217
|
var ImageRefSchema = z19.string().max(255).regex(REFERENCE, "must be an image reference such as ubuntu:24.04 or ghcr.io/org/app@sha256:\u2026");
|
|
20201
20218
|
// packages/api/src/contract/caller-contract.ts
|
|
20202
20219
|
import { eventIterator } from "@orpc/contract";
|
|
20203
|
-
import * as
|
|
20220
|
+
import * as z42 from "zod";
|
|
20204
20221
|
|
|
20205
20222
|
// packages/api/src/schemas/backup-schema.ts
|
|
20206
20223
|
import * as z20 from "zod";
|
|
@@ -20370,83 +20387,140 @@ function isAllowedRedirectUri(text) {
|
|
|
20370
20387
|
return url.protocol === "http:" && ["127.0.0.1", "[::1]", "localhost"].includes(url.hostname);
|
|
20371
20388
|
}
|
|
20372
20389
|
|
|
20373
|
-
// packages/api/src/schemas/
|
|
20390
|
+
// packages/api/src/schemas/secret-add-schema.ts
|
|
20374
20391
|
import * as z29 from "zod";
|
|
20392
|
+
var SecretRulesSchema = z29.array(BrokerRuleSchema, {
|
|
20393
|
+
error: (issue) => issue.input === undefined ? "needs at least one host" : undefined
|
|
20394
|
+
}).min(1, "needs at least one host").max(16).superRefine((rules, context) => {
|
|
20395
|
+
const hosts = rules.map((rule) => rule.host);
|
|
20396
|
+
const repeated = hosts.find((host, index) => hosts.indexOf(host) !== index);
|
|
20397
|
+
if (repeated !== undefined) {
|
|
20398
|
+
context.addIssue({ code: "custom", message: `${repeated} has more than one rule` });
|
|
20399
|
+
}
|
|
20400
|
+
}).readonly();
|
|
20401
|
+
var StaticBindingSchema = z29.strictObject({
|
|
20402
|
+
kind: z29.literal("static"),
|
|
20403
|
+
rules: SecretRulesSchema,
|
|
20404
|
+
env: SecretEnvSchema.optional()
|
|
20405
|
+
});
|
|
20406
|
+
var OAuthBindingSchema = z29.strictObject({
|
|
20407
|
+
kind: z29.literal("oauth"),
|
|
20408
|
+
rules: SecretRulesSchema.refine((rules) => rules.every((rule) => rule.upstream === undefined), "an oauth secret cannot have an upstream; it is for kind static"),
|
|
20409
|
+
env: SecretEnvSchema.optional(),
|
|
20410
|
+
oauth: OAuthConfigSchema
|
|
20411
|
+
});
|
|
20412
|
+
var OldPresetBindingSchema = z29.strictObject({ kind: SecretPresetSchema });
|
|
20413
|
+
var SecretAddKindSchema = z29.enum([
|
|
20414
|
+
...SecretKindSchema.options,
|
|
20415
|
+
...SecretPresetSchema.options,
|
|
20416
|
+
"custom"
|
|
20417
|
+
]);
|
|
20418
|
+
var OldCustomBindingSchema = z29.strictObject({
|
|
20419
|
+
kind: z29.literal("custom"),
|
|
20420
|
+
rules: SecretRulesSchema
|
|
20421
|
+
});
|
|
20422
|
+
var PresetBindingSchema = z29.strictObject({
|
|
20423
|
+
kind: z29.undefined().optional(),
|
|
20424
|
+
preset: SecretPresetSchema
|
|
20425
|
+
});
|
|
20426
|
+
var SecretBindingSchema = z29.discriminatedUnion("kind", [
|
|
20427
|
+
StaticBindingSchema,
|
|
20428
|
+
OAuthBindingSchema,
|
|
20429
|
+
PresetBindingSchema,
|
|
20430
|
+
OldPresetBindingSchema,
|
|
20431
|
+
OldCustomBindingSchema
|
|
20432
|
+
]);
|
|
20433
|
+
var AddFields = {
|
|
20434
|
+
name: SecretNameSchema,
|
|
20435
|
+
value: SecretValueSchema,
|
|
20436
|
+
replace: z29.boolean().optional(),
|
|
20437
|
+
rebind: z29.boolean().optional()
|
|
20438
|
+
};
|
|
20439
|
+
var SecretAddSchema = z29.discriminatedUnion("kind", [
|
|
20440
|
+
StaticBindingSchema.extend(AddFields),
|
|
20441
|
+
OAuthBindingSchema.extend(AddFields),
|
|
20442
|
+
PresetBindingSchema.extend(AddFields),
|
|
20443
|
+
OldPresetBindingSchema.extend(AddFields),
|
|
20444
|
+
OldCustomBindingSchema.extend(AddFields)
|
|
20445
|
+
]);
|
|
20446
|
+
|
|
20447
|
+
// packages/api/src/schemas/service-schema.ts
|
|
20448
|
+
import * as z30 from "zod";
|
|
20375
20449
|
var SERVICE_NAME_PATTERN = /^[a-z0-9][a-z0-9-]{0,62}$/u;
|
|
20376
|
-
var ServiceNameSchema =
|
|
20450
|
+
var ServiceNameSchema = z30.string().regex(SERVICE_NAME_PATTERN, "must be a lowercase letter or digit followed by up to 62 lowercase letters, digits or -");
|
|
20377
20451
|
var SERVICE_LOG_MAX_LINES = 1e5;
|
|
20378
|
-
var ServiceRestartSchema =
|
|
20379
|
-
var EnvEntrySchema =
|
|
20380
|
-
var ServiceDefSchema =
|
|
20452
|
+
var ServiceRestartSchema = z30.enum(["always", "on-failure", "never"]);
|
|
20453
|
+
var EnvEntrySchema = z30.string().regex(/^[A-Za-z_][A-Za-z0-9_]*=/u, "must be KEY=VALUE");
|
|
20454
|
+
var ServiceDefSchema = z30.object({
|
|
20381
20455
|
name: ServiceNameSchema,
|
|
20382
|
-
argv:
|
|
20383
|
-
env:
|
|
20384
|
-
cwd:
|
|
20385
|
-
user:
|
|
20456
|
+
argv: z30.array(z30.string().min(1)).min(1).max(256).readonly(),
|
|
20457
|
+
env: z30.array(EnvEntrySchema).max(256).readonly().optional(),
|
|
20458
|
+
cwd: z30.string().min(1).optional(),
|
|
20459
|
+
user: z30.string().min(1).optional(),
|
|
20386
20460
|
restart: ServiceRestartSchema.optional()
|
|
20387
20461
|
});
|
|
20388
|
-
var ServiceStateSchema =
|
|
20389
|
-
var ServiceSchema =
|
|
20390
|
-
name:
|
|
20462
|
+
var ServiceStateSchema = z30.enum(["starting", "running", "backoff", "stopped", "exited"]);
|
|
20463
|
+
var ServiceSchema = z30.object({
|
|
20464
|
+
name: z30.string(),
|
|
20391
20465
|
state: ServiceStateSchema,
|
|
20392
|
-
pid:
|
|
20393
|
-
restarts:
|
|
20394
|
-
lastExit:
|
|
20395
|
-
argv:
|
|
20396
|
-
envKeys:
|
|
20397
|
-
cwd:
|
|
20398
|
-
user:
|
|
20466
|
+
pid: z30.int().positive().nullable(),
|
|
20467
|
+
restarts: z30.int().nonnegative(),
|
|
20468
|
+
lastExit: z30.object({ code: z30.int(), signal: z30.string().nullable() }).nullable(),
|
|
20469
|
+
argv: z30.array(z30.string()).readonly(),
|
|
20470
|
+
envKeys: z30.array(z30.string()).readonly(),
|
|
20471
|
+
cwd: z30.string().nullable(),
|
|
20472
|
+
user: z30.string().nullable(),
|
|
20399
20473
|
restart: ServiceRestartSchema,
|
|
20400
|
-
source:
|
|
20401
|
-
root:
|
|
20474
|
+
source: z30.enum(["image", "api"]),
|
|
20475
|
+
root: z30.boolean()
|
|
20402
20476
|
});
|
|
20403
|
-
var ServiceLogSchema =
|
|
20404
|
-
|
|
20405
|
-
|
|
20406
|
-
|
|
20407
|
-
|
|
20477
|
+
var ServiceLogSchema = z30.discriminatedUnion("type", [
|
|
20478
|
+
z30.object({ type: z30.literal("log"), service: z30.string(), text: z30.string() }),
|
|
20479
|
+
z30.object({ type: z30.literal("sleeping"), state: ImpStateSchema }),
|
|
20480
|
+
z30.object({ type: z30.literal("awake") }),
|
|
20481
|
+
z30.object({ type: z30.literal("restarting") })
|
|
20408
20482
|
]);
|
|
20409
|
-
var ServiceListSchema =
|
|
20410
|
-
services:
|
|
20411
|
-
recorded:
|
|
20483
|
+
var ServiceListSchema = z30.object({
|
|
20484
|
+
services: z30.array(ServiceSchema).readonly(),
|
|
20485
|
+
recorded: z30.boolean()
|
|
20412
20486
|
});
|
|
20413
20487
|
|
|
20414
20488
|
// packages/api/src/schemas/session-log-schema.ts
|
|
20415
|
-
import * as
|
|
20489
|
+
import * as z31 from "zod";
|
|
20416
20490
|
var SESSION_LOG_READ_MAX_BYTES = 1048576;
|
|
20417
|
-
var SessionLogSchema =
|
|
20491
|
+
var SessionLogSchema = z31.object({
|
|
20418
20492
|
session: SessionNameSchema,
|
|
20419
20493
|
executionGeneration: ExecutionGenerationSchema,
|
|
20420
|
-
bootId:
|
|
20421
|
-
state:
|
|
20494
|
+
bootId: z31.string(),
|
|
20495
|
+
state: z31.enum(["live", "ended"]),
|
|
20422
20496
|
logStart: OffsetSchema,
|
|
20423
20497
|
logEnd: OffsetSchema,
|
|
20424
20498
|
bytes: OffsetSchema,
|
|
20425
20499
|
end: OffsetSchema.optional(),
|
|
20426
|
-
exitCode:
|
|
20427
|
-
complete:
|
|
20428
|
-
stopped:
|
|
20429
|
-
startedAt:
|
|
20430
|
-
endedAt:
|
|
20500
|
+
exitCode: z31.int().nullable().optional(),
|
|
20501
|
+
complete: z31.boolean(),
|
|
20502
|
+
stopped: z31.enum(["disk_full", "imp_limit"]).optional(),
|
|
20503
|
+
startedAt: z31.date(),
|
|
20504
|
+
endedAt: z31.date().optional()
|
|
20431
20505
|
}).readonly();
|
|
20432
|
-
var SessionLogListInputSchema =
|
|
20506
|
+
var SessionLogListInputSchema = z31.object({
|
|
20433
20507
|
name: NameSchema,
|
|
20434
20508
|
session: SessionNameSchema.optional()
|
|
20435
20509
|
});
|
|
20436
|
-
var SessionLogReadInputSchema =
|
|
20510
|
+
var SessionLogReadInputSchema = z31.object({
|
|
20437
20511
|
name: NameSchema,
|
|
20438
20512
|
session: SessionNameSchema,
|
|
20439
20513
|
executionGeneration: ExecutionGenerationSchema,
|
|
20440
20514
|
from: OffsetSchema,
|
|
20441
|
-
limit:
|
|
20515
|
+
limit: z31.int().min(1).max(SESSION_LOG_READ_MAX_BYTES).optional()
|
|
20442
20516
|
});
|
|
20443
|
-
var SessionLogReadSchema =
|
|
20517
|
+
var SessionLogReadSchema = z31.object({
|
|
20444
20518
|
offset: OffsetSchema,
|
|
20445
|
-
gap:
|
|
20446
|
-
data:
|
|
20519
|
+
gap: z31.object({ from: OffsetSchema, to: OffsetSchema }).readonly().optional(),
|
|
20520
|
+
data: z31.instanceof(Blob),
|
|
20447
20521
|
log: SessionLogSchema
|
|
20448
20522
|
}).readonly();
|
|
20449
|
-
var SessionLogDeleteInputSchema =
|
|
20523
|
+
var SessionLogDeleteInputSchema = z31.object({
|
|
20450
20524
|
name: NameSchema,
|
|
20451
20525
|
session: SessionNameSchema.optional(),
|
|
20452
20526
|
executionGeneration: ExecutionGenerationSchema.optional()
|
|
@@ -20456,144 +20530,145 @@ var SessionLogDeleteInputSchema = z30.object({
|
|
|
20456
20530
|
});
|
|
20457
20531
|
|
|
20458
20532
|
// packages/api/src/schemas/storage-schema.ts
|
|
20459
|
-
import * as
|
|
20460
|
-
var DroppedStorageSchema =
|
|
20461
|
-
kind:
|
|
20462
|
-
id:
|
|
20533
|
+
import * as z32 from "zod";
|
|
20534
|
+
var DroppedStorageSchema = z32.object({
|
|
20535
|
+
kind: z32.enum(["imp", "checkpoint", "image", "snapshot", "memory", "secrets"]),
|
|
20536
|
+
id: z32.string()
|
|
20463
20537
|
}).readonly();
|
|
20464
|
-
var OrphanStorageSchema =
|
|
20465
|
-
kind:
|
|
20466
|
-
id:
|
|
20467
|
-
location:
|
|
20468
|
-
bytes:
|
|
20469
|
-
createdAt:
|
|
20470
|
-
snapshots:
|
|
20471
|
-
files:
|
|
20538
|
+
var OrphanStorageSchema = z32.object({
|
|
20539
|
+
kind: z32.enum(["imp", "image", "memory", "checkpoint", "secrets"]),
|
|
20540
|
+
id: z32.string(),
|
|
20541
|
+
location: z32.string(),
|
|
20542
|
+
bytes: z32.int().nonnegative(),
|
|
20543
|
+
createdAt: z32.date().nullable(),
|
|
20544
|
+
snapshots: z32.array(z32.string()).readonly(),
|
|
20545
|
+
files: z32.array(z32.string()).readonly().optional()
|
|
20472
20546
|
}).readonly();
|
|
20473
|
-
var StorageGcSchema =
|
|
20474
|
-
dryRun:
|
|
20475
|
-
dropped:
|
|
20476
|
-
kept:
|
|
20547
|
+
var StorageGcSchema = z32.object({
|
|
20548
|
+
dryRun: z32.boolean(),
|
|
20549
|
+
dropped: z32.array(DroppedStorageSchema).readonly(),
|
|
20550
|
+
kept: z32.array(OrphanStorageSchema).readonly().optional()
|
|
20477
20551
|
}).readonly();
|
|
20478
|
-
var DatabaseCopySchema =
|
|
20479
|
-
path:
|
|
20480
|
-
sizeBytes:
|
|
20481
|
-
lastMigration:
|
|
20482
|
-
impVersion:
|
|
20483
|
-
createdAt:
|
|
20484
|
-
integrity:
|
|
20552
|
+
var DatabaseCopySchema = z32.object({
|
|
20553
|
+
path: z32.string(),
|
|
20554
|
+
sizeBytes: z32.int().nonnegative(),
|
|
20555
|
+
lastMigration: z32.string(),
|
|
20556
|
+
impVersion: z32.string(),
|
|
20557
|
+
createdAt: z32.date(),
|
|
20558
|
+
integrity: z32.string()
|
|
20485
20559
|
});
|
|
20486
20560
|
|
|
20487
20561
|
// packages/api/src/schemas/system-info-schema.ts
|
|
20488
|
-
import * as
|
|
20489
|
-
var CountSchema =
|
|
20490
|
-
var NameFailureSchema =
|
|
20491
|
-
var TailnetNamesSchema =
|
|
20562
|
+
import * as z33 from "zod";
|
|
20563
|
+
var CountSchema = z33.int().nonnegative();
|
|
20564
|
+
var NameFailureSchema = z33.object({ name: NameSchema, error: z33.string() });
|
|
20565
|
+
var TailnetNamesSchema = z33.object({
|
|
20492
20566
|
live: CountSchema,
|
|
20493
|
-
failed:
|
|
20567
|
+
failed: z33.array(NameFailureSchema).readonly()
|
|
20494
20568
|
});
|
|
20495
|
-
var BootStatusSchema =
|
|
20569
|
+
var BootStatusSchema = z33.object({
|
|
20496
20570
|
coldBoots: CountSchema,
|
|
20497
|
-
outdated:
|
|
20571
|
+
outdated: z33.object({
|
|
20498
20572
|
firecracker: CountSchema,
|
|
20499
20573
|
kernel: CountSchema,
|
|
20500
20574
|
agent: CountSchema,
|
|
20501
20575
|
ipv6: CountSchema.optional()
|
|
20502
20576
|
})
|
|
20503
20577
|
});
|
|
20504
|
-
var PassStatusSchema =
|
|
20505
|
-
isOk:
|
|
20506
|
-
error:
|
|
20507
|
-
at:
|
|
20578
|
+
var PassStatusSchema = z33.object({
|
|
20579
|
+
isOk: z33.boolean(),
|
|
20580
|
+
error: z33.string().nullable(),
|
|
20581
|
+
at: z33.date()
|
|
20508
20582
|
});
|
|
20509
|
-
var HttpsInfoSchema =
|
|
20510
|
-
domain:
|
|
20583
|
+
var HttpsInfoSchema = z33.object({
|
|
20584
|
+
domain: z33.string(),
|
|
20511
20585
|
dnsToken: PassStatusSchema.nullable()
|
|
20512
20586
|
});
|
|
20513
|
-
var PublicInfoSchema =
|
|
20514
|
-
ip:
|
|
20587
|
+
var PublicInfoSchema = z33.object({
|
|
20588
|
+
ip: z33.ipv4(),
|
|
20515
20589
|
imps: CountSchema,
|
|
20516
20590
|
records: PassStatusSchema.nullable()
|
|
20517
20591
|
});
|
|
20518
|
-
var SystemFeaturesSchema =
|
|
20519
|
-
sessionOffsets:
|
|
20520
|
-
leases:
|
|
20521
|
-
grantableTokens:
|
|
20522
|
-
secretRebind:
|
|
20523
|
-
tokenUpdate:
|
|
20524
|
-
tokenImageAdd:
|
|
20525
|
-
databaseCopy:
|
|
20526
|
-
imageOpStream:
|
|
20527
|
-
imageBuilds:
|
|
20528
|
-
execRequire:
|
|
20529
|
-
oauthGrants:
|
|
20530
|
-
secretFilesGc:
|
|
20531
|
-
sessionLog:
|
|
20532
|
-
publicEgress:
|
|
20533
|
-
oauthSecrets:
|
|
20534
|
-
secretUpstream:
|
|
20535
|
-
|
|
20536
|
-
|
|
20537
|
-
|
|
20538
|
-
|
|
20539
|
-
|
|
20540
|
-
|
|
20541
|
-
|
|
20542
|
-
|
|
20592
|
+
var SystemFeaturesSchema = z33.object({
|
|
20593
|
+
sessionOffsets: z33.boolean(),
|
|
20594
|
+
leases: z33.boolean(),
|
|
20595
|
+
grantableTokens: z33.boolean().optional(),
|
|
20596
|
+
secretRebind: z33.boolean().optional(),
|
|
20597
|
+
tokenUpdate: z33.boolean().optional(),
|
|
20598
|
+
tokenImageAdd: z33.boolean().optional(),
|
|
20599
|
+
databaseCopy: z33.boolean().optional(),
|
|
20600
|
+
imageOpStream: z33.boolean().optional(),
|
|
20601
|
+
imageBuilds: z33.boolean().optional(),
|
|
20602
|
+
execRequire: z33.boolean().optional(),
|
|
20603
|
+
oauthGrants: z33.boolean().optional(),
|
|
20604
|
+
secretFilesGc: z33.boolean().optional(),
|
|
20605
|
+
sessionLog: z33.boolean().optional(),
|
|
20606
|
+
publicEgress: z33.boolean().optional(),
|
|
20607
|
+
oauthSecrets: z33.boolean().optional(),
|
|
20608
|
+
secretUpstream: z33.boolean().optional(),
|
|
20609
|
+
secretPresets: z33.boolean().optional(),
|
|
20610
|
+
backupOptOut: z33.boolean().optional(),
|
|
20611
|
+
brokerRefusals: z33.boolean().optional(),
|
|
20612
|
+
grantFilters: z33.boolean().optional(),
|
|
20613
|
+
readOnlyFiles: z33.boolean().optional(),
|
|
20614
|
+
execDropSysAdmin: z33.boolean().optional(),
|
|
20615
|
+
guestScratch: z33.boolean().optional(),
|
|
20616
|
+
imagePins: z33.boolean().optional(),
|
|
20617
|
+
buildContextUpload: z33.boolean().optional()
|
|
20543
20618
|
});
|
|
20544
|
-
var GuestInfoSchema =
|
|
20545
|
-
scratchDir:
|
|
20546
|
-
isClearedOnBoot:
|
|
20619
|
+
var GuestInfoSchema = z33.object({
|
|
20620
|
+
scratchDir: z33.string(),
|
|
20621
|
+
isClearedOnBoot: z33.boolean()
|
|
20547
20622
|
});
|
|
20548
|
-
var SystemInfoSchema =
|
|
20549
|
-
version:
|
|
20550
|
-
ramBudgetMib:
|
|
20551
|
-
ramUsedMib:
|
|
20552
|
-
ramReservedMib:
|
|
20553
|
-
ramCommittedMib:
|
|
20554
|
-
ramSleepingMib:
|
|
20555
|
-
awakeCount:
|
|
20556
|
-
impCount:
|
|
20557
|
-
sessionCount:
|
|
20623
|
+
var SystemInfoSchema = z33.object({
|
|
20624
|
+
version: z33.string(),
|
|
20625
|
+
ramBudgetMib: z33.int().nonnegative(),
|
|
20626
|
+
ramUsedMib: z33.int().nonnegative(),
|
|
20627
|
+
ramReservedMib: z33.int().nonnegative(),
|
|
20628
|
+
ramCommittedMib: z33.int().nonnegative(),
|
|
20629
|
+
ramSleepingMib: z33.int().nonnegative().optional(),
|
|
20630
|
+
awakeCount: z33.int().nonnegative(),
|
|
20631
|
+
impCount: z33.int().nonnegative(),
|
|
20632
|
+
sessionCount: z33.int().nonnegative(),
|
|
20558
20633
|
bootStatus: BootStatusSchema,
|
|
20559
|
-
firecrackerVersion:
|
|
20560
|
-
guestKernel:
|
|
20561
|
-
systemDrive:
|
|
20634
|
+
firecrackerVersion: z33.string().nullable(),
|
|
20635
|
+
guestKernel: z33.object({ version: z33.string().nullable(), sha256: z33.string() }),
|
|
20636
|
+
systemDrive: z33.object({ sha256: z33.string() }),
|
|
20562
20637
|
guest: GuestInfoSchema.optional(),
|
|
20563
|
-
storage:
|
|
20564
|
-
backend:
|
|
20565
|
-
usedBytes:
|
|
20566
|
-
availableBytes:
|
|
20567
|
-
reserveBytes:
|
|
20568
|
-
pendingBytes:
|
|
20569
|
-
isLow:
|
|
20570
|
-
impDiskBytes:
|
|
20638
|
+
storage: z33.object({
|
|
20639
|
+
backend: z33.enum(["xfs", "zfs"]),
|
|
20640
|
+
usedBytes: z33.int().nonnegative(),
|
|
20641
|
+
availableBytes: z33.int().nonnegative(),
|
|
20642
|
+
reserveBytes: z33.int().nonnegative(),
|
|
20643
|
+
pendingBytes: z33.int().nonnegative(),
|
|
20644
|
+
isLow: z33.boolean(),
|
|
20645
|
+
impDiskBytes: z33.int().nonnegative()
|
|
20571
20646
|
}),
|
|
20572
|
-
tailscale:
|
|
20573
|
-
enabled:
|
|
20574
|
-
state:
|
|
20575
|
-
hostname:
|
|
20576
|
-
ip:
|
|
20647
|
+
tailscale: z33.object({
|
|
20648
|
+
enabled: z33.boolean(),
|
|
20649
|
+
state: z33.string().nullable(),
|
|
20650
|
+
hostname: z33.string().nullable(),
|
|
20651
|
+
ip: z33.string().nullable(),
|
|
20577
20652
|
names: TailnetNamesSchema.nullable()
|
|
20578
20653
|
}),
|
|
20579
|
-
ksm:
|
|
20580
|
-
running:
|
|
20654
|
+
ksm: z33.object({
|
|
20655
|
+
running: z33.boolean(),
|
|
20581
20656
|
sharedMib: CountSchema,
|
|
20582
|
-
profitMib:
|
|
20657
|
+
profitMib: z33.int(),
|
|
20583
20658
|
zeroMib: CountSchema,
|
|
20584
20659
|
headroomMib: CountSchema,
|
|
20585
20660
|
unmergeable: CountSchema
|
|
20586
20661
|
}).nullable().optional(),
|
|
20587
|
-
rebootReason:
|
|
20588
|
-
cpu:
|
|
20589
|
-
defaults:
|
|
20590
|
-
egress:
|
|
20662
|
+
rebootReason: z33.string().nullable().optional(),
|
|
20663
|
+
cpu: z33.object({ hostCpus: z33.int().positive(), limitsEnforced: z33.boolean() }).optional(),
|
|
20664
|
+
defaults: z33.object({ memoryMib: z33.int().positive(), image: z33.string().nullable() }).optional(),
|
|
20665
|
+
egress: z33.object({ isEnforced: z33.boolean() }).optional(),
|
|
20591
20666
|
public: PublicInfoSchema.nullable().optional(),
|
|
20592
20667
|
https: HttpsInfoSchema.nullable().optional(),
|
|
20593
20668
|
features: SystemFeaturesSchema.optional()
|
|
20594
20669
|
});
|
|
20595
|
-
var SystemFeaturesInfoSchema =
|
|
20596
|
-
version:
|
|
20670
|
+
var SystemFeaturesInfoSchema = z33.object({
|
|
20671
|
+
version: z33.string(),
|
|
20597
20672
|
features: SystemFeaturesSchema
|
|
20598
20673
|
});
|
|
20599
20674
|
var SYSTEM_FEATURES = SystemFeaturesSchema.required().parse(Object.fromEntries(SystemFeaturesSchema.keyof().options.map((name) => [name, true])));
|
|
@@ -20618,7 +20693,7 @@ var ACCESS = {
|
|
|
20618
20693
|
import { oc } from "@orpc/contract";
|
|
20619
20694
|
|
|
20620
20695
|
// packages/api/src/contract/imp-errors.ts
|
|
20621
|
-
import * as
|
|
20696
|
+
import * as z34 from "zod";
|
|
20622
20697
|
|
|
20623
20698
|
// packages/api/src/contract/define-errors.ts
|
|
20624
20699
|
function defineErrors(errors) {
|
|
@@ -20626,7 +20701,7 @@ function defineErrors(errors) {
|
|
|
20626
20701
|
}
|
|
20627
20702
|
|
|
20628
20703
|
// packages/api/src/contract/imp-errors.ts
|
|
20629
|
-
var ResourceKindSchema =
|
|
20704
|
+
var ResourceKindSchema = z34.enum([
|
|
20630
20705
|
"imp",
|
|
20631
20706
|
"image",
|
|
20632
20707
|
"checkpoint",
|
|
@@ -20643,22 +20718,22 @@ var ResourceKindSchema = z33.enum([
|
|
|
20643
20718
|
"oauth-approval",
|
|
20644
20719
|
"database-copy"
|
|
20645
20720
|
]);
|
|
20646
|
-
var ResourceDataSchema =
|
|
20721
|
+
var ResourceDataSchema = z34.object({
|
|
20647
20722
|
kind: ResourceKindSchema,
|
|
20648
|
-
name:
|
|
20649
|
-
reason:
|
|
20723
|
+
name: z34.string(),
|
|
20724
|
+
reason: z34.enum(["binding_changed"]).optional()
|
|
20650
20725
|
});
|
|
20651
|
-
var ForbiddenReasonSchema =
|
|
20652
|
-
var ForbiddenDataSchema =
|
|
20653
|
-
var PreconditionDataSchema =
|
|
20654
|
-
reason:
|
|
20655
|
-
detail:
|
|
20726
|
+
var ForbiddenReasonSchema = z34.enum(["imp_out_of_scope", "not_grantable", "scope"]);
|
|
20727
|
+
var ForbiddenDataSchema = z34.object({ reason: ForbiddenReasonSchema });
|
|
20728
|
+
var PreconditionDataSchema = z34.object({
|
|
20729
|
+
reason: z34.enum(["broker_not_ready", "impd_outdated"]),
|
|
20730
|
+
detail: z34.string()
|
|
20656
20731
|
});
|
|
20657
|
-
var ProtectedImpSchema =
|
|
20732
|
+
var ProtectedImpSchema = z34.object({
|
|
20658
20733
|
name: NameSchema,
|
|
20659
|
-
ramMib:
|
|
20660
|
-
leased:
|
|
20661
|
-
busy:
|
|
20734
|
+
ramMib: z34.int().nonnegative(),
|
|
20735
|
+
leased: z34.boolean(),
|
|
20736
|
+
busy: z34.boolean()
|
|
20662
20737
|
});
|
|
20663
20738
|
var IMP_ERRORS = defineErrors({
|
|
20664
20739
|
NOT_FOUND: { message: "Not found", data: ResourceDataSchema },
|
|
@@ -20671,22 +20746,22 @@ var IMP_ERRORS = defineErrors({
|
|
|
20671
20746
|
RAM_BUDGET_EXCEEDED: {
|
|
20672
20747
|
message: "Not enough RAM budget, even after sleeping idle imps",
|
|
20673
20748
|
status: 503,
|
|
20674
|
-
data:
|
|
20675
|
-
budgetMib:
|
|
20676
|
-
usedMib:
|
|
20677
|
-
requestedMib:
|
|
20678
|
-
neededMib:
|
|
20679
|
-
protected:
|
|
20680
|
-
protectedHidden:
|
|
20749
|
+
data: z34.object({
|
|
20750
|
+
budgetMib: z34.int().nonnegative(),
|
|
20751
|
+
usedMib: z34.int().nonnegative(),
|
|
20752
|
+
requestedMib: z34.int().nonnegative(),
|
|
20753
|
+
neededMib: z34.int().nonnegative().optional(),
|
|
20754
|
+
protected: z34.array(ProtectedImpSchema).readonly().optional(),
|
|
20755
|
+
protectedHidden: z34.int().nonnegative().optional()
|
|
20681
20756
|
})
|
|
20682
20757
|
},
|
|
20683
20758
|
SERVICE_UNAVAILABLE: { message: "impd is stopping" },
|
|
20684
20759
|
INVALID_STATE: {
|
|
20685
20760
|
message: "The imp is not in a state that allows this",
|
|
20686
20761
|
status: 409,
|
|
20687
|
-
data:
|
|
20762
|
+
data: z34.object({
|
|
20688
20763
|
state: ImpStateSchema,
|
|
20689
|
-
allowed:
|
|
20764
|
+
allowed: z34.array(ImpStateSchema),
|
|
20690
20765
|
coldBoots: ColdBootsSchema.optional()
|
|
20691
20766
|
})
|
|
20692
20767
|
},
|
|
@@ -20698,10 +20773,10 @@ var IMP_ERRORS = defineErrors({
|
|
|
20698
20773
|
DISK_FULL: {
|
|
20699
20774
|
message: "Not enough free disk on the host",
|
|
20700
20775
|
status: 507,
|
|
20701
|
-
data:
|
|
20702
|
-
availableBytes:
|
|
20703
|
-
reserveBytes:
|
|
20704
|
-
requestedBytes:
|
|
20776
|
+
data: z34.object({
|
|
20777
|
+
availableBytes: z34.int().nonnegative(),
|
|
20778
|
+
reserveBytes: z34.int().nonnegative(),
|
|
20779
|
+
requestedBytes: z34.int().nonnegative()
|
|
20705
20780
|
})
|
|
20706
20781
|
},
|
|
20707
20782
|
LEASED: {
|
|
@@ -20714,7 +20789,7 @@ var IMP_ERRORS = defineErrors({
|
|
|
20714
20789
|
MOVING: {
|
|
20715
20790
|
message: "The imp is moving between hosts",
|
|
20716
20791
|
status: 409,
|
|
20717
|
-
data:
|
|
20792
|
+
data: z34.object({ retryAfterS: z34.int().positive() })
|
|
20718
20793
|
}
|
|
20719
20794
|
});
|
|
20720
20795
|
|
|
@@ -20722,73 +20797,73 @@ var IMP_ERRORS = defineErrors({
|
|
|
20722
20797
|
var contractBase = oc.$meta({}).errors(IMP_ERRORS);
|
|
20723
20798
|
|
|
20724
20799
|
// packages/api/src/contract/imps-contract.ts
|
|
20725
|
-
import * as
|
|
20800
|
+
import * as z40 from "zod";
|
|
20726
20801
|
|
|
20727
20802
|
// packages/api/src/schemas/cpu-limit-schema.ts
|
|
20728
|
-
import * as
|
|
20729
|
-
var CpuLimitSchema =
|
|
20803
|
+
import * as z35 from "zod";
|
|
20804
|
+
var CpuLimitSchema = z35.number().min(0.1);
|
|
20730
20805
|
|
|
20731
20806
|
// packages/api/src/schemas/cpu-weight-schema.ts
|
|
20732
|
-
import * as
|
|
20733
|
-
var CpuWeightSchema =
|
|
20807
|
+
import * as z36 from "zod";
|
|
20808
|
+
var CpuWeightSchema = z36.int().min(1).max(1e4);
|
|
20734
20809
|
|
|
20735
20810
|
// packages/api/src/schemas/imp-create-input-schema.ts
|
|
20736
|
-
import * as
|
|
20811
|
+
import * as z39 from "zod";
|
|
20737
20812
|
|
|
20738
20813
|
// packages/api/src/schemas/port-schema.ts
|
|
20739
|
-
import * as
|
|
20740
|
-
var PortSchema =
|
|
20814
|
+
import * as z37 from "zod";
|
|
20815
|
+
var PortSchema = z37.int().min(1).max(65535);
|
|
20741
20816
|
|
|
20742
20817
|
// packages/api/src/schemas/vcpus-schema.ts
|
|
20743
|
-
import * as
|
|
20744
|
-
var VcpusSchema =
|
|
20818
|
+
import * as z38 from "zod";
|
|
20819
|
+
var VcpusSchema = z38.int().min(1).max(32);
|
|
20745
20820
|
|
|
20746
20821
|
// packages/api/src/schemas/imp-create-input-schema.ts
|
|
20747
|
-
var ImpCreateInputSchema =
|
|
20822
|
+
var ImpCreateInputSchema = z39.object({
|
|
20748
20823
|
name: NameSchema.optional(),
|
|
20749
20824
|
image: NameSchema.optional(),
|
|
20750
20825
|
vcpus: VcpusSchema.optional(),
|
|
20751
|
-
memoryMib:
|
|
20752
|
-
maxMemoryMib:
|
|
20753
|
-
diskMib:
|
|
20826
|
+
memoryMib: z39.int().min(128).optional(),
|
|
20827
|
+
maxMemoryMib: z39.int().min(128).optional(),
|
|
20828
|
+
diskMib: z39.int().min(1024).optional(),
|
|
20754
20829
|
httpPort: PortSchema.optional(),
|
|
20755
20830
|
policy: EgressPolicySchema.optional(),
|
|
20756
20831
|
cpuLimit: CpuLimitSchema.nullable().optional(),
|
|
20757
20832
|
cpuWeight: CpuWeightSchema.optional(),
|
|
20758
|
-
networks:
|
|
20759
|
-
backup:
|
|
20833
|
+
networks: z39.array(NameSchema).max(MAX_CREATE_NETWORKS).optional(),
|
|
20834
|
+
backup: z39.boolean().optional()
|
|
20760
20835
|
});
|
|
20761
20836
|
|
|
20762
20837
|
// packages/api/src/contract/imps-contract.ts
|
|
20763
|
-
var ForceInputSchema =
|
|
20838
|
+
var ForceInputSchema = z40.object({ name: NameSchema, force: z40.boolean().optional() });
|
|
20764
20839
|
var impsContract = {
|
|
20765
20840
|
create: contractBase.meta(ACCESS.manageImp).input(ImpCreateInputSchema).output(ImpSchema),
|
|
20766
|
-
list: contractBase.meta(ACCESS.readAny).input(
|
|
20841
|
+
list: contractBase.meta(ACCESS.readAny).input(z40.object({ builders: z40.boolean().optional() }).optional()).output(z40.array(ImpSchema)),
|
|
20767
20842
|
get: contractBase.meta(ACCESS.readImp).input(NameInputSchema).output(ImpSchema),
|
|
20768
20843
|
destroy: contractBase.meta(ACCESS.manageImp).input(NameInputSchema).output(EmptySchema),
|
|
20769
20844
|
start: contractBase.meta(ACCESS.execImp).input(NameInputSchema).output(ImpSchema),
|
|
20770
20845
|
stop: contractBase.meta(ACCESS.execImp).input(ForceInputSchema).output(ImpSchema),
|
|
20771
20846
|
sleep: contractBase.meta(ACCESS.execImp).input(ForceInputSchema).output(ImpSchema),
|
|
20772
|
-
wake: contractBase.meta(ACCESS.execImp).input(
|
|
20773
|
-
hold: contractBase.meta(ACCESS.execImp).input(
|
|
20774
|
-
resizeDisk: contractBase.meta(ACCESS.manageImp).input(
|
|
20775
|
-
url: contractBase.meta(ACCESS.readImp).input(NameInputSchema).output(
|
|
20776
|
-
local:
|
|
20777
|
-
https:
|
|
20778
|
-
public:
|
|
20779
|
-
service:
|
|
20780
|
-
tailnet:
|
|
20847
|
+
wake: contractBase.meta(ACCESS.execImp).input(z40.object({ name: NameSchema, restartError: z40.boolean().optional() })).output(ImpSchema),
|
|
20848
|
+
hold: contractBase.meta(ACCESS.execImp).input(z40.object({ name: NameSchema, seconds: z40.int().nonnegative() })).output(ImpSchema),
|
|
20849
|
+
resizeDisk: contractBase.meta(ACCESS.manageImp).input(z40.object({ name: NameSchema, diskMib: z40.int().min(1024) })).output(ImpSchema),
|
|
20850
|
+
url: contractBase.meta(ACCESS.readImp).input(NameInputSchema).output(z40.object({
|
|
20851
|
+
local: z40.url(),
|
|
20852
|
+
https: z40.url().nullable(),
|
|
20853
|
+
public: z40.url().nullable(),
|
|
20854
|
+
service: z40.url().nullable(),
|
|
20855
|
+
tailnet: z40.url().nullable()
|
|
20781
20856
|
})),
|
|
20782
20857
|
policy: contractBase.meta(ACCESS.readImp).input(NameInputSchema).output(EgressPolicySchema),
|
|
20783
|
-
setPolicy: contractBase.meta(ACCESS.manageImp).input(
|
|
20858
|
+
setPolicy: contractBase.meta(ACCESS.manageImp).input(z40.object({ name: NameSchema, policy: EgressPolicySchema })).output(EgressPolicySchema),
|
|
20784
20859
|
expose: contractBase.meta(ACCESS.manageHost).input(ExposeInputSchema).output(ExposeResultSchema),
|
|
20785
20860
|
unexpose: contractBase.meta(ACCESS.manageHost).input(NameInputSchema).output(ImpSchema),
|
|
20786
|
-
fork: contractBase.meta({ access: { scope: "manage", on: "imp", fields: ["source", "name"], noGrantable: true } }).input(
|
|
20861
|
+
fork: contractBase.meta({ access: { scope: "manage", on: "imp", fields: ["source", "name"], noGrantable: true } }).input(z40.object({
|
|
20787
20862
|
source: NameSchema,
|
|
20788
20863
|
name: NameSchema,
|
|
20789
20864
|
checkpoint: CheckpointRefSchema.optional()
|
|
20790
20865
|
})).output(ForkResultSchema),
|
|
20791
|
-
update: contractBase.meta(ACCESS.manageImp).input(
|
|
20866
|
+
update: contractBase.meta(ACCESS.manageImp).input(z40.object({
|
|
20792
20867
|
name: NameSchema,
|
|
20793
20868
|
cpuLimit: CpuLimitSchema.nullable().optional(),
|
|
20794
20869
|
cpuWeight: CpuWeightSchema.optional(),
|
|
@@ -20798,184 +20873,176 @@ var impsContract = {
|
|
|
20798
20873
|
};
|
|
20799
20874
|
|
|
20800
20875
|
// packages/api/src/contract/tokens-contract.ts
|
|
20801
|
-
import * as
|
|
20876
|
+
import * as z41 from "zod";
|
|
20802
20877
|
var tokensContract = {
|
|
20803
|
-
list: contractBase.meta(ACCESS.manageHost).output(
|
|
20804
|
-
create: contractBase.meta(ACCESS.manageHost).input(
|
|
20878
|
+
list: contractBase.meta(ACCESS.manageHost).output(z41.array(TokenSchema)),
|
|
20879
|
+
create: contractBase.meta(ACCESS.manageHost).input(z41.object({
|
|
20805
20880
|
name: NameSchema,
|
|
20806
20881
|
scope: ScopeSchema,
|
|
20807
|
-
imps:
|
|
20808
|
-
sshKeys:
|
|
20882
|
+
imps: z41.array(ImpPatternSchema).min(1).max(32).optional(),
|
|
20883
|
+
sshKeys: z41.array(SshPublicKeySchema).min(1).max(MAX_SSH_KEYS).optional(),
|
|
20809
20884
|
grantable: GrantableSchema.optional(),
|
|
20810
20885
|
imageRefPrefix: ImageRefPrefixSchema.optional()
|
|
20811
|
-
})).output(
|
|
20812
|
-
update: contractBase.meta(ACCESS.manageHost).input(
|
|
20886
|
+
})).output(z41.object({ token: TokenSchema, secret: z41.string() })),
|
|
20887
|
+
update: contractBase.meta(ACCESS.manageHost).input(z41.object({
|
|
20813
20888
|
name: NameSchema,
|
|
20814
20889
|
grantable: GrantableUpdateSchema.optional(),
|
|
20815
20890
|
imageRefPrefix: ImageRefPrefixSchema.nullable().optional()
|
|
20816
20891
|
}).refine((input) => input.grantable !== undefined || input.imageRefPrefix !== undefined, "must set grantable, imageRefPrefix or both")).output(TokenSchema),
|
|
20817
20892
|
delete: contractBase.meta(ACCESS.manageHost).input(NameInputSchema).output(EmptySchema),
|
|
20818
|
-
addKey: contractBase.meta(ACCESS.manageHost).input(
|
|
20819
|
-
removeKey: contractBase.meta(ACCESS.manageHost).input(
|
|
20893
|
+
addKey: contractBase.meta(ACCESS.manageHost).input(z41.object({ name: NameSchema, key: SshPublicKeySchema })).output(SshKeySchema),
|
|
20894
|
+
removeKey: contractBase.meta(ACCESS.manageHost).input(z41.object({ name: NameSchema, fingerprint: z41.string() })).output(EmptySchema),
|
|
20820
20895
|
whoami: contractBase.meta(ACCESS.readAny).output(IdentitySchema)
|
|
20821
20896
|
};
|
|
20822
20897
|
|
|
20823
20898
|
// packages/api/src/contract/caller-contract.ts
|
|
20824
|
-
var LeaseInputSchema =
|
|
20899
|
+
var LeaseInputSchema = z42.object({
|
|
20825
20900
|
name: NameSchema,
|
|
20826
20901
|
label: LeaseLabelSchema.refine((label) => label !== "hold", "hold is the label imps.hold writes"),
|
|
20827
20902
|
ttlSeconds: LeaseTtlSchema
|
|
20828
20903
|
});
|
|
20829
|
-
var ImageAddInputSchema =
|
|
20830
|
-
|
|
20831
|
-
|
|
20904
|
+
var ImageAddInputSchema = z42.union([
|
|
20905
|
+
z42.object({ ref: ImageRefSchema, name: NameSchema.optional() }),
|
|
20906
|
+
z42.object({ imp: NameSchema, name: NameSchema })
|
|
20832
20907
|
]);
|
|
20833
|
-
var ImageBuildInputSchema =
|
|
20834
|
-
contextDir:
|
|
20908
|
+
var ImageBuildInputSchema = z42.object({
|
|
20909
|
+
contextDir: z42.string().startsWith("/"),
|
|
20835
20910
|
name: NameSchema,
|
|
20836
20911
|
dockerfile: DockerfilePathSchema.optional(),
|
|
20837
|
-
logs:
|
|
20912
|
+
logs: z42.boolean().optional()
|
|
20838
20913
|
});
|
|
20839
|
-
var ImageBuildStreamInputSchema =
|
|
20914
|
+
var ImageBuildStreamInputSchema = z42.union([
|
|
20840
20915
|
ImageBuildInputSchema,
|
|
20841
|
-
|
|
20916
|
+
z42.object({ upload: z42.string().min(1), logs: z42.boolean().optional() })
|
|
20842
20917
|
]);
|
|
20843
|
-
var CheckpointCreateInputSchema =
|
|
20918
|
+
var CheckpointCreateInputSchema = z42.object({
|
|
20844
20919
|
name: NameSchema,
|
|
20845
|
-
label:
|
|
20920
|
+
label: z42.string().min(1).max(64).optional()
|
|
20846
20921
|
});
|
|
20847
20922
|
var callerContract = {
|
|
20848
20923
|
imps: impsContract,
|
|
20849
20924
|
leases: {
|
|
20850
20925
|
acquire: contractBase.meta(ACCESS.execImp).input(LeaseInputSchema).output(LeaseSchema),
|
|
20851
20926
|
renew: contractBase.meta(ACCESS.execImp).input(LeaseInputSchema).output(LeaseSchema),
|
|
20852
|
-
release: contractBase.meta(ACCESS.execImp).input(
|
|
20853
|
-
list: contractBase.meta({ access: { scope: "exec", on: "any", audit: false } }).input(
|
|
20927
|
+
release: contractBase.meta(ACCESS.execImp).input(z42.object({ name: NameSchema, label: LeaseLabelSchema })).output(z42.object({ released: z42.boolean() })),
|
|
20928
|
+
list: contractBase.meta({ access: { scope: "exec", on: "any", audit: false } }).input(z42.object({ name: NameSchema.optional(), label: LeaseLabelSchema.optional() })).output(z42.array(LeaseSchema))
|
|
20854
20929
|
},
|
|
20855
20930
|
moves: {
|
|
20856
|
-
prepare: contractBase.meta(ACCESS.manageImpNoGrantable).input(
|
|
20931
|
+
prepare: contractBase.meta(ACCESS.manageImpNoGrantable).input(z42.object({
|
|
20857
20932
|
name: NameSchema,
|
|
20858
|
-
stop:
|
|
20859
|
-
force:
|
|
20860
|
-
targetStorage:
|
|
20933
|
+
stop: z42.boolean().optional(),
|
|
20934
|
+
force: z42.boolean().optional(),
|
|
20935
|
+
targetStorage: z42.enum(["xfs", "zfs"]).optional(),
|
|
20861
20936
|
target: WarmHostSchema.optional()
|
|
20862
20937
|
})).output(MovePlanSchema),
|
|
20863
20938
|
facts: contractBase.meta(ACCESS.manageHost).output(WarmHostSchema),
|
|
20864
|
-
receive: contractBase.meta(ACCESS.manageHost).input(
|
|
20939
|
+
receive: contractBase.meta(ACCESS.manageHost).input(z42.object({
|
|
20865
20940
|
name: NameSchema,
|
|
20866
|
-
bytes:
|
|
20941
|
+
bytes: z42.int().nonnegative(),
|
|
20867
20942
|
warm: WarmMoveSchema.optional()
|
|
20868
20943
|
})).output(MoveTicketSchema),
|
|
20869
|
-
send: contractBase.meta(ACCESS.manageImpNoGrantable).input(
|
|
20870
|
-
status: contractBase.meta(ACCESS.readImp).input(
|
|
20871
|
-
reissue: contractBase.meta(ACCESS.manageHost).input(
|
|
20872
|
-
resume: contractBase.meta(ACCESS.manageImpNoGrantable).input(
|
|
20873
|
-
abort: contractBase.meta(ACCESS.manageImp).input(
|
|
20944
|
+
send: contractBase.meta(ACCESS.manageImpNoGrantable).input(z42.object({ name: NameSchema, to: PeerUrlSchema, ticket: z42.string() })).output(MoveStatusSchema),
|
|
20945
|
+
status: contractBase.meta(ACCESS.readImp).input(z42.object({ name: NameSchema })).output(MoveStatusSchema),
|
|
20946
|
+
reissue: contractBase.meta(ACCESS.manageHost).input(z42.object({ name: NameSchema })).output(MoveTicketSchema),
|
|
20947
|
+
resume: contractBase.meta(ACCESS.manageImpNoGrantable).input(z42.object({ name: NameSchema, ticket: z42.string().optional() })).output(MoveStatusSchema),
|
|
20948
|
+
abort: contractBase.meta(ACCESS.manageImp).input(z42.object({ name: NameSchema })).output(MoveStatusSchema)
|
|
20874
20949
|
},
|
|
20875
20950
|
checkpoints: {
|
|
20876
20951
|
create: contractBase.meta(ACCESS.manageImp).input(CheckpointCreateInputSchema).output(CheckpointSchema),
|
|
20877
|
-
list: contractBase.meta(ACCESS.readImp).input(NameInputSchema).output(
|
|
20878
|
-
restore: contractBase.meta(ACCESS.manageImp).input(
|
|
20879
|
-
delete: contractBase.meta(ACCESS.manageImp).input(
|
|
20952
|
+
list: contractBase.meta(ACCESS.readImp).input(NameInputSchema).output(z42.array(CheckpointSchema)),
|
|
20953
|
+
restore: contractBase.meta(ACCESS.manageImp).input(z42.object({ name: NameSchema, checkpoint: CheckpointRefSchema })).output(ImpSchema),
|
|
20954
|
+
delete: contractBase.meta(ACCESS.manageImp).input(z42.object({ name: NameSchema, checkpoint: CheckpointRefSchema })).output(EmptySchema)
|
|
20880
20955
|
},
|
|
20881
20956
|
backups: {
|
|
20882
20957
|
run: contractBase.meta(ACCESS.manageHost).output(BackupRunSchema),
|
|
20883
20958
|
list: contractBase.meta(ACCESS.readHost).output(BackupStatusSchema),
|
|
20884
|
-
restore: contractBase.meta(ACCESS.manageHost).input(
|
|
20959
|
+
restore: contractBase.meta(ACCESS.manageHost).input(z42.object({
|
|
20885
20960
|
name: NameSchema.optional(),
|
|
20886
|
-
all:
|
|
20887
|
-
at:
|
|
20961
|
+
all: z42.boolean().optional(),
|
|
20962
|
+
at: z42.date().optional(),
|
|
20888
20963
|
as: NameSchema.optional(),
|
|
20889
|
-
merge:
|
|
20964
|
+
merge: z42.boolean().optional()
|
|
20890
20965
|
})).output(BackupRestoreSchema),
|
|
20891
|
-
check: contractBase.meta(ACCESS.manageHost).input(
|
|
20966
|
+
check: contractBase.meta(ACCESS.manageHost).input(z42.object({ subset: BackupCheckSubsetSchema.optional() })).output(EmptySchema)
|
|
20892
20967
|
},
|
|
20893
20968
|
images: {
|
|
20894
|
-
list: contractBase.meta(ACCESS.readAny).output(
|
|
20969
|
+
list: contractBase.meta(ACCESS.readAny).output(z42.array(ImageSchema)),
|
|
20895
20970
|
add: contractBase.meta(ACCESS.manageImage).input(ImageAddInputSchema).output(ImageSchema),
|
|
20896
20971
|
build: contractBase.meta(ACCESS.manageHost).input(ImageBuildInputSchema).output(ImageSchema),
|
|
20897
20972
|
addStream: contractBase.meta({ access: { scope: "manage", on: "image", audit: "refusals" } }).input(ImageAddInputSchema).output(eventIterator(ImageOpEventSchema)),
|
|
20898
20973
|
buildStream: contractBase.meta({ access: { scope: "manage", on: "host", audit: "refusals" } }).input(ImageBuildStreamInputSchema).output(eventIterator(ImageOpEventSchema)),
|
|
20899
|
-
builds: contractBase.meta(ACCESS.readHost).output(
|
|
20974
|
+
builds: contractBase.meta(ACCESS.readHost).output(z42.array(ImageBuildRunSchema)),
|
|
20900
20975
|
delete: contractBase.meta(ACCESS.manageHost).input(NameInputSchema).output(EmptySchema),
|
|
20901
20976
|
pin: contractBase.meta(ACCESS.manageHeldImage).input(NameInputSchema).output(ImageSchema),
|
|
20902
20977
|
unpin: contractBase.meta(ACCESS.manageHeldImage).input(NameInputSchema).output(ImageSchema)
|
|
20903
20978
|
},
|
|
20904
20979
|
exec: {
|
|
20905
|
-
ticket: contractBase.meta({ access: { scope: "exec", on: "imp", fields: ["name"], audit: false } }).input(NameInputSchema).output(
|
|
20980
|
+
ticket: contractBase.meta({ access: { scope: "exec", on: "imp", fields: ["name"], audit: false } }).input(NameInputSchema).output(z42.object({ ticket: z42.string(), expiresAt: z42.date() }))
|
|
20906
20981
|
},
|
|
20907
20982
|
sessions: {
|
|
20908
|
-
list: contractBase.meta(ACCESS.readImp).input(NameInputSchema).output(
|
|
20909
|
-
kill: contractBase.meta(ACCESS.execImp).input(
|
|
20910
|
-
logs: contractBase.meta(ACCESS.readImp).input(SessionLogListInputSchema).output(
|
|
20983
|
+
list: contractBase.meta(ACCESS.readImp).input(NameInputSchema).output(z42.array(SessionSchema)),
|
|
20984
|
+
kill: contractBase.meta(ACCESS.execImp).input(z42.object({ name: NameSchema, session: SessionNameSchema })).output(EmptySchema),
|
|
20985
|
+
logs: contractBase.meta(ACCESS.readImp).input(SessionLogListInputSchema).output(z42.array(SessionLogSchema)),
|
|
20911
20986
|
readLog: contractBase.meta(ACCESS.execImp).input(SessionLogReadInputSchema).output(SessionLogReadSchema),
|
|
20912
|
-
deleteLog: contractBase.meta(ACCESS.execImp).input(SessionLogDeleteInputSchema).output(
|
|
20987
|
+
deleteLog: contractBase.meta(ACCESS.execImp).input(SessionLogDeleteInputSchema).output(z42.object({ deleted: z42.int().nonnegative() }))
|
|
20913
20988
|
},
|
|
20914
20989
|
services: {
|
|
20915
20990
|
list: contractBase.meta(ACCESS.readImp).input(NameInputSchema).output(ServiceListSchema),
|
|
20916
|
-
add: contractBase.meta(ACCESS.execImp).input(
|
|
20991
|
+
add: contractBase.meta(ACCESS.execImp).input(z42.object({
|
|
20917
20992
|
name: NameSchema,
|
|
20918
20993
|
service: ServiceDefSchema,
|
|
20919
|
-
replace:
|
|
20994
|
+
replace: z42.boolean().optional()
|
|
20920
20995
|
})).output(EmptySchema),
|
|
20921
|
-
remove: contractBase.meta(ACCESS.execImp).input(
|
|
20922
|
-
restart: contractBase.meta(ACCESS.execImp).input(
|
|
20923
|
-
logs: contractBase.meta(ACCESS.execImp).input(
|
|
20996
|
+
remove: contractBase.meta(ACCESS.execImp).input(z42.object({ name: NameSchema, service: ServiceNameSchema })).output(EmptySchema),
|
|
20997
|
+
restart: contractBase.meta(ACCESS.execImp).input(z42.object({ name: NameSchema, service: ServiceNameSchema })).output(EmptySchema),
|
|
20998
|
+
logs: contractBase.meta(ACCESS.execImp).input(z42.object({
|
|
20924
20999
|
name: NameSchema,
|
|
20925
21000
|
service: ServiceNameSchema.optional(),
|
|
20926
|
-
lines:
|
|
20927
|
-
follow:
|
|
21001
|
+
lines: z42.int().min(0).max(SERVICE_LOG_MAX_LINES).optional(),
|
|
21002
|
+
follow: z42.boolean().optional()
|
|
20928
21003
|
})).output(eventIterator(ServiceLogSchema))
|
|
20929
21004
|
},
|
|
20930
21005
|
files: {
|
|
20931
|
-
write: contractBase.meta(ACCESS.execImp).input(
|
|
20932
|
-
remove: contractBase.meta(ACCESS.execImp).input(
|
|
21006
|
+
write: contractBase.meta(ACCESS.execImp).input(z42.object({ name: NameSchema, path: FilePathSchema, content: FileContentSchema })).output(z42.object({ path: z42.string() })),
|
|
21007
|
+
remove: contractBase.meta(ACCESS.execImp).input(z42.object({ name: NameSchema, path: FilePathSchema })).output(z42.object({ removed: z42.boolean() }))
|
|
20933
21008
|
},
|
|
20934
21009
|
secrets: {
|
|
20935
|
-
add: contractBase.meta(ACCESS.manageHost).input(
|
|
20936
|
-
|
|
20937
|
-
|
|
20938
|
-
|
|
20939
|
-
rules: z41.array(BrokerRuleSchema).min(1).max(16).optional(),
|
|
20940
|
-
oauth: OAuthConfigSchema.optional(),
|
|
20941
|
-
replace: z41.boolean().optional(),
|
|
20942
|
-
rebind: z41.boolean().optional()
|
|
20943
|
-
})).output(SecretAddedSchema),
|
|
20944
|
-
list: contractBase.meta(ACCESS.readAny).output(z41.array(SecretSchema)),
|
|
20945
|
-
refresh: contractBase.meta(ACCESS.manageHost).input(z41.object({ name: SecretNameSchema })).output(SecretSchema),
|
|
20946
|
-
delete: contractBase.meta(ACCESS.manageHost).input(z41.object({ name: SecretNameSchema })).output(EmptySchema)
|
|
21010
|
+
add: contractBase.meta(ACCESS.manageHost).input(SecretAddSchema).output(SecretAddedSchema),
|
|
21011
|
+
list: contractBase.meta(ACCESS.readAny).output(z42.array(SecretSchema)),
|
|
21012
|
+
refresh: contractBase.meta(ACCESS.manageHost).input(z42.object({ name: SecretNameSchema })).output(SecretSchema),
|
|
21013
|
+
delete: contractBase.meta(ACCESS.manageHost).input(z42.object({ name: SecretNameSchema })).output(EmptySchema)
|
|
20947
21014
|
},
|
|
20948
21015
|
networks: {
|
|
20949
|
-
list: contractBase.meta(ACCESS.readAny).output(
|
|
21016
|
+
list: contractBase.meta(ACCESS.readAny).output(z42.array(NetworkSchema)),
|
|
20950
21017
|
create: contractBase.meta(ACCESS.manageHost).input(NameInputSchema).output(NetworkSchema),
|
|
20951
21018
|
delete: contractBase.meta(ACCESS.manageHost).input(NameInputSchema).output(EmptySchema),
|
|
20952
|
-
join: contractBase.meta(ACCESS.manageHost).input(
|
|
20953
|
-
warnings: contractBase.meta(ACCESS.readImp).input(NameInputSchema).output(
|
|
20954
|
-
leave: contractBase.meta(ACCESS.manageHost).input(
|
|
21019
|
+
join: contractBase.meta(ACCESS.manageHost).input(z42.object({ network: NameSchema, name: NameSchema })).output(NetworkJoinSchema),
|
|
21020
|
+
warnings: contractBase.meta(ACCESS.readImp).input(NameInputSchema).output(z42.array(z42.string())),
|
|
21021
|
+
leave: contractBase.meta(ACCESS.manageHost).input(z42.object({ network: NameSchema, name: NameSchema })).output(NetworkSchema)
|
|
20955
21022
|
},
|
|
20956
21023
|
grants: {
|
|
20957
|
-
add: contractBase.meta(ACCESS.manageGrant).input(
|
|
21024
|
+
add: contractBase.meta(ACCESS.manageGrant).input(z42.object({
|
|
20958
21025
|
name: NameSchema,
|
|
20959
21026
|
secret: SecretNameSchema,
|
|
20960
21027
|
filter: GrantFilterSchema.optional()
|
|
20961
21028
|
})).output(EmptySchema),
|
|
20962
|
-
delete: contractBase.meta(ACCESS.manageGrant).input(
|
|
20963
|
-
list: contractBase.meta(ACCESS.readImp).input(NameInputSchema).output(
|
|
20964
|
-
details: contractBase.meta(ACCESS.readImp).input(NameInputSchema).output(
|
|
21029
|
+
delete: contractBase.meta(ACCESS.manageGrant).input(z42.object({ name: NameSchema, secret: SecretNameSchema })).output(EmptySchema),
|
|
21030
|
+
list: contractBase.meta(ACCESS.readImp).input(NameInputSchema).output(z42.array(SecretNameSchema)),
|
|
21031
|
+
details: contractBase.meta(ACCESS.readImp).input(NameInputSchema).output(z42.array(GrantSchema))
|
|
20965
21032
|
},
|
|
20966
21033
|
audit: {
|
|
20967
|
-
list: contractBase.meta(ACCESS.readAny).input(
|
|
21034
|
+
list: contractBase.meta(ACCESS.readAny).input(z42.object({
|
|
20968
21035
|
name: NameSchema.optional(),
|
|
20969
|
-
limit:
|
|
20970
|
-
})).output(
|
|
20971
|
-
refused: contractBase.meta(ACCESS.readAny).input(
|
|
21036
|
+
limit: z42.int().min(1).max(1000).optional()
|
|
21037
|
+
})).output(z42.array(AuditEntrySchema)),
|
|
21038
|
+
refused: contractBase.meta(ACCESS.readAny).input(z42.object({
|
|
20972
21039
|
name: NameSchema.optional(),
|
|
20973
|
-
limit:
|
|
20974
|
-
})).output(
|
|
20975
|
-
calls: contractBase.meta(ACCESS.readAny).input(
|
|
21040
|
+
limit: z42.int().min(1).max(1000).optional()
|
|
21041
|
+
})).output(z42.array(RefusedRequestSchema)),
|
|
21042
|
+
calls: contractBase.meta(ACCESS.readAny).input(z42.object({
|
|
20976
21043
|
name: NameSchema.optional(),
|
|
20977
|
-
limit:
|
|
20978
|
-
})).output(
|
|
21044
|
+
limit: z42.int().min(1).max(1000).optional()
|
|
21045
|
+
})).output(z42.array(ApiCallSchema))
|
|
20979
21046
|
},
|
|
20980
21047
|
events: {
|
|
20981
21048
|
stream: contractBase.meta(ACCESS.readAny).output(eventIterator(ImpEventSchema))
|
|
@@ -20983,40 +21050,40 @@ var callerContract = {
|
|
|
20983
21050
|
system: {
|
|
20984
21051
|
info: contractBase.meta(ACCESS.readAny).output(SystemInfoSchema),
|
|
20985
21052
|
features: contractBase.meta(ACCESS.readAny).output(SystemFeaturesInfoSchema),
|
|
20986
|
-
gc: contractBase.meta(ACCESS.manageHost).input(
|
|
20987
|
-
dryRun:
|
|
20988
|
-
orphans:
|
|
20989
|
-
secretFiles:
|
|
20990
|
-
removeSecretFiles:
|
|
21053
|
+
gc: contractBase.meta(ACCESS.manageHost).input(z42.object({
|
|
21054
|
+
dryRun: z42.boolean().optional(),
|
|
21055
|
+
orphans: z42.boolean().optional(),
|
|
21056
|
+
secretFiles: z42.boolean().optional(),
|
|
21057
|
+
removeSecretFiles: z42.boolean().optional()
|
|
20991
21058
|
})).output(StorageGcSchema),
|
|
20992
|
-
copyDatabase: contractBase.meta(ACCESS.manageHost).input(
|
|
21059
|
+
copyDatabase: contractBase.meta(ACCESS.manageHost).input(z42.object({ name: NameSchema.optional() })).output(DatabaseCopySchema)
|
|
20993
21060
|
},
|
|
20994
21061
|
oauth: {
|
|
20995
21062
|
clients: {
|
|
20996
|
-
list: contractBase.meta(ACCESS.manageHost).output(
|
|
20997
|
-
add: contractBase.meta(ACCESS.manageHost).input(
|
|
20998
|
-
update: contractBase.meta(ACCESS.manageHost).input(
|
|
21063
|
+
list: contractBase.meta(ACCESS.manageHost).output(z42.array(OAuthClientSchema)),
|
|
21064
|
+
add: contractBase.meta(ACCESS.manageHost).input(z42.object({ name: NameSchema, redirectUris: RedirectUrisSchema })).output(OAuthClientSchema),
|
|
21065
|
+
update: contractBase.meta(ACCESS.manageHost).input(z42.object({ name: NameSchema, redirectUris: RedirectUrisSchema })).output(OAuthClientSchema),
|
|
20999
21066
|
delete: contractBase.meta(ACCESS.manageHost).input(NameInputSchema).output(EmptySchema)
|
|
21000
21067
|
},
|
|
21001
21068
|
grants: {
|
|
21002
|
-
list: contractBase.meta(ACCESS.manageHost).output(
|
|
21003
|
-
delete: contractBase.meta(ACCESS.manageHost).input(
|
|
21069
|
+
list: contractBase.meta(ACCESS.manageHost).output(z42.array(OAuthGrantSchema)),
|
|
21070
|
+
delete: contractBase.meta(ACCESS.manageHost).input(z42.object({ id: z42.string().min(1).max(64) })).output(EmptySchema)
|
|
21004
21071
|
},
|
|
21005
21072
|
approvals: {
|
|
21006
|
-
get: contractBase.meta(ACCESS.readAny).input(
|
|
21007
|
-
approve: contractBase.meta(ACCESS.readAny).input(
|
|
21073
|
+
get: contractBase.meta(ACCESS.readAny).input(z42.object({ code: ApprovalCodeSchema })).output(OAuthApprovalSchema),
|
|
21074
|
+
approve: contractBase.meta(ACCESS.readAny).input(z42.object({
|
|
21008
21075
|
code: ApprovalCodeSchema,
|
|
21009
21076
|
scope: ScopeSchema,
|
|
21010
|
-
imps:
|
|
21077
|
+
imps: z42.array(GrantPatternSchema).min(1).max(32).optional()
|
|
21011
21078
|
})).output(EmptySchema)
|
|
21012
21079
|
}
|
|
21013
21080
|
},
|
|
21014
21081
|
tokens: tokensContract
|
|
21015
21082
|
};
|
|
21016
21083
|
// packages/api/src/contract/auth-contract.ts
|
|
21017
|
-
import * as
|
|
21084
|
+
import * as z43 from "zod";
|
|
21018
21085
|
var authContract = {
|
|
21019
|
-
login: contractBase.meta(ACCESS.noSession).errors({ UNAUTHORIZED: { message: "The token authenticates nobody" } }).input(
|
|
21086
|
+
login: contractBase.meta(ACCESS.noSession).errors({ UNAUTHORIZED: { message: "The token authenticates nobody" } }).input(z43.object({ token: z43.string() })).output(EmptySchema),
|
|
21020
21087
|
logout: contractBase.meta(ACCESS.noSession).output(EmptySchema)
|
|
21021
21088
|
};
|
|
21022
21089
|
|
|
@@ -21024,43 +21091,43 @@ var authContract = {
|
|
|
21024
21091
|
var sessionContract = { auth: authContract };
|
|
21025
21092
|
// packages/api/src/contract/collect-procedure-access.ts
|
|
21026
21093
|
import { isContractProcedure } from "@orpc/contract";
|
|
21027
|
-
import * as
|
|
21094
|
+
import * as z45 from "zod";
|
|
21028
21095
|
|
|
21029
21096
|
// packages/api/src/schemas/procedure-access-schema.ts
|
|
21030
|
-
import * as
|
|
21031
|
-
var FieldsSchema =
|
|
21032
|
-
var NoSessionAccessSchema =
|
|
21033
|
-
var HostAccessSchema =
|
|
21097
|
+
import * as z44 from "zod";
|
|
21098
|
+
var FieldsSchema = z44.array(z44.string()).readonly();
|
|
21099
|
+
var NoSessionAccessSchema = z44.object({ on: z44.literal("none") });
|
|
21100
|
+
var HostAccessSchema = z44.object({
|
|
21034
21101
|
scope: ScopeSchema,
|
|
21035
|
-
on:
|
|
21036
|
-
audit:
|
|
21102
|
+
on: z44.literal("host"),
|
|
21103
|
+
audit: z44.union([z44.literal(false), z44.literal("refusals")]).optional()
|
|
21037
21104
|
});
|
|
21038
|
-
var ImpAccessSchema =
|
|
21105
|
+
var ImpAccessSchema = z44.object({
|
|
21039
21106
|
scope: ScopeSchema,
|
|
21040
|
-
on:
|
|
21107
|
+
on: z44.literal("imp"),
|
|
21041
21108
|
fields: FieldsSchema,
|
|
21042
|
-
noGrantable:
|
|
21043
|
-
audit:
|
|
21109
|
+
noGrantable: z44.literal(true).optional(),
|
|
21110
|
+
audit: z44.literal(false).optional()
|
|
21044
21111
|
});
|
|
21045
|
-
var GrantAccessSchema =
|
|
21112
|
+
var GrantAccessSchema = z44.object({
|
|
21046
21113
|
scope: ScopeSchema,
|
|
21047
|
-
on:
|
|
21114
|
+
on: z44.literal("grant"),
|
|
21048
21115
|
fields: FieldsSchema,
|
|
21049
|
-
secretField:
|
|
21050
|
-
audit:
|
|
21116
|
+
secretField: z44.string(),
|
|
21117
|
+
audit: z44.literal(false).optional()
|
|
21051
21118
|
});
|
|
21052
|
-
var ImageAccessSchema =
|
|
21119
|
+
var ImageAccessSchema = z44.object({
|
|
21053
21120
|
scope: ScopeSchema,
|
|
21054
|
-
on:
|
|
21055
|
-
held:
|
|
21056
|
-
audit:
|
|
21121
|
+
on: z44.literal("image"),
|
|
21122
|
+
held: z44.literal(true).optional(),
|
|
21123
|
+
audit: z44.union([z44.literal(false), z44.literal("refusals")]).optional()
|
|
21057
21124
|
});
|
|
21058
|
-
var AnyAccessSchema =
|
|
21125
|
+
var AnyAccessSchema = z44.object({
|
|
21059
21126
|
scope: ScopeSchema,
|
|
21060
|
-
on:
|
|
21061
|
-
audit:
|
|
21127
|
+
on: z44.literal("any"),
|
|
21128
|
+
audit: z44.literal(false).optional()
|
|
21062
21129
|
});
|
|
21063
|
-
var ProcedureAccessSchema =
|
|
21130
|
+
var ProcedureAccessSchema = z44.discriminatedUnion("on", [
|
|
21064
21131
|
NoSessionAccessSchema,
|
|
21065
21132
|
HostAccessSchema,
|
|
21066
21133
|
ImpAccessSchema,
|
|
@@ -21070,7 +21137,7 @@ var ProcedureAccessSchema = z43.discriminatedUnion("on", [
|
|
|
21070
21137
|
]);
|
|
21071
21138
|
|
|
21072
21139
|
// packages/api/src/contract/collect-procedure-access.ts
|
|
21073
|
-
var MetaSchema =
|
|
21140
|
+
var MetaSchema = z45.object({ access: ProcedureAccessSchema });
|
|
21074
21141
|
function collectProcedureAccess(router, prefix = "") {
|
|
21075
21142
|
return Object.entries(router).flatMap(([key, value]) => {
|
|
21076
21143
|
const path = `${prefix}${key}`;
|
|
@@ -21128,23 +21195,23 @@ var MOVE_RECEIVE_PATH = "/move/receive";
|
|
|
21128
21195
|
import { oc as oc2 } from "@orpc/contract";
|
|
21129
21196
|
|
|
21130
21197
|
// packages/api/src/schemas/move-peer-schema.ts
|
|
21131
|
-
import * as
|
|
21132
|
-
var SystemDriveSchema =
|
|
21133
|
-
var MoveOfferSchema =
|
|
21134
|
-
imageDigest:
|
|
21135
|
-
receivedImageDigest:
|
|
21198
|
+
import * as z46 from "zod";
|
|
21199
|
+
var SystemDriveSchema = z46.string().regex(/^[\da-f]{64}$/v);
|
|
21200
|
+
var MoveOfferSchema = z46.object({
|
|
21201
|
+
imageDigest: z46.string(),
|
|
21202
|
+
receivedImageDigest: z46.string().nullable().default(null),
|
|
21136
21203
|
systemDrive: SystemDriveSchema.optional()
|
|
21137
21204
|
});
|
|
21138
|
-
var MoveOfferReplySchema =
|
|
21139
|
-
needsImage:
|
|
21140
|
-
needsSystemDrive:
|
|
21141
|
-
storage:
|
|
21142
|
-
keepsMaxMemory:
|
|
21143
|
-
keepsLeases:
|
|
21144
|
-
keepsPublicEgress:
|
|
21145
|
-
keepsBackupOff:
|
|
21205
|
+
var MoveOfferReplySchema = z46.object({
|
|
21206
|
+
needsImage: z46.boolean(),
|
|
21207
|
+
needsSystemDrive: z46.boolean().default(false),
|
|
21208
|
+
storage: z46.enum(["xfs", "zfs"]),
|
|
21209
|
+
keepsMaxMemory: z46.boolean().default(false),
|
|
21210
|
+
keepsLeases: z46.boolean().default(false),
|
|
21211
|
+
keepsPublicEgress: z46.boolean().default(false),
|
|
21212
|
+
keepsBackupOff: z46.boolean().default(false)
|
|
21146
21213
|
});
|
|
21147
|
-
var MoveCommitReplySchema =
|
|
21214
|
+
var MoveCommitReplySchema = z46.object({ isCommitted: z46.boolean() });
|
|
21148
21215
|
|
|
21149
21216
|
// packages/api/src/contract/move-peer-contract.ts
|
|
21150
21217
|
var movePeerContract = {
|
|
@@ -21152,6 +21219,28 @@ var movePeerContract = {
|
|
|
21152
21219
|
commit: oc2.route({ method: "POST", path: "/move/commit" }).output(MoveCommitReplySchema),
|
|
21153
21220
|
abort: oc2.route({ method: "POST", path: "/move/abort" }).output(MoveCommitReplySchema)
|
|
21154
21221
|
};
|
|
21222
|
+
// packages/api/src/schemas/secret-presets.ts
|
|
21223
|
+
var SECRET_PRESETS = {
|
|
21224
|
+
github: {
|
|
21225
|
+
kind: "static",
|
|
21226
|
+
rules: [
|
|
21227
|
+
{ host: "github.com", header: "authorization", scheme: "basic", user: "x-access-token" },
|
|
21228
|
+
{ host: "api.github.com", header: "authorization", scheme: "bearer" },
|
|
21229
|
+
{ host: "uploads.github.com", header: "authorization", scheme: "bearer" }
|
|
21230
|
+
],
|
|
21231
|
+
env: ["GH_TOKEN", "GITHUB_TOKEN"]
|
|
21232
|
+
},
|
|
21233
|
+
anthropic: {
|
|
21234
|
+
kind: "static",
|
|
21235
|
+
rules: [{ host: "api.anthropic.com", header: "x-api-key", scheme: "raw" }],
|
|
21236
|
+
env: ["ANTHROPIC_API_KEY"]
|
|
21237
|
+
},
|
|
21238
|
+
npm: {
|
|
21239
|
+
kind: "static",
|
|
21240
|
+
rules: [{ host: "registry.npmjs.org", header: "authorization", scheme: "bearer" }],
|
|
21241
|
+
env: ["NPM_TOKEN"]
|
|
21242
|
+
}
|
|
21243
|
+
};
|
|
21155
21244
|
// packages/api/src/rules/has-scope.ts
|
|
21156
21245
|
function hasScope(granted, needed) {
|
|
21157
21246
|
const grantedRank = ScopeSchema.options.indexOf(granted);
|
|
@@ -21159,7 +21248,7 @@ function hasScope(granted, needed) {
|
|
|
21159
21248
|
return grantedRank !== -1 && neededRank !== -1 && grantedRank >= neededRank;
|
|
21160
21249
|
}
|
|
21161
21250
|
// packages/daemon/src/identity/auth/tailnet-identity.ts
|
|
21162
|
-
import * as
|
|
21251
|
+
import * as z47 from "zod";
|
|
21163
21252
|
|
|
21164
21253
|
// packages/daemon/src/platform/process/ttl-cache.ts
|
|
21165
21254
|
import { LRUCache } from "lru-cache";
|
|
@@ -21173,16 +21262,16 @@ function createTtlCache(options) {
|
|
|
21173
21262
|
}
|
|
21174
21263
|
|
|
21175
21264
|
// packages/daemon/src/identity/auth/tailnet-identity.ts
|
|
21176
|
-
var TailnetRuleSchema =
|
|
21177
|
-
match:
|
|
21265
|
+
var TailnetRuleSchema = z47.object({
|
|
21266
|
+
match: z47.string().regex(/^(?:user:\S+|tag:[\w-]+|\*)$/u, "must be user:<login>, tag:<tag> or *"),
|
|
21178
21267
|
scope: ScopeSchema,
|
|
21179
|
-
imps:
|
|
21268
|
+
imps: z47.array(ImpPatternSchema).min(1).readonly().optional()
|
|
21180
21269
|
}).readonly();
|
|
21181
|
-
var TailnetRulesSchema =
|
|
21182
|
-
var TagsSchema =
|
|
21183
|
-
var WhoisSchema =
|
|
21184
|
-
Node:
|
|
21185
|
-
UserProfile:
|
|
21270
|
+
var TailnetRulesSchema = z47.array(TailnetRuleSchema).min(1).readonly();
|
|
21271
|
+
var TagsSchema = z47.array(z47.string()).nullable().optional();
|
|
21272
|
+
var WhoisSchema = z47.object({
|
|
21273
|
+
Node: z47.object({ Name: z47.string(), Tags: TagsSchema, StableID: z47.string().optional() }),
|
|
21274
|
+
UserProfile: z47.object({ LoginName: z47.string() })
|
|
21186
21275
|
});
|
|
21187
21276
|
var WHOIS_TTL_MS = 60000;
|
|
21188
21277
|
var MAX_CACHED = 256;
|
|
@@ -21305,16 +21394,16 @@ function parseTailnetRules(text) {
|
|
|
21305
21394
|
}
|
|
21306
21395
|
const rules = TailnetRulesSchema.safeParse(json);
|
|
21307
21396
|
if (!rules.success) {
|
|
21308
|
-
throw new Error(`IMP_TAILNET_IDENTITIES: ${
|
|
21397
|
+
throw new Error(`IMP_TAILNET_IDENTITIES: ${z48.prettifyError(rules.error)}`);
|
|
21309
21398
|
}
|
|
21310
21399
|
return rules.data;
|
|
21311
21400
|
}
|
|
21312
21401
|
|
|
21313
21402
|
// packages/daemon/src/identity/oauth/public-mcp-config.ts
|
|
21314
|
-
import * as
|
|
21315
|
-
var PublicMcpEnvSchema =
|
|
21316
|
-
IMP_MCP_PUBLIC_URL:
|
|
21317
|
-
IMP_MCP_PUBLIC_PORT:
|
|
21403
|
+
import * as z49 from "zod";
|
|
21404
|
+
var PublicMcpEnvSchema = z49.object({
|
|
21405
|
+
IMP_MCP_PUBLIC_URL: z49.string().optional(),
|
|
21406
|
+
IMP_MCP_PUBLIC_PORT: z49.coerce.number().pipe(z49.int().min(1).max(65535)).default(7071)
|
|
21318
21407
|
});
|
|
21319
21408
|
var LOOPBACK_HOSTS = new Set(["127.0.0.1", "localhost", "[::1]"]);
|
|
21320
21409
|
function parsePublicMcpConfig(env, others, slotPorts) {
|
|
@@ -21352,16 +21441,16 @@ function parseOrigin(text) {
|
|
|
21352
21441
|
}
|
|
21353
21442
|
|
|
21354
21443
|
// packages/daemon/src/imp-ops/backup/backup-config.ts
|
|
21355
|
-
import * as
|
|
21356
|
-
var CountSchema2 =
|
|
21444
|
+
import * as z50 from "zod";
|
|
21445
|
+
var CountSchema2 = z50.coerce.number().pipe(z50.int().positive());
|
|
21357
21446
|
var KEEP_BUCKETS = ["hourly", "daily", "weekly"];
|
|
21358
|
-
var BackupEnvSchema =
|
|
21359
|
-
IMP_BACKUP_REPOSITORY:
|
|
21360
|
-
IMP_BACKUP_PASSWORD_FILE:
|
|
21447
|
+
var BackupEnvSchema = z50.object({
|
|
21448
|
+
IMP_BACKUP_REPOSITORY: z50.string().optional(),
|
|
21449
|
+
IMP_BACKUP_PASSWORD_FILE: z50.string().optional(),
|
|
21361
21450
|
IMP_BACKUP_INTERVAL_S: CountSchema2.default(21600),
|
|
21362
|
-
IMP_BACKUP_KEEP:
|
|
21363
|
-
IMP_BACKUP_FORGET:
|
|
21364
|
-
IMP_BACKUP_DATABASE:
|
|
21451
|
+
IMP_BACKUP_KEEP: z50.string().default("hourly=24,daily=7,weekly=4"),
|
|
21452
|
+
IMP_BACKUP_FORGET: z50.enum(["true", "false"]).default("true"),
|
|
21453
|
+
IMP_BACKUP_DATABASE: z50.enum(["true", "false"]).default("false"),
|
|
21365
21454
|
IMP_BACKUP_CPUS: CountSchema2.default(2),
|
|
21366
21455
|
IMP_BACKUP_MEMORY_MIB: CountSchema2.default(512)
|
|
21367
21456
|
});
|
|
@@ -21442,26 +21531,26 @@ function checkPublicPorts(ports, others, slotPorts) {
|
|
|
21442
21531
|
|
|
21443
21532
|
// packages/daemon/src/network/https/https-config.ts
|
|
21444
21533
|
import { existsSync as existsSync3 } from "fs";
|
|
21445
|
-
import * as
|
|
21534
|
+
import * as z51 from "zod";
|
|
21446
21535
|
var LETS_ENCRYPT_DIRECTORY = "https://acme-v02.api.letsencrypt.org/directory";
|
|
21447
|
-
var DomainSchema =
|
|
21448
|
-
var PortSchema2 =
|
|
21536
|
+
var DomainSchema = z51.string().transform((value) => value.toLowerCase().replace(/\.$/u, "")).pipe(z51.string().regex(/^(?:[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?\.)+[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?$/u, "IMP_DOMAIN must be a domain name such as imp.example.com"));
|
|
21537
|
+
var PortSchema2 = z51.coerce.number().pipe(z51.int().min(1).max(65535));
|
|
21449
21538
|
var DNS_PROVIDERS = ["cloudflare", "challtestsrv"];
|
|
21450
|
-
var HttpsEnvSchema =
|
|
21539
|
+
var HttpsEnvSchema = z51.object({
|
|
21451
21540
|
IMP_DOMAIN: DomainSchema.optional(),
|
|
21452
21541
|
IMP_HTTPS_PORT: PortSchema2.default(443),
|
|
21453
21542
|
IMP_HTTP_PORT: PortSchema2.default(80),
|
|
21454
|
-
IMP_DNS_PROVIDER:
|
|
21455
|
-
IMP_DNS_API_TOKEN:
|
|
21456
|
-
IMP_DNS_API_TOKEN_FILE:
|
|
21457
|
-
IMP_DNS_API_URL:
|
|
21458
|
-
IMP_ACME_DIRECTORY:
|
|
21459
|
-
IMP_ACME_EMAIL:
|
|
21460
|
-
IMP_ACME_CA_FILE:
|
|
21461
|
-
IMP_PUBLIC_IP:
|
|
21543
|
+
IMP_DNS_PROVIDER: z51.enum(DNS_PROVIDERS).optional(),
|
|
21544
|
+
IMP_DNS_API_TOKEN: z51.string().optional(),
|
|
21545
|
+
IMP_DNS_API_TOKEN_FILE: z51.string().optional(),
|
|
21546
|
+
IMP_DNS_API_URL: z51.url().optional(),
|
|
21547
|
+
IMP_ACME_DIRECTORY: z51.url().default(LETS_ENCRYPT_DIRECTORY),
|
|
21548
|
+
IMP_ACME_EMAIL: z51.email().optional(),
|
|
21549
|
+
IMP_ACME_CA_FILE: z51.string().optional(),
|
|
21550
|
+
IMP_PUBLIC_IP: z51.ipv4().optional(),
|
|
21462
21551
|
IMP_PUBLIC_HTTPS_PORT: PortSchema2.default(7443),
|
|
21463
21552
|
IMP_PUBLIC_HTTP_PORT: PortSchema2.default(7480),
|
|
21464
|
-
IMP_E2E:
|
|
21553
|
+
IMP_E2E: z51.literal("1").optional()
|
|
21465
21554
|
});
|
|
21466
21555
|
function readHttpsConfig(env) {
|
|
21467
21556
|
if (env.IMP_DNS_API_TOKEN !== undefined && env.IMP_DNS_API_TOKEN_FILE !== undefined) {
|
|
@@ -21556,12 +21645,12 @@ function checkSecureUrl(url) {
|
|
|
21556
21645
|
|
|
21557
21646
|
// packages/daemon/src/network/tailnet-names/tailnet-names-config.ts
|
|
21558
21647
|
import { join as join3 } from "path";
|
|
21559
|
-
import * as
|
|
21560
|
-
var PrefixSchema =
|
|
21561
|
-
var TailnetNamesEnvSchema =
|
|
21562
|
-
IMP_TAILNET_NAMES:
|
|
21648
|
+
import * as z52 from "zod";
|
|
21649
|
+
var PrefixSchema = z52.string().regex(/^[a-z][a-z\d-]{0,20}$/u, "IMP_TAILNET_NAME_PREFIX must be a lowercase letter followed by up to 20 letters, digits or hyphens");
|
|
21650
|
+
var TailnetNamesEnvSchema = z52.object({
|
|
21651
|
+
IMP_TAILNET_NAMES: z52.literal("1").optional(),
|
|
21563
21652
|
IMP_TAILNET_NAME_PREFIX: PrefixSchema.optional(),
|
|
21564
|
-
IMP_TAILNET_OAUTH_FILE:
|
|
21653
|
+
IMP_TAILNET_OAUTH_FILE: z52.string().optional()
|
|
21565
21654
|
});
|
|
21566
21655
|
function parseTailnetNamesConfig(env, dataDir, isOnTailnet) {
|
|
21567
21656
|
if (env.IMP_TAILNET_NAMES === undefined) {
|
|
@@ -21577,33 +21666,33 @@ function parseTailnetNamesConfig(env, dataDir, isOnTailnet) {
|
|
|
21577
21666
|
}
|
|
21578
21667
|
|
|
21579
21668
|
// packages/daemon/src/config.ts
|
|
21580
|
-
var PortSchema3 =
|
|
21581
|
-
var CountSchema3 =
|
|
21582
|
-
var DnsServersSchema =
|
|
21583
|
-
var PercentSchema =
|
|
21584
|
-
var MarkSchema =
|
|
21585
|
-
var EnvSchema =
|
|
21586
|
-
IMP_DATA_DIR:
|
|
21669
|
+
var PortSchema3 = z53.coerce.number().pipe(z53.int().min(1).max(65535));
|
|
21670
|
+
var CountSchema3 = z53.coerce.number().pipe(z53.int().positive());
|
|
21671
|
+
var DnsServersSchema = z53.array(z53.ipv4()).min(1);
|
|
21672
|
+
var PercentSchema = z53.coerce.number().pipe(z53.int().min(0).max(100));
|
|
21673
|
+
var MarkSchema = z53.coerce.number().pipe(z53.int().min(1).max(99));
|
|
21674
|
+
var EnvSchema = z53.object({
|
|
21675
|
+
IMP_DATA_DIR: z53.string().default("/var/lib/imp"),
|
|
21587
21676
|
IMP_API_PORT: PortSchema3.default(7070),
|
|
21588
21677
|
IMP_PROXY_PORT: PortSchema3.default(7080),
|
|
21589
21678
|
IMP_PORT_BASE: PortSchema3.default(20000),
|
|
21590
|
-
IMP_SSH_PORT:
|
|
21591
|
-
IMP_SSH_AUTHORIZED_KEYS:
|
|
21679
|
+
IMP_SSH_PORT: z53.coerce.number().pipe(z53.int().min(0).max(65535)).default(22),
|
|
21680
|
+
IMP_SSH_AUTHORIZED_KEYS: z53.enum(["true", "false"]).default("true"),
|
|
21592
21681
|
IMP_BROKER_PORT: PortSchema3.default(7081),
|
|
21593
|
-
IMP_BROKER_TEST_UPSTREAMS:
|
|
21682
|
+
IMP_BROKER_TEST_UPSTREAMS: z53.string().optional(),
|
|
21594
21683
|
IMP_EGRESS_DNS_PORT: PortSchema3.default(7053),
|
|
21595
|
-
IMP_EGRESS_DENY:
|
|
21596
|
-
IMP_HOST_ADDRESSES:
|
|
21684
|
+
IMP_EGRESS_DENY: z53.string().default(""),
|
|
21685
|
+
IMP_HOST_ADDRESSES: z53.string().default(""),
|
|
21597
21686
|
IMP_RAM_BUDGET_MIB: CountSchema3.default(16384),
|
|
21598
21687
|
IMP_IDLE_TIMEOUT_S: CountSchema3.default(60),
|
|
21599
|
-
IMP_IDLE_CPU_PERCENT:
|
|
21688
|
+
IMP_IDLE_CPU_PERCENT: z53.coerce.number().nonnegative().default(10),
|
|
21600
21689
|
IMP_MEMORY_SHRINK_AFTER_S: CountSchema3.default(60),
|
|
21601
|
-
IMP_BOOT_RESERVE_PERCENT: CountSchema3.pipe(
|
|
21690
|
+
IMP_BOOT_RESERVE_PERCENT: CountSchema3.pipe(z53.int().max(100)).default(50),
|
|
21602
21691
|
IMP_WAKE_RESERVE_MIB: CountSchema3.default(256),
|
|
21603
|
-
IMP_SLEEP_MIN_GUEST_UPTIME_MS:
|
|
21604
|
-
IMP_BOOT_TEMPLATES:
|
|
21692
|
+
IMP_SLEEP_MIN_GUEST_UPTIME_MS: z53.coerce.number().pipe(z53.int().nonnegative()).default(1500),
|
|
21693
|
+
IMP_BOOT_TEMPLATES: z53.enum(["true", "false"]).default("true"),
|
|
21605
21694
|
IMP_WATCHDOG_TIMEOUT_S: CountSchema3.default(60),
|
|
21606
|
-
IMP_WATCHDOG_ACTION:
|
|
21695
|
+
IMP_WATCHDOG_ACTION: z53.enum(["report", "restart", "snapshot"]).default("report"),
|
|
21607
21696
|
IMP_DEFAULT_VCPUS: CountSchema3.default(2),
|
|
21608
21697
|
IMP_DEFAULT_MEMORY_MIB: CountSchema3.default(2048),
|
|
21609
21698
|
IMP_DEFAULT_DISK_GIB: CountSchema3.default(32),
|
|
@@ -21613,38 +21702,38 @@ var EnvSchema = z52.object({
|
|
|
21613
21702
|
IMP_BUILD_DISK_GIB: CountSchema3.default(20),
|
|
21614
21703
|
IMP_BUILD_IMAGE_MAX_MIB: CountSchema3.default(8192),
|
|
21615
21704
|
IMP_BUILD_IMAGE_MAX_FILES: CountSchema3.default(1e6),
|
|
21616
|
-
IMP_BUILD_IMAGE:
|
|
21617
|
-
IMP_BUILD_TEST_REGISTRY:
|
|
21618
|
-
IMP_BUILD_TEST_REGISTRY_CA:
|
|
21705
|
+
IMP_BUILD_IMAGE: z53.string().regex(BUILD_IMAGE_PATTERN, "must name an image by digest, <ref>@sha256:<hex>").default(DEFAULT_BUILD_IMAGE),
|
|
21706
|
+
IMP_BUILD_TEST_REGISTRY: z53.string().regex(/^[a-z0-9][a-z0-9.\-]*:\d+$/v, "must be <name>:<port>").optional(),
|
|
21707
|
+
IMP_BUILD_TEST_REGISTRY_CA: z53.string().optional(),
|
|
21619
21708
|
IMP_IMAGE_EVICT_HIGH_PERCENT: MarkSchema.optional(),
|
|
21620
21709
|
IMP_IMAGE_EVICT_LOW_PERCENT: MarkSchema.optional(),
|
|
21621
21710
|
IMP_SESSION_LOG_MAX_MIB: CountSchema3.default(16),
|
|
21622
21711
|
IMP_SESSION_LOG_IMP_MAX_MIB: CountSchema3.default(64),
|
|
21623
21712
|
IMP_SESSION_LOG_IMP_MAX_LIVE: CountSchema3.default(8),
|
|
21624
21713
|
IMP_SESSION_LOG_MAX_AGE_DAYS: CountSchema3.default(7),
|
|
21625
|
-
DOCKER_HOST:
|
|
21626
|
-
IMP_KSM:
|
|
21627
|
-
IMP_KSM_EXEC:
|
|
21628
|
-
IMP_KSM_HEADROOM_PERCENT:
|
|
21629
|
-
IMP_DNS:
|
|
21630
|
-
IMP_SUBNET:
|
|
21631
|
-
IMP_SUBNET6:
|
|
21632
|
-
IMP_FIRECRACKER_BIN:
|
|
21633
|
-
IMP_JAILER:
|
|
21634
|
-
IMP_JAILER_BIN:
|
|
21635
|
-
IMP_KERNEL:
|
|
21636
|
-
IMP_SYSTEM_DRIVE:
|
|
21637
|
-
IMP_DEFAULT_IMAGE:
|
|
21638
|
-
IMP_STORAGE_BACKEND:
|
|
21639
|
-
IMP_ZFS_ROOT:
|
|
21640
|
-
IMP_ZFS_ALLOW_UIOMOVE_BUG:
|
|
21641
|
-
TAILSCALE_AUTHKEY:
|
|
21642
|
-
IMP_TAILSCALE_NODE:
|
|
21643
|
-
IMP_TAILSCALE_HOSTNAME:
|
|
21644
|
-
IMP_DASHBOARD_DIR:
|
|
21645
|
-
IMP_TAILNET_IDENTITIES:
|
|
21646
|
-
IMP_PEER_URL:
|
|
21647
|
-
IMP_MOVE_TEST_CIDR:
|
|
21714
|
+
DOCKER_HOST: z53.string().optional(),
|
|
21715
|
+
IMP_KSM: z53.enum(["0", "1"]).default("0"),
|
|
21716
|
+
IMP_KSM_EXEC: z53.string().default("ksm-exec"),
|
|
21717
|
+
IMP_KSM_HEADROOM_PERCENT: z53.string().default("100"),
|
|
21718
|
+
IMP_DNS: z53.string().default("1.1.1.1,8.8.8.8").transform(splitList).pipe(DnsServersSchema),
|
|
21719
|
+
IMP_SUBNET: z53.cidrv4().default("10.66.0.0/16"),
|
|
21720
|
+
IMP_SUBNET6: z53.string().default("auto"),
|
|
21721
|
+
IMP_FIRECRACKER_BIN: z53.string().default("firecracker"),
|
|
21722
|
+
IMP_JAILER: z53.enum(["true", "false"]).default("true"),
|
|
21723
|
+
IMP_JAILER_BIN: z53.string().default("jailer"),
|
|
21724
|
+
IMP_KERNEL: z53.string().optional(),
|
|
21725
|
+
IMP_SYSTEM_DRIVE: z53.string().optional(),
|
|
21726
|
+
IMP_DEFAULT_IMAGE: z53.string().default("base"),
|
|
21727
|
+
IMP_STORAGE_BACKEND: z53.enum(["xfs", "zfs"]).default("xfs"),
|
|
21728
|
+
IMP_ZFS_ROOT: z53.string().optional(),
|
|
21729
|
+
IMP_ZFS_ALLOW_UIOMOVE_BUG: z53.enum(["0", "1"]).default("0"),
|
|
21730
|
+
TAILSCALE_AUTHKEY: z53.string().optional(),
|
|
21731
|
+
IMP_TAILSCALE_NODE: z53.literal("1").optional(),
|
|
21732
|
+
IMP_TAILSCALE_HOSTNAME: z53.string().default("imp"),
|
|
21733
|
+
IMP_DASHBOARD_DIR: z53.string().optional(),
|
|
21734
|
+
IMP_TAILNET_IDENTITIES: z53.string().optional(),
|
|
21735
|
+
IMP_PEER_URL: z53.url().optional(),
|
|
21736
|
+
IMP_MOVE_TEST_CIDR: z53.cidrv4().optional(),
|
|
21648
21737
|
...HttpsEnvSchema.shape,
|
|
21649
21738
|
...TailnetNamesEnvSchema.shape,
|
|
21650
21739
|
...PublicMcpEnvSchema.shape
|
|
@@ -21862,7 +21951,7 @@ import { join as join46 } from "path";
|
|
|
21862
21951
|
// packages/daemon/package.json
|
|
21863
21952
|
var package_default = {
|
|
21864
21953
|
name: "@impz/daemon",
|
|
21865
|
-
version: "
|
|
21954
|
+
version: "5.0.0",
|
|
21866
21955
|
private: true,
|
|
21867
21956
|
description: "impd: the imp host daemon",
|
|
21868
21957
|
type: "module",
|
|
@@ -22605,10 +22694,10 @@ import { Database } from "bun:sqlite";
|
|
|
22605
22694
|
import { chmodSync, closeSync, mkdirSync as mkdirSync3, openSync, rmSync, statSync } from "fs";
|
|
22606
22695
|
import { join as join5 } from "path";
|
|
22607
22696
|
import { sql as sql2 } from "kysely";
|
|
22608
|
-
import * as
|
|
22609
|
-
var MigrationRowSchema =
|
|
22610
|
-
var IntegrityRowSchema =
|
|
22611
|
-
var SizeRowSchema =
|
|
22697
|
+
import * as z54 from "zod";
|
|
22698
|
+
var MigrationRowSchema = z54.object({ name: z54.string() });
|
|
22699
|
+
var IntegrityRowSchema = z54.object({ integrity_check: z54.string() });
|
|
22700
|
+
var SizeRowSchema = z54.object({ bytes: z54.int().nonnegative() });
|
|
22612
22701
|
async function writeConsistentCopy(db, path) {
|
|
22613
22702
|
await sql2`VACUUM INTO ${path}`.execute(db);
|
|
22614
22703
|
}
|
|
@@ -22901,17 +22990,17 @@ function readFileState(path, stamp) {
|
|
|
22901
22990
|
|
|
22902
22991
|
// packages/daemon/src/platform/db/secrets.ts
|
|
22903
22992
|
import { randomBytes as randomBytes3 } from "crypto";
|
|
22904
|
-
import * as
|
|
22993
|
+
import * as z57 from "zod";
|
|
22905
22994
|
|
|
22906
22995
|
// packages/daemon/src/platform/db/tokens.ts
|
|
22907
|
-
import * as
|
|
22996
|
+
import * as z56 from "zod";
|
|
22908
22997
|
|
|
22909
22998
|
// packages/daemon/src/platform/db/imps-schema.ts
|
|
22910
|
-
import * as
|
|
22911
|
-
var ImpsSchema =
|
|
22999
|
+
import * as z55 from "zod";
|
|
23000
|
+
var ImpsSchema = z55.array(z55.string()).nullable();
|
|
22912
23001
|
|
|
22913
23002
|
// packages/daemon/src/platform/db/tokens.ts
|
|
22914
|
-
var GrantableSchema2 =
|
|
23003
|
+
var GrantableSchema2 = z56.array(z56.object({ name: z56.string(), generation: z56.string() }));
|
|
22915
23004
|
async function listTokenRecords(db) {
|
|
22916
23005
|
const rows = await db.selectFrom("tokens").selectAll().orderBy("name").execute();
|
|
22917
23006
|
return rows.map((row) => toTokenRecord(row));
|
|
@@ -23017,12 +23106,14 @@ function toTokenSshKeyRecord(row) {
|
|
|
23017
23106
|
}
|
|
23018
23107
|
|
|
23019
23108
|
// packages/daemon/src/platform/db/secrets.ts
|
|
23020
|
-
var RulesSchema =
|
|
23109
|
+
var RulesSchema = z57.array(BrokerRuleSchema);
|
|
23110
|
+
var EnvSchema2 = z57.array(z57.string());
|
|
23021
23111
|
async function createSecret(db, secret) {
|
|
23022
23112
|
const row = await db.insertInto("secrets").values({
|
|
23023
23113
|
name: secret.name,
|
|
23024
23114
|
kind: secret.kind,
|
|
23025
23115
|
rules: JSON.stringify(secret.rules),
|
|
23116
|
+
env: JSON.stringify(secret.env ?? []),
|
|
23026
23117
|
oauth: formatOAuthConfig(secret.oauth),
|
|
23027
23118
|
generation: createGeneration(),
|
|
23028
23119
|
value_file: secret.valueFile,
|
|
@@ -23051,6 +23142,7 @@ function upsertSecret(db, secret, rebind) {
|
|
|
23051
23142
|
const row = await trx.updateTable("secrets").set({
|
|
23052
23143
|
kind: secret.kind,
|
|
23053
23144
|
rules: JSON.stringify(secret.rules),
|
|
23145
|
+
env: JSON.stringify(secret.env ?? []),
|
|
23054
23146
|
oauth: formatOAuthConfig(secret.oauth),
|
|
23055
23147
|
value_file: secret.valueFile,
|
|
23056
23148
|
...!isRotation && { generation: createGeneration() }
|
|
@@ -23143,6 +23235,7 @@ async function listGrantedRules(db, impId) {
|
|
|
23143
23235
|
"secrets.name",
|
|
23144
23236
|
"secrets.kind",
|
|
23145
23237
|
"secrets.rules",
|
|
23238
|
+
"secrets.env",
|
|
23146
23239
|
"secrets.value_file",
|
|
23147
23240
|
"grants.filter"
|
|
23148
23241
|
]).where("grants.imp_id", "=", impId).orderBy("secrets.name").execute();
|
|
@@ -23150,6 +23243,7 @@ async function listGrantedRules(db, impId) {
|
|
|
23150
23243
|
secretName: row.name,
|
|
23151
23244
|
kind: parseKind(row.kind),
|
|
23152
23245
|
rule,
|
|
23246
|
+
env: parseEnv(row.env),
|
|
23153
23247
|
valueFile: row.value_file,
|
|
23154
23248
|
filter: parseFilter(row.filter)
|
|
23155
23249
|
})));
|
|
@@ -23222,6 +23316,7 @@ function toSecretRecord(row) {
|
|
|
23222
23316
|
name: row.name,
|
|
23223
23317
|
kind: parseKind(row.kind),
|
|
23224
23318
|
rules: parseRules(row.rules),
|
|
23319
|
+
env: parseEnv(row.env),
|
|
23225
23320
|
oauth: parseOAuth(row.oauth),
|
|
23226
23321
|
generation: row.generation,
|
|
23227
23322
|
valueFile: row.value_file,
|
|
@@ -23231,6 +23326,9 @@ function toSecretRecord(row) {
|
|
|
23231
23326
|
function parseRules(json) {
|
|
23232
23327
|
return RulesSchema.parse(JSON.parse(json));
|
|
23233
23328
|
}
|
|
23329
|
+
function parseEnv(json) {
|
|
23330
|
+
return EnvSchema2.parse(JSON.parse(json));
|
|
23331
|
+
}
|
|
23234
23332
|
function parseFilter(json) {
|
|
23235
23333
|
return json === null ? null : GrantFilterSchema.parse(JSON.parse(json));
|
|
23236
23334
|
}
|
|
@@ -23867,7 +23965,7 @@ function findBadFieldValue(field, value) {
|
|
|
23867
23965
|
return isGood ? undefined : name;
|
|
23868
23966
|
}
|
|
23869
23967
|
// packages/agent-protocol/src/frame-codec.ts
|
|
23870
|
-
import * as
|
|
23968
|
+
import * as z58 from "zod";
|
|
23871
23969
|
var FRAME_TYPES = {
|
|
23872
23970
|
request: 1,
|
|
23873
23971
|
response: 2,
|
|
@@ -23933,7 +24031,7 @@ function buildFrameDecoder() {
|
|
|
23933
24031
|
return { push: decodeChunk, end: checkEnded };
|
|
23934
24032
|
}
|
|
23935
24033
|
function decodeJsonPayload(frame) {
|
|
23936
|
-
return
|
|
24034
|
+
return z58.json().parse(JSON.parse(new TextDecoder().decode(frame.payload)));
|
|
23937
24035
|
}
|
|
23938
24036
|
function mergeBytes2(left, right) {
|
|
23939
24037
|
if (left.byteLength === 0) {
|
|
@@ -25315,7 +25413,7 @@ function toLeaseRecord(row) {
|
|
|
25315
25413
|
// packages/daemon/src/vm/sleep/snapshot-meta.ts
|
|
25316
25414
|
import { existsSync as existsSync4, rmSync as rmSync4 } from "fs";
|
|
25317
25415
|
import { toJson as toJson3 } from "@bufbuild/protobuf";
|
|
25318
|
-
import * as
|
|
25416
|
+
import * as z60 from "zod";
|
|
25319
25417
|
|
|
25320
25418
|
// packages/daemon/src/platform/process/write-file-durably.ts
|
|
25321
25419
|
import {
|
|
@@ -25406,11 +25504,11 @@ function writeToDisk(paths, sync = fsyncSync) {
|
|
|
25406
25504
|
import { isMessage } from "@bufbuild/protobuf";
|
|
25407
25505
|
|
|
25408
25506
|
// packages/daemon/src/vm/agent-client/agent-ids.ts
|
|
25409
|
-
import * as
|
|
25507
|
+
import * as z59 from "zod";
|
|
25410
25508
|
var AgentGenerationSchema = ExecutionGenerationSchema;
|
|
25411
25509
|
var AgentSessionNameSchema = SessionNameSchema;
|
|
25412
|
-
var AgentBootIdSchema =
|
|
25413
|
-
var AgentLogIdentitySchema =
|
|
25510
|
+
var AgentBootIdSchema = z59.string().regex(/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})?$/u);
|
|
25511
|
+
var AgentLogIdentitySchema = z59.object({
|
|
25414
25512
|
generation: AgentGenerationSchema,
|
|
25415
25513
|
session: AgentSessionNameSchema,
|
|
25416
25514
|
bootId: AgentBootIdSchema
|
|
@@ -25486,20 +25584,20 @@ function findCpuChange(snapshot, host) {
|
|
|
25486
25584
|
}
|
|
25487
25585
|
|
|
25488
25586
|
// packages/daemon/src/vm/sleep/snapshot-meta.ts
|
|
25489
|
-
var SnapshotIdentitySchema =
|
|
25490
|
-
firecrackerVersion:
|
|
25491
|
-
snapshotVersion:
|
|
25492
|
-
hostKernel:
|
|
25493
|
-
guestKernel:
|
|
25494
|
-
systemDrive:
|
|
25495
|
-
systemDrivePath:
|
|
25496
|
-
agentVersion:
|
|
25497
|
-
ipv6Prefix:
|
|
25498
|
-
cpuModel:
|
|
25499
|
-
cpuFlags:
|
|
25587
|
+
var SnapshotIdentitySchema = z60.object({
|
|
25588
|
+
firecrackerVersion: z60.string(),
|
|
25589
|
+
snapshotVersion: z60.string(),
|
|
25590
|
+
hostKernel: z60.string(),
|
|
25591
|
+
guestKernel: z60.string(),
|
|
25592
|
+
systemDrive: z60.string(),
|
|
25593
|
+
systemDrivePath: z60.string().optional(),
|
|
25594
|
+
agentVersion: z60.string().optional(),
|
|
25595
|
+
ipv6Prefix: z60.string().nullable().optional(),
|
|
25596
|
+
cpuModel: z60.string().optional(),
|
|
25597
|
+
cpuFlags: z60.string().optional()
|
|
25500
25598
|
});
|
|
25501
25599
|
var AGENT_RECORD_JSON = { useProtoFieldName: true, alwaysEmitImplicit: true };
|
|
25502
|
-
var SeenSessionJsonSchema =
|
|
25600
|
+
var SeenSessionJsonSchema = z60.json().transform((json, ctx) => {
|
|
25503
25601
|
try {
|
|
25504
25602
|
if (typeof json !== "object" || json === null || Array.isArray(json)) {
|
|
25505
25603
|
throw new Error("a session is a JSON object");
|
|
@@ -25512,23 +25610,23 @@ var SeenSessionJsonSchema = z59.json().transform((json, ctx) => {
|
|
|
25512
25610
|
return typeof observed === "number" ? { ...session, observedUnixMs: observed } : session;
|
|
25513
25611
|
} catch (error) {
|
|
25514
25612
|
ctx.addIssue({ code: "custom", message: String(error) });
|
|
25515
|
-
return
|
|
25613
|
+
return z60.NEVER;
|
|
25516
25614
|
}
|
|
25517
25615
|
});
|
|
25518
|
-
var ServicesListJsonSchema =
|
|
25616
|
+
var ServicesListJsonSchema = z60.json().transform((json, ctx) => {
|
|
25519
25617
|
try {
|
|
25520
25618
|
return decodeAgentMessage(ServicesListSchema, json);
|
|
25521
25619
|
} catch (error) {
|
|
25522
25620
|
ctx.addIssue({ code: "custom", message: String(error) });
|
|
25523
|
-
return
|
|
25621
|
+
return z60.NEVER;
|
|
25524
25622
|
}
|
|
25525
25623
|
});
|
|
25526
25624
|
var SnapshotMetaSchema = SnapshotIdentitySchema.extend({
|
|
25527
|
-
createdAt:
|
|
25528
|
-
memoryMib:
|
|
25529
|
-
ramMib:
|
|
25530
|
-
pluggedMib:
|
|
25531
|
-
sessions:
|
|
25625
|
+
createdAt: z60.int(),
|
|
25626
|
+
memoryMib: z60.int(),
|
|
25627
|
+
ramMib: z60.int().nonnegative(),
|
|
25628
|
+
pluggedMib: z60.int().nonnegative().optional(),
|
|
25629
|
+
sessions: z60.array(SeenSessionJsonSchema).readonly().optional(),
|
|
25532
25630
|
services: ServicesListJsonSchema.optional()
|
|
25533
25631
|
});
|
|
25534
25632
|
function buildSnapshotIdentity(vm, host) {
|
|
@@ -25655,19 +25753,19 @@ function countSessions(context, imp) {
|
|
|
25655
25753
|
// packages/daemon/src/vm/sleep/vm-identity.ts
|
|
25656
25754
|
import { existsSync as existsSync5, readFileSync as readFileSync6 } from "fs";
|
|
25657
25755
|
import { release } from "os";
|
|
25658
|
-
import * as
|
|
25659
|
-
var VmIdentitySchema =
|
|
25660
|
-
firecrackerVersion:
|
|
25661
|
-
snapshotVersion:
|
|
25662
|
-
hostKernel:
|
|
25663
|
-
guestKernel:
|
|
25664
|
-
systemDrive:
|
|
25665
|
-
systemDrivePath:
|
|
25666
|
-
agentVersion:
|
|
25667
|
-
bootReason:
|
|
25668
|
-
ipv6Prefix:
|
|
25669
|
-
cpuModel:
|
|
25670
|
-
cpuFlags:
|
|
25756
|
+
import * as z61 from "zod";
|
|
25757
|
+
var VmIdentitySchema = z61.object({
|
|
25758
|
+
firecrackerVersion: z61.string(),
|
|
25759
|
+
snapshotVersion: z61.string(),
|
|
25760
|
+
hostKernel: z61.string(),
|
|
25761
|
+
guestKernel: z61.string(),
|
|
25762
|
+
systemDrive: z61.string(),
|
|
25763
|
+
systemDrivePath: z61.string(),
|
|
25764
|
+
agentVersion: z61.string(),
|
|
25765
|
+
bootReason: z61.string().nullable(),
|
|
25766
|
+
ipv6Prefix: z61.string().nullable().optional(),
|
|
25767
|
+
cpuModel: z61.string().optional(),
|
|
25768
|
+
cpuFlags: z61.string().optional()
|
|
25671
25769
|
});
|
|
25672
25770
|
function readHostIdentity(firecrackerBin, systemFiles, ipv6Prefix = null) {
|
|
25673
25771
|
return {
|
|
@@ -25982,7 +26080,7 @@ import {
|
|
|
25982
26080
|
writeFileSync as writeFileSync2
|
|
25983
26081
|
} from "fs";
|
|
25984
26082
|
import { dirname as dirname6, join as join9 } from "path";
|
|
25985
|
-
import * as
|
|
26083
|
+
import * as z65 from "zod";
|
|
25986
26084
|
|
|
25987
26085
|
// packages/daemon/src/platform/process/require-within.ts
|
|
25988
26086
|
async function requireWithin(promise, durationMs, buildError, startTimer = startRealTimer) {
|
|
@@ -26294,43 +26392,43 @@ function buildKeyedMutex() {
|
|
|
26294
26392
|
import { Database as Database2 } from "bun:sqlite";
|
|
26295
26393
|
import { mkdirSync as mkdirSync4, rmSync as rmSync5 } from "fs";
|
|
26296
26394
|
import { dirname as dirname4 } from "path";
|
|
26297
|
-
import * as
|
|
26298
|
-
var CopyImpSchema =
|
|
26299
|
-
id:
|
|
26300
|
-
name:
|
|
26301
|
-
imageId:
|
|
26302
|
-
state:
|
|
26303
|
-
vcpus:
|
|
26304
|
-
memoryMib:
|
|
26305
|
-
maxMemoryMib:
|
|
26306
|
-
httpPort:
|
|
26307
|
-
egressPolicy:
|
|
26308
|
-
diskBytes:
|
|
26309
|
-
egressAllow:
|
|
26310
|
-
identityResetPending:
|
|
26311
|
-
backup:
|
|
26395
|
+
import * as z62 from "zod";
|
|
26396
|
+
var CopyImpSchema = z62.object({
|
|
26397
|
+
id: z62.string(),
|
|
26398
|
+
name: z62.string(),
|
|
26399
|
+
imageId: z62.string(),
|
|
26400
|
+
state: z62.string(),
|
|
26401
|
+
vcpus: z62.int(),
|
|
26402
|
+
memoryMib: z62.int(),
|
|
26403
|
+
maxMemoryMib: z62.int().nullable(),
|
|
26404
|
+
httpPort: z62.int(),
|
|
26405
|
+
egressPolicy: z62.string(),
|
|
26406
|
+
diskBytes: z62.int(),
|
|
26407
|
+
egressAllow: z62.string(),
|
|
26408
|
+
identityResetPending: z62.int(),
|
|
26409
|
+
backup: z62.int()
|
|
26312
26410
|
});
|
|
26313
|
-
var CopyGrantSchema =
|
|
26314
|
-
impId:
|
|
26315
|
-
secretName:
|
|
26316
|
-
filter:
|
|
26411
|
+
var CopyGrantSchema = z62.object({
|
|
26412
|
+
impId: z62.string(),
|
|
26413
|
+
secretName: z62.string(),
|
|
26414
|
+
filter: z62.string().nullable().transform((json) => json === null ? null : GrantFilterSchema.parse(JSON.parse(json)))
|
|
26317
26415
|
});
|
|
26318
|
-
var CopyMemberSchema =
|
|
26319
|
-
var CopyCheckpointSchema =
|
|
26320
|
-
id:
|
|
26321
|
-
impId:
|
|
26322
|
-
label:
|
|
26323
|
-
createdAt:
|
|
26324
|
-
diskBytes:
|
|
26416
|
+
var CopyMemberSchema = z62.object({ impId: z62.string(), network: z62.string() });
|
|
26417
|
+
var CopyCheckpointSchema = z62.object({
|
|
26418
|
+
id: z62.string(),
|
|
26419
|
+
impId: z62.string(),
|
|
26420
|
+
label: z62.string().nullable(),
|
|
26421
|
+
createdAt: z62.int(),
|
|
26422
|
+
diskBytes: z62.int()
|
|
26325
26423
|
});
|
|
26326
|
-
var CopyImageSchema =
|
|
26327
|
-
id:
|
|
26328
|
-
name:
|
|
26329
|
-
ref:
|
|
26330
|
-
digest:
|
|
26424
|
+
var CopyImageSchema = z62.object({
|
|
26425
|
+
id: z62.string(),
|
|
26426
|
+
name: z62.string(),
|
|
26427
|
+
ref: z62.string(),
|
|
26428
|
+
digest: z62.string(),
|
|
26331
26429
|
source: ImageSourceSchema,
|
|
26332
|
-
sourceImp:
|
|
26333
|
-
sizeBytes:
|
|
26430
|
+
sourceImp: z62.string().nullable(),
|
|
26431
|
+
sizeBytes: z62.int()
|
|
26334
26432
|
});
|
|
26335
26433
|
async function readDatabaseCopy(db, path) {
|
|
26336
26434
|
mkdirSync4(dirname4(path), { recursive: true });
|
|
@@ -26351,11 +26449,11 @@ async function readDatabaseCopy(db, path) {
|
|
|
26351
26449
|
const members = copy.query(`SELECT network_members.imp_id AS impId, networks.name AS network FROM network_members
|
|
26352
26450
|
JOIN networks ON networks.id = network_members.network_id ORDER BY networks.name`).all();
|
|
26353
26451
|
return {
|
|
26354
|
-
imps:
|
|
26355
|
-
grants:
|
|
26356
|
-
members:
|
|
26357
|
-
checkpoints:
|
|
26358
|
-
images:
|
|
26452
|
+
imps: z62.array(CopyImpSchema).parse(imps),
|
|
26453
|
+
grants: z62.array(CopyGrantSchema).parse(grants),
|
|
26454
|
+
members: z62.array(CopyMemberSchema).parse(members),
|
|
26455
|
+
checkpoints: z62.array(CopyCheckpointSchema).parse(checkpoints),
|
|
26456
|
+
images: z62.array(CopyImageSchema).parse(images)
|
|
26359
26457
|
};
|
|
26360
26458
|
} finally {
|
|
26361
26459
|
copy.close();
|
|
@@ -26363,7 +26461,7 @@ async function readDatabaseCopy(db, path) {
|
|
|
26363
26461
|
}
|
|
26364
26462
|
|
|
26365
26463
|
// packages/daemon/src/imp-ops/backup/restic.ts
|
|
26366
|
-
import * as
|
|
26464
|
+
import * as z63 from "zod";
|
|
26367
26465
|
var BACKUP_TAG = "imp-backup";
|
|
26368
26466
|
var RESTIC_HOST = "impd";
|
|
26369
26467
|
var NO_REPOSITORY_EXIT = 10;
|
|
@@ -26371,20 +26469,20 @@ var LOCKED_EXIT = 11;
|
|
|
26371
26469
|
var RETRY_LOCK = "2m";
|
|
26372
26470
|
var LOCK_HOLDER = /locked.* by PID /v;
|
|
26373
26471
|
var NO_SNAPSHOT = "no matching ID found";
|
|
26374
|
-
var SnapshotSchema =
|
|
26375
|
-
id:
|
|
26376
|
-
time:
|
|
26377
|
-
paths:
|
|
26378
|
-
tags:
|
|
26472
|
+
var SnapshotSchema = z63.object({
|
|
26473
|
+
id: z63.string(),
|
|
26474
|
+
time: z63.coerce.date(),
|
|
26475
|
+
paths: z63.array(z63.string()),
|
|
26476
|
+
tags: z63.array(z63.string()).nullish()
|
|
26379
26477
|
});
|
|
26380
|
-
var ExitErrorSchema =
|
|
26381
|
-
var SummarySchema =
|
|
26382
|
-
message_type:
|
|
26383
|
-
snapshot_id:
|
|
26384
|
-
files_new:
|
|
26385
|
-
files_changed:
|
|
26386
|
-
files_unmodified:
|
|
26387
|
-
data_added:
|
|
26478
|
+
var ExitErrorSchema = z63.object({ message_type: z63.literal("exit_error"), message: z63.string() });
|
|
26479
|
+
var SummarySchema = z63.object({
|
|
26480
|
+
message_type: z63.literal("summary"),
|
|
26481
|
+
snapshot_id: z63.string(),
|
|
26482
|
+
files_new: z63.number(),
|
|
26483
|
+
files_changed: z63.number(),
|
|
26484
|
+
files_unmodified: z63.number(),
|
|
26485
|
+
data_added: z63.number()
|
|
26388
26486
|
});
|
|
26389
26487
|
|
|
26390
26488
|
class ResticError extends Error {
|
|
@@ -26488,7 +26586,7 @@ function createRestic(deps) {
|
|
|
26488
26586
|
};
|
|
26489
26587
|
}
|
|
26490
26588
|
function parseSnapshots(stdout) {
|
|
26491
|
-
const parsed =
|
|
26589
|
+
const parsed = z63.array(SnapshotSchema).parse(JSON.parse(stdout || "[]"));
|
|
26492
26590
|
return parsed.map((snapshot) => ({
|
|
26493
26591
|
id: snapshot.id,
|
|
26494
26592
|
time: snapshot.time,
|
|
@@ -27847,61 +27945,61 @@ async function restoreGrants(deps, impName, imported) {
|
|
|
27847
27945
|
}
|
|
27848
27946
|
|
|
27849
27947
|
// packages/daemon/src/imp-ops/backup/backup-manifest.ts
|
|
27850
|
-
import * as
|
|
27948
|
+
import * as z64 from "zod";
|
|
27851
27949
|
|
|
27852
27950
|
// packages/daemon/src/platform/process/legacy-disk-bytes.ts
|
|
27853
27951
|
var LEGACY_DISK_BYTES = 32 * 1024 ** 3;
|
|
27854
27952
|
|
|
27855
27953
|
// packages/daemon/src/imp-ops/backup/backup-manifest.ts
|
|
27856
|
-
var ManifestCheckpointSchema =
|
|
27857
|
-
id:
|
|
27858
|
-
label:
|
|
27859
|
-
createdAt:
|
|
27860
|
-
disk:
|
|
27861
|
-
diskBytes:
|
|
27862
|
-
usedBytes:
|
|
27954
|
+
var ManifestCheckpointSchema = z64.object({
|
|
27955
|
+
id: z64.string(),
|
|
27956
|
+
label: z64.string().nullable(),
|
|
27957
|
+
createdAt: z64.coerce.date(),
|
|
27958
|
+
disk: z64.string(),
|
|
27959
|
+
diskBytes: z64.int().positive().default(LEGACY_DISK_BYTES),
|
|
27960
|
+
usedBytes: z64.int().nonnegative().optional()
|
|
27863
27961
|
}).readonly();
|
|
27864
|
-
var FilteredGrantSchema =
|
|
27865
|
-
var ManifestImpSchema =
|
|
27866
|
-
id:
|
|
27867
|
-
name:
|
|
27868
|
-
imageDigest:
|
|
27869
|
-
vcpus:
|
|
27870
|
-
memoryMib:
|
|
27871
|
-
maxMemoryMib:
|
|
27872
|
-
httpPort:
|
|
27873
|
-
state:
|
|
27874
|
-
synced:
|
|
27875
|
-
dir:
|
|
27876
|
-
disk:
|
|
27877
|
-
diskBytes:
|
|
27878
|
-
usedBytes:
|
|
27879
|
-
egressPolicy:
|
|
27880
|
-
egressAllow:
|
|
27881
|
-
grants:
|
|
27882
|
-
filteredGrants:
|
|
27883
|
-
identityResetPending:
|
|
27884
|
-
networks:
|
|
27885
|
-
checkpoints:
|
|
27962
|
+
var FilteredGrantSchema = z64.object({ secret: z64.string(), filter: GrantFilterSchema }).readonly();
|
|
27963
|
+
var ManifestImpSchema = z64.object({
|
|
27964
|
+
id: z64.string(),
|
|
27965
|
+
name: z64.string(),
|
|
27966
|
+
imageDigest: z64.string(),
|
|
27967
|
+
vcpus: z64.int(),
|
|
27968
|
+
memoryMib: z64.int(),
|
|
27969
|
+
maxMemoryMib: z64.int().nullable().optional(),
|
|
27970
|
+
httpPort: z64.int(),
|
|
27971
|
+
state: z64.string(),
|
|
27972
|
+
synced: z64.boolean(),
|
|
27973
|
+
dir: z64.string(),
|
|
27974
|
+
disk: z64.string(),
|
|
27975
|
+
diskBytes: z64.int().positive().default(LEGACY_DISK_BYTES),
|
|
27976
|
+
usedBytes: z64.int().nonnegative().optional(),
|
|
27977
|
+
egressPolicy: z64.string().default("open"),
|
|
27978
|
+
egressAllow: z64.array(z64.string()).readonly().default([]),
|
|
27979
|
+
grants: z64.array(z64.string()).readonly().default([]),
|
|
27980
|
+
filteredGrants: z64.array(FilteredGrantSchema).readonly().default([]),
|
|
27981
|
+
identityResetPending: z64.boolean().default(false),
|
|
27982
|
+
networks: z64.array(z64.string()).readonly().default([]),
|
|
27983
|
+
checkpoints: z64.array(ManifestCheckpointSchema).readonly()
|
|
27886
27984
|
}).readonly();
|
|
27887
|
-
var ManifestImageSchema =
|
|
27888
|
-
name:
|
|
27889
|
-
ref:
|
|
27890
|
-
digest:
|
|
27985
|
+
var ManifestImageSchema = z64.object({
|
|
27986
|
+
name: z64.string(),
|
|
27987
|
+
ref: z64.string(),
|
|
27988
|
+
digest: z64.string(),
|
|
27891
27989
|
source: ImageSourceSchema.default("oci"),
|
|
27892
|
-
sourceImp:
|
|
27893
|
-
sizeBytes:
|
|
27894
|
-
dir:
|
|
27990
|
+
sourceImp: z64.string().nullable().default(null),
|
|
27991
|
+
sizeBytes: z64.int(),
|
|
27992
|
+
dir: z64.string()
|
|
27895
27993
|
}).readonly();
|
|
27896
|
-
var ManifestExcludedSchema =
|
|
27897
|
-
var BackupManifestSchema =
|
|
27898
|
-
version:
|
|
27899
|
-
runId:
|
|
27900
|
-
createdAt:
|
|
27901
|
-
imps:
|
|
27902
|
-
excluded:
|
|
27903
|
-
images:
|
|
27904
|
-
database:
|
|
27994
|
+
var ManifestExcludedSchema = z64.object({ name: z64.string(), reason: z64.string() }).readonly();
|
|
27995
|
+
var BackupManifestSchema = z64.object({
|
|
27996
|
+
version: z64.literal(1),
|
|
27997
|
+
runId: z64.string(),
|
|
27998
|
+
createdAt: z64.coerce.date(),
|
|
27999
|
+
imps: z64.array(ManifestImpSchema).readonly(),
|
|
28000
|
+
excluded: z64.array(ManifestExcludedSchema).readonly().default([]),
|
|
28001
|
+
images: z64.array(ManifestImageSchema).readonly(),
|
|
28002
|
+
database: z64.object({ file: z64.string(), sizeBytes: z64.int().nonnegative() }).readonly().nullable().default(null)
|
|
27905
28003
|
}).readonly();
|
|
27906
28004
|
|
|
27907
28005
|
// packages/daemon/src/platform/db/create-restored-secrets.ts
|
|
@@ -28578,6 +28676,28 @@ var MIGRATION_041_ADD_MOVE_SEND_STEPS = {
|
|
|
28578
28676
|
}
|
|
28579
28677
|
};
|
|
28580
28678
|
|
|
28679
|
+
// packages/daemon/src/platform/db/migrations/migration-042-add-secret-env.ts
|
|
28680
|
+
var PRESET_ENV = {
|
|
28681
|
+
github: ["GH_TOKEN", "GITHUB_TOKEN"],
|
|
28682
|
+
anthropic: ["ANTHROPIC_API_KEY"],
|
|
28683
|
+
npm: ["NPM_TOKEN"]
|
|
28684
|
+
};
|
|
28685
|
+
var MIGRATION_042_ADD_SECRET_ENV = {
|
|
28686
|
+
async up(db) {
|
|
28687
|
+
await db.schema.alterTable("secrets").addColumn("env", "text", (column) => column.notNull().defaultTo("[]")).execute();
|
|
28688
|
+
for (const [kind, env] of Object.entries(PRESET_ENV)) {
|
|
28689
|
+
await db.updateTable("secrets").set({ env: JSON.stringify(env) }).where("kind", "=", kind).execute();
|
|
28690
|
+
}
|
|
28691
|
+
}
|
|
28692
|
+
};
|
|
28693
|
+
|
|
28694
|
+
// packages/daemon/src/platform/db/migrations/migration-043-merge-secret-kinds.ts
|
|
28695
|
+
var MIGRATION_043_MERGE_SECRET_KINDS = {
|
|
28696
|
+
async up(db) {
|
|
28697
|
+
await db.updateTable("secrets").set({ kind: "static" }).where("kind", "in", ["github", "anthropic", "npm", "custom"]).execute();
|
|
28698
|
+
}
|
|
28699
|
+
};
|
|
28700
|
+
|
|
28581
28701
|
// packages/daemon/src/platform/db/run-migrations.ts
|
|
28582
28702
|
var MIGRATIONS = {
|
|
28583
28703
|
"001_create_initial_schema": MIGRATION_001_CREATE_INITIAL_SCHEMA,
|
|
@@ -28620,7 +28740,9 @@ var MIGRATIONS = {
|
|
|
28620
28740
|
"038_add_image_removals": MIGRATION_038_ADD_IMAGE_REMOVALS,
|
|
28621
28741
|
"039_add_image_pins": MIGRATION_039_ADD_IMAGE_PINS,
|
|
28622
28742
|
"040_add_image_received_digests": MIGRATION_040_ADD_IMAGE_RECEIVED_DIGESTS,
|
|
28623
|
-
"041_add_move_send_steps": MIGRATION_041_ADD_MOVE_SEND_STEPS
|
|
28743
|
+
"041_add_move_send_steps": MIGRATION_041_ADD_MOVE_SEND_STEPS,
|
|
28744
|
+
"042_add_secret_env": MIGRATION_042_ADD_SECRET_ENV,
|
|
28745
|
+
"043_merge_secret_kinds": MIGRATION_043_MERGE_SECRET_KINDS
|
|
28624
28746
|
};
|
|
28625
28747
|
var PROVIDER = {
|
|
28626
28748
|
getMigrations: () => Promise.resolve(MIGRATIONS)
|
|
@@ -28925,11 +29047,11 @@ var CHECK_EVERY_MS = 7 * DAY_MS;
|
|
|
28925
29047
|
var CHECK_SUBSET = "5%";
|
|
28926
29048
|
var PRUNE_LOCK_TRIES = 6;
|
|
28927
29049
|
var RETRY_FIRST_MS = 5 * 60 * 1000;
|
|
28928
|
-
var BackupStateSchema =
|
|
28929
|
-
lastRunAt:
|
|
28930
|
-
lastPruneAt:
|
|
28931
|
-
lastCheckAt:
|
|
28932
|
-
lastCheckError:
|
|
29050
|
+
var BackupStateSchema = z65.object({
|
|
29051
|
+
lastRunAt: z65.coerce.date().nullable().default(null),
|
|
29052
|
+
lastPruneAt: z65.coerce.date().nullable().default(null),
|
|
29053
|
+
lastCheckAt: z65.coerce.date().nullable().default(null),
|
|
29054
|
+
lastCheckError: z65.string().nullable().default(null)
|
|
28933
29055
|
});
|
|
28934
29056
|
function buildBackupsOffError() {
|
|
28935
29057
|
return new ImpdError("PRECONDITION_FAILED", {
|
|
@@ -30027,6 +30149,7 @@ function createSecretRoutes(os, deps) {
|
|
|
30027
30149
|
name: secret.name,
|
|
30028
30150
|
kind: secret.kind,
|
|
30029
30151
|
rules: secret.rules,
|
|
30152
|
+
env: secret.env,
|
|
30030
30153
|
imps: secret.imps.filter((name) => isImpAllowed(patterns, name)),
|
|
30031
30154
|
createdAt: secret.createdAt,
|
|
30032
30155
|
oauth: secret.oauth
|
|
@@ -30873,11 +30996,11 @@ import {
|
|
|
30873
30996
|
import { INVALID_PARAMS, isJSONRPCRequest } from "@modelcontextprotocol/server";
|
|
30874
30997
|
|
|
30875
30998
|
// packages/mcp/src/tools/checkpoint-tools.ts
|
|
30876
|
-
import * as
|
|
30999
|
+
import * as z68 from "zod";
|
|
30877
31000
|
|
|
30878
31001
|
// packages/mcp/src/tools/define-tool.ts
|
|
30879
31002
|
import { ExecError, ORPCError as ORPCError4 } from "@impz/client";
|
|
30880
|
-
import * as
|
|
31003
|
+
import * as z66 from "zod";
|
|
30881
31004
|
|
|
30882
31005
|
// packages/mcp/src/imp-guard.ts
|
|
30883
31006
|
class GuardError extends Error {
|
|
@@ -30978,14 +31101,14 @@ function readPrefix(patterns) {
|
|
|
30978
31101
|
}
|
|
30979
31102
|
|
|
30980
31103
|
// packages/mcp/src/tools/define-tool.ts
|
|
30981
|
-
var JsonObjectSchema =
|
|
31104
|
+
var JsonObjectSchema = z66.record(z66.string(), z66.unknown());
|
|
30982
31105
|
function defineTool(spec) {
|
|
30983
31106
|
const definition = {
|
|
30984
31107
|
name: spec.name,
|
|
30985
31108
|
title: spec.annotations.title,
|
|
30986
31109
|
description: spec.description,
|
|
30987
31110
|
inputSchema: {
|
|
30988
|
-
...JsonObjectSchema.parse(
|
|
31111
|
+
...JsonObjectSchema.parse(z66.toJSONSchema(spec.input, { io: "input" })),
|
|
30989
31112
|
type: "object"
|
|
30990
31113
|
},
|
|
30991
31114
|
annotations: spec.annotations
|
|
@@ -31044,15 +31167,15 @@ function formatCoded(code, message) {
|
|
|
31044
31167
|
}
|
|
31045
31168
|
|
|
31046
31169
|
// packages/mcp/src/tools/imp-tools.ts
|
|
31047
|
-
import * as
|
|
31170
|
+
import * as z67 from "zod";
|
|
31048
31171
|
var ImpNameInput = NameSchema.describe("The imp name, from imp_list");
|
|
31049
|
-
var NameOnly =
|
|
31172
|
+
var NameOnly = z67.strictObject({ name: ImpNameInput });
|
|
31050
31173
|
var IMP_TOOLS = [
|
|
31051
31174
|
defineTool({
|
|
31052
31175
|
name: "imp_list",
|
|
31053
31176
|
scope: "read",
|
|
31054
31177
|
description: "List the imps this server may touch: name, state (running, sleeping, stopped, error), image, memory and URL. A sleeping or stopped imp wakes or boots by itself on the next exec, file or HTTP request.",
|
|
31055
|
-
input:
|
|
31178
|
+
input: z67.strictObject({}),
|
|
31056
31179
|
annotations: { title: "List imps", readOnlyHint: true, openWorldHint: false },
|
|
31057
31180
|
run: async (_input, context) => {
|
|
31058
31181
|
const imps = await context.client.imps.list();
|
|
@@ -31064,7 +31187,7 @@ var IMP_TOOLS = [
|
|
|
31064
31187
|
scope: "manage",
|
|
31065
31188
|
cancellable: false,
|
|
31066
31189
|
description: "Create an imp, a persistent Linux microVM, and boot it. Its disk survives sleeps and restarts until imp_destroy. Without a name, the server picks one inside its guard. Returns the imp. A cancel does not stop the create, and its result still comes back.",
|
|
31067
|
-
input:
|
|
31190
|
+
input: z67.strictObject({
|
|
31068
31191
|
name: ImpCreateInputSchema.shape.name.describe("The new imp's name: a lowercase letter, then up to 30 lowercase letters, digits or hyphens. Omit to have one picked."),
|
|
31069
31192
|
image: ImpCreateInputSchema.shape.image.describe("The image to boot, from imp_image_list; impd's default when omitted"),
|
|
31070
31193
|
vcpus: ImpCreateInputSchema.shape.vcpus.describe("Virtual CPUs; impd's default when omitted"),
|
|
@@ -31141,10 +31264,10 @@ var IMP_TOOLS = [
|
|
|
31141
31264
|
scope: "manage",
|
|
31142
31265
|
cancellable: false,
|
|
31143
31266
|
description: "Create a new imp from the disk of another, now or as it was at one of its checkpoints. The fork boots fresh: it has the disk, not the running processes. Use it to try two approaches side by side. A token limited to some imps gives the fork only the source's secret grants it could make itself; grantsNotCopied names each grant the fork did not get, and grantsError says why it got none. A cancel does not stop the fork, and its result still comes back.",
|
|
31144
|
-
input:
|
|
31267
|
+
input: z67.strictObject({
|
|
31145
31268
|
source: NameSchema.describe("The imp to fork, from imp_list"),
|
|
31146
31269
|
name: NameSchema.optional().describe("The fork's name; omit to have one picked"),
|
|
31147
|
-
checkpoint:
|
|
31270
|
+
checkpoint: z67.string().min(1).optional().describe("A checkpoint id or label of the source, from imp_checkpoint_list; the source's disk now when omitted")
|
|
31148
31271
|
}),
|
|
31149
31272
|
annotations: {
|
|
31150
31273
|
title: "Fork an imp",
|
|
@@ -31177,7 +31300,7 @@ var IMP_TOOLS = [
|
|
|
31177
31300
|
name: "imp_image_list",
|
|
31178
31301
|
scope: "read",
|
|
31179
31302
|
description: "List the images an imp can boot from, for imp_create.",
|
|
31180
|
-
input:
|
|
31303
|
+
input: z67.strictObject({}),
|
|
31181
31304
|
annotations: { title: "List images", readOnlyHint: true, openWorldHint: false },
|
|
31182
31305
|
run: async (_input, context) => {
|
|
31183
31306
|
const images = await context.client.images.list();
|
|
@@ -31187,13 +31310,13 @@ var IMP_TOOLS = [
|
|
|
31187
31310
|
];
|
|
31188
31311
|
|
|
31189
31312
|
// packages/mcp/src/tools/checkpoint-tools.ts
|
|
31190
|
-
var CheckpointRefInput =
|
|
31313
|
+
var CheckpointRefInput = z68.string().min(1).describe("A checkpoint id or label, from imp_checkpoint_list");
|
|
31191
31314
|
var CHECKPOINT_TOOLS = [
|
|
31192
31315
|
defineTool({
|
|
31193
31316
|
name: "imp_checkpoint",
|
|
31194
31317
|
scope: "manage",
|
|
31195
31318
|
description: "Save the imp's disk as a checkpoint, in about 100 ms, without stopping it. Take one before a risky change; imp_restore goes back to it and imp_fork starts a new imp from it.",
|
|
31196
|
-
input:
|
|
31319
|
+
input: z68.strictObject({
|
|
31197
31320
|
name: ImpNameInput,
|
|
31198
31321
|
label: CheckpointCreateInputSchema.shape.label.describe("A label to find the checkpoint by, such as before-migration")
|
|
31199
31322
|
}),
|
|
@@ -31216,7 +31339,7 @@ var CHECKPOINT_TOOLS = [
|
|
|
31216
31339
|
name: "imp_checkpoint_list",
|
|
31217
31340
|
scope: "read",
|
|
31218
31341
|
description: "List the imp's checkpoints: id, label, time and size.",
|
|
31219
|
-
input:
|
|
31342
|
+
input: z68.strictObject({ name: ImpNameInput }),
|
|
31220
31343
|
annotations: { title: "List checkpoints", readOnlyHint: true, openWorldHint: false },
|
|
31221
31344
|
run: async (input, context) => {
|
|
31222
31345
|
context.guard.require(input.name);
|
|
@@ -31229,7 +31352,7 @@ var CHECKPOINT_TOOLS = [
|
|
|
31229
31352
|
scope: "manage",
|
|
31230
31353
|
cancellable: false,
|
|
31231
31354
|
description: "Put the imp's disk back to a checkpoint. Everything written since the checkpoint is lost, and so is the memory: an awake imp boots fresh, a sleeping or stopped one boots on its next use. A cancel does not stop the restore, and its result still comes back.",
|
|
31232
|
-
input:
|
|
31355
|
+
input: z68.strictObject({ name: ImpNameInput, checkpoint: CheckpointRefInput }),
|
|
31233
31356
|
annotations: {
|
|
31234
31357
|
title: "Restore a checkpoint",
|
|
31235
31358
|
readOnlyHint: false,
|
|
@@ -31246,7 +31369,7 @@ var CHECKPOINT_TOOLS = [
|
|
|
31246
31369
|
name: "imp_checkpoint_delete",
|
|
31247
31370
|
scope: "manage",
|
|
31248
31371
|
description: "Delete one of the imp's checkpoints for good. The imp itself is not touched.",
|
|
31249
|
-
input:
|
|
31372
|
+
input: z68.strictObject({ name: ImpNameInput, checkpoint: CheckpointRefInput }),
|
|
31250
31373
|
annotations: {
|
|
31251
31374
|
title: "Delete a checkpoint",
|
|
31252
31375
|
readOnlyHint: false,
|
|
@@ -31262,7 +31385,7 @@ var CHECKPOINT_TOOLS = [
|
|
|
31262
31385
|
];
|
|
31263
31386
|
|
|
31264
31387
|
// packages/mcp/src/tools/exec-tool.ts
|
|
31265
|
-
import * as
|
|
31388
|
+
import * as z69 from "zod";
|
|
31266
31389
|
|
|
31267
31390
|
// packages/mcp/src/exec/output-cap.ts
|
|
31268
31391
|
function createOutputCollector(maxBytes, headBytes) {
|
|
@@ -31500,16 +31623,16 @@ var MAX_TIMEOUT_S = 1800;
|
|
|
31500
31623
|
var DEFAULT_OUTPUT_BYTES = 64 * 1024;
|
|
31501
31624
|
var MAX_OUTPUT_BYTES = 256 * 1024;
|
|
31502
31625
|
var HEAD_BYTES = 8 * 1024;
|
|
31503
|
-
var ExecInput =
|
|
31626
|
+
var ExecInput = z69.strictObject({
|
|
31504
31627
|
name: ImpNameInput,
|
|
31505
|
-
command:
|
|
31506
|
-
argv:
|
|
31507
|
-
stdin:
|
|
31508
|
-
cwd:
|
|
31509
|
-
env:
|
|
31510
|
-
require:
|
|
31511
|
-
timeoutSeconds:
|
|
31512
|
-
maxOutputBytes:
|
|
31628
|
+
command: z69.string().min(1).optional().describe("A shell command line, run as /bin/sh -c COMMAND. Give this or argv."),
|
|
31629
|
+
argv: z69.array(z69.string()).min(1).optional().describe("The program and its arguments, run as they are with no shell. Give this or command."),
|
|
31630
|
+
stdin: z69.string().optional().describe("Text for the command's stdin, which then closes; closed at once when omitted"),
|
|
31631
|
+
cwd: z69.string().optional().describe("The working directory; the image's workdir or HOME when omitted"),
|
|
31632
|
+
env: z69.record(z69.string(), z69.string()).optional().describe("Environment variables, added to the image's"),
|
|
31633
|
+
require: z69.array(z69.enum(EXEC_REQUIREMENTS)).optional().describe("What impd must ensure before the command starts, or the call fails with PRECONDITION_FAILED and nothing runs. broker: impd set the credential broker's proxy variables and CA bundle for this boot."),
|
|
31634
|
+
timeoutSeconds: z69.int().min(1).max(MAX_TIMEOUT_S).default(DEFAULT_TIMEOUT_S).describe(`How long the command may run, waking the imp included (default ${String(DEFAULT_TIMEOUT_S)})`),
|
|
31635
|
+
maxOutputBytes: z69.int().min(1024).max(MAX_OUTPUT_BYTES).default(DEFAULT_OUTPUT_BYTES).describe(`The most output kept per stream (default ${String(DEFAULT_OUTPUT_BYTES)}): the first ${String(HEAD_BYTES)} bytes and the last bytes, with a marker for the bytes dropped between`)
|
|
31513
31636
|
}).refine((input) => input.command === undefined !== (input.argv === undefined), {
|
|
31514
31637
|
message: "give either command or argv"
|
|
31515
31638
|
});
|
|
@@ -31559,7 +31682,7 @@ var EXEC_TOOL = defineTool({
|
|
|
31559
31682
|
});
|
|
31560
31683
|
|
|
31561
31684
|
// packages/mcp/src/tools/file-tools.ts
|
|
31562
|
-
import * as
|
|
31685
|
+
import * as z70 from "zod";
|
|
31563
31686
|
|
|
31564
31687
|
// packages/mcp/src/tools/write-script.ts
|
|
31565
31688
|
var WRITE_SCRIPT = [
|
|
@@ -31588,15 +31711,15 @@ var MAX_READ_BYTES = 1024 * 1024;
|
|
|
31588
31711
|
var MAX_WRITE_BYTES = 4 * 1024 * 1024;
|
|
31589
31712
|
var FILE_TIMEOUT_MS = 60000;
|
|
31590
31713
|
var STDERR_BYTES = 4096;
|
|
31591
|
-
var GuestPathInput =
|
|
31592
|
-
var MaxBytesInput =
|
|
31593
|
-
var EncodingInput =
|
|
31714
|
+
var GuestPathInput = z70.string().startsWith("/", "must be an absolute path").describe("An absolute path in the imp");
|
|
31715
|
+
var MaxBytesInput = z70.int().min(1).max(MAX_READ_BYTES).default(DEFAULT_READ_BYTES).describe(`The most bytes to read (default ${String(DEFAULT_READ_BYTES)}); a larger file fails, so read a part of it with imp_exec (head, tail, sed -n)`);
|
|
31716
|
+
var EncodingInput = z70.enum(["utf8", "base64"]).default("utf8").describe("utf8 for text, base64 for any bytes (default utf8)");
|
|
31594
31717
|
var FILE_TOOLS = [
|
|
31595
31718
|
defineTool({
|
|
31596
31719
|
name: "imp_read_file",
|
|
31597
31720
|
scope: "exec",
|
|
31598
31721
|
description: `Read a file in an imp, up to maxBytes. A sleeping imp wakes and a stopped one boots first. Text comes back as utf8; a file that is not valid UTF-8 fails, so read it again with encoding base64.`,
|
|
31599
|
-
input:
|
|
31722
|
+
input: z70.strictObject({
|
|
31600
31723
|
name: ImpNameInput,
|
|
31601
31724
|
path: GuestPathInput,
|
|
31602
31725
|
encoding: EncodingInput,
|
|
@@ -31636,10 +31759,10 @@ var FILE_TOOLS = [
|
|
|
31636
31759
|
name: "imp_write_file",
|
|
31637
31760
|
scope: "exec",
|
|
31638
31761
|
description: `Write a file in an imp, replacing it whole, and create its parent directories. The write goes to a temp file that is renamed over the path, so no reader sees half a file; an existing file keeps its mode, a symlink is written through, and a directory is refused. At most ${String(MAX_WRITE_BYTES)} bytes.`,
|
|
31639
|
-
input:
|
|
31762
|
+
input: z70.strictObject({
|
|
31640
31763
|
name: ImpNameInput,
|
|
31641
31764
|
path: GuestPathInput,
|
|
31642
|
-
content:
|
|
31765
|
+
content: z70.string().describe("The whole file, as text or as base64 (see encoding)"),
|
|
31643
31766
|
encoding: EncodingInput
|
|
31644
31767
|
}),
|
|
31645
31768
|
annotations: {
|
|
@@ -32275,14 +32398,14 @@ function createMcpEndpoint(deps) {
|
|
|
32275
32398
|
}
|
|
32276
32399
|
|
|
32277
32400
|
// packages/daemon/src/surface/with-retry-after.ts
|
|
32278
|
-
import * as
|
|
32401
|
+
import * as z71 from "zod";
|
|
32279
32402
|
async function withRetryAfter(response) {
|
|
32280
32403
|
if (response.status !== 409) {
|
|
32281
32404
|
return response;
|
|
32282
32405
|
}
|
|
32283
32406
|
try {
|
|
32284
32407
|
const body = await response.clone().json();
|
|
32285
|
-
const MovingBodySchema =
|
|
32408
|
+
const MovingBodySchema = z71.object({ json: z71.object({ code: z71.literal("MOVING") }) });
|
|
32286
32409
|
if (!MovingBodySchema.safeParse(body).success) {
|
|
32287
32410
|
return response;
|
|
32288
32411
|
}
|
|
@@ -32738,7 +32861,7 @@ import { join as join16 } from "path";
|
|
|
32738
32861
|
// packages/daemon/src/create-upstream-resolver.ts
|
|
32739
32862
|
import { readFileSync as readFileSync13, statSync as statSync6 } from "fs";
|
|
32740
32863
|
import { rootCertificates } from "tls";
|
|
32741
|
-
import * as
|
|
32864
|
+
import * as z72 from "zod";
|
|
32742
32865
|
|
|
32743
32866
|
// packages/daemon/src/network/broker/tls/resolve-public-upstream.ts
|
|
32744
32867
|
function resolvePublicUpstream(host) {
|
|
@@ -32746,9 +32869,9 @@ function resolvePublicUpstream(host) {
|
|
|
32746
32869
|
}
|
|
32747
32870
|
|
|
32748
32871
|
// packages/daemon/src/create-upstream-resolver.ts
|
|
32749
|
-
var FileSchema =
|
|
32750
|
-
ca:
|
|
32751
|
-
upstreams:
|
|
32872
|
+
var FileSchema = z72.object({
|
|
32873
|
+
ca: z72.string().includes("-----BEGIN CERTIFICATE-----"),
|
|
32874
|
+
upstreams: z72.record(z72.string(), z72.url({ protocol: /^https$/u }))
|
|
32752
32875
|
});
|
|
32753
32876
|
function createUpstreamResolver(path) {
|
|
32754
32877
|
const cache = {
|
|
@@ -33012,7 +33135,7 @@ function buildHostReach(ranges, uplinks, hasIPv6) {
|
|
|
33012
33135
|
|
|
33013
33136
|
// packages/daemon/src/network/broker/broker-service.ts
|
|
33014
33137
|
import { join as join15 } from "path";
|
|
33015
|
-
import { match as
|
|
33138
|
+
import { match as match3 } from "ts-pattern";
|
|
33016
33139
|
|
|
33017
33140
|
// packages/daemon/src/platform/db/broker-audit.ts
|
|
33018
33141
|
var AUDIT_ROWS_PER_IMP = 1000;
|
|
@@ -33577,51 +33700,8 @@ async function readBrokerPeer(db, slot) {
|
|
|
33577
33700
|
|
|
33578
33701
|
// packages/daemon/src/network/broker/secrets/connector-kinds.ts
|
|
33579
33702
|
var PLACEHOLDER = "imp-broker-placeholder";
|
|
33580
|
-
|
|
33581
|
-
|
|
33582
|
-
rules: [
|
|
33583
|
-
{ host: "github.com", header: "authorization", scheme: "basic", user: "x-access-token" },
|
|
33584
|
-
{ host: "api.github.com", header: "authorization", scheme: "bearer" },
|
|
33585
|
-
{ host: "uploads.github.com", header: "authorization", scheme: "bearer" }
|
|
33586
|
-
],
|
|
33587
|
-
env: ["GH_TOKEN", "GITHUB_TOKEN"]
|
|
33588
|
-
},
|
|
33589
|
-
anthropic: {
|
|
33590
|
-
rules: [{ host: "api.anthropic.com", header: "x-api-key", scheme: "raw" }],
|
|
33591
|
-
env: ["ANTHROPIC_API_KEY"]
|
|
33592
|
-
},
|
|
33593
|
-
npm: {
|
|
33594
|
-
rules: [{ host: "registry.npmjs.org", header: "authorization", scheme: "bearer" }],
|
|
33595
|
-
env: ["NPM_TOKEN"]
|
|
33596
|
-
}
|
|
33597
|
-
};
|
|
33598
|
-
|
|
33599
|
-
class SecretRulesError extends Error {
|
|
33600
|
-
name = "SecretRulesError";
|
|
33601
|
-
}
|
|
33602
|
-
function resolveRules(kind, given) {
|
|
33603
|
-
if (kind !== "custom" && kind !== "oauth") {
|
|
33604
|
-
if (given !== undefined) {
|
|
33605
|
-
throw new SecretRulesError(`kind ${kind} has its own hosts; rules are for kinds custom and oauth`);
|
|
33606
|
-
}
|
|
33607
|
-
return PRESETS[kind].rules;
|
|
33608
|
-
}
|
|
33609
|
-
if (given === undefined || given.length === 0) {
|
|
33610
|
-
throw new SecretRulesError(`kind ${kind} needs at least one host`);
|
|
33611
|
-
}
|
|
33612
|
-
if (kind !== "custom" && given.some((rule) => rule.upstream !== undefined)) {
|
|
33613
|
-
throw new SecretRulesError(`kind ${kind} cannot have an upstream; it is for kind custom`);
|
|
33614
|
-
}
|
|
33615
|
-
const hosts = given.map((rule) => rule.host);
|
|
33616
|
-
const repeated = hosts.find((host, index) => hosts.indexOf(host) !== index);
|
|
33617
|
-
if (repeated !== undefined) {
|
|
33618
|
-
throw new SecretRulesError(`${repeated} has more than one rule`);
|
|
33619
|
-
}
|
|
33620
|
-
return given;
|
|
33621
|
-
}
|
|
33622
|
-
function listPlaceholderEnv(kinds) {
|
|
33623
|
-
const names = kinds.flatMap((kind) => kind === "custom" || kind === "oauth" ? [] : PRESETS[kind].env);
|
|
33624
|
-
return [...new Set(names)];
|
|
33703
|
+
function listPlaceholderEnv(envLists) {
|
|
33704
|
+
return [...new Set(envLists.flat())];
|
|
33625
33705
|
}
|
|
33626
33706
|
function renderCredential(rule, value) {
|
|
33627
33707
|
if (rule.scheme === "bearer") {
|
|
@@ -33634,17 +33714,17 @@ function renderCredential(rule, value) {
|
|
|
33634
33714
|
}
|
|
33635
33715
|
|
|
33636
33716
|
// packages/daemon/src/network/broker/secrets/oauth-state.ts
|
|
33637
|
-
import * as
|
|
33638
|
-
var TokenSchema2 =
|
|
33639
|
-
var StateSchema =
|
|
33640
|
-
v:
|
|
33717
|
+
import * as z73 from "zod";
|
|
33718
|
+
var TokenSchema2 = z73.string().min(1).max(16384);
|
|
33719
|
+
var StateSchema = z73.object({
|
|
33720
|
+
v: z73.literal(1),
|
|
33641
33721
|
refreshToken: TokenSchema2,
|
|
33642
33722
|
accessToken: TokenSchema2.nullable(),
|
|
33643
33723
|
idToken: TokenSchema2.nullable(),
|
|
33644
|
-
expiresAt:
|
|
33645
|
-
refreshedAt:
|
|
33646
|
-
status:
|
|
33647
|
-
error:
|
|
33724
|
+
expiresAt: z73.number().nullable(),
|
|
33725
|
+
refreshedAt: z73.number().nullable(),
|
|
33726
|
+
status: z73.enum(["pending", "ready", "needs_login"]),
|
|
33727
|
+
error: z73.string().max(200).nullable()
|
|
33648
33728
|
});
|
|
33649
33729
|
function buildPendingState(refreshToken) {
|
|
33650
33730
|
return {
|
|
@@ -33706,6 +33786,23 @@ function readJwtExpiry(token) {
|
|
|
33706
33786
|
return typeof exp === "number" && Number.isFinite(exp) && exp > 0 ? exp * 1000 : null;
|
|
33707
33787
|
}
|
|
33708
33788
|
|
|
33789
|
+
// packages/daemon/src/network/broker/secrets/secret-kinds.ts
|
|
33790
|
+
var SECRET_KINDS = {
|
|
33791
|
+
static: {
|
|
33792
|
+
formatValueFile: (value) => value,
|
|
33793
|
+
findCredential: (content) => ({ value: content, oauth: null }),
|
|
33794
|
+
isRefreshed: false
|
|
33795
|
+
},
|
|
33796
|
+
oauth: {
|
|
33797
|
+
formatValueFile: (refreshToken) => formatOAuthState(buildPendingState(refreshToken)),
|
|
33798
|
+
findCredential: (content) => {
|
|
33799
|
+
const state = parseOAuthState(content);
|
|
33800
|
+
return state === null || state.accessToken === null ? null : { value: state.accessToken, oauth: { refreshedAt: state.refreshedAt } };
|
|
33801
|
+
},
|
|
33802
|
+
isRefreshed: true
|
|
33803
|
+
}
|
|
33804
|
+
};
|
|
33805
|
+
|
|
33709
33806
|
// packages/daemon/src/platform/http/send-with-ca.ts
|
|
33710
33807
|
function sendWithCA(url, init) {
|
|
33711
33808
|
const tls = init.tls === undefined ? {} : { tls: { ca: [...init.tls.ca] } };
|
|
@@ -34451,18 +34548,17 @@ function createBrokerProxy(deps) {
|
|
|
34451
34548
|
const readCredential = async (impId, host) => {
|
|
34452
34549
|
const granted = await readRule(impId, host);
|
|
34453
34550
|
const stored = granted === undefined ? null : files.read(granted.valueFile);
|
|
34454
|
-
const
|
|
34455
|
-
|
|
34456
|
-
if (granted === undefined || value === null) {
|
|
34551
|
+
const credential = granted === undefined || stored === null ? null : SECRET_KINDS[granted.kind].findCredential(stored);
|
|
34552
|
+
if (granted === undefined || credential === null) {
|
|
34457
34553
|
return null;
|
|
34458
34554
|
}
|
|
34459
34555
|
return {
|
|
34460
34556
|
secretName: granted.secretName,
|
|
34461
34557
|
header: granted.rule.header,
|
|
34462
|
-
value: renderCredential(granted.rule, value),
|
|
34558
|
+
value: renderCredential(granted.rule, credential.value),
|
|
34463
34559
|
upstream: granted.rule.upstream ?? null,
|
|
34464
34560
|
filter: granted.filter,
|
|
34465
|
-
oauth: oauth
|
|
34561
|
+
oauth: credential.oauth
|
|
34466
34562
|
};
|
|
34467
34563
|
};
|
|
34468
34564
|
const writeAudit = async (entry) => {
|
|
@@ -34531,6 +34627,30 @@ function createBrokerProxy(deps) {
|
|
|
34531
34627
|
};
|
|
34532
34628
|
}
|
|
34533
34629
|
|
|
34630
|
+
// packages/daemon/src/network/broker/secrets/build-stored-binding.ts
|
|
34631
|
+
import { P, match as match2 } from "ts-pattern";
|
|
34632
|
+
function buildStoredBinding(input) {
|
|
34633
|
+
return match2(input).returnType().with({ kind: "static" }, (given) => ({
|
|
34634
|
+
kind: "static",
|
|
34635
|
+
rules: given.rules,
|
|
34636
|
+
env: given.env ?? [],
|
|
34637
|
+
oauth: null
|
|
34638
|
+
})).with({ kind: "oauth" }, (given) => ({
|
|
34639
|
+
kind: "oauth",
|
|
34640
|
+
rules: given.rules,
|
|
34641
|
+
env: given.env ?? [],
|
|
34642
|
+
oauth: given.oauth
|
|
34643
|
+
})).with({ preset: P.string }, (given) => buildPresetBinding(given.preset)).with({ kind: "custom" }, (given) => ({
|
|
34644
|
+
kind: "static",
|
|
34645
|
+
rules: given.rules,
|
|
34646
|
+
env: [],
|
|
34647
|
+
oauth: null
|
|
34648
|
+
})).with({ kind: P.union("github", "anthropic", "npm") }, (given) => buildPresetBinding(given.kind)).exhaustive();
|
|
34649
|
+
}
|
|
34650
|
+
function buildPresetBinding(preset) {
|
|
34651
|
+
return { ...SECRET_PRESETS[preset], oauth: null };
|
|
34652
|
+
}
|
|
34653
|
+
|
|
34534
34654
|
// packages/daemon/src/network/broker/secrets/secret-files.ts
|
|
34535
34655
|
import { randomBytes as randomBytes7 } from "crypto";
|
|
34536
34656
|
import {
|
|
@@ -34653,6 +34773,7 @@ function createSecretStore(deps) {
|
|
|
34653
34773
|
name: secret.name,
|
|
34654
34774
|
kind: secret.kind,
|
|
34655
34775
|
rules: secret.rules,
|
|
34776
|
+
env: secret.env,
|
|
34656
34777
|
imps,
|
|
34657
34778
|
createdAt: secret.createdAt
|
|
34658
34779
|
};
|
|
@@ -34704,38 +34825,19 @@ function createSecretStore(deps) {
|
|
|
34704
34825
|
};
|
|
34705
34826
|
return {
|
|
34706
34827
|
addSecret: async (input) => {
|
|
34707
|
-
|
|
34708
|
-
|
|
34709
|
-
rules = resolveRules(input.kind, input.rules);
|
|
34710
|
-
} catch (error) {
|
|
34711
|
-
if (error instanceof SecretRulesError) {
|
|
34712
|
-
throw new ImpdError("BAD_REQUEST", { message: error.message });
|
|
34713
|
-
}
|
|
34714
|
-
throw error;
|
|
34715
|
-
}
|
|
34716
|
-
if (input.kind === "oauth" && input.oauth === undefined) {
|
|
34717
|
-
throw new ImpdError("BAD_REQUEST", {
|
|
34718
|
-
message: "kind oauth needs a token URL and a client id"
|
|
34719
|
-
});
|
|
34720
|
-
}
|
|
34721
|
-
if (input.kind !== "oauth" && input.oauth !== undefined) {
|
|
34722
|
-
throw new ImpdError("BAD_REQUEST", {
|
|
34723
|
-
message: `kind ${input.kind} has no token URL or client id; they are for kind oauth`
|
|
34724
|
-
});
|
|
34725
|
-
}
|
|
34726
|
-
const oauth = input.kind === "oauth" ? input.oauth ?? null : null;
|
|
34828
|
+
const binding = buildStoredBinding(input);
|
|
34829
|
+
const kind = SECRET_KINDS[binding.kind];
|
|
34727
34830
|
const saved = await refresher.withLock(input.name, async () => {
|
|
34728
34831
|
const valueFile = buildValueFile(input.name);
|
|
34729
|
-
|
|
34730
|
-
|
|
34731
|
-
const written = await writeSecretRow({ name: input.name, kind: input.kind, rules, oauth, valueFile }, input);
|
|
34832
|
+
files.write(valueFile, kind.formatValueFile(input.value));
|
|
34833
|
+
const written = await writeSecretRow({ name: input.name, ...binding, valueFile }, input);
|
|
34732
34834
|
if (written.oldValueFile !== null) {
|
|
34733
34835
|
await removeDisplacedFile(written.oldValueFile);
|
|
34734
34836
|
await deps.applyGrants();
|
|
34735
34837
|
}
|
|
34736
34838
|
return written;
|
|
34737
34839
|
});
|
|
34738
|
-
if (
|
|
34840
|
+
if (kind.isRefreshed) {
|
|
34739
34841
|
await refresher.refresh(input.name, true);
|
|
34740
34842
|
}
|
|
34741
34843
|
const latest = await readSecret(db, input.name);
|
|
@@ -34751,7 +34853,7 @@ function createSecretStore(deps) {
|
|
|
34751
34853
|
if (secret === undefined) {
|
|
34752
34854
|
throw buildNotFoundError("secret", name);
|
|
34753
34855
|
}
|
|
34754
|
-
if (secret.kind
|
|
34856
|
+
if (!SECRET_KINDS[secret.kind].isRefreshed) {
|
|
34755
34857
|
throw new ImpdError("BAD_REQUEST", { message: `secret ${name} is not an oauth secret` });
|
|
34756
34858
|
}
|
|
34757
34859
|
await refresher.refresh(name, true);
|
|
@@ -34890,7 +34992,7 @@ function isDue(state, at) {
|
|
|
34890
34992
|
}
|
|
34891
34993
|
|
|
34892
34994
|
// packages/daemon/src/network/broker/secrets/parse-token-answer.ts
|
|
34893
|
-
import * as
|
|
34995
|
+
import * as z74 from "zod";
|
|
34894
34996
|
function parseTokenAnswer(status, text) {
|
|
34895
34997
|
let body = null;
|
|
34896
34998
|
try {
|
|
@@ -34916,8 +35018,8 @@ function parseTokenAnswer(status, text) {
|
|
|
34916
35018
|
}
|
|
34917
35019
|
return parseTokens(body);
|
|
34918
35020
|
}
|
|
34919
|
-
var ErrorObjectSchema =
|
|
34920
|
-
var ErrorAnswerSchema =
|
|
35021
|
+
var ErrorObjectSchema = z74.object({ code: z74.string().nullish(), error: z74.string().nullish() });
|
|
35022
|
+
var ErrorAnswerSchema = z74.object({ error: z74.union([z74.string(), ErrorObjectSchema]) });
|
|
34921
35023
|
function findErrorCode(body) {
|
|
34922
35024
|
const parsed = ErrorAnswerSchema.safeParse(body);
|
|
34923
35025
|
if (!parsed.success) {
|
|
@@ -34927,11 +35029,11 @@ function findErrorCode(body) {
|
|
|
34927
35029
|
const code = typeof error === "string" ? error : error.code ?? error.error;
|
|
34928
35030
|
return code !== null && code !== undefined && /^[A-Za-z0-9_.-]{1,64}$/u.test(code) ? code : null;
|
|
34929
35031
|
}
|
|
34930
|
-
var TokenAnswerSchema =
|
|
34931
|
-
access_token:
|
|
34932
|
-
refresh_token:
|
|
34933
|
-
id_token:
|
|
34934
|
-
expires_in:
|
|
35032
|
+
var TokenAnswerSchema = z74.object({
|
|
35033
|
+
access_token: z74.string().nullish(),
|
|
35034
|
+
refresh_token: z74.string().nullish(),
|
|
35035
|
+
id_token: z74.string().nullish(),
|
|
35036
|
+
expires_in: z74.number().nullish()
|
|
34935
35037
|
});
|
|
34936
35038
|
function parseTokens(body) {
|
|
34937
35039
|
const parsed = TokenAnswerSchema.safeParse(body);
|
|
@@ -35457,7 +35559,7 @@ ${key.host}`));
|
|
|
35457
35559
|
if (outcome.kind === "granted") {
|
|
35458
35560
|
return;
|
|
35459
35561
|
}
|
|
35460
|
-
throw
|
|
35562
|
+
throw match3(outcome).with({ kind: "no-secret" }, () => buildNotFoundError("secret", secretName)).with({ kind: "no-token" }, () => buildTokenGoneError()).with({ kind: "not-grantable" }, () => buildStaleError(secretName)).with({ kind: "clash" }, (refused) => buildClashError(impName, secretName, refused.clash)).exhaustive();
|
|
35461
35563
|
},
|
|
35462
35564
|
removeGrant: async (impName, secretName, authority = null) => {
|
|
35463
35565
|
const imp = await requireImp(impName);
|
|
@@ -35533,7 +35635,7 @@ ${key.host}`));
|
|
|
35533
35635
|
}).hostIp;
|
|
35534
35636
|
const env = buildBrokerEnv({
|
|
35535
35637
|
proxyUrl: `http://${gateway}:${String(proxy.getPort())}`,
|
|
35536
|
-
placeholders: listPlaceholderEnv(granted.map((entry) => entry.
|
|
35638
|
+
placeholders: listPlaceholderEnv(granted.map((entry) => entry.env)),
|
|
35537
35639
|
placeholder: PLACEHOLDER
|
|
35538
35640
|
});
|
|
35539
35641
|
return { kind: "ready", env };
|
|
@@ -37552,7 +37654,7 @@ function createImpWatchdog(context, lock, ops) {
|
|
|
37552
37654
|
}
|
|
37553
37655
|
|
|
37554
37656
|
// packages/daemon/src/platform/events/imp-event-publisher.ts
|
|
37555
|
-
import { P, match as
|
|
37657
|
+
import { P as P2, match as match4 } from "ts-pattern";
|
|
37556
37658
|
function startImpEventPublisher(deps) {
|
|
37557
37659
|
const pending = [];
|
|
37558
37660
|
const state = { draining: false };
|
|
@@ -37579,7 +37681,7 @@ function startImpEventPublisher(deps) {
|
|
|
37579
37681
|
}
|
|
37580
37682
|
function readEvent(deps, write) {
|
|
37581
37683
|
const envelope = { v: EVENT_VERSION, at: new Date(deps.now()) };
|
|
37582
|
-
return
|
|
37684
|
+
return match4(write).returnType().with({ kind: "added" }, async (added) => ({
|
|
37583
37685
|
...envelope,
|
|
37584
37686
|
ev: "ImpAdded",
|
|
37585
37687
|
reason: "created",
|
|
@@ -37594,7 +37696,7 @@ function readEvent(deps, write) {
|
|
|
37594
37696
|
...envelope,
|
|
37595
37697
|
ev: "ImpRemoved",
|
|
37596
37698
|
imp: await deps.toApi(removed.imp)
|
|
37597
|
-
})).with({ kind:
|
|
37699
|
+
})).with({ kind: P2.union("checkpointAdded", "checkpointRemoved") }, async (checkpointWrite) => {
|
|
37598
37700
|
const imp = await readImpById(deps.db, checkpointWrite.checkpoint.impId);
|
|
37599
37701
|
if (imp === undefined) {
|
|
37600
37702
|
return null;
|
|
@@ -38783,7 +38885,7 @@ import {
|
|
|
38783
38885
|
} from "fs";
|
|
38784
38886
|
import { join as join18 } from "path";
|
|
38785
38887
|
import { withContext as withContext2 } from "@logtape/logtape";
|
|
38786
|
-
import * as
|
|
38888
|
+
import * as z75 from "zod";
|
|
38787
38889
|
|
|
38788
38890
|
// packages/daemon/src/vm/vmm/configure-vm.ts
|
|
38789
38891
|
function createMarks() {
|
|
@@ -38860,11 +38962,11 @@ var MAX_TEMPLATES = 4;
|
|
|
38860
38962
|
var MAX_BUILD_FAILURES = 3;
|
|
38861
38963
|
var MAX_RESTORE_FAILURES = 3;
|
|
38862
38964
|
var BUILD_RETRY_MS = 60000;
|
|
38863
|
-
var TemplateMetaSchema =
|
|
38864
|
-
buildId:
|
|
38865
|
-
vcpus:
|
|
38866
|
-
memoryMib:
|
|
38867
|
-
systemDrivePath:
|
|
38965
|
+
var TemplateMetaSchema = z75.object({
|
|
38966
|
+
buildId: z75.string(),
|
|
38967
|
+
vcpus: z75.int().positive(),
|
|
38968
|
+
memoryMib: z75.int().positive(),
|
|
38969
|
+
systemDrivePath: z75.string()
|
|
38868
38970
|
});
|
|
38869
38971
|
|
|
38870
38972
|
class BuildRefusedError extends Error {
|
|
@@ -39261,7 +39363,7 @@ function readThreadIds(pid, procRoot = "/proc") {
|
|
|
39261
39363
|
}
|
|
39262
39364
|
|
|
39263
39365
|
// packages/daemon/src/imps/session-logs/session-log-service.ts
|
|
39264
|
-
import * as
|
|
39366
|
+
import * as z77 from "zod";
|
|
39265
39367
|
|
|
39266
39368
|
// packages/daemon/src/imps/session-logs/build-log-key.ts
|
|
39267
39369
|
function buildLogKey(impId, generation) {
|
|
@@ -39280,7 +39382,7 @@ import { basename as basename2, dirname as dirname8, join as join20, resolve as
|
|
|
39280
39382
|
import { existsSync as existsSync10, readFileSync as readFileSync20, readdirSync as readdirSync5, rmSync as rmSync16 } from "fs";
|
|
39281
39383
|
import { mkdir, open as open4, stat, truncate, unlink } from "fs/promises";
|
|
39282
39384
|
import { join as join19 } from "path";
|
|
39283
|
-
import * as
|
|
39385
|
+
import * as z76 from "zod";
|
|
39284
39386
|
|
|
39285
39387
|
// packages/daemon/src/imps/session-logs/plan-log-read.ts
|
|
39286
39388
|
function getLogBounds(segments, origin) {
|
|
@@ -39325,20 +39427,20 @@ function planLogRead(segments, origin, from, limit) {
|
|
|
39325
39427
|
var META_FILE = "meta.json";
|
|
39326
39428
|
var SEGMENT_SUFFIX = ".seg";
|
|
39327
39429
|
var COMMIT_DELAY_MS = 1000;
|
|
39328
|
-
var OffsetSchema2 =
|
|
39329
|
-
var GenerationMetaSchema =
|
|
39330
|
-
version:
|
|
39430
|
+
var OffsetSchema2 = z76.int().nonnegative();
|
|
39431
|
+
var GenerationMetaSchema = z76.object({
|
|
39432
|
+
version: z76.literal(1),
|
|
39331
39433
|
session: AgentSessionNameSchema,
|
|
39332
39434
|
executionGeneration: AgentGenerationSchema,
|
|
39333
39435
|
bootId: AgentBootIdSchema,
|
|
39334
|
-
startedAt:
|
|
39436
|
+
startedAt: z76.int(),
|
|
39335
39437
|
origin: OffsetSchema2,
|
|
39336
|
-
segments:
|
|
39337
|
-
state:
|
|
39338
|
-
endedAt:
|
|
39438
|
+
segments: z76.array(z76.object({ start: OffsetSchema2, length: OffsetSchema2 })),
|
|
39439
|
+
state: z76.enum(["live", "ended"]),
|
|
39440
|
+
endedAt: z76.int().optional(),
|
|
39339
39441
|
end: OffsetSchema2.optional(),
|
|
39340
|
-
exitCode:
|
|
39341
|
-
stopped:
|
|
39442
|
+
exitCode: z76.int().nullable().optional(),
|
|
39443
|
+
stopped: z76.enum(["disk_full", "imp_limit"]).optional()
|
|
39342
39444
|
});
|
|
39343
39445
|
function getSegmentPath(directory, start) {
|
|
39344
39446
|
return join19(directory, `${String(start)}${SEGMENT_SUFFIX}`);
|
|
@@ -40118,7 +40220,7 @@ function toExitCode(code, signal) {
|
|
|
40118
40220
|
}
|
|
40119
40221
|
|
|
40120
40222
|
// packages/daemon/src/imps/session-logs/session-log-service.ts
|
|
40121
|
-
var NoSessionPreviousSchema =
|
|
40223
|
+
var NoSessionPreviousSchema = z77.object({ previous: PreviousGenerationSchema.optional() });
|
|
40122
40224
|
function createSessionLogs(deps) {
|
|
40123
40225
|
const openTap = deps.openTap ?? openTapStream;
|
|
40124
40226
|
const createLog = deps.createLog ?? createGenerationLog;
|
|
@@ -42190,9 +42292,9 @@ async function waitForAgent(vsockPath, options) {
|
|
|
42190
42292
|
}
|
|
42191
42293
|
|
|
42192
42294
|
// packages/daemon/src/vm/vmm/firecracker-client.ts
|
|
42193
|
-
import * as
|
|
42194
|
-
var InstanceInfoSchema =
|
|
42195
|
-
var MachineConfigSchema =
|
|
42295
|
+
import * as z78 from "zod";
|
|
42296
|
+
var InstanceInfoSchema = z78.object({ state: z78.enum(["Not started", "Running", "Paused"]) });
|
|
42297
|
+
var MachineConfigSchema = z78.object({ track_dirty_pages: z78.boolean().optional() });
|
|
42196
42298
|
var DEFAULT_TIMEOUTS = { requestMs: 1e4, snapshotMs: 120000 };
|
|
42197
42299
|
|
|
42198
42300
|
class FirecrackerApiError extends Error {
|
|
@@ -44310,78 +44412,78 @@ function buildOfferedDigests(digest, receivedDigest) {
|
|
|
44310
44412
|
var COMMIT_WINDOW_MS = 24 * 60 * 60 * 1000;
|
|
44311
44413
|
|
|
44312
44414
|
// packages/daemon/src/imp-ops/moves/move-header.ts
|
|
44313
|
-
import * as
|
|
44314
|
-
var CpuSchema =
|
|
44315
|
-
var EgressSchema =
|
|
44316
|
-
var CheckpointSchema3 =
|
|
44317
|
-
label:
|
|
44318
|
-
createdAt:
|
|
44319
|
-
diskBytes:
|
|
44415
|
+
import * as z79 from "zod";
|
|
44416
|
+
var CpuSchema = z79.object({ limit: z79.number().positive().nullable(), weight: z79.int() }).readonly();
|
|
44417
|
+
var EgressSchema = z79.object({ mode: z79.string(), allow: z79.array(z79.string()).readonly() }).readonly();
|
|
44418
|
+
var CheckpointSchema3 = z79.object({
|
|
44419
|
+
label: z79.string().nullable(),
|
|
44420
|
+
createdAt: z79.coerce.date(),
|
|
44421
|
+
diskBytes: z79.int().positive()
|
|
44320
44422
|
}).readonly();
|
|
44321
|
-
var MovedBootSchema =
|
|
44423
|
+
var MovedBootSchema = z79.object({ bootId: z79.uuid(), cause: ColdBootCauseSchema, at: z79.iso.datetime() }).readonly();
|
|
44322
44424
|
var MAX_MOVED_LEASES = 1024;
|
|
44323
44425
|
var MAX_LEASE_REMAINING_MS = 100 * 365 * 24 * 60 * 60 * 1000;
|
|
44324
|
-
var LeaseOwnerTextSchema =
|
|
44325
|
-
var MovedLeaseOwnerSchema =
|
|
44426
|
+
var LeaseOwnerTextSchema = z79.string().min(1).max(256);
|
|
44427
|
+
var MovedLeaseOwnerSchema = z79.object({
|
|
44326
44428
|
principal: LeaseOwnerTextSchema,
|
|
44327
44429
|
label: LeaseLabelSchema,
|
|
44328
44430
|
display: LeaseOwnerTextSchema
|
|
44329
44431
|
});
|
|
44330
44432
|
var MovedLeaseSchema = MovedLeaseOwnerSchema.extend({
|
|
44331
|
-
remainingMs:
|
|
44332
|
-
createdAt:
|
|
44433
|
+
remainingMs: z79.int().nonnegative().max(MAX_LEASE_REMAINING_MS).nullable(),
|
|
44434
|
+
createdAt: z79.coerce.date()
|
|
44333
44435
|
}).readonly();
|
|
44334
|
-
var FilteredGrantSchema2 =
|
|
44335
|
-
var ImpSchema2 =
|
|
44336
|
-
id:
|
|
44337
|
-
name:
|
|
44338
|
-
vcpus:
|
|
44339
|
-
memoryMib:
|
|
44340
|
-
maxMemoryMib:
|
|
44341
|
-
httpPort:
|
|
44342
|
-
diskBytes:
|
|
44436
|
+
var FilteredGrantSchema2 = z79.object({ secret: z79.string(), filter: GrantFilterSchema }).readonly();
|
|
44437
|
+
var ImpSchema2 = z79.object({
|
|
44438
|
+
id: z79.uuid(),
|
|
44439
|
+
name: z79.string(),
|
|
44440
|
+
vcpus: z79.int().positive(),
|
|
44441
|
+
memoryMib: z79.int().positive(),
|
|
44442
|
+
maxMemoryMib: z79.int().positive().optional(),
|
|
44443
|
+
httpPort: z79.int().positive(),
|
|
44444
|
+
diskBytes: z79.int().positive(),
|
|
44343
44445
|
cpu: CpuSchema,
|
|
44344
44446
|
egress: EgressSchema,
|
|
44345
|
-
grants:
|
|
44346
|
-
filteredGrants:
|
|
44347
|
-
isIdentityResetPending:
|
|
44348
|
-
isDiskGrowPending:
|
|
44349
|
-
isBackedUp:
|
|
44350
|
-
coldBoots:
|
|
44351
|
-
leases:
|
|
44447
|
+
grants: z79.array(z79.string()).readonly(),
|
|
44448
|
+
filteredGrants: z79.array(FilteredGrantSchema2).readonly().default([]),
|
|
44449
|
+
isIdentityResetPending: z79.boolean(),
|
|
44450
|
+
isDiskGrowPending: z79.boolean().default(false),
|
|
44451
|
+
isBackedUp: z79.boolean().default(true),
|
|
44452
|
+
coldBoots: z79.array(MovedBootSchema).max(4).readonly().default([]),
|
|
44453
|
+
leases: z79.array(MovedLeaseSchema).max(MAX_MOVED_LEASES).readonly().optional()
|
|
44352
44454
|
}).readonly();
|
|
44353
|
-
var StreamStepSchema =
|
|
44354
|
-
checkpoint:
|
|
44355
|
-
dataset:
|
|
44356
|
-
base:
|
|
44455
|
+
var StreamStepSchema = z79.object({
|
|
44456
|
+
checkpoint: z79.int().nonnegative().nullable(),
|
|
44457
|
+
dataset: z79.int().nonnegative(),
|
|
44458
|
+
base: z79.int().nonnegative().nullable()
|
|
44357
44459
|
}).readonly();
|
|
44358
|
-
var HeldAnswerSchema =
|
|
44359
|
-
names:
|
|
44360
|
-
address:
|
|
44361
|
-
ttlS:
|
|
44460
|
+
var HeldAnswerSchema = z79.object({
|
|
44461
|
+
names: z79.array(z79.string()).readonly(),
|
|
44462
|
+
address: z79.string(),
|
|
44463
|
+
ttlS: z79.int().positive()
|
|
44362
44464
|
}).readonly();
|
|
44363
|
-
var WarmSchema =
|
|
44465
|
+
var WarmSchema = z79.object({
|
|
44364
44466
|
move: WarmMoveSchema,
|
|
44365
44467
|
meta: SnapshotMetaSchema.extend({ systemDrive: SystemDriveSchema }),
|
|
44366
44468
|
vm: VmIdentitySchema.nullable(),
|
|
44367
|
-
isDriveIncluded:
|
|
44368
|
-
answers:
|
|
44469
|
+
isDriveIncluded: z79.boolean(),
|
|
44470
|
+
answers: z79.array(HeldAnswerSchema).readonly()
|
|
44369
44471
|
}).readonly();
|
|
44370
|
-
var MoveHeaderSchema =
|
|
44371
|
-
version:
|
|
44472
|
+
var MoveHeaderSchema = z79.object({
|
|
44473
|
+
version: z79.literal(1),
|
|
44372
44474
|
imp: ImpSchema2,
|
|
44373
|
-
image:
|
|
44374
|
-
name:
|
|
44375
|
-
ref:
|
|
44376
|
-
digest:
|
|
44377
|
-
receivedDigest:
|
|
44378
|
-
sizeBytes:
|
|
44475
|
+
image: z79.object({
|
|
44476
|
+
name: z79.string(),
|
|
44477
|
+
ref: z79.string(),
|
|
44478
|
+
digest: z79.string(),
|
|
44479
|
+
receivedDigest: z79.string().nullable().default(null),
|
|
44480
|
+
sizeBytes: z79.int().nonnegative(),
|
|
44379
44481
|
source: ImageSourceSchema,
|
|
44380
|
-
sourceImp:
|
|
44381
|
-
isIncluded:
|
|
44482
|
+
sourceImp: z79.string().nullable(),
|
|
44483
|
+
isIncluded: z79.boolean()
|
|
44382
44484
|
}),
|
|
44383
|
-
checkpoints:
|
|
44384
|
-
streams:
|
|
44485
|
+
checkpoints: z79.array(CheckpointSchema3).readonly(),
|
|
44486
|
+
streams: z79.array(StreamStepSchema).readonly().nullable(),
|
|
44385
44487
|
warm: WarmSchema.nullable().default(null)
|
|
44386
44488
|
}).readonly();
|
|
44387
44489
|
var MOVE_PART_HEADER = "x-imp-move-part";
|
|
@@ -44543,7 +44645,7 @@ class MoveRequestError extends ImpdError {
|
|
|
44543
44645
|
}
|
|
44544
44646
|
|
|
44545
44647
|
// packages/daemon/src/imp-ops/moves/move-tickets.ts
|
|
44546
|
-
import * as
|
|
44648
|
+
import * as z80 from "zod";
|
|
44547
44649
|
var MOVE_AUTH_SCHEME = "ImpMove";
|
|
44548
44650
|
var MOVE_TICKET_PREFIX = "";
|
|
44549
44651
|
function isSameHash(leftItem, rightItem) {
|
|
@@ -44557,19 +44659,19 @@ function readTicketHeader(request) {
|
|
|
44557
44659
|
function buildTicketHeader(ticket) {
|
|
44558
44660
|
return { authorization: `${MOVE_AUTH_SCHEME} ${ticket}` };
|
|
44559
44661
|
}
|
|
44560
|
-
var ReceiptFileSchema =
|
|
44561
|
-
kind:
|
|
44562
|
-
index:
|
|
44563
|
-
sha256:
|
|
44564
|
-
bytes:
|
|
44662
|
+
var ReceiptFileSchema = z80.object({
|
|
44663
|
+
kind: z80.string(),
|
|
44664
|
+
index: z80.int().nonnegative().optional(),
|
|
44665
|
+
sha256: z80.string(),
|
|
44666
|
+
bytes: z80.int().nonnegative()
|
|
44565
44667
|
});
|
|
44566
|
-
var ReceiptBodySchema =
|
|
44567
|
-
ticketId:
|
|
44568
|
-
name:
|
|
44569
|
-
impId:
|
|
44570
|
-
files:
|
|
44668
|
+
var ReceiptBodySchema = z80.object({
|
|
44669
|
+
ticketId: z80.string(),
|
|
44670
|
+
name: z80.string(),
|
|
44671
|
+
impId: z80.string(),
|
|
44672
|
+
files: z80.array(ReceiptFileSchema)
|
|
44571
44673
|
});
|
|
44572
|
-
var ReceiptSchema =
|
|
44674
|
+
var ReceiptSchema = z80.object({ body: z80.string(), mac: z80.string() });
|
|
44573
44675
|
function buildReceipt(body, secret) {
|
|
44574
44676
|
const text = JSON.stringify(body);
|
|
44575
44677
|
return { body: text, mac: sign(secret, text).toString("hex") };
|
|
@@ -44794,7 +44896,7 @@ function createByteCounter(limit) {
|
|
|
44794
44896
|
// packages/daemon/src/imp-ops/moves/move-frames.ts
|
|
44795
44897
|
import { createHash as createHash8 } from "crypto";
|
|
44796
44898
|
import { open as open6 } from "fs/promises";
|
|
44797
|
-
import * as
|
|
44899
|
+
import * as z81 from "zod";
|
|
44798
44900
|
|
|
44799
44901
|
// packages/daemon/src/imp-ops/moves/create-content-hash.ts
|
|
44800
44902
|
import { createHash as createHash7 } from "crypto";
|
|
@@ -44832,8 +44934,8 @@ var MOVE_BLOCK_BYTES = 1024 * 1024;
|
|
|
44832
44934
|
var OFFSET_BYTES = 8;
|
|
44833
44935
|
var HEADER_BYTES3 = 5;
|
|
44834
44936
|
var MAX_PAYLOAD_BYTES = MOVE_BLOCK_BYTES + OFFSET_BYTES;
|
|
44835
|
-
var MoveFileSchema =
|
|
44836
|
-
kind:
|
|
44937
|
+
var MoveFileSchema = z81.object({
|
|
44938
|
+
kind: z81.enum([
|
|
44837
44939
|
"image-rootfs",
|
|
44838
44940
|
"image-config",
|
|
44839
44941
|
"checkpoint",
|
|
@@ -44843,13 +44945,13 @@ var MoveFileSchema = z80.object({
|
|
|
44843
44945
|
"vmstate",
|
|
44844
44946
|
"mem"
|
|
44845
44947
|
]),
|
|
44846
|
-
index:
|
|
44847
|
-
sizeBytes:
|
|
44948
|
+
index: z81.int().nonnegative().optional(),
|
|
44949
|
+
sizeBytes: z81.int().nonnegative()
|
|
44848
44950
|
});
|
|
44849
44951
|
function createFileContentHash(file) {
|
|
44850
44952
|
return file.kind === "image-rootfs" || file.kind === "image-config" ? createContentHash(file.sizeBytes) : null;
|
|
44851
44953
|
}
|
|
44852
|
-
var FileEndSchema =
|
|
44954
|
+
var FileEndSchema = z81.object({ sha256: z81.string() });
|
|
44853
44955
|
function encodeFrame2(type, payload) {
|
|
44854
44956
|
const frame = new Uint8Array(HEADER_BYTES3 + payload.length);
|
|
44855
44957
|
const view = new DataView(frame.buffer);
|
|
@@ -45685,7 +45787,7 @@ function readSettled2(row, imp) {
|
|
|
45685
45787
|
|
|
45686
45788
|
// packages/daemon/src/imp-ops/moves/move-sender.ts
|
|
45687
45789
|
import invariant4 from "tiny-invariant";
|
|
45688
|
-
import { match as
|
|
45790
|
+
import { match as match5 } from "ts-pattern";
|
|
45689
45791
|
|
|
45690
45792
|
// packages/daemon/src/platform/db/move-send-steps.ts
|
|
45691
45793
|
var MOVE_SEND_STEPS = [
|
|
@@ -46247,7 +46349,7 @@ function createMoveSender(deps) {
|
|
|
46247
46349
|
};
|
|
46248
46350
|
const recoverSend = async (imp, row) => {
|
|
46249
46351
|
const log = getImpdLogger("move").with({ imp: imp.name });
|
|
46250
|
-
await
|
|
46352
|
+
await match5(pickSendRecovery(imp.moveState, row?.step)).with("unmark", () => removeMark(imp)).with("wait", () => {
|
|
46251
46353
|
log.info("a prepared send waits for its send after a restart");
|
|
46252
46354
|
}).with("abort", async () => {
|
|
46253
46355
|
const isUndone = await resetSend(imp, row?.peer_url ?? null, row?.ticket ?? null);
|
|
@@ -46369,7 +46471,7 @@ function buildPublicError(name) {
|
|
|
46369
46471
|
}
|
|
46370
46472
|
function pickSendRecovery(moveState, step) {
|
|
46371
46473
|
if (moveState === "sending") {
|
|
46372
|
-
return
|
|
46474
|
+
return match5(step).with(undefined, () => "unmark").with("prepared", () => "wait").with("streaming", () => "abort").with("sent", () => "commit").exhaustive();
|
|
46373
46475
|
}
|
|
46374
46476
|
return moveState === "moved" && step === "sent" ? "commit" : "none";
|
|
46375
46477
|
}
|
|
@@ -46421,7 +46523,7 @@ function createMoveService(deps) {
|
|
|
46421
46523
|
// packages/daemon/src/surface/moves/create-move-peer-handler.ts
|
|
46422
46524
|
import { OpenAPIHandler } from "@orpc/openapi/fetch";
|
|
46423
46525
|
import { ORPCError as ORPCError7, implement as implement3, onError as onError3 } from "@orpc/server";
|
|
46424
|
-
import { match as
|
|
46526
|
+
import { match as match6 } from "ts-pattern";
|
|
46425
46527
|
function createMovePeerHandler(deps) {
|
|
46426
46528
|
const withTicket = async (step, context, call) => {
|
|
46427
46529
|
const startedAt = deps.now();
|
|
@@ -46472,7 +46574,7 @@ function createMovePeerHandler(deps) {
|
|
|
46472
46574
|
const respondReceive = async (context) => {
|
|
46473
46575
|
try {
|
|
46474
46576
|
const received = await withTicket("receive", context, (checked) => deps.calls.receive(checked, context.request));
|
|
46475
|
-
return
|
|
46577
|
+
return match6(received).with({ kind: "part" }, (sent) => Response.json({ part: sent.part }, { status: 202 })).with({ kind: "receipt" }, (sent) => Response.json(sent.receipt)).exhaustive();
|
|
46476
46578
|
} catch (error) {
|
|
46477
46579
|
const failure = toPeerError(error);
|
|
46478
46580
|
return Response.json(encodePeerError(failure), { status: failure.status });
|
|
@@ -46516,7 +46618,7 @@ import {
|
|
|
46516
46618
|
} from "@orpc/client";
|
|
46517
46619
|
import { ResponseValidationPlugin } from "@orpc/contract/plugins";
|
|
46518
46620
|
import { OpenAPILink } from "@orpc/openapi-client/fetch";
|
|
46519
|
-
import * as
|
|
46621
|
+
import * as z82 from "zod";
|
|
46520
46622
|
function makeConnectMovePeer(deps) {
|
|
46521
46623
|
return (target) => {
|
|
46522
46624
|
const sendLinkRequest = async (request) => {
|
|
@@ -46562,7 +46664,7 @@ function makeConnectMovePeer(deps) {
|
|
|
46562
46664
|
};
|
|
46563
46665
|
};
|
|
46564
46666
|
}
|
|
46565
|
-
var PeerErrorBodySchema =
|
|
46667
|
+
var PeerErrorBodySchema = z82.looseObject({ error: z82.string().optional() });
|
|
46566
46668
|
function decodePeerError(body, response) {
|
|
46567
46669
|
const parsed = PeerErrorBodySchema.safeParse(body);
|
|
46568
46670
|
if (!parsed.success) {
|
|
@@ -47322,7 +47424,7 @@ import { join as join29, posix as posix3 } from "path";
|
|
|
47322
47424
|
|
|
47323
47425
|
// packages/local-tar/src/extract-local.ts
|
|
47324
47426
|
import tar from "tar-stream";
|
|
47325
|
-
import * as
|
|
47427
|
+
import * as z83 from "zod";
|
|
47326
47428
|
// packages/local-tar/src/pack-build-context.ts
|
|
47327
47429
|
import { existsSync as existsSync17 } from "fs";
|
|
47328
47430
|
import { lstat, readFile as readFile4, readdir } from "fs/promises";
|
|
@@ -48452,14 +48554,14 @@ function renderPinnedDockerfile(dockerfile, pins, platform) {
|
|
|
48452
48554
|
}
|
|
48453
48555
|
|
|
48454
48556
|
// packages/daemon/src/imps/images/pull/image-pin.ts
|
|
48455
|
-
import * as
|
|
48557
|
+
import * as z84 from "zod";
|
|
48456
48558
|
var PIN_INSPECT_FORMAT = '{"Id":{{json .Id}},"RepoDigests":{{json .RepoDigests}},"Os":{{json .Os}},"Architecture":{{json .Architecture}},"Config":{{json .Config}}}';
|
|
48457
|
-
var ConfigSchema =
|
|
48458
|
-
var PinInspectSchema =
|
|
48459
|
-
Id:
|
|
48460
|
-
RepoDigests:
|
|
48461
|
-
Os:
|
|
48462
|
-
Architecture:
|
|
48559
|
+
var ConfigSchema = z84.object({ OnBuild: z84.array(z84.unknown()).readonly().nullish() }).nullable();
|
|
48560
|
+
var PinInspectSchema = z84.object({
|
|
48561
|
+
Id: z84.string(),
|
|
48562
|
+
RepoDigests: z84.array(z84.string()).readonly().nullable(),
|
|
48563
|
+
Os: z84.string(),
|
|
48564
|
+
Architecture: z84.string(),
|
|
48463
48565
|
Config: ConfigSchema
|
|
48464
48566
|
}).transform((inspect) => ({
|
|
48465
48567
|
Id: inspect.Id,
|
|
@@ -48521,7 +48623,7 @@ impd pinned ${pinned}. On the containerd image store a retag of a multi-platform
|
|
|
48521
48623
|
}
|
|
48522
48624
|
|
|
48523
48625
|
// packages/daemon/src/imps/images/build/build-engine.ts
|
|
48524
|
-
import * as
|
|
48626
|
+
import * as z85 from "zod";
|
|
48525
48627
|
|
|
48526
48628
|
// packages/daemon/src/imps/docker-contract/dockerfile-frontend.ts
|
|
48527
48629
|
var DOCKERFILE_FRONTEND = "docker/dockerfile:1.28@sha256:bb22d9815c728170f72750f4e5b0d672e06176142e1d602c7e66c050100b7e5b";
|
|
@@ -48555,7 +48657,7 @@ function createBuildEngine(run) {
|
|
|
48555
48657
|
if (version.exitCode !== 0) {
|
|
48556
48658
|
throw new Error(`docker version: ${version.stderr.trim()}`);
|
|
48557
48659
|
}
|
|
48558
|
-
const [os, arch] =
|
|
48660
|
+
const [os, arch] = z85.tuple([z85.string(), z85.string()]).parse(version.stdout.trim().split(" ").map((part) => JSON.parse(part)));
|
|
48559
48661
|
return normalizePlatform(os, arch);
|
|
48560
48662
|
},
|
|
48561
48663
|
loadImage: async (image, signal) => {
|
|
@@ -48657,7 +48759,7 @@ class DockerBuildError extends Error {
|
|
|
48657
48759
|
}
|
|
48658
48760
|
|
|
48659
48761
|
// packages/daemon/src/imps/images/build/guest-build.ts
|
|
48660
|
-
import * as
|
|
48762
|
+
import * as z86 from "zod";
|
|
48661
48763
|
|
|
48662
48764
|
// packages/daemon/src/vm/storage/count-tree-bytes.ts
|
|
48663
48765
|
import { lstat as lstat3, readdir as readdir3 } from "fs/promises";
|
|
@@ -48928,8 +49030,8 @@ class ImageLimitError extends ImpdError {
|
|
|
48928
49030
|
// packages/daemon/src/imps/images/build/guest-build.ts
|
|
48929
49031
|
var GUEST_BUILD_TAG = "imp-build:latest";
|
|
48930
49032
|
var LOG_MAX_CHARS = 8000;
|
|
48931
|
-
var ContainerIdSchema =
|
|
48932
|
-
var OciConfigSchema =
|
|
49033
|
+
var ContainerIdSchema = z86.string().regex(/^[a-f0-9]{64}$/v);
|
|
49034
|
+
var OciConfigSchema = z86.record(z86.string(), z86.unknown()).nullable();
|
|
48933
49035
|
async function runGuestBuild(exec, options) {
|
|
48934
49036
|
const lines = options.output === undefined ? null : createPlainLines(options.output);
|
|
48935
49037
|
const result = await exec([
|
|
@@ -49388,7 +49490,7 @@ function normalizeDockerfilePath(path) {
|
|
|
49388
49490
|
}
|
|
49389
49491
|
|
|
49390
49492
|
// packages/daemon/src/imps/images/image-naming.ts
|
|
49391
|
-
import * as
|
|
49493
|
+
import * as z87 from "zod";
|
|
49392
49494
|
var MAX_NAME_LENGTH2 = 31;
|
|
49393
49495
|
function deriveImageName(ref) {
|
|
49394
49496
|
const lastSegment = parseImageReference(ref).path.split("/").at(-1) ?? "";
|
|
@@ -49398,10 +49500,10 @@ function deriveImageName(ref) {
|
|
|
49398
49500
|
}
|
|
49399
49501
|
return name;
|
|
49400
49502
|
}
|
|
49401
|
-
var OciConfigSchema2 =
|
|
49402
|
-
Env:
|
|
49403
|
-
WorkingDir:
|
|
49404
|
-
User:
|
|
49503
|
+
var OciConfigSchema2 = z87.object({
|
|
49504
|
+
Env: z87.array(z87.string()).nullish(),
|
|
49505
|
+
WorkingDir: z87.string().nullish(),
|
|
49506
|
+
User: z87.string().nullish()
|
|
49405
49507
|
}).nullish();
|
|
49406
49508
|
function buildImageRuntimeConfig(ociConfig) {
|
|
49407
49509
|
const parsed = OciConfigSchema2.parse(ociConfig);
|
|
@@ -49415,16 +49517,16 @@ function buildImageRuntimeConfig(ociConfig) {
|
|
|
49415
49517
|
// packages/daemon/src/imps/images/rootfs/create-image-writer.ts
|
|
49416
49518
|
import { existsSync as existsSync19, mkdirSync as mkdirSync22, rmSync as rmSync26, statSync as statSync13, writeFileSync as writeFileSync8 } from "fs";
|
|
49417
49519
|
import { join as join31 } from "path";
|
|
49418
|
-
import * as
|
|
49520
|
+
import * as z89 from "zod";
|
|
49419
49521
|
|
|
49420
49522
|
// packages/daemon/src/imps/docker-contract/refusal.ts
|
|
49421
|
-
import { z as
|
|
49523
|
+
import { z as z88 } from "zod";
|
|
49422
49524
|
var PROXY_PREFIX = "imp-docker-proxy: ";
|
|
49423
49525
|
var ENGINE_FAILURE_PREFIX = `${PROXY_PREFIX}the engine call failed: `;
|
|
49424
49526
|
var REFUSAL_MAX_CHARS = 1000;
|
|
49425
49527
|
var DAEMON_ERROR_PREFIX = "Error response from daemon: ";
|
|
49426
49528
|
var UNABLE_TO_FIND_LINE = /^Unable to find image '[^'\n]+' locally$/u;
|
|
49427
|
-
var RefusalBodySchema =
|
|
49529
|
+
var RefusalBodySchema = z88.strictObject({ message: z88.string() });
|
|
49428
49530
|
function readProxyRefusal(text) {
|
|
49429
49531
|
const body = readJsonMessage(text.trim());
|
|
49430
49532
|
if (body !== null) {
|
|
@@ -49526,11 +49628,11 @@ function createDirectory(path, name) {
|
|
|
49526
49628
|
}
|
|
49527
49629
|
|
|
49528
49630
|
// packages/daemon/src/imps/images/rootfs/create-image-writer.ts
|
|
49529
|
-
var InspectSchema =
|
|
49530
|
-
|
|
49531
|
-
Id:
|
|
49532
|
-
Config:
|
|
49533
|
-
Size:
|
|
49631
|
+
var InspectSchema = z89.tuple([
|
|
49632
|
+
z89.object({
|
|
49633
|
+
Id: z89.string(),
|
|
49634
|
+
Config: z89.unknown(),
|
|
49635
|
+
Size: z89.number().optional()
|
|
49534
49636
|
})
|
|
49535
49637
|
]);
|
|
49536
49638
|
function createImageWriter(deps) {
|
|
@@ -50215,11 +50317,11 @@ function createImpdStorage(config, deps) {
|
|
|
50215
50317
|
}
|
|
50216
50318
|
|
|
50217
50319
|
// packages/daemon/src/host-net/net/tailscale-status.ts
|
|
50218
|
-
import * as
|
|
50219
|
-
var IpListSchema =
|
|
50220
|
-
var StatusSchema =
|
|
50221
|
-
BackendState:
|
|
50222
|
-
Self:
|
|
50320
|
+
import * as z90 from "zod";
|
|
50321
|
+
var IpListSchema = z90.array(z90.string()).nullable().optional();
|
|
50322
|
+
var StatusSchema = z90.object({
|
|
50323
|
+
BackendState: z90.string(),
|
|
50324
|
+
Self: z90.object({ HostName: z90.string(), DNSName: z90.string().optional(), TailscaleIPs: IpListSchema }).optional()
|
|
50223
50325
|
});
|
|
50224
50326
|
var UNKNOWN = { state: null, hostname: null, dnsName: null, ip: null, ips: [] };
|
|
50225
50327
|
var STATUS_TTL_MS = 30000;
|
|
@@ -50497,18 +50599,18 @@ import { getOAuthProviderApi } from "@better-auth/oauth-provider";
|
|
|
50497
50599
|
import { createAuthEndpoint } from "better-auth/api";
|
|
50498
50600
|
import { setSessionCookie } from "better-auth/cookies";
|
|
50499
50601
|
import { generateRandomString } from "better-auth/crypto";
|
|
50500
|
-
import * as
|
|
50602
|
+
import * as z91 from "zod";
|
|
50501
50603
|
var CLIENT_SCOPES = [...ScopeSchema.options, "offline_access"];
|
|
50502
50604
|
var APPROVAL_EMAIL_DOMAIN = "approval.imp.invalid";
|
|
50503
|
-
var SignInBodySchema =
|
|
50504
|
-
oauth_query:
|
|
50505
|
-
tokenID:
|
|
50506
|
-
tokenName:
|
|
50507
|
-
imps:
|
|
50605
|
+
var SignInBodySchema = z91.object({
|
|
50606
|
+
oauth_query: z91.string(),
|
|
50607
|
+
tokenID: z91.string().min(1),
|
|
50608
|
+
tokenName: z91.string().min(1),
|
|
50609
|
+
imps: z91.array(z91.string()).nullable()
|
|
50508
50610
|
});
|
|
50509
|
-
var FixedClientBodySchema =
|
|
50510
|
-
name:
|
|
50511
|
-
redirectURIs:
|
|
50611
|
+
var FixedClientBodySchema = z91.object({
|
|
50612
|
+
name: z91.string().min(1),
|
|
50613
|
+
redirectURIs: z91.array(z91.string()).min(1)
|
|
50512
50614
|
});
|
|
50513
50615
|
function createApproverPlugin() {
|
|
50514
50616
|
return {
|
|
@@ -50534,7 +50636,7 @@ function createApproverPlugin() {
|
|
|
50534
50636
|
}),
|
|
50535
50637
|
verifyMCPAccessToken: createAuthEndpoint("/imp/verify-access-token", {
|
|
50536
50638
|
method: "POST",
|
|
50537
|
-
body:
|
|
50639
|
+
body: z91.object({ token: z91.string() }),
|
|
50538
50640
|
metadata: { SERVER_ONLY: true }
|
|
50539
50641
|
}, async (ctx) => {
|
|
50540
50642
|
const provider = ctx.context.getPlugin("oauth-provider");
|
|
@@ -50578,7 +50680,7 @@ function createApproverPlugin() {
|
|
|
50578
50680
|
|
|
50579
50681
|
// packages/daemon/src/identity/oauth/create-oauth-handlers.ts
|
|
50580
50682
|
import { verifyOAuthQueryParams } from "@better-auth/oauth-provider";
|
|
50581
|
-
import * as
|
|
50683
|
+
import * as z92 from "zod";
|
|
50582
50684
|
|
|
50583
50685
|
// packages/daemon/src/identity/oauth/build-bad-token-request.ts
|
|
50584
50686
|
function buildBadTokenRequest() {
|
|
@@ -50806,14 +50908,14 @@ function expandScopes(asked) {
|
|
|
50806
50908
|
}
|
|
50807
50909
|
|
|
50808
50910
|
// packages/daemon/src/platform/http/render-html.ts
|
|
50809
|
-
import { P as
|
|
50911
|
+
import { P as P3, match as match7 } from "ts-pattern";
|
|
50810
50912
|
var MARKUP = Symbol("markup");
|
|
50811
50913
|
function renderHTML(strings, ...parts) {
|
|
50812
50914
|
const html = parts.reduce((text, part, index) => `${text}${toHTML(part)}${strings[index + 1] ?? ""}`, strings[0] ?? "");
|
|
50813
50915
|
return { [MARKUP]: true, html };
|
|
50814
50916
|
}
|
|
50815
50917
|
function toHTML(part) {
|
|
50816
|
-
return
|
|
50918
|
+
return match7(part).with(P3.string, (text) => escapeHTML(text)).with(P3.array(), (list) => list.map((each) => each.html).join("")).with({ html: P3.string }, (markup) => markup.html).exhaustive();
|
|
50817
50919
|
}
|
|
50818
50920
|
function escapeHTML(text) {
|
|
50819
50921
|
return text.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
@@ -50950,9 +51052,9 @@ var MINUTE_MS2 = 60000;
|
|
|
50950
51052
|
var CONSENT_MS = 10 * MINUTE_MS2;
|
|
50951
51053
|
var MAX_FORM_BYTES = 16 * 1024;
|
|
50952
51054
|
var METADATA_HEADERS = { "cache-control": "no-store" };
|
|
50953
|
-
var PKCEMissSchema =
|
|
50954
|
-
error:
|
|
50955
|
-
error_description:
|
|
51055
|
+
var PKCEMissSchema = z92.object({
|
|
51056
|
+
error: z92.literal("invalid_request"),
|
|
51057
|
+
error_description: z92.literal("code verification failed")
|
|
50956
51058
|
});
|
|
50957
51059
|
function createOAuthHandlers(deps) {
|
|
50958
51060
|
const host = new URL(deps.origin).host;
|
|
@@ -51644,8 +51746,8 @@ function loadOrCreateHostId(dataDir) {
|
|
|
51644
51746
|
|
|
51645
51747
|
// packages/daemon/src/network/tailnet-names/oauth-credential.ts
|
|
51646
51748
|
import { readFileSync as readFileSync26, statSync as statSync14 } from "fs";
|
|
51647
|
-
import * as
|
|
51648
|
-
var CredentialSchema =
|
|
51749
|
+
import * as z93 from "zod";
|
|
51750
|
+
var CredentialSchema = z93.object({ clientId: z93.string().min(1), clientSecret: z93.string().min(1) });
|
|
51649
51751
|
function readOAuthCredential(path) {
|
|
51650
51752
|
const mode = statSync14(path).mode & 511;
|
|
51651
51753
|
if ((mode & 63) !== 0) {
|
|
@@ -51666,17 +51768,17 @@ function readJson(path) {
|
|
|
51666
51768
|
}
|
|
51667
51769
|
|
|
51668
51770
|
// packages/daemon/src/host-net/net/tailscale-serve.ts
|
|
51669
|
-
import * as
|
|
51670
|
-
var HandlerSchema =
|
|
51671
|
-
var WebSchema =
|
|
51672
|
-
Handlers:
|
|
51771
|
+
import * as z94 from "zod";
|
|
51772
|
+
var HandlerSchema = z94.object({ Proxy: z94.string().optional() });
|
|
51773
|
+
var WebSchema = z94.object({
|
|
51774
|
+
Handlers: z94.record(z94.string(), HandlerSchema).nullable().optional()
|
|
51673
51775
|
});
|
|
51674
|
-
var ServiceConfigSchema =
|
|
51675
|
-
Web:
|
|
51776
|
+
var ServiceConfigSchema = z94.object({
|
|
51777
|
+
Web: z94.record(z94.string(), WebSchema).nullable().optional()
|
|
51676
51778
|
});
|
|
51677
|
-
var ServeStatusSchema =
|
|
51678
|
-
TCP:
|
|
51679
|
-
Services:
|
|
51779
|
+
var ServeStatusSchema = z94.object({
|
|
51780
|
+
TCP: z94.record(z94.string(), z94.unknown()).optional(),
|
|
51781
|
+
Services: z94.record(z94.string(), ServiceConfigSchema).nullable().optional()
|
|
51680
51782
|
});
|
|
51681
51783
|
function parseServeStatus(json) {
|
|
51682
51784
|
try {
|
|
@@ -51727,17 +51829,17 @@ function createServiceServe(run = runChecked) {
|
|
|
51727
51829
|
}
|
|
51728
51830
|
|
|
51729
51831
|
// packages/daemon/src/network/tailnet-names/services-api.ts
|
|
51730
|
-
import * as
|
|
51832
|
+
import * as z95 from "zod";
|
|
51731
51833
|
var TAILSCALE_API = "https://api.tailscale.com/api/v2";
|
|
51732
51834
|
var TOKEN_MARGIN_MS = 60000;
|
|
51733
|
-
var ServiceSchema2 =
|
|
51734
|
-
name:
|
|
51735
|
-
comment:
|
|
51736
|
-
ports:
|
|
51737
|
-
tags:
|
|
51835
|
+
var ServiceSchema2 = z95.object({
|
|
51836
|
+
name: z95.string(),
|
|
51837
|
+
comment: z95.string().optional(),
|
|
51838
|
+
ports: z95.array(z95.string()).readonly().optional(),
|
|
51839
|
+
tags: z95.array(z95.string()).readonly().nullable().optional()
|
|
51738
51840
|
}).readonly();
|
|
51739
|
-
var ServiceListSchema2 =
|
|
51740
|
-
var TokenSchema3 =
|
|
51841
|
+
var ServiceListSchema2 = z95.object({ vipServices: z95.array(ServiceSchema2).nullable().optional() });
|
|
51842
|
+
var TokenSchema3 = z95.object({ access_token: z95.string(), expires_in: z95.number().positive() });
|
|
51741
51843
|
|
|
51742
51844
|
class TailscaleApiError extends Error {
|
|
51743
51845
|
status;
|
|
@@ -51826,7 +51928,7 @@ function createServicesApi(options) {
|
|
|
51826
51928
|
}
|
|
51827
51929
|
};
|
|
51828
51930
|
}
|
|
51829
|
-
var ErrorSchema =
|
|
51931
|
+
var ErrorSchema = z95.object({ message: z95.string() });
|
|
51830
51932
|
function readErrorText(text) {
|
|
51831
51933
|
try {
|
|
51832
51934
|
return ErrorSchema.parse(JSON.parse(text)).message;
|
|
@@ -52253,14 +52355,14 @@ function formatAcmeError(error) {
|
|
|
52253
52355
|
// packages/daemon/src/network/https/acme/cert-store.ts
|
|
52254
52356
|
import { existsSync as existsSync22, mkdirSync as mkdirSync24, readFileSync as readFileSync27, rmSync as rmSync28 } from "fs";
|
|
52255
52357
|
import { join as join35 } from "path";
|
|
52256
|
-
import * as
|
|
52257
|
-
var AttemptStateSchema =
|
|
52258
|
-
failures:
|
|
52259
|
-
lastAttemptAt:
|
|
52260
|
-
lastError:
|
|
52358
|
+
import * as z96 from "zod";
|
|
52359
|
+
var AttemptStateSchema = z96.object({
|
|
52360
|
+
failures: z96.int().nonnegative(),
|
|
52361
|
+
lastAttemptAt: z96.number().nullable(),
|
|
52362
|
+
lastError: z96.string().nullable()
|
|
52261
52363
|
});
|
|
52262
|
-
var AccountSchema =
|
|
52263
|
-
var LegacyAccountSchema =
|
|
52364
|
+
var AccountSchema = z96.object({ directoryUrl: z96.string(), url: z96.string(), keyPem: z96.string() });
|
|
52365
|
+
var LegacyAccountSchema = z96.object({ directoryUrl: z96.string(), url: z96.string() });
|
|
52264
52366
|
var NO_ATTEMPTS = { failures: 0, lastAttemptAt: null, lastError: null };
|
|
52265
52367
|
function createCertStore(dataDir) {
|
|
52266
52368
|
const directory = join35(dataDir, "tls");
|
|
@@ -52398,7 +52500,7 @@ function createChalltestsrvProvider(apiUrl) {
|
|
|
52398
52500
|
}
|
|
52399
52501
|
|
|
52400
52502
|
// packages/daemon/src/network/https/dns/cloudflare-provider.ts
|
|
52401
|
-
import * as
|
|
52503
|
+
import * as z97 from "zod";
|
|
52402
52504
|
|
|
52403
52505
|
// packages/daemon/src/network/https/dns/wait-for-txt.ts
|
|
52404
52506
|
import { Resolver as Resolver2 } from "dns/promises";
|
|
@@ -52460,30 +52562,30 @@ var CLOUDFLARE_API = "https://api.cloudflare.com/client/v4";
|
|
|
52460
52562
|
var TXT_TTL_S = 60;
|
|
52461
52563
|
var A_TTL_S = 300;
|
|
52462
52564
|
var PAGE_SIZE = 500;
|
|
52463
|
-
var ApiErrorSchema =
|
|
52464
|
-
var EnvelopeSchema =
|
|
52465
|
-
success:
|
|
52466
|
-
errors:
|
|
52467
|
-
result:
|
|
52468
|
-
result_info:
|
|
52565
|
+
var ApiErrorSchema = z97.object({ code: z97.number().optional(), message: z97.string() });
|
|
52566
|
+
var EnvelopeSchema = z97.object({
|
|
52567
|
+
success: z97.boolean(),
|
|
52568
|
+
errors: z97.array(ApiErrorSchema).default([]),
|
|
52569
|
+
result: z97.unknown().optional(),
|
|
52570
|
+
result_info: z97.object({ page: z97.number(), total_pages: z97.number() }).optional()
|
|
52469
52571
|
});
|
|
52470
|
-
var ZoneSchema =
|
|
52471
|
-
id:
|
|
52472
|
-
name:
|
|
52473
|
-
name_servers:
|
|
52572
|
+
var ZoneSchema = z97.object({
|
|
52573
|
+
id: z97.string(),
|
|
52574
|
+
name: z97.string(),
|
|
52575
|
+
name_servers: z97.array(z97.string())
|
|
52474
52576
|
});
|
|
52475
|
-
var RecordSchema =
|
|
52476
|
-
id:
|
|
52477
|
-
name:
|
|
52478
|
-
type:
|
|
52479
|
-
content:
|
|
52480
|
-
proxied:
|
|
52481
|
-
comment:
|
|
52577
|
+
var RecordSchema = z97.object({
|
|
52578
|
+
id: z97.string(),
|
|
52579
|
+
name: z97.string().optional(),
|
|
52580
|
+
type: z97.string().optional(),
|
|
52581
|
+
content: z97.string(),
|
|
52582
|
+
proxied: z97.boolean().optional(),
|
|
52583
|
+
comment: z97.string().nullable().optional()
|
|
52482
52584
|
});
|
|
52483
52585
|
var MANAGED_COMMENT = "managed by impd";
|
|
52484
52586
|
var ADDRESS_TYPES = new Set(["A", "AAAA", "CNAME"]);
|
|
52485
|
-
var ZoneListSchema =
|
|
52486
|
-
var RecordListSchema =
|
|
52587
|
+
var ZoneListSchema = z97.array(ZoneSchema);
|
|
52588
|
+
var RecordListSchema = z97.array(RecordSchema);
|
|
52487
52589
|
function createCloudflareProvider(options) {
|
|
52488
52590
|
const base = options.apiUrl ?? CLOUDFLARE_API;
|
|
52489
52591
|
const send = options.fetch ?? fetch;
|
|
@@ -55002,8 +55104,8 @@ import {
|
|
|
55002
55104
|
statSync as statSync15
|
|
55003
55105
|
} from "fs";
|
|
55004
55106
|
import { basename as basename5, dirname as dirname11, join as join37 } from "path";
|
|
55005
|
-
import * as
|
|
55006
|
-
var CopiesSchema =
|
|
55107
|
+
import * as z98 from "zod";
|
|
55108
|
+
var CopiesSchema = z98.record(z98.string(), z98.object({ ino: z98.string(), ctimeNs: z98.string(), size: z98.string() }));
|
|
55007
55109
|
function createXfsBackups(ctx) {
|
|
55008
55110
|
const backup = buildBackupPaths(ctx.dataDir);
|
|
55009
55111
|
const freshCopies = new Set;
|