@cotal-ai/core 0.3.2 → 0.5.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 (48) hide show
  1. package/README.md +11 -0
  2. package/dist/agent-file.d.ts +36 -5
  3. package/dist/agent-file.d.ts.map +1 -1
  4. package/dist/agent-file.js +91 -11
  5. package/dist/agent-file.js.map +1 -1
  6. package/dist/channels.d.ts +13 -2
  7. package/dist/channels.d.ts.map +1 -1
  8. package/dist/channels.js +24 -1
  9. package/dist/channels.js.map +1 -1
  10. package/dist/command.d.ts +21 -0
  11. package/dist/command.d.ts.map +1 -1
  12. package/dist/connector-config.d.ts +42 -0
  13. package/dist/connector-config.d.ts.map +1 -0
  14. package/dist/connector-config.js +103 -0
  15. package/dist/connector-config.js.map +1 -0
  16. package/dist/connector.d.ts +11 -0
  17. package/dist/connector.d.ts.map +1 -1
  18. package/dist/endpoint.d.ts +331 -40
  19. package/dist/endpoint.d.ts.map +1 -1
  20. package/dist/endpoint.js +1280 -246
  21. package/dist/endpoint.js.map +1 -1
  22. package/dist/index.d.ts +3 -0
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +3 -0
  25. package/dist/index.js.map +1 -1
  26. package/dist/members.d.ts +93 -0
  27. package/dist/members.d.ts.map +1 -0
  28. package/dist/members.js +193 -0
  29. package/dist/members.js.map +1 -0
  30. package/dist/provision.d.ts +49 -11
  31. package/dist/provision.d.ts.map +1 -1
  32. package/dist/provision.js +92 -31
  33. package/dist/provision.js.map +1 -1
  34. package/dist/resolve.d.ts +53 -0
  35. package/dist/resolve.d.ts.map +1 -0
  36. package/dist/resolve.js +61 -0
  37. package/dist/resolve.js.map +1 -0
  38. package/dist/streams.d.ts +37 -0
  39. package/dist/streams.d.ts.map +1 -1
  40. package/dist/streams.js +91 -4
  41. package/dist/streams.js.map +1 -1
  42. package/dist/subjects.d.ts +80 -2
  43. package/dist/subjects.d.ts.map +1 -1
  44. package/dist/subjects.js +127 -3
  45. package/dist/subjects.js.map +1 -1
  46. package/dist/types.d.ts +111 -5
  47. package/dist/types.d.ts.map +1 -1
  48. package/package.json +4 -2
@@ -37,36 +37,74 @@ export declare function stripSpaceAuth(auth: SpaceAuth): SpaceAuth;
37
37
  export declare function createSpaceAuth(space: string): Promise<SpaceAuth>;
38
38
  /** Options shaping a minted user's permissions. */
39
39
  export interface MintOpts {
40
- /** Channels an "agent" may publish to (the agent file's `publish:` allow-list, already
41
- * resolved by the caller). Each is run through the chat-subject builder so a wildcard
42
- * subtree like `team.>` becomes `chat.<id>.team.>`. Defaults to `["general"]`. */
43
- channels?: string[];
40
+ /** Read ACL — channels an "agent" MAY read (the agent file's `allowSubscribe`, already resolved
41
+ * by the caller). Minted as per-channel single-filter history-consumer create grants
42
+ * (`CONSUMER.CREATE.<CHAT>.<chathist_id>.<chat.*.ch>`) the broker boundary on chat **history**
43
+ * reads (join-backfill / focus-recall). Each is run through the chat-subject builder so a
44
+ * wildcard subtree `team.>` becomes `chat.*.team.>`. Defaults to `["general"]`. The live read is the
45
+ * agent's own native `sub.allow` over `chat.*.<channel>` (also minted from this list, below). */
46
+ allowSubscribe?: string[];
47
+ /** Post ACL — channels an "agent" may publish to (the agent file's `allowPublish`, already
48
+ * resolved by the caller). Each becomes a `chat.<id>.<ch>` publish grant. **Default-deny**:
49
+ * omitted/empty ⇒ no chat publish grant at all — publishing must be declared. */
50
+ allowPublish?: string[];
44
51
  /** The agent's role — scopes its TASK-queue consumer to svc_<role>. */
45
52
  role?: string;
46
53
  /** Control service the agent may address. Defaults to `"manager"`. */
47
54
  manager?: string;
55
+ /** Capabilities declared in the agent file (e.g. `"spawn"`). A capability gates the
56
+ * privileged control-subject grant in {@link permissionsFor}: `spawn` → the agent may
57
+ * publish to the privileged control subject (start/purge/definePersona/named stop).
58
+ * Default-deny when absent — nats-server rejects the publish, no handler involved. */
59
+ capabilities?: string[];
60
+ }
61
+ /** Options for {@link provisionAgent} — {@link MintOpts} plus the active read set. */
62
+ export interface ProvisionOpts extends MintOpts {
63
+ /** The active read set: the channels the agent subscribes to (live core-sub) at boot, and whose
64
+ * `durable`-class members get a boot Plane-3 membership. Must be ⊆ `allowSubscribe`. Defaults to
65
+ * `["general"]`. */
66
+ subscribe?: string[];
67
+ /** Write a DURABLE boot membership for each `durable`-class channel (default true). A durable backstop
68
+ * needs a long-lived manager that hosts Plane-3 AND knows this agent's ACL — true only for an agent
69
+ * launched UNDER a manager (`cotal start` / `cotal up`), which registers it in its `agents` ledger.
70
+ * Set FALSE for a launcher with no such manager — direct foreground `cotal spawn` — so the agent is
71
+ * LIVE-ONLY (no manager would know it, so its durable copies couldn't be authorized by the trusted
72
+ * reader nor its membership leaved via self-service; its runtime joins are live-only for that reason
73
+ * too). Writing a record nobody can deliver/leave is worse than none. */
74
+ durableMembership?: boolean;
48
75
  }
