camstack 1.2.16 → 1.2.18

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/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runDiscover
4
- } from "./chunk-O5WJH4RV.js";
4
+ } from "./chunk-DNOHVKC5.js";
5
5
  import "./chunk-LMMQX4CK.js";
6
6
 
7
7
  // src/cli.ts
@@ -38,7 +38,7 @@ async function runServe(args) {
38
38
  ...typeof values.data === "string" ? { data: values.data } : {}
39
39
  };
40
40
  Object.assign(process.env, buildServeEnv(opts));
41
- await import("./launcher-QKPDMXLY.js");
41
+ await import("./launcher-KGB5UIEY.js");
42
42
  }
43
43
 
44
44
  // src/commands/agent.ts
@@ -83,7 +83,7 @@ async function runAgent(args) {
83
83
  ...typeof values.port === "string" ? { port: values.port } : {}
84
84
  };
85
85
  Object.assign(process.env, buildAgentEnv(opts));
86
- await import("./launcher-QKPDMXLY.js");
86
+ await import("./launcher-KGB5UIEY.js");
87
87
  }
88
88
 
89
89
  // src/commands/setup.ts
@@ -244,9 +244,39 @@ function toDeployResult(value) {
244
244
  target: typeof value["target"] === "string" ? value["target"] : void 0,
245
245
  addonId: typeof value["addonId"] === "string" ? value["addonId"] : void 0,
246
246
  capabilities: Array.isArray(value["capabilities"]) ? value["capabilities"].filter((c) => typeof c === "string") : void 0,
247
+ reloaded: Array.isArray(value["reloaded"]) ? value["reloaded"].filter((c) => typeof c === "string") : void 0,
248
+ verifiedSha256: typeof value["verifiedSha256"] === "string" ? value["verifiedSha256"] : void 0,
247
249
  error: typeof value["error"] === "string" ? value["error"] : void 0
248
250
  };
249
251
  }
