@cotal-ai/core 0.101.7 → 0.102.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.
@@ -1,9 +1,10 @@
1
1
  /**
2
- * One issuance window (SPEC 13.15): an ephemeral `issuer` connection over which a mint stages
3
- * and releases its evidence and writes the accepted row, a lifecycle terminal retires the
4
- * issuances bound to its ledger family, and a host resolves the evidence a caller's request
5
- * rides. The connection lives for the callback only; no standing credential holds a grant on
6
- * either issued-authority store.
2
+ * The `issuer` connection (SPEC 13.15), over which a mint stages and releases its evidence and
3
+ * writes the accepted row, a lifecycle terminal retires the issuances bound to its ledger family,
4
+ * and a host resolves the evidence a caller's request rides. {@link withIssuerSession} opens one
5
+ * for one callback. {@link holdIssuerSession} is the auth plane's held session for its connect-time
6
+ * issuances: one connection on short-lived credentials, replaced before they expire, that closes
7
+ * with the plane.
7
8
  */
8
9
  import { type JetStreamManager } from "@nats-io/jetstream";
9
10
  import { type KV } from "@nats-io/kv";
@@ -21,10 +22,35 @@ export interface IssuerSession {
21
22
  * coordinate is refused rather than guessed live. */
22
23
  sourceIsLive(source: IssuedSourceRef): Promise<boolean>;
23
24
  }
24
- export declare function withIssuerSession<T>(args: {
25
+ type IssuerSessionArgs = {
25
26
  servers: string;
26
27
  space: string;
27
28
  auth: SpaceAuth;
28
29
  tls: boolean;
29
- }, fn: (session: IssuerSession) => Promise<T>): Promise<T>;
30
+ };
31
+ /** One issuance window on its own connection, which lives for the callback only. */
32
+ export declare function withIssuerSession<T>(args: IssuerSessionArgs, fn: (session: IssuerSession) => Promise<T>): Promise<T>;
33
+ /** The issuer session one auth plane holds (SPEC 13.15). */
34
+ export interface HeldIssuerSession {
35
+ /** Run one issuance on the held connection, dialing one on fresh credentials when none is live.
36
+ * The issuance's own reads and writes all happen inside `fn`; the holder keeps the connection
37
+ * and nothing it read. A connection lost while `fn` runs fails that issuance, and nothing `fn`
38
+ * sent is sent again: the next issuance dials a new connection. */
39
+ run<T>(fn: (session: IssuerSession) => Promise<T>): Promise<T>;
40
+ /** Refuse every later issuance and drain every connection this holder dialed, including one an
41
+ * issuance is still using. */
42
+ close(): Promise<void>;
43
+ }
44
+ /**
45
+ * Hold one issuer session for one account, space and auth plane. The connection never reconnects.
46
+ * Its credential keeps the `issuer` profile's short expiry, or `ttlSeconds` when shorter. At a
47
+ * random point between half and four fifths of that lifetime the connection stops taking new
48
+ * issuances and drains once the ones it is running finish, so the broker never expires it, and the
49
+ * next issuance dials a new one on new credentials. Nothing is dialed until the first issuance.
50
+ */
51
+ export declare function holdIssuerSession(args: IssuerSessionArgs & {
52
+ name: string;
53
+ ttlSeconds?: number;
54
+ }): HeldIssuerSession;
55
+ export {};
30
56
  //# sourceMappingURL=issuer-session.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"issuer-session.d.ts","sourceRoot":"","sources":["../src/issuer-session.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAO,KAAK,EAAE,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAK9D,OAAO,EAAiD,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE9H,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3D,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,cAAc,CAAC;IAC5B,QAAQ,CAAC,GAAG,EAAE,gBAAgB,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC;IACtB;;;0DAGsD;IACtD,YAAY,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACzD;AAED,wBAAsB,iBAAiB,CAAC,CAAC,EAC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AAa,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAO1H;AAED,4DAA4D;AAC5D,MAAM,WAAW,iBAAiB;IAChC;;;wEAGoE;IACpE,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC/D;mCAC+B;IAC/B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,iBAAiB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,iBAAiB,CAkEpH"}
