githolon 0.78.0 → 0.79.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 +19 -10
  2. package/package.json +3 -3
package/dist/cli.mjs CHANGED
@@ -3010,6 +3010,7 @@ __export(governance_exports, {
3010
3010
  STAGE_THRESHOLD_CHARS: () => STAGE_THRESHOLD_CHARS,
3011
3011
  buildCertificate: () => buildCertificate,
3012
3012
  buildRebirthPlan: () => buildRebirthPlan,
3013
+ canonicalPrincipal: () => canonicalPrincipal,
3013
3014
  certifyEra: () => certifyEra,
3014
3015
  consentRebirth: () => consentRebirth,
3015
3016
  discoverSigningDomain: () => discoverSigningDomain,
@@ -3104,17 +3105,23 @@ function resolveGovernancePrincipal(opts) {
3104
3105
  }
3105
3106
  return principal;
3106
3107
  }
3108
+ function canonicalPrincipal(principal) {
3109
+ const s = String(principal ?? "").trim();
3110
+ if (s === "") return "";
3111
+ return s.includes(":") ? s : `user:${s}`;
3112
+ }
3107
3113
  async function signAndPostOffer(ws, domain, directiveId, payload, opts) {
3108
3114
  const cloud = cloudBase(opts.cloud);
3109
3115
  const principal = resolveGovernancePrincipal(opts);
3110
3116
  const holon = await connectGovernance(cloud, ws);
3117
+ const resolvedDomain = domain ?? await discoverSigningDomain(holon, ws, directiveId, void 0);
3111
3118
  const device = await ensureDeviceKey(holon, principal);
3112
3119
  const sealed = await holon.signGovernanceOffer({
3113
- domain,
3120
+ domain: resolvedDomain,
3114
3121
  directiveId,
3115
3122
  payload,
3116
3123
  authorSecret: device.secret,
3117
- actor: `user:${principal}`
3124
+ actor: canonicalPrincipal(principal)
3118
3125
  });
3119
3126
  if (sealed.intentBytes.length > STAGE_THRESHOLD_CHARS) {
3120
3127
  const staged = await relaySealedOfferViaStage(cloud, ws, directiveId, sealed.intentBytes, fetch);
@@ -3152,7 +3159,7 @@ async function relaySealedOfferViaStage(cloud, ws, directiveId, intentBytesB64,
3152
3159
  return { sha256: sha2562, size: raw.length, verdict: { ok: r.ok, status: r.status, body } };
3153
3160
  }
3154
3161
  async function signAndPostGovernance(parent, directiveId, payload, opts) {
3155
- return signAndPostOffer(parent, "workspaces", directiveId, payload, opts);
3162
+ return signAndPostOffer(parent, opts.domain, directiveId, payload, opts);
3156
3163
  }
3157
3164
  async function grantOrRevoke(verb, kind, subject, opts) {
3158
3165
  const parent = opts.parent ?? "root";
@@ -3350,7 +3357,7 @@ async function keyEnroll(opts) {
3350
3357
  directiveId,
3351
3358
  payload: enrollPayload,
3352
3359
  authorSecret: device.secret,
3353
- actor: `user:${principal}`
3360
+ actor: canonicalPrincipal(principal)
3354
3361
  });
3355
3362
  const v = await holon.postGovernanceOffer({ directiveId, intentBytes: sealed.intentBytes, ws: parent });
3356
3363
  if (!v.ok) {
@@ -3481,8 +3488,9 @@ async function governanceOffer(ws, directiveId, opts) {
3481
3488
  if (opts.save !== void 0) {
3482
3489
  try {
3483
3490
  const holon = await connectGovernance(cloudBase(opts.cloud), ws);
3491
+ const domain = await discoverSigningDomain(holon, ws, directiveId, opts.domain);
3484
3492
  const device = await ensureDeviceKey(holon, principal);
3485
- const sealed = await holon.signGovernanceOffer({ directiveId, payload, authorSecret: device.secret, actor: `user:${principal}` });
3493
+ const sealed = await holon.signGovernanceOffer({ domain, directiveId, payload, authorSecret: device.secret, actor: canonicalPrincipal(principal) });
3486
3494
  writeFileSync4(opts.save, JSON.stringify({ ws, directiveId, principal, intentBytes: sealed.intentBytes }, null, 2) + "\n");
3487
3495
  } catch (e) {
3488
3496
  err2(e.message);
@@ -4133,7 +4141,7 @@ gov rebirth ${ws}:`);
4133
4141
  return 1;
4134
4142
  }
4135
4143
  signSecret = dk.secret;
4136
- actor = `user:${actorUid}`;
4144
+ actor = canonicalPrincipal(actorUid);
4137
4145
  }
4138
4146
  const res = author2(eng, "root", "workspaces", "rebirthWorkspace", { workspaceId, reason, rebornAt }, controllerHash, { authorSecret: signSecret, actor });
4139
4147
  if (res.ok === false) {
@@ -8378,8 +8386,8 @@ var HELP = {
8378
8386
  ]
8379
8387
  },
8380
8388
  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).",
8389
+ 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>]",
8390
+ 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
8391
  flags: [
8384
8392
  ["--payload <json>", `the directive payload as a JSON object string ('{"name":"\u2026"}')`],
8385
8393
  ["--payload-file <f>", "read the payload JSON from a file instead"],
@@ -9021,7 +9029,8 @@ Identity (~/.holon/credentials.json \u2014 sessions auto-refresh):
9021
9029
  githolon key show | export [--principal <uid>] the device key's public identity (export --yes: secret)
9022
9030
 
9023
9031
  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
9032
+ githolon gov <ws> <directive> [--domain <d>] author ANY governance directive (domain discovered
9033
+ [--payload <json>] from installed law; --domain overrides) as a signed offer
9025
9034
  [--as <uid>] [--stamp] [--save <file>] to <ws> (--save signs without relaying; relay later)
9026
9035
  githolon gov relay <ws> <offer-file> relay a saved offer (the only step that hits the cloud)
9027
9036
  githolon gov rebirth <ws> --reason <text> LAWFUL SUPERSESSION (recovery verb 3): supersede a
@@ -9782,7 +9791,7 @@ ${commandHelp("gov") ?? USAGE}`);
9782
9791
  }
9783
9792
  const [ws, directiveId] = pos;
9784
9793
  if (ws === void 0 || directiveId === void 0) {
9785
- process.stderr.write(`error: expected: githolon gov <ws> <directiveId> [--payload <json>] [--as <uid>]
9794
+ process.stderr.write(`error: expected: githolon gov <ws> <directiveId> [--domain <d>] [--payload <json>] [--as <uid>]
9786
9795
 
9787
9796
  ${commandHelp("gov") ?? USAGE}`);
9788
9797
  return 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "githolon",
3
- "version": "0.78.0",
3
+ "version": "0.79.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.79.0",
33
+ "@githolon/dsl": "^0.79.0",
34
34
  "isomorphic-git": "^1.38.4"
35
35
  },
36
36
  "devDependencies": {