@cotal-ai/core 0.3.2 → 0.4.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.
@@ -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,KAAK;IAEhC;IACA;IAFX,YACW,MAAc,EACd,UAA2B;QAEpC,KAAK,CACH,IAAI,MAAM,oBAAoB,UAAU,CAAC,MAAM,0BAA0B;YACvE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;YACpE,qCAAqC,CACxC,CAAC;QAPO,WAAM,GAAN,MAAM,CAAQ;QACd,eAAU,GAAV,UAAU,CAAiB;QAOpC,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AAED,SAAS,SAAS,CAAC,CAAW;IAC5B,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,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O,IAAI,CAAC,CAAC,CAAC,CAAC;IACtC,MAAM,IAAI,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;AAC5D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE;QAC3C,MAAM,IAAI,KAAK,CAAC,gBAAgB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAC;IAC5G,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,gBAAgB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACjF,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,gBAAgB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;AACxG,CAAC"}
package/dist/streams.d.ts CHANGED
@@ -35,6 +35,29 @@ export declare function dmDurableConfig(space: string, id: string, opts?: {
35
35
  ackWaitMs?: number;
36
36
  inactiveThresholdMs?: number;
37
37
  }): Partial<ConsumerConfig>;
38
+ /**
39
+ * The chat live-tail durable for an instance — ONE definition, used both by the privileged
40
+ * pre-create (manager/provisioner, auth mode) and the endpoint's open-mode self-create, so an
41
+ * idempotent re-add can't error on a config delta. `filter_subjects` binds it to the instance's
42
+ * subscribe set (`chat.*.<ch>` per channel); only the privileged creator sets it under auth, which
43
+ * is the whole point — the agent BINDS-only (denied CONSUMER.CREATE/UPDATE on CHAT) and so can
44
+ * never widen its own read past `allowSubscribe`. `DeliverPolicy.New` (a tail): history is the
45
+ * explicit per-channel backfill on join, the only shape that can honor per-channel replay policy
46
+ * given `deliver_policy` is consumer-wide.
47
+ *
48
+ * Multi-channel ⇒ plural `filter_subjects`, which the client sends on the filter-less create
49
+ * subject (`CONSUMER.CREATE.<stream>.<name>`) — so this durable's filter is NOT ACL-pinnable by
50
+ * subject; bind-only + a trusted creator is the enforcement, exactly as for DM/TASK.
51
+ *
52
+ * `inactive_threshold` is set ONLY when the caller passes one — the open-mode self-create, where
53
+ * the agent owns the durable. The privileged auth pre-create OMITS it (same bind-only reasoning as
54
+ * {@link dmDurableConfig}): a threshold would retire the durable before a late/relaunched agent
55
+ * binds it, and bind would then fail permanently.
56
+ */
57
+ export declare function chatDurableConfig(space: string, id: string, channels: string[], opts?: {
58
+ ackWaitMs?: number;
59
+ inactiveThresholdMs?: number;
60
+ }): Partial<ConsumerConfig>;
38
61
  /**
39
62
  * The TASK work-queue durable for a role — ONE definition, shared by the privileged
40
63
  * pre-create (auth mode) and the endpoint's open-mode self-create. The durable is shared
@@ -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,kBAAkB,CACtC,GAAG,EAAE,gBAAgB,EACrB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CA0Bf;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,MAAM,EACV,IAAI,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAAO,GAC9D,OAAO,CAAC,cAAc,CAAC,CAUzB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CA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AAC,IAAI,EAAE;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAsB/C"}
package/dist/streams.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jetstreamManager, AckPolicy, DeliverPolicy, RetentionPolicy, DiscardPolicy, StorageType, } from "@nats-io/jetstream";
2
2
  import { connect, credsAuthenticator, nanos } from "@nats-io/transport-node";
3
3
  import { Kvm } from "@nats-io/kv";
4
- import { spacePrefix, chatStream, chatSubject, isConcreteChannel, dmStream, dmDurable, unicastSubject, taskStream, taskDurable, anycastSubject, presenceBucket, channelBucket, } from "./subjects.js";
4
+ import { spacePrefix, chatStream, chatSubject, chatDurable, collapseFilterSubjects, isConcreteChannel, dmStream, dmDurable, unicastSubject, taskStream, taskDurable, anycastSubject, presenceBucket, channelBucket, } from "./subjects.js";
5
5
  /** Default presence-bucket entry TTL (ms) — matches the endpoint's default liveness window. */
