@cmmd-center/forge 0.9.4 → 0.9.6

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.
Files changed (41) hide show
  1. package/dist/{BunHttpServer-BgNCpQzV.mjs → BunHttpServer-C_855q3m.mjs} +6 -6
  2. package/dist/{BunHttpServer-DOAuw4Iq.cjs → BunHttpServer-Dxx0kzQc.cjs} +6 -6
  3. package/dist/{BunPTY-D-Klry5N.mjs → BunPTY-B7ThejfA.mjs} +3 -3
  4. package/dist/{BunPTY-2icf7sRj.cjs → BunPTY-BjHFZATJ.cjs} +3 -3
  5. package/dist/{BunServices-ChM4mYH9.mjs → BunServices-BFygTrvx.mjs} +3 -3
  6. package/dist/{BunServices-CiNXNzHD.cjs → BunServices-U1VBnEJS.cjs} +3 -3
  7. package/dist/{Cache-XSj5g7uG.cjs → Cache-BRhFH80U.cjs} +3 -3
  8. package/dist/{Cache-Cm78WiyU.mjs → Cache-CHvh_vWI.mjs} +3 -3
  9. package/dist/{Config-DMA9WqtC.cjs → Config-BHRBB8XM.cjs} +2 -2
  10. package/dist/{Config-DrOyN3WS.mjs → Config-To1VEqlB.mjs} +2 -2
  11. package/dist/{HttpServer-aJkhz6yu.cjs → HttpServer-BTcgkY38.cjs} +123 -4
  12. package/dist/{HttpServer-ByyNdEXm.mjs → HttpServer-DV-x5DVo.mjs} +118 -4
  13. package/dist/{NodeHttpServer-D_ismXpd.cjs → NodeHttpServer-D6YVHsL8.cjs} +7 -7
  14. package/dist/{NodeHttpServer-C_wePPV0.mjs → NodeHttpServer-DgD75IAg.mjs} +7 -7
  15. package/dist/{NodePTY-cb7HIasY.cjs → NodePTY-Bd9mvI6U.cjs} +4 -4
  16. package/dist/{NodePTY-BMUFdM93.mjs → NodePTY-RnitYPTs.mjs} +4 -4
  17. package/dist/{NodeServices-BAl07hlH.cjs → NodeServices-BcQL_53W.cjs} +1 -1
  18. package/dist/{NodeServices-BISZRY3e.cjs → NodeServices-BjmXNhpe.cjs} +3 -3
  19. package/dist/{NodeServices-Bqqy4DuH.mjs → NodeServices-Da5rUDDE.mjs} +3 -3
  20. package/dist/{NodeSqliteClient-SsUCk9mA.cjs → NodeSqliteClient-CG_mPdVp.cjs} +6 -6
  21. package/dist/{NodeSqliteClient-OdI1TawL.mjs → NodeSqliteClient-CcLD4Zvr.mjs} +6 -6
  22. package/dist/{NodeTerminal-B9u7fFYa.cjs → NodeTerminal-D86oor5_.cjs} +3 -3
  23. package/dist/{NodeTerminal-_XekCzf-.mjs → NodeTerminal-Ke6chk0A.mjs} +3 -3
  24. package/dist/{PTY-U3JQnLXS.cjs → PTY-BB84iC10.cjs} +2 -2
  25. package/dist/{PTY-CBkE5akF.mjs → PTY-X-4Tv31s.mjs} +2 -2
  26. package/dist/{Path-Bwl3ltR5.mjs → Path-DJTwK58E.mjs} +2 -2
  27. package/dist/{Path-CsbBuCFB.cjs → Path-qpublmG3.cjs} +2 -2
  28. package/dist/{Schema-CTXk8IgN.mjs → Schema-CKuz8TX8.mjs} +61 -6
  29. package/dist/{Schema-Bij_WAra.cjs → Schema-DaFukK_y.cjs} +72 -5
  30. package/dist/{SqlError-C2mi8_tp.cjs → SqlError-CsWFS-OU.cjs} +3 -3
  31. package/dist/{SqlError-1c-3v7GY.mjs → SqlError-DhK0hV8S.mjs} +3 -3
  32. package/dist/{SqliteClient-CdAhI4lb.cjs → SqliteClient-BpjZWL6O.cjs} +5 -5
  33. package/dist/{SqliteClient-aoOb51gB.mjs → SqliteClient-CA7vjiUj.mjs} +5 -5
  34. package/dist/bin.cjs +435 -88
  35. package/dist/bin.mjs +458 -112
  36. package/dist/{open-FIgTDosf.mjs → open-D8mGyWmt.mjs} +3 -3
  37. package/dist/runtimeBootstrap.cjs +1 -1
  38. package/dist/runtimeBootstrap.mjs +1 -1
  39. package/dist/{runtimeControlAuthority-Dm9z5ziU.mjs → runtimeControlAuthority-L85w5RTn.mjs} +33 -3
  40. package/dist/{runtimeControlAuthority-Dx6Y5LPI.cjs → runtimeControlAuthority-SNBF5Mjy.cjs} +33 -3
  41. package/package.json +1 -1
