@slopus/happy-agent-base 0.0.17 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +20 -0
  2. package/dist/Agent.d.ts +3 -1
  3. package/dist/Agent.d.ts.map +1 -1
  4. package/dist/Agent.js +5 -2
  5. package/dist/Agent.js.map +1 -1
  6. package/dist/AgentBase.d.ts +13 -7
  7. package/dist/AgentBase.d.ts.map +1 -1
  8. package/dist/AgentBase.js +291 -149
  9. package/dist/AgentBase.js.map +1 -1
  10. package/dist/AgentBaseHooks.d.ts +21 -2
  11. package/dist/AgentBaseHooks.d.ts.map +1 -1
  12. package/dist/AgentDatabase.d.ts.map +1 -1
  13. package/dist/AgentDatabase.js +27 -14
  14. package/dist/AgentDatabase.js.map +1 -1
  15. package/dist/AgentDatabaseConnection.d.ts +39 -0
  16. package/dist/AgentDatabaseConnection.d.ts.map +1 -0
  17. package/dist/AgentDatabaseConnection.js +199 -0
  18. package/dist/AgentDatabaseConnection.js.map +1 -0
  19. package/dist/AgentModule.d.ts +7 -1
  20. package/dist/AgentModule.d.ts.map +1 -1
  21. package/dist/AgentPersistence.d.ts +4 -4
  22. package/dist/AgentRef.d.ts +1 -1
  23. package/dist/AgentRef.js +1 -1
  24. package/dist/AgentSpanAttributes.d.ts +11 -0
  25. package/dist/AgentSpanAttributes.d.ts.map +1 -0
  26. package/dist/AgentSpanAttributes.js +11 -0
  27. package/dist/AgentSpanAttributes.js.map +1 -0
  28. package/dist/AgentStorage.d.ts.map +1 -1
  29. package/dist/AgentStorage.js +2 -0
  30. package/dist/AgentStorage.js.map +1 -1
  31. package/dist/AgentSystemLocal.d.ts.map +1 -1
  32. package/dist/AgentSystemLocal.js +53 -30
  33. package/dist/AgentSystemLocal.js.map +1 -1
  34. package/dist/inTx.d.ts +0 -7
  35. package/dist/inTx.d.ts.map +1 -1
  36. package/dist/inTx.js +9 -16
  37. package/dist/inTx.js.map +1 -1
  38. package/dist/index.d.ts +5 -1
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +4 -0
  41. package/dist/index.js.map +1 -1
  42. package/dist/openAgentPGliteDatabase.d.ts +10 -0
  43. package/dist/openAgentPGliteDatabase.d.ts.map +1 -0
  44. package/dist/openAgentPGliteDatabase.js +17 -0
  45. package/dist/openAgentPGliteDatabase.js.map +1 -0
  46. package/dist/openAgentPostgresDatabase.d.ts +13 -0
  47. package/dist/openAgentPostgresDatabase.d.ts.map +1 -0
  48. package/dist/openAgentPostgresDatabase.js +10 -0
  49. package/dist/openAgentPostgresDatabase.js.map +1 -0
  50. package/dist/openAgentSQLiteDatabase.d.ts +6 -0
  51. package/dist/openAgentSQLiteDatabase.d.ts.map +1 -0
  52. package/dist/openAgentSQLiteDatabase.js +48 -0
  53. package/dist/openAgentSQLiteDatabase.js.map +1 -0
  54. package/package.json +6 -4
