@cotal-ai/core 0.168.0 → 0.170.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 (118) hide show
  1. package/dist/agent-file.d.ts +9 -5
  2. package/dist/agent-file.d.ts.map +1 -1
  3. package/dist/agent-file.js +30 -17
  4. package/dist/agent-file.js.map +1 -1
  5. package/dist/anycast-requests.d.ts +8 -1
  6. package/dist/anycast-requests.d.ts.map +1 -1
  7. package/dist/anycast-requests.js +47 -0
  8. package/dist/anycast-requests.js.map +1 -1
  9. package/dist/backup-config.d.ts +5 -2
  10. package/dist/backup-config.d.ts.map +1 -1
  11. package/dist/backup-config.js +7 -2
  12. package/dist/backup-config.js.map +1 -1
  13. package/dist/backup.d.ts +6 -0
  14. package/dist/backup.d.ts.map +1 -1
  15. package/dist/backup.js +11 -4
  16. package/dist/backup.js.map +1 -1
  17. package/dist/connector-setup.d.ts +2 -0
  18. package/dist/connector-setup.d.ts.map +1 -1
  19. package/dist/connector.d.ts +8 -11
  20. package/dist/connector.d.ts.map +1 -1
  21. package/dist/control-exchange.d.ts +114 -0
  22. package/dist/control-exchange.d.ts.map +1 -0
  23. package/dist/control-exchange.js +416 -0
  24. package/dist/control-exchange.js.map +1 -0
  25. package/dist/endpoint-binding.d.ts.map +1 -1
  26. package/dist/endpoint-binding.js +2 -0
  27. package/dist/endpoint-binding.js.map +1 -1
  28. package/dist/endpoint-call.d.ts +2 -1
  29. package/dist/endpoint-call.d.ts.map +1 -1
  30. package/dist/endpoint-call.js +14 -7
  31. package/dist/endpoint-call.js.map +1 -1
  32. package/dist/endpoint-channel-discovery.d.ts +102 -0
  33. package/dist/endpoint-channel-discovery.d.ts.map +1 -0
  34. package/dist/endpoint-channel-discovery.js +170 -0
  35. package/dist/endpoint-channel-discovery.js.map +1 -0
  36. package/dist/endpoint-control-plane.d.ts +204 -0
  37. package/dist/endpoint-control-plane.d.ts.map +1 -0
  38. package/dist/endpoint-control-plane.js +627 -0
  39. package/dist/endpoint-control-plane.js.map +1 -0
  40. package/dist/endpoint-delivery-plane.d.ts +337 -0
  41. package/dist/endpoint-delivery-plane.d.ts.map +1 -0
  42. package/dist/endpoint-delivery-plane.js +1291 -0
  43. package/dist/endpoint-delivery-plane.js.map +1 -0
  44. package/dist/endpoint-durable-backstop.d.ts +249 -0
  45. package/dist/endpoint-durable-backstop.d.ts.map +1 -0
  46. package/dist/endpoint-durable-backstop.js +485 -0
  47. package/dist/endpoint-durable-backstop.js.map +1 -0
  48. package/dist/endpoint-envelope.d.ts +2 -1
  49. package/dist/endpoint-envelope.d.ts.map +1 -1
  50. package/dist/endpoint-envelope.js +9 -3
  51. package/dist/endpoint-envelope.js.map +1 -1
  52. package/dist/endpoint-history.d.ts +370 -0
  53. package/dist/endpoint-history.d.ts.map +1 -0
  54. package/dist/endpoint-history.js +969 -0
  55. package/dist/endpoint-history.js.map +1 -0
  56. package/dist/endpoint-inbound.d.ts +10 -0
  57. package/dist/endpoint-inbound.d.ts.map +1 -0
  58. package/dist/endpoint-inbound.js +28 -0
  59. package/dist/endpoint-inbound.js.map +1 -0
  60. package/dist/endpoint-liveness.d.ts +105 -0
  61. package/dist/endpoint-liveness.d.ts.map +1 -0
  62. package/dist/endpoint-liveness.js +223 -0
  63. package/dist/endpoint-liveness.js.map +1 -0
  64. package/dist/endpoint-messaging.d.ts +229 -0
  65. package/dist/endpoint-messaging.d.ts.map +1 -0
  66. package/dist/endpoint-messaging.js +420 -0
  67. package/dist/endpoint-messaging.js.map +1 -0
  68. package/dist/endpoint-presence.d.ts +15 -0
  69. package/dist/endpoint-presence.d.ts.map +1 -1
  70. package/dist/endpoint-presence.js +35 -0
  71. package/dist/endpoint-presence.js.map +1 -1
  72. package/dist/endpoint-serve.d.ts +11 -1
  73. package/dist/endpoint-serve.d.ts.map +1 -1
  74. package/dist/endpoint-serve.js +42 -5
  75. package/dist/endpoint-serve.js.map +1 -1
  76. package/dist/endpoint-subjects.d.ts +3 -0
  77. package/dist/endpoint-subjects.d.ts.map +1 -1
  78. package/dist/endpoint-subjects.js +3 -0
  79. package/dist/endpoint-subjects.js.map +1 -1
  80. package/dist/endpoint-subscriptions.d.ts +199 -0
  81. package/dist/endpoint-subscriptions.d.ts.map +1 -0
  82. package/dist/endpoint-subscriptions.js +543 -0
  83. package/dist/endpoint-subscriptions.js.map +1 -0
  84. package/dist/endpoint.d.ts +96 -344
  85. package/dist/endpoint.d.ts.map +1 -1
  86. package/dist/endpoint.js +518 -3854
  87. package/dist/endpoint.js.map +1 -1
  88. package/dist/index.d.ts +3 -1
  89. package/dist/index.d.ts.map +1 -1
  90. package/dist/index.js +5 -1
  91. package/dist/index.js.map +1 -1
  92. package/dist/launch-material.d.ts +9 -3
  93. package/dist/launch-material.d.ts.map +1 -1
  94. package/dist/launch-material.js +22 -2
  95. package/dist/launch-material.js.map +1 -1
  96. package/dist/provision-jwt.d.ts.map +1 -1
  97. package/dist/provision-jwt.js +1 -0
  98. package/dist/provision-jwt.js.map +1 -1
  99. package/dist/provision-permissions.d.ts +1 -1
  100. package/dist/provision-permissions.d.ts.map +1 -1
  101. package/dist/provision-permissions.js +10 -1
  102. package/dist/provision-permissions.js.map +1 -1
  103. package/dist/remote-manager-authority.d.ts +1 -1
  104. package/dist/run-host.d.ts +4 -1
  105. package/dist/run-host.d.ts.map +1 -1
  106. package/dist/run-journal.d.ts +2 -0
  107. package/dist/run-journal.d.ts.map +1 -1
  108. package/dist/run-journal.js +1 -1
  109. package/dist/run-journal.js.map +1 -1
  110. package/dist/run-record.d.ts +4 -0
  111. package/dist/run-record.d.ts.map +1 -1
  112. package/dist/run-record.js +36 -0
  113. package/dist/run-record.js.map +1 -1
  114. package/dist/space-quiescence-resources.d.ts +30 -0
  115. package/dist/space-quiescence-resources.d.ts.map +1 -0
  116. package/dist/space-quiescence-resources.js +45 -0
  117. package/dist/space-quiescence-resources.js.map +1 -0
  118. package/package.json +5 -1
