@cotal-ai/runtime 0.169.0 → 0.171.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,514 @@
1
+ /** A run's turn and ask clients: `turn` wakes a seat of this run and reads its yield, `ask` relays a
2
+ * schema-checked pause to a seat and judges its answers, and the roster lookups both share. The
3
+ * mesh handler composes it; the run-memory maps it writes are the handler's, mutated in place, and
4
+ * every input, the handler's own members included, is read through the handler at its use. */
5
+ import { EpEnvelopeError, listRunNotices, markRunNoticeConsumed, principalKey, readCheckpointAnswer, readGoalResult, readGoalStatus, } from "@cotal-ai/core";
6
+ import { Cancelled, EffectError, askSchemaShape, conformsToAskSchema, parseDuration, stepKeyString, } from "@cotal-ai/lang";
7
+ import { delay } from "./delay.js";
8
+ import { servedDespiteStarvation } from "./host-starvation.js";
9
+ import { CheckpointAnswerMissing, TURN_ACCEPT_DEADLINE_MS, WAIT_POLL_MS, parseAgentHandle, seatDownReading, } from "./mesh-handler.js";
10
+ import { askAttemptToken } from "./pause-tokens.js";
11
+ import { PauseOverdue } from "./run-pause-host.js";
12
+ import { renderRunContext } from "./run-context.js";
13
+ /** A step key's enclosing scope: the journal's own rendering (`entry.scope`), re-derived so the
14
+ * live path and the adoption rebuild key the handoff memos identically. */
15
+ function scopeOf(key) {
16
+ const k = stepKeyString(key);
17
+ return k.slice(0, k.lastIndexOf("/"));
18
+ }
19
+ /** The recorded ask progress a resume re-enters at, or undefined for a fresh first attempt. The
20
+ * external is bytes from an earlier process, so the shape is checked rather than trusted. */
21
+ function askResume(v) {
22
+ if (v === undefined)
23
+ return undefined;
24
+ if (!(typeof v.attempt === "number" && v.attempt >= 1 && typeof v.deadlineAt === "number"))
25
+ return undefined;
26
+ // The refusal is bound with the attempt it belongs to. A resume that dropped it would re-ask the
27
+ // seat with no reason its last answer failed, which is the one thing the re-ask exists to say.
28
+ return {
29
+ attempt: v.attempt,
30
+ deadlineAt: v.deadlineAt,
31
+ ...(typeof v.refused === "string" ? { refused: v.refused } : {}),
32
+ };
33
+ }
34
+ /** WHY a reply does not conform, per declared field — the refusal an answerer reads off the entry
35
+ * before answering again. Judged with the same single-field check that judged the reply, so the
36
+ * description can never disagree with the verdict. */
37
+ function askNonconformance(value, shape) {
38
+ if (typeof value !== "object" || value === null || Array.isArray(value))
39
+ return "the reply is not a record";
40
+ const record = value;
41
+ const bad = [];
42
+ for (const [field, kind] of Object.entries(shape)) {
43
+ if (conformsToAskSchema({ [field]: record[field] }, { [field]: kind }))
44
+ continue;
45
+ bad.push(field in record ? `"${field}" wants ${kind}` : `"${field}" is missing (wants ${kind})`);
46
+ }
47
+ return bad.join("; ");
48
+ }
49
+ /** The turn and ask members of a mesh handler, over the handler's own inputs. */
50
+ export class TurnAsk {
51
+ deps;
52
+ constructor(deps) {
53
+ this.deps = deps;
54
+ }
55
+ get handler() { return this.deps.self(); }
56
+ get binding() { return this.deps.binding(); }
57
+ get kv() { return this.deps.kv(); }
58
+ get services() { return this.deps.services(); }
59
+ get lag() { return this.deps.lag(); }
60
+ get onStarved() { return this.deps.onStarved(); }
61
+ get roster() { return this.deps.roster(); }
62
+ get turnsTaken() { return this.deps.turnsTaken(); }
63
+ get handoffMemos() { return this.deps.handoffMemos(); }
64
+ get turnGoals() { return this.deps.turnGoals(); }
65
+ now() { return this.deps.now(); }
66
+ actionCtx() { return this.deps.actionCtx(); }
67
+ manager(command, instanceId) { return this.deps.manager(command, instanceId); }
68
+ invokeManager(service, command, args, opts) {
69
+ return this.deps.invokeManager(service, command, args, opts);
70
+ }
71
+ relayManagerBeforeSubmit(host, command, ref, kind, label) {
72
+ return this.deps.relayManagerBeforeSubmit(host, command, ref, kind, label);
73
+ }
74
+ arm(ref, deadline) { return this.deps.arm(ref, deadline); }
75
+ expired(ref) { return this.deps.expired(ref); }
76
+ cancelTimer(ref) { return this.deps.cancelTimer(ref); }
77
+ settle(ref, signal, relayed) { return this.deps.settle(ref, signal, relayed); }
78
+ presenceDeath(name, uid, watch, decided) { return this.deps.presenceDeath(name, uid, watch, decided); }
79
+ relayToSeat(seat, goalId, payload, deadlineAt, kind, step) {
80
+ return this.deps.relayToSeat(seat, goalId, payload, deadlineAt, kind, step);
81
+ }
82
+ withdrawCancelledRelay(goalId, deadlineAt) { return this.deps.withdrawCancelledRelay(goalId, deadlineAt); }
83
+ recordTurnGoal(handle, goalId) { this.deps.recordTurnGoal(handle, goalId); }
84
+ recordHandoffMemo(scope, to, fromGoalId) { this.deps.recordHandoffMemo(scope, to, fromGoalId); }
85
+ /**
86
+ * `turn` wakes ONE AGENT for one turn, over the manager's relay (a seat is not an endpoint):
87
+ * the manager accepts the goal, parks the rendered context durably, the seat pulls and yields
88
+ * under its own self reach, and the yield is this goal's terminal. The request id is the goalId,
89
+ * the same recovery discipline as `spawn`: a resumed run re-enters the poll, never re-submits.
90
+ *
91
+ * THREE AUTHORITIES END IT, one per ending. The seat's yield is the manager's `succeeded`
92
+ * terminal, carrying the TurnResult. The DEADLINE is double-covered: the manager arms a
93
+ * goal-bound hold (its expiry commits `failed` reason `turn-deadline`), and this client arms its
94
+ * OWN pause under the step's request id — the L4003 authority that survives a dead manager.
95
+ * DEATH: the manager's reap hook marks pending turns; death rides the deadline terminal as
96
+ * `agentDownAt`. This client's presence watch is the early L4002 authority even while the
97
+ * manager runs. The watch reads death the way `wait(down)` does: a superseded incarnation at
98
+ * once, a lapsed row only once it has stayed absent for {@link LAPSE_CONFIRM_MS} and its manager
99
+ * no longer runs the seat.
100
+ *
101
+ * Handoff honoring (lang §5.3) happens HERE: the scope's pending memo is spent at every turn's
102
+ * begin, and when this turn targets its `to`, the link rides the submission (`handoffFrom`, the
103
+ * manager mirrors it into the terminal) and the bound external state. A handoff YIELD is
104
+ * validated against the run roster: an addressee outside it is L4005, one in a different
105
+ * worktree is L4004.
106
+ */
107
+ async turn(req, ctx) {
108
+ if (ctx.signal.cancelled)
109
+ throw new Cancelled(ctx.signal.reason ?? "cancelled");
110
+ const { name, uid } = parseAgentHandle(req.agent.agent);
111
+ const goalId = ctx.requestId;
112
+ const ref = { endpoint: this.binding.endpoint, caller: this.binding.caller, goalId };
113
+ const primary = { endpoint: this.binding.endpoint, token: goalId };
114
+ const scope = scopeOf(ctx.key);
115
+ let ext = ctx.resume?.goalId === goalId ? ctx.resume : undefined;
116
+ if (ext === undefined) {
117
+ const seat = this.handler.seatAddress(name, uid);
118
+ if (seat.address === undefined) {
119
+ if (seat.why === "not-in-roster")
120
+ throw new Error(`turn(${name}#${uid}) addresses an agent that is not in this run's roster; a turn wakes an agent this run spawned`);
121
+ throw new Error(`turn(${name}#${uid}) has no address: the spawn's acceptance floor was never served, so the seat's owner/actor coordinates are unknown`);
122
+ }
123
+ const { owner, actor, host } = seat.address;
124
+ // The permits are the roster entry's, not the address's: a budget is spent per spawn, and
125
+ // the address is only where this turn is sent.
126
+ const entry = this.roster.get(name);
127
+ // Spend the scope's handoff memo at BEGIN, honored or not — honoring is immediate-only.
128
+ const memo = this.handoffMemos.get(scope);
129
+ this.handoffMemos.delete(scope);
130
+ const handoffFrom = memo !== undefined && memo !== "ambiguous" && memo.to === name ? memo.fromGoalId : undefined;
131
+ // Render the seat's context: every unconsumed notice addressed to it, as one durable payload.
132
+ const step = stepKeyString(ctx.key);
133
+ // Addressed by the HANDLE COMPOSITE, exactly as `notify` filed them (an incarnation is the
134
+ // addressee, and a successor under the name is somebody else).
135
+ const notices = (await listRunNotices(this.kv, this.binding.endpoint, this.binding.runId, req.agent.agent))
136
+ .filter((n) => n.consumed === undefined);
137
+ const context = renderRunContext({ run: this.binding.runId, step, notices });
138
+ const deadlineMs = parseDuration(req.deadline ?? this.binding.defaultCheckpointTimeout);
139
+ // The agent's permits are budgets this run spends at the call that would exceed them
140
+ // (cotal-lang 6.5, L4001): one turn per `turns`, and a turn whose deadline runs past the
141
+ // agent's remaining wall clock is already over it. Counted on the fresh path only: a resume
142
+ // re-enters a turn the seed already counted from its journal entry.
143
+ const taken = this.turnsTaken.get(`${name}#${uid}`) ?? 0;
144
+ if (entry.permits?.turns !== undefined && taken >= entry.permits.turns)
145
+ throw new EffectError("L4001", "permit-turns", `turn(${name}#${uid}) would be that agent's turn ${taken + 1}, past its permit of ${entry.permits.turns}`);
146
+ if (entry.permits?.wallClockMs !== undefined && entry.spawnedAt !== undefined) {
147
+ const remaining = entry.spawnedAt + entry.permits.wallClockMs - this.now();
148
+ if (remaining <= 0)
149
+ throw new EffectError("L4001", "permit-wall-clock", `turn(${name}#${uid}): the agent's wall-clock permit (${entry.permits.wallClockMs}ms from its spawn) is spent`);
150
+ if (deadlineMs > remaining)
151
+ throw new EffectError("L4001", "permit-wall-clock", `turn(${name}#${uid}): a ${deadlineMs}ms deadline runs past the agent's remaining wall clock (${remaining}ms of its ${entry.permits.wallClockMs}ms permit)`);
152
+ }
153
+ const payload = JSON.stringify({ run: this.binding.runId, step, context, noticeIds: notices.map((n) => n.noticeId) });
154
+ let submitted = false;
155
+ const submit = async () => {
156
+ const service = submitted ? await this.manager("turn", host)
157
+ : await this.relayManagerBeforeSubmit(host, "turn", ref, "turn", `turn(${name}#${uid})`);
158
+ // After invocation may have run, retain the existing goal reconciliation.
159
+ submitted = true;
160
+ return this.invokeManager(service, "turn", { payload, deadlineMs, ...(handoffFrom !== undefined ? { handoffFrom } : {}) }, {
161
+ id: goalId,
162
+ deadlineMs: TURN_ACCEPT_DEADLINE_MS,
163
+ target: { mode: "owner", owner, actor, lifecycleUid: uid },
164
+ });
165
+ };
166
+ let reply;
167
+ try {
168
+ reply = await submit();
169
+ }
170
+ catch (err) {
171
+ // The invoke did not come back — the goal record is the arbiter, exactly as in `spawn`.
172
+ if ((await readGoalStatus(await this.actionCtx(), ref)) === undefined)
173
+ throw err;
174
+ }
175
+ // ONE reading of a refused acceptance, for both submits: a seat that dies between the first
176
+ // submit and the re-read is the same dead seat, and the resubmit path classing it as an
177
+ // ordinary refusal made an L4002 the program can catch arrive as an uncatchable L4000.
178
+ const refusal = (r, resubmitted) => {
179
+ const err = r.reply.error;
180
+ // `expired` is the serve boundary's "target is not a live managed agent". From the placed
181
+ // host that is the seat's own manager answering about it. From the class rail it is only
182
+ // the members this call reached, so the message does not claim more than that.
183
+ if (err?.code === "expired")
184
+ return new EffectError("L4002", "turn", `turn(${name}#${uid}) ${seatDownReading(err, host)} before the relay began: ${err.message}`);
185
+ return new Error(resubmitted
186
+ ? `turn(${name}#${uid}) landed but its acceptance could not be re-read: ${err?.message ?? "refused with no message"}`
187
+ : `turn(${name}#${uid}) was refused by the ${this.binding.endpoint} endpoint: ${err?.message ?? "refused with no message"}`);
188
+ };
189
+ if (reply !== undefined && reply.reply.ok === false)
190
+ throw refusal(reply, false);
191
+ if (reply === undefined) {
192
+ // The acceptance carries the deadline authority, so a lost reply is asked for again: the
193
+ // same goalId under the same fingerprint is served from the manager's acceptance cache.
194
+ reply = await submit();
195
+ if (reply.reply.ok === false)
196
+ throw refusal(reply, true);
197
+ }
198
+ const floor = reply.reply.data;
199
+ if (typeof floor?.deadlineAt !== "number")
200
+ throw new Error(`turn(${name}#${uid}) was accepted with no readable deadline (${JSON.stringify(reply.reply.data)}); a garbled acceptance never authorizes (SPEC 13.6)`);
201
+ // ONE deadline for the turn: the acceptance's `deadlineAt` is the instant the manager's own
202
+ // hold denies at, and the client's pause is armed on that same instant. A second clock read
203
+ // before the accept round-trip would fire first by the round-trip plus skew and throw away a
204
+ // yield the manager's window still admitted.
205
+ const deadlineAt = floor.deadlineAt;
206
+ ext = {
207
+ goalId, name, owner, actor, uid, deadlineAt,
208
+ noticeIds: notices.map((n) => n.noticeId),
209
+ ...(handoffFrom !== undefined ? { handoffFrom } : {}),
210
+ };
211
+ await ctx.bind(ext);
212
+ // Spent once the turn is RECORDED, which is the same event the adoption seed counts. Spending
213
+ // it before the submit charged a permit for a turn the seat never saw (a dead seat's L4002,
214
+ // an endpoint refusal), and a recovering run would then read a different number off the
215
+ // journal than the live one held.
216
+ this.turnsTaken.set(`${name}#${uid}`, taken + 1);
217
+ }
218
+ this.recordTurnGoal(`${name}#${uid}`, goalId);
219
+ const deadlineAt = ext.deadlineAt;
220
+ if (typeof deadlineAt !== "number")
221
+ throw new Error(`turn(${name}#${uid}) resumed with no recorded deadline; a garbled external state never authorizes`);
222
+ // The client's OWN deadline authority: minted on the first pass, attached to on re-entry.
223
+ await this.arm(primary, deadlineAt);
224
+ const actx = await this.actionCtx();
225
+ const watch = {};
226
+ // Only re-enter the read, never the relay submission or its outcome processing. Each read
227
+ // gets the pause plane's bounded timeout/starvation policy and names itself in diagnostics.
228
+ const poll = (what, read) => servedDespiteStarvation(async () => {
229
+ if (ctx.signal.cancelled)
230
+ throw new Cancelled(ctx.signal.reason ?? "cancelled");
231
+ return await read();
232
+ }, this.lag, `turn(${name}#${uid}) ${what}`, this.onStarved);
233
+ const result = () => poll("readGoalResult", () => readGoalResult(actx, ref));
234
+ const expired = () => poll("expired", () => this.expired(primary));
235
+ const decided = async () => ctx.signal.cancelled || (await result()) !== undefined || (await expired()) !== undefined;
236
+ try {
237
+ for (;;) {
238
+ if (ctx.signal.cancelled)
239
+ throw new Cancelled(ctx.signal.reason ?? "cancelled");
240
+ const fact = await result();
241
+ if (fact !== undefined) {
242
+ await this.cancelTimer(primary);
243
+ return await this.turnOutcome(req, fact, ext, scope, name, uid);
244
+ }
245
+ const ended = await expired();
246
+ if (ended !== undefined)
247
+ throw new EffectError("L4003", "turn-deadline", `turn(${name}#${uid}) deadline elapsed before a yield`);
248
+ const reason = await poll("presenceDeath", () => this.presenceDeath(name, uid, watch, decided));
249
+ if (reason !== undefined) {
250
+ await this.cancelTimer(primary);
251
+ throw new EffectError("L4002", "turn", `turn(${name}#${uid}) found the agent down (${reason}) before a yield`);
252
+ }
253
+ await delay(WAIT_POLL_MS);
254
+ }
255
+ }
256
+ catch (e) {
257
+ // A turn that ends on the run's side without a yield the run accepted (its deadline, the
258
+ // seat's death, a refused handoff, a cancellation) is not a reply, whatever the relay
259
+ // records later: `wait(replied)` reads the verdict this branch raised, never a stale yield.
260
+ this.turnGoals.get(`${name}#${uid}`)?.delete(goalId);
261
+ // In particular a read that exhausted its retry budget must not leave a live relay that
262
+ // tells the seat its later yield continued a turn the run already abandoned. The ordinary
263
+ // turn verdicts already have an authority: death, the shared deadline, or a yielded handoff.
264
+ // Do not ask a dead manager to confirm the client's independent deadline or death verdict.
265
+ const terminal = e instanceof EffectError && ["L4002", "L4003", "L4004", "L4005"].includes(e.code);
266
+ if (!terminal) {
267
+ // Neither cleanup failure may prevent the other resource from being retired.
268
+ const cleanup = await Promise.allSettled([
269
+ this.cancelTimer(primary),
270
+ this.withdrawCancelledRelay(goalId, deadlineAt),
271
+ ]);
272
+ const failures = cleanup.flatMap((r, i) => r.status === "rejected"
273
+ ? [{ resource: i === 0 ? "primary timer claim" : "relay withdrawal", error: r.reason }]
274
+ : []);
275
+ if (failures.length > 0) {
276
+ const message = `${e instanceof Error ? e.message : String(e)}; turn cleanup failed: `
277
+ + failures.map((f) => `${f.resource}: ${f.error instanceof Error ? f.error.message : String(f.error)}`).join("; ");
278
+ const cause = new AggregateError([e, ...failures.map((f) => f.error)], message);
279
+ if (e instanceof EffectError) {
280
+ const error = new EffectError(e.code, e.kind, message, e.detail);
281
+ error.cause = cause;
282
+ throw error;
283
+ }
284
+ throw cause;
285
+ }
286
+ }
287
+ throw e;
288
+ }
289
+ }
290
+ /**
291
+ * A yielded handoff's refusal class: L4005 when the addressee is not in this run's roster,
292
+ * L4004 when it sits in a different worktree than the seat handing off, undefined when the
293
+ * handoff is honorable. One reading for the turn that raises it and the `wait(replied)` that
294
+ * must not count it, so the two observers never diverge on a spoofed or misdirected `to`.
295
+ */
296
+ handoffRefusal(fromWorktree, to) {
297
+ const toName = typeof to === "string" ? to : "";
298
+ const target = this.roster.get(toName);
299
+ if (toName.length === 0 || target === undefined)
300
+ return "L4005";
301
+ if ((target.handle.worktree ?? undefined) !== (fromWorktree ?? undefined))
302
+ return "L4004";
303
+ return undefined;
304
+ }
305
+ /** Map a turn goal's terminal onto the effect's contract: `succeeded` carries the TurnResult
306
+ * (a handoff addressee resolved against the roster — L4005 outside it, L4004 across
307
+ * worktrees), `failed` splits on the manager's recorded reason, `cancelled` unwinds. The
308
+ * consumed notices are marked HERE, by the goal that carried them, tolerating the re-entry
309
+ * conflict (a crash between the terminal and the mark re-marks on resume). */
310
+ async turnOutcome(req, fact, ext, scope, name, uid) {
311
+ if (fact.state === "cancelled")
312
+ throw new Cancelled(`the turn goal for ${name}#${uid} was cancelled`);
313
+ if (fact.state === "failed") {
314
+ const d = fact.data;
315
+ // The one reasoned failure a relay commits. A dead target has no early terminal of its own
316
+ // on the goal plane (SPEC 13.6 item 7): the client's presence watch in the poll loop is the
317
+ // first L4002 authority, and a death that rode to the deadline arrives on this same deny,
318
+ // MARKED by the relay (`agentDownAt`) — read here as the agent-down failure it is, never as
319
+ // a deadline the program could have set longer.
320
+ if (d?.reason === "turn-deadline") {
321
+ if (typeof d.agentDownAt === "number")
322
+ throw new EffectError("L4002", "turn", `turn(${name}#${uid}) found the agent down (it left presence at ${new Date(d.agentDownAt).toISOString()}) before a yield; the deadline terminal carries its death`);
323
+ throw new EffectError("L4003", "turn-deadline", `turn(${name}#${uid}) deadline elapsed before a yield`);
324
+ }
325
+ throw new Error(`turn(${name}#${uid}) failed at the ${this.binding.endpoint} endpoint: ${typeof d?.error === "string" ? d.error : JSON.stringify(fact.data)}`);
326
+ }
327
+ if (fact.state !== "succeeded")
328
+ throw new Error(`turn(${name}#${uid}) settled ${fact.state}; a turn's yield is a succeeded terminal or a reasoned failure, never this`);
329
+ const d = fact.data;
330
+ if ((d?.status !== "done" && d?.status !== "blocked" && d?.status !== "handoff") || typeof d.at !== "number")
331
+ throw new Error(`turn(${name}#${uid}) succeeded with a malformed TurnResult (${JSON.stringify(fact.data)}); a garbled terminal never yields a result`);
332
+ let to;
333
+ if (d.status === "handoff") {
334
+ const toName = typeof d.to === "string" ? d.to : "";
335
+ const refusal = this.handler.handoffRefusal(req.agent.worktree, d.to);
336
+ if (refusal === "L4005")
337
+ throw new EffectError("L4005", "turn-handoff", `turn(${name}#${uid}) yielded a handoff to "${toName}", which is not in this run's roster`);
338
+ const target = this.roster.get(toName);
339
+ if (refusal === "L4004")
340
+ throw new EffectError("L4004", "turn-handoff", `turn(${name}#${uid}) yielded a handoff to "${toName}" across worktrees (${req.agent.worktree ?? "none"} -> ${target.handle.worktree ?? "none"}); you cannot hand someone a working tree they are not in`);
341
+ to = target.handle;
342
+ }
343
+ // The notices this turn carried are consumed by THIS goal — the create-only CAS arbitrates,
344
+ // and a re-entry's conflict reads as "already recorded", never as a failure.
345
+ const noticeIds = Array.isArray(ext.noticeIds) ? ext.noticeIds.filter((n) => typeof n === "string") : [];
346
+ for (const noticeId of noticeIds) {
347
+ try {
348
+ await markRunNoticeConsumed(this.kv, this.binding.endpoint, this.binding.runId, req.agent.agent, noticeId, String(ext.goalId), this.now());
349
+ }
350
+ catch (e) {
351
+ if (!(e instanceof EpEnvelopeError && e.code === "conflict"))
352
+ throw e;
353
+ }
354
+ }
355
+ if (d.status === "handoff" && to !== undefined)
356
+ this.recordHandoffMemo(scope, parseAgentHandle(to.agent).name, String(ext.goalId));
357
+ return {
358
+ status: d.status,
359
+ ...(to !== undefined ? { to } : {}),
360
+ ...(typeof d.note === "string" ? { note: d.note } : {}),
361
+ at: d.at,
362
+ };
363
+ }
364
+ /**
365
+ * `ask` is a schema-checked pause the ADDRESSED AGENT is expected to answer.
366
+ *
367
+ * Each attempt is one checkpoint-plane pause — the same mint, settle and answer record a
368
+ * `checkpoint` rides, answered through the run driver's `resolveCheckpoint` (`cotal run
369
+ * answer`), which is how "the agent publishes a record" reaches a holder-bound plane: the agent,
370
+ * or anyone the run's ACL admits on its behalf, answers through the driver exactly as a human
371
+ * answers a checkpoint. What `ask` adds is the handler-side contract of §6.5: the schema is read
372
+ * as the SHORTHAND (refused L4022 when it cannot be), every answer is checked against it, a
373
+ * non-conforming answer costs one attempt and the refusal reason is bound onto the entry for the
374
+ * answerer to read, and exhausted attempts are the effect's own catchable L4006.
375
+ *
376
+ * **One absolute deadline for the whole ask**, computed once and bound with the first attempt: a
377
+ * re-ask does not restart the clock, or a stream of non-conforming answers could stretch the
378
+ * pause forever. The deadline elapsing with no conforming answer is the ask's own L4006, the
379
+ * same outcome exhausted attempts name: the budget it ran out of is the ask's, and L4003 belongs
380
+ * to a `turn` whose own deadline elapsed.
381
+ *
382
+ * **Attempt N's token derives from the step's request id** (attempt 1 IS the request id), and
383
+ * the CURRENT attempt's token is bound as `askToken` before its pause is armed — so a resume
384
+ * re-enters the attempt in flight, an answer judged non-conforming just before a crash is
385
+ * re-judged identically from its durable settle, and the discharge and the adoption re-arm
386
+ * address the one timer that is actually armed.
387
+ */
388
+ async ask(req, ctx) {
389
+ if (ctx.signal.cancelled)
390
+ throw new Cancelled(ctx.signal.reason ?? "cancelled");
391
+ const shape = askSchemaShape(req.schema);
392
+ if (shape === null) {
393
+ throw new EffectError("L4022", "ask-schema-unreadable", `L4022 Unreadable ask schema\n\n step ${stepKeyString(ctx.key)}\n\nThe schema is not the shorthand this handler enforces: a record mapping each field name to one of "string", "number", "boolean", "array", "record", "null".\n\nFix: write the shorthand, for example { steps: "array" }, or pass {} to accept any record.`);
394
+ }
395
+ const attempts = req.attempts ?? 1;
396
+ // The seat the ask is told to, resolved before anything binds: an ask addresses an agent this
397
+ // run spawned, and one it cannot tell opens no attempt.
398
+ const seat = this.askSeat(req, ctx);
399
+ const resume = askResume(ctx.resume);
400
+ const deadlineAt = resume?.deadlineAt
401
+ ?? this.now() + parseDuration(req.deadline ?? this.binding.defaultCheckpointTimeout);
402
+ let attempt = resume?.attempt ?? 1;
403
+ // The resumed attempt is already bound; every attempt this call opens binds before it arms.
404
+ let bindOwed = resume === undefined;
405
+ let refused = resume?.refused;
406
+ for (;;) {
407
+ const token = askAttemptToken(ctx.requestId, attempt);
408
+ if (bindOwed) {
409
+ await ctx.bind({
410
+ attempt,
411
+ askToken: token,
412
+ deadlineAt,
413
+ ...(refused !== undefined ? { refused } : {}),
414
+ });
415
+ }
416
+ bindOwed = true;
417
+ // The addressed agent is TOLD: the attempt rides the turn relay under the attempt's own
418
+ // token, carrying the token, the schema, the attempt count, the deadline and the previous
419
+ // refusal, so the seat can answer through `cotal run answer`. Idempotent by goal id: a
420
+ // re-entry finds the relay already accepted and submits nothing.
421
+ await this.relayAsk(seat, ctx, token, { attempt, attempts, deadlineAt, ...(refused !== undefined ? { refused } : {}) });
422
+ const ref = { endpoint: this.binding.endpoint, token };
423
+ // The deadline is the ask's whole budget of time: passing it with no conforming record
424
+ // is the same outcome exhausted attempts name (L4006), never a turn's deadline (L4003),
425
+ // and that holds when it passed while the attempt was bound and relayed, before its pause
426
+ // could be minted.
427
+ const expired = () => new EffectError("L4006", "ask-deadline", `ask(${stepKeyString(ctx.key)}) produced no conforming record before its recorded deadline: attempt ${attempt} of ${attempts} was still open when it passed`);
428
+ try {
429
+ await this.arm(ref, deadlineAt);
430
+ }
431
+ catch (e) {
432
+ if (e instanceof PauseOverdue)
433
+ throw expired();
434
+ throw e;
435
+ }
436
+ const settled = await this.settle(ref, ctx.signal, true);
437
+ if (settled.settle === "expired")
438
+ throw expired();
439
+ const answer = settled.answerId === undefined
440
+ ? undefined
441
+ : this.services ? await this.services.pauses.readAnswer(token) : await readCheckpointAnswer(this.kv, this.binding.endpoint, token, settled.answerId);
442
+ if (answer === undefined)
443
+ throw new CheckpointAnswerMissing(token, settled.answerId);
444
+ if (conformsToAskSchema(answer.value, shape))
445
+ return answer.value;
446
+ const why = askNonconformance(answer.value, shape);
447
+ if (attempt >= attempts) {
448
+ throw new EffectError("L4006", "ask-nonconforming", `L4006 ask never produced a conforming record\n\n step ${stepKeyString(ctx.key)}\n\n${attempts} repl${attempts === 1 ? "y was" : "ies were"} checked against the schema and none conformed; the last was refused: ${why}.\n\nFix: have the agent publish a record matching the schema, widen the schema, or raise attempts.`);
449
+ }
450
+ refused = why;
451
+ attempt += 1;
452
+ }
453
+ }
454
+ /**
455
+ * One ask attempt's relay to the addressed seat: a `turn` goal under the attempt's token whose
456
+ * payload carries the ask (token, schema, attempt, deadline, the previous refusal), rendered by
457
+ * the seat's connector as the request to answer. The goal is the seat's to yield when it has
458
+ * answered; the ask itself settles on the checkpoint plane, so the relay's terminal is never
459
+ * read here, and it is never a reply `wait(replied)` observes. A seat the serve boundary reports
460
+ * gone is the agent-down failure (L4002).
461
+ */
462
+ askSeat(req, ctx) {
463
+ const { name, uid } = parseAgentHandle(req.agent.agent);
464
+ const seat = this.handler.seatAddress(name, uid);
465
+ const step = stepKeyString(ctx.key);
466
+ if (seat.address === undefined) {
467
+ if (seat.why === "not-in-roster")
468
+ throw new Error(`ask(${step}) addresses ${name}#${uid}, which is not in this run's roster; an ask is relayed to an agent this run spawned`);
469
+ throw new Error(`ask(${step}) has no address for ${name}#${uid}: the spawn's acceptance floor was never served, so the seat's owner/actor coordinates are unknown`);
470
+ }
471
+ return { ...seat.address, schema: req.schema };
472
+ }
473
+ /**
474
+ * Where a relay to an agent of this run is addressed: the roster entry under the handle's name,
475
+ * at the handle's incarnation, with the owner/actor coordinates its acceptance floor served.
476
+ * One resolver for the three relays (`turn`, `ask`, an escalation), because the three
477
+ * dispositions differ and the lookup does not: a turn and an ask refuse, an escalation stands.
478
+ */
479
+ seatAddress(name, uid) {
480
+ const entry = this.roster.get(name);
481
+ if (entry === undefined || (uid !== undefined && entry.uid !== uid))
482
+ return { why: "not-in-roster" };
483
+ if (entry.owner === undefined || entry.actor === undefined)
484
+ return { why: "no-floor" };
485
+ return { address: { name, uid: entry.uid, owner: entry.owner, actor: entry.actor, ...(entry.host !== undefined ? { host: entry.host } : {}) } };
486
+ }
487
+ /**
488
+ * The principal a `message` wait's `from` handle names, as `<owner>.<actor>`: the coordinates
489
+ * this run's roster recorded when it spawned the seat or bound the participant. A message
490
+ * answers only when its subject's sender is that principal. A handle outside the roster, or one
491
+ * whose coordinates were never served, refuses: matching it on a display name would let any peer
492
+ * that names itself after the agent answer.
493
+ */
494
+ waitSender(agent) {
495
+ const { name, uid } = parseAgentHandle(agent);
496
+ const seat = this.handler.seatAddress(name, uid);
497
+ if (seat.address === undefined) {
498
+ if (seat.why === "not-in-roster")
499
+ throw new Error(`wait(message(..., { from: ${name}#${uid} })) names an agent that is not in this run's roster; \`from\` takes a handle this run spawned or bound with participant()`);
500
+ throw new Error(`wait(message(..., { from: ${name}#${uid} })) has no sender to match: the spawn's acceptance floor was never served, so the seat's owner/actor coordinates are unknown`);
501
+ }
502
+ return principalKey(seat.address.owner, seat.address.actor).key;
503
+ }
504
+ async relayAsk(seat, ctx, token, ask) {
505
+ const step = stepKeyString(ctx.key);
506
+ const context = renderRunContext({ run: this.binding.runId, step, notices: [] });
507
+ const payload = JSON.stringify({
508
+ run: this.binding.runId, step, context, noticeIds: [],
509
+ ask: { token, schema: seat.schema, attempt: ask.attempt, attempts: ask.attempts, deadlineAt: ask.deadlineAt, ...(ask.refused !== undefined ? { refused: ask.refused } : {}) },
510
+ });
511
+ await this.relayToSeat(seat, token, payload, ask.deadlineAt, "ask", step);
512
+ }
513
+ }
514
+ //# sourceMappingURL=mesh-turn-ask.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mesh-turn-ask.js","sourceRoot":"","sources":["../src/mesh-turn-ask.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EACL,eAAe,EAAE,cAAc,EAAE,qBAAqB,EAAE,YAAY,EAAE,oBAAoB,EAAE,cAAc,EAAE,cAAc,GAG3H,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,SAAS,EAAE,WAAW,EAAE,cAAc,EAAE,mBAAmB,EAAE,aAAa,EAAE,aAAa,GAG1F,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,uBAAuB,EAAwB,MAAM,sBAAsB,CAAC;AACrF,OAAO,EACL,uBAAuB,EAAE,uBAAuB,EAAE,YAAY,EAAE,gBAAg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AAO,EAAE,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;SAC9K,CAAC,CAAC;QACH,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IAC5E,CAAC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"offline-command.d.ts","sourceRoot":"","sources":["../src/offline-command.ts"],"names":[],"mappings":"AAKA,UAAU,aAAa;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAuCD;;;;;;0CAM0C;AAC1C,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK7C;AAwID,sFAAsF;AACtF,wBAAsB,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CA2DhI"}
1
+ {"version":3,"file":"offline-command.d.ts","sourceRoot":"","sources":["../src/offline-command.ts"],"names":[],"mappings":"AAMA,UAAU,aAAa;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAuCD;;;;;;0CAM0C;AAC1C,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK7C;AA0JD,sFAAsF;AACtF,wBAAsB,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CA2DhI"}