@@ -1 +1 @@
1
- {"version":3,"file":"AgentDatabase.js","sourceRoot":"","sources":["../sources/AgentDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAY,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AA8C7D,qEAAqE;AACrE,MAAM,UAAU,qBAAqB,CAAC,QAAuB;IACzD,OAAO,EAAE,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;AAC5C,CAAC;AAED,wEAAwE;AACxE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACnC,QAAuB,EACvB,KAAU;IAEV,IAAI,qBAAqB,CAAC,QAAQ,CAAC,EAAE,CAAC;QAClC,OAAO,MAAM,QAAQ,CAAC,GAAG,CAAM,KAAK,CAAC,CAAC;IAC1C,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC7C,IAAI,KAAK,CAAC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
2
+ /**
3
+ * One lifecycle owner for an Agent Base database.
4
+ *
5
+ * Root statements, root transactions, and close enter the same FIFO. Statements using the active
6
+ * transaction facade execute directly because that transaction already owns the database slot.
7
+ */
8
+ export declare class AgentDatabaseConnection<Database extends AgentDatabase = AgentDatabase> {
9
+ #private;
10
+ readonly database: Database;
11
+ constructor(database: Database, closeDatabase: () => void | Promise<void>);
12
+ /**
13
+ * Run one database-owned step against the root FIFO, or directly when the current call chain
14
+ * already owns this connection through a root step or transaction.
15
+ */
16
+ operation<Result>(database: AgentDatabaseFacade<Database>, work: () => Promise<Result>): Promise<Result>;
17
+ /**
18
+ * Hold the root FIFO through commit and its in-process publication. A transaction opened
19
+ * inside an existing database-owned step reuses that step instead of queuing behind itself.
20
+ */
21
+ transaction<Result>(work: (database: AgentDatabaseFacade<Database>) => Promise<Result>, committed?: () => Promise<void>): Promise<Result>;
22
+ /** Reject new work, drain admitted work, and close the owned driver exactly once. */
23
+ close(): Promise<void>;
24
+ }
25
+ /** Find the owner of a root or transaction facade. */
26
+ export declare function agentDatabaseConnection(database: AgentDatabase): AgentDatabaseConnection | undefined;
27
+ /**
28
+ * Give an externally opened database the standard Agent Base scheduling boundary.
29
+ *
30
+ * Production hosts should prefer one of the concrete openers, which also owns driver close.
31
+ */
32
+ export declare function ensureAgentDatabaseConnection<Database extends AgentDatabase>(database: Database): AgentDatabaseConnection<Database>;
33
+ /** Open a root transaction through its owner, or directly for an unowned test facade. */
34
+ export declare function agentDatabaseTransaction<Result>(database: AgentDatabase, work: (database: AgentDatabase) => Promise<Result>, committed?: () => Promise<void>): Promise<Result>;
35
+ /** Run one complete persistence step through the database owner's ordering boundary. */
36
+ export declare function agentDatabaseOperation<Result>(database: AgentDatabase, work: () => Promise<Result>): Promise<Result>;
37
+ /** Start an independent lifetime without inheriting a caller's temporary database ownership. */
38
+ export declare function outsideAgentDatabaseOperation<Result>(work: () => Result): Result;
39
+ //# sourceMappingURL=AgentDatabaseConnection.d.ts.map
@@ -0,0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EAClD,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAChC,OAAO,CAAC,MAAM,CAAC,CAUjB;AAED,wFAAwF;AACxF,wBAAsB,sBAAsB,CAAC,MAAM,EAC/C,QAAQ,EAAE,aAAa,EACvB,IAAI,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,GAC5B,OAAO,CAAC,MAAM,CAAC,CAIjB;AAED,gGAAgG;AAChG,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,MAAM,GAAG,MAAM,CAEhF"}
@@ -0,0 +1,199 @@
1
+ import { AsyncLocalStorage } from "node:async_hooks";
2
+ const roots = new WeakMap();
3
+ const transactions = new WeakMap();
4
+ const activeTransaction = new AsyncLocalStorage();
5
+ const activeRootOperation = new AsyncLocalStorage();
6
+ /**
7
+ * One lifecycle owner for an Agent Base database.
8
+ *
9
+ * Root statements, root transactions, and close enter the same FIFO. Statements using the active
10
+ * transaction facade execute directly because that transaction already owns the database slot.
11
+ */
12
+ export class AgentDatabaseConnection {
13
+ database;
14
+ #closeDatabase;
15
+ #available = Promise.resolve();
16
+ #closePromise;
17
+ #state = "open";
18
+ constructor(database, closeDatabase) {
19
+ if (roots.has(database)) {
20
+ throw new Error("The Agent Database already has a lifecycle owner.");
21
+ }
22
+ this.database = database;
23
+ this.#closeDatabase = closeDatabase;
24
+ roots.set(database, this);
25
+ }
26
+ /**
27
+ * Run one database-owned step against the root FIFO, or directly when the current call chain
28
+ * already owns this connection through a root step or transaction.
29
+ */
30
+ async operation(database, work) {
31
+ const transaction = transactions.get(database);
32
+ if (transaction !== undefined) {
33
+ if (!transaction.active) {
34
+ throw new Error("The Agent Database transaction has ended.");
35
+ }
36
+ if (transaction.connection !== this) {
37
+ throw new Error("The Agent Database transaction belongs to another connection.");
38
+ }
39
+ return await work();
40
+ }
41
+ if (database !== this.database) {
42
+ throw new Error("The Agent Database operation uses an unknown facade.");
43
+ }
44
+ const ambient = activeTransaction.getStore();
45
+ if (ambient?.active === true && ambient.connection === this) {
46
+ throw new Error("Work inside an Agent Database transaction must use its transaction facade.");
47
+ }
48
+ const rootOperation = activeRootOperation.getStore();
49
+ if (rootOperation?.active === true && rootOperation.connection === this) {
50
+ return await work();
51
+ }
52
+ return await this.#admit(async () => {
53
+ const state = {
54
+ connection: this,
55
+ active: true,
56
+ };
57
+ try {
58
+ return await activeRootOperation.run(state, work);
59
+ }
60
+ finally {
61
+ state.active = false;
62
+ }
63
+ });
64
+ }
65
+ /**
66
+ * Hold the root FIFO through commit and its in-process publication. A transaction opened
67
+ * inside an existing database-owned step reuses that step instead of queuing behind itself.
68
+ */
69
+ async transaction(work, committed) {
70
+ const ambient = activeTransaction.getStore();
71
+ if (ambient?.active === true && ambient.connection === this) {
72
+ throw new Error("Nested Agent Database work must reuse the active transaction facade.");
73
+ }
74
+ const run = async () => {
75
+ const result = await runRootTransaction(this.database, async (database) => {
76
+ const state = {
77
+ connection: this,
78
+ active: true,
79
+ };
80
+ transactions.set(database, state);
81
+ try {
82
+ return await activeTransaction.run(state, async () => {
83
+ return await work(database);
84
+ });
85
+ }
86
+ finally {
87
+ state.active = false;
88
+ }
89
+ });
90
+ await committed?.();
91
+ return result;
92
+ };
93
+ const rootOperation = activeRootOperation.getStore();
94
+ if (rootOperation?.active === true && rootOperation.connection === this) {
95
+ return await run();
96
+ }
97
+ return await this.#admit(async () => {
98
+ const state = {
99
+ connection: this,
100
+ active: true,
101
+ };
102
+ try {
103
+ return await activeRootOperation.run(state, run);
104
+ }
105
+ finally {
106
+ state.active = false;
107
+ }
108
+ });
109
+ }
110
+ /** Reject new work, drain admitted work, and close the owned driver exactly once. */
111
+ async close() {
112
+ const transaction = activeTransaction.getStore();
113
+ const rootOperation = activeRootOperation.getStore();
114
+ if ((transaction?.active === true && transaction.connection === this) ||
115
+ (rootOperation?.active === true && rootOperation.connection === this)) {
116
+ throw new Error("An Agent Database operation cannot close its own connection.");
117
+ }
118
+ if (this.#closePromise !== undefined)
119
+ return await this.#closePromise;
120
+ if (this.#state === "closed")
121
+ return;
122
+ this.#state = "closing";
123
+ const closing = this.#enqueue(async () => {
124
+ try {
125
+ await this.#closeDatabase();
126
+ }
127
+ finally {
128
+ this.#state = "closed";
129
+ }
130
+ });
131
+ this.#closePromise = closing;
132
+ await closing;
133
+ }
134
+ async #admit(work) {
135
+ if (this.#state !== "open") {
136
+ throw new Error(`The Agent Database connection is ${this.#state}.`);
137
+ }
138
+ return await this.#enqueue(work);
139
+ }
140
+ async #enqueue(work) {
141
+ const previous = this.#available;
142
+ let release;
143
+ this.#available = new Promise((resolve) => {
144
+ release = resolve;
145
+ });
146
+ await previous;
147
+ try {
148
+ return await work();
149
+ }
150
+ finally {
151
+ release();
152
+ }
153
+ }
154
+ }
155
+ /** Find the owner of a root or transaction facade. */
156
+ export function agentDatabaseConnection(database) {
157
+ return roots.get(database) ?? transactions.get(database)?.connection;
158
+ }
159
+ /**
160
+ * Give an externally opened database the standard Agent Base scheduling boundary.
161
+ *
162
+ * Production hosts should prefer one of the concrete openers, which also owns driver close.
163
+ */
164
+ export function ensureAgentDatabaseConnection(database) {
165
+ const existing = roots.get(database);
166
+ if (existing !== undefined)
167
+ return existing;
168
+ return new AgentDatabaseConnection(database, () => undefined);
169
+ }
170
+ /** Open a root transaction through its owner, or directly for an unowned test facade. */
171
+ export async function agentDatabaseTransaction(database, work, committed) {
172
+ const connection = agentDatabaseConnection(database);
173
+ if (connection !== undefined && connection.database === database) {
174
+ return await connection.transaction(async (transaction) => {
175
+ return await work(transaction);
176
+ }, committed);
177
+ }
178
+ const result = await runRootTransaction(database, work);
179
+ await committed?.();
180
+ return result;
181
+ }
182
+ /** Run one complete persistence step through the database owner's ordering boundary. */
183
+ export async function agentDatabaseOperation(database, work) {
184
+ const connection = agentDatabaseConnection(database);
185
+ if (connection === undefined)
186
+ return await work();
187
+ return await connection.operation(database, work);
188
+ }
189
+ /** Start an independent lifetime without inheriting a caller's temporary database ownership. */
190
+ export function outsideAgentDatabaseOperation(work) {
191
+ return activeRootOperation.exit(work);
192
+ }
193
+ async function runRootTransaction(database, work) {
194
+ // Both supported Drizzle families expose the same callback transaction shape, but TypeScript
195
+ // cannot invoke the union of their generic overloads without erasing that one internal call.
196
+ const transaction = database.transaction.bind(database);
197
+ return await transaction(work);
198
+ }
199
+ //# sourceMappingURL=AgentDatabaseConnection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentDatabaseConnection.js","sourceRoot":"","sources":["../sources/AgentDatabaseConnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAgBrD,MAAM,KAAK,GAAG,IAAI,OAAO,EAAmC,CAAC;AAC7D,MAAM,YAAY,GAAG,IAAI,OAAO,EAAyC,CAAC;AAC1E,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,EAAiC,CAAC;AACjF,MAAM,mBAAmB,GAAG,IAAI,iBAAiB,EAAmC,CAAC;AAErF;;;;;GAKG;AACH,MAAM,OAAO,uBAAuB;IACvB,QAAQ,CAAW;IACnB,cAAc,CAA6B;IACpD,UAAU,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;IAC9C,aAAa,CAA4B;IACzC,MAAM,GAAiC,MAAM,CAAC;IAE9C,YAAY,QAAkB,EAAE,aAAyC;QACrE,IAAI,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACzE,CAAC;QACD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,SAAS,CACX,QAAuC,EACvC,IAA2B;QAE3B,MAAM,WAAW,GAAG,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC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WAAW,EAAE,EAAE;YACtD,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,CAAC;QACnC,CAAC,EAAE,SAAS,CAAC,CAAC;IAClB,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACxD,MAAM,SAAS,EAAE,EAAE,CAAC;IACpB,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,wFAAwF;AACxF,MAAM,CAAC,KAAK,UAAU,sBAAsB,CACxC,QAAuB,EACvB,IAA2B;IAE3B,MAAM,UAAU,GAAG,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IACrD,IAAI,UAAU,KAAK,SAAS;QAAE,OAAO,MAAM,IAAI,EAAE,CAAC;IAClD,OAAO,MAAM,UAAU,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACtD,CAAC;AAED,gGAAgG;AAChG,MAAM,UAAU,6BAA6B,CAAS,IAAkB;IACpE,OAAO,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1C,CAAC;AAED,KAAK,UAAU,kBAAkB,CAC7B,QAAuB,EACvB,IAAkD;IAElD,6FAA6F;IAC7F,6FAA6F;IAC7F,MAAM,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAElC,CAAC;IACrB,OAAO,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import type { ProviderModelCompatibilityType, SessionEvent, SessionReasoningEffort, SessionServiceTier, SessionSystemMessage, SessionToolCallBlock, SessionToolResultMessage } from "@slopus/happy-providers";
2
2
  import type { Context } from "@steve.kite/stdlib";
