@slopus/happy-agent-base 0.0.17 → 0.0.19
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 +20 -0
- package/dist/Agent.d.ts +8 -6
- package/dist/Agent.d.ts.map +1 -1
- package/dist/Agent.js +7 -4
- package/dist/Agent.js.map +1 -1
- package/dist/AgentBase.d.ts +19 -12
- package/dist/AgentBase.d.ts.map +1 -1
- package/dist/AgentBase.js +293 -151
- package/dist/AgentBase.js.map +1 -1
- package/dist/AgentBaseHooks.d.ts +25 -5
- package/dist/AgentBaseHooks.d.ts.map +1 -1
- package/dist/AgentDatabase.d.ts.map +1 -1
- package/dist/AgentDatabase.js +27 -14
- package/dist/AgentDatabase.js.map +1 -1
- package/dist/AgentDatabaseConnection.d.ts +39 -0
- package/dist/AgentDatabaseConnection.d.ts.map +1 -0
- package/dist/AgentDatabaseConnection.js +199 -0
- package/dist/AgentDatabaseConnection.js.map +1 -0
- package/dist/AgentModule.d.ts +7 -1
- package/dist/AgentModule.d.ts.map +1 -1
- package/dist/AgentModuleAction.d.ts +4 -3
- package/dist/AgentModuleAction.d.ts.map +1 -1
- package/dist/AgentPersistence.d.ts +15 -8
- package/dist/AgentPersistence.d.ts.map +1 -1
- package/dist/AgentQueuedMessage.d.ts +13 -0
- package/dist/AgentQueuedMessage.d.ts.map +1 -0
- package/dist/AgentQueuedMessage.js +2 -0
- package/dist/AgentQueuedMessage.js.map +1 -0
- package/dist/AgentRef.d.ts +4 -4
- package/dist/AgentRef.d.ts.map +1 -1
- package/dist/AgentRef.js +1 -1
- package/dist/AgentRef.js.map +1 -1
- package/dist/AgentSpanAttributes.d.ts +11 -0
- package/dist/AgentSpanAttributes.d.ts.map +1 -0
- package/dist/AgentSpanAttributes.js +11 -0
- package/dist/AgentSpanAttributes.js.map +1 -0
- package/dist/AgentStorage.d.ts.map +1 -1
- package/dist/AgentStorage.js +2 -0
- package/dist/AgentStorage.js.map +1 -1
- package/dist/AgentSystem.d.ts +6 -5
- package/dist/AgentSystem.d.ts.map +1 -1
- package/dist/AgentSystemLocal.d.ts +3 -3
- package/dist/AgentSystemLocal.d.ts.map +1 -1
- package/dist/AgentSystemLocal.js +53 -30
- package/dist/AgentSystemLocal.js.map +1 -1
- package/dist/AgentSystemRef.d.ts +3 -3
- package/dist/AgentSystemRef.d.ts.map +1 -1
- package/dist/inTx.d.ts +0 -7
- package/dist/inTx.d.ts.map +1 -1
- package/dist/inTx.js +9 -16
- package/dist/inTx.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/openAgentPGliteDatabase.d.ts +10 -0
- package/dist/openAgentPGliteDatabase.d.ts.map +1 -0
- package/dist/openAgentPGliteDatabase.js +17 -0
- package/dist/openAgentPGliteDatabase.js.map +1 -0
- package/dist/openAgentPostgresDatabase.d.ts +13 -0
- package/dist/openAgentPostgresDatabase.d.ts.map +1 -0
- package/dist/openAgentPostgresDatabase.js +10 -0
- package/dist/openAgentPostgresDatabase.js.map +1 -0
- package/dist/openAgentSQLiteDatabase.d.ts +6 -0
- package/dist/openAgentSQLiteDatabase.d.ts.map +1 -0
- package/dist/openAgentSQLiteDatabase.js +48 -0
- package/dist/openAgentSQLiteDatabase.js.map +1 -0
- package/package.json +6 -4
package/dist/AgentDatabase.js
CHANGED
|
@@ -1,30 +1,43 @@
|
|
|
1
1
|
import { is } from "drizzle-orm";
|
|
2
2
|
import { PgDatabase } from "drizzle-orm/pg-core";
|
|
3
3
|
import { BaseSQLiteDatabase } from "drizzle-orm/sqlite-core";
|
|
4
|
+
import { agentDatabaseConnection } from "./AgentDatabaseConnection.js";
|
|
4
5
|
/** Whether a supported facade belongs to Drizzle's SQLite family. */
|
|
5
6
|
export function isAgentSQLiteDatabase(database) {
|
|
6
7
|
return is(database, BaseSQLiteDatabase);
|
|
7
8
|
}
|
|
8
9
|
/** Run a query that returns rows on either supported Drizzle engine. */
|
|
9
10
|
export async function agentDatabaseRows(database, query) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
const work = async () => {
|
|
12
|
+
if (isAgentSQLiteDatabase(database)) {
|
|
13
|
+
return await database.all(query);
|
|
14
|
+
}
|
|
15
|
+
const result = await database.execute(query);
|
|
16
|
+
if (Array.isArray(result))
|
|
17
|
+
return result;
|
|
18
|
+
const rows = Reflect.get(result, "rows");
|
|
19
|
+
if (!Array.isArray(rows)) {
|
|
20
|
+
throw new Error("The PostgreSQL Drizzle query did not return a row collection.");
|
|
21
|
+
}
|
|
22
|
+
return rows;
|
|
23
|
+
};
|
|
24
|
+
const connection = agentDatabaseConnection(database);
|
|
25
|
+
return connection === undefined ? await work() : await connection.operation(database, work);
|
|
21
26
|
}
|
|
22
27
|
/** Run a statement that does not need its returned rows. */
|
|
23
28
|
export async function agentDatabaseRun(database, query) {
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
const work = async () => {
|
|
30
|
+
if (isAgentSQLiteDatabase(database)) {
|
|
31
|
+
await database.run(query);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
await database.execute(query);
|
|
35
|
+
};
|
|
36
|
+
const connection = agentDatabaseConnection(database);
|
|
37
|
+
if (connection === undefined) {
|
|
38
|
+
await work();
|
|
26
39
|
return;
|
|
27
40
|
}
|
|
28
|
-
await
|
|
41
|
+
await connection.operation(database, work);
|
|
29
42
|
}
|
|
30
43
|
//# sourceMappingURL=AgentDatabase.js.map
|
|
@@ -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,qBAA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AM,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,UAAU,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAChG,CAAC;AAED,4DAA4D;AAC5D,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,QAAuB,EAAE,KAAU;IACtE,MAAM,IAAI,GAAG,KAAK,IAAmB,EAAE;QACnC,IAAI,qBAAqB,CAAC,QAAQ,CAAC,EAAE,CAAC;YAClC,MAAM,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAC1B,OAAO;QACX,CAAC;QACD,MAAM,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC,CAAC;IACF,MAAM,UAAU,GAAG,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IACrD,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,IAAI,EAAE,CAAC;QACb,OAAO;IACX,CAAC;IACD,MAAM,UAAU,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { AgentDatabase, AgentDatabaseFacade } from "./AgentDatabase.js";
|
|
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 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentDatabaseConnection.d.ts","sourceRoot":"","sources":["../sources/AgentDatabaseConnection.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAmB7E;;;;;GAKG;AAC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AAO,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,C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AM,UAAU,CAAC,WAAW,CAAC,KAAK,EAAE,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"}
|
package/dist/AgentModule.d.ts
CHANGED
|
@@ -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":["../sources/AgentModule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,8BAA8B,EAC9B,YAAY,EACZ,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,EAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,KAAK,EACR,wBAAwB,EACxB,mBAAmB,EACnB,wBAAwB,EACxB,4BAA4B,EAC5B,kBAAkB,EAClB,uBAAuB,EACvB,aAAa,EACb,oBAAoB,EACpB,6BAA6B,EAC7B,uBAAuB,EACvB,iBAAiB,EACjB,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,YAAY,EACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC7B,0FAA0F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AAS,CAAC,CAAC;IAC5D;;;;;;;;;OASG;IACH,QAAQ,CAAC,yBAAyB,CAAC,EAAE,CACjC,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,gBAAgB,CAAC,QAAQ,CAAC,EACjC,UAAU,EAAE,mBAAmB,KAC9B,YAAY,CAAC,IAAI,CAAC,CAAC;IACxB,8EAA8E;IAC9E,QAAQ,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"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { SessionSystemMessage
|
|
1
|
+
import type { SessionSystemMessage } from "@slopus/happy-providers";
|
|
2
2
|
import type { AgentMessageMetadata } from "./AgentMetadata.js";
|
|
3
|
+
import type { AgentQueuedMessage } from "./AgentQueuedMessage.js";
|
|
3
4
|
/**
|
|
4
5
|
* What a lifecycle hook can ask the agent to do next: queue a steering or sent message, inject a
|
|
5
6
|
* system notice into the conversation at the next safe history boundary, or trigger compaction.
|
|
@@ -9,12 +10,12 @@ import type { AgentMessageMetadata } from "./AgentMetadata.js";
|
|
|
9
10
|
export type AgentModuleAction = {
|
|
10
11
|
readonly type: "steer";
|
|
11
12
|
readonly id?: string;
|
|
12
|
-
readonly message:
|
|
13
|
+
readonly message: AgentQueuedMessage;
|
|
13
14
|
readonly metadata?: AgentMessageMetadata;
|
|
14
15
|
} | {
|
|
15
16
|
readonly type: "send";
|
|
16
17
|
readonly id?: string;
|
|
17
|
-
readonly message:
|
|
18
|
+
readonly message: AgentQueuedMessage;
|
|
18
19
|
readonly metadata?: AgentMessageMetadata;
|
|
19
20
|
} | {
|
|
20
21
|
readonly type: "inject";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentModuleAction.d.ts","sourceRoot":"","sources":["../sources/AgentModuleAction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,
|
|
1
|
+
{"version":3,"file":"AgentModuleAction.d.ts","sourceRoot":"","sources":["../sources/AgentModuleAction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GACvB;IACI,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,QAAQ,CAAC,QAAQ,CAAC,EAAE,oBAAoB,CAAC;CAC5C,GACD;IACI,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,QAAQ,CAAC,QAAQ,CAAC,EAAE,oBAAoB,CAAC;CAC5C,GACD;IACI,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,sFAAsF;IACtF,QAAQ,CAAC,OAAO,EAAE,oBAAoB,CAAC;CAC1C,GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC"}
|
|
@@ -1,20 +1,27 @@
|
|
|
1
|
-
import type { SessionAssistantBlock, SessionMessage, SessionSystemMessage, SessionToolResultMessage
|
|
1
|
+
import type { SessionAssistantBlock, SessionMessage, SessionSystemMessage, SessionToolResultMessage } from "@slopus/happy-providers";
|
|
2
2
|
import type { Context } from "@steve.kite/stdlib";
|
|
3
3
|
import type { AgentDatabase } from "./AgentDatabase.js";
|
|
4
4
|
import type { AgentMessageMetadata } from "./AgentMetadata.js";
|
|
5
|
+
import type { AgentQueuedMessage } from "./AgentQueuedMessage.js";
|
|
5
6
|
/**
|
|
6
7
|
* One record of the main context store. Only content that is part of the model context lives
|
|
7
|
-
* here:
|
|
8
|
+
* here: queued messages enter when a turn consumes them, assistant output is appended one finished
|
|
8
9
|
* block at a time, and tool results follow the blocks that called them, so records always arrive
|
|
9
10
|
* in context order and consecutive block records reassemble into one assistant message. A
|
|
10
11
|
* compaction record carries the complete replacement context — the messages that stay — and is
|
|
11
12
|
* written in the same transaction that physically deletes the superseded records, so it opens
|
|
12
13
|
* the store; the records after it append as usual.
|
|
13
14
|
*/
|
|
14
|
-
export type AgentRecord =
|
|
15
|
+
export type AgentRecord =
|
|
16
|
+
/**
|
|
17
|
+
* A message a turn consumed from one of the delivery queues. It is identified and
|
|
18
|
+
* deduplicated whatever role it carries, so this is also where a queued system notice or an
|
|
19
|
+
* agent-to-agent payload lands.
|
|
20
|
+
*/
|
|
21
|
+
{
|
|
15
22
|
readonly type: "user";
|
|
16
23
|
readonly id: string;
|
|
17
|
-
readonly message:
|
|
24
|
+
readonly message: AgentQueuedMessage;
|
|
18
25
|
readonly metadata?: AgentMessageMetadata;
|
|
19
26
|
} | {
|
|
20
27
|
readonly type: "block";
|
|
@@ -35,10 +42,10 @@ export type AgentRecord = {
|
|
|
35
42
|
* it reaches the main store only when a turn consumes it into the context, and its pending key
|
|
36
43
|
* is deleted at that moment. A `message.` uniqueness key makes retrying a cuid2 message ID an
|
|
37
44
|
* ignored database conflict; history replacement removes keys for the records it deletes.
|
|
38
|
-
* Exactly one owner connects to a store,
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
45
|
+
* Exactly one owner connects to a store. Transactions, uniqueness constraints, and ordered keys
|
|
46
|
+
* keep history order aligned with storage order. Key-value operations — a module's or a tool's —
|
|
47
|
+
* run as they come, so each one has to be atomic on its own, but no implementation ever has to
|
|
48
|
+
* defend against a second owner.
|
|
42
49
|
*/
|
|
43
50
|
export interface AgentPersistence {
|
|
44
51
|
/** The root Drizzle facade for this store. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentPersistence.d.ts","sourceRoot":"","sources":["../sources/AgentPersistence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,qBAAqB,EACrB,cAAc,EACd,oBAAoB,EACpB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"AgentPersistence.d.ts","sourceRoot":"","sources":["../sources/AgentPersistence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,qBAAqB,EACrB,cAAc,EACd,oBAAoB,EACpB,wBAAwB,EAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW;AACnB;;;;GAIG;AACD;IACI,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,QAAQ,CAAC,QAAQ,CAAC,EAAE,oBAAoB,CAAC;CAC5C,GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,qBAAqB,CAAA;CAAE,GACjE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,wBAAwB,CAAA;CAAE,GACrE;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,oBAAoB,CAAA;CAAE,GACnE;IACI,QAAQ,CAAC,IAAI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O,CAAC,IAAI,CAAC,CAAC;CACzD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SessionAgentMessage, SessionSystemMessage, SessionUserMessage } from "@slopus/happy-providers";
|
|
2
|
+
/**
|
|
3
|
+
* A message a caller may hand to one of the agent's delivery queues.
|
|
4
|
+
*
|
|
5
|
+
* Steering and sending say when a message enters the conversation, not who wrote it. A user
|
|
6
|
+
* message is the ordinary case. A system message is how the runtime tells the model something it
|
|
7
|
+
* never asked for, such as a background process that died. An agent message is the opaque
|
|
8
|
+
* provider-native payload one collaborating agent addresses to another. Each keeps its own role
|
|
9
|
+
* all the way into the context, so the provider serializes it as what it actually is rather than
|
|
10
|
+
* as something the user said.
|
|
11
|
+
*/
|
|
12
|
+
export type AgentQueuedMessage = SessionUserMessage | SessionSystemMessage | SessionAgentMessage;
|
|
13
|
+
//# sourceMappingURL=AgentQueuedMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentQueuedMessage.d.ts","sourceRoot":"","sources":["../sources/AgentQueuedMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EACrB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;GASG;AACH,MAAM,MAAM,kBAAkB,GAAG,kBAAkB,GAAG,oBAAoB,GAAG,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentQueuedMessage.js","sourceRoot":"","sources":["../sources/AgentQueuedMessage.ts"],"names":[],"mappings":""}
|
package/dist/AgentRef.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { SessionUserMessage } from "@slopus/happy-providers";
|
|
2
1
|
import type { Context } from "@steve.kite/stdlib";
|
|
3
2
|
import type { Agent } from "./Agent.js";
|
|
4
3
|
import type { AgentBaseMessageOptions } from "./AgentBase.js";
|
|
5
4
|
import type { AgentDatabase } from "./AgentDatabase.js";
|
|
6
5
|
import type { AgentMetadata } from "./AgentMetadata.js";
|
|
7
6
|
import type { AgentMessageAcceptance } from "./AgentMessageAcceptance.js";
|
|
7
|
+
import type { AgentQueuedMessage } from "./AgentQueuedMessage.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
|
|
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
|
*/
|
|
@@ -36,9 +36,9 @@ export declare class AgentRef<Database extends AgentDatabase = AgentDatabase> {
|
|
|
36
36
|
/** The wrapped agent's ID. */
|
|
37
37
|
get id(): string;
|
|
38
38
|
/** Queue a message that injects as soon as the current response and its tool batch finish. */
|
|
39
|
-
steer(ctx: Context, message:
|
|
39
|
+
steer(ctx: Context, message: AgentQueuedMessage, options?: AgentBaseMessageOptions): Promise<AgentMessageAcceptance>;
|
|
40
40
|
/** Queue a message that injects when the agent would otherwise stop. */
|
|
41
|
-
send(ctx: Context, message:
|
|
41
|
+
send(ctx: Context, message: AgentQueuedMessage, options?: AgentBaseMessageOptions): Promise<AgentMessageAcceptance>;
|
|
42
42
|
/** Shallow-merge fields into this agent's immutable metadata. */
|
|
43
43
|
updateMetadata(ctx: Context, update: AgentMetadata): Promise<void>;
|
|
44
44
|
/** Ask the agent to compact, which it does between turns. */
|
package/dist/AgentRef.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentRef.d.ts","sourceRoot":"","sources":["../sources/AgentRef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"AgentRef.d.ts","sourceRoot":"","sources":["../sources/AgentRef.ts"],"names":[],"mappings":"AAAA,OAAO,K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AAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAEvE;IAED,6DAA6D;IACvD,OAAO,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAEzC;IAED,sCAAsC;IAChC,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAEvC;CACJ"}
|
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
|
|
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
|
*/
|
package/dist/AgentRef.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentRef.js","sourceRoot":"","sources":["../sources/AgentRef.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AgentRef.js","sourceRoot":"","sources":["../sources/AgentRef.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAO7C;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAY,EAAE,MAAc;IAC7D,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5B,OAAO,MAAM,KAAK,MAAM,CAAC;AAC7B,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,QAAQ;IACjB,sCAAsC;IAC7B,MAAM,CAAgC;IAC/C,0FAA0F;IACjF,MAAM,CAAgB;IAE/B,YAAY,KAAoC,EAAE,MAAM,GAAkB,IAAI;QAC1E,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,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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;
|
|
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;AAE5B,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,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