@autohq/cli 0.1.609 → 0.1.610
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/agent-bridge.js +268 -140
- package/dist/index.js +288 -149
- package/package.json +1 -1
package/dist/agent-bridge.js
CHANGED
|
@@ -37751,7 +37751,7 @@ Object.assign(lookup, {
|
|
|
37751
37751
|
// package.json
|
|
37752
37752
|
var package_default = {
|
|
37753
37753
|
name: "@autohq/cli",
|
|
37754
|
-
version: "0.1.
|
|
37754
|
+
version: "0.1.610",
|
|
37755
37755
|
license: "SEE LICENSE IN README.md",
|
|
37756
37756
|
publishConfig: {
|
|
37757
37757
|
access: "public"
|
|
@@ -38969,6 +38969,8 @@ var AuthScopeSchema = external_exports.enum([
|
|
|
38969
38969
|
"tools:write",
|
|
38970
38970
|
"environments:read",
|
|
38971
38971
|
"environments:write",
|
|
38972
|
+
"runtimes:read",
|
|
38973
|
+
"runtimes:write",
|
|
38972
38974
|
"profiles:read",
|
|
38973
38975
|
"profiles:write",
|
|
38974
38976
|
"sessions:read",
|
|
@@ -39104,6 +39106,7 @@ function normalizePersistedAuthClient(value2) {
|
|
|
39104
39106
|
}
|
|
39105
39107
|
var SERVICE_ACCOUNT_READ_ONLY_SCOPES = [
|
|
39106
39108
|
"environments:read",
|
|
39109
|
+
"runtimes:read",
|
|
39107
39110
|
"tools:read",
|
|
39108
39111
|
"agents:read",
|
|
39109
39112
|
"sessions:read",
|
|
@@ -42197,6 +42200,270 @@ var SecretRevealResponseSchema = external_exports.object({
|
|
|
42197
42200
|
value: external_exports.string()
|
|
42198
42201
|
});
|
|
42199
42202
|
|
|
42203
|
+
// ../../packages/schemas/src/environments.ts
|
|
42204
|
+
var RESOURCE_KIND_ENVIRONMENT = "environment";
|
|
42205
|
+
var CURRENT_SANDBOX_USER_HOME = "/home/user";
|
|
42206
|
+
var LEGACY_SANDBOX_USER_HOMES = ["/home/auto", "/home/node"];
|
|
42207
|
+
var STORED_SANDBOX_USER_HOMES = [
|
|
42208
|
+
CURRENT_SANDBOX_USER_HOME,
|
|
42209
|
+
...LEGACY_SANDBOX_USER_HOMES
|
|
42210
|
+
];
|
|
42211
|
+
var EnvironmentSetupCachePathSchema = external_exports.string().trim().refine((value2) => isSafeSandboxUserHomePath(value2), {
|
|
42212
|
+
message: `Expected an absolute path under ${CURRENT_SANDBOX_USER_HOME}`
|
|
42213
|
+
});
|
|
42214
|
+
var StoredEnvironmentSetupCachePathSchema = external_exports.string().trim().refine(
|
|
42215
|
+
(value2) => isSafeSandboxUserHomePath(value2, {
|
|
42216
|
+
allowedHomes: STORED_SANDBOX_USER_HOMES
|
|
42217
|
+
}),
|
|
42218
|
+
{
|
|
42219
|
+
message: `Expected an absolute path under ${CURRENT_SANDBOX_USER_HOME}`
|
|
42220
|
+
}
|
|
42221
|
+
);
|
|
42222
|
+
var EnvironmentImageSchema = external_exports.discriminatedUnion("kind", [
|
|
42223
|
+
external_exports.object({
|
|
42224
|
+
kind: external_exports.literal("preset"),
|
|
42225
|
+
name: ResourceNameSchema
|
|
42226
|
+
}).strict(),
|
|
42227
|
+
external_exports.object({
|
|
42228
|
+
kind: external_exports.literal("base"),
|
|
42229
|
+
ref: external_exports.string().trim().min(1).max(512).refine(isSafeBaseImageRef, {
|
|
42230
|
+
message: "Expected a single Docker/OCI image reference"
|
|
42231
|
+
})
|
|
42232
|
+
}).strict()
|
|
42233
|
+
]);
|
|
42234
|
+
var StoredEnvironmentImageSchema = external_exports.discriminatedUnion("kind", [
|
|
42235
|
+
external_exports.object({
|
|
42236
|
+
kind: external_exports.literal("preset"),
|
|
42237
|
+
name: external_exports.string().trim().min(1)
|
|
42238
|
+
}).strict(),
|
|
42239
|
+
external_exports.object({
|
|
42240
|
+
kind: external_exports.literal("base"),
|
|
42241
|
+
ref: external_exports.string().trim().min(1).refine(isSafeBaseImageRef, {
|
|
42242
|
+
message: "Expected a single Docker/OCI image reference"
|
|
42243
|
+
})
|
|
42244
|
+
}).strict()
|
|
42245
|
+
]);
|
|
42246
|
+
var ENVIRONMENT_APPROVALS_MODES = ["bypass", "prompt"];
|
|
42247
|
+
var EnvironmentApprovalsSchema = external_exports.enum(ENVIRONMENT_APPROVALS_MODES);
|
|
42248
|
+
var EnvironmentSetupSchema = environmentSetupSchema(
|
|
42249
|
+
StoredEnvironmentSetupCachePathSchema
|
|
42250
|
+
);
|
|
42251
|
+
var EnvironmentApplySetupSchema = environmentSetupSchema(
|
|
42252
|
+
EnvironmentSetupCachePathSchema
|
|
42253
|
+
);
|
|
42254
|
+
var EnvironmentSetupCacheSchema = external_exports.object({
|
|
42255
|
+
ttl: external_exports.string().trim().refine(isSetupCacheTtl, {
|
|
42256
|
+
message: "Expected a positive setup cache TTL such as 30m, 24h, or 7d"
|
|
42257
|
+
})
|
|
42258
|
+
}).strict();
|
|
42259
|
+
var EnvironmentResourcesSchema = external_exports.object({
|
|
42260
|
+
cpuCount: external_exports.number().int().min(1).optional(),
|
|
42261
|
+
memoryMB: external_exports.number().int().min(128).optional()
|
|
42262
|
+
}).strict().refine(
|
|
42263
|
+
(resources) => resources.cpuCount !== void 0 || resources.memoryMB !== void 0,
|
|
42264
|
+
{
|
|
42265
|
+
message: "Expected at least one runtime resource setting"
|
|
42266
|
+
}
|
|
42267
|
+
);
|
|
42268
|
+
var EnvironmentSpecSchema = environmentSpecSchema({
|
|
42269
|
+
imageSchema: StoredEnvironmentImageSchema,
|
|
42270
|
+
setupSchema: EnvironmentSetupSchema
|
|
42271
|
+
});
|
|
42272
|
+
var EnvironmentApplySpecSchema = environmentSpecSchema({
|
|
42273
|
+
imageSchema: EnvironmentImageSchema,
|
|
42274
|
+
setupSchema: EnvironmentApplySetupSchema
|
|
42275
|
+
});
|
|
42276
|
+
var EnvironmentCandidateSpecSchema = EnvironmentApplySpecSchema;
|
|
42277
|
+
var EnvironmentResourceSchema = resourceEnvelopeSchema(
|
|
42278
|
+
EnvironmentSpecSchema
|
|
42279
|
+
);
|
|
42280
|
+
var EnvironmentApplyRequestSchema = resourceApplySchema(
|
|
42281
|
+
EnvironmentApplySpecSchema
|
|
42282
|
+
);
|
|
42283
|
+
function environmentSetupSchema(cachePathSchema) {
|
|
42284
|
+
return external_exports.object({
|
|
42285
|
+
name: ResourceNameSchema,
|
|
42286
|
+
commands: external_exports.array(external_exports.string().trim().min(1)).min(1),
|
|
42287
|
+
cache: external_exports.object({
|
|
42288
|
+
key: ResourceNameSchema.optional(),
|
|
42289
|
+
files: external_exports.array(
|
|
42290
|
+
external_exports.string().trim().refine(isSafeRelativePath, {
|
|
42291
|
+
message: "Expected a relative path without traversal"
|
|
42292
|
+
})
|
|
42293
|
+
).default([]),
|
|
42294
|
+
paths: external_exports.array(cachePathSchema).default([])
|
|
42295
|
+
}).strict().default({ files: [], paths: [] })
|
|
42296
|
+
}).strict();
|
|
42297
|
+
}
|
|
42298
|
+
function environmentSpecSchema({
|
|
42299
|
+
imageSchema,
|
|
42300
|
+
setupSchema
|
|
42301
|
+
}) {
|
|
42302
|
+
return external_exports.object({
|
|
42303
|
+
image: imageSchema,
|
|
42304
|
+
env: SecretEnvSchema.default({}),
|
|
42305
|
+
resources: EnvironmentResourcesSchema.optional(),
|
|
42306
|
+
steps: external_exports.array(external_exports.string()).default([]),
|
|
42307
|
+
setup: external_exports.array(setupSchema).default([]),
|
|
42308
|
+
setupCache: EnvironmentSetupCacheSchema.optional(),
|
|
42309
|
+
// Optional rather than defaulted: a default would materialize the key
|
|
42310
|
+
// into stored specs and session environment snapshots the moment the web
|
|
42311
|
+
// app deploys, and this strict schema on a not-yet-deployed worker would
|
|
42312
|
+
// reject those rows (web and workers do not deploy atomically). Absent
|
|
42313
|
+
// means `bypass`; consumers default at the read boundary.
|
|
42314
|
+
approvals: EnvironmentApprovalsSchema.optional()
|
|
42315
|
+
}).strict();
|
|
42316
|
+
}
|
|
42317
|
+
function isSafeSandboxUserHomePath(value2, options = {}) {
|
|
42318
|
+
return (options.allowedHomes ?? [CURRENT_SANDBOX_USER_HOME]).some(
|
|
42319
|
+
(home) => isSafePathUnderHome(value2, home)
|
|
42320
|
+
);
|
|
42321
|
+
}
|
|
42322
|
+
function isSafePathUnderHome(value2, home) {
|
|
42323
|
+
const prefix = `${home}/`;
|
|
42324
|
+
if (!value2.startsWith(prefix)) {
|
|
42325
|
+
return false;
|
|
42326
|
+
}
|
|
42327
|
+
const relative2 = value2.slice(prefix.length);
|
|
42328
|
+
return relative2.split("/").every((segment) => segment !== "" && segment !== "." && segment !== "..");
|
|
42329
|
+
}
|
|
42330
|
+
function isSafeRelativePath(value2) {
|
|
42331
|
+
if (!value2 || value2.startsWith("/")) {
|
|
42332
|
+
return false;
|
|
42333
|
+
}
|
|
42334
|
+
return value2.split("/").every((segment) => segment !== "" && segment !== "." && segment !== "..");
|
|
42335
|
+
}
|
|
42336
|
+
function isSafeBaseImageRef(value2) {
|
|
42337
|
+
return !value2.startsWith("-") && /^[^\s#\\]+$/.test(value2);
|
|
42338
|
+
}
|
|
42339
|
+
function isSetupCacheTtl(value2) {
|
|
42340
|
+
return /^[1-9][0-9]*(s|m|h|d)$/.test(value2);
|
|
42341
|
+
}
|
|
42342
|
+
|
|
42343
|
+
// ../../packages/schemas/src/hosted-runtimes.ts
|
|
42344
|
+
var HOSTED_RUNTIME_STATUSES = [
|
|
42345
|
+
"queued",
|
|
42346
|
+
"provisioning",
|
|
42347
|
+
"running",
|
|
42348
|
+
"closing",
|
|
42349
|
+
"closed"
|
|
42350
|
+
];
|
|
42351
|
+
var HOSTED_RUNTIME_OUTCOMES = [
|
|
42352
|
+
"succeeded",
|
|
42353
|
+
"failed",
|
|
42354
|
+
"cancelled"
|
|
42355
|
+
];
|
|
42356
|
+
var HOSTED_RUNTIME_COMMAND_STATUSES = [
|
|
42357
|
+
"pending",
|
|
42358
|
+
"running",
|
|
42359
|
+
"succeeded",
|
|
42360
|
+
"failed",
|
|
42361
|
+
"cancelled"
|
|
42362
|
+
];
|
|
42363
|
+
var HOSTED_RUNTIME_CLOSE_REASONS = [
|
|
42364
|
+
"completed",
|
|
42365
|
+
"command_failed",
|
|
42366
|
+
"provision_failed",
|
|
42367
|
+
"requested",
|
|
42368
|
+
"internal_error"
|
|
42369
|
+
];
|
|
42370
|
+
var HOSTED_RUNTIME_MAX_COMMAND_BUDGET_SECONDS = 45 * 60;
|
|
42371
|
+
var HostedRuntimeEnvironmentInputSchema = external_exports.discriminatedUnion(
|
|
42372
|
+
"kind",
|
|
42373
|
+
[
|
|
42374
|
+
external_exports.object({
|
|
42375
|
+
kind: external_exports.literal("inline"),
|
|
42376
|
+
spec: EnvironmentCandidateSpecSchema
|
|
42377
|
+
}).strict(),
|
|
42378
|
+
external_exports.object({
|
|
42379
|
+
kind: external_exports.literal("applied"),
|
|
42380
|
+
name: ResourceNameSchema
|
|
42381
|
+
}).strict()
|
|
42382
|
+
]
|
|
42383
|
+
);
|
|
42384
|
+
var HostedRuntimeEnvironmentSourceSchema = external_exports.discriminatedUnion(
|
|
42385
|
+
"kind",
|
|
42386
|
+
[
|
|
42387
|
+
external_exports.object({ kind: external_exports.literal("inline") }).strict(),
|
|
42388
|
+
external_exports.object({
|
|
42389
|
+
kind: external_exports.literal("applied"),
|
|
42390
|
+
name: ResourceNameSchema,
|
|
42391
|
+
resourceId: external_exports.string().trim().min(1),
|
|
42392
|
+
generation: external_exports.number().int().positive()
|
|
42393
|
+
}).strict()
|
|
42394
|
+
]
|
|
42395
|
+
);
|
|
42396
|
+
var HostedRuntimeEnvironmentSnapshotSchema = external_exports.object({
|
|
42397
|
+
source: HostedRuntimeEnvironmentSourceSchema,
|
|
42398
|
+
spec: EnvironmentSpecSchema
|
|
42399
|
+
}).strict();
|
|
42400
|
+
var HostedRuntimeCommandInputSchema = external_exports.object({
|
|
42401
|
+
command: external_exports.string().trim().min(1).max(4096),
|
|
42402
|
+
timeoutSeconds: external_exports.number().int().min(1).max(300).default(60)
|
|
42403
|
+
}).strict();
|
|
42404
|
+
var HostedRuntimeIdempotencyKeySchema = external_exports.string().trim().min(1).max(200);
|
|
42405
|
+
var CreateHostedRuntimeRequestSchema = external_exports.object({
|
|
42406
|
+
environment: HostedRuntimeEnvironmentInputSchema,
|
|
42407
|
+
commands: external_exports.array(HostedRuntimeCommandInputSchema).min(1).max(20)
|
|
42408
|
+
}).strict().superRefine((request, context) => {
|
|
42409
|
+
const totalTimeoutSeconds = request.commands.reduce(
|
|
42410
|
+
(total, command) => total + command.timeoutSeconds,
|
|
42411
|
+
0
|
|
42412
|
+
);
|
|
42413
|
+
if (totalTimeoutSeconds > HOSTED_RUNTIME_MAX_COMMAND_BUDGET_SECONDS) {
|
|
42414
|
+
context.addIssue({
|
|
42415
|
+
code: "custom",
|
|
42416
|
+
message: `Total command timeout must not exceed ${HOSTED_RUNTIME_MAX_COMMAND_BUDGET_SECONDS} seconds`,
|
|
42417
|
+
path: ["commands"]
|
|
42418
|
+
});
|
|
42419
|
+
}
|
|
42420
|
+
});
|
|
42421
|
+
var HostedRuntimeStatusSchema = external_exports.enum(HOSTED_RUNTIME_STATUSES);
|
|
42422
|
+
var HostedRuntimeOutcomeSchema = external_exports.enum(HOSTED_RUNTIME_OUTCOMES);
|
|
42423
|
+
var HostedRuntimeCommandStatusSchema = external_exports.enum(
|
|
42424
|
+
HOSTED_RUNTIME_COMMAND_STATUSES
|
|
42425
|
+
);
|
|
42426
|
+
var HostedRuntimeCloseReasonSchema = external_exports.enum(
|
|
42427
|
+
HOSTED_RUNTIME_CLOSE_REASONS
|
|
42428
|
+
);
|
|
42429
|
+
var HostedRuntimeCommandRecordSchema = external_exports.object({
|
|
42430
|
+
ordinal: external_exports.number().int().positive(),
|
|
42431
|
+
command: external_exports.string(),
|
|
42432
|
+
timeoutSeconds: external_exports.number().int().positive(),
|
|
42433
|
+
status: HostedRuntimeCommandStatusSchema,
|
|
42434
|
+
startedAt: external_exports.string().datetime().nullable(),
|
|
42435
|
+
finishedAt: external_exports.string().datetime().nullable(),
|
|
42436
|
+
durationMs: external_exports.number().int().nonnegative().nullable(),
|
|
42437
|
+
exitCode: external_exports.number().int().nullable(),
|
|
42438
|
+
stdout: external_exports.string().nullable(),
|
|
42439
|
+
stderr: external_exports.string().nullable(),
|
|
42440
|
+
error: external_exports.string().nullable()
|
|
42441
|
+
}).strict();
|
|
42442
|
+
var HostedRuntimeRecordSchema = external_exports.object({
|
|
42443
|
+
id: RuntimeIdSchema2,
|
|
42444
|
+
status: HostedRuntimeStatusSchema,
|
|
42445
|
+
outcome: HostedRuntimeOutcomeSchema.nullable(),
|
|
42446
|
+
environment: HostedRuntimeEnvironmentSourceSchema,
|
|
42447
|
+
commands: external_exports.array(HostedRuntimeCommandRecordSchema),
|
|
42448
|
+
error: external_exports.string().nullable(),
|
|
42449
|
+
closeReason: HostedRuntimeCloseReasonSchema.nullable(),
|
|
42450
|
+
closeRequestedAt: external_exports.string().datetime().nullable(),
|
|
42451
|
+
startedAt: external_exports.string().datetime().nullable(),
|
|
42452
|
+
finishedAt: external_exports.string().datetime().nullable(),
|
|
42453
|
+
createdAt: external_exports.string().datetime(),
|
|
42454
|
+
updatedAt: external_exports.string().datetime()
|
|
42455
|
+
}).strict();
|
|
42456
|
+
var HostedRuntimeDispatchStatusSchema = external_exports.enum([
|
|
42457
|
+
"started",
|
|
42458
|
+
"deferred"
|
|
42459
|
+
]);
|
|
42460
|
+
var HostedRuntimeReceiptSchema = external_exports.object({
|
|
42461
|
+
runtime: HostedRuntimeRecordSchema,
|
|
42462
|
+
workflowId: external_exports.string().trim().min(1),
|
|
42463
|
+
dispatchStatus: HostedRuntimeDispatchStatusSchema
|
|
42464
|
+
}).strict();
|
|
42465
|
+
var HostedRuntimeWorkflowInputSchema = external_exports.object({ runtimeId: RuntimeIdSchema2 }).strip();
|
|
42466
|
+
|
|
42200
42467
|
// ../../packages/schemas/src/session-bindings.ts
|
|
42201
42468
|
var BINDING_TARGET_TYPES = [
|
|
42202
42469
|
"github.pull_request",
|
|
@@ -43980,145 +44247,6 @@ var IdentitySpecSchema = AgentIdentitySchema;
|
|
|
43980
44247
|
var IdentityResourceSchema = resourceEnvelopeSchema(IdentitySpecSchema);
|
|
43981
44248
|
var IdentityApplyRequestSchema = resourceApplySchema(IdentitySpecSchema);
|
|
43982
44249
|
|
|
43983
|
-
// ../../packages/schemas/src/environments.ts
|
|
43984
|
-
var RESOURCE_KIND_ENVIRONMENT = "environment";
|
|
43985
|
-
var CURRENT_SANDBOX_USER_HOME = "/home/user";
|
|
43986
|
-
var LEGACY_SANDBOX_USER_HOMES = ["/home/auto", "/home/node"];
|
|
43987
|
-
var STORED_SANDBOX_USER_HOMES = [
|
|
43988
|
-
CURRENT_SANDBOX_USER_HOME,
|
|
43989
|
-
...LEGACY_SANDBOX_USER_HOMES
|
|
43990
|
-
];
|
|
43991
|
-
var EnvironmentSetupCachePathSchema = external_exports.string().trim().refine((value2) => isSafeSandboxUserHomePath(value2), {
|
|
43992
|
-
message: `Expected an absolute path under ${CURRENT_SANDBOX_USER_HOME}`
|
|
43993
|
-
});
|
|
43994
|
-
var StoredEnvironmentSetupCachePathSchema = external_exports.string().trim().refine(
|
|
43995
|
-
(value2) => isSafeSandboxUserHomePath(value2, {
|
|
43996
|
-
allowedHomes: STORED_SANDBOX_USER_HOMES
|
|
43997
|
-
}),
|
|
43998
|
-
{
|
|
43999
|
-
message: `Expected an absolute path under ${CURRENT_SANDBOX_USER_HOME}`
|
|
44000
|
-
}
|
|
44001
|
-
);
|
|
44002
|
-
var EnvironmentImageSchema = external_exports.discriminatedUnion("kind", [
|
|
44003
|
-
external_exports.object({
|
|
44004
|
-
kind: external_exports.literal("preset"),
|
|
44005
|
-
name: ResourceNameSchema
|
|
44006
|
-
}).strict(),
|
|
44007
|
-
external_exports.object({
|
|
44008
|
-
kind: external_exports.literal("base"),
|
|
44009
|
-
ref: external_exports.string().trim().min(1).max(512).refine(isSafeBaseImageRef, {
|
|
44010
|
-
message: "Expected a single Docker/OCI image reference"
|
|
44011
|
-
})
|
|
44012
|
-
}).strict()
|
|
44013
|
-
]);
|
|
44014
|
-
var StoredEnvironmentImageSchema = external_exports.discriminatedUnion("kind", [
|
|
44015
|
-
external_exports.object({
|
|
44016
|
-
kind: external_exports.literal("preset"),
|
|
44017
|
-
name: external_exports.string().trim().min(1)
|
|
44018
|
-
}).strict(),
|
|
44019
|
-
external_exports.object({
|
|
44020
|
-
kind: external_exports.literal("base"),
|
|
44021
|
-
ref: external_exports.string().trim().min(1).refine(isSafeBaseImageRef, {
|
|
44022
|
-
message: "Expected a single Docker/OCI image reference"
|
|
44023
|
-
})
|
|
44024
|
-
}).strict()
|
|
44025
|
-
]);
|
|
44026
|
-
var ENVIRONMENT_APPROVALS_MODES = ["bypass", "prompt"];
|
|
44027
|
-
var EnvironmentApprovalsSchema = external_exports.enum(ENVIRONMENT_APPROVALS_MODES);
|
|
44028
|
-
var EnvironmentSetupSchema = environmentSetupSchema(
|
|
44029
|
-
StoredEnvironmentSetupCachePathSchema
|
|
44030
|
-
);
|
|
44031
|
-
var EnvironmentApplySetupSchema = environmentSetupSchema(
|
|
44032
|
-
EnvironmentSetupCachePathSchema
|
|
44033
|
-
);
|
|
44034
|
-
var EnvironmentSetupCacheSchema = external_exports.object({
|
|
44035
|
-
ttl: external_exports.string().trim().refine(isSetupCacheTtl, {
|
|
44036
|
-
message: "Expected a positive setup cache TTL such as 30m, 24h, or 7d"
|
|
44037
|
-
})
|
|
44038
|
-
}).strict();
|
|
44039
|
-
var EnvironmentResourcesSchema = external_exports.object({
|
|
44040
|
-
cpuCount: external_exports.number().int().min(1).optional(),
|
|
44041
|
-
memoryMB: external_exports.number().int().min(128).optional()
|
|
44042
|
-
}).strict().refine(
|
|
44043
|
-
(resources) => resources.cpuCount !== void 0 || resources.memoryMB !== void 0,
|
|
44044
|
-
{
|
|
44045
|
-
message: "Expected at least one runtime resource setting"
|
|
44046
|
-
}
|
|
44047
|
-
);
|
|
44048
|
-
var EnvironmentSpecSchema = environmentSpecSchema({
|
|
44049
|
-
imageSchema: StoredEnvironmentImageSchema,
|
|
44050
|
-
setupSchema: EnvironmentSetupSchema
|
|
44051
|
-
});
|
|
44052
|
-
var EnvironmentApplySpecSchema = environmentSpecSchema({
|
|
44053
|
-
imageSchema: EnvironmentImageSchema,
|
|
44054
|
-
setupSchema: EnvironmentApplySetupSchema
|
|
44055
|
-
});
|
|
44056
|
-
var EnvironmentResourceSchema = resourceEnvelopeSchema(
|
|
44057
|
-
EnvironmentSpecSchema
|
|
44058
|
-
);
|
|
44059
|
-
var EnvironmentApplyRequestSchema = resourceApplySchema(
|
|
44060
|
-
EnvironmentApplySpecSchema
|
|
44061
|
-
);
|
|
44062
|
-
function environmentSetupSchema(cachePathSchema) {
|
|
44063
|
-
return external_exports.object({
|
|
44064
|
-
name: ResourceNameSchema,
|
|
44065
|
-
commands: external_exports.array(external_exports.string().trim().min(1)).min(1),
|
|
44066
|
-
cache: external_exports.object({
|
|
44067
|
-
key: ResourceNameSchema.optional(),
|
|
44068
|
-
files: external_exports.array(
|
|
44069
|
-
external_exports.string().trim().refine(isSafeRelativePath, {
|
|
44070
|
-
message: "Expected a relative path without traversal"
|
|
44071
|
-
})
|
|
44072
|
-
).default([]),
|
|
44073
|
-
paths: external_exports.array(cachePathSchema).default([])
|
|
44074
|
-
}).strict().default({ files: [], paths: [] })
|
|
44075
|
-
}).strict();
|
|
44076
|
-
}
|
|
44077
|
-
function environmentSpecSchema({
|
|
44078
|
-
imageSchema,
|
|
44079
|
-
setupSchema
|
|
44080
|
-
}) {
|
|
44081
|
-
return external_exports.object({
|
|
44082
|
-
image: imageSchema,
|
|
44083
|
-
env: SecretEnvSchema.default({}),
|
|
44084
|
-
resources: EnvironmentResourcesSchema.optional(),
|
|
44085
|
-
steps: external_exports.array(external_exports.string()).default([]),
|
|
44086
|
-
setup: external_exports.array(setupSchema).default([]),
|
|
44087
|
-
setupCache: EnvironmentSetupCacheSchema.optional(),
|
|
44088
|
-
// Optional rather than defaulted: a default would materialize the key
|
|
44089
|
-
// into stored specs and session environment snapshots the moment the web
|
|
44090
|
-
// app deploys, and this strict schema on a not-yet-deployed worker would
|
|
44091
|
-
// reject those rows (web and workers do not deploy atomically). Absent
|
|
44092
|
-
// means `bypass`; consumers default at the read boundary.
|
|
44093
|
-
approvals: EnvironmentApprovalsSchema.optional()
|
|
44094
|
-
}).strict();
|
|
44095
|
-
}
|
|
44096
|
-
function isSafeSandboxUserHomePath(value2, options = {}) {
|
|
44097
|
-
return (options.allowedHomes ?? [CURRENT_SANDBOX_USER_HOME]).some(
|
|
44098
|
-
(home) => isSafePathUnderHome(value2, home)
|
|
44099
|
-
);
|
|
44100
|
-
}
|
|
44101
|
-
function isSafePathUnderHome(value2, home) {
|
|
44102
|
-
const prefix = `${home}/`;
|
|
44103
|
-
if (!value2.startsWith(prefix)) {
|
|
44104
|
-
return false;
|
|
44105
|
-
}
|
|
44106
|
-
const relative2 = value2.slice(prefix.length);
|
|
44107
|
-
return relative2.split("/").every((segment) => segment !== "" && segment !== "." && segment !== "..");
|
|
44108
|
-
}
|
|
44109
|
-
function isSafeRelativePath(value2) {
|
|
44110
|
-
if (!value2 || value2.startsWith("/")) {
|
|
44111
|
-
return false;
|
|
44112
|
-
}
|
|
44113
|
-
return value2.split("/").every((segment) => segment !== "" && segment !== "." && segment !== "..");
|
|
44114
|
-
}
|
|
44115
|
-
function isSafeBaseImageRef(value2) {
|
|
44116
|
-
return !value2.startsWith("-") && /^[^\s#\\]+$/.test(value2);
|
|
44117
|
-
}
|
|
44118
|
-
function isSetupCacheTtl(value2) {
|
|
44119
|
-
return /^[1-9][0-9]*(s|m|h|d)$/.test(value2);
|
|
44120
|
-
}
|
|
44121
|
-
|
|
44122
44250
|
// ../../packages/schemas/src/environment-setup-failures.ts
|
|
44123
44251
|
var EnvironmentSetupStepFailureDiagnosticSchema = external_exports.object({
|
|
44124
44252
|
kind: external_exports.literal("environment_setup_step_failure"),
|
package/dist/index.js
CHANGED
|
@@ -15474,6 +15474,8 @@ var init_auth = __esm({
|
|
|
15474
15474
|
"tools:write",
|
|
15475
15475
|
"environments:read",
|
|
15476
15476
|
"environments:write",
|
|
15477
|
+
"runtimes:read",
|
|
15478
|
+
"runtimes:write",
|
|
15477
15479
|
"profiles:read",
|
|
15478
15480
|
"profiles:write",
|
|
15479
15481
|
"sessions:read",
|
|
@@ -15592,6 +15594,7 @@ var init_auth = __esm({
|
|
|
15592
15594
|
});
|
|
15593
15595
|
SERVICE_ACCOUNT_READ_ONLY_SCOPES = [
|
|
15594
15596
|
"environments:read",
|
|
15597
|
+
"runtimes:read",
|
|
15595
15598
|
"tools:read",
|
|
15596
15599
|
"agents:read",
|
|
15597
15600
|
"sessions:read",
|
|
@@ -18943,6 +18946,289 @@ var init_secrets = __esm({
|
|
|
18943
18946
|
}
|
|
18944
18947
|
});
|
|
18945
18948
|
|
|
18949
|
+
// ../../packages/schemas/src/environments.ts
|
|
18950
|
+
function environmentSetupSchema(cachePathSchema) {
|
|
18951
|
+
return external_exports.object({
|
|
18952
|
+
name: ResourceNameSchema,
|
|
18953
|
+
commands: external_exports.array(external_exports.string().trim().min(1)).min(1),
|
|
18954
|
+
cache: external_exports.object({
|
|
18955
|
+
key: ResourceNameSchema.optional(),
|
|
18956
|
+
files: external_exports.array(
|
|
18957
|
+
external_exports.string().trim().refine(isSafeRelativePath, {
|
|
18958
|
+
message: "Expected a relative path without traversal"
|
|
18959
|
+
})
|
|
18960
|
+
).default([]),
|
|
18961
|
+
paths: external_exports.array(cachePathSchema).default([])
|
|
18962
|
+
}).strict().default({ files: [], paths: [] })
|
|
18963
|
+
}).strict();
|
|
18964
|
+
}
|
|
18965
|
+
function environmentSpecSchema({
|
|
18966
|
+
imageSchema,
|
|
18967
|
+
setupSchema
|
|
18968
|
+
}) {
|
|
18969
|
+
return external_exports.object({
|
|
18970
|
+
image: imageSchema,
|
|
18971
|
+
env: SecretEnvSchema.default({}),
|
|
18972
|
+
resources: EnvironmentResourcesSchema.optional(),
|
|
18973
|
+
steps: external_exports.array(external_exports.string()).default([]),
|
|
18974
|
+
setup: external_exports.array(setupSchema).default([]),
|
|
18975
|
+
setupCache: EnvironmentSetupCacheSchema.optional(),
|
|
18976
|
+
// Optional rather than defaulted: a default would materialize the key
|
|
18977
|
+
// into stored specs and session environment snapshots the moment the web
|
|
18978
|
+
// app deploys, and this strict schema on a not-yet-deployed worker would
|
|
18979
|
+
// reject those rows (web and workers do not deploy atomically). Absent
|
|
18980
|
+
// means `bypass`; consumers default at the read boundary.
|
|
18981
|
+
approvals: EnvironmentApprovalsSchema.optional()
|
|
18982
|
+
}).strict();
|
|
18983
|
+
}
|
|
18984
|
+
function isSafeSandboxUserHomePath(value, options = {}) {
|
|
18985
|
+
return (options.allowedHomes ?? [CURRENT_SANDBOX_USER_HOME]).some(
|
|
18986
|
+
(home) => isSafePathUnderHome(value, home)
|
|
18987
|
+
);
|
|
18988
|
+
}
|
|
18989
|
+
function isSafePathUnderHome(value, home) {
|
|
18990
|
+
const prefix = `${home}/`;
|
|
18991
|
+
if (!value.startsWith(prefix)) {
|
|
18992
|
+
return false;
|
|
18993
|
+
}
|
|
18994
|
+
const relative2 = value.slice(prefix.length);
|
|
18995
|
+
return relative2.split("/").every((segment) => segment !== "" && segment !== "." && segment !== "..");
|
|
18996
|
+
}
|
|
18997
|
+
function isSafeRelativePath(value) {
|
|
18998
|
+
if (!value || value.startsWith("/")) {
|
|
18999
|
+
return false;
|
|
19000
|
+
}
|
|
19001
|
+
return value.split("/").every((segment) => segment !== "" && segment !== "." && segment !== "..");
|
|
19002
|
+
}
|
|
19003
|
+
function isSafeBaseImageRef(value) {
|
|
19004
|
+
return !value.startsWith("-") && /^[^\s#\\]+$/.test(value);
|
|
19005
|
+
}
|
|
19006
|
+
function isSetupCacheTtl(value) {
|
|
19007
|
+
return /^[1-9][0-9]*(s|m|h|d)$/.test(value);
|
|
19008
|
+
}
|
|
19009
|
+
var RESOURCE_KIND_ENVIRONMENT, CURRENT_SANDBOX_USER_HOME, LEGACY_SANDBOX_USER_HOMES, STORED_SANDBOX_USER_HOMES, EnvironmentSetupCachePathSchema, StoredEnvironmentSetupCachePathSchema, EnvironmentImageSchema, StoredEnvironmentImageSchema, ENVIRONMENT_APPROVALS_MODES, EnvironmentApprovalsSchema, EnvironmentSetupSchema, EnvironmentApplySetupSchema, EnvironmentSetupCacheSchema, EnvironmentResourcesSchema, EnvironmentSpecSchema, EnvironmentApplySpecSchema, EnvironmentCandidateSpecSchema, EnvironmentResourceSchema, EnvironmentApplyRequestSchema;
|
|
19010
|
+
var init_environments = __esm({
|
|
19011
|
+
"../../packages/schemas/src/environments.ts"() {
|
|
19012
|
+
"use strict";
|
|
19013
|
+
init_zod();
|
|
19014
|
+
init_resources();
|
|
19015
|
+
init_secrets();
|
|
19016
|
+
RESOURCE_KIND_ENVIRONMENT = "environment";
|
|
19017
|
+
CURRENT_SANDBOX_USER_HOME = "/home/user";
|
|
19018
|
+
LEGACY_SANDBOX_USER_HOMES = ["/home/auto", "/home/node"];
|
|
19019
|
+
STORED_SANDBOX_USER_HOMES = [
|
|
19020
|
+
CURRENT_SANDBOX_USER_HOME,
|
|
19021
|
+
...LEGACY_SANDBOX_USER_HOMES
|
|
19022
|
+
];
|
|
19023
|
+
EnvironmentSetupCachePathSchema = external_exports.string().trim().refine((value) => isSafeSandboxUserHomePath(value), {
|
|
19024
|
+
message: `Expected an absolute path under ${CURRENT_SANDBOX_USER_HOME}`
|
|
19025
|
+
});
|
|
19026
|
+
StoredEnvironmentSetupCachePathSchema = external_exports.string().trim().refine(
|
|
19027
|
+
(value) => isSafeSandboxUserHomePath(value, {
|
|
19028
|
+
allowedHomes: STORED_SANDBOX_USER_HOMES
|
|
19029
|
+
}),
|
|
19030
|
+
{
|
|
19031
|
+
message: `Expected an absolute path under ${CURRENT_SANDBOX_USER_HOME}`
|
|
19032
|
+
}
|
|
19033
|
+
);
|
|
19034
|
+
EnvironmentImageSchema = external_exports.discriminatedUnion("kind", [
|
|
19035
|
+
external_exports.object({
|
|
19036
|
+
kind: external_exports.literal("preset"),
|
|
19037
|
+
name: ResourceNameSchema
|
|
19038
|
+
}).strict(),
|
|
19039
|
+
external_exports.object({
|
|
19040
|
+
kind: external_exports.literal("base"),
|
|
19041
|
+
ref: external_exports.string().trim().min(1).max(512).refine(isSafeBaseImageRef, {
|
|
19042
|
+
message: "Expected a single Docker/OCI image reference"
|
|
19043
|
+
})
|
|
19044
|
+
}).strict()
|
|
19045
|
+
]);
|
|
19046
|
+
StoredEnvironmentImageSchema = external_exports.discriminatedUnion("kind", [
|
|
19047
|
+
external_exports.object({
|
|
19048
|
+
kind: external_exports.literal("preset"),
|
|
19049
|
+
name: external_exports.string().trim().min(1)
|
|
19050
|
+
}).strict(),
|
|
19051
|
+
external_exports.object({
|
|
19052
|
+
kind: external_exports.literal("base"),
|
|
19053
|
+
ref: external_exports.string().trim().min(1).refine(isSafeBaseImageRef, {
|
|
19054
|
+
message: "Expected a single Docker/OCI image reference"
|
|
19055
|
+
})
|
|
19056
|
+
}).strict()
|
|
19057
|
+
]);
|
|
19058
|
+
ENVIRONMENT_APPROVALS_MODES = ["bypass", "prompt"];
|
|
19059
|
+
EnvironmentApprovalsSchema = external_exports.enum(ENVIRONMENT_APPROVALS_MODES);
|
|
19060
|
+
EnvironmentSetupSchema = environmentSetupSchema(
|
|
19061
|
+
StoredEnvironmentSetupCachePathSchema
|
|
19062
|
+
);
|
|
19063
|
+
EnvironmentApplySetupSchema = environmentSetupSchema(
|
|
19064
|
+
EnvironmentSetupCachePathSchema
|
|
19065
|
+
);
|
|
19066
|
+
EnvironmentSetupCacheSchema = external_exports.object({
|
|
19067
|
+
ttl: external_exports.string().trim().refine(isSetupCacheTtl, {
|
|
19068
|
+
message: "Expected a positive setup cache TTL such as 30m, 24h, or 7d"
|
|
19069
|
+
})
|
|
19070
|
+
}).strict();
|
|
19071
|
+
EnvironmentResourcesSchema = external_exports.object({
|
|
19072
|
+
cpuCount: external_exports.number().int().min(1).optional(),
|
|
19073
|
+
memoryMB: external_exports.number().int().min(128).optional()
|
|
19074
|
+
}).strict().refine(
|
|
19075
|
+
(resources) => resources.cpuCount !== void 0 || resources.memoryMB !== void 0,
|
|
19076
|
+
{
|
|
19077
|
+
message: "Expected at least one runtime resource setting"
|
|
19078
|
+
}
|
|
19079
|
+
);
|
|
19080
|
+
EnvironmentSpecSchema = environmentSpecSchema({
|
|
19081
|
+
imageSchema: StoredEnvironmentImageSchema,
|
|
19082
|
+
setupSchema: EnvironmentSetupSchema
|
|
19083
|
+
});
|
|
19084
|
+
EnvironmentApplySpecSchema = environmentSpecSchema({
|
|
19085
|
+
imageSchema: EnvironmentImageSchema,
|
|
19086
|
+
setupSchema: EnvironmentApplySetupSchema
|
|
19087
|
+
});
|
|
19088
|
+
EnvironmentCandidateSpecSchema = EnvironmentApplySpecSchema;
|
|
19089
|
+
EnvironmentResourceSchema = resourceEnvelopeSchema(
|
|
19090
|
+
EnvironmentSpecSchema
|
|
19091
|
+
);
|
|
19092
|
+
EnvironmentApplyRequestSchema = resourceApplySchema(
|
|
19093
|
+
EnvironmentApplySpecSchema
|
|
19094
|
+
);
|
|
19095
|
+
}
|
|
19096
|
+
});
|
|
19097
|
+
|
|
19098
|
+
// ../../packages/schemas/src/hosted-runtimes.ts
|
|
19099
|
+
var HOSTED_RUNTIME_STATUSES, HOSTED_RUNTIME_OUTCOMES, HOSTED_RUNTIME_COMMAND_STATUSES, HOSTED_RUNTIME_CLOSE_REASONS, HOSTED_RUNTIME_MAX_COMMAND_BUDGET_SECONDS, HostedRuntimeEnvironmentInputSchema, HostedRuntimeEnvironmentSourceSchema, HostedRuntimeEnvironmentSnapshotSchema, HostedRuntimeCommandInputSchema, HostedRuntimeIdempotencyKeySchema, CreateHostedRuntimeRequestSchema, HostedRuntimeStatusSchema, HostedRuntimeOutcomeSchema, HostedRuntimeCommandStatusSchema, HostedRuntimeCloseReasonSchema, HostedRuntimeCommandRecordSchema, HostedRuntimeRecordSchema, HostedRuntimeDispatchStatusSchema, HostedRuntimeReceiptSchema, HostedRuntimeWorkflowInputSchema;
|
|
19100
|
+
var init_hosted_runtimes = __esm({
|
|
19101
|
+
"../../packages/schemas/src/hosted-runtimes.ts"() {
|
|
19102
|
+
"use strict";
|
|
19103
|
+
init_zod();
|
|
19104
|
+
init_environments();
|
|
19105
|
+
init_ids();
|
|
19106
|
+
init_resources();
|
|
19107
|
+
HOSTED_RUNTIME_STATUSES = [
|
|
19108
|
+
"queued",
|
|
19109
|
+
"provisioning",
|
|
19110
|
+
"running",
|
|
19111
|
+
"closing",
|
|
19112
|
+
"closed"
|
|
19113
|
+
];
|
|
19114
|
+
HOSTED_RUNTIME_OUTCOMES = [
|
|
19115
|
+
"succeeded",
|
|
19116
|
+
"failed",
|
|
19117
|
+
"cancelled"
|
|
19118
|
+
];
|
|
19119
|
+
HOSTED_RUNTIME_COMMAND_STATUSES = [
|
|
19120
|
+
"pending",
|
|
19121
|
+
"running",
|
|
19122
|
+
"succeeded",
|
|
19123
|
+
"failed",
|
|
19124
|
+
"cancelled"
|
|
19125
|
+
];
|
|
19126
|
+
HOSTED_RUNTIME_CLOSE_REASONS = [
|
|
19127
|
+
"completed",
|
|
19128
|
+
"command_failed",
|
|
19129
|
+
"provision_failed",
|
|
19130
|
+
"requested",
|
|
19131
|
+
"internal_error"
|
|
19132
|
+
];
|
|
19133
|
+
HOSTED_RUNTIME_MAX_COMMAND_BUDGET_SECONDS = 45 * 60;
|
|
19134
|
+
HostedRuntimeEnvironmentInputSchema = external_exports.discriminatedUnion(
|
|
19135
|
+
"kind",
|
|
19136
|
+
[
|
|
19137
|
+
external_exports.object({
|
|
19138
|
+
kind: external_exports.literal("inline"),
|
|
19139
|
+
spec: EnvironmentCandidateSpecSchema
|
|
19140
|
+
}).strict(),
|
|
19141
|
+
external_exports.object({
|
|
19142
|
+
kind: external_exports.literal("applied"),
|
|
19143
|
+
name: ResourceNameSchema
|
|
19144
|
+
}).strict()
|
|
19145
|
+
]
|
|
19146
|
+
);
|
|
19147
|
+
HostedRuntimeEnvironmentSourceSchema = external_exports.discriminatedUnion(
|
|
19148
|
+
"kind",
|
|
19149
|
+
[
|
|
19150
|
+
external_exports.object({ kind: external_exports.literal("inline") }).strict(),
|
|
19151
|
+
external_exports.object({
|
|
19152
|
+
kind: external_exports.literal("applied"),
|
|
19153
|
+
name: ResourceNameSchema,
|
|
19154
|
+
resourceId: external_exports.string().trim().min(1),
|
|
19155
|
+
generation: external_exports.number().int().positive()
|
|
19156
|
+
}).strict()
|
|
19157
|
+
]
|
|
19158
|
+
);
|
|
19159
|
+
HostedRuntimeEnvironmentSnapshotSchema = external_exports.object({
|
|
19160
|
+
source: HostedRuntimeEnvironmentSourceSchema,
|
|
19161
|
+
spec: EnvironmentSpecSchema
|
|
19162
|
+
}).strict();
|
|
19163
|
+
HostedRuntimeCommandInputSchema = external_exports.object({
|
|
19164
|
+
command: external_exports.string().trim().min(1).max(4096),
|
|
19165
|
+
timeoutSeconds: external_exports.number().int().min(1).max(300).default(60)
|
|
19166
|
+
}).strict();
|
|
19167
|
+
HostedRuntimeIdempotencyKeySchema = external_exports.string().trim().min(1).max(200);
|
|
19168
|
+
CreateHostedRuntimeRequestSchema = external_exports.object({
|
|
19169
|
+
environment: HostedRuntimeEnvironmentInputSchema,
|
|
19170
|
+
commands: external_exports.array(HostedRuntimeCommandInputSchema).min(1).max(20)
|
|
19171
|
+
}).strict().superRefine((request, context) => {
|
|
19172
|
+
const totalTimeoutSeconds = request.commands.reduce(
|
|
19173
|
+
(total, command) => total + command.timeoutSeconds,
|
|
19174
|
+
0
|
|
19175
|
+
);
|
|
19176
|
+
if (totalTimeoutSeconds > HOSTED_RUNTIME_MAX_COMMAND_BUDGET_SECONDS) {
|
|
19177
|
+
context.addIssue({
|
|
19178
|
+
code: "custom",
|
|
19179
|
+
message: `Total command timeout must not exceed ${HOSTED_RUNTIME_MAX_COMMAND_BUDGET_SECONDS} seconds`,
|
|
19180
|
+
path: ["commands"]
|
|
19181
|
+
});
|
|
19182
|
+
}
|
|
19183
|
+
});
|
|
19184
|
+
HostedRuntimeStatusSchema = external_exports.enum(HOSTED_RUNTIME_STATUSES);
|
|
19185
|
+
HostedRuntimeOutcomeSchema = external_exports.enum(HOSTED_RUNTIME_OUTCOMES);
|
|
19186
|
+
HostedRuntimeCommandStatusSchema = external_exports.enum(
|
|
19187
|
+
HOSTED_RUNTIME_COMMAND_STATUSES
|
|
19188
|
+
);
|
|
19189
|
+
HostedRuntimeCloseReasonSchema = external_exports.enum(
|
|
19190
|
+
HOSTED_RUNTIME_CLOSE_REASONS
|
|
19191
|
+
);
|
|
19192
|
+
HostedRuntimeCommandRecordSchema = external_exports.object({
|
|
19193
|
+
ordinal: external_exports.number().int().positive(),
|
|
19194
|
+
command: external_exports.string(),
|
|
19195
|
+
timeoutSeconds: external_exports.number().int().positive(),
|
|
19196
|
+
status: HostedRuntimeCommandStatusSchema,
|
|
19197
|
+
startedAt: external_exports.string().datetime().nullable(),
|
|
19198
|
+
finishedAt: external_exports.string().datetime().nullable(),
|
|
19199
|
+
durationMs: external_exports.number().int().nonnegative().nullable(),
|
|
19200
|
+
exitCode: external_exports.number().int().nullable(),
|
|
19201
|
+
stdout: external_exports.string().nullable(),
|
|
19202
|
+
stderr: external_exports.string().nullable(),
|
|
19203
|
+
error: external_exports.string().nullable()
|
|
19204
|
+
}).strict();
|
|
19205
|
+
HostedRuntimeRecordSchema = external_exports.object({
|
|
19206
|
+
id: RuntimeIdSchema,
|
|
19207
|
+
status: HostedRuntimeStatusSchema,
|
|
19208
|
+
outcome: HostedRuntimeOutcomeSchema.nullable(),
|
|
19209
|
+
environment: HostedRuntimeEnvironmentSourceSchema,
|
|
19210
|
+
commands: external_exports.array(HostedRuntimeCommandRecordSchema),
|
|
19211
|
+
error: external_exports.string().nullable(),
|
|
19212
|
+
closeReason: HostedRuntimeCloseReasonSchema.nullable(),
|
|
19213
|
+
closeRequestedAt: external_exports.string().datetime().nullable(),
|
|
19214
|
+
startedAt: external_exports.string().datetime().nullable(),
|
|
19215
|
+
finishedAt: external_exports.string().datetime().nullable(),
|
|
19216
|
+
createdAt: external_exports.string().datetime(),
|
|
19217
|
+
updatedAt: external_exports.string().datetime()
|
|
19218
|
+
}).strict();
|
|
19219
|
+
HostedRuntimeDispatchStatusSchema = external_exports.enum([
|
|
19220
|
+
"started",
|
|
19221
|
+
"deferred"
|
|
19222
|
+
]);
|
|
19223
|
+
HostedRuntimeReceiptSchema = external_exports.object({
|
|
19224
|
+
runtime: HostedRuntimeRecordSchema,
|
|
19225
|
+
workflowId: external_exports.string().trim().min(1),
|
|
19226
|
+
dispatchStatus: HostedRuntimeDispatchStatusSchema
|
|
19227
|
+
}).strict();
|
|
19228
|
+
HostedRuntimeWorkflowInputSchema = external_exports.object({ runtimeId: RuntimeIdSchema }).strip();
|
|
19229
|
+
}
|
|
19230
|
+
});
|
|
19231
|
+
|
|
18946
19232
|
// ../../packages/schemas/src/session-bindings.ts
|
|
18947
19233
|
var BINDING_TARGET_TYPES, TRIGGER_BINDING_TARGET_TYPES, OWNER_RELEASABLE_HELD_BINDING_TARGET_TYPES, OBSERVED_TARGET_EVENT_KEYS, SESSION_BINDING_SOURCES, SESSION_BINDING_STATUSES, SESSION_BINDING_RELEASE_POLICIES, SESSION_BINDING_CONTINUITIES, SESSION_BINDING_RELEASED_BY, BINDING_TRANSITION_CAUSES, BindingTargetTypeSchema, TriggerBindingTargetTypeSchema, OwnerReleasableHeldBindingTargetTypeSchema, SessionBindingSourceSchema, SessionBindingStatusSchema, SessionBindingReleasePolicySchema, SessionBindingContinuitySchema, SessionBindingReleasedBySchema, BindingTransitionCauseSchema, BindingTargetSchema, BINDING_AUTO_BIND_VALUES, BindingAutoBindSchema, AUTO_BIND_LEGAL_TARGETS;
|
|
18948
19234
|
var init_session_bindings = __esm({
|
|
@@ -20883,154 +21169,6 @@ var init_identities = __esm({
|
|
|
20883
21169
|
}
|
|
20884
21170
|
});
|
|
20885
21171
|
|
|
20886
|
-
// ../../packages/schemas/src/environments.ts
|
|
20887
|
-
function environmentSetupSchema(cachePathSchema) {
|
|
20888
|
-
return external_exports.object({
|
|
20889
|
-
name: ResourceNameSchema,
|
|
20890
|
-
commands: external_exports.array(external_exports.string().trim().min(1)).min(1),
|
|
20891
|
-
cache: external_exports.object({
|
|
20892
|
-
key: ResourceNameSchema.optional(),
|
|
20893
|
-
files: external_exports.array(
|
|
20894
|
-
external_exports.string().trim().refine(isSafeRelativePath, {
|
|
20895
|
-
message: "Expected a relative path without traversal"
|
|
20896
|
-
})
|
|
20897
|
-
).default([]),
|
|
20898
|
-
paths: external_exports.array(cachePathSchema).default([])
|
|
20899
|
-
}).strict().default({ files: [], paths: [] })
|
|
20900
|
-
}).strict();
|
|
20901
|
-
}
|
|
20902
|
-
function environmentSpecSchema({
|
|
20903
|
-
imageSchema,
|
|
20904
|
-
setupSchema
|
|
20905
|
-
}) {
|
|
20906
|
-
return external_exports.object({
|
|
20907
|
-
image: imageSchema,
|
|
20908
|
-
env: SecretEnvSchema.default({}),
|
|
20909
|
-
resources: EnvironmentResourcesSchema.optional(),
|
|
20910
|
-
steps: external_exports.array(external_exports.string()).default([]),
|
|
20911
|
-
setup: external_exports.array(setupSchema).default([]),
|
|
20912
|
-
setupCache: EnvironmentSetupCacheSchema.optional(),
|
|
20913
|
-
// Optional rather than defaulted: a default would materialize the key
|
|
20914
|
-
// into stored specs and session environment snapshots the moment the web
|
|
20915
|
-
// app deploys, and this strict schema on a not-yet-deployed worker would
|
|
20916
|
-
// reject those rows (web and workers do not deploy atomically). Absent
|
|
20917
|
-
// means `bypass`; consumers default at the read boundary.
|
|
20918
|
-
approvals: EnvironmentApprovalsSchema.optional()
|
|
20919
|
-
}).strict();
|
|
20920
|
-
}
|
|
20921
|
-
function isSafeSandboxUserHomePath(value, options = {}) {
|
|
20922
|
-
return (options.allowedHomes ?? [CURRENT_SANDBOX_USER_HOME]).some(
|
|
20923
|
-
(home) => isSafePathUnderHome(value, home)
|
|
20924
|
-
);
|
|
20925
|
-
}
|
|
20926
|
-
function isSafePathUnderHome(value, home) {
|
|
20927
|
-
const prefix = `${home}/`;
|
|
20928
|
-
if (!value.startsWith(prefix)) {
|
|
20929
|
-
return false;
|
|
20930
|
-
}
|
|
20931
|
-
const relative2 = value.slice(prefix.length);
|
|
20932
|
-
return relative2.split("/").every((segment) => segment !== "" && segment !== "." && segment !== "..");
|
|
20933
|
-
}
|
|
20934
|
-
function isSafeRelativePath(value) {
|
|
20935
|
-
if (!value || value.startsWith("/")) {
|
|
20936
|
-
return false;
|
|
20937
|
-
}
|
|
20938
|
-
return value.split("/").every((segment) => segment !== "" && segment !== "." && segment !== "..");
|
|
20939
|
-
}
|
|
20940
|
-
function isSafeBaseImageRef(value) {
|
|
20941
|
-
return !value.startsWith("-") && /^[^\s#\\]+$/.test(value);
|
|
20942
|
-
}
|
|
20943
|
-
function isSetupCacheTtl(value) {
|
|
20944
|
-
return /^[1-9][0-9]*(s|m|h|d)$/.test(value);
|
|
20945
|
-
}
|
|
20946
|
-
var RESOURCE_KIND_ENVIRONMENT, CURRENT_SANDBOX_USER_HOME, LEGACY_SANDBOX_USER_HOMES, STORED_SANDBOX_USER_HOMES, EnvironmentSetupCachePathSchema, StoredEnvironmentSetupCachePathSchema, EnvironmentImageSchema, StoredEnvironmentImageSchema, ENVIRONMENT_APPROVALS_MODES, EnvironmentApprovalsSchema, EnvironmentSetupSchema, EnvironmentApplySetupSchema, EnvironmentSetupCacheSchema, EnvironmentResourcesSchema, EnvironmentSpecSchema, EnvironmentApplySpecSchema, EnvironmentResourceSchema, EnvironmentApplyRequestSchema;
|
|
20947
|
-
var init_environments = __esm({
|
|
20948
|
-
"../../packages/schemas/src/environments.ts"() {
|
|
20949
|
-
"use strict";
|
|
20950
|
-
init_zod();
|
|
20951
|
-
init_resources();
|
|
20952
|
-
init_secrets();
|
|
20953
|
-
RESOURCE_KIND_ENVIRONMENT = "environment";
|
|
20954
|
-
CURRENT_SANDBOX_USER_HOME = "/home/user";
|
|
20955
|
-
LEGACY_SANDBOX_USER_HOMES = ["/home/auto", "/home/node"];
|
|
20956
|
-
STORED_SANDBOX_USER_HOMES = [
|
|
20957
|
-
CURRENT_SANDBOX_USER_HOME,
|
|
20958
|
-
...LEGACY_SANDBOX_USER_HOMES
|
|
20959
|
-
];
|
|
20960
|
-
EnvironmentSetupCachePathSchema = external_exports.string().trim().refine((value) => isSafeSandboxUserHomePath(value), {
|
|
20961
|
-
message: `Expected an absolute path under ${CURRENT_SANDBOX_USER_HOME}`
|
|
20962
|
-
});
|
|
20963
|
-
StoredEnvironmentSetupCachePathSchema = external_exports.string().trim().refine(
|
|
20964
|
-
(value) => isSafeSandboxUserHomePath(value, {
|
|
20965
|
-
allowedHomes: STORED_SANDBOX_USER_HOMES
|
|
20966
|
-
}),
|
|
20967
|
-
{
|
|
20968
|
-
message: `Expected an absolute path under ${CURRENT_SANDBOX_USER_HOME}`
|
|
20969
|
-
}
|
|
20970
|
-
);
|
|
20971
|
-
EnvironmentImageSchema = external_exports.discriminatedUnion("kind", [
|
|
20972
|
-
external_exports.object({
|
|
20973
|
-
kind: external_exports.literal("preset"),
|
|
20974
|
-
name: ResourceNameSchema
|
|
20975
|
-
}).strict(),
|
|
20976
|
-
external_exports.object({
|
|
20977
|
-
kind: external_exports.literal("base"),
|
|
20978
|
-
ref: external_exports.string().trim().min(1).max(512).refine(isSafeBaseImageRef, {
|
|
20979
|
-
message: "Expected a single Docker/OCI image reference"
|
|
20980
|
-
})
|
|
20981
|
-
}).strict()
|
|
20982
|
-
]);
|
|
20983
|
-
StoredEnvironmentImageSchema = external_exports.discriminatedUnion("kind", [
|
|
20984
|
-
external_exports.object({
|
|
20985
|
-
kind: external_exports.literal("preset"),
|
|
20986
|
-
name: external_exports.string().trim().min(1)
|
|
20987
|
-
}).strict(),
|
|
20988
|
-
external_exports.object({
|
|
20989
|
-
kind: external_exports.literal("base"),
|
|
20990
|
-
ref: external_exports.string().trim().min(1).refine(isSafeBaseImageRef, {
|
|
20991
|
-
message: "Expected a single Docker/OCI image reference"
|
|
20992
|
-
})
|
|
20993
|
-
}).strict()
|
|
20994
|
-
]);
|
|
20995
|
-
ENVIRONMENT_APPROVALS_MODES = ["bypass", "prompt"];
|
|
20996
|
-
EnvironmentApprovalsSchema = external_exports.enum(ENVIRONMENT_APPROVALS_MODES);
|
|
20997
|
-
EnvironmentSetupSchema = environmentSetupSchema(
|
|
20998
|
-
StoredEnvironmentSetupCachePathSchema
|
|
20999
|
-
);
|
|
21000
|
-
EnvironmentApplySetupSchema = environmentSetupSchema(
|
|
21001
|
-
EnvironmentSetupCachePathSchema
|
|
21002
|
-
);
|
|
21003
|
-
EnvironmentSetupCacheSchema = external_exports.object({
|
|
21004
|
-
ttl: external_exports.string().trim().refine(isSetupCacheTtl, {
|
|
21005
|
-
message: "Expected a positive setup cache TTL such as 30m, 24h, or 7d"
|
|
21006
|
-
})
|
|
21007
|
-
}).strict();
|
|
21008
|
-
EnvironmentResourcesSchema = external_exports.object({
|
|
21009
|
-
cpuCount: external_exports.number().int().min(1).optional(),
|
|
21010
|
-
memoryMB: external_exports.number().int().min(128).optional()
|
|
21011
|
-
}).strict().refine(
|
|
21012
|
-
(resources) => resources.cpuCount !== void 0 || resources.memoryMB !== void 0,
|
|
21013
|
-
{
|
|
21014
|
-
message: "Expected at least one runtime resource setting"
|
|
21015
|
-
}
|
|
21016
|
-
);
|
|
21017
|
-
EnvironmentSpecSchema = environmentSpecSchema({
|
|
21018
|
-
imageSchema: StoredEnvironmentImageSchema,
|
|
21019
|
-
setupSchema: EnvironmentSetupSchema
|
|
21020
|
-
});
|
|
21021
|
-
EnvironmentApplySpecSchema = environmentSpecSchema({
|
|
21022
|
-
imageSchema: EnvironmentImageSchema,
|
|
21023
|
-
setupSchema: EnvironmentApplySetupSchema
|
|
21024
|
-
});
|
|
21025
|
-
EnvironmentResourceSchema = resourceEnvelopeSchema(
|
|
21026
|
-
EnvironmentSpecSchema
|
|
21027
|
-
);
|
|
21028
|
-
EnvironmentApplyRequestSchema = resourceApplySchema(
|
|
21029
|
-
EnvironmentApplySpecSchema
|
|
21030
|
-
);
|
|
21031
|
-
}
|
|
21032
|
-
});
|
|
21033
|
-
|
|
21034
21172
|
// ../../packages/schemas/src/environment-setup-failures.ts
|
|
21035
21173
|
var EnvironmentSetupStepFailureDiagnosticSchema, PersistedEnvironmentSetupStepFailureDiagnosticSchema;
|
|
21036
21174
|
var init_environment_setup_failures = __esm({
|
|
@@ -90213,6 +90351,7 @@ var init_src = __esm({
|
|
|
90213
90351
|
init_github_sync();
|
|
90214
90352
|
init_github_credentials();
|
|
90215
90353
|
init_github_mcp_catalog();
|
|
90354
|
+
init_hosted_runtimes();
|
|
90216
90355
|
init_identities();
|
|
90217
90356
|
init_ids();
|
|
90218
90357
|
init_environments();
|
|
@@ -93030,7 +93169,7 @@ var init_package = __esm({
|
|
|
93030
93169
|
"package.json"() {
|
|
93031
93170
|
package_default = {
|
|
93032
93171
|
name: "@autohq/cli",
|
|
93033
|
-
version: "0.1.
|
|
93172
|
+
version: "0.1.610",
|
|
93034
93173
|
license: "SEE LICENSE IN README.md",
|
|
93035
93174
|
publishConfig: {
|
|
93036
93175
|
access: "public"
|