@cotal-ai/connector-core 0.101.7 → 0.103.1

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.
package/dist/agent.d.ts CHANGED
@@ -195,8 +195,8 @@ export declare class MeshAgent extends EventEmitter {
195
195
  /** The turn relay's seat-side intake: every pulled-and-unyielded run turn, by goal id. Fed by
196
196
  * {@link pollTurns}; surfaced into host context by {@link surfacePendingTurns}; drained by
197
197
  * {@link yieldTurn} (explicit) and the working→idle boundary in {@link setStatus} (automatic
198
- * `done`). The poll is also the reconciler: a turn settled elsewhere (deadline, another yield
199
- * path) vanishes from `turn-pending` and is dropped here on the next pull. */
198
+ * `done`). The pull is also the reconciler: a turn settled elsewhere (deadline, another yield
199
+ * path) vanishes from `turn-pending`, and the manager's notice for it brings the pull that drops it. */
200
200
  private activeTurns;
201
201
  /** Deadlines of turns the run settled before this seat yielded them, by goal id, so a late yield
202
202
  * is refused with {@link settledTurnError}. Bounded by {@link MAX_SETTLED_TURNS}. */
@@ -205,10 +205,19 @@ export declare class MeshAgent extends EventEmitter {
205
205
  * snapshotted a goal before its answer; taking it back would surface the settled turn again, and
206
206
  * the next pull would record it as the run's settlement. */
207
207
  private yieldedSincePull;
208
- private turnPollTimer?;
208
+ /** Set once the launching manager's turn notices are subscribed; the endpoint re-binds the
209
+ * subscription on every rebuilt connection. */
210
+ private turnNoticeArmed;
211
+ /** The single retry after a pull that failed for a reason that can pass. Unset while pulls succeed. */
212
+ private turnRetryTimer?;
213
+ /** The timed pull for a launching manager whose answers say it sends no turn notices: a manager
214
+ * from before them. Unset while the manager says it sends them. */
215
+ private legacyTurnPoll?;
209
216
  /** The last pull failure this seat reported, so one that keeps failing is said once. */
210
217
  private pullTrouble?;
211
218
  private turnPollBusy;
219
+ /** A notice or reconnect arrived while a pull was in flight, so one more pull follows it. */
220
+ private turnPullAgain;
212
221
  private _contextId;
213
222
  /** The per-call correlation a {@link withCorrelation} scope binds for the sends inside it. */
214
223
  private readonly correlation;
@@ -745,6 +754,13 @@ export declare class MeshAgent extends EventEmitter {
745
754
  ok: false;
746
755
  error: string;
747
756
  }>;
757
+ /** Manager-call bearers this session holds, by the exact bearer argv (so by selected manager;
758
+ * the space, owner, actor and lifecycle are this session's own). One exchange serves every call
759
+ * until {@link MANAGER_BEARER_MARGIN_MS} before the bearer expires, and concurrent calls share it.
760
+ * Each call still presents the bearer to the broker and checks its binding, so this keeps no
761
+ * authorization decision; any failed call drops the entry, so the next one exchanges afresh. */
762
+ private managerBearers;
763
+ private managerCallBearer;
748
764
  /** Run the spawner's bearer command with this session's environment on every credential path. */
749
765
  private execBearerCmd;
750
766
  /** One v0.4 manager-endpoint invoke (P2 item 1, 1c.2b): the generic {@link CotalEndpoint.invokeService}
@@ -788,23 +804,38 @@ export declare class MeshAgent extends EventEmitter {
788
804
  /** Whether a manager launched this seat. A manager accepts a run turn only against a seat it
789
805
  * launched (`serveTurnGoal`), and every manager launch path (local spawn, restart, resume, and
790
806
  * `delegatedSeatCommand` → `cotal spawn` handoff) sets `COTAL_MANAGER_INSTANCE`
791
- * (`config.managerInstanceId`), so a directly connected session has no turn relay to poll. */
807
+ * (`config.managerInstanceId`), so a directly connected session has no turn relay to arm. */
792
808
  private hasTurnRelay;
793
- private ensureTurnPoll;
809
+ /** Subscribe to the launching manager's turn notices (SPEC 14.3) and pull once. The manager
810
+ * publishes a notice whenever this seat's `turn-pending` answer changes, and repeats it until
811
+ * the seat pulls a new turn, so an idle seat sends nothing, across reconnects too. The pull on a
812
+ * notice, here at the first bind, and on a reconnect while the seat holds a turn is the only
813
+ * intake; the subscription exists before the first pull, so a turn accepted in between is not missed. */
814
+ private armTurnRelay;
815
+ /** Pull now, or once more after the pull in flight, so notices that arrive together cost one pull. */
816
+ private requestTurnPull;
794
817
  /** Pull this seat's pending run turns from its launching manager (`turn-pending`, self-mode).
795
818
  * New turns request a wake so the payload surfaces on the next injectable frame; turns gone from
796
819
  * the reply were settled elsewhere (deadline, agent-down, a competing yield path) and are
797
- * dropped. Only a manager-launched seat (`hasTurnRelay`) arms this poll; any failure to reach
798
- * the launching manager is passed to {@link notePullTrouble}. */
820
+ * dropped. Only a manager-launched seat (`hasTurnRelay`) pulls; any failure to reach the
821
+ * launching manager is passed to {@link turnPullFailed}. */
799
822
  private pollTurns;
823
+ /** Follow what the launching manager says about turn notices. A manager from before them never
824
+ * sends one, so this seat pulls on a timer while its answers say so, and says that once. */
825
+ private noteTurnNotices;
826
+ /** A pull failed. A manager that is down, still reconciling or unanswered can recover, so ONE
827
+ * retry is armed for {@link TURN_PULL_RETRY_MS} later and re-armed while that keeps failing. A
828
+ * refusal (a denied capability, a request the manager rejects) is reported and not retried:
829
+ * asking again on a timer would be the idle poll this relay removed, against a door that is shut.
830
+ * The next notice or reconnect pulls again either way. */
831
+ private turnPullFailed;
800
832
  /**
801
833
  * A pull that did not come back, said ONCE.
802
834
  *
803
- * Only a manager-launched seat polls (`hasTurnRelay`), so an unanswered pull means its own
804
- * launching manager did not answer. The poll runs every few seconds for the life of the session,
805
- * so a line per failure would be a torrent; instead each distinct reason is reported once and
806
- * saying it again waits for the reason to change or for a pull to succeed. Only the manager's
807
- * startup reconciliation window (`still reconciling`) stays silent because it resolves itself.
835
+ * Only a manager-launched seat pulls (`hasTurnRelay`), so an unanswered pull means its own
836
+ * launching manager did not answer. Each distinct reason is reported once and saying it again
837
+ * waits for the reason to change or for a pull to succeed. Only the manager's startup
838
+ * reconciliation window (`still reconciling`) stays silent because it resolves itself.
808
839
  */
809
840
  private notePullTrouble;
810
841
  /** Format every not-yet-surfaced turn still inside its deadline as an injectable context block,
@@ -937,10 +968,9 @@ export declare class MeshAgent extends EventEmitter {
937
968
  * carries it, so an observer can tell a turn that stopped advancing from one that is progressing. */
938
969
  noteActivity(at?: number): void;
939
970
  /** The working→idle boundary: yield `done` for every SURFACED turn (its payload was in the
940
- * context of the turn that just ended; ending without an explicit yield IS the done signal),
941
- * then re-poll immediately on a manager-launched seat (`hasTurnRelay`) so a queued turn wakes
942
- * the seat without waiting out the cadence. Fire-and-forget from the presence path — a yield
943
- * must never block a status write. */
971
+ * context of the turn that just ended; ending without an explicit yield IS the done signal).
972
+ * The manager's notice for each settled yield brings the next queued turn. Fire-and-forget
973
+ * from the presence path — a yield must never block a status write. */
944
974
  private onTurnBoundary;
