@slopus/happy-agent-base 0.0.21 → 0.0.23

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/README.md CHANGED
@@ -101,9 +101,9 @@ Messages receive a generated cuid2 identity, or accept one through `{ id }` for
101
101
  delivery. A repeated ID is an ignored persistence conflict while its message remains in the
102
102
  durable conversation; deliberate conversation replacement releases identities for the records it
103
103
  removes. `send` and `steer` return the effective ID, delivery mode, and whether durable acceptance
104
- created the identity or found it already present. Inside an outer transaction, even an operation
105
- requested with `await: false` completes its durable queue write before returning, because work may
106
- not retain a transaction context after the transaction body ends. Optional immutable metadata
104
+ created the identity or found it already present. Inside an outer transaction, delivery completes
105
+ its durable queue write before returning because work may not retain a transaction context after
106
+ the transaction body ends. Optional immutable metadata
107
107
  travels beside the provider message and reaches both message-accepted hooks; module-generated send
108
108
  and steer actions accept the same fields.
109
109
 
package/dist/Agent.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Context } from "@steve.kite/stdlib";
2
- import { type AgentBaseAwaitOptions, type AgentBaseMessageOptions, type AgentBaseOptions } from "./AgentBase.js";
2
+ import { type AgentBaseMessageOptions, type AgentBaseOptions } from "./AgentBase.js";
3
3
  import type { AgentBaseState } from "./AgentBaseState.js";
4
4
  import type { AgentDatabase } from "./AgentDatabase.js";
5
5
  import type { AgentModule, AgentModuleRuntime } from "./AgentModule.js";
@@ -76,9 +76,9 @@ export declare class Agent<Tool extends AnyAgentTool = AnyAgentTool, Database ex
76
76
  */
77
77
  get state(): AgentBaseState;
78
78
  /** Queue a message that injects as soon as the current response and tool batch finish. */
79
- steer(ctx: Context, message: AgentQueuedMessage, options?: AgentBaseMessageOptions & AgentBaseAwaitOptions): Promise<AgentMessageAcceptance>;
79
+ steer(ctx: Context, message: AgentQueuedMessage, options?: AgentBaseMessageOptions): Promise<AgentMessageAcceptance>;
80
80
  /** Queue a message that injects only when the agent would otherwise stop. */
81
- send(ctx: Context, message: AgentQueuedMessage, options?: AgentBaseMessageOptions & AgentBaseAwaitOptions): Promise<AgentMessageAcceptance>;
81
+ send(ctx: Context, message: AgentQueuedMessage, options?: AgentBaseMessageOptions): Promise<AgentMessageAcceptance>;
82
82
  /** Shallow-merge fields into this agent's immutable metadata. */
83
83
  updateMetadata(ctx: Context, update: AgentMetadata): Promise<void>;
84
84
  /** Start the loop without a new message, continuing a turn an earlier run left unfinished. */
@@ -86,9 +86,9 @@ export declare class Agent<Tool extends AnyAgentTool = AnyAgentTool, Database ex
86
86
  /** Wait until the agent has nothing left to do, including work it accepted but never began. */
87
87
  waitForIdle(): Promise<void>;
88
88
  /** Ask for the conversation to be replaced by the provider's summary of it. */
89
- compact(ctx: Context, options?: AgentBaseAwaitOptions): Promise<void>;
89
+ compact(ctx: Context): Promise<void>;
90
90
  /** Cancel the active turn, leaving queued messages durable for the next one. */
91
- abort(ctx: Context, options?: AgentBaseAwaitOptions): Promise<void>;
91
+ abort(ctx: Context): Promise<void>;
92
92
  /** Finish everything already accepted, then destroy the provider session. */
93
93
  close(): Promise<void>;
