@konstantdotcloud/boombox 0.1.0 → 0.1.1
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/boombox.js +55 -22
- package/dist/index.js +55 -22
- package/package.json +1 -1
package/dist/boombox.js
CHANGED
|
@@ -37606,7 +37606,7 @@ var {
|
|
|
37606
37606
|
init_esm_shims();
|
|
37607
37607
|
|
|
37608
37608
|
// package.json
|
|
37609
|
-
var version = "0.1.
|
|
37609
|
+
var version = "0.1.1";
|
|
37610
37610
|
|
|
37611
37611
|
// src/lib/version.ts
|
|
37612
37612
|
var BOOMBOX_VERSION = version;
|
|
@@ -42547,6 +42547,12 @@ init_esm_shims();
|
|
|
42547
42547
|
|
|
42548
42548
|
// src/lib/resolve-gateway.ts
|
|
42549
42549
|
init_esm_shims();
|
|
42550
|
+
var GatewayResolutionError = class extends Error {
|
|
42551
|
+
constructor(message) {
|
|
42552
|
+
super(message);
|
|
42553
|
+
this.name = "GatewayResolutionError";
|
|
42554
|
+
}
|
|
42555
|
+
};
|
|
42550
42556
|
function resolveGateway(config2) {
|
|
42551
42557
|
return resolveGatewayTarget(config2).url;
|
|
42552
42558
|
}
|
|
@@ -42559,6 +42565,11 @@ function resolveGatewayTarget(config2) {
|
|
|
42559
42565
|
label: "Mode 2: per-tenant VM"
|
|
42560
42566
|
};
|
|
42561
42567
|
}
|
|
42568
|
+
if (config2.runtime.default_kind === "vm") {
|
|
42569
|
+
throw new GatewayResolutionError(
|
|
42570
|
+
'runtime.default_kind is "vm" but runtime.vm_url is unset \u2014 refusing to fall back to the shared cloud gateway (that would run HomeBase off-VM). Run `boombox login` or `boombox enroll` to repoint at your VM, or set runtime.default_kind = "cloud" to use Mode 1 deliberately.'
|
|
42571
|
+
);
|
|
42572
|
+
}
|
|
42562
42573
|
return {
|
|
42563
42574
|
url: normalizeUrl(config2.konstant.gateway_url),
|
|
42564
42575
|
mode: "mode-1-shared-cloud",
|
|
@@ -47064,17 +47075,31 @@ async function runServe(options = {}) {
|
|
|
47064
47075
|
const configPath = options.configPath ?? getConfigPath();
|
|
47065
47076
|
const store = new ConfigStore({ path: configPath, log });
|
|
47066
47077
|
const config2 = store.getCurrent();
|
|
47067
|
-
|
|
47068
|
-
|
|
47069
|
-
|
|
47070
|
-
|
|
47071
|
-
|
|
47072
|
-
|
|
47078
|
+
try {
|
|
47079
|
+
resolveGatewayTarget(config2);
|
|
47080
|
+
} catch (err) {
|
|
47081
|
+
if (err instanceof GatewayResolutionError) {
|
|
47082
|
+
log(`error: ${err.message}`);
|
|
47083
|
+
process.exitCode = 1;
|
|
47084
|
+
return;
|
|
47073
47085
|
}
|
|
47074
|
-
|
|
47075
|
-
|
|
47076
|
-
|
|
47077
|
-
|
|
47086
|
+
throw err;
|
|
47087
|
+
}
|
|
47088
|
+
store.onChange((next, prev) => {
|
|
47089
|
+
try {
|
|
47090
|
+
if (next.konstant.api_key !== prev.konstant.api_key) {
|
|
47091
|
+
log("config: api_key rotated; new requests will use the updated key.");
|
|
47092
|
+
}
|
|
47093
|
+
if (resolveGateway(next) !== resolveGateway(prev)) {
|
|
47094
|
+
log(`config: target changed (${resolveGateway(prev)} \u2192 ${resolveGateway(next)}).`);
|
|
47095
|
+
}
|
|
47096
|
+
if (next.konstant.tenant_id !== prev.konstant.tenant_id) {
|
|
47097
|
+
log(
|
|
47098
|
+
`config: tenant_id changed (${prev.konstant.tenant_id} \u2192 ${next.konstant.tenant_id}).`
|
|
47099
|
+
);
|
|
47100
|
+
}
|
|
47101
|
+
} catch (err) {
|
|
47102
|
+
log(`config: ${err instanceof Error ? err.message : String(err)}`);
|
|
47078
47103
|
}
|
|
47079
47104
|
});
|
|
47080
47105
|
store.watch();
|
|
@@ -47256,17 +47281,25 @@ async function runDoctor(options = {}) {
|
|
|
47256
47281
|
}
|
|
47257
47282
|
}
|
|
47258
47283
|
if (config2) {
|
|
47259
|
-
|
|
47260
|
-
|
|
47261
|
-
|
|
47262
|
-
|
|
47263
|
-
|
|
47264
|
-
|
|
47265
|
-
name: "
|
|
47266
|
-
|
|
47267
|
-
|
|
47268
|
-
|
|
47269
|
-
|
|
47284
|
+
let target = null;
|
|
47285
|
+
try {
|
|
47286
|
+
target = resolveGatewayTarget(config2);
|
|
47287
|
+
checks.push({ name: "mode", ok: true, detail: `${target.label}, target=${target.url}` });
|
|
47288
|
+
} catch (err) {
|
|
47289
|
+
if (!(err instanceof GatewayResolutionError)) throw err;
|
|
47290
|
+
checks.push({ name: "mode", ok: false, detail: err.message });
|
|
47291
|
+
}
|
|
47292
|
+
if (target) {
|
|
47293
|
+
const reach = await reachable(target.url, options.fetchImpl);
|
|
47294
|
+
checks.push(reach);
|
|
47295
|
+
const auth = await verifyAuth(config2, options.fetchImpl);
|
|
47296
|
+
checks.push({
|
|
47297
|
+
name: "auth",
|
|
47298
|
+
ok: auth.ok,
|
|
47299
|
+
detail: auth.ok ? `whoami ok (status ${auth.status})` : `whoami failed (status ${auth.status}): ${auth.message}`
|
|
47300
|
+
});
|
|
47301
|
+
checks.push(await mcpHandshake(config2));
|
|
47302
|
+
}
|
|
47270
47303
|
}
|
|
47271
47304
|
const ok = checks.every((c) => c.ok);
|
|
47272
47305
|
for (const c of checks) {
|
package/dist/index.js
CHANGED
|
@@ -34581,7 +34581,7 @@ init_esm_shims();
|
|
|
34581
34581
|
init_esm_shims();
|
|
34582
34582
|
|
|
34583
34583
|
// package.json
|
|
34584
|
-
var version = "0.1.
|
|
34584
|
+
var version = "0.1.1";
|
|
34585
34585
|
|
|
34586
34586
|
// src/lib/version.ts
|
|
34587
34587
|
var BOOMBOX_VERSION = version;
|
|
@@ -42576,6 +42576,12 @@ var serveStatic = (options = { root: "" }) => {
|
|
|
42576
42576
|
|
|
42577
42577
|
// src/lib/resolve-gateway.ts
|
|
42578
42578
|
init_esm_shims();
|
|
42579
|
+
var GatewayResolutionError = class extends Error {
|
|
42580
|
+
constructor(message) {
|
|
42581
|
+
super(message);
|
|
42582
|
+
this.name = "GatewayResolutionError";
|
|
42583
|
+
}
|
|
42584
|
+
};
|
|
42579
42585
|
function resolveGateway(config2) {
|
|
42580
42586
|
return resolveGatewayTarget(config2).url;
|
|
42581
42587
|
}
|
|
@@ -42588,6 +42594,11 @@ function resolveGatewayTarget(config2) {
|
|
|
42588
42594
|
label: "Mode 2: per-tenant VM"
|
|
42589
42595
|
};
|
|
42590
42596
|
}
|
|
42597
|
+
if (config2.runtime.default_kind === "vm") {
|
|
42598
|
+
throw new GatewayResolutionError(
|
|
42599
|
+
'runtime.default_kind is "vm" but runtime.vm_url is unset \u2014 refusing to fall back to the shared cloud gateway (that would run HomeBase off-VM). Run `boombox login` or `boombox enroll` to repoint at your VM, or set runtime.default_kind = "cloud" to use Mode 1 deliberately.'
|
|
42600
|
+
);
|
|
42601
|
+
}
|
|
42591
42602
|
return {
|
|
42592
42603
|
url: normalizeUrl(config2.konstant.gateway_url),
|
|
42593
42604
|
mode: "mode-1-shared-cloud",
|
|
@@ -43291,17 +43302,31 @@ async function runServe(options = {}) {
|
|
|
43291
43302
|
const configPath = options.configPath ?? getConfigPath();
|
|
43292
43303
|
const store = new ConfigStore({ path: configPath, log });
|
|
43293
43304
|
const config2 = store.getCurrent();
|
|
43294
|
-
|
|
43295
|
-
|
|
43296
|
-
|
|
43297
|
-
|
|
43298
|
-
|
|
43299
|
-
|
|
43305
|
+
try {
|
|
43306
|
+
resolveGatewayTarget(config2);
|
|
43307
|
+
} catch (err) {
|
|
43308
|
+
if (err instanceof GatewayResolutionError) {
|
|
43309
|
+
log(`error: ${err.message}`);
|
|
43310
|
+
process.exitCode = 1;
|
|
43311
|
+
return;
|
|
43300
43312
|
}
|
|
43301
|
-
|
|
43302
|
-
|
|
43303
|
-
|
|
43304
|
-
|
|
43313
|
+
throw err;
|
|
43314
|
+
}
|
|
43315
|
+
store.onChange((next, prev) => {
|
|
43316
|
+
try {
|
|
43317
|
+
if (next.konstant.api_key !== prev.konstant.api_key) {
|
|
43318
|
+
log("config: api_key rotated; new requests will use the updated key.");
|
|
43319
|
+
}
|
|
43320
|
+
if (resolveGateway(next) !== resolveGateway(prev)) {
|
|
43321
|
+
log(`config: target changed (${resolveGateway(prev)} \u2192 ${resolveGateway(next)}).`);
|
|
43322
|
+
}
|
|
43323
|
+
if (next.konstant.tenant_id !== prev.konstant.tenant_id) {
|
|
43324
|
+
log(
|
|
43325
|
+
`config: tenant_id changed (${prev.konstant.tenant_id} \u2192 ${next.konstant.tenant_id}).`
|
|
43326
|
+
);
|
|
43327
|
+
}
|
|
43328
|
+
} catch (err) {
|
|
43329
|
+
log(`config: ${err instanceof Error ? err.message : String(err)}`);
|
|
43305
43330
|
}
|
|
43306
43331
|
});
|
|
43307
43332
|
store.watch();
|
|
@@ -43419,17 +43444,25 @@ async function runDoctor(options = {}) {
|
|
|
43419
43444
|
}
|
|
43420
43445
|
}
|
|
43421
43446
|
if (config2) {
|
|
43422
|
-
|
|
43423
|
-
|
|
43424
|
-
|
|
43425
|
-
|
|
43426
|
-
|
|
43427
|
-
|
|
43428
|
-
name: "
|
|
43429
|
-
|
|
43430
|
-
|
|
43431
|
-
|
|
43432
|
-
|
|
43447
|
+
let target = null;
|
|
43448
|
+
try {
|
|
43449
|
+
target = resolveGatewayTarget(config2);
|
|
43450
|
+
checks.push({ name: "mode", ok: true, detail: `${target.label}, target=${target.url}` });
|
|
43451
|
+
} catch (err) {
|
|
43452
|
+
if (!(err instanceof GatewayResolutionError)) throw err;
|
|
43453
|
+
checks.push({ name: "mode", ok: false, detail: err.message });
|
|
43454
|
+
}
|
|
43455
|
+
if (target) {
|
|
43456
|
+
const reach = await reachable(target.url, options.fetchImpl);
|
|
43457
|
+
checks.push(reach);
|
|
43458
|
+
const auth = await verifyAuth(config2, options.fetchImpl);
|
|
43459
|
+
checks.push({
|
|
43460
|
+
name: "auth",
|
|
43461
|
+
ok: auth.ok,
|
|
43462
|
+
detail: auth.ok ? `whoami ok (status ${auth.status})` : `whoami failed (status ${auth.status}): ${auth.message}`
|
|
43463
|
+
});
|
|
43464
|
+
checks.push(await mcpHandshake(config2));
|
|
43465
|
+
}
|
|
43433
43466
|
}
|
|
43434
43467
|
const ok = checks.every((c) => c.ok);
|
|
43435
43468
|
for (const c of checks) {
|
package/package.json
CHANGED