githolon 0.78.0 → 0.80.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.
Files changed (2) hide show
  1. package/dist/cli.mjs +22 -12
  2. package/package.json +3 -3
package/dist/cli.mjs CHANGED
@@ -1171,8 +1171,9 @@ async function admitIntentOffers(eng, ws, ledger, offers, { receiptFence = null,
1171
1171
  let blob = offer?.blob instanceof Uint8Array ? offer.blob : null;
1172
1172
  try {
1173
1173
  if (!blob && typeof offer?.intentB64 === "string") blob = Uint8Array.from(atob(offer.intentB64), (c) => c.charCodeAt(0));
1174
- if (!blob || blob.byteLength === 0 || blob.byteLength > 8 * 1024 * 1024) {
1175
- rec.rejected.push({ oid: String(offer?.oid || "").slice(0, 10), error: "intent offer must carry intentB64 <= 8 MiB" });
1174
+ const maxOfferBytes = offer?.staged ? 64 * 1024 * 1024 : 8 * 1024 * 1024;
1175
+ if (!blob || blob.byteLength === 0 || blob.byteLength > maxOfferBytes) {
1176
+ rec.rejected.push({ oid: String(offer?.oid || "").slice(0, 10), error: `intent offer must carry intentB64 <= ${maxOfferBytes / (1024 * 1024)} MiB` });
1176
1177
  continue;
1177
1178
  }
1178
1179
  let doc = null;
@@ -3010,6 +3011,7 @@ __export(governance_exports, {
3010
3011
  STAGE_THRESHOLD_CHARS: () => STAGE_THRESHOLD_CHARS,
3011
3012
  buildCertificate: () => buildCertificate,
3012
3013
  buildRebirthPlan: () => buildRebirthPlan,
3014
+ canonicalPrincipal: () => canonicalPrincipal,
3013
3015
  certifyEra: () => certifyEra,
3014
3016
  consentRebirth: () => consentRebirth,
3015
3017
  discoverSigningDomain: () => discoverSigningDomain,
@@ -3104,17 +3106,23 @@ function resolveGovernancePrincipal(opts) {
3104
3106
  }
3105
3107
  return principal;
3106
3108
  }
3109
+ function canonicalPrincipal(principal) {
3110
+ const s = String(principal ?? "").trim();
3111
+ if (s === "") return "";
3112
+ return s.includes(":") ? s : `user:${s}`;
3113
+ }
3107
3114
  async function signAndPostOffer(ws, domain, directiveId, payload, opts) {
3108
3115
  const cloud = cloudBase(opts.cloud);
3109
3116
  const principal = resolveGovernancePrincipal(opts);
3110
3117
  const holon = await connectGovernance(cloud, ws);
3118
+ const resolvedDomain = domain ?? await discoverSigningDomain(holon, ws, directiveId, void 0);
3111
3119
  const device = await ensureDeviceKey(holon, principal);
3112
3120
  const sealed = await holon.signGovernanceOffer({
3113
- domain,
3121
+ domain: resolvedDomain,
3114
3122
  directiveId,
3115
3123
  payload,
3116
3124
  authorSecret: device.secret,
3117
- actor: `user:${principal}`
3125
+ actor: canonicalPrincipal(principal)
3118
3126
  });
3119
3127
  if (sealed.intentBytes.length > STAGE_THRESHOLD_CHARS) {
3120
3128
  const staged = await relaySealedOfferViaStage(cloud, ws, directiveId, sealed.intentBytes, fetch);
@@ -3152,7 +3160,7 @@ async function relaySealedOfferViaStage(cloud, ws, directiveId, intentBytesB64,
3152
3160
  return { sha256: sha2562, size: raw.length, verdict: { ok: r.ok, status: r.status, body } };
3153
3161
  }
3154
3162
  async function signAndPostGovernance(parent, directiveId, payload, opts) {
3155
- return signAndPostOffer(parent, "workspaces", directiveId, payload, opts);
3163
+ return signAndPostOffer(parent, opts.domain, directiveId, payload, opts);
3156
3164
  }
3157
3165
  async function grantOrRevoke(verb, kind, subject, opts) {
3158
3166
  const parent = opts.parent ?? "root";
@@ -3350,7 +3358,7 @@ async function keyEnroll(opts) {
3350
3358
  directiveId,
3351
3359
  payload: enrollPayload,
3352
3360
  authorSecret: device.secret,
3353
- actor: `user:${principal}`
3361
+ actor: canonicalPrincipal(principal)
3354
3362
  });
3355
3363
  const v = await holon.postGovernanceOffer({ directiveId, intentBytes: sealed.intentBytes, ws: parent });
3356
3364
  if (!v.ok) {
@@ -3481,8 +3489,9 @@ async function governanceOffer(ws, directiveId, opts) {
3481
3489
  if (opts.save !== void 0) {
3482
3490
  try {
3483
3491
  const holon = await connectGovernance(cloudBase(opts.cloud), ws);
3492
+ const domain = await discoverSigningDomain(holon, ws, directiveId, opts.domain);
3484
3493
  const device = await ensureDeviceKey(holon, principal);
3485
- const sealed = await holon.signGovernanceOffer({ directiveId, payload, authorSecret: device.secret, actor: `user:${principal}` });
3494
+ const sealed = await holon.signGovernanceOffer({ domain, directiveId, payload, authorSecret: device.secret, actor: canonicalPrincipal(principal) });
3486
3495
  writeFileSync4(opts.save, JSON.stringify({ ws, directiveId, principal, intentBytes: sealed.intentBytes }, null, 2) + "\n");
3487
3496
  } catch (e) {
3488
3497
  err2(e.message);
@@ -4133,7 +4142,7 @@ gov rebirth ${ws}:`);
4133
4142
  return 1;
4134
4143
  }
4135
4144
  signSecret = dk.secret;
4136
- actor = `user:${actorUid}`;
4145
+ actor = canonicalPrincipal(actorUid);
4137
4146
  }
4138
4147
  const res = author2(eng, "root", "workspaces", "rebirthWorkspace", { workspaceId, reason, rebornAt }, controllerHash, { authorSecret: signSecret, actor });
4139
4148
  if (res.ok === false) {
@@ -8378,8 +8387,8 @@ var HELP = {
8378
8387
  ]
8379
8388
  },
8380
8389
  gov: {
8381
- usage: "githolon gov <ws> <directiveId> [--payload <json> | --payload-file <f>] [--as <uid>] [--stamp] [--save <f>] [--cloud <url>]\n githolon gov relay <ws> <offer-file> [--cloud <url>]",
8382
- what: "Author ANY `workspaces` governance directive as a SIGNED offer to <ws> and relay it \u2014 the generic\nlane the grant/ws/key verbs are sugar over. The directive is planned against <ws>'s OWN folded law\n(we connect + sign locally with your enrolled key; the host relays opaque {intentBytes} and the\nkernel re-verifies the signature). SIGNING IS LOCAL: with --save it writes the sealed offer WITHOUT\nrelaying \u2014 sign now, relay later/elsewhere with `gov relay` (the only step that touches the cloud).\nThe acting principal needs an enrolled signing key (githolon key enroll | key import).",
8390
+ usage: "githolon gov <ws> <directiveId> [--domain <d>] [--payload <json> | --payload-file <f>] [--as <uid>] [--stamp] [--save <f>] [--cloud <url>]\n githolon gov relay <ws> <offer-file> [--cloud <url>]",
8391
+ what: "Author ANY governance directive as a SIGNED offer to <ws> and relay it \u2014 the generic lane. The\ndirective's DOMAIN is discovered from <ws>'s installed law (a tenant-composed domain like\n`co2_platform` routes correctly; --domain overrides; ambiguity names the candidates) \u2014 the generic\nlane the grant/ws/key verbs are sugar over. The directive is planned against <ws>'s OWN folded law\n(we connect + sign locally with your enrolled key; the host relays opaque {intentBytes} and the\nkernel re-verifies the signature). SIGNING IS LOCAL: with --save it writes the sealed offer WITHOUT\nrelaying \u2014 sign now, relay later/elsewhere with `gov relay` (the only step that touches the cloud).\nThe acting principal needs an enrolled signing key (githolon key enroll | key import).",
8383
8392
  flags: [
8384
8393
  ["--payload <json>", `the directive payload as a JSON object string ('{"name":"\u2026"}')`],
8385
8394
  ["--payload-file <f>", "read the payload JSON from a file instead"],
@@ -9021,7 +9030,8 @@ Identity (~/.holon/credentials.json \u2014 sessions auto-refresh):
9021
9030
  githolon key show | export [--principal <uid>] the device key's public identity (export --yes: secret)
9022
9031
 
9023
9032
  Governance (SIGNED client-side, relayed as {intentBytes} \u2014 never a host-author endpoint):
9024
- githolon gov <ws> <directive> [--payload <json>] author ANY workspaces directive as a signed offer
9033
+ githolon gov <ws> <directive> [--domain <d>] author ANY governance directive (domain discovered
9034
+ [--payload <json>] from installed law; --domain overrides) as a signed offer
9025
9035
  [--as <uid>] [--stamp] [--save <file>] to <ws> (--save signs without relaying; relay later)
9026
9036
  githolon gov relay <ws> <offer-file> relay a saved offer (the only step that hits the cloud)
9027
9037
  githolon gov rebirth <ws> --reason <text> LAWFUL SUPERSESSION (recovery verb 3): supersede a
@@ -9782,7 +9792,7 @@ ${commandHelp("gov") ?? USAGE}`);
9782
9792
  }
9783
9793
  const [ws, directiveId] = pos;
9784
9794
  if (ws === void 0 || directiveId === void 0) {
9785
- process.stderr.write(`error: expected: githolon gov <ws> <directiveId> [--payload <json>] [--as <uid>]
9795
+ process.stderr.write(`error: expected: githolon gov <ws> <directiveId> [--domain <d>] [--payload <json>] [--as <uid>]
9786
9796
 
9787
9797
  ${commandHelp("gov") ?? USAGE}`);
9788
9798
  return 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "githolon",
3
- "version": "0.78.0",
3
+ "version": "0.80.0",
4
4
  "type": "module",
5
5
  "description": "githolon — the Nomos developer CLI: Rails-style generators for @githolon/dsl domains + the package compiler. Kernel-independent.",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -29,8 +29,8 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@bjorn3/browser_wasi_shim": "0.4.2",
32
- "@githolon/client": "^0.78.0",
33
- "@githolon/dsl": "^0.78.0",
32
+ "@githolon/client": "^0.80.0",
33
+ "@githolon/dsl": "^0.80.0",
34
34
  "isomorphic-git": "^1.38.4"
35
35
  },
36
36
  "devDependencies": {