6
6
  const PRESENCE_TTL_MS = 6_000;
7
7
  /** Per-(sender,channel)-subject retention cap on the chat stream — the bound past which the
@@ -26,9 +26,10 @@ export async function createSpaceStreams(jsm, space) {
26
26
  storage: StorageType.File,
27
27
  max_msgs_per_subject: MAX_MSGS_PER_SUBJECT, // capped per-channel backlog (buffer + history)
28
28
  discard: DiscardPolicy.Old,
29
- // Enable the read-only Direct Get API for per-channel history backfill on join (a pure
30
- // read verb, no consumer create). CHAT ONLY never DM/TASK: direct-get bypasses the
31
- // consumer-create deny that is DM's confidentiality boundary.
29
+ // Direct Get API stays enabled on CHAT (harmless: agents hold no DIRECT.GET grant). Per-channel
30
+ // history reads no longer use itthey go through contained single-filter ephemeral consumers
31
+ // (endpoint `collectHistory`) so the read ACL bounds them. NEVER set on DM/TASK: direct-get
32
+ // would bypass the consumer-create deny that is DM's confidentiality boundary.
32
33
  allow_direct: true,
33
34
  });
34
35
  await jsm.streams.add({
@@ -70,6 +71,37 @@ export function dmDurableConfig(space, id, opts = {}) {
70
71
  cfg.inactive_threshold = nanos(opts.inactiveThresholdMs);
71
72
  return cfg;
72
73
  }
74
+ /**
75
+ * The chat live-tail durable for an instance — ONE definition, used both by the privileged
76
+ * pre-create (manager/provisioner, auth mode) and the endpoint's open-mode self-create, so an
77
+ * idempotent re-add can't error on a config delta. `filter_subjects` binds it to the instance's
78
+ * subscribe set (`chat.*.<ch>` per channel); only the privileged creator sets it under auth, which
79
+ * is the whole point — the agent BINDS-only (denied CONSUMER.CREATE/UPDATE on CHAT) and so can
80
+ * never widen its own read past `allowSubscribe`. `DeliverPolicy.New` (a tail): history is the
81
+ * explicit per-channel backfill on join, the only shape that can honor per-channel replay policy
82
+ * given `deliver_policy` is consumer-wide.
83
+ *
84
+ * Multi-channel ⇒ plural `filter_subjects`, which the client sends on the filter-less create
85
+ * subject (`CONSUMER.CREATE.<stream>.<name>`) — so this durable's filter is NOT ACL-pinnable by
86
+ * subject; bind-only + a trusted creator is the enforcement, exactly as for DM/TASK.
87
+ *
88
+ * `inactive_threshold` is set ONLY when the caller passes one — the open-mode self-create, where
89
+ * the agent owns the durable. The privileged auth pre-create OMITS it (same bind-only reasoning as
90
+ * {@link dmDurableConfig}): a threshold would retire the durable before a late/relaunched agent
91
+ * binds it, and bind would then fail permanently.
92
+ */
93
+ export function chatDurableConfig(space, id, channels, opts = {}) {
94
+ const cfg = {
95
+ durable_name: chatDurable(id),
96
+ filter_subjects: collapseFilterSubjects(channels.map((ch) => chatSubject(space, "*", ch))),
97
+ ack_policy: AckPolicy.Explicit,
98
+ ack_wait: nanos(opts.ackWaitMs ?? 60_000),
99
+ deliver_policy: DeliverPolicy.New,
100
+ };
101
+ if (opts.inactiveThresholdMs)
102
+ cfg.inactive_threshold = nanos(opts.inactiveThresholdMs);
103
+ return cfg;
104
+ }
73
105
  /**
74
106
  * The TASK work-queue durable for a role — ONE definition, shared by the privileged
75
107
  * pre-create (auth mode) and the endpoint's open-mode self-create. The durable is shared
@@ -1 +1 @@
1
- {"version":3,"file":"streams.js","sourceRoot":"","sources":["../src/streams.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,aAAa,EACb,eAAe,EACf,aAAa,EACb,WAAW,GAGZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EACL,WAAW,EACX,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,QAAQ,EACR,SAAS,EACT,cAAc,EACd,UAAU,EACV,WAAW,EACX,cAAc,EACd,cAAc,EACd,aAAa,GACd,MAAM,eAAe,CAAC;AAEvB,+FAA+F;AAC/F,MAAM,eAAe,GAAG,KAAK,CAAC;AAE9B;;4FAE4F;AAC5F,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAOzC;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,GAAqB,EACrB,KAAa;IAEb,MAAM,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IAC7B,MAAM,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC;QACpB,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC;QACvB,QAAQ,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC;QACzB,SAAS,EAAE,eAAe,CAAC,MAAM;QACjC,OAAO,EAAE,WAAW,CAAC,IAAI;QACzB,oBAAoB,EAAE,oBAAoB,EAAE,gDAAgD;QAC5F,OAAO,EAAE,aAAa,CAAC,GAAG;QAC1B,uFAAuF;QACvF,qFAAqF;QACrF,8DAA8D;QAC9D,YAAY,EAAE,IAAI;KACnB,CAAC,CAAC;IACH,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AC,IAAI,CAAC,KAAK,CAAC,EAAE;YACjE,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC;SACnD,CAAC,CAAC;QACH,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;YACnE,MAAM,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC;QAAC,MAAM,CAAC;YACP,yFAAyF;QAC3F,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAC3C,CAAC;YAAS,CAAC;QACT,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC;IACnB,CAAC;AACH,CAAC"}
@@ -26,9 +26,29 @@ export declare function isConcreteChannel(channel: string): boolean;
26
26
  * matching ("is a member on `team.>` a member of `team.backend`?") — channels are dotted
27
27
  * token strings, same rules. */