945
975
  /** Record the host's actual model and optional variant learned after launch, so peers see the
946
976
  * selection in `cotal_roster` and the web roster even when the operator never pinned one. Explicit
@@ -1 +1 @@
1
- {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAUL,aAAa,EAcb,KAAK,YAAY,EAKjB,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,YAAY,EAEjB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,YAAY,EAElB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAO/C,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC;AAE3C;;;6DAG6D;AAC7D,eAAO,MAAM,gBAAgB,QAAS,CAAC;AAEvC;;;;;;8EAM8E;AAC9E,eAAO,MAAM,gBAAgB,QAAS,CAAC;AAEvC;;8BAE8B;AAC9B,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAItD;AAwBD,2EAA2E;AAC3E,MAAM,WAAW,gBAAgB;IAC/B;qGACiG;IACjG,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,2EAA2E;AAC3E,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX;;;;;;6EAMyE;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IAC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AC,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAKtF,mEAAmE;IAC7D,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC;IAO/D;;wEAEoE;YACtD,gBAAgB;IAI9B;;;;+EAI2E;IACrE,aAAa,CAAC,SAAS,GAAE,MAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IAKxE;;;6DAGyD;IACzD,OAAO,CAAC,eAAe;IAmBvB;;qEAEiE;IACjE,OAAO,CAAC,mBAAmB;IAO3B;;uFAEmF;IACnF,OAAO,CAAC,mBAAmB;IAQ3B,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,iBAAiB;IAczB,OAAO,CAAC,GAAG;CAGZ;AAED;;uCAEuC;AACvC,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,CAAC,YAAY,EAAE;IAAE,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC,GAAG,MAAM,CAI/F;AAED,kGAAkG;AAClG,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAOrF"}
package/dist/agent.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { AsyncLocalStorage } from "node:async_hooks";
2
2
  import { EventEmitter } from "node:events";
3
3
  import { hostname } from "node:os";
4
- import { normalizeMentions, RUN_LAUNCH_DEADLINE_MS, subjectMatches, isConcreteChannel, assertValidChannel, channelInAllow, eventChannelPrincipal, resolvePeer as resolvePeerInRoster, peerLabel, CotalEndpoint, acquireLocalConsumer, BASELINE_LIFECYCLE_ENDPOINT, BIND_SPLIT_REISSUES, assertLifecycleToken, EpEnvelopeError, isPublishPermissionDenied, unansweredRequest, controlReplyFrom, controlReplyFromThrown, runAgentBearer, partsToText, assertValidRole, } from "@cotal-ai/core";
5
- import { TURN_POLL_MS } from "./turn-poll.js";
4
+ import { normalizeMentions, RUN_LAUNCH_DEADLINE_MS, subjectMatches, isConcreteChannel, assertValidChannel, channelInAllow, eventChannelPrincipal, resolvePeer as resolvePeerInRoster, peerLabel, CotalEndpoint, acquireLocalConsumer, BASELINE_LIFECYCLE_ENDPOINT, BIND_SPLIT_REISSUES, assertLifecycleToken, EpEnvelopeError, isPublishPermissionDenied, unansweredRequest, controlReplyFrom, controlReplyFromThrown, runAgentBearer, partsToText, assertValidRole, turnNoticeFilter, } from "@cotal-ai/core";
5
+ import { TURN_PULL_RETRY_MS } from "./turn-poll.js";
6
6
  import { attributionSafe } from "./framing.js";
7
7
  import { invokeUserManager } from "./manager-call.js";
8
8
  /** Client-side floor for a spawn action's submit + follow. The manager acceptance carries the exact
@@ -10,6 +10,9 @@ import { invokeUserManager } from "./manager-call.js";
10
10
  * delivery margin. This floor still outlives the manager's generic 30s default and protects
11
11
  * older responders whose acceptance predates that field. */