@@ -1,9 +1,10 @@
1
1
  /**
2
- * One issuance window (SPEC 13.15): an ephemeral `issuer` connection over which a mint stages
3
- * and releases its evidence and writes the accepted row, a lifecycle terminal retires the
4
- * issuances bound to its ledger family, and a host resolves the evidence a caller's request
5
- * rides. The connection lives for the callback only; no standing credential holds a grant on
6
- * either issued-authority store.
2
+ * The `issuer` connection (SPEC 13.15), over which a mint stages and releases its evidence and
3
+ * writes the accepted row, a lifecycle terminal retires the issuances bound to its ledger family,
4
+ * and a host resolves the evidence a caller's request rides. {@link withIssuerSession} opens one
5
+ * for one callback. {@link holdIssuerSession} is the auth plane's held session for its connect-time
6
+ * issuances: one connection on short-lived credentials, replaced before they expire, that closes
7
+ * with the plane.
7
8
  */
8
9
  import { jetstreamManager } from "@nats-io/jetstream";
9
10
  import { Kvm } from "@nats-io/kv";
@@ -12,12 +13,19 @@ import { epAuthBucket } from "./endpoint-binding.js";
12
13
  import { EpEnvelopeError } from "./endpoint-envelope.js";
13
14
  import { issuanceGateKey, parseIssuanceGate } from "./lifecycle-state.js";
14
15
  import { acceptedBucket, issuedBucket, openIssuedStore } from "./issued-authority.js";
15
- import { newIdentity } from "./identity.js";
16
- import { mintCreds } from "./provision.js";
16
+ import { credsClaims, newIdentity } from "./identity.js";
17
+ import { credentialLifetime, mintCreds } from "./provision.js";
18
+ import { armRenewal, renewalDeadlineMs } from "./renewal.js";
17
19
  import { standaloneConnectOpts } from "./streams.js";