3
3
  import type { AgentDatabase, AgentModuleMigration } from "./AgentDatabase.js";
4
- import type { AgentBaseAcceptedMessage, AgentBaseCompaction, AgentBaseCompactionStart, AgentBaseCompletedCompaction, AgentBaseInference, AgentBaseInferenceStart, AgentBaseLoop, AgentBaseModelChange, AgentBasePermissionModeChange, AgentBasePersistedEvent, AgentBaseToolCall, AgentBaseToolCallDecision, AgentBaseToolOutcome, AgentBaseSettlement, AgentBaseTurn, AgentBaseTurnStart, MaybePromise } from "./AgentBaseHooks.js";
4
+ import type { AgentBaseAcceptedMessage, AgentBaseActivation, AgentBaseCompaction, AgentBaseCompactionStart, AgentBaseCompletedCompaction, AgentBaseInference, AgentBaseInferenceStart, AgentBaseLoop, AgentBaseModelChange, AgentBasePermissionModeChange, AgentBasePersistedEvent, AgentBaseToolCall, AgentBaseToolCallDecision, AgentBaseToolOutcome, AgentBaseSettlement, AgentBaseTurn, AgentBaseTurnStart, MaybePromise } from "./AgentBaseHooks.js";
5
5
  import type { AgentModuleAction } from "./AgentModuleAction.js";
