@cotal-ai/auth 0.12.0 → 0.13.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 (95) hide show
  1. package/dist/admission-mediator.d.ts +319 -0
  2. package/dist/admission-mediator.d.ts.map +1 -0
  3. package/dist/admission-mediator.js +1033 -0
  4. package/dist/admission-mediator.js.map +1 -0
  5. package/dist/auth-admin.d.ts +29 -0
  6. package/dist/auth-admin.d.ts.map +1 -0
  7. package/dist/auth-admin.js +224 -0
  8. package/dist/auth-admin.js.map +1 -0
  9. package/dist/authority-client.d.ts +215 -0
  10. package/dist/authority-client.d.ts.map +1 -0
  11. package/dist/authority-client.js +346 -0
  12. package/dist/authority-client.js.map +1 -0
  13. package/dist/barrier-evict.d.ts +16 -0
  14. package/dist/barrier-evict.d.ts.map +1 -0
  15. package/dist/barrier-evict.js +100 -0
  16. package/dist/barrier-evict.js.map +1 -0
  17. package/dist/connect-reader.d.ts +72 -0
  18. package/dist/connect-reader.d.ts.map +1 -0
  19. package/dist/connect-reader.js +154 -0
  20. package/dist/connect-reader.js.map +1 -0
  21. package/dist/continuity.d.ts.map +1 -1
  22. package/dist/continuity.js +3 -0
  23. package/dist/continuity.js.map +1 -1
  24. package/dist/credential-ledger.d.ts +343 -0
  25. package/dist/credential-ledger.d.ts.map +1 -0
  26. package/dist/credential-ledger.js +732 -0
  27. package/dist/credential-ledger.js.map +1 -0
  28. package/dist/drain-repair.d.ts +95 -0
  29. package/dist/drain-repair.d.ts.map +1 -0
  30. package/dist/drain-repair.js +305 -0
  31. package/dist/drain-repair.js.map +1 -0
  32. package/dist/idp.d.ts +19 -0
  33. package/dist/idp.d.ts.map +1 -1
  34. package/dist/idp.js +17 -0
  35. package/dist/idp.js.map +1 -1
  36. package/dist/index.d.ts +5 -2
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +29 -2
  39. package/dist/index.js.map +1 -1
  40. package/dist/issuer.d.ts +8 -0
  41. package/dist/issuer.d.ts.map +1 -1
  42. package/dist/issuer.js +4 -2
  43. package/dist/issuer.js.map +1 -1
  44. package/dist/ledger-scanner.d.ts +98 -0
  45. package/dist/ledger-scanner.d.ts.map +1 -0
  46. package/dist/ledger-scanner.js +352 -0
  47. package/dist/ledger-scanner.js.map +1 -0
  48. package/dist/ledger.d.ts +7 -0
  49. package/dist/ledger.d.ts.map +1 -1
  50. package/dist/ledger.js +53 -5
  51. package/dist/ledger.js.map +1 -1
  52. package/dist/lifecycle-registry.d.ts +397 -0
  53. package/dist/lifecycle-registry.d.ts.map +1 -0
  54. package/dist/lifecycle-registry.js +819 -0
  55. package/dist/lifecycle-registry.js.map +1 -0
  56. package/dist/permissions.d.ts +5 -1
  57. package/dist/permissions.d.ts.map +1 -1
  58. package/dist/permissions.js +29 -6
  59. package/dist/permissions.js.map +1 -1
  60. package/dist/plane-claim.d.ts +83 -0
  61. package/dist/plane-claim.d.ts.map +1 -0
  62. package/dist/plane-claim.js +290 -0
  63. package/dist/plane-claim.js.map +1 -0
  64. package/dist/provider.d.ts.map +1 -1
  65. package/dist/provider.js +2 -1
  66. package/dist/provider.js.map +1 -1
  67. package/dist/records-scanner.d.ts +78 -0
  68. package/dist/records-scanner.d.ts.map +1 -0
  69. package/dist/records-scanner.js +320 -0
  70. package/dist/records-scanner.js.map +1 -0
  71. package/dist/retirement-barrier.d.ts +217 -0
  72. package/dist/retirement-barrier.d.ts.map +1 -0
  73. package/dist/retirement-barrier.js +624 -0
  74. package/dist/retirement-barrier.js.map +1 -0
  75. package/dist/retirement-cleaner.d.ts +54 -0
  76. package/dist/retirement-cleaner.d.ts.map +1 -0
  77. package/dist/retirement-cleaner.js +158 -0
  78. package/dist/retirement-cleaner.js.map +1 -0
  79. package/dist/root-credential.d.ts +26 -0
  80. package/dist/root-credential.d.ts.map +1 -0
  81. package/dist/root-credential.js +116 -0
  82. package/dist/root-credential.js.map +1 -0
  83. package/dist/service.d.ts +60 -0
  84. package/dist/service.d.ts.map +1 -1
  85. package/dist/service.js +317 -10
  86. package/dist/service.js.map +1 -1
  87. package/dist/session-ledger.d.ts +224 -0
  88. package/dist/session-ledger.d.ts.map +1 -0
  89. package/dist/session-ledger.js +713 -0
  90. package/dist/session-ledger.js.map +1 -0
  91. package/dist/token.d.ts +17 -0
  92. package/dist/token.d.ts.map +1 -1
  93. package/dist/token.js +30 -2
  94. package/dist/token.js.map +1 -1
  95. package/package.json +5 -3