@@ -0,0 +1,170 @@
1
+ import { JetStreamApiCodes } from "@nats-io/jetstream";
2
+ import { openChannelRegistry, effectiveReplay, effectiveDeliveryClass, readChannelConfig, readChannelDefaults, decodeChannelEntry, } from "./channels.js";
3
+ import { isPublishPermissionDenied } from "./endpoint.js";
4
+ import { isJetStreamMissing } from "./jetstream-missing.js";
5
+ import { lastKvEntries } from "./kv-scan.js";
6
+ import { CHANNEL_DEFAULTS_KEY, channelBucket, isConcreteChannel } from "./subjects.js";
7
+ /** One endpoint's view of the channel registry: the on-demand read, the cache lookups and the
8
+ * replay and delivery-class policy they answer, and the registry watch or one-shot read that keeps
9
+ * the cache. Internal: `CotalEndpoint` keeps the public methods and forwards to it. */
10
+ export class EndpointChannelDiscovery {
11
+ deps;
12
+ constructor(deps) {
13
+ this.deps = deps;
14
+ }
15
+ get nc() { return this.deps.nc(); }
16
+ get space() { return this.deps.space(); }
17
+ get card() { return this.deps.card(); }
18
+ get doConsume() { return this.deps.doConsume(); }
19
+ get doWatch() { return this.deps.doWatch(); }
20
+ get doWatchChannels() { return this.deps.doWatchChannels(); }
21
+ get channelKv() { return this.deps.channelKv(); }
22
+ set channelWatchIter(iter) { this.deps.setChannelWatchIter(iter); }
23
+ get channelConfigs() { return this.deps.channelConfigs(); }
24
+ get channelDefaults() { return this.deps.channelDefaults(); }
25
+ set channelDefaults(defaults) { this.deps.setChannelDefaults(defaults); }
26
+ get channelRead() { return this.deps.channelRead(); }
27
+ set channelRead(read) { this.deps.setChannelRead(read); }
28
+ get channelReadGeneration() { return this.deps.channelReadGeneration(); }
29
+ set channelReadGeneration(n) { this.deps.setChannelReadGeneration(n); }
30
+ get channelReadApplied() { return this.deps.channelReadApplied(); }
31
+ set channelReadApplied(n) { this.deps.setChannelReadApplied(n); }
32
+ notLiveMsg() { return this.deps.notLiveMsg(); }
33
+ bindKvWatch(kv) { return this.deps.bindKvWatch(kv); }
34
+ emitRecoverable(err) { this.deps.emitRecoverable(err); }
35
+ emit(event, ...args) { return this.deps.emit(event, ...args); }
36
+ /** A consumer that reads presence on demand reads the channel registry on demand too: it holds no
37
+ * watch on either, so a seat binds no consumer per member on these buckets (SPEC §6, §7). */
38
+ get readsChannelsOnDemand() {
39
+ return this.doConsume && this.doWatchChannels && !this.doWatch;
40
+ }
41
+ /**
42
+ * Read the channel registry from the broker now, for a consumer that reads presence on demand. One
43
+ * batched Direct Get that binds no consumer, decoded as the watch decodes; the result replaces the
44
+ * cache, so an entry removed since the last read is gone. {@link listChannels} and a join or leave
45
+ * read through here first; other cache readers see the last read.
46
+ *
47
+ * Calls made while a read is in flight share it, and every other call reads anew. A failed read
48
+ * throws and changes nothing. A credential that may not make the read is refused with the grant it lacks.
49
+ */
50
+ async readChannels() {
51
+ if (!this.readsChannelsOnDemand)
52
+ throw new Error("readChannels is for a consumer that reads presence on demand; this endpoint watches the channel registry or keeps no cache of it");
53
+ const kv = this.channelKv;
54
+ if (!kv)
55
+ throw new Error(this.notLiveMsg());
56
+ if (this.channelRead)
57
+ return this.channelRead;
58
+ const generation = ++this.channelReadGeneration;
59
+ const read = (async () => {
60
+ let entries;
61
+ try {
62
+ entries = await lastKvEntries(kv);
63
+ }
64
+ catch (e) {
65
+ if (!isPublishPermissionDenied(e))
66
+ throw e;
67
+ throw new Error(`channel registry read refused for ${this.card.id}: this credential may not publish $JS.API.DIRECT.GET.KV_${channelBucket(this.space)}, the on-demand registry read (SPEC Appendix B). A credential minted by an older issuer can lack this grant even when newly minted; upgrade the manager or auth service that issues credentials, then mint a new credential. Reusing credentials or reconnecting does not add the grant.`, { cause: e });
68
+ }
69
+ if (generation <= this.channelReadApplied)
70
+ return;
71
+ this.channelReadApplied = generation;
72
+ this.channelConfigs.clear();
73
+ this.channelDefaults = {};
74
+ for (const e of entries)
75
+ this.handleChannelEntry(e);
76
+ })();
77
+ this.channelRead = read;
78
+ const settled = () => { if (this.channelRead === read)
79
+ this.channelRead = undefined; };
80
+ read.then(settled, settled);
81
+ return read;
82
+ }
83
+ /** This channel's registry config from the local cache (undefined if unset). */
84
+ getChannelConfig(channel) {
85
+ return this.channelConfigs.get(channel);
86
+ }
87
+ /** Effective replay-on-join policy for a channel: per-channel override ?? space default ??
88
+ * true. Reads the live cache, so it reflects runtime registry edits. */
89
+ channelReplay(channel) {
90
+ return effectiveReplay(this.channelConfigs.get(channel), this.channelDefaults);
91
+ }
92
+ /** Effective replay window for a channel (per-channel override ?? space default), or undefined
93
+ * for the full retained window. Only meaningful when {@link channelReplay} is true. */
94
+ channelReplayWindow(channel) {
95
+ return this.channelConfigs.get(channel)?.replayWindow ?? this.channelDefaults.replayWindow;
96
+ }
97
+ /** A channel's effective replay policy read straight from the registry bucket, for a caller that
98
+ * reads it right after start, before any watch cache has caught up, or that watches nothing. A
99
+ * wildcard reads the space defaults only. A space with no registry bucket has the built-in policy.
100
+ * `registered` says whether the channel has its own registry entry. */
101
+ async channelReplayPolicy(channel) {
102
+ if (!this.nc)
103
+ throw new Error(this.notLiveMsg());
104
+ const kv = this.channelKv ?? (await openChannelRegistry(this.nc, this.space, { create: false }));
105
+ let cfg;
106
+ let defaults;
107
+ try {
108
+ [cfg, defaults] = await Promise.all([
109
+ isConcreteChannel(channel) ? readChannelConfig(kv, channel) : Promise.resolve(undefined),
110
+ readChannelDefaults(kv),
111
+ ]);
112
+ }
113
+ catch (e) {
114
+ // `open` binds lazily, so a space with no registry bucket surfaces on the first read.
115
+ if (!isJetStreamMissing(e, JetStreamApiCodes.StreamNotFound))
116
+ throw e;
117
+ }
118
+ return { replay: effectiveReplay(cfg, defaults), window: cfg?.replayWindow ?? defaults?.replayWindow ?? null, registered: cfg !== undefined };
119
+ }
120
+ /** Effective delivery class for a channel (per-channel override ?? space default ?? "durable"),
121
+ * from the live watch cache — drives the non-gating delivery-health surface (only durable-class
122
+ * channels have a Plane-3 backstop to report on). */
123
+ channelDeliveryClass(channel) {
124
+ return effectiveDeliveryClass(this.channelConfigs.get(channel), this.channelDefaults);
125
+ }
126
+ /** Watch the channel registry: replay existing keys, then stream updates, into the local
127
+ * cache. A failed bind throws out of connect; an entry that does not decode or validate is
128
+ * reported as a `warning` and dropped, so its channel resolves to the default policy. */
129
+ async startChannelWatch() {
130
+ if (!this.channelKv)
131
+ return;
132
+ const bound = await this.bindKvWatch(this.channelKv);
133
+ if (!bound)
134
+ return;
135
+ const { iter } = bound;
136
+ this.channelWatchIter = iter;
137
+ void (async () => {
138
+ for await (const e of iter)
139
+ this.handleChannelEntry(e);
140
+ })().catch((e) => this.emit("error", e));
141
+ }
142
+ /** {@link EndpointOptions.readOnce}: fill the channel cache from one read of the registry. */
143
+ async readChannelsOnce() {
144
+ if (!this.channelKv)
145
+ return;
146
+ for (const e of await lastKvEntries(this.channelKv))
147
+ this.handleChannelEntry(e);
148
+ }
149
+ handleChannelEntry(e) {
150
+ // Cleared before the decode, so an entry that does not decode resolves to the default as the
151
+ // fresh registry reads do.
152
+ const isDefaults = e.key === CHANNEL_DEFAULTS_KEY;
153
+ if (isDefaults)
154
+ this.channelDefaults = {};
155
+ else
156
+ this.channelConfigs.delete(e.key);
157
+ if (e.operation === "DEL" || e.operation === "PURGE")
158
+ return;
159
+ try {
160
+ if (isDefaults)
161
+ this.channelDefaults = decodeChannelEntry(e);
162
+ else
163
+ this.channelConfigs.set(e.key, decodeChannelEntry(e));
164
+ }
165
+ catch (err) {
166
+ this.emitRecoverable(new Error(`dropped channel registry entry for key ${JSON.stringify(e.key)}: ${err.message}`));
167
+ }
168
+ }
169
+ }
170
+ //# sourceMappingURL=endpoint-channel-discovery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoint-channel-discovery.js","sourceRoot":"","sources":["../src/endpoint-channel-discovery.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAqB,MAAM,oBAAoB,CAAC;AAE1E,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CA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C5B,KAAK,MAAM,CAAC,IAAI,MAAM,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC;YAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAClF,CAAC;IAEO,kBAAkB,CAAC,CAAU;QACnC,6FAA6F;QAC7F,2BAA2B;QAC3B,MAAM,UAAU,GAAG,CAAC,CAAC,GAAG,KAAK,oBAAoB,CAAC;QAClD,IAAI,UAAU;YAAE,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;;YACrC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,CAAC,CAAC,SAAS,KAAK,KAAK,IAAI,CAAC,CAAC,SAAS,KAAK,OAAO;YAAE,OAAO;QAC7D,IAAI,CAAC;YACH,IAAI,UAAU;gBAAE,IAAI,CAAC,eAAe,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC;;gBACxD,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7D,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,eAAe,CAAC,IAAI,KAAK,CAAC,0CAA0C,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,KAAM,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAChI,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,204 @@
1
+ import { type Msg, type NatsConnection, type Subscription } from "@nats-io/transport-node";
2
+ import { type ResolvedService, type SubmitAndFollowGoalOptions } from "./endpoint-invoke.js";
3
+ import type { EpCaller, IssuedCaller } from "./endpoint-subjects.js";
4
+ import { type RegistryEndpointsInput, type RegistryEndpointsOutput } from "./registry-contract.js";
5
+ import type { EpVerbTarget, EpAttributedReply } from "./endpoint-verbs.js";
6
+ import type { ControlReply, ControlRequest, ControlRequestInit, EndpointRef } from "./types.js";
7
+ /** One goal follower {@link EndpointControlPlane.followServiceGoal} registers with its endpoint. */
8
+ type GoalFollower = {
9
+ cancel: () => void;
10
+ reconnected: (nc: NatsConnection) => void;
11
+ };
12
+ /** What the control plane reads from its endpoint. State is read when it is used, never copied, and
13
+ * every method is looked up on the endpoint at call time. */
14
+ export interface EndpointControlPlaneDeps {
15
+ nc: () => NatsConnection | undefined;
16
+ space: () => string;
17
+ owner: () => string;
18
+ actor: () => string;
19
+ stopped: () => boolean;
20
+ authed: () => boolean;
21
+ connId: () => string;
22
+ presentedExp: () => number | undefined;
23
+ issuedGeneration: () => string | undefined;
24
+ acceptedToken: () => string | undefined;
25
+ rebuildPromise: () => Promise<void> | undefined;
26
+ subs: () => Subscription[];
27
+ resolvedServices: () => Map<string, ResolvedService>;
28
+ resolvedCommandServices: () => Map<string, Map<string, ResolvedService>>;
29
+ serviceInvocations: () => WeakMap<NatsConnection, Set<Promise<void>>>;
30
+ requestsAwaitingReply: () => Map<NatsConnection, Set<(error: Error) => void>>;
31
+ activeGoalFollowers: () => Set<GoalFollower>;
32
+ splitsRecovered: () => number;
33
+ setSplitsRecovered: (count: number) => void;
34
+ notLiveMsg: () => string;
35
+ requireLifecycleUid: (what: string) => string;
36
+ reportSubscriptionDenial: (error: unknown) => boolean;
37
+ ref: () => EndpointRef;
38
+ reconnect: () => Promise<void>;
39
+ emit: (event: string, ...args: unknown[]) => boolean;
40
+ }
41
+ /** The request/reply control plane of one endpoint (serve, answer and request control, with the
42
+ * bound reply every request rides) and its service-invocation client (describe, list, invoke,
43
+ * and follow a goal). Internal: `CotalEndpoint` keeps the public methods and forwards to it. */
44
+ export declare class EndpointControlPlane {
45
+ private readonly deps;
46
+ constructor(deps: EndpointControlPlaneDeps);
47
+ private get nc();
48
+ private get space();
49
+ private get owner();
50
+ private get actor();
51
+ private get stopped();
52
+ private get authed();
53
+ private get connId();
54
+ private get presentedExp();
55
+ private get issuedGeneration();
56
+ private get acceptedToken();
57
+ private get rebuildPromise();
58
+ private get subs();
59
+ private get resolvedServices();
60
+ private get resolvedCommandServices();
61
+ private get serviceInvocations();
62
+ private get requestsAwaitingReply();
63
+ private get activeGoalFollowers();
64
+ private get splitsRecovered();
65
+ private set splitsRecovered(value);
66
+ private notLiveMsg;
67
+ private requireLifecycleUid;
68
+ private reportSubscriptionDenial;
69
+ private ref;
70
+ private reconnect;
71
+ private emit;
72
+ /** Serve control requests for a service. Returns the subscription so a caller that re-registers on
73
+ * reconnect (the delivery daemon) can drop the stale one. `boundReply` is REQUIRED for any service
74
+ * whose responder holds a wildcard publish grant over the service subtree (the delivery daemon's
75
+ * `ctl.delivery.*.*.reply.>`): without it, an authenticated caller could set its reply target to a
76
+ * PEER's reply lane (`ctl.delivery.<victim>.reply.<n>`) and turn the responder into a confused
77
+ * deputy — the broker does NOT permission-check the requester's embedded reply subject. With it, a
78
+ * reply is published only when `m.reply` is under the AUTHENTICATED request subject
79
+ * (`${m.subject}.reply.…`), binding the reply to the broker-policed sender token.
80
+ *
81
+ * Requests are answered one at a time, in arrival order. A request `concurrent` accepts is answered
82
+ * in its own time instead: it waits for none of the requests in front of it, including one still
83
+ * running, and holds up none behind it. Only for a request that shares no state with the service's
84
+ * other requests. */
85
+ serveControl(service: string, handler: (req: ControlRequest) => Promise<ControlReply> | ControlReply, opts?: {
86
+ boundReply?: boolean;
87
+ concurrent?: (req: ControlRequest) => boolean;
88
+ }): import("@nats-io/transport-node").Subscription;
89
+ /** Answer one control request for {@link serveControl}: the sender guard, the handler, and the reply. */
90
+ private answerControl;
91
+ /** Keep native named-reply and NoResponders handling, but settle when its connection closes:
92
+ * nats.js can close a no-mux subscription without settling its request. One close observer per
93
+ * connection avoids retaining a closed-promise callback for every completed request. */
94
+ requestBoundReply(nc: NatsConnection, subject: string, body: string, reply: string, timeoutMs: number): Promise<Msg>;
95
+ /** Send a control request to a service and await its reply (client side). Like {@link requestDelivery},
96
+ * the reply rides a BOUNDED subject UNDER the request subject (`ctl.<service>.<id>.reply.<uuid>`), not
97
+ * the per-id `_INBOX`.
98
+ * `noMux` lets us name the reply subject while keeping NoResponders detection. The random suffix is
99
+ * defense-in-depth (a predictable suffix would let a peer target an in-flight named reply sub). The
100
+ * reply sits under the sender's OWN request subject, so the responder's `boundReply` guard accepts it. */
101
+ requestControl(service: string, req: ControlRequestInit, timeoutMs?: number): Promise<ControlReply>;
102
+ /** The caller this connection's endpoint requests ride as: the legacy triple, or the issued
103
+ * caller with its discovered generation (SPEC 13.15). It names the reply rail this connection's
104
+ * credential reads, which is where a manager's turn notice for it lands (SPEC 14.3). */
105
+ serviceRailCaller(): EpCaller;
106
+ /** This endpoint's v0.4 caller triple (§13.2) — the identity its minted ep-rail rows pin. The
107
+ * owner/actor principal is mode-correct by construction (static: DEV_OWNER + the connection
108
+ * identity; user mode: the bearer's callout-derived pair), and the lifecycle UID is the
109
+ * launcher-supplied incarnation the rows are keyed on (ledger-consistent: the §13.1 presence
110
+ * lifecycle-proof refuses a divergent uid before any publish). */
111
+ private serviceCaller;
112
+ /** Follow this caller's goal on its standing connection, subscribing before submission.
113
+ * A submitter may use a separate short-lived control credential for the same caller triple;
114
+ * the accepted action's readiness budget can outlive that credential. This endpoint retains
115
+ * its existing credential renewal and caller-scoped progress grants. */
116
+ followServiceGoal(endpoint: string, submit: (signal?: AbortSignal) => Promise<EpAttributedReply>, deadlineMs?: number, opts?: Pick<SubmitAndFollowGoalOptions, "reconcile" | "signal" | "prepare">): Promise<EpAttributedReply>;
117
+ /** Drop every cached handle for one endpoint after refresh or a currency split. */
118
+ private clearResolvedService;
119
+ /** Hold connection recovery through the whole pre-acceptance phase, including the progress
120
+ * subscription flush. Release on setup failure or the command's answer, never on goal terminal. */
121
+ private beginServiceInvocation;
122
+ private waitServiceRecovery;
123
+ /** The resolved, digest-verified command surface of `endpoint` as this connection's caller sees
124
+ * it. Unpinned calls cache the complete discovery surface, and `refresh` drops both the full
125
+ * handle and any command-specific invocation handles. `instanceId` selects one instance without
126
+ * reading or populating either class cache, as a pinned invoke does. The caller's existing
127
+ * credential must permit that route. */
128
+ describeService(endpoint: string, opts?: {
129
+ deadlineMs?: number;
130
+ signal?: AbortSignal;
131
+ refresh?: boolean;
132
+ instanceId?: string;
133
+ }): Promise<ResolvedService>;
134
+ /** The caller a registry listing rides (SPEC 13.15). An issued connection lists as itself. Any
135
+ * other connection reads the listing generation the issuer bound to the credential it presented,
136
+ * under the token its connection id and that credential's expiry derive. `undefined`: that
137
+ * credential carries no listing binding, because it predates listing issuance or has no expiry. */
138
+ listingCaller(): Promise<IssuedCaller | undefined>;
139
+ /** One page of the registry's `endpoints` answer (SPEC 13.20) over this connection
140
+ * ({@link listRegistryEndpoints}). The describe rides this connection's own caller; the question
141
+ * rides the listing caller on an authed mesh. `unbound`: this credential carries no listing
142
+ * binding. */
143
+ listEndpoints(input: RegistryEndpointsInput, opts?: {
144
+ deadlineMs?: number;
145
+ signal?: AbortSignal;
146
+ }): Promise<{
147
+ unbound: true;
148
+ } | {
149
+ unbound?: false;
150
+ reply: EpAttributedReply;
151
+ page?: RegistryEndpointsOutput;
152
+ }>;
153
+ /** Ask the registry over `nc` under `listing`: this connection, or another of this caller triple
154
+ * such as a manager-call connection. The describe rides this connection, whose view holds the
155
+ * registry's describe. Every endpoint the page lists has its cached describe dropped, so the next
156
+ * describe of it reads the surface afresh. `unbound`: the broker refused the question under
157
+ * `listing`, whose credential holds no listing row. */
158
+ listEndpointsOver(nc: NatsConnection, listing: IssuedCaller | undefined, input: RegistryEndpointsInput, opts?: {
159
+ deadlineMs?: number;
160
+ signal?: AbortSignal;
161
+ }): Promise<{
162
+ unbound: true;
163
+ } | {
164
+ unbound?: false;
165
+ reply: EpAttributedReply;
166
+ page?: RegistryEndpointsOutput;
167
+ }>;
168
+ /** GENERIC v0.4 service invoke over this endpoint's own connection: resolve
169
+ * the named endpoint's registered surface — describe, §13.7 store fetch, digest-verified
170
+ * recompile ({@link resolveService}; cached per endpoint name) — and invoke one command. The
171
+ * resolve is describe-bound currency, and a call that reaches the wrong incarnation is recovered
172
+ * two ways depending on WHO caught it — the difference between knowing the command did not run
173
+ * and only knowing someone answered:
174
+ * - the RESPONDER fenced it on the request's `bind` (§13.2, an `ok:false` reply marked
175
+ * {@link replyRefusedBeforeEffect}): the command did not run, so the bind is dropped and the
176
+ * call re-issued for any command, up to {@link BIND_SPLIT_REISSUES} times while each re-issue
177
+ * is refused the same way. If a re-issue cannot be resolved, the refusal
178
+ * surfaces — still saying the command did not run — naming the resolve failure as why the
179
+ * repair could not be attempted. An unpinned targeted call that reached a member holding no
180
+ * mapping for its target ({@link replyTargetUnmapped}) is repaired the same way, and when the
181
+ * re-issues run out, the latest such refusal is the one surfaced.
182
+ * - this CLIENT caught it on the reply ({@link respondedButUnbound}: a different instance,
183
+ * `failed-precondition`; the same instance at any other epoch, `expired`), which is what a
184
+ * responder too old to know the field produces. A live instance received and answered it, so
185
+ * the bind is dropped but the call is re-issued only for a command on the
186
+ * {@link isRepeatSafeCommand} allowlist; anything else surfaces, since a second attempt could
187
+ * duplicate its effect.
188
+ * A broker permission refusal marked `not-executed` rebuilds the connection and retries once
189
+ * within the original deadline. A second refusal stands. Responder errors and calls that may
190
+ * have run never trigger this repair.
191
+ * Errors from the responder come back structurally on the attributed reply
192
+ * (`reply.ok === false`); transport/validation refusals throw {@link EpEnvelopeError}. */
193
+ invokeService(endpoint: string, command: string, args?: Record<string, unknown>, opts?: {
194
+ target?: EpVerbTarget;
195
+ deadlineMs?: number;
196
+ follow?: boolean;
197
+ signal?: AbortSignal;
198
+ instanceId?: string;
199
+ classInstanceId?: string;
200
+ }): Promise<EpAttributedReply>;
201
+ private invokeServiceOnce;
202
+ }
203
+ export {};
204
+ //# sourceMappingURL=endpoint-control-plane.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoint-control-plane.d.ts","sourceRoot":"","sources":["../src/endpoint-control-plane.ts"],"names":[],"mappings":"AAIA,OAAO,EAAyB,KAAK,GAAG,EAAE,KAAK,cAAc,EAAE,KAAK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