camstack 1.2.14 → 1.2.16
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/chunk-LMMQX4CK.js +49 -0
- package/dist/{chunk-EA6763XQ.js → chunk-O5WJH4RV.js} +312 -135
- package/dist/chunk-RA674VWL.js +2785 -0
- package/dist/cli.js +27 -13
- package/dist/{discover-UMBUCPOL.js → discover-XMMUBDEM.js} +2 -2
- package/dist/{discover-addons-MHWUAAMX.js → discover-addons-3N32LTH7.js} +1 -1
- package/dist/dist-RV3V7TEU.js +902 -0
- package/dist/launcher-QKPDMXLY.js +382860 -0
- package/dist/main-IM5JIKX5.js +2302 -0
- package/package.json +1 -1
- package/dist/chunk-K3NQKI34.js +0 -10
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
runDiscover
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-O5WJH4RV.js";
|
|
5
|
+
import "./chunk-LMMQX4CK.js";
|
|
6
6
|
|
|
7
7
|
// src/cli.ts
|
|
8
8
|
import { createRequire } from "module";
|
|
@@ -15,7 +15,9 @@ import { parseArgs as parseArgs7 } from "util";
|
|
|
15
15
|
import { parseArgs } from "util";
|
|
16
16
|
function buildServeEnv(opts) {
|
|
17
17
|
const env = {
|
|
18
|
-
CAMSTACK_MODE
|
|
18
|
+
// `CAMSTACK_ROLE`, not `CAMSTACK_MODE` — see agent.ts. This one worked
|
|
19
|
+
// only because an empty role DEFAULTS to hub, i.e. by accident.
|
|
20
|
+
CAMSTACK_ROLE: "hub"
|
|
19
21
|
};
|
|
20
22
|
if (opts.port) env.PORT = opts.port;
|
|
21
23
|
if (opts.data) env.CAMSTACK_DATA = opts.data;
|
|
@@ -36,7 +38,7 @@ async function runServe(args) {
|
|
|
36
38
|
...typeof values.data === "string" ? { data: values.data } : {}
|
|
37
39
|
};
|
|
38
40
|
Object.assign(process.env, buildServeEnv(opts));
|
|
39
|
-
await import("
|
|
41
|
+
await import("./launcher-QKPDMXLY.js");
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
// src/commands/agent.ts
|
|
@@ -46,7 +48,11 @@ function buildAgentEnv(opts) {
|
|
|
46
48
|
const hubPort = opts.port ?? "4443";
|
|
47
49
|
const agentName = opts.name ?? `${os.hostname()}-${os.arch()}`;
|
|
48
50
|
return {
|
|
49
|
-
CAMSTACK_MODE
|
|
51
|
+
// `CAMSTACK_ROLE`, not `CAMSTACK_MODE`. Nothing in server/backend has ever
|
|
52
|
+
// read `CAMSTACK_MODE` — the role switch is `resolveNodeRole`
|
|
53
|
+
// (server/backend/src/node-role.ts), which returns 'hub' for an EMPTY
|
|
54
|
+
// value. So `camstack agent` set a variable no one reads and booted a HUB.
|
|
55
|
+
CAMSTACK_ROLE: "agent",
|
|
50
56
|
CAMSTACK_HUB_URL: `ws://${opts.hub}:${hubPort}/agent`,
|
|
51
57
|
CAMSTACK_HUB_TOKEN: opts.token,
|
|
52
58
|
CAMSTACK_AGENT_NAME: agentName
|
|
@@ -77,7 +83,7 @@ async function runAgent(args) {
|
|
|
77
83
|
...typeof values.port === "string" ? { port: values.port } : {}
|
|
78
84
|
};
|
|
79
85
|
Object.assign(process.env, buildAgentEnv(opts));
|
|
80
|
-
await import("
|
|
86
|
+
await import("./launcher-QKPDMXLY.js");
|
|
81
87
|
}
|
|
82
88
|
|
|
83
89
|
// src/commands/setup.ts
|
|
@@ -278,13 +284,13 @@ async function resolveAddonPathInteractive(arg) {
|
|
|
278
284
|
}
|
|
279
285
|
const cwdAbs = path2.resolve(".");
|
|
280
286
|
if (fs2.existsSync(path2.join(cwdAbs, "package.json"))) {
|
|
281
|
-
const { discoverAddonsInCwd: discoverAddonsInCwd2 } = await import("./discover-addons-
|
|
287
|
+
const { discoverAddonsInCwd: discoverAddonsInCwd2 } = await import("./discover-addons-3N32LTH7.js");
|
|
282
288
|
const direct = discoverAddonsInCwd2(cwdAbs, 0);
|
|
283
289
|
if (direct.length > 0 && direct[0].path === cwdAbs) {
|
|
284
290
|
return cwdAbs;
|
|
285
291
|
}
|
|
286
292
|
}
|
|
287
|
-
const { discoverAddonsInCwd } = await import("./discover-addons-
|
|
293
|
+
const { discoverAddonsInCwd } = await import("./discover-addons-3N32LTH7.js");
|
|
288
294
|
const candidates = discoverAddonsInCwd(cwdAbs, 5);
|
|
289
295
|
if (candidates.length === 0) {
|
|
290
296
|
throw new Error(
|
|
@@ -376,7 +382,7 @@ function packAddon(addonDir) {
|
|
|
376
382
|
};
|
|
377
383
|
}
|
|
378
384
|
async function fetchOnlineAgents(serverUrl, token) {
|
|
379
|
-
const url = `${serverUrl}/trpc/nodes.topology?input=${encodeURIComponent('{"json":
|
|
385
|
+
const url = `${serverUrl}/trpc/nodes.topology?input=${encodeURIComponent('{"json":{}}')}`;
|
|
380
386
|
const res = await hubRequest(url, {
|
|
381
387
|
headers: { Authorization: `Bearer ${token}` }
|
|
382
388
|
});
|
|
@@ -386,7 +392,15 @@ async function fetchOnlineAgents(serverUrl, token) {
|
|
|
386
392
|
);
|
|
387
393
|
}
|
|
388
394
|
const body = await res.json();
|
|
389
|
-
|
|
395
|
+
if (body.error) {
|
|
396
|
+
throw new Error(`nodes.topology failed: ${body.error.json?.message ?? "unknown error"}`);
|
|
397
|
+
}
|
|
398
|
+
const nodes = body.result?.data?.json;
|
|
399
|
+
if (!Array.isArray(nodes)) {
|
|
400
|
+
throw new Error(
|
|
401
|
+
"nodes.topology returned no node list \u2014 refusing to assume the cluster is empty"
|
|
402
|
+
);
|
|
403
|
+
}
|
|
390
404
|
return nodes.filter((n) => n.isOnline && !n.isHub);
|
|
391
405
|
}
|
|
392
406
|
async function uploadToTarget(args) {
|
|
@@ -478,8 +492,8 @@ async function deployAddon(addonPath, opts) {
|
|
|
478
492
|
}
|
|
479
493
|
} catch (err) {
|
|
480
494
|
const msg = err instanceof Error ? err.message : String(err);
|
|
481
|
-
|
|
482
|
-
|
|
495
|
+
throw new Error(
|
|
496
|
+
`--cluster: cannot enumerate agents, refusing a partial cluster deploy (${msg}). Deploy per node with -n <nodeId> if this is intentional.`
|
|
483
497
|
);
|
|
484
498
|
}
|
|
485
499
|
} else {
|
|
@@ -1079,7 +1093,7 @@ function isUnknown(_value) {
|
|
|
1079
1093
|
return true;
|
|
1080
1094
|
}
|
|
1081
1095
|
async function resolveServerInteractive(presetNamespace) {
|
|
1082
|
-
const { discoverNodes, resolveHubFromDiscovered, filterHubNodes, DEFAULT_HUB_HTTPS_PORT } = await import("./discover-
|
|
1096
|
+
const { discoverNodes, resolveHubFromDiscovered, filterHubNodes, DEFAULT_HUB_HTTPS_PORT } = await import("./discover-XMMUBDEM.js");
|
|
1083
1097
|
if (presetNamespace) {
|
|
1084
1098
|
const spinner4 = clack.spinner();
|
|
1085
1099
|
spinner4.start(`Discovering hub on LAN (namespace "${presetNamespace}")`);
|