@@ -0,0 +1,154 @@
1
+ import { jetstreamManager } from "@nats-io/jetstream";
2
+ import { EpEnvelopeError, assertInboxConnId, epAuthBucket, recordsBucket } from "@cotal-ai/core";
3
+ import { assertAuthorityStreamShape, openLifecycleMappingReader, readLifecycleMappingLeader } from "./lifecycle-registry.js";
4
+ import { credRowKey, parseLedgerRow } from "./credential-ledger.js";
5
+ /**
6
+ * The connect reader's SCOPED credential grant (SPEC 13.9). Read-only over BOTH authority stores,
7
+ * plus the bind-time shape-proof INFO and a connection-scoped reply inbox. It holds NO write, NO
8
+ * consumer create/update/delete, NO `DIRECT.GET`, and no account-wide inbox.
9
+ *
10
+ * D32 residual (named, not pretend-confined): `$JS.API.STREAM.MSG.GET.<stream>` is body-selected —
11
+ * broker ACLs cannot scope it to only `cred.`/head subjects, so this grant is a space-wide read of
12
+ * credential METADATA (holderPrincipal/state/chain/lifecycleUid/exp; NO secret key material rides
13
+ * the row, confirmed against the closed `CredentialLedgerRow` schema) plus the caller-selected-reply
14
+ * injection class every raw `MSG.GET` profile carries. Acceptable for this trusted, bounded-lived,
15
+ * short-exp+renewed infra reader; a genuinely ledgered infra-reader family is the deferred
16
+ * infra-mint work (a self-minted reader is revoked by stopping the service / rotating the seed, not
17
+ * an agent-barrier revoke — it is not a managed-agent or endpoint descendant).
18
+ */
19
+ export function authConnectReaderGrants(space, connId) {
20
+ const auth = `KV_${epAuthBucket(space)}`;
21
+ const records = `KV_${recordsBucket(space)}`;
22
+ // `connId` is the ONLY untrusted subject-forming interpolant (the space-derived stream names are
23
+ // trusted boot config); route it through the same grammar the sibling mediator/cleaner builders
24
+ // use, so a `>`/`*`/dotted value can never widen the scoped inbox to an account-wide subscribe.
25
+ const inbox = assertInboxConnId(connId);
26
+ return {
27
+ publish: [
28
+ "$JS.API.INFO",
29
+ `$JS.API.STREAM.INFO.${auth}`,
30
+ `$JS.API.STREAM.INFO.${records}`,
31
+ `$JS.API.STREAM.MSG.GET.${auth}`,
32
+ `$JS.API.STREAM.MSG.GET.${records}`,
33
+ ],
34
+ subscribe: [`_INBOX_${inbox}.>`],
35
+ };
36
+ }
37
+ const READERS = new WeakMap();
38
+ function internals(reader) {
39
+ const i = READERS.get(reader);
40
+ if (!i)
41
+ throw new EpEnvelopeError("failed-precondition", "the connect reader was not constructed by openConnectReader(); a hand-assembled context never authorizes (SPEC 13.12)");
42
+ return i;
43
+ }
44
+ /**
45
+ * Open (or re-open, on reconnect) the connect reader on a DATA-account connection, shape-proving
46
+ * BOTH stores at bind (SPEC 13.12) — primary/un-mirrored/non-evicting, and the auth store
47
+ * additionally `allow_direct=false`. Call this on every (re)bind: a dropped reader reconnecting
48
+ * could land on a mirror/follower, so the primary-store proof must re-run before it serves any
49
+ * connect read again. A store that cannot be proved never serves.
50
+ */
51
+ export async function openConnectReader(nc, space) {
52
+ const authBucket = epAuthBucket(space);
53
+ let jsm;
54
+ try {
55
+ jsm = await jetstreamManager(nc);
56
+ const authCfg = (await jsm.streams.info(`KV_${authBucket}`)).config;
57
+ assertAuthorityStreamShape(authCfg, authBucket);
58
+ if (authCfg.allow_direct !== false)
59
+ throw new EpEnvelopeError("failed-precondition", `the auth store ${authBucket} has allow_direct=${String(authCfg.allow_direct)}, not false; a Direct-Get-capable credential store defeats leader-served deny-new (SPEC 13.1); reprovision`);
60
+ }
61
+ catch (e) {
62
+ if (e instanceof EpEnvelopeError)
63
+ throw e;
64
+ throw new EpEnvelopeError("failed-precondition", `the connect reader cannot bind + shape-prove the auth store ${authBucket} (SPEC 13.12): ${e?.message ?? String(e)}`);
65
+ }
66
+ // The records-head reads go through the mapping reader, which shape-proves the records store the
67
+ // same way at its own bind — so both stores are proved on this (re)bind.
68
+ const mapping = await openLifecycleMappingReader(nc, space);
69
+ const reader = Object.freeze({ space });
70
+ READERS.set(reader, { space, jsm, mapping });
71
+ return reader;
72
+ }
73
+ /**
74
+ * Leader-read a single credential-ledger row `cred.<uid>.<credid>` from the auth store (never a
75
+ * follower `DIRECT.GET`: a stale replica could still read `active` after a revoke). Returns
76
+ * `undefined` for a genuinely absent row; a DEL/PURGE marker or a garbled row THROWS (a deletion is
77
+ * never absence, and garbled trusted-path state never authorizes).
78
+ */
79
+ async function readCredRowLeader(reader, uid, credid) {
80
+ const { jsm, space } = internals(reader);
81
+ const bucket = epAuthBucket(space);
82
+ const key = credRowKey(uid, credid);
83
+ let m;
84
+ try {
85
+ m = await jsm.streams.getMessage(`KV_${bucket}`, { last_by_subj: `$KV.${bucket}.${key}` });
86
+ }
87
+ catch (e) {
88
+ if (e.code === 10037)
89
+ return undefined; // no message on the subject
90
+ throw e;
91
+ }
92
+ if (!m)
93
+ return undefined;
94
+ const op = m.header?.get("KV-Operation");
95
+ if (op)
96
+ throw new EpEnvelopeError("failed-precondition", `the credential row ${key} carries a ${op} marker; a deletion is never absence; a revoked credential is a row with state:"revoked", not a tombstone (SPEC 13.1)`);
97
+ return parseLedgerRow(m.data, key);
98
+ }
99
+ /** A source chain that is EXACTLY the single `root` member (the root-issuance case, whose deny-new
100
+ * also pins the lifecycle head's `currentCredentialId`). Session/handle chains are descendants. */
101
+ function isRootChain(chain) {
102
+ return chain.length === 1 && chain[0] === "root";
103
+ }
104
+ /**
105
+ * The connect-time deny-new check (SPEC 13.1). Assumes the caller (the ledger connect authorizer)
106
+ * has ALREADY run the actor-row + scope + lifecycle-equality checks; this adds the credential-row
107
+ * liveness proof. THROWS to deny; returns on allow. Fail-closed throughout: absent/revoked/expired/
108
+ * mismatched rows and every read failure deny.
109
+ *
110
+ * 1. the bearer MUST carry `act.credentialId` (grammar-valid from validateUserToken). Claimless =>
111
+ * deny (deny-new needs the claim; a pre-R1 bearer re-exchanges). A view bearer is NOT exempt;
112
+ * a bearer merely lacking `act.view` is a normal agent connect and is fine.
113
+ * 2. leader-read `cred.<lifecycleUid>.<credid>`; require it exist, be `active`, be unexpired under
114
+ * the service clock, and bind holderPrincipal `<owner>.<actor>` + lifecycleUid + credentialId
115
+ * with NO normalization slack.
116
+ * 3. root-issued credential (`sourceChain === ["root"]`): ALSO leader-read the lifecycle head and
117
+ * require it `active` with `currentCredentialId === credid`, so a SUPERSEDED root issuance is
118
+ * denied even if its old row still reads active (release-last keeps these consistent; head
119
+ * equality is the belt). A descendant (session/handle) leaf row is sufficient here: revoking an
120
+ * ancestor revokes the whole `cred.<uid>.>` family / `bysrc` chain and verified-evicts before
121
+ * the operation reports success, and after the leaf CAS deny-new holds.
122
+ */
123
+ export async function authorizeConnectCredential(reader, t, now) {
124
+ const credid = t.act.credentialId;
125
+ if (credid === undefined)
126
+ throw new EpEnvelopeError("permission-denied", "the bearer carries no credential claim (act.credentialId); connect deny-new requires it; re-exchange for a fresh bearer (lifecycle credential-bound from v0.4 R1)");
127
+ const uid = t.act.lifecycleUid;
128
+ if (uid === undefined)
129
+ throw new EpEnvelopeError("permission-denied", "the bearer carries no lifecycle claim; a credential row is keyed by lifecycle uid (SPEC 13.1)");
130
+ const row = await readCredRowLeader(reader, uid, credid);
131
+ if (row === undefined)
132
+ throw new EpEnvelopeError("permission-denied", `no credential row cred.${uid}.${credid}; a revoked or never-issued credential does not connect (deny-new, SPEC 13.1)`);
133
+ if (row.state !== "active")
134
+ throw new EpEnvelopeError("permission-denied", `credential cred.${uid}.${credid} is "${row.state}", not active; a revoked credential does not connect (deny-new, SPEC 13.1)`);
135
+ const holder = `${t.owner}.${t.act.actor}`;
136
+ if (row.holderPrincipal !== holder)
137
+ throw new EpEnvelopeError("permission-denied", `credential cred.${uid}.${credid} is held by "${row.holderPrincipal}", not the connecting principal "${holder}"; a credential never authorizes a different principal (SPEC 13.1)`);
138
+ if (row.lifecycleUid !== uid)
139
+ throw new EpEnvelopeError("permission-denied", `credential row cred.${uid}.${credid} names lifecycle ${row.lifecycleUid}, not ${uid} (key/value divergence, SPEC 13.1)`);
140
+ if (row.credentialId !== credid)
141
+ throw new EpEnvelopeError("permission-denied", `credential row cred.${uid}.${credid} names credentialId ${row.credentialId} (key/value divergence, SPEC 13.1)`);
142
+ if (row.exp <= now())
143
+ throw new EpEnvelopeError("permission-denied", `credential cred.${uid}.${credid} expired at ${row.exp}; a lapsed credential does not connect (SPEC 13.1)`);
144
+ if (isRootChain(row.sourceChain)) {
145
+ const head = await readLifecycleMappingLeader(internals(reader).mapping, t.owner, t.act.actor);
146
+ if (head === undefined)
147
+ throw new EpEnvelopeError("permission-denied", `no lifecycle head for "${t.owner}/${t.act.actor}"; a root credential connect requires the current head (SPEC 13.1)`);
148
+ if (head.mapping.state !== "active")
149
+ throw new EpEnvelopeError("permission-denied", `the lifecycle head for "${t.owner}/${t.act.actor}" is "${head.mapping.state}", not active; a root credential of a retiring/retired incarnation does not connect (SPEC 13.1)`);
150
+ if (head.mapping.currentCredentialId !== credid)
151
+ throw new EpEnvelopeError("permission-denied", `the current root credential for "${t.owner}/${t.act.actor}" is ${head.mapping.currentCredentialId ?? "(none)"}, not ${credid}; a superseded root issuance does not connect (deny-new, SPEC 13.1)`);
152
+ }
153
+ }
154
+ //# sourceMappingURL=connect-reader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connect-reader.js","sourceRoot":"","sources":["../src/connect-reader.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,gBAAgB,EAAyB,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACjG,OAAO,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,0BAA0B,EAA+B,MAAM,yBAAyB,CAAC;AAC1J,OAAO,EAAE,UAAU,EA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C"}
1
+ {"version":3,"file":"continuity.d.ts","sourceRoot":"","sources":["../src/continuity.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAWhG,eAAO,MAAM,sBAAsB,oCAAoC,CAAC;AAcxE;;;;;;;;GAQG;AACH,wBAAsB,wBAAwB,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAsF5H;AAQD,oFAAoF;AACpF,wBAAsB,4BAA4B,CAAC,KAAK,EAAE;IACxD,KAAK,EAAE,WAAW,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAsBlC"}
@@ -129,9 +129,12 @@ export async function validateRetainedManagedAgent(input) {
129
129
  throw new Error(`retained sentinel credential for ${input.owner}.${input.actor} does not match space "${input.space}"`);
130
130
  // This checks the token hash in constant time and re-walks the current delegation envelope.
131
131
  const row = ledgerAuthorizeAgentExchange(input.dir, input.owner, input.actor, input.actorToken);
132
+ if (!row.lifecycleUid)
133
+ throw new Error(`retained agent ${input.owner}.${input.actor} has no lifecycleUid on its current ledger row; re-grant it (bearers are lifecycle-bound from v0.4)`);
132
134
  return {
133
135
  owner: row.owner,
134
136
  actor: row.actor,
137
+ lifecycleUid: row.lifecycleUid,
135
138
  scope: [...row.scope],
136
139
  allowSubscribe: [...row.allowSubscribe],
137
140
  allowPublish: [...row.allowPublish],
@@ -1 +1 @@
1
- {"version":3,"file":"continuity.js","sourceRoot":"","sources":["../src/continuity.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,E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,CAAC,oCAAoC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,0BAA0B,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC;IAE1H,4FAA4F;IAC5F,MAAM,GAAG,GAAG,4BAA4B,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAChG,IAAI,CAAC,GAAG,CAAC,YAAY;QACnB,MAAM,IAAI,KAAK,CAAC,kBAAkB,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,qGAAqG,CAAC,CAAC;IACrK,OAAO;QACL,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,YAAY,EAAE,GAAG,CAAC,YAAY;QAC9B,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC;QACrB,cAAc,EAAE,CAAC,GAAG,GAAG,CAAC,cAAc,CAAC;QACvC,YAAY,EAAE,CAAC,GAAG,GAAG,CAAC,YAAY,CAAC;QACnC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,343 @@
1
+ /**
2
+ * The D13 NORMATIVE CREDENTIAL LEDGER + the full TAKEOVER ISSUANCE BARRIER, slices (3)+(2b)
3
+ * (SPEC §13.1, as amended). The sibling of `lifecycle-registry.ts`: the SAME minting authority
4
+ * over the SAME two stores, reached only through the sealed registry ({@link registryStores}),
5
+ * so a caller that cannot open the registry can neither write a ledger row nor run a barrier.
6
+ *
7
+ * What is here (all §13.1-normative):
8
+ * - the AGENT-family ledger rows `cred.<lifecycleUid>.<credentialId>` — the closed row schema
9
+ * `{ credentialId, holderPrincipal, lifecycleUid, sourceChain, state: active|revoked, exp }`
10
+ * (monotonic state; revoked rows are never deleted), the per-ancestor lineage index
11
+ * `bysrc.<issuerKeyId>.<id>.<lifecycleUid>.<credentialId>`, and the shared row codec the
12
+ * ENDPOINT family `epcred.<endpoint>.<instanceId>.<credentialId>` reuses (same schema, same
13
+ * discipline; the session adapter writes that family);
14
+ * - the MINT PROTOCOL (observe gate → write rows → revision-pinned gate touch-CAS → release):
15
+ * {@link stageAgentMint} + {@link finalizeAgentMint}. The touch is the §13.1 fence — a gate
16
+ * (or any presented source gate) that moved since observation makes the pinned write LOSE,
17
+ * the mint marks its OWN rows revoked and never releases. An unledgered mint cannot occur
18
+ * through this module: release is gated on finalize, and finalize is gated on the staged
19
+ * rows existing;
20
+ * - SOURCE GATES `srcgate.<issuerKeyId>.<id>` (`{ state: open | frozen }`, CAS): every handle
21
+ * in a presented chain is observed at stage and touch-CASed at finalize, and
22
+ * {@link revokeHandleSource} is the handle-revocation walk — freeze the source gate FIRST,
23
+ * enumerate `bysrc.`, revoke every descendant row, then VERIFIED cluster-wide eviction of
24
+ * every revoked row's holder principal (fail-closed; the gate stays frozen forever);
25
+ * - the TAKEOVER BARRIER {@link runAgentTakeoverBarrier} in the normative order: durable op
26
+ * intent (`stage.<opId>`, create-only) → gate CAS `open → frozen` carrying the intent →
27
+ * point-in-time enumeration of `cred.<lifecycleUid>.>` (the SEALED auth-ledger scanner's
28
+ * fence-free LastPerSubject read — `ledger-scanner.ts`; the barrier profile holds NO auth-stream
29
+ * `CONSUMER.CREATE`, whose body cannot be subject-confined, so the CREATE lives only in the
30
+ * scanner's own sealed credential) → revoke EVERY row → VERIFIED
31
+ * eviction of every holder principal (the injected `evictPrincipal` seam; `verifiedGone`
32
+ * is the ONLY success — anything else throws and the gate STAYS frozen) → the epoch head
33
+ * CAS LAST ({@link advanceEpochWithinTakeover}) → reopen the gate at generation G+1. Every
34
+ * boundary is crash-resumable from the durable intent ({@link resumeAgentTakeover}), and
35
+ * only the SAME operation resumes it.
36
+ *
37
+ * Deny-new vs kill-live, stated precisely (the two halves of revocation, §13.1):
38
+ * - the ledger row CAS is the deny-new SUBSTRATE (rows live in a replicated, leader-served
39
+ * JetStream KV, `allow_direct=false`, §13.12). The REDEEM arm is wired here: the session
40
+ * release reads the normative row and refuses a `revoked` one, so a burned session
41
+ * credential never re-releases. The CONNECT arm (the auth callout reading `cred.<uid>.<id>`
42
+ * to refuse an OFFLINE credential's reconnect) is NOT wired in this slice: it needs the
43
+ * ROOT credential ledgered (the head's `currentCredentialId`, which the activation saga
44
+ * leaves absent until production issuance) and the presented credential to carry its id, so
45
+ * it lands with production activation wiring. Until then, this barrier's deny-new covers the
46
+ * REDEEM path and the LIVE connections it evicts; an offline root credential whose lifecycle
47
+ * UID is preserved across takeover is NOT denied reconnect by the barrier alone (§13.1
48
+ * requires takeover to FAIL LOUD where it cannot revoke + verified-evict, e.g. static
49
+ * credentials — enforced at that connect-arm wiring, not here);
50
+ * - the injected verified eviction is the cluster-wide kill-live with re-scan (core
51
+ * `evictDeniedPrincipal`: CONNZ scan → per-server KICK → re-scan; partial scans fail
52
+ * closed), which handles the LIVE half regardless of the connect-arm.
53
+ *
54
+ * SURFACE: NOTHING here is exported from the package index. The executor seam is the sealed
55
+ * registry itself (constructed only over the minting authority's authenticated connection);
56
+ * an `opId` is an identifier, never a bearer capability. Implementation staging lives in the
57
+ * `stage.` family only — never under a ledger prefix a barrier enumerates.
58
+ */
59
+ import type { KV } from "@nats-io/kv";
60
+ import { type EvictionResult } from "@cotal-ai/core";
61
+ import { type LifecycleRegistry } from "./lifecycle-registry.js";
62
+ export declare const SOURCE_ROOT = "root";
63
+ /** Validate ONE sourceChain member — `root`, `handle.<issuerKeyId>.<id>`, or
64
+ * `session.<sessionId>` (SPEC 13.1) — and return its parsed shape. */
65
+ export declare function parseSourceMember(member: unknown): {
66
+ kind: "root";
67
+ } | {
68
+ kind: "handle";
69
+ issuerKeyId: string;
70
+ id: string;
71
+ } | {
72
+ kind: "session";
73
+ sessionId: string;
74
+ };
75
+ /** The agent-family ledger key `cred.<lifecycleUid>.<credentialId>`. */
76
+ export declare function credRowKey(lifecycleUid: string, credentialId: string): string;
77
+ /** The endpoint-family ledger key `epcred.<endpoint>.<instanceId>.<credentialId>` (disjoint by
78
+ * explicit prefix, never arity, SPEC 13.1). */
79
+ export declare function epcredRowKey(endpoint: string, instanceId: string, credentialId: string): string;
80
+ /** The per-ancestor lineage index key `bysrc.<issuerKeyId>.<id>.<lifecycleUid>.<credentialId>`. */
81
+ export declare function bysrcKey(issuerKeyId: string, id: string, lifecycleUid: string, credentialId: string): string;
82
+ /** The per-handle source gate key `srcgate.<issuerKeyId>.<id>`. */
83
+ export declare function srcgateKey(issuerKeyId: string, id: string): string;
84
+ /** A takeover/registration operation's durable intent key `stage.<opId>` (the `stage.<opId>.`
85
+ * staging family root — NEVER under a ledger prefix a barrier enumerates, SPEC 13.1). */
86
+ export declare function stageIntentKey(opId: string): string;
87
+ /** The §13.1 credential-ledger row, closed. `lifecycleUid` is the HOLDER's KEY identity
88
+ * component: the managed agent's lifecycle UID in the `cred.` family, the endpoint instance's
89
+ * `instanceId` in the `epcred.` family (SPEC 13.1: `instanceId` is to an endpoint what
90
+ * `lifecycleUid` is to a managed agent). `endpoint` is present ONLY in the `epcred.` family
91
+ * (it forms the key there and is absent in `cred.`), so the KEY identity is never conflated
92
+ * with the eviction target. `holderPrincipal` is who the barrier KICKs: ALWAYS a CONNZ-
93
+ * attributable `<owner>.<actor>` dot-form (the caller principal in the `cred.` family; the
94
+ * serving instance's own connection principal in the `epcred.` family, recorded from the
95
+ * endpoint gate), NEVER the endpoint name (which CONNZ cannot attribute). */
96
+ export interface CredentialLedgerRow {
97
+ credentialId: string;
98
+ holderPrincipal: string;
99
+ lifecycleUid: string;
100
+ /** The endpoint NAME whose token forms the `epcred.` key; present iff this is an endpoint-
101
+ * family row, absent in the `cred.` family (which the lifecycleUid keys). */
102
+ endpoint?: string;
103
+ /** The FULL verified lineage at mint: `root` | `handle.<issuerKeyId>.<id>`… |
104
+ * `session.<sessionId>` (SPEC 13.1 — for a handle redemption EVERY handle in the presented
105
+ * chain, never only the leaf). */
106
+ sourceChain: string[];
107
+ /** Monotonic: `active → revoked` only; a revoked row is never deleted. */
108
+ state: "active" | "revoked";
109
+ exp: number;
110
+ }
111
+ /** Parse + validate a ledger row at its consuming boundary — closed schema, and the embedded
112
+ * identity MUST rebuild the row's own key, so a key-mismatched or family-swapped poison row
113
+ * never authorizes (SPEC 13.1/13.3). */
114
+ export declare function parseLedgerRow(raw: Uint8Array, key: string): CredentialLedgerRow;
115
+ /** Create-only write of a ledger/index row with the BYTE-IDENTICAL retry (a crashed writer's
116
+ * retry of its OWN deterministic row proceeds; foreign content under a staged name refuses —
117
+ * a name never silently re-binds, SPEC 13.6 discipline). PACKAGE-INTERNAL: the session
118
+ * adapter writes its `epcred.` rows through this. */
119
+ export declare function createRowByteIdempotent(kv: KV, key: string, value: unknown): Promise<void>;
120
+ /** Idempotent monotonic revocation mark on a ledger row (revision-pinned CAS; a lost pin
121
+ * re-reads — terminal-now returns, still-active retries). An ABSENT key refuses: the ledger
122
+ * is never-deleted, so "revoke a row that does not exist" is a caller bug or corruption,
123
+ * never a silent success. PACKAGE-INTERNAL (the session adapter routes through this too). */
124
+ export declare function markLedgerRowRevoked(kv: KV, key: string): Promise<"revoked" | "already-revoked">;
125
+ /** A per-handle source gate: `open` mints, `frozen` is the revocation fence (terminal for a
126
+ * revoked handle — a source gate never reopens; SPEC 13.1). */
127
+ export interface SourceGateRow {
128
+ issuerKeyId: string;
129
+ id: string;
130
+ state: "open" | "frozen";
131
+ }
132
+ /** Observe a source gate (the candidate read feeding a pinned CAS/touch). A DEL/PURGE marker
133
+ * refuses loudly — a gate is never deleted. */
134
+ export declare function observeSourceGate(reg: LifecycleRegistry, args: {
135
+ issuerKeyId: string;
136
+ id: string;
137
+ }): Promise<{
138
+ row: SourceGateRow;
139
+ revision: number;
140
+ } | undefined>;
141
+ /** Create a handle's source gate OPEN (at the handle's own provisioning). Create-only:
142
+ * idempotent for the identical row; anything else (including a deletion marker) conflicts. */
143
+ export declare function createSourceGateOpen(reg: LifecycleRegistry, args: {
144
+ issuerKeyId: string;
145
+ id: string;
146
+ }): Promise<void>;
147
+ /** CAS a source gate `open → frozen` at the observed revision — the handle-revocation fence
148
+ * (SPEC 13.1: freeze BEFORE enumerating `bysrc.`; an in-flight redemption either finished
149
+ * before the freeze, so its rows are in the enumeration, or loses its pinned touch). */
150
+ export declare function freezeSourceGate(reg: LifecycleRegistry, args: {
151
+ issuerKeyId: string;
152
+ id: string;
153
+ revision: number;
154
+ }): Promise<void>;
155
+ /** What {@link stageAgentMint} durably staged, handed to {@link finalizeAgentMint}. BRANDED
156
+ * (WeakMap membership): only {@link stageAgentMint} produces one, so a hand-assembled or
157
+ * mutated object (e.g. an empty `pins` array that would finalize with no gate proof) can never
158
+ * reach the touch-CAS. The finalize NEVER trusts fields read back from this object: the
159
+ * authoritative pins/rowKey snapshot lives in the module-private WeakMap value (a
160
+ * shallow-frozen public array left mutable pin OBJECTS a caller could rewrite to duplicate
161
+ * the source-gate pin and skip the lifecycle gate). The public object is deep-frozen too,
162
+ * but the snapshot is the authority. */
163
+ export interface StagedAgentMint {
164
+ readonly lifecycleUid: string;
165
+ readonly credentialId: string;
166
+ /** The observed lifecycle-gate + source-gate pins the finalize touch-CASes, keyed by KV key. */
167
+ readonly pins: ReadonlyArray<{
168
+ readonly key: string;
169
+ readonly revision: number;
170
+ }>;
171
+ /** The staged row's own key (what a losing finalize revokes). */
172
+ readonly rowKey: string;
173
+ }
174
+ /**
175
+ * Stage an AGENT-family mint (SPEC 13.1 mint protocol, steps observe + write-rows): observe
176
+ * the lifecycle issuance gate (must exist and be `open` — a frozen gate is a barrier in
177
+ * flight, a retired one is terminal) and EVERY presented handle's source gate (must exist and
178
+ * be `open`), recording each revision; then create the ledger row (`state: "active"` — the
179
+ * row is authority only after finalize releases, and the barrier enumerates it either way)
180
+ * and one `bysrc.` index row per handle chain member. Returns the staged coordinates for
181
+ * {@link finalizeAgentMint}. Nothing is released here.
182
+ */
183
+ export declare function stageAgentMint(reg: LifecycleRegistry, args: {
184
+ lifecycleUid: string;
185
+ credentialId: string;
186
+ holderPrincipal: string;
187
+ sourceChain: string[];
188
+ exp: number;
189
+ }): Promise<StagedAgentMint>;
190
+ /**
191
+ * Finalize an AGENT-family mint (SPEC 13.1 mint protocol, step gate-CAS): touch-CAS every
192
+ * observed gate — the lifecycle gate and each presented source gate — at its pinned revision,
193
+ * each DISTINCT key once, in CANONICAL (sorted) order (the same crossed-pair discipline as the
194
+ * session stage). The touch preserves the value and bumps only the revision: a barrier or a
195
+ * handle revocation that moved ANY of them since observation makes the pinned write LOSE, the
196
+ * mint marks its OWN row revoked, and throws `permission-denied` — it never releases. Only a
197
+ * finalize that returns cleanly permits the caller to release the credential bytes.
198
+ */
199
+ export declare function finalizeAgentMint(reg: LifecycleRegistry, staged: StagedAgentMint): Promise<void>;
200
+ /** One enumerated ledger row (its key, parsed value, and store revision). */
201
+ export interface EnumeratedRow {
202
+ key: string;
203
+ row: CredentialLedgerRow;
204
+ revision: number;
205
+ }
206
+ /**
207
+ * Enumerate a lifecycle's FULL descendant family `cred.<lifecycleUid>.>` (SPEC 13.1/13.9) through
208
+ * the SEALED auth-ledger scanner ({@link registryScanner}). The scan is a fence-free LastPerSubject
209
+ * read: under the normative history=1 store a same-subject `active→revoked` overwrite EVICTS the
210
+ * pre-scan revision, so the scanner delivers each subject's CURRENT last (a concurrent revoke is
211
+ * SEEN, never dropped). The scanner holds the ONLY auth-stream `CONSUMER.CREATE` on its own sealed
212
+ * credential; the barrier profile holds none (a consumer-create body is not subject-ACL confinable,
213
+ * nats-server#8274 — ledger-scanner.ts).
214
+ */
215
+ export declare function enumerateAgentFamily(reg: LifecycleRegistry, lifecycleUid: string): Promise<EnumeratedRow[]>;
216
+ /** A durable operation intent under `stage.<opId>` (SINGLE segment: the session release pins
217
+ * live at `stage.session.<sid>.<c|s>` and are not operations). */
218
+ export interface OperationIntentRef {
219
+ opId: string;
220
+ kind: "takeover" | "retirement";
221
+ lifecycleUid: string;
222
+ }
223
+ /**
224
+ * Enumerate every durable OPERATION intent `stage.<opId>` (SPEC 13.1) — the boot-resume
225
+ * discovery: a barrier executor that crashed mid-operation finds what it may owe here (whether
226
+ * an intent is actually OWED is the gate's call: only a gate still frozen by that opId is —
227
+ * completed and lost operations leave their intent behind by design). Multi-segment `stage.`
228
+ * keys (the session release pins) are not operations and are skipped; a single-segment intent
229
+ * that carries a DEL/PURGE marker, fails to parse, or names an unknown kind THROWS — an intent
230
+ * is never deleted while resumable, and garbled trusted-path state never drives a barrier.
231
+ */
232
+ export declare function enumerateOperationIntents(reg: LifecycleRegistry): Promise<OperationIntentRef[]>;
233
+ /** The injected VERIFIED-EVICTION seam (§13.9: the barrier executor holds the deployment's
234
+ * `evictPrincipal` capability for exactly this step). `verifiedGone` is the ONLY success. */
235
+ export type EvictPrincipal = (principal: string) => Promise<EvictionResult>;
236
+ /** The injected SESSION-PAIR reconciler (SPEC 13.1: a lifecycle barrier tears down BOTH halves
237
+ * of a session, not just the caller credential under `cred.<uid>.>`). For each distinct
238
+ * `session.<sessionId>` naming a revoked descendant, the barrier calls this to terminalize the
239
+ * `session.<sessionId>` row and revoke the paired serving `epcred.` row, and it RETURNS the
240
+ * serving row's CONNZ-attributable holder principal(s) so the barrier can UNION them into its
241
+ * verified-eviction set (SPEC 13.6: a takeover on either side revokes BOTH credentials WITH
242
+ * eviction — a row-only revocation would leave an already-connected serving session live).
243
+ * Injected (not imported) so the credential ledger never depends on the session adapter.
244
+ * Idempotent: an already-reconciled session still returns its principals (a resumed barrier
245
+ * must still evict). */
246
+ export type ReconcileSessionPair = (sessionId: string) => Promise<{
247
+ servingPrincipals: readonly string[];
248
+ }>;
249
+ /** The barrier's injected capabilities. `reconcileSessionPair` is optional: a deployment with
250
+ * no sessions omits it, but a lifecycle that HAS session-derived credentials and omits it
251
+ * fails loud (a torn-down half would be left live). */
252
+ export interface TakeoverDeps {
253
+ evictPrincipal: EvictPrincipal;
254
+ reconcileSessionPair?: ReconcileSessionPair;
255
+ }
256
+ /** The durable takeover intent at `stage.<opId>` — captured BEFORE the freeze, so a crashed
257
+ * barrier resumes the SAME operation from the SAME coordinates ({@link resumeAgentTakeover}). */
258
+ export interface TakeoverIntent {
259
+ kind: "takeover";
260
+ lifecycleUid: string;
261
+ owner: string;
262
+ actor: string;
263
+ /** The head epoch the barrier supersedes (the epoch CAS advances fromEpoch → fromEpoch+1). */
264
+ fromEpoch: number;
265
+ /** The gate generation the barrier freezes at (the reopen advances it to fromGeneration+1). */
266
+ fromGeneration: number;
267
+ }
268
+ /** The barrier's outcome (durable facts, re-readable on resume). */
269
+ export interface TakeoverResult {
270
+ opId: string;
271
+ lifecycleUid: string;
272
+ /** The successor's fenced epoch (fromEpoch + 1). */
273
+ toEpoch: number;
274
+ /** The gate's first mintable generation for the successor (fromGeneration + 1). */
275
+ toGeneration: number;
276
+ /** Ledger rows this run transitioned `active → revoked` (0 on a resume that found them done). */
277
+ revokedRows: number;
278
+ /** Every DISTINCT principal the barrier verified evicted (family holders + the alias itself). */
279
+ evictedPrincipals: string[];
280
+ }
281
+ /**
282
+ * The shared CONTAINMENT core of the lifecycle barriers (SPEC 13.1: takeover and terminal
283
+ * retirement run the SAME revoke + verified-evict discipline over the SAME family):
284
+ * point-in-time enumeration of `cred.<lifecycleUid>.>` → revoke EVERY row (idempotent — a
285
+ * resumed barrier finds some already revoked; the row CAS is the deny-new SUBSTRATE, module
286
+ * header) → reconcile BOTH halves of every session-derived credential (the reconciler
287
+ * terminalizes `session.<sessionId>` and revokes the paired serving `epcred.` row, returning
288
+ * the serving holders; a lifecycle that HAS session-derived credentials but no reconciler
289
+ * fails loud — the serving half would be left live) → VERIFIED cluster-wide eviction of every
290
+ * enumerated holder principal (revoked earlier runs included: their connections may still be
291
+ * live), the alias principal itself, and every session-serving principal. Fail-closed per
292
+ * principal: anything but `verifiedGone` throws and the calling barrier's gate stays frozen.
293
+ * PACKAGE-INTERNAL: both barriers reach it through the sealed registry only.
294
+ */
295
+ export declare function containLifecycleFamily(reg: LifecycleRegistry, args: {
296
+ owner: string;
297
+ actor: string;
298
+ lifecycleUid: string;
299
+ barrier: "takeover" | "retirement";
300
+ }, deps: TakeoverDeps): Promise<{
301
+ revokedRows: number;
302
+ evictedPrincipals: string[];
303
+ }>;
304
+ /**
305
+ * Run the FULL takeover issuance barrier for a managed-agent lifecycle (SPEC 13.1, in the
306
+ * normative order — see the module header). Idempotent/crash-resumable: every step re-checks
307
+ * durable state, so calling it again with the SAME `opId` (directly or via
308
+ * {@link resumeAgentTakeover}) finishes the same operation; a DIFFERENT operation's freeze,
309
+ * a foreign epoch/generation movement, or a stranger's opId refuses before any CAS.
310
+ *
311
+ * FAIL-CLOSED CONTRACT: any failure after the freeze leaves the gate FROZEN (nothing mints)
312
+ * and the epoch un-advanced; eviction failure (`verifiedGone !== true` for ANY principal)
313
+ * throws `unavailable` — takeover MUST fail loud rather than proceed over a live predecessor.
314
+ */
315
+ export declare function runAgentTakeoverBarrier(reg: LifecycleRegistry, args: {
316
+ owner: string;
317
+ actor: string;
318
+ lifecycleUid: string;
319
+ opId: string;
320
+ }, deps: TakeoverDeps): Promise<TakeoverResult>;
321
+ /** Resume a crashed takeover from its durable intent alone (`{ opId }` — SPEC 13.1: the intent
322
+ * decides WHICH operation a frozen gate belongs to; `{ opId, kind }` alone resumes
323
+ * deterministically). Re-runs {@link runAgentTakeoverBarrier} with the intent's own
324
+ * coordinates; a stranger's opId (no intent) is `not-found`. */
325
+ export declare function resumeAgentTakeover(reg: LifecycleRegistry, opId: string, deps: TakeoverDeps): Promise<TakeoverResult>;
326
+ /**
327
+ * Revoke a sturdy handle at its SOURCE (SPEC 13.1): CAS the source gate `open → frozen` FIRST
328
+ * (the fence — an in-flight redemption under this handle either finished before the freeze,
329
+ * so its rows are in the enumeration, or loses its pinned finalize touch and never releases),
330
+ * then enumerate `bysrc.<issuerKeyId>.<id>.>`, revoke EVERY descendant ledger row it indexes
331
+ * (credentials minted under this handle OR under any descendant handle that carried it in the
332
+ * chain), and run VERIFIED cluster-wide eviction of every revoked row's holder principal —
333
+ * fail-closed, exactly the takeover discipline. The source gate stays frozen forever (a
334
+ * revoked handle never mints again); an already-frozen gate resumes the walk idempotently.
335
+ */
336
+ export declare function revokeHandleSource(reg: LifecycleRegistry, args: {
337
+ issuerKeyId: string;
338
+ id: string;
339
+ }, deps: TakeoverDeps): Promise<{
340
+ revokedRows: number;
341
+ evictedPrincipals: string[];
342
+ }>;
343
+ //# sourceMappingURL=credential-ledger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credential-ledger.d.ts","sourceRoot":"","sources":["../src/credential-ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAOL,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EASL,KAAK,iBAAiB,EACvB,MAAM,yBAAyB,CAAC;AAoCjC,eAAO,MAAM,WAAW,SAAS,CAAC;AAElC;uEACuE;AACvE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAYlK;AASD,wEAAwE;AACxE,wBAAgB,UAAU,CAAC,YAAY,EAAE,MAAM,EAA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