12
12
  export const SPAWN_TIMEOUT_MS = 40_000;
13
+ /** A manager-call bearer is reused only while more than this remains before its `exp`, so a
14
+ * control connection opened with it outlives the longest call it carries ({@link SPAWN_TIMEOUT_MS}). */
15
+ const MANAGER_BEARER_MARGIN_MS = 120_000;
13
16
  /** Grace for a mesh op issued while the link is still coming up. `start()` deliberately returns
14
17
  * immediately so the connector's MCP surface boots while the broker is absent — which means a
15
18
  * host that auto-submits a prompt (`cotal spawn --prompt`) can call a mesh tool a second or two
@@ -178,6 +181,29 @@ function renderEscalation(p) {
178
181
  return `\nThis turn is a checkpoint escalated to you at step ${String(p.step)}: ${String(c.prompt)}${by}${wanted}`
179
182
  + `\nAnswer with: cotal run answer ${String(p.run)} ${String(p.step)} --value '<json>'`;
180
183
  }
184
+ /** A bearer JWT's `exp` in milliseconds, or undefined when it names none. */
185
+ function bearerExpiryMs(token) {
186
+ try {
187
+ const exp = JSON.parse(Buffer.from(token.split(".")[1] ?? "", "base64url").toString("utf8")).exp;
188
+ return typeof exp === "number" && Number.isFinite(exp) ? exp * 1000 : undefined;
189
+ }
190
+ catch {
191
+ return undefined;
192
+ }
193
+ }
194
+ /** `p`, or the signal's reason as soon as it aborts. A shared exchange keeps running for the
195
+ * other callers when one of them gives up. */
196
+ function abortable(p, signal) {
197
+ if (!signal)
198
+ return p;
199
+ if (signal.aborted)
200
+ return Promise.reject(signal.reason);
201
+ return new Promise((resolve, reject) => {
202
+ const onAbort = () => reject(signal.reason);
203
+ signal.addEventListener("abort", onAbort, { once: true });
204
+ p.then((v) => { signal.removeEventListener("abort", onAbort); resolve(v); }, (e) => { signal.removeEventListener("abort", onAbort); reject(e); });
205
+ });
206
+ }
181
207
  /**
182
208
  * A thin, mesh-native agent: a {@link CotalEndpoint} plus a buffered inbox and
183
209
  * name-based peer resolution. This is the shared core behind the MCP server
@@ -267,8 +293,8 @@ export class MeshAgent extends EventEmitter {
267
293
  /** The turn relay's seat-side intake: every pulled-and-unyielded run turn, by goal id. Fed by
268
294
  * {@link pollTurns}; surfaced into host context by {@link surfacePendingTurns}; drained by
269
295
  * {@link yieldTurn} (explicit) and the working→idle boundary in {@link setStatus} (automatic
270
- * `done`). The poll is also the reconciler: a turn settled elsewhere (deadline, another yield
271
- * path) vanishes from `turn-pending` and is dropped here on the next pull. */
296
+ * `done`). The pull is also the reconciler: a turn settled elsewhere (deadline, another yield
297
+ * path) vanishes from `turn-pending`, and the manager's notice for it brings the pull that drops it. */
272
298
  activeTurns = new Map();