6
6
  import type { AgentKV } from "./AgentKV.js";
7
7
  import type { AgentMetadata, AgentMetadataChange } from "./AgentMetadata.js";
@@ -194,6 +194,12 @@ export interface AgentModuleHooks<Tool extends AnyAgentTool = AnyAgentTool, Data
194
194
  readonly metadataChangedTransact?: (ctx: Context, scope: AgentModuleScope<Database>, change: AgentMetadataChange) => MaybePromise<void>;
195
195
  /** Observes the complete merged agent metadata after it commits. */
196
196
  readonly metadataChanged?: (ctx: Context, scope: AgentModuleScope<Database>, change: AgentMetadataChange) => MaybePromise<void>;
197
+ /**
198
+ * Runs inside the transaction that makes a settled agent owe work again: scheduling a
199
+ * message activates it, and a restart reactivates one that still owed work, with `restored`
200
+ * true. Modules run in array order and a failure propagates, rolling the activation back.
201
+ */
202
+ readonly afterAgentActivatedTransact?: (ctx: Context, scope: AgentModuleScope<Database>, activation: AgentBaseActivation) => MaybePromise<void>;
197
203
  /** Transactional counterpart to `beforeAgentLoop`. */
198
204
  readonly beforeAgentLoopTransact?: (ctx: Context, scope: AgentModuleScope<Database>, loop: AgentBaseLoop) => MaybePromise<void>;