252
+ function checkDeployTarget(result, requestedNodeId) {
253
+ const actual = result.target;
254
+ if (actual === void 0) return null;
255
+ const expected = requestedNodeId ?? "hub";
256
+ if (actual === expected) return null;
257
+ return `the hub installed this on "${actual}", NOT on "${expected}" \u2014 the target was ignored. Nothing was deployed to the node you named.`;
258
+ }
259
+ function describeDeployOutcome(result, isAgentTarget) {
260
+ const id = result.packageName ?? result.addonId ?? "?";
261
+ const version = result.version ? `@${result.version}` : "";
262
+ const reloaded = result.reloaded;
263
+ const suffix = reloaded === void 0 ? "" : ` (reloaded: ${reloaded.join(", ") || "none"})`;
264
+ const detail = `${id}${version}${suffix}`;
265
+ if (!isAgentTarget) return { detail, warning: null };
266
+ if (reloaded === void 0) {
267
+ return {
268
+ detail,
269
+ warning: "node did not report what it reloaded \u2014 its hub runtime predates deploy verification, so nothing confirms the new code is running"
270
+ };
271
+ }
272
+ if (reloaded.length === 0) {
273
+ return {
274
+ detail,
275
+ warning: "bundle landed but the node reloaded NOTHING \u2014 it is probably still running the previous code. Check the node, or restart the addon."
276
+ };
277
+ }
278
+ return { detail, warning: null };
279
+ }
250
280
  function toPackFilenames(raw) {
251
281
  try {
252
282
  const parsed = JSON.parse(raw);
@@ -408,13 +438,7 @@ async function uploadToTarget(args) {
408
438
  const fileBuffer = fs2.readFileSync(tgzPath);
409
439
  const boundary = `----camstackcli${randomBytes(16).toString("hex")}`;
410
440
  const CRLF = "\r\n";
411
- const parts = [
412
- Buffer.from(
413
- `--${boundary}${CRLF}Content-Disposition: form-data; name="file"; filename="${path2.basename(tgzPath)}"${CRLF}Content-Type: application/gzip${CRLF}${CRLF}`
414
- ),
415
- fileBuffer,
416
- Buffer.from(CRLF)
417
- ];
441
+ const parts = [];
418
442
  const appendField = (name, value) => {
419
443
  parts.push(
420
444
  Buffer.from(
@@ -424,6 +448,13 @@ async function uploadToTarget(args) {
424
448
  };
425
449
  if (nodeId) appendField("nodeId", nodeId);
426
450
  if (addonId) appendField("addonId", addonId);
451
+ parts.push(
452
+ Buffer.from(
453
+ `--${boundary}${CRLF}Content-Disposition: form-data; name="file"; filename="${path2.basename(tgzPath)}"${CRLF}Content-Type: application/gzip${CRLF}${CRLF}`
454
+ ),
455
+ fileBuffer,
456
+ Buffer.from(CRLF)
457
+ );
427
458
  parts.push(Buffer.from(`--${boundary}--${CRLF}`));
428
459
  const body = Buffer.concat(parts);
429
460
  const response = await hubRequest(`${serverUrl}/api/addons/upload`, {
@@ -517,11 +548,14 @@ async function deployAddon(addonPath, opts) {
517
548
  )
518
549
  }
519
550
  );
520
- if (result.success) {
521
- const id = result.packageName ?? result.addonId ?? "?";
522
- const ver = result.version ? `@${result.version}` : "";
523
- const detail = `${id}${ver}`;
551
+ const misrouted = result.success ? checkDeployTarget(result, t.nodeId) : null;
552
+ if (misrouted) {
553
+ console.error(`[camstack] \u2717 ${t.label}: ${misrouted}`);
554
+ outcomes.push({ target: t.label, ok: false, detail: misrouted });
555
+ } else if (result.success) {
556
+ const { detail, warning } = describeDeployOutcome(result, t.nodeId !== void 0);
524
557
  console.log(`[camstack] \u2713 ${t.label}: ${detail}`);
558
+ if (warning) console.warn(`[camstack] \u26A0 ${t.label}: ${warning}`);
525
559
  outcomes.push({ target: t.label, ok: true, detail });
526
560
  } else {
527
561
  const detail = result.error ?? "unknown";
@@ -857,7 +891,7 @@ function toStatusView(value) {
857
891
  };
858
892
  }
859
893
  async function fetchServerStatus(serverUrl, token) {
860
- const url = `${serverUrl}/trpc/serverManagement.getServerPackageStatus?input=${encodeURIComponent('{"json":null}')}`;
894
+ const url = serverPackageStatusUrl(serverUrl);
861
895
  const res = await hubRequest(url, {
862
896
  headers: { Authorization: `Bearer ${token}` },
863
897
  timeoutMs: 1e4
@@ -866,6 +900,9 @@ async function fetchServerStatus(serverUrl, token) {
866
900
  const body = await res.json().catch(() => null);
867
901
  return toStatusView(unwrapTrpcJson(body));
868
902
  }
903
+ function serverPackageStatusUrl(serverUrl) {
904
+ return `${serverUrl}/trpc/serverManagement.getServerPackageStatus?input=${encodeURIComponent('{"json":{}}')}`;
905
+ }
869
906
  async function pollUntilPromoted(args) {
870
907
  const deadline = Date.now() + POLL_BUDGET_MS;
871
908
  let lastState = "";
@@ -1093,7 +1130,7 @@ function isUnknown(_value) {
1093
1130
  return true;
1094
1131
  }
1095
1132
  async function resolveServerInteractive(presetNamespace) {
1096
- const { discoverNodes, resolveHubFromDiscovered, filterHubNodes, DEFAULT_HUB_HTTPS_PORT } = await import("./discover-XMMUBDEM.js");
1133
+ const { discoverNodes, resolveHubFromDiscovered, filterHubNodes, DEFAULT_HUB_HTTPS_PORT } = await import("./discover-X6QNQEDL.js");
1097
1134
  if (presetNamespace) {
1098
1135
  const spinner4 = clack.spinner();
1099
1136
  spinner4.start(`Discovering hub on LAN (namespace "${presetNamespace}")`);
@@ -5,7 +5,7 @@ import {
5
5
  filterHubNodes,
6
6
  resolveHubFromDiscovered,
7
7
  runDiscover
8
- } from "./chunk-O5WJH4RV.js";
8
+ } from "./chunk-DNOHVKC5.js";
9
9
  import "./chunk-LMMQX4CK.js";
10
10
  export {
11
11
  DEFAULT_HUB_HTTPS_PORT,