28
28
  export declare function subjectMatches(pattern: string, subject: string): boolean;
29
+ /** Validate a channel name/pattern used as **policy** (an agent file's `subscribe`/`allowSubscribe`/
30
+ * `allowPublish` entry, a CLI flag, or a join target). Each dotted segment must be a NATS-safe
31
+ * token (exactly what {@link token} leaves unchanged: `[A-Za-z0-9_-]`), or `*` (one level), or `>`
32
+ * (final segment only). Rejects — fail-loud — anything {@link token} would silently rewrite.
33
+ *
34
+ * This closes an ACL-aliasing gap: containment is validated against the RAW policy string
35
+ * (`channelInAllow`), but the minted wire grant is built through `token()` (`chatSubject`). Without
36
+ * this, `allowSubscribe:[foo/bar]` would validate as the channel `foo/bar` yet mint a read grant for
37
+ * the wire subject `chat.*.foo_bar` — letting the agent read `#foo_bar`, a channel the operator
38
+ * never named (and two distinct policy strings could collide on one token). Returns the channel
39
+ * unchanged when valid so callers can use it inline. */
40
+ export declare function assertValidChannel(channel: string): string;
41
+ /** Is `channel` within a read/post ACL `allow` (a list of channel patterns)? True when some
42
+ * entry covers it — exact, or a wildcard subtree (`team.>` covers `team.backend`). Channels are
43
+ * dotted token strings, so this rides {@link subjectMatches}. The single covering rule shared by
44
+ * the load-time invariant (`subscribe ⊆ allowSubscribe`), the connector subset check, and the
45
+ * manager's mediated-join validation (`channel ∈ allowSubscribe`) so they can't drift. */
46
+ export declare function channelInAllow(allow: string[], channel: string): boolean;
29
47
  /** Drop exact duplicates and any subject subsumed by a more-general one — JetStream
30
48
  * rejects a consumer whose `filter_subjects` overlap, so `[team.>, team.backend]`
31
- * must collapse to `[team.>]` before binding the chat consumer. */
49
+ * must collapse to `[team.>]` before binding the chat consumer. A parent and its subtree
50
+ * (`[review, review.>]`) are disjoint in NATS (`review.>` never matches bare `review`), so
51
+ * both are kept — that's how a peer subscribes to a channel *and* everything under it. */
32
52
  export declare function collapseFilterSubjects(subjects: string[]): string[];