@@ -2,7 +2,7 @@
2
2
 
3
3
  import childProcess, { execFile } from "node:child_process";
4
4
  import fs from "node:fs";
5
- import os from "node:os";
5
+ import $U from "node:os";
6
6
  import path from "node:path";
7
7
  import { fileURLToPath } from "node:url";
8
8
  import process from "node:process";
@@ -49,7 +49,7 @@ function isInsideContainer() {
49
49
  //#region ../../node_modules/.bun/is-wsl@3.1.1/node_modules/is-wsl/index.js
50
50
  const isWsl = () => {
51
51
  if (process.platform !== "linux") return false;
52
- if (os.release().toLowerCase().includes("microsoft")) {
52
+ if ($U.release().toLowerCase().includes("microsoft")) {
53
53
  if (isInsideContainer()) return false;
54
54
  return true;
55
55
  }
@@ -589,4 +589,4 @@ defineLazyProperty(apps, "safari", () => detectPlatformBinary({ darwin: "Safari"
589
589
  //#endregion
590
590
  export { apps, open as default, openApp };
591
591
 
592
- //# sourceMappingURL=open-FIgTDosf.mjs.map
592
+ //# sourceMappingURL=open-D8mGyWmt.mjs.map
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  require("./chunk-BhaIgcZK.cjs");
5
- const require_runtimeControlAuthority = require("./runtimeControlAuthority-Dx6Y5LPI.cjs");
5
+ const require_runtimeControlAuthority = require("./runtimeControlAuthority-SNBF5Mjy.cjs");
6
6
  exports.bootstrapRuntimeControlAuthorityFromNarrowGrant = require_runtimeControlAuthority.bootstrapRuntimeControlAuthorityFromNarrowGrant;
7
7
  exports.setRuntimeGrantToken = require_runtimeControlAuthority.setRuntimeGrantToken;
8
8
  exports.verifyCmmdRuntimeTicket = require_runtimeControlAuthority.verifyCmmdRuntimeTicket;
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { n as bootstrapRuntimeControlAuthorityFromNarrowGrant, s as verifyCmmdRuntimeTicket, u as setRuntimeGrantToken } from "./runtimeControlAuthority-Dm9z5ziU.mjs";
3
+ import { n as bootstrapRuntimeControlAuthorityFromNarrowGrant, s as verifyCmmdRuntimeTicket, u as setRuntimeGrantToken } from "./runtimeControlAuthority-L85w5RTn.mjs";
4
4
  export { bootstrapRuntimeControlAuthorityFromNarrowGrant, setRuntimeGrantToken, verifyCmmdRuntimeTicket };
@@ -249,13 +249,40 @@ const CONTROL_AUTHORITY_SCOPES = new Set(["heartbeat", "replication"]);
249
249
  var RuntimeControlAuthorityError = class extends Error {
250
250
  status;
251
251
  code;
252
+ /**
253
+ * Whether trying again could plausibly succeed.
254
+ *
255
+ * A restarting control plane and a wrong credential both fail here and need
256
+ * opposite responses: the first must be retried until the deploy finishes,
257
+ * the second must not be retried at all. Without this the caller cannot tell
258
+ * them apart and picks wrong in one direction or the other.
259
+ */
260
+ retryable;
252
261
  constructor(input) {
253
262
  super(input.message);
254
263
  this.name = "RuntimeControlAuthorityError";
255
264
  this.status = input.status ?? null;
256
265
  this.code = input.code;
266
+ this.retryable = input.retryable ?? false;
257
267
  }
258
268
  };
269
+ /** Longest body prefix quoted into an error message. */
270
+ const CONTROL_AUTHORITY_BODY_PREVIEW = 180;
271
+ /**
272
+ * A short, credential-free description of a body that would not parse.
273
+ *
274
+ * The point is to identify the RESPONDER. A proxy error page says who it is in
275
+ * its first line, and that one line is the whole difference between "CMMD is
276
+ * redeploying" and a multi-hour dig through a guest.
277
+ *
278
+ * Redacted because this lands in logs and the responder is not always the one
279
+ * we think it is: anything resembling a JWT or a long opaque token is stripped
280
+ * rather than trusted to be harmless.
281
+ */
282
+ function describeUnparsableBody(body) {
283
+ const collapsed = body.replace(/[A-Za-z0-9_-]{12,}\.[A-Za-z0-9_-]{12,}\.[A-Za-z0-9_-]{6,}/g, "<redacted-jwt>").replace(/[A-Za-z0-9_-]{40,}/g, "<redacted>").replace(/\s+/g, " ").trim();
284
+ return collapsed.length > CONTROL_AUTHORITY_BODY_PREVIEW ? `${collapsed.slice(0, CONTROL_AUTHORITY_BODY_PREVIEW)}…` : collapsed;
285
+ }
259
286
  let authority = null;
260
287
  let bootstrapInFlight = null;
261
288
  function normalizedControlPlaneUrl(value) {
@@ -352,15 +379,18 @@ async function readControlAuthorityResponse(response) {
352
379
  if (!response.ok) throw new RuntimeControlAuthorityError({
353
380
  status: response.status,
354
381
  code: "CMMD_RUNTIME_CONTROL_AUTHORITY_REJECTED",
382
+ retryable: response.status >= 500,
355
383
  message: `CMMD runtime control authority request failed (${response.status}).`
356
384
  });
385
+ const raw = await response.text().catch(() => "");
357
386
  try {
358
- return await response.json();
387
+ return JSON.parse(raw);
359
388
  } catch {
360
389
  throw new RuntimeControlAuthorityError({
361
390
  status: response.status,
362
391
  code: "CMMD_RUNTIME_CONTROL_AUTHORITY_INVALID_RESPONSE",
363
- message: "CMMD runtime control authority returned invalid JSON."
392
+ retryable: true,
393
+ message: `CMMD runtime control authority returned ${response.status} with a non-JSON body (content-type: ${response.headers.get("content-type") ?? "none"}): ${describeUnparsableBody(raw) || "<empty>"}`
364
394
  });
365
395
  }
366
396
  }
@@ -502,4 +532,4 @@ async function sendRuntimeControlHeartbeat(input) {
502
532
  //#endregion
503
533
  export { verifyCmmdAuthRuntimeTicket as a, verifyCmmdRuntimeTicketRefreshProof as c, createReadOnceFileTokenAccessor as d, sendRuntimeControlHeartbeat as i, runtimeGrantToken as l, bootstrapRuntimeControlAuthorityFromNarrowGrant as n, verifyCmmdClaudeReadinessTicket as o, readRuntimeControlAuthority as r, verifyCmmdRuntimeTicket as s, bootstrapRuntimeControlAuthority as t, setRuntimeGrantToken as u };
504
534
 
505
- //# sourceMappingURL=runtimeControlAuthority-Dm9z5ziU.mjs.map
535
+ //# sourceMappingURL=runtimeControlAuthority-L85w5RTn.mjs.map
@@ -250,13 +250,40 @@ const CONTROL_AUTHORITY_SCOPES = new Set(["heartbeat", "replication"]);
250
250
  var RuntimeControlAuthorityError = class extends Error {
251
251
  status;
252
252
  code;
253
+ /**
254
+ * Whether trying again could plausibly succeed.
255
+ *
256
+ * A restarting control plane and a wrong credential both fail here and need
257
+ * opposite responses: the first must be retried until the deploy finishes,
258
+ * the second must not be retried at all. Without this the caller cannot tell
259
+ * them apart and picks wrong in one direction or the other.
260
+ */
261
+ retryable;
253
262
  constructor(input) {
254
263
  super(input.message);
255
264
  this.name = "RuntimeControlAuthorityError";
256
265
  this.status = input.status ?? null;
257
266
  this.code = input.code;
267
+ this.retryable = input.retryable ?? false;
258
268
  }
259
269
  };
270
+ /** Longest body prefix quoted into an error message. */
271
+ const CONTROL_AUTHORITY_BODY_PREVIEW = 180;
272
+ /**
273
+ * A short, credential-free description of a body that would not parse.
274
+ *
275
+ * The point is to identify the RESPONDER. A proxy error page says who it is in
276
+ * its first line, and that one line is the whole difference between "CMMD is
277
+ * redeploying" and a multi-hour dig through a guest.
278
+ *
279
+ * Redacted because this lands in logs and the responder is not always the one
280
+ * we think it is: anything resembling a JWT or a long opaque token is stripped
281
+ * rather than trusted to be harmless.
282
+ */
283
+ function describeUnparsableBody(body) {
284
+ const collapsed = body.replace(/[A-Za-z0-9_-]{12,}\.[A-Za-z0-9_-]{12,}\.[A-Za-z0-9_-]{6,}/g, "<redacted-jwt>").replace(/[A-Za-z0-9_-]{40,}/g, "<redacted>").replace(/\s+/g, " ").trim();
285
+ return collapsed.length > CONTROL_AUTHORITY_BODY_PREVIEW ? `${collapsed.slice(0, CONTROL_AUTHORITY_BODY_PREVIEW)}…` : collapsed;
286
+ }
260
287
  let authority = null;
261
288
  let bootstrapInFlight = null;
262
289
  function normalizedControlPlaneUrl(value) {
@@ -353,15 +380,18 @@ async function readControlAuthorityResponse(response) {
353
380
  if (!response.ok) throw new RuntimeControlAuthorityError({
354
381
  status: response.status,
355
382
  code: "CMMD_RUNTIME_CONTROL_AUTHORITY_REJECTED",
383
+ retryable: response.status >= 500,
356
384
  message: `CMMD runtime control authority request failed (${response.status}).`
357
385
  });
386
+ const raw = await response.text().catch(() => "");
358
387
  try {
359
- return await response.json();
388
+ return JSON.parse(raw);
360
389
  } catch {
361
390
  throw new RuntimeControlAuthorityError({
362
391
  status: response.status,
363
392
  code: "CMMD_RUNTIME_CONTROL_AUTHORITY_INVALID_RESPONSE",
364
- message: "CMMD runtime control authority returned invalid JSON."
393
+ retryable: true,
394
+ message: `CMMD runtime control authority returned ${response.status} with a non-JSON body (content-type: ${response.headers.get("content-type") ?? "none"}): ${describeUnparsableBody(raw) || "<empty>"}`
365
395
  });
366
396
  }
367
397
  }
@@ -568,4 +598,4 @@ Object.defineProperty(exports, "verifyCmmdRuntimeTicketRefreshProof", {
568
598
  }
569
599
  });
570
600
 
571
- //# sourceMappingURL=runtimeControlAuthority-Dx6Y5LPI.cjs.map
601
+ //# sourceMappingURL=runtimeControlAuthority-SNBF5Mjy.cjs.map
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "cmmd-forge": "dist/bin.mjs"
10
10
  },
11
11
  "type": "module",
12
- "version": "0.9.4",
12
+ "version": "0.9.6",
13
13
  "engines": {
14
14
  "node": "^22.16 || ^23.11 || >=24.10"
15
15
  },