49
76
  /** The privileged onboarding ops a launcher needs — implemented by a connected, permissive
50
77
  * endpoint (the manager, or a short-lived provisioner that `cotal spawn` opens). */
51
78
  export interface DurableProvisioner {
52
79
  provisionDmInbox(id: string): Promise<void>;
80
+ /** Pre-create the agent's bind-only Plane-3 DELIVER durable (`dlv_<id>`, filtered to `dlv.<id>`) so
81
+ * it can BIND its per-member durable handoff without holding CONSUMER.CREATE on the DLV stream. */
82
+ provisionDlvInbox(id: string): Promise<void>;
83
+ /** Write the agent's BOOT durable membership: each `durable`-class boot channel gets a Plane-3
84
+ * durable-active record so it receives the durable backstop from boot. Replaces the legacy
85
+ * bind-only chat live-tail pre-create — live delivery is now the agent's own core subscription. */
86
+ provisionMembership(id: string, channels: string[]): Promise<void>;
53
87
  provisionTaskQueue(role: string): Promise<void>;
54
88
  }
55
- /** Onboard an agent for launch (auth mode): pre-create its bind-only DM (+ role TASK) durables
56
- * and mint its scoped creds. The single shared step so every launcher — the manager and
57
- * `cotal spawn` alike provisions identically (manager not special). */
58
- export declare function provisionAgent(provisioner: DurableProvisioner, auth: SpaceAuth, identity: Identity, opts?: MintOpts): Promise<string>;
89
+ /** Onboard an agent for launch (auth mode): pre-create its bind-only DM (+ Plane-3 DELIVER + role
90
+ * TASK) durables, write its boot durable membership (Plane-3, unless `durableMembership:false`), and
91
+ * mint its scoped creds. Live delivery is the agent's own core subscription — there is no per-instance
92
+ * chat durable. The single shared onboarding step; a launcher with no managing Plane-3 host (direct
93
+ * `cotal spawn`) opts out of the durable membership and is live-only. */
94
+ export declare function provisionAgent(provisioner: DurableProvisioner, auth: SpaceAuth, identity: Identity, opts?: ProvisionOpts): Promise<string>;
59
95
  /** Mint a user creds file for an agent {@link Identity} (its stable id+seed from
60
96
  * {@link newIdentity}). The account signing key signs over ONLY the public key
61
97
  * (`fromPublic`) — the agent seed is never part of the signature, it's only folded into
62
- * the resulting creds file. The "agent" profile is scoped to publish only as itself and
63
- * only to its declared channels (the channel-restriction enforcement); "manager" and
64
- * "observer" stay permissive here and are scoped in steps 6–7. */
98
+ * the resulting creds file. The "agent" profile is scoped to publish only as itself and only to
99
+ * its declared `allowPublish` channels (post ACL, default-deny), and to read only within
100
+ * `allowSubscribe` (live tail bind-only + per-channel history grants); "manager" and "observer"
101
+ * stay permissive here and are scoped in steps 6–7. */
65
102
  export declare function mintCreds(auth: SpaceAuth, identity: Identity, profile: Profile, opts?: MintOpts): Promise<string>;
66
103
  /** Render the `nats-server` config that trusts this space's operator and serves its
67
104
  * accounts via the in-config MEMORY resolver. */
68
105
  export declare function serverConfig(auth: SpaceAuth, opts: {
69
106
  port?: number;
107
+ host?: string;
70
108
  storeDir: string;
71
109
  }): string;
72
110
  export declare function authDir(root: string): string;
@@ -1 +1 @@
1
- {"version":3,"file":"provision.d.ts","sourceRoot":"","sources":["../src/provision.ts"],"names":[],"mappings":"AAyCA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;mEAGmE;AACnE,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,CAAC;AAEjE;+DAC+D;AAC/D,MAAM,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,EAAE,QAAQ,EAClB,IAAI,GAAE,aAAkB,GACvB,OAAO,CAAC,MAAM,CAAC,CAsBjB;AAED;;;;;;wDAMwD;AACxD,wBAAsB,SAAS,CAC7B,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,IAAI,GAAE,QAAa,GAClB,OAAO,CAAC,MAAM,CAAC,CAYjB;AAiLD;kDACkD;AAClD,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAuB9G;AAMD,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED;;iGAEiG;AACjG,wBAAgB,aAAa,CAAC,KAAK,GAAE,MAAsB,GAAG,MAAM,CAQnE;AAED,6FAA6F;AAC7F,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI,CAGhE;AAED,iFAAiF;AACjF,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAIhE"}
package/dist/provision.js CHANGED
@@ -18,7 +18,7 @@ import { readFileSync, writeFileSync, mkdirSync, existsSync } from "node:fs";
18
18
  import { join, dirname, resolve } from "node:path";