94
94
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Agent.d.ts","sourceRoot":"","sources":["../sources/Agent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAGlD,OAAO,EAEH,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACxB,MAAM,gBAAgB,CAAC;AAgBxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAoB,MAAM,kBAAkB,CAAC;AAE1F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OA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AAE,kBAAkB,EAC3B,OAAO,CAAC,EAAE,uBAAuB,GAClC,OAAO,CAAC,sBAAsB,CAAC,CAEjC;IAED,6EAA6E;IACvE,IAAI,CACN,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,kBAAkB,EAC3B,OAAO,CAAC,EAAE,uBAAuB,GAClC,OAAO,CAAC,sBAAsB,CAAC,CAEjC;IAED,iEAAiE;IAC3D,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAEvE;IAED,8FAA8F;IAC9F,KAAK,IAAI,IAAI,CAEZ;IAED,+FAA+F;IACzF,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAEjC;IAED,+EAA+E;IACzE,OAAO,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAEzC;IAED,gFAAgF;IAC1E,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAEvC;IAED,6EAA6E;IACvE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAE3B;IAED;;;OAGG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAEnC;CACJ"}
package/dist/Agent.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { agentConfig } from "./AgentConfig.js";
2
- import { AgentBase, } from "./AgentBase.js";
2
+ import { AgentBase } from "./AgentBase.js";
3
3
  import { agentDatabase, agentEffort, agentHistoryKV, agentKV, agentModel, agentPermissionMode, agentProvider, agentRunKV, agentServiceTier, withAgentKV, withAgentHistoryKV, withAgentRunKV, } from "./AgentContexts.js";
4
4
  /**
5
5
  * A thin wrapper around `AgentBase` that assembles its behavior from modules. Each module
@@ -100,12 +100,12 @@ export class Agent {
100
100
  await this.#base.waitForIdle();
101
101
  }
102
102
  /** Ask for the conversation to be replaced by the provider's summary of it. */
