@cotal-ai/connector-core 0.53.0 → 0.55.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.
- package/dist/agent.d.ts +37 -4
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +245 -84
- package/dist/agent.js.map +1 -1
- package/dist/agui-holder.d.ts +2 -1
- package/dist/agui-holder.d.ts.map +1 -1
- package/dist/agui-holder.js +3 -2
- package/dist/agui-holder.js.map +1 -1
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +5 -1
- package/dist/config.js.map +1 -1
- package/dist/docs-bundle.generated.js +27 -27
- package/dist/docs-bundle.generated.js.map +1 -1
- package/dist/durable-source.d.ts +31 -0
- package/dist/durable-source.d.ts.map +1 -1
- package/dist/durable-source.js +43 -5
- package/dist/durable-source.js.map +1 -1
- package/dist/manager-call.d.ts +17 -0
- package/dist/manager-call.d.ts.map +1 -0
- package/dist/manager-call.js +103 -0
- package/dist/manager-call.js.map +1 -0
- package/dist/orientation.d.ts +5 -0
- package/dist/orientation.d.ts.map +1 -1
- package/dist/orientation.js +18 -1
- package/dist/orientation.js.map +1 -1
- package/dist/tool-specs.d.ts.map +1 -1
- package/dist/tool-specs.js +43 -7
- package/dist/tool-specs.js.map +1 -1
- package/package.json +2 -2
package/dist/agent.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from "node:events";
|
|
2
|
-
import { CotalEndpoint, type ControlReply, type Presence, type PresenceCondition, type PresenceStatus, type AttentionMode, type ChannelMode, type CotalMessage } from "@cotal-ai/core";
|
|
2
|
+
import { CotalEndpoint, type ControlReply, type Presence, type PresenceCondition, type PresenceStatus, type PresenceView, type AttentionMode, type ChannelMode, type CotalMessage } from "@cotal-ai/core";
|
|
3
3
|
import type { AgentConfig } from "./config.js";
|
|
4
4
|
export type { AttentionMode, ChannelMode };
|
|
5
5
|
/** Client-side floor for a spawn action's submit + follow. The manager acceptance carries the exact
|
|
@@ -191,6 +191,14 @@ export declare class MeshAgent extends EventEmitter {
|
|
|
191
191
|
private focusExcludedIds;
|
|
192
192
|
private focusRecallUnsafeChannels;
|
|
193
193
|
private _stopping;
|
|
194
|
+
/** Presence writes go out IN CALL ORDER (#636, #2055). setStatus is two awaited puts and every
|
|
195
|
+
* connector fires it without awaiting, so two overlapping calls interleave their puts and the
|
|
196
|
+
* record that lands last is whichever call's second put finished last, not the call made last;
|
|
197
|
+
* at a driven turn's end the measured order was working, idle, working, and the seat then read
|
|
198
|
+
* working forever. Every write below runs its whole body through this chain, so the later
|
|
199
|
+
* call's puts start only after the earlier call's have settled. A rejected write must not
|
|
200
|
+
* poison the chain: the tail is swallowed and the next write still runs. */
|
|
201
|
+
private presenceChain;
|
|
194
202
|
constructor(config: AgentConfig);
|
|
195
203
|
get id(): string;
|
|
196
204
|
get connected(): boolean;
|
|
@@ -212,6 +220,8 @@ export declare class MeshAgent extends EventEmitter {
|
|
|
212
220
|
forMs: number;
|
|
213
221
|
error?: string;
|
|
214
222
|
bucket: string;
|
|
223
|
+
consecutiveFailures: number;
|
|
224
|
+
stuck: boolean;
|
|
215
225
|
} | undefined;
|
|
216
226
|
/** The latest successful, non-empty inbox drain in this session. */
|
|
217
227
|
get lastInboxDrainedAt(): number | undefined;
|
|
@@ -494,7 +504,14 @@ export declare class MeshAgent extends EventEmitter {
|
|
|
494
504
|
* wrongly reject it), case-insensitively. Send is all-or-nothing: one unknown @name aborts
|
|
495
505
|
* the whole broadcast (fail-loud on typos). Caveat: only catches peers THIS client has seen
|
|
496
506
|
* — an offline peer lingers in the roster, but one never observed (or not yet filled in
|
|
497
|
-
* after connect) throws. See docs/architecture.md.
|
|
507
|
+
* after connect) throws. See docs/architecture.md.
|
|
508
|
+
*
|
|
509
|
+
* #1229: the roster can only support an ABSENCE verdict while `presenceView()` is `current`.
|
|
510
|
+
* `clearConnectionScoped()` empties it on every reconnect and the watch refills entry by
|
|
511
|
+
* entry, so a refusal under an unsafe view would reject a mention of a live peer. A name
|
|
512
|
+
* already in the roster is accepted in every state; an absent name under `unpopulated`
|
|
513
|
+
* waits once for the initial snapshot and re-reads; a still-unverifiable name refuses with
|
|
514
|
+
* the observer's own condition (never "no such peer") and the send does not go out. */
|
|
498
515
|
private assertKnownMentions;
|
|
499
516
|
anycast(role: string, text: string): Promise<CotalMessage>;
|
|
500
517
|
/** Resolve a peer by instance id (exact) or display name. Deterministic and fail-loud: returns
|
|
@@ -525,10 +542,11 @@ export declare class MeshAgent extends EventEmitter {
|
|
|
525
542
|
cwd?: string;
|
|
526
543
|
prompt?: string;
|
|
527
544
|
events?: boolean;
|
|
545
|
+
instance?: string;
|
|
528
546
|
}): Promise<ControlReply>;
|
|
529
547
|
/** The manager's recorded model pin for a managed seat (`inspect.model`). Absence is a real
|
|
530
548
|
* state: a launch may pin none. Distinct from a failed inspect, which cannot attest. */
|
|
531
|
-
inspectModel(name: string): Promise<{
|
|
549
|
+
inspectModel(name: string, instance?: string): Promise<{
|
|
532
550
|
ok: true;
|
|
533
551
|
model?: string;
|
|
534
552
|
} | {
|
|
@@ -654,8 +672,23 @@ export declare class MeshAgent extends EventEmitter {
|
|
|
654
672
|
showPersona(name: string): Promise<ControlReply>;
|
|
655
673
|
/** The full roster, including ourselves. */
|
|
656
674
|
roster(): Presence[];
|
|
675
|
+
/** Trust state of this observer's presence watch (`CotalEndpoint.presenceView()`): the roster
|
|
676
|
+
* above can only support an absence verdict while this is `current` (#1229). */
|
|
677
|
+
presenceView(): PresenceView;
|
|
657
678
|
/** Our last self-reported presence status. */
|
|
658
679
|
get status(): PresenceStatus;
|
|
680
|
+
/** Run one presence write through the chain (#636): the write starts only after every earlier
|
|
681
|
+
* admitted write has settled, and a rejection is swallowed at the TAIL only, so it propagates
|
|
682
|
+
* to this write's own caller while the next admitted write still runs.
|
|
683
|
+
*
|
|
684
|
+
* The straggler rule: departure is the last write, later writes are refused, not reordered.
|
|
685
|
+
* Once `stop()` has begun, any write admitted here rejects AT ONCE (no put queued, no wait on
|
|
686
|
+
* the chain) with a fixed error, instead of running after — or, for a write that calls
|
|
687
|
+
* `requireConnected` (e.g. `setStatus`), sitting out the ten-second connect grace before
|
|
688
|
+
* rejecting anyway. `stop()` itself submits departure's own put through this same method (the
|
|
689
|
+
* `forDeparture` escape) so departure keeps landing after every write already admitted, even
|
|
690
|
+
* though `_stopping` is already true by the time it does. */
|
|
691
|
+
private inOrder;
|
|
659
692
|
setStatus(status: PresenceStatus, activity?: string): Promise<void>;
|
|
660
693
|
/**
|
|
661
694
|
* Publish presence for something that is NOT a turn ending.
|
|
@@ -706,7 +739,7 @@ export declare class MeshAgent extends EventEmitter {
|
|
|
706
739
|
replay: boolean;
|
|
707
740
|
joined: boolean;
|
|
708
741
|
durableUnclosed: boolean;
|
|
709
|
-
deliveryHealth?: "active" | "degraded";
|
|
742
|
+
deliveryHealth?: "active" | "degraded" | "unknown";
|
|
710
743
|
messages: number;
|
|
711
744
|
mode: ChannelMode | "normal";
|
|
712
745
|
}[]>;
|
package/dist/agent.d.ts.map
CHANGED
|
@@ -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,EAQL,aAAa,EAQb,KAAK,YAAY,EAIjB,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAEnB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI/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;;8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ezB,OAAO,CAAC,GAAG;CAGZ;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,7 +1,8 @@
|
|
|
1
1
|
import { execFile } from "node:child_process";
|
|
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, resolvePeer as resolvePeerInRoster, CotalEndpoint, BASELINE_LIFECYCLE_ENDPOINT, EpEnvelopeError, isPublishPermissionDenied, unansweredRequest, renderLifecycleBlocked, partsToText, } from "@cotal-ai/core";
|
|
4
|
+
import { normalizeMentions, RUN_LAUNCH_DEADLINE_MS, subjectMatches, isConcreteChannel, assertValidChannel, channelInAllow, resolvePeer as resolvePeerInRoster, CotalEndpoint, BASELINE_LIFECYCLE_ENDPOINT, assertLifecycleToken, EpEnvelopeError, isPublishPermissionDenied, unansweredRequest, renderLifecycleBlocked, partsToText, } from "@cotal-ai/core";
|
|
5
|
+
import { invokeUserManager } from "./manager-call.js";
|
|
5
6
|
/** Client-side floor for a spawn action's submit + follow. The manager acceptance carries the exact
|
|
6
7
|
* connector-selected readiness budget, and core extends the follow through that budget plus
|
|
7
8
|
* delivery margin. This floor still outlives the manager's generic 30s default and protects
|
|
@@ -44,9 +45,9 @@ function buildMeta(config) {
|
|
|
44
45
|
/** Exec the spawner-provided bearer argv and return the one line it prints. The command owns
|
|
45
46
|
* discovery, the exchange protocol, and the secret file — a failure here is ITS operator-exact
|
|
46
47
|
* stderr sentence, surfaced verbatim (the endpoint emits it as a loud "error" and retries). */
|
|
47
|
-
function execBearerCmd(argv) {
|
|
48
|
+
function execBearerCmd(argv, signal, timeout = 30_000) {
|
|
48
49
|
return new Promise((resolve, reject) => {
|
|
49
|
-
execFile(argv[0], argv.slice(1), { timeout
|
|
50
|
+
execFile(argv[0], argv.slice(1), { timeout, signal, maxBuffer: 64 * 1024 }, (err, stdout, stderr) => {
|
|
50
51
|
if (err)
|
|
51
52
|
return reject(new Error(stderr.trim() || err.message));
|
|
52
53
|
const bearer = stdout.trim();
|
|
@@ -239,6 +240,14 @@ export class MeshAgent extends EventEmitter {
|
|
|
239
240
|
focusExcludedIds = new Map();
|
|
240
241
|
focusRecallUnsafeChannels = new Set();
|
|
241
242
|
_stopping = false;
|
|
243
|
+
/** Presence writes go out IN CALL ORDER (#636, #2055). setStatus is two awaited puts and every
|
|
244
|
+
* connector fires it without awaiting, so two overlapping calls interleave their puts and the
|
|
245
|
+
* record that lands last is whichever call's second put finished last, not the call made last;
|
|
246
|
+
* at a driven turn's end the measured order was working, idle, working, and the seat then read
|
|
247
|
+
* working forever. Every write below runs its whole body through this chain, so the later
|
|
248
|
+
* call's puts start only after the earlier call's have settled. A rejected write must not
|
|
249
|
+
* poison the chain: the tail is swallowed and the next write still runs. */
|
|
250
|
+
presenceChain = Promise.resolve();
|
|
242
251
|
constructor(config) {
|
|
243
252
|
super();
|
|
244
253
|
this.config = config;
|
|
@@ -534,6 +543,14 @@ export class MeshAgent extends EventEmitter {
|
|
|
534
543
|
// Unconditional: a background self-heal can flip _connected without us, so a `_connected`
|
|
535
544
|
// guard could skip the stop and leak the live connection/heartbeat/supervisor. ep.stop() is
|
|
536
545
|
// idempotent (early-returns once stopped), so calling it when already-down is a noop.
|
|
546
|
+
// #636: departure is the last write. Running it THROUGH the chain (as its own inOrder entry,
|
|
547
|
+
// not merely awaited alongside it) orders offline behind every write already admitted,
|
|
548
|
+
// whichever method admitted it — setStatus's requireConnected included. The race is bounded so
|
|
549
|
+
// a wedged write cannot hang shutdown; on the timeout path the chain is abandoned but the
|
|
550
|
+
// endpoint must still stop, so ep.stop() runs directly once there. Every write admitted AFTER
|
|
551
|
+
// this point is refused at once by inOrder() (see there) rather than queued behind departure,
|
|
552
|
+
// so a straggler cannot land after offline and does not sit out setStatus's connect grace.
|
|
553
|
+
await Promise.race([this.inOrder(() => this.ep.stop(), true), sleep(3_000)]);
|
|
537
554
|
await this.ep.stop();
|
|
538
555
|
}
|
|
539
556
|
/** Manual reconnect: tear down the mesh connection and rebuild it in-process, WITHOUT
|
|
@@ -1144,11 +1161,13 @@ export class MeshAgent extends EventEmitter {
|
|
|
1144
1161
|
throw new Error(`"${channel}" must be a concrete channel (no wildcard) to set its attention`);
|
|
1145
1162
|
if (!channelInAllow(this.config.allowSubscribe, channel))
|
|
1146
1163
|
throw new Error(`"${channel}" is not within your read ACL (allowSubscribe) [${this.config.allowSubscribe.join(", ")}]`);
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1164
|
+
await this.inOrder(() => {
|
|
1165
|
+
if (mode === "normal")
|
|
1166
|
+
this.channelModes.delete(channel);
|
|
1167
|
+
else
|
|
1168
|
+
this.channelModes.set(channel, mode);
|
|
1169
|
+
return this.ep.setChannelModes(this.channelModeEntries());
|
|
1170
|
+
});
|
|
1152
1171
|
}
|
|
1153
1172
|
/** Set the attention mode. Entering `focus` captures the chat frontier as the focus-watermark
|
|
1154
1173
|
* (recall surfaces ambient published after it); leaving focus clears it. Requires a live
|
|
@@ -1158,34 +1177,36 @@ export class MeshAgent extends EventEmitter {
|
|
|
1158
1177
|
* it landed just before or after the captured frontier. Only ambient arriving after the local
|
|
1159
1178
|
* switch is ack-dropped. */
|
|
1160
1179
|
async setAttention(mode) {
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1180
|
+
await this.inOrder(async () => {
|
|
1181
|
+
if (mode === "focus") {
|
|
1182
|
+
await this.requireConnected();
|
|
1183
|
+
this.focusExcludedIds.clear();
|
|
1184
|
+
this.focusRecallUnsafeChannels.clear();
|
|
1185
|
+
this.enteringFocus = this._attention !== "focus";
|
|
1186
|
+
try {
|
|
1187
|
+
this.focusSince = await this.ep.chatFrontier();
|
|
1188
|
+
}
|
|
1189
|
+
catch (error) {
|
|
1190
|
+
this.enteringFocus = false;
|
|
1191
|
+
this.focusExcludedIds.clear();
|
|
1192
|
+
this.focusRecallUnsafeChannels.clear();
|
|
1193
|
+
throw error;
|
|
1194
|
+
}
|
|
1195
|
+
this.enteringFocus = false;
|
|
1196
|
+
this.resetRecallWalk();
|
|
1168
1197
|
}
|
|
1169
|
-
|
|
1198
|
+
else {
|
|
1170
1199
|
this.enteringFocus = false;
|
|
1200
|
+
this.focusSince = undefined;
|
|
1171
1201
|
this.focusExcludedIds.clear();
|
|
1172
1202
|
this.focusRecallUnsafeChannels.clear();
|
|
1173
|
-
|
|
1203
|
+
this.resetRecallWalk();
|
|
1174
1204
|
}
|
|
1175
|
-
this.
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
this.focusSince = undefined;
|
|
1181
|
-
this.focusExcludedIds.clear();
|
|
1182
|
-
this.focusRecallUnsafeChannels.clear();
|
|
1183
|
-
this.resetRecallWalk();
|
|
1184
|
-
}
|
|
1185
|
-
this._attention = mode;
|
|
1186
|
-
// Mirror to presence (advisory observability — peers can see "they're in focus"). Best-effort:
|
|
1187
|
-
// a no-op until the KV is bound, and never read back into delivery.
|
|
1188
|
-
await this.ep.setAttention(mode);
|
|
1205
|
+
this._attention = mode;
|
|
1206
|
+
// Mirror to presence (advisory observability — peers can see "they're in focus"). Best-effort:
|
|
1207
|
+
// a no-op until the KV is bound, and never read back into delivery.
|
|
1208
|
+
await this.ep.setAttention(mode);
|
|
1209
|
+
});
|
|
1189
1210
|
}
|
|
1190
1211
|
/** Focus recall: the channel ambient + @mentions ack-dropped since this agent entered focus,
|
|
1191
1212
|
* read back from the chat stream on demand and **replay-gated per channel** (a `replay=off`
|
|
@@ -1227,7 +1248,7 @@ export class MeshAgent extends EventEmitter {
|
|
|
1227
1248
|
await this.requireConnected();
|
|
1228
1249
|
const clean = normalizeMentions(mentions);
|
|
1229
1250
|
if (clean)
|
|
1230
|
-
this.assertKnownMentions(clean);
|
|
1251
|
+
await this.assertKnownMentions(clean);
|
|
1231
1252
|
return this.ep.multicast(text, { channel, mentions: clean, contextId: this._contextId });
|
|
1232
1253
|
}
|
|
1233
1254
|
/**
|
|
@@ -1259,12 +1280,32 @@ export class MeshAgent extends EventEmitter {
|
|
|
1259
1280
|
* wrongly reject it), case-insensitively. Send is all-or-nothing: one unknown @name aborts
|
|
1260
1281
|
* the whole broadcast (fail-loud on typos). Caveat: only catches peers THIS client has seen
|
|
1261
1282
|
* — an offline peer lingers in the roster, but one never observed (or not yet filled in
|
|
1262
|
-
* after connect) throws. See docs/architecture.md.
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1283
|
+
* after connect) throws. See docs/architecture.md.
|
|
1284
|
+
*
|
|
1285
|
+
* #1229: the roster can only support an ABSENCE verdict while `presenceView()` is `current`.
|
|
1286
|
+
* `clearConnectionScoped()` empties it on every reconnect and the watch refills entry by
|
|
1287
|
+
* entry, so a refusal under an unsafe view would reject a mention of a live peer. A name
|
|
1288
|
+
* already in the roster is accepted in every state; an absent name under `unpopulated`
|
|
1289
|
+
* waits once for the initial snapshot and re-reads; a still-unverifiable name refuses with
|
|
1290
|
+
* the observer's own condition (never "no such peer") and the send does not go out. */
|
|
1291
|
+
async assertKnownMentions(mentions) {
|
|
1292
|
+
const names = () => new Set(this.ep.getRoster().map((p) => p.card.name.toLowerCase()));
|
|
1293
|
+
const view = this.ep.presenceView();
|
|
1294
|
+
if (view.state === "unpopulated") {
|
|
1295
|
+
const unknown = mentions.filter((m) => !names().has(m));
|
|
1296
|
+
if (unknown.length)
|
|
1297
|
+
await this.ep.waitForPresenceSnapshot();
|
|
1298
|
+
}
|
|
1299
|
+
const after = this.ep.presenceView();
|
|
1300
|
+
const unknown = mentions.filter((m) => !names().has(m));
|
|
1301
|
+
if (!unknown.length)
|
|
1302
|
+
return;
|
|
1303
|
+
if (after.state === "current")
|
|
1267
1304
|
throw new Error(`unknown mention${unknown.length > 1 ? "s" : ""}: ${unknown.map((u) => `@${u}`).join(", ")} — no such peer observed in space "${this.config.space}"`);
|
|
1305
|
+
const condition = after.state === "stale"
|
|
1306
|
+
? `the presence view is stale since ${new Date(after.staleSince).toISOString()} (${Math.max(0, Date.now() - after.staleSince)}ms silent)`
|
|
1307
|
+
: "the presence view is unpopulated — the watch has not completed its initial snapshot";
|
|
1308
|
+
throw new Error(`cannot verify mention${unknown.length > 1 ? "s" : ""} ${unknown.map((u) => `@${u}`).join(", ")} in space "${this.config.space}": ${condition}, so absence is not a verdict — the peer may be present but unobserved. The send was not published.`);
|
|
1268
1309
|
}
|
|
1269
1310
|
async anycast(role, text) {
|
|
1270
1311
|
await this.requireConnected();
|
|
@@ -1278,9 +1319,25 @@ export class MeshAgent extends EventEmitter {
|
|
|
1278
1319
|
}
|
|
1279
1320
|
async dm(target, text) {
|
|
1280
1321
|
await this.requireConnected();
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1322
|
+
// #1229: a miss is only a real "no peer" while the view is current. Under `unpopulated`
|
|
1323
|
+
// the roster may be a reconnect refill in progress, so wait once for the snapshot and
|
|
1324
|
+
// re-resolve; a still-unverifiable target refuses naming the observer's condition (never
|
|
1325
|
+
// "no peer"), and the DM does not go out.
|
|
1326
|
+
const view = this.ep.presenceView();
|
|
1327
|
+
let peer = this.resolvePeer(target);
|
|
1328
|
+
if (!peer && view.state === "unpopulated") {
|
|
1329
|
+
await this.ep.waitForPresenceSnapshot();
|
|
1330
|
+
peer = this.resolvePeer(target);
|
|
1331
|
+
}
|
|
1332
|
+
if (!peer) {
|
|
1333
|
+
const after = this.ep.presenceView();
|
|
1334
|
+
if (after.state === "current")
|
|
1335
|
+
throw new Error(`no peer "${target}" in space "${this.config.space}"`);
|
|
1336
|
+
const condition = after.state === "stale"
|
|
1337
|
+
? `the presence view is stale since ${new Date(after.staleSince).toISOString()} (${Math.max(0, Date.now() - after.staleSince)}ms silent)`
|
|
1338
|
+
: "the presence view is unpopulated — the watch has not completed its initial snapshot";
|
|
1339
|
+
throw new Error(`cannot verify peer "${target}" in space "${this.config.space}": ${condition}, so absence is not a verdict — the peer may be present but unobserved. The DM was not sent.`);
|
|
1340
|
+
}
|
|
1284
1341
|
const msg = await this.ep.unicast(peer.card.id, text, { contextId: this._contextId });
|
|
1285
1342
|
return { msg, peer };
|
|
1286
1343
|
}
|
|
@@ -1303,10 +1360,19 @@ export class MeshAgent extends EventEmitter {
|
|
|
1303
1360
|
if (raw !== undefined && !raw.trim())
|
|
1304
1361
|
return { ok: false, error: "model: must not be empty" };
|
|
1305
1362
|
const requested = raw?.trim();
|
|
1363
|
+
let instance;
|
|
1364
|
+
try {
|
|
1365
|
+
instance = opts?.instance === undefined ? undefined : assertLifecycleToken(opts.instance, "instance");
|
|
1366
|
+
}
|
|
1367
|
+
catch (e) {
|
|
1368
|
+
return { ok: false, error: e.message };
|
|
1369
|
+
}
|
|
1370
|
+
if (this.config.userAuth && instance !== undefined && this.config.managerInstanceId !== undefined && instance !== this.config.managerInstanceId)
|
|
1371
|
+
return { ok: false, error: "the requested manager instance differs from this credential's instance authority" };
|
|
1306
1372
|
const args = { name, role, agent: opts?.agent, model: requested || undefined, variant: opts?.variant, launchOptions: opts?.launchOptions, cwd: opts?.cwd, prompt: opts?.prompt, events: opts?.events };
|
|
1307
1373
|
// P2 item 2 (2b): spawn is an ACTION — follow the acceptance to the terminal so cotal_spawn
|
|
1308
1374
|
// stays synchronous (the MCP reply carries the live outcome, not the pre-launch acceptance).
|
|
1309
|
-
const reply = await this.managerInvoke("spawn", args, { deadlineMs: SPAWN_TIMEOUT_MS, follow: true });
|
|
1375
|
+
const reply = await this.managerInvoke("spawn", args, { deadlineMs: SPAWN_TIMEOUT_MS, follow: true, ...(instance !== undefined ? { instanceId: instance } : {}) });
|
|
1310
1376
|
if (!requested)
|
|
1311
1377
|
return reply;
|
|
1312
1378
|
// A requested pin that the manager did not record is the silent-drop failure (#972): the spawn
|
|
@@ -1315,7 +1381,7 @@ export class MeshAgent extends EventEmitter {
|
|
|
1315
1381
|
// A wait-timeout is still a timeout, not evidence the pin landed — annotate it, never upgrade it.
|
|
1316
1382
|
const actual = reply.data;
|
|
1317
1383
|
const seat = actual?.name ?? name;
|
|
1318
|
-
const recorded = await this.inspectModel(seat);
|
|
1384
|
+
const recorded = await this.inspectModel(seat, instance);
|
|
1319
1385
|
const recordedLabel = !recorded.ok
|
|
1320
1386
|
? `could not inspect the recorded pin: ${recorded.error}`
|
|
1321
1387
|
: recorded.model === undefined
|
|
@@ -1346,8 +1412,8 @@ export class MeshAgent extends EventEmitter {
|
|
|
1346
1412
|
}
|
|
1347
1413
|
/** The manager's recorded model pin for a managed seat (`inspect.model`). Absence is a real
|
|
1348
1414
|
* state: a launch may pin none. Distinct from a failed inspect, which cannot attest. */
|
|
1349
|
-
async inspectModel(name) {
|
|
1350
|
-
const info = await this.managerInvoke("inspect", { name });
|
|
1415
|
+
async inspectModel(name, instance) {
|
|
1416
|
+
const info = await this.managerInvoke("inspect", { name }, instance === undefined ? undefined : { instanceId: instance });
|
|
1351
1417
|
if (!info.ok)
|
|
1352
1418
|
return { ok: false, error: info.error ?? "inspect refused" };
|
|
1353
1419
|
const model = info.data?.model;
|
|
@@ -1368,7 +1434,48 @@ export class MeshAgent extends EventEmitter {
|
|
|
1368
1434
|
const clean = args === undefined ? undefined : Object.fromEntries(Object.entries(args).filter(([, v]) => v !== undefined));
|
|
1369
1435
|
let r;
|
|
1370
1436
|
try {
|
|
1371
|
-
|
|
1437
|
+
const input = clean && Object.keys(clean).length ? clean : undefined;
|
|
1438
|
+
if (this.config.userAuth) {
|
|
1439
|
+
const managerInstanceId = opts.instanceId ?? this.config.managerInstanceId;
|
|
1440
|
+
const { instanceId: _instanceId, ...invokeOpts } = opts;
|
|
1441
|
+
const submit = async (signal) => {
|
|
1442
|
+
const bearer = await execBearerCmd([
|
|
1443
|
+
...this.config.userAuth.bearerCmd,
|
|
1444
|
+
"--manager-call",
|
|
1445
|
+
...(managerInstanceId ? ["--manager-instance", managerInstanceId] : []),
|
|
1446
|
+
], signal);
|
|
1447
|
+
return invokeUserManager({ ...this.config, managerInstanceId }, bearer, command, input, { ...invokeOpts, signal });
|
|
1448
|
+
};
|
|
1449
|
+
// Subscribe before submission on the renewing main connection. A long accepted launch
|
|
1450
|
+
// must not inherit the short-lived control credential's expiry.
|
|
1451
|
+
r = opts.follow
|
|
1452
|
+
? await this.ep.followServiceGoal(BASELINE_LIFECYCLE_ENDPOINT, submit, opts.deadlineMs, {
|
|
1453
|
+
reconcile: async (goalId, attributed, context) => {
|
|
1454
|
+
const instanceId = attributed.responder?.instanceId;
|
|
1455
|
+
if (!instanceId)
|
|
1456
|
+
throw new Error("accepted goal has no broker-attributed manager instance");
|
|
1457
|
+
const bearer = await execBearerCmd([
|
|
1458
|
+
...this.config.userAuth.bearerCmd,
|
|
1459
|
+
"--manager-call", "--manager-instance", instanceId,
|
|
1460
|
+
], context.signal, Math.min(30_000, context.deadlineMs));
|
|
1461
|
+
// Validate the renewed bearer against the accepting identity, not mutable session state.
|
|
1462
|
+
const config = {
|
|
1463
|
+
...this.config, managerInstanceId: instanceId, lifecycleUid: context.caller.uid,
|
|
1464
|
+
userAuth: { ...this.config.userAuth, owner: context.caller.owner, actor: context.caller.actor },
|
|
1465
|
+
};
|
|
1466
|
+
const queryRes = await invokeUserManager(config, bearer, "goal-result", { goalId }, {
|
|
1467
|
+
signal: context.signal, deadlineMs: Math.min(invokeOpts.deadlineMs ?? 10_000, context.deadlineMs),
|
|
1468
|
+
});
|
|
1469
|
+
if (queryRes.reply.ok !== true)
|
|
1470
|
+
throw new Error(queryRes.reply.error?.message ?? "goal-result query refused");
|
|
1471
|
+
return queryRes.reply.data;
|
|
1472
|
+
},
|
|
1473
|
+
})
|
|
1474
|
+
: await submit();
|
|
1475
|
+
}
|
|
1476
|
+
else {
|
|
1477
|
+
r = await this.ep.invokeService(BASELINE_LIFECYCLE_ENDPOINT, command, input, opts);
|
|
1478
|
+
}
|
|
1372
1479
|
}
|
|
1373
1480
|
catch (e) {
|
|
1374
1481
|
// The verdict "nobody answered" comes from core's answer-provenance marker, NEVER from the
|
|
@@ -1686,30 +1793,55 @@ export class MeshAgent extends EventEmitter {
|
|
|
1686
1793
|
roster() {
|
|
1687
1794
|
return this.ep.getRoster();
|
|
1688
1795
|
}
|
|
1796
|
+
/** Trust state of this observer's presence watch (`CotalEndpoint.presenceView()`): the roster
|
|
1797
|
+
* above can only support an absence verdict while this is `current` (#1229). */
|
|
1798
|
+
presenceView() {
|
|
1799
|
+
return this.ep.presenceView();
|
|
1800
|
+
}
|
|
1689
1801
|
/** Our last self-reported presence status. */
|
|
1690
1802
|
get status() {
|
|
1691
1803
|
return this._status;
|
|
1692
1804
|
}
|
|
1805
|
+
/** Run one presence write through the chain (#636): the write starts only after every earlier
|
|
1806
|
+
* admitted write has settled, and a rejection is swallowed at the TAIL only, so it propagates
|
|
1807
|
+
* to this write's own caller while the next admitted write still runs.
|
|
1808
|
+
*
|
|
1809
|
+
* The straggler rule: departure is the last write, later writes are refused, not reordered.
|
|
1810
|
+
* Once `stop()` has begun, any write admitted here rejects AT ONCE (no put queued, no wait on
|
|
1811
|
+
* the chain) with a fixed error, instead of running after — or, for a write that calls
|
|
1812
|
+
* `requireConnected` (e.g. `setStatus`), sitting out the ten-second connect grace before
|
|
1813
|
+
* rejecting anyway. `stop()` itself submits departure's own put through this same method (the
|
|
1814
|
+
* `forDeparture` escape) so departure keeps landing after every write already admitted, even
|
|
1815
|
+
* though `_stopping` is already true by the time it does. */
|
|
1816
|
+
inOrder(write, forDeparture = false) {
|
|
1817
|
+
if (this._stopping && !forDeparture)
|
|
1818
|
+
return Promise.reject(new Error("agent is stopping; presence writes are refused"));
|
|
1819
|
+
const next = this.presenceChain.then(write, write);
|
|
1820
|
+
this.presenceChain = next.catch(() => { });
|
|
1821
|
+
return next;
|
|
1822
|
+
}
|
|
1693
1823
|
async setStatus(status, activity) {
|
|
1694
|
-
await this.
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1824
|
+
await this.inOrder(async () => {
|
|
1825
|
+
await this.requireConnected();
|
|
1826
|
+
const prev = this._status;
|
|
1827
|
+
try {
|
|
1828
|
+
if (prev !== "working" && status === "working")
|
|
1829
|
+
await this.ep.setCondition(null);
|
|
1830
|
+
await this.publishStatus(status, activity);
|
|
1831
|
+
}
|
|
1832
|
+
finally {
|
|
1833
|
+
// The transition is a fact about the SEAT, not about whether its presence row was written:
|
|
1834
|
+
// assigning before the writes meant one failed publish (which every adapter swallows) left
|
|
1835
|
+
// `_status` idle with no boundary run, and the next real turn end saw no transition at all.
|
|
1836
|
+
this._status = status;
|
|
1837
|
+
// The turn relay's boundary: an adapter funnels its turn-end through this transition (Stop
|
|
1838
|
+
// hooks set idle), so the automatic `done` yield and the immediate re-poll live here once
|
|
1839
|
+
// instead of per connector. `waiting` is not a boundary — a seat blocked on a permission has
|
|
1840
|
+
// not finished, and its deadline is what bounds a stuck one.
|
|
1841
|
+
if (prev === "working" && status === "idle")
|
|
1842
|
+
this.onTurnBoundary();
|
|
1843
|
+
}
|
|
1844
|
+
});
|
|
1713
1845
|
}
|
|
1714
1846
|
/**
|
|
1715
1847
|
* Publish presence for something that is NOT a turn ending.
|
|
@@ -1722,13 +1854,15 @@ export class MeshAgent extends EventEmitter {
|
|
|
1722
1854
|
* than an ending.
|
|
1723
1855
|
*/
|
|
1724
1856
|
async resetStatus(status, activity) {
|
|
1725
|
-
await this.
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1857
|
+
await this.inOrder(async () => {
|
|
1858
|
+
await this.requireConnected();
|
|
1859
|
+
try {
|
|
1860
|
+
await this.publishStatus(status, activity);
|
|
1861
|
+
}
|
|
1862
|
+
finally {
|
|
1863
|
+
this._status = status;
|
|
1864
|
+
}
|
|
1865
|
+
});
|
|
1732
1866
|
}
|
|
1733
1867
|
async publishStatus(status, activity) {
|
|
1734
1868
|
if (activity !== undefined)
|
|
@@ -1737,7 +1871,7 @@ export class MeshAgent extends EventEmitter {
|
|
|
1737
1871
|
}
|
|
1738
1872
|
/** Relay a harness-reported condition into presence, or clear it. */
|
|
1739
1873
|
async setCondition(condition) {
|
|
1740
|
-
await this.ep.setCondition(condition);
|
|
1874
|
+
await this.inOrder(() => this.ep.setCondition(condition));
|
|
1741
1875
|
}
|
|
1742
1876
|
/** The working→idle boundary: yield `done` for every SURFACED turn (its payload was in the
|
|
1743
1877
|
* context of the turn that just ended; ending without an explicit yield IS the done signal),
|
|
@@ -1761,7 +1895,7 @@ export class MeshAgent extends EventEmitter {
|
|
|
1761
1895
|
async setModel(model, variant) {
|
|
1762
1896
|
if (this.config.model)
|
|
1763
1897
|
return; // operator pin is authoritative — never override it with the runtime value
|
|
1764
|
-
await this.ep.setCardModel(model, this.config.variant ?? variant);
|
|
1898
|
+
await this.inOrder(() => this.ep.setCardModel(model, this.config.variant ?? variant));
|
|
1765
1899
|
}
|
|
1766
1900
|
// ---- channel registry ----------------------------------------------------
|
|
1767
1901
|
/** The boot-time "push" half of channel onboarding: a fenced, one-line description per
|
|
@@ -1801,25 +1935,52 @@ export class MeshAgent extends EventEmitter {
|
|
|
1801
1935
|
const mine = this.ep.joinedChannels();
|
|
1802
1936
|
const pending = this.ep.pendingDurableLeaves();
|
|
1803
1937
|
const unclosed = new Set(pending);
|
|
1804
|
-
// Non-gating delivery-health signal:
|
|
1805
|
-
//
|
|
1806
|
-
//
|
|
1938
|
+
// Non-gating delivery-health signal (#445): "active" requires an AFFIRMATIVE bounded round-trip
|
|
1939
|
+
// to the delivery daemon's ctl.delivery responder — the one signal a killed daemon cannot leave
|
|
1940
|
+
// behind. The lease read alone was residue (a SIGKILLed daemon's KV row stays `ready: true` for
|
|
1941
|
+
// the bucket TTL) and the session-local membership map never notices daemon death at all, so
|
|
1942
|
+
// together they certified a corpse. Two separable facts, read separately:
|
|
1943
|
+
// `leaseReadable` — the reader may read the delivery plane (an under-granted read throws);
|
|
1944
|
+
// `daemonMemberships` — the daemon's OWN answer (undefined ⇒ no responder answered, so no
|
|
1945
|
+
// daemon is serving this plane; a throw ⇒ responder-present error, fail closed below).
|
|
1807
1946
|
let leaseLive = false;
|
|
1808
|
-
let
|
|
1947
|
+
let leaseReadable = false;
|
|
1948
|
+
let daemonMemberships;
|
|
1809
1949
|
try {
|
|
1810
1950
|
// "ready" (responder bound), not mere lease existence (single-flight slot claimed mid-startup).
|
|
1811
1951
|
leaseLive = (await this.ep.readDeliveryLease(0))?.ready === true;
|
|
1812
|
-
|
|
1952
|
+
leaseReadable = true;
|
|
1813
1953
|
}
|
|
1814
1954
|
catch {
|
|
1815
1955
|
/* open dev mode or no delivery plane here — health surface does not apply */
|
|
1816
1956
|
}
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1957
|
+
if (leaseReadable) {
|
|
1958
|
+
try {
|
|
1959
|
+
daemonMemberships = await this.ep.fetchMemberships();
|
|
1960
|
+
}
|
|
1961
|
+
catch {
|
|
1962
|
+
/* responder present but errored — health cannot be established, never "active" */
|
|
1963
|
+
daemonMemberships = undefined;
|
|
1964
|
+
leaseReadable = false;
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
// Membership-aware: "active" requires a daemon that ANSWERED and lists this channel for this
|
|
1968
|
+
// lifecycle (the round-trip is scoped to it), plus a live lease (the lease still carries
|
|
1969
|
+
// information the round-trip does not: it distinguishes a serving daemon from one whose loops
|
|
1970
|
+
// are still binding). A SIGKILLed daemon leaves the lease row behind with ready:true and the
|
|
1971
|
+
// local map set, but answers nothing — degraded. A joined durable channel whose health cannot
|
|
1972
|
+
// be established (the reader lacks the grant, or the responder errored) renders "unknown",
|
|
1973
|
+
// distinct from the degraded of a daemon that answered but holds no membership for this owner —
|
|
1974
|
+
// and from the undefined of a channel where health does not apply (not durable-class, not
|
|
1975
|
+
// joined, open mode).
|
|
1976
|
+
const health = (channel, joined) => joined && this.ep.channelDeliveryClass(channel) === "durable"
|
|
1977
|
+
? !leaseReadable
|
|
1978
|
+
? "unknown"
|
|
1979
|
+
: daemonMemberships === undefined
|
|
1980
|
+
? "degraded"
|
|
1981
|
+
: daemonMemberships.some((m) => m.channel === channel) && leaseLive
|
|
1982
|
+
? "active"
|
|
1983
|
+
: "degraded"
|
|
1823
1984
|
: undefined;
|
|
1824
1985
|
const rows = (await this.ep.listChannels()).map((c) => {
|
|
1825
1986
|
const joined = mine.some((p) => subjectMatches(p, c.channel));
|