18
- export async function withIssuerSession(args, fn) {
19
- const creds = await mintCreds(args.auth, newIdentity(), "issuer");
20
- const nc = await dialerFor(args.servers)({ servers: args.servers, ...standaloneConnectOpts({ creds, tls: args.tls }), maxReconnectAttempts: 0 });
20
+ /** Dial one `issuer` connection on freshly minted credentials and bind its stores. It never
21
+ * reconnects: a lost connection closes at once, failing every request still on it, so nothing an
22
+ * issuance sent before the loss is sent again. Returns the session and the credential's lifetime. */
23
+ async function openIssuerSession(args, opts = {}) {
24
+ const creds = await mintCreds(args.auth, newIdentity(), "issuer", opts.ttlSeconds === undefined ? {} : { expiresInSeconds: opts.ttlSeconds });
25
+ const { iat, exp } = credsClaims(creds);
26
+ if (iat === undefined || exp === undefined)
27
+ throw new Error("an issuer credential must carry iat and exp");
28
+ const nc = await dialerFor(args.servers)({ servers: args.servers, ...standaloneConnectOpts({ creds, tls: args.tls }), ...(opts.name ? { name: opts.name } : {}), reconnect: false, maxReconnectAttempts: 0 });
21
29
  try {
22
30
  const kvm = new Kvm(nc);
23
31
  const jsm = await jetstreamManager(nc);
@@ -42,10 +50,103 @@ export async function withIssuerSession(args, fn) {
42
50
  return false;
43
51
  return parseIssuanceGate(entry.data, key, m[1]).state !== "retired";
44
52
  };
45
- return await fn({ nc, jsm, store, accepted, sourceIsLive });
53
+ return { session: { nc, jsm, store, accepted, sourceIsLive }, issuedAtMs: iat * 1000, expiresAtMs: exp * 1000 };
54
+ }
55
+ catch (e) {
56
+ await nc.close().catch(() => { });
57
+ throw e;
58
+ }
59
+ }
60
+ /** One issuance window on its own connection, which lives for the callback only. */
61
+ export async function withIssuerSession(args, fn) {
62
+ const { session } = await openIssuerSession(args);
63
+ try {
64
+ return await fn(session);
46
65
  }
47
66
  finally {
48
- await nc.drain().catch(() => nc.close());
67
+ await session.nc.drain().catch(() => session.nc.close());
49
68
  }
50
69
  }
70
+ /**
71
+ * Hold one issuer session for one account, space and auth plane. The connection never reconnects.
72
+ * Its credential keeps the `issuer` profile's short expiry, or `ttlSeconds` when shorter. At a
73
+ * random point between half and four fifths of that lifetime the connection stops taking new
74
+ * issuances and drains once the ones it is running finish, so the broker never expires it, and the
75
+ * next issuance dials a new one on new credentials. Nothing is dialed until the first issuance.
76
+ */
77
+ export function holdIssuerSession(args) {
78
+ const maxTtl = credentialLifetime("issuer").defaultTtlSeconds;
79
+ if (args.ttlSeconds !== undefined && (!Number.isSafeInteger(args.ttlSeconds) || args.ttlSeconds < 5 || args.ttlSeconds > maxTtl))
80
+ throw new Error(`issuer session ttlSeconds must be an integer between 5 and ${maxTtl} seconds (got ${args.ttlSeconds})`);
81
+ const live = new Set();
82
+ let current;
83
+ let closed = false;
84
+ const refuseClosed = () => {
85
+ if (closed)
86
+ throw new EpEnvelopeError("unavailable", `the issuer session for space "${args.space}" is closed`);
87
+ };
88
+ // Settles without rejecting: a teardown that fails leaves nothing this holder could do again.
89
+ const drain = (h) => h.drained ??= h.session.nc.drain().catch(() => h.session.nc.close()).catch(() => { });
90
+ const retire = (h) => {
91
+ h.retired = true;
92
+ h.cancel();
93
+ if (h.running === 0)
94
+ void drain(h);
95
+ };
96
+ const dial = async () => {
97
+ const { session, issuedAtMs, expiresAtMs } = await openIssuerSession(args, { name: args.name, ...(args.ttlSeconds !== undefined ? { ttlSeconds: args.ttlSeconds } : {}) });
98
+ const h = { session, renewBy: renewalDeadlineMs(issuedAtMs, expiresAtMs), running: 0, retired: false, cancel: () => { } };
99
+ live.add(h);
100
+ h.cancel = armRenewal(args.space, issuedAtMs, expiresAtMs, () => retire(h));
101
+ void session.nc.closed().then(() => {
102
+ h.retired = true;
103
+ h.cancel();
104
+ live.delete(h);
105
+ });
106
+ return h;
107
+ };
108
+ const acquire = async () => {
109
+ for (;;) {
110
+ refuseClosed();
111
+ const pending = current ??= dial();
112
+ let h;
113
+ try {
114
+ h = await pending;
115
+ }
116
+ catch (e) {
117
+ if (current === pending)
118
+ current = undefined;
119
+ throw e;
120
+ }
121
+ refuseClosed();
122
+ if (!h.retired && Date.now() < h.renewBy)
123
+ return h;
124
+ if (current === pending)
125
+ current = undefined;
126
+ retire(h);
127
+ }
128
+ };
129
+ return {
130
+ run: async (fn) => {
131
+ const h = await acquire();
132
+ h.running++;
133
+ try {
134
+ return await fn(h.session);
135
+ }
136
+ finally {
137
+ if (--h.running === 0 && h.retired)
138
+ void drain(h);
139
+ }
140
+ },
141
+ close: async () => {
142
+ closed = true;
143
+ await current?.catch(() => undefined);
144
+ current = undefined;
145
+ const held = [...live];
146
+ for (const h of held)
147
+ h.cancel();
148
+ await Promise.all(held.map(drain));
149
+ },
150
+ };
151
+ }
51
152
  //# sourceMappingURL=issuer-session.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"issuer-session.js","sourceRoot":"","sources":["../src/issuer-session.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,gBAAgB,EAAyB,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,GAAG,EAAW,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe,EAA0C,MAAM,uBAAuB,CAAC;AAC9H,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAkB,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAcrD,MAAM,CAAC,KAAK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EAAE,GAAG,CAAC,CAAC,OAAO;gBAAE,OAAO,CAAC,CAAC;YACnD,IAAI,OAAO,KAAK,OAAO;gBAAE,OAAO,GAAG,SAAS,CAAC;YAC7C,MAAM,CAAC,CAAC,CAAC,CAAC;QACZ,CAAC;IACH,CAAC,CAAC;IACF,OAAO;QACL,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;YAChB,MAAM,CAAC,GAAG,MAAM,OAAO,EAAE,CAAC;YAC1B,CAAC,CAAC,OAAO,EAAE,CAAC;YACZ,IAAI,CAAC;gBACH,OAAO,MAAM,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;YAC7B,CAAC;oBAAS,CAAC;gBACT,IAAI,EAAE,CAAC,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO;oBAAE,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC;YACpD,CAAC;QACH,CAAC;QACD,KAAK,EAAE,KAAK,IAAI,EAAE;YAChB,MAAM,GAAG,IAAI,CAAC;YACd,MAAM,OAAO,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YACtC,OAAO,GAAG,SAAS,CAAC;YACpB,MAAM,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;YACvB,KAAK,MAAM,CAAC,IAAI,IAAI;gBAAE,CAAC,CAAC,MAAM,EAAE,CAAC;YACjC,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;QACrC,CAAC;KACF,CAAC;AACJ,CAAC"}
package/dist/provision.js CHANGED
@@ -112,7 +112,7 @@ export const CREDENTIAL_LIFETIMES = {
112
112
  "run-driver": { class: "standing-renewable", defaultTtlSeconds: STANDING_RENEWABLE_TTL_SEC, renewalOwner: "manager", note: "one workflow run's driver, per takeover attempt (SPEC 14.6): the hosting manager mints it when it takes the run over and re-mints for the SAME nkey on renewal; a new takeover mints a new one" },
113
113
  "run-mediator": { class: "standing-renewable", defaultTtlSeconds: STANDING_RENEWABLE_TTL_SEC, renewalOwner: "manager", note: "trusted workflow host operations, bound to one run and attempt; kept on the hosting process's connection" },
114
114
  "run-operator": { class: "one-shot", defaultTtlSeconds: 60, note: "one served run-status / run-ps / run-answer call (SPEC 14.3): the hosting manager mints it per call on its own connection, never the serve rails; 60s bounds a copied cred to a minute" },
115
- issuer: { class: "one-shot", defaultTtlSeconds: FIVE_MINUTES, note: "one issuance's evidence stage/release or one lifecycle terminal's issuance retirement (SPEC 13.15)" },
115
+ issuer: { class: "mixed", defaultTtlSeconds: FIVE_MINUTES, renewalOwner: "auth-service", note: "renewed as the auth plane's held session for connect-time issuance (re-minted before exp, closed with the plane); one-shot for every other issuance window and for a lifecycle terminal's issuance retirement (SPEC 13.15)" },
116
116
  "run-admitter": { class: "one-shot", defaultTtlSeconds: 60, note: "one hosted run's admission record create, or its revocation marker (SPEC 14.8); 60s bounds a copied cred to a minute" },
117
117
  "transfer-writer": { class: "one-shot", defaultTtlSeconds: FIVE_MINUTES, note: "one carried resume per CLI call: one object's chunk and meta subjects in one instance's transfer bucket" },
118
118
  "transfer-reader": { class: "one-shot", defaultTtlSeconds: FIVE_MINUTES, note: "one transcript-receive or sweep over the minting instance's own transfer bucket" },