103
- async compact(ctx, options) {
104
- await this.#base.compact(ctx, options);
103
+ async compact(ctx) {
104
+ await this.#base.compact(ctx);
105
105
  }
106
106
  /** Cancel the active turn, leaving queued messages durable for the next one. */
107
- async abort(ctx, options) {
108
- await this.#base.abort(ctx, options);
107
+ async abort(ctx) {
108
+ await this.#base.abort(ctx);
109
109
  }
110
110
  /** Finish everything already accepted, then destroy the provider session. */
111
111
  async close() {
package/dist/Agent.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Agent.js","sourceRoot":"","sources":["../sources/Agent.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EACH,SAAS,GAIZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACH,aAAa,EACb,WAAW,EACX,cAAc,EACd,OAAO,EACP,UAAU,EACV,mBAAmB,EACnB,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,cAAc,GACjB,MAAM,oBAAoB,CAAC;AA8B5B;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,KAAK;IAId,yFAAyF;IAChF,KAAK,CAAY;IAC1B,gGAAgG;IACvF,QAAQ,CAAgD;IAEjE;;;OAGG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM,CAGjB,GAAY,EAAE,OAAqC;QACjD,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;QACzC,OAAO,IAAI,KAAK,CAAC,MAAM,SAAS,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,IAAI,CAIb,GAAY,EACZ,OAAqC,EACrC,OAAiB;QAEjB,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;QACzC,OAAO,IAAI,KAAK,CAAC,MAAM,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,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AAC,QAAQ,CAAC;IACxD,OAAO;QACH,KAAK,EAAE;YACH,EAAE,EAAE,OAAO,CAAC,EAAE;YACd,QAAQ,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE,QAAQ;YACpC,QAAQ;YACR,YAAY,EAAE,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,SAAS;YAC7D,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,KAAK;YACvC,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM;YAC1C,IAAI,EAAE,gBAAgB,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,WAAW;YAClD,cAAc,EAAE,mBAAmB,CAAC,GAAG,CAAC;SAC3C;QACD,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC;QACpC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;QACtC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC;QAC1C,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC;KACrD,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,SAAS,MAAM,CACX,GAAQ,EACR,KAAwB;IAExB,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAE,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAA4B,CAAC;AAClF,CAAC"}
@@ -35,28 +35,6 @@ export interface AgentBaseMessageOptions {
35
35
  */
36
36
  readonly permissionMode?: AgentPermissionMode;
37
37
  }
38
- /**
39
- * Whether an operation resolves once the agent has taken the request on, or once the agent has
40
- * carried it out. Every operation that asks something of an agent accepts this, and every one of
41
- * most of them default to the first: asking is the operation, and waiting is opt-in. Message
42
- * acceptance defaults to the durable result except inside the target's own loop, where waiting
43
- * would deadlock.
44
- *
45
- * The reason is re-entrancy. An agent does its work in one run loop, and while a hook or a tool
46
- * runs, that loop is waiting for it — so code in that position that waits for its own agent waits
47
- * for itself. Rather than offer some operations in a waiting form and others not, every operation
48
- * returns as soon as the request is registered, and `await: true` asks for the rest. That flag is
49
- * refused, loudly, when the caller's context says it is running inside the loop of the very agent
50
- * it is asking, which is the only case where the wait could never end.
51
- */
52
- export interface AgentBaseAwaitOptions {
53
- /**
54
- * Wait for the operation to finish rather than for it to be accepted. Message delivery uses
55
- * this to request the durable created/existing result. Refused from inside the agent's own
56
- * run loop.
57
- */
58
- readonly await?: boolean;
59
- }
60
38
  /** Everything an agent session is constructed with; only the identity and store are required. */
61
39
  export interface AgentBaseOptions {
62
40
  /** Stable session identity supplied by the caller. */
@@ -110,9 +88,8 @@ export interface AgentBaseOptions {
110
88
  * A message is accepted exactly once, or not at all. Its durable write and the writes of every
111
89
  * other message in the same batch commit in one transaction under one hold of the lock. So:
112
90
  *
113
- * - `steer` and `send` with `await: true` resolve only once the message is durable; a failed
114
- * write keeps it out of the conversation entirely. Without the flag they return early, but the
115
- * acceptance is the same one, and a close still waits for it.
91
+ * - `steer` and `send` resolve once the message is durable, except inside the target's own loop
92
+ * where waiting would deadlock. A failed write keeps it out of the conversation entirely.
116
93
  * - Messages a hook returns from one decision are accepted as one batch. A caller arriving while
117
94
  * that batch is being written lands after all of it, never between two halves of one thought.
118
95
  * - Queue keys order by what the store already holds, including when the clock moves backwards.
@@ -202,8 +179,6 @@ export interface AgentBaseOptions {
202
179
  * its own outcome adds nothing, since that response is over.
203
180
  *
204
181
  * `abort` signals and returns, because the cancellation is complete once it is signalled.
205
- * `abort(ctx, { await: true })` additionally waits for the loop to stop, which is what an owner
206
- * outside the agent usually wants and what code inside it must not ask for — see below.
207
182
  *
208
183
  * ## Close
209
184
  *
@@ -220,19 +195,11 @@ export interface AgentBaseOptions {
220
195
  * ## Re-entrancy
221
196
  *
222
197
  * A hook or a tool runs while the loop is waiting for it, so anything it asks of its own agent
223
- * that only the loop can deliver would wait for itself. Rather than leave that to be remembered
224
- * per operation, asking and waiting are separated everywhere:
225
- *
226
- * - `steer`, `send`, `abort` and `compact` are safe from anywhere in their asking form, which is
227
- * the default. Each registers what it registers and returns; the loop acts on it afterwards.
228
- * - `await: true` asks for the part only the loop can give. Contexts handed to hooks and tools
229
- * record which agents' loops the execution is inside, so the flag is refused with an error that
230
- * names the problem instead of hanging. The check is per agent: work inside one agent's loop
231
- * may still wait on another's, which is what makes a subagent's report to its parent safe.
232
- * - The refusal is uniform even where a particular wait would have happened to work. A tool that
233
- * waits for its own abort, for instance, does unwind — the batch races each execution against
234
- * cancellation — but that is a property of tool batches rather than of abort, and a rule that
235
- * holds only in one position is worse than no rule.
198
+ * that only the loop can deliver would wait for itself. Loop operations therefore have one safe
199
+ * behavior from every caller:
200
+ *
201
+ * - `steer` and `send` wait for durable acceptance except when aimed at the caller's own loop.
202
+ * - `abort` and `compact` register their request and return; the loop acts afterwards.
236
203
  * - A hook that wants a compaction has a better option than requesting one: the
237
204
  * `{ type: "compact" }` action it returns lands exactly where the loop can act on it, in order
238
205
  * with the rest of that decision.
@@ -306,7 +273,7 @@ export declare class AgentBase {
306
273
  * loop it waits for the durable created/existing result by default; a failed write rejects and
307
274
  * keeps the message out of the conversation entirely.
308
275
  */
309
- steer(ctx: Context, message: AgentQueuedMessage, options?: AgentBaseMessageOptions & AgentBaseAwaitOptions): Promise<AgentMessageAcceptance>;
276
+ steer(ctx: Context, message: AgentQueuedMessage, options?: AgentBaseMessageOptions): Promise<AgentMessageAcceptance>;
310
277
  /**
311
278
  * Queue a message that waits until the agent would otherwise stop — no tool calls or
312
279
  * steering remain — before injecting. Returns once the message has been handed to the agent,
@@ -314,7 +281,7 @@ export declare class AgentBase {
314
281
  * the target's own loop it waits for the durable created/existing result by default; a failed
315
282
  * write rejects and keeps the message out of the conversation entirely.
316
283
  */
317
- send(ctx: Context, message: AgentQueuedMessage, options?: AgentBaseMessageOptions & AgentBaseAwaitOptions): Promise<AgentMessageAcceptance>;
284
+ send(ctx: Context, message: AgentQueuedMessage, options?: AgentBaseMessageOptions): Promise<AgentMessageAcceptance>;
318
285
  /**
319
286
  * Shallow-merge fields into this agent's immutable metadata. The complete AgentConfig and
320
287
  * transactional hook writes commit together; observing hooks run only after that commit.
@@ -338,12 +305,9 @@ export declare class AgentBase {
338
305
  * away when idle — and replaces the compacted history with the provider's replacement context
339
306
  * while keeping every message that joined the history after the snapshot.
340
307
  *
341
- * Returns once the compaction has been asked for; with `await: true` it returns once the
342
- * compaction has run, rejecting when the provider reports failure or when nothing will carry
343
- * it out. Callers that wait while a compaction is pending or running all wait for that same
344
- * compaction rather than queueing another.
308
+ * Returns once the compaction has been asked for. Concurrent requests share one compaction.
345
309
  */
346
- compact(ctx: Context, options?: AgentBaseAwaitOptions): Promise<void>;
310
+ compact(ctx: Context): Promise<void>;
347
311
  /**
348
312
  * Cancel the active turn: stop consuming the inference stream, settle still-running tool calls
349
313
  * as aborted error results, and drop the queued turn request. Blocks that already finished
@@ -351,12 +315,9 @@ export declare class AgentBase {
351
315
  * and send queues stay durable and join the next requested turn. A no-op when the agent is
352
316
  * idle.
353
317
  *
354
- * Returns once the cancellation has been signalled, which is the point from which nothing
355
- * more of that turn happens; with `await: true` it returns once the loop has actually
356
- * unwound. The cancellation is identical either way — waiting only buys the answer about
357
- * when it finished.
318
+ * Returns once the cancellation has been signalled.
358
319
  */
359
- abort(ctx: Context, options?: AgentBaseAwaitOptions): Promise<void>;
320
+ abort(ctx: Context): Promise<void>;
360
321
  /**
361
322
  * Stop the agent, without abandoning anything it had already taken on. Nothing new is
362
323
  * admitted from the moment close is called, but a message accepted just before it is still
@@ -1 +1 @@
1
- {"version":3,"file":"AgentBase.d.ts","sourceRoot":"","sources":["../sources/AgentBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAMR,sBAAsB,EACtB,kBAAkB,EAKrB,MAAM,yBAAyB,CA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G;IACG,OAAO,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAczC;IAmGD;;;;;;;;OAQG;IACG,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBvC;IAgBD;;;;;;;;;;;;;;;;OAgBG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAuD3B;IAED;;;;OAIG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAInC;CA6yEJ"}
package/dist/AgentBase.js CHANGED
@@ -4,7 +4,7 @@ import { AsyncLocalStorage } from "node:async_hooks";
4
4
  import { Type } from "@sinclair/typebox";
5
5
  import { Value } from "@sinclair/typebox/value";
6
6
  import { afterCommit, createContextNamespace, detach, deterministicStringify, withLifetime, } from "@steve.kite/stdlib";
7
- import { agentDatabase, agentKV, agentStorageTransaction, withAgentContext, withAgentDatabase, withAgentHistoryKV, withAgentKV, withAgentPermissionMode, withAgentRunKV, } from "./AgentContexts.js";
7
+ import { agentDatabase, agentId as agentIdOf, agentKV, agentStorageTransaction, withAgentContext, withAgentDatabase, withAgentHistoryKV, withAgentKV, withAgentPermissionMode, withAgentRunKV, } from "./AgentContexts.js";
8
8
  import { agentConfig, ownAgentConfig, withAgentConfig } from "./AgentConfig.js";
9
9
  import { outsideAgentDatabaseOperation } from "./AgentDatabaseConnection.js";
10
10
  import { taskContextBeforeToolCall, withAgentTaskContext } from "./AgentTaskContext.js";
@@ -86,9 +86,8 @@ const storedToolResultSchema = Type.Object({
86
86
  * A message is accepted exactly once, or not at all. Its durable write and the writes of every
87
87
  * other message in the same batch commit in one transaction under one hold of the lock. So:
88
88
  *
89
- * - `steer` and `send` with `await: true` resolve only once the message is durable; a failed
90
- * write keeps it out of the conversation entirely. Without the flag they return early, but the
91
- * acceptance is the same one, and a close still waits for it.
89
+ * - `steer` and `send` resolve once the message is durable, except inside the target's own loop
90
+ * where waiting would deadlock. A failed write keeps it out of the conversation entirely.
92
91
  * - Messages a hook returns from one decision are accepted as one batch. A caller arriving while
93
92
  * that batch is being written lands after all of it, never between two halves of one thought.
94
93
  * - Queue keys order by what the store already holds, including when the clock moves backwards.
@@ -178,8 +177,6 @@ const storedToolResultSchema = Type.Object({
178
177
  * its own outcome adds nothing, since that response is over.
179
178
  *
180
179
  * `abort` signals and returns, because the cancellation is complete once it is signalled.
181
- * `abort(ctx, { await: true })` additionally waits for the loop to stop, which is what an owner
182
- * outside the agent usually wants and what code inside it must not ask for — see below.
183
180
  *
184
181
  * ## Close
185
182
  *
@@ -196,19 +193,11 @@ const storedToolResultSchema = Type.Object({
196
193
  * ## Re-entrancy
197
194
  *
198
195
  * A hook or a tool runs while the loop is waiting for it, so anything it asks of its own agent
199
- * that only the loop can deliver would wait for itself. Rather than leave that to be remembered
200
- * per operation, asking and waiting are separated everywhere:
196
+ * that only the loop can deliver would wait for itself. Loop operations therefore have one safe
197
+ * behavior from every caller:
201
198
  *
202
- * - `steer`, `send`, `abort` and `compact` are safe from anywhere in their asking form, which is
203
- * the default. Each registers what it registers and returns; the loop acts on it afterwards.
204
- * - `await: true` asks for the part only the loop can give. Contexts handed to hooks and tools
205
- * record which agents' loops the execution is inside, so the flag is refused with an error that
206
- * names the problem instead of hanging. The check is per agent: work inside one agent's loop
207
- * may still wait on another's, which is what makes a subagent's report to its parent safe.
208
- * - The refusal is uniform even where a particular wait would have happened to work. A tool that
209
- * waits for its own abort, for instance, does unwind — the batch races each execution against
210
- * cancellation — but that is a property of tool batches rather than of abort, and a rule that
211
- * holds only in one position is worse than no rule.
199
+ * - `steer` and `send` wait for durable acceptance except when aimed at the caller's own loop.
200
+ * - `abort` and `compact` register their request and return; the loop acts afterwards.
212
201
  * - A hook that wants a compaction has a better option than requesting one: the
213
202
  * `{ type: "compact" }` action it returns lands exactly where the loop can act on it, in order
214
203
  * with the rest of that decision.
@@ -759,7 +748,6 @@ export class AgentBase {
759
748
  * transactional hook writes commit together; observing hooks run only after that commit.
760
749
  */
761
750
  async updateMetadata(ctx, update) {
762
- this.#assertOutsideStorageTransaction(ctx, "metadata update");
763
751
  const ownedUpdate = ownAgentMetadata(update);
764
752
  if (ownedUpdate === undefined)
765
753
  throw new Error("The agent metadata is not valid.");
@@ -797,7 +785,16 @@ export class AgentBase {
797
785
  });
798
786
  });
799
787
  });
800
- await this.#invokeHookOn(this.#hookContext(withAgentConfig(ctx, next)), this.#hooks.metadataChanged, change);
788
+ if (agentStorageTransaction(ctx) === undefined) {
789
+ await this.#invokeHookOn(this.#hookContext(withAgentConfig(ctx, next)), this.#hooks.metadataChanged, change);
790
+ }
791
+ else {
792
+ afterCommit(ctx, () => {
793
+ outsideAgentDatabaseOperation(() => {
794
+ void this.#invokeHookOn(this.#hookContext(withAgentConfig(this.#ctx, next)), this.#hooks.metadataChanged, change);
795
+ });
796
+ });
797
+ }
801
798
  }
802
799
  /**
803
800
  * Hand one message to a durable queue. The acceptance runs whether or not the caller waits
@@ -809,15 +806,12 @@ export class AgentBase {
809
806
  if (outerTransaction?.lifetime.aborted === true) {
810
807
  throw new Error("The agent storage transaction carried by this context has ended.");
811
808
  }
812
- const { await: requestedWait, id = createId(), metadata: suppliedMetadata, ...settings } = options ?? {};
809
+ const { id = createId(), metadata: suppliedMetadata, ...settings } = options ?? {};
813
810
  if (!Value.Check(cuid2Schema, id)) {
814
811
  throw new Error("The message ID must be a cuid2 identity.");
815
812
  }
816
- const wait = requestedWait ?? !insideTurn.get(ctx).includes(this.id);
813
+ const wait = agentIdOf(ctx) !== this.id && !insideTurn.get(ctx).includes(this.id);
817
814
  const metadata = ownAgentMessageMetadata(suppliedMetadata);
818
- // Refusing the flag rather than the operation: a closed agent and a re-entrant wait are
819
- // both caller mistakes, and both are reported before any work is started.
820
- this.#assertCanWait(ctx, wait, kind === "steering" ? "a steered message" : "a sent message");
821
815
  if (this.#closed)
822
816
  throw new Error("The agent has been closed.");
823
817
  const knownInProcess = this.#offeredMessageIds.has(id);
@@ -867,19 +861,6 @@ export class AgentBase {
867
861
  accepted: knownInProcess ? "existing" : "created",
868
862
  };
869
863
  }
870
- /**
871
- * Refuse a wait that could never end. A hook or a tool runs while its agent's loop waits for
872
- * it, so waiting for that same agent to finish anything is waiting for oneself; the request
873
- * itself is always allowed, and asking for another agent is unaffected.
874
- */
875
- #assertCanWait(ctx, wait, operation) {
876
- if (!wait)
877
- return;
878
- if (!insideTurn.get(ctx).includes(this.id))
879
- return;
880
- throw new Error(`Waiting for ${operation} from inside the agent's own run loop would wait for a ` +
881
- "turn that cannot finish. Drop `await: true` to ask for it and return.");
882
- }
883
864
  /**
884
865
  * Whether the current execution is running inside this agent's own run loop, judged by the
885
866
  * scope the loop marks itself with. This is what an operation carrying no context has to go
@@ -890,12 +871,6 @@ export class AgentBase {
890
871
  #insideOwnLoop() {
891
872
  return insideLoops.getStore()?.includes(this.id) === true;
892
873
  }
893
- /** Live agent commands cannot be staged or undone by an enclosing database transaction. */
894
- #assertOutsideStorageTransaction(ctx, operation) {
895
- if (agentStorageTransaction(ctx) !== undefined) {
896
- throw new Error(`Agent ${operation} cannot run from inside an outer storage transaction.`);
897
- }
898
- }
899
874
  /** Run one persistence step; its database statements and transactions own consistency. */
900
875
  async #runPersistenceStep(ctx, work) {
901
876
  return await work(ctx);
@@ -1163,33 +1138,22 @@ export class AgentBase {
1163
1138
  * away when idle — and replaces the compacted history with the provider's replacement context
1164
1139
  * while keeping every message that joined the history after the snapshot.
1165
1140
  *
1166
- * Returns once the compaction has been asked for; with `await: true` it returns once the
1167
- * compaction has run, rejecting when the provider reports failure or when nothing will carry
1168
- * it out. Callers that wait while a compaction is pending or running all wait for that same
1169
- * compaction rather than queueing another.
1170
- */
1171
- async compact(ctx, options) {
1172
- this.#assertOutsideStorageTransaction(ctx, "compaction");
1173
- const wait = options?.await ?? false;
1174
- this.#assertCanWait(ctx, wait, "a compaction");
1141
+ * Returns once the compaction has been asked for. Concurrent requests share one compaction.
1142
+ */
1143
+ async compact(ctx) {
1175
1144
  if (this.#closed)
1176
1145
  throw new Error("The agent has been closed.");
1177
- // A compaction runs between turns, so waiting for one waits for the target's current
1178
- // turn to end. That is safe from an ordinary caller, and safe from another agent going
1179
- // about its own business. It is not safe from inside a turn while the target is running
1180
- // a tool: that tool may be waiting for this caller's agent, and neither side can see the
1181
- // other half of the cycle. Such a request is refused outright rather than left standing,
1182
- // because the caller asked to be told when the conversation had been replaced — and a
1183
- // replacement carried out later, once nobody is waiting for it, is a different thing
1184
- // from what was asked for. Ask again from a caller that can wait, or without the wait.
1185
- if (wait && this.#toolsRunning > 0 && insideTurn.get(ctx).length > 0) {
1186
- throw new Error(`Agent ${JSON.stringify(this.id)} is running a tool, so a compaction cannot be ` +
1187
- "waited for from inside another agent's turn: the two could be waiting for " +
1188
- "each other. Ask for it without `await: true`, or from outside a turn.");
1146
+ if (agentStorageTransaction(ctx) !== undefined) {
1147
+ afterCommit(ctx, () => {
1148
+ outsideAgentDatabaseOperation(() => {
1149
+ void this.compact(this.#ctx).catch((error) => {
1150
+ this.#ctx.log.warn("The committed agent compaction failed.", error);
1151
+ });
1152
+ });
1153
+ });
1154
+ return;
1189
1155
  }
1190
1156
  const compaction = this.#ensureCompaction();
1191
- if (wait)
1192
- return compaction;
1193
1157
  compaction.catch(() => undefined);
1194
1158
  }
1195
1159
  /**
@@ -1289,15 +1253,19 @@ export class AgentBase {
1289
1253
  * and send queues stay durable and join the next requested turn. A no-op when the agent is
1290
1254
  * idle.
1291
1255
  *
1292
- * Returns once the cancellation has been signalled, which is the point from which nothing
1293
- * more of that turn happens; with `await: true` it returns once the loop has actually
1294
- * unwound. The cancellation is identical either way — waiting only buys the answer about
1295
- * when it finished.
1296
- */
1297
- async abort(ctx, options) {
1298
- this.#assertOutsideStorageTransaction(ctx, "abort");
1299
- const wait = options?.await ?? false;
1300
- this.#assertCanWait(ctx, wait, "an abort");
1256
+ * Returns once the cancellation has been signalled.
1257
+ */
1258
+ async abort(ctx) {
1259
+ if (agentStorageTransaction(ctx) !== undefined) {
1260
+ afterCommit(ctx, () => {
1261
+ outsideAgentDatabaseOperation(() => {
1262
+ void this.abort(this.#ctx).catch((error) => {
1263
+ this.#ctx.log.warn("The committed agent abort failed.", error);
1264
+ });
1265
+ });
1266
+ });
1267
+ return;
1268
+ }
1301
1269
  const run = this.#signalAbort();
1302
1270
  if (run === undefined)
1303
1271
  return;
@@ -1305,11 +1273,6 @@ export class AgentBase {
1305
1273
  // compaction asked for during it, so its callers are told rather than left waiting for
1306
1274
  // a turn that will never come. That happens once the loop has stopped, whether or not
1307
1275
  // anyone here is waiting to see it.
1308
- if (wait) {
1309
- await run;
1310
- this.#settlePendingCompaction("The compaction was cancelled by an abort.");
1311
- return;
1312
- }
1313
1276
  void run
1314
1277
  .catch(() => undefined)
1315
1278
  .then(() => {