273
299
  /** Deadlines of turns the run settled before this seat yielded them, by goal id, so a late yield
274
300
  * is refused with {@link settledTurnError}. Bounded by {@link MAX_SETTLED_TURNS}. */
@@ -277,10 +303,19 @@ export class MeshAgent extends EventEmitter {
277
303
  * snapshotted a goal before its answer; taking it back would surface the settled turn again, and
278
304
  * the next pull would record it as the run's settlement. */
279
305
  yieldedSincePull = new Set();
280
- turnPollTimer;
306
+ /** Set once the launching manager's turn notices are subscribed; the endpoint re-binds the
307
+ * subscription on every rebuilt connection. */
308
+ turnNoticeArmed = false;
309
+ /** The single retry after a pull that failed for a reason that can pass. Unset while pulls succeed. */
310
+ turnRetryTimer;
311
+ /** The timed pull for a launching manager whose answers say it sends no turn notices: a manager
312
+ * from before them. Unset while the manager says it sends them. */
313
+ legacyTurnPoll;
281
314
  /** The last pull failure this seat reported, so one that keeps failing is said once. */
282
315
  pullTrouble;
283
316
  turnPollBusy = false;
317
+ /** A notice or reconnect arrived while a pull was in flight, so one more pull follows it. */
318
+ turnPullAgain = false;
284
319
  _contextId;
285
320
  /** The per-call correlation a {@link withCorrelation} scope binds for the sends inside it. */
286
321
  correlation = new AsyncLocalStorage();
@@ -403,6 +438,10 @@ export class MeshAgent extends EventEmitter {
403
438
  if (!e.connected)
404
439
  this.transportDrops++;
405
440
  this.emit("transport", e);
441
+ // A notice lost while the transport was down can only matter to a turn this seat holds: the
442
+ // manager repeats the notice for a turn the seat has not pulled yet. So only a holder pulls.
443
+ if (e.connected && this.turnNoticeArmed && this.activeTurns.size > 0)
444
+ this.requestTurnPull();
406
445
  });
407
446
  // The endpoint's (re)binds are the single source of truth for connectedness: this fires on
408
447
  // initial start, manual reconnect, AND the background self-heal — so a recovery the endpoint
@@ -418,6 +457,9 @@ export class MeshAgent extends EventEmitter {
418
457
  this.endpointNoticeLog.clear();
419
458
  }
420
459
  this.emit("connection", e);
460
+ // A rebuilt connection re-bound the notice subscription first; a holder pulls for the gap.
461
+ if (e.connected && this.turnNoticeArmed && this.activeTurns.size > 0)
462
+ this.requestTurnPull();
421
463
  });
422
464
  }
