@slayzone/cli 0.44.0 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/slay.js +54 -24
- package/package.json +1 -1
package/dist/slay.js
CHANGED
|
@@ -16370,7 +16370,8 @@ var HUB_SWITCH_ENV = {
|
|
|
16370
16370
|
enableSso: "SLAYZONE_HUB_ENABLE_SSO",
|
|
16371
16371
|
enableProcesses: "SLAYZONE_HUB_ENABLE_PROCESSES",
|
|
16372
16372
|
enableIntegrations: "SLAYZONE_HUB_ENABLE_INTEGRATIONS",
|
|
16373
|
-
enableTelemetry: "SLAYZONE_HUB_ENABLE_TELEMETRY"
|
|
16373
|
+
enableTelemetry: "SLAYZONE_HUB_ENABLE_TELEMETRY",
|
|
16374
|
+
enablePush: "SLAYZONE_HUB_ENABLE_PUSH"
|
|
16374
16375
|
};
|
|
16375
16376
|
var HUB_SWITCH_DEFAULTS = {
|
|
16376
16377
|
requireLogin: false,
|
|
@@ -16378,7 +16379,8 @@ var HUB_SWITCH_DEFAULTS = {
|
|
|
16378
16379
|
enableSso: false,
|
|
16379
16380
|
enableProcesses: true,
|
|
16380
16381
|
enableIntegrations: true,
|
|
16381
|
-
enableTelemetry: true
|
|
16382
|
+
enableTelemetry: true,
|
|
16383
|
+
enablePush: true
|
|
16382
16384
|
};
|
|
16383
16385
|
var HUB_SSO_ENV = {
|
|
16384
16386
|
tenantId: "SLAYZONE_HUB_SSO_TENANT_ID",
|
|
@@ -16415,12 +16417,17 @@ var HUB_ADDRESS_ENV = {
|
|
|
16415
16417
|
/** Signing key of hub-auth. */
|
|
16416
16418
|
authSecret: "SLAYZONE_HUB_AUTH_SECRET"
|
|
16417
16419
|
};
|
|
16420
|
+
var HUB_CREDENTIALS_ENV = {
|
|
16421
|
+
secret: "SLAYZONE_HUB_CREDENTIALS_SECRET",
|
|
16422
|
+
fd: "SLAYZONE_HUB_CREDENTIALS_FD"
|
|
16423
|
+
};
|
|
16418
16424
|
var LEGACY_HUB_LISTEN_ENV = "SLAYZONE_HUB_ADDRESS";
|
|
16419
16425
|
var HUB_SESSION_RETENTION_DAYS_ENV = "SLAYZONE_HUB_SESSION_RETENTION_DAYS";
|
|
16420
16426
|
var HUB_ALLOWED_WEB_ORIGINS_ENV = "SLAYZONE_HUB_ALLOWED_WEB_ORIGINS";
|
|
16421
16427
|
var HUB_TRUSTED_PROXIES_ENV = "SLAYZONE_HUB_TRUSTED_PROXIES";
|
|
16422
16428
|
var HUB_CONVEX_ADDRESS_ENV = "SLAYZONE_HUB_CONVEX_ADDRESS";
|
|
16423
16429
|
var HUB_STUN_ADDRESSES_ENV = "SLAYZONE_HUB_STUN_ADDRESSES";
|
|
16430
|
+
var HUB_PUSH_SERVICE_ADDRESS_ENV = "SLAYZONE_HUB_PUSH_SERVICE_ADDRESS";
|
|
16424
16431
|
var HUB_PROCESS_ENV = [
|
|
16425
16432
|
...Object.values(HUB_SWITCH_ENV),
|
|
16426
16433
|
...Object.values(HUB_SSO_ENV),
|
|
@@ -16428,12 +16435,14 @@ var HUB_PROCESS_ENV = [
|
|
|
16428
16435
|
...Object.values(IDP_ROLE_ENV),
|
|
16429
16436
|
RETIRED_HUB_SSO_CLIENT_SECRET_ENV,
|
|
16430
16437
|
...Object.values(HUB_ADDRESS_ENV),
|
|
16438
|
+
...Object.values(HUB_CREDENTIALS_ENV),
|
|
16431
16439
|
LEGACY_HUB_LISTEN_ENV,
|
|
16432
16440
|
HUB_ALLOWED_WEB_ORIGINS_ENV,
|
|
16433
16441
|
HUB_TRUSTED_PROXIES_ENV,
|
|
16434
16442
|
HUB_SESSION_RETENTION_DAYS_ENV,
|
|
16435
16443
|
HUB_CONVEX_ADDRESS_ENV,
|
|
16436
|
-
HUB_STUN_ADDRESSES_ENV
|
|
16444
|
+
HUB_STUN_ADDRESSES_ENV,
|
|
16445
|
+
HUB_PUSH_SERVICE_ADDRESS_ENV
|
|
16437
16446
|
];
|
|
16438
16447
|
|
|
16439
16448
|
// ../../shared/platform/src/paths.ts
|
|
@@ -16664,7 +16673,8 @@ var MESSAGES = {
|
|
|
16664
16673
|
HUB_PASSWORD_DISABLED: `Password sign-in is switched off on this hub (${HUB_SWITCH_ENV.enablePassword}=0).`,
|
|
16665
16674
|
HUB_CONVEX_NOT_CONFIGURED: `GitHub sign-in is off on this hub: no Convex deployment is configured (${HUB_CONVEX_ADDRESS_ENV}).`,
|
|
16666
16675
|
HUB_CONVEX_MISMATCH: `This hub starts GitHub sign-in only against its own Convex deployment (${HUB_CONVEX_ADDRESS_ENV}); the request named another.`,
|
|
16667
|
-
HUB_TELEMETRY_DISABLED: `GitHub sign-in (leaderboard, feedback) is off on this hub: third-party telemetry is switched off (${HUB_SWITCH_ENV.enableTelemetry}=0)
|
|
16676
|
+
HUB_TELEMETRY_DISABLED: `GitHub sign-in (leaderboard, feedback) is off on this hub: third-party telemetry is switched off (${HUB_SWITCH_ENV.enableTelemetry}=0).`,
|
|
16677
|
+
HUB_PUSH_DISABLED: `Push notifications are switched off on this hub (${HUB_SWITCH_ENV.enablePush}=0).`
|
|
16668
16678
|
};
|
|
16669
16679
|
var VARIABLES = {
|
|
16670
16680
|
HUB_PROCESSES_DISABLED: HUB_SWITCH_ENV.enableProcesses,
|
|
@@ -16673,7 +16683,8 @@ var VARIABLES = {
|
|
|
16673
16683
|
HUB_PASSWORD_DISABLED: HUB_SWITCH_ENV.enablePassword,
|
|
16674
16684
|
HUB_CONVEX_NOT_CONFIGURED: HUB_CONVEX_ADDRESS_ENV,
|
|
16675
16685
|
HUB_CONVEX_MISMATCH: HUB_CONVEX_ADDRESS_ENV,
|
|
16676
|
-
HUB_TELEMETRY_DISABLED: HUB_SWITCH_ENV.enableTelemetry
|
|
16686
|
+
HUB_TELEMETRY_DISABLED: HUB_SWITCH_ENV.enableTelemetry,
|
|
16687
|
+
HUB_PUSH_DISABLED: HUB_SWITCH_ENV.enablePush
|
|
16677
16688
|
};
|
|
16678
16689
|
|
|
16679
16690
|
// ../../shared/platform/src/cli-install.ts
|
|
@@ -51003,7 +51014,8 @@ var HUB_CONFIG_SWITCH_KEYS = [
|
|
|
51003
51014
|
"enableSso",
|
|
51004
51015
|
"enableProcesses",
|
|
51005
51016
|
"enableIntegrations",
|
|
51006
|
-
"enableTelemetry"
|
|
51017
|
+
"enableTelemetry",
|
|
51018
|
+
"enablePush"
|
|
51007
51019
|
];
|
|
51008
51020
|
function readComputerAgentResources(value) {
|
|
51009
51021
|
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
@@ -51063,6 +51075,7 @@ function coerceHubConfig(raw) {
|
|
|
51063
51075
|
}
|
|
51064
51076
|
function coerceComputerConfig(raw) {
|
|
51065
51077
|
const cfg = {};
|
|
51078
|
+
if (typeof raw.followHubVersion === "boolean") cfg.followHubVersion = raw.followHubVersion;
|
|
51066
51079
|
if (typeof raw.autoUpgrade === "boolean") cfg.autoUpgrade = raw.autoUpgrade;
|
|
51067
51080
|
if (typeof raw.joinToken === "string" && raw.joinToken.length > 0) cfg.joinToken = raw.joinToken;
|
|
51068
51081
|
if (typeof raw.computerName === "string" && raw.computerName.length > 0)
|
|
@@ -51161,6 +51174,8 @@ var import_node_child_process3 = require("node:child_process");
|
|
|
51161
51174
|
var import_node_fs14 = require("node:fs");
|
|
51162
51175
|
var import_node_os5 = require("node:os");
|
|
51163
51176
|
var import_node_path14 = require("node:path");
|
|
51177
|
+
|
|
51178
|
+
// ../../shared/platform/src/service-identity.ts
|
|
51164
51179
|
var KINDS = {
|
|
51165
51180
|
"computer-host": {
|
|
51166
51181
|
labelPrefix: "com.slayzone.session-host.",
|
|
@@ -51203,6 +51218,16 @@ function assertValidServiceName(kind, name) {
|
|
|
51203
51218
|
);
|
|
51204
51219
|
}
|
|
51205
51220
|
}
|
|
51221
|
+
function systemdUnitName(kind, name) {
|
|
51222
|
+
assertValidServiceName(kind, name);
|
|
51223
|
+
return `${KINDS[kind].systemdPrefix}${name}.service`;
|
|
51224
|
+
}
|
|
51225
|
+
function launchdLabel(kind, name) {
|
|
51226
|
+
assertValidServiceName(kind, name);
|
|
51227
|
+
return `${KINDS[kind].labelPrefix}${name}`;
|
|
51228
|
+
}
|
|
51229
|
+
|
|
51230
|
+
// ../../shared/platform/src/service-unit.ts
|
|
51206
51231
|
function defaultUnitDir(backend) {
|
|
51207
51232
|
const home = process.env.HOME ?? (0, import_node_os5.homedir)();
|
|
51208
51233
|
if (backend === "launchd") return (0, import_node_path14.join)(home, "Library", "LaunchAgents");
|
|
@@ -51436,14 +51461,6 @@ function readUnitRoot(kind, name, backend, unitDir = defaultUnitDir(backend)) {
|
|
|
51436
51461
|
function serviceLogNames(kind) {
|
|
51437
51462
|
return { out: KINDS[kind].outLog, err: KINDS[kind].errLog };
|
|
51438
51463
|
}
|
|
51439
|
-
function systemdUnitName(kind, name) {
|
|
51440
|
-
assertValidServiceName(kind, name);
|
|
51441
|
-
return `${KINDS[kind].systemdPrefix}${name}.service`;
|
|
51442
|
-
}
|
|
51443
|
-
function launchdLabel(kind, name) {
|
|
51444
|
-
assertValidServiceName(kind, name);
|
|
51445
|
-
return `${KINDS[kind].labelPrefix}${name}`;
|
|
51446
|
-
}
|
|
51447
51464
|
function readUnitEnv(kind, name, backend, unitDir = defaultUnitDir(backend)) {
|
|
51448
51465
|
let text;
|
|
51449
51466
|
try {
|
|
@@ -51480,7 +51497,8 @@ var UNIX_SOCKET_PATH_MAX_BYTES = {
|
|
|
51480
51497
|
darwin: 104,
|
|
51481
51498
|
linux: 108
|
|
51482
51499
|
};
|
|
51483
|
-
var
|
|
51500
|
+
var HOST_SUPERSEDED_NOTICE = "host-superseded";
|
|
51501
|
+
var LEGACY_HOST_SUPERSEDED_EXIT_CODE = 79;
|
|
51484
51502
|
var ENDPOINT_IN_USE_LISTEN_ERRORS = ["EADDRINUSE", "EEXIST"];
|
|
51485
51503
|
|
|
51486
51504
|
// ../../shared/platform/src/computer-launcher.ts
|
|
@@ -51494,8 +51512,9 @@ const role = process.argv.includes('--session-host') ? 'host' : 'supervisor';
|
|
|
51494
51512
|
const dir = path.join(root, 'computer-runtime'), pointer = path.join(dir, role === 'host' ? 'host-release.json' : 'supervisor.json');
|
|
51495
51513
|
// Restart delay after consecutive failures: 2s doubling to 60s, reset once a child is healthy.
|
|
51496
51514
|
const BACKOFF_MIN_MS = 2000, BACKOFF_MAX_MS = 60000, LOG_MAX_BYTES = 5 * 1024 * 1024;
|
|
51497
|
-
// A session host that found another live host on its control endpoint (computer-endpoints.ts
|
|
51498
|
-
|
|
51515
|
+
// A session host that found another live host on its control endpoint (computer-endpoints.ts
|
|
51516
|
+
// HOST_SUPERSEDED_EXIT_CODE): it says so over IPC, then exits 0. A 0.44.0 host exited 79 instead.
|
|
51517
|
+
const SUPERSEDED_NOTICE = ${JSON.stringify(HOST_SUPERSEDED_NOTICE)}, LEGACY_SUPERSEDED_EXIT = ${LEGACY_HOST_SUPERSEDED_EXIT_CODE};
|
|
51499
51518
|
// This root's endpoints, derived exactly as computer-endpoints.ts derives them.
|
|
51500
51519
|
const endpointKey = crypto.createHash('sha256').update(path.resolve(root)).digest('hex').slice(0, 24);
|
|
51501
51520
|
const endpointDir = process.platform === 'win32' ? null : path.join(os.tmpdir(), 'slay-computer-' + (process.getuid ? process.getuid() : 'user') + '-' + endpointKey);
|
|
@@ -51625,7 +51644,7 @@ function release(code) {
|
|
|
51625
51644
|
function launch() {
|
|
51626
51645
|
if (stopping) return;
|
|
51627
51646
|
rotateHostLog();
|
|
51628
|
-
const state = read(); let timedOut = false; healthy = false; probation = undefined;
|
|
51647
|
+
const state = read(); let timedOut = false, superseded = false; healthy = false; probation = undefined;
|
|
51629
51648
|
const startedAt = Date.now();
|
|
51630
51649
|
child = cp.fork(state.current.entry, [role === 'host' ? '--session-host' : '--supervisor'], {env: {...process.env, SLAYZONE_NONINTERACTIVE:'1'}, stdio:['inherit','inherit','inherit','ipc']});
|
|
51631
51650
|
status.state = 'running'; status.childPid = child.pid; status.nextLaunchAt = null;
|
|
@@ -51638,16 +51657,25 @@ function launch() {
|
|
|
51638
51657
|
if (role === 'supervisor') child.kill('SIGKILL');
|
|
51639
51658
|
else { child.kill('SIGTERM'); killTimer = setTimeout(() => child.kill('SIGKILL'), 10000); }
|
|
51640
51659
|
}, 90000);
|
|
51641
|
-
child.on('message', m => { if (m && m.type === 'supervisor-ready') {clearTimeout(timer); if (!probation) probation = setTimeout(() => {healthy = true; failures = 0;}, 60000);} });
|
|
51660
|
+
child.on('message', m => { if (m && m.type === SUPERSEDED_NOTICE) superseded = true; if (m && m.type === 'supervisor-ready') {clearTimeout(timer); if (!probation) probation = setTimeout(() => {healthy = true; failures = 0;}, 60000);} });
|
|
51642
51661
|
child.on('error', (err) => { log(state.current.version + ' child error: ' + (err && err.message)); });
|
|
51643
51662
|
child.on('exit', (code, signal) => {
|
|
51644
51663
|
clearTimeout(timer); clearTimeout(probation); clearTimeout(killTimer);
|
|
51664
|
+
// A clean exit may still have its last IPC message (the superseded notice) unread:
|
|
51665
|
+
// read the channel to its end first, bounded (a grandchild could hold it open).
|
|
51666
|
+
if (code !== 0 || !child.connected) return exited(code, signal);
|
|
51667
|
+
let settled = false;
|
|
51668
|
+
const settle = () => { if (settled) return; settled = true; clearTimeout(drain); exited(code, signal); };
|
|
51669
|
+
const drain = setTimeout(settle, 1000);
|
|
51670
|
+
child.once('disconnect', settle);
|
|
51671
|
+
});
|
|
51672
|
+
function exited(code, signal) {
|
|
51645
51673
|
const ended = state.current.version + ' pid=' + child.pid + ' exited code=' + code + ' signal=' + signal + ' after ' + (Date.now() - startedAt) + 'ms';
|
|
51646
51674
|
status.childPid = null; status.lastExit = {version: state.current.version, code, signal, at: Date.now()};
|
|
51647
51675
|
if (stopping) {log(ended + '; stopping'); release(code || 0); return;}
|
|
51648
51676
|
// Another live host owns the endpoint: not a failure of this release (no
|
|
51649
51677
|
// quarantine, no rollback), and nothing to restart. This launcher is redundant.
|
|
51650
|
-
if (role === 'host' && code ===
|
|
51678
|
+
if (role === 'host' && !timedOut && ((superseded && code === 0) || code === LEGACY_SUPERSEDED_EXIT)) {log(ended + '; superseded by a live session host, stopping'); stopping = true; release(0); return;}
|
|
51651
51679
|
if (code === 75 && !timedOut) {log(ended + '; relaunching (requested)'); launch(); return;}
|
|
51652
51680
|
const failed = timedOut || code !== 0;
|
|
51653
51681
|
let rolledBack = '';
|
|
@@ -51663,7 +51691,7 @@ function launch() {
|
|
|
51663
51691
|
log(ended + rolledBack + '; restarting in ' + delay + 'ms (failure ' + failures + ')');
|
|
51664
51692
|
status.state = 'backoff'; status.nextLaunchAt = Date.now() + delay;
|
|
51665
51693
|
nextTimer = setTimeout(launch, delay);
|
|
51666
|
-
}
|
|
51694
|
+
}
|
|
51667
51695
|
}
|
|
51668
51696
|
for (const signal of ['SIGINT','SIGTERM']) process.on(signal, () => {
|
|
51669
51697
|
stopping = true; log('received ' + signal + ', stopping');
|
|
@@ -51716,7 +51744,7 @@ var import_node_child_process4 = require("node:child_process");
|
|
|
51716
51744
|
var import_node_fs17 = require("node:fs");
|
|
51717
51745
|
var import_node_module = require("node:module");
|
|
51718
51746
|
var import_node_path16 = require("node:path");
|
|
51719
|
-
var CLI_VERSION = true ? "0.
|
|
51747
|
+
var CLI_VERSION = true ? "0.45.0" : "";
|
|
51720
51748
|
function fail(message) {
|
|
51721
51749
|
console.error(message);
|
|
51722
51750
|
process.exit(1);
|
|
@@ -52520,7 +52548,9 @@ function signedInEmail(baseUrl, token) {
|
|
|
52520
52548
|
var import_node_crypto6 = require("node:crypto");
|
|
52521
52549
|
var HUB_AUTH_SECRET_LABELS = {
|
|
52522
52550
|
/** The bootstrap owner of a reachable password hub (apps/hub bootstrap-owner.ts). */
|
|
52523
|
-
bootstrapOwnerPassword: "slayzone-hub/bootstrap-owner-password/v1"
|
|
52551
|
+
bootstrapOwnerPassword: "slayzone-hub/bootstrap-owner-password/v1",
|
|
52552
|
+
/** The key integration tokens are encrypted under (integrations hub-cipher.ts). */
|
|
52553
|
+
integrationCredentials: "slayzone-hub/integration-credentials/v1"
|
|
52524
52554
|
};
|
|
52525
52555
|
function deriveFromHubAuthSecret(secret, label, bytes) {
|
|
52526
52556
|
if (!secret) throw new Error("[slayzone] cannot derive from an empty hub auth secret");
|
|
@@ -54421,7 +54451,7 @@ function updateCommand() {
|
|
|
54421
54451
|
}
|
|
54422
54452
|
|
|
54423
54453
|
// src/index.ts
|
|
54424
|
-
var program2 = new Command().enablePositionalOptions().name("slay").description("SlayZone CLI").version("0.
|
|
54454
|
+
var program2 = new Command().enablePositionalOptions().name("slay").description("SlayZone CLI").version("0.45.0").option("--dev", "Use development database (slayzone.dev.data.sqlite)").option("--hub <name|port>", "Target a specific hub on this machine (see `slay hub ls`)").showSuggestionAfterError(true).showHelpAfterError(true).hook("preAction", async (thisCommand) => {
|
|
54425
54455
|
const root = thisCommand.parent ?? thisCommand;
|
|
54426
54456
|
const opts = root.opts();
|
|
54427
54457
|
if (opts.dev) process.env.SLAYZONE_DEV = "1";
|