@slopus/happy-agent-base 0.0.6 → 0.0.8
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 +52 -11
- package/dist/Agent.d.ts +24 -22
- package/dist/Agent.d.ts.map +1 -1
- package/dist/Agent.js +113 -111
- package/dist/Agent.js.map +1 -1
- package/dist/AgentBase.d.ts +18 -14
- package/dist/AgentBase.d.ts.map +1 -1
- package/dist/AgentBase.js +486 -122
- package/dist/AgentBase.js.map +1 -1
- package/dist/AgentBaseHooks.d.ts +41 -28
- package/dist/AgentBaseHooks.d.ts.map +1 -1
- package/dist/AgentBasePending.d.ts +6 -2
- package/dist/AgentBasePending.d.ts.map +1 -1
- package/dist/AgentBasePending.js +7 -0
- package/dist/AgentBasePending.js.map +1 -1
- package/dist/AgentConfig.d.ts +9 -9
- package/dist/AgentConfig.d.ts.map +1 -1
- package/dist/AgentConfig.js +8 -8
- package/dist/AgentConfig.js.map +1 -1
- package/dist/AgentContexts.d.ts +25 -1
- package/dist/AgentContexts.d.ts.map +1 -1
- package/dist/AgentContexts.js +46 -2
- package/dist/AgentContexts.js.map +1 -1
- package/dist/AgentDatabase.d.ts +35 -0
- package/dist/AgentDatabase.d.ts.map +1 -0
- package/dist/AgentDatabase.js +30 -0
- package/dist/AgentDatabase.js.map +1 -0
- package/dist/AgentKV.d.ts +19 -6
- package/dist/AgentKV.d.ts.map +1 -1
- package/dist/AgentKV.js +110 -43
- package/dist/AgentKV.js.map +1 -1
- package/dist/AgentMessageAcceptance.d.ts +14 -0
- package/dist/AgentMessageAcceptance.d.ts.map +1 -0
- package/dist/AgentMessageAcceptance.js +2 -0
- package/dist/AgentMessageAcceptance.js.map +1 -0
- package/dist/AgentMetadata.d.ts +3 -3
- package/dist/AgentMetadata.js +3 -3
- package/dist/AgentModule.d.ts +209 -0
- package/dist/AgentModule.d.ts.map +1 -0
- package/dist/AgentModule.js +2 -0
- package/dist/AgentModule.js.map +1 -0
- package/dist/{AgentFeatureAction.d.ts → AgentModuleAction.d.ts} +2 -2
- package/dist/AgentModuleAction.d.ts.map +1 -0
- package/dist/AgentModuleAction.js +2 -0
- package/dist/AgentModuleAction.js.map +1 -0
- package/dist/AgentPermissionMode.d.ts +1 -1
- package/dist/AgentPermissionMode.js +1 -1
- package/dist/AgentPersistence.d.ts +7 -4
- package/dist/AgentPersistence.d.ts.map +1 -1
- package/dist/AgentPersistenceDrizzle.d.ts +29 -0
- package/dist/AgentPersistenceDrizzle.d.ts.map +1 -0
- package/dist/AgentPersistenceDrizzle.js +112 -0
- package/dist/AgentPersistenceDrizzle.js.map +1 -0
- package/dist/AgentRef.d.ts +12 -9
- package/dist/AgentRef.d.ts.map +1 -1
- package/dist/AgentRef.js +8 -8
- package/dist/AgentRef.js.map +1 -1
- package/dist/AgentStorage.d.ts +26 -12
- package/dist/AgentStorage.d.ts.map +1 -1
- package/dist/AgentStorage.js +90 -3
- package/dist/AgentStorage.js.map +1 -1
- package/dist/AgentSystem.d.ts +10 -7
- package/dist/AgentSystem.d.ts.map +1 -1
- package/dist/AgentSystemContext.d.ts +5 -4
- package/dist/AgentSystemContext.d.ts.map +1 -1
- package/dist/AgentSystemContext.js +4 -4
- package/dist/AgentSystemContext.js.map +1 -1
- package/dist/AgentSystemLocal.d.ts +17 -14
- package/dist/AgentSystemLocal.d.ts.map +1 -1
- package/dist/AgentSystemLocal.js +120 -29
- package/dist/AgentSystemLocal.js.map +1 -1
- package/dist/AgentSystemRef.d.ts +9 -7
- package/dist/AgentSystemRef.d.ts.map +1 -1
- package/dist/AgentSystemRef.js +17 -4
- package/dist/AgentSystemRef.js.map +1 -1
- package/dist/AgentTool.d.ts +24 -2
- package/dist/AgentTool.d.ts.map +1 -1
- package/dist/AgentTool.js.map +1 -1
- package/dist/inTx.d.ts +17 -0
- package/dist/inTx.d.ts.map +1 -0
- package/dist/inTx.js +65 -0
- package/dist/inTx.js.map +1 -0
- package/dist/index.d.ts +9 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/dist/AgentFeature.d.ts +0 -184
- package/dist/AgentFeature.d.ts.map +0 -1
- package/dist/AgentFeature.js +0 -2
- package/dist/AgentFeature.js.map +0 -1
- package/dist/AgentFeatureAction.d.ts.map +0 -1
- package/dist/AgentFeatureAction.js +0 -2
- package/dist/AgentFeatureAction.js.map +0 -1
package/dist/AgentRef.d.ts
CHANGED
|
@@ -2,16 +2,19 @@ import type { SessionUserMessage } from "@slopus/happy-providers";
|
|
|
2
2
|
import type { Context } from "@steve.kite/stdlib";
|
|
3
3
|
import type { Agent } from "./Agent.js";
|
|
4
4
|
import type { AgentBaseMessageOptions } from "./AgentBase.js";
|
|
5
|
+
import type { AgentDatabase } from "./AgentDatabase.js";
|
|
5
6
|
import type { AgentMetadata } from "./AgentMetadata.js";
|
|
7
|
+
import type { AgentMessageAcceptance } from "./AgentMessageAcceptance.js";
|
|
8
|
+
import type { AnyAgentTool } from "./AgentTool.js";
|
|
6
9
|
/**
|
|
7
10
|
* Whether this caller may be told that `agentId` durably accepted a message. Acceptance is a
|
|
8
11
|
* queue write under that agent's own persistence lock, so waiting for it is safe from anywhere
|
|
9
|
-
* except inside that agent's loop, which is holding the lock the write needs.
|
|
10
|
-
*
|
|
12
|
+
* except inside that agent's loop, which is holding the lock the write needs. A caller naming no
|
|
13
|
+
* agent is an external host and may wait; only the target agent itself cannot.
|
|
11
14
|
*/
|
|
12
15
|
export declare function acceptanceIsWaitable(ctx: Context, target: string): boolean;
|
|
13
16
|
/**
|
|
14
|
-
* A reference to an agent for code that runs inside one — a
|
|
17
|
+
* A reference to an agent for code that runs inside one — a module hook, or a tool the run loop
|
|
15
18
|
* is waiting on. No operation here waits for a run loop: `compact` and `abort` are requests that
|
|
16
19
|
* resolve once they have been made, and there is no `close`, `waitForIdle` or `start`, each of
|
|
17
20
|
* which is whole-agent lifetime owned by whoever created the agent and nothing *but* the wait
|
|
@@ -22,20 +25,20 @@ export declare function acceptanceIsWaitable(ctx: Context, target: string): bool
|
|
|
22
25
|
* agent's conversation and reject when the write fails, so a caller routing work elsewhere knows
|
|
23
26
|
* whether it arrived. Addressed to the agent the caller is running inside — whose loop would have
|
|
24
27
|
* to perform that write — the message is queued and not waited for. The context decides, since it
|
|
25
|
-
* names the agent the caller is in; a context that names none
|
|
26
|
-
*
|
|
28
|
+
* names the agent the caller is in; a context that names none is an external host and receives
|
|
29
|
+
* the durable acceptance result.
|
|
27
30
|
*/
|
|
28
|
-
export declare class AgentRef {
|
|
31
|
+
export declare class AgentRef<Database extends AgentDatabase = AgentDatabase> {
|
|
29
32
|
#private;
|
|
30
33
|
/** The durable parent captured when this reference was resolved, or `null` for a root. */
|
|
31
34
|
readonly parent: string | null;
|
|
32
|
-
constructor(agent: Agent, parent?: string | null);
|
|
35
|
+
constructor(agent: Agent<AnyAgentTool, Database>, parent?: string | null);
|
|
33
36
|
/** The wrapped agent's ID. */
|
|
34
37
|
get id(): string;
|
|
35
38
|
/** Queue a message that injects as soon as the current response and its tool batch finish. */
|
|
36
|
-
steer(ctx: Context, message: SessionUserMessage, options?: AgentBaseMessageOptions): Promise<
|
|
39
|
+
steer(ctx: Context, message: SessionUserMessage, options?: AgentBaseMessageOptions): Promise<AgentMessageAcceptance>;
|
|
37
40
|
/** Queue a message that injects when the agent would otherwise stop. */
|
|
38
|
-
send(ctx: Context, message: SessionUserMessage, options?: AgentBaseMessageOptions): Promise<
|
|
41
|
+
send(ctx: Context, message: SessionUserMessage, options?: AgentBaseMessageOptions): Promise<AgentMessageAcceptance>;
|
|
39
42
|
/** Shallow-merge fields into this agent's immutable metadata. */
|
|
40
43
|
updateMetadata(ctx: Context, update: AgentMetadata): Promise<void>;
|
|
41
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/Agent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B;IAC9B,IAAI,EAAE,IAAI,MAAM,CAEf;IAED,8FAA8F;IACxF,KAAK,CACP,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,kBAAkB,EAC3B,OAAO,CAAC,EAAE,uBAAuB,GAClC,OAAO,CAAC,sBAAsB,CAAC,CAKjC;IAED,wEAAwE;IAClE,IAAI,CACN,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,kBAAkB,EAC3B,OAAO,CAAC,EAAE,uBAAuB,GAClC,OAAO,CAAC,sBAAsB,CAAC,CAKjC;IAED,iEAAiE;IAC3D,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,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
|
@@ -2,15 +2,15 @@ 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
4
|
* queue write under that agent's own persistence lock, so waiting for it is safe from anywhere
|
|
5
|
-
* except inside that agent's loop, which is holding the lock the write needs.
|
|
6
|
-
*
|
|
5
|
+
* except inside that agent's loop, which is holding the lock the write needs. A caller naming no
|
|
6
|
+
* agent is an external host and may wait; only the target agent itself cannot.
|
|
7
7
|
*/
|
|
8
8
|
export function acceptanceIsWaitable(ctx, target) {
|
|
9
9
|
const caller = agentId(ctx);
|
|
10
|
-
return caller !==
|
|
10
|
+
return caller !== target;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* A reference to an agent for code that runs inside one — a
|
|
13
|
+
* A reference to an agent for code that runs inside one — a module hook, or a tool the run loop
|
|
14
14
|
* is waiting on. No operation here waits for a run loop: `compact` and `abort` are requests that
|
|
15
15
|
* resolve once they have been made, and there is no `close`, `waitForIdle` or `start`, each of
|
|
16
16
|
* which is whole-agent lifetime owned by whoever created the agent and nothing *but* the wait
|
|
@@ -21,8 +21,8 @@ export function acceptanceIsWaitable(ctx, target) {
|
|
|
21
21
|
* agent's conversation and reject when the write fails, so a caller routing work elsewhere knows
|
|
22
22
|
* whether it arrived. Addressed to the agent the caller is running inside — whose loop would have
|
|
23
23
|
* to perform that write — the message is queued and not waited for. The context decides, since it
|
|
24
|
-
* names the agent the caller is in; a context that names none
|
|
25
|
-
*
|
|
24
|
+
* names the agent the caller is in; a context that names none is an external host and receives
|
|
25
|
+
* the durable acceptance result.
|
|
26
26
|
*/
|
|
27
27
|
export class AgentRef {
|
|
28
28
|
/** The agent this reference wraps. */
|
|
@@ -39,14 +39,14 @@ export class AgentRef {
|
|
|
39
39
|
}
|
|
40
40
|
/** Queue a message that injects as soon as the current response and its tool batch finish. */
|
|
41
41
|
async steer(ctx, message, options) {
|
|
42
|
-
await this.#agent.steer(ctx, message, {
|
|
42
|
+
return await this.#agent.steer(ctx, message, {
|
|
43
43
|
...options,
|
|
44
44
|
await: acceptanceIsWaitable(ctx, this.#agent.id),
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
/** Queue a message that injects when the agent would otherwise stop. */
|
|
48
48
|
async send(ctx, message, options) {
|
|
49
|
-
await this.#agent.send(ctx, message, {
|
|
49
|
+
return await this.#agent.send(ctx, message, {
|
|
50
50
|
...options,
|
|
51
51
|
await: acceptanceIsWaitable(ctx, this.#agent.id),
|
|
52
52
|
});
|
package/dist/AgentRef.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentRef.js","sourceRoot":"","sources":["../sources/AgentRef.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"AgentRef.js","sourceRoot":"","sources":["../sources/AgentRef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MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAClD,CAAC;IAED,6DAA6D;IAC7D,KAAK,CAAC,OAAO,CAAC,GAAY;QACtB,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACrD,CAAC;IAED,sCAAsC;IACtC,KAAK,CAAC,KAAK,CAAC,GAAY;QACpB,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACnD,CAAC;CACJ"}
|
package/dist/AgentStorage.d.ts
CHANGED
|
@@ -1,32 +1,37 @@
|
|
|
1
1
|
import type { Context } from "@steve.kite/stdlib";
|
|
2
|
-
import type
|
|
2
|
+
import { type AgentDatabase, type AgentDatabaseFacade } from "./AgentDatabase.js";
|
|
3
|
+
import type { AgentModule } from "./AgentModule.js";
|
|
4
|
+
import { AgentKV } from "./AgentKV.js";
|
|
3
5
|
import type { AgentPersistence } from "./AgentPersistence.js";
|
|
6
|
+
import type { AnyAgentTool } from "./AgentTool.js";
|
|
4
7
|
/**
|
|
5
|
-
* The exclusive ownership of one durable agent store.
|
|
6
|
-
* the
|
|
8
|
+
* The exclusive ownership of one durable agent store. A host sharing its database between
|
|
9
|
+
* processes should back this with the same hard process-level lock as the database itself.
|
|
7
10
|
*/
|
|
8
11
|
export interface AgentStorageLock {
|
|
9
12
|
/** Release the hard lock after the owning AgentSystem has stopped every agent. */
|
|
10
13
|
release(ctx: Context): Promise<void>;
|
|
11
14
|
}
|
|
12
|
-
|
|
13
|
-
export interface AgentStorageOptions {
|
|
15
|
+
interface AgentStorageCommonOptions {
|
|
14
16
|
/**
|
|
15
17
|
* Acquire exclusive ownership of the whole store. This must fail while any other process or
|
|
16
18
|
* AgentSystem owns the same durable store.
|
|
17
19
|
*/
|
|
18
20
|
readonly acquireLock: (ctx: Context) => Promise<AgentStorageLock>;
|
|
19
|
-
/** Shared key-value storage used for state spanning all agents. */
|
|
20
|
-
readonly kv: AgentKV;
|
|
21
|
-
/** Produce the isolated persistence used by one agent. */
|
|
22
|
-
readonly persistence: (agentId: string) => AgentPersistence;
|
|
23
21
|
}
|
|
24
|
-
/**
|
|
25
|
-
export
|
|
22
|
+
/** Drizzle-owned storage. */
|
|
23
|
+
export type AgentStorageOptions<Database extends AgentDatabase = AgentDatabase> = AgentStorageCommonOptions & {
|
|
24
|
+
/** The engine-specific Drizzle facade; the same object is passed through to modules. */
|
|
25
|
+
readonly database: Database;
|
|
26
|
+
};
|
|
27
|
+
/** Storage roots and Drizzle persistence shared by an `AgentSystemLocal` collection. */
|
|
28
|
+
export declare class AgentStorage<Database extends AgentDatabase = AgentDatabase> {
|
|
26
29
|
#private;
|
|
30
|
+
/** The root Drizzle facade. */
|
|
31
|
+
readonly database: Database;
|
|
27
32
|
/** Shared key-value storage used for state spanning all agents. */
|
|
28
33
|
readonly kv: AgentKV;
|
|
29
|
-
constructor(options: AgentStorageOptions);
|
|
34
|
+
constructor(options: AgentStorageOptions<Database>);
|
|
30
35
|
/**
|
|
31
36
|
* Acquire exclusive ownership until the returned lock is released. The adapter's lock
|
|
32
37
|
* enforces this across processes; the local guard also rejects accidental reuse of this
|
|
@@ -35,5 +40,14 @@ export declare class AgentStorage {
|
|
|
35
40
|
acquireLock(ctx: Context): Promise<AgentStorageLock>;
|
|
36
41
|
/** The isolated persistence for the given agent. */
|
|
37
42
|
persistence(agentId: string): AgentPersistence;
|
|
43
|
+
/** Run work in this storage's internally managed transaction. */
|
|
44
|
+
transaction<Result>(ctx: Context, work: (ctx: Context, database: AgentDatabaseFacade<Database>) => Promise<Result>): Promise<Result>;
|
|
45
|
+
/**
|
|
46
|
+
* Install the base schema and every module's ordered keyed migrations. Each migration and
|
|
47
|
+
* its success marker commit atomically. Applied keys must remain an exact prefix, so inserting
|
|
48
|
+
* or reordering historical migrations fails instead of silently changing their meaning.
|
|
49
|
+
*/
|
|
50
|
+
migrate(ctx: Context, modules: readonly AgentModule<AnyAgentTool, Database>[]): Promise<void>;
|
|
38
51
|
}
|
|
52
|
+
export {};
|
|
39
53
|
//# sourceMappingURL=AgentStorage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentStorage.d.ts","sourceRoot":"","sources":["../sources/AgentStorage.ts"],"names":[],"mappings":"
|
|
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,GAAG,aAAa,IAC1E,yBAAyB,GAAG;IACxB,wFAAwF;IACxF,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC/B,CAAC;AAEN,wFAAwF;AACxF,qBAAa,YAAY,CAAC,QAAQ,SAAS,aAAa,GAAG,aAAa;;IACpE,+BAA+B;IAC/B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,mEAAmE;IACnE,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IAUrB,YAAY,OAAO,EAAE,mBAAmB,CAAC,QAAQ,CAAC,EASjD;IAED;;;;OAIG;IACG,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAmBzD;IAED,oDAAoD;IACpD,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,CAE7C;IAED,iEAAiE;IAC3D,WAAW,CAAC,MAAM,EACpB,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,mBAAmB,CAAC,QAAQ,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,GACjF,OAAO,CAAC,MAAM,CAAC,CAKjB;IAED;;;;OAIG;IACG,OAAO,CACT,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,SAAS,WAAW,CAAC,YAAY,EAAE,QAAQ,CAAC,EAAE,GACxD,OAAO,CAAC,IAAI,CAAC,CA6Cf;CA8CJ"}
|
package/dist/AgentStorage.js
CHANGED
|
@@ -1,17 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
import { sql } from "drizzle-orm";
|
|
2
|
+
import { agentDatabaseRows, agentDatabaseRun, } from "./AgentDatabase.js";
|
|
3
|
+
import { AgentKV } from "./AgentKV.js";
|
|
4
|
+
import { AgentPersistenceDrizzle } from "./AgentPersistenceDrizzle.js";
|
|
5
|
+
/** Storage roots and Drizzle persistence shared by an `AgentSystemLocal` collection. */
|
|
2
6
|
export class AgentStorage {
|
|
7
|
+
/** The root Drizzle facade. */
|
|
8
|
+
database;
|
|
3
9
|
/** Shared key-value storage used for state spanning all agents. */
|
|
4
10
|
kv;
|
|
5
11
|
/** Acquires the database-backed exclusive lock for this store. */
|
|
6
12
|
#acquireLock;
|
|
7
13
|
/** Produces the isolated persistence used by one agent. */
|
|
8
14
|
#persistence;
|
|
15
|
+
/** Root persistence used for storage-wide transactions and key-value state. */
|
|
16
|
+
#drizzle;
|
|
9
17
|
/** Prevents two systems from sharing even one AgentStorage instance. */
|
|
10
18
|
#owned = false;
|
|
11
19
|
constructor(options) {
|
|
12
|
-
this.kv = options.kv;
|
|
13
20
|
this.#acquireLock = options.acquireLock;
|
|
14
|
-
this
|
|
21
|
+
this.database = options.database;
|
|
22
|
+
const integration = {
|
|
23
|
+
database: options.database,
|
|
24
|
+
};
|
|
25
|
+
this.#drizzle = new AgentPersistenceDrizzle(integration, "");
|
|
26
|
+
this.kv = new AgentKV(this.#drizzle, "agentSystem.");
|
|
27
|
+
this.#persistence = (agentId) => new AgentPersistenceDrizzle(integration, agentId);
|
|
15
28
|
}
|
|
16
29
|
/**
|
|
17
30
|
* Acquire exclusive ownership until the returned lock is released. The adapter's lock
|
|
@@ -45,5 +58,79 @@ export class AgentStorage {
|
|
|
45
58
|
persistence(agentId) {
|
|
46
59
|
return this.#persistence(agentId);
|
|
47
60
|
}
|
|
61
|
+
/** Run work in this storage's internally managed transaction. */
|
|
62
|
+
async transaction(ctx, work) {
|
|
63
|
+
return await this.#drizzle.transaction(ctx, async (txCtx) => await work(txCtx, txCtx.db));
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Install the base schema and every module's ordered keyed migrations. Each migration and
|
|
67
|
+
* its success marker commit atomically. Applied keys must remain an exact prefix, so inserting
|
|
68
|
+
* or reordering historical migrations fails instead of silently changing their meaning.
|
|
69
|
+
*/
|
|
70
|
+
async migrate(ctx, modules) {
|
|
71
|
+
const names = modules.map((module) => module.name);
|
|
72
|
+
if (names.includes("@happy-agent-base") || new Set(names).size !== names.length) {
|
|
73
|
+
throw new Error("Module names must be unique and cannot use the agent-base owner.");
|
|
74
|
+
}
|
|
75
|
+
await this.#drizzle.transaction(ctx, async (txCtx) => {
|
|
76
|
+
await agentDatabaseRun(txCtx.db, sql `CREATE TABLE IF NOT EXISTS happy_agent_migrations (
|
|
77
|
+
module_key TEXT NOT NULL,
|
|
78
|
+
migration_key TEXT NOT NULL,
|
|
79
|
+
position BIGINT NOT NULL,
|
|
80
|
+
PRIMARY KEY (module_key, migration_key),
|
|
81
|
+
UNIQUE (module_key, position)
|
|
82
|
+
)`);
|
|
83
|
+
});
|
|
84
|
+
await this.#migrateModule(ctx, "@happy-agent-base", [
|
|
85
|
+
[
|
|
86
|
+
"001-core-storage",
|
|
87
|
+
async (_migrationCtx, database) => {
|
|
88
|
+
await agentDatabaseRun(database, sql `CREATE TABLE happy_agent_records (
|
|
89
|
+
owner_id TEXT NOT NULL,
|
|
90
|
+
position BIGINT NOT NULL,
|
|
91
|
+
record_json TEXT NOT NULL,
|
|
92
|
+
PRIMARY KEY (owner_id, position)
|
|
93
|
+
)`);
|
|
94
|
+
await agentDatabaseRun(database, sql `CREATE TABLE happy_agent_values (
|
|
95
|
+
owner_id TEXT NOT NULL,
|
|
96
|
+
key TEXT NOT NULL,
|
|
97
|
+
value_json TEXT NOT NULL,
|
|
98
|
+
PRIMARY KEY (owner_id, key)
|
|
99
|
+
)`);
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
]);
|
|
103
|
+
for (const module of modules) {
|
|
104
|
+
await this.#migrateModule(ctx, module.name, module.migrations ?? []);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
async #migrateModule(ctx, module, migrations) {
|
|
108
|
+
const keys = migrations.map(([key]) => key);
|
|
109
|
+
if (keys.some((key) => key.length === 0) || new Set(keys).size !== keys.length) {
|
|
110
|
+
throw new Error(`Module "${module}" has an empty or duplicate migration key.`);
|
|
111
|
+
}
|
|
112
|
+
const applied = await agentDatabaseRows(this.#drizzle.database, sql `SELECT migration_key, position
|
|
113
|
+
FROM happy_agent_migrations
|
|
114
|
+
WHERE module_key = ${module}
|
|
115
|
+
ORDER BY position`);
|
|
116
|
+
for (let index = 0; index < applied.length; index += 1) {
|
|
117
|
+
if (applied[index]?.migration_key !== keys[index] ||
|
|
118
|
+
Number(applied[index]?.position) !== index) {
|
|
119
|
+
throw new Error(`The applied migrations for module "${module}" are not a prefix of its current migrations.`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
for (let index = applied.length; index < migrations.length; index += 1) {
|
|
123
|
+
const migration = migrations[index];
|
|
124
|
+
if (migration === undefined)
|
|
125
|
+
continue;
|
|
126
|
+
const [key, run] = migration;
|
|
127
|
+
await this.#drizzle.transaction(ctx, async (txCtx) => {
|
|
128
|
+
await run(txCtx, txCtx.db);
|
|
129
|
+
await agentDatabaseRun(txCtx.db, sql `INSERT INTO happy_agent_migrations
|
|
130
|
+
(module_key, migration_key, position)
|
|
131
|
+
VALUES (${module}, ${key}, ${index})`);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
48
135
|
}
|
|
49
136
|
//# sourceMappingURL=AgentStorage.js.map
|
package/dist/AgentStorage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentStorage.js","sourceRoot":"","sources":["../sources/AgentStorage.ts"],"names":[],"mappings":"
|
|
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,M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AS,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;YACpC,IAAI,SAAS,KAAK,SAAS;gBAAE,SAAS;YACtC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC;YAC7B,MAAM,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;gBACjD,MAAM,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,EAAmC,CAAC,CAAC;gBAC5D,MAAM,gBAAgB,CAClB,KAAK,CAAC,EAAE,EACR,GAAG,CAAA;;kCAEW,MAAM,KAAK,GAAG,KAAK,KAAK,GAAG,CAC5C,CAAC;YACN,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC;CACJ"}
|
package/dist/AgentSystem.d.ts
CHANGED
|
@@ -3,8 +3,11 @@ import type { Context } from "@steve.kite/stdlib";
|
|
|
3
3
|
import type { Agent } from "./Agent.js";
|
|
4
4
|
import type { AgentBaseAwaitOptions, AgentBaseMessageOptions } from "./AgentBase.js";
|
|
5
5
|
import type { AgentConfig } from "./AgentConfig.js";
|
|
6
|
+
import type { AgentDatabase } from "./AgentDatabase.js";
|
|
6
7
|
import type { AgentMetadata } from "./AgentMetadata.js";
|
|
8
|
+
import type { AgentMessageAcceptance } from "./AgentMessageAcceptance.js";
|
|
7
9
|
import type { AgentModel } from "./AgentModel.js";
|
|
10
|
+
import type { AnyAgentTool } from "./AgentTool.js";
|
|
8
11
|
/** Conversation state installed atomically before a newly created agent starts. */
|
|
9
12
|
export interface AgentInitialContext {
|
|
10
13
|
/** The conversation installed as the agent's history before its first turn runs. */
|
|
@@ -25,16 +28,16 @@ export interface AgentCreateOptions {
|
|
|
25
28
|
/**
|
|
26
29
|
* A collection of agents addressed by ID: what an owner can ask of the agents it runs. An agent
|
|
27
30
|
* exists only once it has been created with its persisted configuration; resolving one that was
|
|
28
|
-
* never created is an error. Environment and
|
|
31
|
+
* never created is an error. Environment and module settings stay fixed, while metadata changes
|
|
29
32
|
* through a transactional shallow merge.
|
|
30
33
|
*
|
|
31
34
|
* This is the full surface, including the operations that wait for an agent's run loop to reach a
|
|
32
35
|
* particular point — `delete`, and anything reached through the returned `Agent`. Those are for
|
|
33
|
-
* the caller that owns the agents' lifetime. Code running *inside* an agent, such as a
|
|
36
|
+
* the caller that owns the agents' lifetime. Code running *inside* an agent, such as a module
|
|
34
37
|
* hook or a tool, is waited for by that loop and must not wait for it in turn: it should hold an
|
|
35
38
|
* `AgentSystemRef`, whose every operation returns without waiting for a loop.
|
|
36
39
|
*/
|
|
37
|
-
export interface AgentSystem {
|
|
40
|
+
export interface AgentSystem<Database extends AgentDatabase = AgentDatabase> {
|
|
38
41
|
/** The models this collection offers its agents. */
|
|
39
42
|
readonly models: readonly AgentModel[];
|
|
40
43
|
/** Stop every agent and release this system's exclusive ownership of its durable store. */
|
|
@@ -43,7 +46,7 @@ export interface AgentSystem {
|
|
|
43
46
|
* Create an agent with a generated or caller-supplied cuid2 identity. Configuration,
|
|
44
47
|
* parentage, and optional initial context are persisted before it runs.
|
|
45
48
|
*/
|
|
46
|
-
create(ctx: Context, config: AgentConfig, options?: AgentCreateOptions): Promise<Agent
|
|
49
|
+
create(ctx: Context, config: AgentConfig, options?: AgentCreateOptions): Promise<Agent<AnyAgentTool, Database>>;
|
|
47
50
|
/** Close an agent and release its identity, so the same ID can be created again. */
|
|
48
51
|
delete(ctx: Context, agentId: string): Promise<void>;
|
|
49
52
|
/** The current configuration of an agent, or undefined when there is no such agent. */
|
|
@@ -55,14 +58,14 @@ export interface AgentSystem {
|
|
|
55
58
|
/** The parent of an agent, or `null` when it is a root. */
|
|
56
59
|
parentOf(ctx: Context, agentId: string): Promise<string | null>;
|
|
57
60
|
/** The live agent for an ID, loading it if this process has not seen it yet. */
|
|
58
|
-
resolve(ctx: Context, agentId: string): Promise<Agent
|
|
61
|
+
resolve(ctx: Context, agentId: string): Promise<Agent<AnyAgentTool, Database>>;
|
|
59
62
|
/**
|
|
60
63
|
* Queue a user message for an agent, injected as soon as its current response and tool batch
|
|
61
64
|
* finish.
|
|
62
65
|
*/
|
|
63
|
-
steer(ctx: Context, agentId: string, message: SessionUserMessage, options?: AgentBaseMessageOptions & AgentBaseAwaitOptions): Promise<
|
|
66
|
+
steer(ctx: Context, agentId: string, message: SessionUserMessage, options?: AgentBaseMessageOptions & AgentBaseAwaitOptions): Promise<AgentMessageAcceptance>;
|
|
64
67
|
/** Queue a user message for an agent that injects only when the agent would otherwise stop. */
|
|
65
|
-
send(ctx: Context, agentId: string, message: SessionUserMessage, options?: AgentBaseMessageOptions & AgentBaseAwaitOptions): Promise<
|
|
68
|
+
send(ctx: Context, agentId: string, message: SessionUserMessage, options?: AgentBaseMessageOptions & AgentBaseAwaitOptions): Promise<AgentMessageAcceptance>;
|
|
66
69
|
/** Cancel an agent's active turn, leaving its queued messages durable for the next one. */
|
|
67
70
|
abort(ctx: Context, agentId: string, options?: AgentBaseAwaitOptions): Promise<void>;
|
|
68
71
|
/** Ask an agent for its conversation to be replaced by the provider's summary of it. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentSystem.d.ts","sourceRoot":"","sources":["../sources/AgentSystem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACrF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"AgentSystem.d.ts","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f,OAAO,EAAE,kBAAkB,EAC3B,OAAO,CAAC,EAAE,uBAAuB,GAAG,qBAAqB,GAC1D,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAEnC,2FAA2F;IAC3F,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAErF,wFAAwF;IACxF,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1F"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { type Context } from "@steve.kite/stdlib";
|
|
2
|
+
import type { AgentDatabase } from "./AgentDatabase.js";
|
|
2
3
|
import type { AgentSystemRef } from "./AgentSystemRef.js";
|
|
3
4
|
/**
|
|
4
|
-
* Carry the collection that owns an agent and its
|
|
5
|
+
* Carry the collection that owns an agent and its modules, as a reference.
|
|
5
6
|
*
|
|
6
|
-
* Only the reference travels on a context. Everything that reads one — a
|
|
7
|
+
* Only the reference travels on a context. Everything that reads one — a module hook, a tool —
|
|
7
8
|
* is code some run loop is waiting for, while the owner's surface holds the operations that wait
|
|
8
9
|
* for a loop to reach a particular point. A collection therefore puts an `AgentSystemRef` on
|
|
9
10
|
* every context it derives, and agents come back from it as `AgentRef`, so nothing reached
|
|
10
11
|
* through a context can wait for the loop that is waiting for it.
|
|
11
12
|
*/
|
|
12
|
-
export declare function withAgentSystem(ctx: Context, value: AgentSystemRef): Context;
|
|
13
|
-
/** The collection owning the current
|
|
13
|
+
export declare function withAgentSystem<Database extends AgentDatabase>(ctx: Context, value: AgentSystemRef<Database>): Context;
|
|
14
|
+
/** The collection owning the current module or agent operation. */
|
|
14
15
|
export declare function agentSystem(ctx: Context): AgentSystemRef | undefined;
|
|
15
16
|
//# sourceMappingURL=AgentSystemContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentSystemContext.d.ts","sourceRoot":"","sources":["../sources/AgentSystemContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAQ1D;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"AgentSystemContext.d.ts","sourceRoot":"","sources":["../sources/AgentSystemContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAQ1D;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,QAAQ,SAAS,aAAa,EAC1D,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,GAChC,OAAO,CAET;AAED,mEAAmE;AACnE,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,cAAc,GAAG,SAAS,CAEpE"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createContextNamespace } from "@steve.kite/stdlib";
|
|
2
|
-
/** The context slot that carries the collection owning the current agent or
|
|
2
|
+
/** The context slot that carries the collection owning the current agent or module operation. */
|
|
3
3
|
const agentSystemNamespace = createContextNamespace("happyAgent.agentSystem", undefined);
|
|
4
4
|
/**
|
|
5
|
-
* Carry the collection that owns an agent and its
|
|
5
|
+
* Carry the collection that owns an agent and its modules, as a reference.
|
|
6
6
|
*
|
|
7
|
-
* Only the reference travels on a context. Everything that reads one — a
|
|
7
|
+
* Only the reference travels on a context. Everything that reads one — a module hook, a tool —
|
|
8
8
|
* is code some run loop is waiting for, while the owner's surface holds the operations that wait
|
|
9
9
|
* for a loop to reach a particular point. A collection therefore puts an `AgentSystemRef` on
|
|
10
10
|
* every context it derives, and agents come back from it as `AgentRef`, so nothing reached
|
|
@@ -13,7 +13,7 @@ const agentSystemNamespace = createContextNamespace("happyAgent.agentSystem", un
|
|
|
13
13
|
export function withAgentSystem(ctx, value) {
|
|
14
14
|
return agentSystemNamespace.set(ctx, value);
|
|
15
15
|
}
|
|
16
|
-
/** The collection owning the current
|
|
16
|
+
/** The collection owning the current module or agent operation. */
|
|
17
17
|
export function agentSystem(ctx) {
|
|
18
18
|
return agentSystemNamespace.get(ctx);
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentSystemContext.js","sourceRoot":"","sources":["../sources/AgentSystemContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAgB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"AgentSystemContext.js","sourceRoot":"","sources":["../sources/AgentSystemContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAgB,MAAM,oBAAoB,CAAC;AAK1E,iGAAiG;AACjG,MAAM,oBAAoB,GAAG,sBAAsB,CAC/C,wBAAwB,EACxB,SAAS,CACZ,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAC3B,GAAY,EACZ,KAA+B;IAE/B,OAAO,oBAAoB,CAAC,GAAG,CAAC,GAAG,EAAE,KAAkC,CAAC,CAAC;AAC7E,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,WAAW,CAAC,GAAY;IACpC,OAAO,oBAAoB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -2,22 +2,25 @@ import type { SessionUserMessage } from "@slopus/happy-providers";
|
|
|
2
2
|
import { type Context } from "@steve.kite/stdlib";
|
|
3
3
|
import { Agent } from "./Agent.js";
|
|
4
4
|
import { type AgentBaseAwaitOptions, type AgentBaseMessageOptions } from "./AgentBase.js";
|
|
5
|
+
import type { AgentDatabase } from "./AgentDatabase.js";
|
|
5
6
|
import { type AgentConfig } from "./AgentConfig.js";
|
|
6
|
-
import type {
|
|
7
|
+
import type { AgentModule } from "./AgentModule.js";
|
|
7
8
|
import { type AgentMetadata } from "./AgentMetadata.js";
|
|
9
|
+
import type { AgentMessageAcceptance } from "./AgentMessageAcceptance.js";
|
|
8
10
|
import type { AgentModel } from "./AgentModel.js";
|
|
9
11
|
import type { AgentProviders } from "./AgentProviders.js";
|
|
10
12
|
import type { AgentStorage } from "./AgentStorage.js";
|
|
11
13
|
import type { AgentCreateOptions, AgentSystem } from "./AgentSystem.js";
|
|
14
|
+
import type { AnyAgentTool } from "./AgentTool.js";
|
|
12
15
|
/** Everything `AgentSystemLocal` needs to build and run the agents in its collection. */
|
|
13
|
-
export interface AgentSystemLocalOptions {
|
|
16
|
+
export interface AgentSystemLocalOptions<Database extends AgentDatabase = AgentDatabase> {
|
|
14
17
|
/**
|
|
15
|
-
* The
|
|
18
|
+
* The modules every agent in this collection runs with, given as instances the caller has
|
|
16
19
|
* already built and ready to serve. One instance serves the whole collection: a hook is told
|
|
17
|
-
* which agent it is running for by the scope it is handed, so any per-agent state a
|
|
20
|
+
* which agent it is running for by the scope it is handed, so any per-agent state a module
|
|
18
21
|
* keeps in memory has to be keyed by that ID rather than held as a single value.
|
|
19
22
|
*/
|
|
20
|
-
readonly
|
|
23
|
+
readonly modules?: readonly AgentModule<AnyAgentTool, Database>[];
|
|
21
24
|
/** The registry providers are resolved from when an agent is built. */
|
|
22
25
|
readonly providers: AgentProviders;
|
|
23
26
|
/** The registry ID of the provider new agents are created with. */
|
|
@@ -31,13 +34,13 @@ export interface AgentSystemLocalOptions {
|
|
|
31
34
|
* failed load is forgotten so a later resolution can retry.
|
|
32
35
|
*
|
|
33
36
|
* Work serializes per agent rather than per collection: a collection-wide lock would make one
|
|
34
|
-
* agent's
|
|
37
|
+
* agent's module load block every other agent, including one that load itself resolves.
|
|
35
38
|
*
|
|
36
39
|
* This is the owner's handle, and some of what it offers waits for an agent to reach a point only
|
|
37
40
|
* that agent's run loop can bring it to. Hand an `AgentSystemRef` to anything running inside an
|
|
38
41
|
* agent instead.
|
|
39
42
|
*/
|
|
40
|
-
export declare class AgentSystemLocal implements AgentSystem {
|
|
43
|
+
export declare class AgentSystemLocal<Database extends AgentDatabase = AgentDatabase> implements AgentSystem<Database> {
|
|
41
44
|
#private;
|
|
42
45
|
/** The models this collection offers its agents. */
|
|
43
46
|
readonly models: readonly AgentModel[];
|
|
@@ -50,9 +53,9 @@ export declare class AgentSystemLocal implements AgentSystem {
|
|
|
50
53
|
* is resolved and resumed, so by the time this returns the collection is not merely built
|
|
51
54
|
* but running.
|
|
52
55
|
*/
|
|
53
|
-
static create(ctx: Context, storage: AgentStorage
|
|
56
|
+
static create<Database extends AgentDatabase>(ctx: Context, storage: AgentStorage<Database>, config: AgentSystemLocalOptions<Database>): Promise<AgentSystemLocal<Database>>;
|
|
54
57
|
/**
|
|
55
|
-
* Wire this collection to its storage, providers, and
|
|
58
|
+
* Wire this collection to its storage, providers, and module configuration, without reading
|
|
56
59
|
* any of it. Private: a collection is brought up by `create`, which also resumes the work
|
|
57
60
|
* the storage was left holding — building one without that is building half of it.
|
|
58
61
|
*/
|
|
@@ -68,12 +71,12 @@ export declare class AgentSystemLocal implements AgentSystem {
|
|
|
68
71
|
* it. Configuration and parentage are persisted before the agent runs, so every later process
|
|
69
72
|
* resolves the same agent; only its metadata may subsequently change.
|
|
70
73
|
*
|
|
71
|
-
* Nothing here is undone: an agent whose
|
|
74
|
+
* Nothing here is undone: an agent whose modules refuse to load leaves an identity that
|
|
72
75
|
* exists, is resolvable, and will be built the next time something wants it. Taking a
|
|
73
76
|
* provisional identity back after a failed build would add a compensation that can itself
|
|
74
77
|
* fail.
|
|
75
78
|
*/
|
|
76
|
-
create(ctx: Context, config: AgentConfig, options?: AgentCreateOptions): Promise<Agent
|
|
79
|
+
create(ctx: Context, config: AgentConfig, options?: AgentCreateOptions): Promise<Agent<AnyAgentTool, Database>>;
|
|
77
80
|
/**
|
|
78
81
|
* Close an agent and release its identity, so the same ID can be created again. Used to undo
|
|
79
82
|
* a creation whose follow-up work failed; an ID that was never created is left alone.
|
|
@@ -97,11 +100,11 @@ export declare class AgentSystemLocal implements AgentSystem {
|
|
|
97
100
|
* The live agent for an ID, loading and starting it if this process has not seen it yet.
|
|
98
101
|
* Concurrent resolutions of the same ID share one load.
|
|
99
102
|
*/
|
|
100
|
-
resolve(ctx: Context, agentId: string): Promise<Agent
|
|
103
|
+
resolve(ctx: Context, agentId: string): Promise<Agent<AnyAgentTool, Database>>;
|
|
101
104
|
/** Queue a steered message for an agent. */
|
|
102
|
-
steer(ctx: Context, agentId: string, message: SessionUserMessage, options?: AgentBaseMessageOptions & AgentBaseAwaitOptions): Promise<
|
|
105
|
+
steer(ctx: Context, agentId: string, message: SessionUserMessage, options?: AgentBaseMessageOptions & AgentBaseAwaitOptions): Promise<AgentMessageAcceptance>;
|
|
103
106
|
/** Queue a message for an agent. */
|
|
104
|
-
send(ctx: Context, agentId: string, message: SessionUserMessage, options?: AgentBaseMessageOptions & AgentBaseAwaitOptions): Promise<
|
|
107
|
+
send(ctx: Context, agentId: string, message: SessionUserMessage, options?: AgentBaseMessageOptions & AgentBaseAwaitOptions): Promise<AgentMessageAcceptance>;
|
|
105
108
|
/** Cancel an agent's active turn, leaving its queued messages durable for the next one. */
|
|
106
109
|
abort(ctx: Context, agentId: string, options?: AgentBaseAwaitOptions): Promise<void>;
|
|
107
110
|
/** Ask an agent for its conversation to be replaced by the provider's summary of it. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentSystemLocal.d.ts","sourceRoot":"","sources":["../sources/AgentSystemLocal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAkB,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAGlF,OAAO,
|
|
1
|
+
{"version":3,"file":"AgentSystemLocal.d.ts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