423
465
  get id() {
@@ -681,7 +723,7 @@ export class MeshAgent extends EventEmitter {
681
723
  const historicalBuffered = this.peekInbox("pull-only").filter((i) => i.historical).length;
682
724
  this.log(`joined ${this.config.subscribe.length} boot channel(s): ${historicalBuffered} historical message(s) buffered pull-only` +
683
725
  (this.config.backfillFloor !== undefined ? ` (backfill floor ${this.config.backfillFloor})` : ""));
684
- this.ensureTurnPoll();
726
+ this.armTurnRelay();
685
727
  }
686
728
  catch (e) {
687
729
  const error = e instanceof Error ? e : new Error(String(e));
@@ -724,9 +766,14 @@ export class MeshAgent extends EventEmitter {
724
766
  this.emit("stopping");
725
767
  for (const key of [...this.renewals.keys()])
726
768
  this.stopRenewal(key);
727
- if (this.turnPollTimer !== undefined) {
728
- clearInterval(this.turnPollTimer);
729
- this.turnPollTimer = undefined;
769
+ this.managerBearers.clear();
770
+ if (this.turnRetryTimer !== undefined) {
771
+ clearTimeout(this.turnRetryTimer);
772
+ this.turnRetryTimer = undefined;
773
+ }
774
+ if (this.legacyTurnPoll !== undefined) {
775
+ clearInterval(this.legacyTurnPoll);
776
+ this.legacyTurnPoll = undefined;
730
777
  }
731
778
  // stop() is a local terminal fact. Do not wait for an endpoint event that intentionally ignores
732
779
  // its own stopped close, or leave a cleanly stopped session reporting either state as live.
@@ -2001,6 +2048,31 @@ export class MeshAgent extends EventEmitter {
2001
2048
  return { ok: false, error: `inspect returned a non-string model for "${name}"` };
2002
2049
  return { ok: true, model };
2003
2050
  }
2051
+ /** Manager-call bearers this session holds, by the exact bearer argv (so by selected manager;
2052
+ * the space, owner, actor and lifecycle are this session's own). One exchange serves every call
2053
+ * until {@link MANAGER_BEARER_MARGIN_MS} before the bearer expires, and concurrent calls share it.
2054
+ * Each call still presents the bearer to the broker and checks its binding, so this keeps no
2055
+ * authorization decision; any failed call drops the entry, so the next one exchanges afresh. */
2056
+ managerBearers = new Map();
2057
+ managerCallBearer(argv, signal) {
2058
+ const key = JSON.stringify(argv);
2059
+ const held = this.managerBearers.get(key);
2060
+ if (held && (held.refreshAt === undefined || Date.now() < held.refreshAt))
2061
+ return abortable(held.flight, signal);
2062
+ const entry = { flight: this.execBearerCmd(argv) };
2063
+ this.managerBearers.set(key, entry);
2064
+ entry.flight.then((token) => {
2065
+ const exp = bearerExpiryMs(token);
2066
+ if (exp === undefined || exp - MANAGER_BEARER_MARGIN_MS <= Date.now()) {
2067
+ if (this.managerBearers.get(key) === entry)
2068
+ this.managerBearers.delete(key);
2069
+ }
2070
+ else
2071
+ entry.refreshAt = exp - MANAGER_BEARER_MARGIN_MS;
2072
+ }, () => { if (this.managerBearers.get(key) === entry)
2073
+ this.managerBearers.delete(key); });
2074
+ return abortable(entry.flight, signal);
2075
+ }
2004
2076
  /** Run the spawner's bearer command with this session's environment on every credential path. */
2005
2077
  async execBearerCmd(argv, signal, timeoutMs) {
2006
2078
  const bearer = await runAgentBearer(argv, { env: this.launchEnv, signal, timeoutMs });
@@ -2018,6 +2090,7 @@ export class MeshAgent extends EventEmitter {
2018
2090
  async managerInvoke(command, args, opts = {}) {
2019
2091
  const clean = args === undefined ? undefined : Object.fromEntries(Object.entries(args).filter(([, v]) => v !== undefined));
2020
2092
  let r;
2093
+ let dropBearer;
2021
2094
  try {
2022
2095
  const input = clean && Object.keys(clean).length ? clean : undefined;
2023
2096
  if (this.config.userAuth) {
@@ -2028,13 +2101,11 @@ export class MeshAgent extends EventEmitter {
2028
2101
  const { instanceId: _instanceId, follow, ...invokeOpts } = opts;
2029
2102
  // An ambiguity refusal names the bearer command's own selector. This caller passes it from
2030
2103
  // the tool's `instance` argument, so the tool's caller is told that argument instead.
2031
- const bearer = (signal) => this.execBearerCmd([
2032
- ...bearerCmd,
2033
- "--manager-call",
2034
- ...(managerInstanceId ? ["--manager-instance", managerInstanceId] : []),
2035
- ], signal).catch((e) => {
2104
+ const bearerArgv = [...bearerCmd, "--manager-call", ...(managerInstanceId ? ["--manager-instance", managerInstanceId] : [])];
2105
+ const bearer = (signal) => this.managerCallBearer(bearerArgv, signal).catch((e) => {
2036
2106
  throw e instanceof Error ? new Error(e.message.replace("--manager-instance <instanceId>", "the instance argument")) : e;
2037
2107
  });
2108
+ dropBearer = () => { this.managerBearers.delete(JSON.stringify(bearerArgv)); };
2038
2109
  // Subscribe before submission on the renewing main connection. A long accepted launch
2039
2110
  // must not inherit the short-lived control credential's expiry.
2040
2111
  r = await invokeUserManager({ ...this.config, managerInstanceId }, bearer, command, input, {
@@ -2079,12 +2150,15 @@ export class MeshAgent extends EventEmitter {
2079
2150
  // half: this surface is read by agents, and "no responder answered" invites the retry that
2080
2151
  // duplicates a spawn. Only the marker distinguishes them, and core sets it exactly where it
2081
2152
  // observed silence.
2153
+ dropBearer?.();
2082
2154
  if (e instanceof EpEnvelopeError)
2083
2155
  return controlReplyFromThrown(e, unansweredRequest(e)
2084
2156
  ? `${e.message} (no responder answered - a manager may be down, or this credential holds no "${command}" capability and the broker denied the request)`
2085
2157
  : `${e.code}: ${e.message}`);
2086
2158
  return { ok: false, error: e.message };
2087
2159
  }
2160
+ if (r.reply.ok !== true)
2161
+ dropBearer?.();
2088
2162
  return controlReplyFrom(r.reply);
2089
2163
  }
2090
2164
  /** Resolve a managed agent's CURRENT principal triple (owner-mode targets are (owner, actor,
@@ -2175,42 +2249,71 @@ export class MeshAgent extends EventEmitter {
2175
2249
  /** Whether a manager launched this seat. A manager accepts a run turn only against a seat it
2176
2250
  * launched (`serveTurnGoal`), and every manager launch path (local spawn, restart, resume, and
2177
2251
  * `delegatedSeatCommand` → `cotal spawn` handoff) sets `COTAL_MANAGER_INSTANCE`
2178
- * (`config.managerInstanceId`), so a directly connected session has no turn relay to poll. */
2252
+ * (`config.managerInstanceId`), so a directly connected session has no turn relay to arm. */
2179
2253
  hasTurnRelay() {
2180
2254
  return this.config.managerInstanceId !== undefined;
2181
2255
  }
2182
- ensureTurnPoll() {
2183
- if (this.config.turnRelay === false || !this.hasTurnRelay() || this.turnPollTimer !== undefined)
2256
+ /** Subscribe to the launching manager's turn notices (SPEC 14.3) and pull once. The manager
2257
+ * publishes a notice whenever this seat's `turn-pending` answer changes, and repeats it until
2258
+ * the seat pulls a new turn, so an idle seat sends nothing, across reconnects too. The pull on a
2259
+ * notice, here at the first bind, and on a reconnect while the seat holds a turn is the only
2260
+ * intake; the subscription exists before the first pull, so a turn accepted in between is not missed. */
2261
+ armTurnRelay() {
2262
+ if (this.config.turnRelay === false || !this.hasTurnRelay())
2184
2263
  return;
2185
- const t = setInterval(() => {
2186
- void this.pollTurns().catch((e) => this.notePullTrouble(e.message));
2187
- }, TURN_POLL_MS);
2188
- t.unref?.();
2189
- this.turnPollTimer = t;
2264
+ if (!this.turnNoticeArmed) {
2265
+ let caller;
2266
+ try {
2267
+ caller = this.ep.serviceRailCaller();
2268
+ }
2269
+ catch (e) {
2270
+ this.log(`the run-turn relay cannot name this seat's reply rail (${e.message}); no turn will reach this seat`);
2271
+ return;
2272
+ }
2273
+ this.ep.tap(() => this.requestTurnPull(), { subject: turnNoticeFilter(this.config.space, this.config.managerInstanceId, caller) });
2274
+ this.turnNoticeArmed = true;
2275
+ }
2276
+ this.requestTurnPull();
2277
+ }
2278
+ /** Pull now, or once more after the pull in flight, so notices that arrive together cost one pull. */
2279
+ requestTurnPull() {
2280
+ if (this.config.turnRelay === false || this._stopping)
2281
+ return;
2282
+ if (this.turnPollBusy) {
2283
+ this.turnPullAgain = true;
2284
+ return;
2285
+ }
2286
+ void this.pollTurns().catch((e) => this.turnPullFailed(e.message, undefined));
2190
2287
  }
2191
2288
  /** Pull this seat's pending run turns from its launching manager (`turn-pending`, self-mode).
2192
2289
  * New turns request a wake so the payload surfaces on the next injectable frame; turns gone from
2193
2290
  * the reply were settled elsewhere (deadline, agent-down, a competing yield path) and are
2194
- * dropped. Only a manager-launched seat (`hasTurnRelay`) arms this poll; any failure to reach
2195
- * the launching manager is passed to {@link notePullTrouble}. */
2291
+ * dropped. Only a manager-launched seat (`hasTurnRelay`) pulls; any failure to reach the
2292
+ * launching manager is passed to {@link turnPullFailed}. */
2196
2293
  async pollTurns() {
2197
2294
  if (this.config.turnRelay === false || !this._connected || this._stopping || this.turnPollBusy)
2198
2295
  return;
2199
2296
  this.turnPollBusy = true;
2297
+ this.turnPullAgain = false;
2200
2298
  this.yieldedSincePull.clear();
2201
2299
  try {
2202
2300
  const r = await this.managerInvoke("turn-pending", undefined, { target: { mode: "self" } });
2203
2301
  if (!r.ok) {
2204
- this.notePullTrouble(r.error ?? "refused with no message");
2302
+ this.turnPullFailed(r.error ?? "refused with no message", r.code);
2205
2303
  return;
2206
2304
  }
2207
2305
  const rows = r.data?.turns;
2208
2306
  // A reply with no turns array is no snapshot: reconciling on it would drop every accepted
2209
2307
  // turn, including one already shown. Keep what the seat holds until a well-formed pull.
2210
2308
  if (!Array.isArray(rows)) {
2211
- this.notePullTrouble("turn-pending returned no turns array");
2309
+ this.turnPullFailed("turn-pending returned no turns array", "bad-reply");
2212
2310
  return;
2213
2311
  }
2312
+ if (this.turnRetryTimer !== undefined) {
2313
+ clearTimeout(this.turnRetryTimer);
2314
+ this.turnRetryTimer = undefined;
2315
+ }
2316
+ this.noteTurnNotices(r.data.notices === true);
2214
2317
  // A responder off the contract must not reach the formatter: one row with no numeric
2215
2318
  // deadline made peekPendingTurns throw on every frame.
2216
2319
  const turns = rows.filter(isPendingTurn);
@@ -2234,16 +2337,48 @@ export class MeshAgent extends EventEmitter {
2234
2337
  }
2235
2338
  finally {
2236
2339
  this.turnPollBusy = false;
2340
+ if (this.turnPullAgain)
2341
+ this.requestTurnPull();
2342
+ }
2343
+ }
2344
+ /** Follow what the launching manager says about turn notices. A manager from before them never
2345
+ * sends one, so this seat pulls on a timer while its answers say so, and says that once. */
2346
+ noteTurnNotices(sent) {
2347
+ if (sent) {
2348
+ if (this.legacyTurnPoll !== undefined) {
2349
+ clearInterval(this.legacyTurnPoll);
2350
+ this.legacyTurnPoll = undefined;
2351
+ }
2352
+ return;
2237
2353
  }
2354
+ if (this.legacyTurnPoll !== undefined || this._stopping)
2355
+ return;
2356
+ this.log(`manager ${this.config.managerInstanceId} sends no turn notices (it predates them), so this seat pulls its turns every ${TURN_PULL_RETRY_MS}ms`);
2357
+ const t = setInterval(() => this.requestTurnPull(), TURN_PULL_RETRY_MS);
2358
+ t.unref?.();
2359
+ this.legacyTurnPoll = t;
2360
+ }
2361
+ /** A pull failed. A manager that is down, still reconciling or unanswered can recover, so ONE
2362
+ * retry is armed for {@link TURN_PULL_RETRY_MS} later and re-armed while that keeps failing. A
2363
+ * refusal (a denied capability, a request the manager rejects) is reported and not retried:
2364
+ * asking again on a timer would be the idle poll this relay removed, against a door that is shut.
2365
+ * The next notice or reconnect pulls again either way. */
2366
+ turnPullFailed(reason, code) {
2367
+ this.notePullTrouble(reason);
2368
+ const transient = code === undefined || code === "unavailable" || code === "deadline-exceeded";
2369
+ if (!transient || this._stopping || this.turnRetryTimer !== undefined)
2370
+ return;
2371
+ const t = setTimeout(() => { this.turnRetryTimer = undefined; this.requestTurnPull(); }, TURN_PULL_RETRY_MS);
2372
+ t.unref?.();
2373
+ this.turnRetryTimer = t;
2238
2374
  }
2239
2375
  /**
2240
2376
  * A pull that did not come back, said ONCE.
2241
2377
  *
2242
- * Only a manager-launched seat polls (`hasTurnRelay`), so an unanswered pull means its own
2243
- * launching manager did not answer. The poll runs every few seconds for the life of the session,
2244
- * so a line per failure would be a torrent; instead each distinct reason is reported once and
2245
- * saying it again waits for the reason to change or for a pull to succeed. Only the manager's
2246
- * startup reconciliation window (`still reconciling`) stays silent because it resolves itself.
2378
+ * Only a manager-launched seat pulls (`hasTurnRelay`), so an unanswered pull means its own
2379
+ * launching manager did not answer. Each distinct reason is reported once and saying it again
2380
+ * waits for the reason to change or for a pull to succeed. Only the manager's startup
2381
+ * reconciliation window (`still reconciling`) stays silent because it resolves itself.
2247
2382
  */
2248
2383
  notePullTrouble(reason) {
2249
2384
  // The boot window is a manager telling the seat to come back once startup reconciliation finishes.
@@ -2252,7 +2387,7 @@ export class MeshAgent extends EventEmitter {
2252
2387
  if (this.pullTrouble === reason)
2253
2388
  return;
2254
2389
  this.pullTrouble = reason;
2255
- this.log(`the run-turn pull is not answering (${reason}); retrying every ${TURN_POLL_MS}ms`);
2390
+ this.log(`the run-turn pull is not answering (${reason}); the seat pulls again on its next turn notice or reconnect`);
2256
2391
  }
2257
2392
  /** Format every not-yet-surfaced turn still inside its deadline as an injectable context block,
2258
2393
  * WITHOUT marking anything (undefined when none wait). Two-phase on purpose, like the inbox's
@@ -2576,10 +2711,9 @@ export class MeshAgent extends EventEmitter {
2576
2711
  this.ep.noteActivity(at);
2577
2712
  }
2578
2713
  /** The working→idle boundary: yield `done` for every SURFACED turn (its payload was in the
2579
- * context of the turn that just ended; ending without an explicit yield IS the done signal),
2580
- * then re-poll immediately on a manager-launched seat (`hasTurnRelay`) so a queued turn wakes
2581
- * the seat without waiting out the cadence. Fire-and-forget from the presence path — a yield
2582
- * must never block a status write. */
2714
+ * context of the turn that just ended; ending without an explicit yield IS the done signal).
2715
+ * The manager's notice for each settled yield brings the next queued turn. Fire-and-forget
2716
+ * from the presence path — a yield must never block a status write. */
2583
2717
  onTurnBoundary() {
2584
2718
  for (const t of [...this.activeTurns.values()]) {
2585
2719
  if (!t.surfaced)
@@ -2589,8 +2723,6 @@ export class MeshAgent extends EventEmitter {
2589
2723
  this.log(`turn ${t.goalId} auto-yield: ${r.error ?? "refused"}`); })
2590
2724
  .catch((e) => this.log(`turn ${t.goalId} auto-yield: ${e.message}`));
2591
2725
  }
2592
- if (this.hasTurnRelay())
2593
- void this.pollTurns().catch(() => { });
2594
2726
  }
2595
2727
  /** Record the host's actual model and optional variant learned after launch, so peers see the
2596
2728
  * selection in `cotal_roster` and the web roster even when the operator never pinned one. Explicit