aglio-worker 0.60.0 → 0.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent.js +133 -92
- package/package.json +1 -1
package/agent.js
CHANGED
|
@@ -27367,6 +27367,74 @@ function validateRoutingLabels(input2) {
|
|
|
27367
27367
|
return labels;
|
|
27368
27368
|
}
|
|
27369
27369
|
|
|
27370
|
+
// ../../packages/shared/src/plans.ts
|
|
27371
|
+
var PLAN_IDS = ["free", "pro", "team", "enterprise"];
|
|
27372
|
+
var MEGABYTE = 1024 * 1024;
|
|
27373
|
+
var GIGABYTE = 1024 * MEGABYTE;
|
|
27374
|
+
var PLAN_CATALOG = {
|
|
27375
|
+
free: {
|
|
27376
|
+
id: "free",
|
|
27377
|
+
label: "Free",
|
|
27378
|
+
tagline: "For a solo workspace trying Aglio.",
|
|
27379
|
+
priceLabel: "$0",
|
|
27380
|
+
monthlyPriceUsd: 0,
|
|
27381
|
+
entitlements: {
|
|
27382
|
+
seats: 1,
|
|
27383
|
+
projects: 2,
|
|
27384
|
+
runsPerMonth: null,
|
|
27385
|
+
storageBytes: 500 * MEGABYTE,
|
|
27386
|
+
poolSecondsPerMonth: 7200,
|
|
27387
|
+
cloudRunsPerMonth: 20
|
|
27388
|
+
}
|
|
27389
|
+
},
|
|
27390
|
+
pro: {
|
|
27391
|
+
id: "pro",
|
|
27392
|
+
label: "Pro",
|
|
27393
|
+
tagline: "For one person or a small crew shipping together.",
|
|
27394
|
+
priceLabel: "$19/mo",
|
|
27395
|
+
monthlyPriceUsd: 19,
|
|
27396
|
+
entitlements: {
|
|
27397
|
+
seats: 3,
|
|
27398
|
+
projects: 10,
|
|
27399
|
+
runsPerMonth: null,
|
|
27400
|
+
storageBytes: 5 * GIGABYTE,
|
|
27401
|
+
poolSecondsPerMonth: 72e3,
|
|
27402
|
+
cloudRunsPerMonth: 120
|
|
27403
|
+
}
|
|
27404
|
+
},
|
|
27405
|
+
team: {
|
|
27406
|
+
id: "team",
|
|
27407
|
+
label: "Team",
|
|
27408
|
+
tagline: "For a small team shipping together.",
|
|
27409
|
+
priceLabel: "$49/mo",
|
|
27410
|
+
monthlyPriceUsd: 49,
|
|
27411
|
+
entitlements: {
|
|
27412
|
+
seats: 10,
|
|
27413
|
+
projects: 20,
|
|
27414
|
+
runsPerMonth: null,
|
|
27415
|
+
storageBytes: 20 * GIGABYTE,
|
|
27416
|
+
poolSecondsPerMonth: 36e4,
|
|
27417
|
+
cloudRunsPerMonth: 500
|
|
27418
|
+
}
|
|
27419
|
+
},
|
|
27420
|
+
enterprise: {
|
|
27421
|
+
id: "enterprise",
|
|
27422
|
+
label: "Enterprise",
|
|
27423
|
+
tagline: "Unlimited seats, projects and usage.",
|
|
27424
|
+
priceLabel: "Contact us",
|
|
27425
|
+
monthlyPriceUsd: null,
|
|
27426
|
+
entitlements: {
|
|
27427
|
+
seats: null,
|
|
27428
|
+
projects: null,
|
|
27429
|
+
runsPerMonth: null,
|
|
27430
|
+
storageBytes: null,
|
|
27431
|
+
poolSecondsPerMonth: null,
|
|
27432
|
+
cloudRunsPerMonth: null
|
|
27433
|
+
}
|
|
27434
|
+
}
|
|
27435
|
+
};
|
|
27436
|
+
var PLAN_LIST = PLAN_IDS.map((id) => PLAN_CATALOG[id]);
|
|
27437
|
+
|
|
27370
27438
|
// ../../packages/shared/src/worker-capacity.ts
|
|
27371
27439
|
var WORKER_DEFAULT_CAPACITY = 1;
|
|
27372
27440
|
var WORKER_MAX_CAPACITY = 8;
|
|
@@ -27751,6 +27819,11 @@ var createInviteSchema = external_exports.object({
|
|
|
27751
27819
|
email: external_exports.string().email(),
|
|
27752
27820
|
role: memberRoleSchema.default("member")
|
|
27753
27821
|
});
|
|
27822
|
+
var changeEmailSchema = external_exports.object({
|
|
27823
|
+
newEmail: external_exports.string().trim().toLowerCase().max(254).email(),
|
|
27824
|
+
/** Empty for accounts that sign in with GitHub only. */
|
|
27825
|
+
currentPassword: external_exports.string().max(200).default("")
|
|
27826
|
+
});
|
|
27754
27827
|
var jobPayloadSchema = external_exports.record(external_exports.string(), external_exports.unknown());
|
|
27755
27828
|
|
|
27756
27829
|
// ../../packages/shared/src/project-mcp.ts
|
|
@@ -28354,6 +28427,8 @@ var cardLabelInputSchema = external_exports.object({
|
|
|
28354
28427
|
// ../../packages/shared/src/workspace.ts
|
|
28355
28428
|
var INVITE_TTL_DAYS = 7;
|
|
28356
28429
|
var INVITE_TTL_MS = INVITE_TTL_DAYS * 24 * 60 * 60 * 1e3;
|
|
28430
|
+
var DEFAULT_INVITE_EXPIRY_DAYS = INVITE_TTL_DAYS;
|
|
28431
|
+
var MAX_INVITE_EXPIRY_DAYS = 90;
|
|
28357
28432
|
|
|
28358
28433
|
// ../../packages/shared/src/workspace-settings.ts
|
|
28359
28434
|
var WORKSPACE_SETTINGS_DEFAULTS = {
|
|
@@ -28362,13 +28437,16 @@ var WORKSPACE_SETTINGS_DEFAULTS = {
|
|
|
28362
28437
|
/** 0 means keep artifacts forever. */
|
|
28363
28438
|
artifactRetentionDays: 0,
|
|
28364
28439
|
/** The shared workspace consultant is opt-out. Disabled hides every entry point. */
|
|
28365
|
-
consultantEnabled: true
|
|
28440
|
+
consultantEnabled: true,
|
|
28441
|
+
/** How long new invite links stay valid. Existing invites keep their own date. */
|
|
28442
|
+
inviteExpiryDays: DEFAULT_INVITE_EXPIRY_DAYS
|
|
28366
28443
|
};
|
|
28367
28444
|
var workspaceSettingsSchema = external_exports.object({
|
|
28368
28445
|
allowMemberInvites: external_exports.boolean().catch(WORKSPACE_SETTINGS_DEFAULTS.allowMemberInvites),
|
|
28369
28446
|
defaultAgentConfigId: external_exports.string().trim().min(1).nullable().catch(null),
|
|
28370
28447
|
artifactRetentionDays: external_exports.number().int().min(0).max(3650).catch(WORKSPACE_SETTINGS_DEFAULTS.artifactRetentionDays),
|
|
28371
|
-
consultantEnabled: external_exports.boolean().catch(WORKSPACE_SETTINGS_DEFAULTS.consultantEnabled)
|
|
28448
|
+
consultantEnabled: external_exports.boolean().catch(WORKSPACE_SETTINGS_DEFAULTS.consultantEnabled),
|
|
28449
|
+
inviteExpiryDays: external_exports.number().int().min(1).max(MAX_INVITE_EXPIRY_DAYS).catch(WORKSPACE_SETTINGS_DEFAULTS.inviteExpiryDays)
|
|
28372
28450
|
}).passthrough();
|
|
28373
28451
|
|
|
28374
28452
|
// ../../packages/shared/src/theme.ts
|
|
@@ -28383,74 +28461,6 @@ var themePreferencesSchema = external_exports.object({
|
|
|
28383
28461
|
themeScale: external_exports.enum(THEME_SCALES).catch(DEFAULT_THEME_PREFERENCES.themeScale)
|
|
28384
28462
|
});
|
|
28385
28463
|
|
|
28386
|
-
// ../../packages/shared/src/plans.ts
|
|
28387
|
-
var PLAN_IDS = ["free", "pro", "team", "enterprise"];
|
|
28388
|
-
var MEGABYTE = 1024 * 1024;
|
|
28389
|
-
var GIGABYTE = 1024 * MEGABYTE;
|
|
28390
|
-
var PLAN_CATALOG = {
|
|
28391
|
-
free: {
|
|
28392
|
-
id: "free",
|
|
28393
|
-
label: "Free",
|
|
28394
|
-
tagline: "For a solo workspace trying Aglio.",
|
|
28395
|
-
priceLabel: "$0",
|
|
28396
|
-
monthlyPriceUsd: 0,
|
|
28397
|
-
entitlements: {
|
|
28398
|
-
seats: 1,
|
|
28399
|
-
projects: 2,
|
|
28400
|
-
runsPerMonth: null,
|
|
28401
|
-
storageBytes: 500 * MEGABYTE,
|
|
28402
|
-
poolSecondsPerMonth: 7200,
|
|
28403
|
-
cloudRunsPerMonth: 20
|
|
28404
|
-
}
|
|
28405
|
-
},
|
|
28406
|
-
pro: {
|
|
28407
|
-
id: "pro",
|
|
28408
|
-
label: "Pro",
|
|
28409
|
-
tagline: "For one person or a small crew shipping together.",
|
|
28410
|
-
priceLabel: "$19/mo",
|
|
28411
|
-
monthlyPriceUsd: 19,
|
|
28412
|
-
entitlements: {
|
|
28413
|
-
seats: 3,
|
|
28414
|
-
projects: 10,
|
|
28415
|
-
runsPerMonth: null,
|
|
28416
|
-
storageBytes: 5 * GIGABYTE,
|
|
28417
|
-
poolSecondsPerMonth: 72e3,
|
|
28418
|
-
cloudRunsPerMonth: 120
|
|
28419
|
-
}
|
|
28420
|
-
},
|
|
28421
|
-
team: {
|
|
28422
|
-
id: "team",
|
|
28423
|
-
label: "Team",
|
|
28424
|
-
tagline: "For a small team shipping together.",
|
|
28425
|
-
priceLabel: "$49/mo",
|
|
28426
|
-
monthlyPriceUsd: 49,
|
|
28427
|
-
entitlements: {
|
|
28428
|
-
seats: 10,
|
|
28429
|
-
projects: 20,
|
|
28430
|
-
runsPerMonth: null,
|
|
28431
|
-
storageBytes: 20 * GIGABYTE,
|
|
28432
|
-
poolSecondsPerMonth: 36e4,
|
|
28433
|
-
cloudRunsPerMonth: 500
|
|
28434
|
-
}
|
|
28435
|
-
},
|
|
28436
|
-
enterprise: {
|
|
28437
|
-
id: "enterprise",
|
|
28438
|
-
label: "Enterprise",
|
|
28439
|
-
tagline: "Unlimited seats, projects and usage.",
|
|
28440
|
-
priceLabel: "Contact us",
|
|
28441
|
-
monthlyPriceUsd: null,
|
|
28442
|
-
entitlements: {
|
|
28443
|
-
seats: null,
|
|
28444
|
-
projects: null,
|
|
28445
|
-
runsPerMonth: null,
|
|
28446
|
-
storageBytes: null,
|
|
28447
|
-
poolSecondsPerMonth: null,
|
|
28448
|
-
cloudRunsPerMonth: null
|
|
28449
|
-
}
|
|
28450
|
-
}
|
|
28451
|
-
};
|
|
28452
|
-
var PLAN_LIST = PLAN_IDS.map((id) => PLAN_CATALOG[id]);
|
|
28453
|
-
|
|
28454
28464
|
// ../../packages/shared/src/lists.ts
|
|
28455
28465
|
var BOARD_LIST_NAME_MAX = 40;
|
|
28456
28466
|
var boardListInputSchema = external_exports.object({
|
|
@@ -28466,6 +28476,9 @@ var boardListMoveSchema = external_exports.object({
|
|
|
28466
28476
|
// ../../packages/shared/src/password-reset.ts
|
|
28467
28477
|
var PASSWORD_RESET_TTL_SECONDS = 60 * 60;
|
|
28468
28478
|
|
|
28479
|
+
// ../../packages/shared/src/email-change.ts
|
|
28480
|
+
var EMAIL_CHANGE_TTL_SECONDS = 60 * 60;
|
|
28481
|
+
|
|
28469
28482
|
// ../../packages/shared/src/card-open-mode.ts
|
|
28470
28483
|
var CARD_OPEN_MODES = ["popup", "page"];
|
|
28471
28484
|
var cardOpenModeSchema = external_exports.enum(CARD_OPEN_MODES);
|
|
@@ -31330,26 +31343,46 @@ import { join as join6, resolve as resolve5, sep } from "node:path";
|
|
|
31330
31343
|
var FINAL = ["completed", "failed", "cancelled", "expired"];
|
|
31331
31344
|
var POLL_MS = 700;
|
|
31332
31345
|
var KICKOFF_MS = 4e3;
|
|
31346
|
+
var API_ATTEMPTS = 3;
|
|
31347
|
+
var API_RETRY_MS = 400;
|
|
31333
31348
|
function isFinal(status) {
|
|
31334
31349
|
return FINAL.includes(status);
|
|
31335
31350
|
}
|
|
31336
31351
|
function errorText3(error62) {
|
|
31337
31352
|
return error62 instanceof Error ? error62.message : String(error62);
|
|
31338
31353
|
}
|
|
31354
|
+
function errorStatus2(error62) {
|
|
31355
|
+
const status = error62?.status;
|
|
31356
|
+
return typeof status === "number" ? status : null;
|
|
31357
|
+
}
|
|
31358
|
+
function transientControlPlaneError(error62) {
|
|
31359
|
+
const status = errorStatus2(error62);
|
|
31360
|
+
return status === null || status === 429 || status >= 500;
|
|
31361
|
+
}
|
|
31362
|
+
async function withLoginRetry(call, signal) {
|
|
31363
|
+
for (let attempt = 1; ; attempt += 1) {
|
|
31364
|
+
try {
|
|
31365
|
+
return await call();
|
|
31366
|
+
} catch (error62) {
|
|
31367
|
+
if (signal.aborted || attempt >= API_ATTEMPTS || !transientControlPlaneError(error62)) throw error62;
|
|
31368
|
+
await new Promise((done) => setTimeout(done, API_RETRY_MS * attempt));
|
|
31369
|
+
}
|
|
31370
|
+
}
|
|
31371
|
+
}
|
|
31339
31372
|
async function runRemoteProviderLogin(input2) {
|
|
31340
|
-
let session = await input2.api.fetch();
|
|
31341
|
-
const method = session.command;
|
|
31342
31373
|
const root = join6(input2.workspace, "login");
|
|
31343
|
-
const home = join6(root, "home");
|
|
31344
|
-
const target = resolve5(home, session.bundlePath);
|
|
31345
|
-
if (!target.startsWith(resolve5(home) + sep)) {
|
|
31346
|
-
return { state: "failed", error: "Unsafe credential bundle path." };
|
|
31347
|
-
}
|
|
31348
|
-
await mkdir3(home, { recursive: true, mode: 448 });
|
|
31349
|
-
input2.write(`[aglio] provider login ${session.provider} (${method.label})
|
|
31350
|
-
`);
|
|
31351
31374
|
let container = null;
|
|
31352
31375
|
try {
|
|
31376
|
+
let session = await withLoginRetry(() => input2.api.fetch(), input2.signal);
|
|
31377
|
+
const method = session.command;
|
|
31378
|
+
const home = join6(root, "home");
|
|
31379
|
+
const target = resolve5(home, session.bundlePath);
|
|
31380
|
+
if (!target.startsWith(resolve5(home) + sep)) {
|
|
31381
|
+
return { state: "failed", error: "Unsafe credential bundle path." };
|
|
31382
|
+
}
|
|
31383
|
+
await mkdir3(home, { recursive: true, mode: 448 });
|
|
31384
|
+
input2.write(`[aglio] provider login ${session.provider} (${method.label})
|
|
31385
|
+
`);
|
|
31353
31386
|
container = await createDockerLoginContainer({
|
|
31354
31387
|
jobId: input2.job.id,
|
|
31355
31388
|
workspace: root,
|
|
@@ -31381,7 +31414,7 @@ async function runRemoteProviderLogin(input2) {
|
|
|
31381
31414
|
let lastSnapshot = "";
|
|
31382
31415
|
let endedAt = null;
|
|
31383
31416
|
while (!input2.signal.aborted && !input2.cancelled()) {
|
|
31384
|
-
session = await input2.api.fetch();
|
|
31417
|
+
session = await withLoginRetry(() => input2.api.fetch(), input2.signal);
|
|
31385
31418
|
if (isFinal(session.status)) {
|
|
31386
31419
|
return {
|
|
31387
31420
|
state: session.status === "cancelled" ? "cancelled" : session.status === "completed" ? "succeeded" : "failed",
|
|
@@ -31389,7 +31422,10 @@ async function runRemoteProviderLogin(input2) {
|
|
|
31389
31422
|
};
|
|
31390
31423
|
}
|
|
31391
31424
|
if (new Date(session.expiresAt).getTime() <= Date.now()) {
|
|
31392
|
-
await
|
|
31425
|
+
await withLoginRetry(
|
|
31426
|
+
() => input2.api.update({ status: "expired", error: "Sign-in timed out. Start again." }),
|
|
31427
|
+
input2.signal
|
|
31428
|
+
);
|
|
31393
31429
|
return { state: "failed", error: "Sign-in timed out. Start again." };
|
|
31394
31430
|
}
|
|
31395
31431
|
if (method.kickoff && !kickoffSent && Date.now() - startedAt >= KICKOFF_MS) {
|
|
@@ -31411,8 +31447,8 @@ async function runRemoteProviderLogin(input2) {
|
|
|
31411
31447
|
} catch {
|
|
31412
31448
|
}
|
|
31413
31449
|
if (content) {
|
|
31414
|
-
await input2.api.update({ status: "saving" });
|
|
31415
|
-
const uploaded = await input2.api.uploadBundle(content);
|
|
31450
|
+
await withLoginRetry(() => input2.api.update({ status: "saving" }), input2.signal);
|
|
31451
|
+
const uploaded = await withLoginRetry(() => input2.api.uploadBundle(content), input2.signal);
|
|
31416
31452
|
input2.write(`[aglio] credential bundle saved (${uploaded.credentialId})
|
|
31417
31453
|
`);
|
|
31418
31454
|
return { state: "succeeded", error: null };
|
|
@@ -31424,12 +31460,15 @@ async function runRemoteProviderLogin(input2) {
|
|
|
31424
31460
|
const snapshot = JSON.stringify({ url: url2, userCode, status, output: output2.slice(-4e3) });
|
|
31425
31461
|
if (snapshot !== lastSnapshot) {
|
|
31426
31462
|
lastSnapshot = snapshot;
|
|
31427
|
-
await
|
|
31428
|
-
|
|
31429
|
-
|
|
31430
|
-
|
|
31431
|
-
|
|
31432
|
-
|
|
31463
|
+
await withLoginRetry(
|
|
31464
|
+
() => input2.api.update({
|
|
31465
|
+
status,
|
|
31466
|
+
url: url2,
|
|
31467
|
+
userCode,
|
|
31468
|
+
output: output2.slice(-4e3)
|
|
31469
|
+
}),
|
|
31470
|
+
input2.signal
|
|
31471
|
+
);
|
|
31433
31472
|
}
|
|
31434
31473
|
if (ended) {
|
|
31435
31474
|
endedAt ??= Date.now();
|
|
@@ -31438,7 +31477,7 @@ async function runRemoteProviderLogin(input2) {
|
|
|
31438
31477
|
const tail2 = output2.trim().split("\n").slice(-6).join("\n");
|
|
31439
31478
|
const message = `Sign-in ended before an auth file was written (exit ${info.ExitCode ?? "unknown"}).` + (tail2 ? `
|
|
31440
31479
|
${tail2}` : "");
|
|
31441
|
-
await input2.api.update({ status: "failed", error: message });
|
|
31480
|
+
await withLoginRetry(() => input2.api.update({ status: "failed", error: message }), input2.signal);
|
|
31442
31481
|
return { state: "failed", error: message };
|
|
31443
31482
|
}
|
|
31444
31483
|
}
|
|
@@ -31450,7 +31489,9 @@ ${tail2}` : "");
|
|
|
31450
31489
|
return { state: "failed", error: "Sign-in stopped" };
|
|
31451
31490
|
} catch (error62) {
|
|
31452
31491
|
const message = errorText3(error62).slice(0, 2e3);
|
|
31453
|
-
await input2.api.update({ status: "failed", error: message }).catch(
|
|
31492
|
+
await withLoginRetry(() => input2.api.update({ status: "failed", error: message }), input2.signal).catch(
|
|
31493
|
+
() => void 0
|
|
31494
|
+
);
|
|
31454
31495
|
return { state: "failed", error: message };
|
|
31455
31496
|
} finally {
|
|
31456
31497
|
await container?.kill().catch(() => void 0);
|