19
19
  import { encodeOperator, encodeAccount, encodeUser, fmtCreds, } from "@nats-io/jwt";
20
20
  import { createOperator, createAccount, fromPublic, fromSeed } from "@nats-io/nkeys";
21
- import { token, spacePrefix, chatSubject, unicastSubject, anycastSubject, controlServiceSubject, chatStream, dmStream, taskStream, chatDurable, dmDurable, taskDurable, presenceBucket, channelBucket, } from "./subjects.js";
21
+ import { token, spacePrefix, chatSubject, assertValidChannel, channelInAllow, unicastSubject, anycastSubject, controlServiceSubject, CONTROL_PRIVILEGED, CONTROL_SELF_SERVICE, chatStream, dmStream, taskStream, dlvStream, chatHistDurable, dmDurable, taskDurable, dlvDurable, presenceBucket, channelBucket, } from "./subjects.js";
22
22
  // Unlimited account limits — without explicit limits a JWT account defaults to 0 conns
23
23
  // (every connect denied). JetStream needs storage on the data account but MUST stay off
24
24
  // the system account (the server refuses to start otherwise).
@@ -74,21 +74,42 @@ export async function createSpaceAuth(space) {
74
74
  sys: { pub: sysPub, jwt: sysJwt },
75
75
  };
76
76
  }
77
- /** Onboard an agent for launch (auth mode): pre-create its bind-only DM (+ role TASK) durables
78
- * and mint its scoped creds. The single shared step so every launcher — the manager and
79
- * `cotal spawn` alike provisions identically (manager not special). */
77
+ /** Onboard an agent for launch (auth mode): pre-create its bind-only DM (+ Plane-3 DELIVER + role
78
+ * TASK) durables, write its boot durable membership (Plane-3, unless `durableMembership:false`), and
79
+ * mint its scoped creds. Live delivery is the agent's own core subscription — there is no per-instance
80
+ * chat durable. The single shared onboarding step; a launcher with no managing Plane-3 host (direct
81
+ * `cotal spawn`) opts out of the durable membership and is live-only. */
80
82
  export async function provisionAgent(provisioner, auth, identity, opts = {}) {
83
+ const subscribe = opts.subscribe?.length ? opts.subscribe : ["general"];
84
+ const allowSubscribe = opts.allowSubscribe?.length ? opts.allowSubscribe : subscribe;
85
+ // Reject channel names the wire layer would rewrite (the pre-created filter rides token() too).
86
+ for (const ch of [...subscribe, ...allowSubscribe])
87
+ assertValidChannel(ch);
88
+ // Re-assert the load-time invariant at the trust boundary (defense in depth): the pre-created
89
+ // live filter (subscribe) must sit within the read ACL (allowSubscribe), or the provisioner
90
+ // would hand the agent live delivery it isn't permitted to read.
91
+ for (const ch of subscribe)
92
+ if (!channelInAllow(allowSubscribe, ch))
93
+ throw new Error(`provisionAgent: subscribe "${ch}" is not within allowSubscribe [${allowSubscribe.join(", ")}]`);
81
94
  await provisioner.provisionDmInbox(identity.id);
95
+ await provisioner.provisionDlvInbox(identity.id);
96
+ // DELIVER durable exists before membership — the trusted reader transfers boot backstop copies onto it.
97
+ // Durable boot membership only for a launcher backed by a managing Plane-3 host (default). A live-only
98
+ // launcher (direct `cotal spawn`) opts out: no manager would know this agent, so a durable record could
99
+ // be neither authorized for reader delivery nor leaved via self-service — worse than none.
100
+ if (opts.durableMembership !== false)
101
+ await provisioner.provisionMembership(identity.id, subscribe);
82
102
  if (opts.role)
83
103
  await provisioner.provisionTaskQueue(opts.role);
84
- return mintCreds(auth, identity, "agent", opts);
104
+ return mintCreds(auth, identity, "agent", { ...opts, allowSubscribe });
85
105
  }