199
205
  /** Called when the loop leaves the settled state and begins working. */
@@ -1 +1 @@
1
- {"version":3,"file":"AgentModule.d.ts","sourceRoot":"","sources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Q,CAAC,iBAAiB,CAAC,EAAE,CACzB,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,gBAAgB,CAAC,QAAQ,CAAC,EACjC,UAAU,EAAE,mBAAmB,KAC9B,YAAY,CAAC,IAAI,CAAC,CAAC;CAC3B"}
@@ -35,10 +35,10 @@ export type AgentRecord = {
35
35
  * it reaches the main store only when a turn consumes it into the context, and its pending key
36
36
  * is deleted at that moment. A `message.` uniqueness key makes retrying a cuid2 message ID an
37
37
  * ignored database conflict; history replacement removes keys for the records it deletes.
38
- * Exactly one owner connects to a store, and the agent serializes its own record and bookkeeping
39
- * writes through one lock, so history order always matches storage order. Key-value operations —
40
- * a module's or a tool's — run as they come, so each one has to be atomic on its own, but no
41
- * implementation ever has to defend against a second owner.
38
+ * Exactly one owner connects to a store. Transactions, uniqueness constraints, and ordered keys
39
+ * keep history order aligned with storage order. Key-value operations — a module's or a tool's —
40
+ * run as they come, so each one has to be atomic on its own, but no implementation ever has to
41
+ * defend against a second owner.
42
42
  */
43
43
  export interface AgentPersistence {
44
44
  /** The root Drizzle facade for this store. */
@@ -8,7 +8,7 @@ import type { AgentMessageAcceptance } from "./AgentMessageAcceptance.js";
8
8
  import type { AnyAgentTool } from "./AgentTool.js";
9
9
  /**
10
10
  * Whether this caller may be told that `agentId` durably accepted a message. Acceptance is a
11
- * queue write under that agent's own persistence lock, so waiting for it is safe from anywhere
11
+ * queue write through that agent's database transaction, so waiting for it is safe from anywhere
12
12
  * except inside that agent's loop, which is holding the lock the write needs. A caller naming no
13
13
  * agent is an external host and may wait; only the target agent itself cannot.
14
14
  */
package/dist/AgentRef.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { agentId } from "./AgentContexts.js";
2
2
  /**
3
3
  * Whether this caller may be told that `agentId` durably accepted a message. Acceptance is a
4
- * queue write under that agent's own persistence lock, so waiting for it is safe from anywhere
4
+ * queue write through that agent's database transaction, so waiting for it is safe from anywhere
5
5
  * except inside that agent's loop, which is holding the lock the write needs. A caller naming no
6
6
  * agent is an external host and may wait; only the target agent itself cannot.
7
7
  */
@@ -0,0 +1,11 @@
1
+ import { type Context } from "@steve.kite/stdlib";
2
+ /** Values that OpenTelemetry accepts as one span attribute. */
3
+ export type AgentSpanAttributeValue = string | number | boolean | readonly (string | number | boolean)[];
4
+ /** Attributes Agent Base adds to the span currently carried by a context. */
5
+ export type AgentSpanAttributes = Readonly<Record<string, AgentSpanAttributeValue>>;
6
+ /**
7
+ * Add attributes when the installed tracer supports them. Stdlib tracing deliberately has a
8
+ * minimal common span contract, so tracers that only record nesting remain fully supported.
9
+ */
10
+ export declare function setAgentSpanAttributes(ctx: Context, attributes: AgentSpanAttributes): void;
11
+ //# sourceMappingURL=AgentSpanAttributes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentSpanAttributes.d.ts","sourceRoot":"","sources":["../sources/AgentSpanAttributes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7D,+DAA+D;AAC/D,MAAM,MAAM,uBAAuB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC;AAEzG,6EAA6E;AAC7E,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC,CAAC;AAEpF;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,mBAAmB,GAAG,IAAI,CAK1F"}
@@ -0,0 +1,11 @@
1
+ import { traceSpan } from "@steve.kite/stdlib";
2
+ /**
3
+ * Add attributes when the installed tracer supports them. Stdlib tracing deliberately has a
4
+ * minimal common span contract, so tracers that only record nesting remain fully supported.
5
+ */
6
+ export function setAgentSpanAttributes(ctx, attributes) {
7
+ const span = traceSpan.get(ctx);
8
+ if (typeof span?.setAttributes === "function")
9
+ span.setAttributes(attributes);
10
+ }
11
+ //# sourceMappingURL=AgentSpanAttributes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentSpanAttributes.js","sourceRoot":"","sources":["../sources/AgentSpanAttributes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgB,MAAM,oBAAoB,CAAC;AAQ7D;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,GAAY,EAAE,UAA+B;IAChF,MAAM,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,CAEf,CAAC;IAChB,IAAI,OAAO,IAAI,EAAE,aAAa,KAAK,UAAU;QAAE,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;AAClF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"AgentStorage.d.ts","sourceRoot":"","sources":["../sources/AgentStorage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAGH,KAAK,aAAa,EAClB,KAAK,mBAAmB,EAE3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC7B,kFAAkF;IAClF,OAAO,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxC;AAED,UAAU,yBAAyB;IAC/B;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACrE;AAED,6BAA6B;AAC7B,MAAM,MAAM,mBAAmB,CAAC,QAAQ,SAAS,aAAa,G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,OAAO,EAAE,SAAS,WAAW,CAAC,YAAY,EAAE,QAAQ,CAAC,EAAE,GACxD,OAAO,CAAC,IAAI,CAAC,CA6Cf;CAgDJ"}
@@ -1,5 +1,6 @@
1
1
  import { sql } from "drizzle-orm";
2
2
  import { agentDatabaseRows, agentDatabaseRun, } from "./AgentDatabase.js";
3
+ import { ensureAgentDatabaseConnection } from "./AgentDatabaseConnection.js";
3
4
  import { AgentKV } from "./AgentKV.js";
4
5
  import { AgentPersistenceDrizzle } from "./AgentPersistenceDrizzle.js";
5
6
  /** Storage roots and Drizzle persistence shared by an `AgentSystemLocal` collection. */
@@ -19,6 +20,7 @@ export class AgentStorage {
19
20
  constructor(options) {
20
21
  this.#acquireLock = options.acquireLock;
21
22
  this.database = options.database;
23
+ ensureAgentDatabaseConnection(options.database);
22
24
  const integration = {
23
25
  database: options.database,
24
26
  };
@@ -1 +1 @@
1
- {"version":3,"file":"AgentStorage.js","sourceRoot":"","sources":["../sources/AgentStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAGlC,OAAO,EACH,iBAAiB,EACjB,gBAAgB,GAInB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AA0BvE,wFAAwF;AACxF,MAAM,OAAO,YAAY;IACrB,+BAA+B;IACtB,QAAQ,CAAW;IAC5B,mEAAmE;IAC1D,EAAE,CAAU;IACrB,kEAAkE;IACzD,YAAY,CAA8C;IACnE,2DAA2D;IAClD,YAAY,CAAwC;IAC7D,+EAA+E;IACtE,QAAQ,CAAoC;IACrD,wEAAwE;IACxE,MAAM,GAAG,KAAK,CAAC;IAEf,YAAY,OAAsC;QAC9C,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;QACxC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAA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/stdlib";
5
5
  import { Agent } from "./Agent.js";
6
6
  import {} from "./AgentBase.js";
7
7
  import { agentDatabase, agentId as agentIdOf, agentStorageTransaction, withAgentDatabase, withAgentKV, } from "./AgentContexts.js";
8
- import { escapeAgentStorageTransaction } from "./inTx.js";
8
+ import { outsideAgentDatabaseOperation } from "./AgentDatabaseConnection.js";
9
9
  import { agentConfigSchema, ownAgentConfig, withAgentConfig, } from "./AgentConfig.js";
10
10
  import { cuid2Schema, ownAgentMetadata } from "./AgentMetadata.js";
11
11
  import { withAgentSystem } from "./AgentSystemContext.js";
@@ -60,6 +60,8 @@ export class AgentSystemLocal {
60
60
  #sharedModuleKV;
61
61
  /** The live `Agent` instances this process has built, keyed by identity. */
62
62
  #agents = new Map();
63
+ /** Unpublished agents built once per transaction for delivery to an unloaded target. */
64
+ #transactionAgents = new WeakMap();
63
65
  // One agent has one store for the life of the collection, so inspecting an agent's durable
64
66
  // work and running that agent never end up looking at two different stores.
65
67
  #persistences = new Map();
@@ -396,9 +398,16 @@ export class AgentSystemLocal {
396
398
  if (config === undefined) {
397
399
  throw new Error(`Agent "${agentId}" has not been created.`);
398
400
  }
399
- const agent = await this.#instantiate(agentId, config);
401
+ const published = this.#agents.get(agentId);
402
+ if (published !== undefined)
403
+ return published;
404
+ const agent = await this.#instantiate(agentId, config, false, false, undefined, false);
400
405
  if (agent === undefined)
401
406
  throw new Error(`Agent "${agentId}" could not be built.`);
407
+ const concurrent = this.#agents.get(agentId);
408
+ if (concurrent !== undefined)
409
+ return concurrent;
410
+ this.#publish(agent, true);
402
411
  return agent;
403
412
  });
404
413
  }
@@ -406,7 +415,7 @@ export class AgentSystemLocal {
406
415
  * Build one agent and put it to work. Called with the agent's lock held, and only for an ID
407
416
  * that has no live instance yet.
408
417
  */
409
- async #instantiate(agentId, config, onlyIfActive = false, start = true) {
418
+ async #instantiate(agentId, config, onlyIfActive = false, start = true, loadCtx, publish = true) {
410
419
  // An agent outlives whatever asked for it — a restart bringing the collection up, an HTTP
411
420
  // request, another agent's tool — so it takes no context from its caller at all and is
412
421
  // built on the collection's own. A run loop still running long after the call that started
@@ -426,15 +435,24 @@ export class AgentSystemLocal {
426
435
  // resolves through — so the agent is loaded rather than created, and knows whether it
427
436
  // has work left before anything asks it. Bringing a collection up asks only for the
428
437
  // agents that do; anything else resolving an agent wants it whether it owes work or not.
429
- const agent = await Agent.load(agentCtx, options);
438
+ const agent = await Agent.load(agentCtx, options, loadCtx);
430
439
  if (onlyIfActive && !agent.active) {
431
440
  await agent.close();
432
441
  return undefined;
433
442
  }
434
- this.#agents.set(agentId, agent);
443
+ if (publish)
444
+ this.#publish(agent, start);
445
+ return agent;
446
+ }
447
+ /** Publish one fully loaded lifetime synchronously, before the database slot is released. */
448
+ #publish(agent, start) {
449
+ const existing = this.#agents.get(agent.id);
450
+ if (existing !== undefined && existing !== agent) {
451
+ throw new Error(`Agent "${agent.id}" already has a live instance.`);
452
+ }
453
+ this.#agents.set(agent.id, agent);
435
454
  if (start)
436
455
  agent.start();
437
- return agent;
438
456
  }
439
457
  /**
440
458
  * Resolve and resume every agent that has work left from before this process started.
@@ -476,7 +494,7 @@ export class AgentSystemLocal {
476
494
  await this.#invokeLifecycleHook(txCtx, runtime, hook, agent, true);
477
495
  }
478
496
  afterCommit(txCtx, () => {
479
- const observed = (async () => {
497
+ const observed = outsideAgentDatabaseOperation(async () => {
480
498
  for (const runtime of this.#runtimes) {
481
499
  const hook = observe(runtime.hooks);
482
500
  if (hook === undefined)
@@ -488,7 +506,7 @@ export class AgentSystemLocal {
488
506
  // The durable change already committed; observers cannot undo it.
489
507
  }
490
508
  }
491
- })();
509
+ });
492
510
  this.#admitted.add(observed);
493
511
  this.#lifecycleObservations.add(observed);
494
512
  void observed.finally(() => {
@@ -572,34 +590,39 @@ export class AgentSystemLocal {
572
590
  });
573
591
  }
574
592
  /**
575
- * A transactional message loads its target like any other delivery. Instantiation reads only
576
- * committed state and builds memory, so it composes with the open transaction: a rollback
577
- * merely leaves an idle live object with nothing durable to pick up. The target is not
578
- * started here the commit that publishes the message starts its run, and a rolled-back
579
- * transaction starts nothing.
593
+ * Transactional delivery may load an idle target through the transaction it already owns.
594
+ * The provisional object is published only after commit, before the database owner admits
595
+ * another root operation. A rollback therefore leaves neither a live object nor leaked
596
+ * uncommitted state, and this path never waits for an identity lock while owning the database.
580
597
  */
581
598
  async #messageTarget(ctx, agentId) {
582
- if (agentStorageTransaction(ctx) === undefined)
599
+ const transaction = agentStorageTransaction(ctx);
600
+ if (transaction === undefined)
583
601
  return await this.#resolve(ctx, agentId);
584
602
  const existing = this.#agents.get(agentId);
585
603
  if (existing !== undefined)
586
604
  return existing;
587
- return await this.#lockFor(agentId).runInLock(ctx, async (lockCtx) => {
588
- const resolved = this.#agents.get(agentId);
589
- if (resolved !== undefined)
590
- return resolved;
591
- const config = await this.#config(lockCtx, agentId);
592
- if (config === undefined) {
593
- throw new Error(`Agent "${agentId}" has not been created.`);
594
- }
595
- // The load steps outside the transaction scope deliberately: it reads committed
596
- // state on the agent's own detached context, which the ambient-transaction guard
597
- // would otherwise mistake for a context leaking around the transaction.
598
- const agent = await escapeAgentStorageTransaction(async () => await this.#instantiate(agentId, config, false, false));
599
- if (agent === undefined)
600
- throw new Error(`Agent "${agentId}" could not be built.`);
601
- return agent;
602
- });
605
+ let provisional = this.#transactionAgents.get(transaction);
606
+ if (provisional === undefined) {
607
+ provisional = new Map();
608
+ this.#transactionAgents.set(transaction, provisional);
609
+ }
610
+ const cached = provisional.get(agentId);
611
+ if (cached !== undefined)
612
+ return cached;
613
+ const config = await this.#config(ctx, agentId);
614
+ if (config === undefined) {
615
+ throw new Error(`Agent "${agentId}" has not been created.`);
616
+ }
617
+ const agent = await this.#instantiate(agentId, config, false, false, ctx, false);
618
+ if (agent === undefined)
619
+ throw new Error(`Agent "${agentId}" could not be built.`);
620
+ const concurrent = this.#agents.get(agentId);
621
+ if (concurrent !== undefined)
622
+ return concurrent;
623
+ provisional.set(agentId, agent);
624
+ afterCommit(ctx, () => this.#publish(agent, false));
625
+ return agent;
603
626
  }
604
627
  /** Cancel an agent's active turn, leaving its queued messages durable for the next one. */
605
628
  async abort(ctx, agentId, options) {