33
53
  /** Unicast: a specific instance's inbox, tagged with the sender. (Either position may be
34
54
  * `*` for subscribe/allow rules: `inst.<myId>.*` to receive, `inst.*.<myId>` to send as me.) */
@@ -37,6 +57,21 @@ export declare function unicastSubject(space: string, target: string, sender: st
37
57
  export declare function anycastSubject(space: string, service: string, sender: string): string;
38
58
  /** Control request/reply to a service (e.g. the manager), tagged with the sender; anycast via queue group. */
39
59
  export declare function controlServiceSubject(space: string, service: string, sender: string): string;
60
+ /** Control-plane service names — the three-tier split (P2a). The manager subscribes to ALL
61
+ * three; the cred layer grants {@link CONTROL_SELF_SERVICE} to every agent and
62
+ * {@link CONTROL_PRIVILEGED} only to spawn-capable agents (default-deny otherwise), while
63
+ * {@link CONTROL_ADMIN} is reached only by the manager's own allow-all profile (no agent ever
64
+ * gets it). nats-server — not a handler — is the coarse boundary. The handler then routes by
65
+ * op↔service (fail-closed on mismatch) and refines own-child vs admin among holders of the
66
+ * privileged subject. `CONTROL_PRIVILEGED` is the existing `manager` service; `CONTROL_SELF_SERVICE`
67
+ * carries only the no-name self stop/despawn; `CONTROL_ADMIN` carries the operator-only ops
68
+ * (purge, cross-agent stop/despawn/attach/definePersona). */
69
+ export declare const CONTROL_PRIVILEGED: "manager";
70
+ export declare const CONTROL_SELF_SERVICE: "self";
71
+ export declare const CONTROL_ADMIN: "admin";
72
+ /** The three control-plane tiers the manager serves — values tie to the `CONTROL_*` service
73
+ * names so handler routing can't drift from the subject names. */
74
+ export type ControlTier = typeof CONTROL_PRIVILEGED | typeof CONTROL_SELF_SERVICE | typeof CONTROL_ADMIN;
40
75
  export declare function traceSubject(space: string, agentId: string): string;
41
76
  export declare function controlSubject(space: string, agentId: string): string;
42
77
  /** Wildcard matching every subject within a space. */
@@ -85,8 +120,13 @@ export declare function chatStream(space: string): string;
85
120
  export declare function dmStream(space: string): string;
86
121
  /** Stream capturing `svc.>` — anycast work queue. */
87
122
  export declare function taskStream(space: string): string;
88
- /** Durable consumer name for an instance's view of the chat stream. */
123
+ /** Durable consumer name for an instance's view of the chat stream — its live tail. */
89
124
  export declare function chatDurable(instance: string): string;
125
+ /** Consumer name for an instance's short-lived chat **history** reads (join-backfill, focus-recall,
126
+ * drop-marker). A single per-instance name (not the live `chat_<id>`) so its create/info/fetch/
127
+ * delete grants are name-scoped to the agent's own id — a peer can never bind it — while the
128
+ * per-read single `filter_subject` is what the create-time ACL pins to `allowSubscribe`. */
129
+ export declare function chatHistDurable(instance: string): string;
90
130
  /** Durable consumer name for an instance's private DM inbox. */
91
131
  export declare function dmDurable(instance: string): string;
92
132
  /** Durable consumer name (shared across instances of a role) for the task queue. */
@@ -1 +1 @@
1
- {"version":3,"file":"subjects.d.ts","sourceRoot":"","sources":["../src/subjects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,gEAAgE;AAChE,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAGvC;AAED,eAAO,MAAM,IAAI,UAAU,CAAC;AAE5B,wBAAgB,WAAW,CAAC,KAAK,EA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AAoB,cAAc,CAAC;AAIhD,+DAA+D;AAC/D,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,uEAAuE;AACvE,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED,qDAAqD;AACrD,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,uFAAuF;AACvF,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;6FAG6F;AAC7F,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,gEAAgE;AAChE,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,oFAAoF;AACpF,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEnD"}
package/dist/subjects.js CHANGED
@@ -74,7 +74,7 @@ export function subjectMatches(pattern, subject) {
74
74
  const s = subject.split(".");
75
75
  for (let i = 0; i < p.length; i++) {
76
76
  if (p[i] === ">")
77
- return true; // matches all remaining tokens
77
+ return i < s.length; // '>' matches one-or-more remaining tokens — NATS semantics: 'a.>' does NOT match bare 'a'
78
78
  if (i >= s.length)
79
79
  return false;
80
80
  if (p[i] === "*")
@@ -84,9 +84,48 @@ export function subjectMatches(pattern, subject) {
84
84
  }
85
85
  return p.length === s.length;
86
86
  }
87
+ /** Validate a channel name/pattern used as **policy** (an agent file's `subscribe`/`allowSubscribe`/
88
+ * `allowPublish` entry, a CLI flag, or a join target). Each dotted segment must be a NATS-safe
89
+ * token (exactly what {@link token} leaves unchanged: `[A-Za-z0-9_-]`), or `*` (one level), or `>`
90
+ * (final segment only). Rejects — fail-loud — anything {@link token} would silently rewrite.
91
+ *
92
+ * This closes an ACL-aliasing gap: containment is validated against the RAW policy string
93
+ * (`channelInAllow`), but the minted wire grant is built through `token()` (`chatSubject`). Without
94
+ * this, `allowSubscribe:[foo/bar]` would validate as the channel `foo/bar` yet mint a read grant for
95
+ * the wire subject `chat.*.foo_bar` — letting the agent read `#foo_bar`, a channel the operator
96
+ * never named (and two distinct policy strings could collide on one token). Returns the channel
97
+ * unchanged when valid so callers can use it inline. */
98
+ export function assertValidChannel(channel) {
99
+ const segs = channel.split(".");
100
+ if (!channel.length || segs.some((s) => s.length === 0))
101
+ throw new Error(`invalid channel "${channel}": empty segment (no leading/trailing/double dots)`);
102
+ segs.forEach((s, i) => {
103
+ if (s === ">") {
104
+ if (i !== segs.length - 1)
105
+ throw new Error(`invalid channel "${channel}": '>' is only valid as the last segment`);
106
+ return;
107
+ }
108
+ if (s === "*")
109
+ return;
110
+ if (!/^[A-Za-z0-9_-]+$/.test(s))
111
+ throw new Error(`invalid channel "${channel}": segment "${s}" must be a NATS-safe token ([A-Za-z0-9_-]), '*', or '>' — ` +
112
+ `policy channel names can't contain characters the wire layer would rewrite`);
113
+ });
114
+ return channel;
115
+ }
116
+ /** Is `channel` within a read/post ACL `allow` (a list of channel patterns)? True when some
117
+ * entry covers it — exact, or a wildcard subtree (`team.>` covers `team.backend`). Channels are
118
+ * dotted token strings, so this rides {@link subjectMatches}. The single covering rule shared by
119
+ * the load-time invariant (`subscribe ⊆ allowSubscribe`), the connector subset check, and the
120
+ * manager's mediated-join validation (`channel ∈ allowSubscribe`) so they can't drift. */
121
+ export function channelInAllow(allow, channel) {
122
+ return allow.some((a) => subjectMatches(a, channel));
123
+ }
87
124
  /** Drop exact duplicates and any subject subsumed by a more-general one — JetStream
88
125
  * rejects a consumer whose `filter_subjects` overlap, so `[team.>, team.backend]`
89
- * must collapse to `[team.>]` before binding the chat consumer. */
126
+ * must collapse to `[team.>]` before binding the chat consumer. A parent and its subtree
127
+ * (`[review, review.>]`) are disjoint in NATS (`review.>` never matches bare `review`), so
128
+ * both are kept — that's how a peer subscribes to a channel *and* everything under it. */
90
129
  export function collapseFilterSubjects(subjects) {
91
130
  const uniq = [...new Set(subjects)];
92
131
  return uniq.filter((x) => !uniq.some((y) => y !== x && subjectMatches(y, x)));
@@ -104,6 +143,18 @@ export function anycastSubject(space, service, sender) {
104
143
  export function controlServiceSubject(space, service, sender) {
105
144
  return `${spacePrefix(space)}.ctl.${routeToken(service)}.${routeToken(sender)}`;
106
145
  }
146
+ /** Control-plane service names — the three-tier split (P2a). The manager subscribes to ALL
147
+ * three; the cred layer grants {@link CONTROL_SELF_SERVICE} to every agent and
148
+ * {@link CONTROL_PRIVILEGED} only to spawn-capable agents (default-deny otherwise), while
149
+ * {@link CONTROL_ADMIN} is reached only by the manager's own allow-all profile (no agent ever
150
+ * gets it). nats-server — not a handler — is the coarse boundary. The handler then routes by
151
+ * op↔service (fail-closed on mismatch) and refines own-child vs admin among holders of the
152
+ * privileged subject. `CONTROL_PRIVILEGED` is the existing `manager` service; `CONTROL_SELF_SERVICE`
153
+ * carries only the no-name self stop/despawn; `CONTROL_ADMIN` carries the operator-only ops
154
+ * (purge, cross-agent stop/despawn/attach/definePersona). */
155
+ export const CONTROL_PRIVILEGED = "manager";
156
+ export const CONTROL_SELF_SERVICE = "self";
157
+ export const CONTROL_ADMIN = "admin";
107
158
  export function traceSubject(space, agentId) {
108
159
  return `${spacePrefix(space)}.trace.${token(agentId)}`;
109
160
  }
@@ -182,10 +233,17 @@ export function dmStream(space) {
182
233
  export function taskStream(space) {
183
234
  return `TASK_${token(space)}`;
184
235
  }
185
- /** Durable consumer name for an instance's view of the chat stream. */
236
+ /** Durable consumer name for an instance's view of the chat stream — its live tail. */
186
237
  export function chatDurable(instance) {
187
238
  return `chat_${token(instance)}`;
188
239
  }
240
+ /** Consumer name for an instance's short-lived chat **history** reads (join-backfill, focus-recall,
241
+ * drop-marker). A single per-instance name (not the live `chat_<id>`) so its create/info/fetch/
242
+ * delete grants are name-scoped to the agent's own id — a peer can never bind it — while the
243
+ * per-read single `filter_subject` is what the create-time ACL pins to `allowSubscribe`. */
244
+ export function chatHistDurable(instance) {
245
+ return `chathist_${token(instance)}`;
246
+ }
189
247
  /** Durable consumer name for an instance's private DM inbox. */
190
248
  export function dmDurable(instance) {
191
249
  return `dm_${token(instance)}`;
@@ -1 +1 @@
1
- {"version":3,"file":"subjects.js","sourceRoot":"","sources":["../src/subjects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,OAAO,GAAG,iBAAiB,CAAC;AAElC,gEAAgE;AAChE,MAAM,UAAU,KAAK,CAAC,CAAS;IAC7B,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IACzC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAChC,CAAC;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC;AAE5B,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,OAAO,GAAG,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;AACnC,CAAC;AAED;;gFAEgF;AAChF,MAAM,UAAU,iBAAiB,CAAC,QAAmB;IACnD,IAAI,CAAC,QAAQ,EAAE,MAAM;QAAE,OAAO,SAAS,CAAC;IACxC,MAAM,GAAG,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAClG,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;AACtC,CAAC;AAED;;;;;;GAMG;AACH,SAAS,WAAW,CAAC,OAAe;IAClC,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,C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uF;AACvF,MAAM,UAAU,WAAW,CAAC,QAAgB;IAC1C,OAAO,QAAQ,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;AACnC,CAAC;AAED;;;6FAG6F;AAC7F,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC9C,OAAO,YAAY,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;AACvC,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,SAAS,CAAC,QAAgB;IACxC,OAAO,MAAM,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;AACjC,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,OAAO,OAAO,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;AACjC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@cotal-ai/core",
3
- "version": "0.3.2",
3
+ "description": "The Cotal protocol: endpoint, subjects, message types, the NATS client layer, and the extension contracts.",
4
+ "version": "0.4.0",
4
5
  "license": "Apache-2.0",
5
6
  "repository": {
6
7
  "type": "git",
@@ -31,6 +32,7 @@
31
32
  },
32
33
  "scripts": {
33
34
  "typecheck": "tsc -p tsconfig.json --noEmit",
34
- "build": "tsc -p tsconfig.json"
35
+ "build": "tsc -p tsconfig.json",
36
+ "test": "tsx resolve.smoke.ts"
35
37
  }
36
38
  }