86
106
  /** Mint a user creds file for an agent {@link Identity} (its stable id+seed from
87
107
  * {@link newIdentity}). The account signing key signs over ONLY the public key
88
108
  * (`fromPublic`) — the agent seed is never part of the signature, it's only folded into
89
- * the resulting creds file. The "agent" profile is scoped to publish only as itself and
90
- * only to its declared channels (the channel-restriction enforcement); "manager" and
91
- * "observer" stay permissive here and are scoped in steps 6–7. */
109
+ * the resulting creds file. The "agent" profile is scoped to publish only as itself and only to
110
+ * its declared `allowPublish` channels (post ACL, default-deny), and to read only within
111
+ * `allowSubscribe` (live tail bind-only + per-channel history grants); "manager" and "observer"
112
+ * stay permissive here and are scoped in steps 6–7. */
92
113
  export async function mintCreds(auth, identity, profile, opts = {}) {
93
114
  const signer = fromSeed(new TextEncoder().encode(auth.account.signingSeed));
94
115
  const perms = permissionsFor(profile, auth.space, identity.id, opts);
@@ -151,38 +172,56 @@ function permissionsFor(profile, space, id, opts) {
151
172
  return { sub: { allow: sub }, pub: { allow } };
152
173
  }
153
174
  // ---- agent ----
154
- const channels = opts.channels?.length ? opts.channels : ["general"];
155
- const manager = opts.manager ?? "manager";
156
- const chatD = chatDurable(id), dmD = dmDurable(id);
175
+ const allowPublish = opts.allowPublish ?? []; // post ACL — DEFAULT-DENY (publish must be declared)
176
+ const allowSubscribe = opts.allowSubscribe?.length ? opts.allowSubscribe : ["general"]; // read ACL
177
+ // Re-assert at the mint chokepoint (covers mint/spawn paths that bypass the file loader): a policy
178
+ // channel must equal its wire token, or the minted grant would alias the logical ACL.
179
+ for (const ch of [...allowSubscribe, ...allowPublish])
180
+ assertValidChannel(ch);
181
+ const manager = opts.manager ?? CONTROL_PRIVILEGED;
182
+ const chatHistD = chatHistDurable(id), dmD = dmDurable(id);
183
+ const DLV = dlvStream(space), dlvD = dlvDurable(id); // Plane-3 per-member delivery (bind-only)
157
184
  const svcD = opts.role ? taskDurable(opts.role) : undefined;
158
185
  const pubAllow = [
159
- // peer subjects — identity + channel scope (step 5), built from the real builders.
160
- ...channels.map((ch) => chatSubject(space, id, ch)),
186
+ // peer publish — identity + channel scope, built from the real builders. Default-deny: ONLY the
187
+ // declared allowPublish channels (none by default) get a chat-publish grant.
188
+ ...allowPublish.map((ch) => chatSubject(space, id, ch)),
161
189
  unicastSubject(space, "*", id), // inst.*.<id> — DM any instance, as me
162
190
  anycastSubject(space, "*", id), // svc.*.<id> — anycast any role, as me
163
- controlServiceSubject(space, manager, id), // ctl.<mgr>.<id>
191
+ controlServiceSubject(space, CONTROL_SELF_SERVICE, id), // ctl.self.<id> — self stop/despawn + mediated join/leave, granted to all
164
192
  // JetStream control plane — scoped to this agent's own streams/durables.
165
193
  "$JS.API.INFO",
166
- `$JS.API.STREAM.INFO.${CHAT}`, `$JS.API.STREAM.INFO.${DM}`, `$JS.API.STREAM.INFO.${TASK}`, `$JS.API.STREAM.INFO.${KV}`, `$JS.API.STREAM.INFO.${CHKV}`,
167
- // CHAT consumer: self-create + self-update (join/leave mutate filter_subjects). Chat is
168
- // world-readable, so name-scope is enough but PIN to the own concrete chat_<id>, never a
169
- // pattern: `update` clobbers, so a wildcard grant would let an agent repoint a peer's filter
170
- // (silent channel-kick). Both API forms: old DURABLE.CREATE + new CONSUMER.CREATE.<name>
171
- // (the multi-filter create/update subject), each scoped to this durable.
172
- `$JS.API.CONSUMER.DURABLE.CREATE.${CHAT}.${chatD}`,
173
- `$JS.API.CONSUMER.CREATE.${CHAT}.${chatD}`,
174
- `$JS.API.CONSUMER.CREATE.${CHAT}.${chatD}.>`,
175
- `$JS.API.CONSUMER.INFO.${CHAT}.${chatD}`,
176
- `$JS.API.CONSUMER.MSG.NEXT.${CHAT}.${chatD}`,
177
- `$JS.ACK.${CHAT}.${chatD}.>`,
178
- // History backfill on join via Direct Get a read verb (no consumer create/clobber surface).
179
- // CHAT only, never DM/TASK (direct-get bypasses the consumer-create deny that is DM's
180
- // confidentiality boundary). Requires allow_direct on the CHAT stream (set in streams.ts).
181
- `$JS.API.DIRECT.GET.${CHAT}`,
194
+ // STREAM.INFO: CHAT (join watermark, recall drop-marker, channel-list counts — a documented
195
+ // metadata surface, see SPEC §9) + the world-readable presence/registry KVs. NOT DM/TASK: agents
196
+ // bind their dm_<id>/svc_<role> by name and never inspect those streams, so granting INFO there
197
+ // would only leak DM-inbox / task subject metadata across peers for no functional gain.
198
+ `$JS.API.STREAM.INFO.${CHAT}`, `$JS.API.STREAM.INFO.${KV}`, `$JS.API.STREAM.INFO.${CHKV}`,
199
+ // Live channel delivery is the agent's own native core subscription (sub.allow over chat.*.<ch>,
200
+ // below) — there is NO per-instance chat live-tail durable to bind. The durable backstop is
201
+ // Plane-3 (the bind-only dlv_<id> durable below). So no CHAT consumer bind/ack grants here.
202
+ // CHAT history reads (join-backfill, focus-recall, drop-marker) — single-filter EPHEMERAL
203
+ // consumers named chathist_<id>. The create rides the extended subject
204
+ // CONSUMER.CREATE.<CHAT>.<chathist_id>.<filter>, whose trailing filter token nats-server pins to
205
+ // the request body (JSConsumerCreateFilterSubjectMismatchErr, code 10131) — so one create grant
206
+ // per allowSubscribe channel makes history reads broker-bounded to the read ACL. Replaces the
207
+ // old unfiltered DIRECT.GET.<CHAT> (which could fetch ANY message regardless of channel). The
208
+ // name is the agent's own, so info/fetch/delete can't reach a peer's consumer. NO broad
209
+ // CONSUMER.CREATE.<CHAT> / .> deny here: NATS deny beats allow, which would also kill these.
210
+ ...allowSubscribe.map((ch) => `$JS.API.CONSUMER.CREATE.${CHAT}.${chatHistD}.${chatSubject(space, "*", ch)}`),
211
+ `$JS.API.CONSUMER.INFO.${CHAT}.${chatHistD}`,
212
+ `$JS.API.CONSUMER.MSG.NEXT.${CHAT}.${chatHistD}`,
213
+ `$JS.API.CONSUMER.DELETE.${CHAT}.${chatHistD}`,
182
214
  // DM consumer: BIND ONLY — info/fetch/ack its own pre-created durable, never create.
183
215
  `$JS.API.CONSUMER.INFO.${DM}.${dmD}`,
184
216
  `$JS.API.CONSUMER.MSG.NEXT.${DM}.${dmD}`,
185
217
  `$JS.ACK.${DM}.${dmD}.>`,
218
+ // Plane-3 DELIVER consumer (SPEC §8): BIND ONLY its own pre-created dlv_<id> — info/fetch/ack,
219
+ // never create (the provisioner pre-creates it filtered to dlv.<id>). The agent acks this via
220
+ // native JetStream — the re-authorized per-member handoff. It gets NO grant on the INBOX (mixed
221
+ // pre-auth) stream at all: default-deny keeps the fan-out target unreadable by the agent.
222
+ `$JS.API.CONSUMER.INFO.${DLV}.${dlvD}`,
223
+ `$JS.API.CONSUMER.MSG.NEXT.${DLV}.${dlvD}`,
224
+ `$JS.ACK.${DLV}.${dlvD}.>`,
186
225
  // Presence: watch (read, public roster) + flow control + PUT OWN KEY ONLY.
187
226
  `$JS.API.CONSUMER.CREATE.${KV}.>`,
188
227
  `$JS.API.CONSUMER.INFO.${KV}.>`,
@@ -200,6 +239,14 @@ function permissionsFor(profile, space, id, opts) {
200
239
  // allowed — the privileged provisioner pre-creates svc_<role> filtered to svc.<role>.*.
201
240
  pubAllow.push(`$JS.API.CONSUMER.INFO.${TASK}.${svcD}`, `$JS.API.CONSUMER.MSG.NEXT.${TASK}.${svcD}`, `$JS.ACK.${TASK}.${svcD}.>`);
202
241
  }
242
+ if (opts.capabilities?.includes("spawn")) {
243
+ // Spawn capability → grant the PRIVILEGED control subject (start / purge / definePersona /
244
+ // named stop-despawn). Default-deny otherwise: the subject is simply absent from this
245
+ // allow-list, so nats-server rejects the publish — no handler check, no deny-entry (a
246
+ // blanket `ctl.<mgr>.>` deny would override this grant too, since NATS deny beats allow).
247
+ // The self-service subject above is granted to all regardless of capability.
248
+ pubAllow.push(controlServiceSubject(space, manager, id));
249
+ }
203
250
  // Explicit create-deny (defense-in-depth over default-deny) on the two streams whose
204
251
  // create-time filter_subject is the attack surface — DM (private content) and TASK
205
252
  // (cross-role work-stealing). Covers the bare ephemeral form (no trailing token), the
@@ -211,13 +258,26 @@ function permissionsFor(profile, space, id, opts) {
211
258
  `$JS.API.CONSUMER.CREATE.${TASK}`,
212
259
  `$JS.API.CONSUMER.CREATE.${TASK}.>`,
213
260
  `$JS.API.CONSUMER.DURABLE.CREATE.${TASK}.>`,
261
+ // Plane-3 DELIVER: bind-only, like DM — the create-time filter_subject is the attack surface, so
262
+ // no create path (the provisioner pre-creates dlv_<id> filtered to dlv.<id>).
263
+ `$JS.API.CONSUMER.CREATE.${DLV}`,
264
+ `$JS.API.CONSUMER.CREATE.${DLV}.>`,
265
+ `$JS.API.CONSUMER.DURABLE.CREATE.${DLV}.>`,
214
266
  ];
215
- return { pub: { allow: pubAllow, deny: pubDeny }, sub: { allow: [inbox] } };
267
+ // CHAT live read boundary (SPEC v0.3 §9 / Appendix B): mint the read ACL as a native `sub.allow`
268
+ // over cotal.<space>.chat.*.<channel> — one per allowSubscribe channel, wildcards passed through
269
+ // (e.g. chat.*.review.>, chat.*.>). This is what lets an agent self-serve a live channel subscribe
270
+ // with NO manager: join = nc.subscribe, broker-enforced per-subscribe, no consumer name to confine,
271
+ // so an open ACL needs no enumeration. This sub.allow grant IS the live read path — there is no
272
+ // per-instance chat durable; the durable backstop is Plane-3 (manager fan-out → per-member DELIVER).
273
+ const subChat = allowSubscribe.map((ch) => chatSubject(space, "*", ch));
274
+ return { pub: { allow: pubAllow, deny: pubDeny }, sub: { allow: [inbox, ...subChat] } };
216
275
  }
217
276
  /** Render the `nats-server` config that trusts this space's operator and serves its
218
277
  * accounts via the in-config MEMORY resolver. */
219
278
  export function serverConfig(auth, opts) {
220
279
  const port = opts.port ?? 4222;
280
+ const host = opts.host ?? "127.0.0.1";
221
281
  // A minted "agent" carries its full permission allow-list inline in its user JWT, which the
222
282
  // client sends in the CONNECT protocol line. With per-channel + JetStream-API grants that JWT
223
283
  // exceeds the 4 KB default max_control_line at ~2 channels, and the server then silently drops
@@ -226,6 +286,7 @@ export function serverConfig(auth, opts) {
226
286
  // is a per-connection pre-auth allocation under connection flooding. 64 KB clears a many-channel
227
287
  // agent JWT (~4–8 KB) with wide margin while keeping the pre-auth surface ~16× tighter than 1 MB.
228
288
  return `# Generated by \`cotal up\` — do not edit by hand.
289
+ host: ${host}
229
290
  port: ${port}
230
291
  max_control_line: 65536
231
292
  jetstream { store_dir: ${JSON.stringify(opts.storeDir)} }
@@ -1 +1 @@
1
- {"version":3,"file":"provision.js","sourceRoot":"","sources":["../src/provision.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EACL,cAAc,EACd,aAAa,EACb,UAAU,EACV,QAAQ,GACT,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrF,OAAO,EACL,KAAK,EACL,WAAW,EACX,WAAW,EACX,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,UAAU,EACV,QAAQ,EACR,UAAU,EACV,WAAW,EACX,SAAS,EACT,WAAW,EACX,cAAc,EACd,aAAa,GACd,MAAM,eAAe,CAAC;AAkBvB,uFAAuF;AACvF,wFAAwF;AACxF,8DAA8D;AAC9D,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OA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AAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;YAAE,OAAO,GAAG,CAAC;QAChD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,MAAM,KAAK,GAAG;YAAE,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;QAC1C,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;AACH,CAAC;AAED,6FAA6F;AAC7F,MAAM,UAAU,aAAa,CAAC,GAAW,EAAE,IAAe;IACxD,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACpC,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AACtF,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAC/B,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IACrC,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,CAAc,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Peer name resolution + name validation — the client-side half of addressing.
3
+ *
4
+ * The wire routes on the unforgeable instance id (the nkey carried in the subject); a human
5
+ * **name** is only a convenience this resolves to an id. Resolution is deterministic and
6
+ * fail-loud: it returns exactly one peer or throws {@link AmbiguousPeerError} — it never
7
+ * silently picks among same-named peers. The id is authoritative; the name is best-effort.
8
+ *
9
+ * `owner/name` handles (per-owner namespaces) land with the accounts/auth feature; until then
10
+ * `/` is reserved in a name ({@link assertValidName}) so they slot in without a migration.
11
+ * See .internal/plans/peer-addressing.md.
12
+ */
13
+ import type { Presence, PresenceStatus } from "./types.js";
14
+ /** A peer that matched an ambiguous name — structural, so each surface renders it itself
15
+ * (core never formats UI strings). The full `id` is the authoritative, routable address. */
16
+ export interface PeerCandidate {
17
+ id: string;
18
+ name: string;
19
+ role?: string;
20
+ status: PresenceStatus;
21
+ /** Epoch ms of the peer's last heartbeat. */
22
+ ts: number;
23
+ }
24
+ /** Thrown when a name resolves to two or more peers that could each be the target. Carries the
25
+ * candidates structurally so a caller can show them and re-address by the exact `id`. */
26
+ export declare class AmbiguousPeerError extends Error {
27
+ readonly target: string;
28
+ readonly candidates: PeerCandidate[];
29
+ constructor(target: string, candidates: PeerCandidate[]);
30
+ }
31
+ /**
32
+ * Resolve a `target` (an exact instance id, or a display name) to one peer on `roster`.
33
+ *
34
+ * - an exact instance-id match wins (any status — an id is unambiguous);
35
+ * - otherwise a case-insensitive name match, preferring live peers over stale offline ghosts:
36
+ * one live match resolves; **2+ live matches throw**; with no live match a unique offline peer
37
+ * resolves (best-effort), but **2+ offline duplicates throw**;
38
+ * - no match → `undefined` (the caller renders "no such peer").
39
+ *
40
+ * `opts.selfId`, when given, is excluded (you don't DM yourself). Throws
41
+ * {@link AmbiguousPeerError} rather than ever silently picking.
42
+ */
43
+ export declare function resolvePeer(roster: Presence[], target: string, opts?: {
44
+ selfId?: string;
45
+ }): Presence | undefined;
46
+ /**
47
+ * Validate a display name. A name must be non-empty, single-line, and free of surrounding
48
+ * whitespace; `/` is reserved as the future `owner/name` separator (and already means "a path"
49
+ * to the agent-file loader). Throws — no silent rewrite (per AGENTS.md, no fallbacks). Internal
50
+ * spaces are allowed (human display names like "Ada Lovelace").
51
+ */
52
+ export declare function assertValidName(name: string): void;
53
+ //# sourceMappingURL=resolve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE3D;6FAC6F;AAC7F,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,cAAc,CAAC;IACvB,6CAA6C;IAC7C,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;0FAC0F;AAC1F,qBAAa,kBAAmB,SAAQ,KAAK;IAEzC,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,UAAU,EAAE,aAAa,EAAE;gBAD3B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,aAAa,EAAE;CASvC;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,QAAQ,EAAE,EAClB,MAAM,EAAE,MAAM,EACd,IAAI,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,GAC7B,QAAQ,GAAG,SAAS,CAetB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAOlD"}
@@ -0,0 +1,61 @@
1
+ /** Thrown when a name resolves to two or more peers that could each be the target. Carries the
2
+ * candidates structurally so a caller can show them and re-address by the exact `id`. */
3
+ export class AmbiguousPeerError extends Error {
4
+ target;
5
+ candidates;
6
+ constructor(target, candidates) {
7
+ super(`"${target}" is ambiguous — ${candidates.length} peers share that name: ` +
8
+ candidates.map((c) => `${c.name} (${c.id}, ${c.status})`).join("; ") +
9
+ `. Re-send to the exact instance id.`);
10
+ this.target = target;
11
+ this.candidates = candidates;
12
+ this.name = "AmbiguousPeerError";
13
+ }
14
+ }
15
+ function candidate(p) {
16
+ return { id: p.card.id, name: p.card.name, role: p.card.role, status: p.status, ts: p.ts };
17
+ }
18
+ /**
19
+ * Resolve a `target` (an exact instance id, or a display name) to one peer on `roster`.
20
+ *
21
+ * - an exact instance-id match wins (any status — an id is unambiguous);
22
+ * - otherwise a case-insensitive name match, preferring live peers over stale offline ghosts:
23
+ * one live match resolves; **2+ live matches throw**; with no live match a unique offline peer
24
+ * resolves (best-effort), but **2+ offline duplicates throw**;
25
+ * - no match → `undefined` (the caller renders "no such peer").
26
+ *
27
+ * `opts.selfId`, when given, is excluded (you don't DM yourself). Throws
28
+ * {@link AmbiguousPeerError} rather than ever silently picking.
29
+ */
30
+ export function resolvePeer(roster, target, opts = {}) {
31
+ const peers = opts.selfId ? roster.filter((p) => p.card.id !== opts.selfId) : roster;
32
+ const byId = peers.find((p) => p.card.id === target);
33
+ if (byId)
34
+ return byId;
35
+ const want = target.trim().toLowerCase();
36
+ if (!want)
37
+ return undefined;
38
+ const matches = peers.filter((p) => p.card.name.toLowerCase() === want);
39
+ if (matches.length === 0)
40
+ return undefined;
41
+ const live = matches.filter((p) => p.status !== "offline");
42
+ const pool = live.length > 0 ? live : matches;
43
+ if (pool.length === 1)
44
+ return pool[0];
45
+ throw new AmbiguousPeerError(target, pool.map(candidate));
46
+ }
47
+ /**
48
+ * Validate a display name. A name must be non-empty, single-line, and free of surrounding
49
+ * whitespace; `/` is reserved as the future `owner/name` separator (and already means "a path"
50
+ * to the agent-file loader). Throws — no silent rewrite (per AGENTS.md, no fallbacks). Internal
51
+ * spaces are allowed (human display names like "Ada Lovelace").
52
+ */
53
+ export function assertValidName(name) {
54
+ if (name.length === 0 || name !== name.trim())
55
+ throw new Error(`invalid name ${JSON.stringify(name)}: must be non-empty with no surrounding whitespace`);
56
+ if (/[\r\n]/.test(name))
57
+ throw new Error(`invalid name ${JSON.stringify(name)}: must be a single line`);
58
+ if (name.includes("/"))
59
+ throw new Error(`invalid name ${JSON.stringify(name)}: "/" is reserved (the owner/name separator)`);
60
+ }
61
+ //# sourceMappingURL=resolve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.js","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":"AAyBA;0FAC0F;AAC1F,MAAM,OAAO,kBAAmB,SAAQ,K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C,CAAC;AACxG,CAAC"}
package/dist/streams.d.ts CHANGED
@@ -3,6 +3,20 @@ import { type ConsumerConfig, type JetStreamManager } from "@nats-io/jetstream";
3
3
  * oldest message on a subject is discarded (`DiscardPolicy.Old`). Also the horizon of focus
4
4
  * recall: only the last {@link MAX_MSGS_PER_SUBJECT} per sender-subject are recallable. */
5
5
  export declare const MAX_MSGS_PER_SUBJECT = 1000;
6
+ /** JetStream message-dedup window on the Plane-3 streams: a `Nats-Msg-Id`
7
+ * (`<msgId>:<owner>:<generation>`) repeated within this window is collapsed. Sized generous (2h) so
8
+ * an activation-catch-up copy and a racing fan-out copy of the same message dedup even for a slow/
9
+ * backlogged owner. **This window IS the cross-path exactly-once correctness horizon** — two writes
10
+ * of the same logical copy separated by more than it (e.g. a manager crash after a DLV publish, the
11
+ * dinbox ack lost, the window expiring, then a re-transfer after restart) are NOT collapsed at the
12
+ * stream. The connector's commit-aware id-cache (`MeshAgent.ingest`) coalesces live↔durable and
13
+ * redelivery duplicates within a SESSION, but it is in-memory and reset on agent restart, so it is
14
+ * NOT a cross-restart guarantee. A persistent per-owner delivery ledger would lift the bound; not
15
+ * built (the 2h horizon covers the realistic crash/redelivery lag). Keep the window ≥ worst-case lag. */
16
+ export declare const PLANE3_DEDUP_WINDOW_MS: number;
17
+ /** Bound on the trusted reader's in-flight (un-acked) entries per owner — an offline owner with a large
18
+ * backlog can't stall the reader's own redelivery by pinning unbounded pending. */
19
+ export declare const DINBOX_MAX_ACK_PENDING = 1000;
6
20
  export interface ClearSpaceHistoryResult {
7
21
  chat: number;
8
22
  dm?: number;
@@ -45,6 +59,29 @@ export declare function dmDurableConfig(space: string, id: string, opts?: {
45
59
  export declare function taskDurableConfig(space: string, role: string, opts?: {
46
60
  ackWaitMs?: number;
47
61
  }): Partial<ConsumerConfig>;
62
+ /** The single privileged trusted-reader consumer over the WHOLE INBOX (mixed pre-auth) store
63
+ * (`dinbox.>`, all owners) — created + bound only by the manager. Explicit ack: the reader holds an
64
+ * entry un-acked until it has transferred the re-authorized copy to DLV (a crash before transfer
65
+ * redelivers). `max_ack_pending` bounds the reader's in-flight set. The per-message owner is
66
+ * recovered from the subject (`parseDinboxOwner`). */
67
+ export declare function inboxReaderConfig(space: string, opts?: {
68
+ ackWaitMs?: number;
69
+ }): Partial<ConsumerConfig>;
70
+ /** An agent's bind-only per-member DELIVER consumer (mirrors {@link dmDurableConfig}): the provisioner
71
+ * pre-creates it filtered to `dlv.<owner>`; the agent BINDS it (denied CREATE on DLV) and acks via
72
+ * native JetStream — the §8 "equivalent per-member at-least-once mechanism with the same ack
73
+ * semantics". `inactive_threshold` only for an open-mode self-create (none today; Plane-3 is
74
+ * auth-only). */
75
+ export declare function dlvDurableConfig(space: string, owner: string, opts?: {
76
+ ackWaitMs?: number;
77
+ inactiveThresholdMs?: number;
78
+ }): Partial<ConsumerConfig>;
79
+ /** The single privileged fan-out consumer on CHAT (manager-pumped; routing, not auth).
80
+ * `DeliverPolicy.New` at creation (pre-existing backlog is pre-membership); a DURABLE, so on a
81
+ * manager restart it resumes from its ack cursor and fans out the gap, idempotent via `Nats-Msg-Id`. */
82
+ export declare function fanoutDurableConfig(space: string, opts?: {
83
+ ackWaitMs?: number;
84
+ }): Partial<ConsumerConfig>;
48
85
  /** Connect with the given (privileged) creds, create the space's streams, and disconnect.
49
86
  * Used by `cotal up` to pre-create streams once at setup. */
50
87
  export declare function setupSpaceStreams(opts: {
@@ -1 +1 @@
1
- {"version":3,"file":"streams.d.ts","sourceRoot":"","sources":["../src/streams.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AAqB5B;;4FAE4F;AAC5F,eAAO,MAAM,oBAAoB,OAAO,CAAC;AAEzC,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAA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