@autohq/cli 0.1.608 → 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 -112
- package/dist/index.js +289 -122
- 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,117 +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.object({
|
|
44003
|
-
kind: external_exports.literal("preset"),
|
|
44004
|
-
name: ResourceNameSchema
|
|
44005
|
-
}).strict();
|
|
44006
|
-
var ENVIRONMENT_APPROVALS_MODES = ["bypass", "prompt"];
|
|
44007
|
-
var EnvironmentApprovalsSchema = external_exports.enum(ENVIRONMENT_APPROVALS_MODES);
|
|
44008
|
-
var EnvironmentSetupSchema = environmentSetupSchema(
|
|
44009
|
-
StoredEnvironmentSetupCachePathSchema
|
|
44010
|
-
);
|
|
44011
|
-
var EnvironmentApplySetupSchema = environmentSetupSchema(
|
|
44012
|
-
EnvironmentSetupCachePathSchema
|
|
44013
|
-
);
|
|
44014
|
-
var EnvironmentSetupCacheSchema = external_exports.object({
|
|
44015
|
-
ttl: external_exports.string().trim().refine(isSetupCacheTtl, {
|
|
44016
|
-
message: "Expected a positive setup cache TTL such as 30m, 24h, or 7d"
|
|
44017
|
-
})
|
|
44018
|
-
}).strict();
|
|
44019
|
-
var EnvironmentResourcesSchema = external_exports.object({
|
|
44020
|
-
cpuCount: external_exports.number().int().min(1).optional(),
|
|
44021
|
-
memoryMB: external_exports.number().int().min(128).optional()
|
|
44022
|
-
}).strict().refine(
|
|
44023
|
-
(resources) => resources.cpuCount !== void 0 || resources.memoryMB !== void 0,
|
|
44024
|
-
{
|
|
44025
|
-
message: "Expected at least one runtime resource setting"
|
|
44026
|
-
}
|
|
44027
|
-
);
|
|
44028
|
-
var EnvironmentSpecSchema = environmentSpecSchema(
|
|
44029
|
-
EnvironmentSetupSchema
|
|
44030
|
-
);
|
|
44031
|
-
var EnvironmentApplySpecSchema = environmentSpecSchema(
|
|
44032
|
-
EnvironmentApplySetupSchema
|
|
44033
|
-
);
|
|
44034
|
-
var EnvironmentResourceSchema = resourceEnvelopeSchema(
|
|
44035
|
-
EnvironmentSpecSchema
|
|
44036
|
-
);
|
|
44037
|
-
var EnvironmentApplyRequestSchema = resourceApplySchema(
|
|
44038
|
-
EnvironmentApplySpecSchema
|
|
44039
|
-
);
|
|
44040
|
-
function environmentSetupSchema(cachePathSchema) {
|
|
44041
|
-
return external_exports.object({
|
|
44042
|
-
name: ResourceNameSchema,
|
|
44043
|
-
commands: external_exports.array(external_exports.string().trim().min(1)).min(1),
|
|
44044
|
-
cache: external_exports.object({
|
|
44045
|
-
key: ResourceNameSchema.optional(),
|
|
44046
|
-
files: external_exports.array(
|
|
44047
|
-
external_exports.string().trim().refine(isSafeRelativePath, {
|
|
44048
|
-
message: "Expected a relative path without traversal"
|
|
44049
|
-
})
|
|
44050
|
-
).default([]),
|
|
44051
|
-
paths: external_exports.array(cachePathSchema).default([])
|
|
44052
|
-
}).strict().default({ files: [], paths: [] })
|
|
44053
|
-
}).strict();
|
|
44054
|
-
}
|
|
44055
|
-
function environmentSpecSchema(setupSchema) {
|
|
44056
|
-
return external_exports.object({
|
|
44057
|
-
image: EnvironmentImageSchema,
|
|
44058
|
-
env: SecretEnvSchema.default({}),
|
|
44059
|
-
resources: EnvironmentResourcesSchema.optional(),
|
|
44060
|
-
steps: external_exports.array(external_exports.string()).default([]),
|
|
44061
|
-
setup: external_exports.array(setupSchema).default([]),
|
|
44062
|
-
setupCache: EnvironmentSetupCacheSchema.optional(),
|
|
44063
|
-
// Optional rather than defaulted: a default would materialize the key
|
|
44064
|
-
// into stored specs and session environment snapshots the moment the web
|
|
44065
|
-
// app deploys, and this strict schema on a not-yet-deployed worker would
|
|
44066
|
-
// reject those rows (web and workers do not deploy atomically). Absent
|
|
44067
|
-
// means `bypass`; consumers default at the read boundary.
|
|
44068
|
-
approvals: EnvironmentApprovalsSchema.optional()
|
|
44069
|
-
}).strict();
|
|
44070
|
-
}
|
|
44071
|
-
function isSafeSandboxUserHomePath(value2, options = {}) {
|
|
44072
|
-
return (options.allowedHomes ?? [CURRENT_SANDBOX_USER_HOME]).some(
|
|
44073
|
-
(home) => isSafePathUnderHome(value2, home)
|
|
44074
|
-
);
|
|
44075
|
-
}
|
|
44076
|
-
function isSafePathUnderHome(value2, home) {
|
|
44077
|
-
const prefix = `${home}/`;
|
|
44078
|
-
if (!value2.startsWith(prefix)) {
|
|
44079
|
-
return false;
|
|
44080
|
-
}
|
|
44081
|
-
const relative2 = value2.slice(prefix.length);
|
|
44082
|
-
return relative2.split("/").every((segment) => segment !== "" && segment !== "." && segment !== "..");
|
|
44083
|
-
}
|
|
44084
|
-
function isSafeRelativePath(value2) {
|
|
44085
|
-
if (!value2 || value2.startsWith("/")) {
|
|
44086
|
-
return false;
|
|
44087
|
-
}
|
|
44088
|
-
return value2.split("/").every((segment) => segment !== "" && segment !== "." && segment !== "..");
|
|
44089
|
-
}
|
|
44090
|
-
function isSetupCacheTtl(value2) {
|
|
44091
|
-
return /^[1-9][0-9]*(s|m|h|d)$/.test(value2);
|
|
44092
|
-
}
|
|
44093
|
-
|
|
44094
44250
|
// ../../packages/schemas/src/environment-setup-failures.ts
|
|
44095
44251
|
var EnvironmentSetupStepFailureDiagnosticSchema = external_exports.object({
|
|
44096
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,126 +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(setupSchema) {
|
|
20903
|
-
return external_exports.object({
|
|
20904
|
-
image: EnvironmentImageSchema,
|
|
20905
|
-
env: SecretEnvSchema.default({}),
|
|
20906
|
-
resources: EnvironmentResourcesSchema.optional(),
|
|
20907
|
-
steps: external_exports.array(external_exports.string()).default([]),
|
|
20908
|
-
setup: external_exports.array(setupSchema).default([]),
|
|
20909
|
-
setupCache: EnvironmentSetupCacheSchema.optional(),
|
|
20910
|
-
// Optional rather than defaulted: a default would materialize the key
|
|
20911
|
-
// into stored specs and session environment snapshots the moment the web
|
|
20912
|
-
// app deploys, and this strict schema on a not-yet-deployed worker would
|
|
20913
|
-
// reject those rows (web and workers do not deploy atomically). Absent
|
|
20914
|
-
// means `bypass`; consumers default at the read boundary.
|
|
20915
|
-
approvals: EnvironmentApprovalsSchema.optional()
|
|
20916
|
-
}).strict();
|
|
20917
|
-
}
|
|
20918
|
-
function isSafeSandboxUserHomePath(value, options = {}) {
|
|
20919
|
-
return (options.allowedHomes ?? [CURRENT_SANDBOX_USER_HOME]).some(
|
|
20920
|
-
(home) => isSafePathUnderHome(value, home)
|
|
20921
|
-
);
|
|
20922
|
-
}
|
|
20923
|
-
function isSafePathUnderHome(value, home) {
|
|
20924
|
-
const prefix = `${home}/`;
|
|
20925
|
-
if (!value.startsWith(prefix)) {
|
|
20926
|
-
return false;
|
|
20927
|
-
}
|
|
20928
|
-
const relative2 = value.slice(prefix.length);
|
|
20929
|
-
return relative2.split("/").every((segment) => segment !== "" && segment !== "." && segment !== "..");
|
|
20930
|
-
}
|
|
20931
|
-
function isSafeRelativePath(value) {
|
|
20932
|
-
if (!value || value.startsWith("/")) {
|
|
20933
|
-
return false;
|
|
20934
|
-
}
|
|
20935
|
-
return value.split("/").every((segment) => segment !== "" && segment !== "." && segment !== "..");
|
|
20936
|
-
}
|
|
20937
|
-
function isSetupCacheTtl(value) {
|
|
20938
|
-
return /^[1-9][0-9]*(s|m|h|d)$/.test(value);
|
|
20939
|
-
}
|
|
20940
|
-
var RESOURCE_KIND_ENVIRONMENT, CURRENT_SANDBOX_USER_HOME, LEGACY_SANDBOX_USER_HOMES, STORED_SANDBOX_USER_HOMES, EnvironmentSetupCachePathSchema, StoredEnvironmentSetupCachePathSchema, EnvironmentImageSchema, ENVIRONMENT_APPROVALS_MODES, EnvironmentApprovalsSchema, EnvironmentSetupSchema, EnvironmentApplySetupSchema, EnvironmentSetupCacheSchema, EnvironmentResourcesSchema, EnvironmentSpecSchema, EnvironmentApplySpecSchema, EnvironmentResourceSchema, EnvironmentApplyRequestSchema;
|
|
20941
|
-
var init_environments = __esm({
|
|
20942
|
-
"../../packages/schemas/src/environments.ts"() {
|
|
20943
|
-
"use strict";
|
|
20944
|
-
init_zod();
|
|
20945
|
-
init_resources();
|
|
20946
|
-
init_secrets();
|
|
20947
|
-
RESOURCE_KIND_ENVIRONMENT = "environment";
|
|
20948
|
-
CURRENT_SANDBOX_USER_HOME = "/home/user";
|
|
20949
|
-
LEGACY_SANDBOX_USER_HOMES = ["/home/auto", "/home/node"];
|
|
20950
|
-
STORED_SANDBOX_USER_HOMES = [
|
|
20951
|
-
CURRENT_SANDBOX_USER_HOME,
|
|
20952
|
-
...LEGACY_SANDBOX_USER_HOMES
|
|
20953
|
-
];
|
|
20954
|
-
EnvironmentSetupCachePathSchema = external_exports.string().trim().refine((value) => isSafeSandboxUserHomePath(value), {
|
|
20955
|
-
message: `Expected an absolute path under ${CURRENT_SANDBOX_USER_HOME}`
|
|
20956
|
-
});
|
|
20957
|
-
StoredEnvironmentSetupCachePathSchema = external_exports.string().trim().refine(
|
|
20958
|
-
(value) => isSafeSandboxUserHomePath(value, {
|
|
20959
|
-
allowedHomes: STORED_SANDBOX_USER_HOMES
|
|
20960
|
-
}),
|
|
20961
|
-
{
|
|
20962
|
-
message: `Expected an absolute path under ${CURRENT_SANDBOX_USER_HOME}`
|
|
20963
|
-
}
|
|
20964
|
-
);
|
|
20965
|
-
EnvironmentImageSchema = external_exports.object({
|
|
20966
|
-
kind: external_exports.literal("preset"),
|
|
20967
|
-
name: ResourceNameSchema
|
|
20968
|
-
}).strict();
|
|
20969
|
-
ENVIRONMENT_APPROVALS_MODES = ["bypass", "prompt"];
|
|
20970
|
-
EnvironmentApprovalsSchema = external_exports.enum(ENVIRONMENT_APPROVALS_MODES);
|
|
20971
|
-
EnvironmentSetupSchema = environmentSetupSchema(
|
|
20972
|
-
StoredEnvironmentSetupCachePathSchema
|
|
20973
|
-
);
|
|
20974
|
-
EnvironmentApplySetupSchema = environmentSetupSchema(
|
|
20975
|
-
EnvironmentSetupCachePathSchema
|
|
20976
|
-
);
|
|
20977
|
-
EnvironmentSetupCacheSchema = external_exports.object({
|
|
20978
|
-
ttl: external_exports.string().trim().refine(isSetupCacheTtl, {
|
|
20979
|
-
message: "Expected a positive setup cache TTL such as 30m, 24h, or 7d"
|
|
20980
|
-
})
|
|
20981
|
-
}).strict();
|
|
20982
|
-
EnvironmentResourcesSchema = external_exports.object({
|
|
20983
|
-
cpuCount: external_exports.number().int().min(1).optional(),
|
|
20984
|
-
memoryMB: external_exports.number().int().min(128).optional()
|
|
20985
|
-
}).strict().refine(
|
|
20986
|
-
(resources) => resources.cpuCount !== void 0 || resources.memoryMB !== void 0,
|
|
20987
|
-
{
|
|
20988
|
-
message: "Expected at least one runtime resource setting"
|
|
20989
|
-
}
|
|
20990
|
-
);
|
|
20991
|
-
EnvironmentSpecSchema = environmentSpecSchema(
|
|
20992
|
-
EnvironmentSetupSchema
|
|
20993
|
-
);
|
|
20994
|
-
EnvironmentApplySpecSchema = environmentSpecSchema(
|
|
20995
|
-
EnvironmentApplySetupSchema
|
|
20996
|
-
);
|
|
20997
|
-
EnvironmentResourceSchema = resourceEnvelopeSchema(
|
|
20998
|
-
EnvironmentSpecSchema
|
|
20999
|
-
);
|
|
21000
|
-
EnvironmentApplyRequestSchema = resourceApplySchema(
|
|
21001
|
-
EnvironmentApplySpecSchema
|
|
21002
|
-
);
|
|
21003
|
-
}
|
|
21004
|
-
});
|
|
21005
|
-
|
|
21006
21172
|
// ../../packages/schemas/src/environment-setup-failures.ts
|
|
21007
21173
|
var EnvironmentSetupStepFailureDiagnosticSchema, PersistedEnvironmentSetupStepFailureDiagnosticSchema;
|
|
21008
21174
|
var init_environment_setup_failures = __esm({
|
|
@@ -90185,6 +90351,7 @@ var init_src = __esm({
|
|
|
90185
90351
|
init_github_sync();
|
|
90186
90352
|
init_github_credentials();
|
|
90187
90353
|
init_github_mcp_catalog();
|
|
90354
|
+
init_hosted_runtimes();
|
|
90188
90355
|
init_identities();
|
|
90189
90356
|
init_ids();
|
|
90190
90357
|
init_environments();
|
|
@@ -93002,7 +93169,7 @@ var init_package = __esm({
|
|
|
93002
93169
|
"package.json"() {
|
|
93003
93170
|
package_default = {
|
|
93004
93171
|
name: "@autohq/cli",
|
|
93005
|
-
version: "0.1.
|
|
93172
|
+
version: "0.1.610",
|
|
93006
93173
|
license: "SEE LICENSE IN README.md",
|
|
93007
93174
|
publishConfig: {
|
|
93008
93175
|
access: "public"
|
|
@@ -99590,7 +99757,7 @@ function EnvironmentsView({
|
|
|
99590
99757
|
return {
|
|
99591
99758
|
id: environment.metadata.uid,
|
|
99592
99759
|
name: environment.metadata.name,
|
|
99593
|
-
kind: environment.spec.image.name
|
|
99760
|
+
kind: environment.spec.image.kind === "preset" ? environment.spec.image.name : `base:${environment.spec.image.ref}`,
|
|
99594
99761
|
target: envEntries.map(([name, value]) => `${name}:${envValueKind(value)}`).join(", "),
|
|
99595
99762
|
detail: "",
|
|
99596
99763
|
updatedAt: environment.metadata.updatedAt
|